PageSourceSearch

https://extremegroup.ai/assets/HumanDynamicsResponder-NRNXxzYy.js

js extremegroup.ai collected 2026-10-05 14:58:31 UTC 9,331 bytes, 1 lines download raw bytes

1import{j as e}from"./editor-D81ingK4.js";import{r as o}from"./charts-D2ZB5Iwm.js";import{B as v}from"./button-_gHqfTyb.js";import{c as j}from"./utils-C7YNzFbK.js";import{P as $,a as B,b as Q}from"./popover-3_Y7KNPm.js";import{S as U}from"./scroll-area-7VrCUUKH.js";import{b9 as V,aa as q,s as G,bU as K,dY as M,aG as O}from"./index-Dz6bAh96.js";import{u as Y}from"./useHumanDynamicsSession-G-8rQcex.js";import{A as J,b as W,c as X,d as Z,e as ee,f as se,g as ae,h as te}from"./alert-dialog-DrJz3g9b.js";import{S as k}from"./skeleton-Di1UovKF.js";import"./useHumanDynamicsProfiles-CgCfXz_A.js";import"./index-DfKkw2Fq.js";function ne({value:a,onChange:l,min:t=0,max:d=10,minLabel:m="Não me identifico",maxLabel:p="Me identifico totalmente",disabled:i=!1,className:u}){const N=Array.from({length:d-t+1},(s,w)=>t+w),r=o.useCallback(s=>{if(i)return;const w=s.key,x=parseInt(w,10);!isNaN(x)&&x>=t&&x<=d&&l(x),a!==null&&((s.key==="ArrowRight"||s.key==="ArrowUp")&&(s.preventDefault(),a<d&&l(a+1)),(s.key==="ArrowLeft"||s.key==="ArrowDown")&&(s.preventDefault(),a>t&&l(a-1)))},[a,l,t,d,i]);return o.useEffect(()=>(window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)),[r]),e.jsxs("div",{className:j("w-full space-y-4",u),children:[e.jsx("div",{className:"flex items-center justify-center gap-2 sm:gap-3",children:N.map(s=>e.jsx("button",{type:"button",disabled:i,onClick:()=>l(s),className:j("relative flex items-center justify-center rounded-full transition-all duration-200","w-10 h-10 sm:w-12 sm:h-12 text-sm sm:text-base font-medium","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2","disabled:opacity-50 disabled:cursor-not-allowed",a===s?"bg-primary text-primary-foreground scale-110 shadow-lg":"bg-muted hover:bg-muted/80 text-muted-foreground hover:text-foreground"),children:s},s))}),e.jsxs("div",{className:"flex items-center justify-between text-xs sm:text-sm text-muted-foreground px-1",children:[e.jsx("span",{className:"max-w-[120px] sm:max-w-none",children:m}),e.jsx("span",{className:"max-w-[120px] sm:max-w-none text-right",children:p})]}),e.jsx("p",{className:"hidden sm:block text-center text-xs text-muted-foreground/60",children:"Use as teclas 0-9 ou setas para selecionar"})]})}function re({totalPerguntas:a,currentIndex:l,isRespondida:t,onNavigate:d,className:m}){const p=Array.from({length:a},(r,s)=>t(s)).filter(Boolean).length,i=20,u=a>i,N=u?i:a;return e.jsxs("div",{className:j("flex items-center gap-2",m),children:[e.jsxs("div",{className:"hidden md:flex items-center gap-1",children:[Array.from({length:N},(r,s)=>e.jsx("button",{onClick:()=>d(s),className:j("w-2 h-2 rounded-full transition-all duration-200 hover:scale-125",s===l?"bg-primary ring-2 ring-primary/30 scale-125":t(s)?"bg-accent-foreground/70 hover:bg-accent-foreground/90":"bg-muted-foreground/30 hover:bg-muted-foreground/50"),title:`Pergunta ${s+1}${t(s)?" (respondida)":""}`,"aria-label":`Ir para pergunta ${s+1}`},s)),u&&e.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:["+",a-i]})]}),e.jsxs($,{children:[e.jsx(B,{asChild:!0,children:e.jsxs(v,{variant:"ghost",size:"sm",className:"gap-1 text-xs text-muted-foreground hover:text-foreground",children:[e.jsxs("span",{className:"md:hidden",children:[l+1,"/",a]}),e.jsxs("span",{className:"hidden md:inline",children:[p,"/",a]}),e.jsx(V,{className:"h-3 w-3"})]})}),e.jsx(Q,{className:"w-72 p-3",align:"center",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"font-medium",children:"Navegação"}),e.jsxs("span",{className:"text-muted-foreground",children:[p," de ",a," respondidas"]})]}),e.jsx(U,{className:"h-48",children:e.jsx("div",{className:"grid grid-cols-10 gap-1.5 pr-3",children:Array.from({length:a},(r,s)=>e.jsx("button",{onClick:()=>d(s),className:j("w-6 h-6 rounded text-xs font-medium transition-all duration-150","flex items-center justify-center",s===l?"bg-primary text-primary-foreground ring-2 ring-primary/30":t(s)?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted hover:bg-muted/80 text-muted-foreground"),title:`Pergunta ${s+1}${t(s)?" (respondida)":""}`,children:s+1},s))})}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-foreground
1/70"}),e.jsx("span",{children:"Respondida"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-primary"}),e.jsx("span",{children:"Atual"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-muted-foreground/30"}),e.jsx("span",{children:"Pendente"})]})]})]})})]})]})}function je(){const a=q(),[l,t]=o.useState(0),[d,m]=o.useState(!1),[p,i]=o.useState(!1),[u,N]=o.useState(!1),{perguntas:r,perguntasLoading:s,respostas:w,respostasLoading:x,totalPerguntas:y,totalRespondidas:E,salvarResposta:L,salvarRespostaLoading:P,finalizarAssessment:I,finalizarAssessmentLoading:z,isCompleto:T,getRespostaParaPergunta:b}=Y();o.useEffect(()=>{if(u||s||x||r.length===0)return;const n=r.findIndex(c=>b(c.id)===null);n===-1?t(r.length-1):n>0&&t(n),N(!0)},[u,s,x,r,b]),o.useEffect(()=>{T&&a("/human-dynamics")},[T,a]);const f=r[l],g=f?b(f.id):null,C=l===0,h=l===r.length-1,A=E===y,H=o.useCallback(n=>{const c=r[n];return c?b(c.id)!==null:!1},[r,b]),R=o.useCallback(n=>{n<0||n>=r.length||(i(!0),setTimeout(()=>{t(n),i(!1)},150))},[r.length]),F=o.useCallback(async n=>{f&&(await L({perguntaId:f.id,valor:n}),h||(i(!0),setTimeout(()=>{t(c=>c+1),i(!1)},300)))},[f,L,h]),_=o.useCallback(()=>{C||(i(!0),setTimeout(()=>{t(n=>n-1),i(!1)},200))},[C]),D=o.useCallback(()=>{!h&&g!==null&&(i(!0),setTimeout(()=>{t(n=>n+1),i(!1)},200))},[h,g]),S=o.useCallback(async()=>{await I(),a("/human-dynamics")},[I,a]);return o.useEffect(()=>{const n=c=>{c.key==="Enter"&&g!==null&&(c.preventDefault(),h&&A?S():D()),c.key==="Escape"&&m(!0)};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[g,h,A,S,D]),s?e.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[e.jsx("div",{className:"p-4 border-b",children:e.jsx(k,{className:"h-6 w-48"})}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-2xl space-y-8",children:[e.jsx(k,{className:"h-8 w-full"}),e.jsx(k,{className:"h-24 w-full"}),e.jsx(k,{className:"h-16 w-full"})]})})]}):f?e.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[e.jsx("header",{className:"sticky top-0 z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border-b",children:e.jsx("div",{className:"container max-w-4xl mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[e.jsx(G,{className:"h-5 w-5"}),e.jsx("span",{className:"font-medium text-sm hidden sm:inline",children:"Human Dynamics"})]}),e.jsx(re,{totalPerguntas:y,currentIndex:l,isRespondida:H,onNavigate:R,className:"flex-1 justify-center"}),e.jsxs(v,{variant:"ghost",size:"sm",onClick:()=>m(!0),className:"gap-1 text-muted-foreground",children:[e.jsx(K,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Salvar e Sair"})]})]})})}),e.jsx("main",{className:"flex-1 flex items-center justify-center p-4 sm:p-8",children:e.jsx("div",{className:"w-full max-w-2xl",children:e.jsxs("div",{className:j("transition-all duration-300 ease-in-out",p&&"opacity-0 translate-x-4"),children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4 text-center",children:["Pergunta ",l+1," de ",y]}),e.jsxs("h2",{className:"text-xl sm:text-2xl font-medium text-center mb-12 leading-relaxed",children:['"',f.texto_pergunta,'"']}),e.jsx(ne,{value:g,onChange:F,disabled:P})]})})}),e.jsx("footer",{className:"sticky bottom-0 bg-background/95 backdrop-blur border-t",children:e.jsx("div",{className:"container max-w-4xl mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs(v,{variant:"ghost",onClick:_,disabled:C,className:"gap-2",children:[e.jsx(M,{className:"h-4 w-4"}),"Anterior"]}),e.jsx("p",{className:"text-xs text-muted-foreground hidden sm:block",children:"Pressione Enter para avançar"}),h?e.jsx(v,{onClick:S,disabled:!A||z,className:"gap-2",children:z?"Calculando...":"Finalizar"}):e.jsxs(v,{onClick:D,disabled:g===null,className:"gap-2",children:["Próxima",e.jsx(O,{className:"h-4 w-4"})]})]})})}),e.jsx(J,{open:d,onOpenChange:m,children:e.jsxs(W,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Salvar e sair?"}),e.jsxs(ee,{children:["Seu progresso está salvo automaticamente. Você respondeu"," ",E," de ",
1y," perguntas e pode continuar de onde parou a qualquer momento."]})]}),e.jsxs(se,{children:[e.jsx(ae,{children:"Continuar respondendo"}),e.jsx(te,{onClick:()=>a("/human-dynamics"),children:"Sair"})]})]})})]}):e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("p",{className:"text-muted-foreground",children:"Nenhuma pergunta encontrada."})})}export{je 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.