1import{j as t,u as R,c as M,m as q,g as F,T as A,M as ee,h as w,a as k,B as P,r as re,I as ne,a9 as Pe,o as de,i as Ne}from"./@themenu-design-system-DYRiRzlM.js";import{a as g,R as ue,m as Oe}from"./@analytics-DQmwd0WL.js";import{u as S}from"./@react-intl-ByT5Dd3Q.js";import{dg as L,V as W,s as me,gO as pe,e as X,gP as Re,gQ as ge,K as Ee,ac as ae,cK as z,b as fe,gR as Qe,at as te,ce as he,aH as D,aD as T,aE as Q,aF as $,cE as xe,cH as ze,H as Fe}from"./index-CEOZadzw.js";import{W as H}from"./WhiteCard-Dl3n6wF_.js";import{F as Ae}from"./FormikFieldTextarea-DpmrvN7W.js";import"./@react-aria-stately-BjYSCrfq.js";import"./@libphonenumber-js-CKk4m8Ay.js";import"./@luxon-DfZoh-A_.js";import"./@utils-B5fX3Hvq.js";import"./@swiper-B92D2qE2.js";import"./FormikErrorMessage-BtkyPZrk.js";try{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="bdb80424-f60e-4fcb-89e0-4143dc539da1",e._sentryDebugIdIdentifier="sentry-dbid-bdb80424-f60e-4fcb-89e0-4143dc539da1")}catch{}var E=(e=>(e.Good="GOOD",e.Partial="PARTIAL",e.Wrong="WRONG",e))(E||{}),be=(e=>(e.Completed="COMPLETED",e.Sent="SENT",e.Inactive="INACTIVE",e.InProgress="IN_PROGRESS",e))(be||{}),y=(e=>(e.Enps="ENPS",e.FreeForm="FREE_FORM",e.MultiPick="MULTI_PICK",e.Quiz="QUIZ",e.Scale="SCALE",e.SinglePick="SINGLE_PICK",e))(y||{});const O=e=>e.type===y.Quiz,ve=e=>e.type===y.MultiPick,we=e=>e.type===y.SinglePick,Te=e=>e.type===y.Enps,je=e=>e.type===y.Scale,Ve=e=>e.type===y.Scale&&!!e.shuffleQuestionId,Le=e=>e.type===y.FreeForm,De=e=>{var s;return{id:e.id,status:be.Sent,survey:e,questions:e.questions||[],next:{question:(s=e.questions)==null?void 0:s[0]}}},$e=async({surveyId:e})=>await L({method:"GET",path:`v1/surveys/${e}/preview`,headers:{"Accept-Language":navigator.languages}}),Be=async({campaignId:e})=>await L({method:"GET",path:`v1/campaigns/${e}/user-survey`,headers:{"Accept-Language":navigator.languages}}),Ge=()=>{const{id:e}=W(),s=!!me(pe.route),[n,r]=g.useState();if(s){const{data:l,...o}=X({queryKey:[Re,{surveyId:e}],queryFn:()=>$e({surveyId:e||""}),enabled:!!e}),i=l&&De(l);return!n&&i&&r(i),{userSurvey:n,isPulsePreview:s,setUserSurveyPreview:r,...o}}const{data:a,...c}=X({queryKey:[ge,{campaignId:e}],queryFn:()=>Be({campaignId:e||""}),enabled:!!e});return{userSurvey:a,isPulsePreview:s,...c}},Ue=()=>{const[e,s]=g.useState([]);return{isEmpty:()=>e.length===0,pop:()=>(s([...e.slice(0,-1)]),e.slice(-1).pop()),push:c=>{s([...e,c])}}},N=g.createContext({}),We=({children:e})=>{const[s,n]=g.useState(),[r,a]=g.useState(!1),c=Ue(),{userSurvey:l,isLoading:o,isPulsePreview:i,...u}=Ge(),d=l==null?void 0:l.questions[0],p=g.useMemo(()=>!!(s&&s.id===(d==null?void 0:d.id)),[d,s]),m=(h,x)=>{c.push(h),n(x)},f=(h,x)=>{var _,C;m({...h,answer:x},((_=x.next)==null?void 0:_.question)&&{...x.next.question,answer:(C=x.next)==null?void 0:C.answer})};return t.jsx(N.Provider,{value:{currentQuestion:s,setCurrentQuestion:n,goToNextQuestion:m,goToNextQuestionFromAnswer:f,displayQuizResults:r,previousQuestions:c,setDisplayQuizResults:a,userSurvey:l,...u,isFirstQuestion:p,isLoading:o,isPulsePreview:i},children:e})},He=async({answer:e,campaignId:s,questionId:n})=>await L({method:"PUT",path:`v1/campaigns/${s}/questions/${n}/answer`,body:{value:e.value,scale_value:e.scaleValue,selected_question_option_ids:e.selectedOptionIds,comment:e.comment}}),Ke=({surveyId:e,questionId:s,questionOptionIds:n})=>L({method:"PUT",path:`v1/surveys/${e}/preview/${s}/answer`,body:{selected_question_option_ids:n}}),V=e=>{const s=Ee(),n={onSuccess:()=>{s.invalidateQueries({queryKey:[ge]})}},{mutateAsync:r}=ae({mutationFn:He,...n}),{mutateAsync:a}=ae({mutationFn:Ke,...n}),{displayQuizResults:c,goToNextQuestionFromAnswer:l,setCurrentQuestion:o,setDisplayQuizResults:i,userSurvey:u}=g.useContext(N),d=O(e),{id:p}=W(),m=async(j,v)=>{const b=await r({campaignId:p||"",questionId:e.id,answer:j});return b&&(v==null||v.resetForm()),b},f=j=>{var v;return{rawSelectedOptions:(v=j.selectedOptionIds)==null?void 0:v.map(b=>({questionOptionId:b})),comment:j.comment??null}},h=async(j,v)=>{const{question:b}=await a({surveyId:u.survey.id,questionId:Ve(e)?e.shuffleQuestionId:e.id,questionOptionIds:j.selectedOptionIds}),I=f(j);I.next={question:b},v==null||v.resetForm(),l(e,I)},x=async(j,v)=>{const b=await m(j,v);if(c||e.answer)return l(e,b);i(!0),o({...e,answer:b})},_=async(j,v)=>{if(d)return x(j,v);const b=await m(j,v);l(e,b)},C=me(pe.route);return{onSubmit:(j,v)=>{C?h(j,v):_(j,v)}}},Ye=(e,s)=>{if(!e||!s)return{answerStatus:null,goodAnswers:[]};const n=e.filter(o=>o.isCorrect===!0).map(o=>o.id),r=e.filter(o=>o.isCorrect===!1).map(o=>o.id),a=s.every(o=>n.includes(o.questionOptionId))&&s.length===n.length,c=s.every(o=>r.includes(o.questionOptionId));let l=E.Partial;return a?l=E.Good:c&&(l=E.Wrong),{answerStatus:l,goodAnswers:n}}
1,ye=2e3,Xe={[E.Good]:"pulse_page.quiz.answer.good",[E.Partial]:"pulse_page.quiz.answer.partial",[E.Wrong]:"pulse_page.quiz.answer.wrong"},Ze={success:"border-border-success dark:border-border-success-dark",warning:"border-border-warning dark:border-border-warning-dark",critical:"border-border-critical dark:border-border-critical-dark",default:"border-border-default dark:border-border-default-dark"},Je=M({base:"mt-1 flex items-center justify-between rounded-8 border border-solid first:mt-0",variants:{isSelected:{true:"bg-background-default font-medium dark:bg-background-default-dark"},answerLevel:Ze}}),qe=({answerLevel:e,isCorrect:s,isSelected:n,label:r})=>{const a=R();return t.jsxs("div",{className:Je({isSelected:n,answerLevel:e}),children:[r,t.jsx(q,{name:s?"check":"cancel",color:s?a.colors.content.success:a.colors.content.critical})]})},et={GOOD:"success",PARTIAL:"warning",WRONG:"critical"},tt={success:"bg-background-success dark:bg-background-success-dark",critical:"bg-background-critical dark:bg-background-critical-dark",warning:"bg-background-warning dark:bg-background-warning-dark"},st=M({base:"-bottom-16 absolute w-[480px] pb-24",variants:{answerLevel:tt}}),rt=({answerStatus:e,isOpen:s,onClose:n,question:r})=>{const a=S(),c=R(),l=e?et[e]:"default";return t.jsx(F,{local:!0,theme:A.LIGHT,children:t.jsx(ee,{className:st({answerLevel:l}),isOpen:s,onClose:n,children:t.jsxs(w,{mb:12,borderRadius:12,colorSet:l,children:[t.jsx(k,{variant:"h2",weight:"medium",align:"center",color:c.colors.content[l],children:a.formatMessage({id:Xe[e]})}),t.jsx("div",{className:"mt-24 max-h-[300px] overflow-scroll",children:r.rawOptions.map(o=>{var i,u;return t.jsx(qe,{label:o.label,answerLevel:l,isCorrect:!!o.isCorrect,isSelected:!!((u=(i=r.answer)==null?void 0:i.rawSelectedOptions)!=null&&u.find(d=>d.questionOptionId===o.id))},o.id)})}),t.jsx(P,{onClick:n,mt:24,width:"100%",size:40,children:a.formatMessage({id:"pulse_page.actions.submit_validate"})})]})})})},nt=e=>t.jsx(F,{local:!0,theme:A.LIGHT,children:t.jsx(rt,{...e})}),at=e=>e?"pulse_page.actions.submit_next":"pulse_page.actions.submit_validate",ot=({disabled:e=!1,handleSubmit:s,question:n})=>{const r=S();return t.jsx(P,{type:"submit",disabled:e&&!n.isOptional,size:40,endIcon:"arrow-right",onClick:s,children:r.formatMessage({id:at(!!(O(n)&&n.answer))})})},ct=({question:e,disabled:s,handleSubmit:n,onSkip:r})=>{var d;const a=S(),{displayQuizResults:c,goToNextQuestionFromAnswer:l,setDisplayQuizResults:o}=g.useContext(N),{answerStatus:i}=Ye(O(e)?e.rawOptions:void 0,(d=e.answer)==null?void 0:d.rawSelectedOptions),u=()=>{o(!1),l(e,e.answer)};return t.jsxs(w,{children:[O(e)&&i&&t.jsx(nt,{answerStatus:i,isOpen:c,onClose:u,question:e}),t.jsxs("div",{className:"grid grid-cols-[170px] gap-y-16",children:[e.isOptional&&t.jsx(P,{variant:"secondary",type:"submit",size:40,onClick:r,disabled:!!(i&&(e!=null&&e.answer)),children:a.formatMessage({id:"pulse_page.actions.skip_question"})}),t.jsx(ot,{disabled:s||!1,handleSubmit:n,question:e})]})]})},lt=()=>{const{userSurvey:e}=g.useContext(N),{id:s,program:n}=e.survey,r=S(),[a,c]=g.useState(!1),l=i=>{if(i){const u=document.createElement("textarea");u.value=i,document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}},o=n!=null&&n.companyId?`https://corpo.swile.co/engagement/${n.companyId}/surveys/${s}/update`:null;return t.jsxs(w,{display:"flex",alignItems:"center",children:[t.jsx(re,{content:r.formatMessage({id:a?"pulse_page.preview.copy_link_done":"pulse_page.preview.copy_link"}),delay:0,direction:"left",children:t.jsx(ne,{name:a?"check":"link",size:48,variant:"secondary",onClick:()=>{l(window.location.href),c(!0)}})}),o&&t.jsx(w,{ml:8,children:t.jsx(re,{content:r.formatMessage({id:"pulse_page.preview.edit_survey"}),delay:0,direction:"left",children:t.jsx(ne,{name:"edit",size:48,variant:"secondary",component:"a",href:o,target:"_blank"})})})]})},it=({question:e})=>{const s=S(),{dirty:n,handleSubmit:r,resetForm:a}=z(),{isPulsePreview:c}=g.useContext(N),{onSubmit:l}=V(e),o=()=>{a(),l({})};
1return t.jsxs("div",{className:"grid w-full grid-cols-[33%_34%_33%]",children:[t.jsx(w,{}),t.jsx(w,{p:24,display:"flex",justifyContent:"center",children:t.jsx(ct,{disabled:!(e!=null&&e.answer)&&!n,handleSubmit:r,onSkip:o,question:e})}),t.jsx(w,{mr:16,display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"center",children:c&&t.jsxs(w,{display:"flex",alignItems:"center",children:[t.jsx(k,{variant:"h2",children:s.formatMessage({id:"pulse_page.preview.title"})}),t.jsx(w,{ml:16,children:t.jsx(lt,{})})]})})]})},dt=({title:e,description:s,isOpen:n,onClose:r})=>{const a=S();return t.jsx(F,{local:!0,theme:A.LIGHT,children:t.jsxs(ee,{isOpen:n,onClose:r,title:t.jsx(k,{variant:"h2",align:"center",mb:32,children:e}),children:[t.jsx(k,{whiteSpace:"pre-wrap",variant:"body",mb:32,children:s}),t.jsx(P,{variant:"primary",size:40,onClick:r,children:a.formatMessage({id:"pulse_page.info_modal.continue"})})]})})},ke=({displayHeaderTitle:e=!0,isResults:s=!1})=>{const n=S(),{isFirstQuestion:r,isLoading:a,isPulsePreview:c,previousQuestions:l,setCurrentQuestion:o,userSurvey:{survey:i}}=g.useContext(N),u=fe(),d=()=>{o(l.pop())},p=()=>{u("/")},[m,f]=g.useState(!s&&r),h=()=>f(!0),x=()=>f(!1),_=!l.isEmpty()&&(!s||c);return t.jsxs("div",{className:"grid w-full grid-cols-[33%_34%_33%] p-24",children:[t.jsx(w,{display:"flex",alignItems:"center",children:_&&t.jsx(P,{variant:"secondary",startIcon:"chevron-left",onClick:d,children:n.formatMessage({id:"pulse_page.actions.previous_question"})})}),t.jsx(w,{display:"flex",justifyContent:"center",alignItems:"center",children:s&&e&&t.jsx(k,{variant:"body",weight:"medium",children:n.formatMessage({id:"pulse_page.header.results"})})}),t.jsxs(w,{display:"flex",justifyContent:"flex-end",children:[!a&&t.jsx(P,{variant:"secondary",endIcon:"information",onClick:h,mr:8,children:n.formatMessage({id:"pulse_page.actions.info"})}),t.jsx(P,{variant:"secondary",endIcon:"cancel",onClick:p,children:n.formatMessage({id:"pulse_page.actions.exit"})})]}),!a&&t.jsx(dt,{title:i.name,description:i.introMessage,isOpen:m,onClose:x})]})},ut=async e=>await L({method:"GET",path:`v1/campaigns/${e.campaignId}/summary`}),mt=e=>{var s;return e.type===y.MultiPick&&((s=e.rawOptions)!=null&&s.some(n=>typeof(n==null?void 0:n.isCorrect)=="boolean"))?{...e,type:y.Quiz}:e},pt=e=>{if(e)return{...e,questions:e.questions.map(s=>mt(s))}},_e=({isPulsePreview:e})=>{if(e)return{campaignSummary:null};const{id:s}=W(),{data:n,...r}=X({queryKey:[Qe,{campaignId:s}],queryFn:()=>ut({campaignId:s||""}),enabled:!!s});return{campaignSummary:ue.useMemo(()=>pt(n),[n]),...r}},Ie=({error:e})=>{const s=fe(),n=S(),r=()=>{s("/")};return t.jsx(F,{local:!0,theme:A.LIGHT,children:t.jsx("div",{className:"flex h-screen w-[752px] items-center justify-center",children:t.jsx(H,{className:"w-[752px] text-center",children:t.jsxs(w,{children:[t.jsx(k,{variant:"h1",mb:16,children:e}),t.jsx(P,{variant:"secondary",endIcon:"cancel",onClick:r,children:n.formatMessage({id:"pulse_page.actions.exit"})})]})})})})},K=({children:e,icon:s})=>t.jsxs("div",{className:"mx-auto flex w-max items-center justify-center rounded-8 bg-background-contrast p-16 text-content-placeholder dark:bg-background-contrast-dark dark:text-content-placeholder-dark",children:[s&&t.jsx(q,{name:s,mr:8}),e]}),gt=({question:e})=>{const s=S(),n=R(),{identity:r}=te(),{isPulsePreview:a}=g.useContext(N),{campaignSummary:c}=_e({isPulsePreview:a}),l=g.useMemo(()=>{var d,p;return((p=(d=e.results)==null?void 0:d.total)==null?void 0:p.count)||0},[e]),o=g.useMemo(()=>{var d;return((d=c==null?void 0:c.stats)==null?void 0:d.completed)||0},[e]),i=d=>{var p,m,f;switch(d.type){case y.Scale:case y.Enps:case y.Quiz:case y.MultiPick:case y.SinglePick:return((m=(p=d==null?void 0:d.answer)==null?void 0:p.rawSelectedOptions)==null?void 0:m.length)===0;default:return!((f=d.answer)!=null&&f.comment)}},u=l<o||i(e)&&r;return t.jsx(t.Fragment,{children:u&&t.jsxs(K,{children:[l<o&&t.jsx(k,{variant:"footnote",color:n.colors.content.placeholder,children:s.formatMessage({id:"results_optional_question_details.count_user_answer"},{count:l,total:o})}),t.jsx(w,{children:i(e)&&r&&t.jsx(k,{variant:"body",weight:"medium",children:s.formatMessage({id:"results_optional_question_details.current_user_not_answer"})})})]})})},ft=M({base:"flex w-full items-center justify-between rounded-8 p-16",variants:{color:{true:"text-success dar
1k:text-success-dark",false:"text-critical dark:text-critical-dark"}}}),ht=({isCorrect:e,isSelected:s,item:n,percentage:r})=>{const{identity:a}=te(),l=Pe({colorSet:e?"success":"critical"}),{formatInitials:o}=he();return t.jsxs("div",{className:ft({color:e}),children:[t.jsxs(w,{display:"flex",children:[s&&a&&t.jsx(de,{mr:8,size:20,src:a.avatarUrl||void 0,fallbackText:o(a)}),t.jsx(k,{variant:"body",color:l.content,...s&&{weight:"medium"},children:n.value})]}),t.jsx(w,{component:"span",display:"flex",children:t.jsxs(k,{color:l.content,...s&&{weight:"medium"},variant:"body",ml:12,children:[r,"%"]})})]})},xt=M({base:"absolute z-0 h-full rounded-l-8 bg-background-primary",variants:{percentage95:{true:"rounded-r-8 border border-border-default border-solid",false:"rounded-r-0"}}}),bt=({total:e,item:s,selectedOptions:n,isCorrect:r,isQuiz:a})=>{const c=m=>Math.round(m*100/e),l=R(),{formatInitials:o}=he(),{identity:i}=te(),u=!!(s.questionOptionId&&n.includes(s.questionOptionId)),d=c(s.count),p=u?l.colors.content.default:l.colors.content.subdued;return t.jsxs(w,{position:"relative",mb:4,children:[a&&t.jsx(ht,{item:s,isCorrect:!!r,isSelected:u,percentage:d}),!a&&t.jsxs(t.Fragment,{children:[d>0&&t.jsx("div",{className:xt({percentage95:d>95}),style:{width:`${d}%`}}),t.jsxs("div",{className:"z-[1] flex h-full w-full items-center justify-between rounded-8 border border-border-default border-solid p-16",children:[t.jsxs(w,{display:"flex",children:[u&&i&&t.jsx(de,{mr:8,size:20,src:i.avatarUrl||void 0,fallbackText:o(i)}),t.jsx(k,{className:"z-0",variant:"body",color:p,...u&&{weight:"medium"},children:s.value})]}),t.jsxs(k,{className:"z-0",color:p,...u&&{weight:"medium"},variant:"body",ml:12,children:[d,"%"]})]})]})]})},vt=({question:e})=>{var l,o,i,u,d,p;const s=S(),n=(((l=e==null?void 0:e.results)==null?void 0:l.drilldown)||[]).map(m=>({...m,questionOption:e.rawOptions.find(f=>f.label===m.value)})),r=((i=(o=e.answer)==null?void 0:o.rawSelectedOptions)==null?void 0:i.map(m=>m.questionOptionId))??[],a=((d=(u=e.results)==null?void 0:u.total)==null?void 0:d.count)||1,c=((p=e.results)==null?void 0:p.answersTypeBreakdown)||null;return t.jsxs("div",{children:[t.jsx("div",{className:"grid auto-rows-fr grid-cols-2 gap-x-8 gap-y-4",children:n.map((m,f)=>{var h,x;return m.value&&t.jsx(bt,{item:{count:m.count,value:m.value||"",questionOptionId:(h=m.questionOption)==null?void 0:h.id},isCorrect:O(e)&&((x=e.rawOptions.find(_=>_.label===m.value))==null?void 0:x.isCorrect),isQuiz:O(e),selectedOptions:r,total:a},String.fromCharCode(f))})}),O(e)&&c&&t.jsx(w,{mt:24,children:t.jsx(K,{children:s.formatMessage({id:"results_question_quiz.stats"},{good:c.good,total:c.total})})})]})},wt=({averageValue:e,min:s,max:n})=>{const r=R(),a=S(),c=100*(e-s)/(n-s);return t.jsxs("div",{className:"-top-20 -translate-x-1/2 absolute flex transform flex-col items-center justify-center text-center leading-7 hover:z-[1]",style:{left:`${c}%`},children:[t.jsx(k,{className:"block w-max",variant:"footnote",color:r.colors.content.primary,weight:"medium",mb:8,children:a.formatMessage({id:"results_question_scale.average"})}),t.jsx(k,{className:"rounded-[14px] bg-background-primary px-8 dark:bg-background-primary-dark",color:r.colors.content.primary,variant:"body",weight:"medium",children:a.formatNumber(e)})]})},jt=({question:e})=>{var o,i,u,d,p,m,f,h;const s=e.rawOptions[0].scaleValue,n=e.rawOptions[e.rawOptions.length-1].scaleValue,r=(i=(o=e.results)==null?void 0:o.total)!=null&&i.value?Math.round(((d=(u=e.results)==null?void 0:u.total)==null?void 0:d.value)*10)/10:0,a=(f=(m=(p=e.answer)==null?void 0:p.rawSelectedOptions)==null?void 0:m[0])==null?void 0:f.questionOptionId,c=(h=e.rawOptions.find(x=>x.id===a))==null?void 0:h.scaleValue;e.rawOptions.map((x,_)=>({label:x.label,value:x.scaleValue}));const l=e.rawOptions.length;return t.jsxs("div",{className:"relative mx-auto my-16 w-[55%] pt-16",children:[t.jsxs("div",{className:"relative h-32",children:[t.jsx("div",{className:"absolute top-[calc(50%-1px)] h-[1px] w-full rounded-24 bg-background-primary dark:bg-background-primary-dark"}),t.jsx(w,{children:[...new Array(l)].map((x,_)=>t.jsx("div",{className:"absolute top-[calc(50%-2px)] size-4 rounded-circular bg-content-primary dark:bg-content-primary-dark",style:{left:`calc(${_*100/(l-1)}% - 2px)`}},String.fromCharCode(_)))}),t.jsx(wt,{averageValue:r,min:s,max:n}),t.jsx(w,{position:"relative",children:c!=null&&t.jsx("div",{className:"-translate-x-1/2 absolute flex size-32 transform items-center justify-center rounded-full bg-content-primary font-bold text-14 text-content-default-dark leading-7 dark:bg-content-primary-dark dark:text-content-default",style:{left:`${100*(c-s)/(n-s)}%`},children:c})})]}),t.jsx(w,{children:l>0&&t.jsxs("div",{className:"mt-4 flex justify-between",children:[t.jsx(k,{variant:"footnote",children:e.rawOptions[0].label}),t.jsx(k,{align:"right",variant:"footnote",children:e.rawOptions[l-1].label})]})})]})},yt=({question:e})=>{var n,r;const s=S();
1return t.jsx(F,{local:!0,theme:A.LIGHT,children:t.jsxs(H,{className:"w-[752px]",mb:8,children:[t.jsx(k,{mb:24,variant:"h1",align:"center",children:e.label}),(r=(n=e.results)==null?void 0:n.total)!=null&&r.count?t.jsxs(t.Fragment,{children:[(e.type===y.SinglePick||e.type===y.Quiz||e.type===y.MultiPick)&&t.jsx(vt,{question:e}),(e.type===y.Scale||e.type===y.Enps)&&t.jsx(jt,{question:e}),e.isOptional&&t.jsx(gt,{question:e})]}):t.jsx(K,{children:s.formatMessage({id:"results_question_wrapper.question_without_answer"})})]})})},kt=()=>{var l,o,i,u,d,p,m;const e=S(),{isLoading:s,isPulsePreview:n,userSurvey:r}=g.useContext(N),{campaignSummary:a}=_e({isPulsePreview:n});if(!(r!=null&&r.survey)&&!s)return t.jsx(Ie,{error:e.formatMessage({id:"pulse_page.error.test"})});const c=!!((l=a==null?void 0:a.survey)!=null&&l.hasUserBenchmarkAfterFilled);return t.jsxs(t.Fragment,{children:[t.jsx(ke,{isResults:!0,displayHeaderTitle:c}),!s&&(r==null?void 0:r.survey)&&t.jsxs(w,{mb:16,width:"752px",children:[t.jsx(F,{local:!0,theme:A.LIGHT,children:t.jsxs(H,{borderRadius:20,children:[(!((o=r==null?void 0:r.survey)!=null&&o.isAnonymous)||((i=r==null?void 0:r.survey)==null?void 0:i.thankMessage))&&t.jsx(w,{borderRadius:8,display:"flex",flexDirection:"column",alignItems:"center",children:t.jsx(k,{variant:"h1",align:"center",children:n&&!((u=r==null?void 0:r.survey)!=null&&u.thankMessage)?e.formatMessage({id:"pulse_page.results.preview.default_thank_message"}):r.survey.thankMessage})}),c&&t.jsx(w,{mt:24,children:t.jsx(K,{icon:"information",children:e.formatMessage({id:"pulse_page.stats"},{total:(d=a==null?void 0:a.stats)==null?void 0:d.total,completed:(p=a==null?void 0:a.stats)==null?void 0:p.completed})})})]})}),((m=a==null?void 0:a.survey)==null?void 0:m.hasUserBenchmarkAfterFilled)&&t.jsx(w,{mt:48,children:a==null?void 0:a.questions.map(f=>f.type!==y.FreeForm&&f.answer&&t.jsx(yt,{question:f},f.id))})]})]})},_t=24,It={24:{iconSize:12}},St={success:"bg-background-success dark:bg-background-success-dark",critical:"bg-background-critical dark:bg-background-critical-dark"},Ct=M({base:"flex w-max items-center justify-between rounded-[15px] border-0 p-[0.25em_0.75em]",variants:{clickable:{true:"cursor-pointer"},backgroundColor:St}}),Mt=({icon:e,onClick:s,size:n=_t,text:r,variant:a="success"})=>{const c=R();return t.jsxs(P,{className:Ct({clickable:!!s,backgroundColor:a}),onClick:s,children:[t.jsx(k,{variant:"body",color:c.colors.content[a],children:r}),e&&t.jsx("div",{className:"ml-8 flex size-16 items-center justify-center rounded-[40%] bg-background-primary dark:bg-background-primary-dark",children:t.jsx(q,{color:c.colors.content[a],name:e,size:It[n].iconSize})})]})},Pt=({badge:e,isAnonymous:s,isOpen:n,onClose:r})=>{const a=S(),c=s?"pulse_page.question.modal_anonymous":"pulse_page.question.modal_public";return t.jsx(ee,{isOpen:n,onClose:r,width:"375px",children:t.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-16 text-center",children:[e,t.jsx(k,{variant:"body",children:a.formatMessage({id:c})}),t.jsx(P,{onClick:r,children:a.formatMessage({id:"pulse_page.question.modal_submit"})})]})})},Nt=({isAnonymous:e})=>{const[s,n]=g.useState(!1),r=S(),a=e?"success":"critical",c=e?"pulse_page.question.badge_anonymous":"pulse_page.question.badge_public",l=({icon:o,onClick:i}={})=>t.jsx(Mt,{text:r.formatMessage({id:c}),variant:a,icon:o,onClick:i});return t.jsxs(w,{children:[t.jsx(Pt,{badge:l(),isAnonymous:e,isOpen:s,onClose:()=>n(!1)}),l({icon:"question-mark",onClick:()=>{n(!0)}})]})},Ot=()=>{const e=S(),{handleSubmit:s}=z();return t.jsx("form",{onSubmit:s,children:t.jsx(D,{className:"rounded-8 border-0 bg-background-contrast p-16 text-center text-18 text-content-default dark:bg-background-contrast-dark dark:text-content-default-dark",name:"comment",component:Ae,rows:5,placeholder:e.formatMessage({id:"pulse_page.enter_answer"}),maxLength:ye})})};var Z=new Map,G=new WeakMap,oe=0,Rt;function Et(e){return e?(G.has(e)||(oe+=1,G.set(e,oe.toString())),G.get(e)):"0"}function Qt(e){return Object.keys(e).sort().filter(s=>e[s]!==void 0).map(s=>`${s}_${s==="root"?Et(e.root):e[s]}`).toString()}function zt(e){const s=Qt(e);let n=Z.get(s);if(!n){const r=new Map;let a;const c=new IntersectionObserver(l=>{l.forEach(o=>{var i;const u=o.isIntersecting&&a.some(d=>o.intersectionRatio>=d);e.trackVisibility&&typeof o.isVisible>
1"u"&&(o.isVisible=u),[...(i=r.get(o.target))!=null?i:[]].forEach(d=>{d(u,o)})})},e);a=c.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:s,observer:c,elements:r},Z.set(s,n)}return n}function Ft(e,s,n={},r=Rt){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const u=e.getBoundingClientRect();return s(r,{isIntersecting:r,target:e,intersectionRatio:typeof n.threshold=="number"?n.threshold:0,time:0,boundingClientRect:u,intersectionRect:u,rootBounds:u}),()=>{}}const{id:a,observer:c,elements:l}=zt(n),o=l.get(e)||[];l.has(e)||l.set(e,o),o.push(s),c.observe(e);let i=!1;return function(){i||(i=!0,o.splice(o.indexOf(s),1),o.length===0&&(l.delete(e),c.unobserve(e)),l.size===0&&(c.disconnect(),Z.delete(a)))}}var J=Reflect.get(Oe,"useInsertionEffect"),At=J??g.useEffect;function Tt(e){return(e==null?void 0:e.startsWith("19."))||!1}var ce=Tt(g.version);function Vt(e,{threshold:s,root:n,rootMargin:r,scrollMargin:a,trackVisibility:c,delay:l,fallbackInView:o,skip:i,triggerOnce:u}){const d=g.useRef(e),p=g.useRef({node:null,stop:void 0,owner:null});return J||(d.current=e),At(()=>{d.current=e},[e]),g.useCallback(function m(f){const h=p.current;if(!f&&h.owner!==m)return;if(f===h.node)return h.owner=m,ce?h.stop:void 0;const x=h.stop;if(h.stop=void 0,x==null||x(),!f||i){h.node=null,h.owner=f?m:null;return}h.node=f,h.owner=m;let _,C;function j(){_==null||_(),h.stop===j&&(h.node=null,h.stop=void 0)}return h.stop=j,_=Ft(f,(v,b)=>{d.current(v,b,C),C=v,u&&v&&j()},{threshold:s,root:n,rootMargin:r,scrollMargin:a,trackVisibility:c,delay:l},o),h.stop!==j&&_(),ce?h.stop:void 0},[Array.isArray(s)?s.toString():s,n,r,a,c,l,o,i,u])}var Lt=typeof window>"u"?g.useEffect:g.useLayoutEffect;function le({threshold:e,delay:s,trackVisibility:n,rootMargin:r,scrollMargin:a,root:c,triggerOnce:l,skip:o,initialInView:i,fallbackInView:u,onChange:d}={}){const p=g.useRef(i),[m,f]=g.useState({inView:!!i,entry:void 0}),h=Vt((j,v)=>{const b=p.current;p.current=j,!(b===void 0&&!j)&&(f({inView:j,entry:v}),d==null||d(j,v))},{threshold:e,root:c,rootMargin:r,scrollMargin:a,trackVisibility:n,delay:s,fallbackInView:u,skip:o,triggerOnce:l}),x=g.useRef({node:null,reset:!1}),_=g.useCallback(function(v){v?(x.current.node=v,x.current.reset=!1):x.current.node&&(x.current.node=null,x.current.reset=!0);const b=h(v);if(b)return()=>{b(),x.current.node===v&&(x.current.node=null,x.current.reset=!0)}},[h]);Lt(()=>{x.current.reset&&(x.current.reset=!1,!(l||o)&&(f({inView:!!i,entry:void 0}),p.current=i))});const C=[_,m.inView,m.entry];return C.ref=C[0],C.inView=C[1],C.entry=C[2],C}const Dt=M({base:["relative flex max-h-[370px] flex-col overflow-y-auto","before:sticky before:top-0 before:right-0 before:left-0 before:block before:flex-shrink-0 before:flex-grow-0 before:bg-gradient-to-b before:from-white before:to-transparent before:content-['']","after:sticky after:right-0 after:bottom-0 after:left-0 after:block after:flex-shrink-0 after:flex-grow-0 after:bg-gradient-to-t after:from-transparent after:to-white after:content-['']"],variants:{topInView:{true:"before:h-0 before:opacity-0",false:"before:h-40 before:opacity-1"},bottomInView:{true:"before:h-0 before:opacity-0",false:"before:h-40 before:opacity-1"}}}),Se=({children:e})=>{const s=ue.useRef(null),{ref:n,inView:r}=le({root:s.current}),{ref:a,inView:c}=le({root:s.current});return t.jsxs("div",{className:Dt({topInView:r,bottomInView:c}),ref:s,children:[t.jsx("div",{ref:n}),e,t.jsx("div",{ref:a})]})},Ce=M({base:["ml-0 flex w-full items-center justify-center rounded-8 py-8 text-center text-18","[&_input]:hidden"],variants:{disabled:{false:"bg-background-contrast dark:bg-background-contrast-dark"},checked:{true:"bg-content-primary text-background-default hover:bg-[linear-gradient(rgba(255,255,255,0.1),rgba(255,255,255,0.1))] dark:bg-content-primary-dark",false:"text-content-default hover:bg-background-hover dark:text-content-default-dark dark:hover:bg-background-hover-dark"},disabledAndChecked:{true:"text-inverted-content-default"},hasCorrectnessAndCorrect:{true:"bg-content-success text-inverted-content-default"},hasCorrectnessAndIncorrect:{true:"bg-content-critical text-inverted-content-default"},hasCorrectnessAndNotCheck:{true:"bg-content-success"},hasCorrectnessAndCheck:{true:"bg-content-critical"}}}),$t=M({variants:{checked:{true:"text-background-default hover:bg-[linear-gradient(rgba(255,255,255,0.1),rgba(255,255,255,0.1))]",false:"text-content-default"}}}),Me=({selectedOptions:e,options:s,disabled:n,isAnswered:r,name:a})=>t.jsx(Se,{children:t.jsx("div",{className:"grid flex-grow auto-rows-min grid-cols-2 gap-8",children:s.map(c=>{const l=typeof c.isCorrect=="boolean";return t.jsx("div",{className:Ce({checked:(e==null?void 0:e.includes(c.value.toString()))&&!n,disabled:n,hasCorrectnessAndCorrect:l&&r&&c.isCorrect,hasCorrectnessAndIncorrect:l&&r&&!c.isCorrect,hasCorrectnessAndNotCheck:l&&r&&n&&!(e!=null&&e.includes(c.value.toString())),hasCorrectnessAndCheck:l&&r&&n&&(e==null?void 0:e.includes(c.value.toString()))}),children:t.jsxs("label",{htmlFor:`checkbox-${a}-${c.value}`,className:"flex h-full w-full items-center justify-center hover:cursor-pointer",children:[t.jsx(D,{type:"checkbox",name:a,disabled:n,value:c.value,id:`checkbox-${a}-${c.value}`}),c.label]})},c.value.toString())})})}),Bt=T().shape({comment:Q()}),Y=({disabled:e=!1})=>{const s=S(),{setFieldValue:n,values:r}=z();return t.jsx(D,{name:"comment",id:"comment",value:r.comment,suffix:s.formatMessage({id:"pulse_page.comment.suffix_optional"}),onChange:a=>
1n("comment",a.target.value),component:Ne,rows:3,label:s.formatMessage({id:"pulse_page.comment.label"}),validationSchema:Bt,maxLength:ye,disabled:e})},Gt=({question:e})=>{const{handleSubmit:s,values:n}=z(),r=e.rawOptions.map(a=>({value:a.id,label:a.label}));return t.jsxs("form",{onSubmit:s,children:[t.jsx(Me,{name:"selectedOptionIds",options:r,selectedOptions:n.selectedOptionIds}),t.jsx(w,{mt:24,children:t.jsx(Y,{})})]})},Ut=({question:e})=>{const s=e.rawOptions.map(c=>({value:c.id,label:c.label,isCorrect:c.isCorrect})),{handleSubmit:n,values:r}=z(),a=!!e.answer;return t.jsxs("form",{onSubmit:n,children:[t.jsx(Me,{name:"selectedOptionIds",options:s,disabled:a,isAnswered:a,selectedOptions:r.selectedOptionIds}),t.jsx("div",{className:"mt-24",children:t.jsx(Y,{disabled:a})})]})},Wt=e=>g.createElement("svg",{width:19,height:12,viewBox:"0 0 19 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M12.7422 10.1868L17.1867 6.02018L12.7422 1.85352",stroke:"#633FD3",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{d:"M5.59111 10.1868L1.14666 6.02018L5.59111 1.85352",stroke:"#633FD3",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),Ht=M({base:"absolute top-[calc(50%-24px/2)] size-24 rounded-circular bg-background-highlighted-primary text-center text-content-default-dark leading-6 transition-transform duration-150 ease-linear dark:bg-background-highlighted-primary-dark dark:text-content-default",variants:{isHovered:{true:"scale-100",false:"scale-[calc(1/6)]"}}}
1),Kt=M({variants:{isHovered:{true:"block",false:"hidden"}}}),Yt=({isHovered:e,marksLength:s,value:n,position:r})=>t.jsx("div",{className:Ht({isHovered:e}),style:{left:`calc(${r*100/(s-1)}% - 24px / 2)`},children:t.jsx("span",{className:Kt({isHovered:e}),children:n})}),Xt=.6,Zt=M({base:["z-[1] m-0 w-[calc(90%+32px)] touch-none bg-transparent focus:outline-none dark:bg-transparent","z-10 mt-8 appearance-none rounded-full bg-[length:16px] bg-center bg-no-repeat transition-border transition-shadow duration-250 ease-linear","[&::-webkit-slider-thumb]:size-32","[&::-moz-range-thumb]:size-24","[&::-webkit-slider-runnable-track]:w-full [&::-webkit-slider-runnable-track]:cursor-pointer [&::-webkit-slider-runnable-track]:rounded-24 [&::-webkit-slider-runnable-track]:p-0 [&::-webkit-slider-runnable-track]:text-transparent","[&::-moz-range-track]:w-full [&::-moz-range-track]:cursor-pointer [&::-moz-range-track]:rounded-24 [&::-moz-range-track]:p-0 [&::-moz-range-track]:text-transparent"],variants:{hasValue:{true:"border border-[rgba(99,63,211,0.5)] bg-background-highlighted-primary dark:bg-background-highlighted-primary-dark",false:"bg-background-primary dark:bg-background-primary-dark"},isDragging:{true:"cursor-grabbing",false:"cursor-grab"},hasValueWithoutDragging:{true:"shadow-[0px_0px_0px_3px_rgba(99,63,211,0.5),0px_0px_0px_10px_rgba(238,234,250,0.8)]"}}}),Jt=({value:e,marks:s,onChange:n})=>{const r=g.useRef(null),a=s.length-1,c=s[0].value,l=s[a].value,o=Number.isInteger(e),[i,u]=g.useState(!1),[d,p]=g.useState(o?e:c+a/2);g.useEffect(()=>{i||p(o||o?e:c+a/2)},[o,e,i,c,a]);const[m,f]=g.useState(null),h=b=>{const I=r.current;if(I&&!i){const B=b.nativeEvent.offsetX/I.clientWidth*a,se=Math.round(B);1-Math.abs(B-se)>Xt&&f(se)}},x=b=>{const I=b.currentTarget.valueAsNumber;p(I);const B=Math.round(I);p(i?I:B)},_=()=>{f(null),u(!0)},C=()=>{u(!1);const b=Math.round(d);p(b),n(b)},j=()=>{f(null)},v=b=>{b.preventDefault();let I=d;b.keyCode===39&&(I=Math.min(Math.floor(I)+1,l)),b.keyCode===37&&(I=Math.max(Math.ceil(I)-1,c)),p(I),n(I)};return t.jsx("div",{className:"flex flex-col items-center",children:t.jsxs("div",{className:"relative flex w-[90%] flex-col items-center",children:[t.jsx("div",{className:"absolute mt-24 h-[1px] w-[90%] bg-background-primary dark:bg-background-primary-dark"}),t.jsx("div",{className:"absolute top-28 mb-8 h-48 w-[90%] text-center text-content-primary text-xs dark:text-content-primary-dark",children:s.map((b,I)=>t.jsx(Yt,{isHovered:m===I,marksLength:s.length,value:b.value,position:I},b.value))}),t.jsx("div",{className:"relative z-[2] w-[90%]",children:t.jsx("div",{className:"pointer-events-none absolute flex h-48 w-32 items-center justify-center overflow-hidden font-bold text-content-default-dark leading-8 [clip-path:circle(16px)] dark:text-content-default",style:{left:`calc(${(d-c)/(l-c)*100}% - 16px)`},children:(o||i)&&t.jsx("div",{className:"w-32",children:t.jsx("div",{className:"absolute top-[calc(50%-16px)] flex text-center",style:{transform:`translateX(-${(d-c)*42}px)`},children:s.map((b,I)=>t.jsx("span",{className:"w-32 [&:not(:last-child)]:mr-10",style:{opacity:1-Math.abs(I-d+c)},children:b.value},b.value))})})})}),t.jsx("input",{type:"range",step:"0.01",className:Zt({hasValue:o||i,isDragging:i,hasValueWithoutDragging:o&&!i}),style:{backgroundImage:o||i?void 0:`url(${Wt})`},ref:r,min:c,max:l,value:d,onChange:x,onKeyDown:v,onTouchStart:_,onTouchEnd:C,onMouseDown:_,onMouseUp:C,onMouseMove:h,onMouseLeave:j})]})})},qt=({marks:e,field:s,form:n})=>t.jsx(Jt,{onChange:r=>n.setFieldValue(s.name,r),value:s.value,marks:e}),ie=({question:e})=>{const s=R(),{handleSubmit:n}=z();return t.jsxs("form",{onSubmit:n,children:[t.jsxs("div",{className:"w-full",children:[t.jsx(D,{name:"scaleValue",component:qt,marks:e.rawOptions.map(r=>({value:r.scaleValue,label:r.label}))}),t.jsx("div",{className:"mx-auto w-[87%]",children:e.rawOptions.length>0&&t.jsxs("div",{className:"mt-48 flex items-center justify-between",children:[t.jsx(k,{variant:"footnote",color:s.colors.content.placeholder,ml:16,children:e.rawOptions[0].label}),t.jsx(k,{variant:"footnote",color:s.colors.content.placeholder,mr:16,children:e.rawOptions[e.rawOptions.length-1].label})]})})]}),t.jsx("div",{className:"mt-24",children:t.jsx(Y,{})})]})},es=({selectedOption:e,options:s,name:n})=>t.jsx(Se,{children:t.jsx("div",{className:"grid flex-grow auto-rows-min grid-cols-2 gap-8",children:s.map(r=>
1t.jsx("div",{className:Ce({checked:r.value===e}),children:t.jsxs("label",{htmlFor:`radio-${n}-${r.value}`,className:"flex h-full w-full items-center justify-center hover:cursor-pointer",children:[t.jsx(D,{type:"radio",name:n,value:r.value,id:`radio-${n}-${r.value}`}),t.jsx(k,{variant:"body",className:$t({checked:r.value===e}),children:r.label})]})},r.value.toString()))})}),ts=({question:e})=>{const{handleSubmit:s,values:n}=z(),r=e.rawOptions.map(a=>({value:a.id,label:a.label}));return t.jsxs("form",{onSubmit:s,children:[t.jsx(es,{name:"selectedOptionId",options:r,selectedOption:n.selectedOptionId}),t.jsx("div",{className:"mt-24",children:t.jsx(Y,{})})]})},U=({children:e})=>{const s=R();return t.jsx(k,{variant:"footnote",align:"center",mt:8,color:s.colors.content.placeholder,children:e})},ss=({question:e})=>{const s=S(),n=e.answer?"question_wrapper.quiz_subtitle.already_answered":"question_wrapper.quiz_subtitle";return t.jsx(U,{children:s.formatMessage({id:n})})},rs=({question:e})=>{const s=S();return t.jsxs(w,{children:[ve(e)&&t.jsx(U,{children:s.formatMessage({id:"question_wrapper.multi_pick_subtitle"})}),we(e)&&t.jsx(U,{children:s.formatMessage({id:"question_wrapper.single_pick_subtitle"})}),je(e)&&t.jsx(U,{children:s.formatMessage({id:"slider_pulse.init_text"})}),O(e)&&t.jsx(ss,{question:e})]})},ns=({isAnonymous:e,question:s})=>t.jsxs(t.Fragment,{children:[t.jsx(w,{display:"flex",justifyContent:"center",mb:8,children:t.jsx(Nt,{isAnonymous:e})}),t.jsx(w,{children:t.jsx(k,{variant:"h1",align:"center",children:s.label})}),t.jsx(w,{mb:24,children:t.jsx(rs,{question:s})}),je(s)&&t.jsx(ie,{question:s}),Te(s)&&t.jsx(ie,{question:s}),Le(s)&&t.jsx(Ot,{question:s}),we(s)&&t.jsx(ts,{question:s}),ve(s)&&t.jsx(Gt,{question:s}),O(s)&&t.jsx(Ut,{question:s})]}),as=T().shape({comment:Q()}),os=({children:e,question:s})=>{var a;const{onSubmit:n}=V(s),r={comment:((a=s==null?void 0:s.answer)==null?void 0:a.comment)||""};return t.jsx($,{initialValues:r,validationSchema:as,validateOnMount:!0,enableReinitialize:!0,onSubmit:n,children:e})},cs=T().shape({selectedOptions:xe(),comment:Q()}),ls=({children:e,question:s})=>{var a,c,l;const{onSubmit:n}=V(s),r={selectedOptionIds:((c=(a=s.answer)==null?void 0:a.rawSelectedOptions)==null?void 0:c.map(o=>o.questionOptionId))??[],comment:((l=s==null?void 0:s.answer)==null?void 0:l.comment)??""};return t.jsx($,{initialValues:r,validationSchema:cs,validateOnMount:!0,enableReinitialize:!0,onSubmit:n,children:e})},is=T().shape({selectedOptionIds:xe(),comment:Q()}),ds=({children:e,question:s})=>{var a,c,l;const n={selectedOptionIds:((c=(a=s.answer)==null?void 0:a.rawSelectedOptions)==null?void 0:c.map(o=>o.questionOptionId))??[],comment:((l=s.answer)==null?void 0:l.comment)??""},{onSubmit:r}=V(s);return t.jsx($,{initialValues:n,validationSchema:is,validateOnMount:!0,enableReinitialize:!0,onSubmit:r,children:e})},us=T().shape({scaleValue:ze(),comment:Q()}),ms=({question:e,children:s})=>{var l;const{onSubmit:n}=V(e),r=(o,i)=>{const{scaleValue:u,...d}=o,p=e.rawOptions.find(m=>m.scaleValue===u);n({selectedOptionIds:[p==null?void 0:p.id].filter(Boolean),...d},i)},a=e.rawOptions.find(o=>{var i,u,d;return o.id===((d=(u=(i=e==null?void 0:e.answer)==null?void 0:i.rawSelectedOptions)==null?void 0:u[0])==null?void 0:d.questionOptionId)}),c={scaleValue:(a==null?void 0:a.scaleValue)??null,comment:((l=e==null?void 0:e.answer)==null?void 0:l.comment)??""};return t.jsx($,{initialValues:c,validationSchema:us,validateOnMount:!0,enableReinitialize:!0,onSubmit:r,children:s})},ps=T().shape({selectedOptions:Q(),comment:Q()}),gs=({children:e,question:s})=>{var c,l,o;const{onSubmit:n}=V(s),r=(l=(c=s.answer)==null?void 0:c.rawSelectedOptions)==null?void 0:l[0],a={selectedOptionId:(r==null?void 0:r.questionOptionId)??"",comment:((o=s==null?void 0:s.answer)==null?void 0:o.comment)??""};return t.jsx($,{initialValues:a,validationSchema:ps,validateOnMount:!0,enableReinitialize:!0,onSubmit:(i,u)=>{n({selectedOptionIds:[i.selectedOptionId].filter(Boolean),comment:i.comment})},children:e})},fs=({children:e,question:s})=>{switch(s.type){case y.Scale:case y.Enps:return t.jsx(ms,{question:s,children:e});case y.SinglePick:return t.jsx(gs,{question:s,children:e});case y.Quiz:return t.jsx(ds,{question:s,children:e});case y.MultiPick:return t.jsx(ls,{question:s,children:e});case y.FreeForm:return t.jsx(os,{question:s,children:e});default:throw new Error("Something went wrong. Please contact an administrator.")}},hs="f22bcf9b-8d72-495a-97ca-db3140350fd4",xs=()=>{const e=S(),{id:s}=W(),n=s===hs?e.formatMessage({id:"pulse_page.error.feature_coming_soon"}):e.formatMessage({id:"pulse_page.error.test"}),{currentQuestion:r,isLoading:a,setCurrentQuestion:c,displayQuizResults:l,userSurvey:o}=g.useContext(N);g.useEffect(()=>{var u;c((u=o==null?void 0:o.next)==null?void 0:u.question)},[o==null?void 0:o.id]);const i=!r&&!l;return t.jsxs("div",{className:"flex h-screen flex-col items-center",children:[(o==null?void 0:o.survey)&&t.jsxs(t.Fragment,{children:[i&&t.jsx(kt,{}),!i&&r&&t.jsx(fs,{question:r,children:t.jsxs(t.Fragment,{children:[t.jsx(ke,{}),t.jsx("div",{className:"flex w-full items-center justify-center",children:t.jsx(H,{className:"mx-auto w-[752px] items-center justify-center",children:t.jsx(ns,{isAnonymous:o.survey.isAnonymous,question:r})})}),t.jsx(it,{question:r})]})})]}),!(o!=null&&o.survey)&&!a&&t.jsx(Ie,{error:n})]})},bs=({children:e,pageTitle:s})=>t.jsxs(t.Fragment,{children:[s&&t.jsx(Fe,{children:t.jsx("title",{children:s})}),t.jsx("div",{className:"h-full overflow-auto bg-background-default-dark",children:e})]}),vs=()=>{var r;const{userSurvey:e}=g.useContext(N),s=S(),n=(r=e==null?void 0:e.survey)!=null&&r.name?s.formatMessage({id:"pulse_page.page_title"},{pulseName:e.survey.name}):s.formatMessage({id:"pulse_page.default_page_title"});return t.jsx(bs,{pageTitle:n,children:t.jsx(xs,{})})},Es=()=>t.jsx(We,{children:t.jsx(vs,{})});
1export{Es 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.