1import{j as t}from"./vendor-radix-CJcRONz9.js";import{r as m,L as E,s as P,j as L,aw as $,_ as H,ay as J,$ as K}from"./vendor-lucide-ExEL-EWq.js";import{f as O,c as Y,t as F,B as v,j as w}from"./index-DXeg46-h.js";import{T as G}from"./textarea-vJ7KnT5o.js";import"./vendor-react-dom-UPKpHdcJ.js";import"./vendor-jspdf-B_JAU3Kj.js";import"./vendor-recharts-DasAn7NX.js";import"./usePersistFn-BFINfK1x.js";import"./useComposition-BTqCjZVd.js";function dt(){var M;const{slug:x}=O(),{currentFestivalSlug:d}=Y(),c=typeof window<"u"&&new URLSearchParams(window.location.search).get("festival")||d,[n,o]=m.useState(!1),[l,j]=m.useState(0),[b,N]=m.useState({}),[g,i]=m.useState(null),[s,T]=m.useState(!1),[y,D]=m.useState("forward"),I=F.survey.getBySlug.useQuery({slug:x,festivalSlug:c},{enabled:!!x}),[_]=m.useState(()=>{const a="rec-survey-respondent";let r=localStorage.getItem(a);return r||(r=crypto.randomUUID(),localStorage.setItem(a,r)),r}),k=F.survey.startResponse.useMutation({onSuccess:a=>{i(a.responseId)}}),R=F.survey.submitAnswer.useMutation(),q=F.survey.completeResponse.useMutation({onSuccess:()=>{T(!0)}}),p=I.data,z=(p==null?void 0:p.questions)||[],f=z.length,e=z[l],B=f>0?(l+1)/f*100:0,U=()=>{p&&(k.mutate({festivalSlug:c,surveyId:p.id,respondentId:_}),o(!0))},S=m.useCallback(a=>{!e||!g||(N(r=>({...r,[e.id]:a})),R.mutate({festivalSlug:c,responseId:g,questionId:e.id,value:typeof a=="object"?JSON.stringify(a):String(a)}))},[e,g,R]),h=m.useCallback(()=>{l<f-1?(D("forward"),j(a=>a+1)):g&&q.mutate({festivalSlug:c,responseId:g})},[l,f,g,q]),V=m.useCallback(()=>{l>0&&(D("backward"),j(a=>a-1))},[l]);if(m.useEffect(()=>{const a=r=>{r.key==="Enter"&&!r.shiftKey&&((e?b[e.id]:void 0)!==void 0||!(e!=null&&e.isRequired))&&(r.preventDefault(),h())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[h,e,b]),I.isLoading)return t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:120",className:"min-h-screen flex items-center justify-center bg-[#0D0D0D]",children:t.jsx(E,{"data-loc":"client/src/pages/SatisfactionForm.tsx:121",className:"w-8 h-8 animate-spin text-white/50"})});if(!p)return t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:129",className:"min-h-screen flex items-center justify-center bg-[#0D0D0D] px-4",children:t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:130",className:"text-center text-white",children:[t.jsx("h1",{"data-loc":"client/src/pages/SatisfactionForm.tsx:131",className:"text-2xl font-bold mb-2",children:"Questionnaire introuvable"}),t.jsx("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:132",className:"text-white/60",children:"Ce questionnaire n'existe pas ou n'est plus actif."})]})});if(s){const a=p.mediaType,r=p.mediaUrl,C=a==="replay"?r:((M=r==null?void 0:r.match(/(?:v=|youtu\.be\/)([^&?/]+)/))==null?void 0:M[1])||null;return t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:145",className:"min-h-screen flex items-center justify-center bg-[#0D0D0D] px-4 py-12",children:t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:146",className:"text-center text-white max-w-2xl w-full animate-in fade-in slide-in-from-bottom-4 duration-500",children:[t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:147",className:"w-16 h-16 rounded-full bg-green-500/20 flex items-center justify-center mx-auto mb-6",children:t.jsx(P,{"data-loc":"client/src/pages/SatisfactionForm.tsx:148",className:"w-8 h-8 text-green-400"})}),t.jsx("h1",{"data-loc":"client/src/pages/SatisfactionForm.tsx:150",className:"text-2xl sm:text-3xl font-bold mb-4",children:p.thankYouMessage||"Merci !"}),t.jsx("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:151",className:"text-white/60 mb-8",children:"Vos réponses ont bien été enregistrées."}),a&&r&&t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:155",className:"mt-4 rounded-xl overflow-hidden border border-white/10",children:[a==="image"&&t.jsx("img",{"data-loc":"client/src/pages/SatisfactionForm.tsx:157",src:r,alt:"",className:"w-full max-h-80 object-cover"}),(a==="video"||a==="replay")&&C&&t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:160",className:"relative w-full",style:{paddingBottom:"56.25%"},children:t.jsx("iframe",{"data-loc":"client/src/pages/SatisfactionForm.tsx:161",src:`https://www.youtube.com/embed/${C}?autoplay=1&mute=1&rel=0`,title:"Vidéo",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"absolute inset-0 w-full h-full"})})]})]})})}if(!n)return t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:180",className:"min-h-screen flex items-center justify-center bg-[#0D0D0D] px-4",children:t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:181",className:"text-center text-white max-w-lg w-full animate-in fade-in slide-in-from-bottom-4 duration-500",children:[t.jsx("h1",{"data-loc":"client/src/pages/SatisfactionForm.tsx:182",className:"text-3xl sm:text-4xl font-bold mb-4 leading-tight",children:p.title}),p.description&&t.jsx("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:184",className:"text-base sm:text-lg text-white/70 mb-8 leading-relaxed",children:p.description}),t.jsxs(v,{"data-loc":"client/src/pages/SatisfactionForm.tsx:186",size:"lg",className:"bg-rec-magenta hover:bg-rec-magenta/90 text-white px-6 sm:px-8 py-5 sm:py-6 text-base sm:text-lg w-full sm:w-auto",onClick:U,disabled:k.isPending,children:[k.isPending?t.jsx(E,{"data-loc":"client/src/pages/SatisfactionForm.tsx:193",className:"w-5 h-5 animate-spin mr-2"}):null,p.startButtonText||"C'est parti !"]}),t.jsxs("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:197",className:"text-sm text-white/40 mt-6",children:[f," questions · ~3 min"]})]})});
1const u=e?b[e.id]:void 0,A=u!==void 0||!(e!=null&&e.isRequired);return t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:208",className:"min-h-screen bg-[#0D0D0D] flex flex-col",children:[t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:210",className:"fixed top-0 left-0 right-0 h-1 bg-white/10 z-50",children:t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:211",className:"h-full bg-rec-magenta transition-all duration-500 ease-out",style:{width:`${B}%`}})}),t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:218",className:"fixed top-3 right-4 text-white/40 text-xs sm:text-sm z-50",children:[l+1," / ",f]}),t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:223",className:"flex-1 flex items-center justify-center px-4 sm:px-8 py-16 sm:py-20",children:t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:224",className:w("max-w-2xl w-full animate-in duration-400",y==="forward"?"fade-in slide-in-from-bottom-4":"fade-in slide-in-from-top-4"),children:[t.jsxs("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:234",className:"text-rec-magenta font-medium mb-2 text-sm sm:text-base",children:[l+1," â"]}),t.jsx("h2",{"data-loc":"client/src/pages/SatisfactionForm.tsx:239",className:"text-xl sm:text-2xl md:text-3xl font-bold text-white mb-2 leading-snug",children:e==null?void 0:e.questionText}),(e==null?void 0:e.subtitle)&&t.jsx("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:245",className:"text-white/50 mb-6 text-sm sm:text-base",children:e.subt
1itle}),t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:249",className:"mt-6 sm:mt-8",children:[(e==null?void 0:e.questionType)==="rating"&&t.jsx(W,{"data-loc":"client/src/pages/SatisfactionForm.tsx:251",value:u,onChange:a=>{S(a),setTimeout(()=>h(),400)}}),(e==null?void 0:e.questionType)==="nps"&&t.jsx(X,{"data-loc":"client/src/pages/SatisfactionForm.tsx:260",value:u,onChange:a=>{S(a),setTimeout(()=>h(),400)}}),(e==null?void 0:e.questionType)==="single_choice"&&t.jsx(Z,{"data-loc":"client/src/pages/SatisfactionForm.tsx:269",options:e.options||[],value:u,onChange:a=>{S(a),setTimeout(()=>h(),400)}}),(e==null?void 0:e.questionType)==="long_text"&&t.jsx(Q,{"data-loc":"client/src/pages/SatisfactionForm.tsx:279",value:u,onChange:S}),(e==null?void 0:e.questionType)==="ranking"&&t.jsx(tt,{"data-loc":"client/src/pages/SatisfactionForm.tsx:285",options:e.options||[],value:u,onChange:S})]}),((e==null?void 0:e.questionType)==="long_text"||(e==null?void 0:e.questionType)==="ranking")&&t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:295",className:"mt-6 sm:mt-8",children:t.jsxs(v,{"data-loc":"client/src/pages/SatisfactionForm.tsx:296",onClick:h,disabled:!A,className:"bg-rec-magenta hover:bg-rec-magenta/90 text-white w-full sm:w-auto",children:[l===f-1?"Terminer":"Suivant",t.jsx(L,{"data-loc":"client/src/pages/SatisfactionForm.tsx:302",className:"w-4 h-4 ml-2"})]})})]},e==null?void 0:e.id)}),t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:310",className:"fixed bottom-4 right-4 flex gap-2 z-50",children:[t.jsx(v,{"data-loc":"client/src/pages/SatisfactionForm.tsx:311",variant:"ghost",size:"icon",className:"text-white/50 hover:text-white bg-black/30 rounded-full",onClick:V,disabled:l===0,children:t.jsx($,{"data-loc":"client/src/pages/SatisfactionForm.tsx:318",className:"w-5 h-5"})}),t.jsx(v,{"data-loc":"client/src/pages/SatisfactionForm.tsx:320",variant:"ghost",size:"icon",className:"text-white/50 hover:text-white bg-black/30 rounded-full",onClick:h,disabled:!A,children:t.jsx(L,{"data-loc":"client/src/pages/SatisfactionForm.tsx:327",className:"w-5 h-5"})})]}),t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:332",className:"fixed bottom-4 left-4 text-white/30 text-xs z-50 hidden sm:block",children:["Appuyez sur ",t.jsx("kbd",{"data-loc":"client/src/pages/SatisfactionForm.tsx:333",className:"px-1 py-0.5 bg-white/10 rounded",children:"Entrée âµ"})," pour continuer"]})]})}function W({value:x,onChange:d}){const[c,n]=m.useState(null);return t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:345",className:"flex gap-2 sm:gap-3 flex-wrap",children:[1,2,3,4,5].map(o=>t.jsx("button",{"data-loc":"client/src/pages/SatisfactionForm.tsx:347",className:w("w-12 h-12 sm:w-14 sm:h-14 rounded-lg border-2 flex items-center justify-center transition-all duration-200",(c!==null?o<=c:o<=(x||0))?"border-rec-magenta bg-rec-magenta/20 text-rec-magenta scale-110":"border-white/20 text-white/40 hover:border-white/40"),onMouseEnter:()=>n(o),onMouseLeave:()=>n(null),onClick:()=>d(o),children:t.jsx(H,{"data-loc":"client/src/pages/SatisfactionForm.tsx:359",className:w("w-5 h-5 sm:w-6 sm:h-6",(c!==null?o<=c:o<=(x||0))&&"fill-current")})},o))})}function X({value:x,onChange:d}){return t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:373",children:[t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:375",className:"flex gap-1 flex-wrap",children:Array.from({length:11},(c,n)=>n).map(c=>t.jsx("button",{"data-loc":"client/src/pages/SatisfactionForm.tsx:377",className:w("w-10 h-10 sm:w-12 sm:h-12 rounded-lg border-2 flex items-center justify-center font-bold text-sm transition-all duration-200",x===c?"border-rec-magenta bg-rec-magenta/20 text-rec-magenta scale-110":"border-white/20 text-white/60 hover:border-white/40"),onClick:()=>d(c),children:c},c))}),t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:391",className:"flex justify-between mt-2 text-xs text-white/40",children:[t.jsx("span",{"data-loc":"client/src/pages/SatisfactionForm.tsx:392",children:"Pas du tout probable"}),t.jsx("span",{"data-loc":"client/src/pages/SatisfactionForm.tsx:393",children:"Très probable"})]})]})}function Z({options:x,value:d,onChange:c}){return t.jsx("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:409",className:"space-y-2",children:x.map((n,o)=>t.jsxs("button",{"data-loc":"client/src/pages/SatisfactionForm.tsx:411",className:w("w-full text-left px-4 sm:px-5 py-3 sm:py-4 rounded-lg border-2 transition-all duration-200 flex items-center gap-3",d===n?"border-rec-magenta bg-rec-magenta/10 text-white":"border-white/20 text-white/70 hover:border-white/40 hover:bg-white/5"),onClick:()=>c(n),children:[t.jsx("span",{"data-loc":"client/src/pages/SatisfactionForm.tsx:421",className:w("w-6 h-6 rounded border-2 flex items-center justify-center text-xs font-bold shrink-0",d===n?"border-rec-magenta bg-rec-magenta text-white":"border-white/30 text-white/50"),children:String.fromCharCode(65+o)}),t.jsx("span",{"data-loc":"client/src/pages/SatisfactionForm.tsx:431",className:"text-sm sm:text-base",children:n}),d===n&&t.jsx(P,{"data-loc":"client/src/pages/SatisfactionForm.tsx:432",className:"w-4 h-4 sm:w-5 sm:h-5 text-rec-magenta ml-auto shrink-0"})]},o))})}function Q({value:x,onChange:d}){const[c,n]=m.useState(x||"");return t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:443",children:[t.jsx(G,{"data-loc":"client/src/pages/SatisfactionForm.tsx:444",value:c,onChange:o=>{n(o.target.value),d(o.target.value)},placeholder:"Tapez votre réponse ici...",rows:4,className:"bg-transparent border-white/20 text-white placeholder:text-white/30 focus:border-rec-magenta resize-none text-base sm:text-lg"}),t.jsx("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:454",className:"text-xs text-white/30 mt-2 hidden sm:block",children:"Shift + Entrée pour un retour à la ligne"})]})}function tt({options:x,value:d,onChange:c}){const[n,o]=m.useState(d||[]),l=x.filter(i=>!n.includes(i)),j=i=>{const s=[...n,i];o(s),c(s)},b=i=>{const s=n.filter((T,y)=>y!==i);o(s),c(s)},N=i=>{if(i===0)return;const s=[...n];[s[i-1],s[i]]=[s[i],s[i-1]],o(s),c(s)},g=i=>{if(i===n.length-1)return;const s=[...n];[s[i],s[i+1]]=[s[i+1],s[i]],o(s),c(s)};return t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:500",className:"space-y-4",children:[n.length>0&&t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:502",className:"space-y-2",children:[t.jsx("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:503",className:"text-xs text-white/40 uppercase tracking-wider",children:"Votre classement"}),n.map((i,s)=>t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:505",className:"flex items-center gap-2 px-3 sm:px-4 py-2 sm:py-3 rounded-lg border-2 border-rec-magenta/50 bg-rec-magenta/10",children:[t.jsx("span",{"data-loc":"client/src/pages/SatisfactionForm.tsx:509",className:"w-6 h-6 rounded-full bg-rec-magenta text-white text-xs font-bold flex items-center justify-center shrink-0",children:s+1}),t.jsx("span",{"data-loc":"client/src/pages/SatisfactionForm.tsx:512",className:"flex-1 text-white text-sm sm:text-base",children:i}),t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:513",className:"flex gap-1",children:[t.jsx("button",{"data-loc":"client/src/pages/SatisfactionForm.tsx:514",className:"text-white/40 hover:text-white disabled:opacity-30 p-1",onClick:()=>N(s),disabled:s===0,children:t.jsx(J,{"data-loc":"client/src/pages/SatisfactionForm.tsx:519",className:"w-4 h-4"})}),t.jsx("button",{"data-loc":"client/src/pages/SatisfactionForm.tsx:521",className:"text-white/40 hover:text-white disabled:opacity-30 p-1",onClick:()=>g(s),disabled:s===n.length-1,children:t.jsx(K,{"data-loc":"client/src/pages/SatisfactionForm.tsx:526",className:"w-4 h-4"})}),t.jsx("button",{"data-loc":"client/src/pages/SatisfactionForm.tsx:528",className:"text-red-400/60 hover:text-red-400 ml-1 p-1 text-lg leading-none",onClick:()=>b(s),children:"Ã"})]})]},i))]}),l.length>0&&t.jsxs("div",{"data-loc":"client/src/pages/SatisfactionForm.tsx:541",className:"space-y-2",children:[t.jsxs("p",{"data-loc":"client/src/pages/SatisfactionForm.tsx:542",className:"text-xs text-white/40 uppercase tracking-wider",children:["Cliquez pour classer (",l.length," restant",l.length>
11?"s":"",")"]}),l.map(i=>t.jsx("button",{"data-loc":"client/src/pages/SatisfactionForm.tsx:546",className:"w-full text-left px-3 sm:px-4 py-2 sm:py-3 rounded-lg border-2 border-white/20 text-white/60 hover:border-white/40 hover:bg-white/5 transition-all text-sm sm:text-base",onClick:()=>j(i),children:i},i))]})]})}export{dt as default};
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.