vue-flow-form-rate
Version:
Create conversational conditional-logic forms with Vue.js.
6 lines • 54.2 kB
JavaScript
!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",Rate:"FlowFormRateType"});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.value=e,this.selected=!1};r.prototype.choiceValue=function(){return this.value},r.prototype.toggle=function(){this.selected=!this.selected};var a=function(e){this.url="",this.text="",this.target="_blank",Object.assign(this,e)},l=function(e,t){if(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.range=null,this.ranges=[],Object.assign(this,e),this.type===i.Rate&&null!==this.range){this.ranges=[];for(var n=1;n<=this.range;n++)this.ranges.push(new r(n))}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.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()};l.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},l.prototype.setAnswer=function(e){this.type!==i.Number||""===e||isNaN(+e)||(e=+e),this.answer=e},l.prototype.setIndex=function(e){this.id||(this.id="q_"+e),this.index=e},l.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)}}},l.prototype.resetAnswer=function(){this.answered=!1,this.answer=this.multiple?[]:null,this.other=null,this.resetOptions()},l.prototype.isMultipleChoiceType=function(){return[i.MultipleChoice,i.MultiplePictureChoice,i.Rate].includes(this.type)};var u=!1,h=!1;"undefined"!=typeof navigator&&"undefined"!=typeof document&&(u=navigator.userAgent.match(/iphone|ipad|ipod/i)||-1!==navigator.userAgent.indexOf("Mac")&&"ontouchend"in document,h=u||navigator.userAgent.match(/android/i));var c={data:function(){return{isIos:u,isMobile:h}}},p={name:"FlowFormBaseType",props:{language:n,question:l,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:p,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"))}}},m={class:"faux-form"},f=["value","required"],v={key:0,label:" ",value:"",disabled:"",selected:"",hidden:""},g=["disabled","value"],y=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 w(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[h=t[s]],l=e[o];a&&!a.escape?(a.pattern.test(l)&&(r+=a.transform?a.transform(l):l,s++),o++):(a&&a.escape&&(h=t[++s]),n&&(r+=h),l===h&&o++,s++)}for(var u="";s<t.length&&n;){var h;if(i[h=t[s]]){u="";break}u+=h,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""}}(w,t,i)(e,t,n,i):w(e,t,n,i)}d.render=function(e,n,i,s,o,r){return t.openBlock(),t.createElementBlock("span",m,[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",v," ")):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,g)})),128))],40,f),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),y])])},d.__file="src/components/QuestionTypes/DropdownType.vue";var q={"#":{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 x(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}var b={name:"TheMask",props:{value:[String,Number],mask:{type:[String,Array],required:!0},masked:{type:Boolean,default:!1},tokens:{type:Object,default:function(){return q}}},directives:{mask:function(e,t){var n=t.value;if((Array.isArray(n)||"string"==typeof n)&&(n={mask:n,tokens:q}),"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(x("input"))}};var s=k(e.value,n.mask,!0,n.tokens);s!==e.value&&(e.value=s,e.dispatchEvent(x("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))}}},T=["value"];b.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,T)),[[a,r.config]])},b.__file="node_modules/vue-the-mask/src/component.vue";var E={extends:p,name:i.Text,components:{TheMask:b},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"],B=["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,B))],8,V)},E.__file="src/components/QuestionTypes/TextType.vue";var C={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"},F={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()}};F.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]])},F.__file="node_modules/vue-textarea-autosize/src/components/TextareaAutosize.vue";var L={extends:p,name:i.LongText,components:{TextareaAutosize:F},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()}}};L.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"])])},L.__file="src/components/QuestionTypes/LongTextType.vue";var A={extends:p,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"],O={key:0,class:"f-image"},M=["src","alt"],Q={class:"f-label-wrap"},K={class:"f-key"},D={key:0,class:"f-label"},I=["aria-label"],P={class:"f-label-wrap"},_={key:0,class:"f-key"},z={key:2,class:"f-selected"},$={class:"f-label"},U={key:3,class:"f-label"};A.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",O,[t.createElementVNode("img",{src:e.imageSrc,alt:e.imageAlt},null,8,M)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",Q,[t.createElementVNode("span",K,t.toDisplayString(r.getToggleKey(n)),1),e.choiceLabel()?(t.openBlock(),t.createElementBlock("span",D,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",P,[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",$,t.toDisplayString(e.question.other),1)])):(t.openBlock(),t.createElementBlock("span",U,t.toDisplayString(e.language.otherPrompt),1))])],10,I)):t.createCommentVNode("v-if",!0)],2)])},A.__file="src/components/QuestionTypes/MultipleChoiceType.vue";var R={extends:A,name:i.MultiplePictureChoice,data:function(){return{hasImages:!0}},__file:"src/components/QuestionTypes/MultiplePictureChoiceType.vue"},H={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"},Z={extends:E,name:i.Phone,data:function(){return{inputType:"tel",canReceiveFocus:!0}},__file:"src/components/QuestionTypes/PhoneType.vue"},Y={extends:p,name:i.SectionBreak,methods:{onEnter:function(){this.dirty=!0,this._onEnter()},isValid:function(){return!0}}},J={key:0,class:"f-content"},G={class:"f-section-text"};Y.render=function(e,n,i,s,o,r){return e.question.content?(t.openBlock(),t.createElementBlock("div",J,[t.createElementVNode("span",G,t.toDisplayString(e.question.content),1)])):t.createCommentVNode("v-if",!0)},Y.__file="src/components/QuestionTypes/SectionBreakType.vue";var X={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"},W={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"},ee={extends:E,name:i.File,mounted:function(){this.question.accept&&(this.mimeTypeRegex=new RegExp(this.question.accept.replace("*","[^\\/,]+")))},methods:{setAnswer:function(e){this.question.setAnswer(this.files),this.answer=e,this.question.answered=this.isValid(),this.$emit("update:modelValue",e)},showInvalid:function(){return null!==this.errorMessage},validate:function(){var e=this;if(this.errorMessage=null,this.question.required&&!this.hasValue)return!1;if(this.question.accept&&!Array.from(this.files).every((function(t){return e.mimeTypeRegex.test(t.type)})))return this.errorMessage=this.language.formatString(this.language.errorAllowedFileTypes,{fileTypes:this.question.accept}),!1;if(this.question.multiple){var t=this.files.length;if(null!==this.question.min&&t<+this.question.min)return this.errorMessage=this.language.formatString(this.language.errorMinFiles,{min:this.question.min}),!1;if(null!==this.question.max&&t>+this.question.max)return this.errorMessage=this.language.formatString(this.language.errorMaxFiles,{max:this.question.max}),!1}if(null!==this.question.maxSize&&Array.from(this.files).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.$refs.input.checkValidity()}},computed:{files:function(){return this.$refs.input.files}}},te=["accept","multiple","value","required"];ee.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,te)},ee.__file="src/components/QuestionTypes/FileType.vue";var ne={extends:p,name:i.Rate,data:function(){return{editingOther:!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.ranges[n];i?this.toggleAnswer(i):this.question.allowOther&&n===this.question.ranges.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.ranges.length;t++){var n=this.question.ranges[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.ranges.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.ranges.filter((function(e){return e.selected})).length||!!this.question.allowOther&&(this.question.other&&this.question.other.trim().length>0)}}},ie={class:"f-radios-wrap"},se=["onClick","aria-label"],oe={class:"f-num"};ne.render=function(e,n,i,s,o,r){return t.openBlock(),t.createElementBlock("div",ie,[t.createElementVNode("ul",{class:t.normalizeClass(["f-num-range",{"f-multiple":e.question.multiple}]),role:"listbox"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.ranges,(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},"f-num-wrapper"]),key:"m"+n,"aria-label":r.getLabel(n),role:"option"},[t.createElementVNode("span",oe,t.toDisplayString(e.value),1)],10,se)})),128))],2)])},ne.__file="src/components/QuestionTypes/RateType.vue";var re={name:"FlowFormQuestion",components:{FlowFormDateType:W,FlowFormDropdownType:d,FlowFormEmailType:C,FlowFormLongTextType:L,FlowFormMultipleChoiceType:A,FlowFormMultiplePictureChoiceType:R,FlowFormNumberType:H,FlowFormPasswordType:j,FlowFormPhoneType:Z,FlowFormSectionBreakType:Y,FlowFormTextType:E,FlowFormFileType:ee,FlowFormUrlType:X,FlowFormRateType:ne},props:{question:l,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}}},ae={class:"q-inner"},le={key:0,class:"f-tagline"},ue={key:0,class:"fh2"},he={key:1,class:"f-text"},ce=["aria-label"],pe=[t.createElementVNode("span",{"aria-hidden":"true"},"*",-1)],de={key:1,class:"f-answer"},me={key:2,class:"f-sub"},fe={key:0},ve=["innerHTML"],ge={key:2,class:"f-help"},ye={key:3,class:"f-help"},we={key:3,class:"f-answer f-full-width"},ke={key:0,class:"f-description"},qe={key:0},xe=["href","target"],be={key:0,class:"vff-animate f-fade-in f-enter"},Te=["aria-label"],Ee={key:0},Ve={key:1},Be={key:2},Ce=["innerHTML"],Fe={key:1,class:"f-invalid",role:"alert","aria-live":"assertive"};re.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",ae,[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",le,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",ue,t.toDisplayString(i.question.title),1)):(t.openBlock(),t.createElementBlock("span",he,[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"},pe,8,ce)):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",me,[i.question.subtitle?(t.openBlock(),t.createElementBlock("span",fe,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,ve)),i.question.type===o.QuestionType.MultipleChoice&&i.question.multiple?(t.openBlock(),t.createElementBlock("span",ge,t.toDisplayString(i.question.helpText||i.language.multipleChoiceHelpText),1)):i.question.type===o.QuestionType.MultipleChoice?(t.openBlock(),t.createElementBlock("span",ye,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",we,[(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",ke,[i.question.description?(t.openBlock(),t.createElementBlock("span",qe,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,xe)})),128))])):t.createCommentVNode("v-if",!0)],2),r.showOkButton()?(t.openBlock(),t.createElementBlock("div",be,[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",Ee,t.toDisplayString(i.language.continue),1)):r.showSkip()?(t.openBlock(),t.createElementBlock("span",Ve,t.toDisplayString(i.language.skip),1)):(t.openBlock(),t.createElementBlock("span",Be,t.toDisplayString(i.language.ok),1))],8,Te),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,Ce))])):t.createCommentVNode("v-if",!0),r.showInvalid()?(t.openBlock(),t.createElementBlock("div",Fe,t.toDisplayString(r.errorMessage),1)):t.createCommentVNode("v-if",!0)])],2)},re.__file="src/components/FlowFormQuestion.vue";var Le={},Ae={methods:{getInstance:function(e){return Le[e]},setInstance:function(){Le[this.id]=this}}},Se={name:"FlowForm",components:{FlowFormQuestion:re},props:{questions:{type:Array,validator:function(e){return e.every((function(e){return e instanceof l}))}},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,Ae],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:a},s=this.$slots.default(),r=null;s&&s.length&&((r=s[0].children)||(r=s)),r&&r.filter((function(e){return e.type&&-1!==e.type.name.indexOf("Question")})).forEach((function(s){var o=s.props,r=e.getInstance(o.id),a=new l;null!==r.question&&(a=r.question),o.modelValue&&(a.answer=o.modelValue),Object.keys(a).forEach((function(e){if(void 0!==o[e])if("boolean"==typeof a[e])a[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)})),a[e]=s}else if("type"===e){if(-1!==Object.values(i).indexOf(o[e]))a[e]=o[e];else for(var r in i)if(r.toLowerCase()===o[e].toLowerCase()){a[e]=i[r];break}}else a[e]=o[e]})),r.question=a,a.resetOptions(),t.push(a)}))}return t}}},methods:{setQuestionRef:function(e){this.questionRefs.push(e)},activeQuestionComponent:function(){return this.questionRefs[this.activeQuestionIndex]},setQuestions:function(){this.setQuestionListActivePath(),this.setQuestionList()},setQuestionListActivePath:function(){var e=[];if(this.questionModels.length){var t,n=0,i=0,s=this.activeQuestionIndex;do{var o=this.questionModels[n];if(o.setIndex(i),o.language=this.language,e.push(o),o.jump)if(o.answered)if(t=o.getJumpId()){if("_submit"===t)n=this.questionModels.length;else for(var r=0;r<this.questionModels.length;r++)if(this.questionModels[r].id===t){r<n?(o.answered=!1,s=r,++n):n=r;break}}else++n;else n=this.questionModels.length;else++n;++i}while(n<this.questionModels.length);this.questionListActivePath=e,this.goToQuestion(s)}},setQuestionList:function(){for(var e=[],t=0;t<this.questionListActivePath.length;t++){var n=this.questionListActivePath[t];if(e.push(n),!n.answered){this.completed&&(this.completed=!1);break}}this.questionList=e},onBeforeUnload:function(e){this.activeQuestionIndex>0&&!this.submitted&&(e.preventDefault(),e.returnValue="")},onKeyDownListener:function(e){if("Tab"===e.key&&!this.submitted)if(e.shiftKey)e.stopPropagation(),e.preventDefault(),this.navigation&&this.goToPreviousQuestion();else{var t=this.activeQuestionComponent();t.shouldFocus()?(e.preventDefault(),t.focusField()):(e.stopPropagation(),this.emitTab(),this.reverse=!1)}},onKeyUpListener:function(e){if(!e.shiftKey&&-1!==["Tab","Enter"].indexOf(e.key)&&!this.submitted){var t=this.activeQuestionComponent();"Tab"===e.key&&t.shouldFocus()?t.focusField():("Enter"===e.key&&this.emitEnter(),e.stopPropagation(),this.reverse=!1)}},emitEnter:function(){if(!this.disabled){var e=this.activeQuestionComponent();e?e.onEnter():this.completed&&this.isOnLastStep&&this.submit()}},emitTab:function(){var e=this.activeQuestionComponent();e?e.onTab():this.emitEnter()},submit:function(){this.emitSubmit(),this.submitted=!0},emitComplete:function(){this.$emit("complete",this.completed,this.questionList)},emitSubmit:function(){this.$emit("submit",this.questionList)},isNextQuestionAvailable:function(){if(this.submitted)return!1;var e=this.activeQuestion;return!(!e||e.required)||(!(!this.completed||this.isOnLastStep)||this.activeQuestionIndex<this.questionList.length-1)},onQuestionAnswered:function(e){var t=this;e.isValid()?(this.$emit("answer",e.question),this.activeQuestionIndex<this.questionListActivePath.length&&++this.activeQuestionIndex,this.$nextTick((function(){t.reverse=!1,t.setQuestions(),t.checkTimer(),t.$nextTick((function(){var e=t.activeQuestionComponent();e?(t.autofocus&&e.focusField(),t.activeQuestionIndex=e.question.index):t.isOnLastStep&&(t.completed=!0,t.activeQuestionIndex=t.questionListActivePath.length,t.$refs.button&&t.$refs.button.focus()),t.$emit("step",t.activeQuestionId,t.activeQuestion)}))}))):this.completed&&(this.completed=!1)},goToPreviousQuestion:function(){this.blurFocus(),this.activeQuestionIndex>0&&!this.submitted&&(this.isOnTimerStopStep&&this.startTimer(),--this.activeQuestionIndex,this.reverse=!0,this.checkTimer())},goToNextQuestion:function(){this.blurFocus(),this.isNextQuestionAvailable()&&this.emitEnter(),this.reverse=!1},goToQuestion:function(e){if(isNaN(+e)){var t=this.activeQuestionIndex;this.questionListActivePath.forEach((function(n,i){n.id===e&&(t=i)})),e=t}if(e!==this.activeQuestionIndex&&(this.blurFocus(),!this.submitted&&e<=this.questionListActivePath.length-1)){do{if(this.questionListActivePath.slice(0,e).every((function(e){return e.answered})))break;--e}while(e>0);this.reverse=e<this.activeQuestionIndex,this.activeQuestionIndex=e,this.checkTimer()}},blurFocus:function(){document.activeElement&&document.activeElement.blur&&document.activeElement.blur()},checkTimer:function(){this.timer&&(this.isOnTimerStartStep?this.startTimer():this.isOnTimerStopStep&&this.stopTimer())},startTimer:function(){this.timer&&!this.timerOn&&(this.timerInterval=setInterval(this.incrementTime,1e3),this.timerOn=!0)},stopTimer:function(){this.timerOn&&clearInterval(this.timerInterval),this.timerOn=!1},incrementTime:function(){++this.time,this.$emit("timer",this.time,this.formatTime(this.time))},formatTime:function(e){var t=14,n=5;return e>=3600&&(t=11,n=8),new Date(1e3*e).toISOString().substr(t,n)},setDisabled:function(e){this.disabled=e},reset:function(){this.questionModels.forEach((function(e){return e.resetAnswer()})),this.goToQuestion(0)}},watch:{completed:function(){this.emitComplete()},submitted:function(){this.stopTimer()}}},Ne={class:"f-container"},Oe={class:"f-form-wrap"},Me={key:0,class:"vff-animate f-fade-in-up field-submittype"},Qe={class:"f-section-wrap"},Ke={class:"fh2"},De=["aria-label"],Ie=["innerHTML"],Pe={key:2,class:"text-success"},_e={class:"vff-footer"},ze={class:"footer-inner-wrap"},$e={class:"f-progress-bar"},Ue={key:1,class:"f-nav"},Re=["aria-label"],He=t.createElementVNode("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"42.333px",height:"28.334px",viewBox:"78.833 5.5 42.333 28.334","aria-hidden":"true"},[t.createElementVNode("path",{d:"M82.039,31.971L100,11.442l17.959,20.529L120,30.187L101.02,8.492c-0.258-0.295-0.629-0.463-1.02-0.463c-0.39,0-0.764,0.168-1.02,0.463L80,30.187L82.039,31.971z"})],-1),je={class:"f-nav-text","aria-hidden":"true"},Ze=["aria-label"],Ye=t.createElementVNode("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"42.333px",height:"28.334px",viewBox:"78.833 5.5 42.333 28.334","aria-hidden":"true"},[t.createElementVNode("path",{d:"M117.963,8.031l-17.961,20.529L82.042,8.031l-2.041,1.784l18.98,21.695c0.258,0.295,0.629,0.463,1.02,0.463c0.39,0,0.764-0.168,1.02-0.463l18.98-21.695L117.963,8.031z"})],-1),Je={class:"f-nav-text","aria-hidden":"true"},Ge={key:2,class:"f-timer"};Se.render=function(e,n,i,s,o,r){var a=t.