freemium-survey-components 0.10.19 → 0.10.20
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/lib/index.cjs.js +1 -1
- package/lib/index.esm.js +1 -1
- package/package.json +1 -1
package/lib/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),t=e(n),o=e(require("react-dom")),r=e(require("react-focus-lock"));function a(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}a(".freemium-survey-components .nps-container {\n margin: 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n grid-gap: 52px;\n gap: 52px;\n}\n.freemium-survey-components .nps-container .footer {\n border-top: 1px solid var(--default-background-color);\n border-top: 1px solid var(--background-color, var(--default-background-color));\n padding-top: 20px;\n margin-top: 20px;\n display: flex;\n justify-content: center;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #666;\n}\n.freemium-survey-components .nps-container .nps-scale {\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .button-container {\n display: flex;\n border-radius: 4px;\n justify-content: space-between;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .positive-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n right: 0px;\n text-align: right;\n}\n.freemium-survey-components .nps-container .nps-scale .negative-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n left: 0;\n text-align: left;\n}\n.freemium-survey-components .nps-container .nps-scale span {\n color: #aaa;\n font-size: 0.75rem;\n}\n.freemium-survey-components .nps-container .nps-scale button {\n display: inline-block;\n font-size: 1rem;\n white-space: nowrap;\n vertical-align: middle;\n background: none;\n border: none;\n box-shadow: none;\n cursor: pointer;\n text-align: center;\n font-weight: 400;\n border-radius: 4px;\n margin: 0;\n outline: none;\n margin-left: -1px;\n width: 40px;\n height: 40px;\n transform: scale(1);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover {\n transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover, .freemium-survey-components .nps-container .nps-scale button:focus {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale button.active {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale.rounded button {\n border-radius: 50%;\n}\n.freemium-survey-components .nps-container .nps-scale.square button {\n border-radius: 0;\n}\n.freemium-survey-components .nps-container .nps-scale.curved button {\n border-radius: 3px;\n}\n.freemium-survey-components .nps-container .nps-scale.highlighted button:hover, .freemium-survey-components .nps-container .nps-scale.highlighted button:focus, .freemium-survey-components .nps-container .nps-scale.highlighted button.active {\n background: var(--default-brand-color) !important;\n background: var(--brand-color, var(--default-brand-color)) !important;\n}\n.freemium-survey-components .nps-container .nps-scale .choices {\n width: 100%;\n display: flex;\n justify-content: space-between;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .button-container {\n background-color: transparent;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice {\n color: #000;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice.active,\n.freemium-survey-components .nps-container .nps-scale.standard .choice:focus,\n.freemium-survey-components .nps-container .nps-scale.standard .choice:hover {\n color: #fff;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1).active {\n background: #eb5b56;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2).active {\n background: #fb8774;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3).active {\n background: #f58f6b;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4).active {\n background: #f6996a;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5).active {\n background: #eab268;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6).active {\n background: #cebb69;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7).active {\n background: #bdc46c;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8).active {\n background: #a4cd72;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9).active {\n background: #77c955;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10).active {\n background: #37c248;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11).active {\n background: #1ebf31;\n}\n\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .nps-container .nps-scale .button-container,\n.card-survey-style .nps-container .nps-scale .button-container {\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale .choices,\n.card-survey-style .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale button,\n.card-survey-style .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n }\n}\n.widget-survey-components .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}");const s=e=>{const{type_info:{linear_scale:{button_style:o="highlighted",button_shape:r="rounded"}={},score_presets:{start:a="Very unlikely",end:s="Very likely"}={},validation:{min:i},footer_text:c}}=e,u=e=>{switch(e){case e<=6:return"detractor";case e<=8:return"passive";default:return"promoter"}},l=n.useRef(Array.from({length:10+(0===i?1:0)},((e,n)=>n+i)));return t.createElement("div",{className:"nps-container","data-test-input":"nps"},t.createElement("div",{className:`nps-scale ${r} ${o}`},t.createElement("div",{className:"button-container"},t.createElement("span",{className:"negative-text",role:"note"},`${i} - ${a}`),t.createElement("span",{className:"positive-text",role:"note"},`${l.current[l.current.length-1]} - ${s}`),t.createElement("div",{className:"choices",role:"radiogroup","aria-required":!0},l.current.map((n=>t.createElement("button",{role:"radio","aria-checked":e.npsValue===n,key:n,"data-test-nps-choice":n,onClick:t=>{e.onChangeHandler(n)},className:`choice ${u(n)} ${e.npsValue===n&&"active"}`},n)))))),t.createElement("div",{className:"footer",role:"note"},c))},i=(e,n)=>(e.defaultProps=n,e);a('.freemium-survey-components .input-container,\n.freemium-survey-components .textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n.freemium-survey-components label.input-label {\n display: inline-block;\n padding-bottom: 8px;\n padding-left: 2px;\n font-size: 0.75rem;\n font-weight: 400;\n}\n.freemium-survey-components label.required::after {\n content: "*";\n position: relative;\n top: 2px;\n font-weight: 500;\n font-size: 0.85rem;\n padding-left: 3px;\n color: #d72d30;\n}\n.freemium-survey-components .input-basic {\n width: 100%;\n display: flex;\n align-items: center;\n border-radius: 4px;\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n transition: border-color 0.2s linear;\n background: #fff;\n}\n.freemium-survey-components .textarea-container .input-basic {\n flex-direction: column;\n align-items: unset;\n}\n.freemium-survey-components .input-basic.error {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error:hover {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error[focus-within] {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic.error:focus-within {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: 0.2s linear;\n}\n.freemium-survey-components .input-basic[focus-within] {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .input-basic:focus-within {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .end-max-length {\n padding: 0 8px;\n font-size: 0.85rem;\n}\n.freemium-survey-components .textarea-container .end-max-length {\n padding: 8px;\n align-self: flex-end;\n}\n.freemium-survey-components span.input-error {\n display: block;\n padding-left: 2px;\n padding-top: 4px;\n font-size: 0.9rem;\n color: #d72d30;\n}\n.freemium-survey-components input[type=text] {\n padding: 6px 12px;\n flex: 1;\n border: unset;\n height: 32px;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components input[type=text],\n.freemium-survey-components textarea {\n outline: none;\n border: none;\n}\n.freemium-survey-components input[type=text]::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea {\n min-height: 116px;\n padding: 12px;\n flex: 1;\n border: unset;\n resize: none;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components textarea::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}');const c={isRequired:!1,showCount:!1,isErrored:!1,inline:!1,spellCheck:!1,autoFocusInput:!0},u=n.forwardRef(((e,o)=>{const r=n.useRef(null);n.useEffect((()=>{e.autoFocusInput&&setTimeout((()=>{r.current?.focus()}),q+350)}),[e.autoFocusInput]);const{inputStyle:a,style:s,className:i,showCount:c,isErrored:u,startLabel:l,isRequired:d,errorText:p,endLabel:m,maxLength:f,autoFocusInput:h,...v}=e;return t.createElement("div",{className:"input-container",style:s},e.label&&t.createElement("label",{className:"input-label "+(d?"required":"")},e.label),t.createElement("div",null,l&&t.createElement("div",{className:"start-label"},l),t.createElement("div",{className:`input-basic ${u?"error":""}${i||""}`},t.createElement("input",Object.assign({type:"text",autoComplete:"off",ref:r,style:a},v)),c&&f>0&&t.createElement("div",{className:"end-max-length"},`${e.value&&e.value.length||0}/${e.maxLength}`)),m&&t.createElement("div",{className:"end-label"},m)),u&&p&&t.createElement("span",{className:"input-error"},e.errorText))})),l=n.forwardRef(((e,o)=>{const r=n.useRef(null);n.useEffect((()=>{e.autoFocusInput&&setTimeout((()=>{r.current?.focus()}),q+350)}),[e.autoFocusInput]);const{inputStyle:a,style:s,className:i,showCount:c,maxLength:u,isErrored:l,startLabel:d,isRequired:p,autoFocusInput:m,...f}=e;return t.createElement(t.Fragment,null,t.createElement("div",{className:"textarea-container",style:s},e.label&&t.createElement("label",{className:"input-label "+(p?"required":"")},e.label),d&&t.createElement("div",{className:"start-label"},d),t.createElement("div",{className:`input-basic ${l?"error":""} ${i||""}`},t.createElement("textarea",Object.assign({autoComplete:"off",ref:r,style:a},f)),c&&u&&u>0&&t.createElement("div",{className:"end-max-length"},`${e.value&&e.value.length||0}/${e.maxLength}`)),e.endLabel&&t.createElement("div",{className:"end-label"},e.endLabel)),e.isErrored&&e.errorText&&t.createElement("span",{className:"input-error"},e.errorText))})),d=i(u,c),p=i(l,c);a('.freemium-survey-components .checkbox-group {\n width: 100%;\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n flex-direction: column;\n white-space: nowrap;\n flex-wrap: wrap;\n}\n.freemium-survey-components .icon-container {\n display: inline-block;\n flex: 0 0 12px;\n width: 12px;\n height: 12px;\n min-width: 12px;\n min-height: 12px;\n color: inherit;\n position: absolute;\n left: 1px;\n top: 2px;\n}\n.freemium-survey-components .tick-icon {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n color: inherit;\n fill: currentColor;\n}\n.freemium-survey-components input[type=checkbox] {\n position: absolute;\n clip: rect(0px 0px 0px 0px);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=checkbox]:focus ~ .checkbox {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 2px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 2px;\n border-color: transparent;\n}\n.freemium-survey-components .checkbox-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n opacity: 1;\n line-height: 1.2;\n cursor: pointer;\n font-size: 1rem;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components .checkbox-label:hover .checkbox {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components .checkbox-label.disabled {\n opacity: 0.5;\n cursor: "not-allowed";\n}\n.freemium-survey-components .checkbox {\n transition: background-color ease-in 0.2s;\n min-width: 14px;\n min-height: 14px;\n min-height: 14px;\n max-height: 14px;\n border-radius: 2px;\n position: relative;\n margin-right: 16px;\n background-color: #fff;\n border: 1px solid;\n text-align: left;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:disabled ~ .checkbox:hover {\n box-shadow: unset;\n border-color: unset;\n}');const m=()=>t.createElement("svg",{id:"tick",className:"tick-icon",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"title",viewBox:"0 0 10 10"},t.createElement("path",{d:"M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z",fill:"#fff",fillRule:"evenodd"})),f=({values:e=[],options:o,autoFocusGroup:r,onChangeHandler:a,othersOption:s,othersRequired:i})=>{const c=(()=>{let n=-1;return e.map(((e,t)=>{const r=o.find((n=>n.value===e));return r||(n=t),r})),n})(),[u,l]=n.useState(!1),p=n.useRef(null);return n.useEffect((()=>{r&&setTimeout((()=>{p.current?.focus()}),q+350)}),[r]),t.createElement("div",{className:"checkbox-group"},t.createElement("button",{ref:p,className:"autofocus-button","aria-hidden":!0}),o?.map(((n,o)=>t.createElement(h,{key:n.id,checked:e?.includes(n.value),name:n.value,id:n.id,onChange:(t,o)=>{if(o)a([...e||[],n.value]);else{const t=e.indexOf(n.value);t>-1&&e.splice(t,1),a([...e])}}},n.value))),s&&t.createElement(h,{key:"others",checked:u,name:"others",id:"others",onChange:(e,n)=>{l(n)}},"Others"),u&&t.createElement(t.Fragment,null,t.createElement(d,{placeholder:"Enter your comment",value:e[c],onChange:n=>{-1!==c?(e[c]=n.target.value,a(e)):a(e.concat(n.target.value))},label:""})))},h=i((e=>{const o=n.useRef(null);return n.useEffect((()=>{e.autoFocus&&setTimeout((()=>{o.current?.focus()}),q+20)}),[]),t.createElement("label",{className:`checkbox-label ${e.disabled&&"disabled"}`},t.createElement("input",{ref:o,id:e.id,type:"checkbox",name:e.name,readOnly:e.readOnly,disabled:e.disabled,"aria-disabled":e.disabled,checked:e.checked,onChange:e.readOnly?()=>{}:n=>e.onChange(n,n.target.checked)}),t.createElement("div",{className:"checkbox"},e.checked&&t.createElement("div",{className:"icon-container"},t.createElement(m,null)," ")),t.createElement("div",null,e.children))}),{checked:!1});a('.freemium-survey-components .radio-group {\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n white-space: nowrap;\n flex-direction: column;\n width: 100%;\n}\n.freemium-survey-components .radio {\n background-color: #fff;\n border: 1px solid;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: background-color ease-in 0.2s;\n min-width: 18px;\n max-width: 18px;\n min-height: 18px;\n max-height: 18px;\n border-radius: 50%;\n position: relative;\n margin-right: 16px;\n text-align: left;\n}\n.freemium-survey-components .radio:before {\n left: 3px;\n top: 3px;\n content: "";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transition: all ease-in 0.2s;\n background-color: #fff;\n}\n.freemium-survey-components .radio-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n cursor: pointer;\n line-height: 1.2;\n font-size: 1rem;\n font-weight: 400;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components input[type=radio] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=radio]:focus ~ .radio {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 3px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 3px;\n border-color: transparent;\n}\n.freemium-survey-components input[type=radio]:checked ~ .radio:before {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .radio-label:hover .radio {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}');const v=({name:e,options:o,value:r,autoFocusGroup:a,onChangeHandler:s,othersOption:i,othersRequired:c})=>{const[u,l]=n.useState(""),[p,m]=n.useState(""),f=n.useRef(null);return n.useEffect((()=>{a&&setTimeout((()=>{f.current?.focus()}),q+350)}),[a]),n.useEffect((()=>{r||(m(""),l(""))}),[r]),n.useEffect((()=>{p&&o.find((e=>e.value===p))&&s(p)}),[p]),t.createElement("div",{className:"radio-group",role:"radiogroup"},t.createElement("button",{ref:f,className:"autofocus-button","aria-hidden":!0,tabIndex:-1}),o?.map(((n,o)=>t.createElement(x,{key:n.value,value:n.value,name:e,onChange:e=>{m(e.currentTarget.value)},checked:p===n.value},n.value))),i&&t.createElement(x,{key:"others",value:"others",name:e,onChange:e=>{m("others")},checked:"others"===p},"Others"),"others"===p&&t.createElement(t.Fragment,null,t.createElement(d,{value:u,onChange:e=>l(e.target.value),placeholder:"Enter your comment",label:""}),u!==r&&t.createElement(g,{inline:!0,disabled:c&&0===u.length,onClick:()=>s(u)},"Next")))},x=i((e=>{const o=n.useRef(null);return n.useEffect((()=>{e.autoFocus&&setTimeout((()=>{o.current?.focus()}),q+20)}),[]),t.createElement("label",{className:"radio-label"},t.createElement("input",{ref:o,type:"radio",name:e.name,value:e.value,checked:e.checked,onChange:e.onChange}),t.createElement("div",{className:"radio"}),t.createElement("div",null,e.children))}),{checked:!1,autoFocus:!1});a(".progressbar-container {\n width: 100%;\n height: 4px;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n text-align: left;\n}\n\n.progressbar {\n transition: transform 0.25s linear;\n transform-origin: left;\n height: 100%;\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}");const b=e=>{const{totalSteps:n,completedSteps:o}=e;return t.createElement("div",{className:"progressbar-container"},t.createElement("div",{className:"progressbar",style:{width:(o>0?100/n:0)+"%",transform:`scaleX(${o})`}}))};a(".freemium-survey-components .action-button {\n width: auto;\n display: block;\n padding: 8px 16px;\n cursor: pointer;\n line-height: 1.5;\n text-align: center;\n font-weight: 500;\n letter-spacing: 0.3px;\n border-radius: 4px;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: --default-button-text-color;\n color: var(--button-text-color, --default-button-text-color);\n background: var(--default-brand-color);\n background: var(--brand-color, var(--default-brand-color));\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n border-radius: 4px;\n min-width: 200px;\n max-width: -webkit-fit-content;\n max-width: -moz-fit-content;\n max-width: fit-content;\n transform: translateY(0px);\n transition: transform ease 0.2s;\n}\n.freemium-survey-components .action-button:not([disabled]):hover {\n transform: translateY(-4px);\n}\n.freemium-survey-components .action-button[disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n}\n.freemium-survey-components button:focus:not(:active) {\n /* box-shadow: 0 0 0 2px ${pseudo.focus}; */\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .action-button {\n min-width: 120px;\n }\n}\n.widget-survey-components .action-button {\n min-width: 120px;\n}\n\n.freemium-survey-components.mobile-preview .action-button {\n min-width: 120px;\n}");const y=()=>t.createElement(t.Fragment,null,"..."),g=e=>{const{inline:n=!1,children:o,disabled:r,className:a="",htmlType:s,type:i="primary",onClick:c,size:u,overrideStyleClassName:l="",loading:d=!1,...p}=e;return t.createElement("button",Object.assign({style:n?{display:"inline-block"}:{},disabled:r,className:`action-button ${a} ${l}`,type:s,onClick:c},p),d?t.createElement(y,null):o)},w=({question:e,formValues:n,onChangeHandler:o,autoFocusInput:r})=>{switch(e.type_info.question_type){case"RANGE":return t.createElement(s,{type_info:e.type_info,onChangeHandler:o,npsValue:n[e.name]});case"CHECKBOX":case"MULTI_SELECT":return t.createElement(f,{autoFocusGroup:r,values:n[e.name],options:e.type_info.choices,onChangeHandler:o,othersOption:e.type_info.meta?.othersOption,othersRequired:e.type_info.meta?.othersRequired});case"RADIO":case"DROPDOWN":return t.createElement(v,{autoFocusGroup:r,name:e.name,onChangeHandler:o,options:e.type_info.choices,value:n[e.name],othersOption:e.type_info.meta?.othersOption,othersRequired:e.type_info.meta?.othersRequired});case"INPUT":case"TEXT":return e.type_info?.meta?.readOnly?t.createElement("div",{className:"message-container"},e.type_info?.meta?.value):t.createElement("div",{className:"responsive-text-field"},t.createElement(d,{autoFocusInput:r,label:"",maxLength:300,showCount:!0,isRequired:e.is_required,value:n[e.name]||"",placeholder:e.type_info?.meta?.placeholder??"",onChange:e=>o(e.target.value)}),t.createElement(p,{autoFocusInput:r,label:"",maxLength:300,showCount:!0,isRequired:e.is_required,placeholder:e.type_info?.meta?.placeholder??"",value:n[e.name]||"",onChange:e=>o(e.target.value)}));case"PARAGRAPH":return t.createElement(p,{autoFocusInput:r,label:"",isRequired:e.is_required,placeholder:e.type_info?.meta?.placeholder??"",value:n[e.name]||"",onChange:e=>o(e.target.value)});default:return console.error(`Question type ${e.type_info.question_type} not found`),null}},k=(e,n,t)=>{if(e){let o={"{{nps.score}}":t};n&&(o={...o,...n});const r=new RegExp(Object.keys(o).join("|"),"gi");e=e.replace(r,(function(e){return o[e.toLowerCase()]}))}return e};a(":root {\n --default-brand-color: #264966;\n --default-question-text-color: #000;\n --default-question-background-color: #fff;\n --default-background-color: #f8f8f8;\n --default-button-text-color: #fff;\n --default-secondary-button-text-color: #000;\n --default-input-placeholder-color: #92a2b1;\n --compact-widget-max-height: 560px;\n --default-widget-max-height: 400px;\n --cozy-widget-max-height: 380px;\n}\n\n.freemium-survey-step-navigation {\n padding: 0 2px;\n box-shadow: 0px 0px 6px #eee;\n}\n.freemium-survey-step-navigation .navigation-button {\n width: 38px;\n text-align: -webkit-center;\n height: 38px;\n background-color: #fff;\n border: none;\n cursor: pointer;\n border-radius: 0 3px 3px 0;\n}\n.freemium-survey-step-navigation .navigation-button:first-of-type {\n border-right: 1px solid #d9d9d9;\n border-radius: 3px 0 0 3px;\n}\n.freemium-survey-step-navigation .navigation-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.freemium-survey-step-navigation .navigation-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.freemium-survey-components .question-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n text-align: center;\n max-width: 700px;\n margin: 0 auto;\n background: var(--default-question-background-color);\n background: var(--question-background-color, var(--default-question-background-color));\n border-radius: 4px;\n transition: transform 500ms ease 0ms, opacity 200ms ease 0ms;\n box-shadow: 0px 12px 15px rgba(18, 52, 77, 0.03);\n margin-bottom: 28px;\n padding: 28px 28px 20px 28px;\n grid-gap: 28px;\n gap: 28px;\n position: relative;\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n transition: opacity 50ms ease-out;\n overflow: auto;\n}\n.freemium-survey-components .hide-question-container {\n opacity: 0;\n}\n.freemium-survey-components .question-text {\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.8;\n width: 100%;\n text-align: left;\n color: var(--default-question-text-color);\n color: var(--question-text-color, var(--default-question-text-color));\n}\n.freemium-survey-components .autofocus-button {\n border: none;\n width: 0;\n height: 0;\n opacity: 0;\n margin-top: -12px;\n margin-left: -12px;\n}\n@-webkit-keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.freemium-survey-components .question-footer {\n display: flex;\n justify-content: flex-end;\n grid-gap: 40px;\n gap: 40px;\n width: 100%;\n align-items: center;\n}\n.freemium-survey-components .question-footer:empty {\n display: none;\n}\n.freemium-survey-components .action-buttons {\n display: flex;\n grid-gap: 20px;\n gap: 20px;\n flex-direction: row-reverse;\n}\n.freemium-survey-components .action-buttons:empty {\n display: none;\n}\n.freemium-survey-components .skip-button {\n font-weight: 400;\n cursor: pointer;\n background: transparent;\n border: none;\n min-width: 40px;\n padding: 8px 16px;\n border-radius: 4px;\n color: var(--default-secondary-button-text-color);\n color: var(--secondary-button-text-color, var(--default-secondary-button-text-color));\n letter-spacing: 0.05rem;\n line-height: 1.5;\n border: 1px solid transparent;\n}\n.freemium-survey-components .skip-button:hover {\n background-color: #f3f3f3;\n}\n.freemium-survey-components .next-button {\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .submit {\n max-width: 700px;\n margin: 0 auto;\n text-align: left;\n background: transparent;\n box-shadow: none;\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .thankyou {\n display: flex;\n align-items: center;\n justify-content: center;\n grid-gap: 20px;\n gap: 20px;\n min-height: 180px;\n}\n.freemium-survey-components .thankyou .heading {\n font-weight: 600;\n font-size: 28px;\n}\n.freemium-survey-components .thankyou .text {\n white-space: pre-wrap;\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.6;\n color: #12344d;\n width: 75%;\n}\n.freemium-survey-components .thankyou .redirection-text {\n color: #929292;\n margin-bottom: 12px;\n font-weight: 300;\n}\n.freemium-survey-components .thankyou .link {\n width: 100%;\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: #666;\n font-weight: 500;\n text-decoration: underline;\n}\n.freemium-survey-components .responsive-text-field {\n width: 100%;\n}\n.freemium-survey-components .responsive-text-field .textarea-container {\n display: none;\n}\n.freemium-survey-components .message-container:empty {\n display: none;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-component .responsive-text-field .input-container,\n.card-survey-style .responsive-text-field .input-container {\n display: none;\n }\n .freemium-survey-component .responsive-text-field .textarea-container,\n.card-survey-style .responsive-text-field .textarea-container {\n display: flex;\n }\n}\ndiv.widget-survey-components,\ndiv.card-survey-style {\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n flex-grow: 1;\n font-size: 0.875rem;\n overflow: hidden;\n}\ndiv.widget-survey-components .questions,\ndiv.card-survey-style .questions {\n min-width: 100%;\n max-width: 100%;\n display: flex;\n height: 100%;\n position: relative;\n max-height: 560px;\n max-height: var(--compact-widget-max-height);\n}\ndiv.widget-survey-components .question-text,\ndiv.card-survey-style .question-text {\n width: 100%;\n text-align: left;\n}\ndiv.widget-survey-components .focus-lock,\ndiv.card-survey-style .focus-lock {\n width: 100%;\n}\ndiv.widget-survey-components .question-container,\ndiv.card-survey-style .question-container {\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n min-width: 100%;\n max-width: 100%;\n margin-bottom: 0;\n padding: 16px 28px;\n grid-gap: 16px;\n gap: 16px;\n flex-grow: 1;\n}\ndiv.widget-survey-components .question-footer,\ndiv.card-survey-style .question-footer {\n margin: 0px auto;\n justify-content: space-between;\n position: -webkit-sticky;\n position: sticky;\n bottom: 0;\n padding-bottom: 20px;\n}\ndiv.widget-survey-components .submit,\ndiv.card-survey-style .submit {\n padding-bottom: 0;\n margin: unset;\n}\ndiv.widget-survey-components .nps-container .footer,\ndiv.card-survey-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components .nps-container .widget .choices,\ndiv.card-survey-style .nps-container .widget .choices {\n grid-gap: 8px;\n gap: 8px;\n}\ndiv.widget-survey-components .radio-group,\ndiv.card-survey-style .radio-group {\n width: 100%;\n}\ndiv.widget-survey-components .checkbox-group,\ndiv.card-survey-style .checkbox-group {\n width: 100%;\n flex-wrap: nowrap;\n}\n\ndiv.widget-survey-components .question-container {\n box-shadow: none;\n border-radius: 0;\n}\ndiv.widget-survey-components .question-text {\n font-size: 0.875rem;\n}\ndiv.widget-survey-components .progressbar-container {\n position: absolute;\n}\ndiv.widget-survey-components .progressbar-container .progressbar {\n border-radius: 3px 0 0 0;\n}\ndiv.widget-survey-components .textarea-container .end-max-length {\n padding: 4px;\n}\ndiv.widget-survey-components .responsive-text-field .input-container {\n display: none;\n}\ndiv.widget-survey-components .responsive-text-field .textarea-container {\n display: flex;\n}\ndiv.widget-survey-components div.thankyou {\n min-height: unset;\n}\ndiv.widget-survey-components div.thankyou .text {\n width: 85%;\n}\ndiv.widget-survey-components div.thankyou svg {\n width: 140px;\n height: 120px;\n}\n\ndiv.widget-survey-components.default-style .freemium-survey-step-navigation {\n margin: 0;\n}\ndiv.widget-survey-components.default-style .questions {\n max-height: 400px;\n max-height: var(--default-widget-max-height);\n}\ndiv.widget-survey-components.default-style .question-container {\n padding: 12px 28px;\n}\ndiv.widget-survey-components.default-style .question-footer {\n justify-content: space-between;\n}\ndiv.widget-survey-components.default-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.default-style .nps-container .choices {\n flex-wrap: unset;\n grid-gap: 12px;\n gap: 12px;\n}\ndiv.widget-survey-components.default-style .action-button {\n line-height: 1.2;\n}\ndiv.widget-survey-components.default-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style textarea {\n min-height: 84px;\n}\ndiv.widget-survey-components.default-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.widget-survey-components.cozy-style .freemium-survey-step-navigation {\n margin: 0;\n}\n.widget-survey-components.cozy-style .questions {\n max-height: 380px;\n max-height: var(--cozy-widget-max-height);\n}\n.widget-survey-components.cozy-style .question-text {\n font-size: 1rem;\n}\n.widget-survey-components.cozy-style .question-text.nps {\n text-align: center;\n width: 60%;\n min-width: 600px;\n margin: auto;\n}\n.widget-survey-components.cozy-style .question-container {\n padding: 12px 28px;\n}\n.widget-survey-components.cozy-style .question-footer {\n justify-content: space-between;\n}\n.widget-survey-components.cozy-style .nps-container {\n grid-gap: 44px;\n gap: 44px;\n}\n.widget-survey-components.cozy-style .nps-container .widget {\n display: flex;\n justify-content: center;\n}\n.widget-survey-components.cozy-style .nps-container .button-container {\n width: 60%;\n min-width: 600px;\n margin: 0 auto;\n}\n.widget-survey-components.cozy-style .nps-container .button-container .choices {\n justify-content: space-around;\n}\n.widget-survey-components.cozy-style .nps-container .footer {\n padding-top: 8px;\n}\n.widget-survey-components.cozy-style .action-button {\n line-height: 1.2;\n}\n.widget-survey-components.cozy-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style textarea {\n min-height: 60px;\n}\n.widget-survey-components.cozy-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.freemium-survey-components.mobile-preview .thankyou .text {\n width: unset;\n}");const E=["RANGE","NPS","RADIO","DROPDOWN"],q=200,C=({thankYouQuestion:e,preview:o,placeholders:r,npsValue:a})=>(n.useEffect((()=>{o||e.type_info.meta?.redirectUrl&&setTimeout((()=>{window.location.href=e.type_info.meta?.redirectUrl}),1e4)}),[]),t.createElement("div",{className:"question-container thankyou"},t.createElement("div",{className:"heading"},"Thank you!"),t.createElement("div",{className:"text",dangerouslySetInnerHTML:{__html:k(e.text,r,a)}}),e.type_info.meta?.redirectUrl&&t.createElement("div",{style:{width:"100%"}},t.createElement("div",{className:"redirection-text"},"You will be redirected to the below URL automatically in 10 seconds.",t.createElement("br",null)),t.createElement("a",{className:"link",href:e.type_info.meta?.redirectUrl},e?.type_info.meta?.redirectUrl)))),_=()=>t.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M7.82585 6.15754C7.98999 6.32147 8.08232 6.54389 8.08252 6.77587L8.08252 7.2192C8.07983 7.45069 7.98788 7.6722 7.82585 7.83754L1.82919 13.8225C1.77496 13.8772 1.71044 13.9206 1.63936 13.9502C1.56827 13.9798 1.49203 13.9951 1.41502 13.9951C1.33801 13.9951 1.26177 13.9798 1.19068 13.9502C1.1196 13.9206 1.05508 13.8772 1.00085 13.8225L0.172521 12.9942C0.118197 12.941 0.0750381 12.8774 0.0455752 12.8073C0.0161124 12.7372 0.000937578 12.6619 0.000937585 12.5859C0.000937592 12.5098 0.0161125 12.4345 0.0455753 12.3644C0.0750381 12.2943 0.118197 12.2308 0.172521 12.1775L5.36419 6.99754L0.172522 1.81754C0.117847 1.76331 0.0744506 1.69879 0.0448352 1.62771C0.0152208 1.55662 -2.75162e-05 1.48038 -2.75094e-05 1.40337C-2.75027e-05 1.32636 0.0152208 1.25012 0.0448353 1.17904C0.0744507 1.10795 0.117847 1.04343 0.172522 0.989205L1.00086 0.172537C1.05508 0.117862 1.1196 0.0744661 1.19069 0.0448507C1.26177 0.0152353 1.33801 -1.20337e-05 1.41502 -1.2027e-05C1.49203 -1.20203e-05 1.56827 0.0152353 1.63936 0.0448507C1.71044 0.0744661 1.77496 0.117862 1.82919 0.172537L7.82585 6.15754Z",fill:"#6B6B6B"})),N=()=>t.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M0.256667 7.83755C0.0925257 7.67361 0.000204227 7.4512 0 7.21921V6.77588C0.00268801 6.5444 0.0946357 6.32289 0.256667 6.15755L6.25333 0.172549C6.30756 0.117874 6.37208 0.0744776 6.44316 0.0448625C6.51425 0.0152474 6.59049 0 6.6675 0C6.74451 0 6.82075 0.0152474 6.89184 0.0448625C6.96292 0.0744776 7.02744 0.117874 7.08167 0.172549L7.91 1.00088C7.96432 1.05411 8.00748 1.11764 8.03694 1.18776C8.06641 1.25787 8.08158 1.33316 8.08158 1.40922C8.08158 1.48527 8.06641 1.56056 8.03694 1.63067C8.00748 1.70079 7.96432 1.76432 7.91 1.81755L2.71833 6.99755L7.91 12.1775C7.96467 12.2318 8.00807 12.2963 8.03769 12.3674C8.0673 12.4385 8.08255 12.5147 8.08255 12.5917C8.08255 12.6687 8.0673 12.745 8.03769 12.8161C8.00807 12.8871 7.96467 12.9517 7.91 13.0059L7.08167 13.8225C7.02744 13.8772 6.96292 13.9206 6.89184 13.9502C6.82075 13.9799 6.74451 13.9951 6.6675 13.9951C6.59049 13.9951 6.51425 13.9799 6.44316 13.9502C6.37208 13.9206 6.30756 13.8772 6.25333 13.8225L0.256667 7.83755Z",fill:"#6B6B6B"})),z=({currentBlockIndex:e,currentBlockIndexOfBlocksWithQns:n,blocksWithQns:o,blocks:r,setHorizontalScrollUnits:a,preventQuestionAnimation:s})=>t.createElement("div",{className:"freemium-survey-step-navigation","data-navigation-element":"1"},t.createElement("button",{disabled:0==n.current,className:"navigation-button",onClick:()=>{n.current=Math.max(n.current-1,0),e.current=r.findIndex((e=>e.name===o[n.current].name)),s.current=!1,a(n.current)}},t.createElement(N,null)),t.createElement("button",{className:"navigation-button",disabled:n.current>=o.length-1,onClick:()=>{s.current=!1,n.current=Math.min(n.current+1,o.length-1),e.current=r.findIndex((e=>e.name===o[n.current].name)),a(n.current)}},t.createElement(_,null))),S=({widget:e,widgetStyle:n,surveyStyle:o,formValues:r,blocksWithQns:a,blocks:s,thankYouQuestion:i,currentBlockIndexOfBlocksWithQns:c,currentBlockIndexOfBlocks:u,currentEditingBlock:l,isSubmitting:d,isValuesCommitted:p,isCurrentBlockFinal:m,setHorizontalScrollUnits:f,handleFormValues:h,skipBlock:v,setIsSubmitting:x,onSubmit:b,setIsSurveyCompleted:y,preventQuestionAnimation:w,preview:k,...q})=>{const C=q.blockIndex??c.current,_=q.question??a[C].question,N=()=>_.name===l.current.question.name&&!E.includes(_.type_info.question_type)&&!m(),S=()=>"RANGE"!==_.type_info.question_type&&!_.required&&_.name===l.current.question.name&&!m(),I=()=>"DROPDOWN"===_.type_info.question_type&&_.name!==l.current.question.name&&!_.required&&null!=r[_.name],R=()=>m()&&(e||"standard"!==o)&&_.name===l.current.question.name;return t.createElement("div",{className:"question-footer"},!(!e&&"standard"===o||0===C&&!r[_.name]||"compact"===n)&&t.createElement(z,{currentBlockIndex:u,currentBlockIndexOfBlocksWithQns:c,blocksWithQns:a,blocks:s,setHorizontalScrollUnits:f,preventQuestionAnimation:w}),(N()||I()||S()||R())&&t.createElement("div",{className:"action-buttons"},N()&&t.createElement(g,{onClick:()=>{h(a[C],null,!0)},disabled:!r[l.current.question.name]||Array.isArray(r[l.current.question.name])&&0===r[l.current.question.name].length,className:"next-button"},"Next"),S()&&t.createElement("button",{className:"skip-button",onClick:()=>v(_)},"Skip"),I()&&t.createElement("button",{className:"skip-button",onClick:()=>{l.current=a[C],u.current=s.findIndex((e=>e.name===a[C].name)),v(_)}},"Clear selection"),R()&&t.createElement("div",{className:"submit"},t.createElement(g,{disabled:(l.current.question.required||l.current.question.type_info.pivot_question)&&void 0===r[l.current.question.name]||d,onClick:()=>{x(!0),b(r,(()=>{i?.type_info.meta?.skipThankYouPage&&(window.location.href=i?.type_info.meta?.redirectUrl),i?.type_info.meta?.skipThankYouPage||y(!0)}))}},d?"Submitting":"Submit Survey"))))},I=({survey:e,surveyStyle:a="standard",placeholders:s,onSubmit:i,widget:c,npsValue:u,widgetStyle:l,widgetNavigatorQuerySelector:d,preview:p,mobilePreview:m})=>{const{meta:{blocks:f},question_details:{questions:h}}=e,[v,x]=n.useState(null),[y,_]=n.useState({}),[N,I]=n.useState(!1),[R,B]=n.useState([]),[O,T]=n.useState(0),[L,$]=n.useState(!1),[F,A]=n.useState(null),Q=n.useRef(null),H=n.useRef(null),V=n.useRef(-1),j=n.useRef(null),U=n.useRef(0),P=n.useRef(0),Y=n.useRef(!1),W=n.useRef([]),G=t.useRef(!!u&&"card"===a),M=n.useRef(null),D=n.useRef([]);n.useEffect((()=>{f&&(M.current=f.find((e=>"TY"===e.name)),x(f.filter((e=>"TY"!==e.name))))}),[f]),n.useEffect((()=>{if(v)if(H.current=h.find((e=>e.pivot_question))??h.find((e=>"RANGE"===e.type_info.question_type))??h[0],null!=u){V.current=u;const e=h.find((e=>e.name===v[0].question_names[0]));Q.current={...v[0],question:e},W.current=[...W.current,{...v[0],question:e}],B(W.current),_({Q_1:u})}else if(!Q.current&&v.length>0)return Q.current=v[0],void Z(v[0])}),[v,u]),t.useEffect((()=>{R.length&&(W.current=R,P.current=R.length-1),c||"standard"!==a?(j.current&&(j.current.style.maxHeight="unset"),D.current[U.current]=j.current?.scrollHeight||D.current[U.current]||0,j.current&&(j.current.style.maxHeight="100%")):j.current?.scrollIntoView({block:"center",behavior:"smooth"}),T(R.length-1)}),[R]),n.useEffect((()=>{Object.keys(y).length>0&&Q.current.question&&(E.includes(Q.current.question.type_info.question_type)||Y.current)&&!X()&&J()}),[y]),n.useEffect((()=>{if(null!=y?.[H.current?.name])if(M.current?.is_based_on_score){const e=H.current?.type_info?.choices[y?.[H.current?.name]]?.dependent_question_names,n=M.current?.question_names.find((n=>e?.includes(n))),t=h.find((e=>e.name===n));A(t)}else{const e=h.find((e=>e.name==M.current?.question_names[0]));A(e)}}),[y?.[H.current?.name]]);const X=()=>U.current===v.length-1||"end"===Q.current.branchOption,Z=e=>{let n={};if(e.is_based_on_score){const t=H.current?.type_info?.choices[y?.[H.current?.name]]?.dependent_question_names,o=e.question_names.find((e=>t?.includes(e)));n=h.find((e=>e.name===o))}else n=h.find((n=>n.name===e.question_names[0]));Q.current.question=n;W.current.find((e=>e.question.name===n.name))?(T(O+1),P.current+=1):B([...W.current,{...e,question:n}])},J=()=>{if(X())I(!0);else{if(Q.current.nextBlock)U.current=v.findIndex((e=>e.name===Q.current.nextBlock));else if(Q.current.question.type_info?.meta?.branches){const e=Q.current.question.type_info?.meta?.branches,n=y[Q.current.question.name];let t;if(t="RANGE"===Q.current.question.type_info.question_type?e.find((e=>n>=e.min&&n<=e.max)):e.find((e=>n===e.value)),t?.nextBlock){if("TY"===t.nextBlock)return void I(!0);U.current=v.findIndex((e=>e.name===t.nextBlock))}else U.current+=1}else U.current+=1;Q.current=v[U.current],Z(v[U.current])}},K=e=>{Y.current=!0,delete y[e.name],_({...y})},ee=(e,n,t)=>{if(G.current=!1,t){if(Y.current=!0,null!=y[e.question.name]&&e.name!==R[R.length-1].name){const[t,o]=(e=>{const n=R.findIndex((n=>n.name===e.name)),t=R.slice(0,n+1),o=t.reduce(((e,n)=>(e[n.question.name]=y[n.question.name],e)),{});return U.current=v.findIndex((n=>n.name===e.name)),[t,o]})(e);_({...o,...null!=n&&{[e.question.name]:n}}),W.current=t}else _({...y,...null!=n&&{[e.question.name]:n}});H?.current?.name==e?.question?.name&&(V.current=n)}else _({...y,...null!=n&&{[e.question.name]:n}})};return Q.current&&Q.current.question?N?t.createElement("div",{className:`freemium-survey-components ${c?"widget-survey-components":""} ${l}-style ${m?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},t.createElement(C,{thankYouQuestion:F,preview:p,placeholders:s,npsValue:V.current})):t.createElement("div",{className:`freemium-survey-components ${c?"widget-survey-components":""} ${l}-style ${m?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},t.createElement(b,{totalSteps:v.length,completedSteps:U.current}),c&&"compact"===l&&document.querySelector(d)&&t.createElement(t.Fragment,null,o.createPortal(t.createElement(r,{autoFocus:!1,group:"active-focus-lock-1",disabled:!1},t.createElement(z,{currentBlockIndex:U,currentBlockIndexOfBlocksWithQns:P,blocksWithQns:R,blocks:v,setHorizontalScrollUnits:T})),document.querySelector(d))),t.createElement("div",{style:c||"card"===a?{transform:`translateX(calc(-${O} * 100%))`,height:`${D.current[U.current]}px`,transition:G.current||R?.length<=1?"none":`all ${q}ms ease-out 0ms`}:{},className:"questions"},R.map(((e,n)=>t.createElement(r,{key:e.question.name,ref:j,autoFocus:!1,disabled:n!==P.current||"standard"===a&&!c,group:"active-focus-lock-1",className:"question-container "+(!c&&"card"!==a||P.current===n?"":"hide-question-container")},t.createElement("div",{className:"question-text "+(0===n?"nps":""),dangerouslySetInnerHTML:{__html:k(e.question.text,s,V.current)},title:`question-${n}`,role:"heading","aria-level":1}),t.createElement(w,{question:e.question,formValues:y,autoFocusInput:P.current===n,onChangeHandler:n=>{Y.current=!1,U.current=v.findIndex((n=>n.name===e.name)),Q.current=e,ee(e,n,E.includes(e.question.type_info.question_type)&&!X())}}),"standard"===a||c?t.createElement(S,{question:e.question,blockIndex:n,widget:c,widgetStyle:l,surveyStyle:a,formValues:y,blocksWithQns:R,blocks:v,thankYouQuestion:F,currentBlockIndexOfBlocksWithQns:P,currentBlockIndexOfBlocks:U,currentEditingBlock:Q,isSubmitting:L,isValuesCommitted:Y,isCurrentBlockFinal:X,setHorizontalScrollUnits:T,handleFormValues:ee,skipBlock:K,setIsSubmitting:$,onSubmit:i,setIsSurveyCompleted:I,preventQuestionAnimation:G,preview:p}):t.createElement(t.Fragment,null,n===P.current&&o.createPortal(t.createElement(r,{group:"active-focus-lock-1",autoFocus:!1},t.createElement(S,{widget:c,widgetStyle:l,surveyStyle:a,formValues:y,blocksWithQns:R,blocks:v,thankYouQuestion:F,currentBlockIndexOfBlocksWithQns:P,currentBlockIndexOfBlocks:U,currentEditingBlock:Q,isSubmitting:L,isValuesCommitted:Y,isCurrentBlockFinal:X,setHorizontalScrollUnits:T,handleFormValues:ee,skipBlock:K,setIsSubmitting:$,onSubmit:i,setIsSurveyCompleted:I,preventQuestionAnimation:G})),document.getElementById("freemium-survey")??document.body))))),!c&&"card"!==a&&X()&&t.createElement("div",{className:"submit"},t.createElement(g,{disabled:Q.current.question.required&&void 0===y[Q.current.question.name]||L,onClick:()=>{$(!0),i(y,(()=>{p||F?.type_info.meta?.skipThankYouPage&&(window.location.href=F?.type_info.meta?.redirectUrl),F?.type_info.meta?.skipThankYouPage||I(!0)}))}},L?"Submitting Survey":"Submit Survey")))):null};exports.ACTIVE_FOCUS_LOCK_GROUP="active-focus-lock-1",exports.AUTO_REDIRECT_DELAY=1e4,exports.BUTTON_SIZE_VARIANTS={LARGE:"large",MINI:"mini",NORMAL:"normal"},exports.Button=g,exports.CheckboxGroup=f,exports.Input=d,exports.NPS=s,exports.ProgressBar=b,exports.Radio=x,exports.RadioGroup=v,exports.Survey=e=>{const{survey:o}=e,r=n.useMemo((()=>{const e=JSON.parse(JSON.stringify(o)),n=[],{question_details:{questions:t}}=e;return t.forEach((e=>{const t=e.type_info?.meta?.block;t&&(t.question_names||(t.question_names=[e.name]),n.push(t))})),{...e,meta:{...e.meta,blocks:n}}}),[o]);return t.createElement(I,Object.assign({},e,{survey:r}))},exports.TRANSITION_DELAY=q,exports.TextArea=p;
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),t=e(n),o=e(require("react-dom")),r=e(require("react-focus-lock"));function a(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}a(".freemium-survey-components .nps-container {\n margin: 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n grid-gap: 52px;\n gap: 52px;\n}\n.freemium-survey-components .nps-container .footer {\n border-top: 1px solid var(--default-background-color);\n border-top: 1px solid var(--background-color, var(--default-background-color));\n padding-top: 20px;\n margin-top: 20px;\n display: flex;\n justify-content: center;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #666;\n}\n.freemium-survey-components .nps-container .nps-scale {\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .button-container {\n display: flex;\n border-radius: 4px;\n justify-content: space-between;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .positive-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n right: 0px;\n text-align: right;\n}\n.freemium-survey-components .nps-container .nps-scale .negative-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n left: 0;\n text-align: left;\n}\n.freemium-survey-components .nps-container .nps-scale span {\n color: #aaa;\n font-size: 0.75rem;\n}\n.freemium-survey-components .nps-container .nps-scale button {\n display: inline-block;\n font-size: 1rem;\n white-space: nowrap;\n vertical-align: middle;\n background: none;\n border: none;\n box-shadow: none;\n cursor: pointer;\n text-align: center;\n font-weight: 400;\n border-radius: 4px;\n margin: 0;\n outline: none;\n margin-left: -1px;\n width: 40px;\n height: 40px;\n transform: scale(1);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover {\n transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover, .freemium-survey-components .nps-container .nps-scale button:focus {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale button.active {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale.rounded button {\n border-radius: 50%;\n}\n.freemium-survey-components .nps-container .nps-scale.square button {\n border-radius: 0;\n}\n.freemium-survey-components .nps-container .nps-scale.curved button {\n border-radius: 3px;\n}\n.freemium-survey-components .nps-container .nps-scale.highlighted button:hover, .freemium-survey-components .nps-container .nps-scale.highlighted button:focus, .freemium-survey-components .nps-container .nps-scale.highlighted button.active {\n background: var(--default-brand-color) !important;\n background: var(--brand-color, var(--default-brand-color)) !important;\n}\n.freemium-survey-components .nps-container .nps-scale .choices {\n width: 100%;\n display: flex;\n justify-content: space-between;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .button-container {\n background-color: transparent;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice {\n color: #000;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice.active,\n.freemium-survey-components .nps-container .nps-scale.standard .choice:focus,\n.freemium-survey-components .nps-container .nps-scale.standard .choice:hover {\n color: #fff;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1).active {\n background: #eb5b56;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2).active {\n background: #fb8774;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3).active {\n background: #f58f6b;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4).active {\n background: #f6996a;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5).active {\n background: #eab268;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6).active {\n background: #cebb69;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7).active {\n background: #bdc46c;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8).active {\n background: #a4cd72;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9).active {\n background: #77c955;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10).active {\n background: #37c248;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11).active {\n background: #1ebf31;\n}\n\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .nps-container .nps-scale .button-container,\n.card-survey-style .nps-container .nps-scale .button-container {\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale .choices,\n.card-survey-style .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale button,\n.card-survey-style .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n }\n}\n.widget-survey-components .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}");const s=e=>{const{type_info:{linear_scale:{button_style:o="highlighted",button_shape:r="rounded"}={},score_presets:{start:a="Very unlikely",end:s="Very likely"}={},validation:{min:i},footer_text:c}}=e,u=e=>{switch(e){case e<=6:return"detractor";case e<=8:return"passive";default:return"promoter"}},l=n.useRef(Array.from({length:10+(0===i?1:0)},((e,n)=>n+i)));return t.createElement("div",{className:"nps-container","data-test-input":"nps"},t.createElement("div",{className:`nps-scale ${r} ${o}`},t.createElement("div",{className:"button-container"},t.createElement("span",{className:"negative-text",role:"note"},`${i} - ${a}`),t.createElement("span",{className:"positive-text",role:"note"},`${l.current[l.current.length-1]} - ${s}`),t.createElement("div",{className:"choices",role:"radiogroup","aria-required":!0},l.current.map((n=>t.createElement("button",{role:"radio","aria-checked":e.npsValue===n,key:n,"data-test-nps-choice":n,onClick:t=>{e.onChangeHandler(n)},className:`choice ${u(n)} ${e.npsValue===n&&"active"}`},n)))))),t.createElement("div",{className:"footer",role:"note"},c))},i=(e,n)=>(e.defaultProps=n,e);a('.freemium-survey-components .input-container,\n.freemium-survey-components .textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n.freemium-survey-components label.input-label {\n display: inline-block;\n padding-bottom: 8px;\n padding-left: 2px;\n font-size: 0.75rem;\n font-weight: 400;\n}\n.freemium-survey-components label.required::after {\n content: "*";\n position: relative;\n top: 2px;\n font-weight: 500;\n font-size: 0.85rem;\n padding-left: 3px;\n color: #d72d30;\n}\n.freemium-survey-components .input-basic {\n width: 100%;\n display: flex;\n align-items: center;\n border-radius: 4px;\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n transition: border-color 0.2s linear;\n background: #fff;\n}\n.freemium-survey-components .textarea-container .input-basic {\n flex-direction: column;\n align-items: unset;\n}\n.freemium-survey-components .input-basic.error {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error:hover {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error[focus-within] {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic.error:focus-within {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: 0.2s linear;\n}\n.freemium-survey-components .input-basic[focus-within] {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .input-basic:focus-within {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .end-max-length {\n padding: 0 8px;\n font-size: 0.85rem;\n}\n.freemium-survey-components .textarea-container .end-max-length {\n padding: 8px;\n align-self: flex-end;\n}\n.freemium-survey-components span.input-error {\n display: block;\n padding-left: 2px;\n padding-top: 4px;\n font-size: 0.9rem;\n color: #d72d30;\n}\n.freemium-survey-components input[type=text] {\n padding: 6px 12px;\n flex: 1;\n border: unset;\n height: 32px;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components input[type=text],\n.freemium-survey-components textarea {\n outline: none;\n border: none;\n}\n.freemium-survey-components input[type=text]::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea {\n min-height: 116px;\n padding: 12px;\n flex: 1;\n border: unset;\n resize: none;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components textarea::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}');const c={isRequired:!1,showCount:!1,isErrored:!1,inline:!1,spellCheck:!1,autoFocusInput:!0},u=n.forwardRef(((e,o)=>{const r=n.useRef(null);n.useEffect((()=>{e.autoFocusInput&&setTimeout((()=>{r.current?.focus()}),q+350)}),[e.autoFocusInput]);const{inputStyle:a,style:s,className:i,showCount:c,isErrored:u,startLabel:l,isRequired:d,errorText:p,endLabel:m,maxLength:f,autoFocusInput:h,...v}=e;return t.createElement("div",{className:"input-container",style:s},e.label&&t.createElement("label",{className:"input-label "+(d?"required":"")},e.label),t.createElement("div",null,l&&t.createElement("div",{className:"start-label"},l),t.createElement("div",{className:`input-basic ${u?"error":""}${i||""}`},t.createElement("input",Object.assign({type:"text",autoComplete:"off",ref:r,style:a},v)),c&&f>0&&t.createElement("div",{className:"end-max-length"},`${e.value&&e.value.length||0}/${e.maxLength}`)),m&&t.createElement("div",{className:"end-label"},m)),u&&p&&t.createElement("span",{className:"input-error"},e.errorText))})),l=n.forwardRef(((e,o)=>{const r=n.useRef(null);n.useEffect((()=>{e.autoFocusInput&&setTimeout((()=>{r.current?.focus()}),q+350)}),[e.autoFocusInput]);const{inputStyle:a,style:s,className:i,showCount:c,maxLength:u,isErrored:l,startLabel:d,isRequired:p,autoFocusInput:m,...f}=e;return t.createElement(t.Fragment,null,t.createElement("div",{className:"textarea-container",style:s},e.label&&t.createElement("label",{className:"input-label "+(p?"required":"")},e.label),d&&t.createElement("div",{className:"start-label"},d),t.createElement("div",{className:`input-basic ${l?"error":""} ${i||""}`},t.createElement("textarea",Object.assign({autoComplete:"off",ref:r,style:a},f)),c&&u&&u>0&&t.createElement("div",{className:"end-max-length"},`${e.value&&e.value.length||0}/${e.maxLength}`)),e.endLabel&&t.createElement("div",{className:"end-label"},e.endLabel)),e.isErrored&&e.errorText&&t.createElement("span",{className:"input-error"},e.errorText))})),d=i(u,c),p=i(l,c);a('.freemium-survey-components .checkbox-group {\n width: 100%;\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n flex-direction: column;\n white-space: nowrap;\n flex-wrap: wrap;\n}\n.freemium-survey-components .icon-container {\n display: inline-block;\n flex: 0 0 12px;\n width: 12px;\n height: 12px;\n min-width: 12px;\n min-height: 12px;\n color: inherit;\n position: absolute;\n left: 1px;\n top: 2px;\n}\n.freemium-survey-components .tick-icon {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n color: inherit;\n fill: currentColor;\n}\n.freemium-survey-components input[type=checkbox] {\n position: absolute;\n clip: rect(0px 0px 0px 0px);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=checkbox]:focus ~ .checkbox {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 2px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 2px;\n border-color: transparent;\n}\n.freemium-survey-components .checkbox-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n opacity: 1;\n line-height: 1.2;\n cursor: pointer;\n font-size: 1rem;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components .checkbox-label:hover .checkbox {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components .checkbox-label.disabled {\n opacity: 0.5;\n cursor: "not-allowed";\n}\n.freemium-survey-components .checkbox {\n transition: background-color ease-in 0.2s;\n min-width: 14px;\n min-height: 14px;\n min-height: 14px;\n max-height: 14px;\n border-radius: 2px;\n position: relative;\n margin-right: 16px;\n background-color: #fff;\n border: 1px solid;\n text-align: left;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:disabled ~ .checkbox:hover {\n box-shadow: unset;\n border-color: unset;\n}');const m=()=>t.createElement("svg",{id:"tick",className:"tick-icon",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"title",viewBox:"0 0 10 10"},t.createElement("path",{d:"M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z",fill:"#fff",fillRule:"evenodd"})),f=({values:e=[],options:o,autoFocusGroup:r,onChangeHandler:a,othersOption:s,othersRequired:i})=>{const c=(()=>{let n=-1;return e.map(((e,t)=>{const r=o.find((n=>n.value===e));return r||(n=t),r})),n})(),[u,l]=n.useState(!1),p=n.useRef(null);return n.useEffect((()=>{r&&setTimeout((()=>{p.current?.focus()}),q+350)}),[r]),t.createElement("div",{className:"checkbox-group"},t.createElement("button",{ref:p,className:"autofocus-button","aria-hidden":!0}),o?.map(((n,o)=>t.createElement(h,{key:n.id,checked:e?.includes(n.value),name:n.value,id:n.id,onChange:(t,o)=>{if(o)a([...e||[],n.value]);else{const t=e.indexOf(n.value);t>-1&&e.splice(t,1),a([...e])}}},n.value))),s&&t.createElement(h,{key:"others",checked:u,name:"others",id:"others",onChange:(e,n)=>{l(n)}},"Others"),u&&t.createElement(t.Fragment,null,t.createElement(d,{placeholder:"Enter your comment",value:e[c],onChange:n=>{-1!==c?(e[c]=n.target.value,a(e)):a(e.concat(n.target.value))},label:""})))},h=i((e=>{const o=n.useRef(null);return n.useEffect((()=>{e.autoFocus&&setTimeout((()=>{o.current?.focus()}),q+20)}),[]),t.createElement("label",{className:`checkbox-label ${e.disabled&&"disabled"}`},t.createElement("input",{ref:o,id:e.id,type:"checkbox",name:e.name,readOnly:e.readOnly,disabled:e.disabled,"aria-disabled":e.disabled,checked:e.checked,onChange:e.readOnly?()=>{}:n=>e.onChange(n,n.target.checked)}),t.createElement("div",{className:"checkbox"},e.checked&&t.createElement("div",{className:"icon-container"},t.createElement(m,null)," ")),t.createElement("div",null,e.children))}),{checked:!1});a('.freemium-survey-components .radio-group {\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n white-space: nowrap;\n flex-direction: column;\n width: 100%;\n}\n.freemium-survey-components .radio {\n background-color: #fff;\n border: 1px solid;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: background-color ease-in 0.2s;\n min-width: 18px;\n max-width: 18px;\n min-height: 18px;\n max-height: 18px;\n border-radius: 50%;\n position: relative;\n margin-right: 16px;\n text-align: left;\n}\n.freemium-survey-components .radio:before {\n left: 3px;\n top: 3px;\n content: "";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transition: all ease-in 0.2s;\n background-color: #fff;\n}\n.freemium-survey-components .radio-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n cursor: pointer;\n line-height: 1.2;\n font-size: 1rem;\n font-weight: 400;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components input[type=radio] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=radio]:focus ~ .radio {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 3px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 3px;\n border-color: transparent;\n}\n.freemium-survey-components input[type=radio]:checked ~ .radio:before {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .radio-label:hover .radio {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}');const v=({name:e,options:o,value:r,autoFocusGroup:a,onChangeHandler:s,othersOption:i,othersRequired:c})=>{const[u,l]=n.useState(""),[p,m]=n.useState(""),f=n.useRef(null);return n.useEffect((()=>{a&&setTimeout((()=>{f.current?.focus()}),q+350)}),[a]),n.useEffect((()=>{r||(m(""),l(""))}),[r]),n.useEffect((()=>{p&&o.find((e=>e.value===p))&&s(p)}),[p]),t.createElement("div",{className:"radio-group",role:"radiogroup"},t.createElement("button",{ref:f,className:"autofocus-button","aria-hidden":!0,tabIndex:-1}),o?.map(((n,o)=>t.createElement(x,{key:n.value,value:n.value,name:e,onChange:e=>{m(e.currentTarget.value)},checked:p===n.value},n.value))),i&&t.createElement(x,{key:"others",value:"others",name:e,onChange:e=>{m("others")},checked:"others"===p},"Others"),"others"===p&&t.createElement(t.Fragment,null,t.createElement(d,{value:u,onChange:e=>l(e.target.value),placeholder:"Enter your comment",label:""}),u!==r&&t.createElement(g,{inline:!0,disabled:c&&0===u.length,onClick:()=>s(u)},"Next")))},x=i((e=>{const o=n.useRef(null);return n.useEffect((()=>{e.autoFocus&&setTimeout((()=>{o.current?.focus()}),q+20)}),[]),t.createElement("label",{className:"radio-label"},t.createElement("input",{ref:o,type:"radio",name:e.name,value:e.value,checked:e.checked,onChange:e.onChange}),t.createElement("div",{className:"radio"}),t.createElement("div",null,e.children))}),{checked:!1,autoFocus:!1});a(".progressbar-container {\n width: 100%;\n height: 4px;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n text-align: left;\n}\n\n.progressbar {\n transition: transform 0.25s linear;\n transform-origin: left;\n height: 100%;\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}");const b=e=>{const{totalSteps:n,completedSteps:o}=e;return t.createElement("div",{className:"progressbar-container"},t.createElement("div",{className:"progressbar",style:{width:(o>0?100/n:0)+"%",transform:`scaleX(${o})`}}))};a(".freemium-survey-components .action-button {\n width: auto;\n display: block;\n padding: 8px 16px;\n cursor: pointer;\n line-height: 1.5;\n text-align: center;\n font-weight: 500;\n letter-spacing: 0.3px;\n border-radius: 4px;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: --default-button-text-color;\n color: var(--button-text-color, --default-button-text-color);\n background: var(--default-brand-color);\n background: var(--brand-color, var(--default-brand-color));\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n border-radius: 4px;\n min-width: 200px;\n max-width: -webkit-fit-content;\n max-width: -moz-fit-content;\n max-width: fit-content;\n transform: translateY(0px);\n transition: transform ease 0.2s;\n}\n.freemium-survey-components .action-button:not([disabled]):hover {\n transform: translateY(-4px);\n}\n.freemium-survey-components .action-button[disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n}\n.freemium-survey-components button:focus:not(:active) {\n /* box-shadow: 0 0 0 2px ${pseudo.focus}; */\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .action-button {\n min-width: 120px;\n }\n}\n.widget-survey-components .action-button {\n min-width: 120px;\n}\n\n.freemium-survey-components.mobile-preview .action-button {\n min-width: 120px;\n}");const y=()=>t.createElement(t.Fragment,null,"..."),g=e=>{const{inline:n=!1,children:o,disabled:r,className:a="",htmlType:s,type:i="primary",onClick:c,size:u,overrideStyleClassName:l="",loading:d=!1,...p}=e;return t.createElement("button",Object.assign({style:n?{display:"inline-block"}:{},disabled:r,className:`action-button ${a} ${l}`,type:s,onClick:c},p),d?t.createElement(y,null):o)},w=({question:e,formValues:n,onChangeHandler:o,autoFocusInput:r})=>{switch(e.type_info.question_type){case"RANGE":return t.createElement(s,{type_info:e.type_info,onChangeHandler:o,npsValue:n[e.name]});case"CHECKBOX":case"MULTI_SELECT":return t.createElement(f,{autoFocusGroup:r,values:n[e.name],options:e.type_info.choices,onChangeHandler:o,othersOption:e.type_info.meta?.othersOption,othersRequired:e.type_info.meta?.othersRequired});case"RADIO":case"DROPDOWN":return t.createElement(v,{autoFocusGroup:r,name:e.name,onChangeHandler:o,options:e.type_info.choices,value:n[e.name],othersOption:e.type_info.meta?.othersOption,othersRequired:e.type_info.meta?.othersRequired});case"INPUT":case"TEXT":return e.type_info?.meta?.readOnly?t.createElement("div",{className:"message-container"},e.type_info?.meta?.value):t.createElement("div",{className:"responsive-text-field"},t.createElement(d,{autoFocusInput:r,label:"",maxLength:300,showCount:!0,isRequired:e.is_required,value:n[e.name]||"",placeholder:e.type_info?.meta?.placeholder??"",onChange:e=>o(e.target.value)}),t.createElement(p,{autoFocusInput:r,label:"",maxLength:300,showCount:!0,isRequired:e.is_required,placeholder:e.type_info?.meta?.placeholder??"",value:n[e.name]||"",onChange:e=>o(e.target.value)}));case"PARAGRAPH":return t.createElement(p,{autoFocusInput:r,label:"",isRequired:e.is_required,placeholder:e.type_info?.meta?.placeholder??"",value:n[e.name]||"",onChange:e=>o(e.target.value)});default:return console.error(`Question type ${e.type_info.question_type} not found`),null}},k=(e,n,t)=>{if(e){let o={"{{nps.score}}":t};n&&(o={...o,...n});const r=new RegExp(Object.keys(o).join("|"),"gi");e=e.replace(r,(function(e){return o[e.toLowerCase()]}))}return e};a(":root {\n --default-brand-color: #264966;\n --default-question-text-color: #000;\n --default-question-background-color: #fff;\n --default-background-color: #f8f8f8;\n --default-button-text-color: #fff;\n --default-secondary-button-text-color: #000;\n --default-input-placeholder-color: #92a2b1;\n --compact-widget-max-height: 560px;\n --default-widget-max-height: 400px;\n --cozy-widget-max-height: 380px;\n}\n\n.freemium-survey-step-navigation {\n padding: 0 2px;\n box-shadow: 0px 0px 6px #eee;\n}\n.freemium-survey-step-navigation .navigation-button {\n width: 38px;\n text-align: -webkit-center;\n height: 38px;\n background-color: #fff;\n border: none;\n cursor: pointer;\n border-radius: 0 3px 3px 0;\n}\n.freemium-survey-step-navigation .navigation-button:first-of-type {\n border-right: 1px solid #d9d9d9;\n border-radius: 3px 0 0 3px;\n}\n.freemium-survey-step-navigation .navigation-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.freemium-survey-step-navigation .navigation-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.freemium-survey-components .question-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n text-align: center;\n max-width: 700px;\n margin: 0 auto;\n background: var(--default-question-background-color);\n background: var(--question-background-color, var(--default-question-background-color));\n border-radius: 4px;\n transition: transform 500ms ease 0ms, opacity 200ms ease 0ms;\n box-shadow: 0px 12px 15px rgba(18, 52, 77, 0.03);\n margin-bottom: 28px;\n padding: 28px 28px 20px 28px;\n grid-gap: 28px;\n gap: 28px;\n position: relative;\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n transition: opacity 50ms ease-out;\n overflow: auto;\n}\n.freemium-survey-components .hide-question-container {\n opacity: 0;\n}\n.freemium-survey-components .question-text {\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.8;\n width: 100%;\n text-align: left;\n color: var(--default-question-text-color);\n color: var(--question-text-color, var(--default-question-text-color));\n}\n.freemium-survey-components .autofocus-button {\n border: none;\n width: 0;\n height: 0;\n opacity: 0;\n margin-top: -12px;\n margin-left: -12px;\n}\n@-webkit-keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.freemium-survey-components .question-footer {\n display: flex;\n justify-content: flex-end;\n grid-gap: 40px;\n gap: 40px;\n width: 100%;\n align-items: center;\n}\n.freemium-survey-components .question-footer:empty {\n display: none;\n}\n.freemium-survey-components .action-buttons {\n display: flex;\n grid-gap: 20px;\n gap: 20px;\n flex-direction: row-reverse;\n}\n.freemium-survey-components .action-buttons:empty {\n display: none;\n}\n.freemium-survey-components .skip-button {\n font-weight: 400;\n cursor: pointer;\n background: transparent;\n border: none;\n min-width: 40px;\n padding: 8px 16px;\n border-radius: 4px;\n color: var(--default-secondary-button-text-color);\n color: var(--secondary-button-text-color, var(--default-secondary-button-text-color));\n letter-spacing: 0.05rem;\n line-height: 1.5;\n border: 1px solid transparent;\n}\n.freemium-survey-components .skip-button:hover {\n background-color: #f3f3f3;\n}\n.freemium-survey-components .next-button {\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .submit {\n max-width: 700px;\n margin: 0 auto;\n text-align: left;\n background: transparent;\n box-shadow: none;\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .thankyou {\n display: flex;\n align-items: center;\n justify-content: center;\n grid-gap: 20px;\n gap: 20px;\n min-height: 180px;\n}\n.freemium-survey-components .thankyou .heading {\n font-weight: 600;\n font-size: 28px;\n}\n.freemium-survey-components .thankyou .text {\n white-space: pre-wrap;\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.6;\n color: #12344d;\n width: 75%;\n}\n.freemium-survey-components .thankyou .redirection-text {\n color: #929292;\n margin-bottom: 12px;\n font-weight: 300;\n}\n.freemium-survey-components .thankyou .link {\n width: 100%;\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: #666;\n font-weight: 500;\n text-decoration: underline;\n}\n.freemium-survey-components .responsive-text-field {\n width: 100%;\n}\n.freemium-survey-components .responsive-text-field .textarea-container {\n display: none;\n}\n.freemium-survey-components .message-container:empty {\n display: none;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-component .responsive-text-field .input-container,\n.card-survey-style .responsive-text-field .input-container {\n display: none;\n }\n .freemium-survey-component .responsive-text-field .textarea-container,\n.card-survey-style .responsive-text-field .textarea-container {\n display: flex;\n }\n}\ndiv.widget-survey-components.compact-style .freemium-survey-step-navigation {\n padding: 0 2px;\n margin-left: 4px;\n box-shadow: 0px 0px 6px #eee;\n margin-top: 4px;\n}\ndiv.widget-survey-components.compact-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.compact-style .nps-container .choices {\n grid-gap: 12px;\n gap: 12px;\n}\n\ndiv.widget-survey-components,\ndiv.card-survey-style {\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n flex-grow: 1;\n font-size: 0.875rem;\n overflow: hidden;\n}\ndiv.widget-survey-components .questions,\ndiv.card-survey-style .questions {\n min-width: 100%;\n max-width: 100%;\n display: flex;\n height: 100%;\n position: relative;\n max-height: 560px;\n max-height: var(--compact-widget-max-height);\n}\ndiv.widget-survey-components .question-text,\ndiv.card-survey-style .question-text {\n width: 100%;\n text-align: left;\n}\ndiv.widget-survey-components .focus-lock,\ndiv.card-survey-style .focus-lock {\n width: 100%;\n}\ndiv.widget-survey-components .question-container,\ndiv.card-survey-style .question-container {\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n min-width: 100%;\n max-width: 100%;\n margin-bottom: 0;\n padding: 16px 28px;\n grid-gap: 16px;\n gap: 16px;\n flex-grow: 1;\n}\ndiv.widget-survey-components .question-footer,\ndiv.card-survey-style .question-footer {\n margin: 0px auto;\n justify-content: space-between;\n bottom: 0;\n padding-bottom: 20px;\n}\ndiv.widget-survey-components .submit,\ndiv.card-survey-style .submit {\n padding-bottom: 0;\n margin: unset;\n}\ndiv.widget-survey-components .nps-container .footer,\ndiv.card-survey-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components .nps-container .widget .choices,\ndiv.card-survey-style .nps-container .widget .choices {\n grid-gap: 8px;\n gap: 8px;\n}\ndiv.widget-survey-components .radio-group,\ndiv.card-survey-style .radio-group {\n width: 100%;\n}\ndiv.widget-survey-components .checkbox-group,\ndiv.card-survey-style .checkbox-group {\n width: 100%;\n flex-wrap: nowrap;\n}\n\ndiv.widget-survey-components .question-container {\n box-shadow: none;\n border-radius: 0;\n}\ndiv.widget-survey-components .question-text {\n font-size: 0.875rem;\n}\ndiv.widget-survey-components .progressbar-container {\n position: absolute;\n}\ndiv.widget-survey-components .progressbar-container .progressbar {\n border-radius: 3px 0 0 0;\n}\ndiv.widget-survey-components .textarea-container .end-max-length {\n padding: 4px;\n}\ndiv.widget-survey-components .responsive-text-field .input-container {\n display: none;\n}\ndiv.widget-survey-components .responsive-text-field .textarea-container {\n display: flex;\n}\ndiv.widget-survey-components div.thankyou {\n min-height: unset;\n}\ndiv.widget-survey-components div.thankyou .text {\n width: 85%;\n}\ndiv.widget-survey-components div.thankyou svg {\n width: 140px;\n height: 120px;\n}\n\ndiv.widget-survey-components.default-style .freemium-survey-step-navigation {\n margin: 0;\n}\ndiv.widget-survey-components.default-style .questions {\n max-height: 400px;\n max-height: var(--default-widget-max-height);\n}\ndiv.widget-survey-components.default-style .question-container {\n padding: 12px 28px;\n}\ndiv.widget-survey-components.default-style .question-footer {\n justify-content: space-between;\n}\ndiv.widget-survey-components.default-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.default-style .nps-container .choices {\n flex-wrap: unset;\n grid-gap: 12px;\n gap: 12px;\n}\ndiv.widget-survey-components.default-style .action-button {\n line-height: 1.2;\n}\ndiv.widget-survey-components.default-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style textarea {\n min-height: 84px;\n}\ndiv.widget-survey-components.default-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.widget-survey-components.cozy-style .freemium-survey-step-navigation {\n margin: 0;\n}\n.widget-survey-components.cozy-style .questions {\n max-height: 380px;\n max-height: var(--cozy-widget-max-height);\n}\n.widget-survey-components.cozy-style .question-text {\n font-size: 1rem;\n}\n.widget-survey-components.cozy-style .question-text.nps {\n text-align: center;\n width: 60%;\n min-width: 600px;\n margin: auto;\n}\n.widget-survey-components.cozy-style .question-container {\n padding: 12px 28px;\n}\n.widget-survey-components.cozy-style .question-footer {\n justify-content: space-between;\n}\n.widget-survey-components.cozy-style .nps-container {\n grid-gap: 44px;\n gap: 44px;\n}\n.widget-survey-components.cozy-style .nps-container .widget {\n display: flex;\n justify-content: center;\n}\n.widget-survey-components.cozy-style .nps-container .button-container {\n width: 60%;\n min-width: 600px;\n margin: 0 auto;\n}\n.widget-survey-components.cozy-style .nps-container .button-container .choices {\n justify-content: space-around;\n}\n.widget-survey-components.cozy-style .nps-container .footer {\n padding-top: 8px;\n}\n.widget-survey-components.cozy-style .action-button {\n line-height: 1.2;\n}\n.widget-survey-components.cozy-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style textarea {\n min-height: 60px;\n}\n.widget-survey-components.cozy-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.freemium-survey-components.mobile-preview .thankyou .text {\n width: unset;\n}");const E=["RANGE","NPS","RADIO","DROPDOWN"],q=200,C=({thankYouQuestion:e,preview:o,placeholders:r,npsValue:a})=>(n.useEffect((()=>{o||e.type_info.meta?.redirectUrl&&setTimeout((()=>{window.location.href=e.type_info.meta?.redirectUrl}),1e4)}),[]),t.createElement("div",{className:"question-container thankyou"},t.createElement("div",{className:"heading"},"Thank you!"),t.createElement("div",{className:"text",dangerouslySetInnerHTML:{__html:k(e.text,r,a)}}),e.type_info.meta?.redirectUrl&&t.createElement("div",{style:{width:"100%"}},t.createElement("div",{className:"redirection-text"},"You will be redirected to the below URL automatically in 10 seconds.",t.createElement("br",null)),t.createElement("a",{className:"link",href:e.type_info.meta?.redirectUrl},e?.type_info.meta?.redirectUrl)))),_=()=>t.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M7.82585 6.15754C7.98999 6.32147 8.08232 6.54389 8.08252 6.77587L8.08252 7.2192C8.07983 7.45069 7.98788 7.6722 7.82585 7.83754L1.82919 13.8225C1.77496 13.8772 1.71044 13.9206 1.63936 13.9502C1.56827 13.9798 1.49203 13.9951 1.41502 13.9951C1.33801 13.9951 1.26177 13.9798 1.19068 13.9502C1.1196 13.9206 1.05508 13.8772 1.00085 13.8225L0.172521 12.9942C0.118197 12.941 0.0750381 12.8774 0.0455752 12.8073C0.0161124 12.7372 0.000937578 12.6619 0.000937585 12.5859C0.000937592 12.5098 0.0161125 12.4345 0.0455753 12.3644C0.0750381 12.2943 0.118197 12.2308 0.172521 12.1775L5.36419 6.99754L0.172522 1.81754C0.117847 1.76331 0.0744506 1.69879 0.0448352 1.62771C0.0152208 1.55662 -2.75162e-05 1.48038 -2.75094e-05 1.40337C-2.75027e-05 1.32636 0.0152208 1.25012 0.0448353 1.17904C0.0744507 1.10795 0.117847 1.04343 0.172522 0.989205L1.00086 0.172537C1.05508 0.117862 1.1196 0.0744661 1.19069 0.0448507C1.26177 0.0152353 1.33801 -1.20337e-05 1.41502 -1.2027e-05C1.49203 -1.20203e-05 1.56827 0.0152353 1.63936 0.0448507C1.71044 0.0744661 1.77496 0.117862 1.82919 0.172537L7.82585 6.15754Z",fill:"#6B6B6B"})),N=()=>t.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M0.256667 7.83755C0.0925257 7.67361 0.000204227 7.4512 0 7.21921V6.77588C0.00268801 6.5444 0.0946357 6.32289 0.256667 6.15755L6.25333 0.172549C6.30756 0.117874 6.37208 0.0744776 6.44316 0.0448625C6.51425 0.0152474 6.59049 0 6.6675 0C6.74451 0 6.82075 0.0152474 6.89184 0.0448625C6.96292 0.0744776 7.02744 0.117874 7.08167 0.172549L7.91 1.00088C7.96432 1.05411 8.00748 1.11764 8.03694 1.18776C8.06641 1.25787 8.08158 1.33316 8.08158 1.40922C8.08158 1.48527 8.06641 1.56056 8.03694 1.63067C8.00748 1.70079 7.96432 1.76432 7.91 1.81755L2.71833 6.99755L7.91 12.1775C7.96467 12.2318 8.00807 12.2963 8.03769 12.3674C8.0673 12.4385 8.08255 12.5147 8.08255 12.5917C8.08255 12.6687 8.0673 12.745 8.03769 12.8161C8.00807 12.8871 7.96467 12.9517 7.91 13.0059L7.08167 13.8225C7.02744 13.8772 6.96292 13.9206 6.89184 13.9502C6.82075 13.9799 6.74451 13.9951 6.6675 13.9951C6.59049 13.9951 6.51425 13.9799 6.44316 13.9502C6.37208 13.9206 6.30756 13.8772 6.25333 13.8225L0.256667 7.83755Z",fill:"#6B6B6B"})),z=({currentBlockIndex:e,currentBlockIndexOfBlocksWithQns:n,blocksWithQns:o,blocks:r,setHorizontalScrollUnits:a,preventQuestionAnimation:s})=>t.createElement("div",{className:"freemium-survey-step-navigation","data-navigation-element":"1"},t.createElement("button",{disabled:0==n.current,className:"navigation-button",onClick:()=>{n.current=Math.max(n.current-1,0),e.current=r.findIndex((e=>e.name===o[n.current].name)),s.current=!1,a(n.current)}},t.createElement(N,null)),t.createElement("button",{className:"navigation-button",disabled:n.current>=o.length-1,onClick:()=>{s.current=!1,n.current=Math.min(n.current+1,o.length-1),e.current=r.findIndex((e=>e.name===o[n.current].name)),a(n.current)}},t.createElement(_,null))),S=({widget:e,widgetStyle:n,surveyStyle:o,formValues:r,blocksWithQns:a,blocks:s,thankYouQuestion:i,currentBlockIndexOfBlocksWithQns:c,currentBlockIndexOfBlocks:u,currentEditingBlock:l,isSubmitting:d,isValuesCommitted:p,isCurrentBlockFinal:m,setHorizontalScrollUnits:f,handleFormValues:h,skipBlock:v,setIsSubmitting:x,onSubmit:b,setIsSurveyCompleted:y,preventQuestionAnimation:w,preview:k,...q})=>{const C=q.blockIndex??c.current,_=q.question??a[C].question,N=()=>_.name===l.current.question.name&&!E.includes(_.type_info.question_type)&&!m(),S=()=>"RANGE"!==_.type_info.question_type&&!_.required&&_.name===l.current.question.name&&!m(),I=()=>"DROPDOWN"===_.type_info.question_type&&_.name!==l.current.question.name&&!_.required&&null!=r[_.name],R=()=>m()&&(e||"standard"!==o)&&_.name===l.current.question.name;return t.createElement("div",{className:"question-footer"},!(!e&&"standard"===o||0===C&&!r[_.name]||"compact"===n)&&t.createElement(z,{currentBlockIndex:u,currentBlockIndexOfBlocksWithQns:c,blocksWithQns:a,blocks:s,setHorizontalScrollUnits:f,preventQuestionAnimation:w}),(N()||I()||S()||R())&&t.createElement("div",{className:"action-buttons"},N()&&t.createElement(g,{onClick:()=>{h(a[C],null,!0)},disabled:!r[l.current.question.name]||Array.isArray(r[l.current.question.name])&&0===r[l.current.question.name].length,className:"next-button"},"Next"),S()&&t.createElement("button",{className:"skip-button",onClick:()=>v(_)},"Skip"),I()&&t.createElement("button",{className:"skip-button",onClick:()=>{l.current=a[C],u.current=s.findIndex((e=>e.name===a[C].name)),v(_)}},"Clear selection"),R()&&t.createElement("div",{className:"submit"},t.createElement(g,{disabled:(l.current.question.required||l.current.question.type_info.pivot_question)&&void 0===r[l.current.question.name]||d,onClick:()=>{x(!0),b(r,(()=>{i?.type_info.meta?.skipThankYouPage&&(window.location.href=i?.type_info.meta?.redirectUrl),i?.type_info.meta?.skipThankYouPage||y(!0)}))}},d?"Submitting":"Submit Survey"))))},I=({survey:e,surveyStyle:a="standard",placeholders:s,onSubmit:i,widget:c,npsValue:u,widgetStyle:l,widgetNavigatorQuerySelector:d,preview:p,mobilePreview:m})=>{const{meta:{blocks:f},question_details:{questions:h}}=e,[v,x]=n.useState(null),[y,_]=n.useState({}),[N,I]=n.useState(!1),[R,B]=n.useState([]),[O,T]=n.useState(0),[L,$]=n.useState(!1),[F,A]=n.useState(null),Q=n.useRef(null),H=n.useRef(null),V=n.useRef(-1),j=n.useRef(null),U=n.useRef(0),P=n.useRef(0),Y=n.useRef(!1),W=n.useRef([]),G=t.useRef(!!u&&"card"===a),M=n.useRef(null),D=n.useRef([]);n.useEffect((()=>{f&&(M.current=f.find((e=>"TY"===e.name)),x(f.filter((e=>"TY"!==e.name))))}),[f]),n.useEffect((()=>{if(v)if(H.current=h.find((e=>e.pivot_question))??h.find((e=>"RANGE"===e.type_info.question_type))??h[0],null!=u){V.current=u;const e=h.find((e=>e.name===v[0].question_names[0]));Q.current={...v[0],question:e},W.current=[...W.current,{...v[0],question:e}],B(W.current),_({Q_1:u})}else if(!Q.current&&v.length>0)return Q.current=v[0],void Z(v[0])}),[v,u]),t.useEffect((()=>{R.length&&(W.current=R,P.current=R.length-1),c||"standard"!==a?(j.current&&(j.current.style.maxHeight="unset"),D.current[U.current]=j.current?.scrollHeight||D.current[U.current]||0,j.current&&(j.current.style.maxHeight="100%")):j.current?.scrollIntoView({block:"center",behavior:"smooth"}),T(R.length-1)}),[R]),n.useEffect((()=>{Object.keys(y).length>0&&Q.current.question&&(E.includes(Q.current.question.type_info.question_type)||Y.current)&&!X()&&J()}),[y]),n.useEffect((()=>{if(null!=y?.[H.current?.name])if(M.current?.is_based_on_score){const e=H.current?.type_info?.choices[y?.[H.current?.name]]?.dependent_question_names,n=M.current?.question_names.find((n=>e?.includes(n))),t=h.find((e=>e.name===n));A(t)}else{const e=h.find((e=>e.name==M.current?.question_names[0]));A(e)}}),[y?.[H.current?.name]]);const X=()=>U.current===v.length-1||"end"===Q.current.branchOption,Z=e=>{let n={};if(e.is_based_on_score){const t=H.current?.type_info?.choices[y?.[H.current?.name]]?.dependent_question_names,o=e.question_names.find((e=>t?.includes(e)));n=h.find((e=>e.name===o))}else n=h.find((n=>n.name===e.question_names[0]));Q.current.question=n;W.current.find((e=>e.question.name===n.name))?(T(O+1),P.current+=1):B([...W.current,{...e,question:n}])},J=()=>{if(X())I(!0);else{if(Q.current.nextBlock)U.current=v.findIndex((e=>e.name===Q.current.nextBlock));else if(Q.current.question.type_info?.meta?.branches){const e=Q.current.question.type_info?.meta?.branches,n=y[Q.current.question.name];let t;if(t="RANGE"===Q.current.question.type_info.question_type?e.find((e=>n>=e.min&&n<=e.max)):e.find((e=>n===e.value)),t?.nextBlock){if("TY"===t.nextBlock)return void I(!0);U.current=v.findIndex((e=>e.name===t.nextBlock))}else U.current+=1}else U.current+=1;Q.current=v[U.current],Z(v[U.current])}},K=e=>{Y.current=!0,delete y[e.name],_({...y})},ee=(e,n,t)=>{if(G.current=!1,t){if(Y.current=!0,null!=y[e.question.name]&&e.name!==R[R.length-1].name){const[t,o]=(e=>{const n=R.findIndex((n=>n.name===e.name)),t=R.slice(0,n+1),o=t.reduce(((e,n)=>(e[n.question.name]=y[n.question.name],e)),{});return U.current=v.findIndex((n=>n.name===e.name)),[t,o]})(e);_({...o,...null!=n&&{[e.question.name]:n}}),W.current=t}else _({...y,...null!=n&&{[e.question.name]:n}});H?.current?.name==e?.question?.name&&(V.current=n)}else _({...y,...null!=n&&{[e.question.name]:n}})};return Q.current&&Q.current.question?N?t.createElement("div",{className:`freemium-survey-components ${c?"widget-survey-components":""} ${l}-style ${m?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},t.createElement(C,{thankYouQuestion:F,preview:p,placeholders:s,npsValue:V.current})):t.createElement("div",{className:`freemium-survey-components ${c?"widget-survey-components":""} ${l}-style ${m?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},t.createElement(b,{totalSteps:v.length,completedSteps:U.current}),c&&"compact"===l&&document.querySelector(d)&&t.createElement(t.Fragment,null,o.createPortal(t.createElement(r,{autoFocus:!1,group:"active-focus-lock-1",disabled:!1},t.createElement(z,{currentBlockIndex:U,currentBlockIndexOfBlocksWithQns:P,blocksWithQns:R,blocks:v,setHorizontalScrollUnits:T,preventQuestionAnimation:G})),document.querySelector(d))),t.createElement("div",{style:c||"card"===a?{transform:`translateX(calc(-${O} * 100%))`,height:`${D.current[U.current]}px`,transition:G.current||R?.length<=1?"none":`all ${q}ms ease-out 0ms`}:{},className:"questions"},R.map(((e,n)=>t.createElement(r,{key:e.question.name,ref:j,autoFocus:!1,disabled:n!==P.current||"standard"===a&&!c,group:"active-focus-lock-1",className:"question-container "+(!c&&"card"!==a||P.current===n?"":"hide-question-container")},t.createElement("div",{className:"question-text "+(0===n?"nps":""),dangerouslySetInnerHTML:{__html:k(e.question.text,s,V.current)},title:`question-${n}`,role:"heading","aria-level":1}),t.createElement(w,{question:e.question,formValues:y,autoFocusInput:P.current===n,onChangeHandler:n=>{Y.current=!1,U.current=v.findIndex((n=>n.name===e.name)),Q.current=e,ee(e,n,E.includes(e.question.type_info.question_type)&&!X())}}),"standard"===a||c?t.createElement(S,{question:e.question,blockIndex:n,widget:c,widgetStyle:l,surveyStyle:a,formValues:y,blocksWithQns:R,blocks:v,thankYouQuestion:F,currentBlockIndexOfBlocksWithQns:P,currentBlockIndexOfBlocks:U,currentEditingBlock:Q,isSubmitting:L,isValuesCommitted:Y,isCurrentBlockFinal:X,setHorizontalScrollUnits:T,handleFormValues:ee,skipBlock:K,setIsSubmitting:$,onSubmit:i,setIsSurveyCompleted:I,preventQuestionAnimation:G,preview:p}):t.createElement(t.Fragment,null,n===P.current&&o.createPortal(t.createElement(r,{group:"active-focus-lock-1",autoFocus:!1},t.createElement(S,{widget:c,widgetStyle:l,surveyStyle:a,formValues:y,blocksWithQns:R,blocks:v,thankYouQuestion:F,currentBlockIndexOfBlocksWithQns:P,currentBlockIndexOfBlocks:U,currentEditingBlock:Q,isSubmitting:L,isValuesCommitted:Y,isCurrentBlockFinal:X,setHorizontalScrollUnits:T,handleFormValues:ee,skipBlock:K,setIsSubmitting:$,onSubmit:i,setIsSurveyCompleted:I,preventQuestionAnimation:G})),document.getElementById("freemium-survey")??document.body))))),!c&&"card"!==a&&X()&&t.createElement("div",{className:"submit"},t.createElement(g,{disabled:Q.current.question.required&&void 0===y[Q.current.question.name]||L,onClick:()=>{$(!0),i(y,(()=>{p||F?.type_info.meta?.skipThankYouPage&&(window.location.href=F?.type_info.meta?.redirectUrl),F?.type_info.meta?.skipThankYouPage||I(!0)}))}},L?"Submitting Survey":"Submit Survey")))):null};exports.ACTIVE_FOCUS_LOCK_GROUP="active-focus-lock-1",exports.AUTO_REDIRECT_DELAY=1e4,exports.BUTTON_SIZE_VARIANTS={LARGE:"large",MINI:"mini",NORMAL:"normal"},exports.Button=g,exports.CheckboxGroup=f,exports.Input=d,exports.NPS=s,exports.ProgressBar=b,exports.Radio=x,exports.RadioGroup=v,exports.Survey=e=>{const{survey:o}=e,r=n.useMemo((()=>{const e=JSON.parse(JSON.stringify(o)),n=[],{question_details:{questions:t}}=e;return t.forEach((e=>{const t=e.type_info?.meta?.block;t&&(t.question_names||(t.question_names=[e.name]),n.push(t))})),{...e,meta:{...e.meta,blocks:n}}}),[o]);return t.createElement(I,Object.assign({},e,{survey:r}))},exports.TRANSITION_DELAY=q,exports.TextArea=p;
|
package/lib/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useRef as n,forwardRef as t,useEffect as o,useState as r,useMemo as a}from"react";import i from"react-dom";import s from"react-focus-lock";function c(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}c(".freemium-survey-components .nps-container {\n margin: 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n grid-gap: 52px;\n gap: 52px;\n}\n.freemium-survey-components .nps-container .footer {\n border-top: 1px solid var(--default-background-color);\n border-top: 1px solid var(--background-color, var(--default-background-color));\n padding-top: 20px;\n margin-top: 20px;\n display: flex;\n justify-content: center;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #666;\n}\n.freemium-survey-components .nps-container .nps-scale {\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .button-container {\n display: flex;\n border-radius: 4px;\n justify-content: space-between;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .positive-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n right: 0px;\n text-align: right;\n}\n.freemium-survey-components .nps-container .nps-scale .negative-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n left: 0;\n text-align: left;\n}\n.freemium-survey-components .nps-container .nps-scale span {\n color: #aaa;\n font-size: 0.75rem;\n}\n.freemium-survey-components .nps-container .nps-scale button {\n display: inline-block;\n font-size: 1rem;\n white-space: nowrap;\n vertical-align: middle;\n background: none;\n border: none;\n box-shadow: none;\n cursor: pointer;\n text-align: center;\n font-weight: 400;\n border-radius: 4px;\n margin: 0;\n outline: none;\n margin-left: -1px;\n width: 40px;\n height: 40px;\n transform: scale(1);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover {\n transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover, .freemium-survey-components .nps-container .nps-scale button:focus {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale button.active {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale.rounded button {\n border-radius: 50%;\n}\n.freemium-survey-components .nps-container .nps-scale.square button {\n border-radius: 0;\n}\n.freemium-survey-components .nps-container .nps-scale.curved button {\n border-radius: 3px;\n}\n.freemium-survey-components .nps-container .nps-scale.highlighted button:hover, .freemium-survey-components .nps-container .nps-scale.highlighted button:focus, .freemium-survey-components .nps-container .nps-scale.highlighted button.active {\n background: var(--default-brand-color) !important;\n background: var(--brand-color, var(--default-brand-color)) !important;\n}\n.freemium-survey-components .nps-container .nps-scale .choices {\n width: 100%;\n display: flex;\n justify-content: space-between;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .button-container {\n background-color: transparent;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice {\n color: #000;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice.active,\n.freemium-survey-components .nps-container .nps-scale.standard .choice:focus,\n.freemium-survey-components .nps-container .nps-scale.standard .choice:hover {\n color: #fff;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1).active {\n background: #eb5b56;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2).active {\n background: #fb8774;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3).active {\n background: #f58f6b;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4).active {\n background: #f6996a;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5).active {\n background: #eab268;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6).active {\n background: #cebb69;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7).active {\n background: #bdc46c;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8).active {\n background: #a4cd72;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9).active {\n background: #77c955;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10).active {\n background: #37c248;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11).active {\n background: #1ebf31;\n}\n\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .nps-container .nps-scale .button-container,\n.card-survey-style .nps-container .nps-scale .button-container {\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale .choices,\n.card-survey-style .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale button,\n.card-survey-style .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n }\n}\n.widget-survey-components .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}");const l=t=>{const{type_info:{linear_scale:{button_style:o="highlighted",button_shape:r="rounded"}={},score_presets:{start:a="Very unlikely",end:i="Very likely"}={},validation:{min:s},footer_text:c}}=t,l=e=>{switch(e){case e<=6:return"detractor";case e<=8:return"passive";default:return"promoter"}},u=n(Array.from({length:10+(0===s?1:0)},((e,n)=>n+s)));return e.createElement("div",{className:"nps-container","data-test-input":"nps"},e.createElement("div",{className:`nps-scale ${r} ${o}`},e.createElement("div",{className:"button-container"},e.createElement("span",{className:"negative-text",role:"note"},`${s} - ${a}`),e.createElement("span",{className:"positive-text",role:"note"},`${u.current[u.current.length-1]} - ${i}`),e.createElement("div",{className:"choices",role:"radiogroup","aria-required":!0},u.current.map((n=>e.createElement("button",{role:"radio","aria-checked":t.npsValue===n,key:n,"data-test-nps-choice":n,onClick:e=>{t.onChangeHandler(n)},className:`choice ${l(n)} ${t.npsValue===n&&"active"}`},n)))))),e.createElement("div",{className:"footer",role:"note"},c))},u=(e,n)=>(e.defaultProps=n,e);c('.freemium-survey-components .input-container,\n.freemium-survey-components .textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n.freemium-survey-components label.input-label {\n display: inline-block;\n padding-bottom: 8px;\n padding-left: 2px;\n font-size: 0.75rem;\n font-weight: 400;\n}\n.freemium-survey-components label.required::after {\n content: "*";\n position: relative;\n top: 2px;\n font-weight: 500;\n font-size: 0.85rem;\n padding-left: 3px;\n color: #d72d30;\n}\n.freemium-survey-components .input-basic {\n width: 100%;\n display: flex;\n align-items: center;\n border-radius: 4px;\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n transition: border-color 0.2s linear;\n background: #fff;\n}\n.freemium-survey-components .textarea-container .input-basic {\n flex-direction: column;\n align-items: unset;\n}\n.freemium-survey-components .input-basic.error {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error:hover {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error[focus-within] {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic.error:focus-within {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: 0.2s linear;\n}\n.freemium-survey-components .input-basic[focus-within] {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .input-basic:focus-within {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .end-max-length {\n padding: 0 8px;\n font-size: 0.85rem;\n}\n.freemium-survey-components .textarea-container .end-max-length {\n padding: 8px;\n align-self: flex-end;\n}\n.freemium-survey-components span.input-error {\n display: block;\n padding-left: 2px;\n padding-top: 4px;\n font-size: 0.9rem;\n color: #d72d30;\n}\n.freemium-survey-components input[type=text] {\n padding: 6px 12px;\n flex: 1;\n border: unset;\n height: 32px;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components input[type=text],\n.freemium-survey-components textarea {\n outline: none;\n border: none;\n}\n.freemium-survey-components input[type=text]::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea {\n min-height: 116px;\n padding: 12px;\n flex: 1;\n border: unset;\n resize: none;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components textarea::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}');const d={isRequired:!1,showCount:!1,isErrored:!1,inline:!1,spellCheck:!1,autoFocusInput:!0},p=t(((t,r)=>{const a=n(null);o((()=>{t.autoFocusInput&&setTimeout((()=>{a.current?.focus()}),z+350)}),[t.autoFocusInput]);const{inputStyle:i,style:s,className:c,showCount:l,isErrored:u,startLabel:d,isRequired:p,errorText:m,endLabel:f,maxLength:h,autoFocusInput:v,...x}=t;return e.createElement("div",{className:"input-container",style:s},t.label&&e.createElement("label",{className:"input-label "+(p?"required":"")},t.label),e.createElement("div",null,d&&e.createElement("div",{className:"start-label"},d),e.createElement("div",{className:`input-basic ${u?"error":""}${c||""}`},e.createElement("input",Object.assign({type:"text",autoComplete:"off",ref:a,style:i},x)),l&&h>0&&e.createElement("div",{className:"end-max-length"},`${t.value&&t.value.length||0}/${t.maxLength}`)),f&&e.createElement("div",{className:"end-label"},f)),u&&m&&e.createElement("span",{className:"input-error"},t.errorText))})),m=t(((t,r)=>{const a=n(null);o((()=>{t.autoFocusInput&&setTimeout((()=>{a.current?.focus()}),z+350)}),[t.autoFocusInput]);const{inputStyle:i,style:s,className:c,showCount:l,maxLength:u,isErrored:d,startLabel:p,isRequired:m,autoFocusInput:f,...h}=t;return e.createElement(e.Fragment,null,e.createElement("div",{className:"textarea-container",style:s},t.label&&e.createElement("label",{className:"input-label "+(m?"required":"")},t.label),p&&e.createElement("div",{className:"start-label"},p),e.createElement("div",{className:`input-basic ${d?"error":""} ${c||""}`},e.createElement("textarea",Object.assign({autoComplete:"off",ref:a,style:i},h)),l&&u&&u>0&&e.createElement("div",{className:"end-max-length"},`${t.value&&t.value.length||0}/${t.maxLength}`)),t.endLabel&&e.createElement("div",{className:"end-label"},t.endLabel)),t.isErrored&&t.errorText&&e.createElement("span",{className:"input-error"},t.errorText))})),f=u(p,d),h=u(m,d);c('.freemium-survey-components .checkbox-group {\n width: 100%;\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n flex-direction: column;\n white-space: nowrap;\n flex-wrap: wrap;\n}\n.freemium-survey-components .icon-container {\n display: inline-block;\n flex: 0 0 12px;\n width: 12px;\n height: 12px;\n min-width: 12px;\n min-height: 12px;\n color: inherit;\n position: absolute;\n left: 1px;\n top: 2px;\n}\n.freemium-survey-components .tick-icon {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n color: inherit;\n fill: currentColor;\n}\n.freemium-survey-components input[type=checkbox] {\n position: absolute;\n clip: rect(0px 0px 0px 0px);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=checkbox]:focus ~ .checkbox {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 2px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 2px;\n border-color: transparent;\n}\n.freemium-survey-components .checkbox-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n opacity: 1;\n line-height: 1.2;\n cursor: pointer;\n font-size: 1rem;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components .checkbox-label:hover .checkbox {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components .checkbox-label.disabled {\n opacity: 0.5;\n cursor: "not-allowed";\n}\n.freemium-survey-components .checkbox {\n transition: background-color ease-in 0.2s;\n min-width: 14px;\n min-height: 14px;\n min-height: 14px;\n max-height: 14px;\n border-radius: 2px;\n position: relative;\n margin-right: 16px;\n background-color: #fff;\n border: 1px solid;\n text-align: left;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:disabled ~ .checkbox:hover {\n box-shadow: unset;\n border-color: unset;\n}');const v=()=>e.createElement("svg",{id:"tick",className:"tick-icon",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"title",viewBox:"0 0 10 10"},e.createElement("path",{d:"M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z",fill:"#fff",fillRule:"evenodd"})),x=({values:t=[],options:a,autoFocusGroup:i,onChangeHandler:s,othersOption:c,othersRequired:l})=>{const u=(()=>{let e=-1;return t.map(((n,t)=>{const o=a.find((e=>e.value===n));return o||(e=t),o})),e})(),[d,p]=r(!1),m=n(null);return o((()=>{i&&setTimeout((()=>{m.current?.focus()}),z+350)}),[i]),e.createElement("div",{className:"checkbox-group"},e.createElement("button",{ref:m,className:"autofocus-button","aria-hidden":!0}),a?.map(((n,o)=>e.createElement(b,{key:n.id,checked:t?.includes(n.value),name:n.value,id:n.id,onChange:(e,o)=>{if(o)s([...t||[],n.value]);else{const e=t.indexOf(n.value);e>-1&&t.splice(e,1),s([...t])}}},n.value))),c&&e.createElement(b,{key:"others",checked:d,name:"others",id:"others",onChange:(e,n)=>{p(n)}},"Others"),d&&e.createElement(e.Fragment,null,e.createElement(f,{placeholder:"Enter your comment",value:t[u],onChange:e=>{-1!==u?(t[u]=e.target.value,s(t)):s(t.concat(e.target.value))},label:""})))},b=u((t=>{const r=n(null);return o((()=>{t.autoFocus&&setTimeout((()=>{r.current?.focus()}),z+20)}),[]),e.createElement("label",{className:`checkbox-label ${t.disabled&&"disabled"}`},e.createElement("input",{ref:r,id:t.id,type:"checkbox",name:t.name,readOnly:t.readOnly,disabled:t.disabled,"aria-disabled":t.disabled,checked:t.checked,onChange:t.readOnly?()=>{}:e=>t.onChange(e,e.target.checked)}),e.createElement("div",{className:"checkbox"},t.checked&&e.createElement("div",{className:"icon-container"},e.createElement(v,null)," ")),e.createElement("div",null,t.children))}),{checked:!1});c('.freemium-survey-components .radio-group {\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n white-space: nowrap;\n flex-direction: column;\n width: 100%;\n}\n.freemium-survey-components .radio {\n background-color: #fff;\n border: 1px solid;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: background-color ease-in 0.2s;\n min-width: 18px;\n max-width: 18px;\n min-height: 18px;\n max-height: 18px;\n border-radius: 50%;\n position: relative;\n margin-right: 16px;\n text-align: left;\n}\n.freemium-survey-components .radio:before {\n left: 3px;\n top: 3px;\n content: "";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transition: all ease-in 0.2s;\n background-color: #fff;\n}\n.freemium-survey-components .radio-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n cursor: pointer;\n line-height: 1.2;\n font-size: 1rem;\n font-weight: 400;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components input[type=radio] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=radio]:focus ~ .radio {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 3px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 3px;\n border-color: transparent;\n}\n.freemium-survey-components input[type=radio]:checked ~ .radio:before {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .radio-label:hover .radio {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}');const y=({name:t,options:a,value:i,autoFocusGroup:s,onChangeHandler:c,othersOption:l,othersRequired:u})=>{const[d,p]=r(""),[m,h]=r(""),v=n(null);return o((()=>{s&&setTimeout((()=>{v.current?.focus()}),z+350)}),[s]),o((()=>{i||(h(""),p(""))}),[i]),o((()=>{m&&a.find((e=>e.value===m))&&c(m)}),[m]),e.createElement("div",{className:"radio-group",role:"radiogroup"},e.createElement("button",{ref:v,className:"autofocus-button","aria-hidden":!0,tabIndex:-1}),a?.map(((n,o)=>e.createElement(g,{key:n.value,value:n.value,name:t,onChange:e=>{h(e.currentTarget.value)},checked:m===n.value},n.value))),l&&e.createElement(g,{key:"others",value:"others",name:t,onChange:e=>{h("others")},checked:"others"===m},"Others"),"others"===m&&e.createElement(e.Fragment,null,e.createElement(f,{value:d,onChange:e=>p(e.target.value),placeholder:"Enter your comment",label:""}),d!==i&&e.createElement(q,{inline:!0,disabled:u&&0===d.length,onClick:()=>c(d)},"Next")))},g=u((t=>{const r=n(null);return o((()=>{t.autoFocus&&setTimeout((()=>{r.current?.focus()}),z+20)}),[]),e.createElement("label",{className:"radio-label"},e.createElement("input",{ref:r,type:"radio",name:t.name,value:t.value,checked:t.checked,onChange:t.onChange}),e.createElement("div",{className:"radio"}),e.createElement("div",null,t.children))}),{checked:!1,autoFocus:!1});c(".progressbar-container {\n width: 100%;\n height: 4px;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n text-align: left;\n}\n\n.progressbar {\n transition: transform 0.25s linear;\n transform-origin: left;\n height: 100%;\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}");const w=n=>{const{totalSteps:t,completedSteps:o}=n;return e.createElement("div",{className:"progressbar-container"},e.createElement("div",{className:"progressbar",style:{width:(o>0?100/t:0)+"%",transform:`scaleX(${o})`}}))};c(".freemium-survey-components .action-button {\n width: auto;\n display: block;\n padding: 8px 16px;\n cursor: pointer;\n line-height: 1.5;\n text-align: center;\n font-weight: 500;\n letter-spacing: 0.3px;\n border-radius: 4px;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: --default-button-text-color;\n color: var(--button-text-color, --default-button-text-color);\n background: var(--default-brand-color);\n background: var(--brand-color, var(--default-brand-color));\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n border-radius: 4px;\n min-width: 200px;\n max-width: -webkit-fit-content;\n max-width: -moz-fit-content;\n max-width: fit-content;\n transform: translateY(0px);\n transition: transform ease 0.2s;\n}\n.freemium-survey-components .action-button:not([disabled]):hover {\n transform: translateY(-4px);\n}\n.freemium-survey-components .action-button[disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n}\n.freemium-survey-components button:focus:not(:active) {\n /* box-shadow: 0 0 0 2px ${pseudo.focus}; */\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .action-button {\n min-width: 120px;\n }\n}\n.widget-survey-components .action-button {\n min-width: 120px;\n}\n\n.freemium-survey-components.mobile-preview .action-button {\n min-width: 120px;\n}");const k=()=>e.createElement(e.Fragment,null,"..."),E={LARGE:"large",MINI:"mini",NORMAL:"normal"},q=n=>{const{inline:t=!1,children:o,disabled:r,className:a="",htmlType:i,type:s="primary",onClick:c,size:l,overrideStyleClassName:u="",loading:d=!1,...p}=n;return e.createElement("button",Object.assign({style:t?{display:"inline-block"}:{},disabled:r,className:`action-button ${a} ${u}`,type:i,onClick:c},p),d?e.createElement(k,null):o)},C=({question:n,formValues:t,onChangeHandler:o,autoFocusInput:r})=>{switch(n.type_info.question_type){case"RANGE":return e.createElement(l,{type_info:n.type_info,onChangeHandler:o,npsValue:t[n.name]});case"CHECKBOX":case"MULTI_SELECT":return e.createElement(x,{autoFocusGroup:r,values:t[n.name],options:n.type_info.choices,onChangeHandler:o,othersOption:n.type_info.meta?.othersOption,othersRequired:n.type_info.meta?.othersRequired});case"RADIO":case"DROPDOWN":return e.createElement(y,{autoFocusGroup:r,name:n.name,onChangeHandler:o,options:n.type_info.choices,value:t[n.name],othersOption:n.type_info.meta?.othersOption,othersRequired:n.type_info.meta?.othersRequired});case"INPUT":case"TEXT":return n.type_info?.meta?.readOnly?e.createElement("div",{className:"message-container"},n.type_info?.meta?.value):e.createElement("div",{className:"responsive-text-field"},e.createElement(f,{autoFocusInput:r,label:"",maxLength:300,showCount:!0,isRequired:n.is_required,value:t[n.name]||"",placeholder:n.type_info?.meta?.placeholder??"",onChange:e=>o(e.target.value)}),e.createElement(h,{autoFocusInput:r,label:"",maxLength:300,showCount:!0,isRequired:n.is_required,placeholder:n.type_info?.meta?.placeholder??"",value:t[n.name]||"",onChange:e=>o(e.target.value)}));case"PARAGRAPH":return e.createElement(h,{autoFocusInput:r,label:"",isRequired:n.is_required,placeholder:n.type_info?.meta?.placeholder??"",value:t[n.name]||"",onChange:e=>o(e.target.value)});default:return console.error(`Question type ${n.type_info.question_type} not found`),null}},_=(e,n,t)=>{if(e){let o={"{{nps.score}}":t};n&&(o={...o,...n});const r=new RegExp(Object.keys(o).join("|"),"gi");e=e.replace(r,(function(e){return o[e.toLowerCase()]}))}return e};c(":root {\n --default-brand-color: #264966;\n --default-question-text-color: #000;\n --default-question-background-color: #fff;\n --default-background-color: #f8f8f8;\n --default-button-text-color: #fff;\n --default-secondary-button-text-color: #000;\n --default-input-placeholder-color: #92a2b1;\n --compact-widget-max-height: 560px;\n --default-widget-max-height: 400px;\n --cozy-widget-max-height: 380px;\n}\n\n.freemium-survey-step-navigation {\n padding: 0 2px;\n box-shadow: 0px 0px 6px #eee;\n}\n.freemium-survey-step-navigation .navigation-button {\n width: 38px;\n text-align: -webkit-center;\n height: 38px;\n background-color: #fff;\n border: none;\n cursor: pointer;\n border-radius: 0 3px 3px 0;\n}\n.freemium-survey-step-navigation .navigation-button:first-of-type {\n border-right: 1px solid #d9d9d9;\n border-radius: 3px 0 0 3px;\n}\n.freemium-survey-step-navigation .navigation-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.freemium-survey-step-navigation .navigation-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.freemium-survey-components .question-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n text-align: center;\n max-width: 700px;\n margin: 0 auto;\n background: var(--default-question-background-color);\n background: var(--question-background-color, var(--default-question-background-color));\n border-radius: 4px;\n transition: transform 500ms ease 0ms, opacity 200ms ease 0ms;\n box-shadow: 0px 12px 15px rgba(18, 52, 77, 0.03);\n margin-bottom: 28px;\n padding: 28px 28px 20px 28px;\n grid-gap: 28px;\n gap: 28px;\n position: relative;\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n transition: opacity 50ms ease-out;\n overflow: auto;\n}\n.freemium-survey-components .hide-question-container {\n opacity: 0;\n}\n.freemium-survey-components .question-text {\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.8;\n width: 100%;\n text-align: left;\n color: var(--default-question-text-color);\n color: var(--question-text-color, var(--default-question-text-color));\n}\n.freemium-survey-components .autofocus-button {\n border: none;\n width: 0;\n height: 0;\n opacity: 0;\n margin-top: -12px;\n margin-left: -12px;\n}\n@-webkit-keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.freemium-survey-components .question-footer {\n display: flex;\n justify-content: flex-end;\n grid-gap: 40px;\n gap: 40px;\n width: 100%;\n align-items: center;\n}\n.freemium-survey-components .question-footer:empty {\n display: none;\n}\n.freemium-survey-components .action-buttons {\n display: flex;\n grid-gap: 20px;\n gap: 20px;\n flex-direction: row-reverse;\n}\n.freemium-survey-components .action-buttons:empty {\n display: none;\n}\n.freemium-survey-components .skip-button {\n font-weight: 400;\n cursor: pointer;\n background: transparent;\n border: none;\n min-width: 40px;\n padding: 8px 16px;\n border-radius: 4px;\n color: var(--default-secondary-button-text-color);\n color: var(--secondary-button-text-color, var(--default-secondary-button-text-color));\n letter-spacing: 0.05rem;\n line-height: 1.5;\n border: 1px solid transparent;\n}\n.freemium-survey-components .skip-button:hover {\n background-color: #f3f3f3;\n}\n.freemium-survey-components .next-button {\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .submit {\n max-width: 700px;\n margin: 0 auto;\n text-align: left;\n background: transparent;\n box-shadow: none;\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .thankyou {\n display: flex;\n align-items: center;\n justify-content: center;\n grid-gap: 20px;\n gap: 20px;\n min-height: 180px;\n}\n.freemium-survey-components .thankyou .heading {\n font-weight: 600;\n font-size: 28px;\n}\n.freemium-survey-components .thankyou .text {\n white-space: pre-wrap;\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.6;\n color: #12344d;\n width: 75%;\n}\n.freemium-survey-components .thankyou .redirection-text {\n color: #929292;\n margin-bottom: 12px;\n font-weight: 300;\n}\n.freemium-survey-components .thankyou .link {\n width: 100%;\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: #666;\n font-weight: 500;\n text-decoration: underline;\n}\n.freemium-survey-components .responsive-text-field {\n width: 100%;\n}\n.freemium-survey-components .responsive-text-field .textarea-container {\n display: none;\n}\n.freemium-survey-components .message-container:empty {\n display: none;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-component .responsive-text-field .input-container,\n.card-survey-style .responsive-text-field .input-container {\n display: none;\n }\n .freemium-survey-component .responsive-text-field .textarea-container,\n.card-survey-style .responsive-text-field .textarea-container {\n display: flex;\n }\n}\ndiv.widget-survey-components,\ndiv.card-survey-style {\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n flex-grow: 1;\n font-size: 0.875rem;\n overflow: hidden;\n}\ndiv.widget-survey-components .questions,\ndiv.card-survey-style .questions {\n min-width: 100%;\n max-width: 100%;\n display: flex;\n height: 100%;\n position: relative;\n max-height: 560px;\n max-height: var(--compact-widget-max-height);\n}\ndiv.widget-survey-components .question-text,\ndiv.card-survey-style .question-text {\n width: 100%;\n text-align: left;\n}\ndiv.widget-survey-components .focus-lock,\ndiv.card-survey-style .focus-lock {\n width: 100%;\n}\ndiv.widget-survey-components .question-container,\ndiv.card-survey-style .question-container {\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n min-width: 100%;\n max-width: 100%;\n margin-bottom: 0;\n padding: 16px 28px;\n grid-gap: 16px;\n gap: 16px;\n flex-grow: 1;\n}\ndiv.widget-survey-components .question-footer,\ndiv.card-survey-style .question-footer {\n margin: 0px auto;\n justify-content: space-between;\n position: -webkit-sticky;\n position: sticky;\n bottom: 0;\n padding-bottom: 20px;\n}\ndiv.widget-survey-components .submit,\ndiv.card-survey-style .submit {\n padding-bottom: 0;\n margin: unset;\n}\ndiv.widget-survey-components .nps-container .footer,\ndiv.card-survey-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components .nps-container .widget .choices,\ndiv.card-survey-style .nps-container .widget .choices {\n grid-gap: 8px;\n gap: 8px;\n}\ndiv.widget-survey-components .radio-group,\ndiv.card-survey-style .radio-group {\n width: 100%;\n}\ndiv.widget-survey-components .checkbox-group,\ndiv.card-survey-style .checkbox-group {\n width: 100%;\n flex-wrap: nowrap;\n}\n\ndiv.widget-survey-components .question-container {\n box-shadow: none;\n border-radius: 0;\n}\ndiv.widget-survey-components .question-text {\n font-size: 0.875rem;\n}\ndiv.widget-survey-components .progressbar-container {\n position: absolute;\n}\ndiv.widget-survey-components .progressbar-container .progressbar {\n border-radius: 3px 0 0 0;\n}\ndiv.widget-survey-components .textarea-container .end-max-length {\n padding: 4px;\n}\ndiv.widget-survey-components .responsive-text-field .input-container {\n display: none;\n}\ndiv.widget-survey-components .responsive-text-field .textarea-container {\n display: flex;\n}\ndiv.widget-survey-components div.thankyou {\n min-height: unset;\n}\ndiv.widget-survey-components div.thankyou .text {\n width: 85%;\n}\ndiv.widget-survey-components div.thankyou svg {\n width: 140px;\n height: 120px;\n}\n\ndiv.widget-survey-components.default-style .freemium-survey-step-navigation {\n margin: 0;\n}\ndiv.widget-survey-components.default-style .questions {\n max-height: 400px;\n max-height: var(--default-widget-max-height);\n}\ndiv.widget-survey-components.default-style .question-container {\n padding: 12px 28px;\n}\ndiv.widget-survey-components.default-style .question-footer {\n justify-content: space-between;\n}\ndiv.widget-survey-components.default-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.default-style .nps-container .choices {\n flex-wrap: unset;\n grid-gap: 12px;\n gap: 12px;\n}\ndiv.widget-survey-components.default-style .action-button {\n line-height: 1.2;\n}\ndiv.widget-survey-components.default-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style textarea {\n min-height: 84px;\n}\ndiv.widget-survey-components.default-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.widget-survey-components.cozy-style .freemium-survey-step-navigation {\n margin: 0;\n}\n.widget-survey-components.cozy-style .questions {\n max-height: 380px;\n max-height: var(--cozy-widget-max-height);\n}\n.widget-survey-components.cozy-style .question-text {\n font-size: 1rem;\n}\n.widget-survey-components.cozy-style .question-text.nps {\n text-align: center;\n width: 60%;\n min-width: 600px;\n margin: auto;\n}\n.widget-survey-components.cozy-style .question-container {\n padding: 12px 28px;\n}\n.widget-survey-components.cozy-style .question-footer {\n justify-content: space-between;\n}\n.widget-survey-components.cozy-style .nps-container {\n grid-gap: 44px;\n gap: 44px;\n}\n.widget-survey-components.cozy-style .nps-container .widget {\n display: flex;\n justify-content: center;\n}\n.widget-survey-components.cozy-style .nps-container .button-container {\n width: 60%;\n min-width: 600px;\n margin: 0 auto;\n}\n.widget-survey-components.cozy-style .nps-container .button-container .choices {\n justify-content: space-around;\n}\n.widget-survey-components.cozy-style .nps-container .footer {\n padding-top: 8px;\n}\n.widget-survey-components.cozy-style .action-button {\n line-height: 1.2;\n}\n.widget-survey-components.cozy-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style textarea {\n min-height: 60px;\n}\n.widget-survey-components.cozy-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.freemium-survey-components.mobile-preview .thankyou .text {\n width: unset;\n}");const N=["RANGE","NPS","RADIO","DROPDOWN"],z=200,S=1e4,I="active-focus-lock-1",B=({thankYouQuestion:n,preview:t,placeholders:r,npsValue:a})=>(o((()=>{t||n.type_info.meta?.redirectUrl&&setTimeout((()=>{window.location.href=n.type_info.meta?.redirectUrl}),1e4)}),[]),e.createElement("div",{className:"question-container thankyou"},e.createElement("div",{className:"heading"},"Thank you!"),e.createElement("div",{className:"text",dangerouslySetInnerHTML:{__html:_(n.text,r,a)}}),n.type_info.meta?.redirectUrl&&e.createElement("div",{style:{width:"100%"}},e.createElement("div",{className:"redirection-text"},"You will be redirected to the below URL automatically in 10 seconds.",e.createElement("br",null)),e.createElement("a",{className:"link",href:n.type_info.meta?.redirectUrl},n?.type_info.meta?.redirectUrl)))),O=()=>e.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.82585 6.15754C7.98999 6.32147 8.08232 6.54389 8.08252 6.77587L8.08252 7.2192C8.07983 7.45069 7.98788 7.6722 7.82585 7.83754L1.82919 13.8225C1.77496 13.8772 1.71044 13.9206 1.63936 13.9502C1.56827 13.9798 1.49203 13.9951 1.41502 13.9951C1.33801 13.9951 1.26177 13.9798 1.19068 13.9502C1.1196 13.9206 1.05508 13.8772 1.00085 13.8225L0.172521 12.9942C0.118197 12.941 0.0750381 12.8774 0.0455752 12.8073C0.0161124 12.7372 0.000937578 12.6619 0.000937585 12.5859C0.000937592 12.5098 0.0161125 12.4345 0.0455753 12.3644C0.0750381 12.2943 0.118197 12.2308 0.172521 12.1775L5.36419 6.99754L0.172522 1.81754C0.117847 1.76331 0.0744506 1.69879 0.0448352 1.62771C0.0152208 1.55662 -2.75162e-05 1.48038 -2.75094e-05 1.40337C-2.75027e-05 1.32636 0.0152208 1.25012 0.0448353 1.17904C0.0744507 1.10795 0.117847 1.04343 0.172522 0.989205L1.00086 0.172537C1.05508 0.117862 1.1196 0.0744661 1.19069 0.0448507C1.26177 0.0152353 1.33801 -1.20337e-05 1.41502 -1.2027e-05C1.49203 -1.20203e-05 1.56827 0.0152353 1.63936 0.0448507C1.71044 0.0744661 1.77496 0.117862 1.82919 0.172537L7.82585 6.15754Z",fill:"#6B6B6B"})),$=()=>e.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.256667 7.83755C0.0925257 7.67361 0.000204227 7.4512 0 7.21921V6.77588C0.00268801 6.5444 0.0946357 6.32289 0.256667 6.15755L6.25333 0.172549C6.30756 0.117874 6.37208 0.0744776 6.44316 0.0448625C6.51425 0.0152474 6.59049 0 6.6675 0C6.74451 0 6.82075 0.0152474 6.89184 0.0448625C6.96292 0.0744776 7.02744 0.117874 7.08167 0.172549L7.91 1.00088C7.96432 1.05411 8.00748 1.11764 8.03694 1.18776C8.06641 1.25787 8.08158 1.33316 8.08158 1.40922C8.08158 1.48527 8.06641 1.56056 8.03694 1.63067C8.00748 1.70079 7.96432 1.76432 7.91 1.81755L2.71833 6.99755L7.91 12.1775C7.96467 12.2318 8.00807 12.2963 8.03769 12.3674C8.0673 12.4385 8.08255 12.5147 8.08255 12.5917C8.08255 12.6687 8.0673 12.745 8.03769 12.8161C8.00807 12.8871 7.96467 12.9517 7.91 13.0059L7.08167 13.8225C7.02744 13.8772 6.96292 13.9206 6.89184 13.9502C6.82075 13.9799 6.74451 13.9951 6.6675 13.9951C6.59049 13.9951 6.51425 13.9799 6.44316 13.9502C6.37208 13.9206 6.30756 13.8772 6.25333 13.8225L0.256667 7.83755Z",fill:"#6B6B6B"})),L=({currentBlockIndex:n,currentBlockIndexOfBlocksWithQns:t,blocksWithQns:o,blocks:r,setHorizontalScrollUnits:a,preventQuestionAnimation:i})=>e.createElement("div",{className:"freemium-survey-step-navigation","data-navigation-element":"1"},e.createElement("button",{disabled:0==t.current,className:"navigation-button",onClick:()=>{t.current=Math.max(t.current-1,0),n.current=r.findIndex((e=>e.name===o[t.current].name)),i.current=!1,a(t.current)}},e.createElement($,null)),e.createElement("button",{className:"navigation-button",disabled:t.current>=o.length-1,onClick:()=>{i.current=!1,t.current=Math.min(t.current+1,o.length-1),n.current=r.findIndex((e=>e.name===o[t.current].name)),a(t.current)}},e.createElement(O,null))),F=({widget:n,widgetStyle:t,surveyStyle:o,formValues:r,blocksWithQns:a,blocks:i,thankYouQuestion:s,currentBlockIndexOfBlocksWithQns:c,currentBlockIndexOfBlocks:l,currentEditingBlock:u,isSubmitting:d,isValuesCommitted:p,isCurrentBlockFinal:m,setHorizontalScrollUnits:f,handleFormValues:h,skipBlock:v,setIsSubmitting:x,onSubmit:b,setIsSurveyCompleted:y,preventQuestionAnimation:g,preview:w,...k})=>{const E=k.blockIndex??c.current,C=k.question??a[E].question,_=()=>C.name===u.current.question.name&&!N.includes(C.type_info.question_type)&&!m(),z=()=>"RANGE"!==C.type_info.question_type&&!C.required&&C.name===u.current.question.name&&!m(),S=()=>"DROPDOWN"===C.type_info.question_type&&C.name!==u.current.question.name&&!C.required&&null!=r[C.name],I=()=>m()&&(n||"standard"!==o)&&C.name===u.current.question.name;return e.createElement("div",{className:"question-footer"},!(!n&&"standard"===o||0===E&&!r[C.name]||"compact"===t)&&e.createElement(L,{currentBlockIndex:l,currentBlockIndexOfBlocksWithQns:c,blocksWithQns:a,blocks:i,setHorizontalScrollUnits:f,preventQuestionAnimation:g}),(_()||S()||z()||I())&&e.createElement("div",{className:"action-buttons"},_()&&e.createElement(q,{onClick:()=>{h(a[E],null,!0)},disabled:!r[u.current.question.name]||Array.isArray(r[u.current.question.name])&&0===r[u.current.question.name].length,className:"next-button"},"Next"),z()&&e.createElement("button",{className:"skip-button",onClick:()=>v(C)},"Skip"),S()&&e.createElement("button",{className:"skip-button",onClick:()=>{u.current=a[E],l.current=i.findIndex((e=>e.name===a[E].name)),v(C)}},"Clear selection"),I()&&e.createElement("div",{className:"submit"},e.createElement(q,{disabled:(u.current.question.required||u.current.question.type_info.pivot_question)&&void 0===r[u.current.question.name]||d,onClick:()=>{x(!0),b(r,(()=>{s?.type_info.meta?.skipThankYouPage&&(window.location.href=s?.type_info.meta?.redirectUrl),s?.type_info.meta?.skipThankYouPage||y(!0)}))}},d?"Submitting":"Submit Survey"))))},T=({survey:t,surveyStyle:a="standard",placeholders:c,onSubmit:l,widget:u,npsValue:d,widgetStyle:p,widgetNavigatorQuerySelector:m,preview:f,mobilePreview:h})=>{const{meta:{blocks:v},question_details:{questions:x}}=t,[b,y]=r(null),[g,k]=r({}),[E,S]=r(!1),[I,O]=r([]),[$,T]=r(0),[R,Q]=r(!1),[H,A]=r(null),V=n(null),j=n(null),U=n(-1),P=n(null),W=n(0),Y=n(0),G=n(!1),M=n([]),D=e.useRef(!!d&&"card"===a),X=n(null),Z=n([]);o((()=>{v&&(X.current=v.find((e=>"TY"===e.name)),y(v.filter((e=>"TY"!==e.name))))}),[v]),o((()=>{if(b)if(j.current=x.find((e=>e.pivot_question))??x.find((e=>"RANGE"===e.type_info.question_type))??x[0],null!=d){U.current=d;const e=x.find((e=>e.name===b[0].question_names[0]));V.current={...b[0],question:e},M.current=[...M.current,{...b[0],question:e}],O(M.current),k({Q_1:d})}else if(!V.current&&b.length>0)return V.current=b[0],void K(b[0])}),[b,d]),e.useEffect((()=>{I.length&&(M.current=I,Y.current=I.length-1),u||"standard"!==a?(P.current&&(P.current.style.maxHeight="unset"),Z.current[W.current]=P.current?.scrollHeight||Z.current[W.current]||0,P.current&&(P.current.style.maxHeight="100%")):P.current?.scrollIntoView({block:"center",behavior:"smooth"}),T(I.length-1)}),[I]),o((()=>{Object.keys(g).length>0&&V.current.question&&(N.includes(V.current.question.type_info.question_type)||G.current)&&!J()&&ee()}),[g]),o((()=>{if(null!=g?.[j.current?.name])if(X.current?.is_based_on_score){const e=j.current?.type_info?.choices[g?.[j.current?.name]]?.dependent_question_names,n=X.current?.question_names.find((n=>e?.includes(n))),t=x.find((e=>e.name===n));A(t)}else{const e=x.find((e=>e.name==X.current?.question_names[0]));A(e)}}),[g?.[j.current?.name]]);const J=()=>W.current===b.length-1||"end"===V.current.branchOption,K=e=>{let n={};if(e.is_based_on_score){const t=j.current?.type_info?.choices[g?.[j.current?.name]]?.dependent_question_names,o=e.question_names.find((e=>t?.includes(e)));n=x.find((e=>e.name===o))}else n=x.find((n=>n.name===e.question_names[0]));V.current.question=n;M.current.find((e=>e.question.name===n.name))?(T($+1),Y.current+=1):O([...M.current,{...e,question:n}])},ee=()=>{if(J())S(!0);else{if(V.current.nextBlock)W.current=b.findIndex((e=>e.name===V.current.nextBlock));else if(V.current.question.type_info?.meta?.branches){const e=V.current.question.type_info?.meta?.branches,n=g[V.current.question.name];let t;if(t="RANGE"===V.current.question.type_info.question_type?e.find((e=>n>=e.min&&n<=e.max)):e.find((e=>n===e.value)),t?.nextBlock){if("TY"===t.nextBlock)return void S(!0);W.current=b.findIndex((e=>e.name===t.nextBlock))}else W.current+=1}else W.current+=1;V.current=b[W.current],K(b[W.current])}},ne=e=>{G.current=!0,delete g[e.name],k({...g})},te=(e,n,t)=>{if(D.current=!1,t){if(G.current=!0,null!=g[e.question.name]&&e.name!==I[I.length-1].name){const[t,o]=(e=>{const n=I.findIndex((n=>n.name===e.name)),t=I.slice(0,n+1),o=t.reduce(((e,n)=>(e[n.question.name]=g[n.question.name],e)),{});return W.current=b.findIndex((n=>n.name===e.name)),[t,o]})(e);k({...o,...null!=n&&{[e.question.name]:n}}),M.current=t}else k({...g,...null!=n&&{[e.question.name]:n}});j?.current?.name==e?.question?.name&&(U.current=n)}else k({...g,...null!=n&&{[e.question.name]:n}})};return V.current&&V.current.question?E?e.createElement("div",{className:`freemium-survey-components ${u?"widget-survey-components":""} ${p}-style ${h?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},e.createElement(B,{thankYouQuestion:H,preview:f,placeholders:c,npsValue:U.current})):e.createElement("div",{className:`freemium-survey-components ${u?"widget-survey-components":""} ${p}-style ${h?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},e.createElement(w,{totalSteps:b.length,completedSteps:W.current}),u&&"compact"===p&&document.querySelector(m)&&e.createElement(e.Fragment,null,i.createPortal(e.createElement(s,{autoFocus:!1,group:"active-focus-lock-1",disabled:!1},e.createElement(L,{currentBlockIndex:W,currentBlockIndexOfBlocksWithQns:Y,blocksWithQns:I,blocks:b,setHorizontalScrollUnits:T})),document.querySelector(m))),e.createElement("div",{style:u||"card"===a?{transform:`translateX(calc(-${$} * 100%))`,height:`${Z.current[W.current]}px`,transition:D.current||I?.length<=1?"none":`all ${z}ms ease-out 0ms`}:{},className:"questions"},I.map(((n,t)=>e.createElement(s,{key:n.question.name,ref:P,autoFocus:!1,disabled:t!==Y.current||"standard"===a&&!u,group:"active-focus-lock-1",className:"question-container "+(!u&&"card"!==a||Y.current===t?"":"hide-question-container")},e.createElement("div",{className:"question-text "+(0===t?"nps":""),dangerouslySetInnerHTML:{__html:_(n.question.text,c,U.current)},title:`question-${t}`,role:"heading","aria-level":1}),e.createElement(C,{question:n.question,formValues:g,autoFocusInput:Y.current===t,onChangeHandler:e=>{G.current=!1,W.current=b.findIndex((e=>e.name===n.name)),V.current=n,te(n,e,N.includes(n.question.type_info.question_type)&&!J())}}),"standard"===a||u?e.createElement(F,{question:n.question,blockIndex:t,widget:u,widgetStyle:p,surveyStyle:a,formValues:g,blocksWithQns:I,blocks:b,thankYouQuestion:H,currentBlockIndexOfBlocksWithQns:Y,currentBlockIndexOfBlocks:W,currentEditingBlock:V,isSubmitting:R,isValuesCommitted:G,isCurrentBlockFinal:J,setHorizontalScrollUnits:T,handleFormValues:te,skipBlock:ne,setIsSubmitting:Q,onSubmit:l,setIsSurveyCompleted:S,preventQuestionAnimation:D,preview:f}):e.createElement(e.Fragment,null,t===Y.current&&i.createPortal(e.createElement(s,{group:"active-focus-lock-1",autoFocus:!1},e.createElement(F,{widget:u,widgetStyle:p,surveyStyle:a,formValues:g,blocksWithQns:I,blocks:b,thankYouQuestion:H,currentBlockIndexOfBlocksWithQns:Y,currentBlockIndexOfBlocks:W,currentEditingBlock:V,isSubmitting:R,isValuesCommitted:G,isCurrentBlockFinal:J,setHorizontalScrollUnits:T,handleFormValues:te,skipBlock:ne,setIsSubmitting:Q,onSubmit:l,setIsSurveyCompleted:S,preventQuestionAnimation:D})),document.getElementById("freemium-survey")??document.body))))),!u&&"card"!==a&&J()&&e.createElement("div",{className:"submit"},e.createElement(q,{disabled:V.current.question.required&&void 0===g[V.current.question.name]||R,onClick:()=>{Q(!0),l(g,(()=>{f||H?.type_info.meta?.skipThankYouPage&&(window.location.href=H?.type_info.meta?.redirectUrl),H?.type_info.meta?.skipThankYouPage||S(!0)}))}},R?"Submitting Survey":"Submit Survey")))):null},R=n=>{const{survey:t}=n,o=a((()=>{const e=JSON.parse(JSON.stringify(t)),n=[],{question_details:{questions:o}}=e;return o.forEach((e=>{const t=e.type_info?.meta?.block;t&&(t.question_names||(t.question_names=[e.name]),n.push(t))})),{...e,meta:{...e.meta,blocks:n}}}),[t]);return e.createElement(T,Object.assign({},n,{survey:o}))};export{I as ACTIVE_FOCUS_LOCK_GROUP,S as AUTO_REDIRECT_DELAY,E as BUTTON_SIZE_VARIANTS,q as Button,x as CheckboxGroup,f as Input,l as NPS,w as ProgressBar,g as Radio,y as RadioGroup,R as Survey,z as TRANSITION_DELAY,h as TextArea};
|
|
1
|
+
import e,{useRef as n,forwardRef as t,useEffect as o,useState as r,useMemo as a}from"react";import i from"react-dom";import s from"react-focus-lock";function c(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}c(".freemium-survey-components .nps-container {\n margin: 0 auto;\n width: 100%;\n display: flex;\n flex-direction: column;\n grid-gap: 52px;\n gap: 52px;\n}\n.freemium-survey-components .nps-container .footer {\n border-top: 1px solid var(--default-background-color);\n border-top: 1px solid var(--background-color, var(--default-background-color));\n padding-top: 20px;\n margin-top: 20px;\n display: flex;\n justify-content: center;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #666;\n}\n.freemium-survey-components .nps-container .nps-scale {\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .button-container {\n display: flex;\n border-radius: 4px;\n justify-content: space-between;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale .positive-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n right: 0px;\n text-align: right;\n}\n.freemium-survey-components .nps-container .nps-scale .negative-text {\n position: absolute;\n color: #475867;\n bottom: -40px;\n font-size: 12px;\n left: 0;\n text-align: left;\n}\n.freemium-survey-components .nps-container .nps-scale span {\n color: #aaa;\n font-size: 0.75rem;\n}\n.freemium-survey-components .nps-container .nps-scale button {\n display: inline-block;\n font-size: 1rem;\n white-space: nowrap;\n vertical-align: middle;\n background: none;\n border: none;\n box-shadow: none;\n cursor: pointer;\n text-align: center;\n font-weight: 400;\n border-radius: 4px;\n margin: 0;\n outline: none;\n margin-left: -1px;\n width: 40px;\n height: 40px;\n transform: scale(1);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover {\n transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in, transform 0.2s cubic-bezier(0.5, 2, 0.5, 0.75);\n}\n.freemium-survey-components .nps-container .nps-scale button:hover, .freemium-survey-components .nps-container .nps-scale button:focus {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale button.active {\n color: white;\n transform: scale(1.2);\n z-index: 2;\n position: relative;\n}\n.freemium-survey-components .nps-container .nps-scale.rounded button {\n border-radius: 50%;\n}\n.freemium-survey-components .nps-container .nps-scale.square button {\n border-radius: 0;\n}\n.freemium-survey-components .nps-container .nps-scale.curved button {\n border-radius: 3px;\n}\n.freemium-survey-components .nps-container .nps-scale.highlighted button:hover, .freemium-survey-components .nps-container .nps-scale.highlighted button:focus, .freemium-survey-components .nps-container .nps-scale.highlighted button.active {\n background: var(--default-brand-color) !important;\n background: var(--brand-color, var(--default-brand-color)) !important;\n}\n.freemium-survey-components .nps-container .nps-scale .choices {\n width: 100%;\n display: flex;\n justify-content: space-between;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .button-container {\n background-color: transparent;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice {\n color: #000;\n background: var(--default-background-color);\n background: var(--background-color, var(--default-background-color));\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice.active,\n.freemium-survey-components .nps-container .nps-scale.standard .choice:focus,\n.freemium-survey-components .nps-container .nps-scale.standard .choice:hover {\n color: #fff;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(1).active {\n background: #eb5b56;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(2).active {\n background: #fb8774;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(3).active {\n background: #f58f6b;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(4).active {\n background: #f6996a;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(5).active {\n background: #eab268;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(6).active {\n background: #cebb69;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(7).active {\n background: #bdc46c;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(8).active {\n background: #a4cd72;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(9).active {\n background: #77c955;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(10).active {\n background: #37c248;\n}\n.freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11):hover, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11):focus, .freemium-survey-components .nps-container .nps-scale.standard .choice:nth-child(11).active {\n background: #1ebf31;\n}\n\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.freemium-survey-components.mobile-preview .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .nps-container .nps-scale .button-container,\n.card-survey-style .nps-container .nps-scale .button-container {\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale .choices,\n.card-survey-style .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n }\n .freemium-survey-components .nps-container .nps-scale button,\n.card-survey-style .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n }\n}\n.widget-survey-components .nps-container .nps-scale .button-container {\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale .choices {\n flex-wrap: wrap;\n justify-content: center;\n grid-gap: 16px;\n gap: 16px;\n background: transparent;\n}\n.widget-survey-components .nps-container .nps-scale button {\n border-radius: 50%;\n background: #ebeff3;\n}");const l=t=>{const{type_info:{linear_scale:{button_style:o="highlighted",button_shape:r="rounded"}={},score_presets:{start:a="Very unlikely",end:i="Very likely"}={},validation:{min:s},footer_text:c}}=t,l=e=>{switch(e){case e<=6:return"detractor";case e<=8:return"passive";default:return"promoter"}},u=n(Array.from({length:10+(0===s?1:0)},((e,n)=>n+s)));return e.createElement("div",{className:"nps-container","data-test-input":"nps"},e.createElement("div",{className:`nps-scale ${r} ${o}`},e.createElement("div",{className:"button-container"},e.createElement("span",{className:"negative-text",role:"note"},`${s} - ${a}`),e.createElement("span",{className:"positive-text",role:"note"},`${u.current[u.current.length-1]} - ${i}`),e.createElement("div",{className:"choices",role:"radiogroup","aria-required":!0},u.current.map((n=>e.createElement("button",{role:"radio","aria-checked":t.npsValue===n,key:n,"data-test-nps-choice":n,onClick:e=>{t.onChangeHandler(n)},className:`choice ${l(n)} ${t.npsValue===n&&"active"}`},n)))))),e.createElement("div",{className:"footer",role:"note"},c))},u=(e,n)=>(e.defaultProps=n,e);c('.freemium-survey-components .input-container,\n.freemium-survey-components .textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n.freemium-survey-components label.input-label {\n display: inline-block;\n padding-bottom: 8px;\n padding-left: 2px;\n font-size: 0.75rem;\n font-weight: 400;\n}\n.freemium-survey-components label.required::after {\n content: "*";\n position: relative;\n top: 2px;\n font-weight: 500;\n font-size: 0.85rem;\n padding-left: 3px;\n color: #d72d30;\n}\n.freemium-survey-components .input-basic {\n width: 100%;\n display: flex;\n align-items: center;\n border-radius: 4px;\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n transition: border-color 0.2s linear;\n background: #fff;\n}\n.freemium-survey-components .textarea-container .input-basic {\n flex-direction: column;\n align-items: unset;\n}\n.freemium-survey-components .input-basic.error {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error:hover {\n border: 1px solid #d72d30;\n}\n.freemium-survey-components .input-basic.error[focus-within] {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic.error:focus-within {\n box-shadow: none;\n}\n.freemium-survey-components .input-basic:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: 0.2s linear;\n}\n.freemium-survey-components .input-basic[focus-within] {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .input-basic:focus-within {\n border: 1px solid transparent;\n box-shadow: 0 0 0 2px var(--default-brand-color);\n box-shadow: 0 0 0 2px var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .end-max-length {\n padding: 0 8px;\n font-size: 0.85rem;\n}\n.freemium-survey-components .textarea-container .end-max-length {\n padding: 8px;\n align-self: flex-end;\n}\n.freemium-survey-components span.input-error {\n display: block;\n padding-left: 2px;\n padding-top: 4px;\n font-size: 0.9rem;\n color: #d72d30;\n}\n.freemium-survey-components input[type=text] {\n padding: 6px 12px;\n flex: 1;\n border: unset;\n height: 32px;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components input[type=text],\n.freemium-survey-components textarea {\n outline: none;\n border: none;\n}\n.freemium-survey-components input[type=text]::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components input[type=text]::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea {\n min-height: 116px;\n padding: 12px;\n flex: 1;\n border: unset;\n resize: none;\n font-size: 1rem;\n /* line-height: ${typography.input.text.lineHeight}; */\n border-radius: 4px;\n}\n.freemium-survey-components textarea::-moz-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea:-ms-input-placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}\n.freemium-survey-components textarea::placeholder {\n color: #92a2b2;\n font-weight: 400;\n font-size: 0.85rem;\n}');const d={isRequired:!1,showCount:!1,isErrored:!1,inline:!1,spellCheck:!1,autoFocusInput:!0},p=t(((t,r)=>{const a=n(null);o((()=>{t.autoFocusInput&&setTimeout((()=>{a.current?.focus()}),z+350)}),[t.autoFocusInput]);const{inputStyle:i,style:s,className:c,showCount:l,isErrored:u,startLabel:d,isRequired:p,errorText:m,endLabel:f,maxLength:h,autoFocusInput:v,...x}=t;return e.createElement("div",{className:"input-container",style:s},t.label&&e.createElement("label",{className:"input-label "+(p?"required":"")},t.label),e.createElement("div",null,d&&e.createElement("div",{className:"start-label"},d),e.createElement("div",{className:`input-basic ${u?"error":""}${c||""}`},e.createElement("input",Object.assign({type:"text",autoComplete:"off",ref:a,style:i},x)),l&&h>0&&e.createElement("div",{className:"end-max-length"},`${t.value&&t.value.length||0}/${t.maxLength}`)),f&&e.createElement("div",{className:"end-label"},f)),u&&m&&e.createElement("span",{className:"input-error"},t.errorText))})),m=t(((t,r)=>{const a=n(null);o((()=>{t.autoFocusInput&&setTimeout((()=>{a.current?.focus()}),z+350)}),[t.autoFocusInput]);const{inputStyle:i,style:s,className:c,showCount:l,maxLength:u,isErrored:d,startLabel:p,isRequired:m,autoFocusInput:f,...h}=t;return e.createElement(e.Fragment,null,e.createElement("div",{className:"textarea-container",style:s},t.label&&e.createElement("label",{className:"input-label "+(m?"required":"")},t.label),p&&e.createElement("div",{className:"start-label"},p),e.createElement("div",{className:`input-basic ${d?"error":""} ${c||""}`},e.createElement("textarea",Object.assign({autoComplete:"off",ref:a,style:i},h)),l&&u&&u>0&&e.createElement("div",{className:"end-max-length"},`${t.value&&t.value.length||0}/${t.maxLength}`)),t.endLabel&&e.createElement("div",{className:"end-label"},t.endLabel)),t.isErrored&&t.errorText&&e.createElement("span",{className:"input-error"},t.errorText))})),f=u(p,d),h=u(m,d);c('.freemium-survey-components .checkbox-group {\n width: 100%;\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n flex-direction: column;\n white-space: nowrap;\n flex-wrap: wrap;\n}\n.freemium-survey-components .icon-container {\n display: inline-block;\n flex: 0 0 12px;\n width: 12px;\n height: 12px;\n min-width: 12px;\n min-height: 12px;\n color: inherit;\n position: absolute;\n left: 1px;\n top: 2px;\n}\n.freemium-survey-components .tick-icon {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n color: inherit;\n fill: currentColor;\n}\n.freemium-survey-components input[type=checkbox] {\n position: absolute;\n clip: rect(0px 0px 0px 0px);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=checkbox]:focus ~ .checkbox {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 2px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 2px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 2px;\n border-color: transparent;\n}\n.freemium-survey-components .checkbox-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n opacity: 1;\n line-height: 1.2;\n cursor: pointer;\n font-size: 1rem;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components .checkbox-label:hover .checkbox {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components .checkbox-label.disabled {\n opacity: 0.5;\n cursor: "not-allowed";\n}\n.freemium-survey-components .checkbox {\n transition: background-color ease-in 0.2s;\n min-width: 14px;\n min-height: 14px;\n min-height: 14px;\n max-height: 14px;\n border-radius: 2px;\n position: relative;\n margin-right: 16px;\n background-color: #fff;\n border: 1px solid;\n text-align: left;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:checked ~ .checkbox:hover {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components input[type=checkbox]:disabled ~ .checkbox:hover {\n box-shadow: unset;\n border-color: unset;\n}');const v=()=>e.createElement("svg",{id:"tick",className:"tick-icon",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"title",viewBox:"0 0 10 10"},e.createElement("path",{d:"M3 5.87c-.18666814.00267463-.36667109-.06932655-.5-.2L.21 3.41c-.1786328-.17863279-.24839684-.43899577-.1830127-.6830127.06538414-.24401694.25598306-.43461586.5-.5C.77100423 2.16160316 1.0313672 2.23136721 1.21 2.41L3 4.18 6.8.33c.27679776-.27455556.72320224-.27455556 1 0 .13696438.13025306.21450026.31098915.21450026.5S7.93696438 1.19974694 7.8 1.33L3.45 5.67c-.12082534.11896945-.28072735.19003701-.45.2Z",fill:"#fff",fillRule:"evenodd"})),x=({values:t=[],options:a,autoFocusGroup:i,onChangeHandler:s,othersOption:c,othersRequired:l})=>{const u=(()=>{let e=-1;return t.map(((n,t)=>{const o=a.find((e=>e.value===n));return o||(e=t),o})),e})(),[d,p]=r(!1),m=n(null);return o((()=>{i&&setTimeout((()=>{m.current?.focus()}),z+350)}),[i]),e.createElement("div",{className:"checkbox-group"},e.createElement("button",{ref:m,className:"autofocus-button","aria-hidden":!0}),a?.map(((n,o)=>e.createElement(b,{key:n.id,checked:t?.includes(n.value),name:n.value,id:n.id,onChange:(e,o)=>{if(o)s([...t||[],n.value]);else{const e=t.indexOf(n.value);e>-1&&t.splice(e,1),s([...t])}}},n.value))),c&&e.createElement(b,{key:"others",checked:d,name:"others",id:"others",onChange:(e,n)=>{p(n)}},"Others"),d&&e.createElement(e.Fragment,null,e.createElement(f,{placeholder:"Enter your comment",value:t[u],onChange:e=>{-1!==u?(t[u]=e.target.value,s(t)):s(t.concat(e.target.value))},label:""})))},b=u((t=>{const r=n(null);return o((()=>{t.autoFocus&&setTimeout((()=>{r.current?.focus()}),z+20)}),[]),e.createElement("label",{className:`checkbox-label ${t.disabled&&"disabled"}`},e.createElement("input",{ref:r,id:t.id,type:"checkbox",name:t.name,readOnly:t.readOnly,disabled:t.disabled,"aria-disabled":t.disabled,checked:t.checked,onChange:t.readOnly?()=>{}:e=>t.onChange(e,e.target.checked)}),e.createElement("div",{className:"checkbox"},t.checked&&e.createElement("div",{className:"icon-container"},e.createElement(v,null)," ")),e.createElement("div",null,t.children))}),{checked:!1});c('.freemium-survey-components .radio-group {\n display: flex;\n grid-gap: 12px;\n gap: 12px;\n white-space: nowrap;\n flex-direction: column;\n width: 100%;\n}\n.freemium-survey-components .radio {\n background-color: #fff;\n border: 1px solid;\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n transition: background-color ease-in 0.2s;\n min-width: 18px;\n max-width: 18px;\n min-height: 18px;\n max-height: 18px;\n border-radius: 50%;\n position: relative;\n margin-right: 16px;\n text-align: left;\n}\n.freemium-survey-components .radio:before {\n left: 3px;\n top: 3px;\n content: "";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transition: all ease-in 0.2s;\n background-color: #fff;\n}\n.freemium-survey-components .radio-label {\n display: flex;\n align-items: baseline;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-align: left;\n cursor: pointer;\n line-height: 1.2;\n font-size: 1rem;\n font-weight: 400;\n padding: 16px 24px;\n min-width: 200px;\n border: 1px solid #ebeff3;\n box-shadow: 0px 2px 5px rgba(18, 52, 77, 0.06);\n border-radius: 4px;\n white-space: pre-wrap;\n}\n.freemium-survey-components input[type=radio] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n width: 0px;\n height: 0px;\n}\n.freemium-survey-components input[type=radio]:focus ~ .radio {\n /* box-shadow: ${pseudo.focus} 0px 0px 0px 3px; */\n box-shadow: var(--default-brand-color) 0px 0px 0px 3px;\n box-shadow: var(--brand-color, var(--default-brand-color)) 0px 0px 0px 3px;\n border-color: transparent;\n}\n.freemium-survey-components input[type=radio]:checked ~ .radio:before {\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}\n.freemium-survey-components .radio-label:hover .radio {\n border-color: var(--default-brand-color);\n border-color: var(--brand-color, var(--default-brand-color));\n box-shadow: var(--default-background-color) 0px 0px 0px 5px;\n box-shadow: var(--background-color, var(--default-background-color)) 0px 0px 0px 5px;\n}');const g=({name:t,options:a,value:i,autoFocusGroup:s,onChangeHandler:c,othersOption:l,othersRequired:u})=>{const[d,p]=r(""),[m,h]=r(""),v=n(null);return o((()=>{s&&setTimeout((()=>{v.current?.focus()}),z+350)}),[s]),o((()=>{i||(h(""),p(""))}),[i]),o((()=>{m&&a.find((e=>e.value===m))&&c(m)}),[m]),e.createElement("div",{className:"radio-group",role:"radiogroup"},e.createElement("button",{ref:v,className:"autofocus-button","aria-hidden":!0,tabIndex:-1}),a?.map(((n,o)=>e.createElement(y,{key:n.value,value:n.value,name:t,onChange:e=>{h(e.currentTarget.value)},checked:m===n.value},n.value))),l&&e.createElement(y,{key:"others",value:"others",name:t,onChange:e=>{h("others")},checked:"others"===m},"Others"),"others"===m&&e.createElement(e.Fragment,null,e.createElement(f,{value:d,onChange:e=>p(e.target.value),placeholder:"Enter your comment",label:""}),d!==i&&e.createElement(q,{inline:!0,disabled:u&&0===d.length,onClick:()=>c(d)},"Next")))},y=u((t=>{const r=n(null);return o((()=>{t.autoFocus&&setTimeout((()=>{r.current?.focus()}),z+20)}),[]),e.createElement("label",{className:"radio-label"},e.createElement("input",{ref:r,type:"radio",name:t.name,value:t.value,checked:t.checked,onChange:t.onChange}),e.createElement("div",{className:"radio"}),e.createElement("div",null,t.children))}),{checked:!1,autoFocus:!1});c(".progressbar-container {\n width: 100%;\n height: 4px;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n text-align: left;\n}\n\n.progressbar {\n transition: transform 0.25s linear;\n transform-origin: left;\n height: 100%;\n background-color: var(--default-brand-color);\n background-color: var(--brand-color, var(--default-brand-color));\n}");const w=n=>{const{totalSteps:t,completedSteps:o}=n;return e.createElement("div",{className:"progressbar-container"},e.createElement("div",{className:"progressbar",style:{width:(o>0?100/t:0)+"%",transform:`scaleX(${o})`}}))};c(".freemium-survey-components .action-button {\n width: auto;\n display: block;\n padding: 8px 16px;\n cursor: pointer;\n line-height: 1.5;\n text-align: center;\n font-weight: 500;\n letter-spacing: 0.3px;\n border-radius: 4px;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: --default-button-text-color;\n color: var(--button-text-color, --default-button-text-color);\n background: var(--default-brand-color);\n background: var(--brand-color, var(--default-brand-color));\n border: 1px solid var(--default-brand-color);\n border: 1px solid var(--brand-color, var(--default-brand-color));\n border-radius: 4px;\n min-width: 200px;\n max-width: -webkit-fit-content;\n max-width: -moz-fit-content;\n max-width: fit-content;\n transform: translateY(0px);\n transition: transform ease 0.2s;\n}\n.freemium-survey-components .action-button:not([disabled]):hover {\n transform: translateY(-4px);\n}\n.freemium-survey-components .action-button[disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n}\n.freemium-survey-components button:focus:not(:active) {\n /* box-shadow: 0 0 0 2px ${pseudo.focus}; */\n}\n\n@media (max-width: 550px) {\n .freemium-survey-components .action-button {\n min-width: 120px;\n }\n}\n.widget-survey-components .action-button {\n min-width: 120px;\n}\n\n.freemium-survey-components.mobile-preview .action-button {\n min-width: 120px;\n}");const k=()=>e.createElement(e.Fragment,null,"..."),E={LARGE:"large",MINI:"mini",NORMAL:"normal"},q=n=>{const{inline:t=!1,children:o,disabled:r,className:a="",htmlType:i,type:s="primary",onClick:c,size:l,overrideStyleClassName:u="",loading:d=!1,...p}=n;return e.createElement("button",Object.assign({style:t?{display:"inline-block"}:{},disabled:r,className:`action-button ${a} ${u}`,type:i,onClick:c},p),d?e.createElement(k,null):o)},C=({question:n,formValues:t,onChangeHandler:o,autoFocusInput:r})=>{switch(n.type_info.question_type){case"RANGE":return e.createElement(l,{type_info:n.type_info,onChangeHandler:o,npsValue:t[n.name]});case"CHECKBOX":case"MULTI_SELECT":return e.createElement(x,{autoFocusGroup:r,values:t[n.name],options:n.type_info.choices,onChangeHandler:o,othersOption:n.type_info.meta?.othersOption,othersRequired:n.type_info.meta?.othersRequired});case"RADIO":case"DROPDOWN":return e.createElement(g,{autoFocusGroup:r,name:n.name,onChangeHandler:o,options:n.type_info.choices,value:t[n.name],othersOption:n.type_info.meta?.othersOption,othersRequired:n.type_info.meta?.othersRequired});case"INPUT":case"TEXT":return n.type_info?.meta?.readOnly?e.createElement("div",{className:"message-container"},n.type_info?.meta?.value):e.createElement("div",{className:"responsive-text-field"},e.createElement(f,{autoFocusInput:r,label:"",maxLength:300,showCount:!0,isRequired:n.is_required,value:t[n.name]||"",placeholder:n.type_info?.meta?.placeholder??"",onChange:e=>o(e.target.value)}),e.createElement(h,{autoFocusInput:r,label:"",maxLength:300,showCount:!0,isRequired:n.is_required,placeholder:n.type_info?.meta?.placeholder??"",value:t[n.name]||"",onChange:e=>o(e.target.value)}));case"PARAGRAPH":return e.createElement(h,{autoFocusInput:r,label:"",isRequired:n.is_required,placeholder:n.type_info?.meta?.placeholder??"",value:t[n.name]||"",onChange:e=>o(e.target.value)});default:return console.error(`Question type ${n.type_info.question_type} not found`),null}},_=(e,n,t)=>{if(e){let o={"{{nps.score}}":t};n&&(o={...o,...n});const r=new RegExp(Object.keys(o).join("|"),"gi");e=e.replace(r,(function(e){return o[e.toLowerCase()]}))}return e};c(":root {\n --default-brand-color: #264966;\n --default-question-text-color: #000;\n --default-question-background-color: #fff;\n --default-background-color: #f8f8f8;\n --default-button-text-color: #fff;\n --default-secondary-button-text-color: #000;\n --default-input-placeholder-color: #92a2b1;\n --compact-widget-max-height: 560px;\n --default-widget-max-height: 400px;\n --cozy-widget-max-height: 380px;\n}\n\n.freemium-survey-step-navigation {\n padding: 0 2px;\n box-shadow: 0px 0px 6px #eee;\n}\n.freemium-survey-step-navigation .navigation-button {\n width: 38px;\n text-align: -webkit-center;\n height: 38px;\n background-color: #fff;\n border: none;\n cursor: pointer;\n border-radius: 0 3px 3px 0;\n}\n.freemium-survey-step-navigation .navigation-button:first-of-type {\n border-right: 1px solid #d9d9d9;\n border-radius: 3px 0 0 3px;\n}\n.freemium-survey-step-navigation .navigation-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.freemium-survey-step-navigation .navigation-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.freemium-survey-components .question-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n text-align: center;\n max-width: 700px;\n margin: 0 auto;\n background: var(--default-question-background-color);\n background: var(--question-background-color, var(--default-question-background-color));\n border-radius: 4px;\n transition: transform 500ms ease 0ms, opacity 200ms ease 0ms;\n box-shadow: 0px 12px 15px rgba(18, 52, 77, 0.03);\n margin-bottom: 28px;\n padding: 28px 28px 20px 28px;\n grid-gap: 28px;\n gap: 28px;\n position: relative;\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n transition: opacity 50ms ease-out;\n overflow: auto;\n}\n.freemium-survey-components .hide-question-container {\n opacity: 0;\n}\n.freemium-survey-components .question-text {\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.8;\n width: 100%;\n text-align: left;\n color: var(--default-question-text-color);\n color: var(--question-text-color, var(--default-question-text-color));\n}\n.freemium-survey-components .autofocus-button {\n border: none;\n width: 0;\n height: 0;\n opacity: 0;\n margin-top: -12px;\n margin-left: -12px;\n}\n@-webkit-keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes opac {\n 0%, 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n.freemium-survey-components .question-footer {\n display: flex;\n justify-content: flex-end;\n grid-gap: 40px;\n gap: 40px;\n width: 100%;\n align-items: center;\n}\n.freemium-survey-components .question-footer:empty {\n display: none;\n}\n.freemium-survey-components .action-buttons {\n display: flex;\n grid-gap: 20px;\n gap: 20px;\n flex-direction: row-reverse;\n}\n.freemium-survey-components .action-buttons:empty {\n display: none;\n}\n.freemium-survey-components .skip-button {\n font-weight: 400;\n cursor: pointer;\n background: transparent;\n border: none;\n min-width: 40px;\n padding: 8px 16px;\n border-radius: 4px;\n color: var(--default-secondary-button-text-color);\n color: var(--secondary-button-text-color, var(--default-secondary-button-text-color));\n letter-spacing: 0.05rem;\n line-height: 1.5;\n border: 1px solid transparent;\n}\n.freemium-survey-components .skip-button:hover {\n background-color: #f3f3f3;\n}\n.freemium-survey-components .next-button {\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .submit {\n max-width: 700px;\n margin: 0 auto;\n text-align: left;\n background: transparent;\n box-shadow: none;\n color: var(--default-button-text-color);\n color: var(--button-text-color, var(--default-button-text-color));\n}\n.freemium-survey-components .thankyou {\n display: flex;\n align-items: center;\n justify-content: center;\n grid-gap: 20px;\n gap: 20px;\n min-height: 180px;\n}\n.freemium-survey-components .thankyou .heading {\n font-weight: 600;\n font-size: 28px;\n}\n.freemium-survey-components .thankyou .text {\n white-space: pre-wrap;\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.6;\n color: #12344d;\n width: 75%;\n}\n.freemium-survey-components .thankyou .redirection-text {\n color: #929292;\n margin-bottom: 12px;\n font-weight: 300;\n}\n.freemium-survey-components .thankyou .link {\n width: 100%;\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: #666;\n font-weight: 500;\n text-decoration: underline;\n}\n.freemium-survey-components .responsive-text-field {\n width: 100%;\n}\n.freemium-survey-components .responsive-text-field .textarea-container {\n display: none;\n}\n.freemium-survey-components .message-container:empty {\n display: none;\n}\n\n@media (max-width: 550px) {\n .freemium-survey-component .responsive-text-field .input-container,\n.card-survey-style .responsive-text-field .input-container {\n display: none;\n }\n .freemium-survey-component .responsive-text-field .textarea-container,\n.card-survey-style .responsive-text-field .textarea-container {\n display: flex;\n }\n}\ndiv.widget-survey-components.compact-style .freemium-survey-step-navigation {\n padding: 0 2px;\n margin-left: 4px;\n box-shadow: 0px 0px 6px #eee;\n margin-top: 4px;\n}\ndiv.widget-survey-components.compact-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.compact-style .nps-container .choices {\n grid-gap: 12px;\n gap: 12px;\n}\n\ndiv.widget-survey-components,\ndiv.card-survey-style {\n display: flex;\n flex-direction: column;\n grid-gap: 28px;\n gap: 28px;\n flex-grow: 1;\n font-size: 0.875rem;\n overflow: hidden;\n}\ndiv.widget-survey-components .questions,\ndiv.card-survey-style .questions {\n min-width: 100%;\n max-width: 100%;\n display: flex;\n height: 100%;\n position: relative;\n max-height: 560px;\n max-height: var(--compact-widget-max-height);\n}\ndiv.widget-survey-components .question-text,\ndiv.card-survey-style .question-text {\n width: 100%;\n text-align: left;\n}\ndiv.widget-survey-components .focus-lock,\ndiv.card-survey-style .focus-lock {\n width: 100%;\n}\ndiv.widget-survey-components .question-container,\ndiv.card-survey-style .question-container {\n height: -webkit-fit-content;\n height: -moz-fit-content;\n height: fit-content;\n min-width: 100%;\n max-width: 100%;\n margin-bottom: 0;\n padding: 16px 28px;\n grid-gap: 16px;\n gap: 16px;\n flex-grow: 1;\n}\ndiv.widget-survey-components .question-footer,\ndiv.card-survey-style .question-footer {\n margin: 0px auto;\n justify-content: space-between;\n bottom: 0;\n padding-bottom: 20px;\n}\ndiv.widget-survey-components .submit,\ndiv.card-survey-style .submit {\n padding-bottom: 0;\n margin: unset;\n}\ndiv.widget-survey-components .nps-container .footer,\ndiv.card-survey-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components .nps-container .widget .choices,\ndiv.card-survey-style .nps-container .widget .choices {\n grid-gap: 8px;\n gap: 8px;\n}\ndiv.widget-survey-components .radio-group,\ndiv.card-survey-style .radio-group {\n width: 100%;\n}\ndiv.widget-survey-components .checkbox-group,\ndiv.card-survey-style .checkbox-group {\n width: 100%;\n flex-wrap: nowrap;\n}\n\ndiv.widget-survey-components .question-container {\n box-shadow: none;\n border-radius: 0;\n}\ndiv.widget-survey-components .question-text {\n font-size: 0.875rem;\n}\ndiv.widget-survey-components .progressbar-container {\n position: absolute;\n}\ndiv.widget-survey-components .progressbar-container .progressbar {\n border-radius: 3px 0 0 0;\n}\ndiv.widget-survey-components .textarea-container .end-max-length {\n padding: 4px;\n}\ndiv.widget-survey-components .responsive-text-field .input-container {\n display: none;\n}\ndiv.widget-survey-components .responsive-text-field .textarea-container {\n display: flex;\n}\ndiv.widget-survey-components div.thankyou {\n min-height: unset;\n}\ndiv.widget-survey-components div.thankyou .text {\n width: 85%;\n}\ndiv.widget-survey-components div.thankyou svg {\n width: 140px;\n height: 120px;\n}\n\ndiv.widget-survey-components.default-style .freemium-survey-step-navigation {\n margin: 0;\n}\ndiv.widget-survey-components.default-style .questions {\n max-height: 400px;\n max-height: var(--default-widget-max-height);\n}\ndiv.widget-survey-components.default-style .question-container {\n padding: 12px 28px;\n}\ndiv.widget-survey-components.default-style .question-footer {\n justify-content: space-between;\n}\ndiv.widget-survey-components.default-style .nps-container .footer {\n padding-top: 12px;\n}\ndiv.widget-survey-components.default-style .nps-container .choices {\n flex-wrap: unset;\n grid-gap: 12px;\n gap: 12px;\n}\ndiv.widget-survey-components.default-style .action-button {\n line-height: 1.2;\n}\ndiv.widget-survey-components.default-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\ndiv.widget-survey-components.default-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\ndiv.widget-survey-components.default-style textarea {\n min-height: 84px;\n}\ndiv.widget-survey-components.default-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.widget-survey-components.cozy-style .freemium-survey-step-navigation {\n margin: 0;\n}\n.widget-survey-components.cozy-style .questions {\n max-height: 380px;\n max-height: var(--cozy-widget-max-height);\n}\n.widget-survey-components.cozy-style .question-text {\n font-size: 1rem;\n}\n.widget-survey-components.cozy-style .question-text.nps {\n text-align: center;\n width: 60%;\n min-width: 600px;\n margin: auto;\n}\n.widget-survey-components.cozy-style .question-container {\n padding: 12px 28px;\n}\n.widget-survey-components.cozy-style .question-footer {\n justify-content: space-between;\n}\n.widget-survey-components.cozy-style .nps-container {\n grid-gap: 44px;\n gap: 44px;\n}\n.widget-survey-components.cozy-style .nps-container .widget {\n display: flex;\n justify-content: center;\n}\n.widget-survey-components.cozy-style .nps-container .button-container {\n width: 60%;\n min-width: 600px;\n margin: 0 auto;\n}\n.widget-survey-components.cozy-style .nps-container .button-container .choices {\n justify-content: space-around;\n}\n.widget-survey-components.cozy-style .nps-container .footer {\n padding-top: 8px;\n}\n.widget-survey-components.cozy-style .action-button {\n line-height: 1.2;\n}\n.widget-survey-components.cozy-style .radio-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .radio-group .radio-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style .checkbox-group {\n flex-direction: row;\n flex-wrap: wrap;\n}\n.widget-survey-components.cozy-style .checkbox-group .checkbox-label {\n padding: 12px 16px;\n min-width: 160px;\n font-size: 0.9rem;\n}\n.widget-survey-components.cozy-style textarea {\n min-height: 60px;\n}\n.widget-survey-components.cozy-style .end-max-length {\n font-size: 0.8rem;\n font-weight: 300;\n padding: 4px;\n}\n\n.freemium-survey-components.mobile-preview .thankyou .text {\n width: unset;\n}");const N=["RANGE","NPS","RADIO","DROPDOWN"],z=200,S=1e4,I="active-focus-lock-1",B=({thankYouQuestion:n,preview:t,placeholders:r,npsValue:a})=>(o((()=>{t||n.type_info.meta?.redirectUrl&&setTimeout((()=>{window.location.href=n.type_info.meta?.redirectUrl}),1e4)}),[]),e.createElement("div",{className:"question-container thankyou"},e.createElement("div",{className:"heading"},"Thank you!"),e.createElement("div",{className:"text",dangerouslySetInnerHTML:{__html:_(n.text,r,a)}}),n.type_info.meta?.redirectUrl&&e.createElement("div",{style:{width:"100%"}},e.createElement("div",{className:"redirection-text"},"You will be redirected to the below URL automatically in 10 seconds.",e.createElement("br",null)),e.createElement("a",{className:"link",href:n.type_info.meta?.redirectUrl},n?.type_info.meta?.redirectUrl)))),O=()=>e.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.82585 6.15754C7.98999 6.32147 8.08232 6.54389 8.08252 6.77587L8.08252 7.2192C8.07983 7.45069 7.98788 7.6722 7.82585 7.83754L1.82919 13.8225C1.77496 13.8772 1.71044 13.9206 1.63936 13.9502C1.56827 13.9798 1.49203 13.9951 1.41502 13.9951C1.33801 13.9951 1.26177 13.9798 1.19068 13.9502C1.1196 13.9206 1.05508 13.8772 1.00085 13.8225L0.172521 12.9942C0.118197 12.941 0.0750381 12.8774 0.0455752 12.8073C0.0161124 12.7372 0.000937578 12.6619 0.000937585 12.5859C0.000937592 12.5098 0.0161125 12.4345 0.0455753 12.3644C0.0750381 12.2943 0.118197 12.2308 0.172521 12.1775L5.36419 6.99754L0.172522 1.81754C0.117847 1.76331 0.0744506 1.69879 0.0448352 1.62771C0.0152208 1.55662 -2.75162e-05 1.48038 -2.75094e-05 1.40337C-2.75027e-05 1.32636 0.0152208 1.25012 0.0448353 1.17904C0.0744507 1.10795 0.117847 1.04343 0.172522 0.989205L1.00086 0.172537C1.05508 0.117862 1.1196 0.0744661 1.19069 0.0448507C1.26177 0.0152353 1.33801 -1.20337e-05 1.41502 -1.2027e-05C1.49203 -1.20203e-05 1.56827 0.0152353 1.63936 0.0448507C1.71044 0.0744661 1.77496 0.117862 1.82919 0.172537L7.82585 6.15754Z",fill:"#6B6B6B"})),$=()=>e.createElement("svg",{style:{display:"block"},width:"9",height:"14",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.256667 7.83755C0.0925257 7.67361 0.000204227 7.4512 0 7.21921V6.77588C0.00268801 6.5444 0.0946357 6.32289 0.256667 6.15755L6.25333 0.172549C6.30756 0.117874 6.37208 0.0744776 6.44316 0.0448625C6.51425 0.0152474 6.59049 0 6.6675 0C6.74451 0 6.82075 0.0152474 6.89184 0.0448625C6.96292 0.0744776 7.02744 0.117874 7.08167 0.172549L7.91 1.00088C7.96432 1.05411 8.00748 1.11764 8.03694 1.18776C8.06641 1.25787 8.08158 1.33316 8.08158 1.40922C8.08158 1.48527 8.06641 1.56056 8.03694 1.63067C8.00748 1.70079 7.96432 1.76432 7.91 1.81755L2.71833 6.99755L7.91 12.1775C7.96467 12.2318 8.00807 12.2963 8.03769 12.3674C8.0673 12.4385 8.08255 12.5147 8.08255 12.5917C8.08255 12.6687 8.0673 12.745 8.03769 12.8161C8.00807 12.8871 7.96467 12.9517 7.91 13.0059L7.08167 13.8225C7.02744 13.8772 6.96292 13.9206 6.89184 13.9502C6.82075 13.9799 6.74451 13.9951 6.6675 13.9951C6.59049 13.9951 6.51425 13.9799 6.44316 13.9502C6.37208 13.9206 6.30756 13.8772 6.25333 13.8225L0.256667 7.83755Z",fill:"#6B6B6B"})),L=({currentBlockIndex:n,currentBlockIndexOfBlocksWithQns:t,blocksWithQns:o,blocks:r,setHorizontalScrollUnits:a,preventQuestionAnimation:i})=>e.createElement("div",{className:"freemium-survey-step-navigation","data-navigation-element":"1"},e.createElement("button",{disabled:0==t.current,className:"navigation-button",onClick:()=>{t.current=Math.max(t.current-1,0),n.current=r.findIndex((e=>e.name===o[t.current].name)),i.current=!1,a(t.current)}},e.createElement($,null)),e.createElement("button",{className:"navigation-button",disabled:t.current>=o.length-1,onClick:()=>{i.current=!1,t.current=Math.min(t.current+1,o.length-1),n.current=r.findIndex((e=>e.name===o[t.current].name)),a(t.current)}},e.createElement(O,null))),F=({widget:n,widgetStyle:t,surveyStyle:o,formValues:r,blocksWithQns:a,blocks:i,thankYouQuestion:s,currentBlockIndexOfBlocksWithQns:c,currentBlockIndexOfBlocks:l,currentEditingBlock:u,isSubmitting:d,isValuesCommitted:p,isCurrentBlockFinal:m,setHorizontalScrollUnits:f,handleFormValues:h,skipBlock:v,setIsSubmitting:x,onSubmit:b,setIsSurveyCompleted:g,preventQuestionAnimation:y,preview:w,...k})=>{const E=k.blockIndex??c.current,C=k.question??a[E].question,_=()=>C.name===u.current.question.name&&!N.includes(C.type_info.question_type)&&!m(),z=()=>"RANGE"!==C.type_info.question_type&&!C.required&&C.name===u.current.question.name&&!m(),S=()=>"DROPDOWN"===C.type_info.question_type&&C.name!==u.current.question.name&&!C.required&&null!=r[C.name],I=()=>m()&&(n||"standard"!==o)&&C.name===u.current.question.name;return e.createElement("div",{className:"question-footer"},!(!n&&"standard"===o||0===E&&!r[C.name]||"compact"===t)&&e.createElement(L,{currentBlockIndex:l,currentBlockIndexOfBlocksWithQns:c,blocksWithQns:a,blocks:i,setHorizontalScrollUnits:f,preventQuestionAnimation:y}),(_()||S()||z()||I())&&e.createElement("div",{className:"action-buttons"},_()&&e.createElement(q,{onClick:()=>{h(a[E],null,!0)},disabled:!r[u.current.question.name]||Array.isArray(r[u.current.question.name])&&0===r[u.current.question.name].length,className:"next-button"},"Next"),z()&&e.createElement("button",{className:"skip-button",onClick:()=>v(C)},"Skip"),S()&&e.createElement("button",{className:"skip-button",onClick:()=>{u.current=a[E],l.current=i.findIndex((e=>e.name===a[E].name)),v(C)}},"Clear selection"),I()&&e.createElement("div",{className:"submit"},e.createElement(q,{disabled:(u.current.question.required||u.current.question.type_info.pivot_question)&&void 0===r[u.current.question.name]||d,onClick:()=>{x(!0),b(r,(()=>{s?.type_info.meta?.skipThankYouPage&&(window.location.href=s?.type_info.meta?.redirectUrl),s?.type_info.meta?.skipThankYouPage||g(!0)}))}},d?"Submitting":"Submit Survey"))))},T=({survey:t,surveyStyle:a="standard",placeholders:c,onSubmit:l,widget:u,npsValue:d,widgetStyle:p,widgetNavigatorQuerySelector:m,preview:f,mobilePreview:h})=>{const{meta:{blocks:v},question_details:{questions:x}}=t,[b,g]=r(null),[y,k]=r({}),[E,S]=r(!1),[I,O]=r([]),[$,T]=r(0),[R,Q]=r(!1),[H,A]=r(null),V=n(null),j=n(null),U=n(-1),P=n(null),W=n(0),Y=n(0),G=n(!1),M=n([]),D=e.useRef(!!d&&"card"===a),X=n(null),Z=n([]);o((()=>{v&&(X.current=v.find((e=>"TY"===e.name)),g(v.filter((e=>"TY"!==e.name))))}),[v]),o((()=>{if(b)if(j.current=x.find((e=>e.pivot_question))??x.find((e=>"RANGE"===e.type_info.question_type))??x[0],null!=d){U.current=d;const e=x.find((e=>e.name===b[0].question_names[0]));V.current={...b[0],question:e},M.current=[...M.current,{...b[0],question:e}],O(M.current),k({Q_1:d})}else if(!V.current&&b.length>0)return V.current=b[0],void K(b[0])}),[b,d]),e.useEffect((()=>{I.length&&(M.current=I,Y.current=I.length-1),u||"standard"!==a?(P.current&&(P.current.style.maxHeight="unset"),Z.current[W.current]=P.current?.scrollHeight||Z.current[W.current]||0,P.current&&(P.current.style.maxHeight="100%")):P.current?.scrollIntoView({block:"center",behavior:"smooth"}),T(I.length-1)}),[I]),o((()=>{Object.keys(y).length>0&&V.current.question&&(N.includes(V.current.question.type_info.question_type)||G.current)&&!J()&&ee()}),[y]),o((()=>{if(null!=y?.[j.current?.name])if(X.current?.is_based_on_score){const e=j.current?.type_info?.choices[y?.[j.current?.name]]?.dependent_question_names,n=X.current?.question_names.find((n=>e?.includes(n))),t=x.find((e=>e.name===n));A(t)}else{const e=x.find((e=>e.name==X.current?.question_names[0]));A(e)}}),[y?.[j.current?.name]]);const J=()=>W.current===b.length-1||"end"===V.current.branchOption,K=e=>{let n={};if(e.is_based_on_score){const t=j.current?.type_info?.choices[y?.[j.current?.name]]?.dependent_question_names,o=e.question_names.find((e=>t?.includes(e)));n=x.find((e=>e.name===o))}else n=x.find((n=>n.name===e.question_names[0]));V.current.question=n;M.current.find((e=>e.question.name===n.name))?(T($+1),Y.current+=1):O([...M.current,{...e,question:n}])},ee=()=>{if(J())S(!0);else{if(V.current.nextBlock)W.current=b.findIndex((e=>e.name===V.current.nextBlock));else if(V.current.question.type_info?.meta?.branches){const e=V.current.question.type_info?.meta?.branches,n=y[V.current.question.name];let t;if(t="RANGE"===V.current.question.type_info.question_type?e.find((e=>n>=e.min&&n<=e.max)):e.find((e=>n===e.value)),t?.nextBlock){if("TY"===t.nextBlock)return void S(!0);W.current=b.findIndex((e=>e.name===t.nextBlock))}else W.current+=1}else W.current+=1;V.current=b[W.current],K(b[W.current])}},ne=e=>{G.current=!0,delete y[e.name],k({...y})},te=(e,n,t)=>{if(D.current=!1,t){if(G.current=!0,null!=y[e.question.name]&&e.name!==I[I.length-1].name){const[t,o]=(e=>{const n=I.findIndex((n=>n.name===e.name)),t=I.slice(0,n+1),o=t.reduce(((e,n)=>(e[n.question.name]=y[n.question.name],e)),{});return W.current=b.findIndex((n=>n.name===e.name)),[t,o]})(e);k({...o,...null!=n&&{[e.question.name]:n}}),M.current=t}else k({...y,...null!=n&&{[e.question.name]:n}});j?.current?.name==e?.question?.name&&(U.current=n)}else k({...y,...null!=n&&{[e.question.name]:n}})};return V.current&&V.current.question?E?e.createElement("div",{className:`freemium-survey-components ${u?"widget-survey-components":""} ${p}-style ${h?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},e.createElement(B,{thankYouQuestion:H,preview:f,placeholders:c,npsValue:U.current})):e.createElement("div",{className:`freemium-survey-components ${u?"widget-survey-components":""} ${p}-style ${h?"mobile-preview":""} ${a}-survey-style`,id:"freemium-survey"},e.createElement(w,{totalSteps:b.length,completedSteps:W.current}),u&&"compact"===p&&document.querySelector(m)&&e.createElement(e.Fragment,null,i.createPortal(e.createElement(s,{autoFocus:!1,group:"active-focus-lock-1",disabled:!1},e.createElement(L,{currentBlockIndex:W,currentBlockIndexOfBlocksWithQns:Y,blocksWithQns:I,blocks:b,setHorizontalScrollUnits:T,preventQuestionAnimation:D})),document.querySelector(m))),e.createElement("div",{style:u||"card"===a?{transform:`translateX(calc(-${$} * 100%))`,height:`${Z.current[W.current]}px`,transition:D.current||I?.length<=1?"none":`all ${z}ms ease-out 0ms`}:{},className:"questions"},I.map(((n,t)=>e.createElement(s,{key:n.question.name,ref:P,autoFocus:!1,disabled:t!==Y.current||"standard"===a&&!u,group:"active-focus-lock-1",className:"question-container "+(!u&&"card"!==a||Y.current===t?"":"hide-question-container")},e.createElement("div",{className:"question-text "+(0===t?"nps":""),dangerouslySetInnerHTML:{__html:_(n.question.text,c,U.current)},title:`question-${t}`,role:"heading","aria-level":1}),e.createElement(C,{question:n.question,formValues:y,autoFocusInput:Y.current===t,onChangeHandler:e=>{G.current=!1,W.current=b.findIndex((e=>e.name===n.name)),V.current=n,te(n,e,N.includes(n.question.type_info.question_type)&&!J())}}),"standard"===a||u?e.createElement(F,{question:n.question,blockIndex:t,widget:u,widgetStyle:p,surveyStyle:a,formValues:y,blocksWithQns:I,blocks:b,thankYouQuestion:H,currentBlockIndexOfBlocksWithQns:Y,currentBlockIndexOfBlocks:W,currentEditingBlock:V,isSubmitting:R,isValuesCommitted:G,isCurrentBlockFinal:J,setHorizontalScrollUnits:T,handleFormValues:te,skipBlock:ne,setIsSubmitting:Q,onSubmit:l,setIsSurveyCompleted:S,preventQuestionAnimation:D,preview:f}):e.createElement(e.Fragment,null,t===Y.current&&i.createPortal(e.createElement(s,{group:"active-focus-lock-1",autoFocus:!1},e.createElement(F,{widget:u,widgetStyle:p,surveyStyle:a,formValues:y,blocksWithQns:I,blocks:b,thankYouQuestion:H,currentBlockIndexOfBlocksWithQns:Y,currentBlockIndexOfBlocks:W,currentEditingBlock:V,isSubmitting:R,isValuesCommitted:G,isCurrentBlockFinal:J,setHorizontalScrollUnits:T,handleFormValues:te,skipBlock:ne,setIsSubmitting:Q,onSubmit:l,setIsSurveyCompleted:S,preventQuestionAnimation:D})),document.getElementById("freemium-survey")??document.body))))),!u&&"card"!==a&&J()&&e.createElement("div",{className:"submit"},e.createElement(q,{disabled:V.current.question.required&&void 0===y[V.current.question.name]||R,onClick:()=>{Q(!0),l(y,(()=>{f||H?.type_info.meta?.skipThankYouPage&&(window.location.href=H?.type_info.meta?.redirectUrl),H?.type_info.meta?.skipThankYouPage||S(!0)}))}},R?"Submitting Survey":"Submit Survey")))):null},R=n=>{const{survey:t}=n,o=a((()=>{const e=JSON.parse(JSON.stringify(t)),n=[],{question_details:{questions:o}}=e;return o.forEach((e=>{const t=e.type_info?.meta?.block;t&&(t.question_names||(t.question_names=[e.name]),n.push(t))})),{...e,meta:{...e.meta,blocks:n}}}),[t]);return e.createElement(T,Object.assign({},n,{survey:o}))};export{I as ACTIVE_FOCUS_LOCK_GROUP,S as AUTO_REDIRECT_DELAY,E as BUTTON_SIZE_VARIANTS,q as Button,x as CheckboxGroup,f as Input,l as NPS,w as ProgressBar,y as Radio,g as RadioGroup,R as Survey,z as TRANSITION_DELAY,h as TextArea};
|