Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw TypeError("'this' is null or not defined");var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw TypeError("predicate must be a function");for(var i=arguments[1],r=0;r0&&e.each(d,function(e,n){"change"!==n?s[n](i.debounce(function(e){e.stopPropagation(),t._handleValueChange()},epi.EPiServer.Forms.ThrottleTimeout,t)):s[n](function(){t._handleValueChange.apply(t)})}),e(o).on("formsDependencyStateChanged",function(e,n){t._handleValueChange.apply(t)}),n.push(a.fieldName)}}},runCheck:function(){this._handleValueChange()},_handleValueChange:function(){var t=this.isSatisfied;this.isSatisfied=this._checkSatisfaction(),this.isSatisfied!==t&&e(this).trigger("change",{isSatisfied:this.isSatisfied})},_checkSatisfaction:function(){if(!this.conditions||this.conditions.length<=0)return!0;for(var e=0;e=0||((l=document.createElement("script")).type="text/javascript",l.async=n||!1,l.defer=n||!1,l.src=s,r.appendChild(l),i.LoadedScripts.push(s));l?i._setupCallback(l,t):t()},loadExternalCssOnDemand:function(e,t){for(var n=document.getElementsByTagName("head")[0],r=0,a=e.length,o=null;r").text(t).html()},htmlDecodeEntities:function(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value},isMatchedReg:function(e,t){try{var n=new RegExp(t).exec(e);return null!=n&&n.length>0}catch(e){return console.debug(e.message),!1}},raiseFormsEvent:function(t,n){var i=e.extend(!0,{type:"forms",workingFormInfo:t},n);if(t)t.$workingForm.triggerHandler(i);else{var r=e('.EPiServerForms:eq(0), [data-f-type="form"]:first');(!r||r.length<1)&&(r=e("body")),r.triggerHandler(i)}},injectVisitorData:function(t){var n=e(".FormHidden[data-epiforms-visitordatasources], [data-f-visitordatasources]",t.$workingForm);if(n&&0!==n.length){var i=null;n.each(function(){if((i=e(this))&&i.length>0){var t=null,n=i.data("epiforms-visitordatasources")||i.data("f-visitordatasources");e(n.split(",")).each(function(e,n){"function"==typeof(t=epi.EPiServer.Forms.VisitorData[n])&&t(i)})}})}},isElementType:function(e,t){return e.data("f-type")===t},getElementName:function(e){return e.attr("name")||e.data("epiforms-element-name")||e.data("f-element-name")},getElementValue:function(t){return t.hasClass("FormFileUpload")||i.isElementType(t,"fileupload")?i.getPreviousPostedFiles(t):t.hasClass("FormChoice")||i.isElementType(t,"choice")?t.find(".FormChoice__Input:checked, [data-f-datainput]:checked").map(function(t,n){return e(n).val()}).get():t.hasClass("FormSelection")||i.isElementType(t,"selection")?[].concat(t.find("select").val()):t.hasClass("FormCaptcha")||t.hasClass("FormTextbox")||t.hasClass("FormTextbox--Textarea")||i.isElementType(t,"captcha")||i.isElementType(t,"textbox")?e.trim(e(".FormTextbox__Input, [data-f-datainput]",t).val()):t.hasClass("FormRange")||i.isElementType(t,"range")?e.trim(e(".FormRange__Input, [data-f-datainput]",t).val()):t.hasClass("Form__CustomElement")||i.isElementType(t,"custom")?epi.EPiServer.Forms.Extension.getCustomElementValue(t):i.getNonSpecificElementValue(t)},getFormStepBlock:function(e,t){return console.warn("This is obsolete. Use getFormElementBlock() instead."),i.getFormElementBlock(e,t)},getFormElementBlock:function(t,n){if(!t)return[];var i=e(".Form__Element [data-epiforms-element-name='"+t+"']",n);return i&&i.length||(i=e("[data-f-element-name='"+t+"']",n)),i},getWorkingFormFromInnerElement:function(t){return e(t).parents(".EPiServerForms:first, [data-f-type='form']:first")},getFormIdentifier:function(e){return e.prop("id")},getPreviousPostedFiles:function(t){var n=t.find(".FormFileUpload__Input, [data-f-datainput]"),r=i.getElementName(n),a=i.getWorkingFormFromInnerElement(n),o=epi.EPiServer.Forms.Utils.getFormIdentifier(a),s=epi.EPiServer.Forms.Data.loadFormDataFromStorage(o),l=n[0].files;return e.each(s,function(e,t){if(-1!=e.indexOf("__TempData")&&e.replace("__TempData","")==r&&0==l.length)return l=t,!1}),l},getNonSpecificElementValue:function(t){if(!t.attr("data-f-element-name"))return e.trim(t.val());var n=t.find(":input");if(0==n.length)return e.trim(t.val());if("input"!=n[0].tagName.toLowerCase())return e.trim(e(n[0]).val());var i=n[0].type.toLowerCase();return"checkbox"==i||"radio"==i?n.filter(":checked").map(function(t,n){return e(n).val()}).get():e.trim(e(n[0]).val())},getCurrentStepIndex:function(t){var n=e("input[name=__FormCurrentStepIndex]",t.$workingForm).val();return void 0===n||""===n.trim()||isNaN(+n)||+n>t.StepsInfo.Steps.length-1?t.StepsInfo.AllStepsAreNotLinked?n=0:e.each(t.StepsInfo.Steps,function(e,i){if(i.attachedContentLink==epi.EPiServer.CurrentPageLink&&a.isStepSatisfyDependentCondition(i,t))return n=e,!1}):n=+n,n},setCurrentStepIndex:function(t,n){return e("input[name=__FormCurrentStepIndex]",t.$workingForm).val(n),n},validateRegularExpressionValidator:function(e,t,n){return n&&n.model&&n.model.jsPattern&&""!==t?i.isMatchedReg(t,n.model.jsPattern)?{isValid:!0}:{isValid:!1,message:i.stringFormat(n.model.message,[n.model.jsPattern,n.description])}:{isValid:!0}},showNextStepOnEnterKeyDown:function(t){var n=i.getWorkingFormFromInnerElement(t.target),r=t.keyCode,a=e(".Form__NavigationBar .Form__NavigationBar__Action.btnNext, [data-f-type='navigationbar'] [data-f-navigation-next]",n),o=e(".Form__Element.FormSubmitButton, [data-f-type='submitbutton']",n).parent(".FormStep, [data-f-type='step']").filter(function(t){return!e(this).hasClass("hide")});return 13!=r||0!=o.length||null==a||!a.length||(t.preventDefault(),t.stopPropagation(),a.trigger("click"),!0)},scrollToTheTopOfForm:function(t){null!=t&&"fixed"!==t.css("position").toLowerCase()&&e(document).scrollTop()>0&&window.scrollTo(0,t.offset().top)}},Extension:{getSummarizedText:function(t,n,r){var a=r?"
":"\n",o=r?t.ConfirmMessage:i.htmlDecodeEntities(t.ConfirmMessage),s=t.ElementsInfo,l=[],d=[],m=["__FormGuid","__FormLanguage","__FormCurrentStepIndex","__FormSubmissionId"],p=t.ConfirmMessage?o+a+a:"",f=null,u=null;for(var c in n)if(-1==l.indexOf(c.replace("__TempData",""))&&!i.isInactiveField(t,c)){var g=-1!==c.indexOf("__TempData")?s[c.replace("__TempData","")]:s[c];f=g&&g.friendlyName?g.friendlyName:"",(null==(u=g&&1==g.customBinding?epi.EPiServer.Forms.CustomBindingElements[g.type](g,n[c]):n[c])||u instanceof Array&&0===u.length||e.isEmptyObject(u))&&(u=""),u instanceof Array?u=e.map(u,function(e,t){return e?"string"==typeof e?e:"object"==typeof e?e.name:void 0:null}).join(", "):u instanceof FileList&&0===u.length?u="":(u=u.toString().substr(0,46).trim()).length>=45&&(u+=" ..."),e("[name="+c+"]",t.$workingForm).hasClass("FormHideInSummarized")&&d.push(c),""==f||null==f||""==u||null==u||m.indexOf(c)>=0||d.indexOf(c)>=0||(l.push(c),p+=r?i.stringFormat("{0}: {1}"+a,[i.htmlEncodeEntities(f),i.htmlEncodeEntities(u)]):i.stringFormat("{0}: {1}"+a,[i.htmlDecodeEntities(f),u]))}return p},showSummarizedText:function(t,n,i,r){var a=e.Deferred(),o=this.getSummarizedText(n,t,!1);return o&&""!==o.trim()?(setTimeout(function(){var e=confirm(o);a.resolve(e)},100),a.promise()):(a.resolve(!0),a.promise())},getCustomElementValue:function(e){return e.val()||e.find("[data-f-datainput]").val()},bindCustomElementValue:function(e,t){e.find(".Form__CustomInput, [data-f-datainput]").val(t)},resetCustomElementValue:function(e){e.find(".Form__CustomInput, [data-f-datainput]").val("")},getAllDataElements:function(t){return e(".Form__Element, .Form__CustomElement, [data-f-type]",t).not(".FormStep,.FormSubmitButton,.Form__Element--NonData,[data-f-type='step'],[data-f-type='form'],[data-f-type='resetbutton'],[data-f-type='submitbutton'],[data-f-element-nondata]")},isStepSatisfyDependentCondition:function(e,t){if(!e)return!1;var n=e.dependField,i=r.loadFormDataFromStorage(t.Id),a=epi.EPiServer.Forms.DependConditions[e.dependCondition];return!(n&&a&&i)||(l._isInactiveElement(n,t)?a(null,e.dependValue):a(i[n],e.dependValue))},getAntiForgeryToken:function(t){return{antiForgeryToken:e('input[name="__RequestVerificationToken"]',t.$workingForm).val()}},buildSubmitRequestHeader:function(t){var n={},i=this.getAntiForgeryToken(t);return e.extend(n,i),n}},Data:{loadCurrentFormDataFromStorage:function(e){var t=epi.EPiServer.Forms.Utils.getFormIdentifier(e);return this.loadFormDataFromStorage(t)},loadFormDataFromStorage:function(t){var n=this.getStorage()[t];return n&&(n=e.parseJSON(n))||{}},saveCurrentFormDataToStorage:function(e,t){var n=epi.EPiServer.Forms.Utils.getFormIdentifier(e);return this.saveFormDataToStorage(n,t)},saveFormDataToStorage:function(e,t){var n=this.getStorage();try{n.setItem(e,JSON.stringify(t))}catch(e){console.log("Local Storage not supported: "+e.message)}return t},clearFormDataInStorage:function(e){removeFormDataInStorage(epi.EPiServer.Forms.Utils.getFormIdentifier(e))},removeFormDataInStorage:function(e){this.getStorage().removeItem(e)},getStorage:function(){return sessionStorage}},Validation:{getValidatorByValidatorType:function(e,t){if(e instanceof Array&&0!==e.length&&t)for(var n=0,i=null,r=e.length;n=0&&e.workingFormInfo.DependencyInactiveElements.splice(t,1)}else e.$domElement.hide(this.Config.HideDuration),e.workingFormInfo.DependencyInactiveElements.push(e.dependantInfo.fieldName)},hide:function(e){if(e.isSatisfied)e.$domElement.hide(this.Config.HideDuration),e.$domElement.addClass("hide"),e.workingFormInfo.DependencyInactiveElements.push(e.dependantInfo.fieldName);else{e.$domElement.show(this.Config.ShowDuration);var t=e.workingFormInfo.DependencyInactiveElements&&e.workingFormInfo.DependencyInactiveElements.indexOf(e.dependantInfo.fieldName);t>=0&&e.workingFormInfo.DependencyInactiveElements.splice(t,1)}}},DependantController:t,Dependant:n,_initDependencyInfos:function(e){var t=e.DependenciesInfo;if(t&&!(t.length<=0)){e.DependantControllers=[];for(var n=0;n=0)){var a=i.getCurrentStepIndex(n),o=e(n.$steps[a]);return e(t,o).length>0?i.getElementValue(t):epi.EPiServer.Forms.Data.loadCurrentFormDataFromStorage(n.$workingForm)[r]}}},_getTriggerEventForDependeeElement:function(e){return i.isElementType(e,"textbox")?"keyup":"change"},_getTriggerEventsForDependeeElement:function(e){return i.isElementType(e,"textbox")?"number"===e.attr("data-f-modifier")?["keyup","change"]:["keyup"]:["change"]},_isElementOfInactiveSteps:function(t,n){var i=n.StepsInfo.Steps.filter(function(e){return!1===e.isActive});if(0===i.length)return!1;for(var r=0;r0)for(;p>>0))}(i)).length<1||(o=o.toLowerCase(),r.indexOf(o)>=0||!(a.length<1||a.indexOf(o)>-1)))return{isValid:!1,message:epi.EPiServer.Forms.Utils.stringFormat(n.model.message,[l])};return{isValid:!0}},"EPiServer.Forms.Implementation.Validation.MaxFileSizeValidator":function(e,t,n){for(var i=t,r=0,a=i.length,o=n.model.sizeInBytes;ro)return{isValid:!1,message:epi.EPiServer.Forms.Utils.stringFormat(n.model.message,[o/1048576])};return{isValid:!0}},"EPiServer.Forms.Implementation.Validation.NumericValidator":function(t,n,i){return n&&1!=e.isNumeric(n)?{isValid:!1,message:i.model.message}:{isValid:!0}},"EPiServer.Forms.Implementation.Validation.CaptchaValidator":{initialize:function(t){var n=this;t.parents(".FormCaptcha, [data-f-type='captcha']").find(".FormCaptcha__Refresh, [data-f-captcha-refresh]").on("click",function(t){n._refreshCaptcha(e(this)),t.preventDefault()})},validate:function(e,t,n){var i=t.trim();return{isValid:null!=i&&""!=i,message:n.model.message}},onServerValidateFailed:function(e,t){this._refreshCaptcha(e),e.focus()},_refreshCaptcha:function(e){var t=e.hasClass("FormCaptcha")||i.isElementType(e,"captcha")?e:e.parents(".FormCaptcha, [data-f-type='captcha']"),n=t.find(".FormCaptcha__Image, [data-f-captcha-image]"),r=t.find(".FormTextbox__Input, [data-f-datainput]");n.attr("src",n.attr("src")+"&d="+Math.random()),r.val("")}}}},f={DependConditions:{Equals:function(e,t){return(e=e?epi.EPiServer.Forms.Utils.getConcatString(e,",").toUpperCase():"")===(t=t?t.toUpperCase():"")},NotEquals:function(e,t){return(e=e?epi.EPiServer.Forms.Utils.getConcatString(e,",").toUpperCase():"")!=(t=t?t.toUpperCase():"")},Contains:function(e,t){return e=e?epi.EPiServer.Forms.Utils.getConcatString(e,",").toUpperCase():"",t=t?t.toUpperCase():"",e.indexOf(t)>=0},NotContains:function(e,t){return!(e=e?epi.EPiServer.Forms.Utils.getConcatString(e,","):"")&&t||e&&!t||e&&t&&e.toUpperCase().indexOf(t.toUpperCase())<0},MatchRegularExpression:function(e,t){var n=new RegExp(t,"igm");return n.ignoreCase=n.global=n.multiline=!0,!t||t&&n.test(e)}}};e.extend(!0,epi.EPiServer.Forms,m),e.extend(!0,epi.EPiServer.Forms,p),e.extend(!0,epi.EPiServer.Forms,f),e.extend(!0,epi.EPiServer.Forms,{CustomBindingElements:{}}),epi.EPiServer.Forms.init=function(){epi.EPiServer.Forms.__Initialized||(epi.EPiServer.Forms.__Initialized=!0,e(document).ready(function(){function t(t){t.preventDefault(),t.stopPropagation();var n=i.getWorkingFormFromInnerElement(t.target),s=g(n);if(!1===s.SubmittableStatus.submittable)return f(s,s.SubmittableStatus.message),!1;var d=C(s);if(!h(d,s))return E(d),_(d),!1;var m=function(t){var n=g(t),i=v(t),a=r.loadFormDataFromStorage(n.Id);return e.extend(a,i)}(n);e.when(function(t,n){var i=e.Deferred();if(!t.ShowSummarizedData)return i.resolve(!0),i.promise();return a.showSummarizedText(n,t,["__FormGuid","__FormLanguage","__FormCurrentStepIndex","__FormSubmissionId"],[])}(s,m)).then(function(r){if(!r)return!1;var a=[];for(var d in m)if(-1==d.indexOf("__TempData")&&!l._isInactiveElement(d,s)&&!i.getFormElementBlock(d,n).parents(".FormStep:first, [data-f-type='step']:first").hasClass("hide")){var u=o.getElementValidators(s.ValidationInfo,d);a=a.concat(o.validateFormValue(d,m[d],u))}var c=e.grep(a,function(e){return 0==e.isValid});if(c.length>0){var g=e.map(c,function(e){return s.ElementsInfo[e.fieldName].friendlyName+": "+e.message});return f(s,g.join(" ")),!1}p(t)})}function n(e){e.preventDefault(),e.stopPropagation();var t=i.getWorkingFormFromInnerElement(e.target),n=g(t);i.raiseFormsEvent(n,{type:"formsReset",sourceEvent:e}),m(t,n),S(n.StepsInfo.Steps[0],n)}function m(t,n){if(t.get(0).reset(),n.SubmittableStatus&&!1===n.SubmittableStatus.submittable?f(n,n.SubmittableStatus.message):f(n,""),r.removeFormDataInStorage(n.Id),e("[aria-invalid=true]",t).attr("aria-invalid","false"),a.getAllDataElements(t).each(function(t,n){var r=e(n);F(r).text(""),r.removeClass("ValidationFail ValidationSuccess"),r.hasClass("FormChoice")||i.isElementType(r,"choice")?r.find("input[type=checkbox], input[type=radio]").each(function(t,n){var i=e(n);i.prop("checked",!(!i.data("epiforms-default-value")&&!i.data("f-default-value")))}):r.hasClass("FormSelection")||i.isElementType(r,"selection")?(r.find("option[disabled]:eq(0)").prop("selected",!0),r.find("option").each(function(t,n){var i=e(n);!1===i.prop("disabled")&&i.prop("selected",!(!i.data("epiforms-default-value")&&!i.data("f-default-value")))})):r.hasClass("FormFileUpload")||i.isElementType(r,"fileupload")?(u(r).text(""),I(r.find(".FormFileUpload__Input, [data-f-datainput]"))):(r.hasClass("Form__CustomElement")||i.isElementType(r,"custom"))&&a.resetCustomElementValue(r)}),n.DependantControllers&&n.DependantControllers.length)for(var o=0;o0&&null!==x[0]&&"object"==typeof x[0]&&x[0].file&&Object.getPrototypeOf(x[0].file)===File.prototype){for(var A,$=x,O="",U=0;U<$.length;U++)A=$[U].file,b.append(N+"_file_"+U,A),O+=A.name+"|";b.append(N,O)}else b.append(N,x);i.raiseFormsEvent(d,{type:"formsStartSubmitting",formData:b}),u.prop("disabled",!0),f(d,""),e.ajax({url:d.DataSubmitController+"/Submit",headers:a.buildSubmitRequestHeader(d),data:b,cache:!1,type:n.prop("method"),processData:!1,contentType:!1,async:epi.EPiServer.Forms.AsyncSubmit||n.data("epiforms-async-submit")||n.data("f-async-submit")||!1,success:function(a){if(t.preventDefault(),e(".Form__Element__ValidationError, [data-f-validationerror]").text(""),!0===a.IsSuccess){var s=C(d);if(e(".FormFileUpload .FormFileUpload__Input, [data-f-type='fileupload'] [data-f-datainput]",s).each(function(t,n){e(this).val(""),I(e(this))}),0==T&&0==v){i.raiseFormsEvent(d,{type:"formsNavigationNextStep",targetStep:P});var l=r.loadFormDataFromStorage(d.Id),p=e.extend(l,{__FormSubmissionId:a.Data.SubmissionId});return r.saveFormDataToStorage(d.Id,p),i.raiseFormsEvent(d,{type:"formsSubmitted",formData:b,isFinalizedSubmission:!1,isSuccess:a.IsSuccess,returnedResult:a}),S(P,d),!1}1==T&&m(n,d),i.raiseFormsEvent(d,{type:"formsSubmitted",formData:b,isFinalizedSubmission:T,isSuccess:a.IsSuccess,returnedResult:a});var u=d.StepsInfo.Steps.length;if(a.RedirectUrl)return window.location.href=a.RedirectUrl,!1;0==v&&!P&&V0&&function(t,n){for(var i=null,r=0;r0){var f=o.validateFormValue(s,p,d),u=e.grep(f,function(e){return 0==e.isValid}),c=n.ValidationInfo.find(e=>e.targetElementId===l||e.targetElementName===l),g=e("#"+c.targetElementId);if(u&&u.length>0){var v=e.map(u,function(e){return e.message});g.attr("aria-invalid","true"),r.addClass("ValidationFail"),a.text(v.join(" ")).show(),m=!1}else r.addClass("ValidationSuccess"),g.attr("aria-invalid","false"),m=!0}return i.raiseFormsEvent(n,{type:"elementValidated",isValid:m,elementName:s,elementValue:p,elementIdentifier:l,element:t,$messageContainer:a}),m}(a,n)&&r}),i.raiseFormsEvent(n,{type:"formsStepValidating",isValid:r}),n.$workingForm.toggleClass("ValidationSuccess",r),n.$workingForm.toggleClass("ValidationFail",!r),r}function F(t){var n=i.getElementName(t),r=i.stringFormat("{0}[data-epiforms-linked-name='{1}'], {0}[data-epiforms-linked-name='{2}']",[".Form__Element__ValidationError",n,t.attr("id")]),a=i.stringFormat("{0}[data-f-linked-name='{1}'], {0}[data-f-linked-name='{2}']",["[data-f-validationerror]",n,t.attr("id")]);return e(r).add(a)}function S(t,n){if(t)if(i.raiseFormsEvent(n,{type:"formsNavigateToStep",targetStep:t}),function(t,n){e.each(t,function(t,r){var o=-1!=t.indexOf("__TempData")?t.replace("__TempData",""):t,s=e('[data-epiforms-element-name="'+o+'"], [data-f-element-name="'+o+'"]',n);if(0!=s.length){if(s.hasClass("FormExcludeDataRebind")||s.data("f-excludedatarebind"))return;var l=s.find(".FormChoice__Input--Checkbox, [data-f-datainput]:checkbox");if(0!=l.length)return void e.each(l,function(){var t=e(this).val();e(this).attr("checked",r.indexOf(t)>-1)});if(0!=(l=s.find(".FormChoice__Input--Radio, [data-f-datainput]:radio")).length){var d=e.isArray(r)?r[0]:r;return void e.each(l,function(){var t=e(this).val();e(this).attr("checked",d==t)})}if(s.hasClass("FormSelection")||i.isElementType(s,"selection"))return void e("option:enabled",s).each(function(t,n){e(n).attr("selected",r.indexOf(e(n).val())>-1)});if(s.hasClass("FormCaptcha")||i.isElementType(s,"captcha"))return;if(0!=(l=s.find(".FormFileUpload__Input, [data-f-datainput]:file")).length){var m="";if(r instanceof Array&&r.length>0){var p=r.map(function(e){return e.name}).join(", ");m=m.concat(p)}if(""!==m){var f=i.stringFormat(epi.EPiServer.Forms.Messages.fileUpload.postedFile,[m]);u(s).text(f).show()}return}if(s.hasClass("Form__CustomElement")||i.isElementType(s,"custom"))return void a.bindCustomElementValue(s,r);s.find("[data-f-datainput]:first").val(r)}})}(r.loadFormDataFromStorage(n.Id),n.$workingForm),n.StepsInfo.AllStepsAreNotLinked||t.attachedContentLink==epi.EPiServer.CurrentPageLink)n.$steps.addClass("hide"),n.$steps.each(function(r,a){if(r===t.index)return e(a).removeClass("hide"),i.setCurrentStepIndex(n,t.index),!1}),i.scrollToTheTopOfForm(n.$workingForm);else{if(t.attachedUrl&&t.attachedUrl.length)return void window.location.replace(t.attachedUrl);n.StepsInfo.AllStepsAreNotLinked||f(n,epi.EPiServer.Forms.Messages.viewMode.malformStepConfiguration)}else n.$steps.hide();y(n)}function E(t){epi.EPiServer.Forms.Validators["EPiServer.Forms.Implementation.Validation.CaptchaValidator"]._refreshCaptcha(e(".Form__Element.FormCaptcha, [data-f-type='captcha']",t))}function _(t){if(t){var n=e(".Form__Element.ValidationFail",t)[0];n&&(n.scrollIntoView(),e("[data-f-datainput]",n)[0].focus())}}function y(t){var n=i.getCurrentStepIndex(t),r=e(".Form__NavigationBar, [data-f-type='navigationbar']",t.$workingForm);if(n<0)r.hide();else{var a=e(".Form__NavigationBar__Action.btnPrev, [data-f-navigation-previous]",r).prop("disabled",!1),o=e(".Form__NavigationBar__Action.btnNext, [data-f-navigation-next]",r).prop("disabled",!1);0!=n&&!1!==t.SubmittableStatus.submittable||a.prop("disabled",!0),n!=t.StepsInfo.Steps.length-1&&!1!==t.SubmittableStatus.submittable||o.prop("disabled",!0),e(".Form__NavigationBar, [data-f-type='navigationbar']",t.$workingForm).toggle(t.ShowNavigationBar);var s=n+1,l=t.StepsInfo.Steps.length;e(".Form__NavigationBar__ProgressBar__CurrentStep, [data-f-navigation-currentStep]",r).text(s),e(".Form__NavigationBar__ProgressBar__StepsCount, [data-f-navigation-stepcount]",r).text(l),e(".Form__NavigationBar__ProgressBar--Progress, [data-f-navigation-progress]",r).css({width:100*s/l+"%"})}}function C(t){var n=i.getCurrentStepIndex(t);return e(t.$steps[n])}function I(e){/MSIE/.test(navigator.userAgent)&&e.replaceWith(e=e.clone(!0))}d?(e('.EPiServerForms, [data-f-type="form"]').each(function(a,o){var l=e(o),d=g(l);d.SubmittableStatus&&!1===d.SubmittableStatus.submittable&&f(d,d.SubmittableStatus.message),function(t){if(!t||!t.StepsInfo||!t.StepsInfo.Steps)return;if(t.$steps=e(".FormStep, [data-f-type='step']",t.$workingForm),t.StepsInfo.Steps.length<2)return;S(t.StepsInfo.Steps[i.getCurrentStepIndex(t)],t),e(".Form__NavigationBar__Action.btnNext, [data-f-navigation-next]",t.$workingForm).on("click",function(e){e.preventDefault();var n=C(t),i=h(n,t);if(!i)return E(n),_(n),!1;p(e)}),e(".Form__NavigationBar__Action.btnPrev, [data-f-navigation-previous]",t.$workingForm).on("click",function(n){n.preventDefault();var a=c(t.$workingForm,function(e){return e.hasClass("FormFileUpload")||i.isElementType(e,"fileupload")});r.saveFormDataToStorage(t.Id,a);var o=s.findPreviousStep(i.getCurrentStepIndex(t),t);S(o,t);var l=e("section[data-epiforms-stepindex="+o.index+"], section[data-f-stepindex="+o.index+"]",t.$workingForm);E(l),i.raiseFormsEvent(t,{type:"formsNavigationPrevStep",targetStep:o})})}(d);for(var m=1;m=65&&t<=90||32==t)return!1;if(!e.shiftKey&&!e.altKey&&!e.ctrlKey&&t>=48&&t<=57||t>=96&&t<=105||65==e.keyCode&&!0===e.ctrlKey||67==t&&!0===e.ctrlKey||88==t&&!0===e.ctrlKey||t>=35&&t<=39||8==t||9==t||13==t||46==t||45==t)return!0;var n=this.value;return(109!=t&&189!=t||"-"!==n[0])&&(!((!(e.shiftKey||e.altKey||e.ctrlKey||190!=t)||188==t||110==t)&&/[\.,]/.test(n))&&void 0)}).on("keyup",function(e){var t=this.value;isNaN(t)&&t&&(t=(t=("-"===t[0]?"-":"")+t.replace(/[^0-9\.]/g,"")).replace(/\.(?=(.*)\.)+/g,""),this.value=t)}),e('.EPiServerForms input.FormTextbox__Input,.FormChoice__Input.FormChoice__Input--Checkbox,.FormRange__Input,.FormTextbox__Input.FormUrl__Input,.FormChoice__Input.FormChoice__Input--Radio,.FormTextbox__Input.FormCaptcha__Input.FormHideInSummarized,[data-f-type="form"] [data-f-datainput]:not(textarea)').on("keydown",function(e){return i.showNextStepOnEnterKeyDown(e)})):e('.EPiServerForms .Form__Status__Message, [data-f-type="form"] [data-f-form-statusmessage]').text(epi.EPiServer.Forms.ErrorMessages.cantnotworkwithoutstorage)}))},epi.EPiServer.Forms.ExternalScriptSources.length<=0&&epi.EPiServer.Forms.ExternalCssSources.length<=0?epi.EPiServer.Forms.init():(i.loadExternalScriptOnDemand(epi.EPiServer.Forms.ExternalScriptSources,function(){i.raiseFormsEvent(null,{type:"formsLoadExternalScripts",scripts:epi.EPiServer.Forms.ExternalScriptSources}),epi.EPiServer.Forms.init()}),i.loadExternalCssOnDemand(epi.EPiServer.Forms.ExternalCssSources,function(){i.raiseFormsEvent(null,{type:"formsLoadExternalCss",Css:epi.EPiServer.Forms.ExternalCssSources})}))}else console.error("Forms cannot work without jQuery");else console.error("Forms is not initialized correctly")}($$epiforms||$);