1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];if(null!=r)for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:mentortools-frontend":!0});var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="86cd38bc-446c-4d5a-833f-dd934876169f",e._sentryDebugIdIdentifier="sentry-dbid-86cd38bc-446c-4d5a-833f-dd934876169f")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9367],{7028:(e,t,r)=>{"use strict";r.d(t,{CJ:()=>a,HQ:()=>s,JK:()=>i});var n=r(48711);let a=e=>new Intl.NumberFormat("fr-FR").format(e),s=e=>(0,n.F0)(e)&&"error"in e.response?.data&&e.response?.data?.error==="Insufficient credits",i=e=>(0,n.F0)(e)&&"error"in e.response?.data&&e.response?.data?.error==="No access"},18889:(e,t,r)=>{"use strict";r.d(t,{T:()=>s});var n=r(64713),a=r(31941);let s=(0,n.Ay)(a.A,{shouldForwardProp:e=>"badgeColor"!==e})(({theme:e,badgeColor:t="primary"})=>({borderRadius:4,color:e.palette[t].main,backgroundColor:e.colorWithOpacity(e.palette[t].main,16),lineHeight:"14px",fontSize:13,letterSpacing:0,padding:e.spacing(1.25,2.25),alignSelf:"start"}))},22068:(e,t,r)=>{"use strict";r.d(t,{V:()=>i});var n=r(37876),a=r(5236),s=r(67020);let i=()=>(0,n.jsx)(s.default,{"data-sentry-element":"Error500","data-sentry-component":"ServerSideError","data-sentry-source-file":"ServerSideError.tsx"});i.getLayout=e=>(0,n.jsx)(a.A,{children:e})},28752:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});function n(e,t){if(!e)throw Error("Invariant failed")}},31165:(e,t,r)=>{"use strict";r.d(t,{A:()=>x});var n=r(44501),a=r(40670),s=r(14232),i=r(49995),o=r(4697),l=r(64713),d=r(26200),c=r(47951),u=r(45879);function p(e){return(0,u.Ay)("MuiCardContent",e)}(0,c.A)("MuiCardContent",["root"]);var m=r(37876);let g=["className","component"],y=(0,l.Ay)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}})),x=s.forwardRef(function(e,t){let r=(0,d.A)({props:e,name:"MuiCardContent"}),{className:s,component:l="div"}=r,c=(0,a.A)(r,g),u=(0,n.A)({},r,{component:l}),x=(e=>{let{classes:t}=e;return(0,o.A)({root:["root"]},p,t)})(u);return(0,m.jsx)(y,(0,n.A)({as:l,className:(0,i.A)(x.root,s),ownerState:u,ref:t},c))})},36837:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>tC});var n=r(37876),a=r(14232),s=r(62902),i=r(74234),o=r(31941),l=r(5157),d=r(22068),c=r(12772),u=r(30942),p=r(74359),m=r(14958),g=r(47353),y=r(11313),x=r(76554),h=r(99399),f=r(69884),_=r(68010),A=r(16361),b=r(27345),j=r(61210),C=r(48230),v=r.n(C),E=r(76587),S=r(24261),w=r(43882),k=r(29608),I=r(8600),G=r(64713),T=r(47692),F=r(66950),O=r(88992),R=r(75542),N=r(39086),P=r(21372),M=r(13810),$=r(67768),W=r(40097);let D=(e=!0)=>{let{notify:t}=(0,A.A)(),{user:r}=(0,m.A)(),n=(0,$.jE)(),{isPending:a,mutateAsync:s}=(0,W.n)({mutationFn:g.x.updateCourseGenerationTask,onError:()=>t("COURSE_GENERATION.update_task",{type:"error"}),onSuccess:()=>{e&&n.invalidateQueries({queryKey:y.Ay.courseGeneration.detail({portal_id:r?.portal.id||0}).queryKey})}});return{isUpdateCourseGenerationPending:a,mutateUpdateCourseGenerationAsync:s}};var z=r(56e3),L=r(7028),q=r(94596),V=r(47300),B=r(51802),U=r(48080);let H=B.Ik({modules:B.YO(B.Ik({lessons:B.YO(B.Yj().min(1,"required").max(250,"max_250")).min(1,"no_empty_lessons"),title:B.Yj().min(1,"required").max(250,"max_250")})).min(1,"no_empty_modules")}),K=B.Ik({id:B.ai().optional(),attached_file_id:B.Yj().nullable().optional(),course_about:B.Yj().min(1,"required").max(300,"max_300"),participants_description:B.Yj().min(1,"required").max(300,"max_300"),language:B.k5((0,U.y2)(V.so)),course_tone:B.k5((0,U.y2)(V.wJ)),proficiency_level:B.k5((0,U.y2)(V.BG)),course_scope:B.k5((0,U.y2)(V.e)),course_goal:B.Yj().min(1,"required").max(500,"max_500"),course_name:B.Yj().min(1,"required").max(250,"max_250"),course_description:B.Yj().min(1,"required").max(500,"max_500"),course_structure:H,content_generation_enabled:B.zM(),module_thumbnail_generation_enabled:B.zM(),lesson_thumbnail_generation_enabled:B.zM(),lesson_image_generation_enabled:B.zM(),generation_model:B.k5((0,U.y2)(V.HL)),image_style:B.k5((0,U.y2)(V.Hj))}),Y=K.pick({attached_file_id:!0,language:!0,course_tone:!0,participants_description:!0,course_about:!0,proficiency_level:!0,course_scope:!0}),Q=K.pick({course_goal:!0,course_name:!0,course_description:!0}
1),X=K.pick({content_generation_enabled:!0,module_thumbnail_generation_enabled:!0,lesson_thumbnail_generation_enabled:!0,lesson_image_generation_enabled:!0,generation_model:!0,image_style:!0}),J=(e,t)=>{let r=t?.language_id&&(0,V.W$)(t.language_id)&&V.so[t.language_id],n=e?.language||r||"DE";return{attached_file_id:e?.attached_file_id||null,language:e?.language||n,course_tone:e?.course_tone||V.wJ.formal,participants_description:e?.participants_description||"",course_about:e?.course_about||"",proficiency_level:e?.proficiency_level||V.BG.entry,course_scope:e?.course_scope||V.e.small}};var Z=r(31543),ee=r(90035),et=r(38137),er=r(68954);let en=(0,G.Ay)(S.A)(({theme:e})=>({fontSize:13,color:e.colorWithOpacity(e.palette.grey[800],50)})),ea=(0,G.Ay)(s.A)(({theme:e,selected:t})=>({border:`1px solid ${t?e.palette.primary.main:e.palette.divider}`,borderRadius:e.spacing(2),padding:e.spacing(4),flex:1,gap:e.spacing(1),"& :hover":{cursor:"pointer"}})),es=(0,G.Ay)(T.A)({padding:0}),ei=(0,G.Ay)(w.A)(({theme:e})=>({fontSize:13,color:e.palette.grey[900],lineHeight:1.1})),eo=({onNext:e,courseGenerationTask:t,isGenerationAvailable:r})=>{let d=(0,i.A)(),{t:c}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.description"}),{t:p}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.navigation"}),{t:x}=(0,u.o)("translation"),{data:f=[],isLoading:_}=(0,P.J)(),b=(0,a.useMemo)(()=>f.map(e=>({value:(0,V.W$)(e.id)?V.so[e.id]:"DE",name:x(`LANGUAGE.${N.v8?.[e.id]}`)})),[f,x]),j=(0,a.useMemo)(()=>[{title:c("course_length_options.quick_title"),info:c("course_length_options.quick_info"),value:V.e.small},{title:c("course_length_options.regular_title"),info:c("course_length_options.regular_info"),value:V.e.medium},{title:c("course_length_options.extensive_title"),info:c("course_length_options.extensive_info"),value:V.e.large}],[c]),C=(0,a.useMemo)(()=>[{additionalValue:(0,n.jsxs)(s.A,{children:[(0,n.jsx)(o.A,{color:d.colorWithOpacity("#4C475D",90),sx:{".Mui-selected &":{color:d.palette.common.white}},variant:"body1",children:c("proficiency_options.entry")}),(0,n.jsx)(o.A,{color:d.colorWithOpacity("#4C475D",60),sx:{".Mui-selected &":{color:d.palette.common.white}},variant:"subtitle2",children:c("proficiency_options.entry_info")})]}),name:"",value:V.BG.entry},{name:"",additionalValue:(0,n.jsxs)(s.A,{children:[(0,n.jsx)(o.A,{color:d.colorWithOpacity("#4C475D",90),sx:{".Mui-selected &":{color:d.palette.common.white}},variant:"body1",children:c("proficiency_options.intermediate")}),(0,n.jsx)(o.A,{sx:{".Mui-selected &":{color:d.palette.common.white}},color:d.colorWithOpacity("#4C475D",60),variant:"subtitle2",children:c("proficiency_options.intermediate_info")})]}),value:V.BG.intermediate},{name:"",additionalValue:(0,n.jsxs)(s.A,{children:[(0,n.jsx)(o.A,{color:d.colorWithOpacity("#4C475D",90),sx:{".Mui-selected &":{color:d.palette.common.white}},variant:"body1",children:c("proficiency_options.advanced")}),(0,n.jsx)(o.A,{color:d.colorWithOpacity("#4C475D",60),sx:{".Mui-selected &":{color:d.palette.common.white}},variant:"subtitle2",children:c("proficiency_options.advanced_info")})]}),value:V.BG.advanced}],[c,d]),{control:S,isSubmitting:w,onSubmit:G,setValue:B}=(({courseGenerationTask:e,onSubmitSuccessful:t})=>{let{data:r}=(0,q.WP)(),{control:s,handleSubmit:i,setValue:o,getValues:l,reset:d,formState:{isSubmitting:c}}=(0,O.mN)({resolver:(0,M.u)(Y),defaultValues:J(e,r)});(0,a.useEffect)(()=>{d(J(e,r))},[e,r,d]);let{isAddCourseGenerationPending:u,mutateAddCourseGenerationAsync:p}=(({shouldNotifySuccess:e=!1,shouldNotifyError:t=!0})=>{let{notify:r,notifyContent:a}=(0,A.A)(),{user:s}=(0,m.A)(),i=(0,$.jE)(),{isPending:o,mutateAsync:l}=(0,W.n)({mutationFn:g.x.addCourseGenerationTask,onSuccess:t=>{i.setQueryData(y.Ay.courseGeneration.detail({portal_id:s?.portal.id||0}).queryKey,t),e&&r("COURSE_GENERATION.add_task")},onError:e=>{t&&((0,L.HQ)(e)?a((0,n.jsx)(z.n,{}),{type:"error"}):r("COURSE_GENERATION.add_task",{type:"error"})),i.invalidateQueries({queryKey:y.Ay.courseGeneration.detail({portal_id:s?.portal.id||0}).queryKey})}});return{isAddCourseGenerationPending:o,mutateAddCourseGenerationAsync:l}})({shouldNotifySuccess:!1,shouldNotifyError:!0}),{isUpdateCourseGenerationPending:x,mutateUpdateCourseGenerationAsync:h}=D();return{control:s,onSubmit:i(async r=>{if(e){try{await h({id:e.id,...r}),t?.()}catch(e){console.error(e)}return}try{await p({...r,attached_file_id:r.attached_file_id||null}),t?.()}catch(e){console.error(e)}}),setValue:o,getValues:l,isSubmitting:c||u||x}})({courseGenerationTask:t,onSubmitSuccessful:e}),{isTeamMember:U}=(0,h.D)(),{isVerified:H}=(0,Z.n)(),K=U||H,Q=(0,O.FH)({control:S,name:"language"}),X=(0,a.useMemo)(()=>K?r?void 0:(0,n.jsxs)(s.A,{gap:d.spacing(1.5),direction:"row",children:[(0,n.jsxs)(o.A,{variant:"body1",color:"inherit",children:[x("PAGE.AGENT.insufficient_credits.title"),"."]}),(0,n.jsx)(o.A,{component:v(),href:"/credits",color:"inherit",children:x("PAGE.AGENT.insufficient_credits.action")})]}):x("PAGE.COURSE_GENERATION.must_verify"),[r,K,c,x,d]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(s.A,{spacing:d.spacing(6),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:d.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h2",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"CourseDescriptionForm.tsx",children:c("title")}),(0,n.jsx)(o.A,{variant:"subtitle1",color:d.colorWithOpacity(d.palette.grey[900],60),"data-sentry-element":"Typography","data-sentry-source-file":"CourseDescriptionForm.tsx",children:c("subtitle")})]}),(0,n.jsxs)(s.A,{spacing:d.spacing(12),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:d.spacing(2),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h4",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"CourseDescriptionForm.tsx",children:c("upload_label")}),(0,n.jsx)(O.xI,{control:S,name:"attached_file_id",render:({field:{value:e,onCh
1ange:t}})=>(0,n.jsx)(F.A,{sx:{position:"relative"},children:(0,n.jsx)(et.A,{existingPdfId:e||"",requirements:c("upload_req",{maxSize:30}),formSetterFn:t,maxFileSize:30})}),"data-sentry-element":"Controller","data-sentry-source-file":"CourseDescriptionForm.tsx"})]}),(0,n.jsxs)(s.A,{spacing:d.spacing(4),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:d.spacing(2),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h5",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"CourseDescriptionForm.tsx",children:c("course_topic")}),(0,n.jsxs)(s.A,{spacing:d.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsx)(O.xI,{control:S,name:"course_about",render:({field:{value:e,onChange:t},fieldState:{error:r,invalid:a}})=>(0,n.jsx)(R.XY,{"data-form-path":"course_about","data-element-type":"input","data-ai-field":"Describe your course and the main solution it will provide for your learners simple text field",onChange:t,value:e,multiline:!0,rows:5,placeholder:c("course_topic_placeholder"),fullWidth:!0,error:a,helperText:r&&c(`validation.${r.message}`)}),"data-sentry-element":"Controller","data-sentry-source-file":"CourseDescriptionForm.tsx"}),(0,n.jsx)(en,{"data-sentry-element":"FormHelperTextStyled","data-sentry-source-file":"CourseDescriptionForm.tsx",children:c("course_topic_helpertext")})]})]}),(0,n.jsx)(O.xI,{control:S,name:"language",render:({field:{value:e,onChange:t}})=>(0,n.jsx)(ee.A,{"data-form-path":"main_information.category_id","data-ai-field":"Select language",loading:_,value:e,handleValueChange:e=>{"en"===e.target.value&&B("course_tone",V.wJ.formal),t(e)},labelText:c("language_label"),placeholder:c("language_placeholder"),selectItems:b}),"data-sentry-element":"Controller","data-sentry-source-file":"CourseDescriptionForm.tsx"}),"EN"!==Q&&(0,n.jsxs)(s.A,{children:[(0,n.jsxs)(s.A,{direction:"row",alignItems:"center",spacing:d.spacing(1.5),children:[(0,n.jsx)(ei,{children:c("form_of_address")}),(0,n.jsx)(I.A,{title:c("language_tooltip"),arrow:!0,placement:"right",children:(0,n.jsx)(s.A,{alignItems:"center",justifyContent:"center",children:(0,n.jsx)(l.A,{color:d.palette.grey[900],fontSize:18,icon:"tabler:help"})})})]}),(0,n.jsx)(O.xI,{control:S,name:"course_tone",render:({field:{value:e,onChange:t}})=>(0,n.jsxs)(k.A,{value:e,row:!0,onChange:t,children:[(0,n.jsx)(E.A,{control:(0,n.jsx)(T.A,{"data-element-type":"button","data-ai-field":"formal form of address radio button"}),label:c("language_options.formal"),value:V.wJ.formal}),(0,n.jsx)(E.A,{control:(0,n.jsx)(T.A,{"data-element-type":"button","data-ai-field":"informal form of address radio button"}),label:c("language_options.informal"),value:V.wJ.informal})]})})]})]}),(0,n.jsxs)(s.A,{spacing:d.spacing(4),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:d.spacing(2),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h5",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"CourseDescriptionForm.tsx",children:c("course_participants")}),(0,n.jsxs)(s.A,{spacing:d.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsx)(O.xI,{control:S,name:"participants_description",render:({field:{value:e,onChange:t},fieldState:{error:r,invalid:a}})=>(0,n.jsx)(R.XY,{"data-form-path":"participants_description","data-element-type":"input","data-ai-field":"Briefly describe your learners simple text field",onChange:t,value:e,multiline:!0,rows:5,placeholder:c("participants_placeholder"),fullWidth:!0,error:a,helperText:r&&c(`validation.${r.message}`)}),"data-sentry-element":"Controller","data-sentry-source-file":"CourseDescriptionForm.tsx"}),(0,n.jsx)(en,{"data-sentry-element":"FormHelperTextStyled","data-sentry-source-file":"CourseDescriptionForm.tsx",children:c("participants_helpertext")})]})]}),(0,n.jsx)(O.xI,{control:S,name:"proficiency_level",render:({field:{value:e,onCh
1ange:t}})=>(0,n.jsx)(ee.A,{"data-form-path":"proficiency_level","data-ai-field":"Select learner proficiency level",value:e,handleValueChange:t,labelText:c("proficiency_label"),placeholder:c("proficiency_placeholder"),selectItems:C,hideAdditionalValueInOptions:!1,additionalValuePropagation:!0}),"data-sentry-element":"Controller","data-sentry-source-file":"CourseDescriptionForm.tsx"})]}),(0,n.jsxs)(s.A,{spacing:d.spacing(2.5),"data-sentry-element":"Stack","data-sentry-source-file":"CourseDescriptionForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h5",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"CourseDescriptionForm.tsx",children:c("course_length")}),(0,n.jsx)(O.xI,{control:S,name:"course_scope",render:({field:{value:e,onChange:t}})=>(0,n.jsx)(k.A,{value:e,onChange:t,children:(0,n.jsx)(s.A,{direction:{xs:"column",md:"row"},spacing:d.spacing(2.5),children:j.map(({title:r,info:a,value:i})=>(0,n.jsxs)(ea,{"data-element-type":"button","data-ai-field":`${r} option button for course length click`,selected:i===e,onClick:()=>t(i),children:[(0,n.jsxs)(s.A,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[(0,n.jsx)(o.A,{variant:"h6",component:"p",children:r}),(0,n.jsx)(es,{value:i})]}),(0,n.jsx)(o.A,{children:a})]},i))})}),"data-sentry-element":"Controller","data-sentry-source-file":"CourseDescriptionForm.tsx"})]})]})]}),(0,n.jsx)(er.A,{saveButton:{disabled:!K||!r,tooltip:X,onSubmit:G,text:p("next"),variant:"contained",isSubmitting:w},"data-sentry-element":"FormFooter","data-sentry-source-file":"CourseDescriptionForm.tsx"})]})};var el=r(22208),ed=r(74086),ec=r(39567);let eu=(0,G.Ay)(S.A)(({theme:e})=>({fontSize:13,color:e.colorWithOpacity(e.palette.grey[800],50)})),ep=({helpertext:e,placeholder:t,title:r,rows:a=5,contentType:d,children:c,control:p})=>{let{t:m}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.context"}),{isOpen:g,toggle:y}=(0,ec.A)(!0),x=(0,i.A)();return(0,n.jsxs)(s.A,{bgcolor:x.colorWithOpacity(x.palette.secondary.main,8),borderRadius:x.spacing(1.5),padding:x.spacing(4),gap:g?x.spacing(5):0,"data-sentry-element":"Stack","data-sentry-component":"ContentWithSuggestions","data-sentry-source-file":"ContentWithSuggestions.tsx",children:[(0,n.jsxs)(s.A,{alignItems:"center",justifyContent:"space-between",direction:"row","data-sentry-element":"Stack","data-sentry-source-file":"ContentWithSuggestions.tsx",children:[(0,n.jsx)(o.A,{variant:"h5",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"ContentWithSuggestions.tsx",children:r}),(0,n.jsx)(el.A,{"data-element-type":"button","data-ai-field":`toggle expand content for ${r} block`,onClick:()=>y(),variant:"outlined",sx:{width:30,minWidth:30,height:30,padding:x.spacing(1.5)},"data-sentry-element":"Button","data-sentry-source-file":"ContentWithSuggestions.tsx",children:(0,n.jsx)(l.A,{icon:"tabler:chevron-down",color:"primary",fontSize:18,style:{transform:g?"rotate(-180deg)":"rotate(0deg)",transition:"transform 150ms ease-out"},"data-sentry-element":"Icon","data-sentry-source-file":"ContentWithSuggestions.tsx"})})]}),(0,n.jsx)(F.A,{"data-sentry-element":"Box","data-sentry-source-file":"ContentWithSuggestions.tsx",children:(0,n.jsx)(ed.A,{in:g,"data-sentry-element":"Collapse","data-sentry-source-file":"ContentWithSuggestions.tsx",children:(0,n.jsxs)(s.A,{spacing:x.spacing(3),"data-sentry-element":"Stack","data-sentry-source-file":"ContentWithSuggestions.tsx",children:[(0,n.jsx)(s.A,{gap:x.spacing(5),"data-sentry-element":"Stack","data-sentry-source-file":"ContentWithSuggestions.tsx",children:(0,n.jsxs)(s.A,{spacing:x.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"ContentWithSuggestions.tsx",children:[(0,n.jsx)(O.xI,{control:p,name:d,render:({field:e,fieldState:{invalid:r,error:s}})=>(0,n.jsx)(R.XY,{"data-form-path":d,"data-element-type":"input","data-ai-field":`${t} text field`,fullWidth:!0,multiline:!0,rows:a,placeholder:t,...e,error:r,helperText:s&&m(`validation.${s.message}`)}),"data-sentry-element":"Controller","data-sentry-source-file":"ContentWithSuggestions.tsx"}),e&&(0,n.jsx)(eu,{children:e})]})}),c]})})})]})};var em=r(3801),eg=r(48711),ey=r(63456);let ex=B.Ik({suggestion:B.Yj().optional().nullable()}),eh=()=>(0,n.jsx)(F.A,{component:l.A,icon:"tabler:loader",sx:{fontSize:24,animation:"spin 1s linear infinite","@keyframes spin":{"100%":{transform:"rotate(360deg)"}}},"data-sentry-element":"Box","data-sentry-component":"BufferingSpinner","data-sentry-source-file":"BufferingSpinner.tsx"}),ef=(0,G.Ay)(T.A)({padding:0}),e_=(0,G.Ay)(s.A)(({theme:e,selected:t})=>({border:`1px solid ${t?e.palette.primary.main:e.palette.divider}`,borderRadius:e.spacing(2),padding:e.spacing(2.5,3.5),background:e.palette.background.paper,flex:1,flexDirection:"row",alignItems:"center",gap:e.spacing(2),"& :hover":{cursor:"pointer"}})),eA=(0,G.Ay)(s.A)(({theme:e})=>({position:"absolute",inset:0,left:e.spacing(-4),right:e.spacing(-4),background:e.colorWithOpacity(e.palette.common.black,60),color:e.palette.common.white,justifyContent:"center",alignItems:"center",gap:e.spacing(2),backdropFilter:"blur(8px)"})),eb=({direction:e="column",contentType:t})=>{let r=(0,i.A)(),{t:a}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.context"});return(0,n.jsxs)(eA,{direction:e,"data-sentry-element":"OverlayLoaderWrapper","data-sentry-component":"OverlayLoader","data-sentry-source-file":"AISuggestions.tsx",children:[(0,n.jsx)(eh,{"data-sentry-element":"BufferingSpinner","data-sentry-source-file":"AISuggestions.tsx"}),(0,n.jsx)(o.A,{color:r.palette.common.white,variant:"body2","data-sentry-element":"Typography","data-sentry-source-file":"AISuggestions.tsx",children:a((e=>{switch(e){case"course_name":return"loading_message_course_name";case"course_description":return"loading_message_description";case"course_goal":return"loading_message_goals"}})(t))})]})},ej=(0,a.memo)(({contentType:e,onSelect:t,taskId:r,control:d})=>{let c,m=(0,i.A)(),{t:x}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.context"}),h=(e=>{switch(e){case"course_description":return V.PV.course_description;case"course_goal":return V.PV.goal;case"course_name":return V.PV.course_name}})(e),{control:f}=(c=(0,O.FH)({control:d,name:e}),(0,O.mN)({resolver:(0,M.u)(ex),defaultValues:{suggestion:c}})),{isGenerateSuggestionsError:_,isGenerateSuggestionsLoading:b,refetchSuggestions:j,suggestions:C}=(({suggestionType:e,taskId:t})=>{let{notify:r}=(0,A.A)(),{t:n}=(0,ey.Bd)("translation",{keyPrefix:"ALERT"}),{refetch:s,isFetching:i,isError:o,data:l}=(0,p.I)({queryKey:y.Ay.courseGeneration.suggestions(e,t).queryKey,queryFn:async()=>{try{return await g.x.generateSuggestions({id:t,suggestion_type:e})}catch(e){if((0,eg.F0)(e)&&e.response?.data){let t=e.response.data,{isFileSizeError:a,maxSize:s}=(0,V.Hz)(t);a&&r(n("ERROR.COURSE_GENERATION.file_size_exceeded",{maxSize:s}),{type:"error"})}throw e}},select:e=>e.data.result?.suggestions,refetchOnReconnect:!1,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:1/0});return{isGenerateSuggestionsLoading:i,isGenerateSuggestionsError:o,refetchSuggestions:(0,a.useCallback)(async()=>{try{let{isError:e,error:t}=await s();if(e&&(0,eg.F0)(t)&&t.response?.data){let e=t.response.data,{isFileSizeError:a,maxSize:s}=(0,V.Hz)(e);if(a)return void r(n("ERROR.COURSE_GENERATION.file_size_exceeded",{maxSize:s}),{type:"error"});r("COURSE_GENERATION.generate_suggestions",{type:"error"});return}if(e)return void r("COURSE_GENERATION.generate_suggestions",{type:"error"});r("COURSE_GENERATION.generate_suggestions")}catch(e){if((0,eg.F0)(e)&&e.response?.data){let t=e.response.data,{isFileSizeError:a,maxSize:s}=(0,V.Hz)(t);if(a)return void r(n("ERROR.COURSE_GENERATION.file_size_exceeded",{maxSize:s}),{type:"error"})}r("COURSE_GENERATION.generate_suggestions",{type:"error"})}},[r,s,n]),suggestions:l}})({suggestionType:h,taskId:r}),v=(0,a.useCallback)(()=>_?b?(0,n.jsx)(s.A,{alignItems:"center",position:"relative",minHeight:35,useFlexGap:!0,children:(0,n.jsx)(eb,{direction:"row",contentType:e})}):(0,n.jsx)(o.A,{variant:"body2",children:x("suggestions_loading_error")}):(0,n.jsx)(O.xI,{control:f,name:"suggestion",render:({field:{value:r,onChange:a}})=>(0,n.jsx)(k.A,{value:r,children:(0,n.jsxs)(s.A,{position:"relative",spacing:m.spacing(2),useFlexGap:!0,minHeight:200,children:[C?.map((r,s)=>(0,n.jsxs)(e_,{"data-element-type":"button","data-ai-field":`click on suggestion with index = ${s} and value = ${r} for ${e} field`,onClick:()=>{a(r),t(r,e)},children:[(0,n.jsx)(ef,{disableRipple:!0,value:r}),(0,n.jsx)(o.A,{children:r})]},r)),b&&(0,n.jsx)(eb,{contentType:e})]})})}),[e,_,b,t,f,C,x,m]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(s.A,{gap:m.spacing(3),useFlexGap:!0,children:[(0,n.jsxs)(s.A,{alignItems:"center",justifyContent:"space-between",direction:"row",gap:m.spacing(2),children:[(0,n.jsxs)(s.A,{alignItems:"center",justifyContent:"space-between",direction:"row",gap:m.spacing(2),children:[(0,n.jsx)(l.A,{icon:"tabler:wand",color:m.palette.primary.main}),(0,n.jsx)(o.A,{variant:"subtitle2",children:x("ai_suggest_btn")})]}),(0,n.jsx)(em.A,{"data-element-type":"button","data-ai-field":`click on regenerate suggestions button for ${e} field`,loading:b,startIcon:(0,n.jsx)(l.A,{icon:"tabler:refresh"}),variant:"text",onClick:j,children:x("ai_regenerate_btn")})]}),v()]})})});var eC=r(41070);let ev=({courseGenerationTask:e,onNext:t,onPrevious:r})=>{let l=(0,i.A)(),{t:d}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.context"}),{t:c}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.navigation"}),{isSubmitting:p,onSubmit:m,setValue:g,control:x,getValues:h}=(({courseGenerationTask:e,onSubmitSuccessful:t})=>{let{control:r,handleSubmit:n,setValue:a,getValues:s,formState:{isSubmitting:i}}=(0,O.mN)({resolver:(0,M.u)(Q),defaultValues:{course_goal:e?.course_goal||"",course_name:e?.course_name||"",course_description:e?.course_description||""},mode:"all"}),{isUpdateCourseGenerationPending:o,mutateUpdateCourseGenerationAsync:l}=D(),d=(0,$.jE)();return{control:r,onSubmit:n(async r=>{if(e)try{await l({id:e.id,...r}),d.invalidateQueries({queryKey:y.Ay.courseGeneration.structure(e.id,1).queryKey}),d.invalidateQueries({queryKey:y.Ay.courseGeneration.structure(e.id,2).queryKey}),d.invalidateQueries({queryKey:y.Ay.courseGeneration.structure(e.id,3).queryKey}),t?.()}catch(e){console.error(e)}}),setValue:a,getValues:s,isSubmitting:i||o}
1})({courseGenerationTask:e,onSubmitSuccessful:t}),f=e=>{let{path:t,value:r}=e.detail,n=structuredClone(h());(0,eC.F)(n,t,r),g(t,r,{shouldValidate:!0,shouldDirty:!0})};return(0,a.useEffect)(()=>(window.addEventListener("form:setValue",f),()=>{window.removeEventListener("form:setValue",f)}),[g,h]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(s.A,{spacing:l.spacing(6),"data-sentry-element":"Stack","data-sentry-source-file":"CourseContextForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:l.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"CourseContextForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h2",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"CourseContextForm.tsx",children:d("title")}),(0,n.jsx)(o.A,{variant:"subtitle1",color:l.colorWithOpacity(l.palette.grey[900],60),"data-sentry-element":"Typography","data-sentry-source-file":"CourseContextForm.tsx",children:d("subtitle")})]}),(0,n.jsx)(ep,{placeholder:d("goal_placeholder"),title:d("goal_title"),helpertext:d("goal_placeholder"),contentType:"course_goal",control:x,"data-sentry-element":"ContentWithSuggestions","data-sentry-source-file":"CourseContextForm.tsx",children:(0,n.jsx)(ej,{contentType:"course_goal",onSelect:(e,t)=>{g(t,e,{shouldValidate:!0,shouldTouch:!0,shouldDirty:!0})},taskId:e?.id||0,control:x,"data-sentry-element":"AISuggestions","data-sentry-source-file":"CourseContextForm.tsx"})}),(0,n.jsx)(ep,{placeholder:d("course_name_placeholder"),title:d("course_name_title"),helpertext:d("course_name_placeholder"),rows:2,contentType:"course_name",control:x,"data-sentry-element":"ContentWithSuggestions","data-sentry-source-file":"CourseContextForm.tsx",children:(0,n.jsx)(ej,{contentType:"course_name",onSelect:(e,t)=>{g(t,e,{shouldValidate:!0,shouldTouch:!0,shouldDirty:!0})},taskId:e?.id||0,control:x,"data-sentry-element":"AISuggestions","data-sentry-source-file":"CourseContextForm.tsx"})}),(0,n.jsx)(ep,{placeholder:d("description_placeholder"),title:d("description_title"),helpertext:d("description_placeholder"),contentType:"course_description",control:x,"data-sentry-element":"ContentWithSuggestions","data-sentry-source-file":"CourseContextForm.tsx",children:(0,n.jsx)(ej,{contentType:"course_description",onSelect:(e,t)=>{g(t,e,{shouldValidate:!0,shouldTouch:!0,shouldDirty:!0})},taskId:e?.id||0,control:x,"data-sentry-element":"AISuggestions","data-sentry-source-file":"CourseContextForm.tsx"})})]}),(0,n.jsx)(er.A,{saveButton:{onSubmit:m,text:c("next"),variant:"contained",isSubmitting:p},applyButton:{text:c("previous"),variant:"outlined",onSubmit:r},"data-sentry-element":"FormFooter","data-sentry-source-file":"CourseContextForm.tsx"})]})};var eE=r(86888),eS=r(88414);let ew=(e,t)=>{let r=e?.id||0;return(0,p.I)({queryKey:y.Ay.courseGeneration.structure(r,t).queryKey,queryFn:()=>g.x.generateStructure({id:r}),select:e=>e.data.result,refetchOnReconnect:!1,refetchOnWindowFocus:!1,refetchInterval:1/0,refetchOnMount:!1})},ek=e=>({modules:e?.course_structure?.modules||[]}),eI=({courseGenerationTask:e,onSubmitSuccessful:t})=>{let r=(0,O.mN)({resolver:(0,M.u)(H),defaultValues:ek(e)});(0,a.useEffect)(()=>{r.reset(ek(e))},[e]);let{isUpdateCourseGenerationPending:n,mutateUpdateCourseGenerationAsync:s}=D(),i=r.handleSubmit(async r=>{if(e)try{await s({id:e.id,course_structure:r}),t?.()}catch(e){console.error(e)}});return{form:r,onSubmit:i,isSubmitting:r.formState.isSubmitting||n}};var eG=r(26183),eT=r(74441),eF=r(82179),eO=r(79494);let eR=(0,G.Ay)(eF.A)(({theme:e})=>({borderRadius:"8px",cursor:"pointer",flex:1,flexDirection:"column",gap:e.spacing(2),maxHeight:380,overflow:"hidden",padding:e.spacing(4),transition:"all .2s ease-in-out"})),eN=(0,G.Ay)(eF.A)(({theme:e})=>({backgroundColor:e.palette.background.default,flexDirection:"row",borderRadius:"4px",gap:e.spacing(2),padding:e.spacing(.5,1,.5,4)})),eP=(0,G.Ay)(eF.A)(({theme:e})=>({gap:e.spacing(3),flexWrap:"wrap",flexDirection:"row",[e.breakpoints.down("md")]:{flexDirection:"column"}}
1)),eM=(0,a.memo)(({structureFields:e,selectedStructure:t,onChangeSelectedModule:r})=>{let a=(0,i.A)(),{t:s}=(0,u.o)("translation",{keyPrefix:"COURSE_AI"}),{copyToClipboard:d}=(0,eO.T)();return(0,n.jsx)(k.A,{children:(0,n.jsx)(eP,{children:e?.map((e,i)=>{let c=!!e&&!!t&&((e,t)=>{if(!t||e.modules.length!==t.modules.length)return!1;for(let r=0;r<e.modules.length;r++){let n=e.modules[r],a=t.modules[r];if(n.title!==a.title||n.lessons.length!==a.lessons.length)return!1;for(let e=0;e<n.lessons.length;e++)if(n.lessons[e]!==a.lessons[e])return!1}return!0})(e,t);return(0,n.jsxs)(eR,{"data-element-type":"button","data-ai-field":`Select course template structure with index = ${i}`,onClick:()=>{e&&r(e)},border:`1px solid ${c?a.palette.primary.main:a.palette.divider}`,children:[(0,n.jsxs)(eF.A,{direction:"row",justifyContent:"space-between",children:[(0,n.jsx)(E.A,{checked:c,onChange:(t,n)=>{n&&e&&r(e)},label:`${s("structure.template")} ${i+1}`,control:(0,n.jsx)(T.A,{disableTouchRipple:!0,disableRipple:!0,disableFocusRipple:!0,size:"small"})}),(0,n.jsx)(eG.A,{"data-element-type":"button","data-ai-field":`copy course template structure with index = ${i}`,color:"primary",onClick:e&&(t=>{let r;t.stopPropagation(),d((r="",e.modules.forEach(e=>{r+=`${e.title} 2 3`,e.lessons.forEach(e=>{r+=`⢠${e} 4 5`})}),r.trim()))}),children:(0,n.jsx)(l.A,{icon:"tabler:copy"})})]}),(0,n.jsx)(eF.A,{overflow:"auto",children:e?.modules.map(e=>(0,n.jsxs)(eF.A,{children:[(0,n.jsx)(F.A,{bgcolor:(0,eT.X4)(a.palette.primary.main,.16),borderRadius:"4px",padding:a.spacing(1.25,1.5),children:(0,n.jsx)(o.A,{variant:"body2",children:e.title})}),(0,n.jsx)(eF.A,{gap:a.spacing(.5),children:e.lessons.map(e=>(0,n.jsxs)(eN,{children:[(0,n.jsx)(o.A,{variant:"body2",children:"â¢"}),(0,n.jsx)(o.A,{variant:"body2",children:e})]},e))})]},e.title))})]},i)})})})}),e$=({onNext:e,onPrevious:t,courseGenerationTask:r})=>{let{t:l}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.topics"}),{t:d}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.navigation"}),c=(0,i.A)(),{courseStructure:p,isGenerateCourseStructureError:m,isGenerateCourseStructureFetching:g,refetchSuggestions:y}=(e=>{let{notify:t}=(0,A.A)(),{isFetching:r,isError:n,data:s,refetch:i}=ew(e,1),{isFetching:o,isError:l,data:d,refetch:c}=ew(e,2),{isFetching:u,isError:p,data:m,refetch:g}=ew(e,3),y=(0,a.useCallback)(async()=>{try{let[e,r,n]=await Promise.all([i(),c(),g()]);if(e.error||r.error||n.error)return void t("COURSE_GENERATION.generate_structure",{type:"error"});t("COURSE_GENERATION.generate_structure")}catch(e){t("COURSE_GENERATION.generate_structure",{type:"error"})}},[t,i,c,g]);return(0,a.useMemo)(()=>({isGenerateCourseStructureFetching:r||o||u,isGenerateCourseStructureError:n||l||p,refetchSuggestions:y,courseStructure:[s,d,m]}),[s,d,m,n,l,p,r,o,u,y])})(r),{onSubmit:x,isSubmitting:h,form:{watch:f,setValue:_,getValues:b,formState:{errors:j}}}=eI({courseGenerationTask:r,onSubmitSuccessful:e}),C=e=>{let{path:t,value:r}=e.detail,n=structuredClone(b());(0,eC.F)(n,t,r),_(t,r,{shouldValidate:!0,shouldDirty:!0})};(0,a.useEffect)(()=>(window.addEventListener("form:setValue",C),()=>{window.removeEventListener("form:setValue",C)}),[_,b]);let v=j?.modules,E=(0,a.useCallback)(()=>{_("modules",[]),y()},[y,_]),w=(0,eS.A)(e=>e.breakpoints.down("md")),k=f(),I=(0,a.useCallback)(()=>g?(0,n.jsxs)(s.A,{direction:w?"column":"row",gap:c.spacing(4),width:"100%",children:[(0,n.jsx)(eE.A,{sx:{flex:1},variant:"rectangular",width:w?"100%":void 0,height:w?200:350}),(0,n.jsx)(eE.A,{sx:{flex:1},variant:"rectangular",width:w?"100%":void 0,height:w?200:350}),(0,n.jsx)(eE.A,{sx:{flex:1},variant:"rectangular",width:w?"100%":void 0,height:w?200:350})]}):!p||m?(0,n.jsx)(o.A,{variant:"body2",children:l("structure_loading_error")}):(0,n.jsxs)(s.A,{spacing:c.spacing(2),children:[(0,n.jsx)(eM,{structureFields:p,selectedStru
5cture:k,onChangeSelectedModule:e=>{_("modules",e.modules)}}),v?.message&&(0,n.jsx)(S.A,{error:!0,children:l(`validation.${v.message}`)})]}),[p,v?.message,m,g,w,k,_,l,c]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(s.A,{spacing:c.spacing(6),"data-sentry-element":"Stack","data-sentry-source-file":"CourseTopicsForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:c.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"CourseTopicsForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h2",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"CourseTopicsForm.tsx",children:l("title")}),(0,n.jsx)(o.A,{variant:"subtitle1",color:c.colorWithOpacity(c.palette.grey[900],60),"data-sentry-element":"Typography","data-sentry-source-file":"CourseTopicsForm.tsx",children:l("subtitle")})]}),(0,n.jsxs)(s.A,{alignItems:"center",gap:c.spacing(4),"data-sentry-element":"Stack","data-sentry-source-file":"CourseTopicsForm.tsx",children:[I(),(0,n.jsx)(em.A,{"data-element-type":"button","data-ai-field":"other suggestion button",loading:g,onClick:E,"data-sentry-element":"LoadingButton","data-sentry-source-file":"CourseTopicsForm.tsx",children:m?l("regenerate_suggestions"):l("other_suggestions")})]})]}),(0,n.jsx)(er.A,{saveButton:{"data-element-type":"button","data-ai-field":"next step button",onSubmit:x,text:d("next"),variant:"contained",isSubmitting:h},applyButton:{"data-element-type":"button","data-ai-field":"previous step button",text:d("previous"),variant:"outlined",onSubmit:t},"data-sentry-element":"FormFooter","data-sentry-source-file":"CourseTopicsForm.tsx"})]})};var eW=r(85811),eD=r(76747);let ez=({append:e})=>{let t=(0,a.useRef)(null),r=(0,i.A)(),{t:s}=(0,u.o)(),[o,l]=(0,a.useState)(""),d=e=>{let{path:r,value:n}=e.detail,a=t.current?.querySelector(`[data-form-path="${r}"]`);a&&(a.value=n,a.dispatchEvent(new Event("input",{bubbles:!0})),l(n))};return(0,a.useEffect)(()=>(window.addEventListener("form:setValue",d),()=>{window.removeEventListener("form:setValue",d)}),[]),(0,n.jsxs)(eF.A,{ref:t,marginX:r.spacing(4),padding:r.spacing(4),borderRadius:r.spacing(2),border:`1px solid ${r.palette.divider}`,bgcolor:r.palette.background.paper,gap:r.spacing(2),sx:{flexDirection:{xs:"column",sm:"row"}},"data-sentry-element":"Stack","data-sentry-component":"AppendModule","data-sentry-source-file":"AppendModule.tsx",children:[(0,n.jsx)(R.XY,{"data-form-path":"enter_module_title","data-element-type":"input","data-ai-field":"Enter/change a new module title",onChange:e=>l(e.target.value),value:o,placeholder:s("extracted.enter_module_title"),fullWidth:!0,"data-sentry-element":"CustomTextField","data-sentry-source-file":"AppendModule.tsx"}),(0,n.jsx)(el.A,{"data-element-type":"button","data-ai-field":`appent/add module with title = ${o}`,disabled:0===o.length,onClick:()=>{e({title:o,lessons:[]}),l("")},variant:"outlined",endIcon:(0,n.jsx)(eW.In,{icon:"tabler:plus"}),sx:{minWidth:"195px"},"data-sentry-element":"Button","data-sentry-source-file":"AppendModule.tsx",children:s("ACTION.ENTITY.add_module")})]})},eL=({appendLesson:e,moduleIndex:t})=>{let r=(0,a.useRef)(null),s=(0,i.A)(),{t:o}=(0,u.o)(),[l,d]=(0,a.useState)(""),c=e=>{let{path:t,value:n}=e.detail,a=r.current?.querySelector(`[data-form-path="${t}"]`);a&&(a.value=n,a.dispatchEvent(new Event("input",{bubbles:!0})),d(n))};return(0,a.useEffect)(()=>(window.addEventListener("form:setValue",c),()=>{window.removeEventListener("form:setValue",c)}),[]),(0,n.jsxs)(eF.A,{ref:r,gap:s.spacing(2),sx:{flexDirection:{xs:"column",sm:"row"}},"data-sentry-element":"Stack","data-sentry-component":"AppendLesson","data-sentry-source-file":"AppendLesson.tsx",children:[(0,n.jsx)(R.XY,{"data-form-path":`enter_lesson_title_to_module_${t}`,"data-element-type":"input","data-ai-field":`Enter/change a new lesson title for module with index = ${t}`,onChange:e=>d(e.target.value),value:l,placeholder:o("extracted.enter_lesson_title"),fullWidth:!0,"data-sentry-element":"CustomTextField","data-sentry-source-file":"AppendLesson.tsx"}),(0,n.jsx)(el.A,{"data-element-type":"button","data-ai-field":`appent/add lesson with title = ${l} to module with index = ${t}`,disabled:0===l.length,onClick:()=>{e(l),d("")},variant:"outlined",endIcon:(0,n.jsx)(eW.In,{icon:"tabler:plus"}),sx:{minWidth:"145px"},"data-sentry-element":"Button","data-sentry-source-file":"AppendLesson.tsx",children:o("ACTION.ENTITY.add_lesson")})]})},eq=(0,a.memo)(({before:e,moduleIndex:t,lessonIndex:r,onRemove:s})=>{let l=(0,i.A)(),{t:d}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.structure"}),{control:c,setValue:p,formState:{errors:m}}=(0,O.xW)(),g=m?.modules?.[t]?.lessons?.[r],y=(0,O.FH)({control:c,name:`modules.${t}.lessons.${r}`}),[x,h]=(0,a.useState)(""),{toggle:f,isOpen:_}=(0,ec.A)(),A=e=>{let{path:t,value:r}=e.detail,n=document.querySelector(`[data-form-path="${t}"]`);n&&(n.value=r,n.dispatchEvent(new Event("input",{bubbles:!0})),h(r))};return(0,a.useEffect)(()=>(window.addEventListener("form:setValue",A),()=>{window.removeEventListener("form:setValue",A)}),[]),(0,n.jsxs)(eF.A,{direction:"row",gap:l.spacing(2),padding:l.spacing(1),bgcolor:l.palette.background.default,alignItems:"center",borderRadius:l.spacing(1),children:[e,(0,n.jsxs)(eF.A,{alignItems:"center",direction:"row",justifyContent:"space-between",gap:l.spacing(2),width:"100%",children:[_?(0,n.jsx)(R.XY,{"data-form-path":`modules.${t}.lessons.${r}`,"data-element-type":"input","data-ai-field":`edit title input field for lesson with index = ${r} for module with index = ${t}`,value:x,onChange:e=>h(e.target.value),size:"small",fullWidth:!0,error:!!g,helperText:g?.message&&d(`validation.${g.message}`)}):(0,n.jsxs)(eF.A,{spacing:l.spacing(1),children:[(0,n.jsx)(o.A,{variant:"body2",children:y}),g?.message&&(0,n.jsx)(S.A,{error:!0,children:d(`validation.${g.message}`)})]}),(0,n.jsx)(eF.A,{direction:"row",gap:_?l.spacing(2):0,children:_?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(el.A,{"data-element-type":"button","data-ai-field":`cancel editing lesson title with module index = ${t} and lesson index = ${r}`,sx:{maxHeight:30,maxWidth:30,minHeight:30,minWidth:30,padding:l.spacing(1)},variant:"outlined",onClick:()=>{f(),h(y)},color:"error",children:(0,n.jsx)(eW.In,{icon:"tabler:x"})}),(0,n.jsx)(el.A,{"data-element-type":"button","data-ai-field":`save lesson title with module index = ${t} and lesson index = ${r}`,sx:{maxHeight:30,maxWidth:30,minHeight:30,minWidth:30,padding:l.spacing(1)},variant:"contained",onClick:()=>{p(`modules.${t}.lessons.${r}`,x),f()},color:"success",disabled:0===x.length,children:(0,n.jsx)(eW.In,{icon:"tabler:check",color:l.palette.common.white})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eG.A,{"data-element-type":"button","data-ai-field":`edit lesson title with module index = ${t} and lesson index = ${r}`,size:"small",onClick:()=>{f(),h(y)},color:"primary",children:(0,n.jsx)(eW.In,{fontSize:18,icon:"tabler:pencil"})}),(0,n.jsx)(eG.A,{"data-element-type":"button","data-ai-field":`remove lesson title with module index = ${t} and lesson index = ${r}`,size:"small",onClick:()=>s(r),color:"error",children:(0,n.jsx)(eW.In,{fontSize:18,icon:"tabler:trash"})})]})})]})]})}),eV=(0,a.memo)(({index:e,onRemove:t,before:r})=>{let s=(0,i.A)(),{t:l}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.structure"}),[d,c]=(0,a.useState)(""),{toggle:p,isOpen:m}=(0,ec.A)(),{control:g,getValues:y,setValue:x,formState:{errors:h}}=(0,O.xW)(),f=(0,O.FH)({control:g,name:`modules.${e}.title`}),_=h?.modules?.[e],A=h?.modules?.[e]?.lessons,b=e=>{let{path:t,value:r}=e.detail,n=document.querySelector(`[data-form-path="${t}"]`);n&&(n.value=r,n.dispatchEvent(new Event("input",{bubbles:!0})),c(r))};(0,a.useEffect)(()=>(window.addEventListener("form:setValue",b),()=>{window.removeEventListener("form:setValue",b)}),[]);let j=(0,O.FH)({control:g,name:`modules.${e}.lessons`}),C=t=>{x(`modules.${e}.lessons`,j.filter((e,r)=>r!==t))};return(0,n.jsx)(eF.A,{padding:s.spacing(4),borderRadius:s.spacing(2),border:`1px solid ${s.palette.divider}`,bgcolor:s.palette.background.paper,children:(0,n.jsxs)(eF.A,{gap:s.spacing(2),children:[(0,n.jsxs)(eF.A,{direction:"row",alignItems:"center",gap:s.spacing(1),width:"100%",children:[r,(0,n.jsxs)(eF.A,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:s.spacing(2),paddingX:s.spacing(2),width:"100%",children:[m?(0,n.jsx)(R.XY,{"data-form-path":`modules.${e}.title`,"data-element-type":"input","data-ai-field":`edit title input field for module with index = ${e}`,value:d,onChange:e=>c(e.target.value),size:"small",fullWidth:!0,error:!!_,helperText:_?.message&&l(`validation.${_.message}`)}):(0,n.jsxs)(eF.A,{spacing:s.spacing(1),children:[(0,n.jsx)(o.A,{variant:"body1",fontWeight:600,children:f}),_?.message&&(0,n.jsx)(S.A,{error:!0,children:l(`validation.${_.message}`)})]}),(0,n.jsx)(eF.A,{direction:"row",gap:m?s.spacing(2):0,children:m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(el.A,{sx:{maxHeight:30,maxWidth:30,minHeight:30,minWidth:30,padding:s.spacing(1)},variant:"outlined",onClick:()=>{p(),c(f)},color:"error",children:(0,n.jsx)(eW.In,{icon:"tabler:x"})}),(0,n.jsx)(el.A,{sx:{maxHeight:30,maxWidth:30,minHeight:30,minWidth:30,padding:s.spacing(1)},variant:"contained",onClick:()=>{x(`modules.${e}.title`,d),p()},color:"success",disabled:0===d.length,children:(0,n.jsx)(eW.In,{icon:"tabler:check",color:s.palette.common.white})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eG.A,{size:"small",onClick:()=>{p(),c(f)},color:"primary",children:(0,n.jsx)(eW.In,{fontSize:18,icon:"tabler:pencil"})}),(0,n.jsx)(eG.A,{size:"small",onClick:()=>t(e),color:"error",children:(0,n.jsx)(eW.In,{fontSize:18,icon:"tabler:trash"})})]})})]})]}),(0,n.jsxs)(eF.A,{padding:s.spacing(4),gap:s.spacing(2),children:[A?.message&&(0,n.jsx)(S.A,{error:!0,children:l(`validation.${A.message}`)}),(0,n.jsx)(eD.JY,{onDragEnd:t=>{if(!t.destination)return;let r=t.source.index,n=t.destination.index;if(r===n)return;let a=[...y(`modules.${e}.lessons`)],[s]=a.splice(r,1);a.splice(n,0,s),((t,r)=>{let n=[...j],[a]=n.splice(t,1);n.splice(r,0,a),x(`modules.${e}.lessons`,n)})(r,n)},children:(0,n.jsx)(eD.gL,{droppableId:`lessons-${e}`,children:t=>(0,n.jsxs)(eF.A,{ref:t.innerRef,...t.droppableProps,gap:s.spacing(2),children:[j.map((t,r)=>(0,n.jsx)(eD.sx,{draggableId:`${t}-${r}`,index:r,children:t=>(0,n.jsx)(eF.A,{ref:t.innerRef,...t.draggableProps,children:(0,n.jsx)(eq,{before:(0,n.jsx)("div",{children:(0,n.jsx)(eG.A,{color:"primary",sx:{cursor:"grab"}
5,...t.dragHandleProps,children:(0,n.jsx)(eW.In,{icon:"tabler:grip-vertical"})})}),lessonIndex:r,moduleIndex:e,onRemove:C})})},r)),t.placeholder]})})}),(0,n.jsx)(eL,{appendLesson:t=>{x(`modules.${e}.lessons`,[...j,t])},moduleIndex:e},e)]})]})},e)}),eB=()=>{let e=(0,i.A)(),{t}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.structure"}),{control:r,getValues:a,formState:{errors:s}}=(0,O.xW)(),{fields:o,remove:l,move:d,append:c}=(0,O.jz)({control:r,name:"modules"}),p=s?.modules;return(0,n.jsx)(eF.A,{gap:e.spacing(6),"data-sentry-element":"Stack","data-sentry-component":"CustomizeCourse","data-sentry-source-file":"CustomizeCourse.tsx",children:(0,n.jsx)(eF.A,{gap:e.spacing(4),"data-sentry-element":"Stack","data-sentry-source-file":"CustomizeCourse.tsx",children:(0,n.jsxs)(eF.A,{gap:e.spacing(2),"data-sentry-element":"Stack","data-sentry-source-file":"CustomizeCourse.tsx",children:[(0,n.jsx)(eF.A,{"data-sentry-element":"Stack","data-sentry-source-file":"CustomizeCourse.tsx",children:(0,n.jsxs)(eF.A,{direction:"row",gap:e.spacing(2),padding:e.spacing(4),"data-sentry-element":"Stack","data-sentry-source-file":"CustomizeCourse.tsx",children:[p?.message&&(0,n.jsx)(S.A,{error:!0,children:t(`validation.${p.message}`)}),(0,n.jsx)(eD.JY,{onDragEnd:e=>{if(!e.destination)return;let t=e.source.index,r=e.destination.index;if(t===r)return;let n=[...a("modules")],[s]=n.splice(t,1);n.splice(r,0,s),d(t,r)},"data-sentry-element":"DragDropContext","data-sentry-source-file":"CustomizeCourse.tsx",children:(0,n.jsx)(eD.gL,{droppableId:"modules","data-sentry-element":"Droppable","data-sentry-source-file":"CustomizeCourse.tsx",children:t=>(0,n.jsxs)(eF.A,{ref:t.innerRef,...t.droppableProps,gap:e.spacing(4),width:"100%",children:[o.map((e,t)=>(0,n.jsx)(eD.sx,{draggableId:e.id,index:t,children:r=>(0,n.jsx)(eF.A,{ref:r.innerRef,...r.draggableProps,children:(0,n.jsx)(eV,{before:(0,n.jsx)("div",{children:(0,n.jsx)(eG.A,{color:"primary",sx:{cursor:"grab"},...r.dragHandleProps,children:(0,n.jsx)(eW.In,{icon:"tabler:grip-vertical"})})}),index:t,onRemove:l},e.id)})},e.id)),t.placeholder]})})})]})}),(0,n.jsx)(ez,{append:c,"data-sentry-element":"AppendModule","data-sentry-source-file":"CustomizeCourse.tsx"})]})})})},eU=({onNext:e,onPrevious:t,courseGenerationTask:r})=>{let{t:a}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.structure"}),{t:l}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.navigation"}),d=(0,i.A)(),{onSubmit:c,isSubmitting:p,form:m}=eI({courseGenerationTask:r,onSubmitSuccessful:e});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(s.A,{spacing:d.spacing(6),"data-sentry-element":"Stack","data-sentry-source-file":"CourseStructureForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:d.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"CourseStructureForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h2",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"CourseStructureForm.tsx",children:a("title")}),(0,n.jsx)(o.A,{variant:"subtitle1",color:d.colorWithOpacity(d.palette.grey[900],60),"data-sentry-element":"Typography","data-sentry-source-file":"CourseStructureForm.tsx",children:a("subtitle")})]}),(0,n.jsx)(O.Op,{...m,"data-sentry-element":"FormProvider","data-sentry-source-file":"CourseStructureForm.tsx",children:(0,n.jsx)(eB,{"data-sentry-element":"CustomizeCourse","data-sentry-source-file":"CourseStructureForm.tsx"})})]}),(0,n.jsx)(er.A,{saveButton:{onSubmit:c,text:l("next"),variant:"contained",isSubmitting:p},applyButton:{text:l("previous"),variant:"outlined",onSubmit:t},"data-sentry-element":"FormFooter","data-sentry-source-file":"CourseStructureForm.tsx"})]})};var eH=r(48185),eK=r(25875),eY=r(50064);let eQ=({taskId:e,getValues:t,trigger:r})=>{let{t:l}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.generate_tab"}),{notify:d}=(0,A.A)(),c=(0,i.A)(),{isGeneratePreviewImagePending:p,mutateGeneratePreviewImage:m,previewImageData:y}=(()=>{let{notify:e}=(0,A.A)(),{isPending:t,mutate:r,data:n}=(0,W.n)({mutationFn:g.x.generateImagePreview,onError:()=>e("COURSE_GENERATION.generate_preview",{type:"error"}),onSuccess:()=>e("COURSE_GENERATION.generate_preview")});return{isGeneratePreviewImagePending:t,mutateGeneratePreviewImage:r,previewImageData:n?.data.result}})(),x=(0,a.useCallback)(async()=>{let{generation_model:n,image_style:a}=t();(n||await r("generation_model"),a||await r("image_style"),n&&a)?m({i
5d:e,image_source:n,image_style:a}):d("COURSE_GENERATION.preview_validation",{type:"error"})},[t,m,d,e,r]);return(0,n.jsxs)(s.A,{"data-sentry-element":"Stack","data-sentry-component":"ImagePreviewGenerator","data-sentry-source-file":"ImagePreviewGenerator.tsx",children:[(0,n.jsxs)(s.A,{spacing:c.spacing(3),"data-sentry-element":"Stack","data-sentry-source-file":"ImagePreviewGenerator.tsx",children:[(0,n.jsxs)(s.A,{position:"relative",direction:"row",justifyContent:"space-between",alignItems:"flex-start","data-sentry-element":"Stack","data-sentry-source-file":"ImagePreviewGenerator.tsx",children:[(0,n.jsx)(F.A,{"data-sentry-element":"Box","data-sentry-source-file":"ImagePreviewGenerator.tsx",children:y&&(0,n.jsx)(s.A,{spacing:c.spacing(4),children:y?.file_ids?.map(e=>(0,n.jsx)(F.A,{children:(0,n.jsx)("img",{src:(0,eY.s4)(e||"",356),alt:"Generated image preview"})},e))})}),(0,n.jsx)(em.A,{"data-element-type":"button","data-ai-field":`${!y?"image preview":"regenerate image preview"} button click`,variant:"outlined",onClick:x,loading:p,"data-sentry-element":"LoadingButton","data-sentry-source-file":"ImagePreviewGenerator.tsx",children:l(y?"regenerate":"image_preview")})]}),y&&(0,n.jsx)(o.A,{color:c.colorWithOpacity("#4B465C",50),fontSize:13,children:l("cover_image_info")})]}),p&&(0,n.jsxs)(s.A,{justifyContent:"center",alignItems:"center",gap:c.spacing(2),children:[(0,n.jsx)(eh,{}),(0,n.jsx)(o.A,{variant:"body2",children:l("generating_image")})]})]})};var eX=r(54587),eJ=r.n(eX),eZ=r(22870);let e0=(0,G.Ay)(s.A)(({theme:e,isSelected:t,isDisabled:r})=>({borderRadius:"8px",cursor:r?void 0:"pointer",overflow:"hidden",border:`4px solid ${t?e.palette.primary.main:e.palette.grey[200]}`,opacity:r?"60%":void 0,pointerEvents:r?"none":void 0,position:"relative","&:hover":{border:`4px solid ${e.palette.primary[300]}`},"&:active":{border:`4px solid ${e.palette.primary.main}`}})),e1=(0,G.Ay)(o.A)(({theme:e})=>({position:"absolute",bottom:0,width:"100%",padding:e.spacing(6,1.5,1,1.5),color:e.palette.common.white,background:`linear-gradient(0deg, ${e.colorWithOpacity(e.palette.common.black,50)} 0%, ${e.colorWithOpacity(e.palette.common.black,50)} 30%, ${e.colorWithOpacity(e.palette.common.black,0)} 100%)`})),e2={modern_educational:(0,eZ.Fb)("/images/image-style-example/modernEducational.png"),cartoon_friendly:(0,eZ.Fb)("/images/image-style-example/cartoonFriendly.png"),realistic_with_people:(0,eZ.Fb)("/images/image-style-example/realisticWithPeople.png"),minimalist:(0,eZ.Fb)("/images/image-style-example/minimalist.png"),infographic:(0,eZ.Fb)("/images/image-style-example/infographic.png"),watercolor_artistic:(0,eZ.Fb)("/images/image-style-example/watercolorArtistic.png"),tech_digital:(0,eZ.Fb)("/images/image-style-example/techDigital.png"),nature_organic:(0,eZ.Fb)("/images/image-style-example/natureOrganic.png")},e5=({value:e,onChange:t,isDisabled:r=!1})=>{let{t:l}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.generate_tab"}),d=(0,i.A)(),c=(0,a.useMemo)(()=>Object.entries(V.Hj).map(([e,t])=>({value:t,text:l(`style_labels.${e}`),imageSource:e in V.Hj?e2[e]:""})),[l]);return(0,n.jsxs)(s.A,{spacing:d.spacing(2),"data-sentry-element":"Stack","data-sentry-component":"ImageStylePicker","data-sentry-source-file":"ImageStylePicker.tsx",children:[(0,n.jsx)(o.A,{variant:"h6",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"ImageStylePicker.tsx",children:l("image_style_label")}),(0,n.jsx)(s.A,{direction:"row",spacing:d.spacing(4),flexWrap:"wrap",useFlexGap:!0,"data-sentry-element":"Stack","data-sentry-source-file":"ImageStylePicker.tsx",children:c.map(({value:a,text:i,imageSource:o},l)=>(0,n.jsx)(s.A,{spacing:d.spacing(2),children:(0,n.jsxs)(e0,{"data-element-type":"button","data-ai-field":`Click on image style with value = ${i} and element index = ${l}`,onClick:()=>t(a),isSelected:e===a,isDisabled:r,children:[(0,n.jsx)(eJ(),{src:o,alt:i,width:125,height:125,style:{borderRadius:"3px"}}),(0,n.jsx)(e1,{variant:"caption",children:i})]})},a))})]})};var e4=r(18889);let e3=(0,G.Ay)(eH.A)(({theme:e})=>({padding:e.spacing(0,1,0,0)}
5)),e6=(0,G.Ay)(E.A)({display:"flex",alignItems:"flex-start"}),e8=(0,G.Ay)(o.A)(({theme:e})=>({color:e.colorWithOpacity(e.palette.grey[500],80),fontSize:13})),e9=(0,G.Ay)(eK.A)(({theme:e})=>({marginTop:e.spacing(-2),marginBottom:e.spacing(-3)})),e7=({onPrevious:e,courseGenerationTask:t,modelAccess:r})=>{let{t:d}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.generate_tab"}),{t:c}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.navigation"}),{t:p}=(0,u.o)("translation",{keyPrefix:"PAGE.AI_VIDEO_CREATION.setup_avatar_modal"}),x=(0,i.A)(),h=(0,a.useMemo)(()=>r?.models?.map(e=>{let t=e.is_available,r=e.access===U.iw.PAID,a=(0,n.jsxs)(s.A,{direction:"row",alignItems:"center",spacing:x.spacing(2),children:[(0,n.jsx)(o.A,{children:d(`models.${e.title}`)}),r&&(0,n.jsx)(e4.T,{badgeColor:"primary",children:t?p("paid_model"):p("not_enough_credits_for_model")})]});return{disabled:!t,value:e.title,name:"",additionalValue:a}})||[],[r?.models,x,d,p]),{control:f,onSubmit:_,isSubmitting:b,getValues:j,trigger:C,setValue:S}=(({courseGenerationTask:e,onSubmitSuccessful:t,shouldInvalidateQueries:r=!0})=>{let{control:a,handleSubmit:s,setValue:i,getValues:o,trigger:l,formState:{isSubmitting:d}}=(0,O.mN)({resolver:(0,M.u)(X),defaultValues:{content_generation_enabled:e?.content_generation_enabled??!1,module_thumbnail_generation_enabled:e?.module_thumbnail_generation_enabled??!1,lesson_thumbnail_generation_enabled:e?.lesson_thumbnail_generation_enabled??!1,lesson_image_generation_enabled:e?.lesson_image_generation_enabled??!1,generation_model:e?.generation_model||V.HL.mentorVision,image_style:e?.image_style||V.Hj.modern_educational},mode:"all"}),{isUpdateCourseGenerationPending:c,mutateUpdateCourseGenerationAsync:u}=D(r),{isStartCourseGenerationPending:p,mutateStartCourseGenerationAsync:x}=((e,t=!0)=>{let{notify:r,notifyContent:a}=(0,A.A)(),{user:s}=(0,m.A)(),i=(0,$.jE)(),{isPending:o,mutateAsync:l}=(0,W.n)({mutationFn:g.x.startCourseGenerationTask,onError:e=>{(0,L.HQ)(e)?a((0,n.jsx)(z.n,{}),{type:"error"}):r("COURSE_GENERATION.start_generating",{type:"error"})},onSuccess:n=>{let a=n.data.result.status;"completed"===a&&r("COURSE_GENERATION.start_generating"),"finish_with_error"===a&&r("COURSE_GENERATION.start_generating",{type:"error"}),i.invalidateQueries({queryKey:y.Ay.courseGeneration.status(e).queryKey}),t&&i.invalidateQueries({queryKey:y.Ay.courseGeneration.detail({portal_id:s?.portal.id||0}).queryKey})},onSettled:()=>{i.invalidateQueries({queryKey:y.Ay.courseGeneration.status(e).queryKey}),t&&i.invalidateQueries({queryKey:y.Ay.courseGeneration.detail({portal_id:s?.portal.id||0}).queryKey})}});return{isStartCourseGenerationPending:o,mutateStartCourseGenerationAsync:l}})(e?.id||0,!1);return{control:a,onSubmit:s(async r=>{if(e)try{await u({id:e.id,...r}),await x({id:e.id}),t?.()}catch(e){console.error(e)}}),setValue:i,getValues:o,trigger:l,isSubmitting:d||c||p}})({courseGenerationTask:t}),w=(0,a.useCallback)(e=>{let t=r?.models?.find(t=>t.title===e);if(t&&t.access===U.iw.PAID&&t.is_available)return x.palette.grey[300]},[r,x]),k=(0,O.FH)({control:f,name:"content_generation_enabled"});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(s.A,{spacing:x.spacing(6),"data-sentry-element":"Stack","data-sentry-source-file":"GenerateCourseForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:x.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"GenerateCourseForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h2",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"GenerateCourseForm.tsx",children:d("title")}),(0,n.jsx)(o.A,{variant:"subtitle1",color:x.colorWithOpacity(x.palette.grey[900],60),"data-sentry-element":"Typography","data-sentry-source-file":"GenerateCourseForm.tsx",children:d("subtitle")})]}),(0,n.jsxs)(s.A,{spacing:x.spacing(12),"data-sentry-element":"Stack","data-sentry-source-file":"GenerateCourseForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:x.spacing(4),"data-sentry-element":"Stack","data-sentry-source-file":"GenerateCourseForm.tsx",children:[(0,n.jsx)(o.A,{variant:"h5",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"GenerateCourseForm.tsx",children:d("preferences")}
5),(0,n.jsxs)(s.A,{spacing:x.spacing(5),"data-sentry-element":"Stack","data-sentry-source-file":"GenerateCourseForm.tsx",children:[(0,n.jsxs)(s.A,{spacing:x.spacing(3),useFlexGap:!0,"data-sentry-element":"Stack","data-sentry-source-file":"GenerateCourseForm.tsx",children:[(0,n.jsx)(O.xI,{control:f,name:"content_generation_enabled",render:({field:{value:e,onChange:t}})=>(0,n.jsx)(e6,{control:(0,n.jsx)(e9,{"data-element-type":"button","data-ai-field":`Generate content for all pages switch button with ${e?"switched on":"switched off"} value`,checked:e,value:e,onChange:e=>{let r=e.target.checked;S("lesson_thumbnail_generation_enabled",r),S("module_thumbnail_generation_enabled",r),S("lesson_image_generation_enabled",!1),t(r)}}),label:(0,n.jsxs)(s.A,{spacing:x.spacing(1),children:[(0,n.jsx)(o.A,{variant:"body1",children:d("all_pages_label")}),(0,n.jsx)(e8,{children:d("all_pages_sublabel")})]})}),"data-sentry-element":"Controller","data-sentry-source-file":"GenerateCourseForm.tsx"}),(0,n.jsxs)(s.A,{marginLeft:x.spacing(12.5),spacing:x.spacing(3),useFlexGap:!0,"data-sentry-element":"Stack","data-sentry-source-file":"GenerateCourseForm.tsx",children:[(0,n.jsx)(E.A,{disabled:!0,checked:!0,control:(0,n.jsx)(e3,{}),label:d("generate_cover_img"),"data-sentry-element":"FormControlLabel","data-sentry-source-file":"GenerateCourseForm.tsx"}),(0,n.jsx)(O.xI,{control:f,name:"module_thumbnail_generation_enabled",render:({field:e})=>(0,n.jsx)(E.A,{disabled:!k,control:(0,n.jsx)(e3,{"data-element-type":"button","data-ai-field":`Generate thumbnail images for each module checkbox ${e.value?"checked":"unchecked"} checkbox`,checked:e.value,...e}),label:d("each_module")}),"data-sentry-element":"Controller","data-sentry-source-file":"GenerateCourseForm.tsx"}),(0,n.jsx)(O.xI,{control:f,name:"lesson_thumbnail_generation_enabled",render:({field:e})=>(0,n.jsx)(E.A,{disabled:!k,control:(0,n.jsx)(e3,{"data-element-type":"button","data-ai-field":`Generate thumbnail images for each lesson ${e.value?"checked":"unchecked"} checkbox`,checked:e.value,...e}),label:d("each_lesson")}),"data-sentry-element":"Controller","data-sentry-source-file":"GenerateCourseForm.tsx"}),(0,n.jsx)(O.xI,{control:f,name:"lesson_image_generation_enabled",render:({field:e})=>(0,n.jsx)(E.A,{disabled:!k,control:(0,n.jsx)(e3,{"data-element-type":"button","data-ai-field":`Generate images within lessons ${e.value?"checked":"unchecked"} checkbox`,checked:e.value,...e}),label:d("within_lessons")}),"data-sentry-element":"Controller","data-sentry-source-file":"GenerateCourseForm.tsx"})]})]}),(0,n.jsx)(O.xI,{control:f,name:"generation_model",render:({field:{value:e,onChange:t}})=>{let r,a=(r=V.HL,Object.keys(r).find(t=>r?.[t]===e)),i=w(e);return(0,n.jsxs)(s.A,{spacing:x.spacing(2),children:[(0,n.jsx)(ee.A,{disabled:!k,value:e,handleValueChange:t,selectItems:h,labelText:d("image_source_label"),hideAdditionalValueInOptions:!1,selectedStackProps:{sx:{color:i}}}),(0,n.jsx)(o.A,{variant:"body2",children:a&&a in V.HL?d(`model_description.${a}`):d("model_description.default_model_text")})]})},"data-sentry-element":"Controller","data-sentry-source-file":"GenerateCourseForm.tsx"}),(0,n.jsx)(O.xI,{control:f,name:"image_style",render:({field:{value:e,onChange:t}})=>(0,n.jsx)(e5,{value:e,onChange:e=>t(e),isDisabled:!k}),"data-sentry-element":"Controller","data-sentry-source-file":"GenerateCourseForm.tsx"})]})]}),k&&t&&(0,n.jsx)(eQ,{taskId:t.id,trigger:C,getValues:j})]})]}),(0,n.jsx)(er.A,{saveButton:{disabled:!r?.is_generation_available,tooltip:r?.is_generation_available?void 0:(0,n.jsxs)(s.A,{gap:x.spacing(1.5),direction:"row",children:[(0,n.jsxs)(o.A,{variant:"body1",color:"inherit",children:[p("PAGE.AGENT.insufficient_credits.title"),"."]}),(0,n.jsx)(o.A,{component:v(),href:"/credits",color:"inherit",children:p("PAGE.AGENT.insufficient_credits.action")})]}),onSubmit:r?.is_generation_available?_:()=>void 0,startIcon:(0,n.jsx)(l.A,{fontSize:24,icon:"tabler:wand"}),text:c("generate"),variant:"contained",isSubmitting:b},applyButton:{text:c("previous"),variant:"outlined",onSubmit:e},"data-sentry-element":"FormFooter","data-sentry-source-file":"GenerateCourseForm.tsx"})]})},te=({courseGenerationTask:e,isErrorStatus:t})=>{let{t:r}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION"}),{notify:s}=(0,A.A)(),i=(0,a.useRef)(!1);(0,a.useEffect)(()=>{t&&!i.current&&(i.current=!0,s("COURSE_GENERATION.finish_with_error",{type:"error"}))},[t,s]);let{data:o}=(0,p.I)({queryKey:y.Ay.courseGeneration.modelAccess.queryKey,queryFn:g.x.getModelAcce
5ss,select:({data:e})=>e.result}),[l,d]=(0,a.useState)(()=>t||!e?0:e.course_goal&&e.course_name&&e.course_description?e.course_structure&&e.course_structure?.modules&&0!==e.course_structure.modules.length?4:2:1),m=()=>{4!==l&&d(e=>e+1)},x=()=>{0!==l&&d(e=>e-1)};return(0,n.jsx)("form",{"data-sentry-component":"CourseGenerationForm","data-sentry-source-file":"CourseGenerationForm.tsx",children:(0,n.jsxs)(b.A,{stepperMode:!0,currentStepStatus:l,displayAsNumber:!0,"data-sentry-element":"FormLayout","data-sentry-source-file":"CourseGenerationForm.tsx",children:[(0,n.jsx)(j.A,{menuTitle:r("NAVIGATION.form.describe_course_title"),menuSubTitle:r("NAVIGATION.form.describe_course_subtitle"),"data-sentry-element":"FormTab","data-sentry-source-file":"CourseGenerationForm.tsx",children:(0,n.jsx)(eo,{onNext:m,courseGenerationTask:e,isGenerationAvailable:o?.is_generation_available,"data-sentry-element":"CourseDescriptionForm","data-sentry-source-file":"CourseGenerationForm.tsx"})}),(0,n.jsx)(j.A,{menuTitle:r("NAVIGATION.form.set_context_title"),menuSubTitle:r("NAVIGATION.form.set_context_subtitle"),"data-sentry-element":"FormTab","data-sentry-source-file":"CourseGenerationForm.tsx",children:e?(0,n.jsx)(ev,{onNext:m,onPrevious:x,courseGenerationTask:e}):(0,n.jsx)(c.A,{})}),(0,n.jsx)(j.A,{menuTitle:r("NAVIGATION.form.course_structure_title"),menuSubTitle:r("NAVIGATION.form.course_structure_subtitle"),"data-sentry-element":"FormTab","data-sentry-source-file":"CourseGenerationForm.tsx",children:(0,n.jsx)(e$,{onNext:m,onPrevious:x,courseGenerationTask:e,"data-sentry-element":"CourseTopicsForm","data-sentry-source-file":"CourseGenerationForm.tsx"})}),(0,n.jsx)(j.A,{menuTitle:r("NAVIGATION.form.modules_lessons_title"),menuSubTitle:r("NAVIGATION.form.modules_lessons_subtitle"),"data-sentry-element":"FormTab","data-sentry-source-file":"CourseGenerationForm.tsx",children:(0,n.jsx)(eU,{onNext:m,onPrevious:x,courseGenerationTask:e,"data-sentry-element":"CourseStructureForm","data-sentry-source-file":"CourseGenerationForm.tsx"})}),(0,n.jsx)(j.A,{menuTitle:r("NAVIGATION.form.generate_content_title"),menuSubTitle:r("NAVIGATION.form.generate_content_subtitle"),"data-sentry-element":"FormTab","data-sentry-source-file":"CourseGenerationForm.tsx",children:(0,n.jsx)(e7,{onPrevious:x,courseGenerationTask:e,modelAccess:o,"data-sentry-element":"GenerateCourseForm","data-sentry-source-file":"CourseGenerationForm.tsx"})})]})})};var tt=r(89099),tr=r(66664),tn=r(14840),ta=r(49158),ts=r(76068),ti=r(51220),to=r(8899);let tl=(0,G.Ay)(F.A)(({theme:e})=>({position:"absolute",top:`-${e.spacing(2.5)}`,right:`-${e.spacing(2.5)}`,display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,padding:e.spacing(1.5),borderRadius:e.spacing(1.5),backgroundColor:e.palette.customColors.cardBg,boxShadow:`0 2px 4px 0 ${e.colorWithOpacity(e.palette.grey[500],30)}`,cursor:"pointer"})),td=(0,G.Ay)(F.A)(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:e.spacing(4),padding:e.spacing(0,8,5.5,8)})),tc=(0,G.Ay)(F.A)(({theme:e})=>({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:807,width:"100%",border:0,outline:0,borderRadius:e.spacing(1.5),boxShadow:`0 5px 20px 0 ${e.colorWithOpacity(e.palette.grey[900],40)}`,backgroundColor:e.palette.customColors.cardBg,[e.breakpoints.down("sm")]:{width:"93%"}})),tu=(0,G.Ay)(s.A)(({theme:e})=>({padding:e.spacing(5,6,1),gap:e.spacing(1)})),tp=(0,G.Ay)(F.A)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4),padding:e.spacing(1,6,4)})),tm=({isOpen:e,onClose:t})=>{let{t:r}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.generating_loader.error_modal"}),d=(0,eS.A)(e=>e.breakpoints.down("md")),[c]=(0,a.useState)(()=>new Date),p=(0,i.A)();return(0,n.jsx)(ti.A,{open:e,onClose:t,"data-sentry-element":"Modal","data-sentry-component":"ErrorMessageModal","data-sentry-source-file":"ErrorMessageModal.tsx",children:(0,n.jsxs)(tc,{"data-sentry-element":"ModalContent","data-sentry-source-file":"ErrorMessageModal.tsx",children:[(0,n.jsx)(tl,{"data-sentry-element":"IconBox","data-sentry-source-file":"ErrorMessageModal.tsx",children:(0,n.jsx)(l.A,{icon:"tabler:x",onClick:t,"data-sentry-element":"Icon","data-sentry-source-file":"ErrorMessageModal.tsx"})}),(0,n.jsxs)(s.A,{spacing:p.spacing(5.5),"data-sentry-element":"Stack","data-sentry-source-file":"ErrorMessageModal.tsx",children:[(0,n.jsxs)(tu,{"data-sentry-element":"ModalHeader","data-sentry-source-file":"ErrorMessageModal.tsx",children:[(0,n.jsx)(o.A,{variant:"h3",component:"p",color:p.palette.grey[800],"data-sentry-element":"Typography","data-sentry-source-file":"ErrorMessageModal.tsx",children:r("title")}),(0,n.jsx)(o.A,{variant:"subtitle1",color:p.colorWithOpacity(p.palette.grey[800],60),"data-sentry-element":"Typography","data-sentry-source-file":"ErrorMessageModal.tsx",children:r("subtitle")})]}),(0,n.jsx)(tp,{"data-sentry-element":"ModalBody","data-sentry-source-file":"ErrorMessageModal.tsx",children:(0,n.jsxs)(s.A,{padding:p.spacing(3),border:`1px solid ${p.colorWithOpacity(p.palette.error.main,16)}`,borderRadius:"6px",spacing:p.spacing(3),"data-sentry-element":"Stack","data-sentry-source-file":"ErrorMessageModal.tsx",children:[(0,n.jsxs)(s.A,{direction:"row",spacing:p.spacing(3),alignItems:"flex-start","data-sentry-element":"Stack","data-sentry-source-file":"ErrorMessageModal.tsx",children:[(0,n.jsx)(F.A,{bgcolor:p.palette.error.main,padding:p.spacing(1.5),borderRadius:"6px",maxHeight:34,"data-sentry-element":"Box","data-sentry-source-file":"ErrorMessageModal.tsx",children:(0,n.jsx)(l.A,{icon:"tabler:alert-triangle",color:p.palette.common.white,fontSize:22,"data-sentry-element":"Icon","data-sentry-source-file":"ErrorMessageModal.tsx"})}),(0,n.jsxs)(s.A,{spacing:p.spacing(1),"data-sentry-element":"Stack","data-sentry-source-file":"ErrorMessageModal.tsx",children:[(0,n.jsxs)(F.A,{"data-sentry-element":"Box","data-sentry-source-file":"ErrorMessageModal.tsx",children:[c&&(0,n.jsx)(o.A,{variant:"body2",fontWeight:500,color:p.colorWithOpacity(p.palette.grey[900],50),children:(0,to.GP)(c,"dd.MM.uuuu HH:mm")}
5),(0,n.jsx)(o.A,{variant:"h5",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"ErrorMessageModal.tsx",children:r("error_message")})]}),(0,n.jsx)(o.A,{variant:"body1",color:p.colorWithOpacity(p.palette.grey[900],90),"data-sentry-element":"Typography","data-sentry-source-file":"ErrorMessageModal.tsx",children:r("generation_error")})]})]}),(0,n.jsx)(F.A,{padding:p.spacing(d?6:12,6),bgcolor:p.palette.background.default,"data-sentry-element":"Box","data-sentry-source-file":"ErrorMessageModal.tsx",children:(0,n.jsx)(o.A,{"data-sentry-element":"Typography","data-sentry-source-file":"ErrorMessageModal.tsx",children:r("moderation")})})]})})]}),(0,n.jsx)(td,{"data-sentry-element":"ModalFooter","data-sentry-source-file":"ErrorMessageModal.tsx",children:(0,n.jsx)(el.A,{onClick:t,variant:"tonal",size:"large","data-sentry-element":"Button","data-sentry-source-file":"ErrorMessageModal.tsx",children:r("close")})})]})})};var tg=r(80390);let ty=(0,G.Ay)(s.A)(({theme:e})=>({minHeight:650,justifyContent:"center",alignItems:"center",padding:e.spacing(6),borderRadius:e.spacing(1.5),backgroundColor:e.palette.background.paper,boxShadow:e.shadows[1],gap:e.spacing(6)})),tx=e=>{switch(e){case"in_progress":return 5;case"content_generation":case"finish_with_error":return 15;case"module_thumbnail_generation":return 50;case"lesson_thumbnail_generation":return 75;case"lesson_image_generation":return 90;case"completed":return 100;default:return 0}},th=e=>{let t=(0,i.A)();return(0,n.jsxs)(F.A,{sx:{position:"relative",display:"inline-flex"},"data-sentry-element":"Box","data-sentry-component":"CircularProgressWithLabel","data-sentry-source-file":"GeneratingLoader.tsx",children:[(0,n.jsxs)(F.A,{sx:{position:"relative",display:"inline-flex"},"data-sentry-element":"Box","data-sentry-source-file":"GeneratingLoader.tsx",children:[(0,n.jsx)(tr.A,{variant:"determinate",value:100,size:57,thickness:5,sx:{color:t.colorWithOpacity("#4B465C",8)},"data-sentry-element":"CircularProgress","data-sentry-source-file":"GeneratingLoader.tsx"}),(0,n.jsx)(tr.A,{size:57,thickness:5,variant:"determinate",sx:{color:t.palette.primary.main,position:"absolute",left:0,[`& .${tn.A.circle}`]:{strokeLinecap:"round"}},...e,"data-sentry-element":"CircularProgress","data-sentry-source-file":"GeneratingLoader.tsx"})]}),(0,n.jsx)(F.A,{sx:{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center"},"data-sentry-element":"Box","data-sentry-source-file":"GeneratingLoader.tsx",children:(0,n.jsx)(o.A,{variant:"body1",fontWeight:600,component:"div",sx:{color:"text.secondary"},"data-sentry-element":"Typography","data-sentry-source-file":"GeneratingLoader.tsx",children:`${Math.round(e.value)}%`})})]})},tf=({progressCheckStatus:e,text:t})=>{let r=(0,i.A)(),d=(0,a.useCallback)(()=>{switch(e){case"loading":default:return(0,n.jsx)(eh,{});case"success":return(0,n.jsx)(l.A,{icon:"tabler:circle-check-filled",fontSize:24,color:r.palette.success.main});case"error":return(0,n.jsx)(l.A,{icon:"tabler:circle-x-filled",fontSize:24,color:r.palette.error.main});case"unreached":return(0,n.jsx)(l.A,{icon:"tabler:circle-dashed",fontSize:24,color:r.palette.grey["600"]})}},[r,e]);return(0,n.jsxs)(s.A,{spacing:r.spacing(4),direction:"row",alignItems:"center","data-sentry-element":"Stack","data-sentry-component":"ProgressCheck","data-sentry-source-file":"GeneratingLoader.tsx",children:[d(),(0,n.jsx)(o.A,{variant:"body1","data-sentry-element":"Typography","data-sentry-source-file":"GeneratingLoader.tsx",children:t})]})},t_=(e,t,r)=>{if(!t)return"loading";if(V.Cd?.[t]>e)return"success";if("finish_with_error"===t){let t=r?V.Cd?.[r]:0;return void 0===r?"unreached":e<t?"success":e===t?"error":"unreached"}return"loading"},tA=({taskId:e,courseGenerationTask:t,hasAccess:r})=>{let{t:l}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION.generating_loader"}),d=(0,i.A)(),{notify:c}=(0,A.A)(),p=(0,tt.useRouter)(),{data:g,refetch:h}=(0,x.c)(e,{enabled:r}),_=g?.status,b=(0,$.jE)(),{isOpen:j,open:C,close:v}=(0,ts.A)(),{user:E}=(0,m.A)(),S=(0,a.useRef)(!1),w=(0,a.useRef)();(0,a.useEffect)(()=>{_&&"finish_with_error"!==_&&(w.current=_)},[_]),(0,ta.$)(async()=>
5{if("completed"===_){if(S.current)return;c("COURSE_GENERATION.generation"),S.current=!0,await p.push(f.C.courses),b.invalidateQueries({queryKey:y.Ay.courseGeneration.detail({portal_id:E?.portal.id||0}).queryKey}),b.invalidateQueries({queryKey:y.Ay.courseGeneration.status(e).queryKey});return}if("finish_with_error"===_){if(S.current)return;C(),S.current=!0;return}h()},2*tg.KF);let k=(0,a.useCallback)(()=>{let e=[{text:l("outlining"),progressCheckStatus:"success",enabled:!0},{text:l("generating_content"),progressCheckStatus:t_(V.Cd.content_generation,_,w.current),enabled:!0},{text:l("module_thumbnail_creation"),progressCheckStatus:t_(V.Cd.module_thumbnail_generation,_,w.current),enabled:!!t?.module_thumbnail_generation_enabled},{text:l("lesson_thumbnail_creation"),progressCheckStatus:t_(V.Cd.lesson_thumbnail_generation,_,w.current),enabled:!!t?.lesson_thumbnail_generation_enabled},{text:l("lesson_image_creation"),progressCheckStatus:t_(V.Cd.lesson_image_generation,_,w.current),enabled:!!t?.lesson_image_generation_enabled}];return(0,n.jsx)(s.A,{spacing:d.spacing(5),children:e.filter(e=>e.enabled).map(({text:e,progressCheckStatus:t})=>(0,n.jsx)(tf,{text:e,progressCheckStatus:t},e))})},[t?.lesson_image_generation_enabled,t?.lesson_thumbnail_generation_enabled,t?.module_thumbnail_generation_enabled,_,l,d]),I=(0,a.useMemo)(()=>"finish_with_error"===_?tx(w.current):tx(_),[_]);return(0,n.jsxs)(ty,{"data-sentry-element":"Wrapper","data-sentry-component":"GeneratingLoader","data-sentry-source-file":"GeneratingLoader.tsx",children:[(0,n.jsxs)(s.A,{spacing:d.spacing(1),textAlign:"center","data-sentry-element":"Stack","data-sentry-source-file":"GeneratingLoader.tsx",children:[(0,n.jsx)(o.A,{variant:"h4",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"GeneratingLoader.tsx",children:l("title")}),(0,n.jsx)(o.A,{variant:"subtitle1",component:"p",color:d.colorWithOpacity(d.palette.grey[900],60),"data-sentry-element":"Typography","data-sentry-source-file":"GeneratingLoader.tsx",children:l("subtitle")})]}),(0,n.jsx)(F.A,{"data-sentry-element":"Box","data-sentry-source-file":"GeneratingLoader.tsx",children:(0,n.jsx)(th,{variant:"determinate",value:I,"data-sentry-element":"CircularProgressWithLabel","data-sentry-source-file":"GeneratingLoader.tsx"})}),k(),_&&(0,n.jsx)(tm,{status:_,onClose:v,isOpen:j})]})};var tb=r(69348),tj=r(82867);let tC=()=>{let{hasAccess:e}=(0,h.D)(),{t}=(0,u.o)("translation",{keyPrefix:"PAGE.COURSE_GENERATION"}),r=(0,i.A)(),A=e(tj.Qi.GENERATE_AI_COURSE),{isLoading:b,isPending:j,isError:C,data:v}=(({enabled:e=!0})=>{let{user:t}=(0,m.A)(),r=t?.portal.id,n={portal_id:r||0};return(0,p.I)({queryKey:y.Ay.courseGeneration.detail(n).queryKey,queryFn:()=>g.x.getCourseGenerationTask(n),select:e=>e.data.result,enabled:e&&!!r,refetchOnReconnect:!1,refetchOnWindowFocus:!1,refetchInterval:1/0})})({enabled:A}),{isLoading:E,isError:S,data:w}=(0,x.c)(v?.id,{enabled:A&&!!v?.id}),k=(0,a.useCallback)(()=>{if(b||E)return(0,n.jsx)(c.A,{});if(C||S)return(0,n.jsx)(d.V,{});let e=w?.status,t="finish_with_error"===e;return e&&"in_progress"!==e&&!t?(0,n.jsx)(tA,{hasAccess:A,taskId:v?.id||0,courseGenerationTask:v}):j?null:(0,n.jsx)(te,{courseGenerationTask:v,isErrorStatus:t})},[A,b,E,C,S,w?.status,j,v]);return A?(0,n.jsxs)(s.A,{spacing:r.spacing(6),"data-sentry-element":"Stack","data-sentry-component":"CourseGeneration","data-sentry-source-file":"index.tsx",children:[(0,n.jsx)(_.A,{separator:(0,n.jsx)(l.A,{icon:"tabler:chevron-right"}),data:[{href:f.C.courses,text:t("NAVIGATION.breadcrumbs.course_overview")},{href:f.C.createCourse,text:t("NAVIGATION.breadcrumbs.add_new_course")},{text:t("NAVIGATION.breadcrumbs.course_generation"),isActive:!0}],"data-sentry-element":"BreadCrumbs","data-sentry-source-file":"index.tsx"}),(0,n.jsx)(o.A,{variant:"h2",component:"p","data-sentry-element":"Typography","data-sentry-source-file":"index.tsx",children:t("title")}),k()]}):(0,n.jsx)(tb.default,{isTeamMember:!0})}},47300:(e,t,r)=>{"use strict";r.d(t,{BG:()=>s,Cd:()=>n,HL:()=>o,Hj:()=>l,Hz:()=>h,PV:()=>d,W$:()=>u,e:()=>a,iu:()=>x,kq:()=>m,rk:()=>g,so:()=>c,wJ:()=>i}),r(39086);let n={finish_with_error:0,in_progress:1,content_generation:2,module_thumbnail_generation:3,lesson_thumbnail_generation:4,lesson_image_generation:5,completed:6},a={small:"small",medium:"medium",large:"large"},s={entry:"entry",intermediate:"intermediate",advanced:"advanced"},i={formal:"formal",informal:"informal"},o={mentorVision:"mentor_vision",canvasMind:"canvas_mind",createIQ:"create_iq"},l={modern_educational:"modern educational",cartoon_friendly:"cartoon & friendly",realistic_with_people:"realistic with people",minimalist:"minimalist",infographic:"infographic",watercolor_artistic:"watercolor & artistic",tech_digital:"tech & digital",nature_organic:"nature & organic"},d={goal:"goal",course_name:"course_name",course_description:"course_description"},c={1:"EN",2:"DE",3:"SK",4:"HU",5:"MK",6:"CS",7:"ES"},u=e=>e in c,p={preparing:"â³",in_progress:"\uD83D\uDE80",content_generation:"âï¸",module_thumbnail_generation:"\uD83D\uDDBCï¸",lesson_thumbnail_generation:"\uD83D\uDCC4",lesson_image_generation:"\uD83D\uDD8Cï¸",completed:"â
",finish_with_error:"â ï¸"},m=e=>e?"finish_with_error"===e?{translationKey:"generation_status_finish_with_error",emoji:p.finish_with_error,showAnimatedEllipsis:!1}:"completed"===e?{translationKey:"generation_status_completed",emoji:p.completed,showAnimatedEllipsis:!1}:{translationKey:`generation_status_${e}`,emoji:p[e],showAnimatedEllipsis:!0}:{translationKey:"generation_status_preparing",emoji:p.preparing,showAnimatedEllipsis:!0},g=e=>{switch(e){case"in_progress":return 5;case"content_generation":case"finish_with_error":return 15;case"module_thumbnail_generation":return 50;case"lesson_thumbnail_generation":return 75;case"lesson_image_generation":return 90;case"completed":return 100;default:return 0}},y=["id","created_at","text_price","image_price"],x=e=>y.some(t=>t===e),h=e=>{if("ValueError"===e.error_type&&e.error?.includes("max size")){let t=e.error.match(/max size\s*=\s*(\d+)\s*MB/i);return{isFileSizeError:!0,maxSize:t?t[1]:"30"}}return{isFileSizeError:!1,maxSize:"30"}}},47353:(e,t,r)=>{"use strict";r.d(t,{x:()=>s});var n=r(81498),a=r(54683);let s={getCourseGenerationTask:async e=>a.A.post(n.y.getCourseGenerationTask,{...e}),addCourseGenerationTask:async e=>a.A.post(n.y.addCourseGenerationTask,e),updateCourseGenerationTask:async e=>{let{id:t,...r}=e,s=n.y.updateCourseGenerationTask.replace("{task_id}",t.toString());return a.A.post(s,r)},deleteCourseGenerationTask:async e=>a.A.post(n.y.deleteCourseGenerationTask,e),startCourseGenerationTask:async e=>a.A.post(n.y.startCourseGenerationTask,e),getCourseGenerationTaskStatus:async e=>a.A.post(n.y.getCourseGenerationTaskStatus,e),getCourseGenerationStatistics:async e=>a.A.post(n.y.getCourseGenerationStatistics,e),getCourseGenerationStatisticsCount:async()=>a.A.post(n.y.getCourseGenerationStatisticsCount),generateStructure:async e=>a.A.post(n.y.generateStructureOpenAI,e),generateSuggestions:async e=>
5a.A.post(n.y.generateSuggestionsOpenAI,e),getModelAccess:async()=>a.A.get(n.y.getModelAccess),generateImagePreview:async e=>a.A.post(n.y.generateImagePreview,e),startOnboardingCourseGeneration:async e=>a.A.post(n.y.onboardingCourseGeneration,e)}},49158:(e,t,r)=>{"use strict";r.d(t,{$:()=>a});var n=r(14232);let a=(e,t,{runImmediately:r=!1}={})=>{let a=(0,n.useRef)(e);(0,n.useEffect)(()=>{a.current=e},[e]),(0,n.useEffect)(()=>{if(null===t)return;r&&a.current();let e=setInterval(()=>a.current(),t);return()=>clearInterval(e)},[t,r])}},56e3:(e,t,r)=>{"use strict";r.d(t,{n:()=>p});var n=r(37876),a=r(48230),s=r.n(a),i=r(62902),o=r(74234),l=r(31941),d=r(22208),c=r(30942),u=r(69884);let p=()=>{let e=(0,o.A)(),{t}=(0,c.o)("translation",{keyPrefix:"ALERT.ERROR.INSUFFICIENT_CREDITS"});return(0,n.jsxs)(i.A,{spacing:e.spacing(3),"data-sentry-element":"Stack","data-sentry-component":"InsufficientCreditsToast","data-sentry-source-file":"InsufficientCreditsToast.tsx",children:[(0,n.jsx)(l.A,{variant:"h5",component:"p",color:e.palette.common.white,"data-sentry-element":"Typography","data-sentry-source-file":"InsufficientCreditsToast.tsx",children:t("title")}),(0,n.jsx)(d.A,{component:s(),href:u.C.credits,variant:"contained","data-sentry-element":"Button","data-sentry-source-file":"InsufficientCreditsToast.tsx",children:(0,n.jsx)(l.A,{fontWeight:500,color:e.palette.common.white,"data-sentry-element":"Typography","data-sentry-source-file":"InsufficientCreditsToast.tsx",children:t("action")})})]})}},56109:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/courses/generation",function(){return r(36837)}])},67020:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>g});var n=r(37876),a=r(48230),s=r.n(a),i=r(22208),o=r(64713),l=r(31941),d=r(66950),c=r(5236),u=r(30942);let p=(0,o.Ay)(d.A)(({theme:e})=>({[e.breakpoints.down("md")]:{width:"90vw"}})),m=()=>{let{t:e}=(0,u.o)();return(0,n.jsx)(d.A,{className:"content-center","data-sentry-element":"Box","data-sentry-component":"Error500","data-sentry-source-file":"500.tsx",children:(0,n.jsx)(d.A,{sx:{p:5,display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},"data-sentry-element":"Box","data-sentry-source-file":"500.tsx",children:(0,n.jsxs)(p,{"data-sentry-element":"BoxWrapper","data-sentry-source-file":"500.tsx",children:[(0,n.jsx)(l.A,{variant:"h2",sx:{mb:1.5},"data-sentry-element":"Typography","data-sentry-source-file":"500.tsx",children:e("ALERT.ERROR.STATUS.500.issue")}),(0,n.jsx)(l.A,{sx:{mb:6,color:"text.secondary"},"data-sentry-element":"Typography","data-sentry-source-file":"500.tsx",children:e("ALERT.ERROR.STATUS.500.description")}),(0,n.jsx)(i.A,{href:"/",component:s(),variant:"contained","data-sentry-element":"Button","data-sentry-source-file":"500.tsx",children:e("ACTION.back_home")})]})})})};m.getLayout=e=>(0,n.jsx)(c.A,{children:e});let g=m},76554:(e,t,r)=>{"use strict";r.d(t,{c:()=>i});var n=r(74359),a=r(11313),s=r(47353);let i=(e,t={enabled:!0})=>(0,n.I)({queryKey:a.Ay.courseGeneration.status(e).queryKey,queryFn:()=>s.x.getCourseGenerationTaskStatus({id:e}),select:e=>e.data.result,enabled:t?.enabled&&!!e,refetchInterval:t?.refetchInterval})}},e=>{e.O(0,[1289,3218,4587,3220,8015,636,6593,8792],()=>e(e.s=56109)),_N_E=e.O()}]); 6//# sourceMappingURL=generation-be37b055ba82e79e.js.map
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.