var A=Object.defineProperty,U=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var j=(s,o,r)=>o in s?A(s,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[o]=r,n=(s,o)=>{for(var r in o||(o={}))y.call(o,r)&&j(s,r,o[r]);if(h)for(var r of h(o))C.call(o,r)&&j(s,r,o[r]);return s},t=(s,o)=>U(s,_(o));import{r as R,j as e}from"./react-vendor-xYZnmIII.js";import{C as S}from"./chunked-uploader-input-dQEAsxxf.js";import{I as F}from"./input-error-_LAmvivg.js";import{L as l,R as I,f,I as L,T as b}from"./ui-components-CQM92IK3.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";const z=({data:s,setData:o,errors:r,isSubmit:v,setIsFileSelected:a,setIsFileUploaded:g,setIsSubmit:u})=>{var p,c,x;const[d,w]=R.useState(((p=s.options)==null?void 0:p.audio_source)||"url"),N=i=>{var m;w(i),o("options",t(n({},s.options),{audio_source:i,audio_url:i==="url"&&((m=s.options)==null?void 0:m.audio_url)||""}))};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(l,{children:"Instructions"}),e.jsxs("div",{className:"rounded-md bg-blue-50 p-3 text-sm text-blue-900",children:[e.jsx("p",{className:"mb-1 font-medium",children:"How listening questions work:"}),e.jsx("p",{children:"• Upload or link to an audio file"}),e.jsx("p",{children:"• Students listen to the audio and answer the question"}),e.jsx("p",{children:"• You can use multiple choice options or short answer"})]})]}),e.jsxs("div",{children:[e.jsx(l,{children:"Audio Source"}),e.jsxs(I,{value:d,onValueChange:i=>N(i),className:"flex gap-4 pt-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(f,{value:"url",id:"url"}),e.jsx(l,{htmlFor:"url",className:"cursor-pointer font-normal",children:"Audio URL"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(f,{value:"upload",id:"upload"}),e.jsx(l,{htmlFor:"upload",className:"cursor-pointer font-normal",children:"Upload File"})]})]})]}),d==="url"?e.jsxs("div",{children:[e.jsx(l,{children:"Audio URL *"}),e.jsx(L,{type:"url",placeholder:"https://example.com/audio.mp3",value:((c=s.options)==null?void 0:c.audio_url)||"",onChange:i=>o("options",t(n({},s.options),{audio_url:i.target.value}))}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Direct link to an audio file (mp3, wav, ogg)"})]}):e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{children:[e.jsx(l,{children:"Upload Audio File *"}),e.jsx(S,{isSubmit:v,filetype:"audio",delayUpload:!0,onFileSelected:i=>{a(!0)},onFileUploaded:i=>{g(!0),o("options",t(n({},s.options),{new_audio_url:i.file_url}))},onError:i=>{u(!1),a(!1)},onCancelUpload:()=>{u(!1),a(!1)}}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Supported formats: MP3, WAV, OGG (Max 100MB)"})]})}),e.jsxs("div",{children:[e.jsx(l,{children:"Answer Instructions"}),e.jsx(b,{placeholder:"What should students answer after listening? (e.g., 'Summarize the main points' or 'Answer the following questions')",rows:3,value:((x=s.options)==null?void 0:x.instructions)||"",onChange:i=>o("options",t(n({},s.options),{instructions:i.target.value}))})]}),e.jsx(F,{message:r.options})]})};export{z as default};
