1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[16414],{6315:(e,t,r)=>{"use strict";r.d(t,{p:()=>o});var s=r(50979),a=r(25963),n=r(22990);let o=a.forwardRef((e,t)=>{let{className:r,type:a,...o}=e;return(0,s.jsx)("input",{type:a,className:(0,n.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...o})});o.displayName="Input"},23053:(e,t,r)=>{"use strict";r.d(t,{T:()=>s,i:()=>a});var s=function(e){return e.Exam="Exam",e.InterviewKit="InterviewKit",e.RegularCourse="RegularCourse",e}({}),a=function(e){return e.Article="Article",e.CloudSandboxLab="CloudSandboxLab",e.Lab="Lab",e.OpenEndedQuestion="OpenEndedQuestion",e.Quiz="Quiz",e.Video="Video",e}({})},25098:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSP:()=>rg,default:()=>rx});var s=r(50979),a=r(25963),n=r(30369),o=r(34838),l=r(85919),i=r(40093),c=r(24306),d=r(36607),u=r(40456),m=r(70875),h=r(32557),g=r(92918),x=r(25266),f=r(24900),p=r(46919),w=r(91996),b=r(19492),y=r(42527),v=r(33092),N=r(90815),j=r(65091);let k="instructor",S="add-article-course-item-to-course";"".concat(k,"-").concat(S);let P=e=>({context:{namespace:k,functionName:S},data:e}),q=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[P(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},I=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await q({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:P(r)}).then(e=>e)}},M=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await I({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},E="instructor",A="add-cloud-sandbox-course-item-to-course";"".concat(E,"-").concat(A);let C=e=>({context:{namespace:E,functionName:A},data:e}),L=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[C(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},T=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await L({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:C(r)}
1).then(e=>e)}},U=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await T({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},R="instructor",z="add-lab-course-item-to-course";"".concat(R,"-").concat(z);let D=e=>({context:{namespace:R,functionName:z},data:e}),O=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[D(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},_=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await O({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:D(r)}).then(e=>e)}},V=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await _({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},F="instructor",$="add-open-ended-question-course-item-to-course";"".concat(F,"-").concat($);let G=e=>({context:{namespace:F,functionName:$},data:e}),Q=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[G(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},H=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await Q({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:G(r)}).then(e=>e)}},B=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await H({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},W="instructor",Z="add-quiz-course-item-to-course";"".concat(W,"-").concat(Z);let Y=e=>({context:{namespace:W,functionName:Z},data:e}),K=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[Y(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or c
1ontact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},X=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await K({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:Y(r)}).then(e=>e)}},J=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await X({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},ee="instructor",et="add-video-course-item-to-course";"".concat(ee,"-").concat(et);let er=e=>({context:{namespace:ee,functionName:et},data:e}),es=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[er(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},ea=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await es({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:er(r)}).then(e=>e)}},en=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await ea({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},eo="instructor",el="get-all-course-items";"".concat(eo,"-").concat(el);let ei=e=>({context:{namespace:eo,functionName:el},data:e}),ec=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[ei(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},ed=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await ec({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:ei(r)}).then(e=>e)}},eu=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await ed({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},em="instructor",eh="save-course-curriculum";"".concat(em,"-").concat(eh);let eg=e=>({context:{namespace:em,functionName:eh},data:e}),ex=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[eg(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or c
1ontact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},ef=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await ex({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:eg(r)}).then(e=>e)}},ep=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await ef({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},ew="instructor",eb="delete-course-item";"".concat(ew,"-").concat(eb);let ey=e=>({context:{namespace:ew,functionName:eb},data:e}),ev=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[ey(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},eN=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await ev({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:ey(r)}).then(e=>e)}},ej=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await eN({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},ek="instructor",eS="change-course-item-publish-state";"".concat(ek,"-").concat(eS);let eP=e=>({context:{namespace:ek,functionName:eS},data:e}),eq=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[eP(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},eI=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await eq({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:eP(r)}).then(e=>e)}},eM=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await eI({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}};var eE=r(23053);async function eA(){let{courseSlug:e,sections:t}=eC.getState(),r=[];for(let e=0;e<t.length;e++){let s=t[e];for(let e=0;e<s.courseItems.length;e++){let t=s.courseItems[e],a={op:t.courseItemSlug.startsWith("temp_")?"new":"update",section:s.title,title:t.title,slug:t.courseItemSlug};r.push(a)}}let s=await ep({data:{order:r,courseSlug:e}});"ok"===s.status||console.error(s.errorMessage)}let eC=(0,w.vt)((e,t)=>({courseData:null,courseSlug:"",sections:[],async refetchCurriculumFromBackendAndStoreInZustand(t){let{courseSlug:r}=t,s=await eu({data:{courseSlug:r}});"ok"===s.status?e({sections:function(e){let t={},r=[];for(let s=0;s<e.length;s++){let a=e[s],n=a.sectionName;"number"==typeof t[n]?r[t[n]].courseItems.push(a):(t[n]=r.length,r.push({title:n,courseItems:[a]}))}return r}(s.data.courseItems)}):(0,h.A2)(s.errorMessage)},addNewSection(e){let{name:r,index:s}=e;return t().sections.some(e=>e.title===r)?{status:"error",error:"Section already exists"}:(t().writeProperty(e=>{let t=null!=s?s:e.sections.length;e.sections.splice(t,0,{title:r,courseItems:[]})}),{status:"ok"})},writeProperty:t=>{"function"==typeof t?e((0,b.j)(e=>{t(e)})):e(t)},async deleteCurrentItem(e){let{title:r,typeName:s}=e;if("yes"!==await (0,y.U)({title:"Delete ".concat(s,"?"),message:'Are you sure you want to delete "'.concat(r,'" (').concat(s,")?")}))return;let a=await ej({data:{courseSlug:t().courseSlug,courseItemSlug:e.courseItemSlug}});"ok"===a.status?(t().writeProperty(t=>{for(let r of t.sections)for(let t=0;t<r.courseItems.length;t++)if(r.courseItems[t].courseItemSlug===e.courseItemSlug){r.courseItems.splice(t,1);break}}),(0,h.v0)('"'.concat(r,'" ').concat(s," deleted successfully"))):(0,h.A2)(a.errorMessage)}
1,async addNewCourseItem(e){let r=null,s=0,a=t().sections;for(let t=0;t<a.length;t++){let n=a[t];if(s+=n.courseItems.length,n.title===e.sectionTitle){r=n;break}}if(!r)return;let n="Untitled ".concat(e.type),o=e.type===eE.i.Article?M:e.type===eE.i.CloudSandboxLab?U:e.type===eE.i.Lab?V:e.type===eE.i.OpenEndedQuestion?B:e.type===eE.i.Quiz?J:e.type===eE.i.Video?en:(0,m.cg)(e.type),l=await o({data:{courseSlug:t().courseSlug,title:n,customIndexPosition:s,sectionName:r.title}});"error"===l.status?(0,h.A2)(l.errorMessage):await t().refetchCurriculumFromBackendAndStoreInZustand({courseSlug:t().courseSlug})},async changePublishState(e){let r=await eM({data:{courseSlug:t().courseSlug,courseItemSlug:e.courseItemSlug,newState:e.newPublishStatus}});"error"===r.status?(0,h.A2)(r.errorMessage):await t().refetchCurriculumFromBackendAndStoreInZustand({courseSlug:t().courseSlug})}}));!m.p8&&m.tw&&(0,p.O)("CurriculumManagerStore",eC);var eL=r(21055),eT=r(29841),eU=r(57696),eR=r(23449),ez=r(26541),eD=r(33311),eO=r(371),e_=r(71577),eV=r(94285),eF=r(64679),e$=r(9182),eG=r(52614),eQ=function(e){return e.Deleted="Deleted",e.Draft="Draft",e.Published="Published",e}({}),eH=r(35935),eB=r(74723),eW=r(51677),eZ=r(34625),eY=r(91020);let eK="instructor",eX="get-private-lab-library",eJ="".concat(eK,"-").concat(eX),e0=e=>({context:{namespace:eK,functionName:eX},data:e}),e1=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[e0(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},e5=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await e1({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:e0(r)}).then(e=>e)}};var e2=r(9852);let e3=(e,t)=>{let r=(0,e2.hZ)(),s=(0,a.useMemo)(()=>new URL(r.requestUrl).hostname,[r.requestUrl]);return(0,eY.I)({queryKey:[eJ,e0(e)],queryFn:()=>e5({data:e,schoolHostname:s}),...null!=t?t:{}})};var e6=function(e){return e.Interactive="Interactive",e.Io="Io",e}({});let e4="instructor",e9="attach-lab-to-course-item";"".concat(e4,"-").concat(e9);let e8=e=>({context:{namespace:e4,functionName:e9},data:e}),e7=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[e8(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},te=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await e7({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:e8(r)}).then(e=>e)}},tt=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await te({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},tr="instructor",ts="delete-lab";"".concat(tr,"-").concat(ts);let ta=e=>({context:{namespace:tr,functionName:ts},data:e}),tn=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[ta(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or c
1ontact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},to=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await tn({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:ta(r)}).then(e=>e)}},tl=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await to({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},ti=e=>{let{dotslug:t}=e,[r,n]=(0,a.useState)(!1),[o,l]=(0,a.useState)({currentPageNumber:1,totalResults:0,pages:1}),[i,c]=(0,a.useState)(""),d=eC(e=>e.courseSlug),u=eC(e=>e.refetchCurriculumFromBackendAndStoreInZustand),{refetch:g,isLoading:x,data:p}=e3({limit:10,pageNumber:o.currentPageNumber}),[w,v]=(0,a.useState)(null),[N,j]=(0,a.useState)(null);async function k(r){n(!0);let s=await tt({data:{labId:r,courseItemSlug:t,courseSlug:d}});"error"===s.status?(0,h.A2)(s.errorMessage):(e.closeModal(),await u({courseSlug:d}),(0,h.v0)("Lab linked successfully"),n(!1))}async function S(e){if("yes"!==await (0,y.U)({title:"Delete Lab",message:"Are you sure you want to delete this lab? This action is irreversible"}))return;n(!0);let t=await tl({data:{labId:e}});"error"===t.status?(0,h.A2)(t.errorMessage):(v([]),l(e=>({...e,currentPageNumber:1})),await g(),n(!1),(0,h.v0)("Lab removed successfully"))}return(0,a.useEffect)(()=>{if(null==p)return;let e=p.paginationMeta;v(e=>[...(null==e?void 0:e.length)?e:[],...p.labs.map(e=>{if(e)return{uniqueId:e.uniqueId,slug:e.slug,codingLabType:e.codingLabType,title:e.title,createdAt:e.createdAt}}).filter(eZ.Wo)]),l({currentPageNumber:e.page,totalResults:e.totalResults,pages:e.pages})},[p]),(0,a.useEffect)(()=>{j(w)},[w]),(0,s.jsxs)("div",{className:"mx-auto flex max-w-[1800px] flex-col gap-6 px-6 lg:px-8",children:[(0,s.jsxs)("div",{className:"mt-4 text-center",children:[(0,s.jsx)(f.XUx,{className:"mx-auto h-12 w-12 text-gray-400"}),(0,s.jsx)("h2",{className:"mt-2 text-lg font-medium text-gray-900",children:"Create a new lab"}),(0,s.jsxs)("div",{className:"mt-1 flex flex-col gap-2 text-sm text-gray-500",children:[(0,s.jsxs)("p",{children:["Add a quick title to create your lab. You will be able to edit your lab details after."," "]}),(0,s.jsx)("p",{children:"You can also pick an existing lab from a curated set of challenges. "}),(0,s.jsx)("a",{href:"https://teach.codedamn.com",target:"_blank",className:"underline",rel:"noreferrer",children:"Read the guide to know more"})]})]}),(0,s.jsxs)("form",{action:"#",className:"flex w-full flex-col items-center gap-3 md:flex-row md:gap-0",children:[(0,s.jsx)("label",{htmlFor:"text",className:"sr-only",children:"Lab Title"}),(0,s.jsx)("input",{type:"text",name:"text",id:"text","data-testid":"new-lab-title",value:i,onChange:e=>c(e.target.value),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 disabled:cursor-wait disabled:opacity-50 sm:text-sm",placeholder:"Enter a lab title, like: Write the best Java program"}),(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{className:"text-xs",children:"Best suited for web development, backend and frontend challenges."}),placement:"bottom",delay:0,children:(0,s.jsx)("button",{type:"submit","data-testid":"create-interactive-lab-btn",className:"w-full flex-shrink-0 cursor-pointer rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-wait disabled:opacity-50 md:ml-4 md:w-fit",children:"Create Interactive Lab"})}),(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{className:"text-xs",children:"Best suited for DSA/Competitive Coding questions with input-output checking"}),placement:"bottom",delay:0,children:(0,s.jsx)("button",{type:"submit",className:"w-full flex-shrink-0 cursor-pointer rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-wait disabled:opacity-50 md:ml-4 md:w-fit",children:"Create I/O Lab"})})]}),null===N||0===N.length&&x?(0,s.jsx)("div",{className:"flex h-screen w-full items-center justify-center",children:(0,s.jsx)(eV.A,{})}):null,(null==N?void 0:N.length)!==0||x?null:(0,s.jsxs)("div",{className:"mt-6 flex h-96 flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-gray-500 bg-white/50 text-gray-600",children:[(0,s.jsx)(eH.iOI,{className:"h-14 w-14"}),(0,s.jsx)("h1",{className:"text-center",children:"No labs created"}),(0,s.jsx)("div",{className:"flex items-center gap-3",children:(0,s.jsxs)("a",{href:"https://teach.codedamn.com/docs",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-indigo-600 px-3 py-2 text-sm font-medium leading-4 text-indigo-600 shadow-sm hover:bg-indigo-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",children:[(0,s.jsx)(f.Kf6,{}),"Read the guide"]})})]}),N&&N.length>0&&(0,s.jsx)("div",{className:"min-h-[40vh] w-full ring-1 ring-gray-300 sm:-mx-6 md:mx-0 md:rounded-lg",children:(0,s.jsxs)("table",{className:"mx-auto min-w-full divide-y divide-gray-300",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6",children:"Title"}),(0,s.jsx)("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell",children:"Created"}),(0,s.jsx)("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell",children:"Lab Type"}),(0,s.jsx)("th",{scope:"col",className:"relative py-3.5 pl-3 pr-4 text-center text-gray-900 sm:pr-6",children:"Actions"})]})}),(0,s.jsx)("tbody",{children:N.map((e,t)=>{let a=(0,eB.Ay)(e.createdAt).toDate(),n=Date.now()-a.getTime()<72e6;return(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{className:(0,m.xW)(0===t?"":"border-t border-transparent","relative py-4 pl-4 pr-3 text-sm sm:pl-6"),children:[(0,s.jsxs)("div",{className:"font-medium text-gray-900",children:[e.title," ",n?(0,s.jsx)("span",{className:"inline-flex items-center rounded-full bg-yellow-100 px-2.5 py-0.5 text-xs font-medium text-yellow-800",children:"New"}):null]}),0!==t?(0,s.jsx)("div",{className:"absolute -top-px left-6 right-0 h-px bg-gray-200"}):null]}),(0,s.jsx)("td",{className:(0,m.xW)(0===t?"":"border-t border-gray-200","hidden px-3 py-3.5 text-sm text-gray-500 lg:table-cell"),children:(0,eB.Ay)(a).format("D MMMM YYYY")}),(0,s.jsx)("td",{className:(0,m.xW)(0===t?"":"border-t border-gray-200","hidden px-3 py-3.5 text-sm text-gray-500 lg:table-cell"),children:e.codingLabType===e6.Io?(0,s.jsx)("span",{className:"inline-flex items-center rounded-full bg-sky-100 px-2.5 py-0.5 text-xs font-medium text-sky-800",children:"I/O"}):(0,s.jsx)("span",{className:"inline-flex items-center rounded-full bg-sky-100 px-2.5 py-0.5 text-xs font-medium text-sky-800",children:"Interactive"})}),(0,s.jsxs)("td",{className:(0,m.xW)(0===t?"":"border-t border-transparent","relative flex items-center justify-center gap-3 py-3.5 pl-3 pr-4 text-right text-sm font-medium sm:pr-6"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-1",children:[(0,s.jsx)("button",{type:"button","data-testid":"btn-link-lab",disabled:r,className:"inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>{k(e.uniqueId).catch(console.error)},children:"Link"}),(0,s.jsx)("button",{type:"button","data-testid":"btn-edit-lab",disabled:r,className:"inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>
1{window.open("/instructor/edit-lab/".concat(e.slug,"/lab-details"),"_blank")},children:"Edit"}),(0,s.jsx)("button",{type:"button",disabled:r,"data-testid":"btn-delete-lab",className:"inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>{S(e.uniqueId).catch(console.error)},children:"Delete"})]}),0!==t?(0,s.jsx)("div",{className:"absolute -top-px left-0 right-6 h-px bg-gray-200"}):null]})]},e.uniqueId)})})]})}),N&&N.length>0&&o.pages!==o.currentPageNumber?(0,s.jsx)("div",{className:"flex w-full justify-end",children:(0,s.jsxs)(eW.$,{variant:"outline",className:"ml-full",disabled:x||o.pages===o.currentPageNumber,onClick:()=>{l((0,b.j)(e=>{e.currentPageNumber=Math.ceil(N.length/10)+1}))},children:[" ","Show More"]})}):null]})};var tc=r(70983);let td="instructor",tu="update-course-article-item";"".concat(td,"-").concat(tu);let tm=e=>({context:{namespace:td,functionName:tu},data:e}),th=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[tm(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},tg=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await th({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:tm(r)}).then(e=>e)}},tx=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await tg({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},tf=e=>{let{state:t}=e,r=eC(e=>e.courseSlug),n=eC(e=>e.refetchCurriculumFromBackendAndStoreInZustand),[o,l]=(0,a.useState)(!1),[i,c]=(0,a.useState)(t.title),[d,u]=(0,a.useState)(t.markdownArticleContent);async function m(){l(!0);let e=await tx({data:{title:i,markdown:d,courseSlug:r,articleId:t.articleUniqueId}});"ok"===e.status?(i!==t.title&&n({courseSlug:r}),(0,h.v0)("Article saved")):(0,h.A2)(e.errorMessage),l(!1)}return(0,s.jsxs)("div",{className:"mx-auto max-w-[1800px] px-6 lg:px-8",children:[(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)("label",{htmlFor:"articleTitle",className:"block text-sm font-medium text-gray-700",children:"Title"}),(0,s.jsx)("div",{className:"mt-1",children:(0,s.jsx)("input",{type:"text",name:"title",id:"articleTitle",className:"block w-full rounded-md border-gray-300 text-gray-900 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm",placeholder:"My amazing article powered by markdown....",value:i,onChange:e=>c(e.target.value)})})]}),(0,s.jsx)("div",{className:"mt-8",children:(0,s.jsx)(tc.MarkdownEditor,{value:d,onChange:e=>u(e),uploadImage:!0,placeholder:"Add text, code and images for rich articles. [markdown supported]"})}),(0,s.jsx)("div",{className:"my-4 flex flex-col items-end",children:(0,s.jsx)("button",{id:"saveArticle",type:"button",className:"inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-wait disabled:opacity-50",onClick:()=>
1{m().catch(e=>console.error(e))},disabled:o,children:"Save Changes"})})]})};var tp=r(18367),tw=r.n(tp),tb=r(83798),ty=r(19798);let tv="instructor",tN="update-video-item";"".concat(tv,"-").concat(tN);let tj=e=>({context:{namespace:tv,functionName:tN},data:e}),tk=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[tj(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},tS=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await tk({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:tj(r)}).then(e=>e)}},tP=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await tS({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},tq="instructor",tI="attach-video-to-course-item";"".concat(tq,"-").concat(tI);let tM=e=>({context:{namespace:tq,functionName:tI},data:e}),tE=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[tM(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},tA=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await tE({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:tM(r)}).then(e=>e)}},tC=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await tA({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},tL="instructor",tT="unlink-video-from-course-item";"".concat(tL,"-").concat(tT);let tU=e=>({context:{namespace:tL,functionName:tT},data:e}),tR=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[tU(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or c
1ontact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},tz=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await tR({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:tU(r)}).then(e=>e)}},tD=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await tz({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},tO=tw()(()=>Promise.resolve().then(r.bind(r,70983)).then(e=>e.MarkdownEditor),{loadableGenerated:{webpack:()=>[70983]},ssr:!1}),t_=e=>{var t,r,n,o,l,i;let{dotslug:c,refetchMe:d}=e,u=eC(e=>e.courseSlug),m=eC(e=>e.refetchCurriculumFromBackendAndStoreInZustand),[g,x]=(0,a.useState)(!1),[f,p]=(0,a.useState)(e.state),[w,y]=(0,a.useState)(!1);async function v(){var t;y(!0);let r=await tP({data:{courseSlug:u,courseItemSlug:c,title:f.title,description:null!=(t=f.description)?t:""}});"ok"===r.status?((0,h.v0)("Video details updated"),f.title!==e.state.title&&await m({courseSlug:u})):(0,h.A2)(r.errorMessage),y(!1)}async function N(e){let t=await tC({data:{videoId:e,courseSlug:u,courseItemSlug:c}});"error"===t.status?(0,h.A2)(t.errorMessage):(d().catch(e=>console.log(e)),m({courseSlug:u}),(0,h.v0)("Video linked successfully"),x(!1))}async function j(){let e=await tD({data:{courseSlug:u,courseItemSlug:c}});"error"===e.status?(0,h.A2)(e.errorMessage):(d().catch(e=>console.log(e)),m({courseSlug:u}),(0,h.v0)("Video unlinked successfully"))}let k=(null==(t=f.signedVideos.at(0))?void 0:t.src)==null;return(0,s.jsxs)("div",{className:"mx-auto max-w-[1800px] px-6 lg:px-8",children:[(0,s.jsxs)("div",{className:"mt-6 grid grid-cols-5 gap-6",children:[(0,s.jsxs)("div",{className:"col-span-5 flex flex-col gap-6 md:col-span-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700",children:"Title"}),(0,s.jsx)("div",{className:"mt-1",children:(0,s.jsx)("input",{type:"text",name:"title",id:"title",className:"block w-full rounded-md border-gray-300 text-gray-900 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm",placeholder:"Title of the video",value:f.title,onChange:e=>p((0,b.j)(t=>{t.title=e.target.value}))})})]}),(0,s.jsx)(tO,{id:"video-description-MDE",label:"Description (optional)",placeholder:"Write show notes related to this video",value:null!=(l=f.description)?l:"",onChange:e=>p((0,b.j)(t=>{t.description=e}))}),(0,s.jsx)("div",{className:"flex w-full flex-col items-end",children:(0,s.jsx)("button",{onClick:()=>{v().catch(e=>console.error(e))},disabled:w,type:"button",className:"inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-wait disabled:opacity-50",children:"Save Edits"})})]}),(0,s.jsx)("div",{className:"col-span-5 flex flex-col gap-6 md:col-span-2",children:(0,s.jsxs)("div",{className:"rounded-md border border-gray-300 bg-white",children:[k?(0,s.jsx)(tb.A,{src:"https://dummyimage.com/640x360",width:640,height:360,className:"aspect-[16/9] h-auto w-full rounded-md",alt:"Video Missing"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("video",{controls:!0,width:640,height:360,className:"aspect-[16/9] h-auto w-full rounded border",children:[(0,s.jsx)("source",{src:null!=(i=null==(r=f.signedVideos.at(0))?void 0:r.src)?i:"https://cdn.plyr.io/static/blank.mp4",type:"video/mp4"}),f.signedCaptions.map(e=>(0,s.jsx)("track",{kind:"subtitles",src:null==e?void 0:e.src,lang:null==e?void 0:e.language,label:null==e?void 0:e.label},null==e?void 0:e.language))]}),(0,s.jsxs)("p",{className:"ml-0.5 mt-4 px-4",children:[(0,s.jsx)("b",{children:"Title:\xa0"})," ",null==(o=f.signedVideos.at(0))||null==(n=o.src)?void 0:n.split("?")[0].split("/").slice(-1)[0]]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-center gap-3 p-4",children:[(0,s.jsx)("button",{type:"button",className:"inline-flex w-full items-center justify-center rounded-md border border-gray-600 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2",onClick:function(){x(!0)},children:k?"Add a video":"Change video"}),e.publishStatus!==eQ.Published&&(0,s.jsx)("button",{disabled:k,type:"button",className:"inline-flex w-full items-center justify-center rounded-md border border-red-500 bg-white px-3 py-2 text-sm font-medium leading-4 text-red-700 shadow-sm hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>{j().catch(e=>console.error(e))},children:"Unlink video"})]})]})})]}),g&&(0,s.jsx)(ty.A,{closeLibrary:()=>x(!1),onVideoSelect:e=>{N(e).catch(e=>console.error(e))}})]})},tV="instructor",tF="get-all-course-item-resource",t$="".concat(tV,"-").concat(tF),tG=e=>({context:{namespace:tV,functionName:tF},data:e}),tQ=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[tG(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or c
1ontact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},tH=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await tQ({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:tG(r)}).then(e=>e)}},tB=(e,t)=>{let r=(0,e2.hZ)(),s=(0,a.useMemo)(()=>new URL(r.requestUrl).hostname,[r.requestUrl]);return(0,eY.I)({queryKey:[t$,tG(e)],queryFn:()=>tH({data:e,schoolHostname:s}),...null!=t?t:{}})};var tW=r(75800);let tZ="instructor",tY="store-course-item-resource";"".concat(tZ,"-").concat(tY);let tK=e=>({context:{namespace:tZ,functionName:tY},data:e}),tX=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[tK(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},tJ=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await tX({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:tK(r)}).then(e=>e)}},t0=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await tJ({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}};var t1=r(6315),t5=r(47461);let t2="instructor",t3="get-details-to-upload-course-item-resource";"".concat(t2,"-").concat(t3);let t6=e=>({context:{namespace:t2,functionName:t3},data:e}),t4=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[t6(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},t9=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await t4({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:t6(r)}).then(e=>e)}},t8=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await t9({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}},t7=()=>{let[e,t]=(0,a.useState)(!1),r=(0,a.useCallback)(async e=>{let{inputElement:r}=e;t(!0),(0,h.W7)("Uploading file... Please wait.");try{var s,a;let e=r.target.files?r.target.files[0]:null;(0,e$.V)(e,"No file selected!");let n=e.name.split("."),o=(null==n||null==(a=n[(null==n?void 0:n.length)-2])||null==(s=a.split("/"))?void 0:s.pop())||Date.now().toString(),l=n.pop();(0,e$.V)(l,"No file extension?");let i=await t8({data:{fileName:o,fileExtension:l}});if("error"===i.status)throw Error(i.errorMessage);{let r=await fetch(i.data.signedS3PutUrl,{method:"PUT",body:e,headers:{"Content-Type":t5.lookup(l)||"text/plain"}});if(200!==r.status){console.error(r);let e=await r.text();throw Error(e)}return(0,h.v0)("File uploaded successfully!"),t(!1),{isSuccess:!0,s3Details:i.data,fileName:o}}}catch(e){return(0,h.A2)((null==e?void 0:e.message)||"Something went wrong with your upload. Please try again or c
1ontact support."),t(!1),{isSuccess:!1}}},[]);return(0,a.useMemo)(()=>({uploadFileToS3:r,isUploadingFileToS3:e}),[e,r])},re="instructor",rt="toggle-course-item-monetization-status";"".concat(re,"-").concat(rt);let rr=e=>({context:{namespace:re,functionName:rt},data:e}),rs=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:a,fermionSchoolId:n}=e;try{t=await v.Ay.request({method:"POST",baseURL:(0,N.Pb)(),data:{fermionSchoolId:n,authToken:s,fermionAuthTokenForCodedamn:r,data:[rr(a)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},ra=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,n=s||(0,m.G0)()||null,o=(0,j.wx)({schoolHostname:t})||null,l=(0,m.$q)()||null;if(!a)return await rs({fermionAuthTokenForCodedamn:l,fermionSchoolId:o,data:r,authToken:n});{let e=(0,N.zL)(r);return await N.l3.fetch({batchingUniqueKey:e,fermionSchoolId:o,authToken:n,fermionAuthTokenForCodedamn:l,data:rr(r)}).then(e=>e)}},rn=async e=>{let{data:t,forceOverrideAuthToken:r,shouldEnableBatching:s=!0,forceOverrideSchoolHostname:a}=e;try{let e;if(null!=a)e=a;else if("undefined"!=typeof document)e=window.location.hostname;else throw Error("Unable to figure out schoolHostname which is required to get config. Please make sure the API functions are called properly on server side");let n=await ra({data:t,shouldEnableBatching:s,forceOverrideAuthToken:r,schoolHostname:e});return{status:"ok",data:n}}catch(e){return{status:"error",errorMessage:(0,N._R)(e).errorMessage}}};function ro(e,t){var r;let s=t.find(t=>t.title===e);return null!=(r=null==s?void 0:s.courseItems)?r:[]}let rl=(e,t,r)=>{let s=Array.from(e);if(s.length<=t||s.length<=r)return s;let[a]=s.splice(t,1);return s.splice(r,0,a),s},ri=(e,t,r,s)=>{let a=Array.from(e),n=Array.from(t),[o]=a.splice(r.index,1);return n.splice(s.index,0,o),[a,n]},rc=e=>{let{courseItemSlug:t}=e,[r,n]=(0,a.useState)(!1),{uploadFileToS3:o}=t7(),l=tB({courseItemSlug:t});return l.data?(0,s.jsxs)("div",{className:"w-full flex flex-col px-6 py-4",children:[(0,s.jsx)("p",{children:"You can attach resources like PDF, code files, or any other asset that could help leaners with your lesson. It will be made available to learners to download on their own computer."}),0===l.data.resources.length?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"mt-4 font-medium",children:"Resources for the lecture added by you:"}),l.data.resources.map((e,t)=>(0,s.jsx)("div",{className:"ml-2 mt-2",children:(0,s.jsxs)(tW.N_,{unsafeHref:e.downloadLink,target:"_blank",className:"hover:underline",rel:"noreferrer",children:[t+1,". ",e.name]})},e.courseItemResourceId))]}),(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)("p",{className:"font-medium",children:"Upload a new resource"}),(0,s.jsx)("div",{className:"max-w-sm",children:(0,s.jsx)(t1.p,{type:"file",className:"mt-2",disabled:r,value:void 0,onChange:e=>{n(!0),o({inputElement:e}).then(async r=>{if(!r.isSuccess)return(0,h.A2)("Something went wrong! Please try again or contact support!");await t0({data:{courseItemSlug:t,resourceName:r.fileName,resourceEncodedS3Details:r.s3Details.encodedS3Details}}),await l.refetch(),null!=e.target&&(e.target.value="")}).catch(e=>{(0,h.A2)((null==e?void 0:e.message)||"Something went wrong! Please try again or contact support!")}).finally(()=>n(!1))}})})]})]}):(0,s.jsx)("div",{className:"h-full w-full flex justify-center items-center",children:(0,s.jsx)(eV.A,{})})},rd=e=>{let{item:t,sectionIndex:r}=e,o=eC(e=>e.courseSlug),l=eC(e=>e.deleteCurrentItem),i=eC(e=>e.changePublishState),c=eC(e=>e.refetchCurriculumFromBackendAndStoreInZustand);async function d(){let e=await rn({data:{courseSlug:o,courseItemSlug:t.courseItemSlug}});"error"===e.status?(0,h.A2)(e.errorMessage):await c({courseSlug:o})}let u="",x=(0,s.jsx)(s.Fragment,{});t.type===eE.i.Video?(u="Video",x=(0,s.jsx)("span",{className:"rounded bg-red-100 px-2 py-0.5 text-xs font-semibold text-red-800",children:"Video"})):t.type===eE.i.Lab&&(u="Lab",null!=t.linkedCodingLabData&&(x=t.linkedCodingLabData.labType===e6.Io?(0,s.jsx)("span",{className:"rounded bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-800",children:"I/O Lab"}):(0,s.jsx)("span",{className:"rounded bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-800",children:"Lab"}
1))),t.type===eE.i.Quiz&&(u="Quiz",x=(0,s.jsx)("span",{className:"rounded bg-pink-100 px-2 py-0.5 text-xs font-semibold text-pink-800",children:"Quiz"})),t.type===eE.i.Article&&(u="Article",x=(0,s.jsx)("span",{className:"rounded bg-yellow-100 px-2 py-0.5 text-xs font-semibold text-yellow-800",children:"Article"})),t.type===eE.i.CloudSandboxLab&&(u="Cloud Sandbox",x=(0,s.jsx)("span",{className:"rounded bg-fuchsia-100 px-2 py-0.5 text-xs font-semibold text-fuchsia-800",children:"Cloud Sandbox"})),t.type===eE.i.OpenEndedQuestion&&(u="Open Ended Question",x=(0,s.jsx)("span",{className:"rounded bg-fuchsia-100 px-2 py-0.5 text-xs font-semibold text-amber-800",children:"Open Ended Question"}));let[p,w]=(0,a.useState)(null),[b,y]=(0,a.useState)(null),{data:v,refetch:N,isFetching:j}=(0,eF.O)({courseItemSlug:String(p),courseSlug:o,requestType:{type:"for-instructor",isRequestingAsInstructorOfCourse:!0}},{enabled:null!=p&&""!==p}),k=null!=p,S=(null==v?void 0:v.response.status)!=="for-instructor"?null:v.response.data.courseItemData,P="Lab"===t.type&&null!=t.linkedCodingLabData||"Quiz"===t.type&&null!=t.linkedQuizId||"Video"===t.type&&t.isVideoAttached||"Article"===t.type||"Quiz"===t.type||"CloudSandboxLab"===t.type;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g.sx,{index:r,draggableId:t.courseItemSlug,children:e=>(0,s.jsx)("div",{ref:e.innerRef,...e.draggableProps,...e.dragHandleProps,className:"mb-4",children:(0,s.jsxs)("div",{className:"shadow-xs my-5 flex w-full cursor-move flex-col items-center justify-between gap-4 space-x-4 rounded-md border border-gray-300 p-3 text-sm text-black shadow-gray-200 hover:bg-gray-50 sm:flex-row sm:gap-0",children:[(0,s.jsxs)("div",{className:"flex w-full flex-1 flex-shrink-0 items-center space-x-3",children:[(0,s.jsx)(e_.LUV,{className:"h-8 w-6 text-gray-600 hover:text-gray-800"}),x,(0,s.jsxs)("div",{className:"flex items-center space-x-2","data-testid":"item-title-".concat(r+1),children:[(0,s.jsx)("span",{className:"font-medium",children:t.title}),(0,s.jsxs)("div",{className:"hidden sm:flex gap-2",children:[t.status===eQ.Draft?(0,s.jsxs)("span",{className:"flex items-center gap-1 rounded bg-indigo-100 px-1.5 py-0.5 text-xs text-indigo-800",children:[(0,s.jsx)(f.jDV,{className:"-mt-px"}),"Draft"]}):(0,s.jsxs)("span",{className:"flex items-center gap-1 rounded bg-green-800 px-1.5 py-0.5 text-xs text-white",children:[(0,s.jsx)(f.L7X,{}),"Published"]}),P?(0,s.jsxs)("span",{className:"flex items-center gap-1 rounded bg-red-100 px-1.5 py-0.5 text-xs text-red-800",children:[(0,s.jsx)(e_.DD1,{className:"-mt-px"}),"Unlinked"]}):null]})]})]}),P?(0,s.jsx)("div",{className:"flex w-full items-center justify-between space-x-2 sm:w-fit",children:(0,s.jsx)("button",{type:"button",className:"inline-flex w-full items-center justify-center rounded border border-transparent bg-gray-800 px-3 py-1.5 text-sm font-medium leading-4 text-white shadow-sm hover:bg-gray-900 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:opacity-40 sm:w-fit",onClick:()=>{i({courseItemSlug:t.courseItemSlug,newPublishStatus:t.status===eQ.Draft?eQ.Published:eQ.Draft}).catch(e=>console.error(e))},children:t.status===eQ.Draft?"Publish item":"Convert to draft"})}):null,(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{children:P?"Unlinked items cannot be monetized":t.status===eQ.Draft?"Cannot toggle monetization on draft items":t.isFree?"Monetization disabled":"Monetization enabled"}),children:(0,s.jsx)("div",{title:"tooltip",tabIndex:0,children:(0,s.jsx)("button",{disabled:!P||t.status===eQ.Draft,className:"".concat(P?t.isFree?"border border-gray-400 text-gray-600 hover:bg-gray-200":"border border-green-600 text-green-600 hover:bg-green-50":"border border-gray-300 text-gray-400"," flex h-8 w-8 cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed disabled:opacity-40"),onClick:()=>{d().catch(e=>console.error(e))},children:t.isFree?(0,s.jsx)(e_.dQG,{className:"text-xl"}):(0,s.jsx)(e_.H4F,{className:"text-xl"})})})})}),(0,s.jsx)("div",{className:"flex",children:(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{children:"Manage resources"}),children:(0,s.jsx)("div",{children:(0,s.jsx)("button",{onClick:()=>{y(t.courseItemSlug)},"data-testid":"manage-item-resource-btn-".concat(r+1),className:"inline-flex shrink-0 cursor-pointer items-center rounded-full border border-indigo-600 p-2 text-xs font-medium text-indigo-600 hover:bg-indigo-50 disabled:cursor-not-allowed disabled:opacity-40",children:(0,s.jsx)(eG.LFT,{className:"h-3.5 w-3.5"})})})})}),(0,s.jsx)("div",{className:"flex",children:(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{children:"Edit Item"}),children:(0,s.jsx)("div",{children:(0,s.jsx)("button",{onClick:()=>
1{!function(e){t.type===eE.i.Quiz?window.open("/instructor/edit-quiz/".concat(o,"/").concat(e,"/quiz-details"),"_blank"):t.type===eE.i.Lab?null==t.linkedCodingLabData?w(e):window.open("/instructor/edit-lab/".concat(t.linkedCodingLabData.slug,"/lab-details")):t.type===eE.i.CloudSandboxLab?window.open("/instructor/edit-cloud-sandbox/".concat(t.courseItemSlug,"/sandbox-details")):t.type===eE.i.Article||t.type===eE.i.Video||t.type===eE.i.OpenEndedQuestion?w(e):(0,m.cg)(t.type)}(t.courseItemSlug)},"data-testid":"edit-item-btn-".concat(r+1),className:"inline-flex shrink-0 cursor-pointer items-center rounded-full border border-indigo-600 p-2 text-xs font-medium text-indigo-600 hover:bg-indigo-50 disabled:cursor-not-allowed disabled:opacity-40",children:(0,s.jsx)(eO.rnS,{className:"h-3.5 w-3.5"})})})})}),t.status===eQ.Draft&&(0,s.jsx)("div",{children:(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{children:"Delete Item"}),children:(0,s.jsx)("button",{"data-testid":"delete-item-btn-".concat(r+1),onClick:()=>{l({title:t.title,typeName:u,courseItemSlug:t.courseItemSlug}).catch(e=>console.error(e))},className:"inline-flex shrink-0 cursor-pointer items-center rounded-full border border-red-600 p-2 text-xs font-medium text-red-600 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-40",children:(0,s.jsx)(eO.WeY,{className:"h-3.5 w-3.5"})})})}),(0,s.jsxs)("div",{className:"flex sm:hidden",children:[t.status===eQ.Draft?(0,s.jsxs)("span",{className:"flex items-center gap-1 rounded bg-indigo-100 px-1.5 py-0.5 text-xs text-indigo-800",children:[(0,s.jsx)(f.jDV,{className:"-mt-px"}),"Draft"]}):(0,s.jsxs)("span",{className:"flex items-center gap-1 rounded bg-green-800 px-1.5 py-0.5 text-xs text-white",children:[(0,s.jsx)(f.L7X,{}),"Published"]}),P?null:(0,s.jsxs)("span",{className:"flex items-center gap-1 rounded bg-red-100 px-1.5 py-0.5 text-xs text-red-800",children:[(0,s.jsx)(e_.DD1,{className:"-mt-px"}),"Unlinked"]})]})]})]})})},t.courseItemSlug),(0,s.jsx)(eU.j,{isOpen:k,onClose:()=>{},className:"mx-2 my-8 max-w-5xl bg-white pb-6 text-black sm:mx-auto",children:(0,s.jsxs)("div",{className:"w-full h-[90vh] overflow-y-hidden flex flex-col",children:[(0,s.jsxs)("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-gray-200 bg-white p-4 sm:px-6",children:[(0,s.jsx)("h3",{className:"text-lg font-bold leading-6 text-gray-900 md:text-xl",children:(null==S?void 0:S.type)!=null?(0,n.kq)(S.type).cleanName:"Course item"}),(0,s.jsx)(f.zhF,{onClick:()=>w(null),className:"shrink-0 cursor-pointer text-gray-600 hover:text-black","data-testid":"close-modal"})]}),(0,s.jsx)("div",{className:"overflow-y-auto flex-grow",children:(e=>{if(j||!p)return(0,s.jsx)("div",{className:"flex items-center justify-center py-24",children:(0,s.jsx)(eV.A,{})});switch(t.type){case eE.i.Video:return(0,e$.V)((null==S?void 0:S.type)==="Video"),(0,s.jsx)(t_,{state:S,isEditMode:!0,dotslug:p,refetchMe:async()=>{await N()},publishStatus:e});case eE.i.Lab:if(null==S)return(0,s.jsx)(ti,{dotslug:p,refetchMe:async()=>{await N()},closeModal:()=>{w(null)}});return null;case eE.i.CloudSandboxLab:return(0,s.jsx)("p",{children:"Cloudsandbox Lab - Unsupported"});case eE.i.Article:return(0,e$.V)((null==S?void 0:S.type)==="Article"),(0,s.jsx)(tf,{state:S,closeModal:()=>{w(null)}});case eE.i.OpenEndedQuestion:return(0,e$.V)((null==S?void 0:S.type)==="OpenEndedQuestion"),(0,s.jsx)("p",{children:"Unsupported"})}})(t.status)})]})}),(0,s.jsx)(eU.j,{isOpen:!!b,onClose:()=>{},className:"mx-2 my-8 max-w-5xl bg-white pb-6 text-black sm:mx-auto",children:(0,s.jsxs)("div",{className:"w-full h-[90vh] overflow-y-hidden flex flex-col",children:[(0,s.jsxs)("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-gray-200 bg-white p-4 sm:px-6",children:[(0,s.jsxs)("h3",{className:"text-lg font-bold leading-6 text-gray-900 md:text-xl",children:["Manage resources -"," ",(null==S?void 0:S.type)!=null?(0,n.kq)(S.type).cleanName:"Course item"]}),(0,s.jsx)(f.zhF,{onClick:()=>y(null),className:"shrink-0 cursor-pointer text-gray-600 hover:text-black","data-testid":"close-modal"})]}),(0,s.jsx)("div",{className:"overflow-y-auto flex-grow",children:(0,s.jsx)(rc,{courseItemSlug:t.courseItemSlug})})]})})]})},ru=e=>{let{setCollapsed:t,sectionIndex:r,collapsed:n,rawTitle:o,title:l}=e,{register:i,handleSubmit:c,formState:{errors:d}}=(0,x.mN)({defaultValues:{sectionName:o}}),u=eC(e=>e.sections),m=eC(e=>e.writeProperty),[g,p]=(0,a.useState)(!1);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-5 flex cursor-pointer items-center gap-2 md:flex-row",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("h1",{className:"flex items-center text-lg font-bold",onClick:()=>t(e=>!e),children:l}),n?(0,s.jsx)(ez.mlL,{className:"delay-50 h-8 w-8 translate-y-0.5 text-black transition duration-300 ease-in-out",onClick:()=>t(e=>!e)}):(0,s.jsx)(ez.mlL,{className:"delay-50 h-8 w-8 rotate-180 transform text-black transition duration-300 ease-in-out",onClick:()=>t(e=>!e)})]}),(0,s.jsx)("div",{className:"grow"}),(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{children:"Rename Section"}),children:(0,s.jsx)("button",{"data-testid":"rename-section",type:"button",className:"inline-flex cursor-pointer items-center rounded-full border border-transparent bg-indigo-600 p-2 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",onClick:()=>{p(!0)},children:(0,s.jsx)(eO.rnS,{className:"h-4 w-4"})})}),(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{children:"Move Section Down"}),children:(0,s.jsx)("button",{type:"button",className:"inline-flex cursor-pointer items-center rounded-full border border-transparent bg-gray-800 p-2 text-white shadow-sm hover:bg-gray-900 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-40",onClick:function(){r!==u.length&&(m(e=>{let t=e.sections[r],s=e.sections[r+1];e.sections[r]=s,e.sections[r+1]=t}),eA())},disabled:r===u.length-1,children:(0,s.jsx)(eO.D_L,{className:"h-4 w-4","aria-hidden":"true"})})}),(0,s.jsx)(eD.v,{content:(0,s.jsx)("span",{children:"Move Section Up"}),children:(0,s.jsx)("button",{type:"button",className:"inline-flex cursor-pointer items-center rounded-full border border-transparent bg-gray-800 p-2 text-white shadow-sm hover:bg-gray-900 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-40",onClick:function(){0!==r&&(m(e=>{let t=e.sections[r],s=e.sections[r-1];e.sections[r]=s,e.sections[r-1]=t}),eA())},disabled:0===r,children:(0,s.jsx)(eO.Ob1,{className:"h-4 w-4","aria-hidden":"true"})})})]}),(0,s.jsx)(eU.j,{isOpen:g,onClose:()=>{p(!1)},className:"my-8 max-w-2xl bg-white text-black",children:(0,s.jsxs)("form",{onSubmit:c(e=>{let{sectionName:t}=e,r=function(e,t){return t&&t.trim()?u.find(e=>e.title===t)?"Section named '".concat(t,"' already exists"):(m(r=>{let s=r.sections.find(t=>t.title===e);s&&(s.title=t)}),eA(),"Section re-named to '".concat(t,"'")):"The section name must not be empty."}(o,t);r.endsWith("'".concat(t,"'"))?((0,h.v0)(r),p(!1)):(0,h.A2)(r)}),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-200 bg-white p-4 sm:px-6",children:[(0,s.jsx)("h3",{className:"text-lg font-bold leading-6 text-gray-900 md:text-xl",children:"Rename Section"}),(0,s.jsx)(f.zhF,{onClick:()=>p(!1),className:"shrink-0 cursor-pointer text-gray-600 hover:text-black"})]}),(0,s.jsx)("div",{className:"px-6 pt-4",children:(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700",children:"New section name"}),(0,s.jsxs)("div",{className:"relative mt-1 rounded-md shadow-sm",children:[(0,s.jsx)("input",{type:"text",id:"name","data-testid":"rename-section-input",autoComplete:"name",className:"block w-full min-w-0 flex-1 rounded-md border-gray-300 sm:text-sm ".concat(d.sectionName?"focus:border-red-500 focus:ring-red-500":"focus:border-indigo-500 focus:ring-indigo-500"),...i("sectionName",{required:"A section name is required"})}),d.sectionName&&(0,s.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:(0,s.jsx)(f.jDV,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),d.sectionName&&(0,s.jsx)("p",{className:"mt-1 text-xs text-red-600",id:"email-error",children:d.sectionName.message})]})}),(0,s.jsx)("div",{className:"mt-3 flex items-center justify-end bg-gray-100 px-6 py-3",children:(0,s.jsx)("button",{"data-testid":"rename-section-submit",type:"submit",className:"inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-5 py-1.5 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",children:"Rename"})})]})})]})},rm=e=>{var t;let{section:r,sectionIndex:n}=e,[o,l]=(0,a.useState)(!1),[i,c]=(0,a.useState)(!1),[d,u]=(0,a.useState)(!1),{register:p,handleSubmit:w,formState:{errors:b,isSubmitting:y},reset:v}=(0,x.mN)({defaultValues:{sectionTitle:""}}),N=(0,eR.K)(),j=m.DS||"authorized"===N.state&&"codedamn"===N.data.username,k=eC(e=>e.sections),S=eC(e=>e.addNewSection),P=eC(e=>e.addNewCourseItem);function q(){}let I=m.tw&&(!m.p8||"enable"===window.__cl);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"relative my-8 flex w-full flex-col break-normal rounded-md border border-gray-200 bg-white px-2 py-6 text-black sm:px-8",children:(0,s.jsx)(g.gL,{droppableId:r.title,children:e=>(0,s.jsxs)("div",{ref:e.innerRef,children:[(0,s.jsx)(ru,{sectionIndex:n,rawTitle:r.title,title:(0,s.jsxs)("span",{children:[r.title," ",(0,s.jsxs)("span",{className:"text-xs font-normal opacity-80",children:["(",r.courseItems.length," ",1===r.courseItems.length?"item":"items",")"]})]}),collapsed:o,setCollapsed:l}),o?null:(0,s.jsxs)(s.Fragment,{children:[r.courseItems.map((e,t)=>(0,s.jsx)(rd,{item:e,sectionIndex:t},e.courseItemSlug)),e.placeholder,(0,s.jsxs)("div",{className:"mx-auto my-3 flex w-full flex-wrap gap-4 sm:flex-nowrap sm:gap-0 sm:space-x-3 items-center",children:[(0,s.jsxs)(eT.$,{variant:"secondary",disabled:d,id:"add-new-lab-item-btn","data-testid":"add-new-lab",onClick:()=>{u(!0),P({sectionTitle:r.title,indexAt:r.courseItems.length,type:eE.i.Lab}).then(()=>{u(!1)}).catch(console.error)},children:[(0,s.jsx)(f.G5q,{className:"flex-shrink-0"}),"\xa0",(0,s.jsx)("span",{children:"Coding Lab"})]}),j?(0,s.jsxs)(eT.$,{variant:"secondary",disabled:d,id:"add-new-lab-item-btn","data-testid":"add-new-lab",onClick:()=>{u(!0),P({sectionTitle:r.title,indexAt:r.courseItems.length,type:eE.i.OpenEndedQuestion}).then(()=>{u(!1)}).catch(console.error)},children:[(0,s.jsx)(f.G5q,{className:"flex-shrink-0"}),"\xa0",(0,s.jsx)("span",{children:"Open ended question (AI)"})]}):null,(0,s.jsxs)(eT.$,{variant:"secondary",disabled:d,id:"add-new-lab-item-btn-2","data-testid":"add-new-quiz",onClick:()=>{u(!0),P({sectionTitle:r.title,indexAt:r.courseItems.length,type:eE.i.Quiz}).then(()=>{u(!1)}).catch(console.error)},children:[(0,s.jsx)(f.G5q,{className:"flex-shrink-0"}
1),"\xa0",(0,s.jsx)("span",{children:"Quiz"})]}),(0,s.jsxs)(eT.$,{variant:"secondary",disabled:d,id:"add-new-lab-item-btn-3","data-testid":"add-new-video",onClick:()=>{u(!0),P({sectionTitle:r.title,indexAt:r.courseItems.length,type:eE.i.Video}).then(()=>{u(!1)}).catch(console.error)},children:[(0,s.jsx)(f.G5q,{className:"flex-shrink-0"}),"\xa0",(0,s.jsx)("span",{children:"Video"})]}),(0,s.jsxs)(eT.$,{variant:"secondary",disabled:d,id:"add-new-lab-item-btn-4","data-testid":"add-new-article",onClick:()=>{u(!0),P({sectionTitle:r.title,indexAt:r.courseItems.length,type:eE.i.Article}).then(()=>{u(!1)}).catch(console.error)},children:[(0,s.jsx)(f.G5q,{className:"flex-shrink-0"}),"\xa0",(0,s.jsx)("span",{children:"Article"})]}),I?(0,s.jsx)(eT.$,{size:"sm",variant:"default",onClick:q,children:"Import from Library"}):null,(0,s.jsx)("div",{className:"flex-grow"}),n===k.length-1?null:(0,s.jsx)(eT.$,{type:"button",disabled:d,id:"add-new-lab-item-btn-6","data-testid":"add-section-below",onClick:()=>{c(!0)},children:"Add Section Below"})]})]})]})})}),i&&(0,s.jsx)("div",{className:"relative block w-full rounded-lg border-2 border-dashed border-gray-300 focus:outline-none",children:(0,s.jsx)("form",{onSubmit:e=>{e.preventDefault(),w(e=>{let{sectionTitle:t}=e,r=S({name:t,index:n+1});"ok"===r.status?(v(),c(!1)):(0,h.A2)(r.error)})(e)},children:(0,s.jsx)("div",{className:"shadow sm:overflow-hidden sm:rounded-md",children:(0,s.jsxs)("div",{className:"space-y-4 bg-white px-4 py-6 sm:p-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h3",{className:"text-lg font-bold leading-6 text-gray-900",children:"New Section"}),(0,s.jsx)(f.zhF,{className:"cursor-pointer opacity-90 hover:opacity-100",onClick:()=>c(!1)})]}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"Course videos, labs, projects, articles and quizzes can be added to this section to enhance your course curriculum"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,s.jsx)("div",{className:"col-span-2",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"section-title",className:"block text-sm font-medium text-gray-700",children:"Section Title"}),(0,s.jsxs)("div",{className:"relative mt-1 rounded-md shadow-sm",children:[(0,s.jsx)("input",{autoFocus:!0,t
1ype:"text",id:"section-title",...p("sectionTitle",{required:"A title is required"}),className:"block w-full pr-10 focus:outline-none ".concat(b.sectionTitle?"border-red-300 text-red-900 focus:border-red-500 focus:ring-red-500":"border-indigo-300 placeholder-gray-500 focus:border-indigo-500 focus:ring-indigo-500"," rounded-md sm:text-sm"),placeholder:"For e.g. Chaos Engineering Prerequisites"}),b.sectionTitle&&(0,s.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:(0,s.jsx)(f.jDV,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),(0,s.jsx)("p",{className:"mt-2 text-xs text-red-600",id:"email-error",children:null==(t=b.sectionTitle)?void 0:t.message})]})}),(0,s.jsxs)("div",{className:"col-span-1",children:[(0,s.jsx)("label",{className:"block opacity-0",children:"submit title"}),(0,s.jsx)("button",{disabled:y,type:"submit",className:"inline-flex justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-40",children:"Add Section"})]})]}),(0,s.jsx)("div",{className:"max-w-lg rounded bg-blue-50 px-2 py-1 text-xs",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)(f.$4v,{className:"h-4 w-4 text-blue-600","aria-hidden":"true"})}),(0,s.jsx)("div",{className:"ml-2 flex-1 md:flex md:justify-between",children:(0,s.jsx)("p",{className:"text-blue-700",children:"Empty sections are not allowed. They will be automatically removed."})})]})})]})})})})]})},rh=()=>{var e;let[t,r]=(0,a.useState)(!1),n=eC(e=>e.sections),o=eC(e=>e.writeProperty),{register:l,handleSubmit:i,formState:{errors:c,isSubmitting:d},reset:u}=(0,x.mN)({defaultValues:{sectionTitle:""}}),m=eC(e=>e.addNewSection);return(0,s.jsxs)("div",{className:"flex-grow px-4 py-6",children:[(0,s.jsxs)("div",{className:"mb-4 flex w-full flex-col justify-between gap-4 sm:mb-0 md:flex-row md:items-center md:gap-0",children:[(0,s.jsx)("div",{children:(0,s.jsx)("p",{className:"flex-1 text-lg font-semibold md:text-xl",children:"Manage Curriculum"})}),(0,s.jsx)("div",{className:"flex items-center gap-3",children:(0,s.jsxs)("button",{onClick:()=>r(!0),type:"button",className:"inline-flex w-full items-center justify-center gap-1 rounded-md border border-indigo-600 px-3 py-2 text-sm font-medium leading-4 text-indigo-600 hover:bg-indigo-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:w-fit sm:justify-start",children:[(0,s.jsx)(f.u8N,{}),"Upload Videos"]})})]}),t&&(0,s.jsx)(eL.A,{close:()=>r(!1)}),(0,s.jsx)(g.JY,{onDragEnd:function(e){let{source:t,destination:r}=e;if(r){if(t.droppableId===r.droppableId){let e=rl(ro(t.droppableId,n),t.index,r.index);o(r=>{let s=r.sections.find(e=>e.title===t.droppableId);s&&(s.courseItems=e)})}else{let[e,s]=ri(ro(t.droppableId,n),ro(r.droppableId,n),t,r);o(a=>{let n=a.sections.find(e=>e.title===t.droppableId),o=a.sections.find(e=>e.title===r.droppableId);n&&(n.courseItems=e),o&&(o.courseItems=s)})}eA()}},children:n.map((e,t)=>(0,s.jsx)(rm,{section:e,sectionIndex:t},e.title))}),(0,s.jsx)("div",{className:"relative block w-full rounded-lg border-2 border-dashed border-gray-400 focus:outline-none mt-4",children:(0,s.jsx)("form",{onSubmit:i(e=>{let{sectionTitle:t}=e,r=m({name:t});"ok"===r.status?u():(0,h.A2)(r.error)}),className:"text-left",children:(0,s.jsx)("div",{className:"sm:overflow-hidden sm:rounded-md",children:(0,s.jsxs)("div",{className:"space-y-4 bg-white px-4 py-6 sm:p-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-lg font-bold leading-6 text-gray-900",children:"New Section"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"Course videos, labs, projects, articles and quizzes can be added to this section to enhance your course curriculum"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,s.jsx)("div",{className:"col-span-2",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"section-title",className:"block text-sm font-medium text-gray-700",children:"Section Title"}),(0,s.jsxs)("div",{className:"relative mt-1 rounded-md",children:[(0,s.jsx)("input",{type:"text","data-testid":"new-section-title",id:"section-title",...l("sectionTitle",{required:"A title is required"}),className:"block w-full pr-10 focus:outline-none ".concat(c.sectionTitle?"border-red-300 text-red-900 focus:border-red-500 focus:ring-red-500":"border-indigo-300 placeholder-gray-500 focus:border-indigo-500 focus:ring-indigo-500"," rounded-md sm:text-sm"),placeholder:"For e.g. Chaos Engineering Prerequisites"}),c.sectionTitle&&(0,s.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:(0,s.jsx)(f.jDV,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),(0,s.jsx)("p",{className:"mt-2 text-xs text-red-600",id:"email-error",children:null==(e=c.sectionTitle)?void 0:e.message})]})}),(0,s.jsxs)("div",{className:"col-span-1",children:[(0,s.jsx)("label",{className:"block opacity-0",children:"Submit title"}),(0,s.jsx)("button",{type:"submit","data-testid":"add-section-btn",className:"inline-flex justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",disabled:d,children:"Add Section"})]})]}),(0,s.jsx)("div",{className:"max-w-lg rounded bg-blue-50 px-2 py-1 text-xs",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)(f.$4v,{className:"h-4 w-4 text-blue-600","aria-hidden":"true"})}),(0,s.jsx)("div",{className:"ml-2 flex-1 md:flex md:justify-between",children:(0,s.jsx)("p",{className:"text-blue-700",children:"Empty sections will be automatically removed when you refresh the page."})})]})})]})})})})]})};var rg=!0;let rx=()=>{let{courseSlug:e}
1=(0,o.A)("/instructor/interactive-course-manager/[courseSlug]/[pageSlug]");(0,a.useEffect)(()=>{eC.getState().writeProperty({courseSlug:e})},[e]);let{data:t}=(0,d.T)({courseSlug:e}),r=eC(e=>e.refetchCurriculumFromBackendAndStoreInZustand);(0,a.useEffect)(()=>{r({courseSlug:e})},[e,r]);let n=eC(e=>e.writeProperty),m=eC(e=>e.courseSlug);return((0,a.useEffect)(()=>{null!=t&&n({courseData:t.response,courseSlug:e})},[t,e,n]),m!==e)?(0,s.jsxs)(i.l,{mobileSidebarTurnedNavigation:(0,s.jsx)(c.O,{courseSlug:e}),desktopSidebar:(0,s.jsx)(c.Q,{courseSlug:e}),children:[(0,s.jsx)("div",{className:"w-full min-h-screen md:rounded-tl-2xl bg-white relative pb-20",children:(0,s.jsxs)("div",{className:"px-8 py-8 flex flex-col gap-4",children:[(0,s.jsx)(u.E,{className:"w-full h-[50px]"}),(0,s.jsx)(u.E,{className:"w-[40%] h-[30px]"}),(0,s.jsx)(u.E,{className:"w-[75%] h-[30px]"})]})}),(0,s.jsx)(l.bV,{title:"Manage course syllabus"})]}):(0,s.jsxs)(i.l,{mobileSidebarTurnedNavigation:(0,s.jsx)(c.O,{courseSlug:e}),desktopSidebar:(0,s.jsx)(c.Q,{courseSlug:e}),children:[(0,s.jsx)(rh,{}),(0,s.jsx)(l.bV,{title:"Manage curriculum"})]})}},64679:(e,t,r)=>{"use strict";r.d(t,{O:()=>f});var s=r(91020),a=r(33092),n=r(90815),o=r(70875),l=r(65091);let i="user",c="get-course-item-information-for-user",d="".concat(i,"-").concat(c),u=e=>({context:{namespace:i,functionName:c},data:e}),m=async e=>{let t,{fermionAuthTokenForCodedamn:r,authToken:s,data:o,fermionSchoolId:l}=e;try{t=await a.Ay.request({method:"POST",baseURL:(0,n.Pb)(),data:{fermionSchoolId:l,authToken:s,fermionAuthTokenForCodedamn:r,data:[u(o)]}}).then(e=>e.data).then(e=>{var t;return(null==(t=e.at(0))?void 0:t.output)||null})}catch(e){throw{errorMessage:(null==e?void 0:e.message)||"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!0}}if(!t)throw{errorMessage:"Something went wrong while making this request. Please try again or contact [email protected]",isNetworkError:!1};if("ok"===t.status)return t.data;throw{...t,isNetworkError:!1}},h=async e=>{let{schoolHostname:t,data:r,forceOverrideAuthToken:s,shouldEnableBatching:a=!0}=e,i=s||(0,o.G0)()||null,c=(0,l.wx)({schoolHostname:t})||null,d=(0,o.$q)()||null;if(!a)return await m({fermionAuthTokenForCodedamn:d,fermionSchoolId:c,data:r,authToken:i});{let e=(0,n.zL)(r);return await n.l3.fetch({batchingUniqueKey:e,fermionSchoolId:c,authToken:i,fermionAuthTokenForCodedamn:d,data:u(r)}).then(e=>e)}};var g=r(9852),x=r(25963);let f=(e,t)=>{let r=(0,g.hZ)(),a=(0,x.useMemo)(()=>new URL(r.requestUrl).hostname,[r.requestUrl]);return(0,s.I)({queryKey:[d,u(e)],queryFn:()=>h({data:e,schoolHostname:a}),...null!=t?t:{}})}},66234:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/instructor/interactive-course-manager/[slug]/manage",function(){return r(25098)}])}},e=>{var t=t=>e(e.s=t);e.O(0,[46593,52802,83344,76217,40122,54158,97608,9821,33045,85414,56093,91020,45833,51123,52892,51355,89642,54369,26654,8991,15599,91408,25266,18367,40093,30369,68797,90636,38792],()=>t(66234)),_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.