1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7804],{55698:function(e,t,n){var s=n(85893);t.Z=()=>(0,s.jsx)("div",{className:"relative h-[80vh] ",children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center text-center h-full absolute top-0 left-0 w-full",children:[(0,s.jsx)("div",{className:"p-4 mb-6",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("img",{src:"/images/logo/ditp_logo.png",className:"w-[160px] h-[80px] object-contain drop-shadow-[0_1px_2px_rgba(0,0,0,0.7)]",alt:"DITP Logo"}),(0,s.jsx)("img",{src:"/images/logo/Asset-1-25.png",className:"w-[64px] h-[80px] object-contain drop-shadow-[0_1px_2px_rgba(0,0,0,0.7)]",alt:"DITP Logo Asset"})]})}),(0,s.jsx)("h1",{className:"text-2xl font-bold",children:"404 This page could not be found."}),(0,s.jsxs)("h1",{className:"text-2xl font-bold",children:[" ","The requested URL was not found on this server."]})]})})},83754:function(e,t,n){n.d(t,{X:function(){return a}});var s=n(85893),o=n(23432),l=n(67294);let a=e=>{let{isLoading:t,className:n,children:a,isRounded:i,disabled:r,delay:d=450,onClick:c=()=>{},...u}=e,m=(0,l.useRef)(),x=(0,l.useMemo)(()=>t||r,[t,r]),p=(0,l.useCallback)(e=>{m.current&&(clearTimeout(m.current),m.current=null),m.current=setTimeout(()=>{c(e)},d)},[c,d]);return(0,s.jsxs)("button",{disabled:x,type:"button",className:"btn ".concat(n||""," flex justify-content-center gap-1 align-items-center disabled:opacity-70 disabled:cursor-not-allowed !disabled:bg-gray-400"),onClick:p,...u,children:[t&&(0,s.jsx)(o.Z,{size:16,className:"animate-spin"}),a]})}},61488:function(e,t,n){var s=n(85893),o=n(68258),l=n(76809),a=n(82797);t.Z=e=>{let{isPreview:t,survey:n,messages:i}=e;return(0,s.jsxs)("div",{className:"flex flex-col md:flex-row justify-end items-end gap-2 my-8 ".concat(t?"cursor-not-allowed opacity-75":""),children:[i.survey.share_assessment," :",(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(o.Dk,{disabled:t,onClick:()=>{l.hi.saveSurveysFromStat(null==n?void 0:n.documentId,a.a.SHARE_FACEBOOK_BEFORE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==n?void 0:n.documentId,"?isGuest=yes"),children:(0,s.jsx)(o.Vq,{size:32,round:!0})}),(0,s.jsx)(o.Ni,{disabled:t,onClick:()=>{l.hi.saveSurveysFromStat(null==n?void 0:n.documentId,a.a.SHARE_LINE_BEFORE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==n?void 0:n.documentId,"?isGuest=yes"),children:(0,s.jsx)(o.zb,{size:32,round:!0})}),(0,s.jsx)(o.B,{disabled:t,onClick:()=>{l.hi.saveSurveysFromStat(null==n?void 0:n.documentId,a.a.SHARE_X_BEFORE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==n?void 0:n.documentId,"?isGuest=yes"),children:(0,s.jsx)(o.b0,{size:32,round:!0})}),(0,s.jsx)(o.r2,{disabled:t,onClick:()=>{l.hi.saveSurveysFromStat(null==n?void 0:n.documentId,a.a.SHARE_LINKEDIN_BEFORE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==n?void 0:n.documentId,"?isGuest=yes"),children:(0,s.jsx)(o.pA,{size:32,round:!0})}),(0,s.jsx)(o.N0,{disabled:t,onClick:()=>{l.hi.saveSurveysFromStat(null==n?void 0:n.documentId,a.a.SHARE_WHATSAPP_BEFORE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==n?void 0:n.documentId,"?isGuest=yes"),children:(0,s.jsx)(o.ud,{size:32,round:!0})}),(0,s.jsx)("button",{disabled:t,onClick:()=>{let e=encodeURIComponent("à¹à¸à¸à¸à¸à¸£à¹à¸¡: ".concat((null==n?void 0:n.survey_name)||"Export Readiness Assessment")),t=encodeURIComponent("à¸à¸à¹à¸à¸´à¸à¸à¸³à¹à¸à¸à¸à¸à¸£à¹à¸¡: ".concat(window.location.origin,"/e-survey-from/").concat(null==n?void 0:n.documentId,"?isGuest=yes"));"mailto:?subject=".concat(e,"&body=").concat(t),l.hi.saveSurveysFromStat(null==n?void 0:n.documentId,a.a.SHARE_EMAIL_BEFORE);let s="à¹à¸à¸à¸à¸à¸£à¹à¸¡: ".concat((null==n?void 0:n.survey_name)||"Export Readiness Assessment","\n\nà¸à¸à¹à¸à¸´à¸à¸à¸³à¹à¸à¸à¸à¸à¸£à¹à¸¡: ").concat(window.location.origin,"/e-survey-from/").concat(null==n?void 0:n.documentId,"?isGuest=yes");navigator.clipboard.writeText(s).then(()=>{alert("à¸à¸±à¸à¸¥à¸à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¹à¸¥à¹à¸§ สามารà¸à¸à¸³à¹à¸à¹à¸à¸£à¹à¹à¸à¸à¸µà¹à¸¡à¸¥à¹à¸à¹")})},className:"cursor-pointer",children:(0,s.jsx)(o.LQ,{size:32,round:!0})}),(0,s.jsx)(o.tq,{onClick:()=>{l.hi.saveSurveysFromStat(null==n?void 0:n.documentId,a.a.SHARE_TELEGRAM_BEFORE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==n?void 0:n.documentId,"?isGuest=yes"),children:(0,s.jsx)(o.YG,{size:32,round:!0})})]})]})}},49899:function(e,t,n){n.d(t,{Z:function(){return J}});var s=n(85893),o=n(67294),l=n(20512),a=n(99571),i=n(76809),r=n(45149),d=n(11163),c=n.n(d),u=n(41664),m=n.n(u);n(69740);var x=n(16215),p=n(13897),v=n(6258),f=n(84906),h=n(68258),b=n(82797),g=n(14640);let _=e=>{let{surveyData:t,ssoAccount:n,messages:d,isPreview:u=!1}=e,_=(0,g.useLocale)(),[y,j]=(0,o.useState)(1),[I,w]=(0,o.useState)(!1),[E,N]=(0,o.useState)(null),[S,C]=(0,o.useState)([]),[T,R]=(0,o.useState)([]),[k,A]=(0,o.useState)([]),[F,q]=(0,o.useState)({}),B=t.isAssessment,{getSavedFormData:L,saveFormData:O,removeFormData:V}=(0,p.h)({ssoAccount:n,locale:_,mode:u?"preview":"live"}),P=(0,o.useRef)(!1),G=(0,l.TA)({initialValues:F,enableReinitialize:!0,onSubmit:async e=>{w(!0),r.W.showLoading();try{let p=v.Z.get(f.B$),g=!(null==n?void 0:n.ssoid);g||null==n||n.ssoid;let y={data:{account:g?"":((null==n?void 0:n.ssoid)||"")+"",anonymus_id:g?(p||"")+"":"",e_survey:t.documentId,answer:[]}},j=T.filter(e=>e.type_field===a.j$.UPLOAD_FILE);if(j&&j.length>0)for(let t=0;t<j.length;t++){let n=j[t];if(e[n.documentId]&&e[n.documentId].length>0){let t=e[n.documentId].map(e=>e.file),s=await i.hi.uploadFiles(t);if(s&&s.data&&s.data.length>0){let e={};B?e.e_survey_assessment=n.documentId:e.e_survey_question=n.documentId,e.type_field=n.type_field,e.answer_file=s.data.map(e=>e.id),y.data.answer.push(e)}}}Object.keys(e).forEach(t=>{let n=T.find(e=>e.documentId===t&&e.type_field!==a.j$.UPLOAD_FILE);if(n){var s,o,l,i,r,d,c,u;let m={};switch(B?m.e_survey_assessment=n.documentId:m.e_survey_question=n.documentId,m.type_field=n.type_field,n.type_field){case a.j$.TEXT_FIELD:m.answer_text=e[t];break;case a.j$.RATING_SCALE:m.answer_rating=e[t];break;
1case a.j$.SINGLE_CHOICE:if(B){m.e_survey_option_assessments=e[t]?[e[t]]:[];let o=null===(s=n.option)||void 0===s?void 0:s.find(n=>n.documentId===e[t]);(null==o?void 0:o.is_show_input)&&(m.answer_option_text=[{e_survey_option_assessment:o.documentId,answer_text:e["text_".concat(n.documentId,"_").concat(o.documentId)]}])}else{m.e_survey_option_questions=e[t]?[e[t]]:[];let s=null===(o=n.option)||void 0===o?void 0:o.find(n=>n.documentId===e[t]);(null==s?void 0:s.is_show_input)&&(m.answer_option_text=[{e_survey_option_question:s.documentId,answer_text:e["text_".concat(n.documentId,"_").concat(s.documentId)]}])}break;case a.j$.MULTIPLE_CHOICE:if(B){m.e_survey_option_assessments=e[t];let s=null===(l=n.option)||void 0===l?void 0:l.filter(n=>e[t].includes(n.documentId));(null==s?void 0:s.length)>0&&(m.answer_option_text=s.filter(e=>e.is_show_input).map(t=>({e_survey_option_assessment:t.documentId,answer_text:e["text_".concat(n.documentId,"_").concat(t.documentId)]})))}else{m.e_survey_option_questions=e[t];let s=null===(i=n.option)||void 0===i?void 0:i.filter(n=>e[t].includes(n.documentId));(null==s?void 0:s.length)>0&&(m.answer_option_text=s.filter(e=>e.is_show_input).map(t=>({e_survey_option_question:t.documentId,answer_text:e["text_".concat(n.documentId,"_").concat(t.documentId)]})))}break;case a.j$.DROPDOWN_OPTION:if(B){m.e_survey_option_assessments=e[t]?[e[t]]:[];let s=null===(r=n.option)||void 0===r?void 0:r.find(n=>n.documentId===e[t]);(null==s?void 0:s.is_show_input)&&(m.answer_option_text=[{e_survey_option_assessment:s.documentId,answer_text:e["text_".concat(n.documentId,"_").concat(s.documentId)]}])}else{m.e_survey_option_questions=e[t]?[e[t]]:[];let s=null===(d=n.option)||void 0===d?void 0:d.find(n=>n.documentId===e[t]);(null==s?void 0:s.is_show_input)&&(m.answer_option_text=[{e_survey_option_question:s.documentId,answer_text:e["text_".concat(n.documentId,"_").concat(s.documentId)]}])}break;case a.j$.TTC:m.region=(null===(c=e[t])||void 0===c?void 0:c.region_id)||void 0,m.office=(null===(u=e[t])||void 0===u?void 0:u.office_id)||void 0}y.data.answer.push(m)}});let I=await i.hi.submitSurvey(y,B);if(I.isError){var o,l,u;let e=(null===(u=I.error.response)||void 0===u?void 0:null===(l=u.data)||void 0===l?void 0:null===(o=l.error)||void 0===o?void 0:o.message)||I.error.message;r.W.showDialogFail({title:"Fail",message:e})}else V(t.documentId),P.current=!0,B?(c().push("/e-survey-from/[id]/[answerID]/result/".concat(n?"":"?isGuest=yes"),"/e-survey-from/".concat(t.documentId,"/").concat(I.data.data.documentId,"/result/").concat(n?"":"?isGuest=yes")),r.W.close()):(I.data.data.documentId,r.W.showModal({showCancelButton:!1,showConfirmButton:!1,allowOutsideClick:!1,html:(0,s.jsx)("div",{className:"text-[#10143C]",children:(0,s.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,s.jsx)("img",{alt:"question-submitted",src:"/icons/checked.png",style:{width:"84px",height:"75px",objectFit:"contain"}}),(0,s.jsxs)("div",{className:"font-bold text-2xl",children:[d.survey.popup_submission,":"]}),(0,s.jsx)("div",{className:"font-normal text-base",children:(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:d.survey.popup_submission_detail||""}})}),(0,s.jsx)("div",{className:"font-normal text-sm",children:(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:d.survey.submission_detail||""}})}),(0,s.jsxs)("div",{className:"flex flex-col md:flex-row justify-center items-center gap-2 my-4",children:[d.survey.share_assessment,":",(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(h.Dk,{onClick:()=>{i.hi.saveSurveysFromStat(null==t?void 0:t.documentId,b.a.SHARE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==t?void 0:t.documentId,"?isGuest=yes"),children:(0,s.jsx)(h.Vq,{size:32,round:!0})}),(0,s.jsx)(h.Ni,{onClick:()=>{i.hi.saveSurveysFromStat(null==t?void 0:t.documentId,b.a.SHARE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==t?void 0:t.documentId,"?isGuest=yes"),children:(0,s.jsx)(h.zb,{size:32,round:!0})}),(0,s.jsx)(h.B,{onClick:()=>{i.hi.saveSurveysFromStat(null==t?void 0:t.documentId,b.a.SHARE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==t?void 0:t.documentId,"?isGuest=yes"),children:(0,s.jsx)(h.b0,{size:32,round:!0})}),(0,s.jsx)(h.r2,{onClick:()=>{i.hi.saveSurveysFromStat(null==t?void 0:t.documentId,b.a.SHARE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==t?void 0:t.documentId,"?isGuest=yes"),children:(0,s.jsx)(h.pA,{size:32,round:!0})}),(0,s.jsx)(h.N0,{onClick:()=>{i.hi.saveSurveysFromStat(null==t?void 0:t.documentId,b.a.SHARE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==t?void 0:t.documentId,"?isGuest=yes"),children:(0,s.jsx)(h.ud,{size:32,round:!0})}),(0,s.jsx)("button",{onClick:D,className:"cursor-pointer",children:(0,s.jsx)(h.LQ,{size:32,round:!0})}),(0,s.jsx)(h.tq,{onClick:()=>{i.hi.saveSurveysFromStat(null==t?void 0:t.documentId,b.a.SHARE)},url:"".concat(window.location.origin,"/e-survey-from/").concat(null==t?void 0:t.documentId,"?isGuest=yes"),children:(0,s.jsx)(h.YG,{size:32,round:!0})})]})]}),(0,s.jsx)("div",{className:"flex gap-4 justify-center w-full flex-wrap md:flex-nowrap",children:(0,s.jsx)(m(),{href:"/",target:"_blank",locale:_,style:{maxWidth:"220px",width:"100%",minHeight:"53px"},className:"font-semibold text-base bg-white rounded-full border-2 border-[#10143C] flex justify-center items-center gap-2",children:(0,s.jsxs)("div",{className:"flex justify-center items-center gap-2",children:[(0,s.jsx)(x.Z,{size:14,color:"#10143C"})," ",d.survey.popup_back_to_home]})})})]})}),width:"650px"}))}catch(e){console.error("Submit error:",e),r.W.close()}finally{w(!1)}},validate:e=>{let t=(0,a.iY)(T,e,_);try{return t.validateSync(e,{abortEarly:!1}),{}}catch(t){let e={};return t.inner.forEach(t=>{t.path&&(e[t.path]=t.message)}),e}}}),D=()=>{var e,t,n,s,o,l,a,r,d,c;let u=encodeURIComponent("à¹à¸à¸à¸à¸£à¸°à¹à¸¡à¸´à¸: ".concat((null===(t=props.surveysdata)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.survey_name)||"Export Readiness Assessment")),m=encodeURIComponent("à¸à¸à¹à¸à¸´à¸à¸à¸³à¹à¸à¸à¸à¸£à¸°à¹à¸¡à¸´à¸à¸à¸§à¸²à¸¡à¸à¸£à¹à¸à¸¡à¹à¸à¸à¸²à¸£à¸ªà¹à¸à¸à¸à¸: ".concat(window.location.origin,"/e-survey-from/").concat(null===(s=props.surveysdata)||void 0===s?void 0:null===(n=s.data)||void 0===n?void 0:n.documentId,"?isGuest=yes"));"mailto:?subject=".concat(u,"&body=").concat(m),i.hi.saveSurveysFromStat(null===(l=props.surveysdata)||void 0===l?void 0:null===(o=l.data)||void 0===o?void 0:o.documentId,b.a.SHARE);let x="à¹à¸à¸à¸à¸£à¸°à¹à¸¡à¸´à¸: ".concat((null===(r=props.surveysdata)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.survey_name)||"Export Readiness Assessment","\n\nà¸à¸à¹à¸à¸´à¸à¸à¸³à¹à¸à¸à¸à¸£à¸°à¹à¸¡à¸´à¸à¸à¸§à¸²à¸¡à¸à¸£à¹à¸à¸¡à¹à¸à¸à¸²à¸£à¸ªà¹à¸à¸à¸à¸: ").concat(window.location.origin,"/e-survey-from/").concat(null===(c=props.surveysdata)||void 0===c?void 0:null===(d=c.data)||void 0===d?void 0:d.documentId,"?isGuest=yes");navigator.clipboard.writeText(x).then(()=>{alert("à¸à¸±à¸à¸¥à¸à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¹à¸¥à¹à¸§ สามารà¸à¸à¸³à¹à¸à¹à¸à¸£à¹à¹à¸à¸à¸µà¹à¸¡à¸¥à¹à¸à¹")})},z=(0,o.useRef)(null);(0,o.useEffect)(()=>{(null==t?void 0:t.documentId)&&(z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{P.current||O(G.values,t.documentId)},3e3))},[G.values,t,O]),(0,o.useEffect)(()=>{(null==t?void 0:t.pageHeaders)&&A(t.pageHeaders)},[t]),(0,o.useEffect)(()=>{(null==t?void 0:t.questions)&&C((0,a.T2)(t.questions))},[t]),(0,o.useEffect)(()=>{R((0,a.kv)(S,G.values))},[S,G.values]),(0,o.useEffect)(()=>{q(L(t.documentId,S)||(0,a.re)(S))},[S,t.documentId]);let H=(0,o.useCallback)(()=>k.find(e=>e.page===y),[k,y]),M=(0,o.useCallback)(()=>{let e=T.map(e=>e.documentId);return t.questions.filter(t=>(t.page||1)===y&&e.includes(t.documentId))},[t,y,T]),U=(0,o.useCallback)(e=>{let t=k.length;e>=1&&e<=t&&j(e)},[T,k]),$=(0,o.useCallback)(async e=>{if(0===Object.keys(e).length)return null;let t=Object.keys(e),n=y;for(let e of t){let t=S.find(t=>t.documentId===e);t&&t.page&&t.page<n&&(n=t.page)}return n},[G,S,y]),W=(0,o.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y;setTimeout(()=>{let n=Object.keys(e).filter(t=>!!e[t]);if(n.length>0){let e=new Map;for(let s of(n.forEach(n=>{let s=S.find(e=>e.documentId===n||n.startsWith("text_".concat(e.documentId,"_")));s&&s.page===t&&(e.has(s.documentId)||e.set(s.documentId,[]),e.get(s.documentId).push(n))}),Array.from(document.querySelectorAll("[data-question-id]")))){let t=s.getAttribute("data-question-id"),n=e.get(t);
1if(!n||0===n.length)continue;let o=[...n.flatMap(e=>['[name="'.concat(e,'"]'),"#".concat(e),'[data-field="'.concat(e,'"]')]),"input:not([type='hidden']):not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","[tabindex]:not([tabindex='-1'])"].map(e=>s.querySelector(e)).find(Boolean);s.scrollIntoView({behavior:"smooth",block:"center"}),o&&"function"==typeof o.focus&&o.focus();break}}},100)},[S,y]),Y=(0,o.useCallback)(async()=>{let e=await G.validateForm();if(G.setTouched(Object.keys(G.values).reduce((e,t)=>(e[t]=!0,e),{})),Object.keys(e).length>0){let t=await $(e);return t&&t!==y?(U(t),setTimeout(()=>{W(e,t)},300)):W(e,y),!1}return G.handleSubmit(),!0},[G,$,W,y,U]);return{formik:G,currentPage:y,pageHeaders:k,goToPage:U,getCurrentPageQuestions:M,getCurrentPageHeader:H,findFirstPageWithError:$,focusFirstErrorField:W,handleFormSubmit:Y}};var y=n(45697),j=n.n(y);let I=e=>{let{question:t,formik:n,className:o="",children:l}=e,a=n.errors["".concat(t.documentId)],i=n.touched["".concat(t.documentId)],r=t.isSubQuestion||!1,d=(null==n?void 0:n.submitCount)>0,c=a&&(i||d);return(0,s.jsxs)("div",{"data-question-id":t.documentId,className:"survey-question mb-6 ".concat(o," ").concat(c?"has-error":""),children:[t.question?r?(0,s.jsxs)("div",{className:"font-medium text-lg lg:text-2xl text-[#10143C] mb-2",children:[t.question," ",t.required&&(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}):(0,s.jsxs)("h2",{className:" font-bold text-2xl lg:text-[38px] bg-gradient-to-r from-[#1A1C49] via-[#41B8B9] to-[#41B8B9] bg-clip-text text-transparent leading-normal",children:[t.question,t.required&&(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}):null,t.description&&(0,s.jsx)("div",{className:"font-medium text-base text-black mb-2",children:t.description}),(0,s.jsx)("div",{className:"question-input mb-2",children:l}),c?(0,s.jsx)("div",{className:"error-message text-red-500 text-sm font-normal",children:a}):null]})};I.propTypes={question:j().object.isRequired,value:j().any,onChange:j().func,error:j().string,disabled:j().bool,className:j().string,children:j().element.isRequired};let w=e=>{let{disabled:t,question:n,formik:o,isPreview:l=!1}=e,a=o.values["".concat(n.documentId)],i=o.errors["".concat(n.documentId)],r=o.touched["".concat(n.documentId)],d={type:"text",value:a,onChange:e=>{o.setFieldValue("".concat(n.documentId),e.target.value)},onBlur:e=>{o.setFieldTouched("".concat(n.documentId),!0)},disabled:l||t,className:"form-input max-w-[400px] min-w-0 w-full min-h-[45px] border-[#E5E7EB] border px-4 border-solid rounded-lg text-black text-base ".concat(i&&r?"error":""),placeholder:n.placeholder||""};return n.max_length&&(d.maxLength=n.max_length),n.max_length>255||"textarea"===n.input_type?(0,s.jsx)("textarea",{...d,rows:n.rows||4,className:"form-textarea max-w-[400px] min-w-0 w-full min-h-[45px] border-[#E5E7EB] border p-4 border-solid rounded-lg text-black text-base ".concat(i&&r?"error":"")}):(0,s.jsx)("input",{...d})};var E=e=>(0,s.jsx)(I,{...e,children:(0,s.jsx)(w,{...e})});let N=e=>{var t,n,o;let{formik:l,disabled:a,question:i,isPreview:r=!1}=e,d=(0,g.useLocale)(),c=(0,g.useTranslations)("SurveyComponents"),u="".concat(i.documentId),m=l.values[u],x=l.errors[u],p=l.touched[u],v=null===(t=i.option)||void 0===t?void 0:t.find(e=>e.documentId===m),f="text_".concat(i.documentId,"_").concat(null==v?void 0:v.documentId),h=l.errors[f],b=l.values[f],_=l.touched[f],y=(e,t)=>{l.setFieldValue("text_".concat(i.documentId,"_").concat(t),e.target.value)},j={th:"--- à¹à¸¥à¸·à¸à¸ ---",en:"--- Select ---",zh:"--- è¯·éæ© ---",ja:"--- 鏿ãã¦ãã ãã ---"},I=j[d]||j.th,w=c("specify");return(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("select",{name:u,value:m,onChange:e=>{l.setFieldValue(u,e.target.value)},onBlur:()=>{l.setFieldTouched(u,!0)},disabled:r||a,className:"form-select custom-select appearance-none max-w-[400px] min-w-0 w-full min-h-[45px] border-[#E5E7EB] border px-4 border-solid rounded-lg text-black text-base ".concat(x&&p?"error":""),children:[(0,s.jsx)("option",{value:"",children:I}),null===(o=i.option)||void 0===o?void 0:null===(n=o.sort((e,t)=>
1e.sequence-t.sequence))||void 0===n?void 0:n.map(e=>(0,s.jsx)("option",{value:e.documentId,children:e.option},e.documentId))]}),v&&v.is_show_input?(0,s.jsx)("div",{class:"relative",children:(0,s.jsx)("input",{type:"text",name:f,onChange:e=>y(e,null==v?void 0:v.documentId),onBlur:()=>l.setFieldTouched(f,!0),value:b,placeholder:w,className:"form-input max-w-[400px] min-w-0 w-full min-h-[40px] border-[#E5E7EB] border px-4 border-solid rounded-lg text-black text-base ".concat(h&&_?"error border-red-500 border text-red-500":"")})}):null,h?(0,s.jsx)("div",{className:"text-red-500 text-sm",children:h}):null]})};var S=e=>(0,s.jsx)(I,{...e,children:(0,s.jsx)(N,{...e})});let C=e=>{var t,n;let{disabled:l,question:a,formik:i,isPreview:r=!1}=e,d=(0,g.useTranslations)("SurveyComponents"),c=i.values["".concat(a.documentId)],u=a.max_select_multiple,m=r||l,x=(0,o.useCallback)(e=>{let t=i.values["".concat(a.documentId)],n=Array.isArray(t)?t:[],s=n.includes(e)?n.filter(t=>t!==e):n.length<u?[...n,e]:n;i.setFieldValue("".concat(a.documentId),s),setTimeout(()=>{i.setFieldTouched("".concat(a.documentId),!0)},500)},[a,i]),p=(e,t)=>{i.setFieldValue("text_".concat(a.documentId,"_").concat(t),e.target.value)},v=d("specify");return(0,s.jsx)("div",{className:"flex flex-col gap-2",children:null===(n=a.option)||void 0===n?void 0:null===(t=n.sort((e,t)=>e.sequence-t.sequence))||void 0===t?void 0:t.map(e=>{let t=Array.isArray(c)&&c.includes(e.documentId),n="text_".concat(a.documentId,"_").concat(e.documentId),o=i.values[n],l=i.errors[n],r=i.touched[n];return(0,s.jsxs)("label",{className:"checkbox-label flex gap-2 items-center",htmlFor:e.documentId,children:[(0,s.jsx)("input",{type:"checkbox",id:e.documentId,checked:Array.isArray(c)&&c.includes(e.documentId),onChange:()=>x(e.documentId),disabled:m,className:"checkbox-input"}),(0,s.jsx)("span",{className:"checkbox-text font-medium text-base text-black",children:e.option}),e.is_show_input&&t?(0,s.jsx)("div",{class:"relative",children:(0,s.jsx)("input",{onChange:t=>p(t,e.documentId),name:n,placeholder:v,value:o,disabled:!t,className:"form-input max-w-[400px] min-w-0 w-full min-h-[40px] border-[#E5E7EB] border px-4 border-solid rounded-lg text-black text-base ".concat(l&&r?"error border-red-500 border text-red-500":"")})}):null,l?(0,s.jsx)("div",{className:"text-red-500 text-sm",children:l}):null]},e.documentId)})})};var T=e=>(0,s.jsx)(I,{...e,children:(0,s.jsx)(C,{...e})});let R=e=>{var t,n;let{disabled:o,question:l,formik:a,isPreview:i=!1}=e,r=(0,g.useTranslations)("SurveyComponents"),d=a.values["".concat(l.documentId)],c=i||o,u=e=>{a.setFieldValue("".concat(l.documentId),e),setTimeout(()=>{a.setFieldTouched("".concat(l.documentId),!0)},500)},m=(e,t)=>{a.setFieldValue("text_".concat(l.documentId,"_").concat(t),e.target.value)},x=r("specify");return(0,s.jsx)("div",{className:"flex flex-col gap-2",children:null===(n=l.option)||void 0===n?void 0:null===(t=n.sort((e,t)=>e.sequence-t.sequence))||void 0===t?void 0:t.map(e=>{let t=d===e.documentId,n="text_".concat(l.documentId,"_").concat(e.documentId),o=a.values[n],i=a.errors[n],r=a.touched[n];return(0,s.jsxs)("label",{className:"flex gap-2 items-center",children:[(0,s.jsx)("input",{type:"radio",name:"".concat(l.documentId),value:e.documentId,checked:d===e.documentId,onChange:()=>u(e.documentId),disabled:c,className:"radio-input"}),(0,s.jsx)("span",{className:"radio-text font-medium text-base text-black",children:e.option}),e.is_show_input&&t?(0,s.jsx)("div",{class:"relative",children:(0,s.jsx)("input",{name:n,onChange:t=>m(t,e.documentId),placeholder:x,value:o,disabled:!t,className:"form-input max-w-[400px] min-w-0 w-full min-h-[40px] border-[#E5E7EB] border px-4 border-solid rounded-lg text-black text-base ".concat(i&&r?"error border-red-500 border text-red-500":"")})}):null,i?(0,s.jsx)("div",{className:"text-red-500 text-sm",children:i}):null]},e.documentId)})})};var k=e=>(0,s.jsx)(I,{...e,children:(0,s.jsx)(R,{...e})});let A=e=>{let{disabled:t,question:n,formik:o,isPreview:l=!1}=e,a=o.values["".concat(n.documentId)];o.errors["".concat(n.documentId)],o.touched["".concat(n.documentId)];let i=n.min_rating_scale||1,r=n.max_rating_scale||5,d=n.step||1,c=l||t,u=e=>{o.setFieldValue("".concat(n.documentId),e),setTimeout(()=>{o.setFieldTouched("".concat(n.documentId),!0)},500)},m=(()=>{let e=[];for(let t=i;t<=r;t+=d)e.push(t);return e})();return(0,s.jsx)("div",{className:"flex flex-col gap-2 w-full mb-9",children:(0,s.jsx)("div",{className:"w-full flex items-center flex-nowrap gap-2",children:m.map((e,t)=>(0,s.jsx)("button",{type:"button",name:"rating_".concat(e),value:e,onClick:()=>
1u(e),disabled:c,className:"\n rating-label\n border border-1 rounded-full\n min-w-0\n flex-grow\n basis-0\n max-w-[120px]\n h-[52px]\n flex justify-center items-center\n border-[#D8D8D8] text-base font-normal md:font-medium\n relative\n ".concat(c?"cursor-not-allowed opacity-70":"","\n ").concat(a===e?"bg-[#10143C] text-white":"","\n "),children:e},e))})})};var F=e=>(0,s.jsx)(I,{...e,children:(0,s.jsx)(A,{...e})}),q=e=>{let{question:t,className:n=""}=e;return(0,s.jsx)("div",{className:"static-text-question mb-5 ".concat(n),children:t.static_text&&(0,s.jsx)("div",{className:"bg-[#F2F3FF] border border-[#D7D9F0] rounded-xl",children:(0,s.jsx)("div",{className:"static-text-content ql-editor",dangerouslySetInnerHTML:{__html:t.static_text}})})})},B=e=>{var t,n;let{question:o,className:l=""}=e;return(0,s.jsx)("div",{className:"static-image-question mb-5 mt-7 ".concat(l),children:o.static_image&&(0,s.jsx)("div",{className:"image-container",children:(0,s.jsx)("img",{src:null===(t=o.static_image)||void 0===t?void 0:t.url,alt:null===(n=o.static_image)||void 0===n?void 0:n.name,className:"survey-image",loading:"lazy"})})})};let L=e=>{let{formik:t,disabled:n,question:l,isPreview:a=!1}=e,[i,r]=(0,o.useState)(!1),[d,c]=(0,o.useState)(!1),u=t.values["".concat(l.documentId)];t.errors["".concat(l.documentId)],t.touched["".concat(l.documentId)];let m=l.max_upload_file||1,x=l.accepted_file_types||"application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, image/jpeg, image/png, application/zip, text/csv",p=l.max_file_size||209715200,v=a||n,f=async e=>{if(v||d)return;let n=Array.from(e);if(n.length>m){alert("สามารà¸à¸à¸±à¸à¹à¸«à¸¥à¸à¹à¸à¹à¸ªà¸¹à¸à¸ªà¸¸à¸ ".concat(m," à¹à¸à¸¥à¹"));return}if(n.filter(e=>e.size>p).length>0){alert("à¸à¸à¸²à¸à¹à¸à¸¥à¹à¸à¹à¸à¸à¹à¸¡à¹à¹à¸à¸´à¸ ".concat(Math.round(p/1024/1024)," MB"));return}c(!0);try{let e=n.map(e=>({name:e.name,size:e.size,type:e.type,lastModified:e.lastModified,file:e}));t.setFieldValue(l.documentId,e)}catch(e){console.error("Upload error:",e),alert("à¹à¸à¸´à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸à¹à¸à¸à¸²à¸£à¸à¸±à¸à¹à¸«à¸¥à¸à¹à¸à¸¥à¹")}finally{c(!1)}},h=e=>{if(1===m)t.setFieldValue(l.documentId,[]);else{let n=(Array.isArray(u)?u:[]).filter((t,n)=>n!==e);t.setFieldValue(l.documentId,n)}},b=Array.isArray(u)?u:[];return(0,s.jsxs)("div",{class:"grid grid-cols-[120px_1fr] border border-[#E5E7EB] rounded-lg overflow-hidden max-w-[400px] min-w-0 ".concat(v?"cursor-not-allowed opacity-75":""),children:[(0,s.jsx)("span",{class:"px-4 py-2 bg-gray-100 text-gray-500 border-r border-[#E5E7EB] item-st flex items-center min-w-[120px]",children:"Choose file"}),b.length>0?(0,s.jsx)("div",{class:"cursor-pointer flex-1 px-4 py-2 text-gray-700 hover:bg-gray-50 transition-colors min-h-[46px] flex items-center overflow-y-auto ".concat(v?"!cursor-not-allowed opacity-75":""),children:(0,s.jsx)("div",{className:"uploaded-files flex flex-col gap-2",children:b.map((e,t)=>(0,s.jsxs)("div",{className:"uploaded-file flex items-center gap-2",children:[(0,s.jsx)("div",{style:{maxWidth:"200px"},title:e.name,className:"file-name overflow-hidden whitespace-nowrap text-ellipsis",children:e.name}),(0,s.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),h(t)},className:"remove-file-btn rounded-full size-6 border border-[#E5E7EB] flex items-center justify-center p-0",disabled:v,children:"â"})]},t))})}):(0,s.jsx)("label",{htmlFor:"file_input_".concat(l.documentId),className:"cursor-pointer flex-1 px-4 py-2 text-gray-700 hover:bg-gray-50 transition-colors min-h-[46px] flex items-center overflow-y-auto ".concat(v?"!cursor-not-allowed opacity-75":""),children:(0,s.jsx)("span",{id:"file-name",className:"truncate",children:"No file chosen"})}),(0,s.jsx)("input",{type:"file",id:"file_input_".concat(l.documentId),class:"hidden",multiple:m>1,accept:x,onChange:e=>{f(e.target.files)},disabled:v||d})]})};var O=e=>(0,s.jsx)(I,{...e,children:(0,s.jsx)(L,{...e})}),V=e=>{let{question:t,className:n="",isPreview:s=!1}=e;return null},P=function(e){let{question:t}=e;return(0,s.jsxs)("div",{className:"mb-5",children:[(0,s.jsx)("h2",{className:" font-bold text-2xl lg:text-[38px] bg-gradient-to-r from-[#1A1C49] via-[#41B8B9] to-[#41B8B9] bg-clip-text text-transparent leading-normal",children:t.question}),t.description&&(0,s.jsx)("div",{className:"font-medium text-base text-black",children:t.description})]})},G=n(54613),D=n(17611);let z=e=>{let{data:{label:t}}=e;return(0,s.jsx)(D.c.Option,{...e,children:(0,s.jsx)("div",{className:"flex items-center",children:t})})},H=e=>(0,s.jsx)(D.c.Input,{...e,onChange:t=>{e.onChange(t)}
1}),M=e=>{let{formik:t,disabled:n,question:l,isPreview:a=!1,isMobile:r=!1,placeholder:d="",onChange:c=()=>{}}=e,u="".concat(l.documentId),m=t.values[u],x=t.errors[u],p=t.touched[u],[v,f]=(0,o.useState)(!1),[h,b]=(0,o.useState)(!0),[_,y]=(0,o.useState)(!1),[j,I]=(0,o.useState)(!0),[w,E]=(0,o.useState)(!1),[N,S]=(0,o.useState)([]),C=(0,g.useTranslations)("SurveyComponents"),T=C("select_region"),R=C("select_office"),k=C("office_required"),A=(0,o.useMemo)(()=>{if(!m||!(null==m?void 0:m.region_id))return null;let e=N.find(e=>e.documentId===m.region_id);return{label:(null==e?void 0:e.region_name)||"",value:null==e?void 0:e.documentId,...e}},[m,N]),F=(0,o.useMemo)(()=>{var e;if(!m||!(null==m?void 0:m.office_id)||!A)return null;let t=null==A?void 0:null===(e=A.offices)||void 0===e?void 0:e.find(e=>e.documentId===m.office_id);return{label:(null==t?void 0:t.name)||"",value:null==t?void 0:t.documentId,...t}},[m,A]),q=(0,o.useCallback)(e=>{if(e){let n={region_id:e.value,office_id:""};t.setFieldValue(u,n),t.setFieldError(u,k),c(n)}else t.setFieldValue(u,null),t.setFieldError(u,void 0),c(null)},[t,u,c]),B=(0,o.useCallback)(e=>{let n=t.values[u];if(e){let s=n?{...n,office_id:e.value}:{office_id:e.value};t.setFieldValue(u,s),t.setFieldError(u,void 0),c(s)}else{let e=n?{...n,office_id:""}:null;t.setFieldValue(u,e),(null==n?void 0:n.region_id)&&t.setFieldError(u,k),c(e)}},[t,u,c]),L=(0,o.useCallback)(()=>{t.setFieldTouched(u,!0)},[t,u]),O=(0,o.useCallback)(e=>e&&Array.isArray(e)?e.map(e=>e?{...e,label:e.region_name||"",value:e.documentId}:null).filter(Boolean):[],[]),V=(0,o.useCallback)(e=>e&&Array.isArray(e)?e.map(e=>e?{...e,label:e.name||"",value:e.documentId}:null).filter(Boolean):[],[]);(0,o.useEffect)(()=>{i.hi.getRegionWithTTCgetLang(null==l?void 0:l.locale).then(e=>{let t=[];(e.data.data||[]).forEach(e=>{!t.find(t=>t.documentId===e.documentId&&t.locale===e.locale)&&Array.isArray(e.offices)&&e.offices.length>0&&t.push(e)}),S(t)}).catch(e=>{});let e=t.values[u];(null==e?void 0:e.region_id)&&!(null==e?void 0:e.office_id)&&t.setFieldError(u,k),(null==e?void 0:e.office_id)&&t.setFieldError(u,void 0)},[t.values[u],null==l?void 0:l.locale]);let P=x&&p?{border:"1px solid #B70909"}:{},D=a||n;return(0,s.jsxs)("div",{className:"flex flex-col gap-2",name:u,children:[(0,s.jsx)(G.Z,{className:"basic-single bg-transparent",classNames:{multiValueRemove:()=>"!bg-[#E5E7EB] !rounded-full !size-[15px] min-w-[15px] !p-0 font-light flex justify-center",multiValueLabel:()=>"!text-sm !font-[500] !m-0 !p-0",multiValue:()=>"!m-0 !mr-1 !px-[6px] !py-[5px] !rounded-full border !border-[#E5E7EB] !bg-white flex items-center gap-1",input:()=>"!focus:outline-none !p-0 !m-0 !shadow-none [&>input]:!shadow-none [&>input]:!ring-0 [&>input]:!outline-none",valueContainer:()=>"!p-0 !m-0",clearIndicator:()=>"!p-0",dropdownIndicator:()=>"!p-0",control:()=>"form-select !min-h-[45px] !max-w-[400px] !min-w-0 !pl-4 !pr-2 !py-[4.5px] truncate w-full border !border-[#E5E7EB] !rounded-lg !text-black !text-base !focus:outline-none !appearance-none !shadow-none ".concat(D?"!bg-[#e9ecef]":""),menu:()=>"!max-w-[400px] "},isDisabled:D,isLoading:v,isClearable:h,isRtl:_,value:A,isSearchable:j,placeholder:d||T,cacheOptions:!0,defaultOptions:O(N),components:{Option:z,Input:H},onBlur:L,onChange:q,isMulti:w,styles:{control:(e,t)=>({...e,...P}),menu:e=>({...e,zIndex:9999999,position:"absolute"})},menuPlacement:r?"top":"auto"}),A&&(0,s.jsx)(G.Z,{className:"basic-single bg-transparent mt-1",classNames:{multiValueRemove:()=>"!bg-[#E5E7EB] !rounded-full !size-[15px] min-w-[15px] !p-0 font-light flex justify-center",multiValueLabel:()=>"!text-sm !font-[500] !m-0 !p-0",multiValue:()=>"!m-0 !mr-1 !px-[6px] !py-[5px] !rounded-full border !border-[#E5E7EB] !bg-white flex items-center gap-1",input:()=>"!focus:outline-none !p-0 !m-0 !shadow-none [&>input]:!shadow-none [&>input]:!ring-0 [&>input]:!outline-none",valueContainer:()=>"!p-0 !m-0",clearIndicator:()=>"!p-0",dropdownIndicator:()=>"!p-0",control:()=>"form-select !min-h-[45px] !max-w-[400px] !min-w-0 !pl-4 !pr-2 !py-[4.5px] truncate w-full border !border-[#
1E5E7EB] !rounded-lg !text-black !text-base !focus:outline-none !appearance-none !shadow-none ".concat(D?"!bg-[#e9ecef]":""),menu:()=>"!max-w-[400px] "},isDisabled:D,isLoading:v,isClearable:h,isRtl:_,value:F,isSearchable:j,placeholder:d||R,cacheOptions:!0,defaultOptions:V((null==A?void 0:A.offices)||[]),components:{Option:z,Input:H},onBlur:L,onChange:B,isMulti:w,styles:{control:(e,t)=>({...e,...P}),menu:e=>({...e,zIndex:9999999,position:"absolute"})},menuPlacement:r?"top":"auto"})]})};var U=e=>(0,s.jsx)(I,{...e,children:(0,s.jsx)(M,{...e})}),$=e=>{let{question:t,className:n,formik:o,isPreview:l=!1}=e,i=t.type_field,r={question:t,className:n,formik:o,isPreview:l};if(t.has_sub_questions)return(0,s.jsx)(P,{question:t,formik:o,isPreview:l});switch(i){case a.j$.TEXT_FIELD:return(0,s.jsx)(E,{...r});case a.j$.DROPDOWN_OPTION:return(0,s.jsx)(S,{...r});case a.j$.MULTIPLE_CHOICE:return(0,s.jsx)(T,{...r});case a.j$.SINGLE_CHOICE:return(0,s.jsx)(k,{...r});case a.j$.RATING_SCALE:return(0,s.jsx)(F,{...r});case a.j$.STATIC_TEXT:return(0,s.jsx)(q,{...r});case a.j$.STATIC_IMAGE:return(0,s.jsx)(B,{...r});case a.j$.UPLOAD_FILE:return(0,s.jsx)(O,{...r});case a.j$.TTC:return(0,s.jsx)(U,{...r});case a.j$.PAGE_HEADER:return(0,s.jsx)(V,{...r});default:return(0,s.jsx)("div",{className:"unknown-question-type",children:(0,s.jsxs)("p",{children:["à¸à¸£à¸°à¹à¸ à¸à¸à¸³à¸à¸²à¸¡à¹à¸¡à¹à¸£à¸à¸à¸£à¸±à¸: ",i]})})}};let W=e=>{let{question:t,formValues:n,formik:l,isPreview:a=!1}=e,i=(0,o.useMemo)(()=>t.has_sub_questions?t.subQuestions:[],[t]),r=(0,o.useMemo)(()=>i,[i,n]);return(0,s.jsxs)("div",{className:"question-container",children:[(0,s.jsx)("div",{className:"main-question",children:(0,s.jsx)($,{question:t,formik:l,isPreview:a})}),r.length>0&&(0,s.jsx)("div",{className:"sub-questions",children:r.map(e=>(0,s.jsx)("div",{className:"sub-question",children:(0,s.jsx)(W,{question:e,formValues:n,formik:l,isPreview:a})},e.id))})]})};W.propTypes={question:j().object.isRequired,formValues:j().object.isRequired,onChange:j().func.isRequired,errors:j().object,disabled:j().bool,className:j().string},W.defaultProps={errors:{},disabled:!1,className:""};var Y=e=>{let{questions:t=[],pageHeader:n,pageNumber:o,formValues:l,formik:a,className:i="",isPreview:r=!1}=e;return 0===t.length?(0,s.jsx)("p",{className:"no-questions",children:"à¹à¸¡à¹à¸¡à¸µà¸à¸³à¸à¸²à¸¡à¹à¸à¸«à¸à¹à¸²à¸à¸µà¹"}):(0,s.jsx)("div",{className:"",children:t.length>0&&(0,s.jsx)("div",{className:"page-questions",children:t.map(e=>(0,s.jsx)("div",{className:"question-wrapper",children:(0,s.jsx)(W,{question:e,formValues:l,formik:a,isPreview:r})},e.id))})})};let Z=e=>{let{currentPage:t,totalPages:n,className:o=""}=e,l=Array.from({length:n},(e,t)=>t+1);return(0,s.jsx)("div",{className:"bg-white rounded-lg p-6 ".concat(o),children:(0,s.jsx)("div",{className:"flex items-center justify-center p-2 overflow-x-auto pb-2",children:l.map((e,n)=>{let o=e===t,a=e<t,i=n===l.length-1;return(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("div",{className:"flex flex-col items-center",children:(0,s.jsx)("div",{className:"\n w-10 h-10 rounded-full flex items-center justify-center text-xl font-normal transition-all duration-300\n ".concat(o?"bg-gradient-to-r from-[#276d6e] to-[#41B8B9]":a?"bg-gradient-to-r from-[#276d6e] to-[#41B8B9] text-white":"bg-gray-200 text-gray-600","\n "),children:a?(0,s.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):o?(0,s.jsx)("div",{className:"bg-white min-w-[36px] min-h-[36px] rounded-full flex items-center justify-center ",children:(0,s.jsx)("span",{className:"bg-gradient-to-r from-[#1A1C49] via-[#41B8B9] to-[#41B8B9] bg-clip-text text-transparent",children:e})}):(0,s.jsx)("div",{className:"bg-white min-w-[36px] min-h-[36px] rounded-full flex items-center justify-center ",children:(0,s.jsx)("span",{className:"text-black",children:e})})})}),!i&&(0,s.jsx)("div",{className:"flex items-center justify-center gap-1.5 mx-2",children:[1,2,3].map(e=>(0,s.jsx)("div",{className:"w-1.5 h-1.5 rounded-full ".concat(a?"bg-gradient-to-r from-[#276d6e] to-[#41B8B9]":"bg-gray-200")},e))})]},e)})})})};Z.propTypes={currentPage:j().number.isRequired,totalPages:j().number.isRequired,className:j().string};var X=n(83754),Q=n(23810),K=e=>{let{currentPage:t,totalPages:n,onNext:l,onPrevious:a,isSubmitting:i=!1,canGoPrevious:r=!1,isLastPage:d=!1,handleFormSubmit:c,formik:u,className:m="",isPreview:x=!1,isAssessment:p,messages:v}=e,[f,h]=(0,o.useState)(""),b=u.values.pdpaConsent;return(0,s.jsxs)("div",{className:"mt-8 gap-10 flex flex-col ".concat(m),children:[d?(0,s.jsx)("div",{className:"flex flex-col gap-5",children:p?(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"checkbox",id:"pdpaConsent",name:"pdpaConsent",checked:b,disabled:x,onClick:()=>{u.setFieldValue("pdpaConsent",!b)},className:"mr-2"}),(0,s.jsxs)("label",{htmlFor:"pdpaConsent",className:"text-sm",children:[v.survey.accept," ",(0,s.jsx)("a",{href:"https://www.ditp.go.th/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"underline",children:v.survey.department})]})]}):null}):null,(0,s.jsxs)("div",{className:"flex items-center w-full gap-2 flex-wrap ".concat(d?"justify-between":"justify-center"),children:[d?(0,s.jsx)(Q.Z,{onVerify:e=>{h(e)}}):null,(0,s.jsxs)("div",{className:"flex gap-4 items-center justify-end",children:[r?(0,s.jsx)(X.X,{type:"button",onClick:a,disabled:!r||i,className:"text-[#10143C] border border-[#10143C] px-6 py-3 !rounded-full min-w-full sm:min-w-[200px] min-h-[52px] text-base font-bold flex items-center justify-center ",children:"ยà¹à¸à¸à¸à¸¥à¸±à¸"}):null,d?(0,s.jsx)(X.X,{type:"button",disabled:p&&!b||!f||x,onClick:c,className:"bg-gradient-to-r disabled:bg-gray-300 from-[#1A1C49] to-[#41B8B9] text-white px-6 py-3 !rounded-full min-w-full sm:min-w-[200px] min-h-[52px] text-base font-bold flex items-center justify-center ",children:p?v.survey.Submit:"Submit / สà¹à¸à¹à¸à¸à¸ªà¸³à¸£à¸§à¸"}):(0,s.jsx)(X.X,{delay:0,type:"button",onClick:l,disabled:i,className:"text-[#10143C] border border-[#10143C] px-6 py-3 !rounded-full min-w-full sm:min-w-[200px] min-h-[52px] text-base font-bold flex items-center justify-center ",children:"à¸à¸±à¸à¹à¸"})]})]})]})},J=e=>{let{surveyData:t,onSubmit:n,onSave:l,storageKey:i="survey_data",enableAutoSave:r=!0,showProgress:d=!0,showNavigation:c=!0,className:u="",ssoAccount:m,isPreview:x,messages:p}=e,[v,f]=(0,o.useState)(!1),{formik:h,currentPage:b,pageHeaders:g,getCurrentPageQuestions:y,getCurrentPageHeader:j,goToPage:I,handleFormSubmit:w}=_({surveyData:t,storageKey:i,ssoAccount:m,messages:p,isPreview:x}),E=(null==t?void 0:t.pages)||[],N=E[b],S=y(),C=j(),T=null==t?void 0:t.isAssessment,R=async()=>{I(b+1),setTimeout(()=>{(0,a.k3)()},500)},k=()=>{I(b-1),setTimeout(()=>{(0,a.k3)()},500)};return t&&E.length?(0,s.jsxs)("div",{className:"",children:[d&&g.length>1?(0,s.jsx)(Z,{currentPage:b,totalPages:g.length}):null,(0,s.jsxs)("form",{className:"",onSubmit:h.handleSubmit,children:[(0,s.jsx)(Y,{pageData:N,questions:S,pageHeader:C,formValues:h.values,pageNumber:b,formik:h,isPreview:x}),c?(0,s.jsx)(K,{formik:h,currentPage:b,totalPages:g.length,onNext:()=>R(h),onPrevious:()=>k(h),handleFormSubmit:w,isSubmitting:v||h.isSubmitting,canGoNext:b<g.length-1,canGoPrevious:b>1,isLastPage:b>=g.length,isPreview:x,isAssessment:T,messages:p}):null]})]}):(0,s.jsx)("div",{className:"survey-form-error",children:(0,s.jsx)("p",{children:"à¹à¸¡à¹à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸à¸à¸ªà¸à¸à¸à¸²à¸¡"})})}},10544:function(e,t,n){n.d(t,{f1:function(){return d}});var s=n(85893),o=n(67294);let l=(0,o.createContext)(),a={SET_SURVEY_DATA:"SET_SURVEY_DATA",SET_CURRENT_PAGE:"SET_CURRENT_PAGE",SET_FORM_VALUES:"SET_FORM_VALUES",SET_LOADING:"SET_LOADING",SET_ERROR:"SET_ERROR",RESET_SURVEY:"RESET_SURVEY"},i={surveyData:null,currentPage:0,formValues:{},isLoading:!1,error:null,isSubmitted:!1},r=(e,t)=>{switch(t.type){case a.SET_SURVEY_DATA:return{...e,surveyData:t.payload,error:null};case a.SET_CURRENT_PAGE:return{...e,currentPage:t.payload};case a.SET_FORM_VALUES:return{...e,formValues:{...e.formValues,...t.payload}};case a.SET_LOADING:return{...e,isLoading:t.payload};case a.SET_ERROR:return{...e,error:t.payload,isLoading:!1};case a.RESET_SURVEY:return{...i};default:return e}},d=e=>{let{children:t}=e,[n,d]=(0,o.useReducer)(r,i),c={...n,setSurveyData:e=>{d({type:a.SET_SURVEY_DATA,payload:e})},setCurrentPage:e=>{d({type:a.SET_CURRENT_PAGE,payload:e})},setFormValues:e=>{d({type:a.SET_FORM_VALUES,payload:e})}
1,setLoading:e=>{d({type:a.SET_LOADING,payload:e})},setError:e=>{d({type:a.SET_ERROR,payload:e})},resetSurvey:()=>{d({type:a.RESET_SURVEY})}};return(0,s.jsx)(l.Provider,{value:c,children:t})}}}]);
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.