freemium-survey-components 2.0.428 → 2.0.430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/automated-version-bump.yml +281 -0
- package/.github/workflows/security_verification.yml +4 -3
- package/lib/bundle.css +2 -2
- package/lib/index.cjs.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/types/survey/meta-channel-preview/index.d.ts +1 -3
- package/lib/types/types.d.ts +3 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -36,4 +36,4 @@ const V$=(e,t,n,a,o=!0)=>{const i=[];let r=t;const c=Math.min(e.byteLength,t+n-1
|
|
|
36
36
|
* FilePondPluginFileValidateType 1.2.9
|
|
37
37
|
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
|
38
38
|
* Please visit https://pqina.nl/filepond/ for details.
|
|
39
|
-
*/;const h5=({addFilter:e,utils:t})=>{const{Type:n,isString:a,replaceInString:o,guesstimateMimeType:i,getExtensionFromFilename:r,getFilenameFromURL:c}=t,s=(e,t)=>e.some((e=>{return/\*$/.test(e)?(n=e,(/^[^/]+/.exec(t)||[]).pop()===n.slice(0,-2)):e===t;var n})),l=(e,t,n)=>{if(0===t.length)return!0;const o=(e=>{let t="";if(a(e)){const n=c(e),a=r(n);a&&(t=i(a))}else t=e.type;return t})(e);return n?new Promise(((a,i)=>{n(e,o).then((e=>{s(t,e)?a():i()})).catch(i)})):s(t,o)};return e("SET_ATTRIBUTE_TO_OPTION_MAP",(e=>Object.assign(e,{accept:"acceptedFileTypes"}))),e("ALLOW_HOPPER_ITEM",((e,{query:t})=>!t("GET_ALLOW_FILE_TYPE_VALIDATION")||l(e,t("GET_ACCEPTED_FILE_TYPES")))),e("LOAD_FILE",((e,{query:t})=>new Promise(((n,a)=>{if(!t("GET_ALLOW_FILE_TYPE_VALIDATION"))return void n(e);const i=t("GET_ACCEPTED_FILE_TYPES"),r=t("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),c=l(e,i,r),s=()=>{const e=i.map((e=>t=>null!==e[t]&&(e[t]||t))(t("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"))).filter((e=>!1!==e)),n=e.filter(((t,n)=>e.indexOf(t)===n));a({status:{main:t("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:o(t("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:n.join(", "),allButLastType:n.slice(0,-1).join(", "),lastType:n[n.length-1]})}})};if("boolean"==typeof c)return c?n(e):s();c.then((()=>{n(e)})).catch(s)})))),{options:{allowFileTypeValidation:[!0,n.BOOLEAN],acceptedFileTypes:[[],n.ARRAY],labelFileTypeNotAllowed:["File is of invalid type",n.STRING],fileValidateTypeLabelExpectedTypes:["Expects {allButLastType} or {lastType}",n.STRING],fileValidateTypeLabelExpectedTypesMap:[{},n.OBJECT],fileValidateTypeDetectType:[null,n.FUNCTION]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:h5}));K(m5,h5,I$,z5),B3(_3,D3,H3,I3);const f5=b((({onClick:e,maxFileSize:n=16,visible:a=!0,supportedFileFormats:o,translationVariables:i,fileErrors:r},c)=>{const[l,p]=s(!1),d=i?.drop_your_file?i?.drop_your_file:t.createElement(t.Fragment,null,"Drop your file here, or Browse");return t.createElement("div",{ref:c,className:"file-upload-container "+(r?.current?.main?"errored":""),onClick:e,style:{visibility:a?"visible":"hidden"},onDragOver:e=>{e.preventDefault(),e.target.classList.add("push-backward")}}," ",t.createElement(we,{name:"file-upload-icon"}),"string"!=typeof d?t.createElement("p",null,d):t.createElement("p",{className:"drop-your-file-container",dangerouslySetInnerHTML:{__html:d}}),t.createElement("p",{className:"max-size"},((e,t,n)=>{if(n&&e&&t)return e.replace(t,n)})(i?.max_file_size,"{{max_file_size}}",String(n))||`Maximum file size : ${n} MB`),t.createElement("p",{className:"support file-formats"},i?.supported_file_formats||"Supported file formats: "," ",(o=o.join(", ")).trim()?t.createElement(t.Fragment,null,l?o:o.slice(0,20)," ",t.createElement("span",{onClick:()=>p(!l),style:{color:"#2C5CC5",textDecoration:"underline",cursor:"pointer"}},l?i?.show_less||"Show less":i?.show_more||"Show more")):"No formats selected"),t.createElement("div",{className:"filepond--drip"}))})),O5=({question:e,onChangeHandler:n,onFileUpload:a,setErrors:o,translationVariables:i,surveyServAssetUrl:c,value:l,preview:p})=>{const[d,u]=s([]),[b,M]=s([]),z=r(),m=e.type_info?.file_field?.max_file_size||10,h=r(null),f=r(),[O,A]=s(!1);let v=!1;t.useEffect((()=>{const t=localStorage.getItem(`uploadedFile-${e?.name}`),n=t?JSON.parse(t):"";n?.source&&(n.options={...n.options,file:{name:l,size:n.fileSize}},l&&u([n]))}),[]);const g=async(t,o)=>{try{if(v)return;if(f.current&&Wa(h.current)||t){const i=t??f.current.getFiles()?.[0]?.file;if(i&&a){v=!0;const t=await a(i.type,i.size,i.name,e);if(o&&o(!0,50,100),t.startsWith("http")&&c){const a=await fetch(t,{method:"PUT",headers:{"Content-Type":i.type,"Content-Disposition":"attachment"},body:i}),o=new URL(t),r=`${c}${o.pathname}`;if(!a.ok)throw console.error("Error uploading file"),new Error("Error uploading file");localStorage.setItem(`uploadedFile-${e?.name}`,JSON.stringify({source:r,options:{type:"local"},fileSize:f.current.getFiles()?.[0]?.fileSize})),n(i.name)}else n(p?"dummy":null),console.error("Error fetching pre-signed url");v=!1}}}catch(e){throw console.error("error in uploading file",e,"stringified error",JSON.stringify(e)),new Error("Error uploading file")}};return t.useEffect((()=>{(()=>{const t=e.type_info?.file_field?.allowed_file_types,n=Object.keys(Oe).map((e=>{if((t||[]).includes(e))return Oe[e].concat(",")})).join(" ").trim().slice(0,-1);M(n.split(", "))})()}),[]),t.createElement(t.Fragment,null,t.createElement(Q,{ref:f,files:d,labelFileProcessing:i?.uploading_text??"Uploading..",labelFileProcessingComplete:i?.upload_complete??"Upload complete",labelMaxFileSizeExceeded:i?.file_too_large??"The file is too large and cannot be uploaded.",labelMaxFileSize:"",labelTapToCancel:"",labelTapToUndo:"",labelFileTypeNotAllowed:i?.invalid_type??"The file mismatch. Retry by uploading the supported file type.",fileValidateTypeLabelExpectedTypes:"",beforeAddFile:e=>(h.current?.main&&(h.current=null,o({}),u([e]),A(!0)),!0),onremovefile:()=>{O?A(!1):(u([]),o({}),h.current=null,n(null))},allowReplace:!0,server:{process:async(e,t,n,a,o,i)=>{i(!0,0,100);try{await g(t,i),i(!0,100,100),a(t.name)}catch(e){o("An error occurred during upload")}}},onpreparefile:(e,t)=>{const n=new FileReader;n.onloadend=()=>{const t=n.result??"",a=new Blob([t],{type:e.fileType}),o=new File([a],e.filename,{type:e.fileType});g(o)},n.readAsArrayBuffer(t)},onerror:t=>{h.current=t,o({[e.name]:t})},required:!0,credits:!1,allowFileTypeValidation:!0,acceptedFileTypes:b,fileValidateTypeDetectType:(e,t)=>new Promise(((t,n)=>{const a=e.name.split(".");t(`.${a[a.length-1].toLowerCase()}`)})),imageEditor:{legacyDataToImageState:mJ,createEditor:K3,imageReader:[E3,{}],imageWriter:[N3,{}],imageProcessor:iF,imageEditorAfterWriteImage:({src:e,dest:t,imageState:n})=>new Promise(((a,o)=>{iF(e,{imageReader:E3(),imageWriter:N3({targetSize:{width:128,height:15,fit:"cover"}}),imageState:n}).then((n=>{a([{name:"input_",file:e},{name:"output_",file:t},{name:"thumb_",file:n.dest}])})).catch(o)})),editorOptions:{utils:["crop","finetune","filter","annotate"],imageOrienter:P3(),shapePreprocessor:Q3(),...V3,...X3,...$3,locale:{...j3,...U3,...Y3,...G3,...Z3,...F3}}},allowFileSizeValidation:!0,maxFileSize:`${m}MB`,onupdatefiles:e=>{z.current?.classList.remove("push-backward"),e.length&&u(e)},maxFiles:1,name:`${e.id}-files`}),t.createElement(f5,{ref:z,onClick:e=>{const t=e.target;"path"!==t?.tagName&&"P"!==t?.tagName&&(!t?.className||t?.className instanceof SVGAnimatedString||t.className.includes("format-type-toggler"))||f.current.browse()},fileErrors:h,visible:Boolean(!d.length||h.current?.main),maxFileSize:m,translationVariables:{...i,tTimeZones:[{id:"",offset:"",timeZone:""}]},supportedFileFormats:b}),h?.current?.main&&t.createElement("div",{className:"file-error"},t.createElement(we,{name:"info"}),t.createElement("span",null,`${h?.current?.main}\n ${h.current?.sub}`)))},A5=e=>{switch(e){case"EMAIL":return"email";case"PHONE":return"tel";case"NUMBER":return"number";default:return"text"}},v5=({question:e,autoFocusDelay:n,onChangeHandler:a,surveyStyle:o,formValues:i,fieldErrors:r,translationVariables:c,language:s,isQuestionBgDark:l,isMobile:p,isWidget:d,widgetStyle:u})=>{const b=e.type_info?.form_fields?.layout,M=e.type_info?.form_fields?.fields;return t.createElement("div",{className:`fsc-form-field-container layout-${(p||d&&"compact"===u?"VERTICAL":b??"VERTICAL").toLowerCase()}`.trim()},M?.map(((p,d)=>{const u="NUMBER"===p?.type||"PHONE"===p.type?18:256;return t.createElement("div",{className:"fsc-form-field",key:p.id},"DATE"!==p?.type&&"DATE_TIME"!==p?.type?t.createElement(t.Fragment,null,"PHONE"===p.type?t.createElement(Za,{key:d,surveyLayout:o??"card",setFocus:0===d&&"standard"!==o,autoFocusDelay:n,label:p?.label||"",type:"tel",isRequired:!!p.required,showCount:!0,maxLength:u,value:p.id&&i[e.name]?.[p.id]||"",onChangeHandler:(t,n)=>{p.id&&a({...i[e.name]??{},[p.id]:t||null},!0)},isErrored:!(!p.id||!i?.[e.name]?.[p.id])&&!!r?.[p?.id||""],errorText:p.id&&i[e.name]?.[p.id]?r?.[p?.id]:"",translationVariables:c}):t.createElement(Xa,{isQuestionBgDark:l,key:d,setFocus:0===d&&"standard"!==o,autoFocusDelay:n,onKeyDown:e=>{"PHONE"===p?.type&&Ba(e),"NUMBER"===p?.type&&$a(e)},showCount:!0,maxLength:u,placeholder:"NUMBER"===p?.type?"0":void 0,label:p?.label||"",type:A5(p?.type??"TEXT"),isRequired:!!p.required,value:p.id?i[e.name]?.[p.id]??"":"",onChange:t=>{p.id&&a({...i[e.name]??{},[p.id]:t.target.value.slice(0,u)||null})},onBlur:t=>{if(p.id){const n=i[e.name]?.[p.id],o=t.target.value.slice(0,u);(ya(n)||Wa(n))&&(ya(o)||Wa(o))||a?.({...i[e.name]??{},[p.id]:o||null},!1)}},isErrored:!(!p.id||!i?.[e.name]?.[p.id])&&!!r?.[p?.id||""],errorText:p.id&&i[e.name]?.[p.id]?r?.[p?.id]:""})):t.createElement(t.Fragment,null,"DATE_TIME"===p?.type?t.createElement(Fq,{id:p.id??"",name:e.name??"",label:p?.label??"",isRequired:!!p.required,allowOnlyFuture:!!e.type_info?.meta?.allow_future_date,language:s,useAmPm:!e.type_info?.meta?.time_format,showTimezoneSelect:!1,onChange:t=>{a({...i[e.name]??{},...p.id&&{[p.id]:t}},!0)},value:p?.id&&i[e?.name]?.[p?.id],type:"FORM_FIELD",translationVariables:c}):t.createElement(jq,{id:p.id??"",name:e.name??"",label:p?.label??"",isRequired:!!p.required,allowOnlyFuture:!!e.type_info?.meta?.allow_future_date,language:s,onChange:t=>{a({...i[e.name]??{},...p.id&&{[p.id]:t}},!0)},value:p?.id&&i[e?.name]?.[p?.id],type:"FORM_FIELD",translationVariables:c})))})))};var g5="rovingFocusGroup.onEntryFocus",y5={bubbles:!1,cancelable:!0},q5="RovingFocusGroup",[W5,w5,L5]=bt(q5),[R5,C5]=Pe(q5,[L5]),[x5,k5]=R5(q5),T5=b(((e,t)=>y(W5.Provider,{scope:e.__scopeRovingFocusGroup,children:y(W5.Slot,{scope:e.__scopeRovingFocusGroup,children:y(S5,{...e,ref:t})})})));T5.displayName=q5;var S5=b(((e,t)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:l,currentTabStopId:p,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:u,onEntryFocus:b,preventScrollOnEntryFocus:M=!1,...z}=e,m=r(null),h=Ne(t,m),f=zt(l),[O=null,A]=He({prop:p,defaultProp:d,onChange:u}),[v,g]=s(!1),q=_e(b),W=w5(a),w=r(!1),[L,R]=s(0);return c((()=>{const e=m.current;if(e)return e.addEventListener(g5,q),()=>e.removeEventListener(g5,q)}),[q]),y(x5,{scope:a,orientation:o,dir:f,loop:i,currentTabStopId:O,onItemFocus:n((e=>A(e)),[A]),onItemShiftTab:n((()=>g(!0)),[]),onFocusableItemAdd:n((()=>R((e=>e+1))),[]),onFocusableItemRemove:n((()=>R((e=>e-1))),[]),children:y(Ke.div,{tabIndex:v||0===L?-1:0,"data-orientation":o,...z,ref:h,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,(()=>{w.current=!0})),onFocus:Be(e.onFocus,(e=>{const t=!w.current;if(e.target===e.currentTarget&&t&&!v){const t=new CustomEvent(g5,y5);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=W().filter((e=>e.focusable));$5([e.find((e=>e.active)),e.find((e=>e.id===O)),...e].filter(Boolean).map((e=>e.ref.current)),M)}}w.current=!1})),onBlur:Be(e.onBlur,(()=>g(!1)))})})})),E5="RovingFocusGroupItem",N5=b(((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:o=!1,tabStopId:i,...r}=e,s=Bt(),l=i||s,p=k5(E5,n),d=p.currentTabStopId===l,u=w5(n),{onFocusableItemAdd:b,onFocusableItemRemove:M}=p;return c((()=>{if(a)return b(),()=>M()}),[a,b,M]),y(W5.ItemSlot,{scope:n,id:l,focusable:a,active:o,children:y(Ke.span,{tabIndex:d?0:-1,"data-orientation":p.orientation,...r,ref:t,onMouseDown:Be(e.onMouseDown,(e=>{a?p.onItemFocus(l):e.preventDefault()})),onFocus:Be(e.onFocus,(()=>p.onItemFocus(l))),onKeyDown:Be(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void p.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const a=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(a)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)?void 0:P5[a]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=u().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)n.reverse();else if("prev"===t||"next"===t){"prev"===t&&n.reverse();const a=n.indexOf(e.currentTarget);n=p.loop?function(e,t){return e.map(((n,a)=>e[(t+a)%e.length]))}(n,a+1):n.slice(a+1)}setTimeout((()=>$5(n)))}}))})})}));N5.displayName=E5;var P5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $5(e,t=!1){const n=document.activeElement;for(const a of e){if(a===n)return;if(a.focus({preventScroll:t}),document.activeElement!==n)return}}var B5=T5,_5=N5,H5="Radio",[D5,I5]=Pe(H5),[V5,X5]=D5(H5),j5=b(((e,t)=>{const{__scopeRadio:n,name:a,checked:o=!1,required:i,disabled:c,value:l="on",onCheck:p,form:d,...u}=e,[b,M]=s(null),z=Ne(t,(e=>M(e))),m=r(!1),h=!b||(d||!!b.closest("form"));return W(V5,{scope:n,checked:o,disabled:c,children:[y(Ke.button,{type:"button",role:"radio","aria-checked":o,"data-state":Y5(o),"data-disabled":c?"":void 0,disabled:c,value:l,...u,ref:z,onClick:Be(e.onClick,(e=>{o||p?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())}))}),h&&y(G5,{control:b,bubbles:!m.current,name:a,value:l,checked:o,required:i,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})}));j5.displayName=H5;var F5="RadioIndicator",U5=b(((e,t)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=X5(F5,n);return y(Xe,{present:a||i.checked,children:y(Ke.span,{"data-state":Y5(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t})})}));U5.displayName=F5;var G5=e=>{const{control:t,checked:n,bubbles:a=!0,...o}=e,i=r(null),s=De(n),l=Ve(t);return c((()=>{const e=i.current,t=window.HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==n&&o){const t=new Event("click",{bubbles:a});o.call(e,n),e.dispatchEvent(t)}}),[s,n,a]),y("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Y5(e){return e?"checked":"unchecked"}var Z5=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],K5="RadioGroup",[Q5,J5]=Pe(K5,[C5,I5]),e4=C5(),t4=I5(),[n4,a4]=Q5(K5),o4=b(((e,t)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:r=!1,disabled:c=!1,orientation:s,dir:l,loop:p=!0,onValueChange:d,...u}=e,b=e4(n),M=zt(l),[z,m]=He({prop:i,defaultProp:o,onChange:d});return y(n4,{scope:n,name:a,required:r,disabled:c,value:z,onValueChange:m,children:y(B5,{asChild:!0,...b,orientation:s,dir:M,loop:p,children:y(Ke.div,{role:"radiogroup","aria-required":r,"aria-orientation":s,"data-disabled":c?"":void 0,dir:M,...u,ref:t})})})}));o4.displayName=K5;var i4="RadioGroupItem",r4=b(((e,t)=>{const{__scopeRadioGroup:n,disabled:a,...o}=e,i=a4(i4,n),s=i.disabled||a,l=e4(n),p=t4(n),d=r(null),u=Ne(t,d),b=i.value===o.value,M=r(!1);return c((()=>{const e=e=>{Z5.includes(e.key)&&(M.current=!0)},t=()=>M.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}}),[]),y(_5,{asChild:!0,...l,focusable:!s,active:b,children:y(j5,{disabled:s,required:i.required,checked:b,...p,...o,name:i.name,ref:u,onCheck:()=>i.onValueChange(o.value),onKeyDown:Be((e=>{"Enter"===e.key&&e.preventDefault()})),onFocus:Be(o.onFocus,(()=>{M.current&&d.current?.click()}))})})}));r4.displayName=i4;var c4=b(((e,t)=>{const{__scopeRadioGroup:n,...a}=e,o=t4(n);return y(U5,{...o,...a,ref:t})}));c4.displayName="RadioGroupIndicator";var s4=o4,l4=r4,p4=c4;const d4=e=>{const{checked:n,className:a,disabled:o,id:i,isRequired:r,label:c,name:s,readOnly:l,onChange:p,...d}=e;return t.createElement(s4,{className:`fsc-radio ${a??""}`.trim(),name:s,"aria-label":c||"Radio button",value:n?"default":"",required:r,disabled:o,"aria-readonly":l,onValueChange:e=>{p?.(!n,e)},...d},t.createElement("div",{className:"fsc-radio-container"},t.createElement(l4,{checked:n,"aria-checked":n,className:"fsc-radio-item",disabled:o,"aria-readonly":l,id:i,value:"default"},t.createElement(p4,{className:"fsc-radio-indicator"})),c&&t.createElement("label",{htmlFor:i,className:"fsc-radio-label"},c,c&&r&&t.createElement("span",null,"*"))))},u4=e=>{const{type_info:{matrix_properties:n},onChangeHandler:a,value:o}=e;return t.createElement("div",{className:"matrix-container","data-test-input":"matrix"},t.createElement("table",{className:"st-mt-table"},t.createElement("thead",{className:"st-mt-thead"},t.createElement("tr",{className:"st-mt-tr"},t.createElement("th",{className:"m-s-b-s-q-m-s-th-empty st-mt-th"}),n?.rating_labels?.map(((e,n)=>e.is_active?t.createElement("th",{key:e.id,className:"m-s-b-s-q-m-s-th st-mt-th"},t.createElement("div",{className:"m-s-b-s-q-m-s-th-div"},e.text)):null)))),t.createElement("tbody",{className:"st-mt-tbody"},n?.statements?.map(((e,i)=>e.is_active?t.createElement("tr",{key:e.id,className:"m-s-b-s-q-m-s-tr-hover st-mt-tr"},t.createElement("td",{className:"m-s-b-s-q-m-s-input st-mt-td"},e.text),n?.rating_labels?.map(((r,c)=>{if(!r.is_active)return null;const s=o?.find((t=>t?.statement_id===e?.id));return t.createElement("td",{key:r.id,className:"m-s-b-s-q-m-s-switch st-mt-td"},"SINGLE_ANSWER"===n?.type&&t.createElement(d4,{key:r.id||`${i}-key-${c}`,name:`q-m-s-radio-${i}-key-${c}`,checked:!!s?.rating_labels?.find((e=>e?.id===r?.id)),id:r.id??"",onChange:()=>{e?.id&&r?.id&&a(s?.statement_id?[...o||[]].map((e=>e?.statement_id===s?.statement_id?{...s,rating_labels:[{id:r.id||"",text:r?.text||""}]}:e)):[...o||[],{statement_id:e.id,rating_labels:[{id:r.id,text:r?.text||""}]}])},label:""}),"MULTIPLE_ANSWERS"===n?.type&&t.createElement(dt,{key:r.id||`${i}-key-${c}`,name:`q-m-s-checkbox-${i}-key-${c}`,checked:!!s?.rating_labels?.find((e=>e?.id===r?.id)),id:r.id??"",onChange:t=>{e?.id&&r?.id&&a(s?.statement_id?[...o||[]].map((e=>e.statement_id===s.statement_id?{...s,rating_labels:t?[...s.rating_labels||[],{id:r.id||"",text:r?.text||""}]:(s.rating_labels||[]).filter((e=>e?.id!==r.id))}:e)):[...o||[],{statement_id:e.id,rating_labels:[{id:r.id,text:r?.text||""}]}])}}))}))):null)))))},b4=e=>{const{type_info:{matrix_properties:n},onChangeHandler:a,name:o,isMobile:i,isReverseAnimation:r,statementIndex:c,value:s,widgetStyle:l,language:p="en"}=e,d=t.useMemo((()=>(n?.statements||[]).find(((e,t)=>t===c))),[n?.statements,c]),u=t.useMemo((()=>s?.find((e=>e?.statement_id===d?.id))),[d,s]);return t.createElement("div",{className:"matrix-wd-container","data-test-input":"matrix"},t.createElement("div",{className:"matrix-st-count"},`${c+1}/${(n?.statements||[]).length}`),t.createElement(HT,{exitBeforeEnter:!0},t.createElement(NT.div,{key:`${d?.id??""}`,initial:{opacity:0,x:La(p,r)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(p,r)},transition:{duration:.2}},t.createElement("div",{className:"matrix-st-text"},d?.text),t.createElement("div",{className:`matrix-st-labels wd-style-${l} ${i?"mt-mobile":""}`.trim()},"MULTIPLE_ANSWERS"===n?.type&&t.createElement(h$,{name:o??"",onChangeHandler:e=>{if(d?.id){const t=u?.statement_id?[...s||[]].map((t=>t.statement_id===u.statement_id?{...u,rating_labels:e.map((e=>{const t=n?.rating_labels?.find((t=>t.id===e));return{id:e,text:t?.text||""}}))}:t)):[...s||[],{statement_id:d.id,rating_labels:e.map((e=>{const t=n?.rating_labels?.find((t=>t.id===e));return{id:e,text:t?.text||""}}))}];a(t)}},saveOthersValue:()=>{},options:(n?.rating_labels??[]).map((e=>({id:e.id,value:e.text}))),values:(u?.rating_labels??[]).map((e=>e.id??"")),autoFocusDelay:0,othersValue:""}),"SINGLE_ANSWER"===n?.type&&t.createElement(DT,{name:o??"",language:p||"en",onChangeHandler:e=>{const t=n?.rating_labels?.find((t=>t.id===e));d?.id&&e&&a(u?.statement_id?[...s||[]].map((n=>n?.statement_id===u?.statement_id?{...u,rating_labels:[{id:e||"",text:t?.text||""}]}:n)):[...s||[],{statement_id:d.id,rating_labels:[{id:e,text:t?.text||""}]}])},saveOthersValue:()=>{},options:(n?.rating_labels??[]).map((e=>({id:e.id,value:e.text}))),value:u?.rating_labels?.[0]?.id??"",othersValue:""})))))},M4=({question:e,autoFocusDelay:n,setFocus:a,formValues:o,surveyLayout:i,onChangeHandler:r,isQuestionBgDark:c})=>{const s=e?.type_info?.number_field?.decimal,l=e?.type_info?.number_field?.decimal_point,p=s?2===l?"0.01":"0.1":"1",d=o[e.name],[u,b]=t.useState(d);t.useEffect((()=>{u&&!d&&b(d)}),[d]);const{maxLength:M,maxNumber:z}=t.useMemo((()=>{const e=s?16:18;var t;return{maxLength:e,maxNumber:(t=e)>=16?10n**BigInt(t)-1n:10**t-1}}),[s]),m=e=>{s&&!ya(l)&&(e.split(".")?.[1]?.length??0)>(l??0)||r(e?qa(e,s||!1):"",!1)};return t.createElement("div",{className:"responsive-input-field"},t.createElement(Xa,{autoFocusDelay:n,isRequired:!!e.required,type:"number",step:p,placeholder:e?.type_info?.meta?.placeholder??s?"0.0"+(2===l?"0":""):"0",onKeyDown:e=>{const{key:t,keyCode:n,which:a,code:o}=e;if(["e","E"].includes(t)&&e.currentTarget.value&&e.preventDefault(),"."===t&&s||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||["Backspace","Shift","Tab","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","-","+","e","E"].includes(t))return;if(["e","E"].includes(t))return;const i=void 0===a?n??o:a;String.fromCharCode(i).match(/^[0-9]+$/)||e.preventDefault()},..."card"===i?{value:d??"",onChange:e=>{if(e.target.value.includes("e+"))return;const t=BigInt(e.target.value.split(".")[0]??"");BigInt(t)<=z&&e.target.value.length<=M&&m(e.target.value)}}:{value:u??"",onChange:e=>{if(e.target.value.includes("e+"))return;const t=BigInt(e.target.value.split(".")[0]??""),n=e.target.value.split(".")[1]??"";if(n.length>(l??0))return;const a=BigInt(t);a<=z&&e.target.value.length<=M&&b(`${a}${ya(n)||Wa(n)?"":`.${n}`}`)},onBlur:()=>{return e=u,void((ya(d)||Wa(d))&&(ya(u)||Wa(u))||u===d||m(e));var e}},setFocus:a,showCount:!0,max:`${z}`,maxLength:M,isQuestionBgDark:c}))},z4=({question:e,questionCommentOnchangeHandler:n,commentsMeta:a,setFocus:o,isQuestionBgDark:i,isCommentsEnabled:r})=>{const[c,s]=t.useState(a?.toString());return r?t.createElement(HT,null,t.createElement(NT.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},transition:{duration:.3,ease:"easeInOut"},exit:{height:0,opacity:0},className:"question-comments"},t.createElement(WP,{showCount:!0,maxLength:1500,rows:2,isRequired:!!e.required,placeholder:e?.type_info?.comment_placeholder??"Enter your comment",onChange:t=>{const a=t.target.value||"";s(a),n?.(e.name,a)},value:a||c,setFocus:!0,isQuestionBgDark:i,"aria-label":e.name}))):null},m4=e=>{switch(e){case"EMAIL":return"email";case"PHONE":return"tel";case"URL":return"url";default:return"text"}},h4=e=>{switch(e){case"PHONE":return"phone";case"EMAIL":return"email";case"URL":return"url";default:return""}},f4=({question:e,autoFocusDelay:n,formValues:a,onChangeHandler:o,textboxErrors:i,surveyLayout:r,setFocus:c,onKeyDownHandler:s,translationVariables:l,isQuestionBgDark:p})=>{const d=e?.type_info?.text_field?.text_type,u=a[e.name],[b,M]=t.useState(u);return t.useEffect((()=>{b&&!u&&M(u)}),[u]),t.createElement("div",{className:"responsive-input-field"},"PHONE"===d?t.createElement(Za,{startAdornment:t.createElement(we,{fill:"var(--choices-answers-color, var(--question-text-color, var(--default-question-text-color)))",name:h4(d)}),type:m4(d),setFocus:c,autoFocusDelay:n,label:"",isRequired:!!e.required,value:u,isErrored:!!i[e.name],errorText:i[e.name]||"",placeholder:e?.type_info?.meta?.placeholder??"",onChangeHandler:o,maxLength:18,showCount:!0,onKeyDownHandler:s,surveyLayout:r,translationVariables:l}):t.createElement(Xa,{startAdornment:d&&"TEXT"!==d&&t.createElement(we,{fill:"var(--choices-answers-color, var(--question-text-color, var(--default-question-text-color)))",name:h4(d)}),type:m4(d),setFocus:c,autoFocusDelay:n,showCount:!0,label:"",onKeyDown:s,isRequired:!!e.required,isErrored:!!i[e.name],errorText:i[e.name]||"",placeholder:e?.type_info?.meta?.placeholder??"",..."card"===r?{value:u??"",onChange:e=>o(e.target.value)}:{onBlur:e=>{(ya(u)||Wa(u))&&(ya(b)||Wa(b))||b===u||o?.(e.target.value,!0)},value:b??"",onChange:e=>M(e.target.value)},maxLength:50,isQuestionBgDark:p}))},O4=({surveyLanguage:e,language:n="en",question:a,formValues:o,othersMeta:i,onChangeHandler:r,saveOthersValue:c,autoFocusDelay:s,isFinalQn:l,isWidget:p,isMobile:d,initialPivotAnswer:u,initialQuestionAnswer:b,isInitialTransition:M,formQuestionErrors:z,dateQuestionErrors:m,contactFormErrors:h,activeIndexOfRenderedStatement:f={},textboxQuestionErrors:O,isReverseAnimation:A,fileUploadErrors:v,preview:g,onFileUpload:y,widgetStyle:q="default",setErrors:W,translationVariables:w,surveyServAssetUrl:L,setFocus:R,block:C,onKeyDown:x,surveyStyle:k,isQuestionBgDark:T})=>{const S=a?.type_info?.question_comment,E=a?.type_info?.footer_text&&a.type_info.meta?.question_hint?t.createElement("div",{className:"footer question-hint ss-question-hint",role:"note",dangerouslySetInnerHTML:{__html:a?.type_info?.footer_text}}):t.createElement(t.Fragment,null),N=o[a.name],[P,$]=t.useState(N);switch(t.useEffect((()=>{P&&!N&&$(N)}),[N]),a?.type_info?.question_type){case"MATRIX_RATING_SCALE":return t.createElement(t.Fragment,null,p||d?t.createElement(b4,{language:n,name:a.name,isReverseAnimation:A,type_info:a?.type_info||{},onChangeHandler:e=>{r(e?.filter((e=>(e.rating_labels||[]).length>0)))},isMobile:d,value:o[a.name]||[],statementIndex:f[a.name]??0,widgetStyle:q}):t.createElement(u4,{type_info:a?.type_info||{},onChangeHandler:e=>{r(e?.filter((e=>(e.rating_labels||[]).length>0)))},value:o[a.name]||[]}),E);case"RANGE":return t.createElement(t.Fragment,null,t.createElement(XT,{question:a,onChangeHandler:r,isWidget:p,isMobile:d,widgetStyle:q,value:o[a.name],initialPivotAnswer:u,isInitialTransition:M}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"CHECKBOX":case"MULTI_SELECT":return t.createElement(t.Fragment,null,t.createElement(h$,{name:a.name,values:o[a.name],othersValue:i[a.name],options:a?.choices||[],onChangeHandler:r,saveOthersValue:c,isOthersOption:!!(a?.choices||[]).find((e=>e.meta?.is_others)),othersRequired:!!a?.type_info.meta?.othersRequired,autoFocusDelay:s,translationVariables:w,othersInputPlaceholder:a?.type_info?.comment_placeholder}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"RADIO":case"DROPDOWN":return t.createElement(t.Fragment,null,t.createElement(DT,{autoFocusDelay:s,name:a.name,onChangeHandler:r,initialQuestionAnswer:b,displayFormat:a?.type_info?.meta?.display_format||"LIST",saveOthersValue:c,options:a?.choices||[],value:o[a.name],othersValue:i[a.name],isOthersOption:!!(a?.choices||[]).find((e=>e.meta?.is_others)),language:n||"en",othersRequired:!!a?.type_info.meta?.othersRequired,isFinalQn:l,translationVariables:w,isQuestionBgDark:T,othersInputPlaceholder:a?.type_info?.comment_placeholder}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"TEXT":return t.createElement(t.Fragment,null,t.createElement(f4,{question:a,autoFocusDelay:s,formValues:o,onChangeHandler:r,textboxErrors:O||"",setFocus:R,onKeyDownHandler:x,surveyLayout:k??"card",translationVariables:w,isQuestionBgDark:T}),E);case"NUMBER":return t.createElement(t.Fragment,null,t.createElement(M4,{question:a,autoFocusDelay:s,formValues:o,setFocus:R,onChangeHandler:r,surveyLayout:k??"card",isQuestionBgDark:T}),E);case"FORM_FIELD":return t.createElement(t.Fragment,null,t.createElement(v5,{widgetStyle:q,question:a,isWidget:p,isMobile:d,surveyStyle:k,isRequired:!!a.required,autoFocusDelay:s,translationVariables:w,onChangeHandler:(e,t)=>{r(e,"card"!==k&&t)},formValues:o,fieldErrors:z?.[a.name]||{},language:n||"en",isQuestionBgDark:T}),E);case"CONTACT_FORM":return t.createElement(t.Fragment,null,t.createElement(O$,{question:a,setFocus:R,autoFocusDelay:s,onChangeHandler:r,translationVariables:w,formValues:o,fieldErrors:h?.[a.name]||{},language:n||"en",isQuestionBgDark:T}),E);case"PARAGRAPH":return t.createElement(t.Fragment,null,t.createElement(WP,{showCount:!0,maxLength:1500,autoFocusDelay:s,isRequired:!!a.required,placeholder:a?.type_info?.meta?.placeholder??"",..."card"===k?{value:N??"",onChange:e=>r(e.target.value)}:{onBlur:e=>{(ya(N)||Wa(N))&&(ya(P)||Wa(P))||P===N||r?.(e.target.value,!0)},value:P??"",onChange:e=>$(e.target.value)},setFocus:R,isQuestionBgDark:T,"aria-label":a.name}),E);case"BOOLEAN":case"RESOLUTION":return t.createElement(t.Fragment,null,t.createElement(xe,{type_info:a?.type_info,onSelect:r,value:o[a.name]}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"MESSAGE":return E;case"CONSENT":return t.createElement(t.Fragment,null,t.createElement(f$,{question:a,onChange:r,value:o[a.name]}),E);case"SLIDER":const e=a?.type_info.meta?.slider;return t.createElement(t.Fragment,null,t.createElement(yP,{defaultValue:[o[a.name]??e?.opening_position],isRequired:!!a.required,dir:wa(n)?"rtl":"ltr",answer:o[a.name],min:e?.min,max:e?.max,onValueChange:([e],t)=>r(e,"card"!==k&&t),isInput:e?.numerical_input_box,gridLines:e?.grid_lines,stopAtGrid:e?.stop_at_grid_lines,allowDecimals:e?.allow_decimal,decimalPoints:e?.decimal_points,isMobile:d||"compact"===q}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"RANK_ORDER":const{others_meta:v,...C}=o;return t.createElement(t.Fragment,null,t.createElement(wN,{valueItems:C[a.name],items:a?.choices||[],onReorder:(e,t)=>r(e,"card"!==k&&t)}),E);case"DATE_TIME":return t.createElement(t.Fragment,null,"DATE_TIME"===a.type_info.meta?.question_format?t.createElement(Fq,{id:a.id??"",name:a.name??"",type:"QUESTION",displayFormat:a.type_info.meta?.format??void 0,allowOnlyFuture:a.type_info.meta?.allow_future_date||!1,useAmPm:!a.type_info.meta?.time_format,showTimezoneSelect:!!a.type_info.meta?.time_zone,onChange:(e,t)=>{r(e,"card"!==k&&t)},setErrors:e=>{W((t=>({...t,dateQuestionErrors:e})))},fieldErrors:m?.[a.name]??[],value:o[a.name]||"",translationVariables:w,language:n||"en",isQuestionBgDark:T,isWidget:p}):t.createElement(jq,{allowOnlyFuture:a.type_info.meta?.allow_future_date||!1,type:"QUESTION",displayFormat:a.type_info.meta?.format??void 0,onChange:e=>{r(e,!1)},value:o[a.name]||"",translationVariables:w,language:n||"en",fieldErrors:m?.[a.name]??[],isQuestionBgDark:T,isWidget:p}),E);case"FILE":return t.createElement(O5,{setErrors:e=>{W({formQuestionErrors:z,textboxQuestionErrors:O,contactFormErrors:h,fileUploadErrors:e,dateQuestionErrors:m})},preview:g,onChangeHandler:r,question:a,onFileUpload:y,value:o[a.name]||"",translationVariables:w,surveyServAssetUrl:L});default:return console.error(`Question type ${a?.type_info?.question_type} not found`),null}},A4=({surveyServAssetUrl:e,thankYouQuestion:n,preview:a,placeholders:o,canResubmit:i,resetSurvey:r,navigateToStart:l,isMobile:p,allowMultipleSubmission:d,pivot:u,answers:b,questions:M,rangeToRender:z,translationVariables:m})=>{const{redirectUrl:h,redirectDelay:f,show_custom_button:O,show_review_links:A,show_social_links:v,image_url:g}=n?.type_info?.meta??{},[y,q]=s(f??10),[W,w]=t.useState(!1);return c((()=>{if(!a&&h){const e=setInterval((()=>q((e=>e>1?e-1:("undefined"!=typeof window&&(window.location.href=h??""),0)))),1e3);return()=>{clearInterval(e),w(!1)}}return()=>{w(!1)}}),[]),t.createElement("div",{className:"question-container ss-question-container thankyou"},g&&t.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:g,alt:"thankyou_logo"}),t.createElement(t.Fragment,null,Ca(n)),t.createElement("div",{className:"text ss-thankyou-message",dangerouslySetInnerHTML:{__html:ka({questionText:n.text,placeholders:o,npsRating:Ta({theme:"nps",answers:b,questions:M})??"",npsRatingLabel:Sa({theme:"nps",answers:b,questions:M}),csatRating:Ta({theme:"csat",answers:b,questions:M})??"",csatRatingLabel:Sa({theme:"csat",answers:b,questions:M}),cesRating:Ta({theme:"ces",answers:b,questions:M})??"",cesRatingLabel:Sa({theme:"ces",answers:b,questions:M}),preference:u?.question.type_info?.scale_properties?.labels?.preference,isPreview:a})}}),(i||d)&&t.createElement("div",{className:("wrap-up-actions "+(p?"mobile":"")).trim()},i&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:W,onClick:()=>{w(!0),l()},"aria-label":m?.edit_response||"Edit your response"},t.createElement(we,{name:"edit"}),m?.edit_response||"Edit your response"),d&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:W,onClick:()=>{w(!0),r()},"aria-label":m?.another_response||"Submit another response"},t.createElement(we,{name:"reload"}),m?.another_response||"Submit another response")),h&&t.createElement("div",{className:"redirection-container"},t.createElement("div",{className:"redirection-text"},Pa(y,m?.redirect_msg),t.createElement("br",null)),t.createElement("a",{className:"link",href:h},h)),(O||A||v)&&t.createElement(m$,{show_custom_button:O,show_review_links:A,show_social_links:v,surveyServAssetUrl:e}))},v4=({activeIndexOfRenderedStatement:e,navigateToPreviousBlock:n,canDisplayDisableButtonParams:a,navigateToNextBlock:o,translationVariables:i,setAnimationInProgress:r,animationInProgress:c,question:s})=>t.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},t.createElement("button",{disabled:c||QP("navigation-prev",a),className:"navigation-button ss-navigation-button",onClick:()=>{r(!0),setTimeout((()=>{r(!1)}),se),n()},title:s.name&&(e?.[s.name]??0)>0?i?.prev_statement||"go to previous statement":i?.prev_question||"go to previous question"},t.createElement(we,{name:"arrow-previous"})),t.createElement("button",{className:"navigation-button ss-navigation-button",disabled:c||QP("navigation-next",a),title:i?.next_question||"Go to next question",onClick:()=>{r(!0),setTimeout((()=>{r(!1)}),se),o()}},t.createElement(we,{name:"arrow-next"}))),g4=e=>{const{initialStatementHasAnswer:n,answers:a,renderedBlocks:o,blocks:i,activeIndexOfBlocks:r,activeIndexOfRenderedStatement:c={},activeIndexOfRenderedBlocks:l,saveFormValues:p,onSubmitHandler:d,skipBlock:u,skipStatement:b,survey:M,navigateToNextBlock:z,navigateToPreviousBlock:m,isInitialTransition:h,initialPivotAnswer:f,translationVariables:O,navigateToNextStatement:A,canDisplayDisableButtonParams:v,formQuestionErrors:g,dateQuestionErrors:y,textboxQuestionErrors:q,contactFormErrors:W,questions:w,pages:L,buttonRef:R,isReverseAnimation:C,isSubmitting:x}=e,[k,T]=s(!1),{question:S}=o[l],E={...v,isSubmitting:x},N=S?.type_info?.meta?.display_format,P=SP({blocks:i,activeIndexOfBlocks:r,renderedBlocks:o,activeIndexOfRenderedBlocks:l,questions:w});return t.createElement(t.Fragment,null,(UP("message",E)||UP("consent",E))&&t.createElement(HT,{exitBeforeEnter:!0},t.createElement(NT.div,{key:S.name??"",id:`consent-buttons-${S.name??""}`,className:"question-consent-buttons ss-consent-action-buttons",initial:{opacity:0,x:La(e.language,C)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(e.language,C)},transition:{duration:.2}},UP("consent",E)&&"BUTTON"===N&&fe.map((e=>t.createElement(Te,{key:l+String(e.recordAs),onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),p(o[l],e.recordAs,!0)},disabled:k||QP("consent",E),variant:ya(a.formValues?.[S.name])||a.formValues?.[S.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(a.formValues?.[S.name]===e.recordAs?"selected":"")).trim()},S?.type_info?.scale_properties?.labels?.values?.[e.id]||e.defaultValue))),UP("message",E)&&t.createElement(Te,{onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),P?d("COMPLETE"):u()},disabled:k||QP("message",E),className:"message-button ss-action-message-button"},S?.type_info?.scale_properties?.labels?.values?.[0]||"Begin"))),(UP("navigation",E)||UP("next",E)||UP("next-statement",E)||UP("submit",E)||UP("skip",E)||UP("skip-statement",E))&&t.createElement("div",{className:"question-footer ss-question-footer-container"},UP("navigation",E)?t.createElement(v4,{animationInProgress:k,setAnimationInProgress:T,answers:a,canDisplayDisableButtonParams:E,activeIndexOfBlocks:r,activeIndexOfRenderedBlocks:l,renderedBlocks:o,initialStatementHasAnswer:n,blocks:i,activeIndexOfRenderedStatement:c,navigateToNextBlock:z,navigateToPreviousBlock:m,translationVariables:O,pages:L,question:S}):t.createElement("div",null),t.createElement("div",{className:"action-buttons ss-action-buttons"},UP("skip",E)&&t.createElement(Te,{className:"skip-button ss-action-skip-button",onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),u()},variant:"secondary","aria-label":"skip question",disabled:k||x},e?.survey?.meta?.action_button?.skip||O?.actionButtonText?.skip||O?.skip||"Skip"),UP("skip-statement",E)&&t.createElement(Te,{className:"skip-button ss-action-skip-button",onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),b()},"aria-label":"skip statement",variant:"secondary",disabled:k||x},e?.survey?.meta?.action_button?.skip||O?.actionButtonText?.skip||O?.skip||"Skip"),UP("next",E)&&t.createElement(Te,{ref:R,onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),0!==l||!h||"RANGE"!==S.type_info?.question_type&&"BOOLEAN"!==S.type_info?.question_type||S.type_info?.question_comment||void 0===f?p(o[l],"CHECKBOX"===S?.type_info?.meta?.display_format&&"CONSENT"===S?.type_info?.question_type?a.formValues[S.name]??!1:a.formValues[S.name],!0):p(o[l],f,!0)},disabled:k||QP("next",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||O?.actionButtonText?.next||O?.next||"Next"),UP("next-statement",E)&&t.createElement(Te,{ref:R,onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),A?.(S.name)},disabled:k||!!QP("next-statement",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||O?.actionButtonText?.next||O?.next||"Next"),UP("submit",E)&&t.createElement("div",{className:"submit ss-action-submit-button"},t.createElement(Te,{ref:R,disabled:k||QP("submit",E),onClick:()=>{Wa(y?.[S.name])&&Wa(g?.[S.name])&&Wa(q?.[S.name])&&Wa(W?.[S.name])&&(T(!0),setTimeout((()=>{T(!1)}),se),d("COMPLETE"))}},M?.meta?.action_button?.submit||O?.actionButtonText?.submit||O?.submit_survey||"Submit")))))},y4=e=>{const{blocks:n,pages:a,activePage:i,renderedBlocks:l,activeBlock:p,activeIndexOfBlocks:d,activeIndexOfRenderedBlocks:u,isSurveyCompleted:b,isReverseAnimation:M,saveFormValues:z,saveOthersValue:m,skipBlock:h,skipStatement:f,onSubmitHandler:O,navigateToNextBlock:A,navigateToPreviousBlock:v,answers:g,questions:y,pivot:q,isInitialTransition:W,resetSurvey:w,activeIndexOfRenderedStatement:L,navigateToNextStatement:R,navigateToPreviousStatement:C,navigateToStart:x,translationVariables:k,initialStatementHasAnswer:T,dateQuestionErrors:S,formQuestionErrors:E,textboxQuestionErrors:N,contactFormErrors:P,fileUploadErrors:$,setErrors:B,expanded:_,setExpanded:H,isQuestionBgDark:D,isSubmitting:I}=d$(e);Da("Card",{...e,answers:g,activePage:i,activeBlock:p,renderedBlocks:l,activeIndexOfBlocks:d,activeIndexOfRenderedBlocks:u,activeIndexOfRenderedStatement:L});const V=r(null),X=Wa(g.formValues)&&e.survey.prompt_settings?.is_enabled&&e.preview,[j,F]=s(X),U=t.useMemo((()=>xa(q?.question)),[q?.question]),G=o((()=>n.filter((({name:e},t,n)=>!BP({nextBlockName:e||"",blocks:n,questions:y}))).length),[n,y]);c((()=>{p&&e.onBlockChange?.(p,i)}),[p,e]),c((()=>{e.survey.theme&&Ea(e.survey.theme,e.surveyServAssetUrl??"")}),[e.survey.theme,e.surveyServAssetUrl]),c((()=>{e.getSurveyProgress?.({totalBlocks:G,isSurveyCompleted:b,noOfAnswers:d})}),[G,b,d]);const Y={answers:g,blocks:n,blockIndex:u,activeIndexOfBlocks:d,initialStatementHasAnswer:T,activeIndexOfRenderedBlocks:u,activeIndexOfRenderedStatement:L,renderedBlocks:l,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:W,questions:y,pages:a,activeIndexOfSet:0,branchSeparatePage:!1,pivot:q};return p&&p.question?t.createElement("div",{className:`freemium-survey-components card-survey-style ${wa(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${e.isMobile?"mobile-preview":""}`.trim(),id:"freemium-survey"},t.createElement("div",{className:("question-holder "+(j?"prompt":"")).trim()},!b&&!j&&!e.isWidget&&a.length>0&&i?.page_id&&t.createElement(u$,{expanded:_,id:i.page_id,setExpanded:H,activePage:i,translationVariables:k}),t.createElement("div",{className:"questions ss-questions"},b?t.createElement(A4,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:EP({pivotQn:q?.question,pivotQnAnswer:q?.answer,block:_P({activeBlock:p,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:g,questions:y,activeIndexOfBlocks:d,renderedBlocks:l,contactData:e.contactData,surveyLayout:"card",pages:a}),questions:y}),canResubmit:e.canResubmit,allowMultipleSubmission:e.allowMultipleSubmission,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",x):x()},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",w):w()},preview:!!e.preview,placeholders:e.placeholders,isMobile:e.isMobile,pivot:q,rangeToRender:U,translationVariables:k,answers:g}):t.createElement(t.Fragment,null,!j&&e.isWidget&&a.length>0&&i?.page_id&&t.createElement(u$,{expanded:_,id:i.page_id,setExpanded:H,activePage:i,translationVariables:k}),t.createElement(HT,{exitBeforeEnter:!0},t.createElement(NT.div,{id:`${p.question.name}`,className:"question-container ss-question-container","data-test-question-name":p.question.name,key:`${p.question.name}`,initial:{opacity:0,x:La(e.language,M)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(e.language,M)},transition:{duration:.2}},j&&e.survey.prompt_settings?t.createElement(M$,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt?.(t),1===t&&F(!1)},placeholders:e.placeholders,isPreview:!!e.preview}):t.createElement(t.Fragment,null,t.createElement("div",{className:("question-text ss-question-text "+(p.required?"required":"")).trim(),dangerouslySetInnerHTML:{__html:ka({questionText:p?.question.text,placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:g,questions:y})??"",npsRatingLabel:Sa({theme:"nps",answers:g,questions:y}),csatRating:Ta({theme:"csat",answers:g,questions:y})??"",csatRatingLabel:Sa({theme:"csat",answers:g,questions:y}),cesRating:Ta({theme:"ces",answers:g,questions:y})??"",cesRatingLabel:Sa({theme:"ces",answers:g,questions:y}),preference:q?.question.type_info?.scale_properties?.labels?.preference,isPreview:!!e.preview})},"aria-label":`question-${u}`,role:"heading","aria-level":1}),t.createElement(O4,{setFocus:!0,onKeyDown:e=>{"Enter"===e.key&&V.current&&V.current.click()},isReverseAnimation:M,preview:!!e.preview,surveyServAssetUrl:e.surveyServAssetUrl,setErrors:B,onFileUpload:e.onFileUpload,language:e.language||"en",surveyStyle:e.surveyStyle,surveyLanguage:e.survey.language,block:p,question:p.question,isFinalQn:SP({blocks:n,activeIndexOfBlocks:d,renderedBlocks:l,activeIndexOfRenderedBlocks:u,questions:y}),formValues:g.formValues,othersMeta:g.others,autoFocusDelay:"standard"===e.surveyStyle?350:0,activeIndexOfRenderedStatement:L,saveOthersValue:m,onChangeHandler:(e,t)=>{z(p,e,t)},isMobile:!!e.isMobile,initialPivotAnswer:e.initialPivotAnswer,initialQuestionAnswer:e.initialQuestionAnswer,isInitialTransition:W,formQuestionErrors:E,dateQuestionErrors:S,textboxQuestionErrors:N,fileUploadErrors:$,contactFormErrors:P,translationVariables:k,isQuestionBgDark:D})))),!j&&t.createElement(g4,{isWidget:!1,language:e.language||"en",isReverseAnimation:M,surveyStyle:e.surveyStyle,canDisplayDisableButtonParams:Y,answers:g,renderedBlocks:l,blocks:n,pages:a,activeIndexOfRenderedStatement:L,buttonRef:V,survey:e.survey,initialStatementHasAnswer:T,navigateToNextStatement:R,navigateToPreviousStatement:C,activeIndexOfRenderedBlocks:u,activeIndexOfBlocks:d,saveFormValues:z,skipBlock:h,skipStatement:f,onSubmitHandler:O,navigateToPreviousBlock:v,navigateToNextBlock:A,isInitialTransition:W,initialPivotAnswer:e.initialPivotAnswer,isMobile:!!e.isMobile,translationVariables:k,formQuestionErrors:E,dateQuestionErrors:S,textboxQuestionErrors:N,fileUploadErrors:$,contactFormErrors:P,questions:y,isSubmitting:I})))),!e.footerProps?.hideFooter&&(e?.footerProps?.languageDDComponent||e?.footerProps?.showFWBranding||e.footerProps?.footerContent)?t.createElement(Ga,{...e.footerProps,surveyStyle:e.surveyStyle,bgColor:e.survey.theme?.palette?.footer_background??e.survey.theme?.palette?.survey_background??z$}):null):null},q4=e=>{const n=!!e.survey.meta?.branch_separate_page,a=e.survey.question_details?.questions||[],i=e.contactData||{},l=e.translationVariables||{},p=r({}),[d,u]=s(e.survey?.blocks?.filter((e=>"TY"!==e.name&&!e.is_deleted))),[b,M]=s({formQuestionErrors:{},textboxQuestionErrors:{},fileUploadErrors:{},contactFormErrors:{},dateQuestionErrors:{}}),[z,m]=s(!1),[h,f]=s(0),[O,A]=s(e.survey.pages??[]),[v,g]=s(O?.[0]),[y,q]=s(!1),W=o((()=>n$({pages:O,blocks:d,questions:a,initialPivotAnswer:e.initialPivotAnswer,responses:e.answers,answerStatus:e.answerStatus||"PARTIAL",branchSeparatePage:n,surveyLayout:"standard",contactData:i})),[d,a,e.answers]),[w,L]=s(W.renderedBlocks),[R,C]=s(W.activeIndexOfRenderedBlocks),[x,k]=s(0),[T,S]=s(W.activeIndexOfRenderedStatement),E=r(W.pivot),N=r(W.isInitialTransition),[P,$]=s(""),[B,_]=s(W.answers),H=r(((W.isConsideredCompleted||"PARTIAL"===e.answerStatus)&&e.canResubmit)??!1),[D,I]=s(!1),V=w[R],X=t.useMemo((()=>w.length>0?d?.findIndex((e=>e.name===w[R]?.name)):0),[R]),j=o((()=>{const t=e.survey.theme?.palette?.question_background;return!!t&&Ia(t)}),[e.survey.theme?.palette?.question_background]);c((()=>{e.survey.updated_at!==P&&(Da("useEffect",{updated_at:e.survey.updated_at,props:e}),A(e.survey.pages??[]),u(e.survey.blocks?.filter((e=>"TY"!==e.name&&!e.is_deleted))),g(e.survey.pages?.[0]),$(e.survey.updated_at??""))}),[e.survey.updated_at]),c((()=>{Da("useEffect",{renderedBlocks:w,pages:O,activeIndexOfRenderedBlocks:R,props:e});const t=w?.[R]?.page_id,a=O.find((e=>e.page_id===t));O.length>0&&t&&a?.page_id&&g(a),void 0!==w?.[R]?.orderOfSet&&n&&k(w?.[R]?.orderOfSet)}),[w,O,R]),c((()=>{Da("useEffect",{blocks:d,initialPivotAnswer:e.initialPivotAnswer,props:e});let t={...B};if(W.isConsideredCompleted&&N.current&&e.canResubmit)return;const{others_meta:o,...r}=e.answers||{};E.current={...E.current,question:xP({questions:a,blocks:d})};const c=a.find((e=>e.name===d?.[0]?.question_name||e.name===d?.[0]?.question_names?.[0]))??E.current.question;if(Wa(r)||void 0===e.initialPivotAnswer||r[c.name]===e.initialPivotAnswer||(t={...B,formValues:{...B.formValues,[c.name]:e.initialPivotAnswer},moveToNextPage:!0}),void 0!==e.initialPivotAnswer){const n=kP(E.current.question,e.initialPivotAnswer);E.current={...E.current,answer:"BOOLEAN"===c?.type_info?.question_type?Boolean(n):n},t={...B,formValues:{...B.formValues,[c.name]:E.current.answer},moveToNextPage:!1}}else void 0!==e.initialQuestionAnswer&&(t={...B,formValues:{...B.formValues,[c.name]:e.initialQuestionAnswer},moveToNextPage:!1});_(t);const s=EP({pivotQn:E.current.question,pivotQnAnswer:E.current.answer,block:d[0],questions:a}),l=e$({activeBlock:{...d[0],question:s},blocks:d,questions:a,answers:t,pages:O,renderedBlocks:w,contactData:i,surveyLayout:"standard",initialTransition:!0,isEditResponse:H.current,branchSeparatePage:n}),u=[{...d[0],question:s},...l];if(L(n?Va(u,p):u),(e=>{if(null==e||0===Object.keys(e).length)return!0;const t=Object.keys(e).filter((e=>""!==e&&!ya(e)&&"others_meta"!==e));return t.every((t=>!e[t]))&&(!e.others_meta||0===Object.keys(e.others_meta).length)})({others_meta:{},...t.formValues})||N.current)C(d.findIndex((e=>u[0].name===e.name))),k(0);else{const e=u?.[u.length-1];C(u.findIndex((t=>t.name===e?.name))),n&&k(e?.orderOfSet!==x?e?.orderOfSet:0)}S({})}),[d,e.initialPivotAnswer,h]);c((()=>{if(Da("useEffect",{answers:B,blocks:d,props:e}),!(W.isConsideredCompleted&&N.current&&e.canResubmit)&&(!Wa(B.formValues)||B.moveToNextPage)&&d&&F(V,B.commitDirtyValue))if(FP({blocks:d,activeIndexOfBlocks:X,renderedBlocks:w,activeIndexOfRenderedBlocks:R,answers:B,questions:a,activePage:v,pages:O,surveyLayout:"standard"})){if(void 0!==e.initialPivotAnswer&&1===w.length&&N.current&&!B.commitDirtyValue);else if(B.commitDirtyValue){const t=VP({renderedBlocks:w,activeBlock:V,blocks:d,activeIndexOfBlocks:X,answers:B,questions:a,contactData:i,pages:O,surveyLayout:"standard",isDisplayBlock:!0});if(t!==1/0)N.current||!V.question.type_info?.question_type||V.question.type_info?.question_comment||["FORM_FIELD","MULTI_SELECT","RANK_ORDER"].includes(V.question.type_info?.question_type)?U():(e=>{e!==1/0&&setTimeout((()=>{const t=EP({pivotQn:E.current?.question,pivotQnAnswer:E.current?.answer,block:d?.[e],questions:a});if(t?.name){const e=document?.querySelector(`.question-container.standard-card-${t.name}`),n=document?.querySelector(`.question-container.standard-card-${t.name} input`),a=document?.querySelector(`.question-container.standard-card-${t.name} textarea`);e?.scrollIntoView({behavior:"smooth",block:"center",inline:"start"}),setTimeout((()=>{n?.focus(),a?.focus()}),le)}U()}),0)})(t),(!B.moveToNextPage&&!n&&t&&t>0&&d[t-1]?.page_id===d[t]?.page_id||B.moveToNextPage)&&((e,t)=>{if(e===1/0)return;const o=d?.[e];let r=E.current?.question;o?.display_logic?.some((e=>"BASED_ON_RATING_GROUP"===e.logic_type))&&(r=xP({questions:a,blocks:d,displayLogic:o?.display_logic}));const c=EP({pivotQn:r??E.current?.question,pivotQnAnswer:B?.formValues[r?.name]??E.current?.answer,block:o,questions:a}),s=JP({renderedBlocks:w,activeIndexOfRenderedBlocks:R}),l=d?.[e],u=e$({activeBlock:{...l,question:c},answers:B,blocks:d,questions:a,pages:O,renderedBlocks:w,contactData:i,surveyLayout:"standard",isEditResponse:H.current,branchSeparatePage:n}),b=[...s,...c?.name?[{...l,question:c}]:[],...u];S((e=>{const t={...e};return b.forEach((e=>{"MATRIX_RATING_SCALE"===e.question.type_info?.question_type&&(t[e.question.name]=0)})),t}));const M=n?Va(b,p):b;L(M),t||C(s.length)})(t,!B.moveToNextPage&&!n);else{UP("submit",{answers:B,blocks:d,blockIndex:0,activeIndexOfBlocks:X,initialStatementHasAnswer:Y,activeIndexOfRenderedBlocks:R,activeIndexOfRenderedStatement:T,renderedBlocks:w,activePage:v,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:N.current,questions:a,pages:O,contactData:e.contactData,activeIndexOfSet:x,branchSeparatePage:n,isSubmitting:y})||U("COMPLETE")}}}else("MATRIX_RATING_SCALE"===V?.question?.type_info?.question_type||B.commitDirtyValue)&&U()}),[B,d]);const F=(e,t)=>{if(e?.question_name)switch(e.question?.type_info?.question_type){case"DATE_TIME":return!t||i$({answer:B.formValues?.[e.question_name]||"",errorSetter:M,questionName:e.question_name,errors:b,translationVariables:l});case"FORM_FIELD":return o$({fields:e.question?.type_info?.form_fields?.fields,answers:B.formValues?.[e.question_name]||{},errorSetter:M,questionName:e.question_name,errors:b,translationVariables:l});case"TEXT":return r$({type:e.question?.type_info?.text_field?.text_type,answer:B.formValues?.[e.question_name]||"",errorSetter:M,questionName:e.question_name,errors:b,translationVariables:l});case"CONTACT_FORM":return c$({fields:e.question?.type_info?.contact_form?.fields,answers:B.formValues?.[e.question_name]||{},errorSetter:M,questionName:e.question_name,errors:b,translationVariables:l});case"FILE":return s$({errors:b.fileUploadErrors})||!e.required}return!0},U=(t="PARTIAL")=>{let n=()=>{},o=0;if(w.some(((e,t)=>(o=t,!F(e,!0)))))return void C(o);let r={...B.formValues};if("COMPLETE"===t){q(!0),n=()=>{q(!1),I(!0),H.current=!1};r=l$({pages:O,answers:{...B,formValues:r},blocks:d,questions:a,contactData:i,surveyLayout:"standard"})}e.onSubmit({...r,others_meta:B.others},n,t,H.current?"EDIT":"CREATE")},G=e=>{S((t=>({...t,[e]:(ya(t[e])?0:t[e])+1})))},Y=t.useMemo((()=>{if("MATRIX_RATING_SCALE"!==V?.question?.type_info?.question_type)return!1;const e=V?.question?.type_info?.matrix_properties?.statements||[],t=e?.[T?.[V?.question.name]]??0,n=(B.formValues[V?.question.name]||[]).find((e=>e.statement_id===t?.id));return(n?.rating_labels||[]).length>0}),[T,R]),Z=()=>{const e=O.findIndex((e=>e.page_id===v?.page_id));let t=1,n=O?.[e+t];for(;!w.map((e=>e.page_id)).includes(n?.page_id)&&e+t<O.length;)n=O?.[e+ ++t];const a=w.find((e=>e.page_id===n?.page_id));n?.page_id&&g(n),"number"==typeof a?.orderOfSet&&k(a.orderOfSet);const o=w.findIndex((e=>e.page_id===n?.page_id));-1!==o&&C(o)},K=()=>{const e=O.findIndex((e=>e.page_id===v?.page_id));let t=1,n=O?.[e-t];for(;e-t>=0&&(!n||!w.some((e=>e.page_id===n.page_id)));)t++,n=O[e-t];if(!n)return;const a=w.find((e=>e.page_id===n.page_id));n.page_id&&g(n),"number"==typeof a?.orderOfSet&&k(a.orderOfSet);const o=w.findIndex((e=>e.name===a?.name));-1!==o&&C(o)};return{blocks:d,pages:O,navigateToNextSet:()=>{const e=w.find((e=>e.orderOfSet===x+1));if(e){n&&void 0!==e?.orderOfSet&&k(e?.orderOfSet);const t=O.find((t=>t.page_id===e?.page_id));t?.page_id&&g(t),_((e=>({...e,moveToNextPage:!0})))}else Z()},navigateToPreviousSet:()=>{const e=w.find((e=>e.orderOfSet===x-1));if(!e)return void K();n&&"number"==typeof e.orderOfSet&&k(e.orderOfSet);const t=O.find((t=>t.page_id===e.page_id));t?.page_id&&g(t);const a=w.findIndex((t=>t.name===e.name));-1!==a&&C(a)},activePage:v,questions:a,renderedBlocks:w,initialStatementHasAnswer:Y,activeBlock:V,activeIndexOfBlocks:X,activeIndexOfRenderedBlocks:R,activeIndexOfRenderedStatement:T,navigateToNextStatement:G,navigateToPreviousStatement:e=>{S((t=>({...t,[e]:(ya(t[e])?0:t[e])-1})))},isInitialTransition:N.current,isSurveyCompleted:D,pivot:E.current,answers:B,translationVariables:l,...b,setErrors:M,saveFormValues:(e,t,n=!1,a=R)=>{if(y)return;N.current=!1,e.question.name===E.current?.question.name&&(E.current={...E.current,answer:"BOOLEAN"===E.current?.question?.type_info?.question_type?Boolean(t):t}),a!==R&&C(a);const o={...B,formValues:{...B.formValues,[e.question.name]:"BOOLEAN"===e.question?.type_info?.question_type?Boolean(t):t},commitDirtyValue:n,moveToNextPage:!1};t$((({renderedBlocks:e,activeIndexOfRenderedBlocks:t})=>JP({renderedBlocks:e,activeIndexOfRenderedBlocks:t}).map((({question:e})=>e)))({renderedBlocks:w,activeIndexOfRenderedBlocks:a}),o),H.current&&(e.category??[]).length>0&&(e.category?.forEach((e=>{e.question_name&&(o.formValues[e.question_name]=null)})),o.formValues[e.question.name]=t),_(o);const i=w[a];"SINGLE_ANSWER"===i.question.type_info?.matrix_properties?.type&&(T?.[i.question.name]??0)<(i.question?.type_info?.matrix_properties?.statements||[]).length-1&&setTimeout((()=>{G?.(i.question.name)}),0)},saveOthersValue:(e,t,n=R)=>{if(n!==R&&C(n),null===t){const t={...B.others};delete t[e],_({...B,commitDirtyValue:!1,others:t,moveToNextPage:!1})}else _({...B,commitDirtyValue:!1,others:{...B.others,[e]:t},moveToNextPage:!1})},clearRadioSelection:e=>{C(e);const t=w[e].question;t.type_info?.pivot_question&&(E.current={question:t,answer:void 0}),delete B.formValues[t.name],delete B.others[t.name],"DATE_TIME"===t.type_info?.question_type&&b.dateQuestionErrors?.[t.name]&&M((e=>{const n={...e.dateQuestionErrors};return delete n[t.name],{...e,dateQuestionErrors:n}}));const o=(({renderedBlocks:e,answers:t})=>{const n=e.reduce(((e,n)=>(n?.question?.name&&void 0!==t.formValues[n.question.name]&&(e[n.question.name]=t.formValues[n.question.name]),e)),{});return{...t,formValues:n}})({renderedBlocks:w,answers:B}),r={...o,formValues:{...o.formValues},moveToNextPage:!1,commitDirtyValue:!1},c=e$({activeBlock:w[e],blocks:d,questions:a,answers:r,pages:O,renderedBlocks:w,contactData:i,surveyLayout:"standard",isEditResponse:H.current,branchSeparatePage:n});S((e=>{const t={...e};return c.forEach((e=>{"MATRIX_RATING_SCALE"===e.question.type_info?.question_type&&(t[e.question.name]=0)})),t}));const s=[...w.slice(0,e+1),...c];L(n?Va(s,p):s),_(r)},onSubmitHandler:U,navigateToStart:()=>{H.current=!0,I(!1),S({}),C(0),n&&("number"==typeof w?.[0].orderOfSet?k(w?.[0].orderOfSet):k(0))},isValidQuestion:F,resetSurvey:()=>{I(!1),f((e=>e+1)),_({formValues:{},others:{},commitDirtyValue:!1,moveToNextPage:!1}),p$(localStorage)},moveToNextPage:e=>{const t={};e&&O.length>0&&w.forEach((e=>{v?.page_id!==e.page_id||n&&x!==e.orderOfSet||"MESSAGE"===e.question.type_info?.question_type||(t[e.question.name]=null)})),Wa(B.formValues??{})&&O.length>0&&w.forEach((e=>{v?.page_id!==e.page_id||n&&x!==e.orderOfSet||"MESSAGE"!==e.question.type_info?.question_type||(t[e.question.name]=null)}));const a=w.filter((e=>v?.page_id===e?.page_id)),o=a[a.length-1],i=w.findIndex((e=>e.name===o?.name));R!==i&&C(i),setTimeout((()=>{_((e=>({...e,formValues:{...e.formValues,...t},commitDirtyValue:!0,moveToNextPage:!0})))}),0)},moveToNextSet:e=>{let t=0;if(w.some(((e,n)=>(t=n,!F(e,!0)))))return void C(t);const a={};w.forEach((t=>{v?.page_id!==t.page_id||n&&x!==t.orderOfSet||!e&&void 0!==B.formValues[t.question.name]||(a[t.question.name]=null)})),Wa(B.formValues??{})&&O.length>0&&w.forEach((e=>{v?.page_id!==e.page_id||n&&x!==e.orderOfSet||"MESSAGE"!==e.question.type_info?.question_type||(a[e.question.name]=null)}));const o=w.filter((e=>v?.page_id===e?.page_id&&(!n||x===e.orderOfSet))),i=o[o.length-1],r=w.findIndex((e=>e.name===i?.name));C(r),setTimeout((()=>{_((e=>({...e,formValues:{...e.formValues,...a},commitDirtyValue:!0,moveToNextPage:!0})))}),0)},setIsSubmitting:q,isSubmitting:y,expanded:z,setExpanded:m,activeIndexOfSet:x,setActiveRenderedBlockIndex:C,isQuestionBgDark:j}},W4=["next","next-statement","next-page","next-set","skip","skip-statement","skip-page","skip-set","submit","navigation","set-navigation","clear-selection","message","consent","navigation-prev","navigation-next","navigation-page-prev","navigation-page-next","previous-matrix-statement","next-matrix-statement","navigation-set-prev","navigation-set-next"],w4=({translationVariables:e,canDisplayDisableButtonParams:n,navigateToNextSet:a,navigateToPreviousSet:o})=>t.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},t.createElement("button",{disabled:QP("navigation-set-prev",n),className:"navigation-button ss-navigation-button",onClick:o,title:e?.prev_question??"go to previous question"},t.createElement(we,{name:"arrow-previous"})),t.createElement("button",{className:"navigation-button ss-navigation-button",disabled:QP("navigation-set-next",n),title:e?.next_question||"Go to next question",onClick:a},t.createElement(we,{name:"arrow-next"}))),L4=({surveyServAssetUrl:e,thankYouQuestion:n,preview:a,placeholders:o,canResubmit:i,allowMultipleSubmission:r,navigateToStart:l,resetSurvey:p,isMobile:d,pivot:u,answers:b,questions:M,rangeToRender:z,translationVariables:m})=>{const{redirectUrl:h,redirectDelay:f,image_url:O,show_custom_button:A,show_review_links:v,show_social_links:g}=n?.type_info?.meta??{},[y,q]=s(f??10),[W,w]=t.useState(!1);return c((()=>{if(!a&&h){const e=setInterval((()=>q((e=>e>1?e-1:("undefined"!=typeof window&&(window.location.href=h??""),0)))),1e3);return()=>{clearInterval(e),w(!1)}}return()=>{w(!1)}}),[]),t.createElement("div",{className:"thankyou-container"},t.createElement("div",{className:"question-container ss-question-container thankyou"},O&&t.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:O,alt:"thankyou_logo"}),t.createElement(t.Fragment,null,Ca(n)),t.createElement("div",{className:"text ss-thankyou-message",dangerouslySetInnerHTML:{__html:ka({questionText:n.text,placeholders:o,npsRating:Ta({theme:"nps",answers:b,questions:M})??"",npsRatingLabel:Sa({theme:"nps",answers:b,questions:M}),csatRating:Ta({theme:"csat",answers:b,questions:M})??"",csatRatingLabel:Sa({theme:"csat",answers:b,questions:M}),cesRating:Ta({theme:"ces",answers:b,questions:M})??"",cesRatingLabel:Sa({theme:"ces",answers:b,questions:M}),preference:u?.question.type_info?.scale_properties?.labels?.preference,isPreview:a})}}),(i||r)&&t.createElement("div",{className:("wrap-up-actions "+(d?"mobile":"")).trim()},i&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:W,onClick:()=>{w(!0),l()}},t.createElement(we,{name:"edit"}),m?.edit_response||"Edit your response"),r&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:W,onClick:()=>{w(!0),p()}},t.createElement(we,{name:"reload"}),m?.another_response||"Submit another response")),h&&t.createElement(t.Fragment,null,t.createElement("div",{className:"redirection-text"},Pa(y,m?.redirect_msg),t.createElement("br",null)),t.createElement("a",{className:"link",href:h},h)),t.createElement(m$,{show_custom_button:A,show_review_links:v,show_social_links:g,surveyServAssetUrl:e})))},R4=e=>{const{blockIndex:n,renderedBlocks:a,activeIndexOfRenderedBlocks:o,translationVariables:i,saveFormValues:r,answers:c,clearRadioSelection:s,canDisplayDisableButtonParams:l,navigateToNextStatement:p,navigateToPreviousStatement:d,isSubmitting:u,isMobile:b}=e,M={};W4.forEach((e=>{M[e]=!!UP(e,l)}));const z=a[n??o],{question:m}=z,h=m?.type_info?.meta?.display_format;return M?.consent||M?.["previous-matrix-statement"]||M?.["next-matrix-statement"]||M?.["clear-selection"]||M?.message?t.createElement("div",{className:"question-footer ss-question-footer-container"},t.createElement("div",null,(M?.["previous-matrix-statement"]||M?.["next-matrix-statement"])&&"MATRIX_RATING_SCALE"===m?.type_info?.question_type&&t.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},t.createElement("button",{disabled:QP("previous-matrix-statement",l),className:"navigation-button ss-navigation-button",onClick:()=>{d(m.name)},title:i?.prev_question??"go to previous question"},t.createElement(we,{name:"arrow-previous"})),t.createElement("button",{className:"navigation-button ss-navigation-button",disabled:QP("next-matrix-statement",l),title:i?.next_question||"Go to next question",onClick:()=>{p(m.name)}},t.createElement(we,{name:"arrow-next"})))),t.createElement("div",{className:("action-buttons ss-action-buttons "+(M.consent?"question-consent-buttons ss-consent-action-buttons":"")).trim()},M?.["clear-selection"]&&t.createElement(Te,{className:"sec-button",variant:"secondary",onClick:()=>s(n),disabled:u},e?.survey?.meta?.action_button?.clear_selection||i?.actionButtonText?.clear_selection||i?.clear_selection||"Clear selection"),b&&"MATRIX_RATING_SCALE"===m.type_info?.question_type&&"MULTIPLE_ANSWERS"===m?.type_info?.matrix_properties?.type&&M?.["next-matrix-statement"]&&t.createElement(Te,{disabled:QP("next-matrix-statement",l),className:"primary-button",variant:"primary",onClick:()=>{p(m.name)}},e?.survey?.meta?.action_button?.next||i?.actionButtonText?.next||i?.next||"Next"),M?.consent&&"BUTTON"===h&&fe.map((e=>t.createElement(Te,{key:o+String(e.recordAs),onClick:()=>{r(z,e.recordAs,!1,n)},disabled:QP("consent",l),variant:ya(c.formValues?.[m.name])||c.formValues?.[m.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(c.formValues?.[m.name]===e.recordAs?"selected":"")).trim()},m?.type_info?.scale_properties?.labels?.values?.[e.id]??e.defaultValue))))):null},C4=e=>{const{pages:n,activePage:a,navigateToNextSet:i,navigateToPreviousSet:l,isInitialTransition:p,blocks:d,renderedBlocks:u,activeBlock:b,activeIndexOfBlocks:M,activeIndexOfRenderedBlocks:z,isSurveyCompleted:m,translationVariables:h,saveFormValues:f,saveOthersValue:O,clearRadioSelection:A,onSubmitHandler:v,answers:g,questions:y,resetSurvey:q,initialStatementHasAnswer:W,navigateToStart:w,activeIndexOfRenderedStatement:L,navigateToNextStatement:R,navigateToPreviousStatement:C,pivot:x,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,contactFormErrors:E,fileUploadErrors:N,setErrors:P,isSubmitting:$,setIsSubmitting:B,moveToNextSet:_,expanded:H,setExpanded:D,activeIndexOfSet:I,isValidQuestion:V,setActiveRenderedBlockIndex:X,isQuestionBgDark:j}=q4(e);Da("Standard",{...e,answers:g,activePage:a,activeBlock:b,renderedBlocks:u,activeIndexOfSet:I,activeIndexOfBlocks:M,activeIndexOfRenderedBlocks:z,activeIndexOfRenderedStatement:L});const F=!!e.survey.meta?.branch_separate_page,U=r(null),G=r({}),Y=r(null),Z=o((()=>xa(x?.question)),[x?.question]),K=o((()=>d.filter((({name:e},t,n)=>!BP({nextBlockName:e||"",blocks:n,questions:y}))).length),[d,y]),Q=Wa(g.formValues)&&e.survey.prompt_settings?.is_enabled&&e.preview,[J,ee]=s(Q),te=u.filter((e=>a?.page_id===e?.page_id));c((()=>{const t=Object.values(g.formValues).filter((e=>"string"==typeof e&&""!==e.trim()||"number"==typeof e||"boolean"==typeof e||Array.isArray(e)&&e.length>0||"object"==typeof e&&null!==e&&Object.keys(e).length>0)).length;e.getSurveyProgress?.({totalBlocks:K,isSurveyCompleted:m,noOfAnswers:m||t>K?K:t})}),[K,g,m]),c((()=>{e.survey.theme&&Ea(e.survey.theme,e.surveyServAssetUrl??"")}),[e.survey.theme,e.surveyServAssetUrl]),c((()=>{setTimeout((()=>{Y.current&&Object.keys(g.formValues).length&&Y.current?.scrollIntoView({inline:"start",block:"start",behavior:"smooth"})}),0),b&&e.onBlockChange?.(b,a)}),[a?.page_id]);const[ne,ae]=s(!1);if(!b||!b.question)return null;const{question:oe}=u[z],ie={answers:g,blocks:d,blockIndex:0,activeIndexOfBlocks:M,initialStatementHasAnswer:W,activeIndexOfRenderedBlocks:z,activeIndexOfRenderedStatement:L,renderedBlocks:u,activePage:a,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:p,questions:y,pages:n,contactData:e.contactData,activeIndexOfSet:I,branchSeparatePage:F,isSubmitting:$,secBtnTxt:e.secBtnTxt,isNavigatedBefore:ne,pivot:x},re={};W4.forEach((e=>{re[e]=!!UP(e,ie)}));const ce=u[u.length-1];return t.createElement("div",{className:`freemium-survey-components ${wa(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${e.isMobile?"mobile-preview":""} standard-survey-style`,id:"freemium-survey",ref:Y},J&&e.survey.prompt_settings?t.createElement("div",{className:"questions ss-questions"},t.createElement("div",{className:"question-container ss-question-container"},t.createElement(M$,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt?.(t),1===t&&ee(!1)},placeholders:e.placeholders,isPreview:!!e.preview}))):t.createElement(t.Fragment,null,m?t.createElement(L4,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:EP({pivotQn:x?.question,pivotQnAnswer:x?.answer,block:_P({activeBlock:ce,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:g,questions:y,activeIndexOfBlocks:d.findIndex((e=>e.name===ce.name)),renderedBlocks:u,contactData:e.contactData,surveyLayout:"standard",pages:n}),questions:y}),answers:g,preview:!!e.preview,placeholders:e.placeholders,pivot:{...x,question:x?.question||{name:""},answer:x?.answer},rangeToRender:Z,canResubmit:e.canResubmit,isMobile:e.isMobile,allowMultipleSubmission:e.allowMultipleSubmission,translationVariables:h,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",(()=>{B(!1),w()})):(B(!1),w())},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",(()=>{B(!1),q()})):(B(!1),q())}}):t.createElement(t.Fragment,null,n.length>0&&a?.page_id&&t.createElement(u$,{expanded:H,id:a.page_id,setExpanded:D,activePage:a,translationVariables:h}),t.createElement("div",{className:("questions "+(e?.secBtnTxt?"sec-btn":"")).trim()},u.map(((o,i)=>{if(n.length>0&&a?.page_id!==o?.page_id||e.survey.meta?.branch_separate_page&&o.orderOfSet!==I)return null;const r=te.findIndex((e=>e.name===o.name)),c=VP({renderedBlocks:u,activeBlock:b,blocks:d,activeIndexOfBlocks:M,answers:g,questions:y,contactData:e.contactData,pages:n,surveyLayout:"standard"});return t.createElement(NT.div,{id:o.question.name,key:o.question.name,ref:U,className:`question-container ss-question-container standard-card-${o.question.name}`,"data-test-question-name":b.question.name,initial:{opacity:0},animate:{opacity:1,x:0},exit:{opacity:0},transition:{duration:.2,delay:r?r/15:0},..."MULTI_SELECT"===b.question.type_info?.question_type&&c!==1/0&&-1!==c&&void 0!==g.formValues?.[o.question.name]&&G.current[o.question.name]!==g.formValues?.[o.question.name]?{onMouseLeave:()=>{f(o,g.formValues?.[o.question.name],!0,i),G.current[o.question.name]=g.formValues?.[o.question.name]}}:{}},t.createElement("div",{className:`question-text ss-question-text ${o.required?"required":""} ${0===i?"nps":""}`.trim(),dangerouslySetInnerHTML:{__html:ka({questionText:o.question.text,placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:g,questions:y})??"",npsRatingLabel:Sa({theme:"nps",answers:g,questions:y}),csatRating:Ta({theme:"csat",answers:g,questions:y})??"",csatRatingLabel:Sa({theme:"csat",answers:g,questions:y}),cesRating:Ta({theme:"ces",answers:g,questions:y})??"",cesRatingLabel:Sa({theme:"ces",answers:g,questions:y}),preference:x?.question.type_info?.scale_properties?.labels?.preference,isPreview:!!e.preview})},"aria-label":`question-${i}`,role:"heading","aria-level":1}),t.createElement(O4,{surveyServAssetUrl:e.surveyServAssetUrl,fileUploadErrors:N,setErrors:P,onFileUpload:e.onFileUpload,block:o,preview:!!e.preview,surveyLanguage:e.survey.language,language:e.language||"en",question:o.question,surveyStyle:e.surveyStyle,isFinalQn:SP({blocks:d,activeIndexOfBlocks:M,renderedBlocks:u,activeIndexOfRenderedBlocks:z,questions:y}),formValues:g.formValues,othersMeta:g.others,isMobile:!!e.isMobile,autoFocusDelay:20,activeIndexOfRenderedStatement:L,saveOthersValue:(e,t)=>{O(e,t,i)},onChangeHandler:(e,t)=>{const n=o.question.type_info?.question_type;f(o,e,!!n&&["RANGE","DROPDOWN","BOOLEAN"].includes(n)||t,i)},initialPivotAnswer:e.initialPivotAnswer,initialQuestionAnswer:e.initialQuestionAnswer,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,contactFormErrors:E,translationVariables:h,isQuestionBgDark:j}),"MESSAGE"!==o.question.type_info?.question_type&&t.createElement(R4,{canDisplayDisableButtonParams:{...ie,blockIndex:i},language:e.language||"en",isWidget:!1,surveyStyle:e.surveyStyle,answers:g,renderedBlocks:u,blocks:d,pages:n,survey:e.survey,blockIndex:i,isInitialTransition:p,activeIndexOfRenderedBlocks:z,initialStatementHasAnswer:W,navigateToNextStatement:R,navigateToPreviousStatement:C,activeIndexOfRenderedStatement:L,activeIndexOfBlocks:M,saveFormValues:f,isMobile:!!e.isMobile,clearRadioSelection:A,initialPivotAnswer:e.initialPivotAnswer,translationVariables:h,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,contactFormErrors:E,fileUploadErrors:N,questions:y,isSubmitting:$}))}))),t.createElement("div",{className:"page-actions"},t.createElement("div",null,re["set-navigation"]&&t.createElement(w4,{answers:g,canDisplayDisableButtonParams:ie,activeIndexOfBlocks:M,pages:n,activeIndexOfRenderedBlocks:z,renderedBlocks:u,initialStatementHasAnswer:W,blocks:d,activeIndexOfRenderedStatement:L,translationVariables:h,navigateToPreviousSet:l,navigateToNextSet:i})),t.createElement("div",{className:"page-action-buttons ss-page-action-buttons"},e?.secBtnTxt&&t.createElement(Te,{variant:"secondary",onClick:()=>{ae(!0),e?.handleSecondaryAction?.({answers:g.formValues,survey:e.survey})},"aria-label":"secondary-action",disabled:$},e.secBtnTxt),re["skip-set"]&&t.createElement(Te,{variant:"secondary",onClick:()=>{ae(!0),_(!0)},"aria-label":"skip set",disabled:$},e?.survey?.meta?.action_button?.skip||h?.actionButtonText?.skip||h?.skip||"Skip"),re?.["next-set"]&&t.createElement(Te,{onClick:()=>{_(),ae(!0)},disabled:!!QP("next-set",ie),className:"next-set"},e?.survey?.meta?.action_button?.next||h?.actionButtonText?.next||h?.next||"Next"),re.submit&&!re?.["next-set"]&&t.createElement(Te,{disabled:!!QP("submit",ie),onClick:()=>{let e=0;u.some(((t,n)=>(e=n,!V(t,!0))))?X(e):Wa(T?.[oe.name])&&Wa(k?.[oe.name])&&Wa(S?.[oe.name])&&Wa(N?.[oe.name])&&Wa(E?.[oe.name])&&v("COMPLETE")}},e?.survey?.meta?.action_button?.submit||h?.actionButtonText?.submit||h?.submit_survey||"Submit"))))),!e.secBtnTxt&&!e.footerProps?.hideFooter&&(e?.footerProps?.languageDDComponent||e?.footerProps?.showFWBranding||e.footerProps?.footerContent)&&t.createElement(Ga,{...e.footerProps,surveyStyle:e.surveyStyle,bgColor:e.survey.theme?.palette?.footer_background??e.survey.theme?.palette?.survey_background??z$}))},x4=e=>t.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("g",{clipPath:"url(#clip0_8207_70478)"},t.createElement("rect",{width:"10",height:"10",fill:"white",fillOpacity:"0.01"}),t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.62499 3.19375C8.62499 3.4 8.79374 3.56875 8.99999 3.56875C9.20624 3.56875 9.37499 3.4 9.37499 3.19375V1C9.37499 0.79375 9.20624 0.625 8.99999 0.625H6.80624C6.59999 0.625 6.43124 0.79375 6.43124 1C6.43124 1.20625 6.59999 1.375 6.80624 1.375H8.09377L5.66876 3.80001C5.52501 3.95001 5.52501 4.18751 5.66876 4.33126C5.73751 4.40626 5.83751 4.44376 5.93126 4.44376V4.45001C6.02501 4.45001 6.11876 4.41251 6.19376 4.33751L8.62499 1.90628V3.19375ZM1 9.37501H1.00738H3.19375C3.4 9.37501 3.56875 9.20626 3.56875 9.00001C3.56875 8.79376 3.4 8.62501 3.19375 8.62501H1.90626L4.3375 6.19376C4.48125 6.04376 4.48125 5.80626 4.3375 5.66251C4.1875 5.51876 3.95 5.51876 3.80625 5.66251L1.375 8.09376V6.80626C1.375 6.60001 1.20625 6.43126 1 6.43126C0.79375 6.43126 0.625 6.60001 0.625 6.80626V9.00001C0.625 9.20626 0.79375 9.37501 1 9.37501Z",fill:"#264966"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_8207_70478"},t.createElement("rect",{width:"10",height:"10",fill:"white"})))),k4=e=>t.createElement("svg",{width:"8",height:"2",viewBox:"0 0 8 2",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{d:"M7.3 1.4H0.7C0.313401 1.4 0 1.0866 0 0.699999C0 0.3134 0.313401 0 0.7 0H7.3C7.6866 0 8 0.3134 8 0.699999C8 1.0866 7.6866 1.4 7.3 1.4Z",fill:"#264966"})),T4=({surveyServAssetUrl:e,thankYouQuestion:n,placeholders:a,canResubmit:o,navigateToStart:i,resetSurvey:r,widgetStyle:s,allowMultipleSubmission:l,pivot:p,rangeToRender:d,answers:u,questions:b,translationVariables:M,isQuestionBgDark:z})=>{const{show_custom_button:m,show_review_links:h,show_social_links:f,image_url:O}=n?.type_info?.meta??{},[A,v]=t.useState(!1);return c((()=>()=>{v(!1)}),[]),t.createElement("div",{className:"question-container ss-question-container thankyou"},O&&t.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:O,alt:"thankyou_logo"}),t.createElement("div",{className:O?"heading":"heading thankyou-image"},t.createElement(t.Fragment,null,Ca(n))),t.createElement("div",{className:O?"text ss-thankyou-message":"text ss-thankyou-message thankyou-image",dangerouslySetInnerHTML:{__html:ka({questionText:n.text,placeholders:a,npsRating:Ta({theme:"nps",answers:u,questions:b})??"",npsRatingLabel:Sa({theme:"nps",answers:u,questions:b}),csatRating:Ta({theme:"csat",answers:u,questions:b})??"",csatRatingLabel:Sa({theme:"csat",answers:u,questions:b}),cesRating:Ta({theme:"ces",answers:u,questions:b})??"",cesRatingLabel:Sa({theme:"ces",answers:u,questions:b}),preference:p?.question.type_info?.scale_properties?.labels?.preference})}}),(o||l)&&t.createElement("div",{className:`wrap-up-actions ${O?"":"thank-you-image"} ${"compact"===s?"mobile":""}`.trim()},o&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:A,onClick:()=>{v(!0),i()}},t.createElement(we,{name:"edit"}),M?.edit_response||"Edit your response"),l&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:A,onClick:()=>{v(!0),r()}},t.createElement(we,{name:"reload"}),M?.another_response||"Submit another response")),t.createElement(m$,{show_custom_button:m,show_review_links:h,show_social_links:f,surveyServAssetUrl:e}))},S4=({translationVariables:e,activeIndexOfRenderedStatement:n,navigateToPreviousBlock:a,navigateToNextBlock:o,question:i,canDisplayDisableButtonParams:r,animationInProgress:c,setAnimationInProgress:s})=>t.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},t.createElement("button",{disabled:c||!!QP("navigation-prev",r),className:"navigation-button ss-navigation-button",onClick:()=>{s(!0),setTimeout((()=>{s(!1)}),se),a()},title:i.name&&(n?.[i.name]??0)>0?e?.prev_statement||"go to previous statement":e?.prev_question||"go to previous question"},t.createElement(we,{name:"arrow-previous"})),t.createElement("button",{className:"navigation-button ss-navigation-button",disabled:c||!!QP("navigation-next",r),onClick:()=>{s(!0),setTimeout((()=>{s(!1)}),se),o()},title:e?.next_question||"go to next question"},t.createElement(we,{name:"arrow-next"}))),E4=e=>{const{widgetStyle:n,answers:a,initialStatementHasAnswer:o,renderedBlocks:i,blocks:r,activeIndexOfBlocks:c,navigateToNextStatement:l,activeIndexOfRenderedBlocks:p,translationVariables:d,saveFormValues:u,activeIndexOfRenderedStatement:b={},onSubmitHandler:M,skipBlock:z,skipStatement:m,navigateToNextBlock:h,navigateToPreviousBlock:f,formQuestionErrors:O,dateQuestionErrors:A,textboxQuestionErrors:v,fileUploadErrors:g,contactFormErrors:y,canDisplayDisableButtonParams:q,pages:W,setFooterElementRef:w,isSubmitting:L}=e,[R,C]=s(!1),{question:x}=i[p],k=x?.type_info?.question_type,T={...q,isSubmitting:L},S=(e=!1)=>{const n=e?[...fe].reverse():[...fe];return UP("consent",T)&&"BUTTON"===N&&n.map((e=>t.createElement(Te,{key:p+String(e.id),onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),u(i[p],e.recordAs,!0)},disabled:R||QP("consent",T),variant:ya(a.formValues?.[x.name])||a.formValues?.[x.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(a.formValues?.[x.name]===e.recordAs?"selected":"")).trim()},x?.type_info?.scale_properties?.labels?.values?.[e.id]||e.defaultValue)))},E="compact"===n&&(UP("navigation",T)&&UP("skip",T)||"CONSENT"===k||"MESSAGE"===k),N=x?.type_info?.meta?.display_format;return t.createElement(t.Fragment,null,(UP("navigation",T)||UP("next",T)||UP("next-statement",T)||UP("consent",T)||UP("submit",T)||UP("skip",T)||UP("skip-statement",T)||UP("message",T))&&t.createElement("div",{className:"question-footer ss-question-footer-container",ref:e=>e?w?.(e):null},E?t.createElement("div",{className:"compact-footer-container"},UP("next",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),u(i[p],"CHECKBOX"===x?.type_info?.meta?.display_format&&"CONSENT"===x?.type_info?.question_type?a.formValues[x.name]??!1:a.formValues[x.name],!0)},disabled:R||!!QP("next",T),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||d?.next||"Next"),UP("message",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),z()},disabled:R||QP("message",T),className:"message-button ss-action-message-button"},x?.type_info?.scale_properties?.labels?.values?.[0]||"Begin"),UP("submit",T)&&t.createElement("div",{className:"submit ss-action-submit-button"},t.createElement(Te,{disabled:R||!!QP("submit",T),onClick:()=>{Wa(A?.[x.name])&&Wa(O?.[x.name])&&Wa(v?.[x.name])&&Wa(g?.[x.name])&&Wa(y?.[x.name])&&(C(!0),setTimeout((()=>{C(!1)}),se),M("COMPLETE"))}},e?.survey?.meta?.action_button?.submit||d?.actionButtonText?.submit||d?.submit_survey||"Submit")),UP("next-statement",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),l?.(x.name)},disabled:R||!!QP("next-statement",T),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||d?.actionButtonText?.next||d?.next||"Next"),S(),t.createElement("div",{className:"compact-footer-layout"},t.createElement(S4,{animationInProgress:R,setAnimationInProgress:C,answers:a,canDisplayDisableButtonParams:T,pages:W,activeIndexOfBlocks:c,activeIndexOfRenderedBlocks:p,renderedBlocks:i,initialStatementHasAnswer:o,blocks:r,activeIndexOfRenderedStatement:b,question:x,translationVariables:d,navigateToNextBlock:h,navigateToPreviousBlock:f}),"MESSAGE"!==k&&!r[c].required&&t.createElement(Te,{className:"skip-button ss-action-skip-button",onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),z()},variant:"secondary","aria-label":"skip question",disabled:R},e?.survey?.meta?.action_button?.skip||d?.actionButtonText?.skip||d?.skip||"Skip"))):t.createElement(t.Fragment,null,UP("navigation",T)?t.createElement(S4,{animationInProgress:R,setAnimationInProgress:C,answers:a,pages:W,canDisplayDisableButtonParams:T,activeIndexOfBlocks:c,activeIndexOfRenderedBlocks:p,activeIndexOfRenderedStatement:b,renderedBlocks:i,blocks:r,question:x,initialStatementHasAnswer:o,translationVariables:d,navigateToNextBlock:h,navigateToPreviousBlock:f}):t.createElement("div",null),t.createElement("div",{className:"action-buttons ss-action-buttons"},UP("skip",T)&&t.createElement(Te,{className:"skip-button ss-action-skip-button",variant:"secondary",onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),z()},"aria-label":"skip question",disabled:R},e?.survey?.meta?.action_button?.skip||d?.actionButtonText?.skip||d?.skip||"Skip"),UP("skip-statement",T)&&t.createElement(Te,{className:"skip-button ss-action-skip-button",variant:"secondary",onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),m()},"aria-label":"skip statement",disabled:R},e?.survey?.meta?.action_button?.skip||d?.actionButtonText?.skip||d?.skip||"Skip"),S(!0),UP("next",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),u(i[p],"CHECKBOX"===x?.type_info?.meta?.display_format&&"CONSENT"===x?.type_info?.question_type?a.formValues[x.name]??!1:a.formValues[x.name],!0)},disabled:R||!!QP("next",T),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||d?.actionButtonText?.next||d?.next||"Next"),UP("next-statement",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),l?.(x.name)},disabled:R||!!QP("next-statement",T),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||d?.actionButtonText?.next||d?.next||"Next"),UP("submit",T)&&t.createElement("div",{className:"submit ss-action-submit-button"},t.createElement(Te,{disabled:R||!!QP("submit",T),onClick:()=>{Wa(A?.[x.name])&&Wa(O?.[x.name])&&Wa(v?.[x.name])&&Wa(g?.[x.name])&&Wa(y?.[x.name])&&(C(!0),setTimeout((()=>{C(!1)}),se),M("COMPLETE"))}},e?.survey?.meta?.action_button?.submit||d?.actionButtonText?.submit||d?.submit_survey||"Submit")),UP("message",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),z()},disabled:R||QP("message",T),className:"next-button ss-action-next-button"},x?.type_info?.scale_properties?.labels?.values?.[0]||"Begin")))))},N4=e=>{const{pages:n,activePage:a,blocks:o,renderedBlocks:i,activeBlock:l,activeIndexOfBlocks:p,activeIndexOfRenderedBlocks:d,isSurveyCompleted:u,isReverseAnimation:b,translationVariables:M,saveFormValues:z,saveOthersValue:m,skipBlock:h,skipStatement:f,initialStatementHasAnswer:O,onSubmitHandler:A,navigateToNextBlock:v,activeIndexOfRenderedStatement:g,navigateToNextStatement:y,navigateToPreviousStatement:q,navigateToPreviousBlock:W,answers:w,questions:L,resetSurvey:R,navigateToStart:C,pivot:x,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,fileUploadErrors:E,contactFormErrors:N,setErrors:P,expanded:$,setExpanded:B,isQuestionBgDark:_,isSubmitting:H}=d$({...e,isWidget:!0});Da("Widget",{...e,renderedBlocks:i,activeIndexOfBlocks:p,answers:w,activeIndexOfRenderedBlocks:d,activeBlock:l});const[D,I]=s(null),[V,X]=s(null),[j,F]=s(null),[U,G]=s(0),Y=t.useMemo((()=>xa(x?.question)),[x?.question]),Z=Wa(w.formValues)&&e.survey.prompt_settings?.is_enabled,[K,Q]=s(Z),J=r(Z?-1:d),ee=()=>{if(null===D||!D||"undefined"==typeof window||"undefined"==typeof document)return;const t=Math.max(document?.documentElement.clientHeight||0,window.innerHeight||0)-(V?.scrollHeight??0)-(j?.scrollHeight??0)-164,n=Math.min(D?.scrollHeight,Math.min(de[e.widgetStyle],t));U!==n&&G(n)};c((()=>{setTimeout((()=>{ee()}),0)}),[K,u,D,g[l?.question?.name],d,j,$,k,Object.keys(T),Object.keys(S),Object.keys(E),Object.keys(N)]),c((()=>{"MATRIX_RATING_SCALE"===l?.question?.type_info?.question_type&&setTimeout((()=>{ee()}),0)}),[g[l?.question?.name]]),c((()=>{e.loadAsNewSurvey&&e.handleAction&&e.handleAction("RE_SUBMIT",R)}),[]),c((()=>{e.setCurrentSurveyState?.({question:i[d]?.question,npsScore:x?.answer})}),[d,x?.answer]),c((()=>{d!==J.current&&(J.current=-1)}),[d]);const te={answers:w,blocks:o,blockIndex:d,activeIndexOfBlocks:p,initialStatementHasAnswer:O,activeIndexOfRenderedBlocks:d,activeIndexOfRenderedStatement:g,renderedBlocks:i,isMobile:!!e.isMobile,surveyStyle:"card",isWidget:!0,questions:L,pages:n,contactData:e.contactData,activeIndexOfSet:0,branchSeparatePage:!1,pivot:x};if(!l||!l?.question)return null;const ne=u?o.length:p+(u?1:0),ae=u?100:(ne>0?100/o.length:0)*ne;return t.createElement("div",{className:`freemium-survey-components widget-survey-components\n ${e.widgetStyle}-style`.trim(),id:"freemium-survey"},u||K||!e.survey.meta?.progress_bar?null:t.createElement("div",{className:"widget-progressbar"},t.createElement("div",{className:"progress-completion"},ae.toFixed(),"%"),t.createElement(Uq,{totalSteps:o.length,completedSteps:p+(u?1:0),isWidget:!0})),!K&&!e.minimized&&n.length>0&&a?.page_id&&!u&&t.createElement(u$,{ref:e=>e?F(e):null,expanded:$,id:a.page_id,setExpanded:B,activePage:a,translationVariables:M}),t.createElement("div",{className:"questions ss-questions",style:{...Z&&K||J.current===d?{transition:"none"}:{}}},t.createElement(HT,{exitBeforeEnter:!0},t.createElement(NT.div,{id:`${l.question.name}`,className:`question-container ss-question-container ${u?"thankyou":""} ${K?"prompt-container":""}`.trim(),"data-test-question-name":l.question.name,key:`${l.question.name}`,initial:{opacity:0,x:La(e.language,b)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(e.language,b)},transition:{duration:.2}},t.createElement("div",{className:"animation-container",style:{height:e.minimized?0:U>0&&!$?`${U}px`:"auto"}},t.createElement("div",{className:"scroll-container",ref:e=>e?I(e):null},K&&e.survey.prompt_settings?t.createElement(M$,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt(t),1===t&&Q(!1)},placeholders:e.placeholders}):t.createElement(t.Fragment,null,u?t.createElement(T4,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:EP({pivotQn:x?.question,pivotQnAnswer:x?.answer,block:_P({activeBlock:l,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:w,questions:L,activeIndexOfBlocks:p,renderedBlocks:i,contactData:e.contactData,surveyLayout:"card",pages:n}),questions:L}),placeholders:e.placeholders,canResubmit:e.canResubmit,widgetStyle:e.widgetStyle,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",C):C()},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",R):R()},allowMultipleSubmission:e.allowMultipleSubmission,pivot:x,rangeToRender:Y,translationVariables:M,isQuestionBgDark:_,answers:w}):t.createElement(t.Fragment,null,t.createElement("div",{className:`question-text ss-question-text ${!l.question.type_info?.pivot_question&&l.required?"required":""} ${"RANGE"===l?.question?.type_info?.question_type?"range-question-text":""}`.trim(),dangerouslySetInnerHTML:{__html:ka({questionText:l?.question.text,placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:w,questions:L})??"",npsRatingLabel:Sa({theme:"nps",answers:w,questions:L}),csatRating:Ta({theme:"csat",answers:w,questions:L})??"",csatRatingLabel:Sa({theme:"csat",answers:w,questions:L}),cesRating:Ta({theme:"ces",answers:w,questions:L})??"",cesRatingLabel:Sa({theme:"ces",answers:w,questions:L}),preference:x?.question.type_info?.scale_properties?.labels?.preference})},"aria-label":`question-${d}`,role:"heading","aria-level":1}),"MESSAGE"!==l.question.type_info?.question_type&&t.createElement("div",{className:"question-wrapper",onTransitionEndCapture:e=>e.stopPropagation()},t.createElement(O4,{setFocus:!0,surveyStyle:"card",isReverseAnimation:b,language:e?.language||"en",surveyServAssetUrl:e.surveyServAssetUrl,fileUploadErrors:E,setErrors:P,onFileUpload:e.onFileUpload,surveyLanguage:e.survey.language,block:l,question:l.question,isFinalQn:SP({blocks:o,activeIndexOfBlocks:p,renderedBlocks:i,activeIndexOfRenderedBlocks:d,questions:L}),formValues:w.formValues,widgetStyle:e.widgetStyle,isMobile:!1,othersMeta:w.others,autoFocusDelay:0,activeIndexOfRenderedStatement:g,isWidget:!0,saveOthersValue:(e,t)=>{m(e,t),setTimeout((()=>{ee()}),0)},onChangeHandler:e=>{setTimeout((()=>{ee()}),0),z(l,e)},formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,contactFormErrors:N,translationVariables:M,isQuestionBgDark:_})))))))),!u&&!K&&t.createElement(E4,{pages:n,isWidget:!0,language:e.language||"en",widgetStyle:e.widgetStyle,setFooterElementRef:X,surveyStyle:"standard",answers:w,survey:e.survey,canDisplayDisableButtonParams:{...te,blockIndex:d,activeIndexOfRenderedBlocks:d},isMobile:!1,renderedBlocks:i,initialStatementHasAnswer:O,activeIndexOfRenderedStatement:g,blocks:o,activeIndexOfRenderedBlocks:d,navigateToNextStatement:y,navigateToPreviousStatement:q,activeIndexOfBlocks:p,translationVariables:M,saveFormValues:z,skipBlock:h,skipStatement:f,onSubmitHandler:A,navigateToPreviousBlock:W,navigateToNextBlock:v,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,fileUploadErrors:E,contactFormErrors:N,questions:L,isSubmitting:H})))},P4={default:{width:522,11:6,10:6,9:8,8:8,7:18,6:22,5:28,4:32,3:36},compact:{width:522,11:6,10:6,9:8,8:8,7:18,6:22,5:28,4:32,3:36},cozy:{width:582,11:12,10:12,9:12,8:12,7:18,6:22,5:28,4:32,3:36}},$4=({language:e="en",survey:n,preview:a,placeholders:o,contactData:i,overRideComponent:c,onSubmit:l,onDismiss:p,onClose:d,isMobile:u,surveyType:b,unsubscribeUrl:M,isSurveyCompleted:z,children:m=null,answerStatus:h,loadSurveyCollapsed:f=!1,handleAction:O,answers:A,onAnsweringPrompt:v,allowMultipleSubmission:g,loadAsNewSurvey:y,canResubmit:q,translationVariables:W,surveyServAssetUrl:w,footerProps:L,surveyPoweredBy:R,onFileUpload:C,isQuestionBgDark:x,hideMinimize:k,position:T,collector:S})=>{const E=n.question_details?.questions||[],[N,P]=s(),[$,B]=s(!1),[_,H]=s(f),[D,I]=s(!1),{theme:V}=n,[X,j]=s(null),F=t.useMemo((()=>((e=[])=>{const t=e.sort(((e,t)=>Number(e.order)-Number(t.order)));return t.find((e=>!e.is_deleted))??t[0]})(n.blocks||[])),[n.blocks]),U=F?.question_name?F?.question_name??"":F?.category?.[0].question_name??"",G=E.find((e=>e.name===U)),Y=()=>{B(!0),setTimeout((()=>{d?.()}),300)},Z=r(null);function K(e){const t=document?.getElementById("freshworks-survey-widget");if(t&&e?.channel_info?.web_in_app_channel_info?.backdrop_enabled)try{const a=(n=e?.channel_info?.web_in_app_channel_info?.backdrop_color,Object.entries({...ue,backgroundColor:n}).map((([e,t])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${t}`)).join("; "));t.style.cssText=a}catch(e){console.error("Error applying styles to widgetElement:",e)}var n}return t.useEffect((()=>{const e=document?.documentElement;if(!e||!n.question_details?.questions)return;let t=0;(n.question_details.questions??[]).forEach((e=>{const n=xa(e);"RANGE"===e.type_info?.question_type&&n.length>t&&(t=n.length)}));const a=42*t+P4[b][t]*(t-1);e.style.setProperty("--fsc-max-range-question-width",Math.min(P4[b].width,a)+"px")}),[n,b]),t.useEffect((()=>{V&&(Ea(V,w??""),I(Ia(V.palette?.footer_background??V.palette?.survey_background??z$)))}),[V,w]),t.useEffect((()=>{K(S)}),[S]),t.createElement("div",{id:"freshworks-survey-widget",className:`align-${T||""}`},n.theme?.advanced?.additional_css&&t.createElement("style",null,n.theme?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),t.createElement("div",{className:`surveyserv-widget-container ${wa(e||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${u?"widget-mobile":""} ${b}-container-style ${_?"minimized":""}`,id:"surveyserv-widget-container"},t.createElement("header",{id:"surveyserv-widget-header",className:("widget-header "+(_?"minimized":"")).trim()},_?t.createElement("span",{className:"header-content minimized",dangerouslySetInnerHTML:{__html:ka({questionText:(!N&&n.prompt_settings?.is_enabled?n.prompt_settings.text:X?.question?.text)??_a(G?.text||""),placeholders:{...o,"{{nps.rating}}":String(X?.npsScore??"")}})}}):t.createElement("div",null),t.createElement("div",{className:"icons"},!z&&!k&&t.createElement(Te,{onClick:()=>{H((e=>!e))},variant:"secondary",className:"icon minimize-btn",title:_?W?.maximize||"Maximize widget":W?.minimize||"Minimize widget"},_?t.createElement(x4,null):t.createElement(k4,null)),t.createElement(Te,{ref:Z,onClick:()=>{z?Y():p()},variant:"secondary",title:W?.dismiss||"Dismiss widget",className:"icon minimize-btn"},t.createElement(wP,null)))),m,t.createElement("main",{className:("widget-main "+(_?"minimized":"")).trim()},c?t.createElement(t.Fragment,null,c):t.createElement(N4,{surveyServAssetUrl:w,answers:A,minimized:_,widgetStyle:b,answerStatus:h,language:e||"en",survey:n,placeholders:o,isMobile:!!u,contactData:i,onFileUpload:C,allowMultipleSubmission:g,loadAsNewSurvey:y,canResubmit:q,onSubmit:l,setCurrentSurveyState:j,widgetHeaderQuerySelector:_?void 0:"#surveyserv-widget-header",onAnsweringPrompt:e=>{v?.(e),P(e),0==e&&Wa(n.prompt_settings?.declined_message)&&Y()},handleAction:O,translationVariables:W})),(R||M||!!L?.showFWBranding)&&t.createElement("footer",{className:`widget-footer ${_?"minimized":""} survey-footer-${D?"dark":"light"}`.trim()},t.createElement("div",null,M&&!_&&t.createElement("a",{href:M,target:"_blank",rel:"noopener noreferrer",onClick:e=>{a&&e.preventDefault(),e.stopPropagation(),Y()}},W?.unsubscribe||"Unsubscribe")),!!L?.showFWBranding&&t.createElement("div",{className:"footer-text"},t.createElement(Ua,{surveyPoweredBy:R,isDark:D})))))},B4=e=>{const{survey:n,answers:a}=RP(e.survey,e.answers),[o,i]=t.useState(!1);return t.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&"undefined"!=typeof sessionStorage&&sessionStorage&&sessionStorage.clear&&(Da("Survey matchMedia",{innerHeight:window.innerHeight,innerWidth:window.innerWidth}),i(window.matchMedia("(max-width: 550px)").matches),p$(localStorage))}),[]),t.useEffect((()=>{const t=document?.documentElement;!ya(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),Da("Survey",{...e,survey:n,isMobile:o,answers:a}),t.createElement(t.Fragment,null,n.theme?.advanced?.additional_css&&t.createElement("style",null,n.theme?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),"standard"===e.surveyStyle?t.createElement(C4,{...e,answers:a,survey:n,isMobile:o||!!e.isMobile,initialQuestionAnswer:e.initialQuestionAnswer}):t.createElement(y4,{...e,answers:a,survey:n,isMobile:o||!!e.isMobile,surveyStyle:"card",initialQuestionAnswer:e.initialQuestionAnswer}))},_4=e=>{const{survey:n,answers:a}=RP(e.survey,e.answers);return Da("WebInAppContainer",{...e,survey:n,answers:a}),t.createElement($4,{...e,survey:n,answers:a})},H4=e=>{const[n,a]=t.useState(!1),[o,i]=t.useState(!1);return t.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&(a(window.matchMedia("(max-width: 550px)").matches),"cozy"===e.surveyType&&i(window.matchMedia("(max-width: 1080px)").matches))}),[]),Da("WebInAppSurvey",{...e,isMobile:n,isDefault:o}),e.isLoading?t.createElement("div",{id:"freshworks-survey-widget"},t.createElement("div",{className:`surveyserv-widget-container ${wa(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${n?"widget-mobile":""} ${e.surveyType}-container-style`,id:"surveyserv-widget-container"},t.createElement("header",{id:"surveyserv-widget-header",className:"widget-header".trim()},t.createElement("div",null),t.createElement(Te,{onClick:()=>{setTimeout((()=>{e?.onClose?.()}),300)},variant:"secondary",title:e.translationVariables?.dismiss||"Dismiss widget",className:"icon minimize-btn"},t.createElement(wP,null))),t.createElement("main",{className:"widget-main widget-loader".trim()},e.overRideComponent??t.createElement(Ya,null)))):t.createElement(t.Fragment,null,e?.survey?.id?t.createElement(_4,{...e,isMobile:n,surveyType:n?"compact":o?"default":e.surveyType}):null)},D4=e=>{const{question:n,surveyStyle:a,language:o,onAnswer:i,translationVariables:r,surveyServAssetUrl:c,block:s,theme:l}=e,[p,d]=t.useState(!!e.isMobile);return t.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&d(window.matchMedia("(max-width: 550px)").matches||!!e.isMobile)}),[]),t.useEffect((()=>{l&&Ea(l,c??"")}),[l,c]),Da("QuestionPreview",{...e,isMobile:p}),t.createElement(t.Fragment,null,l?.advanced?.additional_css&&t.createElement("style",null,l?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),t.createElement("div",{className:`freemium-survey-components question-preview ${a}-survey-style ${wa(o||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${p?"mobile-preview":""}`.trim(),id:"freemium-survey"},t.createElement("div",{className:"question-holder"},t.createElement("div",{className:"questions ss-questions"},t.createElement(NT.div,{id:`${n.name}`,className:"question-container ss-question-container","data-test-question-name":n.name,key:`${n.name}`,initial:{opacity:0,x:La(o,!1)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(o,!1)},transition:{duration:.2}},t.createElement("div",{className:`question-text ss-question-text ${s.required?"required":""} ${"RANGE"===n?.type_info?.question_type?"range-question-text":""}`.trim(),dangerouslySetInnerHTML:{__html:ka({questionText:n.text,placeholders:{},npsRating:"",npsRatingLabel:"",csatRating:"",csatRatingLabel:"",cesRating:"",cesRatingLabel:"",preference:n.type_info?.scale_properties?.labels?.preference})},"aria-label":"question-0",role:"heading","aria-level":1}),t.createElement(O4,{surveyStyle:a,language:e?.language||"en",surveyServAssetUrl:c,surveyLanguage:e?.language,block:s,question:n,formValues:{},isMobile:p,othersMeta:{},saveOthersValue:(e,t)=>{},onChangeHandler:e=>{i?.({value:e,block:s,question:n})},translationVariables:r??{},activeIndexOfRenderedStatement:{},autoFocusDelay:0,contactFormErrors:{},dateQuestionErrors:{},fileUploadErrors:{},formQuestionErrors:{},textboxQuestionErrors:{},setErrors:()=>{}}))))))},{entries:I4,setPrototypeOf:V4,isFrozen:X4,getPrototypeOf:j4,getOwnPropertyDescriptor:F4}=Object;let{freeze:U4,seal:G4,create:Y4}=Object,{apply:Z4,construct:K4}="undefined"!=typeof Reflect&&Reflect;U4||(U4=function(e){return e}),G4||(G4=function(e){return e}),Z4||(Z4=function(e,t,n){return e.apply(t,n)}),K4||(K4=function(e,t){return new e(...t)});const Q4=b6(Array.prototype.forEach),J4=b6(Array.prototype.lastIndexOf),e6=b6(Array.prototype.pop),t6=b6(Array.prototype.push),n6=b6(Array.prototype.splice),a6=b6(String.prototype.toLowerCase),o6=b6(String.prototype.toString),i6=b6(String.prototype.match),r6=b6(String.prototype.replace),c6=b6(String.prototype.indexOf),s6=b6(String.prototype.trim),l6=b6(Object.prototype.hasOwnProperty),p6=b6(RegExp.prototype.test),d6=(u6=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return K4(u6,t)});var u6;function b6(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return Z4(e,t,a)}}function M6(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a6;V4&&V4(e,null);let a=t.length;for(;a--;){let o=t[a];if("string"==typeof o){const e=n(o);e!==o&&(X4(t)||(t[a]=e),o=e)}e[o]=!0}return e}function z6(e){for(let t=0;t<e.length;t++){l6(e,t)||(e[t]=null)}return e}function m6(e){const t=Y4(null);for(const[n,a]of I4(e)){l6(e,n)&&(Array.isArray(a)?t[n]=z6(a):a&&"object"==typeof a&&a.constructor===Object?t[n]=m6(a):t[n]=a)}return t}function h6(e,t){for(;null!==e;){const n=F4(e,t);if(n){if(n.get)return b6(n.get);if("function"==typeof n.value)return b6(n.value)}e=j4(e)}return function(){return null}}const f6=U4(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),O6=U4(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),A6=U4(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),v6=U4(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),g6=U4(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),y6=U4(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),q6=U4(["#text"]),W6=U4(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),w6=U4(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),L6=U4(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),R6=U4(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),C6=G4(/\{\{[\w\W]*|[\w\W]*\}\}/gm),x6=G4(/<%[\w\W]*|[\w\W]*%>/gm),k6=G4(/\$\{[\w\W]*/gm),T6=G4(/^data-[\-\w.\u00B7-\uFFFF]+$/),S6=G4(/^aria-[\-\w]+$/),E6=G4(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),N6=G4(/^(?:\w+script|data):/i),P6=G4(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$6=G4(/^html$/i),B6=G4(/^[a-z][.\w]*(-[.\w]+)+$/i);var _6=Object.freeze({__proto__:null,ARIA_ATTR:S6,ATTR_WHITESPACE:P6,CUSTOM_ELEMENT:B6,DATA_ATTR:T6,DOCTYPE_NAME:$6,ERB_EXPR:x6,IS_ALLOWED_URI:E6,IS_SCRIPT_OR_DATA:N6,MUSTACHE_EXPR:C6,TMPLIT_EXPR:k6});const H6=1,D6=3,I6=7,V6=8,X6=9,j6=function(){return"undefined"==typeof window?null:window};var F6=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j6();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==X6||!t.Element)return n.isSupported=!1,n;let{document:a}=t;const o=a,i=o.currentScript,{DocumentFragment:r,HTMLTemplateElement:c,Node:s,Element:l,NodeFilter:p,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:b,trustedTypes:M}=t,z=l.prototype,m=h6(z,"cloneNode"),h=h6(z,"remove"),f=h6(z,"nextSibling"),O=h6(z,"childNodes"),A=h6(z,"parentNode");if("function"==typeof c){const e=a.createElement("template");e.content&&e.content.ownerDocument&&(a=e.content.ownerDocument)}let v,g="";const{implementation:y,createNodeIterator:q,createDocumentFragment:W,getElementsByTagName:w}=a,{importNode:L}=o;let R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof I4&&"function"==typeof A&&y&&void 0!==y.createHTMLDocument;const{MUSTACHE_EXPR:C,ERB_EXPR:x,TMPLIT_EXPR:k,DATA_ATTR:T,ARIA_ATTR:S,IS_SCRIPT_OR_DATA:E,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:P}=_6;let{IS_ALLOWED_URI:$}=_6,B=null;const _=M6({},[...f6,...O6,...A6,...g6,...q6]);let H=null;const D=M6({},[...W6,...w6,...L6,...R6]);let I=Object.seal(Y4(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,X=null,j=!0,F=!0,U=!1,G=!0,Y=!1,Z=!0,K=!1,Q=!1,J=!1,ee=!1,te=!1,ne=!1,ae=!0,oe=!1,ie=!0,re=!1,ce={},se=null;const le=M6({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pe=null;const de=M6({},["audio","video","img","source","image","track"]);let ue=null;const be=M6({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Me="http://www.w3.org/1998/Math/MathML",ze="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let he=me,fe=!1,Oe=null;const Ae=M6({},[Me,ze,me],o6);let ve=M6({},["mi","mo","mn","ms","mtext"]),ge=M6({},["annotation-xml"]);const ye=M6({},["title","style","font","a","script"]);let qe=null;const We=["application/xhtml+xml","text/html"];let we=null,Le=null;const Re=a.createElement("form"),Ce=function(e){return e instanceof RegExp||e instanceof Function},xe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Le||Le!==e){if(e&&"object"==typeof e||(e={}),e=m6(e),qe=-1===We.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===qe?o6:a6,B=l6(e,"ALLOWED_TAGS")?M6({},e.ALLOWED_TAGS,we):_,H=l6(e,"ALLOWED_ATTR")?M6({},e.ALLOWED_ATTR,we):D,Oe=l6(e,"ALLOWED_NAMESPACES")?M6({},e.ALLOWED_NAMESPACES,o6):Ae,ue=l6(e,"ADD_URI_SAFE_ATTR")?M6(m6(be),e.ADD_URI_SAFE_ATTR,we):be,pe=l6(e,"ADD_DATA_URI_TAGS")?M6(m6(de),e.ADD_DATA_URI_TAGS,we):de,se=l6(e,"FORBID_CONTENTS")?M6({},e.FORBID_CONTENTS,we):le,V=l6(e,"FORBID_TAGS")?M6({},e.FORBID_TAGS,we):m6({}),X=l6(e,"FORBID_ATTR")?M6({},e.FORBID_ATTR,we):m6({}),ce=!!l6(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,F=!1!==e.ALLOW_DATA_ATTR,U=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,K=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,J=e.FORCE_BODY||!1,ae=!1!==e.SANITIZE_DOM,oe=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,$=e.ALLOWED_URI_REGEXP||E6,he=e.NAMESPACE||me,ve=e.MATHML_TEXT_INTEGRATION_POINTS||ve,ge=e.HTML_INTEGRATION_POINTS||ge,I=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(I.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(I.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(I.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(F=!1),te&&(ee=!0),ce&&(B=M6({},q6),H=[],!0===ce.html&&(M6(B,f6),M6(H,W6)),!0===ce.svg&&(M6(B,O6),M6(H,w6),M6(H,R6)),!0===ce.svgFilters&&(M6(B,A6),M6(H,w6),M6(H,R6)),!0===ce.mathMl&&(M6(B,g6),M6(H,L6),M6(H,R6))),e.ADD_TAGS&&(B===_&&(B=m6(B)),M6(B,e.ADD_TAGS,we)),e.ADD_ATTR&&(H===D&&(H=m6(H)),M6(H,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&M6(ue,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===le&&(se=m6(se)),M6(se,e.FORBID_CONTENTS,we)),ie&&(B["#text"]=!0),K&&M6(B,["html","head","body"]),B.table&&(M6(B,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw d6('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw d6('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,g=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const a="data-tt-policy-suffix";t&&t.hasAttribute(a)&&(n=t.getAttribute(a));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(M,i)),null!==v&&"string"==typeof g&&(g=v.createHTML(""));U4&&U4(e),Le=e}},ke=M6({},[...O6,...A6,...v6]),Te=M6({},[...g6,...y6]),Se=function(e){t6(n.removed,{element:e});try{A(e).removeChild(e)}catch(t){h(e)}},Ee=function(e,t){try{t6(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){t6(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Se(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ne=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=i6(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===qe&&he===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(he===me)try{t=(new b).parseFromString(o,qe)}catch(e){}if(!t||!t.documentElement){t=y.createDocument(he,"template",null);try{t.documentElement.innerHTML=fe?g:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(a.createTextNode(n),i.childNodes[0]||null),he===me?w.call(t,K?"html":"body")[0]:K?t.documentElement:i},Pe=function(e){return q.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},$e=function(e){return e instanceof u&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof s&&e instanceof s};function _e(e,t,a){Q4(e,(e=>{e.call(n,t,a,Le)}))}const He=function(e){let t=null;if(_e(R.beforeSanitizeElements,e,null),$e(e))return Se(e),!0;const a=we(e.nodeName);if(_e(R.uponSanitizeElement,e,{tagName:a,allowedTags:B}),Z&&e.hasChildNodes()&&!Be(e.firstElementChild)&&p6(/<[/\w!]/g,e.innerHTML)&&p6(/<[/\w!]/g,e.textContent))return Se(e),!0;if(e.nodeType===I6)return Se(e),!0;if(Z&&e.nodeType===V6&&p6(/<[/\w]/g,e.data))return Se(e),!0;if(!B[a]||V[a]){if(!V[a]&&Ie(a)){if(I.tagNameCheck instanceof RegExp&&p6(I.tagNameCheck,a))return!1;if(I.tagNameCheck instanceof Function&&I.tagNameCheck(a))return!1}if(ie&&!se[a]){const t=A(e)||e.parentNode,n=O(e)||e.childNodes;if(n&&t){for(let a=n.length-1;a>=0;--a){const o=m(n[a],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,f(e))}}}return Se(e),!0}return e instanceof l&&!function(e){let t=A(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const n=a6(e.tagName),a=a6(t.tagName);return!!Oe[e.namespaceURI]&&(e.namespaceURI===ze?t.namespaceURI===me?"svg"===n:t.namespaceURI===Me?"svg"===n&&("annotation-xml"===a||ve[a]):Boolean(ke[n]):e.namespaceURI===Me?t.namespaceURI===me?"math"===n:t.namespaceURI===ze?"math"===n&&ge[a]:Boolean(Te[n]):e.namespaceURI===me?!(t.namespaceURI===ze&&!ge[a])&&!(t.namespaceURI===Me&&!ve[a])&&!Te[n]&&(ye[n]||!ke[n]):!("application/xhtml+xml"!==qe||!Oe[e.namespaceURI]))}(e)?(Se(e),!0):"noscript"!==a&&"noembed"!==a&&"noframes"!==a||!p6(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===D6&&(t=e.textContent,Q4([C,x,k],(e=>{t=r6(t,e," ")})),e.textContent!==t&&(t6(n.removed,{element:e.cloneNode()}),e.textContent=t)),_e(R.afterSanitizeElements,e,null),!1):(Se(e),!0)},De=function(e,t,n){if(ae&&("id"===t||"name"===t)&&(n in a||n in Re))return!1;if(F&&!X[t]&&p6(T,t));else if(j&&p6(S,t));else if(!H[t]||X[t]){if(!(Ie(e)&&(I.tagNameCheck instanceof RegExp&&p6(I.tagNameCheck,e)||I.tagNameCheck instanceof Function&&I.tagNameCheck(e))&&(I.attributeNameCheck instanceof RegExp&&p6(I.attributeNameCheck,t)||I.attributeNameCheck instanceof Function&&I.attributeNameCheck(t))||"is"===t&&I.allowCustomizedBuiltInElements&&(I.tagNameCheck instanceof RegExp&&p6(I.tagNameCheck,n)||I.tagNameCheck instanceof Function&&I.tagNameCheck(n))))return!1}else if(ue[t]);else if(p6($,r6(n,N,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==c6(n,"data:")||!pe[e]){if(U&&!p6(E,r6(n,N,"")));else if(n)return!1}else;return!0},Ie=function(e){return"annotation-xml"!==e&&i6(e,P)},Ve=function(e){_e(R.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||$e(e))return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:r,namespaceURI:c,value:s}=i,l=we(r),p=s;let d="value"===r?p:s6(p);if(a.attrName=l,a.attrValue=d,a.keepAttr=!0,a.forceKeepAttr=void 0,_e(R.uponSanitizeAttribute,e,a),d=a.attrValue,!oe||"id"!==l&&"name"!==l||(Ee(r,e),d="user-content-"+d),Z&&p6(/((--!?|])>)|<\/(style|title)/i,d)){Ee(r,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){Ee(r,e);continue}if(!G&&p6(/\/>/i,d)){Ee(r,e);continue}Y&&Q4([C,x,k],(e=>{d=r6(d,e," ")}));const u=we(e.nodeName);if(De(u,l,d)){if(v&&"object"==typeof M&&"function"==typeof M.getAttributeType)if(c);else switch(M.getAttributeType(u,l)){case"TrustedHTML":d=v.createHTML(d);break;case"TrustedScriptURL":d=v.createScriptURL(d)}if(d!==p)try{c?e.setAttributeNS(c,r,d):e.setAttribute(r,d),$e(e)?Se(e):e6(n.removed)}catch(t){Ee(r,e)}}else Ee(r,e)}_e(R.afterSanitizeAttributes,e,null)},Xe=function e(t){let n=null;const a=Pe(t);for(_e(R.beforeSanitizeShadowDOM,t,null);n=a.nextNode();)_e(R.uponSanitizeShadowNode,n,null),He(n),Ve(n),n.content instanceof r&&e(n.content);_e(R.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null,i=null,c=null,l=null;if(fe=!e,fe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw d6("toString is not a function");if("string"!=typeof(e=e.toString()))throw d6("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Q||xe(t),n.removed=[],"string"==typeof e&&(re=!1),re){if(e.nodeName){const t=we(e.nodeName);if(!B[t]||V[t])throw d6("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)a=Ne("\x3c!----\x3e"),i=a.ownerDocument.importNode(e,!0),i.nodeType===H6&&"BODY"===i.nodeName||"HTML"===i.nodeName?a=i:a.appendChild(i);else{if(!ee&&!Y&&!K&&-1===e.indexOf("<"))return v&&ne?v.createHTML(e):e;if(a=Ne(e),!a)return ee?null:ne?g:""}a&&J&&Se(a.firstChild);const p=Pe(re?e:a);for(;c=p.nextNode();)He(c),Ve(c),c.content instanceof r&&Xe(c.content);if(re)return e;if(ee){if(te)for(l=W.call(a.ownerDocument);a.firstChild;)l.appendChild(a.firstChild);else l=a;return(H.shadowroot||H.shadowrootmode)&&(l=L.call(o,l,!0)),l}let d=K?a.outerHTML:a.innerHTML;return K&&B["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&p6($6,a.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+d),Y&&Q4([C,x,k],(e=>{d=r6(d,e," ")})),v&&ne?v.createHTML(d):d},n.setConfig=function(){xe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},n.clearConfig=function(){Le=null,Q=!1},n.isValidAttribute=function(e,t,n){Le||xe({});const a=we(e),o=we(t);return De(a,o,n)},n.addHook=function(e,t){"function"==typeof t&&t6(R[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=J4(R[e],t);return-1===n?void 0:n6(R[e],n,1)[0]}return e6(R[e])},n.removeHooks=function(e){R[e]=[]},n.removeAllHooks=function(){R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const U6=t.memo((e=>{const{meta_image:n,meta_title:a,meta_description:o,meta_host:i,short_url:r,message:c,channel:s}=e;let l="",p="";if(i){let e=i;e.endsWith("/")||(e+="/"),r&&(e+=r),l=e;try{p=new URL(e).hostname}catch(t){console.warn("Invalid URL provided:",e)}}const d=Boolean(n),u=("fsc-link-preview "+("whatsapp"===s?"fsc-link-preview--whatsapp":"")).trim(),b=("fsc-link-preview__meta "+(d?"":"fsc-link-preview__meta--no-logo")).trim();return t.createElement("div",{className:u},t.createElement("div",{className:b},d&&t.createElement("div",{className:"fsc-link-preview__meta__logo"},t.createElement("img",{src:n,alt:"page logo",loading:"lazy"})),p&&t.createElement("div",{className:"fsc-link-preview__meta__domain"},p),a&&t.createElement("div",{className:"fsc-link-preview__meta__title"},a),o&&t.createElement("div",{className:"fsc-link-preview__meta__description"},o)),c&&t.createElement("div",{className:"fsc-link-preview__message"},c),l&&t.createElement("div",{className:"fsc-link-preview__url"},t.createElement("a",{href:l,target:"_blank",rel:"noopener noreferrer","aria-label":`Visit ${p||l}`},l)))}));U6.displayName="LinkPreview";const G6=({children:e,title:n,closeModal:a,isModalOpen:o})=>t.createElement(X,{in:o,unmountOnExit:!0,timeout:500,classNames:"fade",key:n},t.createElement("div",{className:"options-popup",style:{}},t.createElement("header",null,t.createElement("button",{onClick:a,className:"close"},t.createElement(wP,null)),t.createElement("h4",null,n)),t.createElement("main",{className:"fsc-range-main"},e),t.createElement("footer",null,"Tab an item to select it"))),Y6=({question:e,saveFormValues:n})=>{const[a,o]=s(!1),{range:i}=e?.type_info?.scale_properties||{},c=Number(i?.[0]?.min),l=Number(i?.[i.length-1]?.max),p="descending"===e?.type_info?.scale_properties?.order,d=[...e?.type_info?.scale_properties?.labels?.values||[]],u=e?.type_info?.scale_properties?.labels?.preference;p&&d.reverse();const b=r(Array.from({length:l+(0===c?1:0)},((e,t)=>p?l-t:t+c)));return b.current.length<=3?t.createElement("ul",{className:`choices ${("THUMBS"===e?.type_info?.type_variant||"all"!==e?.type_info?.scale_properties?.labels?.preference)&&"one-line"}`},b.current.map(((a,o)=>"THUMBS"===e?.type_info?.type_variant?t.createElement("li",{className:"choice range-choice",key:`thumbs-${a}-${o}`},t.createElement("button",{onClick:()=>{n(a)}},t.createElement(we,{name:a?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),"all"===e?.type_info?.scale_properties?.labels?.preference&&e?.type_info?.scale_properties?.labels?.values?.[a])):t.createElement("li",{className:"choice range-choice",key:`choice-${a}-${o}`},t.createElement("button",{onClick:()=>{n(a)}},t.createElement("span",{className:"star-rating-wrapper"},Array.from({length:a},((e,n)=>t.createElement(we,{name:"whatsapp-star",id:`choice-${n}`})))," ","all"===u||"edges"===u&&(0===o||o===d.length-1)?d[a-1]:null)))))):t.createElement(t.Fragment,null,t.createElement("button",{onClick:()=>o(!0),className:"choices-button choice"},t.createElement(we,{name:"whatsapp-choices"}),"Rate Support"),t.createElement(G6,{title:"Rate Support",isModalOpen:a,closeModal:()=>o(!1)},b.current.map(((e,a)=>t.createElement("div",{className:"option-row"},t.createElement("button",{onClick:()=>{n(e),o(!1)}},t.createElement("span",{className:"star-rating-wrapper"},Array.from({length:e},((e,n)=>t.createElement(we,{name:"whatsapp-star",id:`qus-${n}`})))," ","all"===u||"edges"===u&&(0===a||a===d.length-1)?d[e-1]:null)))))))},Z6=({question:e,saveFormValues:n,type:a})=>{const[o,i]=s(!1);return t.createElement(t.Fragment,null,t.createElement("button",{onClick:()=>i(!0),className:"choices-button choice"},t.createElement(we,{name:"whatsapp-choices"}),"Select answer"),t.createElement(G6,{title:"Select a choice",isModalOpen:o,closeModal:()=>i(!1)},t.createElement("ul",{className:`choices multi-choice ${a}`},e.choices.map(((e,a)=>t.createElement("li",{className:"choice",style:{boxShadow:"none"},key:`${e}-${a}`},t.createElement("button",{onClick:()=>{n(e.id),i(!1)}},e.value)))))))},K6=e=>{const n=r(null);return((e,t)=>{c((()=>{if(e){e.style.height="0px";const t=e.scrollHeight;e.style.height=t+"px"}}),[e,t])})(n.current,String(e.value)??""),c((()=>{e.autoFocus&&n.current?.focus()}),[e.autoFocus]),t.createElement("div",{className:"textarea-container"},t.createElement("textarea",{placeholder:"Type a message",ref:n,rows:1,onChange:e.onChange,value:e.value}),t.createElement("button",{onClick:()=>{e.onSubmit(),n.current&&(n.current.value="")}},t.createElement(we,{name:"whatsapp-send"})))},Q6=({text:e,placeholders:n,pivot:a,rangeToRender:o,questions:i,answers:r})=>t.createElement("div",{className:"question-text-container"},t.createElement("div",{className:"question-text ss-question-text",dangerouslySetInnerHTML:{__html:ka({questionText:e,placeholders:n,npsRating:Ta({theme:"nps",answers:r,questions:i})??"",npsRatingLabel:Sa({theme:"nps",answers:r,questions:i}),csatRating:Ta({theme:"csat",answers:r,questions:i})??"",csatRatingLabel:Sa({theme:"csat",answers:r,questions:i}),cesRating:Ta({theme:"ces",answers:r,questions:i})??"",cesRatingLabel:Sa({theme:"ces",answers:r,questions:i}),preference:a?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0})},role:"heading","aria-level":1})),J6=({block:e,saveFormValues:n,type:a,translationVariables:o,language:i})=>{const{question_type:r}=e.question?.type_info;switch(r){case"RANGE":return t.createElement(Y6,{question:e.question,saveFormValues:e=>n(e,!0)});case"DROPDOWN":case"MULTI_CHOICE":case"MULTI_SELECT":return t.createElement(Z6,{dir:wa(i||"en")?"rtl":"ltr",question:e.question,saveFormValues:e=>n(e,!0),type:a,translationVariables:o});case"PARAGRAPH":case"INPUT":return null;default:return console.error(`Question type ${r} not supported`),null}},e8=({config:e,placeholders:n,onSelect:a,promptAccepted:i,type:r})=>{const c=o((()=>e.reverse_order?e.choices?.reverse():e.choices),[e]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"question-container ss-question-container "+(null==i?"active":"")},t.createElement(Q6,{text:e.text,placeholders:n}),t.createElement("ul",{className:"choices one-line"},c?.map(((e,n)=>t.createElement("li",{className:"choice",key:`prompt-${e}-${n}`},t.createElement("button",{className:"action",onClick:()=>{a(Number(e.id))}},t.createElement(we,{name:Number(e.id)?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),e.value)))))),void 0!==i&&t.createElement("div",{className:"answers-container"},t.createElement("div",{className:"answers"},"whatsapp"===r&&t.createElement("div",{className:"reply-block"},t.createElement("p",{className:"user"},"Acme.inc"),t.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:ka({questionText:e.text,placeholders:n})}})),t.createElement("div",{className:"answer-text"},t.createElement(we,{name:Number(i)?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),c.find((e=>e.id==i))?.value))),!1===i&&e.is_declined&&e.declined_message&&t.createElement("div",{className:"question-container ss-question-container"},t.createElement(Q6,{text:e.declined_message,placeholders:n})))},t8=e=>{const{activeBlock:n,activeIndexOfBlocks:a,activeIndexOfRenderedBlocks:o,answers:i,saveFormValues:l,blocks:p,questions:d,renderedBlocks:u,onSubmitHandler:b,isSurveyCompleted:M,pivot:z}=d$(e),{type:m="whatsapp"}=e,{question_type:h}=n?.question.type_info??{},f=t.useMemo((()=>xa(z?.question)),[z?.question]),O=r(null),[A,v]=s(void 0),g=SP({blocks:p,activeIndexOfBlocks:a,renderedBlocks:u,activeIndexOfRenderedBlocks:o,questions:d});return c((()=>{O.current&&O.current.scroll({top:1e4,behavior:"smooth"})}),[n,i,M]),n&&n.question?t.createElement("div",{className:`${m} whatsapp-container`},t.createElement("div",{className:"msg-container"},t.createElement("div",{className:"scroll-wrapper",ref:O},e.survey.prompt_settings?t.createElement(e8,{config:e.survey.prompt_settings,onSelect:e=>{v(1===e)},promptAccepted:A,placeholders:e.placeholders,type:m}):null,!e.survey.prompt_settings||A?u.map(((r,c)=>{const s=r.question.type_info?.scale_properties?.labels?.preference,h=r.question.type_info?.scale_properties?.labels?.values||[];return t.createElement(t.Fragment,null,t.createElement("div",{className:"question-container ss-question-container "+(M||c!==u.length-1?"":"active")},t.createElement(Q6,{text:r.question.text,placeholders:e.placeholders,pivot:z,rangeToRender:f}),t.createElement(J6,{language:e.language||"en",block:r,placeholders:e.placeholders,saveFormValues:(e,t)=>{l(r,e,t),setTimeout((()=>{!0===t&&SP({blocks:p,activeIndexOfBlocks:a,renderedBlocks:u,activeIndexOfRenderedBlocks:o,questions:d})&&b("COMPLETE")}))},type:m})),r.name===n.name&&!i.commitDirtyValue||ae.isNil(i.formValues[r.question.name])?null:t.createElement("div",{className:"answers-container"},t.createElement("div",{className:"answers"},"THUMBS"===r.question.type_info?.type_variant?t.createElement(t.Fragment,null,"whatsapp"===m&&t.createElement("div",{className:"reply-block"},t.createElement("p",{className:"user"},"Acme.inc"),t.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:F6.sanitize(ka({questionText:r.question.text||"",placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:i,questions:d})??"",npsRatingLabel:Sa({theme:"nps",answers:i,questions:d}),csatRating:Ta({theme:"csat",answers:i,questions:d})??"",csatRatingLabel:Sa({theme:"csat",answers:i,questions:d}),cesRating:Ta({theme:"ces",answers:i,questions:d})??"",cesRatingLabel:Sa({theme:"ces",answers:i,questions:d}),preference:z?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0}))}})),t.createElement("div",{className:"answer-text"},t.createElement(we,{name:Number(i.formValues[r.question.name])?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),"all"===r.question.type_info?.scale_properties?.labels?.preference&&r.question.type_info?.scale_properties?.labels?.values?.[Number(i.formValues[r.question.name])])):"EMOJI"===r.question.type_info?.type_variant||"STAR"===r.question.type_info?.type_variant?t.createElement(t.Fragment,null,"whatsapp"===m&&i.formValues[r.question.name]&&t.createElement("div",{className:"reply-block"},t.createElement("p",{className:"user"},"Acme.inc"),t.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:F6.sanitize(ka({questionText:r.question.text||"",placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:i,questions:d})??"",npsRatingLabel:Sa({theme:"nps",answers:i,questions:d}),csatRating:Ta({theme:"csat",answers:i,questions:d})??"",csatRatingLabel:Sa({theme:"csat",answers:i,questions:d}),cesRating:Ta({theme:"ces",answers:i,questions:d})??"",cesRatingLabel:Sa({theme:"ces",answers:i,questions:d}),preference:z?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0}))}})),t.createElement("div",{className:"answer-text"},t.createElement("div",{className:"star-rating-wrapper"},Array.from({length:Number(i.formValues[r.question.name])},((e,n)=>t.createElement(we,{name:"whatsapp-star",id:`ans-${n}`})))," ","all"===s||"edges"===s&&(1===i.formValues[r.question.name]||i.formValues[r.question.name]===h.length)?h[Number(i.formValues[r.question.name])-1]:null))):"DROPDOWN"===r.question.type_info?.question_type||"MULTI_SELECT"===r.question.type_info?.question_type?t.createElement(t.Fragment,null,r.question.choices?.find((e=>e.id===i.formValues[r.question.name]))?.value||i.formValues[r.question.name]?.toString()):t.createElement(t.Fragment,null,i.formValues[r.question.name]?.toString()))))})):null,M&&t.createElement("div",{className:"question-container ss-question-container",id:"new"},t.createElement(Q6,{text:EP({pivotQn:z?.question,pivotQnAnswer:z?.answer,block:e.survey.blocks?.find((e=>"TY"===e.name)),questions:d})?.text,placeholders:e.placeholders,pivot:z,rangeToRender:f})))),t.createElement(K6,{onChange:e=>{"PARAGRAPH"!==h||M||l(n,e.target.value)},value:"PARAGRAPH"===h&&!M&&i.formValues[n.question.name]?i.formValues[n.question.name]:"",activeBlock:!0,autoFocus:"PARAGRAPH"===h,onSubmit:()=>{l(n,i?.formValues?.[n.question.name],!0),g&&b("COMPLETE")}})):null},n8=e=>t.createElement("div",{className:`${e.channel} whatsapp-container`},t.createElement("div",{className:"msg-container"},t.createElement("div",{className:"scroll-wrapper"},t.createElement("div",{className:"question-container ss-question-container active"},t.createElement(U6,{...e})))),t.createElement(K6,{onSubmit:e=>{Da("LinkPreviewChannel","submitted")}})),a8=e=>{const{survey:n,previewConfig:a}=e,[o,i]=s(!1),[r,c]=s(!1),[l,p]=s({others_meta:{}}),{block:d,question:u,agentName:b,userName:M}=t.useMemo((()=>{const e=n.blocks.find((e=>!e.is_deleted)),t=n.question_details?.questions?.find((t=>t.name===e?.question_name||e?.category?.map((e=>e.question_name)).includes(t.name)));return{block:e,question:t,agentName:a?.agent?.firstName||a?.agent?.lastName?`${a?.agent?.firstName??""} ${a?.agent?.lastName??""}`.trim():"John Doe",userName:a?.user?.firstName||a?.user?.lastName?`${a?.user?.firstName??""} ${a?.user?.lastName??""}`.trim():"Hartmann"}}),[a?.agent?.firstName,a?.agent?.lastName,a?.user?.firstName,a?.user?.lastName,n.blocks,n.question_details?.questions]);return d?.name&&u?.name?t.createElement("div",{className:"web-chat-channel"},t.createElement("div",{className:"wc-header"},t.createElement("div",{className:"wc-h-action-button"},t.createElement(we,{name:"arrow-left"})),t.createElement("div",{className:"wc-h-info"},t.createElement("div",{className:"wc-h-info-main wc-wrap-text"},a?.topicName??"Instant support"),t.createElement("div",{className:"wc-h-info-sub wc-wrap-text"},a?.topicDescription??"Typically responds in 5 mins")),t.createElement("div",{className:"wc-h-action-button"},t.createElement(we,{name:"close"}))),t.createElement("div",{className:"wc-body"},t.createElement("div",{className:"wc-body-scroll-container"},t.createElement("div",{className:"wc-agent-details"},t.createElement("div",{className:"wc-icon"},a?.agent?.imageUrl?t.createElement("img",{src:a?.agent?.imageUrl,alt:b,className:"wc-a-avatar"}):b?.slice(0,1)),t.createElement("div",{className:"wc-a-info"},t.createElement("div",{className:"wc-a-i-name wc-break-text"},b),t.createElement("div",{className:"wc-a-i-designation wc-break-text"},a?.agent?.designation??"Sr. Customer support agent"))),t.createElement("div",{className:"wc-agent-chat-wrapper"},t.createElement("div",{className:"wc-icon"},a?.user?.imageUrl?t.createElement("img",{src:a?.user?.imageUrl,alt:M,className:"wc-a-avatar"}):M?.slice(0,1)),t.createElement("div",{className:"w-a-c-container"},t.createElement("div",{className:"wc-a-s-name wc-break-text"},M),t.createElement("div",{className:"wc-a-survey-wrapper"},t.createElement(D4,{block:d,question:u,surveyStyle:"card",onAnswer:e=>{p({...e.question.name?{[e.question.name]:e.value}:{},others_meta:{}}),i(!0)},isMobile:!0,theme:e.survey.theme??{},language:e.language,surveyServAssetUrl:e.surveyServAssetUrl,translationVariables:e.translationVariables})),t.createElement("div",{className:"wc-a-timestamp wc-break-text"},a?.timeString??(new Date).toLocaleTimeString())))),t.createElement("div",{className:"wc-footer"},t.createElement("div",{className:"w-f-link wc-wrap-text"},a?.actionText??"Continue chat"))),t.createElement("div",{className:"web-chat-survey-preview"},o&&t.createElement(H4,{answers:l,answerStatus:"PARTIAL",language:e.language,surveyServAssetUrl:e.surveyServAssetUrl,translationVariables:e.translationVariables,preview:!0,isSurveyCompleted:r,onAnsweringPrompt:e=>{},onDismiss:()=>{i(!1)},onClose:()=>{i(!1)},onSubmit:(e,t,n)=>{"COMPLETE"===n&&(c(!0),setTimeout((()=>{t()}),0))},isMobile:!0,placeholders:{},survey:e.survey,surveyType:"compact"}))):null},o8=e=>{Da("ChannelPreview",e);const{survey:n,answers:a}=RP(e.survey,e.answers);return t.useEffect((()=>{const t=document?.documentElement;!ya(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),t.useEffect((()=>{n.theme&&Ea(n.theme,e.surveyServAssetUrl??"")}),[n.theme,e.surveyServAssetUrl]),"chat"===e.channel?t.createElement(a8,{...e,survey:n,answers:a}):"whatsapp"===e.channel?t.createElement(t8,{...e,survey:n,answers:a}):"instagram"===e.channel?t.createElement(t8,{type:"instagram",...e,survey:n,answers:a}):(console.error(`Channel ${e.channel} not supported`),null)},i8=e=>{Da("ChannelLinkPreview",e);return t.useEffect((()=>{const t=document?.documentElement;!ya(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),["whatsapp","instagram"].includes(e.channel)?t.createElement(n8,{...e}):(console.error(`Channel ${e.channel} not supported`),null)};var r8=Object.freeze({__proto__:null,allPathsLoader:function(e,t){return gi(void 0,void 0,void 0,(function(){return yi(this,(function(n){switch(n.label){case 0:return[4,Promise.resolve().then((function(){return xr}))];case 1:return[2,(0,n.sent().getIconPaths)(e,t)]}}))}))}}),c8=Object.freeze({__proto__:null,splitPathsBySizeLoader:function(e,t){return gi(void 0,void 0,void 0,(function(){var n,a;return yi(this,(function(o){switch(o.label){case 0:return n=yr(e),t!==Wr.STANDARD?[3,2]:[4,Promise.resolve().then((function(){return wr}))];case 1:return a=o.sent(),[3,4];case 2:return[4,Promise.resolve().then((function(){return Lr}))];case 3:a=o.sent(),o.label=4;case 4:return[2,a[n]]}}))}))}});export{ge as ALL_FONTS,xe as Binary,Te as Button,i8 as ChannelLinkPreview,o8 as ChannelPreview,dt as Checkbox,ve as DEFAULT_FONT,jq as DatePicker,Fq as DateTimePicker,ja as Dropdown,ye as FONT_SIZE_OPTIONS,Xa as Input,Ya as Loader,Za as PhoneNumberInput,Uq as ProgressBar,D4 as QuestionPreview,DT as RadioGroup,XT as Range,wN as RankOrder,yP as Slider,B4 as Survey,Ga as SurveyFooter,qP as SurveyProgress,WP as TextArea,H4 as WebInAppSurvey};
|
|
39
|
+
*/;const h5=({addFilter:e,utils:t})=>{const{Type:n,isString:a,replaceInString:o,guesstimateMimeType:i,getExtensionFromFilename:r,getFilenameFromURL:c}=t,s=(e,t)=>e.some((e=>{return/\*$/.test(e)?(n=e,(/^[^/]+/.exec(t)||[]).pop()===n.slice(0,-2)):e===t;var n})),l=(e,t,n)=>{if(0===t.length)return!0;const o=(e=>{let t="";if(a(e)){const n=c(e),a=r(n);a&&(t=i(a))}else t=e.type;return t})(e);return n?new Promise(((a,i)=>{n(e,o).then((e=>{s(t,e)?a():i()})).catch(i)})):s(t,o)};return e("SET_ATTRIBUTE_TO_OPTION_MAP",(e=>Object.assign(e,{accept:"acceptedFileTypes"}))),e("ALLOW_HOPPER_ITEM",((e,{query:t})=>!t("GET_ALLOW_FILE_TYPE_VALIDATION")||l(e,t("GET_ACCEPTED_FILE_TYPES")))),e("LOAD_FILE",((e,{query:t})=>new Promise(((n,a)=>{if(!t("GET_ALLOW_FILE_TYPE_VALIDATION"))return void n(e);const i=t("GET_ACCEPTED_FILE_TYPES"),r=t("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),c=l(e,i,r),s=()=>{const e=i.map((e=>t=>null!==e[t]&&(e[t]||t))(t("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"))).filter((e=>!1!==e)),n=e.filter(((t,n)=>e.indexOf(t)===n));a({status:{main:t("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:o(t("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:n.join(", "),allButLastType:n.slice(0,-1).join(", "),lastType:n[n.length-1]})}})};if("boolean"==typeof c)return c?n(e):s();c.then((()=>{n(e)})).catch(s)})))),{options:{allowFileTypeValidation:[!0,n.BOOLEAN],acceptedFileTypes:[[],n.ARRAY],labelFileTypeNotAllowed:["File is of invalid type",n.STRING],fileValidateTypeLabelExpectedTypes:["Expects {allButLastType} or {lastType}",n.STRING],fileValidateTypeLabelExpectedTypesMap:[{},n.OBJECT],fileValidateTypeDetectType:[null,n.FUNCTION]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:h5}));K(m5,h5,I$,z5),B3(_3,D3,H3,I3);const f5=b((({onClick:e,maxFileSize:n=16,visible:a=!0,supportedFileFormats:o,translationVariables:i,fileErrors:r},c)=>{const[l,p]=s(!1),d=i?.drop_your_file?i?.drop_your_file:t.createElement(t.Fragment,null,"Drop your file here, or Browse");return t.createElement("div",{ref:c,className:"file-upload-container "+(r?.current?.main?"errored":""),onClick:e,style:{visibility:a?"visible":"hidden"},onDragOver:e=>{e.preventDefault(),e.target.classList.add("push-backward")}}," ",t.createElement(we,{name:"file-upload-icon"}),"string"!=typeof d?t.createElement("p",null,d):t.createElement("p",{className:"drop-your-file-container",dangerouslySetInnerHTML:{__html:d}}),t.createElement("p",{className:"max-size"},((e,t,n)=>{if(n&&e&&t)return e.replace(t,n)})(i?.max_file_size,"{{max_file_size}}",String(n))||`Maximum file size : ${n} MB`),t.createElement("p",{className:"support file-formats"},i?.supported_file_formats||"Supported file formats: "," ",(o=o.join(", ")).trim()?t.createElement(t.Fragment,null,l?o:o.slice(0,20)," ",t.createElement("span",{onClick:()=>p(!l),style:{color:"#2C5CC5",textDecoration:"underline",cursor:"pointer"}},l?i?.show_less||"Show less":i?.show_more||"Show more")):"No formats selected"),t.createElement("div",{className:"filepond--drip"}))})),O5=({question:e,onChangeHandler:n,onFileUpload:a,setErrors:o,translationVariables:i,surveyServAssetUrl:c,value:l,preview:p})=>{const[d,u]=s([]),[b,M]=s([]),z=r(),m=e.type_info?.file_field?.max_file_size||10,h=r(null),f=r(),[O,A]=s(!1);let v=!1;t.useEffect((()=>{const t=localStorage.getItem(`uploadedFile-${e?.name}`),n=t?JSON.parse(t):"";n?.source&&(n.options={...n.options,file:{name:l,size:n.fileSize}},l&&u([n]))}),[]);const g=async(t,o)=>{try{if(v)return;if(f.current&&Wa(h.current)||t){const i=t??f.current.getFiles()?.[0]?.file;if(i&&a){v=!0;const t=await a(i.type,i.size,i.name,e);if(o&&o(!0,50,100),t.startsWith("http")&&c){const a=await fetch(t,{method:"PUT",headers:{"Content-Type":i.type,"Content-Disposition":"attachment"},body:i}),o=new URL(t),r=`${c}${o.pathname}`;if(!a.ok)throw console.error("Error uploading file"),new Error("Error uploading file");localStorage.setItem(`uploadedFile-${e?.name}`,JSON.stringify({source:r,options:{type:"local"},fileSize:f.current.getFiles()?.[0]?.fileSize})),n(i.name)}else n(p?"dummy":null),console.error("Error fetching pre-signed url");v=!1}}}catch(e){throw console.error("error in uploading file",e,"stringified error",JSON.stringify(e)),new Error("Error uploading file")}};return t.useEffect((()=>{(()=>{const t=e.type_info?.file_field?.allowed_file_types,n=Object.keys(Oe).map((e=>{if((t||[]).includes(e))return Oe[e].concat(",")})).join(" ").trim().slice(0,-1);M(n.split(", "))})()}),[]),t.createElement(t.Fragment,null,t.createElement(Q,{ref:f,files:d,labelFileProcessing:i?.uploading_text??"Uploading..",labelFileProcessingComplete:i?.upload_complete??"Upload complete",labelMaxFileSizeExceeded:i?.file_too_large??"The file is too large and cannot be uploaded.",labelMaxFileSize:"",labelTapToCancel:"",labelTapToUndo:"",labelFileTypeNotAllowed:i?.invalid_type??"The file mismatch. Retry by uploading the supported file type.",fileValidateTypeLabelExpectedTypes:"",beforeAddFile:e=>(h.current?.main&&(h.current=null,o({}),u([e]),A(!0)),!0),onremovefile:()=>{O?A(!1):(u([]),o({}),h.current=null,n(null))},allowReplace:!0,server:{process:async(e,t,n,a,o,i)=>{i(!0,0,100);try{await g(t,i),i(!0,100,100),a(t.name)}catch(e){o("An error occurred during upload")}}},onpreparefile:(e,t)=>{const n=new FileReader;n.onloadend=()=>{const t=n.result??"",a=new Blob([t],{type:e.fileType}),o=new File([a],e.filename,{type:e.fileType});g(o)},n.readAsArrayBuffer(t)},onerror:t=>{h.current=t,o({[e.name]:t})},required:!0,credits:!1,allowFileTypeValidation:!0,acceptedFileTypes:b,fileValidateTypeDetectType:(e,t)=>new Promise(((t,n)=>{const a=e.name.split(".");t(`.${a[a.length-1].toLowerCase()}`)})),imageEditor:{legacyDataToImageState:mJ,createEditor:K3,imageReader:[E3,{}],imageWriter:[N3,{}],imageProcessor:iF,imageEditorAfterWriteImage:({src:e,dest:t,imageState:n})=>new Promise(((a,o)=>{iF(e,{imageReader:E3(),imageWriter:N3({targetSize:{width:128,height:15,fit:"cover"}}),imageState:n}).then((n=>{a([{name:"input_",file:e},{name:"output_",file:t},{name:"thumb_",file:n.dest}])})).catch(o)})),editorOptions:{utils:["crop","finetune","filter","annotate"],imageOrienter:P3(),shapePreprocessor:Q3(),...V3,...X3,...$3,locale:{...j3,...U3,...Y3,...G3,...Z3,...F3}}},allowFileSizeValidation:!0,maxFileSize:`${m}MB`,onupdatefiles:e=>{z.current?.classList.remove("push-backward"),e.length&&u(e)},maxFiles:1,name:`${e.id}-files`}),t.createElement(f5,{ref:z,onClick:e=>{const t=e.target;"path"!==t?.tagName&&"P"!==t?.tagName&&(!t?.className||t?.className instanceof SVGAnimatedString||t.className.includes("format-type-toggler"))||f.current.browse()},fileErrors:h,visible:Boolean(!d.length||h.current?.main),maxFileSize:m,translationVariables:{...i,tTimeZones:[{id:"",offset:"",timeZone:""}]},supportedFileFormats:b}),h?.current?.main&&t.createElement("div",{className:"file-error"},t.createElement(we,{name:"info"}),t.createElement("span",null,`${h?.current?.main}\n ${h.current?.sub}`)))},A5=e=>{switch(e){case"EMAIL":return"email";case"PHONE":return"tel";case"NUMBER":return"number";default:return"text"}},v5=({question:e,autoFocusDelay:n,onChangeHandler:a,surveyStyle:o,formValues:i,fieldErrors:r,translationVariables:c,language:s,isQuestionBgDark:l,isMobile:p,isWidget:d,widgetStyle:u})=>{const b=e.type_info?.form_fields?.layout,M=e.type_info?.form_fields?.fields;return t.createElement("div",{className:`fsc-form-field-container layout-${(p||d&&"compact"===u?"VERTICAL":b??"VERTICAL").toLowerCase()}`.trim()},M?.map(((p,d)=>{const u="NUMBER"===p?.type||"PHONE"===p.type?18:256;return t.createElement("div",{className:"fsc-form-field",key:p.id},"DATE"!==p?.type&&"DATE_TIME"!==p?.type?t.createElement(t.Fragment,null,"PHONE"===p.type?t.createElement(Za,{key:d,surveyLayout:o??"card",setFocus:0===d&&"standard"!==o,autoFocusDelay:n,label:p?.label||"",type:"tel",isRequired:!!p.required,showCount:!0,maxLength:u,value:p.id&&i[e.name]?.[p.id]||"",onChangeHandler:(t,n)=>{p.id&&a({...i[e.name]??{},[p.id]:t||null},!0)},isErrored:!(!p.id||!i?.[e.name]?.[p.id])&&!!r?.[p?.id||""],errorText:p.id&&i[e.name]?.[p.id]?r?.[p?.id]:"",translationVariables:c}):t.createElement(Xa,{isQuestionBgDark:l,key:d,setFocus:0===d&&"standard"!==o,autoFocusDelay:n,onKeyDown:e=>{"PHONE"===p?.type&&Ba(e),"NUMBER"===p?.type&&$a(e)},showCount:!0,maxLength:u,placeholder:"NUMBER"===p?.type?"0":void 0,label:p?.label||"",type:A5(p?.type??"TEXT"),isRequired:!!p.required,value:p.id?i[e.name]?.[p.id]??"":"",onChange:t=>{p.id&&a({...i[e.name]??{},[p.id]:t.target.value.slice(0,u)||null})},onBlur:t=>{if(p.id){const n=i[e.name]?.[p.id],o=t.target.value.slice(0,u);(ya(n)||Wa(n))&&(ya(o)||Wa(o))||a?.({...i[e.name]??{},[p.id]:o||null},!1)}},isErrored:!(!p.id||!i?.[e.name]?.[p.id])&&!!r?.[p?.id||""],errorText:p.id&&i[e.name]?.[p.id]?r?.[p?.id]:""})):t.createElement(t.Fragment,null,"DATE_TIME"===p?.type?t.createElement(Fq,{id:p.id??"",name:e.name??"",label:p?.label??"",isRequired:!!p.required,allowOnlyFuture:!!e.type_info?.meta?.allow_future_date,language:s,useAmPm:!e.type_info?.meta?.time_format,showTimezoneSelect:!1,onChange:t=>{a({...i[e.name]??{},...p.id&&{[p.id]:t}},!0)},value:p?.id&&i[e?.name]?.[p?.id],type:"FORM_FIELD",translationVariables:c}):t.createElement(jq,{id:p.id??"",name:e.name??"",label:p?.label??"",isRequired:!!p.required,allowOnlyFuture:!!e.type_info?.meta?.allow_future_date,language:s,onChange:t=>{a({...i[e.name]??{},...p.id&&{[p.id]:t}},!0)},value:p?.id&&i[e?.name]?.[p?.id],type:"FORM_FIELD",translationVariables:c})))})))};var g5="rovingFocusGroup.onEntryFocus",y5={bubbles:!1,cancelable:!0},q5="RovingFocusGroup",[W5,w5,L5]=bt(q5),[R5,C5]=Pe(q5,[L5]),[x5,k5]=R5(q5),T5=b(((e,t)=>y(W5.Provider,{scope:e.__scopeRovingFocusGroup,children:y(W5.Slot,{scope:e.__scopeRovingFocusGroup,children:y(S5,{...e,ref:t})})})));T5.displayName=q5;var S5=b(((e,t)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:l,currentTabStopId:p,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:u,onEntryFocus:b,preventScrollOnEntryFocus:M=!1,...z}=e,m=r(null),h=Ne(t,m),f=zt(l),[O=null,A]=He({prop:p,defaultProp:d,onChange:u}),[v,g]=s(!1),q=_e(b),W=w5(a),w=r(!1),[L,R]=s(0);return c((()=>{const e=m.current;if(e)return e.addEventListener(g5,q),()=>e.removeEventListener(g5,q)}),[q]),y(x5,{scope:a,orientation:o,dir:f,loop:i,currentTabStopId:O,onItemFocus:n((e=>A(e)),[A]),onItemShiftTab:n((()=>g(!0)),[]),onFocusableItemAdd:n((()=>R((e=>e+1))),[]),onFocusableItemRemove:n((()=>R((e=>e-1))),[]),children:y(Ke.div,{tabIndex:v||0===L?-1:0,"data-orientation":o,...z,ref:h,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,(()=>{w.current=!0})),onFocus:Be(e.onFocus,(e=>{const t=!w.current;if(e.target===e.currentTarget&&t&&!v){const t=new CustomEvent(g5,y5);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=W().filter((e=>e.focusable));$5([e.find((e=>e.active)),e.find((e=>e.id===O)),...e].filter(Boolean).map((e=>e.ref.current)),M)}}w.current=!1})),onBlur:Be(e.onBlur,(()=>g(!1)))})})})),E5="RovingFocusGroupItem",N5=b(((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:o=!1,tabStopId:i,...r}=e,s=Bt(),l=i||s,p=k5(E5,n),d=p.currentTabStopId===l,u=w5(n),{onFocusableItemAdd:b,onFocusableItemRemove:M}=p;return c((()=>{if(a)return b(),()=>M()}),[a,b,M]),y(W5.ItemSlot,{scope:n,id:l,focusable:a,active:o,children:y(Ke.span,{tabIndex:d?0:-1,"data-orientation":p.orientation,...r,ref:t,onMouseDown:Be(e.onMouseDown,(e=>{a?p.onItemFocus(l):e.preventDefault()})),onFocus:Be(e.onFocus,(()=>p.onItemFocus(l))),onKeyDown:Be(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void p.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const a=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(a)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)?void 0:P5[a]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=u().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)n.reverse();else if("prev"===t||"next"===t){"prev"===t&&n.reverse();const a=n.indexOf(e.currentTarget);n=p.loop?function(e,t){return e.map(((n,a)=>e[(t+a)%e.length]))}(n,a+1):n.slice(a+1)}setTimeout((()=>$5(n)))}}))})})}));N5.displayName=E5;var P5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $5(e,t=!1){const n=document.activeElement;for(const a of e){if(a===n)return;if(a.focus({preventScroll:t}),document.activeElement!==n)return}}var B5=T5,_5=N5,H5="Radio",[D5,I5]=Pe(H5),[V5,X5]=D5(H5),j5=b(((e,t)=>{const{__scopeRadio:n,name:a,checked:o=!1,required:i,disabled:c,value:l="on",onCheck:p,form:d,...u}=e,[b,M]=s(null),z=Ne(t,(e=>M(e))),m=r(!1),h=!b||(d||!!b.closest("form"));return W(V5,{scope:n,checked:o,disabled:c,children:[y(Ke.button,{type:"button",role:"radio","aria-checked":o,"data-state":Y5(o),"data-disabled":c?"":void 0,disabled:c,value:l,...u,ref:z,onClick:Be(e.onClick,(e=>{o||p?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())}))}),h&&y(G5,{control:b,bubbles:!m.current,name:a,value:l,checked:o,required:i,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})}));j5.displayName=H5;var F5="RadioIndicator",U5=b(((e,t)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=X5(F5,n);return y(Xe,{present:a||i.checked,children:y(Ke.span,{"data-state":Y5(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t})})}));U5.displayName=F5;var G5=e=>{const{control:t,checked:n,bubbles:a=!0,...o}=e,i=r(null),s=De(n),l=Ve(t);return c((()=>{const e=i.current,t=window.HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==n&&o){const t=new Event("click",{bubbles:a});o.call(e,n),e.dispatchEvent(t)}}),[s,n,a]),y("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Y5(e){return e?"checked":"unchecked"}var Z5=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],K5="RadioGroup",[Q5,J5]=Pe(K5,[C5,I5]),e4=C5(),t4=I5(),[n4,a4]=Q5(K5),o4=b(((e,t)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:r=!1,disabled:c=!1,orientation:s,dir:l,loop:p=!0,onValueChange:d,...u}=e,b=e4(n),M=zt(l),[z,m]=He({prop:i,defaultProp:o,onChange:d});return y(n4,{scope:n,name:a,required:r,disabled:c,value:z,onValueChange:m,children:y(B5,{asChild:!0,...b,orientation:s,dir:M,loop:p,children:y(Ke.div,{role:"radiogroup","aria-required":r,"aria-orientation":s,"data-disabled":c?"":void 0,dir:M,...u,ref:t})})})}));o4.displayName=K5;var i4="RadioGroupItem",r4=b(((e,t)=>{const{__scopeRadioGroup:n,disabled:a,...o}=e,i=a4(i4,n),s=i.disabled||a,l=e4(n),p=t4(n),d=r(null),u=Ne(t,d),b=i.value===o.value,M=r(!1);return c((()=>{const e=e=>{Z5.includes(e.key)&&(M.current=!0)},t=()=>M.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}}),[]),y(_5,{asChild:!0,...l,focusable:!s,active:b,children:y(j5,{disabled:s,required:i.required,checked:b,...p,...o,name:i.name,ref:u,onCheck:()=>i.onValueChange(o.value),onKeyDown:Be((e=>{"Enter"===e.key&&e.preventDefault()})),onFocus:Be(o.onFocus,(()=>{M.current&&d.current?.click()}))})})}));r4.displayName=i4;var c4=b(((e,t)=>{const{__scopeRadioGroup:n,...a}=e,o=t4(n);return y(U5,{...o,...a,ref:t})}));c4.displayName="RadioGroupIndicator";var s4=o4,l4=r4,p4=c4;const d4=e=>{const{checked:n,className:a,disabled:o,id:i,isRequired:r,label:c,name:s,readOnly:l,onChange:p,...d}=e;return t.createElement(s4,{className:`fsc-radio ${a??""}`.trim(),name:s,"aria-label":c||"Radio button",value:n?"default":"",required:r,disabled:o,"aria-readonly":l,onValueChange:e=>{p?.(!n,e)},...d},t.createElement("div",{className:"fsc-radio-container"},t.createElement(l4,{checked:n,"aria-checked":n,className:"fsc-radio-item",disabled:o,"aria-readonly":l,id:i,value:"default"},t.createElement(p4,{className:"fsc-radio-indicator"})),c&&t.createElement("label",{htmlFor:i,className:"fsc-radio-label"},c,c&&r&&t.createElement("span",null,"*"))))},u4=e=>{const{type_info:{matrix_properties:n},onChangeHandler:a,value:o}=e;return t.createElement("div",{className:"matrix-container","data-test-input":"matrix"},t.createElement("table",{className:"st-mt-table"},t.createElement("thead",{className:"st-mt-thead"},t.createElement("tr",{className:"st-mt-tr"},t.createElement("th",{className:"m-s-b-s-q-m-s-th-empty st-mt-th"}),n?.rating_labels?.map(((e,n)=>e.is_active?t.createElement("th",{key:e.id,className:"m-s-b-s-q-m-s-th st-mt-th"},t.createElement("div",{className:"m-s-b-s-q-m-s-th-div"},e.text)):null)))),t.createElement("tbody",{className:"st-mt-tbody"},n?.statements?.map(((e,i)=>e.is_active?t.createElement("tr",{key:e.id,className:"m-s-b-s-q-m-s-tr-hover st-mt-tr"},t.createElement("td",{className:"m-s-b-s-q-m-s-input st-mt-td"},e.text),n?.rating_labels?.map(((r,c)=>{if(!r.is_active)return null;const s=o?.find((t=>t?.statement_id===e?.id));return t.createElement("td",{key:r.id,className:"m-s-b-s-q-m-s-switch st-mt-td"},"SINGLE_ANSWER"===n?.type&&t.createElement(d4,{key:r.id||`${i}-key-${c}`,name:`q-m-s-radio-${i}-key-${c}`,checked:!!s?.rating_labels?.find((e=>e?.id===r?.id)),id:r.id??"",onChange:()=>{e?.id&&r?.id&&a(s?.statement_id?[...o||[]].map((e=>e?.statement_id===s?.statement_id?{...s,rating_labels:[{id:r.id||"",text:r?.text||""}]}:e)):[...o||[],{statement_id:e.id,rating_labels:[{id:r.id,text:r?.text||""}]}])},label:""}),"MULTIPLE_ANSWERS"===n?.type&&t.createElement(dt,{key:r.id||`${i}-key-${c}`,name:`q-m-s-checkbox-${i}-key-${c}`,checked:!!s?.rating_labels?.find((e=>e?.id===r?.id)),id:r.id??"",onChange:t=>{e?.id&&r?.id&&a(s?.statement_id?[...o||[]].map((e=>e.statement_id===s.statement_id?{...s,rating_labels:t?[...s.rating_labels||[],{id:r.id||"",text:r?.text||""}]:(s.rating_labels||[]).filter((e=>e?.id!==r.id))}:e)):[...o||[],{statement_id:e.id,rating_labels:[{id:r.id,text:r?.text||""}]}])}}))}))):null)))))},b4=e=>{const{type_info:{matrix_properties:n},onChangeHandler:a,name:o,isMobile:i,isReverseAnimation:r,statementIndex:c,value:s,widgetStyle:l,language:p="en"}=e,d=t.useMemo((()=>(n?.statements||[]).find(((e,t)=>t===c))),[n?.statements,c]),u=t.useMemo((()=>s?.find((e=>e?.statement_id===d?.id))),[d,s]);return t.createElement("div",{className:"matrix-wd-container","data-test-input":"matrix"},t.createElement("div",{className:"matrix-st-count"},`${c+1}/${(n?.statements||[]).length}`),t.createElement(HT,{exitBeforeEnter:!0},t.createElement(NT.div,{key:`${d?.id??""}`,initial:{opacity:0,x:La(p,r)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(p,r)},transition:{duration:.2}},t.createElement("div",{className:"matrix-st-text"},d?.text),t.createElement("div",{className:`matrix-st-labels wd-style-${l} ${i?"mt-mobile":""}`.trim()},"MULTIPLE_ANSWERS"===n?.type&&t.createElement(h$,{name:o??"",onChangeHandler:e=>{if(d?.id){const t=u?.statement_id?[...s||[]].map((t=>t.statement_id===u.statement_id?{...u,rating_labels:e.map((e=>{const t=n?.rating_labels?.find((t=>t.id===e));return{id:e,text:t?.text||""}}))}:t)):[...s||[],{statement_id:d.id,rating_labels:e.map((e=>{const t=n?.rating_labels?.find((t=>t.id===e));return{id:e,text:t?.text||""}}))}];a(t)}},saveOthersValue:()=>{},options:(n?.rating_labels??[]).map((e=>({id:e.id,value:e.text}))),values:(u?.rating_labels??[]).map((e=>e.id??"")),autoFocusDelay:0,othersValue:""}),"SINGLE_ANSWER"===n?.type&&t.createElement(DT,{name:o??"",language:p||"en",onChangeHandler:e=>{const t=n?.rating_labels?.find((t=>t.id===e));d?.id&&e&&a(u?.statement_id?[...s||[]].map((n=>n?.statement_id===u?.statement_id?{...u,rating_labels:[{id:e||"",text:t?.text||""}]}:n)):[...s||[],{statement_id:d.id,rating_labels:[{id:e,text:t?.text||""}]}])},saveOthersValue:()=>{},options:(n?.rating_labels??[]).map((e=>({id:e.id,value:e.text}))),value:u?.rating_labels?.[0]?.id??"",othersValue:""})))))},M4=({question:e,autoFocusDelay:n,setFocus:a,formValues:o,surveyLayout:i,onChangeHandler:r,isQuestionBgDark:c})=>{const s=e?.type_info?.number_field?.decimal,l=e?.type_info?.number_field?.decimal_point,p=s?2===l?"0.01":"0.1":"1",d=o[e.name],[u,b]=t.useState(d);t.useEffect((()=>{u&&!d&&b(d)}),[d]);const{maxLength:M,maxNumber:z}=t.useMemo((()=>{const e=s?16:18;var t;return{maxLength:e,maxNumber:(t=e)>=16?10n**BigInt(t)-1n:10**t-1}}),[s]),m=e=>{s&&!ya(l)&&(e.split(".")?.[1]?.length??0)>(l??0)||r(e?qa(e,s||!1):"",!1)};return t.createElement("div",{className:"responsive-input-field"},t.createElement(Xa,{autoFocusDelay:n,isRequired:!!e.required,type:"number",step:p,placeholder:e?.type_info?.meta?.placeholder??s?"0.0"+(2===l?"0":""):"0",onKeyDown:e=>{const{key:t,keyCode:n,which:a,code:o}=e;if(["e","E"].includes(t)&&e.currentTarget.value&&e.preventDefault(),"."===t&&s||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||["Backspace","Shift","Tab","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","-","+","e","E"].includes(t))return;if(["e","E"].includes(t))return;const i=void 0===a?n??o:a;String.fromCharCode(i).match(/^[0-9]+$/)||e.preventDefault()},..."card"===i?{value:d??"",onChange:e=>{if(e.target.value.includes("e+"))return;const t=BigInt(e.target.value.split(".")[0]??"");BigInt(t)<=z&&e.target.value.length<=M&&m(e.target.value)}}:{value:u??"",onChange:e=>{if(e.target.value.includes("e+"))return;const t=BigInt(e.target.value.split(".")[0]??""),n=e.target.value.split(".")[1]??"";if(n.length>(l??0))return;const a=BigInt(t);a<=z&&e.target.value.length<=M&&b(`${a}${ya(n)||Wa(n)?"":`.${n}`}`)},onBlur:()=>{return e=u,void((ya(d)||Wa(d))&&(ya(u)||Wa(u))||u===d||m(e));var e}},setFocus:a,showCount:!0,max:`${z}`,maxLength:M,isQuestionBgDark:c}))},z4=({question:e,questionCommentOnchangeHandler:n,commentsMeta:a,setFocus:o,isQuestionBgDark:i,isCommentsEnabled:r})=>{const[c,s]=t.useState(a?.toString());return r?t.createElement(HT,null,t.createElement(NT.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},transition:{duration:.3,ease:"easeInOut"},exit:{height:0,opacity:0},className:"question-comments"},t.createElement(WP,{showCount:!0,maxLength:1500,rows:2,isRequired:!!e.required,placeholder:e?.type_info?.comment_placeholder??"Enter your comment",onChange:t=>{const a=t.target.value||"";s(a),n?.(e.name,a)},value:a||c,setFocus:!0,isQuestionBgDark:i,"aria-label":e.name}))):null},m4=e=>{switch(e){case"EMAIL":return"email";case"PHONE":return"tel";case"URL":return"url";default:return"text"}},h4=e=>{switch(e){case"PHONE":return"phone";case"EMAIL":return"email";case"URL":return"url";default:return""}},f4=({question:e,autoFocusDelay:n,formValues:a,onChangeHandler:o,textboxErrors:i,surveyLayout:r,setFocus:c,onKeyDownHandler:s,translationVariables:l,isQuestionBgDark:p})=>{const d=e?.type_info?.text_field?.text_type,u=a[e.name],[b,M]=t.useState(u);return t.useEffect((()=>{b&&!u&&M(u)}),[u]),t.createElement("div",{className:"responsive-input-field"},"PHONE"===d?t.createElement(Za,{startAdornment:t.createElement(we,{fill:"var(--choices-answers-color, var(--question-text-color, var(--default-question-text-color)))",name:h4(d)}),type:m4(d),setFocus:c,autoFocusDelay:n,label:"",isRequired:!!e.required,value:u,isErrored:!!i[e.name],errorText:i[e.name]||"",placeholder:e?.type_info?.meta?.placeholder??"",onChangeHandler:o,maxLength:18,showCount:!0,onKeyDownHandler:s,surveyLayout:r,translationVariables:l}):t.createElement(Xa,{startAdornment:d&&"TEXT"!==d&&t.createElement(we,{fill:"var(--choices-answers-color, var(--question-text-color, var(--default-question-text-color)))",name:h4(d)}),type:m4(d),setFocus:c,autoFocusDelay:n,showCount:!0,label:"",onKeyDown:s,isRequired:!!e.required,isErrored:!!i[e.name],errorText:i[e.name]||"",placeholder:e?.type_info?.meta?.placeholder??"",..."card"===r?{value:u??"",onChange:e=>o(e.target.value)}:{onBlur:e=>{(ya(u)||Wa(u))&&(ya(b)||Wa(b))||b===u||o?.(e.target.value,!0)},value:b??"",onChange:e=>M(e.target.value)},maxLength:50,isQuestionBgDark:p}))},O4=({surveyLanguage:e,language:n="en",question:a,formValues:o,othersMeta:i,onChangeHandler:r,saveOthersValue:c,autoFocusDelay:s,isFinalQn:l,isWidget:p,isMobile:d,initialPivotAnswer:u,initialQuestionAnswer:b,isInitialTransition:M,formQuestionErrors:z,dateQuestionErrors:m,contactFormErrors:h,activeIndexOfRenderedStatement:f={},textboxQuestionErrors:O,isReverseAnimation:A,fileUploadErrors:v,preview:g,onFileUpload:y,widgetStyle:q="default",setErrors:W,translationVariables:w,surveyServAssetUrl:L,setFocus:R,block:C,onKeyDown:x,surveyStyle:k,isQuestionBgDark:T})=>{const S=a?.type_info?.question_comment,E=a?.type_info?.footer_text&&a.type_info.meta?.question_hint?t.createElement("div",{className:"footer question-hint ss-question-hint",role:"note",dangerouslySetInnerHTML:{__html:a?.type_info?.footer_text}}):t.createElement(t.Fragment,null),N=o[a.name],[P,$]=t.useState(N);switch(t.useEffect((()=>{P&&!N&&$(N)}),[N]),a?.type_info?.question_type){case"MATRIX_RATING_SCALE":return t.createElement(t.Fragment,null,p||d?t.createElement(b4,{language:n,name:a.name,isReverseAnimation:A,type_info:a?.type_info||{},onChangeHandler:e=>{r(e?.filter((e=>(e.rating_labels||[]).length>0)))},isMobile:d,value:o[a.name]||[],statementIndex:f[a.name]??0,widgetStyle:q}):t.createElement(u4,{type_info:a?.type_info||{},onChangeHandler:e=>{r(e?.filter((e=>(e.rating_labels||[]).length>0)))},value:o[a.name]||[]}),E);case"RANGE":return t.createElement(t.Fragment,null,t.createElement(XT,{question:a,onChangeHandler:r,isWidget:p,isMobile:d,widgetStyle:q,value:o[a.name],initialPivotAnswer:u,isInitialTransition:M}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"CHECKBOX":case"MULTI_SELECT":return t.createElement(t.Fragment,null,t.createElement(h$,{name:a.name,values:o[a.name],othersValue:i[a.name],options:a?.choices||[],onChangeHandler:r,saveOthersValue:c,isOthersOption:!!(a?.choices||[]).find((e=>e.meta?.is_others)),othersRequired:!!a?.type_info.meta?.othersRequired,autoFocusDelay:s,translationVariables:w,othersInputPlaceholder:a?.type_info?.comment_placeholder}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"RADIO":case"DROPDOWN":return t.createElement(t.Fragment,null,t.createElement(DT,{autoFocusDelay:s,name:a.name,onChangeHandler:r,initialQuestionAnswer:b,displayFormat:a?.type_info?.meta?.display_format||"LIST",saveOthersValue:c,options:a?.choices||[],value:o[a.name],othersValue:i[a.name],isOthersOption:!!(a?.choices||[]).find((e=>e.meta?.is_others)),language:n||"en",othersRequired:!!a?.type_info.meta?.othersRequired,isFinalQn:l,translationVariables:w,isQuestionBgDark:T,othersInputPlaceholder:a?.type_info?.comment_placeholder}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"TEXT":return t.createElement(t.Fragment,null,t.createElement(f4,{question:a,autoFocusDelay:s,formValues:o,onChangeHandler:r,textboxErrors:O||"",setFocus:R,onKeyDownHandler:x,surveyLayout:k??"card",translationVariables:w,isQuestionBgDark:T}),E);case"NUMBER":return t.createElement(t.Fragment,null,t.createElement(M4,{question:a,autoFocusDelay:s,formValues:o,setFocus:R,onChangeHandler:r,surveyLayout:k??"card",isQuestionBgDark:T}),E);case"FORM_FIELD":return t.createElement(t.Fragment,null,t.createElement(v5,{widgetStyle:q,question:a,isWidget:p,isMobile:d,surveyStyle:k,isRequired:!!a.required,autoFocusDelay:s,translationVariables:w,onChangeHandler:(e,t)=>{r(e,"card"!==k&&t)},formValues:o,fieldErrors:z?.[a.name]||{},language:n||"en",isQuestionBgDark:T}),E);case"CONTACT_FORM":return t.createElement(t.Fragment,null,t.createElement(O$,{question:a,setFocus:R,autoFocusDelay:s,onChangeHandler:r,translationVariables:w,formValues:o,fieldErrors:h?.[a.name]||{},language:n||"en",isQuestionBgDark:T}),E);case"PARAGRAPH":return t.createElement(t.Fragment,null,t.createElement(WP,{showCount:!0,maxLength:1500,autoFocusDelay:s,isRequired:!!a.required,placeholder:a?.type_info?.meta?.placeholder??"",..."card"===k?{value:N??"",onChange:e=>r(e.target.value)}:{onBlur:e=>{(ya(N)||Wa(N))&&(ya(P)||Wa(P))||P===N||r?.(e.target.value,!0)},value:P??"",onChange:e=>$(e.target.value)},setFocus:R,isQuestionBgDark:T,"aria-label":a.name}),E);case"BOOLEAN":case"RESOLUTION":return t.createElement(t.Fragment,null,t.createElement(xe,{type_info:a?.type_info,onSelect:r,value:o[a.name]}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"MESSAGE":return E;case"CONSENT":return t.createElement(t.Fragment,null,t.createElement(f$,{question:a,onChange:r,value:o[a.name]}),E);case"SLIDER":const e=a?.type_info.meta?.slider;return t.createElement(t.Fragment,null,t.createElement(yP,{defaultValue:[o[a.name]??e?.opening_position],isRequired:!!a.required,dir:wa(n)?"rtl":"ltr",answer:o[a.name],min:e?.min,max:e?.max,onValueChange:([e],t)=>r(e,"card"!==k&&t),isInput:e?.numerical_input_box,gridLines:e?.grid_lines,stopAtGrid:e?.stop_at_grid_lines,allowDecimals:e?.allow_decimal,decimalPoints:e?.decimal_points,isMobile:d||"compact"===q}),S&&null!=o[a.name]&&t.createElement(z4,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:R,isQuestionBgDark:T,isCommentsEnabled:S}),E);case"RANK_ORDER":const{others_meta:v,...C}=o;return t.createElement(t.Fragment,null,t.createElement(wN,{valueItems:C[a.name],items:a?.choices||[],onReorder:(e,t)=>r(e,"card"!==k&&t)}),E);case"DATE_TIME":return t.createElement(t.Fragment,null,"DATE_TIME"===a.type_info.meta?.question_format?t.createElement(Fq,{id:a.id??"",name:a.name??"",type:"QUESTION",displayFormat:a.type_info.meta?.format??void 0,allowOnlyFuture:a.type_info.meta?.allow_future_date||!1,useAmPm:!a.type_info.meta?.time_format,showTimezoneSelect:!!a.type_info.meta?.time_zone,onChange:(e,t)=>{r(e,"card"!==k&&t)},setErrors:e=>{W((t=>({...t,dateQuestionErrors:e})))},fieldErrors:m?.[a.name]??[],value:o[a.name]||"",translationVariables:w,language:n||"en",isQuestionBgDark:T,isWidget:p}):t.createElement(jq,{allowOnlyFuture:a.type_info.meta?.allow_future_date||!1,type:"QUESTION",displayFormat:a.type_info.meta?.format??void 0,onChange:e=>{r(e,!1)},value:o[a.name]||"",translationVariables:w,language:n||"en",fieldErrors:m?.[a.name]??[],isQuestionBgDark:T,isWidget:p}),E);case"FILE":return t.createElement(O5,{setErrors:e=>{W({formQuestionErrors:z,textboxQuestionErrors:O,contactFormErrors:h,fileUploadErrors:e,dateQuestionErrors:m})},preview:g,onChangeHandler:r,question:a,onFileUpload:y,value:o[a.name]||"",translationVariables:w,surveyServAssetUrl:L});default:return console.error(`Question type ${a?.type_info?.question_type} not found`),null}},A4=({surveyServAssetUrl:e,thankYouQuestion:n,preview:a,placeholders:o,canResubmit:i,resetSurvey:r,navigateToStart:l,isMobile:p,allowMultipleSubmission:d,pivot:u,answers:b,questions:M,rangeToRender:z,translationVariables:m})=>{const{redirectUrl:h,redirectDelay:f,show_custom_button:O,show_review_links:A,show_social_links:v,image_url:g}=n?.type_info?.meta??{},[y,q]=s(f??10),[W,w]=t.useState(!1);return c((()=>{if(!a&&h){const e=setInterval((()=>q((e=>e>1?e-1:("undefined"!=typeof window&&(window.location.href=h??""),0)))),1e3);return()=>{clearInterval(e),w(!1)}}return()=>{w(!1)}}),[]),t.createElement("div",{className:"question-container ss-question-container thankyou"},g&&t.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:g,alt:"thankyou_logo"}),t.createElement(t.Fragment,null,Ca(n)),t.createElement("div",{className:"text ss-thankyou-message",dangerouslySetInnerHTML:{__html:ka({questionText:n.text,placeholders:o,npsRating:Ta({theme:"nps",answers:b,questions:M})??"",npsRatingLabel:Sa({theme:"nps",answers:b,questions:M}),csatRating:Ta({theme:"csat",answers:b,questions:M})??"",csatRatingLabel:Sa({theme:"csat",answers:b,questions:M}),cesRating:Ta({theme:"ces",answers:b,questions:M})??"",cesRatingLabel:Sa({theme:"ces",answers:b,questions:M}),preference:u?.question.type_info?.scale_properties?.labels?.preference,isPreview:a})}}),(i||d)&&t.createElement("div",{className:("wrap-up-actions "+(p?"mobile":"")).trim()},i&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:W,onClick:()=>{w(!0),l()},"aria-label":m?.edit_response||"Edit your response"},t.createElement(we,{name:"edit"}),m?.edit_response||"Edit your response"),d&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:W,onClick:()=>{w(!0),r()},"aria-label":m?.another_response||"Submit another response"},t.createElement(we,{name:"reload"}),m?.another_response||"Submit another response")),h&&t.createElement("div",{className:"redirection-container"},t.createElement("div",{className:"redirection-text"},Pa(y,m?.redirect_msg),t.createElement("br",null)),t.createElement("a",{className:"link",href:h},h)),(O||A||v)&&t.createElement(m$,{show_custom_button:O,show_review_links:A,show_social_links:v,surveyServAssetUrl:e}))},v4=({activeIndexOfRenderedStatement:e,navigateToPreviousBlock:n,canDisplayDisableButtonParams:a,navigateToNextBlock:o,translationVariables:i,setAnimationInProgress:r,animationInProgress:c,question:s})=>t.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},t.createElement("button",{disabled:c||QP("navigation-prev",a),className:"navigation-button ss-navigation-button",onClick:()=>{r(!0),setTimeout((()=>{r(!1)}),se),n()},title:s.name&&(e?.[s.name]??0)>0?i?.prev_statement||"go to previous statement":i?.prev_question||"go to previous question"},t.createElement(we,{name:"arrow-previous"})),t.createElement("button",{className:"navigation-button ss-navigation-button",disabled:c||QP("navigation-next",a),title:i?.next_question||"Go to next question",onClick:()=>{r(!0),setTimeout((()=>{r(!1)}),se),o()}},t.createElement(we,{name:"arrow-next"}))),g4=e=>{const{initialStatementHasAnswer:n,answers:a,renderedBlocks:o,blocks:i,activeIndexOfBlocks:r,activeIndexOfRenderedStatement:c={},activeIndexOfRenderedBlocks:l,saveFormValues:p,onSubmitHandler:d,skipBlock:u,skipStatement:b,survey:M,navigateToNextBlock:z,navigateToPreviousBlock:m,isInitialTransition:h,initialPivotAnswer:f,translationVariables:O,navigateToNextStatement:A,canDisplayDisableButtonParams:v,formQuestionErrors:g,dateQuestionErrors:y,textboxQuestionErrors:q,contactFormErrors:W,questions:w,pages:L,buttonRef:R,isReverseAnimation:C,isSubmitting:x}=e,[k,T]=s(!1),{question:S}=o[l],E={...v,isSubmitting:x},N=S?.type_info?.meta?.display_format,P=SP({blocks:i,activeIndexOfBlocks:r,renderedBlocks:o,activeIndexOfRenderedBlocks:l,questions:w});return t.createElement(t.Fragment,null,(UP("message",E)||UP("consent",E))&&t.createElement(HT,{exitBeforeEnter:!0},t.createElement(NT.div,{key:S.name??"",id:`consent-buttons-${S.name??""}`,className:"question-consent-buttons ss-consent-action-buttons",initial:{opacity:0,x:La(e.language,C)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(e.language,C)},transition:{duration:.2}},UP("consent",E)&&"BUTTON"===N&&fe.map((e=>t.createElement(Te,{key:l+String(e.recordAs),onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),p(o[l],e.recordAs,!0)},disabled:k||QP("consent",E),variant:ya(a.formValues?.[S.name])||a.formValues?.[S.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(a.formValues?.[S.name]===e.recordAs?"selected":"")).trim()},S?.type_info?.scale_properties?.labels?.values?.[e.id]||e.defaultValue))),UP("message",E)&&t.createElement(Te,{onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),P?d("COMPLETE"):u()},disabled:k||QP("message",E),className:"message-button ss-action-message-button"},S?.type_info?.scale_properties?.labels?.values?.[0]||"Begin"))),(UP("navigation",E)||UP("next",E)||UP("next-statement",E)||UP("submit",E)||UP("skip",E)||UP("skip-statement",E))&&t.createElement("div",{className:"question-footer ss-question-footer-container"},UP("navigation",E)?t.createElement(v4,{animationInProgress:k,setAnimationInProgress:T,answers:a,canDisplayDisableButtonParams:E,activeIndexOfBlocks:r,activeIndexOfRenderedBlocks:l,renderedBlocks:o,initialStatementHasAnswer:n,blocks:i,activeIndexOfRenderedStatement:c,navigateToNextBlock:z,navigateToPreviousBlock:m,translationVariables:O,pages:L,question:S}):t.createElement("div",null),t.createElement("div",{className:"action-buttons ss-action-buttons"},UP("skip",E)&&t.createElement(Te,{className:"skip-button ss-action-skip-button",onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),u()},variant:"secondary","aria-label":"skip question",disabled:k||x},e?.survey?.meta?.action_button?.skip||O?.actionButtonText?.skip||O?.skip||"Skip"),UP("skip-statement",E)&&t.createElement(Te,{className:"skip-button ss-action-skip-button",onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),b()},"aria-label":"skip statement",variant:"secondary",disabled:k||x},e?.survey?.meta?.action_button?.skip||O?.actionButtonText?.skip||O?.skip||"Skip"),UP("next",E)&&t.createElement(Te,{ref:R,onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),0!==l||!h||"RANGE"!==S.type_info?.question_type&&"BOOLEAN"!==S.type_info?.question_type||S.type_info?.question_comment||void 0===f?p(o[l],"CHECKBOX"===S?.type_info?.meta?.display_format&&"CONSENT"===S?.type_info?.question_type?a.formValues[S.name]??!1:a.formValues[S.name],!0):p(o[l],f,!0)},disabled:k||QP("next",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||O?.actionButtonText?.next||O?.next||"Next"),UP("next-statement",E)&&t.createElement(Te,{ref:R,onClick:()=>{T(!0),setTimeout((()=>{T(!1)}),se),A?.(S.name)},disabled:k||!!QP("next-statement",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||O?.actionButtonText?.next||O?.next||"Next"),UP("submit",E)&&t.createElement("div",{className:"submit ss-action-submit-button"},t.createElement(Te,{ref:R,disabled:k||QP("submit",E),onClick:()=>{Wa(y?.[S.name])&&Wa(g?.[S.name])&&Wa(q?.[S.name])&&Wa(W?.[S.name])&&(T(!0),setTimeout((()=>{T(!1)}),se),d("COMPLETE"))}},M?.meta?.action_button?.submit||O?.actionButtonText?.submit||O?.submit_survey||"Submit")))))},y4=e=>{const{blocks:n,pages:a,activePage:i,renderedBlocks:l,activeBlock:p,activeIndexOfBlocks:d,activeIndexOfRenderedBlocks:u,isSurveyCompleted:b,isReverseAnimation:M,saveFormValues:z,saveOthersValue:m,skipBlock:h,skipStatement:f,onSubmitHandler:O,navigateToNextBlock:A,navigateToPreviousBlock:v,answers:g,questions:y,pivot:q,isInitialTransition:W,resetSurvey:w,activeIndexOfRenderedStatement:L,navigateToNextStatement:R,navigateToPreviousStatement:C,navigateToStart:x,translationVariables:k,initialStatementHasAnswer:T,dateQuestionErrors:S,formQuestionErrors:E,textboxQuestionErrors:N,contactFormErrors:P,fileUploadErrors:$,setErrors:B,expanded:_,setExpanded:H,isQuestionBgDark:D,isSubmitting:I}=d$(e);Da("Card",{...e,answers:g,activePage:i,activeBlock:p,renderedBlocks:l,activeIndexOfBlocks:d,activeIndexOfRenderedBlocks:u,activeIndexOfRenderedStatement:L});const V=r(null),X=Wa(g.formValues)&&e.survey.prompt_settings?.is_enabled&&e.preview,[j,F]=s(X),U=t.useMemo((()=>xa(q?.question)),[q?.question]),G=o((()=>n.filter((({name:e},t,n)=>!BP({nextBlockName:e||"",blocks:n,questions:y}))).length),[n,y]);c((()=>{p&&e.onBlockChange?.(p,i)}),[p,e]),c((()=>{e.survey.theme&&Ea(e.survey.theme,e.surveyServAssetUrl??"")}),[e.survey.theme,e.surveyServAssetUrl]),c((()=>{e.getSurveyProgress?.({totalBlocks:G,isSurveyCompleted:b,noOfAnswers:d})}),[G,b,d]);const Y={answers:g,blocks:n,blockIndex:u,activeIndexOfBlocks:d,initialStatementHasAnswer:T,activeIndexOfRenderedBlocks:u,activeIndexOfRenderedStatement:L,renderedBlocks:l,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:W,questions:y,pages:a,activeIndexOfSet:0,branchSeparatePage:!1,pivot:q};return p&&p.question?t.createElement("div",{className:`freemium-survey-components card-survey-style ${wa(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${e.isMobile?"mobile-preview":""}`.trim(),id:"freemium-survey"},t.createElement("div",{className:("question-holder "+(j?"prompt":"")).trim()},!b&&!j&&!e.isWidget&&a.length>0&&i?.page_id&&t.createElement(u$,{expanded:_,id:i.page_id,setExpanded:H,activePage:i,translationVariables:k}),t.createElement("div",{className:"questions ss-questions"},b?t.createElement(A4,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:EP({pivotQn:q?.question,pivotQnAnswer:q?.answer,block:_P({activeBlock:p,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:g,questions:y,activeIndexOfBlocks:d,renderedBlocks:l,contactData:e.contactData,surveyLayout:"card",pages:a}),questions:y}),canResubmit:e.canResubmit,allowMultipleSubmission:e.allowMultipleSubmission,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",x):x()},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",w):w()},preview:!!e.preview,placeholders:e.placeholders,isMobile:e.isMobile,pivot:q,rangeToRender:U,translationVariables:k,answers:g}):t.createElement(t.Fragment,null,!j&&e.isWidget&&a.length>0&&i?.page_id&&t.createElement(u$,{expanded:_,id:i.page_id,setExpanded:H,activePage:i,translationVariables:k}),t.createElement(HT,{exitBeforeEnter:!0},t.createElement(NT.div,{id:`${p.question.name}`,className:"question-container ss-question-container","data-test-question-name":p.question.name,key:`${p.question.name}`,initial:{opacity:0,x:La(e.language,M)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(e.language,M)},transition:{duration:.2}},j&&e.survey.prompt_settings?t.createElement(M$,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt?.(t),1===t&&F(!1)},placeholders:e.placeholders,isPreview:!!e.preview}):t.createElement(t.Fragment,null,t.createElement("div",{className:("question-text ss-question-text "+(p.required?"required":"")).trim(),dangerouslySetInnerHTML:{__html:ka({questionText:p?.question.text,placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:g,questions:y})??"",npsRatingLabel:Sa({theme:"nps",answers:g,questions:y}),csatRating:Ta({theme:"csat",answers:g,questions:y})??"",csatRatingLabel:Sa({theme:"csat",answers:g,questions:y}),cesRating:Ta({theme:"ces",answers:g,questions:y})??"",cesRatingLabel:Sa({theme:"ces",answers:g,questions:y}),preference:q?.question.type_info?.scale_properties?.labels?.preference,isPreview:!!e.preview})},"aria-label":`question-${u}`,role:"heading","aria-level":1}),t.createElement(O4,{setFocus:!0,onKeyDown:e=>{"Enter"===e.key&&V.current&&V.current.click()},isReverseAnimation:M,preview:!!e.preview,surveyServAssetUrl:e.surveyServAssetUrl,setErrors:B,onFileUpload:e.onFileUpload,language:e.language||"en",surveyStyle:e.surveyStyle,surveyLanguage:e.survey.language,block:p,question:p.question,isFinalQn:SP({blocks:n,activeIndexOfBlocks:d,renderedBlocks:l,activeIndexOfRenderedBlocks:u,questions:y}),formValues:g.formValues,othersMeta:g.others,autoFocusDelay:"standard"===e.surveyStyle?350:0,activeIndexOfRenderedStatement:L,saveOthersValue:m,onChangeHandler:(e,t)=>{z(p,e,t)},isMobile:!!e.isMobile,initialPivotAnswer:e.initialPivotAnswer,initialQuestionAnswer:e.initialQuestionAnswer,isInitialTransition:W,formQuestionErrors:E,dateQuestionErrors:S,textboxQuestionErrors:N,fileUploadErrors:$,contactFormErrors:P,translationVariables:k,isQuestionBgDark:D})))),!j&&t.createElement(g4,{isWidget:!1,language:e.language||"en",isReverseAnimation:M,surveyStyle:e.surveyStyle,canDisplayDisableButtonParams:Y,answers:g,renderedBlocks:l,blocks:n,pages:a,activeIndexOfRenderedStatement:L,buttonRef:V,survey:e.survey,initialStatementHasAnswer:T,navigateToNextStatement:R,navigateToPreviousStatement:C,activeIndexOfRenderedBlocks:u,activeIndexOfBlocks:d,saveFormValues:z,skipBlock:h,skipStatement:f,onSubmitHandler:O,navigateToPreviousBlock:v,navigateToNextBlock:A,isInitialTransition:W,initialPivotAnswer:e.initialPivotAnswer,isMobile:!!e.isMobile,translationVariables:k,formQuestionErrors:E,dateQuestionErrors:S,textboxQuestionErrors:N,fileUploadErrors:$,contactFormErrors:P,questions:y,isSubmitting:I})))),!e.footerProps?.hideFooter&&(e?.footerProps?.languageDDComponent||e?.footerProps?.showFWBranding||e.footerProps?.footerContent)?t.createElement(Ga,{...e.footerProps,surveyStyle:e.surveyStyle,bgColor:e.survey.theme?.palette?.footer_background??e.survey.theme?.palette?.survey_background??z$}):null):null},q4=e=>{const n=!!e.survey.meta?.branch_separate_page,a=e.survey.question_details?.questions||[],i=e.contactData||{},l=e.translationVariables||{},p=r({}),[d,u]=s(e.survey?.blocks?.filter((e=>"TY"!==e.name&&!e.is_deleted))),[b,M]=s({formQuestionErrors:{},textboxQuestionErrors:{},fileUploadErrors:{},contactFormErrors:{},dateQuestionErrors:{}}),[z,m]=s(!1),[h,f]=s(0),[O,A]=s(e.survey.pages??[]),[v,g]=s(O?.[0]),[y,q]=s(!1),W=o((()=>n$({pages:O,blocks:d,questions:a,initialPivotAnswer:e.initialPivotAnswer,responses:e.answers,answerStatus:e.answerStatus||"PARTIAL",branchSeparatePage:n,surveyLayout:"standard",contactData:i})),[d,a,e.answers]),[w,L]=s(W.renderedBlocks),[R,C]=s(W.activeIndexOfRenderedBlocks),[x,k]=s(0),[T,S]=s(W.activeIndexOfRenderedStatement),E=r(W.pivot),N=r(W.isInitialTransition),[P,$]=s(""),[B,_]=s(W.answers),H=r(((W.isConsideredCompleted||"PARTIAL"===e.answerStatus)&&e.canResubmit)??!1),[D,I]=s(!1),V=w[R],X=t.useMemo((()=>w.length>0?d?.findIndex((e=>e.name===w[R]?.name)):0),[R]),j=o((()=>{const t=e.survey.theme?.palette?.question_background;return!!t&&Ia(t)}),[e.survey.theme?.palette?.question_background]);c((()=>{e.survey.updated_at!==P&&(Da("useEffect",{updated_at:e.survey.updated_at,props:e}),A(e.survey.pages??[]),u(e.survey.blocks?.filter((e=>"TY"!==e.name&&!e.is_deleted))),g(e.survey.pages?.[0]),$(e.survey.updated_at??""))}),[e.survey.updated_at]),c((()=>{Da("useEffect",{renderedBlocks:w,pages:O,activeIndexOfRenderedBlocks:R,props:e});const t=w?.[R]?.page_id,a=O.find((e=>e.page_id===t));O.length>0&&t&&a?.page_id&&g(a),void 0!==w?.[R]?.orderOfSet&&n&&k(w?.[R]?.orderOfSet)}),[w,O,R]),c((()=>{Da("useEffect",{blocks:d,initialPivotAnswer:e.initialPivotAnswer,props:e});let t={...B};if(W.isConsideredCompleted&&N.current&&e.canResubmit)return;const{others_meta:o,...r}=e.answers||{};E.current={...E.current,question:xP({questions:a,blocks:d})};const c=a.find((e=>e.name===d?.[0]?.question_name||e.name===d?.[0]?.question_names?.[0]))??E.current.question;if(Wa(r)||void 0===e.initialPivotAnswer||r[c.name]===e.initialPivotAnswer||(t={...B,formValues:{...B.formValues,[c.name]:e.initialPivotAnswer},moveToNextPage:!0}),void 0!==e.initialPivotAnswer){const n=kP(E.current.question,e.initialPivotAnswer);E.current={...E.current,answer:"BOOLEAN"===c?.type_info?.question_type?Boolean(n):n},t={...B,formValues:{...B.formValues,[c.name]:E.current.answer},moveToNextPage:!1}}else void 0!==e.initialQuestionAnswer&&(t={...B,formValues:{...B.formValues,[c.name]:e.initialQuestionAnswer},moveToNextPage:!1});_(t);const s=EP({pivotQn:E.current.question,pivotQnAnswer:E.current.answer,block:d[0],questions:a}),l=e$({activeBlock:{...d[0],question:s},blocks:d,questions:a,answers:t,pages:O,renderedBlocks:w,contactData:i,surveyLayout:"standard",initialTransition:!0,isEditResponse:H.current,branchSeparatePage:n}),u=[{...d[0],question:s},...l];if(L(n?Va(u,p):u),(e=>{if(null==e||0===Object.keys(e).length)return!0;const t=Object.keys(e).filter((e=>""!==e&&!ya(e)&&"others_meta"!==e));return t.every((t=>!e[t]))&&(!e.others_meta||0===Object.keys(e.others_meta).length)})({others_meta:{},...t.formValues})||N.current)C(d.findIndex((e=>u[0].name===e.name))),k(0);else{const e=u?.[u.length-1];C(u.findIndex((t=>t.name===e?.name))),n&&k(e?.orderOfSet!==x?e?.orderOfSet:0)}S({})}),[d,e.initialPivotAnswer,h]);c((()=>{if(Da("useEffect",{answers:B,blocks:d,props:e}),!(W.isConsideredCompleted&&N.current&&e.canResubmit)&&(!Wa(B.formValues)||B.moveToNextPage)&&d&&F(V,B.commitDirtyValue))if(FP({blocks:d,activeIndexOfBlocks:X,renderedBlocks:w,activeIndexOfRenderedBlocks:R,answers:B,questions:a,activePage:v,pages:O,surveyLayout:"standard"})){if(void 0!==e.initialPivotAnswer&&1===w.length&&N.current&&!B.commitDirtyValue);else if(B.commitDirtyValue){const t=VP({renderedBlocks:w,activeBlock:V,blocks:d,activeIndexOfBlocks:X,answers:B,questions:a,contactData:i,pages:O,surveyLayout:"standard",isDisplayBlock:!0});if(t!==1/0)N.current||!V.question.type_info?.question_type||V.question.type_info?.question_comment||["FORM_FIELD","MULTI_SELECT","RANK_ORDER"].includes(V.question.type_info?.question_type)?U():(e=>{e!==1/0&&setTimeout((()=>{const t=EP({pivotQn:E.current?.question,pivotQnAnswer:E.current?.answer,block:d?.[e],questions:a});if(t?.name){const e=document?.querySelector(`.question-container.standard-card-${t.name}`),n=document?.querySelector(`.question-container.standard-card-${t.name} input`),a=document?.querySelector(`.question-container.standard-card-${t.name} textarea`);e?.scrollIntoView({behavior:"smooth",block:"center",inline:"start"}),setTimeout((()=>{n?.focus(),a?.focus()}),le)}U()}),0)})(t),(!B.moveToNextPage&&!n&&t&&t>0&&d[t-1]?.page_id===d[t]?.page_id||B.moveToNextPage)&&((e,t)=>{if(e===1/0)return;const o=d?.[e];let r=E.current?.question;o?.display_logic?.some((e=>"BASED_ON_RATING_GROUP"===e.logic_type))&&(r=xP({questions:a,blocks:d,displayLogic:o?.display_logic}));const c=EP({pivotQn:r??E.current?.question,pivotQnAnswer:B?.formValues[r?.name]??E.current?.answer,block:o,questions:a}),s=JP({renderedBlocks:w,activeIndexOfRenderedBlocks:R}),l=d?.[e],u=e$({activeBlock:{...l,question:c},answers:B,blocks:d,questions:a,pages:O,renderedBlocks:w,contactData:i,surveyLayout:"standard",isEditResponse:H.current,branchSeparatePage:n}),b=[...s,...c?.name?[{...l,question:c}]:[],...u];S((e=>{const t={...e};return b.forEach((e=>{"MATRIX_RATING_SCALE"===e.question.type_info?.question_type&&(t[e.question.name]=0)})),t}));const M=n?Va(b,p):b;L(M),t||C(s.length)})(t,!B.moveToNextPage&&!n);else{UP("submit",{answers:B,blocks:d,blockIndex:0,activeIndexOfBlocks:X,initialStatementHasAnswer:Y,activeIndexOfRenderedBlocks:R,activeIndexOfRenderedStatement:T,renderedBlocks:w,activePage:v,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:N.current,questions:a,pages:O,contactData:e.contactData,activeIndexOfSet:x,branchSeparatePage:n,isSubmitting:y})||U("COMPLETE")}}}else("MATRIX_RATING_SCALE"===V?.question?.type_info?.question_type||B.commitDirtyValue)&&U()}),[B,d]);const F=(e,t)=>{if(e?.question_name)switch(e.question?.type_info?.question_type){case"DATE_TIME":return!t||i$({answer:B.formValues?.[e.question_name]||"",errorSetter:M,questionName:e.question_name,errors:b,translationVariables:l});case"FORM_FIELD":return o$({fields:e.question?.type_info?.form_fields?.fields,answers:B.formValues?.[e.question_name]||{},errorSetter:M,questionName:e.question_name,errors:b,translationVariables:l});case"TEXT":return r$({type:e.question?.type_info?.text_field?.text_type,answer:B.formValues?.[e.question_name]||"",errorSetter:M,questionName:e.question_name,errors:b,translationVariables:l});case"CONTACT_FORM":return c$({fields:e.question?.type_info?.contact_form?.fields,answers:B.formValues?.[e.question_name]||{},errorSetter:M,questionName:e.question_name,errors:b,translationVariables:l});case"FILE":return s$({errors:b.fileUploadErrors})||!e.required}return!0},U=(t="PARTIAL")=>{let n=()=>{},o=0;if(w.some(((e,t)=>(o=t,!F(e,!0)))))return void C(o);let r={...B.formValues};if("COMPLETE"===t){q(!0),n=()=>{q(!1),I(!0),H.current=!1};r=l$({pages:O,answers:{...B,formValues:r},blocks:d,questions:a,contactData:i,surveyLayout:"standard"})}e.onSubmit({...r,others_meta:B.others},n,t,H.current?"EDIT":"CREATE")},G=e=>{S((t=>({...t,[e]:(ya(t[e])?0:t[e])+1})))},Y=t.useMemo((()=>{if("MATRIX_RATING_SCALE"!==V?.question?.type_info?.question_type)return!1;const e=V?.question?.type_info?.matrix_properties?.statements||[],t=e?.[T?.[V?.question.name]]??0,n=(B.formValues[V?.question.name]||[]).find((e=>e.statement_id===t?.id));return(n?.rating_labels||[]).length>0}),[T,R]),Z=()=>{const e=O.findIndex((e=>e.page_id===v?.page_id));let t=1,n=O?.[e+t];for(;!w.map((e=>e.page_id)).includes(n?.page_id)&&e+t<O.length;)n=O?.[e+ ++t];const a=w.find((e=>e.page_id===n?.page_id));n?.page_id&&g(n),"number"==typeof a?.orderOfSet&&k(a.orderOfSet);const o=w.findIndex((e=>e.page_id===n?.page_id));-1!==o&&C(o)},K=()=>{const e=O.findIndex((e=>e.page_id===v?.page_id));let t=1,n=O?.[e-t];for(;e-t>=0&&(!n||!w.some((e=>e.page_id===n.page_id)));)t++,n=O[e-t];if(!n)return;const a=w.find((e=>e.page_id===n.page_id));n.page_id&&g(n),"number"==typeof a?.orderOfSet&&k(a.orderOfSet);const o=w.findIndex((e=>e.name===a?.name));-1!==o&&C(o)};return{blocks:d,pages:O,navigateToNextSet:()=>{const e=w.find((e=>e.orderOfSet===x+1));if(e){n&&void 0!==e?.orderOfSet&&k(e?.orderOfSet);const t=O.find((t=>t.page_id===e?.page_id));t?.page_id&&g(t),_((e=>({...e,moveToNextPage:!0})))}else Z()},navigateToPreviousSet:()=>{const e=w.find((e=>e.orderOfSet===x-1));if(!e)return void K();n&&"number"==typeof e.orderOfSet&&k(e.orderOfSet);const t=O.find((t=>t.page_id===e.page_id));t?.page_id&&g(t);const a=w.findIndex((t=>t.name===e.name));-1!==a&&C(a)},activePage:v,questions:a,renderedBlocks:w,initialStatementHasAnswer:Y,activeBlock:V,activeIndexOfBlocks:X,activeIndexOfRenderedBlocks:R,activeIndexOfRenderedStatement:T,navigateToNextStatement:G,navigateToPreviousStatement:e=>{S((t=>({...t,[e]:(ya(t[e])?0:t[e])-1})))},isInitialTransition:N.current,isSurveyCompleted:D,pivot:E.current,answers:B,translationVariables:l,...b,setErrors:M,saveFormValues:(e,t,n=!1,a=R)=>{if(y)return;N.current=!1,e.question.name===E.current?.question.name&&(E.current={...E.current,answer:"BOOLEAN"===E.current?.question?.type_info?.question_type?Boolean(t):t}),a!==R&&C(a);const o={...B,formValues:{...B.formValues,[e.question.name]:"BOOLEAN"===e.question?.type_info?.question_type?Boolean(t):t},commitDirtyValue:n,moveToNextPage:!1};t$((({renderedBlocks:e,activeIndexOfRenderedBlocks:t})=>JP({renderedBlocks:e,activeIndexOfRenderedBlocks:t}).map((({question:e})=>e)))({renderedBlocks:w,activeIndexOfRenderedBlocks:a}),o),H.current&&(e.category??[]).length>0&&(e.category?.forEach((e=>{e.question_name&&(o.formValues[e.question_name]=null)})),o.formValues[e.question.name]=t),_(o);const i=w[a];"SINGLE_ANSWER"===i.question.type_info?.matrix_properties?.type&&(T?.[i.question.name]??0)<(i.question?.type_info?.matrix_properties?.statements||[]).length-1&&setTimeout((()=>{G?.(i.question.name)}),0)},saveOthersValue:(e,t,n=R)=>{if(n!==R&&C(n),null===t){const t={...B.others};delete t[e],_({...B,commitDirtyValue:!1,others:t,moveToNextPage:!1})}else _({...B,commitDirtyValue:!1,others:{...B.others,[e]:t},moveToNextPage:!1})},clearRadioSelection:e=>{C(e);const t=w[e].question;t.type_info?.pivot_question&&(E.current={question:t,answer:void 0}),delete B.formValues[t.name],delete B.others[t.name],"DATE_TIME"===t.type_info?.question_type&&b.dateQuestionErrors?.[t.name]&&M((e=>{const n={...e.dateQuestionErrors};return delete n[t.name],{...e,dateQuestionErrors:n}}));const o=(({renderedBlocks:e,answers:t})=>{const n=e.reduce(((e,n)=>(n?.question?.name&&void 0!==t.formValues[n.question.name]&&(e[n.question.name]=t.formValues[n.question.name]),e)),{});return{...t,formValues:n}})({renderedBlocks:w,answers:B}),r={...o,formValues:{...o.formValues},moveToNextPage:!1,commitDirtyValue:!1},c=e$({activeBlock:w[e],blocks:d,questions:a,answers:r,pages:O,renderedBlocks:w,contactData:i,surveyLayout:"standard",isEditResponse:H.current,branchSeparatePage:n});S((e=>{const t={...e};return c.forEach((e=>{"MATRIX_RATING_SCALE"===e.question.type_info?.question_type&&(t[e.question.name]=0)})),t}));const s=[...w.slice(0,e+1),...c];L(n?Va(s,p):s),_(r)},onSubmitHandler:U,navigateToStart:()=>{H.current=!0,I(!1),S({}),C(0),n&&("number"==typeof w?.[0].orderOfSet?k(w?.[0].orderOfSet):k(0))},isValidQuestion:F,resetSurvey:()=>{I(!1),f((e=>e+1)),_({formValues:{},others:{},commitDirtyValue:!1,moveToNextPage:!1}),p$(localStorage)},moveToNextPage:e=>{const t={};e&&O.length>0&&w.forEach((e=>{v?.page_id!==e.page_id||n&&x!==e.orderOfSet||"MESSAGE"===e.question.type_info?.question_type||(t[e.question.name]=null)})),Wa(B.formValues??{})&&O.length>0&&w.forEach((e=>{v?.page_id!==e.page_id||n&&x!==e.orderOfSet||"MESSAGE"!==e.question.type_info?.question_type||(t[e.question.name]=null)}));const a=w.filter((e=>v?.page_id===e?.page_id)),o=a[a.length-1],i=w.findIndex((e=>e.name===o?.name));R!==i&&C(i),setTimeout((()=>{_((e=>({...e,formValues:{...e.formValues,...t},commitDirtyValue:!0,moveToNextPage:!0})))}),0)},moveToNextSet:e=>{let t=0;if(w.some(((e,n)=>(t=n,!F(e,!0)))))return void C(t);const a={};w.forEach((t=>{v?.page_id!==t.page_id||n&&x!==t.orderOfSet||!e&&void 0!==B.formValues[t.question.name]||(a[t.question.name]=null)})),Wa(B.formValues??{})&&O.length>0&&w.forEach((e=>{v?.page_id!==e.page_id||n&&x!==e.orderOfSet||"MESSAGE"!==e.question.type_info?.question_type||(a[e.question.name]=null)}));const o=w.filter((e=>v?.page_id===e?.page_id&&(!n||x===e.orderOfSet))),i=o[o.length-1],r=w.findIndex((e=>e.name===i?.name));C(r),setTimeout((()=>{_((e=>({...e,formValues:{...e.formValues,...a},commitDirtyValue:!0,moveToNextPage:!0})))}),0)},setIsSubmitting:q,isSubmitting:y,expanded:z,setExpanded:m,activeIndexOfSet:x,setActiveRenderedBlockIndex:C,isQuestionBgDark:j}},W4=["next","next-statement","next-page","next-set","skip","skip-statement","skip-page","skip-set","submit","navigation","set-navigation","clear-selection","message","consent","navigation-prev","navigation-next","navigation-page-prev","navigation-page-next","previous-matrix-statement","next-matrix-statement","navigation-set-prev","navigation-set-next"],w4=({translationVariables:e,canDisplayDisableButtonParams:n,navigateToNextSet:a,navigateToPreviousSet:o})=>t.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},t.createElement("button",{disabled:QP("navigation-set-prev",n),className:"navigation-button ss-navigation-button",onClick:o,title:e?.prev_question??"go to previous question"},t.createElement(we,{name:"arrow-previous"})),t.createElement("button",{className:"navigation-button ss-navigation-button",disabled:QP("navigation-set-next",n),title:e?.next_question||"Go to next question",onClick:a},t.createElement(we,{name:"arrow-next"}))),L4=({surveyServAssetUrl:e,thankYouQuestion:n,preview:a,placeholders:o,canResubmit:i,allowMultipleSubmission:r,navigateToStart:l,resetSurvey:p,isMobile:d,pivot:u,answers:b,questions:M,rangeToRender:z,translationVariables:m})=>{const{redirectUrl:h,redirectDelay:f,image_url:O,show_custom_button:A,show_review_links:v,show_social_links:g}=n?.type_info?.meta??{},[y,q]=s(f??10),[W,w]=t.useState(!1);return c((()=>{if(!a&&h){const e=setInterval((()=>q((e=>e>1?e-1:("undefined"!=typeof window&&(window.location.href=h??""),0)))),1e3);return()=>{clearInterval(e),w(!1)}}return()=>{w(!1)}}),[]),t.createElement("div",{className:"thankyou-container"},t.createElement("div",{className:"question-container ss-question-container thankyou"},O&&t.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:O,alt:"thankyou_logo"}),t.createElement(t.Fragment,null,Ca(n)),t.createElement("div",{className:"text ss-thankyou-message",dangerouslySetInnerHTML:{__html:ka({questionText:n.text,placeholders:o,npsRating:Ta({theme:"nps",answers:b,questions:M})??"",npsRatingLabel:Sa({theme:"nps",answers:b,questions:M}),csatRating:Ta({theme:"csat",answers:b,questions:M})??"",csatRatingLabel:Sa({theme:"csat",answers:b,questions:M}),cesRating:Ta({theme:"ces",answers:b,questions:M})??"",cesRatingLabel:Sa({theme:"ces",answers:b,questions:M}),preference:u?.question.type_info?.scale_properties?.labels?.preference,isPreview:a})}}),(i||r)&&t.createElement("div",{className:("wrap-up-actions "+(d?"mobile":"")).trim()},i&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:W,onClick:()=>{w(!0),l()}},t.createElement(we,{name:"edit"}),m?.edit_response||"Edit your response"),r&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:W,onClick:()=>{w(!0),p()}},t.createElement(we,{name:"reload"}),m?.another_response||"Submit another response")),h&&t.createElement(t.Fragment,null,t.createElement("div",{className:"redirection-text"},Pa(y,m?.redirect_msg),t.createElement("br",null)),t.createElement("a",{className:"link",href:h},h)),t.createElement(m$,{show_custom_button:A,show_review_links:v,show_social_links:g,surveyServAssetUrl:e})))},R4=e=>{const{blockIndex:n,renderedBlocks:a,activeIndexOfRenderedBlocks:o,translationVariables:i,saveFormValues:r,answers:c,clearRadioSelection:s,canDisplayDisableButtonParams:l,navigateToNextStatement:p,navigateToPreviousStatement:d,isSubmitting:u,isMobile:b}=e,M={};W4.forEach((e=>{M[e]=!!UP(e,l)}));const z=a[n??o],{question:m}=z,h=m?.type_info?.meta?.display_format;return M?.consent||M?.["previous-matrix-statement"]||M?.["next-matrix-statement"]||M?.["clear-selection"]||M?.message?t.createElement("div",{className:"question-footer ss-question-footer-container"},t.createElement("div",null,(M?.["previous-matrix-statement"]||M?.["next-matrix-statement"])&&"MATRIX_RATING_SCALE"===m?.type_info?.question_type&&t.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},t.createElement("button",{disabled:QP("previous-matrix-statement",l),className:"navigation-button ss-navigation-button",onClick:()=>{d(m.name)},title:i?.prev_question??"go to previous question"},t.createElement(we,{name:"arrow-previous"})),t.createElement("button",{className:"navigation-button ss-navigation-button",disabled:QP("next-matrix-statement",l),title:i?.next_question||"Go to next question",onClick:()=>{p(m.name)}},t.createElement(we,{name:"arrow-next"})))),t.createElement("div",{className:("action-buttons ss-action-buttons "+(M.consent?"question-consent-buttons ss-consent-action-buttons":"")).trim()},M?.["clear-selection"]&&t.createElement(Te,{className:"sec-button",variant:"secondary",onClick:()=>s(n),disabled:u},e?.survey?.meta?.action_button?.clear_selection||i?.actionButtonText?.clear_selection||i?.clear_selection||"Clear selection"),b&&"MATRIX_RATING_SCALE"===m.type_info?.question_type&&"MULTIPLE_ANSWERS"===m?.type_info?.matrix_properties?.type&&M?.["next-matrix-statement"]&&t.createElement(Te,{disabled:QP("next-matrix-statement",l),className:"primary-button",variant:"primary",onClick:()=>{p(m.name)}},e?.survey?.meta?.action_button?.next||i?.actionButtonText?.next||i?.next||"Next"),M?.consent&&"BUTTON"===h&&fe.map((e=>t.createElement(Te,{key:o+String(e.recordAs),onClick:()=>{r(z,e.recordAs,!1,n)},disabled:QP("consent",l),variant:ya(c.formValues?.[m.name])||c.formValues?.[m.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(c.formValues?.[m.name]===e.recordAs?"selected":"")).trim()},m?.type_info?.scale_properties?.labels?.values?.[e.id]??e.defaultValue))))):null},C4=e=>{const{pages:n,activePage:a,navigateToNextSet:i,navigateToPreviousSet:l,isInitialTransition:p,blocks:d,renderedBlocks:u,activeBlock:b,activeIndexOfBlocks:M,activeIndexOfRenderedBlocks:z,isSurveyCompleted:m,translationVariables:h,saveFormValues:f,saveOthersValue:O,clearRadioSelection:A,onSubmitHandler:v,answers:g,questions:y,resetSurvey:q,initialStatementHasAnswer:W,navigateToStart:w,activeIndexOfRenderedStatement:L,navigateToNextStatement:R,navigateToPreviousStatement:C,pivot:x,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,contactFormErrors:E,fileUploadErrors:N,setErrors:P,isSubmitting:$,setIsSubmitting:B,moveToNextSet:_,expanded:H,setExpanded:D,activeIndexOfSet:I,isValidQuestion:V,setActiveRenderedBlockIndex:X,isQuestionBgDark:j}=q4(e);Da("Standard",{...e,answers:g,activePage:a,activeBlock:b,renderedBlocks:u,activeIndexOfSet:I,activeIndexOfBlocks:M,activeIndexOfRenderedBlocks:z,activeIndexOfRenderedStatement:L});const F=!!e.survey.meta?.branch_separate_page,U=r(null),G=r({}),Y=r(null),Z=o((()=>xa(x?.question)),[x?.question]),K=o((()=>d.filter((({name:e},t,n)=>!BP({nextBlockName:e||"",blocks:n,questions:y}))).length),[d,y]),Q=Wa(g.formValues)&&e.survey.prompt_settings?.is_enabled&&e.preview,[J,ee]=s(Q),te=u.filter((e=>a?.page_id===e?.page_id));c((()=>{const t=Object.values(g.formValues).filter((e=>"string"==typeof e&&""!==e.trim()||"number"==typeof e||"boolean"==typeof e||Array.isArray(e)&&e.length>0||"object"==typeof e&&null!==e&&Object.keys(e).length>0)).length;e.getSurveyProgress?.({totalBlocks:K,isSurveyCompleted:m,noOfAnswers:m||t>K?K:t})}),[K,g,m]),c((()=>{e.survey.theme&&Ea(e.survey.theme,e.surveyServAssetUrl??"")}),[e.survey.theme,e.surveyServAssetUrl]),c((()=>{setTimeout((()=>{Y.current&&Object.keys(g.formValues).length&&Y.current?.scrollIntoView({inline:"start",block:"start",behavior:"smooth"})}),0),b&&e.onBlockChange?.(b,a)}),[a?.page_id]);const[ne,ae]=s(!1);if(!b||!b.question)return null;const{question:oe}=u[z],ie={answers:g,blocks:d,blockIndex:0,activeIndexOfBlocks:M,initialStatementHasAnswer:W,activeIndexOfRenderedBlocks:z,activeIndexOfRenderedStatement:L,renderedBlocks:u,activePage:a,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:p,questions:y,pages:n,contactData:e.contactData,activeIndexOfSet:I,branchSeparatePage:F,isSubmitting:$,secBtnTxt:e.secBtnTxt,isNavigatedBefore:ne,pivot:x},re={};W4.forEach((e=>{re[e]=!!UP(e,ie)}));const ce=u[u.length-1];return t.createElement("div",{className:`freemium-survey-components ${wa(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${e.isMobile?"mobile-preview":""} standard-survey-style`,id:"freemium-survey",ref:Y},J&&e.survey.prompt_settings?t.createElement("div",{className:"questions ss-questions"},t.createElement("div",{className:"question-container ss-question-container"},t.createElement(M$,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt?.(t),1===t&&ee(!1)},placeholders:e.placeholders,isPreview:!!e.preview}))):t.createElement(t.Fragment,null,m?t.createElement(L4,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:EP({pivotQn:x?.question,pivotQnAnswer:x?.answer,block:_P({activeBlock:ce,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:g,questions:y,activeIndexOfBlocks:d.findIndex((e=>e.name===ce.name)),renderedBlocks:u,contactData:e.contactData,surveyLayout:"standard",pages:n}),questions:y}),answers:g,preview:!!e.preview,placeholders:e.placeholders,pivot:{...x,question:x?.question||{name:""},answer:x?.answer},rangeToRender:Z,canResubmit:e.canResubmit,isMobile:e.isMobile,allowMultipleSubmission:e.allowMultipleSubmission,translationVariables:h,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",(()=>{B(!1),w()})):(B(!1),w())},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",(()=>{B(!1),q()})):(B(!1),q())}}):t.createElement(t.Fragment,null,n.length>0&&a?.page_id&&t.createElement(u$,{expanded:H,id:a.page_id,setExpanded:D,activePage:a,translationVariables:h}),t.createElement("div",{className:("questions "+(e?.secBtnTxt?"sec-btn":"")).trim()},u.map(((o,i)=>{if(n.length>0&&a?.page_id!==o?.page_id||e.survey.meta?.branch_separate_page&&o.orderOfSet!==I)return null;const r=te.findIndex((e=>e.name===o.name)),c=VP({renderedBlocks:u,activeBlock:b,blocks:d,activeIndexOfBlocks:M,answers:g,questions:y,contactData:e.contactData,pages:n,surveyLayout:"standard"});return t.createElement(NT.div,{id:o.question.name,key:o.question.name,ref:U,className:`question-container ss-question-container standard-card-${o.question.name}`,"data-test-question-name":b.question.name,initial:{opacity:0},animate:{opacity:1,x:0},exit:{opacity:0},transition:{duration:.2,delay:r?r/15:0},..."MULTI_SELECT"===b.question.type_info?.question_type&&c!==1/0&&-1!==c&&void 0!==g.formValues?.[o.question.name]&&G.current[o.question.name]!==g.formValues?.[o.question.name]?{onMouseLeave:()=>{f(o,g.formValues?.[o.question.name],!0,i),G.current[o.question.name]=g.formValues?.[o.question.name]}}:{}},t.createElement("div",{className:`question-text ss-question-text ${o.required?"required":""} ${0===i?"nps":""}`.trim(),dangerouslySetInnerHTML:{__html:ka({questionText:o.question.text,placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:g,questions:y})??"",npsRatingLabel:Sa({theme:"nps",answers:g,questions:y}),csatRating:Ta({theme:"csat",answers:g,questions:y})??"",csatRatingLabel:Sa({theme:"csat",answers:g,questions:y}),cesRating:Ta({theme:"ces",answers:g,questions:y})??"",cesRatingLabel:Sa({theme:"ces",answers:g,questions:y}),preference:x?.question.type_info?.scale_properties?.labels?.preference,isPreview:!!e.preview})},"aria-label":`question-${i}`,role:"heading","aria-level":1}),t.createElement(O4,{surveyServAssetUrl:e.surveyServAssetUrl,fileUploadErrors:N,setErrors:P,onFileUpload:e.onFileUpload,block:o,preview:!!e.preview,surveyLanguage:e.survey.language,language:e.language||"en",question:o.question,surveyStyle:e.surveyStyle,isFinalQn:SP({blocks:d,activeIndexOfBlocks:M,renderedBlocks:u,activeIndexOfRenderedBlocks:z,questions:y}),formValues:g.formValues,othersMeta:g.others,isMobile:!!e.isMobile,autoFocusDelay:20,activeIndexOfRenderedStatement:L,saveOthersValue:(e,t)=>{O(e,t,i)},onChangeHandler:(e,t)=>{const n=o.question.type_info?.question_type;f(o,e,!!n&&["RANGE","DROPDOWN","BOOLEAN"].includes(n)||t,i)},initialPivotAnswer:e.initialPivotAnswer,initialQuestionAnswer:e.initialQuestionAnswer,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,contactFormErrors:E,translationVariables:h,isQuestionBgDark:j}),"MESSAGE"!==o.question.type_info?.question_type&&t.createElement(R4,{canDisplayDisableButtonParams:{...ie,blockIndex:i},language:e.language||"en",isWidget:!1,surveyStyle:e.surveyStyle,answers:g,renderedBlocks:u,blocks:d,pages:n,survey:e.survey,blockIndex:i,isInitialTransition:p,activeIndexOfRenderedBlocks:z,initialStatementHasAnswer:W,navigateToNextStatement:R,navigateToPreviousStatement:C,activeIndexOfRenderedStatement:L,activeIndexOfBlocks:M,saveFormValues:f,isMobile:!!e.isMobile,clearRadioSelection:A,initialPivotAnswer:e.initialPivotAnswer,translationVariables:h,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,contactFormErrors:E,fileUploadErrors:N,questions:y,isSubmitting:$}))}))),t.createElement("div",{className:"page-actions"},t.createElement("div",null,re["set-navigation"]&&t.createElement(w4,{answers:g,canDisplayDisableButtonParams:ie,activeIndexOfBlocks:M,pages:n,activeIndexOfRenderedBlocks:z,renderedBlocks:u,initialStatementHasAnswer:W,blocks:d,activeIndexOfRenderedStatement:L,translationVariables:h,navigateToPreviousSet:l,navigateToNextSet:i})),t.createElement("div",{className:"page-action-buttons ss-page-action-buttons"},e?.secBtnTxt&&t.createElement(Te,{variant:"secondary",onClick:()=>{ae(!0),e?.handleSecondaryAction?.({answers:g.formValues,survey:e.survey})},"aria-label":"secondary-action",disabled:$},e.secBtnTxt),re["skip-set"]&&t.createElement(Te,{variant:"secondary",onClick:()=>{ae(!0),_(!0)},"aria-label":"skip set",disabled:$},e?.survey?.meta?.action_button?.skip||h?.actionButtonText?.skip||h?.skip||"Skip"),re?.["next-set"]&&t.createElement(Te,{onClick:()=>{_(),ae(!0)},disabled:!!QP("next-set",ie),className:"next-set"},e?.survey?.meta?.action_button?.next||h?.actionButtonText?.next||h?.next||"Next"),re.submit&&!re?.["next-set"]&&t.createElement(Te,{disabled:!!QP("submit",ie),onClick:()=>{let e=0;u.some(((t,n)=>(e=n,!V(t,!0))))?X(e):Wa(T?.[oe.name])&&Wa(k?.[oe.name])&&Wa(S?.[oe.name])&&Wa(N?.[oe.name])&&Wa(E?.[oe.name])&&v("COMPLETE")}},e?.survey?.meta?.action_button?.submit||h?.actionButtonText?.submit||h?.submit_survey||"Submit"))))),!e.secBtnTxt&&!e.footerProps?.hideFooter&&(e?.footerProps?.languageDDComponent||e?.footerProps?.showFWBranding||e.footerProps?.footerContent)&&t.createElement(Ga,{...e.footerProps,surveyStyle:e.surveyStyle,bgColor:e.survey.theme?.palette?.footer_background??e.survey.theme?.palette?.survey_background??z$}))},x4=e=>t.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("g",{clipPath:"url(#clip0_8207_70478)"},t.createElement("rect",{width:"10",height:"10",fill:"white",fillOpacity:"0.01"}),t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.62499 3.19375C8.62499 3.4 8.79374 3.56875 8.99999 3.56875C9.20624 3.56875 9.37499 3.4 9.37499 3.19375V1C9.37499 0.79375 9.20624 0.625 8.99999 0.625H6.80624C6.59999 0.625 6.43124 0.79375 6.43124 1C6.43124 1.20625 6.59999 1.375 6.80624 1.375H8.09377L5.66876 3.80001C5.52501 3.95001 5.52501 4.18751 5.66876 4.33126C5.73751 4.40626 5.83751 4.44376 5.93126 4.44376V4.45001C6.02501 4.45001 6.11876 4.41251 6.19376 4.33751L8.62499 1.90628V3.19375ZM1 9.37501H1.00738H3.19375C3.4 9.37501 3.56875 9.20626 3.56875 9.00001C3.56875 8.79376 3.4 8.62501 3.19375 8.62501H1.90626L4.3375 6.19376C4.48125 6.04376 4.48125 5.80626 4.3375 5.66251C4.1875 5.51876 3.95 5.51876 3.80625 5.66251L1.375 8.09376V6.80626C1.375 6.60001 1.20625 6.43126 1 6.43126C0.79375 6.43126 0.625 6.60001 0.625 6.80626V9.00001C0.625 9.20626 0.79375 9.37501 1 9.37501Z",fill:"#264966"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_8207_70478"},t.createElement("rect",{width:"10",height:"10",fill:"white"})))),k4=e=>t.createElement("svg",{width:"8",height:"2",viewBox:"0 0 8 2",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{d:"M7.3 1.4H0.7C0.313401 1.4 0 1.0866 0 0.699999C0 0.3134 0.313401 0 0.7 0H7.3C7.6866 0 8 0.3134 8 0.699999C8 1.0866 7.6866 1.4 7.3 1.4Z",fill:"#264966"})),T4=({surveyServAssetUrl:e,thankYouQuestion:n,placeholders:a,canResubmit:o,navigateToStart:i,resetSurvey:r,widgetStyle:s,allowMultipleSubmission:l,pivot:p,rangeToRender:d,answers:u,questions:b,translationVariables:M,isQuestionBgDark:z})=>{const{show_custom_button:m,show_review_links:h,show_social_links:f,image_url:O}=n?.type_info?.meta??{},[A,v]=t.useState(!1);return c((()=>()=>{v(!1)}),[]),t.createElement("div",{className:"question-container ss-question-container thankyou"},O&&t.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:O,alt:"thankyou_logo"}),t.createElement("div",{className:O?"heading":"heading thankyou-image"},t.createElement(t.Fragment,null,Ca(n))),t.createElement("div",{className:O?"text ss-thankyou-message":"text ss-thankyou-message thankyou-image",dangerouslySetInnerHTML:{__html:ka({questionText:n.text,placeholders:a,npsRating:Ta({theme:"nps",answers:u,questions:b})??"",npsRatingLabel:Sa({theme:"nps",answers:u,questions:b}),csatRating:Ta({theme:"csat",answers:u,questions:b})??"",csatRatingLabel:Sa({theme:"csat",answers:u,questions:b}),cesRating:Ta({theme:"ces",answers:u,questions:b})??"",cesRatingLabel:Sa({theme:"ces",answers:u,questions:b}),preference:p?.question.type_info?.scale_properties?.labels?.preference})}}),(o||l)&&t.createElement("div",{className:`wrap-up-actions ${O?"":"thank-you-image"} ${"compact"===s?"mobile":""}`.trim()},o&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:A,onClick:()=>{v(!0),i()}},t.createElement(we,{name:"edit"}),M?.edit_response||"Edit your response"),l&&t.createElement("button",{className:"action-button",tabIndex:0,disabled:A,onClick:()=>{v(!0),r()}},t.createElement(we,{name:"reload"}),M?.another_response||"Submit another response")),t.createElement(m$,{show_custom_button:m,show_review_links:h,show_social_links:f,surveyServAssetUrl:e}))},S4=({translationVariables:e,activeIndexOfRenderedStatement:n,navigateToPreviousBlock:a,navigateToNextBlock:o,question:i,canDisplayDisableButtonParams:r,animationInProgress:c,setAnimationInProgress:s})=>t.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},t.createElement("button",{disabled:c||!!QP("navigation-prev",r),className:"navigation-button ss-navigation-button",onClick:()=>{s(!0),setTimeout((()=>{s(!1)}),se),a()},title:i.name&&(n?.[i.name]??0)>0?e?.prev_statement||"go to previous statement":e?.prev_question||"go to previous question"},t.createElement(we,{name:"arrow-previous"})),t.createElement("button",{className:"navigation-button ss-navigation-button",disabled:c||!!QP("navigation-next",r),onClick:()=>{s(!0),setTimeout((()=>{s(!1)}),se),o()},title:e?.next_question||"go to next question"},t.createElement(we,{name:"arrow-next"}))),E4=e=>{const{widgetStyle:n,answers:a,initialStatementHasAnswer:o,renderedBlocks:i,blocks:r,activeIndexOfBlocks:c,navigateToNextStatement:l,activeIndexOfRenderedBlocks:p,translationVariables:d,saveFormValues:u,activeIndexOfRenderedStatement:b={},onSubmitHandler:M,skipBlock:z,skipStatement:m,navigateToNextBlock:h,navigateToPreviousBlock:f,formQuestionErrors:O,dateQuestionErrors:A,textboxQuestionErrors:v,fileUploadErrors:g,contactFormErrors:y,canDisplayDisableButtonParams:q,pages:W,setFooterElementRef:w,isSubmitting:L}=e,[R,C]=s(!1),{question:x}=i[p],k=x?.type_info?.question_type,T={...q,isSubmitting:L},S=(e=!1)=>{const n=e?[...fe].reverse():[...fe];return UP("consent",T)&&"BUTTON"===N&&n.map((e=>t.createElement(Te,{key:p+String(e.id),onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),u(i[p],e.recordAs,!0)},disabled:R||QP("consent",T),variant:ya(a.formValues?.[x.name])||a.formValues?.[x.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(a.formValues?.[x.name]===e.recordAs?"selected":"")).trim()},x?.type_info?.scale_properties?.labels?.values?.[e.id]||e.defaultValue)))},E="compact"===n&&(UP("navigation",T)&&UP("skip",T)||"CONSENT"===k||"MESSAGE"===k),N=x?.type_info?.meta?.display_format;return t.createElement(t.Fragment,null,(UP("navigation",T)||UP("next",T)||UP("next-statement",T)||UP("consent",T)||UP("submit",T)||UP("skip",T)||UP("skip-statement",T)||UP("message",T))&&t.createElement("div",{className:"question-footer ss-question-footer-container",ref:e=>e?w?.(e):null},E?t.createElement("div",{className:"compact-footer-container"},UP("next",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),u(i[p],"CHECKBOX"===x?.type_info?.meta?.display_format&&"CONSENT"===x?.type_info?.question_type?a.formValues[x.name]??!1:a.formValues[x.name],!0)},disabled:R||!!QP("next",T),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||d?.next||"Next"),UP("message",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),z()},disabled:R||QP("message",T),className:"message-button ss-action-message-button"},x?.type_info?.scale_properties?.labels?.values?.[0]||"Begin"),UP("submit",T)&&t.createElement("div",{className:"submit ss-action-submit-button"},t.createElement(Te,{disabled:R||!!QP("submit",T),onClick:()=>{Wa(A?.[x.name])&&Wa(O?.[x.name])&&Wa(v?.[x.name])&&Wa(g?.[x.name])&&Wa(y?.[x.name])&&(C(!0),setTimeout((()=>{C(!1)}),se),M("COMPLETE"))}},e?.survey?.meta?.action_button?.submit||d?.actionButtonText?.submit||d?.submit_survey||"Submit")),UP("next-statement",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),l?.(x.name)},disabled:R||!!QP("next-statement",T),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||d?.actionButtonText?.next||d?.next||"Next"),S(),t.createElement("div",{className:"compact-footer-layout"},t.createElement(S4,{animationInProgress:R,setAnimationInProgress:C,answers:a,canDisplayDisableButtonParams:T,pages:W,activeIndexOfBlocks:c,activeIndexOfRenderedBlocks:p,renderedBlocks:i,initialStatementHasAnswer:o,blocks:r,activeIndexOfRenderedStatement:b,question:x,translationVariables:d,navigateToNextBlock:h,navigateToPreviousBlock:f}),"MESSAGE"!==k&&!r[c].required&&t.createElement(Te,{className:"skip-button ss-action-skip-button",onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),z()},variant:"secondary","aria-label":"skip question",disabled:R},e?.survey?.meta?.action_button?.skip||d?.actionButtonText?.skip||d?.skip||"Skip"))):t.createElement(t.Fragment,null,UP("navigation",T)?t.createElement(S4,{animationInProgress:R,setAnimationInProgress:C,answers:a,pages:W,canDisplayDisableButtonParams:T,activeIndexOfBlocks:c,activeIndexOfRenderedBlocks:p,activeIndexOfRenderedStatement:b,renderedBlocks:i,blocks:r,question:x,initialStatementHasAnswer:o,translationVariables:d,navigateToNextBlock:h,navigateToPreviousBlock:f}):t.createElement("div",null),t.createElement("div",{className:"action-buttons ss-action-buttons"},UP("skip",T)&&t.createElement(Te,{className:"skip-button ss-action-skip-button",variant:"secondary",onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),z()},"aria-label":"skip question",disabled:R},e?.survey?.meta?.action_button?.skip||d?.actionButtonText?.skip||d?.skip||"Skip"),UP("skip-statement",T)&&t.createElement(Te,{className:"skip-button ss-action-skip-button",variant:"secondary",onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),m()},"aria-label":"skip statement",disabled:R},e?.survey?.meta?.action_button?.skip||d?.actionButtonText?.skip||d?.skip||"Skip"),S(!0),UP("next",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),u(i[p],"CHECKBOX"===x?.type_info?.meta?.display_format&&"CONSENT"===x?.type_info?.question_type?a.formValues[x.name]??!1:a.formValues[x.name],!0)},disabled:R||!!QP("next",T),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||d?.actionButtonText?.next||d?.next||"Next"),UP("next-statement",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),l?.(x.name)},disabled:R||!!QP("next-statement",T),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||d?.actionButtonText?.next||d?.next||"Next"),UP("submit",T)&&t.createElement("div",{className:"submit ss-action-submit-button"},t.createElement(Te,{disabled:R||!!QP("submit",T),onClick:()=>{Wa(A?.[x.name])&&Wa(O?.[x.name])&&Wa(v?.[x.name])&&Wa(g?.[x.name])&&Wa(y?.[x.name])&&(C(!0),setTimeout((()=>{C(!1)}),se),M("COMPLETE"))}},e?.survey?.meta?.action_button?.submit||d?.actionButtonText?.submit||d?.submit_survey||"Submit")),UP("message",T)&&t.createElement(Te,{onClick:()=>{C(!0),setTimeout((()=>{C(!1)}),se),z()},disabled:R||QP("message",T),className:"next-button ss-action-next-button"},x?.type_info?.scale_properties?.labels?.values?.[0]||"Begin")))))},N4=e=>{const{pages:n,activePage:a,blocks:o,renderedBlocks:i,activeBlock:l,activeIndexOfBlocks:p,activeIndexOfRenderedBlocks:d,isSurveyCompleted:u,isReverseAnimation:b,translationVariables:M,saveFormValues:z,saveOthersValue:m,skipBlock:h,skipStatement:f,initialStatementHasAnswer:O,onSubmitHandler:A,navigateToNextBlock:v,activeIndexOfRenderedStatement:g,navigateToNextStatement:y,navigateToPreviousStatement:q,navigateToPreviousBlock:W,answers:w,questions:L,resetSurvey:R,navigateToStart:C,pivot:x,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,fileUploadErrors:E,contactFormErrors:N,setErrors:P,expanded:$,setExpanded:B,isQuestionBgDark:_,isSubmitting:H}=d$({...e,isWidget:!0});Da("Widget",{...e,renderedBlocks:i,activeIndexOfBlocks:p,answers:w,activeIndexOfRenderedBlocks:d,activeBlock:l});const[D,I]=s(null),[V,X]=s(null),[j,F]=s(null),[U,G]=s(0),Y=t.useMemo((()=>xa(x?.question)),[x?.question]),Z=Wa(w.formValues)&&e.survey.prompt_settings?.is_enabled,[K,Q]=s(Z),J=r(Z?-1:d),ee=()=>{if(null===D||!D||"undefined"==typeof window||"undefined"==typeof document)return;const t=Math.max(document?.documentElement.clientHeight||0,window.innerHeight||0)-(V?.scrollHeight??0)-(j?.scrollHeight??0)-164,n=Math.min(D?.scrollHeight,Math.min(de[e.widgetStyle],t));U!==n&&G(n)};c((()=>{setTimeout((()=>{ee()}),0)}),[K,u,D,g[l?.question?.name],d,j,$,k,Object.keys(T),Object.keys(S),Object.keys(E),Object.keys(N)]),c((()=>{"MATRIX_RATING_SCALE"===l?.question?.type_info?.question_type&&setTimeout((()=>{ee()}),0)}),[g[l?.question?.name]]),c((()=>{e.loadAsNewSurvey&&e.handleAction&&e.handleAction("RE_SUBMIT",R)}),[]),c((()=>{e.setCurrentSurveyState?.({question:i[d]?.question,npsScore:x?.answer})}),[d,x?.answer]),c((()=>{d!==J.current&&(J.current=-1)}),[d]);const te={answers:w,blocks:o,blockIndex:d,activeIndexOfBlocks:p,initialStatementHasAnswer:O,activeIndexOfRenderedBlocks:d,activeIndexOfRenderedStatement:g,renderedBlocks:i,isMobile:!!e.isMobile,surveyStyle:"card",isWidget:!0,questions:L,pages:n,contactData:e.contactData,activeIndexOfSet:0,branchSeparatePage:!1,pivot:x};if(!l||!l?.question)return null;const ne=u?o.length:p+(u?1:0),ae=u?100:(ne>0?100/o.length:0)*ne;return t.createElement("div",{className:`freemium-survey-components widget-survey-components\n ${e.widgetStyle}-style`.trim(),id:"freemium-survey"},u||K||!e.survey.meta?.progress_bar?null:t.createElement("div",{className:"widget-progressbar"},t.createElement("div",{className:"progress-completion"},ae.toFixed(),"%"),t.createElement(Uq,{totalSteps:o.length,completedSteps:p+(u?1:0),isWidget:!0})),!K&&!e.minimized&&n.length>0&&a?.page_id&&!u&&t.createElement(u$,{ref:e=>e?F(e):null,expanded:$,id:a.page_id,setExpanded:B,activePage:a,translationVariables:M}),t.createElement("div",{className:"questions ss-questions",style:{...Z&&K||J.current===d?{transition:"none"}:{}}},t.createElement(HT,{exitBeforeEnter:!0},t.createElement(NT.div,{id:`${l.question.name}`,className:`question-container ss-question-container ${u?"thankyou":""} ${K?"prompt-container":""}`.trim(),"data-test-question-name":l.question.name,key:`${l.question.name}`,initial:{opacity:0,x:La(e.language,b)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(e.language,b)},transition:{duration:.2}},t.createElement("div",{className:"animation-container",style:{height:e.minimized?0:U>0&&!$?`${U}px`:"auto"}},t.createElement("div",{className:"scroll-container",ref:e=>e?I(e):null},K&&e.survey.prompt_settings?t.createElement(M$,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt(t),1===t&&Q(!1)},placeholders:e.placeholders}):t.createElement(t.Fragment,null,u?t.createElement(T4,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:EP({pivotQn:x?.question,pivotQnAnswer:x?.answer,block:_P({activeBlock:l,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:w,questions:L,activeIndexOfBlocks:p,renderedBlocks:i,contactData:e.contactData,surveyLayout:"card",pages:n}),questions:L}),placeholders:e.placeholders,canResubmit:e.canResubmit,widgetStyle:e.widgetStyle,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",C):C()},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",R):R()},allowMultipleSubmission:e.allowMultipleSubmission,pivot:x,rangeToRender:Y,translationVariables:M,isQuestionBgDark:_,answers:w}):t.createElement(t.Fragment,null,t.createElement("div",{className:`question-text ss-question-text ${!l.question.type_info?.pivot_question&&l.required?"required":""} ${"RANGE"===l?.question?.type_info?.question_type?"range-question-text":""}`.trim(),dangerouslySetInnerHTML:{__html:ka({questionText:l?.question.text,placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:w,questions:L})??"",npsRatingLabel:Sa({theme:"nps",answers:w,questions:L}),csatRating:Ta({theme:"csat",answers:w,questions:L})??"",csatRatingLabel:Sa({theme:"csat",answers:w,questions:L}),cesRating:Ta({theme:"ces",answers:w,questions:L})??"",cesRatingLabel:Sa({theme:"ces",answers:w,questions:L}),preference:x?.question.type_info?.scale_properties?.labels?.preference})},"aria-label":`question-${d}`,role:"heading","aria-level":1}),"MESSAGE"!==l.question.type_info?.question_type&&t.createElement("div",{className:"question-wrapper",onTransitionEndCapture:e=>e.stopPropagation()},t.createElement(O4,{setFocus:!0,surveyStyle:"card",isReverseAnimation:b,language:e?.language||"en",surveyServAssetUrl:e.surveyServAssetUrl,fileUploadErrors:E,setErrors:P,onFileUpload:e.onFileUpload,surveyLanguage:e.survey.language,block:l,question:l.question,isFinalQn:SP({blocks:o,activeIndexOfBlocks:p,renderedBlocks:i,activeIndexOfRenderedBlocks:d,questions:L}),formValues:w.formValues,widgetStyle:e.widgetStyle,isMobile:!1,othersMeta:w.others,autoFocusDelay:0,activeIndexOfRenderedStatement:g,isWidget:!0,saveOthersValue:(e,t)=>{m(e,t),setTimeout((()=>{ee()}),0)},onChangeHandler:e=>{setTimeout((()=>{ee()}),0),z(l,e)},formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,contactFormErrors:N,translationVariables:M,isQuestionBgDark:_})))))))),!u&&!K&&t.createElement(E4,{pages:n,isWidget:!0,language:e.language||"en",widgetStyle:e.widgetStyle,setFooterElementRef:X,surveyStyle:"standard",answers:w,survey:e.survey,canDisplayDisableButtonParams:{...te,blockIndex:d,activeIndexOfRenderedBlocks:d},isMobile:!1,renderedBlocks:i,initialStatementHasAnswer:O,activeIndexOfRenderedStatement:g,blocks:o,activeIndexOfRenderedBlocks:d,navigateToNextStatement:y,navigateToPreviousStatement:q,activeIndexOfBlocks:p,translationVariables:M,saveFormValues:z,skipBlock:h,skipStatement:f,onSubmitHandler:A,navigateToPreviousBlock:W,navigateToNextBlock:v,formQuestionErrors:k,dateQuestionErrors:T,textboxQuestionErrors:S,fileUploadErrors:E,contactFormErrors:N,questions:L,isSubmitting:H})))},P4={default:{width:522,11:6,10:6,9:8,8:8,7:18,6:22,5:28,4:32,3:36},compact:{width:522,11:6,10:6,9:8,8:8,7:18,6:22,5:28,4:32,3:36},cozy:{width:582,11:12,10:12,9:12,8:12,7:18,6:22,5:28,4:32,3:36}},$4=({language:e="en",survey:n,preview:a,placeholders:o,contactData:i,overRideComponent:c,onSubmit:l,onDismiss:p,onClose:d,isMobile:u,surveyType:b,unsubscribeUrl:M,isSurveyCompleted:z,children:m=null,answerStatus:h,loadSurveyCollapsed:f=!1,handleAction:O,answers:A,onAnsweringPrompt:v,allowMultipleSubmission:g,loadAsNewSurvey:y,canResubmit:q,translationVariables:W,surveyServAssetUrl:w,footerProps:L,surveyPoweredBy:R,onFileUpload:C,isQuestionBgDark:x,hideMinimize:k,position:T,collector:S})=>{const E=n.question_details?.questions||[],[N,P]=s(),[$,B]=s(!1),[_,H]=s(f),[D,I]=s(!1),{theme:V}=n,[X,j]=s(null),F=t.useMemo((()=>((e=[])=>{const t=e.sort(((e,t)=>Number(e.order)-Number(t.order)));return t.find((e=>!e.is_deleted))??t[0]})(n.blocks||[])),[n.blocks]),U=F?.question_name?F?.question_name??"":F?.category?.[0].question_name??"",G=E.find((e=>e.name===U)),Y=()=>{B(!0),setTimeout((()=>{d?.()}),300)},Z=r(null);function K(e){const t=document?.getElementById("freshworks-survey-widget");if(t&&e?.channel_info?.web_in_app_channel_info?.backdrop_enabled)try{const a=(n=e?.channel_info?.web_in_app_channel_info?.backdrop_color,Object.entries({...ue,backgroundColor:n}).map((([e,t])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${t}`)).join("; "));t.style.cssText=a}catch(e){console.error("Error applying styles to widgetElement:",e)}var n}return t.useEffect((()=>{const e=document?.documentElement;if(!e||!n.question_details?.questions)return;let t=0;(n.question_details.questions??[]).forEach((e=>{const n=xa(e);"RANGE"===e.type_info?.question_type&&n.length>t&&(t=n.length)}));const a=42*t+P4[b][t]*(t-1);e.style.setProperty("--fsc-max-range-question-width",Math.min(P4[b].width,a)+"px")}),[n,b]),t.useEffect((()=>{V&&(Ea(V,w??""),I(Ia(V.palette?.footer_background??V.palette?.survey_background??z$)))}),[V,w]),t.useEffect((()=>{K(S)}),[S]),t.createElement("div",{id:"freshworks-survey-widget",className:`align-${T||""}`},n.theme?.advanced?.additional_css&&t.createElement("style",null,n.theme?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),t.createElement("div",{className:`surveyserv-widget-container ${wa(e||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${u?"widget-mobile":""} ${b}-container-style ${_?"minimized":""}`,id:"surveyserv-widget-container"},t.createElement("header",{id:"surveyserv-widget-header",className:("widget-header "+(_?"minimized":"")).trim()},_?t.createElement("span",{className:"header-content minimized",dangerouslySetInnerHTML:{__html:ka({questionText:(!N&&n.prompt_settings?.is_enabled?n.prompt_settings.text:X?.question?.text)??_a(G?.text||""),placeholders:{...o,"{{nps.rating}}":String(X?.npsScore??"")}})}}):t.createElement("div",null),t.createElement("div",{className:"icons"},!z&&!k&&t.createElement(Te,{onClick:()=>{H((e=>!e))},variant:"secondary",className:"icon minimize-btn",title:_?W?.maximize||"Maximize widget":W?.minimize||"Minimize widget"},_?t.createElement(x4,null):t.createElement(k4,null)),t.createElement(Te,{ref:Z,onClick:()=>{z?Y():p()},variant:"secondary",title:W?.dismiss||"Dismiss widget",className:"icon minimize-btn"},t.createElement(wP,null)))),m,t.createElement("main",{className:("widget-main "+(_?"minimized":"")).trim()},c?t.createElement(t.Fragment,null,c):t.createElement(N4,{surveyServAssetUrl:w,answers:A,minimized:_,widgetStyle:b,answerStatus:h,language:e||"en",survey:n,placeholders:o,isMobile:!!u,contactData:i,onFileUpload:C,allowMultipleSubmission:g,loadAsNewSurvey:y,canResubmit:q,onSubmit:l,setCurrentSurveyState:j,widgetHeaderQuerySelector:_?void 0:"#surveyserv-widget-header",onAnsweringPrompt:e=>{v?.(e),P(e),0==e&&Wa(n.prompt_settings?.declined_message)&&Y()},handleAction:O,translationVariables:W})),(R||M||!!L?.showFWBranding)&&t.createElement("footer",{className:`widget-footer ${_?"minimized":""} survey-footer-${D?"dark":"light"}`.trim()},t.createElement("div",null,M&&!_&&t.createElement("a",{href:M,target:"_blank",rel:"noopener noreferrer",onClick:e=>{a&&e.preventDefault(),e.stopPropagation(),Y()}},W?.unsubscribe||"Unsubscribe")),!!L?.showFWBranding&&t.createElement("div",{className:"footer-text"},t.createElement(Ua,{surveyPoweredBy:R,isDark:D})))))},B4=e=>{const{survey:n,answers:a}=RP(e.survey,e.answers),[o,i]=t.useState(!1);return t.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&"undefined"!=typeof sessionStorage&&sessionStorage&&sessionStorage.clear&&(Da("Survey matchMedia",{innerHeight:window.innerHeight,innerWidth:window.innerWidth}),i(window.matchMedia("(max-width: 550px)").matches),p$(localStorage))}),[]),t.useEffect((()=>{const t=document?.documentElement;!ya(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),Da("Survey",{...e,survey:n,isMobile:o,answers:a}),t.createElement(t.Fragment,null,n.theme?.advanced?.additional_css&&t.createElement("style",null,n.theme?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),"standard"===e.surveyStyle?t.createElement(C4,{...e,answers:a,survey:n,isMobile:o||!!e.isMobile,initialQuestionAnswer:e.initialQuestionAnswer}):t.createElement(y4,{...e,answers:a,survey:n,isMobile:o||!!e.isMobile,surveyStyle:"card",initialQuestionAnswer:e.initialQuestionAnswer}))},_4=e=>{const{survey:n,answers:a}=RP(e.survey,e.answers);return Da("WebInAppContainer",{...e,survey:n,answers:a}),t.createElement($4,{...e,survey:n,answers:a})},H4=e=>{const[n,a]=t.useState(!1),[o,i]=t.useState(!1);return t.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&(a(window.matchMedia("(max-width: 550px)").matches),"cozy"===e.surveyType&&i(window.matchMedia("(max-width: 1080px)").matches))}),[]),Da("WebInAppSurvey",{...e,isMobile:n,isDefault:o}),e.isLoading?t.createElement("div",{id:"freshworks-survey-widget"},t.createElement("div",{className:`surveyserv-widget-container ${wa(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${n?"widget-mobile":""} ${e.surveyType}-container-style`,id:"surveyserv-widget-container"},t.createElement("header",{id:"surveyserv-widget-header",className:"widget-header".trim()},t.createElement("div",null),t.createElement(Te,{onClick:()=>{setTimeout((()=>{e?.onClose?.()}),300)},variant:"secondary",title:e.translationVariables?.dismiss||"Dismiss widget",className:"icon minimize-btn"},t.createElement(wP,null))),t.createElement("main",{className:"widget-main widget-loader".trim()},e.overRideComponent??t.createElement(Ya,null)))):t.createElement(t.Fragment,null,e?.survey?.id?t.createElement(_4,{...e,isMobile:n,surveyType:n?"compact":o?"default":e.surveyType}):null)},D4=e=>{const{question:n,surveyStyle:a,language:o,onAnswer:i,translationVariables:r,surveyServAssetUrl:c,block:s,theme:l}=e,[p,d]=t.useState(!!e.isMobile);return t.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&d(window.matchMedia("(max-width: 550px)").matches||!!e.isMobile)}),[]),t.useEffect((()=>{l&&Ea(l,c??"")}),[l,c]),Da("QuestionPreview",{...e,isMobile:p}),t.createElement(t.Fragment,null,l?.advanced?.additional_css&&t.createElement("style",null,l?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),t.createElement("div",{className:`freemium-survey-components question-preview ${a}-survey-style ${wa(o||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${p?"mobile-preview":""}`.trim(),id:"freemium-survey"},t.createElement("div",{className:"question-holder"},t.createElement("div",{className:"questions ss-questions"},t.createElement(NT.div,{id:`${n.name}`,className:"question-container ss-question-container","data-test-question-name":n.name,key:`${n.name}`,initial:{opacity:0,x:La(o,!1)},animate:{opacity:1,x:0},exit:{opacity:0,x:Ra(o,!1)},transition:{duration:.2}},t.createElement("div",{className:`question-text ss-question-text ${s.required?"required":""} ${"RANGE"===n?.type_info?.question_type?"range-question-text":""}`.trim(),dangerouslySetInnerHTML:{__html:ka({questionText:n.text,placeholders:{},npsRating:"",npsRatingLabel:"",csatRating:"",csatRatingLabel:"",cesRating:"",cesRatingLabel:"",preference:n.type_info?.scale_properties?.labels?.preference})},"aria-label":"question-0",role:"heading","aria-level":1}),t.createElement(O4,{surveyStyle:a,language:e?.language||"en",surveyServAssetUrl:c,surveyLanguage:e?.language,block:s,question:n,formValues:{},isMobile:p,othersMeta:{},saveOthersValue:(e,t)=>{},onChangeHandler:e=>{i?.({value:e,block:s,question:n})},translationVariables:r??{},activeIndexOfRenderedStatement:{},autoFocusDelay:0,contactFormErrors:{},dateQuestionErrors:{},fileUploadErrors:{},formQuestionErrors:{},textboxQuestionErrors:{},setErrors:()=>{}}))))))},{entries:I4,setPrototypeOf:V4,isFrozen:X4,getPrototypeOf:j4,getOwnPropertyDescriptor:F4}=Object;let{freeze:U4,seal:G4,create:Y4}=Object,{apply:Z4,construct:K4}="undefined"!=typeof Reflect&&Reflect;U4||(U4=function(e){return e}),G4||(G4=function(e){return e}),Z4||(Z4=function(e,t,n){return e.apply(t,n)}),K4||(K4=function(e,t){return new e(...t)});const Q4=b6(Array.prototype.forEach),J4=b6(Array.prototype.lastIndexOf),e6=b6(Array.prototype.pop),t6=b6(Array.prototype.push),n6=b6(Array.prototype.splice),a6=b6(String.prototype.toLowerCase),o6=b6(String.prototype.toString),i6=b6(String.prototype.match),r6=b6(String.prototype.replace),c6=b6(String.prototype.indexOf),s6=b6(String.prototype.trim),l6=b6(Object.prototype.hasOwnProperty),p6=b6(RegExp.prototype.test),d6=(u6=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return K4(u6,t)});var u6;function b6(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return Z4(e,t,a)}}function M6(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a6;V4&&V4(e,null);let a=t.length;for(;a--;){let o=t[a];if("string"==typeof o){const e=n(o);e!==o&&(X4(t)||(t[a]=e),o=e)}e[o]=!0}return e}function z6(e){for(let t=0;t<e.length;t++){l6(e,t)||(e[t]=null)}return e}function m6(e){const t=Y4(null);for(const[n,a]of I4(e)){l6(e,n)&&(Array.isArray(a)?t[n]=z6(a):a&&"object"==typeof a&&a.constructor===Object?t[n]=m6(a):t[n]=a)}return t}function h6(e,t){for(;null!==e;){const n=F4(e,t);if(n){if(n.get)return b6(n.get);if("function"==typeof n.value)return b6(n.value)}e=j4(e)}return function(){return null}}const f6=U4(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),O6=U4(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),A6=U4(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),v6=U4(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),g6=U4(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),y6=U4(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),q6=U4(["#text"]),W6=U4(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),w6=U4(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),L6=U4(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),R6=U4(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),C6=G4(/\{\{[\w\W]*|[\w\W]*\}\}/gm),x6=G4(/<%[\w\W]*|[\w\W]*%>/gm),k6=G4(/\$\{[\w\W]*/gm),T6=G4(/^data-[\-\w.\u00B7-\uFFFF]+$/),S6=G4(/^aria-[\-\w]+$/),E6=G4(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),N6=G4(/^(?:\w+script|data):/i),P6=G4(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$6=G4(/^html$/i),B6=G4(/^[a-z][.\w]*(-[.\w]+)+$/i);var _6=Object.freeze({__proto__:null,ARIA_ATTR:S6,ATTR_WHITESPACE:P6,CUSTOM_ELEMENT:B6,DATA_ATTR:T6,DOCTYPE_NAME:$6,ERB_EXPR:x6,IS_ALLOWED_URI:E6,IS_SCRIPT_OR_DATA:N6,MUSTACHE_EXPR:C6,TMPLIT_EXPR:k6});const H6=1,D6=3,I6=7,V6=8,X6=9,j6=function(){return"undefined"==typeof window?null:window};var F6=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j6();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==X6||!t.Element)return n.isSupported=!1,n;let{document:a}=t;const o=a,i=o.currentScript,{DocumentFragment:r,HTMLTemplateElement:c,Node:s,Element:l,NodeFilter:p,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:b,trustedTypes:M}=t,z=l.prototype,m=h6(z,"cloneNode"),h=h6(z,"remove"),f=h6(z,"nextSibling"),O=h6(z,"childNodes"),A=h6(z,"parentNode");if("function"==typeof c){const e=a.createElement("template");e.content&&e.content.ownerDocument&&(a=e.content.ownerDocument)}let v,g="";const{implementation:y,createNodeIterator:q,createDocumentFragment:W,getElementsByTagName:w}=a,{importNode:L}=o;let R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof I4&&"function"==typeof A&&y&&void 0!==y.createHTMLDocument;const{MUSTACHE_EXPR:C,ERB_EXPR:x,TMPLIT_EXPR:k,DATA_ATTR:T,ARIA_ATTR:S,IS_SCRIPT_OR_DATA:E,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:P}=_6;let{IS_ALLOWED_URI:$}=_6,B=null;const _=M6({},[...f6,...O6,...A6,...g6,...q6]);let H=null;const D=M6({},[...W6,...w6,...L6,...R6]);let I=Object.seal(Y4(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,X=null,j=!0,F=!0,U=!1,G=!0,Y=!1,Z=!0,K=!1,Q=!1,J=!1,ee=!1,te=!1,ne=!1,ae=!0,oe=!1,ie=!0,re=!1,ce={},se=null;const le=M6({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pe=null;const de=M6({},["audio","video","img","source","image","track"]);let ue=null;const be=M6({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Me="http://www.w3.org/1998/Math/MathML",ze="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let he=me,fe=!1,Oe=null;const Ae=M6({},[Me,ze,me],o6);let ve=M6({},["mi","mo","mn","ms","mtext"]),ge=M6({},["annotation-xml"]);const ye=M6({},["title","style","font","a","script"]);let qe=null;const We=["application/xhtml+xml","text/html"];let we=null,Le=null;const Re=a.createElement("form"),Ce=function(e){return e instanceof RegExp||e instanceof Function},xe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Le||Le!==e){if(e&&"object"==typeof e||(e={}),e=m6(e),qe=-1===We.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===qe?o6:a6,B=l6(e,"ALLOWED_TAGS")?M6({},e.ALLOWED_TAGS,we):_,H=l6(e,"ALLOWED_ATTR")?M6({},e.ALLOWED_ATTR,we):D,Oe=l6(e,"ALLOWED_NAMESPACES")?M6({},e.ALLOWED_NAMESPACES,o6):Ae,ue=l6(e,"ADD_URI_SAFE_ATTR")?M6(m6(be),e.ADD_URI_SAFE_ATTR,we):be,pe=l6(e,"ADD_DATA_URI_TAGS")?M6(m6(de),e.ADD_DATA_URI_TAGS,we):de,se=l6(e,"FORBID_CONTENTS")?M6({},e.FORBID_CONTENTS,we):le,V=l6(e,"FORBID_TAGS")?M6({},e.FORBID_TAGS,we):m6({}),X=l6(e,"FORBID_ATTR")?M6({},e.FORBID_ATTR,we):m6({}),ce=!!l6(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,F=!1!==e.ALLOW_DATA_ATTR,U=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,K=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,J=e.FORCE_BODY||!1,ae=!1!==e.SANITIZE_DOM,oe=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,$=e.ALLOWED_URI_REGEXP||E6,he=e.NAMESPACE||me,ve=e.MATHML_TEXT_INTEGRATION_POINTS||ve,ge=e.HTML_INTEGRATION_POINTS||ge,I=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(I.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(I.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(I.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(F=!1),te&&(ee=!0),ce&&(B=M6({},q6),H=[],!0===ce.html&&(M6(B,f6),M6(H,W6)),!0===ce.svg&&(M6(B,O6),M6(H,w6),M6(H,R6)),!0===ce.svgFilters&&(M6(B,A6),M6(H,w6),M6(H,R6)),!0===ce.mathMl&&(M6(B,g6),M6(H,L6),M6(H,R6))),e.ADD_TAGS&&(B===_&&(B=m6(B)),M6(B,e.ADD_TAGS,we)),e.ADD_ATTR&&(H===D&&(H=m6(H)),M6(H,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&M6(ue,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===le&&(se=m6(se)),M6(se,e.FORBID_CONTENTS,we)),ie&&(B["#text"]=!0),K&&M6(B,["html","head","body"]),B.table&&(M6(B,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw d6('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw d6('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,g=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const a="data-tt-policy-suffix";t&&t.hasAttribute(a)&&(n=t.getAttribute(a));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(M,i)),null!==v&&"string"==typeof g&&(g=v.createHTML(""));U4&&U4(e),Le=e}},ke=M6({},[...O6,...A6,...v6]),Te=M6({},[...g6,...y6]),Se=function(e){t6(n.removed,{element:e});try{A(e).removeChild(e)}catch(t){h(e)}},Ee=function(e,t){try{t6(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){t6(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Se(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ne=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=i6(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===qe&&he===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(he===me)try{t=(new b).parseFromString(o,qe)}catch(e){}if(!t||!t.documentElement){t=y.createDocument(he,"template",null);try{t.documentElement.innerHTML=fe?g:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(a.createTextNode(n),i.childNodes[0]||null),he===me?w.call(t,K?"html":"body")[0]:K?t.documentElement:i},Pe=function(e){return q.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},$e=function(e){return e instanceof u&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof s&&e instanceof s};function _e(e,t,a){Q4(e,(e=>{e.call(n,t,a,Le)}))}const He=function(e){let t=null;if(_e(R.beforeSanitizeElements,e,null),$e(e))return Se(e),!0;const a=we(e.nodeName);if(_e(R.uponSanitizeElement,e,{tagName:a,allowedTags:B}),Z&&e.hasChildNodes()&&!Be(e.firstElementChild)&&p6(/<[/\w!]/g,e.innerHTML)&&p6(/<[/\w!]/g,e.textContent))return Se(e),!0;if(e.nodeType===I6)return Se(e),!0;if(Z&&e.nodeType===V6&&p6(/<[/\w]/g,e.data))return Se(e),!0;if(!B[a]||V[a]){if(!V[a]&&Ie(a)){if(I.tagNameCheck instanceof RegExp&&p6(I.tagNameCheck,a))return!1;if(I.tagNameCheck instanceof Function&&I.tagNameCheck(a))return!1}if(ie&&!se[a]){const t=A(e)||e.parentNode,n=O(e)||e.childNodes;if(n&&t){for(let a=n.length-1;a>=0;--a){const o=m(n[a],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,f(e))}}}return Se(e),!0}return e instanceof l&&!function(e){let t=A(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const n=a6(e.tagName),a=a6(t.tagName);return!!Oe[e.namespaceURI]&&(e.namespaceURI===ze?t.namespaceURI===me?"svg"===n:t.namespaceURI===Me?"svg"===n&&("annotation-xml"===a||ve[a]):Boolean(ke[n]):e.namespaceURI===Me?t.namespaceURI===me?"math"===n:t.namespaceURI===ze?"math"===n&&ge[a]:Boolean(Te[n]):e.namespaceURI===me?!(t.namespaceURI===ze&&!ge[a])&&!(t.namespaceURI===Me&&!ve[a])&&!Te[n]&&(ye[n]||!ke[n]):!("application/xhtml+xml"!==qe||!Oe[e.namespaceURI]))}(e)?(Se(e),!0):"noscript"!==a&&"noembed"!==a&&"noframes"!==a||!p6(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===D6&&(t=e.textContent,Q4([C,x,k],(e=>{t=r6(t,e," ")})),e.textContent!==t&&(t6(n.removed,{element:e.cloneNode()}),e.textContent=t)),_e(R.afterSanitizeElements,e,null),!1):(Se(e),!0)},De=function(e,t,n){if(ae&&("id"===t||"name"===t)&&(n in a||n in Re))return!1;if(F&&!X[t]&&p6(T,t));else if(j&&p6(S,t));else if(!H[t]||X[t]){if(!(Ie(e)&&(I.tagNameCheck instanceof RegExp&&p6(I.tagNameCheck,e)||I.tagNameCheck instanceof Function&&I.tagNameCheck(e))&&(I.attributeNameCheck instanceof RegExp&&p6(I.attributeNameCheck,t)||I.attributeNameCheck instanceof Function&&I.attributeNameCheck(t))||"is"===t&&I.allowCustomizedBuiltInElements&&(I.tagNameCheck instanceof RegExp&&p6(I.tagNameCheck,n)||I.tagNameCheck instanceof Function&&I.tagNameCheck(n))))return!1}else if(ue[t]);else if(p6($,r6(n,N,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==c6(n,"data:")||!pe[e]){if(U&&!p6(E,r6(n,N,"")));else if(n)return!1}else;return!0},Ie=function(e){return"annotation-xml"!==e&&i6(e,P)},Ve=function(e){_e(R.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||$e(e))return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:r,namespaceURI:c,value:s}=i,l=we(r),p=s;let d="value"===r?p:s6(p);if(a.attrName=l,a.attrValue=d,a.keepAttr=!0,a.forceKeepAttr=void 0,_e(R.uponSanitizeAttribute,e,a),d=a.attrValue,!oe||"id"!==l&&"name"!==l||(Ee(r,e),d="user-content-"+d),Z&&p6(/((--!?|])>)|<\/(style|title)/i,d)){Ee(r,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){Ee(r,e);continue}if(!G&&p6(/\/>/i,d)){Ee(r,e);continue}Y&&Q4([C,x,k],(e=>{d=r6(d,e," ")}));const u=we(e.nodeName);if(De(u,l,d)){if(v&&"object"==typeof M&&"function"==typeof M.getAttributeType)if(c);else switch(M.getAttributeType(u,l)){case"TrustedHTML":d=v.createHTML(d);break;case"TrustedScriptURL":d=v.createScriptURL(d)}if(d!==p)try{c?e.setAttributeNS(c,r,d):e.setAttribute(r,d),$e(e)?Se(e):e6(n.removed)}catch(t){Ee(r,e)}}else Ee(r,e)}_e(R.afterSanitizeAttributes,e,null)},Xe=function e(t){let n=null;const a=Pe(t);for(_e(R.beforeSanitizeShadowDOM,t,null);n=a.nextNode();)_e(R.uponSanitizeShadowNode,n,null),He(n),Ve(n),n.content instanceof r&&e(n.content);_e(R.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null,i=null,c=null,l=null;if(fe=!e,fe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw d6("toString is not a function");if("string"!=typeof(e=e.toString()))throw d6("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Q||xe(t),n.removed=[],"string"==typeof e&&(re=!1),re){if(e.nodeName){const t=we(e.nodeName);if(!B[t]||V[t])throw d6("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)a=Ne("\x3c!----\x3e"),i=a.ownerDocument.importNode(e,!0),i.nodeType===H6&&"BODY"===i.nodeName||"HTML"===i.nodeName?a=i:a.appendChild(i);else{if(!ee&&!Y&&!K&&-1===e.indexOf("<"))return v&&ne?v.createHTML(e):e;if(a=Ne(e),!a)return ee?null:ne?g:""}a&&J&&Se(a.firstChild);const p=Pe(re?e:a);for(;c=p.nextNode();)He(c),Ve(c),c.content instanceof r&&Xe(c.content);if(re)return e;if(ee){if(te)for(l=W.call(a.ownerDocument);a.firstChild;)l.appendChild(a.firstChild);else l=a;return(H.shadowroot||H.shadowrootmode)&&(l=L.call(o,l,!0)),l}let d=K?a.outerHTML:a.innerHTML;return K&&B["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&p6($6,a.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+d),Y&&Q4([C,x,k],(e=>{d=r6(d,e," ")})),v&&ne?v.createHTML(d):d},n.setConfig=function(){xe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},n.clearConfig=function(){Le=null,Q=!1},n.isValidAttribute=function(e,t,n){Le||xe({});const a=we(e),o=we(t);return De(a,o,n)},n.addHook=function(e,t){"function"==typeof t&&t6(R[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=J4(R[e],t);return-1===n?void 0:n6(R[e],n,1)[0]}return e6(R[e])},n.removeHooks=function(e){R[e]=[]},n.removeAllHooks=function(){R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const U6=t.memo((e=>{const{meta_image:n,meta_title:a,meta_description:o,meta_host:i,short_url:r,message:c,channel:s}=e;let l="",p="";if(i){let e=i;e.endsWith("/")||(e+="/"),r&&(e+=r),l=e;try{p=new URL(e).hostname}catch(t){console.warn("Invalid URL provided:",e)}}const d=Boolean(n),u=("fsc-link-preview "+("whatsapp"===s?"fsc-link-preview--whatsapp":"")).trim(),b=("fsc-link-preview__meta "+(d?"":"fsc-link-preview__meta--no-logo")).trim();return t.createElement("div",{className:u},t.createElement("div",{className:b},d&&t.createElement("div",{className:"fsc-link-preview__meta__logo"},t.createElement("img",{src:n,alt:"page logo",loading:"lazy"})),p&&t.createElement("div",{className:"fsc-link-preview__meta__domain"},p),a&&t.createElement("div",{className:"fsc-link-preview__meta__title"},a),o&&t.createElement("div",{className:"fsc-link-preview__meta__description"},o)),c&&t.createElement("div",{className:"fsc-link-preview__message",dangerouslySetInnerHTML:{__html:F6.sanitize(c)}}),l&&t.createElement("div",{className:"fsc-link-preview__url"},t.createElement("a",{href:l,target:"_blank",rel:"noopener noreferrer","aria-label":`Visit ${p||l}`},l)))}));U6.displayName="LinkPreview";const G6=({children:e,title:n,closeModal:a,isModalOpen:o})=>t.createElement(X,{in:o,unmountOnExit:!0,timeout:500,classNames:"fade",key:n},t.createElement("div",{className:"options-popup",style:{}},t.createElement("header",null,t.createElement("button",{onClick:a,className:"close"},t.createElement(wP,null)),t.createElement("h4",null,n)),t.createElement("main",{className:"fsc-range-main"},e),t.createElement("footer",null,"Tab an item to select it"))),Y6=({question:e,saveFormValues:n})=>{const[a,o]=s(!1),{range:i}=e?.type_info?.scale_properties||{},c=Number(i?.[0]?.min),l=Number(i?.[i.length-1]?.max),p="descending"===e?.type_info?.scale_properties?.order,d=[...e?.type_info?.scale_properties?.labels?.values||[]],u=e?.type_info?.scale_properties?.labels?.preference;p&&d.reverse();const b=r(Array.from({length:l+(0===c?1:0)},((e,t)=>p?l-t:t+c)));return b.current.length<=3?t.createElement("ul",{className:`choices ${("THUMBS"===e?.type_info?.type_variant||"all"!==e?.type_info?.scale_properties?.labels?.preference)&&"one-line"}`},b.current.map(((a,o)=>"THUMBS"===e?.type_info?.type_variant?t.createElement("li",{className:"choice range-choice",key:`thumbs-${a}-${o}`},t.createElement("button",{onClick:()=>{n(a)}},t.createElement(we,{name:a?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),"all"===e?.type_info?.scale_properties?.labels?.preference&&e?.type_info?.scale_properties?.labels?.values?.[a])):t.createElement("li",{className:"choice range-choice",key:`choice-${a}-${o}`},t.createElement("button",{onClick:()=>{n(a)}},t.createElement("span",{className:"star-rating-wrapper"},Array.from({length:a},((e,n)=>t.createElement(we,{name:"whatsapp-star",id:`choice-${n}`})))," ","all"===u||"edges"===u&&(0===o||o===d.length-1)?d[a-1]:null)))))):t.createElement(t.Fragment,null,t.createElement("button",{onClick:()=>o(!0),className:"choices-button choice"},t.createElement(we,{name:"whatsapp-choices"}),"Rate Support"),t.createElement(G6,{title:"Rate Support",isModalOpen:a,closeModal:()=>o(!1)},b.current.map(((e,a)=>t.createElement("div",{className:"option-row"},t.createElement("button",{onClick:()=>{n(e),o(!1)}},t.createElement("span",{className:"star-rating-wrapper"},Array.from({length:e},((e,n)=>t.createElement(we,{name:"whatsapp-star",id:`qus-${n}`})))," ","all"===u||"edges"===u&&(0===a||a===d.length-1)?d[e-1]:null)))))))},Z6=({question:e,saveFormValues:n,type:a})=>{const[o,i]=s(!1);return t.createElement(t.Fragment,null,t.createElement("button",{onClick:()=>i(!0),className:"choices-button choice"},t.createElement(we,{name:"whatsapp-choices"}),"Select answer"),t.createElement(G6,{title:"Select a choice",isModalOpen:o,closeModal:()=>i(!1)},t.createElement("ul",{className:`choices multi-choice ${a}`},e.choices.map(((e,a)=>t.createElement("li",{className:"choice",style:{boxShadow:"none"},key:`${e}-${a}`},t.createElement("button",{onClick:()=>{n(e.id),i(!1)}},e.value)))))))},K6=e=>{const n=r(null);return((e,t)=>{c((()=>{if(e){e.style.height="0px";const t=e.scrollHeight;e.style.height=t+"px"}}),[e,t])})(n.current,String(e.value)??""),c((()=>{e.autoFocus&&n.current?.focus()}),[e.autoFocus]),t.createElement("div",{className:"textarea-container"},t.createElement("textarea",{placeholder:"Type a message",ref:n,rows:1,onChange:e.onChange,value:e.value}),t.createElement("button",{onClick:()=>{e.onSubmit(),n.current&&(n.current.value="")}},t.createElement(we,{name:"whatsapp-send"})))},Q6=({text:e,placeholders:n,pivot:a,rangeToRender:o,questions:i,answers:r})=>t.createElement("div",{className:"question-text-container"},t.createElement("div",{className:"question-text ss-question-text",dangerouslySetInnerHTML:{__html:ka({questionText:e,placeholders:n,npsRating:Ta({theme:"nps",answers:r,questions:i})??"",npsRatingLabel:Sa({theme:"nps",answers:r,questions:i}),csatRating:Ta({theme:"csat",answers:r,questions:i})??"",csatRatingLabel:Sa({theme:"csat",answers:r,questions:i}),cesRating:Ta({theme:"ces",answers:r,questions:i})??"",cesRatingLabel:Sa({theme:"ces",answers:r,questions:i}),preference:a?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0})},role:"heading","aria-level":1})),J6=({block:e,saveFormValues:n,type:a,translationVariables:o,language:i})=>{const{question_type:r}=e.question?.type_info;switch(r){case"RANGE":return t.createElement(Y6,{question:e.question,saveFormValues:e=>n(e,!0)});case"DROPDOWN":case"MULTI_CHOICE":case"MULTI_SELECT":return t.createElement(Z6,{dir:wa(i||"en")?"rtl":"ltr",question:e.question,saveFormValues:e=>n(e,!0),type:a,translationVariables:o});case"PARAGRAPH":case"INPUT":return null;default:return console.error(`Question type ${r} not supported`),null}},e8=({config:e,placeholders:n,onSelect:a,promptAccepted:i,type:r})=>{const c=o((()=>e.reverse_order?e.choices?.reverse():e.choices),[e]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"question-container ss-question-container "+(null==i?"active":"")},t.createElement(Q6,{text:e.text,placeholders:n}),t.createElement("ul",{className:"choices one-line"},c?.map(((e,n)=>t.createElement("li",{className:"choice",key:`prompt-${e}-${n}`},t.createElement("button",{className:"action",onClick:()=>{a(Number(e.id))}},t.createElement(we,{name:Number(e.id)?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),e.value)))))),void 0!==i&&t.createElement("div",{className:"answers-container"},t.createElement("div",{className:"answers"},"whatsapp"===r&&t.createElement("div",{className:"reply-block"},t.createElement("p",{className:"user"},"Acme.inc"),t.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:ka({questionText:e.text,placeholders:n})}})),t.createElement("div",{className:"answer-text"},t.createElement(we,{name:Number(i)?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),c.find((e=>e.id==i))?.value))),!1===i&&e.is_declined&&e.declined_message&&t.createElement("div",{className:"question-container ss-question-container"},t.createElement(Q6,{text:e.declined_message,placeholders:n})))},t8=e=>{const{activeBlock:n,activeIndexOfBlocks:a,activeIndexOfRenderedBlocks:o,answers:i,saveFormValues:l,blocks:p,questions:d,renderedBlocks:u,onSubmitHandler:b,isSurveyCompleted:M,pivot:z}=d$(e),{type:m="whatsapp"}=e,{question_type:h}=n?.question.type_info??{},f=t.useMemo((()=>xa(z?.question)),[z?.question]),O=r(null),[A,v]=s(void 0),g=SP({blocks:p,activeIndexOfBlocks:a,renderedBlocks:u,activeIndexOfRenderedBlocks:o,questions:d});return c((()=>{O.current&&O.current.scroll({top:1e4,behavior:"smooth"})}),[n,i,M]),n&&n.question?t.createElement("div",{className:`${m} whatsapp-container`},t.createElement("div",{className:"msg-container"},t.createElement("div",{className:"scroll-wrapper",ref:O},e.survey.prompt_settings?t.createElement(e8,{config:e.survey.prompt_settings,onSelect:e=>{v(1===e)},promptAccepted:A,placeholders:e.placeholders,type:m}):null,!e.survey.prompt_settings||A?u.map(((r,c)=>{const s=r.question.type_info?.scale_properties?.labels?.preference,h=r.question.type_info?.scale_properties?.labels?.values||[];return t.createElement(t.Fragment,null,t.createElement("div",{className:"question-container ss-question-container "+(M||c!==u.length-1?"":"active")},t.createElement(Q6,{text:r.question.text,placeholders:e.placeholders,pivot:z,rangeToRender:f}),t.createElement(J6,{language:e.language||"en",block:r,placeholders:e.placeholders,saveFormValues:(e,t)=>{l(r,e,t),setTimeout((()=>{!0===t&&SP({blocks:p,activeIndexOfBlocks:a,renderedBlocks:u,activeIndexOfRenderedBlocks:o,questions:d})&&b("COMPLETE")}))},type:m})),r.name===n.name&&!i.commitDirtyValue||ae.isNil(i.formValues[r.question.name])?null:t.createElement("div",{className:"answers-container"},t.createElement("div",{className:"answers"},"THUMBS"===r.question.type_info?.type_variant?t.createElement(t.Fragment,null,"whatsapp"===m&&t.createElement("div",{className:"reply-block"},t.createElement("p",{className:"user"},"Acme.inc"),t.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:F6.sanitize(ka({questionText:r.question.text||"",placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:i,questions:d})??"",npsRatingLabel:Sa({theme:"nps",answers:i,questions:d}),csatRating:Ta({theme:"csat",answers:i,questions:d})??"",csatRatingLabel:Sa({theme:"csat",answers:i,questions:d}),cesRating:Ta({theme:"ces",answers:i,questions:d})??"",cesRatingLabel:Sa({theme:"ces",answers:i,questions:d}),preference:z?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0}))}})),t.createElement("div",{className:"answer-text"},t.createElement(we,{name:Number(i.formValues[r.question.name])?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),"all"===r.question.type_info?.scale_properties?.labels?.preference&&r.question.type_info?.scale_properties?.labels?.values?.[Number(i.formValues[r.question.name])])):"EMOJI"===r.question.type_info?.type_variant||"STAR"===r.question.type_info?.type_variant?t.createElement(t.Fragment,null,"whatsapp"===m&&i.formValues[r.question.name]&&t.createElement("div",{className:"reply-block"},t.createElement("p",{className:"user"},"Acme.inc"),t.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:F6.sanitize(ka({questionText:r.question.text||"",placeholders:e.placeholders,npsRating:Ta({theme:"nps",answers:i,questions:d})??"",npsRatingLabel:Sa({theme:"nps",answers:i,questions:d}),csatRating:Ta({theme:"csat",answers:i,questions:d})??"",csatRatingLabel:Sa({theme:"csat",answers:i,questions:d}),cesRating:Ta({theme:"ces",answers:i,questions:d})??"",cesRatingLabel:Sa({theme:"ces",answers:i,questions:d}),preference:z?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0}))}})),t.createElement("div",{className:"answer-text"},t.createElement("div",{className:"star-rating-wrapper"},Array.from({length:Number(i.formValues[r.question.name])},((e,n)=>t.createElement(we,{name:"whatsapp-star",id:`ans-${n}`})))," ","all"===s||"edges"===s&&(1===i.formValues[r.question.name]||i.formValues[r.question.name]===h.length)?h[Number(i.formValues[r.question.name])-1]:null))):"DROPDOWN"===r.question.type_info?.question_type||"MULTI_SELECT"===r.question.type_info?.question_type?t.createElement(t.Fragment,null,r.question.choices?.find((e=>e.id===i.formValues[r.question.name]))?.value||i.formValues[r.question.name]?.toString()):t.createElement(t.Fragment,null,i.formValues[r.question.name]?.toString()))))})):null,M&&t.createElement("div",{className:"question-container ss-question-container",id:"new"},t.createElement(Q6,{text:EP({pivotQn:z?.question,pivotQnAnswer:z?.answer,block:e.survey.blocks?.find((e=>"TY"===e.name)),questions:d})?.text,placeholders:e.placeholders,pivot:z,rangeToRender:f})))),t.createElement(K6,{onChange:e=>{"PARAGRAPH"!==h||M||l(n,e.target.value)},value:"PARAGRAPH"===h&&!M&&i.formValues[n.question.name]?i.formValues[n.question.name]:"",activeBlock:!0,autoFocus:"PARAGRAPH"===h,onSubmit:()=>{l(n,i?.formValues?.[n.question.name],!0),g&&b("COMPLETE")}})):null},n8=e=>t.createElement("div",{className:`${e.channel} whatsapp-container`},t.createElement("div",{className:"msg-container"},t.createElement("div",{className:"scroll-wrapper"},t.createElement("div",{className:"question-container ss-question-container active"},t.createElement(U6,{...e})))),t.createElement(K6,{onSubmit:e=>{Da("LinkPreviewChannel","submitted")}})),a8=e=>{const{survey:n,previewConfig:a}=e,[o,i]=s(!1),[r,c]=s(!1),[l,p]=s({others_meta:{}}),{block:d,question:u,agentName:b,userName:M}=t.useMemo((()=>{const e=n.blocks.find((e=>!e.is_deleted)),t=n.question_details?.questions?.find((t=>t.name===e?.question_name||e?.category?.map((e=>e.question_name)).includes(t.name)));return{block:e,question:t,agentName:a?.agent?.firstName||a?.agent?.lastName?`${a?.agent?.firstName??""} ${a?.agent?.lastName??""}`.trim():"John Doe",userName:a?.user?.firstName||a?.user?.lastName?`${a?.user?.firstName??""} ${a?.user?.lastName??""}`.trim():"Hartmann"}}),[a?.agent?.firstName,a?.agent?.lastName,a?.user?.firstName,a?.user?.lastName,n.blocks,n.question_details?.questions]);return d?.name&&u?.name?t.createElement("div",{className:"web-chat-channel"},t.createElement("div",{className:"wc-header"},t.createElement("div",{className:"wc-h-action-button"},t.createElement(we,{name:"arrow-left"})),t.createElement("div",{className:"wc-h-info"},t.createElement("div",{className:"wc-h-info-main wc-wrap-text"},a?.topicName??"Instant support"),t.createElement("div",{className:"wc-h-info-sub wc-wrap-text"},a?.topicDescription??"Typically responds in 5 mins")),t.createElement("div",{className:"wc-h-action-button"},t.createElement(we,{name:"close"}))),t.createElement("div",{className:"wc-body"},t.createElement("div",{className:"wc-body-scroll-container"},t.createElement("div",{className:"wc-agent-details"},t.createElement("div",{className:"wc-icon"},a?.agent?.imageUrl?t.createElement("img",{src:a?.agent?.imageUrl,alt:b,className:"wc-a-avatar"}):b?.slice(0,1)),t.createElement("div",{className:"wc-a-info"},t.createElement("div",{className:"wc-a-i-name wc-break-text"},b),t.createElement("div",{className:"wc-a-i-designation wc-break-text"},a?.agent?.designation??"Sr. Customer support agent"))),t.createElement("div",{className:"wc-agent-chat-wrapper"},t.createElement("div",{className:"wc-icon"},a?.user?.imageUrl?t.createElement("img",{src:a?.user?.imageUrl,alt:M,className:"wc-a-avatar"}):M?.slice(0,1)),t.createElement("div",{className:"w-a-c-container"},t.createElement("div",{className:"wc-a-s-name wc-break-text"},M),t.createElement("div",{className:"wc-a-survey-wrapper"},t.createElement(D4,{block:d,question:u,surveyStyle:"card",onAnswer:e=>{p({...e.question.name?{[e.question.name]:e.value}:{},others_meta:{}}),i(!0)},isMobile:!0,theme:e.survey.theme??{},language:e.language,surveyServAssetUrl:e.surveyServAssetUrl,translationVariables:e.translationVariables})),t.createElement("div",{className:"wc-a-timestamp wc-break-text"},a?.timeString??(new Date).toLocaleTimeString())))),t.createElement("div",{className:"wc-footer"},t.createElement("div",{className:"w-f-link wc-wrap-text"},a?.actionText??"Continue chat"))),t.createElement("div",{className:"web-chat-survey-preview"},o&&t.createElement(H4,{answers:l,answerStatus:"PARTIAL",language:e.language,surveyServAssetUrl:e.surveyServAssetUrl,translationVariables:e.translationVariables,preview:!0,isSurveyCompleted:r,onAnsweringPrompt:e=>{},onDismiss:()=>{i(!1)},onClose:()=>{i(!1)},onSubmit:(e,t,n)=>{"COMPLETE"===n&&(c(!0),setTimeout((()=>{t()}),0))},isMobile:!0,placeholders:{},survey:e.survey,surveyType:"compact"}))):null},o8=e=>{Da("ChannelPreview",e);const{survey:n,answers:a}=RP(e.survey,e.answers);return t.useEffect((()=>{const t=document?.documentElement;!ya(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),t.useEffect((()=>{n.theme&&Ea(n.theme,e.surveyServAssetUrl??"")}),[n.theme,e.surveyServAssetUrl]),"chat"===e.channel?t.createElement(a8,{...e,survey:n,answers:a}):"whatsapp"===e.channel?t.createElement(t8,{...e,survey:n,answers:a}):"instagram"===e.channel?t.createElement(t8,{type:"instagram",...e,survey:n,answers:a}):(console.error(`Channel ${e.channel} not supported`),null)},i8=e=>{Da("ChannelLinkPreview",e);return t.useEffect((()=>{const t=document?.documentElement;!ya(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),["whatsapp","instagram"].includes(e.channel)?t.createElement(n8,{...e}):(console.error(`Channel ${e.channel} not supported`),null)};var r8=Object.freeze({__proto__:null,allPathsLoader:function(e,t){return gi(void 0,void 0,void 0,(function(){return yi(this,(function(n){switch(n.label){case 0:return[4,Promise.resolve().then((function(){return xr}))];case 1:return[2,(0,n.sent().getIconPaths)(e,t)]}}))}))}}),c8=Object.freeze({__proto__:null,splitPathsBySizeLoader:function(e,t){return gi(void 0,void 0,void 0,(function(){var n,a;return yi(this,(function(o){switch(o.label){case 0:return n=yr(e),t!==Wr.STANDARD?[3,2]:[4,Promise.resolve().then((function(){return wr}))];case 1:return a=o.sent(),[3,4];case 2:return[4,Promise.resolve().then((function(){return Lr}))];case 3:a=o.sent(),o.label=4;case 4:return[2,a[n]]}}))}))}});export{ge as ALL_FONTS,xe as Binary,Te as Button,i8 as ChannelLinkPreview,o8 as ChannelPreview,dt as Checkbox,ve as DEFAULT_FONT,jq as DatePicker,Fq as DateTimePicker,ja as Dropdown,ye as FONT_SIZE_OPTIONS,Xa as Input,Ya as Loader,Za as PhoneNumberInput,Uq as ProgressBar,D4 as QuestionPreview,DT as RadioGroup,XT as Range,wN as RankOrder,yP as Slider,B4 as Survey,Ga as SurveyFooter,qP as SurveyProgress,WP as TextArea,H4 as WebInAppSurvey};
|