UNPKG

@ditdot-dev/vue-flow-form

Version:

Create conversational conditional-logic forms with Vue.js.

6 lines 60.5 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueFlowForm={},e.Vue)}(this,(function(e,t){"use strict"; /*! Copyright (c) 2020 - present, DITDOT Ltd. - MIT Licence https://github.com/ditdot-dev/vue-flow-form https://www.ditdot.hr/en */var n=function(e){this.enterKey="Enter",this.shiftKey="Shift",this.ok="OK",this.continue="Continue",this.skip="Skip",this.pressEnter="Press :enterKey",this.multipleChoiceHelpText="Choose as many as you like",this.multipleChoiceHelpTextSingle="Choose only one answer",this.otherPrompt="Other",this.placeholder="Type your answer here...",this.submitText="Submit",this.longTextHelpText=":shiftKey + :enterKey to make a line break.",this.prev="Prev",this.next="Next",this.percentCompleted=":percent% completed",this.invalidPrompt="Please fill out the field correctly",this.thankYouText="Thank you!",this.successText="Your submission has been sent.",this.ariaOk="Press to continue",this.ariaRequired="This step is required",this.ariaPrev="Previous step",this.ariaNext="Next step",this.ariaSubmitText="Press to submit",this.ariaMultipleChoice="Press :letter to select",this.ariaTypeAnswer="Type your answer here",this.errorAllowedFileTypes="Invalid file type. Allowed file types: :fileTypes.",this.errorMaxFileSize="File(s) too large. Maximum allowed file size: :size.",this.errorMinFiles="Too few files added. Minimum allowed files: :min.",this.errorMaxFiles="Too many files added. Maximum allowed files: :max.",Object.assign(this,e||{})};n.prototype.formatString=function(e,t){var n=this;return e.replace(/:(\w+)/g,(function(e,i){return n[i]?'<span class="f-string-em">'+n[i]+"</span>":t&&t[i]?t[i]:e}))},n.prototype.formatFileSize=function(e){var t=e>0?Math.floor(Math.log(e)/Math.log(1024)):0;return 1*(e/Math.pow(1024,t)).toFixed(2)+" "+["B","kB","MB","GB","TB"][t]};var i=Object.freeze({Date:"FlowFormDateType",Dropdown:"FlowFormDropdownType",Email:"FlowFormEmailType",File:"FlowFormFileType",LongText:"FlowFormLongTextType",MultipleChoice:"FlowFormMultipleChoiceType",MultiplePictureChoice:"FlowFormMultiplePictureChoiceType",Number:"FlowFormNumberType",Password:"FlowFormPasswordType",Phone:"FlowFormPhoneType",SectionBreak:"FlowFormSectionBreakType",Text:"FlowFormTextType",Url:"FlowFormUrlType",Matrix:"FlowFormMatrixType",OpinionScale:"FlowFormOpinionScaleType",IconRate:"FlowFormIconRateType"});Object.freeze({label:"",value:"",disabled:!0});var s=Object.freeze({Date:"##/##/####",DateIso:"####-##-##",PhoneUs:"(###) ###-####"}),o=function(e){this.label="",this.value=null,this.selected=!1,this.imageSrc=null,this.imageAlt=null,Object.assign(this,e)};o.prototype.choiceLabel=function(){return this.label||this.value},o.prototype.choiceValue=function(){return null!==this.value?this.value:this.label||this.imageAlt||this.imageSrc},o.prototype.toggle=function(){this.selected=!this.selected};var r=function(e){this.url="",this.text="",this.target="_blank",Object.assign(this,e)},a=function(e){e=e||{},this.id=null,this.answer=null,this.answered=!1,this.index=0,this.options=[],this.description="",this.className="",this.type=null,this.html=null,this.required=!1,this.jump=null,this.placeholder=null,this.mask="",this.multiple=!1,this.allowOther=!1,this.other=null,this.language=null,this.tagline=null,this.title=null,this.subtitle=null,this.content=null,this.inline=!1,this.helpText=null,this.helpTextShow=!0,this.descriptionLink=[],this.min=null,this.max=null,this.maxLength=null,this.nextStepOnAnswer=!1,this.accept=null,this.maxSize=null,this.rows=[],this.columns=[],this.labelLeft=null,this.labelRight=null,Object.assign(this,e),this.type===i.Phone&&(this.mask||(this.mask=s.Phone),this.placeholder||(this.placeholder=this.mask)),this.type===i.Url&&(this.mask=null),this.type!==i.Date||this.placeholder||(this.placeholder="yyyy-mm-dd"),this.type!==i.Matrix&&this.multiple&&!Array.isArray(this.answer)&&(this.answer=this.answer?[this.answer]:[]),(this.required||void 0===e.answer)&&(!this.answer||this.multiple&&!this.answer.length)||(this.answered=!0),this.resetOptions()};a.prototype.getJumpId=function(){var e=null;return"function"==typeof this.jump?e=this.jump.call(this):this.jump[this.answer]?e=this.jump[this.answer]:this.jump._other&&(e=this.jump._other),e},a.prototype.setAnswer=function(e){this.type!==i.Number||""===e||isNaN(+e)||(e=+e),this.answer=e},a.prototype.setIndex=function(e){this.id||(this.id="q_"+e),this.index=e},a.prototype.resetOptions=function(){var e=this;if(this.options){var t=Array.isArray(this.answer),n=0;if(this.options.forEach((function(i){var s=i.choiceValue();e.answer===s||t&&-1!==e.answer.indexOf(s)?(i.selected=!0,++n):i.selected=!1})),this.allowOther){var i=null;t?this.answer.length&&this.answer.length!==n&&(i=this.answer[this.answer.length-1]):-1===this.options.map((function(e){return e.choiceValue()})).indexOf(this.answer)&&(i=this.answer),null!==i&&(this.other=i)}}},a.prototype.resetAnswer=function(){this.answered=!1,this.answer=this.multiple?[]:null,this.other=null,this.resetOptions()},a.prototype.isMultipleChoiceType=function(){return[i.MultipleChoice,i.MultiplePictureChoice].includes(this.type)};var l=!1,u=!1;"undefined"!=typeof navigator&&"undefined"!=typeof document&&(l=navigator.userAgent.match(/iphone|ipad|ipod/i)||-1!==navigator.userAgent.indexOf("Mac")&&"ontouchend"in document,u=l||navigator.userAgent.match(/android/i));var c={data:function(){return{isIos:l,isMobile:u}}},h={name:"FlowFormBaseType",props:{language:n,question:a,active:Boolean,disabled:Boolean,modelValue:[String,Array,Boolean,Number,Object]},mixins:[c],data:function(){return{dirty:!1,dataValue:null,answer:null,enterPressed:!1,allowedChars:null,alwaysAllowedKeys:["ArrowLeft","ArrowRight","Delete","Backspace"],focused:!1,canReceiveFocus:!1,errorMessage:null}},mounted:function(){this.question.answer?this.dataValue=this.answer=this.question.answer:this.question.multiple&&(this.dataValue=[])},methods:{fixAnswer:function(e){return e},getElement:function(){for(var e=this.$refs.input;e&&e.$el;)e=e.$el;return e},setFocus:function(){this.focused=!0},unsetFocus:function(e){this.focused=!1},focus:function(){if(!this.focused){var e=this.getElement();e&&e.focus()}},blur:function(){var e=this.getElement();e&&e.blur()},onKeyDown:function(e){this.enterPressed=!1,clearTimeout(this.timeoutId),e&&("Enter"!==e.key||e.shiftKey||this.unsetFocus(),null!==this.allowedChars&&-1===this.alwaysAllowedKeys.indexOf(e.key)&&-1===this.allowedChars.indexOf(e.key)&&e.preventDefault())},onChange:function(e){this.dirty=!0,this.dataValue=e.target.value,this.onKeyDown(),this.setAnswer(this.dataValue)},onEnter:function(){this._onEnter()},_onEnter:function(){this.enterPressed=!0,this.dataValue=this.fixAnswer(this.dataValue),this.setAnswer(this.dataValue),this.isValid()?this.blur():this.focus()},setAnswer:function(e){this.question.setAnswer(e),this.answer=this.question.answer,this.question.answered=this.isValid(),this.$emit("update:modelValue",this.answer)},showInvalid:function(){return this.dirty&&this.enterPressed&&!this.isValid()},isValid:function(){return!(this.question.required||this.hasValue||!this.dirty)||!!this.validate()},validate:function(){return!this.question.required||this.hasValue}},computed:{placeholder:function(){return this.question.placeholder||this.language.placeholder},hasValue:function(){if(null!==this.dataValue){var e=this.dataValue;return e.trim?e.trim().length>0:!Array.isArray(e)||e.length>0}return!1}},__file:"src/components/QuestionTypes/BaseType.vue"},d={extends:h,name:i.Dropdown,computed:{answerLabel:function(){for(var e=0;e<this.question.options.length;e++){var t=this.question.options[e];if(t.choiceValue()===this.dataValue)return t.choiceLabel()}return this.question.placeholder}},methods:{onKeyDownListener:function(e){"ArrowDown"===e.key||"ArrowUp"===e.key?this.setAnswer(this.dataValue):"Enter"===e.key&&this.hasValue&&(this.focused=!1,this.blur())},onKeyUpListener:function(e){"Enter"===e.key&&this.isValid()&&!this.disabled&&(e.stopPropagation(),this._onEnter(),this.$emit("next"))}}},p={class:"faux-form"},m=["value","required"],f={key:0,label:" ",value:"",disabled:"",selected:"",hidden:""},v=["disabled","value"],g=t.createElementVNode("span",{class:"f-arrow-down"},[t.createElementVNode("svg",{version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"-163 254.1 284.9 284.9",style:"","xml:space":"preserve"},[t.createElementVNode("g",null,[t.createElementVNode("path",{d:"M119.1,330.6l-14.3-14.3c-1.9-1.9-4.1-2.9-6.6-2.9c-2.5,0-4.7,1-6.6,2.9L-20.5,428.5l-112.2-112.2c-1.9-1.9-4.1-2.9-6.6-2.9c-2.5,0-4.7,0.9-6.6,2.9l-14.3,14.3c-1.9,1.9-2.9,4.1-2.9,6.6c0,2.5,1,4.7,2.9,6.6l133,133c1.9,1.9,4.1,2.9,6.6,2.9s4.7-1,6.6-2.9l133.1-133c1.9-1.9,2.8-4.1,2.8-6.6C121.9,334.7,121,332.5,119.1,330.6z"})])])],-1);function y(e,t,n,i){void 0===n&&(n=!0),e=e||"",t=t||"";for(var s=0,o=0,r="";s<t.length&&o<e.length;){var a=i[c=t[s]],l=e[o];a&&!a.escape?(a.pattern.test(l)&&(r+=a.transform?a.transform(l):l,s++),o++):(a&&a.escape&&(c=t[++s]),n&&(r+=c),l===c&&o++,s++)}for(var u="";s<t.length&&n;){var c;if(i[c=t[s]]){u="";break}u+=c,s++}return r+u}function k(e,t,n,i){return void 0===n&&(n=!0),Array.isArray(t)?function(e,t,n){return t=t.sort((function(e,t){return e.length-t.length})),function(i,s,o){void 0===o&&(o=!0);for(var r=0;r<t.length;){var a=t[r];r++;var l=t[r];if(!(l&&e(i,l,!0,n).length>a.length))return e(i,a,o,n)}return""}}(y,t,i)(e,t,n,i):y(e,t,n,i)}d.render=function(e,n,i,s,o,r){return t.openBlock(),t.createElementBlock("span",p,[t.createElementVNode("select",{ref:"input",class:"",value:e.dataValue,onChange:n[0]||(n[0]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onChange&&e.onChange.apply(e,t)}),onKeydown:n[1]||(n[1]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onKeyDownListener&&r.onKeyDownListener.apply(r,e)}),onKeyup:n[2]||(n[2]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onKeyUpListener&&r.onKeyUpListener.apply(r,e)}),required:e.question.required},[e.question.required?(t.openBlock(),t.createElementBlock("option",f," ")):t.createCommentVNode("v-if",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.options,(function(e,n){return t.openBlock(),t.createElementBlock("option",{disabled:e.disabled,value:e.choiceValue(),key:"o"+n},t.toDisplayString(e.choiceLabel()),9,v)})),128))],40,m),t.createElementVNode("span",null,[t.createElementVNode("span",{class:t.normalizeClass(["f-empty",{"f-answered":this.question.answer&&this.question.answered}])},t.toDisplayString(r.answerLabel),3),g])])},d.__file="src/components/QuestionTypes/DropdownType.vue";var w={"#":{pattern:/\d/},X:{pattern:/[0-9a-zA-Z]/},S:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleUpperCase()}},a:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleLowerCase()}},"!":{escape:!0}};function q(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}var x={name:"TheMask",props:{value:[String,Number],mask:{type:[String,Array],required:!0},masked:{type:Boolean,default:!1},tokens:{type:Object,default:function(){return w}}},directives:{mask:function(e,t){var n=t.value;if((Array.isArray(n)||"string"==typeof n)&&(n={mask:n,tokens:w}),"INPUT"!==e.tagName.toLocaleUpperCase()){var i=e.getElementsByTagName("input");if(1!==i.length)throw new Error("v-mask directive requires 1 input, found "+i.length);e=i[0]}e.oninput=function(t){if(t.isTrusted){var i=e.selectionEnd,s=e.value[i-1];for(e.value=k(e.value,n.mask,!0,n.tokens);i<e.value.length&&e.value.charAt(i-1)!==s;)i++;e===document.activeElement&&(e.setSelectionRange(i,i),setTimeout((function(){e.setSelectionRange(i,i)}),0)),e.dispatchEvent(q("input"))}};var s=k(e.value,n.mask,!0,n.tokens);s!==e.value&&(e.value=s,e.dispatchEvent(q("input")))}},data:function(){return{lastValue:null,display:this.value}},watch:{value:function(e){e!==this.lastValue&&(this.display=e)},masked:function(){this.refresh(this.display)}},computed:{config:function(){return{mask:this.mask,tokens:this.tokens,masked:this.masked}}},methods:{onInput:function(e){e.isTrusted||this.refresh(e.target.value)},refresh:function(e){this.display=e,(e=k(e,this.mask,this.masked,this.tokens))!==this.lastValue&&(this.lastValue=e,this.$emit("input",e))}}},b=["value"];x.render=function(e,n,i,s,o,r){var a=t.resolveDirective("mask");return t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"text",value:o.display,onInput:n[0]||(n[0]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onInput&&r.onInput.apply(r,e)})},null,40,b)),[[a,r.config]])},x.__file="node_modules/vue-the-mask/src/component.vue";var E={extends:h,name:i.Text,components:{TheMask:x},data:function(){return{inputType:"text",canReceiveFocus:!0}},methods:{validate:function(){return this.question.mask&&this.hasValue?this.validateMask():!this.question.required||this.hasValue},validateMask:function(){var e=this;return Array.isArray(this.question.mask)?this.question.mask.some((function(t){return t.length===e.dataValue.length})):this.dataValue.length===this.question.mask.length}}},V=["data-placeholder"],T=["type","value","required","min","max","placeholder","maxlength"];E.render=function(e,n,i,s,o,r){var a=t.resolveComponent("the-mask");return t.openBlock(),t.createElementBlock("span",{"data-placeholder":"date"===o.inputType?e.placeholder:null},[e.question.mask?(t.openBlock(),t.createBlock(a,{key:0,ref:"input",mask:e.question.mask,masked:!1,type:o.inputType,value:e.modelValue,required:e.question.required,onKeydown:e.onKeyDown,onKeyup:[e.onChange,t.withKeys(t.withModifiers(e.onEnter,["prevent"]),["enter"]),t.withKeys(t.withModifiers(e.onEnter,["prevent"]),["tab"])],onFocus:e.setFocus,onBlur:e.unsetFocus,placeholder:e.placeholder,min:e.question.min,max:e.question.max,onChange:e.onChange},null,8,["mask","type","value","required","onKeydown","onKeyup","onFocus","onBlur","placeholder","min","max","onChange"])):(t.openBlock(),t.createElementBlock("input",{key:1,ref:"input",type:o.inputType,value:e.modelValue,required:e.question.required,onKeydown:n[0]||(n[0]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onKeyDown&&e.onKeyDown.apply(e,t)}),onKeyup:[n[1]||(n[1]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onChange&&e.onChange.apply(e,t)}),n[2]||(n[2]=t.withKeys(t.withModifiers((function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onEnter&&e.onEnter.apply(e,t)}),["prevent"]),["enter"])),n[3]||(n[3]=t.withKeys(t.withModifiers((function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onEnter&&e.onEnter.apply(e,t)}),["prevent"]),["tab"]))],onFocus:n[4]||(n[4]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.setFocus&&e.setFocus.apply(e,t)}),onBlur:n[5]||(n[5]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.unsetFocus&&e.unsetFocus.apply(e,t)}),min:e.question.min,max:e.question.max,onChange:n[6]||(n[6]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onChange&&e.onChange.apply(e,t)}),placeholder:e.placeholder,maxlength:e.question.maxLength},null,40,T))],8,V)},E.__file="src/components/QuestionTypes/TextType.vue";var B={extends:E,name:i.Email,data:function(){return{inputType:"email"}},methods:{validate:function(){return this.hasValue?/^[^@]+@.+[^.]$/.test(this.dataValue):!this.question.required}},__file:"src/components/QuestionTypes/EmailType.vue"},C={name:"TextareaAutosize",props:{value:{type:[String,Number],default:""},autosize:{type:Boolean,default:!0},minHeight:{type:[Number],default:null},maxHeight:{type:[Number],default:null},important:{type:[Boolean,Array],default:!1}},data:function(){return{val:null,maxHeightScroll:!1,height:"auto"}},computed:{computedStyles:function(){return this.autosize?{resize:this.isResizeImportant?"none !important":"none",height:this.height,overflow:this.maxHeightScroll?"auto":this.isOverflowImportant?"hidden !important":"hidden"}:{}},isResizeImportant:function(){var e=this.important;return!0===e||Array.isArray(e)&&e.includes("resize")},isOverflowImportant:function(){var e=this.important;return!0===e||Array.isArray(e)&&e.includes("overflow")},isHeightImportant:function(){var e=this.important;return!0===e||Array.isArray(e)&&e.includes("height")}},watch:{value:function(e){this.val=e},val:function(e){this.$nextTick(this.resize),this.$emit("input",e)},minHeight:function(){this.$nextTick(this.resize)},maxHeight:function(){this.$nextTick(this.resize)},autosize:function(e){e&&this.resize()}},methods:{resize:function(){var e=this,t=this.isHeightImportant?"important":"";return this.height="auto"+(t?" !important":""),this.$nextTick((function(){var n=e.$el.scrollHeight+1;e.minHeight&&(n=n<e.minHeight?e.minHeight:n),e.maxHeight&&(n>e.maxHeight?(n=e.maxHeight,e.maxHeightScroll=!0):e.maxHeightScroll=!1);var i=n+"px";e.height=i+(t?" !important":"")})),this}},created:function(){this.val=this.value},mounted:function(){this.resize()}};C.render=function(e,n,i,s,o,r){return t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{style:t.normalizeStyle(r.computedStyles),"onUpdate:modelValue":n[0]||(n[0]=function(e){return o.val=e}),onFocus:n[1]||(n[1]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.resize&&r.resize.apply(r,e)})},null,36)),[[t.vModelText,o.val]])},C.__file="node_modules/vue-textarea-autosize/src/components/TextareaAutosize.vue";var F={extends:h,name:i.LongText,components:{TextareaAutosize:C},data:function(){return{canReceiveFocus:!0}},mounted:function(){window.addEventListener("resize",this.onResizeListener)},beforeUnmount:function(){window.removeEventListener("resize",this.onResizeListener)},methods:{onResizeListener:function(){this.$refs.input.resize()},unsetFocus:function(e){!e&&this.isMobile||(this.focused=!1)},onEnterDown:function(e){this.isMobile||e.preventDefault()},onEnter:function(){this._onEnter(),this.isMobile&&this.focus()}}};F.render=function(e,n,i,s,o,r){var a=t.resolveComponent("textarea-autosize");return t.openBlock(),t.createElementBlock("span",null,[t.createVNode(a,{ref:"input",rows:"1",value:e.modelValue,required:e.question.required,onKeydown:[e.onKeyDown,t.withKeys(t.withModifiers(r.onEnterDown,["exact"]),["enter"])],onKeyup:[e.onChange,t.withKeys(t.withModifiers(r.onEnter,["exact","prevent"]),["enter"]),t.withKeys(t.withModifiers(r.onEnter,["prevent"]),["tab"])],onFocus:e.setFocus,onBlur:r.unsetFocus,placeholder:e.placeholder,maxlength:e.question.maxLength},null,8,["value","required","onKeydown","onKeyup","onFocus","onBlur","placeholder","maxlength"])])},F.__file="src/components/QuestionTypes/LongTextType.vue";var L={extends:h,name:i.MultipleChoice,data:function(){return{editingOther:!1,hasImages:!1}},mounted:function(){this.addKeyListener()},beforeUnmount:function(){this.removeKeyListener()},watch:{active:function(e){e?(this.addKeyListener(),this.question.multiple&&this.question.answered&&(this.enterPressed=!1)):this.removeKeyListener()}},methods:{addKeyListener:function(){this.removeKeyListener(),document.addEventListener("keyup",this.onKeyListener)},removeKeyListener:function(){document.removeEventListener("keyup",this.onKeyListener)},onKeyListener:function(e){if(this.active&&!this.editingOther&&e.key&&1===e.key.length){var t=e.key.toUpperCase().charCodeAt(0);if(t>=65&&t<=90){var n=t-65;if(n>-1){var i=this.question.options[n];i?this.toggleAnswer(i):this.question.allowOther&&n===this.question.options.length&&this.startEditOther()}}}},getLabel:function(e){return this.language.ariaMultipleChoice.replace(":letter",this.getToggleKey(e))},getToggleKey:function(e){var t=65+e;return t<=90?String.fromCharCode(t):""},toggleAnswer:function(e){if(!this.question.multiple){this.question.allowOther&&(this.question.other=this.dataValue=null,this.setAnswer(this.dataValue));for(var t=0;t<this.question.options.length;t++){var n=this.question.options[t];n.selected&&this._toggleAnswer(n)}}this._toggleAnswer(e)},_toggleAnswer:function(e){var t=e.choiceValue();e.toggle(),this.question.multiple?(this.enterPressed=!1,e.selected?-1===this.dataValue.indexOf(t)&&this.dataValue.push(t):this._removeAnswer(t)):this.dataValue=e.selected?t:null,this.isValid()&&this.question.nextStepOnAnswer&&!this.question.multiple&&!this.disabled&&this.$emit("next"),this.setAnswer(this.dataValue)},_removeAnswer:function(e){var t=this.dataValue.indexOf(e);-1!==t&&this.dataValue.splice(t,1)},startEditOther:function(){var e=this;this.editingOther=!0,this.enterPressed=!1,this.$nextTick((function(){e.$refs.otherInput.focus()}))},onChangeOther:function(){if(this.editingOther){var e=[],t=this;this.question.options.forEach((function(n){n.selected&&(t.question.multiple?e.push(n.choiceValue()):n.toggle())})),this.question.other&&this.question.multiple?e.push(this.question.other):this.question.multiple||(e=this.question.other),this.dataValue=e,this.setAnswer(this.dataValue)}},stopEditOther:function(){this.editingOther=!1}},computed:{hasValue:function(){return!!this.question.options.filter((function(e){return e.selected})).length||!!this.question.allowOther&&(this.question.other&&this.question.other.trim().length>0)}}},S={class:"f-radios-wrap"},N=["onClick","aria-label"],A={key:0,class:"f-image"},M=["src","alt"],O={class:"f-label-wrap"},Q={class:"f-key"},I={key:0,class:"f-label"},D=["aria-label"],K={class:"f-label-wrap"},_={key:0,class:"f-key"},z={key:2,class:"f-selected"},P={class:"f-label"},$={key:3,class:"f-label"};L.render=function(e,n,i,s,o,r){return t.openBlock(),t.createElementBlock("div",S,[t.createElementVNode("ul",{class:t.normalizeClass(["f-radios",{"f-multiple":e.question.multiple}]),role:"listbox"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.options,(function(e,n){return t.openBlock(),t.createElementBlock("li",{onClick:t.withModifiers((function(t){return r.toggleAnswer(e)}),["prevent"]),class:t.normalizeClass({"f-selected":e.selected}),key:"m"+n,"aria-label":r.getLabel(n),role:"option"},[o.hasImages&&e.imageSrc?(t.openBlock(),t.createElementBlock("span",A,[t.createElementVNode("img",{src:e.imageSrc,alt:e.imageAlt},null,8,M)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",O,[t.createElementVNode("span",Q,t.toDisplayString(r.getToggleKey(n)),1),e.choiceLabel()?(t.openBlock(),t.createElementBlock("span",I,t.toDisplayString(e.choiceLabel()),1)):t.createCommentVNode("v-if",!0)])],10,N)})),128)),!o.hasImages&&e.question.allowOther?(t.openBlock(),t.createElementBlock("li",{key:0,class:t.normalizeClass(["f-other",{"f-selected":e.question.other,"f-focus":o.editingOther}]),onClick:n[5]||(n[5]=t.withModifiers((function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.startEditOther&&r.startEditOther.apply(r,e)}),["prevent"])),"aria-label":e.language.ariaTypeAnswer,role:"option"},[t.createElementVNode("div",K,[o.editingOther?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",_,t.toDisplayString(r.getToggleKey(e.question.options.length)),1)),o.editingOther?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,"onUpdate:modelValue":n[0]||(n[0]=function(t){return e.question.other=t}),type:"text",ref:"otherInput",onBlur:n[1]||(n[1]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.stopEditOther&&r.stopEditOther.apply(r,e)}),onKeyup:[n[2]||(n[2]=t.withKeys(t.withModifiers((function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.stopEditOther&&r.stopEditOther.apply(r,e)}),["prevent"]),["enter"])),n[3]||(n[3]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onChangeOther&&r.onChangeOther.apply(r,e)})],onChange:n[4]||(n[4]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onChangeOther&&r.onChangeOther.apply(r,e)}),maxlength:"256"},null,544)),[[t.vModelText,e.question.other]]):e.question.other?(t.openBlock(),t.createElementBlock("span",z,[t.createElementVNode("span",P,t.toDisplayString(e.question.other),1)])):(t.openBlock(),t.createElementBlock("span",$,t.toDisplayString(e.language.otherPrompt),1))])],10,D)):t.createCommentVNode("v-if",!0)],2)])},L.__file="src/components/QuestionTypes/MultipleChoiceType.vue";var R={extends:L,name:i.MultiplePictureChoice,data:function(){return{hasImages:!0}},__file:"src/components/QuestionTypes/MultiplePictureChoiceType.vue"},U={extends:E,name:i.Number,data:function(){return{inputType:"tel",allowedChars:"-0123456789."}},methods:{validate:function(){return!(null!==this.question.min&&!isNaN(this.question.min)&&+this.dataValue<+this.question.min)&&(!(null!==this.question.max&&!isNaN(this.question.max)&&+this.dataValue>+this.question.max)&&(this.hasValue?this.question.mask?this.validateMask():!isNaN(+this.dataValue):!this.question.required||this.hasValue))}},__file:"src/components/QuestionTypes/NumberType.vue"},j={extends:E,name:i.Password,data:function(){return{inputType:"password"}},__file:"src/components/QuestionTypes/PasswordType.vue"},H={extends:E,name:i.Phone,data:function(){return{inputType:"tel",canReceiveFocus:!0}},__file:"src/components/QuestionTypes/PhoneType.vue"},Z={extends:h,name:i.SectionBreak,methods:{onEnter:function(){this.dirty=!0,this._onEnter()},isValid:function(){return!0}}},G={key:0,class:"f-content"},Y={class:"f-section-text"};Z.render=function(e,n,i,s,o,r){return e.question.content?(t.openBlock(),t.createElementBlock("div",G,[t.createElementVNode("span",Y,t.toDisplayString(e.question.content),1)])):t.createCommentVNode("v-if",!0)},Z.__file="src/components/QuestionTypes/SectionBreakType.vue";var J={extends:E,name:i.Url,data:function(){return{inputType:"url"}},methods:{fixAnswer:function(e){return e&&-1===e.indexOf("://")&&(e="https://"+e),e},validate:function(){if(this.hasValue)try{return new URL(this.fixAnswer(this.dataValue)),!0}catch(e){return!1}return!this.question.required}},__file:"src/components/QuestionTypes/UrlType.vue"},X={extends:E,name:i.Date,data:function(){return{inputType:"date"}},methods:{validate:function(){return!(this.question.min&&this.dataValue<this.question.min)&&(!(this.question.max&&this.dataValue>this.question.max)&&(!this.question.required||this.hasValue))}},__file:"src/components/QuestionTypes/DateType.vue"},W={extends:E,name:i.File,methods:{setAnswer:function(e){this.question.setAnswer(this.$refs.input.files),this.answer=e,this.question.answered=this.isValid(),this.$emit("update:modelValue",e)},showInvalid:function(){return null!==this.errorMessage},checkFileAccept:function(e){var t="."+e.name.split(".").pop();return!(!this.acceptedFileExtensionsRegex||!this.acceptedFileExtensionsRegex.test(t))||!(!this.acceptedFileMimesRegex||!this.acceptedFileMimesRegex.test(e.type))},validate:function(){var e=this;if(this.question.required&&!this.hasValue)return!1;var t=this.$refs.input.files,n=t.length;if(this.question.accept&&!Array.from(t).every((function(t){return e.checkFileAccept(t)})))return this.errorMessage=this.language.formatString(this.language.errorAllowedFileTypes,{fileTypes:this.question.accept}),!1;if(this.question.multiple){if(null!==this.question.min&&n<+this.question.min)return this.errorMessage=this.language.formatString(this.language.errorMinFiles,{min:this.question.min}),!1;if(null!==this.question.max&&n>+this.question.max)return this.errorMessage=this.language.formatString(this.language.errorMaxFiles,{max:this.question.max}),!1}if(null!==this.question.maxSize&&Array.from(t).reduce((function(e,t){return e+t.size}),0)>+this.question.maxSize)return this.errorMessage=this.language.formatString(this.language.errorMaxFileSize,{size:this.language.formatFileSize(this.question.maxSize)}),!1;return this.errorMessage=null,this.$refs.input.checkValidity()}},computed:{acceptArray:function(){return this.question.accept?this.question.accept.split(","):[]},acceptedFileMimes:function(){return this.acceptArray.filter((function(e){return"."!==e[0]}))},acceptedFileMimesRegex:function(){return this.acceptedFileMimes.length?new RegExp(this.acceptedFileMimes.join("|").replace(/\*/g,".*")):null},acceptedFileExtensions:function(){return this.acceptArray.filter((function(e){return"."===e[0]}))},acceptedFileExtensionsRegex:function(){return this.acceptedFileExtensions.length?new RegExp(this.acceptedFileExtensions.join("|")):null}}},ee=["accept","multiple","value","required"];W.render=function(e,n,i,s,o,r){return t.openBlock(),t.createElementBlock("input",{ref:"input",type:"file",accept:e.question.accept,multiple:e.question.multiple,value:e.modelValue,required:e.question.required,onKeyup:[n[0]||(n[0]=t.withKeys(t.withModifiers((function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onEnter&&e.onEnter.apply(e,t)}),["prevent"]),["enter"])),n[1]||(n[1]=t.withKeys(t.withModifiers((function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onEnter&&e.onEnter.apply(e,t)}),["prevent"]),["tab"]))],onFocus:n[2]||(n[2]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.setFocus&&e.setFocus.apply(e,t)}),onBlur:n[3]||(n[3]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.unsetFocus&&e.unsetFocus.apply(e,t)}),onChange:n[4]||(n[4]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onChange&&e.onChange.apply(e,t)})},null,40,ee)},W.__file="src/components/QuestionTypes/FileType.vue";var te={extends:h,name:i.Matrix,data:function(){return{selected:{},inputList:[]}},beforeMount:function(){if(this.question.multiple)for(var e=0,t=this.question.rows;e<t.length;e+=1){var n=t[e];this.selected[n.id]=this.question.answer&&this.question.answer[n.id]?[].concat(this.question.answer[n.id]):[]}else this.question.answer&&(this.selected=Object.assign({},this.question.answer))},beforeUpdate:function(){this.inputList=[]},methods:{onChange:function(e){this.dirty=!0,this.dataValue=this.selected,this.onKeyDown(),this.setAnswer(this.dataValue)},validate:function(){if(!this.question.required)return!0;return!!Object.values(this.inputGroups).every((function(e){return e.some((function(e){return e.checked}))}))},getElement:function(){return this.inputList[0]}},computed:{inputGroups:function(){for(var e={},t=0,n=this.question.rows;t<n.length;t+=1){var i=n[t];e[i.id]=[]}return this.inputList.forEach((function(t){e[t.dataset.id].push(t)})),e}}},ne={class:"f-matrix-wrap"},ie=t.createElementVNode("td",null,null,-1),se={class:"f-table-string"},oe={class:"f-table-cell f-row-cell"},re={class:"f-table-string"},ae=["title"],le={key:0,class:"f-field-wrap"},ue={class:"f-matrix-field f-matrix-radio"},ce=["name","id","aria-label","data-id","value","onUpdate:modelValue"],he=t.createElementVNode("span",{class:"f-field-mask f-radio-mask"},[t.createElementVNode("svg",{viewBox:"0 0 24 24",class:"f-field-svg f-radio-svg"},[t.createElementVNode("circle",{r:"6",cx:"12",cy:"12"})])],-1),de={key:1,class:"f-field-wrap"},pe={class:"f-matrix-field f-matrix-checkbox"},me=["id","aria-label","data-id","value","onUpdate:modelValue"],fe=t.createElementVNode("span",{class:"f-field-mask f-checkbox-mask"},[t.createElementVNode("svg",{viewBox:"0 0 24 24",class:"f-field-svg f-checkbox-svg"},[t.createElementVNode("rect",{width:"12",height:"12",x:"6",y:"6"})])],-1);te.render=function(e,n,i,s,o,r){return t.openBlock(),t.createElementBlock("div",ne,[t.createElementVNode("table",{class:t.normalizeClass(["f-matrix-table",{"f-matrix-multiple":e.question.multiple}])},[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[ie,(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.columns,(function(e,n){return t.openBlock(),t.createElementBlock("th",{key:"c"+n,class:"f-table-cell f-column-cell"},[t.createElementVNode("span",se,t.toDisplayString(e.label),1)])})),128))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.rows,(function(i,s){return t.openBlock(),t.createElementBlock("tr",{key:"r"+s,class:"f-table-row"},[t.createElementVNode("td",oe,[t.createElementVNode("span",re,t.toDisplayString(i.label),1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.columns,(function(s,a){return t.openBlock(),t.createElementBlock("td",{key:"l"+a,title:s.label,class:"f-table-cell f-matrix-cell"},[e.question.multiple?(t.openBlock(),t.createElementBlock("div",de,[t.createElementVNode("label",pe,[t.withDirectives(t.createElementVNode("input",{type:"checkbox",ref:function(e){return o.inputList.push(e)},id:"c"+a+"-"+i.id,"aria-label":i.label,"data-id":i.id,value:s.value,class:"f-field-control f-checkbox-control","onUpdate:modelValue":function(e){return o.selected[i.id]=e},onChange:n[1]||(n[1]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onChange&&r.onChange.apply(r,e)})},null,40,me),[[t.vModelCheckbox,o.selected[i.id]]]),fe])])):(t.openBlock(),t.createElementBlock("div",le,[t.createElementVNode("label",ue,[t.withDirectives(t.createElementVNode("input",{type:"radio",ref:function(e){return o.inputList.push(e)},name:i.id,id:"c"+a+"-"+i.id,"aria-label":i.label,"data-id":i.id,value:s.value,"onUpdate:modelValue":function(e){return o.selected[i.id]=e},class:"f-field-control f-radio-control",onChange:n[0]||(n[0]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onChange&&r.onChange.apply(r,e)})},null,40,ce),[[t.vModelRadio,o.selected[i.id]]]),he])]))],8,ae)})),128))])})),128))])],2)])},te.__file="src/components/QuestionTypes/MatrixType.vue";var ve={extends:h,name:i.OpinionScale,data:function(){return{isIconScale:!1,hoveredIndex:null,activeIndex:null}},mixins:[c],beforeMount:function(){var e=this.question.max||5,t=Math.min(Math.max(e,1),10);if(!this.question.options.length)for(var n=1;n<=t;n++)this.question.options.push(new o({value:n.toString()}))},mounted:function(){this.addKeyListener()},beforeUnmount:function(){this.removeKeyListener()},watch:{active:function(e){e?this.addKeyListener():this.removeKeyListener()}},methods:{addKeyListener:function(){this.removeKeyListener(),document.addEventListener("keyup",this.onKeyListener)},removeKeyListener:function(){document.removeEventListener("keyup",this.onKeyListener)},onMouseover:function(e){this.hoveredIndex=e},onMouseleave:function(){this.hoveredIndex=null},onKeyListener:function(e){if(this.active&&e.key&&1===e.key.length){var t=e.key.toUpperCase().charCodeAt(0);if(t>=48&&t<=57){var n=t-49;if(n>-1){var i=this.question.options[n];i&&this.toggleAnswer(i)}}}},getLabel:function(e){return this.language.ariaMultipleChoice.replace(":letter",this.getToggleKey(e))},getToggleKey:function(e){return e},toggleAnswer:function(e){for(var t=0;t<this.question.options.length;t++){var n=this.question.options[t];n.selected&&this._toggleAnswer(n)}this._toggleAnswer(e)},_toggleAnswer:function(e){var t=e.choiceValue();e.toggle(),this.activeIndex=e.selected?this.question.options.indexOf(e):null,this.dataValue=e.selected?t:null,this.isValid()&&this.question.nextStepOnAnswer&&!this.disabled&&this.$emit("next"),this.setAnswer(this.dataValue)},_removeAnswer:function(e){var t=this.dataValue.indexOf(e);-1!==t&&this.dataValue.splice(t,1)},iconScaleClasses:function(e){var t={};return this.isIconScale&&(this.isMobile||(t["f-hovered"]=this.hoveredIndex&&e<this.hoveredIndex),t["f-previous"]=this.activeIndex&&e<this.activeIndex),t}},computed:{hasValue:function(){return!!this.question.options.filter((function(e){return e.selected})).length}}},ge={class:"f-radios-wrap"},ye={class:"f-radios",role:"listbox"},ke=["onClick","onMouseover","aria-label"],we={key:0,class:"f-label-wrap"},qe={key:0,class:"f-label"},xe={key:1,class:"f-icon-wrap"},be=t.createElementVNode("div",{class:"f-icon"},[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[t.createElementVNode("path",{d:"M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z","stroke-width":".5"})])],-1),Ee={class:"f-key"},Ve={key:0,class:"f-label-scale-wrap"},Te={key:0,class:"f-label-scale"},Be=t.createElementVNode("span",{class:"f-label-scale-num"},"1 - ",-1),Ce={key:1,class:"f-label-scale"},Fe={class:"f-label-scale-num"};ve.render=function(e,n,i,s,o,r){return t.openBlock(),t.createElementBlock("div",ge,[t.createElementVNode("ul",ye,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.options,(function(e,i){return t.openBlock(),t.createElementBlock("li",{onClick:t.withModifiers((function(t){return r.toggleAnswer(e)}),["prevent"]),onMouseover:function(e){return o.isIconScale&&r.onMouseover(i)},onMouseleave:n[0]||(n[0]=function(e){return o.isIconScale&&r.onMouseleave()}),class:t.normalizeClass(Object.assign({},{"f-selected":e.selected},r.iconScaleClasses(i))),key:"m"+i,"aria-label":r.getLabel(e.value),role:"option"},[o.isIconScale?(t.openBlock(),t.createElementBlock("div",xe,[be,t.createElementVNode("div",Ee,t.toDisplayString(r.getToggleKey(e.value)),1)])):(t.openBlock(),t.createElementBlock("div",we,[e.choiceLabel()?(t.openBlock(),t.createElementBlock("span",qe,t.toDisplayString(e.choiceLabel()),1)):t.createCommentVNode("v-if",!0)]))],42,ke)})),128))]),o.isIconScale||!e.question.labelLeft&&!e.question.labelRight?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("div",Ve,[e.question.labelLeft?(t.openBlock(),t.createElementBlock("span",Te,[Be,t.createTextVNode(" "+t.toDisplayString(e.question.labelLeft),1)])):t.createCommentVNode("v-if",!0),e.question.labelRight?(t.openBlock(),t.createElementBlock("span",Ce,[t.createElementVNode("span",Fe,t.toDisplayString(e.question.options.length)+" - ",1),t.createTextVNode(" "+t.toDisplayString(e.question.labelRight),1)])):t.createCommentVNode("v-if",!0)]))])},ve.__file="src/components/QuestionTypes/OpinionScaleType.vue";var Le={extends:ve,name:i.IconRate,data:function(){return{isIconScale:!0}},__file:"src/components/QuestionTypes/IconRateType.vue"},Se={name:"FlowFormQuestion",components:{FlowFormDateType:X,FlowFormDropdownType:d,FlowFormEmailType:B,FlowFormLongTextType:F,FlowFormMultipleChoiceType:L,FlowFormMultiplePictureChoiceType:R,FlowFormNumberType:U,FlowFormPasswordType:j,FlowFormPhoneType:H,FlowFormSectionBreakType:Z,FlowFormTextType:E,FlowFormFileType:W,FlowFormUrlType:J,FlowFormMatrixType:te,FlowFormOpinionScaleType:ve,FlowFormIconRateType:Le},props:{question:a,language:n,value:[String,Array,Boolean,Number,Object],active:{type:Boolean,default:!1},reverse:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!0}},mixins:[c],data:function(){return{QuestionType:i,dataValue:null,debounced:!1}},mounted:function(){this.autofocus&&this.focusField(),this.dataValue=this.question.answer,this.$refs.qanimate.addEventListener("animationend",this.onAnimationEnd)},beforeUnmount:function(){this.$refs.qanimate.removeEventListener("animationend",this.onAnimationEnd)},methods:{focusField:function(){var e=this.$refs.questionComponent;e&&e.focus()},onAnimationEnd:function(){this.autofocus&&this.focusField()},shouldFocus:function(){var e=this.$refs.questionComponent;return e&&e.canReceiveFocus&&!e.focused},returnFocus:function(){this.$refs.questionComponent,this.shouldFocus()&&this.focusField()},onEnter:function(e){this.checkAnswer(this.emitAnswer)},onTab:function(e){this.checkAnswer(this.emitAnswerTab)},checkAnswer:function(e){var t=this,n=this.$refs.questionComponent;n.isValid()&&this.question.isMultipleChoiceType()&&this.question.nextStepOnAnswer&&!this.question.multiple?(this.$emit("disable",!0),this.debounce((function(){e(n),t.$emit("disable",!1)}),350)):e(n)},emitAnswer:function(e){e&&(e.focused||this.$emit("answer",e),e.onEnter())},emitAnswerTab:function(e){e&&this.question.type!==i.Date&&(this.returnFocus(),this.$emit("answer",e),e.onEnter())},debounce:function(e,t){var n;return this.debounced=!0,clearTimeout(n),void(n=setTimeout(e,t))},showOkButton:function(){var e=this.$refs.questionComponent;return this.question.type===i.SectionBreak?this.active:!this.question.required||(!(!this.question.allowOther||!this.question.other)||!(this.question.isMultipleChoiceType()&&!this.question.multiple&&this.question.nextStepOnAnswer)&&(!(!e||null===this.dataValue)&&(e.hasValue&&e.isValid())))},showSkip:function(){var e=this.$refs.questionComponent;return!(this.question.required||e&&e.hasValue)},showInvalid:function(){var e=this.$refs.questionComponent;return!(!e||null===this.dataValue)&&e.showInvalid()}},computed:{mainClasses:{cache:!1,get:function(){var e={"q-is-active":this.active,"q-is-inactive":!this.active,"f-fade-in-down":this.reverse,"f-fade-in-up":!this.reverse,"f-focused":this.$refs.questionComponent&&this.$refs.questionComponent.focused,"f-has-value":this.$refs.questionComponent&&this.$refs.questionComponent.hasValue};return e["field-"+this.question.type.toLowerCase().substring(8,this.question.type.length-4)]=!0,e}},showHelperText:function(){return!!this.question.subtitle||(this.question.type===i.LongText||this.question.type===i.MultipleChoice)&&this.question.helpTextShow},errorMessage:function(){var e=this.$refs.questionComponent;return e&&e.errorMessage?e.errorMessage:this.language.invalidPrompt}}},Ne={class:"q-inner"},Ae={key:0,class:"f-tagline"},Me={key:0,class:"fh2"},Oe={key:1,class:"f-text"},Qe=["aria-label"],Ie=[t.createElementVNode("span",{"aria-hidden":"true"},"*",-1)],De={key:1,class:"f-answer"},Ke={key:2,class:"f-sub"},_e={key:0},ze=["innerHTML"],Pe={key:2,class:"f-help"},$e={key:3,class:"f-help"},Re={key:3,class:"f-answer f-full-width"},Ue={key:0,class:"f-description"},je={key:0},He=["href","target"],Ze={key:0,class:"vff-animate f-fade-in f-enter"},Ge=["aria-label"],Ye={key:0},Je={key:1},Xe={key:2},We=["innerHTML"],et={key:1,class:"f-invalid",role:"alert","aria-live":"assertive"};Se.render=function(e,n,i,s,o,r){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vff-animate q-form",r.mainClasses]),ref:"qanimate"},[t.createElementVNode("div",Ne,[t.createElementVNode("div",{class:t.normalizeClass({"f-section-wrap":i.question.type===o.QuestionType.SectionBreak})},[t.createElementVNode("div",{class:t.normalizeClass({fh2:i.question.type!==o.QuestionType.SectionBreak})},[i.question.tagline?(t.openBlock(),t.createElementBlock("span",Ae,t.toDisplayString(i.question.tagline),1)):t.createCommentVNode("v-if",!0),i.question.title?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[i.question.type===o.QuestionType.SectionBreak?(t.openBlock(),t.createElementBlock("span",Me,t.toDisplayString(i.question.title),1)):(t.openBlock(),t.createElementBlock("span",Oe,[t.createTextVNode(t.toDisplayString(i.question.title)+"  ",1),t.createCommentVNode(" Required questions are marked by an asterisk (*) "),i.question.required?(t.openBlock(),t.createElementBlock("span",{key:0,class:"f-required","aria-label":i.language.ariaRequired,role:"note"},Ie,8,Qe)):t.createCommentVNode("v-if",!0),i.question.inline?(t.openBlock(),t.createElementBlock("span",De,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(i.question.type),{ref:"questionComponent",question:i.question,language:i.language,modelValue:o.dataValue,"onUpdate:modelValue":n[0]||(n[0]=function(e){return o.dataValue=e}),active:i.active,disabled:i.disabled,onNext:r.onEnter},null,8,["question","language","modelValue","active","disabled","onNext"]))])):t.createCommentVNode("v-if",!0)]))],2112)):t.createCommentVNode("v-if",!0),r.showHelperText?(t.openBlock(),t.createElementBlock("span",Ke,[i.question.subtitle?(t.openBlock(),t.createElementBlock("span",_e,t.toDisplayString(i.question.subtitle),1)):t.createCommentVNode("v-if",!0),i.question.type!==o.QuestionType.LongText||e.isMobile?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",{key:1,class:"f-help",innerHTML:i.question.helpText||i.language.formatString(i.language.longTextHelpText)},null,8,ze)),i.question.type===o.QuestionType.MultipleChoice&&i.question.multiple?(t.openBlock(),t.createElementBlock("span",Pe,t.toDisplayString(i.question.helpText||i.language.multipleChoiceHelpText),1)):i.question.type===o.QuestionType.MultipleChoice?(t.openBlock(),t.createElementBlock("span",$e,t.toDisplayString(i.question.helpText||i.language.multipleChoiceHelpTextSingle),1)):t.createCommentVNode("v-if",!0)])):t.createCommentVNode("v-if",!0),i.question.inline?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("div",Re,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(i.question.type),{ref:"questionComponent",question:i.question,language:i.language,modelValue:o.dataValue,"onUpdate:modelValue":n[1]||(n[1]=function(e){return o.dataValue=e}),active:i.active,disabled:i.disabled,onNext:r.onEnter},null,8,["question","language","modelValue","active","disabled","onNext"]))]))],2),i.question.description||0!==i.question.descriptionLink.length?(t.openBlock(),t.createElementBlock("p",Ue,[i.question.description?(t.openBlock(),t.createElementBlock("span",je,t.toDisplayString(i.question.description),1)):t.createCommentVNode("v-if",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.question.descriptionLink,(function(e,n){return t.openBlock(),t.createElementBlock("a",{class:"f-link",key:"m"+n,href:e.url,target:e.target},t.toDisplayString(e.text||e.url),9,He)})),128))])):t.createCommentVNode("v-if",!0)],2),r.showOkButton()?(t.openBlock(),t.createElementBlock("div",Ze,[t.createElementVNode("button",{class:"o-btn-action",type:"button",ref:"button",href:"#",onClick:n[2]||(n[2]=t.withModifiers((function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onEnter&&r.onEnter.apply(r,e)}),["prevent"])),"aria-label":i.language.ariaOk},[i.question.type===o.QuestionType.SectionBreak?(t.openBlock(),t.createElementBlock("span",Ye,t.toDisplayString(i.language.continue),1)):r.showSkip()?(t.openBlock(),t.createElementBlock("span",Je,t.toDisplayString(i.language.skip),1)):(t.openBlock(),t.createElementBlock("span",Xe,t.toDisplayString(i.language.ok),1))],8,Ge),i.question.type===o.QuestionType.LongText&&e.isMobile?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("a",{key:0,class:"f-enter-desc",href:"#",onClick:n[3]||(n[3]=t.withModifiers((function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r.onEnter&&r.onEnter.apply(r,e)}),["prevent"])),innerHTML:i.language.formatString(i.language.pressEnter)},null,8,We))])):t.createCommentVNode("v-if",!0),r.showInvalid()?(t.openBlock(),t.createElementBlock("div",et,t.toDisplayString(r.errorMessage),1)):t.createCommentVNode("v-if",!0)])],2)},Se.__file="src/components/FlowFormQuestion.vue";var tt={},nt={methods:{getInstance:function(e){return tt[e]},setInstance:function(){tt[this.id]=this}}},it={name:"FlowForm",components:{FlowFormQuestion:Se},props:{questions:{type:Array,validator:function(e){return e.every((function(e){return e instanceof a}))}},language:{type:n,default:function(){return new n}},progressbar:{type:Boolean,default:!0},standalone:{type:Boolean,default:!0},navigation:{type:Boolean,default:!0},timer:{type:Boolean,default:!1},timerStartStep:[String,Number],timerStopStep:[String,Number],autofocus:{type:Boolean,default:!0}},mixins:[c,nt],data:function(){return{questionRefs:[],completed:!1,submitted:!1,activeQuestionIndex:0,questionList:[],questionListActivePath:[],reverse:!1,timerOn:!1,timerInterval:null,time:0,disabled:!1}},mounted:function(){document.addEventListener("keydown",this.onKeyDownListener),document.addEventListener("keyup",this.onKeyUpListener,!0),window.addEventListener("beforeunload",this.onBeforeUnload),this.setQuestions(),this.checkTimer()},beforeUnmount:function(){document.removeEventListener("keydown",this.onKeyDownListener),document.removeEventListener("keyup",this.onKeyUpListener,!0),window.removeEventListener("beforeunload",this.onBeforeUnload),this.stopTimer()},beforeUpdate:function(){this.questionRefs=[]},computed:{numActiveQuestions:function(){return this.questionListActivePath.length},activeQuestion:function(){return this.questionListActivePath[this.activeQuestionIndex]},activeQuestionId:function(){var e=this.questionModels[this.activeQuestionIndex];return this.isOnLastStep?"_submit":e&&e.id?e.id:null},numCompletedQuestions:function(){var e=0;return this.questionListActivePath.forEach((function(t){t.answered&&++e})),e},percentCompleted:function(){return this.numActiveQuestions?Math.floor(this.numCompletedQuestions/this.numActiveQuestions*100):0},isOnLastStep:function(){return this.numActiveQuestions>0&&this.activeQuestionIndex===this.questionListActivePath.length},isOnTimerStartStep:function(){return this.activeQuestionId===this.timerStartStep||!this.timerOn&&!this.timerStartStep&&0===this.activeQuestionIndex},isOnTimerStopStep:function(){return!!this.submitted||this.activeQuestionId===this.timerStopStep},questionModels:{cache:!1,get:function(){var e=this;if(this.questions&&this.questions.length)return this.questions;var t=[];if(!this.questions){var n={options:o,descriptionLink:r},s=this.$slots.default&&this.$slots.default(),l=null;s&&s.length&&((l=s[0].children)||(l=s)),l&&l.filter((function(e){return e.type&&"object"==typeof e.type&&-1!==e.type.name.indexOf("Question")})).forEach((function(s){var o=s.props,r=e.getInstance(o.id),l=new a;null!==r.question&&(l=r.question),o.modelValue&&(l.answer=o.modelValue),Object.keys(l).forEach((function(e){if(void 0!==o[e])if("boolean"==typeof l[e])l[e]=!1!==o[e];else if(e in n){var t=n[e],s=[];o[e].forEach((function(e){var n=new t;Object.keys(n).forEach((function(t){void 0!==e[t]&&(n[t]=e[t])})),s.push(n)})),l[e]=s}else if("type"===e){if(-1!==Object.values(i).indexOf(o[e]))l[e]=o[e];else for(var r in i)if(r.toLowerCase()===o[e].toLowerCase()){l[e]=i[r];break}}else l[e]=o[e]})),r.question=l,l.resetOptions(),t.push(l)}))}return t}}},methods:{setQuestionRef:function(e){t