1import{r,u as Se,c as n,d as m,j as t,B as l,H as be,T as p,i as Ce,e as E}from"./MarketingSiteLoadingFallback-DfYAzeIM.js";import{a as we,u as je,b as Z,p as Fe,c as Ae,g as ve,j as ke,G as Re,h as e,I as De,B as f,k as Ie,D as T,l as ee,t as Te,m as Oe}from"./renderJungleWebApp-DZgne_TB.js";import{I as ze}from"./IconDelete-B38Z1cd4.js";import{I as te}from"./IconCheckmarkSuccess-BdZDW5vA.js";import{I as We,a as Qe,g as _e,u as Ee}from"./landingHandoffUploadClaim-B2LBwAI7.js";import{T as O}from"./textarea-BxfDy4nw.js";import{S as He}from"./select-CHURZt1F.js";import"./frontend-release-BHg_hj9G.js";import"./hub-D89kKFfg.js";import"./index-rQLcFmgX.js";import"./track-error-DEre5AXz.js";import"./legacy-referrer-id-43tytWzp.js";import"./main-YoYAMf6n.js";import"./stripe-price-details-DClgIPIw.js";import"./document-upload-sentry-Dl2_Y04U.js";import"./sentry-init-BRm8Bcin.js";import"./client-environment-BMTHOZAb.js";import"./split-CzYrjwZo.js";function rt(){var X;const{t:H}=we(),D=r.useRef(null),b=r.useRef(null),C=r.useRef(null),w=r.useRef(null),{deckId:U}=Se(),j=je(o=>o.currentUser),g=Z(o=>o.currentReviewDeck),oe=Z(o=>o.setCurrentReviewDeck),re=Fe(o=>o.setPageSetup),{keyConcepts:F,allCardsForCurrentDeckAndSubdecks:ne,setAllCardsForCurrentDeckAndSubdecks:ie}=Ae(o=>o),[d,A]=r.useState(""),[x,se]=r.useState(""),[S,ae]=r.useState(""),[v,le]=r.useState(""),[z,L]=r.useState(""),[P,B]=r.useState(!1),[ce,$]=r.useState(!1),[M,Y]=r.useState(!0),[de,N]=r.useState(!1),[pe,G]=r.useState(!1),[K,ue]=r.useState(F&&F.length>0?(X=F[0])==null?void 0:X.key_concept_name:null),[c,xe]=r.useState(!1),[a,W]=r.useState(!1),[h,fe]=r.useState([null,null,null]),[I,ge]=r.useState(-1),[k,he]=r.useState([]),[s,R]=r.useState(n.RegularFreeResponseQuestion),Q=(x==null?void 0:x.length)===0||(d==null?void 0:d.length)===0||!M||P||s===n.RegularMultipleChoiceQuestion&&!h.some(o=>o!==null&&(o==null?void 0:o.length)>0)||s===n.CaseScenarioFreeResponseQuestion&&(S==null?void 0:S.length)===0,V=s===n.RegularMultipleChoiceQuestion||s===n.CaseScenarioMultipleChoiceQuestion||s===n.TrueOrFalseQuestion;r.useEffect(()=>{window.scrollTo(0,0),re({headerType:"jungleLogoAndProfileMenu",showJungleBackground:!1}),U?ve(U,j).then(o=>{o&&oe(o)}):window.history.back()},[]),r.useEffect(()=>{b.current&&(b.current.style.height="auto",b.current.style.height=b.current.scrollHeight+"px")},[x]),r.useEffect(()=>{w.current&&(w.current.style.height="auto",w.current.style.height=w.current.scrollHeight+"px")},[S]),r.useEffect(()=>{C.current&&(C.current.style.height="auto",C.current.style.height=C.current.scrollHeight+"px")},[d]),r.useEffect(()=>{h.length>0&&he(h.map(()=>null)),k[I]&&(k[I].style.height="auto",k[I].style.height=k[I].scrollHeight+"px")},[h]),r.useEffect(()=>{if(v){var o=v.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g);Y(o!=null)}else Y(!0)},[v]),r.useEffect(()=>{s===n.TrueOrFalseQuestion?A(m.False):A("")},[s]);const ye=async()=>{if(P||!x||!d||(x==null?void 0:x.length)===0||(d==null?void 0:d.length)===0||!g)return;B(!0),$(!1),Te("Added new card to deck",{currentDeckId:g.id,currentDeckName:g.name,cardType:s,hasImage:c||a},j);let o=await Oe(v,d,x,g.id,g.name,j,c?z:null,z,s,h.filter(i=>i&&(i==null?void 0:i.length)>0),S,s===n.RegularFreeResponseQuestion?K:null);B(!1),o?(ie([...ne,o]),window.history.back()):$(!0)},q=async o=>{if(D.current){const i=D.current;i.click(),i.onchange=async u=>{const J=u.target.files[0];await _(J,o),D.current.value=null}}},_=async(o,i)=>{i?G(!0):N(!0);const u=o.name.replace(/\s/g,"+");let y=await _e(u,j,null);if(await Ee(o,y,j,null)==="success"){xe(i);let me=`${y.url}${y.fields.key}`;L(me),W(!0)}else W(!1);i?G(!1):N(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(ke,{title:"Add New Card to Deck â Jungle",pageDescription:`Add a new card to your study deck, ${g==null?void 0:g.name}.`,robots:"noindex"}),t.jsxs(l,{width:{md:"600px",base:"90%"},margin:"0 auto",display:"flex",flexDir:"column",flex:1,marginBottom:be,children:[t.jsx(Re,{}),ce&&t.jsxs(p,{role:"alert",color:e.accentColors.errorStrong,children:[H("root_render_failure_title","something went wrong"),". ",H("try_again","try again")]}),t.jsxs(l,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[t.jsxs(l,{display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",children:[t.jsx(De,{width:20,height:20,color:e.text.body}),t.jsx(p,{color:e.text.header,fontSize:"20px",fontFamily:"Outfit",fontStyle:"normal",fontWeight:"500",lineHeight:"128%",children:"add card"})]}),t.jsxs(l,{display:"flex",flexDirection:"row",gap:"20px",children:[t.jsx(f,{display:{md:"flex",base:"none"},title:"cancel",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"text",borderRadius:"4px",size:Ce?"medium":"large",fontWeight:500,padding:"4px 8px",onClick:()=>{window.history.back()}}),t.jsxs(E,{fontSize:{md:"20px",base:"18px"},borderRadius:"4px",padding:"4px 8px",_disabled:{bg:e.secondaryAction.inactive,color:e.secondaryAction.inactiveDarker,cursor:"not-allowed"},bg:e.secondaryAction.light,_hover:{bg:e.secondaryAction.inactive,color:Q?e.secondaryAction.inactiveDarker:e.secondaryAction.default},color:e.secondaryAction.default,onClick:()=>ye(),isDisabled:Q,children:[t.jsx(Ie,{color:Q?e.secondaryAction.inactiveDarker:e.secondaryAction.default,he
1ight:20,width:20}),t.jsx(p,{fontWeight:500,ml:"8px",children:"add"})]})]})]}),t.jsxs(l,{display:"flex",alignItems:"flex-start",justifyContent:"left",gap:"20px",flexDirection:"column",marginY:"24px",children:[t.jsx(p,{fontFamily:"Outfit",fontSize:{md:"16px",base:"14px"},fontStyle:"normal",fontWeight:"400",lineHeight:"24px",textAlign:"left",children:"question type:"}),t.jsxs(l,{display:"flex",alignItems:"flex-start",gap:"12px",flexDirection:"row",maxWidth:"100%",flexWrap:"wrap",children:[t.jsx(f,{size:"small",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"light",title:"free response",fontSize:{md:"14px",base:"14px"},pressed:s===n.RegularFreeResponseQuestion,onClick:()=>{R(n.RegularFreeResponseQuestion)}}),t.jsx(f,{size:"small",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"light",title:"multiple choice",fontSize:{md:"14px",base:"14px"},pressed:s===n.RegularMultipleChoiceQuestion,onClick:()=>{R(n.RegularMultipleChoiceQuestion)}}),t.jsx(f,{size:"small",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"light",title:"case - free response",fontSize:{md:"14px",base:"14px"},pressed:s===n.CaseScenarioFreeResponseQuestion,onClick:()=>{R(n.CaseScenarioFreeResponseQuestion)}}),t.jsx(f,{size:"small",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"light",title:"case - multiple choice",fontSize:{md:"14px",base:"14px"},pressed:s===n.CaseScenarioMultipleChoiceQuestion,onClick:()=>{R(n.CaseScenarioMultipleChoiceQuestion)}}),t.jsx(f,{size:"small",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"light",title:"true/false",fontSize:{md:"14px",base:"14px"},pressed:s===n.TrueOrFalseQuestion,onClick:()=>{R(n.TrueOrFalseQuestion)}})]})]}),t.jsxs(l,{display:"flex",flexDirection:"column",paddingX:"24px",paddingY:"20px",borderRadius:"20px",boxShadow:"0px 8px 32px 0px rgba(6, 38, 6, 0.04), 1px 2px 4px 0px rgba(6, 38, 6, 0.09)",backgroundColor:e.surface.white,border:`1px solid ${e.surface.border}`,children:[(s===n.CaseScenarioFreeResponseQuestion||s===n.CaseScenarioMultipleChoiceQuestion)&&t.jsxs(t.Fragment,{children:[t.jsx(l,{display:"flex",flexDirection:"row",alignItems:"center",mt:"16px",children:t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:e.text.label,children:"CASE SCENARIO"})}),t.jsx(O,{autoFocus:!0,ref:w,placeholder:"Add case scenario here",_placeholder:{color:e.text.placeholder,fontWeight:400},value:S,sx:{overflowY:"auto","&::-webkit-scrollbar":{display:"none"},msOverflowStyle:"none",scrollbarWidth:"none",height:"auto"},lineHeight:8,border:`0px solid ${e.surface.tertiary}`,margin:"0 auto",borderRadius:"0px 0px 16px 16px",bg:e.surface.white,color:e.text.body,focusBorderColor:e.surface.white,fontSize:"16px",fontWeight:400,fontFamily:"Outfit",minH:"80px",paddingInline:"0px",overflow:"hidden",resize:"none",onChange:o=>{ae(o.target.value)}}),t.jsx(T,{marginY:"12px"})]}),t.jsx(l,{display:"flex",flexDirection:"row",alignItems:"center",mt:"16px",children:t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:e.text.label,children:"QUESTION"})}),t.jsx(O,{autoFocus:!0,ref:b,placeholder:"add question here",_placeholder:{color:e.text.placeholder,fontWeight:400},value:x,sx:{overflowY:"auto","&::-webkit-scrollbar":{display:"none"},msOverflowStyle:"none",scrollbarWidth:"none",height:"auto"},lineHeight:8,border:`0px solid ${e.surface.tertiary}`,margin:"0 auto",borderRadius:"0px 0px 16px 16px",bg:e.surface.white,color:e.text.body,focusBorderColor:e.surface.white,fontSize:"16px",fontWeight:400,fontFamily:"Outfit",minH:"80px",paddingInline:"0px",overflow:"hidden",resize:"none",onChange:o=>{se(o.target.value)}}),t.jsx(T,{marginY:"12px"}),t.jsx(l,{display:"flex",flexDirection:"row",alignItems:"center",mt:"16px",children:t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:V?e.accentColors.successStrong:e.text.label,children:V?"CORRECT ANSWER":"ANSWER"})}),s===n.TrueOrFalseQuestion?t.jsxs(l,{display:"flex",flexDirection:"row",width:"100%",maxWidth:"200px",marginTop:"16px",children:[t.jsx(E,{width:"50%",height:"44px",borderRadius:"16px 0px 0px 16px",borderY:`1px solid ${e.secondaryAction.light}`,borderLeft:`1px solid ${e.secondaryAction.light}`,borderRight:`1px solid ${e.secondaryAction.light}`,padding:"10px 24px",fontSize:"16px",fontWeight:"400",fontStyle:"normal",background:d===m.True?e.secondaryAction.light:"#FFFFFF",color:d===m.True?e.secondaryAction.hover:e.secondaryAction.default,_hover:{bg:e.secondaryAction.inactive,color:e.secondaryAction.pressed},onClick:()=>
1A(m.True),children:"True"}),t.jsx(E,{width:"50%",height:"44px",borderRadius:"0px 16px 16px 0px",borderY:`1px solid ${e.secondaryAction.light}`,borderRight:`1px solid ${e.secondaryAction.light}`,padding:"10px 24px",fontSize:"16px",fontWeight:"400",fontStyle:"normal",background:d===m.False?e.secondaryAction.light:"#FFFFFF",color:d===m.False?e.secondaryAction.hover:e.secondaryAction.default,_hover:{bg:e.secondaryAction.inactive,color:e.secondaryAction.pressed},onClick:()=>A(m.False),children:"False"})]}):t.jsx(O,{ref:C,placeholder:"add answer here",value:d,sx:{overflowY:"auto","&::-webkit-scrollbar":{display:"none"},msOverflowStyle:"none",scrollbarWidth:"none",height:"auto"},lineHeight:8,border:`0px solid ${e.surface.tertiary}`,margin:"0 auto",borderRadius:"0px 0px 16px 16px",bg:e.surface.white,color:e.text.body,focusBorderColor:e.surface.white,fontSize:"16px",fontWeight:400,fontFamily:"Outfit",minH:"80px",paddingInline:"0px",overflow:"hidden",resize:"none",_placeholder:{color:e.text.placeholder,fontWeight:400},onChange:o=>{A(o.target.value)}}),s===n.RegularFreeResponseQuestion&&t.jsxs(t.Fragment,{children:[t.jsx(T,{marginY:"12px"}),t.jsxs(l,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",mt:"16px",children:[t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:e.text.label,children:"KEY CONCEPT"}),t.jsx(He,{color:e.text.label,fontSize:"16px",borderColor:e.secondaryAction.inactive,iconColor:e.text.label,maxWidth:"260px",borderRadius:"100px",height:"50px",value:K,background:"white",_active:{borderColor:e.secondaryAction.inactive,boxShadow:"none"},_focusVisible:{borderColor:e.secondaryAction.inactive,boxShadow:"none"},onChange:o=>ue(o.target.value),children:F&&Array.from(F).map(o=>t.jsx("option",{value:o.key_concept_name,children:o.key_concept_name},o.key_concept_name))})]})]}),(s===n.RegularMultipleChoiceQuestion||s===n.CaseScenarioMultipleChoiceQuestion)&&t.jsxs(t.Fragment,{children:[t.jsx(T,{marginY:"12px"}),t.jsxs(l,{paddingY:"16px",children:[t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",marginBottom:"8px",color:e.accentColors.errorStrong,children:"WRONG ANSWERS"}),t.jsx(l,{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"16px",alignSelf:"stretch",children:h.map((o,i)=>t.jsx(O,{ref:u=>{k[i]=u},placeholder:"Write your answer here...",value:o||"",sx:{overflowY:"auto","&::-webkit-scrollbar":{display:"none"},msOverflowStyle:"none",scrollbarWidth:"none",height:"auto"},size:"xs",padding:"0px",lineHeight:"124%",border:`0px solid ${e.surface.tertiary}`,margin:"0 auto",bg:e.surface.white,color:e.text.body,focusBorderColor:e.surface.white,fontSize:"16px",fontWeight:400,fontFamily:"Outfit",minHeight:"20px",paddingInline:"0px",overflow:"hidden",resize:"none",_placeholder:{color:e.text.placeholder,fontWeight:400},onFocus:()=>ge(i),onChange:u=>{const y=[...h];y[i]=u.target.value,fe(y)}},i))})]})]})]}),t.jsxs(l,{marginTop:"20px",display:"flex",flexDirection:"column",paddingX:"24px",paddingY:"20px",borderRadius:"20px",boxShadow:"0px 8px 32px 0px rgba(6, 38, 6, 0.04), 1px 2px 4px 0px rgba(6, 38, 6, 0.09)",backgroundColor:e.surface.white,border:`1px solid ${e.surface.border}`,children:[t.jsxs(l,{display:"flex",flexDirection:"column",alignItems:"left",children:[t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:e.text.label,children:"SOURCE LINK (optional)"}),!M&&t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:e.accentColors.errorStrong,children:"Source link not valid"})]}),t.jsx(We,{placeholder:"add link here",value:v,onChange:o=>{le(o.target.value)},fontSize:"16px",bg:e.surface.white,border:"0px",padding:"16px 0px",width:"100%",height:"54px",mt:"8px",focusBorderColor:e.surface.white,_placeholder:{color:e.text.placeholder,fontWeight:400},type:"url"})]}),s!==n.RegularMultipleChoiceQuestion&&s!==n.CaseScenarioMultipleChoiceQuestion&&t.jsxs(l,{marginTop:"20px",display:"flex",flexDirection:"column",paddingX:"24px",paddingY:"20px",borderRadius:"20px",boxShadow:"0px 8px 32px 0px rgba(6, 38, 6, 0.04), 1px 2px 4px 0px rgba(6, 38, 6, 0.09)",backgroundColor:e.surface.white,border:`1px solid ${e.surface.border}`,children:[t.jsxs(l,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:e.text.label,children:"ADD IMAGE (optional)"}),a&&t.jsx(f,{size:"small",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"text",title:"remove image",fontSize:{md:"16px",base:"14px"},LeftIcon:ze,onClick:()=>{W(!1),L("")}})]}),t.jsxs(l,{display:"flex",flexDirection:{md:"row",base:"column"},gap:"28px",marginTop:"12px",children:[t.jsxs(l,{display:"flex",flexDirection:"column",gap:"8px",width:{md:"50%",base:"100%"},onDrop:async o=>{o.preventDefault(),o.stopPropagation();let i=[...o.dataTransfer.files];if(i&&i.length>0){let u=i[0];_(u,!0)}},onDragOver:o=>{o.preventDefault(),o.stopPropagation()},onDragEnter:o=>{o.preventDefault(),o.stopPropagation()},onDragLeave:o=>{o.preventDefault(),o.stopPropagation()},children:[t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:e.text.label,children:"to question & answer side"}),t.jsx(f,{disabled:a,size:"medium",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"light",borderRadius:"12px",border:`1px solid ${a&&c?e.accentColors.successStrong:e.secondaryAction.inactive}`,bg:a&&c?e.accentColors.successLight:"rgba(238, 240, 239, 0.40)",LeftIcon:a&&c?te:ee,title:a&&c?"success":"upload image",color:a&&c?e.accentColors.successStrong:e.secondaryAction.default,_hover:{color:a&&c?e.accentColors.successStrong:e.secondaryAction.pressed,bg:a&&c?e.accentColors.successLight:e.secondaryAction.light},_disabled:{color:a&&c?e.accentColors.successStrong:e.secondaryAction.inactive,bg:a&&c?e.accentColors.successLight:e.secondaryAction.light,cursor:"not-allowed"},onClick:()=>q(!0),isLoading:pe,height:"51px"})]}),t.jsxs(l,{display:"flex",flexDirection:"column",gap:"8px",width:{md:"50%",base:"100%"},onDrop:async o=>{o.preventDefault(),o.stopPropagation();let i=[...o.dataTransfer.files];if(i&&i.length>0){let u=i[0];_(u,!1)}},children:[t.jsx(p,{fontFamily:"Outfit",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"124%",color:e.text.label,children:"to answer side only"}),t.jsx(f,{disabled:a,size:"medium",buttonPrimaryOrSecondaryType:"secondary",buttonStyleType:"light",borderRadius:"12px",border:`1px solid ${a&&!c?e.accentColors.successStrong:e.secondaryAction.inactive}`,bg:a&&!c?e.accentColors.successLight:"rgba(238, 240, 239, 0.40)",LeftIcon:a&&!c?te:ee,title:a&&!c?"success":"upload image",color:a&&!c?e.accentColors.successStrong:e.secondaryAction.default,_hover:{color:a&&!c?e.accentColors.successStrong:e.secondaryAction.pressed,bg:a&&!c?e.accentColors.successLight:e.secondaryAction.light},_disabled:{color:a&&!c?e.accentColors.successStrong:e.secondaryAction.inactive,bg:a&&!c?e.accentColors.successLight:e.secondaryAction.light,cursor:"not-allowed"},onClick:()=>q(!1),isLoading:de,height:"51px"})]})]}),t.jsx(Qe,{alignSelf:"center",marginTop:"20px",width:"80%",src:z}),t.jsx("input",{type:"file",ref:D,id:"PdfUploadInput",style:{display:"none"},accept:"application/jpeg, application/jpg, application/png, image/jpeg, image/jpg, image/png"})]})]})]})}export{rt as default}; 2//# sourceMappingURL=AddCardPage-DHdbnJZm.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.