1import{r as i,j as e,R as q}from"./react-vendor-RAgTqeYh.js";import{s as Ce}from"./icons-vendor-6gb1Z3ox.js";import{c as X,C as ae,b as se,S as M}from"./CandidateService-Y5pZsXdg.js";import{e as z,c as I,u as re,a as R,l as b,h as _,A as F,s as L,D as Se,V as je}from"./index-Bc5otjpZ.js";import{u as oe,H as ne,B as ke,a as Ne}from"./BaseSecretariaPageSimple-C26H5CsK.js";import{u as ie}from"./useProcessCompletion-C_zCze1_.js";import{a as G}from"./router-vendor-DjI2G_af.js";import{u as le}from"./UseScrollToTopUtil-DrfQDtk0.js";import"./vendor-DLg6GVPO.js";import{u as Te}from"./useModalClose-QAjV_yOU.js";import{M as Ee}from"./OptionEditor-BGNL6Zw2.js";import{s as V}from"./AccessibilityButton-Dav5niMJ.js";import Re from"./ErrorModal-Bla_kxvG.js";import{m as y}from"./motion-vendor-CssF1Ngq.js";import{u as Ie,a as Le,T as Ae}from"./TabFocusBlocker-DFmXy_em.js";import{c as Y}from"./countVisualLines-DMdxDXVu.js";import{L as $}from"./katex-vendor-BXQlUUX2.js";import{B as De}from"./ButtonLazaro-_cQKRLcQ.js";import"./useFocusTrap-CI7-8ki8.js";import"./query-vendor-DD1O1CcM.js";import"./SelectionProcessQueries-lfVV_e6m.js";import"./useSecretariaAdminDarkMode-4k-SvZBd.js";import"./tiptap-vendor-Dm54o_Oc.js";import"./floating-vendor-DX3gHNau.js";import"./deviceDetection-Dq4Wm6uL.js";function Me(r){const{value:t,onSave:c,enabled:d=!0,isManuallySaved:o=!1}=r,a=i.useRef(!1);i.useEffect(()=>{if(!d||o)return;const n=()=>typeof t=="string"?t.trim().length>0:t!=null,u=()=>{n()&&!a.current&&(c(t),a.current=!0)},m=()=>{document.visibilityState==="hidden"&&n()&&!a.current&&(c(t),a.current=!0)};return window.addEventListener("beforeunload",u),document.addEventListener("visibilitychange",m),()=>{window.removeEventListener("beforeunload",u),document.removeEventListener("visibilitychange",m)}},[t,c,d,o]),i.useEffect(()=>{a.current=!1},[t])}const W={REPEATED_CHARS:r=>new RegExp(`(.)\\1{${r},}`,"g"),SPECIAL_CHARS:/[^\w\s\n.,!?;:()\-'"áà âãéèêÃìîóòôõúùûçÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃúªüÃ]/g,VALID_CHARS:/^[\w\s\n.,!?;:()\-'"áà âãéèêÃìîóòôõúùûçÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃúªüÃ]*$/};function Pe(){const r=i.useRef(0),t=i.useCallback((o,a)=>{const{SECURITY:n}=z;return[()=>{const g=Date.now()-r.current,j=Math.abs(o.length-a.length);return g<n.SUSPICIOUS_INPUT_TIME_THRESHOLD&&j>n.SUSPICIOUS_INPUT_LENGTH_THRESHOLD},()=>W.REPEATED_CHARS(n.REPEATED_CHARS_THRESHOLD).test(o),()=>(o.match(W.SPECIAL_CHARS)||[]).length>o.length*n.SPECIAL_CHARS_PERCENTAGE].some(g=>g())},[]),c=i.useCallback(o=>W.VALID_CHARS.test(o),[]),d=i.useCallback((o,a)=>{const{SECURITY:n}=z;if(a.length>=n.INPUT_HISTORY_ANALYSIS_SIZE){const m=a.slice(-5).reduce((v,l)=>v+l.length,0)/n.INPUT_HISTORY_ANALYSIS_SIZE;if(o.length>m*n.RAPID_INPUT_MULTIPLIER)return!0}return!1},[]);return{detectSuspiciousInput:t,validateInput:c,analyzeInputHistory:d}}const _e=()=>{const r=G(),{selectedCategoryId:t}
1=oe(),{completeProcessByContextAndNavigate:c}=ie(),[d,o]=i.useState(!1),[a,n]=i.useState(!1),[u,m]=i.useState(!1),[v,l]=i.useState(""),[g,j]=i.useState(!1),[N,C]=i.useState(!1);return{isLoading:d,hasAcceptedTerms:a,showDeclarationPopup:g,showErrorModal:u,errorMessage:v,startRedaction:async()=>{if(!a){l("Você deve aceitar os termos antes de iniciar a redação."),m(!0);return}o(!0);try{const T=await I.getCsrfToken(),E=await X.startExam(1,T,"Redacao");if(E.wordingIsFinished){l(E.errorMessage||"A prova/redação já foi finalizada."),C(!0),m(!0);return}r("/redacao-editor")}catch(T){console.error("Erro ao iniciar a redação:",T),l(T?.message||"Erro ao iniciar a redação. Tente novamente."),m(!0)}finally{o(!1)}},acceptTerms:()=>{n(!0)},declineTerms:()=>{n(!1)},goBack:()=>{r("/portalCandidato")},openDeclarationPopup:()=>{j(!0)},closeDeclarationPopup:()=>{j(!1)},closeErrorModal:()=>{m(!1),N&&(C(!1),t!=null?c(String(t),"redacao",t):r("/portalCandidato"))}}},vt=()=>{const r=_e();re(),le();const{handleBackdropClick:t}=Te({isOpen:r.showDeclarationPopup,onClose:r.closeDeclarationPopup}),[c,d]=i.useState(null),o=n=>{const u=n.currentTarget.getBoundingClientRect();d({x:(n.clientX-u.left)/u.width*100,y:(n.clientY-u.top)/u.height*100})},a=()=>d(null);return e.jsxs("div",{className:"min-h-screen w-full bg-cover bg-center bg-no-repeat",style:{backgroundImage:"url(/background-portalcandidato.webp)"},children:[e.jsx(ne,{}),e.jsxs(y.main,{initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.3},className:"relative px-8 py-10 lg:px-8",children:[e.jsx(ae,{onClick:r.goBack}),e.jsxs("div",{className:"mx-auto max-w-4xl",children:[e.jsx(se,{onClick:r.goBack}),e.jsx(y.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},className:"mb-12 text-center",children:e.jsx("h1",{className:"text-background-primary mb-4 text-2xl font-bold lg:text-3xl",children:"Redação online"})}),e.jsx(y.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},className:"from-background-primary to-background-light shadow-strong group relative overflow-hidden rounded-3xl bg-gradient-to-br",children:e.jsxs("div",{className:"relative p-8 lg:p-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-text mb-6 text-xl font-bold lg:text-2xl",children:"Separamos algumas dicas para que tudo ocorra da melhor forma possÃvel neste momento, veja:"}),e.jsx("div",{className:"bg-primary/5 rounded-xl p-4 sm:p-6",children:e.jsxs("ul",{className:"text-text/80 space-y-2 text-sm sm:text-base",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"bg-primary mt-1.5 h-1.5 w-1.5 flex-shrink-0 rounded-full"}),"Antes de mais nada, tenha calma."]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"bg-primary mt-1.5 h-1.5 w-1.5 flex-shrink-0 rounded-full"}),"Mantenha a respiração constante."]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"bg-primary mt-1.5 h-1.5 w-1.5 flex-shrink-0 rounded-full"}),"Pegue uma garrafa de água e hidrate-se sempre."]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"bg-primary mt-1.5 h-1.5 w-1.5 flex-shrink-0 rounded-full"}),e.jsxs("span",{children:["Fique atento ao prazo! ",e.jsx("strong",{children:"Você terá 1 hora para completá-la."})]})]})]})})]}),e.jsx("div",{className:"mb-8 flex",children:e.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:r.hasAcceptedTerms,onChange:r.hasAcceptedTerms?r.declineTerms:r.acceptTerms,className:"border-primary text-primary checked:border-primary checked:bg-primary focus:ring-primary h-5 w-5 rounded-full border-2 checked:rounded-full focus:ring-2"}),e.jsxs("span",{className:"text-text text-sm lg:text-base",children:["Li e aceito os termos da"," ",e.jsx("button",{type:"button",onClick:r.openDeclarationPopup,className:"text-primary hover:text-primary/80 focus:ring-primary rounded underline focus:outline-none focus:ring-2 focus:ring-offset-2",children:"declaração de autoria"}),"."]})]})}),e.jsx("div",{className:"flex justify-center",children:e.jsx(y.button,{onClick:r.startRedaction,disabled:!r.hasAcceptedTerms||r.isLoading,className:`flex items-center justify-center gap-3 rounded-xl px-8 py-4 text-lg font-semibold transition-all duration-200 ${r.hasAcceptedTerms&&!r.isLoading?"from-primary to-secondary text-background-primary shadow-soft hover:shadow-medium bg-gradient-to-r":"bg-background-light text-text/50 cursor-not-allowed"}`,whileHover:r.hasAcceptedTerms&&!r.isLoading?{scale:1.02}:{},whileTap:r.hasAcceptedTerms&&!r.isLoading?{scale:.98}:{},children:r.isLoading?e.jsx(e.Fragment,{children:e.jsx("div",{className:"border-secondary h-5 w-5 animate-spin rounded-full border-2 border-t-transparent"})}):"Iniciar redação"})})]})})]})]}),r.showDeclarationPopup&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:t,children:e.jsxs(y.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2},className:"from-background-primary to-background-light shadow-strong relative mx-4 w-full max-w-xl rounded-3xl bg-gradient-to-br p-8",children:[e.jsx(y.button,{type:"button",initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{delay:.2,type:"spring"},onClick:r.closeDeclarationPopup,className:"bg-background-light text-text/60 hover:bg-primary/10 hover:text-primary absolute right-4 top-4 flex h-8 w-8 items-center justify-center rounded-full transition-colors duration-200",whileHover:{scale:1.1,rotate:90},whileTap:{scale:.9},"aria-label":"Fechar",children:e.jsx(Ce,{size:16})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-text mb-6 text-2xl font-bold",children:"Declaração de Autoria"}),e.jsxs("div",{className:"text-text/80 space-y-4",children:[e.jsx("p",{children:"Por fim, declaro que sou o autor original do conteúdo de minha redação e que não utilizei nenhuma ferramenta de busca na internet, inteligência artificial ou qualquer outro re
1curso externo para elaborar o texto."}),e.jsx("p",{children:"Todo o conteúdo foi desenvolvido exclusivamente com base no meu conhecimento pessoal, sem consulta a materiais externos ou auxÃlio de terceiros."})]}),e.jsx("div",{className:"mt-8 flex w-full justify-center",children:e.jsxs("button",{type:"button",onClick:r.closeDeclarationPopup,onMouseMove:o,onMouseLeave:a,className:"from-primary to-secondary text-background-primary shadow-soft hover:shadow-medium relative flex w-full items-center justify-center gap-2 overflow-hidden rounded-xl bg-gradient-to-r px-6 py-3 text-base font-semibold transition-all duration-200 active:scale-95",children:[e.jsx("span",{className:"pointer-events-none absolute inset-0 transition-opacity duration-150",style:{opacity:c?1:0,background:c?`radial-gradient(circle 80px at ${c.x}% ${c.y}%, rgba(255,255,255,0.22), transparent 50%)`:"transparent"},"aria-hidden":!0}),e.jsx("span",{className:"relative z-10",children:"Entendi"})]})})]})]})}),e.jsx(Re,{isOpen:r.showErrorModal,onClose:r.closeErrorModal,title:"Erro ao iniciar redação",message:r.errorMessage})]})},ce=r=>{const t=G(),{selectedProcess:c}=oe(),{markProcessAsCompleted:d}=ie(),o=R(s=>s.redacaoManuallySaved),a=R(s=>s.redacaoSuspiciousActivity),n=R(s=>s.setRedacaoDraft),u=R(s=>s.setRedacaoSuspiciousActivity),m=R(s=>s.setRedacaoManuallySaved),v=R(s=>s.setRedacaoSavedData),[l,g]=i.useState(!0),[j,N]=i.useState(!1),[C,S]=i.useState(!1),[f,O]=i.useState(""),[Z,B]=i.useState(!1),[Q,P]=i.useState(!1),[T,E]=i.useState(!1),[p,de]=i.useState(),[w,ue]=i.useState(),[me,J]=i.useState(1),pe=i.useRef(0),A=i.useRef([]),D=i.useRef(!1),K=i.useRef(null),k=i.useRef(!1),ee=sessionStorage.getItem("isObservingCandidate")=="true",H=o,{isBlocked:he}=Ie({enabled:!1}),{detectSuspiciousInput:ge,validateInput:fe,analyzeInputHistory:xe}=Pe();Me({value:f,onSave:()=>{},enabled:!1,isManuallySaved:H}),i.useEffect(()=>((async()=>{try{const s=await X.getWording();de(s),ue({id:Number(s.wordingTheme.questionCode),theme:s.wordingTheme.wordingTheme.theme,orientation:s.wordingTheme.wordingTheme.orientation,supportingText:s.wordingTheme.wordingTheme.supportingText}),O(s.wording),k.current=!0}catch(s){b.warn(`Não foi possÃvel verificar dados salvos da redação: ${s}`)}finally{g(!1)}})(),()=>{_.cancel(F.candidate.exam.wording)}),[]),i.useEffect(()=>{const s=console.log;return console.log=(...h)=>{h.some(x=>typeof x=="string"&&x.includes("textarea"))&&(D.current=!0,L.recordEvent("devtools_detected",{reason:"console_manipulation",context:"redacao_editor"})),s.apply(console,h)},()=>{console.log=s}},[]),i.useEffect(()=>{a==="true"&&(D.current=!0)},[a]),i.useEffect(()=>{const s=setInterval(()=>{if(K.current){const{message:h,timestamp:x}=K.current;b.debug(h,{timestamp:x}),K.current=null}},z.AUTO_SAVE.LOG_INTERVAL);return()=>clearInterval(s)},[]),i.useLayoutEffect(()=>{const s=r.current;s&&J(Y(f,s))},[f]),i.useEffect(()=>{const s=r.current;if(!s||typeof ResizeObserver>"u")return;const h=new ResizeObserver(()=>{const x=r.current;x&&J(Y(x.value,x))});return h.observe(s),()=>h.disconnect()},[]);const ve=async s=>{if(!k.current)try{k.current=!0;const h={codProva:p.examCode||"",subjectCode:"1",areaCode:p.wordingTheme.areaCode||null,questionCode:p.wordingTheme.questionCode||null,id:p.idExam||0,questionType:"C",optionCode:null,seqQuestion:p.wordingTheme.displayOrder||1,answer:s,peso:Math.round(p.wordingTheme.points||0)};let x=null;try{x=await I.getCsrfToken()}catch{b.warn("Não foi possÃvel obter CSRF token para salvar o primeiro caractere da redação")}await _.post(F.candidate.exam.saveAnswer,h,{csrfToken:x||void 0,includeCredentials:!0})}catch(h){b.error("Erro ao salvar o primeiro caractere da redação: ",h),k.current=!1}};return{isSaving:j,isFinalizing:C,isLoading:l,temaRedacao:w,resposta:f,isManuallySaved:H,showMobileBlock:he,isObservingCandidate:ee,setResposta:s=>{if(ge(s,f)){D.current=!0,L.recordEvent("suspicious_activity",{reason:"suspicious_input_detected",inputLength:s.length,previousLength:f.length});return}if(!fe(s)){D.current=!0,L.recordEvent("xss_attempt",{reason:"invalid_characters",input
1Length:s.length});return}const{SECURITY:h}=z;if(A.current.push(s),A.current.length>h.INPUT_HISTORY_SIZE&&A.current.shift(),xe(s,A.current)){D.current=!0;const ye=A.current.slice(-5).reduce((be,we)=>be+we.length,0)/h.INPUT_HISTORY_ANALYSIS_SIZE;L.recordEvent("rapid_input",{reason:"input_too_large",inputLength:s.length,averageLength:ye});return}const x=r.current;(x&&x.getBoundingClientRect().width>0?Y(s,x):s.split(` 2`).length)<=je.MAX_LINES_REDACAO&&(O(s),pe.current=Date.now(),H&&m(!1),s.length===1&&f.length===0&&!k.current&&ve(s))},salvarEContinuarDepois:async()=>{N(!0);try{const s={codProva:p.examCode||"",subjectCode:"1",areaCode:p.wordingTheme.areaCode||null,questionCode:p.wordingTheme.questionCode||null,id:p.idExam||0,questionType:"C",optionCode:null,seqQuestion:p.wordingTheme.displayOrder||1,answer:f,peso:Math.round(p.wordingTheme.points||0)};let h=null;try{h=await I.getCsrfToken()}catch{b.warn("Não foi possÃvel obter CSRF token para salvar resposta da redação")}await _.post(F.candidate.exam.saveAnswer,s,{csrfToken:h||void 0,includeCredentials:!0}),b.debug("Resposta da redação salva com sucesso via save-answer"),m(!0),w&&(v({theme:w.theme,orientation:w.orientation,supportingText:w.supportingText,userText:f}),b.debug("Dados completos da redação salvos no store",{hasTheme:!!w.theme,hasOrientation:!!w.orientation,hasSupportingText:!!w.supportingText,userTextLength:f.length})),E(!0)}catch(s){b.error("Erro ao salvar redação: ",s),m(!0),w&&v({theme:w.theme,orientation:w.orientation,supportingText:w.supportingText,userText:f}),E(!0)}finally{N(!1)}},finalizar:()=>{if(!f.trim()){alert("Por favor, escreva sua redação antes de finalizar.");return}P(!0)},confirmarEnvio:async()=>{P(!1),S(!0);try{const s=await I.getCsrfToken(),h=await I.validMe(s);if(typeof h=="string"||!h)throw new Error("Usuário não autenticado");const x={codProva:p.examCode||"",subjectCode:"1",areaCode:p.wordingTheme.areaCode||null,questionCode:p.wordingTheme.questionCode||null,id:p.idExam||0,questionType:"C",optionCode:null,seqQuestion:p.wordingTheme.displayOrder||1,answer:f,peso:Math.round(p.wordingTheme.points||0)};let U=null;try{U=await I.getCsrfToken()}catch{b.warn("Não foi possÃvel obter CSRF token para salvar resposta da redação")}await _.post(F.candidate.exam.saveAnswer,x,{csrfToken:U||void 0,includeCredentials:!0}),b.debug("Resposta da redação salva com sucesso");try{await X.finishExam(p.examCode||"",p.idExam||0,p.wordingTheme.areaCode||"",0),c&&d(c,"prova-online"),b.debug("Redação finalizada com sucesso")}catch(te){b.error("Erro ao finalizar redação:",te)}n(null),u(null),m(!1),v(null),k.current=!1,setTimeout(()=>{S(!1),B(!0)},Se.FINALIZATION_PROCESSING)}catch(s){b.error("Erro ao finalizar redação:",s),S(!1),alert(s.message)}},cancelarEnvio:()=>{P(!1)},goBack:async()=>{if(n(null),u(null),m(!1),v(null),k.current=!1,ee){t("/portalCandidato");return}t("/redacao")},lineCount:me,isSuccessModalOpen:Z,showConfirmModal:Q,showSaveWarningModal:T,closeSuccessModal:()=>{B(!1),t("/portalCandidato")},closeSaveWarningModal:()=>{E(!1),t("/portalCandidato")}}};class Fe{author;work;publisher;edition;local;number;year;page;siteUrl;dateAccess;constructor(t,c,d,o,a,n,u,m,v,l){this.year=t,this.author=c,this.dateAccess=d,this.edition=o,this.local=a,this.number=n,this.work=u,this.page=m,this.publisher=v,this.siteUrl=l}get(){let t="";if(this.year&&(t+=this.year+". "),this.author&&(t+=this.author+". "),this.dateAccess){const c=["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],d=new Date(this.dateAccess),o=String(d.getDate()).padStart(2,"0"),a=d.getFullYear();t+=`Acessado em: ${o} de ${c[d.getMonth()]}, ${a}. `}return this.edition&&(t+=this.edition+". "),this.local&&(t+=this.local+". "),this.number&&(t+=this.number+". "),this.work&&(t+=this.work+". "),this.page&&(t+=this.page+". "),this.publisher&&(t+=this.publisher+". "),this.siteUrl&&(t+=`DisponÃvel em: ${this.siteUrl}. `),t}}const ze=()=>{const r=o=>{if(o.key==="F12"||o.ctrlKey&&o.shiftKey&&o.key==="I"||o.ctrlKey&&o.shiftKey&&o.key==="J"||o.ctrlKey&&o.key==="U")return o.preventDefault(),L.recordEvent("devtools_detected",{key:o.key,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,context:"exam_protection"}),!1},t=o=>{o.target.tagName!=="TEXTAREA"&&o.preventDefault()},c=()=>{document.hidden&&(console.warn("Tentativa de mudança de aba detectada"),L.recordEvent("suspicious_activity",{reason:"tab_change_detected",context:"exam_protection"}))},d=o=>{o.preventDefault()};return document.addEventListener("keydown",r),document.addEventListener("contextmenu",t),document.addEventListener("visibilitychange",c),window.addEventListener("beforeprint",d),()=>{document.removeEventListener("keydown",r),document.removeEventListener("contextmenu",t),document.removeEventListener("visibilitychange",c),window.removeEventListener("beforeprint",d)}},yt=()=>{const r=q.useRef(null),t=ce(r);re(),le();const c=Le(),[d,o]=q.useState(null);return q.useEffect(()=>{const a=ze(),n=l=>{if((l.ctrlKey||l.metaKey)&&l.key.toLowerCase()==="s")return l.preventDefault(),!1;const g=l.key.toLowerCase();if((l.ctrlKey||l.metaKey)&&(g==="c"||g==="v"||g==="x"||l.key==="Insert"&&!l.shiftKey)||l.shiftKey&&l.key==="Insert")return l.preventDefault(),!1},u=l=>{l.preventDefault()},m=l=>{l.target.tagName!=="TEXTAREA"&&l.preventDefault()},v=console.log;return console.log=(...l)=>{l.some(g=>typeof g=="string"&&g.includes("textarea"))||v.apply(console,l)},document.addEventListener("keydown",n),document.addEventListener("selectstart",m),document.addEventListener("copy",u,!0),document.addEventListener("cut",u,!0),document.addEventListener("paste",u,!0),()=>{a(),document.removeEventListener("keydown",n),document.removeEventListener("selectstart",m),document.removeEventListener("copy",u,!0),document.removeEventListener("cut",u,!0),document.removeEventListener("paste",u,!0),console.log=v}},[]),t.isLoading?e.jsxs("div",{className:"min-h-screen w-full bg-cover bg-fixed bg-center bg-no-repeat",style:{backgroundImage:"url(/background-portalcandidato.webp)"},children:[e.jsx(ne,{}),e.jsx("div",{className:"flex h-screen items-center justify-center",children:e.jsx("div",{className:"text-center",children:e.jsx("div",{className:"border-background-primary mb-4 h-12 w-12 animate-spin rounded-full border-4 border-t-transparent"})})})]}):e.jsxs(ke,{children:[e.jsxs(y.main,{initial:{opacity:0}
2,animate:{opacity:1},transition:{delay:.1,duration:.3},className:"relative px-8 py-10 lg:px-8",children:[e.jsx(ae,{onClick:t.goBack}),e.jsxs("div",{className:"mx-auto max-w-6xl",children:[e.jsx(se,{onClick:t.goBack}),e.jsx(y.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3,duration:.3},className:"from-primary/10 to-secondary/10 mb-8 rounded-xl bg-gradient-to-r p-6 py-12 sm:p-6",children:e.jsx("h1",{className:"text-background-primary text-xl font-bold lg:text-2xl",children:"Redação - Processo Seletivo"})}),e.jsx(y.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.3},className:"from-background-primary to-background-light shadow-strong group relative overflow-hidden rounded-3xl bg-gradient-to-br",children:e.jsxs("div",{className:"relative p-8 lg:p-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-text mb-4 text-xl font-bold lg:text-2xl",children:e.jsx($,{children:V(t.temaRedacao?.theme||"")})}),e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"text-text/80 mb-4 text-sm lg:text-base",children:e.jsx($,{children:V(t.temaRedacao?.orientation||"")})}),e.jsxs("div",{className:"bg-background-light/50 rounded-xl p-6",children:[e.jsx("blockquote",{className:"text-text mb-4 text-sm italic lg:text-base",children:e.jsx($,{children:V(t.temaRedacao?.supportingText||"")})}),t.temaRedacao?.sources&&t.temaRedacao.sources.length>0&&t.temaRedacao.sources.map((a,n)=>{const u=new Fe(a.year,a.author,a.dateAccess,a.edition,a.local,a.number,a.work,a.page,a.publisher,a.siteUrl);return e.jsx("p",{className:"text-text/60 text-xs lg:text-sm",children:u.get()},n)})]})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("label",{className:"text-text mb-2 block text-sm font-medium lg:text-base",children:"Resposta"}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:r,value:t.resposta,onChange:a=>t.setResposta(a.target.value),placeholder:"Digite sua redação aqui...",maxLength:5e3,className:"border-primary/20 bg-background-light/50 text-text placeholder:text-text/50 focus:border-primary h-[650px] w-full resize-none break-words rounded-xl border-2 p-6 text-sm focus:outline-none lg:text-base",style:{backgroundImage:"repeating-linear-gradient(transparent, transparent 19px, #e5e7eb 19px, #e5e7eb 20px)",backgroundSize:"100% 20px",lineHeight:"20px",paddingTop:"20px",marginTop:"2px"},disabled:t.isSaving||t.isFinalizing,onDragOver:a=>a.preventDefault(),onDrop:a=>a.preventDefault(),onKeyDown:a=>{const n=a.key.toLowerCase();if(a.ctrlKey||a.metaKey){if(n==="c"||n==="v"||n==="x"){a.preventDefault();return}if(a.key==="Insert"&&!a.shiftKey){a.preventDefault();return}}if(a.shiftKey&&a.key==="Insert"){a.preventDefault();return}if((a.ctrlKey||a.metaKey)&&(n==="a"||n==="z")){a.preventDefault();return}if(a.key==="F12"||(a.ctrlKey||a.metaKey)&&a.shiftKey&&(a.key==="I"||a.key==="J")||(a.ctrlKey||a.metaKey)&&a.key==="u"){a.preventDefault();return}if(a.key==="Enter"&&t.lineCount>=30){a.preventDefault();return}if(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(a.key)){a.preventDefault();return}},onInput:()=>{},onFocus:a=>{const n=a.target;setTimeout(()=>{n.selectionStart!==n.selectionEnd&&n.setSelectionRange(n.selectionStart,n.selectionStart)},0)}}),e.jsxs("div",{className:"text-text/60 absolute bottom-4 right-4 text-xs lg:text-sm",children:[t.lineCount,"/30"]})]})]}),e.jsx("div",{className:"flex flex-col gap-4 sm:flex-row sm:justify-end",children:e.jsxs(y.button,{onClick:t.finalizar,disabled:t.isSaving||t.isFinalizing||!t.resposta.trim()||t.isObservingCandidate,onMouseMove:a=>{const n=a.currentTarget.getBoundingClientRect();o({x:(a.clientX-n.left)/n.width*100,y:(a.clientY-n.top)/n.height*100})},onMouseLeave:()=>o(null),className:`relative flex w-full items-center justify-center gap-3 overflow-hidden rounded-2xl px-10 py-4 text-base font-semibold transition-all duration-200 sm:w-auto sm:px-12 sm:text-lg ${t.resposta.trim()&&!t.isSaving&&!t.isFinalizing&&!t.isObservingCandidate?"from-primary to-secondary text-background-primary shadow-soft hover:shadow-medium bg-gradient-to-r":"bg-background-light text-text/50 cursor-not-allowed"}`,whileHover:t.resposta.trim()&&!t.isSaving&&!t.isFinalizing&&!t.isObservingCandidate?{scale:1.02}:{},whileTap:t.resposta.trim()&&!t.isSaving&&!t.isFinalizing&&!t.isObservingCandidate?{scale:.98}:{},children:[e.jsx("span",{className:"pointer-events-none absolute inset-0 transition-opacity duration-150",style:{opacity:d?1:0,background:d?`radial-gradient(circle 80px at ${d.x}% ${d.y}%, rgba(255,255,255,0.22), transparent 50%)`:"transparent"},"aria-hidden":!0}),e.jsx("span",{className:"relative z-10",children:t.isFinalizing?e.jsx("div",{className:"border-secondary h-4 w-4 animate-spin rounded-full border-2 border-t-transparent"}):"Finalizar"})]})})]})})]})]}
2),e.jsx(M,{isOpen:t.showConfirmModal,onClose:t.cancelarEnvio,title:"Confirmar Envio da Redação",message:"Tem certeza que deseja finalizar e enviar sua redação? Esta ação não pode ser desfeita.",buttonText:"Sim, Finalizar",onButtonClick:t.confirmarEnvio,showCloseButton:!0}),e.jsx(M,{isOpen:t.isSuccessModalOpen,onClose:t.closeSuccessModal,title:"Redação Finalizada!",message:"Sua redação foi enviada com sucesso. Você será redirecionado para o portal do candidato.",buttonText:"Continuar",onButtonClick:t.closeSuccessModal,showCloseButton:!1}),e.jsx(M,{isOpen:t.showSaveWarningModal,onClose:t.closeSaveWarningModal,title:"Redação Salva!",message:"Não feche a aba, se fechar irá perder o progresso.",buttonText:"Entendi",onButtonClick:t.closeSaveWarningModal,showCloseButton:!1}),e.jsx(Ae,{isVisible:!c}),e.jsx(Ee,{isOpen:t.showMobileBlock})]})},bt=()=>{const r=G(),t=i.useRef(null),c=ce(t),[d,o]=i.useState(""),[a,n]=i.useState(""),[u,m]=i.useState(!1),[v,l]=i.useState(!1),g=()=>{r(-1)},j=()=>{console.log("Salvar rascunho",{resposta:c.resposta,notaFinal:d,observacoes:a})},N=async()=>{console.log("Finalizar correção",{resposta:c.resposta,notaFinal:d,observacoes:a})};return e.jsxs(Ne,{children:[e.jsx("main",{className:"mx-auto w-full max-w-6xl px-4 pb-10 pt-24",children:e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-12",children:[e.jsx(y.section,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2},className:"lg:col-span-8",children:e.jsxs("div",{className:"overflow-hidden rounded-xl bg-white shadow-sm",children:[e.jsxs("div",{className:"border-b border-gray-100 p-6 md:p-8",children:[e.jsx("h2",{className:"mb-2 text-xl font-semibold text-gray-900",children:c.temaRedacao?.theme}),e.jsx("p",{className:"text-sm text-gray-700",children:c.temaRedacao?.orientation})]}),e.jsxs("div",{className:"p-6 md:p-8",children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-800",children:"Redação"}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:t,value:c.resposta,onChange:C=>c.setResposta(C.target.value),className:"focus:border-primary focus:ring-primary/20 h-[640px] w-full resize-none break-words rounded-lg border border-gray-200 bg-gray-50 p-4 text-sm text-gray-800 placeholder:text-gray-500 focus:outline-none focus:ring-1",placeholder:"Conteúdo da redação...",style:{backgroundImage:"repeating-linear-gradient(transparent, transparent 19px, #e5e7eb 19px, #e5e7eb 20px)",backgroundSize:"100% 20px",lineHeight:"20px",paddingTop:"20px",marginTop:"2px"}}),e.jsxs("div",{className:"pointer-events-none absolute bottom-3 right-3 rounded-md bg-white/70 px-2 py-1 text-xs text-gray-600 shadow-sm",children:[c.lineCount,"/30 linhas"]})]})]})]})}),e.jsx(y.aside,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,delay:.05},className:"lg:col-span-4",children:e.jsxs("div",{className:"sticky top-24 space-y-6",children:[e.jsxs("div",{className:"rounded-xl bg-white p-5 shadow-sm",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-800",children:"Correção de Redação"}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:"Ãrea de avaliação da secretaria"})]}),e.jsxs("div",{className:"overflow-hidden rounded-xl bg-white shadow-sm",children:[e.jsxs("div",{className:"border-b border-gray-100 p-5",children:[e.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Avaliação"}),e.jsx("p",{className:"mt-1 text-xs text-gray-600",children:"Defina a nota final e observações."})]}),e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-800",children:"Nota final (%)"}),e.jsx("input",{type:"number",inputMode:"numeric",min:0,max:100,step:1,maxLength:3,value:d,onChange:C=>{const S=C.target.value.replace(/[^0-9]/g,"");if(S.length>3)return;if(S===""){o(S);return}const f=parseInt(S,10);!isNaN(f)&&f>=0&&f<=100&&o(S)},className:"focus:border-primary focus:ring-primary/20 w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-800 placeholder:text-gray-400 focus:outline-none focus:ring-1",placeholder:"0 a 100"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-800",children:"Observações"}),e.jsx("textarea",{value:a,onChange:C=>n(C.target.value),className:"focus:border-primary focus:ring-primary/20 h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white p-3 text-sm text-gray-800 placeholder:text-gray-400 focus:outline-none focus:ring-1",placeholder:"Comentários do avaliador..."})]})]}),e.jsxs("div",{className:"flex gap-2 border-t border-gray-100 p-5",children:[e.jsx(y.button,{onClick:g,className:"flex-1 rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm font-semibold text-gray-700 transition-all hover:bg-gray-50",children:"Cancelar"}),e.jsx(y.button,{onClick:()=>m(!0),className:"border-primary/30 bg-primary/10 text-primary hover:bg-primary/20 flex-1 rounded-lg border px-4 py-2.5 text-sm font-semibold transition-all",children:"Salvar"})]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl bg-white shadow-sm",children:e.jsxs("div",{className:"p-5",children:[e.jsx("p",{className:"mb-3 text-sm text-gray-700",children:"Revise os campos antes de finalizar a correção."}),e.jsx(De,{onClick:()=>l(!0),className:"from-primary to-secondary text-background-primary shadow-soft hover:shadow-medium w-full rounded-lg bg-gradient-to-r px-5 py-2.5 text-sm font-semibold text-white transition-all",shineEffect:!0,children:"Finalizar correção"})]})})]})})]})}),e.jsx(M,{isOpen:u,onClose:()=>m(!1),title:"Confirmar salvamento",message:"Deseja salvar esta correção como rascunho? Você poderá finalizar depois.",buttonText:"Confirmar salvamento",onButtonClick:()=>{m(!1),j(),r("/secretaria/avaliacao/correcoes")},showCloseButton:!0}),e.jsx(M,{isOpen:v,onClose:()=>l(!1),title:"Confirmar finalização",message:"Tem certeza que deseja finalizar a correção? Esta ação não pode ser desfeita.",buttonText:"Finalizar correção",onButtonClick:()=>{l(!1),N(),r("/secretaria/avaliacao/correcoes")},showCloseButton:!0})]})};export{Fe as Fontes,vt as InfoRedacaoView,bt as RedacaoEditorSecretariaView,yt as RedacaoView,_e as useInfoRedacaoViewModel,ce as useRedacaoEditorViewModel};
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.