function LZ(n){return(n<0||n>9?"":"0")+n}function isDate(n,t){var i=getDateFromFormat(n,t);return i==0?!1:!0}function compareDates(n,t,i,r){var u=getDateFromFormat(n,t),f=getDateFromFormat(i,r);return u==0||f==0?-1:u>f?1:0}function formatDate(n,t){t=t+"";var o="",f=0,h="",e="",u=n.getYear()+"",s=n.getMonth()+1,c=n.getDate(),l=n.getDay(),r=n.getHours(),a=n.getMinutes(),v=n.getSeconds(),i={};for(u.length<4&&(u=""+(+u+1900)),i.y=""+u,i.yyyy=u,i.yy=u.substring(2,4),i.M=s,i.MM=LZ(s),i.MMM=MONTH_NAMES[s-1],i.NNN=MONTH_NAMES[s+11],i.d=c,i.dd=LZ(c),i.E=DAY_NAMES[l+7],i.EE=DAY_NAMES[l],i.H=r,i.HH=LZ(r),i.h=r==0?12:r>12?r-12:r,i.hh=LZ(i.h),i.K=r>11?r-12:r,i.k=r+1,i.KK=LZ(i.K),i.kk=LZ(i.k),i.a=r>11?"PM":"AM",i.m=a,i.mm=LZ(a),i.s=v,i.ss=LZ(v);f<t.length;){for(h=t.charAt(f),e="";t.charAt(f)==h&&f<t.length;)e+=t.charAt(f++);o=i[e]!=null?o+i[e]:o+e}return o}function _isInteger(n){for(var t=0;t<n.length;t++)if("1234567890".indexOf(n.charAt(t))==-1)return!1;return!0}function _getInt(n,t,i,r){for(var u,f=r;f>=i;f--){if(u=n.substring(t,t+f),u.length<i)return null;if(_isInteger(u))return u}return null}function getDateFromFormat(n,t){var v,o,y,k;n=n+"";t=t+"";for(var r=0,l=0,d="",i="",p,w,a=new Date,e=a.getYear(),f=a.getMonth()+1,s=1,u=a.getHours(),h=a.getMinutes(),c=a.getSeconds(),b="";l<t.length;){for(d=t.charAt(l),i="";t.charAt(l)==d&&l<t.length;)i+=t.charAt(l++);if(i=="yyyy"||i=="yy"||i=="y"){if(i=="yyyy"&&(p=4,w=4),i=="yy"&&(p=2,w=2),i=="y"&&(p=2,w=4),e=_getInt(n,r,p,w),e==null)return 0;r+=e.length;e.length==2&&(e=e>70?1900+ +e:2e3+ +e)}else if(i=="MMM"||i=="NNN"){for(f=0,o=0;o<MONTH_NAMES.length;o++)if(v=MONTH_NAMES[o],n.substring(r,r+v.length).toLowerCase()==v.toLowerCase()&&(i=="MMM"||i=="NNN"&&o>11)){f=o+1;f>12&&(f-=12);r+=v.length;break}if(f<1||f>12)return 0}else if(i=="EE"||i=="E"){for(o=0;o<DAY_NAMES.length;o++)if(y=DAY_NAMES[o],n.substring(r,r+y.length).toLowerCase()==y.toLowerCase()){r+=y.length;break}}else if(i=="MM"||i=="M"){if(f=_getInt(n,r,i.length,2),f==null||f<1||f>12)return 0;r+=f.length}else if(i=="dd"||i=="d"){if(s=_getInt(n,r,i.length,2),s==null||s<1||s>31)return 0;r+=s.length}else if(i=="hh"||i=="h"){if(u=_getInt(n,r,i.length,2),u==null||u<1||u>12)return 0;r+=u.length}else if(i=="HH"||i=="H"){if(u=_getInt(n,r,i.length,2),u==null||u<0||u>23)return 0;r+=u.length}else if(i=="KK"||i=="K"){if(u=_getInt(n,r,i.length,2),u==null||u<0||u>11)return 0;r+=u.length}else if(i=="kk"||i=="k"){if(u=_getInt(n,r,i.length,2),u==null||u<1||u>24)return 0;r+=u.length;u--}else if(i=="mm"||i=="m"){if(h=_getInt(n,r,i.length,2),h==null||h<0||h>59)return 0;r+=h.length}else if(i=="ss"||i=="s"){if(c=_getInt(n,r,i.length,2),c==null||c<0||c>59)return 0;r+=c.length}else if(i=="a"){if(n.substring(r,r+2).toLowerCase()=="am")b="AM";else if(n.substring(r,r+2).toLowerCase()=="pm")b="PM";else return 0;r+=2}else{if(n.substring(r,r+i.length)!=i)return 0;r+=i.length}}if(r!=n.length)return 0;if(f==2)if(e%4==0&&e%100!=0||e%400==0){if(s>29)return 0}else if(s>28)return 0;return(f==4||f==6||f==9||f==11)&&s>30?0:(u<12&&b=="PM"?u=+u+12:u>11&&b=="AM"&&(u-=12),k=new Date(e,f-1,s,u,h,c),k.getTime())}function parseDate(n){var e=arguments.length==2?arguments[1]:!1,u,t,i,f,r;for(generalFormats=["y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d"],monthFirst=["M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d"],dateFirst=["d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M"],u=["generalFormats",e?"dateFirst":"monthFirst",e?"monthFirst":"dateFirst"],t=null,i=0;i<u.length;i++)for(f=window[u[i]],r=0;r<f.length;r++)if(t=getDateFromFormat(n,f[r]),t!=0)return new Date(t);return null}function expand(n){$("#"+n.id+"-div").toggle(500)}function hasChannel(){return $("#pt_canais").val()==""?!1:!0}function scrollToAnchor(n){var t=$("div[name='"+n+"']");$("html,body").animate({scrollTop:t.offset().top},"slow")}function addChannels(){var t=$(".chkbox:checkbox:checked"),n="";t.each(function(){n=n+$(this).attr("id")+", "});$("input[name='pt_canais.Value']").val(n);$("#pt_canais").val(n);$("#pt_canais").val().length>0&&$(".jq-errorMessage-br").hide()}function submitChannels(n){hasChannel()?$(".jq-errorMessage-br").hide():(n.preventDefault(),scrollToAnchor("jq-errorMessage-br"),$(".jq-errorMessage-br").show())}var MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],DAY_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat"],__extends,EC;(function(n){var t;(function(n){var i=function(){function i(){}return i.subscribe=function(n,r,u){var f=new t(n,r,u);i.handlers.push(f)},i.unsubscribe=function(n,t){i.handlers=$.grep(i.handlers,function(i){return i.event===n&&i.scope===t?!0:!1},!0)},i.fire=function(t,r,u){u===void 0&&(u=null);n.Debug.logToConsole("Observer:fire: "+t);var f=u||window;i.handlers.forEach(function(n){n.event===t&&n.funct.call(f,r)})},i.resubscribe=function(n,t,r){i.unsubscribe(n,r);i.subscribe(n,t,r)},i.handlers=[],i}(),t;n.Observer=i;t=function(){function n(n,t,i){this.event=n;this.scope=i;this.funct=t}return n}();n.Handle=t})(t=n.ServiceSelector||(n.ServiceSelector={}))})(EC||(EC={})),function(n){var t;(function(n){"use strict";var i=function(){function n(){}return n.clearContractSelection="ssf.contractmanagement.clearcontractselection",n}(),t;n.Commands=i;t=function(){function n(){}return n.contractInformationChanged="ssf.contractmanagement.contractInformationChanged",n.slideToggleFinished="ssf.contractmanagement.slideToggleFinished",n}();n.Events=t})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){"use strict";var i,c,f,u,e,l,o,s,w,a,h,r,v,y,p;i=jQuery;c=function(){function n(){}return n.readInitData=function(n,t){var u=n.attr("data-initdata"),i;return u==null||u.length==0?t:(i=jQuery.parseJSON(u),t!=null&&(i=jQuery.extend(t,i)),r.logToConsole("Read init data performed:"),i)},n.initializeControls=function(n,t){i(function(){i("[data-type='"+n+"']").each(function(u,f){try{var o=new t(i(f));r.logToConsole("Initializing control type name:"+n+" with index: "+u)}catch(e){r.logToConsole("Failed to initialize controls for type name: "+n+" of type: "+t+" with index: "+u+". Exception: "+e,!0)}})})},n.initializeControlsByFactoryMethod=function(n,t){i(function(){i("[data-type='"+n+"']").each(function(u,f){try{var o=t(i(f));r.logToConsole("Initializing control type name: "+n+" with index: "+u)}catch(e){r.logToConsole("Failed to initialize controls for control type name: "+n+" with index: "+u+". Exception: "+e)}})})},n.initializeControlsByFactoryMethodAndDataSelector=function(n,t,u){i(function(){i(t).each(function(t,f){try{var o=u(i(f));r.logToConsole("Initializing control type name: "+n+" with index: "+t)}catch(e){r.logToConsole("Failed to initialize controls for control type name: "+n+" with index: "+t+". Exception: "+e)}})})},n}();t.InitHelpers=c;f=function(){function n(n){this._dataScopeName="noScopeName";this.component=n;n&&n.length>0&&(n.children(":first").attr("data-scope")?this._dataScopeName=n.children(":first").attr("data-scope"):n.attr("data-scope")?this._dataScopeName=n.attr("data-scope"):n.closest("[data-scope]").length>0&&n.closest("[data-scope]").attr("data-scope")&&(this._dataScopeName=n.closest("[data-scope]").attr("data-scope")))}return Object.defineProperty(n.prototype,"dataScopeName",{get:function(){return this._dataScopeName},set:function(n){this._dataScopeName=n},enumerable:!0,configurable:!0}),n.prototype.trackChange=function(n){n===void 0&&(n=!1);u.trackChangeExplicitScope(this.dataScopeName,!1)},n.prototype.trackChangeExplicit=function(n,t){t===void 0&&(t=!1);u.trackChangeExplicitScope(n,!1)},n.prototype.setupDataScopeTracker=function(n){u.setupTracker(n)},n.prototype.resetChangesTracker=function(){u.resetPendingChanges()},n.prototype.comscoreTrack=function(n,t){this.comscoreTrackParameterAndValue(n+"="+t)},n.prototype.comscoreTrackParameterAndValue=function(n){var t=i("input:hidden[data-selector='sitestat-url']").val(),r;t!==null&&t!==""&&(r=t+"&"+n,udm_(r))},n}();t.ChangesTrackableDataScope=f;u=function(){function n(){}return n.setupTracker=function(t){i("input, select",t.component).off(n.change).on(n.change,i.proxy(n.setModified,t));i("input[type=checkbox]",t.component).off(n.change).on(n.change,i.proxy(n.setModified,t));i("h3.is-editable--active",t.component).off("keyup.changesTracker").on("keyup.changesTracker",i.proxy(n.setModified,t));i("[data-scope='cancel-operation']",t.component).off(n.click).on(n.click,i.proxy(n.setUnmodified,t));i("[data-scope='save-operation']",t.component).off(n.click).on(n.click,i.proxy(n.setUnmodified,t))},n.setModified=function(t){n.trackChange(t,!0)},n.setUnmodified=function(t){n.trackChange(t,!1)},n.trackChange=function(t,r){if(r===void 0&&(r=!1),t!=null){var u=i(t.target).parent().closest("[data-scope]");u.length>0?n.modifiedScopes[u.attr("data-scope")]=r:n.modifiedScopes.noScopeName=r}},n.trackChangeExplicitScope=function(t,i){i===void 0&&(i=!1);t!=null&&(n.modifiedScopes[t]=i)},n.hasPendingChanges=function(){var t=n.modifiedScopes;for(var i in t)if(t.hasOwnProperty(i)&&t[i])return!0;return!1},n.resetPendingChanges=function(){var t=n.modifiedScopes;for(var i in t)t.hasOwnProperty(i)&&(t[i]=!1);return!0},n.modifiedScopes={},n.click="click.changesTracker",n.change="change.changesTracker",n}();t.ChangeTrackerDataScope=u;e=function(n){function t(t){var r=i("div[data-js-guid='"+t+"']");n.call(this,r);this.guid=t}return __extends(t,n),t}(f);t.BaseComponent=e;l=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.comscoreTrackExpenseAmount=function(n){var t="0";n!==null&&n!==""&&n!=="0"&&(t="1");this.comscoreTrack("expenseamount",t)},t}(e);t.BaseContractComponent=l;o=function(n){function t(t){n.call(this,t)}return __extends(t,n),t}(f);t.BaseComponentNew=o;s=function(n){function t(t){var i=this;n.call(this,t);this.component.on("click","[data-comscore-onclickin]",function(n){return i.trackClick(n)})}return __extends(t,n),t.prototype.trackClick=function(n){var t=i("input:hidden[data-selector='comscore-measurementurl']").val(),f=i("input:hidden[data-selector='comscore-currentcounter']").val(),r=jQuery(n.currentTarget).data("comscore-onclickin"),u;t!==""&&r!==""&&(u=t+"?"+f+"."+r+"&ns_type=clickin",udm_(u))},t}(o);t.ComscoreOnClickTracker=s;w=new s(jQuery(document));a=function(){function n(){}return n.openModal=function(n){i("<a/>").addClass("js-popup").attr("href",n).attr("data-popup-modal","true").attr("data-backdrop","static").attr("data-keyboard","false").modal().click()},n}();t.SppHelper=a;h=function(){function n(n,t){this.message=n;this.category=t}return n}();t.DebugEvent=h;r=function(){function n(){}return n.logToConsole=function(n,t,i){t===void 0&&(t=!1);i===void 0&&(i=null);window.console&&console!==undefined&&console.log!==undefined&&console.log(n);this.isDebugEnabled&&this.debugEvents.push(new h(n,i))},n.registerJavascriptHandler=function(){if(i("meta[name=developerMode]").length==0){this.isDebugEnabled=!1;return}this.isDebugEnabled=!0;window.onerror=this.handleJavascriptError},n.handleJavascriptError=function(t,i,r,u){var f="JS ERROR: "+t+"<br />@ "+i+" (line: "+r;return u&&(f+=", col: "+u),f+=")",n.logToConsole(f,!0),!1},n.startProfile=function(){return new Date},n.endProfile=function(t,i){if(this.isDebugEnabled){var u=(new Date).getTime()-t.getTime(),r=new Date(u),f=i==null?"":i+": ",e=f+(r.getSeconds()+r.getMilliseconds()/1e3)+"s";n.logToConsole(e)}},n.isDebugEnabled=!1,n.debugEvents=[],n}();t.Debug=r;n.ServiceSelector.Debug.registerJavascriptHandler();v=function(){function n(){}return n.count=function(){return this._count},n.increment=function(){(this._count++,r.logToConsole("Waitpanel counter increased to: "+this._count),this._count>1)||i.publish("spinner.open",[i("body")])},n.decrement=function(){(this._count--,r.logToConsole("Waitpanel counter decreased to: "+this._count),this._count>0)||(this._count<0&&r.logToConsole("Waitpanel counter went below zero! Count be a problem.",!0),i.publish("spinner.close",[i("body")]))},n.show=function(n){i.publish("spinner.open",[n])},n.hide=function(n){i.publish("spinner.close",[n])},n._count=0,n}();t.WaitPanel=v;y=function(){function t(){}return t.setEnvironmentPrefix=function(n){t.environmentPrefix=n},t.submitFormAndUpdate=function(n,r){var u={url:n.action,type:n.method,data:i(n).serialize(),traditional:!0},f=i.extend(u,r);t.update(f,r)},t.submitFormAndGetData=function(n,r){var u={url:n.action,type:n.method,data:i(n).serialize(),traditional:!0},f=i.extend(u,r);t.getData(f,r)},t.getDataFromAction=function(n,r,u,f,e,o){var s=t.getApiUrl(n,r,u),h=i.extend({url:s,data:f},e);t.doGeneric(h,o,t.doGetData)},t.sendDataToActionAndUpdate=function(n,r,u,f,e,o){var s=t.getApiUrl(n,r,u),h=i.extend({url:s,data:f},e);t.update(h,o)},t.getData=function(n,i){t.doGeneric(n,i,t.doGetData)},t.update=function(n,i){t.doGeneric(n,i,t.doUpdate)},t.getApiUrl=function(n,t,r){var e=i("meta[name='scID']").attr("content"),u=this.environmentPrefix+"/ServiceSelectorsAPI/"+n+"/"+t+"/"+e,f;return r!=null&&r.length>0&&(f=r.replace("?",""),u=u+"?"+f),u},t.doGeneric=function(n,t,r){var u={onError:jQuery.noop,onSuccess:jQuery.noop,onValidationFailed:jQuery.noop,useErrorWindow:!0,useWaitPanel:!0,waitPanelElement:null},f=i.extend({type:"POST",data:{},dataType:"json"},n),e=i.extend(u,t);r(f,e)},t.doUpdate=function(u,f){f.useWaitPanel&&n.ServiceSelector.WaitPanel.increment();var e=r.startProfile();i.ajax(u).done(function(n){if(n.Updates!=null)for(var r=0;r<n.Updates.length;r++)i("#"+n.Updates[r].Id).html(n.Updates[r].Html);if(n.Valid){f.onSuccess(null);t.addEvents(n.Events)}else f.onValidationFailed(null)}).fail(function(n,i,r){t.handleAjaxFail(n,i,r,f)}).always(function(){f.useWaitPanel&&n.ServiceSelector.WaitPanel.decrement();r.endProfile(e,"Ajax update ended: ")})},t.doGetData=function(u,f){var o=this,e;f.useWaitPanel&&(f.waitPanelElement?n.ServiceSelector.WaitPanel.show(f.waitPanelElement):n.ServiceSelector.WaitPanel.increment());e=r.startProfile();i.ajax(u).done(function(n){if(n.Valid){f.onSuccess(n.Data);t.addEvents(n.Events)}else f.onValidationFailed(n.ValidationErrors)}).fail(function(n,i,r){t.handleAjaxFail(n,i,r,f)}).always(function(){f.useWaitPanel&&(f.waitPanelElement?n.ServiceSelector.WaitPanel.hide(f.waitPanelElement):n.ServiceSelector.WaitPanel.decrement());r.endProfile(e,"Ajax update ended: ")})},t.addEvents=function(t){for(var i=0;i<t.length;i++)n.ServiceSelector.Debug.logToConsole(t[i],null,"selectorRegisteredEvent")},t.handleAjaxFail=function(t,r,u,f){var h,o,e,c,l,s;(t.status!==0||t.abort.length!==1)&&(h="Ajax update ended with status "+t.status+" ("+u+")",n.ServiceSelector.Debug.logToConsole(h,!0),f.useErrorWindow&&(o=i("#ServerErrorDebugMessage"),o.length>0?(e=t.responseText.indexOf("<body"),e+=t.responseText.substring(e).indexOf(">")+1,c=t.responseText.indexOf("<\/body>"),l=t.responseText.substring(e,c),i("#ServerErrorDebugMessageContent .data-block").html(l),o.click()):(s=i("#ServerErrorMessage"),s.length>0&&s.click())),f.onError())},t.environmentPrefix="",t}();t.Ajax=y;p=function(){function n(){}return n.storeInSession=function(n,t){this.getSessionStorageAvailability&&sessionStorage.setItem(n,JSON.stringify(t))},n.removeFromSession=function(n){this.getSessionStorageAvailability&&sessionStorage.setItem(n,null)},n.getFromSession=function(n){if(!this.getSessionStorageAvailability)return null;var t=sessionStorage.getItem(n);return JSON.parse(t)},n.getSessionStorageAvailability=function(){if(!this.isChecked){sessionStorage||(this.sessionStorageIsAvailable=!1);try{sessionStorage.setItem(this.testStorageKey,this.testStorageValue);var n=sessionStorage.getItem(this.testStorageKey);n!==this.testStorageValue&&(this.sessionStorageIsAvailable=!1);sessionStorage.removeItem(this.testStorageKey);this.sessionStorageIsAvailable=!0}catch(t){this.sessionStorageIsAvailable=!1}this.isChecked=!0}return this.sessionStorageIsAvailable},n.isChecked=!1,n.sessionStorageIsAvailable=!0,n.testStorageKey="teststore",n.testStorageValue="testme",n}();t.SessionStore=p})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){"use strict";var i=function(t){function i(n){t.call(this,n);this.bindEvents()}return __extends(i,t),i.prototype.bindEvents=function(){this.component.find("[data-selector='email-pdf-form']").on("submit","form",$.proxy(this.sendPdf,this));this.component.find("[data-selector='pdf-form-close']").on("click",$.proxy(this.togglePdfForm,this))},i.prototype.sendPdf=function(t){t.preventDefault();var r=t.currentTarget,i=$(t.currentTarget);(i.data("ssfvalidator")||i.ssfvalidator({autoRevalidate:!0,showValidationMessages:!0}),i.ssfvalidator("validate"))&&n.ServiceSelector.Ajax.submitFormAndGetData(r,{onSuccess:function(n){n&&$(i).hide().parent().find("[data-selector='sendpdf-confirmation']").show();i.ssfvalidator("destroy")},useWaitPanel:!0})},i.prototype.togglePdfForm=function(){var n=$("form","[data-selector='email-pdf-form']");n.is(":hidden")&&(n[0].reset(),n.show(),$("[data-selector='sendpdf-confirmation']").hide())},i}(n.ServiceSelector.BaseComponentNew);t.SsfPrintOrSendPdf=i;t.InitHelpers.initializeControlsByFactoryMethod("SsfPrintOrPreviewComponent",function(n){return new i(n)})})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t={options:{autoRevalidate:!1,showSummary:!1,showValidationMessages:!1,summarySelector:"",includeHiddenFields:!1},_create:function(){this._isValidated=!1;this._fieldDefinitions=[];this._ruleDefinitions=[];this.addRule("required",this._checkRequiredField,"#ValidationError_MissingFields");this.addRule("requiredgroup",this._checkRequiredGroupField,"#ValidationError_MissingFieldsGroup");this.addRule("email",this._checkEmailField,"#ValidationError_Email");this.addRule("number",this._checkNumberField,"#ValidationError_Number");this.addRule("decimal",this._checkNonNegativeDecimalField,"#ValidationError_Number");this.addRule("positivedecimal",this._checkPositiveDecimalField,"#ValidationError_Number");this.addRule("date",this._checkIsDateField,"#ValidationError_Date");this.addRule("futuredate",this._checkFutureDateField,"#ValidationError_FutureDate");this.addRule("pastdate",this._checkPastDateField,"#ValidationError_PastDate");this.addRule("birthdateAdult",this._checkBirthdateAdultField,"#ValidationError_birthdateAdult");this.addRule("phonenr",this._checkPhoneNrField,"#ValidationError_PhoneNumber");this.addRule("checked",this._checkIsChecked,"#ValidationError_IsChecked");this.addRule("dateday",this._checkDateDay,"#ValidationError_DateDay");this.addRule("datemonth",this._checkDateMonth,"#ValidationError_DateMonth");this.addRule("dateyear",this._checkDateYear,"#ValidationError_DateYear");this.addRule("BEphone",this._checkBEphone,"#ValidationError_BEphone");this.addRule("BEbank",this._checkBEbank,"#ValidationError_BEbank");this.addRule("range",this._checkRange,"#ValidationError_Range");this.addRule("iban",n.proxy(this._checkIBAN,this),"#ValidationError_IBAN");this.addRule("becardidentitynumber",n.proxy(this._checkBeIdentityCardNumber,this),"#ValidationError_BECardIdentityNumber");this.addRule("benationalnumber",n.proxy(this._checkBeNationalNumber,this),"#ValidationError_BENationalNumber");this.addRule("regex",n.proxy(this._checkRegex,this),"#ValidationError_BENationalNumber");this.addRule("ptcarregistrationplate",n.proxy(this._checkPtCarRegistrationPlate,this),"#ValidationError_PTCarRegistrationPlate");this.addRule("ptfiscalidentitynumber",n.proxy(this._checkPtFiscalIdentityNumber,this),"#ValidationError_PTFiscalIdentityNumber");this._bindRevalidation()},addRule:function(t,i,r){var u=null;r&&(u=this.element.find(r).text(),u||(u=n(r).text()));this._ruleDefinitions.push({fieldSelector:t,func:i,message:u});this._processRule(t,i,u)},_processRule:function(t,i,r){for(var o,u,f,e,h=[],c=this.element.find('[data-validation~="'+t+'"]'),s=0;s<c.length;s++){if(o=c.eq(s),u=o.attr("name"),n.inArray(u,h)!==-1)continue;else h.push(u);for(f=null,e=0;e<this._fieldDefinitions.length;e++)if(this._fieldDefinitions[e].name==u){f=this._fieldDefinitions[e];break}f||(f={field:o,name:u,placeholder:this.element.find('[data-validation-placeholder="'+u+'"]'),rules:[]},this._fieldDefinitions.push(f));f.rules.push({func:i,message:r})}},_bindRevalidation:function(){var t,r,i;if(this.options.autoRevalidate)for(t=0;t<this._fieldDefinitions.length;t++)r=this._fieldDefinitions[t],i=this.element.find("[name='"+r.name+"']"),i.filter("input:not([type=radio], [type=checkbox]), textarea").blur(n.proxy(this.revalidate,this)),i.filter("select").change(n.proxy(this.revalidate,this)),i.filter("input:checkbox, input:radio").change(n.proxy(this.revalidate,this))},_checkIsChecked:function(n,t){return t.is(":checked")?!0:!1},_checkRequiredField:function(n){var t=n===undefined||n==null||n=="";return!t},_checkRequiredGroupField:function(t,i,r){var u=!1,f=i.data("requiredgroup"),e=r.find('[data-requiredgroup="'+f+'"]');return n(e).each(function(){var t=n(this).val(),i;return(n(this).is(":radio")||n(this).is(":checkbox"))&&(t=n(this).is(":checked")?n(this).val():null),i=t===undefined||t==null||t=="",i?void 0:(u=!0,!1)}),u},_checkNumberField:function(n){if(n=="")return!0;var t=parseInt(n);return!isNaN(t)&&n.match(/\D+/)==null},_checkPositiveDecimalField:function(n){if(!n.length>0)return!0;if(isNaN(n.replace(",",".")||n.indexOf(".")!==-1))return!1;var t=parseFloat(n);return!isNaN(t)&&t>0},_checkNonNegativeDecimalField:function(n){if(!n.length>0)return!0;if(isNaN(n.replace(",",".")||n.indexOf(".")!==-1))return!1;var t=parseFloat(n);return!isNaN(t)&&t>=0},_checkRange:function(n,t){var i=t.data("min"),r=t.data("max"),u=parseInt(n);return i!==""&&i>u?!1:r!==""&&r<u?!1:!0},_checkDateDay:function(n){if(n=="")return!0;try{var t=parseInt(n);return t>0&&t<=31}catch(i){return!1}},_checkDateMonth:function(n){if(n=="")return!0;try{var t=parseInt(n);return t>0&&t<=12}catch(i){return!1}},_checkDateYear:function(n,t){var i,u,f,r;if(n=="")return!0;try{return i=parseInt(n),u=t.data("validation").indexOf("datepast")>-1,u?(r=(new Date).getFullYear(),i.toString().length==4&&r>=i):(f=t.data("validation").indexOf("datefuture")>-1,f?(r=(new Date).getFullYear(),r<=i):i.toString().length==4)}catch(e){return!1}},_checkBEphone:function(n){return n==""?!0:n.indexOf("+32")==0&&n.length>=10},_checkBEbank:function(n){return n===""?!0:n.match("[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}")!=null},_checkIsDateField:function(t,i,r,u){if(t=="")return!0;try{var f=u._findRegion();return n.datepicker.parseDate(n.datepicker.regional[f].dateFormat,t),!0}catch(e){}return!1},_findRegion:function(){var t=n("html").attr("lang"),i=["pt-br","nl-BE"].filter(function(n){return n===t}).length===1;return i?t:t.split("-")[0]},_checkFutureDateField:function(t,i,r,u){try{if(t=="")return!0;var e=u._findRegion(),o=n.datepicker.parseDate(n.datepicker.regional[e].dateFormat,t),f=new Date,s=new Date(f.getFullYear(),f.getMonth(),f.getDate());return o>s}catch(h){return!1}},_checkPastDateField:function(t,i,r,u){try{if(t=="")return!0;var e=u._findRegion(),o=n.datepicker.parseDate(n.datepicker.regional[e].dateFormat,t),f=new Date,s=new Date(f.getFullYear(),f.getMonth(),f.getDate());return o<s}catch(h){return!1}},_checkBirthdateAdultField:function(t,i,r,u){try{if(t=="")return!0;var h=u._findRegion(),f=n.datepicker.parseDate(n.datepicker.regional[h].dateFormat,t),e=new Date,o=e.getFullYear()-f.getFullYear(),s=e.getMonth()-f.getMonth();return(s<0||s===0&&e.getDate()<f.getDate())&&o--,o>=18}catch(c){return!1}},_checkEmailField:function(n){return n?n.match(new RegExp("^[a-zA-Z0-9!#$%&'*+\\/=?^_`{|}~-]+(?:.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?"))!=null:!0},_checkPhoneNrField:function(n){return n.match(new RegExp("^\\+[1-9]{1}[0-9]{9,12}$"))!=null},_checkPtCarRegistrationPlate:function(n){return n.length==0?!0:n.match(new RegExp("^[0-9]{2}-[0-9]{2}-[A-Za-z]{2}|[0-9]{2}-[A-Za-z]{2}-[0-9]{2}|[A-Za-z]{2}-[0-9]{2}-[0-9]{2}$"))!=null},_checkPtFiscalIdentityNumber:function(n){if(n.length==0)return!0;var t,r=0;if(n.length==9&&(t=n.charAt(0),t=="1"||t=="2"||t=="5"||t=="6"||t=="8"||t=="9")){for(r=t*9,i=2;i<=8;i++)r+=n.charAt(i-1)*(10-i);if(r=11-r%11,r>=10&&(r=0),r==n.charAt(8))return!0}return!1},_hideValidationErrors:function(n,t){this.options.showValidationMessages&&(n.closest(".form__item").removeClass("form__item--has-errors"),this.options.showSummary||t.slideUp({complete:function(){t.text("")}}))},_removeDuplicates:function(n){var i=[],t,u,r,f;n:for(t=0,u=n.length;t<u;t++){for(r=0,f=i.length;r<f;r++)if(i[r]==n[t])continue n;i.push(n[t])}return i},reset:function(){var n,t;for(this._isValidated=!1,n=0;n<this._fieldDefinitions.length;n++)t=this._fieldDefinitions[n],this._hideValidationErrors(t.field,t.placeholder)},restart:function(n){var t,i;for(this.reset();this._fieldDefinitions.length;)this._fieldDefinitions.pop();for(t=0;t<this._ruleDefinitions.length;t++)i=this._ruleDefinitions[t],this._processRule(i.fieldSelector,i.func,i.message);n===!0&&this.validate()},revalidate:function(){return this._isValidated?this.validate():!1},_showValidationErrors:function(n,t,i){this.options.showValidationMessages&&(n.closest(".form__item").addClass("form__item--has-errors"),this.options.showSummary||t.text(i).slideDown())},validate:function(){var t,i,f,e,o,s,r,h,c;this._isValidated=!0;var a=new Date,u=!0,l=[];for(t=0;t<this._fieldDefinitions.length;t++)i=this._fieldDefinitions[t],f=this._validateField(i.field,i.rules,i.placeholder),f.success||(u=!1,l.push(f.message));if(this.options.showSummary)if(e=this.element.find(this.options.summarySelector),u)e.empty();else{for(o=n("<ul>"),s=this._removeDuplicates(l),r=0;r<s.length;r++)n("<li><\/li>").text(s[r]).appendTo(o);e.html(o)}return h=new Date-a,c="Form validated: "+(u?"Success":"Failure")+" ("+h+"ms)",EC.ServiceSelector.Debug.logToConsole(c),u},_validateField:function(n,t,i){var s=this,u,e,f,o,r;if(!n.is(":visible")&&!n.is('[data-validation~="hidden"]')&&!s.options.includeHiddenFields)return{success:!0};for(u=null,n.is(":radio")||n.is(":checkbox")?(e=n.attr("name"),e?u=this.element.find("[name='"+e+"']:checked").val():n.is(":checked")&&(u=n.val())):u=n.val(),f=0;f<t.length;f++)if(o=t[f],!o.func(u,n,this.element,this))return r=n.data("validation-message"),r||(r=o.message),r||(r="No validation message found!"),this._showValidationErrors(n,i,r),{success:!1,message:r};return this._hideValidationErrors(n,i),{success:!0}},longModulo:function(n,t){for(var i="",f=n.length,u,r=0;r<f;r++)i+=n.charAt(r),u=+i%t,i=u.toString(10);return+i},_checkBeIdentityCardNumber:function(n){var t;if(n.length==0)return!0;if(t=n.replace(/[\s-,.]+/g,""),!/^[0-9]{12}$/.test(t))return!1;var r=+t.substr(10,2),u=t.substr(0,10),i=this.longModulo(u,97);return i===r||i===0},_checkBeNationalNumber:function(n){var t;if(n.length==0)return!0;if(t=n.replace(/[\s-,.]+/g,""),!/^[0-9]{11}$/.test(t))return!1;var i=+t.substr(9,2),r=t.substr(0,9),u=97-this.longModulo(r,97);return u===i?!0:97-this.longModulo("2"+r,97)===i},_checkIBAN:function(n){var i,t;if(n.length==0)return!0;if(i=n.toUpperCase().replace(/[\s-,.]+/g,""),!/^[A-Z0-9]{5,}$/.test(i))return!1;var r=i.substr(4)+i.substr(0,4),f=r.length,u="";for(t=0;t<f;t++)u+=isNaN(+r[t])?(r[t].charCodeAt(0)-55).toString():r[t];return this.longModulo(u,97)===1},_checkRegex:function(n,t){if(n.length==0)return!0;var i=t.data("valregexpattern"),r=t.data("valregexflags"),u=new RegExp(i,r);return n.match(u)!=null}},r;n.widget("EC.ssfvalidator",t);r={addRule:function(n,t){this._ruleDefinitions.push({fieldSelector:n,func:t});this._processRule(n,t)},_processRule:function(t,i){for(var r,u,s=[],h=this.element.find("[data-val-"+t+"]"),e=0;e<h.length;e++){var o=h.eq(e),f=o.attr("name"),c=o.attr("data-val-"+t);if(n.inArray(f,s)!==-1)continue;else s.push(f);for(r=null,u=0;u<this._fieldDefinitions.length;u++)if(this._fieldDefinitions[u].name==f){r=this._fieldDefinitions[u];break}r||(r={field:o,name:f,placeholder:this.element.find('[data-validation-placeholder="'+f+'"]'),rules:[]},this._fieldDefinitions.push(r));r.rules.push({func:i,message:c})}}};n.widget("EC.ssfvalidatorUnobstrusive",n.extend(!0,t,r))}(jQuery),function(n){function t(n,t){for(var i="",f=n.length,u,r=0;r<f;r++)i+=n.charAt(r),u=+i%t,i=u.toString(10);return+i}function r(n){var i=n.replace(/[\s-,.]+/g,"");if(!/^[0-9]{11}$/.test(i))return!1;var r=+i.substr(9,2),u=i.substr(0,9),f=97-t(u,97);return f===r?!0:97-t("2"+u,97)===r}function u(n){var i=n.replace(/[\s-,.]+/g,"");if(!/^[0-9]{12}$/.test(i))return!1;var u=+i.substr(10,2),f=i.substr(0,10),r=t(f,97);return r===u||r===0}function f(n){var u=n.toUpperCase().replace(/[\s-,.]+/g,""),i;if(!/^[A-Z0-9]{5,}$/.test(u))return!1;var r=u.substr(4)+u.substr(0,4),e=r.length,f="";for(i=0;i<e;i++)f+=isNaN(+r[i])?(r[i].charCodeAt(0)-55).toString():r[i];return t(f,97)===1}function e(t,i){if(this.optional(i))return!0;var r=n(i),u=r.data("valRegexoptPattern"),f=r.data("valRegexoptFlags"),e=new RegExp(u,f);return t.match(e)!=null}function o(t,r){console.log("check");var u=n(r),o=u.attr("data-val-requiredif-dependentfield"),f=i(o),e=u.attr("data-val-requiredif-dependentvalues").split(",");return!f.length||!e.length?!0:n.inArray(f.val(),e)===-1?!0:t?!0:!1}function s(t,r){var u=n(r),o=u.attr("data-val-requiredifnot-dependentfield"),f=i(o),e=u.attr("data-val-requiredifnot-dependentvalues").split(",");return!f.length||!e.length?!0:n.inArray(f.val(),e)>-1?!0:t?!0:!1}function i(t){var i=n("[name='"+t+"']");return i.is(":checkbox")||i.is(":radio")?i.filter(":checked"):i}function h(n,t,i){return this.depend(i,t)?t.checked:"dependency-mismatch"}n.validator.addMethod("benationalnumber",function(n,t){return this.optional(t)||r(n)});n.validator.unobtrusive.adapters.addBool("benationalnumber");n.validator.addMethod("becardidentitynumber",function(n,t){return this.optional(t)||u(n)});n.validator.unobtrusive.adapters.addBool("becardidentitynumber");n.validator.addMethod("iban",function(n,t){return this.optional(t)||f(n)});n.validator.unobtrusive.adapters.addBool("iban");n.validator.addMethod("regexopt",e);n.validator.unobtrusive.adapters.addBool("regexopt");n.validator.addMethod("requiredif",o);n.validator.unobtrusive.adapters.addBool("requiredif");n.validator.addMethod("requiredifnot",s);n.validator.unobtrusive.adapters.addBool("requiredifnot");n.validator.addMethod("mustbechecked",h);n.validator.unobtrusive.adapters.addBool("mustbechecked");n.validator.addMethod("isvaliddate",function(n,t,i){return n===null||n.match(/^ *$/)!==null?!0:getDateFromFormat(n,i.dateformat)!=0});n.validator.unobtrusive.adapters.add("isvaliddate",["dateformat"],function(n){n.rules.isvaliddate=n.params;n.messages.isvaliddate=n.message});n.validator.addMethod("isdateinrange",function(n,t,i){if(n===null||n.match(/^ *$/)!==null)return!0;var r=getDateFromFormat(n,i.dateformat),u=getDateFromFormat(n,i.mindate);return r!=0&&u!=0?r-u>0:!1});n.validator.unobtrusive.adapters.add("isdateinrange",["dateformat","mindate"],function(n){n.rules.isdateinrange=n.params;n.messages.isdateinrange=n.message});n.validator.addMethod("isvalidtaxcode",function(n){return n===null||n.match(/^ *$/)!==null?!0:!1});n.validator.unobtrusive.adapters.add("isvalidtaxcode",function(n){n.messages.isvalidtaxcode=n.message})}(jQuery),function(n,t){"use strict";n.widget("cx.ssf_compare_desktop",{options:{moreThan:1,max:5,checkboxSelector:'[data-selector="ssf-compare-checkbox"]',compareItem:"listing__item__compare",compareBarItem:"compare-bar__item",hasCompareBarClass:"has-compare-bar",removingCompareItem:"compare-bar__item--removing",removeableClass:"compare-bar__item--removeable",checkedClass:"listing__item__compare--checked",disabledCheckClass:"listing__item__compare--disabled",waitingClass:"listing__item__compare--waiting",removeAllClass:"compare-bar__remove-link",disabledClass:"is-disabled",hiddenClass:"hidden",errorClass:"error--server",closeClass:"compare-remove",isCollapsed:"compare-bar--is-collapsed",isOpen:"is-showmore--open",collapseClass:"compare--collapse-toggle",compareActiveClass:"is-active",compareButton:"js-btn--compare",compareButtonCount:"listing__btn-bar__count",compareBarButtonClass:"compare-bar__button__action",compareBarButtonCountClass:"compare-bar__button__count",compareBarTextCountClass:"compare-bar__saved-products-count",duration:300,messages:{singleItem:"Please add another item to compare"},templates:{error:'<div class="error {{error_class}}">{{fail_message}}<\/div>',compareItemEmpty:'<li class="compare-bar__item compare-bar__item--removeable"><div class="compare-bar__image__container"><\/div><h3 class="zeta"><\/h3><\/li>',compareItemFull:'{{#data}}<li class="compare-bar__item has-image  compare-bar__item--removeable" data-compare-id="{{id}}"  data-compare-img="{{img}}"  data-compare-title="{{title}}"><div class="compare-bar__image__container"><a tabindex="0" class="compare-remove icon-x"><span class="visuallyhidden">Remove item<\/span><\/a><img src="{{{img}}}" class="compare-bar__image__item" alt="" /><\/div><h3 class="zeta"><a href="{{{href}}}">{{title}}<\/a><\/h3><\/li>{{/data}}'}},widgetEventPrefix:"ssf_compare_desktop_",_create:function(){var i=this;i._html=n("#off-canvas-menu-wrapper");i._checkList=[];(i.element.data("compare_data")||i.element.data("compare_data")!==t)&&(i._checkList=i.element.data("compare_data"));i.bindCheckboxes();i._on(function(){var n={};return n["click ."+i.options.closeClass]=i._removeItem,n["click ."+i.options.collapseClass]=i._collapse,n["keydown ."+i.options.closeClass]=function(n){(n.keyCode===32||n.keyCode===13)&&i._removeItem(n)},n["click ."+i.options.removeAllClass]=i._removeAllItem,n}());i._findCheckboxes();i._listItems=i.element.find(i.options.listItem);i._compareBar=i.element.find(".compare-bar");i._compareBarContent=i.element.find(".compare-bar__content");i._compareList=i._compareBar.find(".compare-bar__list");i._compareButton=i._compareBar.find("."+i.options.compareBarButtonClass);i._compareButtonCount=i._compareBar.find("."+i.options.compareBarButtonCountClass);i._compareTextCount=i._compareBar.find("."+i.options.compareBarTextCountClass);i._collapseButton=i._compareBar.find("."+i.options.collapseClass);i._timeoutId=null;i._wrapperWidth=0;i._on("."+i.options.compareItem,{keydown:function(n){var t=n.keyCode||n.which;(t===32||t===13)&&i._toggleCheckedButtons(n)}});i._renderItems(i._checkList);i.element.addClass(i.options.compareActiveClass);i._revealCompareBar(i._checkList.length);i.countCheckButtons();i._on(i.window,{resize:i._resizeHandler,orientationchange:i._resizeHandler});n(document.body).on("compareitems-updated",function(n,t){console.info("Compared checked ",t);i._checkList=t;i._renderItems(i._checkList);i.element.addClass(i.options.compareActiveClass);i._revealCompareBar(i._checkList.length);i._updateCompareCheckboxes(t);i.countCheckButtons()})},bindCheckboxes:function(){n(document.body).on("click",this.options.checkboxSelector,n.proxy(function(n){this._toggleCheckedButtons(n)},this))},_updateCompareCheckboxes:function(t){for(var u,r=this._findCheckboxes(),f=t.map(function(n){return n.id}),i=0;i<r.length;i++)u=r[i].getAttribute("data-compare-id"),n.inArray(u,f)>-1&&n(r[i]).addClass("listing__item__compare--checked").attr("checked",!0)},_removeFromCollection:function(t){this._checkList=n.grep(this._checkList,function(n){return n.id.toString()!==t.id.toString()})},_resizeHandler:function(){var n=this,t=n._compareBar.width();t<850||t>960||n._wrapperWidth!==t&&(n._wrapperWidth=t,clearTimeout(n._timeoutId),n._timeoutId=setTimeout(function(){},150))},_remotelyUncheckCheckboxes:function(t){var i=this,r=n.grep(i._findCheckboxes(),function(i){var r=n(i).data("compare-id");return r.toString()===t.id.toString()});r&&n(r).removeClass(i.options.checkedClass).attr("checked",!1)},_renderItems:function(n){for(var t=this,u=n.length,f=t.options.max-u,i=Mustache.render(t.options.templates.compareItemFull,{data:n}),r=0;r<f;r++)i+=t.options.templates.compareItemEmpty;t._compareList.empty().html(i);t._tooFewWarning(t._returnRemoveable(),!0)},_toggleCheckedButtons:function(i){var u=n(i.currentTarget),r,f,o,s,e;if(u.is("a")&&i.preventDefault(),r=this,s={type:i.type},u.hasClass(r.options.disabledCheckClass)||u.hasClass(r.options.waitingClass))return!1;if(e={id:u.data("compare-id"),img:u.data("compare-img"),title:u.data("compare-title"),href:u.data("compare-href")},r._removeErrorMessage(u),u.addClass(r.options.waitingClass),u.hasClass(r.options.checkedClass))r._removeEvent(s,u,e);else{if(n.each(r._returnRemoveable(),function(t,i){var u=n(i);if(!u.hasClass("has-image")&&!u.hasClass(r.options.waitingClass))return f=u,u.addClass(r.options.waitingClass),o=t,!1}),f===t)return;r._checkList.push(e);r.countCheckButtons();r._checkList.length<=3&&this._disableCompareButtons(1);r._animateCompareBarHorizontal(r._checkList.length,o);r._trigger("add",null,{id:e,complete:function(n){if(n.status==="failure"){f.removeClass(r.options.removingCompareItem).removeClass(r.options.waitingClass);u.after(Mustache.render(r.options.templates.error,{fail_message:n.fail_message,error_class:r.options.errorClass})).removeClass(r.options.waitingClass).removeClass(r.options.checkedClass).attr("checked",!1);r._removeFromCollection(n.data.id);r.countCheckButtons();r._deleteItem(f);return}u.addClass(r.options.checkedClass).removeClass(r.options.disabledCheckClass).removeClass(r.options.waitingClass).attr("checked",!0);r._addSingleItem(f,n,u);r._tooFewWarning(r._returnRemoveable(),!0)}})}},_addSingleItem:function(n,t,i){var r=this,u=Mustache.render(r.options.templates.compareItemFull,{data:t.data.id});n&&n.replaceWith(u);i.removeClass(r.options.waitingClass).addClass(r.options.checkedClass).attr("checked",!0);r.countCheckButtons()},_animateCompareBarHorizontal:function(n,t){this._compareBarContent.animate({scrollLeft:n>3&&t>2?400:0},this.options.duration)},_removeErrorMessage:function(n){n.next("."+this.options.errorClass).remove()},_removeEvent:function(n,t,i){var r=this,u,f;u=r._compareList.find('[data-compare-id="'+i.id+'"]');u.addClass(r.options.removingCompareItem);f=u.index();u.hasClass(r.options.waitingClass)||(t.addClass(r.options.waitingClass).removeClass(r.options.checkedClass).attr("checked",!1),r._removeErrorMessage(t),r._trigger("remove",null,{id:i,complete:function(e){if(e.status==="failure"){u.removeClass(r.options.removingCompareItem).removeClass(r.options.waitingClass);t.after(Mustache.render(r.options.templates.error,{fail_message:e.fail_message,error_class:r.options.errorClass})).addClass(r.options.checkedClass).removeClass(r.options.waitingClass).attr("checked",!0);n.type==="keydown"&&u.find("."+r.options.closeClass).focus();return}r._animateCompareBarHorizontal(r._checkList.length,f);u.removeClass(r.options.waitingClass);t.removeClass(r.options.waitingClass);r._remotelyUncheckCheckboxes(i);r._deleteItem(u,f,n);r._removeFromCollection(e.data.id);r.countCheckButtons()}}))},_deleteItem:function(n,i,r){var u=this;n.hide(u.options.duration,function(){var f=u._returnRemoveable(),e;if(f.length<6&&(u._compareList.append(Mustache.render(u.options.templates.compareItemEmpty)),u._tooFewWarning(f,!1)),i!==t&&r.type==="keydown"){if(e=f.filter(".has-image").length,e===1){u.element.find(".listing__footer").prop("tabIndex",-1).focus();return}i!==-1&&i>0?u._compareList.children().eq(i-1).find("."+u.options.closeClass).focus():u._compareList.children().eq(i+1).find("."+u.options.closeClass).focus()}setTimeout(function(){n.remove();u.countCheckButtons()},u.options.duration)})},_tooFewWarning:function(n,t){var r=n.filter(".has-image").length,i=t?1:2;r===i&&n.eq(i).find(".zeta").text(this._compareBar.data("add-another-item-text"))},_returnRemoveable:function(){return self._compareList=this._compareBar.find(".compare-bar__list"),self._compareList.children()},countCheckButtons:function(){var n=this._checkList.length,t;this._disableCompareButtons(n);this._disableCheckboxes(n);this._revealCompareBar(n);this._updateCount(this._compareButtonCount,n);this._updateCount(this._compareTextCount,n);this.element.data("compare_data",this._checkList);this.element.find("."+this.options.compareButtonCount).text("("+n+")");t=this.element.find("."+this.options.compareButton);n>this.options.moreThan?t.removeClass(this.options.disabledClass).prop("tabIndex",0):t.addClass(this.options.disabledClass).prop("tabIndex",-1)},_updateCount:function(n,t){n.text(t)},_revealCompareBar:function(n){var t=n!==0;this._compareBar.toggleClass(this.options.hiddenClass,!t);this._compareBar.toggleClass(this.options.compareActiveClass,t);this._html.toggleClass(this.options.hasCompareBarClass,t);this._setToggleButtonText()},_collapse:function(n){var t=this._compareBar.hasClass(this.options.isCollapsed);n.preventDefault();this._compareBar.toggleClass(this.options.isCollapsed,!t);this._setToggleButtonText()},_setToggleButtonText:function(){var n=this._compareBar.hasClass(this.options.isCollapsed),t=n?"view-more-text":"view-less-text";this._collapseButton.toggleClass(this.options.isOpen,!n).text(this._compareBar.data(t))},_removeItem:function(t){t.preventDefault();var i=n(t.currentTarget).closest("."+this.options.compareBarItem),r={id:i.data("compare-id"),img:i.data("compare-img"),title:i.data("compare-title"),href:i.data("compare-href")},u={type:t.type};this._removeEvent(u,i,r);this._compareList.find("."+this.options.errorClass).remove()},_removeAllItem:function(t){t.preventDefault();var i=this,u=n(t.currentTarget).closest("."+i.options.compareBarItem),r=i._returnRemoveable().filter(".has-image");i._findCheckboxes().add(r).addClass(i.options.waitingClass);r.addClass(i.options.removingCompareItem);i._removeErrorMessage(u);i._trigger("remove_all",null,{complete:function(n){if(n.status==="failure"){i._findCheckboxes().removeClass(i.options.waitingClass);i._compareBarContent.append(Mustache.render(i.options.templates.error,{fail_message:n.fail_message,error_class:i.options.errorClass}));r.removeClass(i.options.waitingClass).removeClass(i.options.removingCompareItem);return}i._findCheckboxes().removeClass(i.options.waitingClass).removeClass(i.options.checkedClass).attr("checked",!1);r.removeClass(i.options.waitingClass).removeClass(i.options.removingCompareItem);i._checkList=[];i._animateCompareBarHorizontal(0);i._renderItems(i._checkList);i.countCheckButtons();i._removeErrorMessage(i.element.find("."+i.options.compareItem))}})},_disableCheckboxes:function(n){n>=this.options.max?this._findCheckboxes().not("."+this.options.checkedClass).addClass(this.options.disabledCheckClass).prop("tabIndex",-1):this._findCheckboxes().removeClass(this.options.disabledCheckClass).prop("tabIndex",0)},_disableCompareButtons:function(n){var t=n<=this.options.moreThan,i=t?-1:0;this._compareButton.prop({disabled:t,tabIndex:i}).toggleClass(this.options.disabledClass,t)},_destroy:function(){var n=this;n._off(n.window,"resize orientationchange");n._html.removeClass(n.options.hasCompareBarClass);n._findCheckboxes().next("."+this.options.errorClass).remove()},_findCheckboxes:function(){return n(this.options.checkboxSelector)}});n(function(){n(".js-ssf-listing--desktop, .js-ssf-listing--mobile").ssf_compare_desktop()})}(jQuery);__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(t){var i=function(){function t(n){this.options=$.extend({},n);this.itemsToCompare=this.getItems();this.compareTable=$(".compare-table");this.bindDeleteFromCompare();this.bindShowHideAddMore()}return t.prototype.bindShowHideAddMore=function(){this.itemsToCompare.length>=this.options.maxItemsToCompare?$(".js-addmore-link").hide():$(".js-addmore-link").show()},t.prototype.bindDeleteFromCompare=function(){var t=this;this.itemsToCompare.on("click",function(i){var r=$(i.currentTarget),u=r.data("remove-id"),f={onSuccess:function(){t.removeColumnsAndAddemptyAnimation(r)}};n.ServiceSelector.Ajax.getDataFromAction(t.options.controllerName,t.options.removeItemAction,null,{itemId:u},null,f)})},t.prototype.removeColumnsAndAddemptyAnimation=function(n){var t=this,u;this.itemsToCompare.length-1==1&&(u=this.itemsToCompare.not(n),window.location.href=u.first().data("redirect-url"));var f=this.itemsToCompare.index(n),r=this.compareTable.find("tr"),i=0;r.each(function(n,u){i++;var e=$(u).find("td:eq("+f+")"),o=i;i==r.length&&(o="last");e.hide(400,function(){e.remove();$(u).append(t.options.emptyRowTemplates[o]||"<td><\/td>");i==r.length&&(t.itemsToCompare=t.getItems(),t.removeEnabledClassFromColumnGroup(),t.bindShowHideAddMore())})})},t.prototype.removeEnabledClassFromColumnGroup=function(){var n=this;this.compareTable.find("tr:first td").each(function(t,i){$(i).hasClass("compare-table__top-row--placeholder")&&n.compareTable.find("colgroup col:eq("+(t+1)+")").removeClass("compare-table__column--panel")})},t.prototype.getItems=function(){return $(".compare-remove")},t}(),r;t.CompareBase=i;r=function(n){function t(t){n.call(this,t)}return __extends(t,n),t}(i);t.ServiceSelectorCompare=r})(i=t.SppServiceSelectorBase||(t.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(){function i(n){this.$compare_mobile_version=$(".js-ssf-listing--mobile");this.$compare_desktop_version=$(".js-ssf-listing--desktop");this.$gotoComparePageLink=$(".compare-bar__button__action");this.$gotoCompareMobileButton=$(".js-btn--compare");this.component=$("[data-selector='compare-bar']");this.settings=n;this.initialize();this.bindEvents();this.bindAjaxEvents();this.bindGoToComparePage();this.fetchCompareItemsInSession()}return i.prototype.initializeCxCompareBar=function(n,t){n.ssf_compare_desktop(t)},i.prototype.initialize=function(){n.ServiceSelector.SessionStore.getFromSession("compareIsCollapsed")?this.component.addClass("compare-bar--is-collapsed"):this.component.removeClass("compare-bar--is-collapsed")},i.prototype.bindEvents=function(){this.component.on("click","[data-selector='state-toggle']",$.proxy(this.setCompareBarStateInSession,this))},i.prototype.bindGoToComparePage=function(){var n=this;this.$gotoComparePageLink.click(function(t){t.preventDefault();window.location=n.$gotoComparePageLink.data("url")});this.$gotoCompareMobileButton.on("click",function(t){(t.preventDefault(),$(t.currentTarget).hasClass("is-disabled"))||(window.location=n.$gotoComparePageLink.data("url"))})},i.prototype.fetchCompareItemsInSession=function(){var n={useWaitPanel:!1,onSuccess:function(n){n.length&&$(document.body).trigger("compareitems-updated",[n])}};t.Ajax.getDataFromAction(this.settings.controllerName,this.settings.getItemsAction,null,null,null,n)},i.prototype.bindAjaxEvents=function(){var t=this;this.$compare_mobile_version.on("ssf_compare_mobile_remove",function(n,i){t.executeCompareRequest(i,t.settings.removeItemAction)});this.$compare_mobile_version.on("ssf_compare_mobile_add",function(n,i){t.executeCompareRequest(i,t.settings.addItemAction)});this.$compare_desktop_version.on("ssf_compare_desktop_remove",function(n,i){t.executeCompareRequest(i,t.settings.removeItemAction)});this.$compare_desktop_version.on("ssf_compare_desktop_add",function(n,i){t.executeCompareRequest(i,t.settings.addItemAction,function(n){$(document.body).find("[data-compare-id='"+n+"']").addClass("listing__item__compare--checked")})});this.$compare_desktop_version.on("ssf_compare_desktop_remove_all",function(i,r){var u={onSuccess:function(n){r.complete(n)}};n.ServiceSelector.Ajax.getDataFromAction(t.settings.controllerName,t.settings.clearItemsAction,null,null,null,u)})},i.prototype.executeCompareRequest=function(t,i,r){var f=this,u;r===void 0&&(r=null);u={useWaitPanel:!1,onSuccess:function(n){var i={status:n.Succes?"success":"failure",fail_message:n.ErrorMessage,data:f.createCxDataObject(n.AffectedItem)};t.complete(i);r!==null&&r(n.AffectedItem.Id)}};n.ServiceSelector.Ajax.getDataFromAction(this.settings.controllerName,i,null,{itemId:t.id.id},null,u)},i.prototype.createCxDataObject=function(n){return n?{id:{id:n.Id,href:n.Href,title:n.Name,img:n.ImageUrl}}:null},i.prototype.setCompareBarStateInSession=function(){n.ServiceSelector.SessionStore.storeInSession("compareIsCollapsed",!this.component.hasClass("compare-bar--is-collapsed"))},i}(),u;i.CompareBarBase=r;u=function(n){function t(){n.call(this,{controllerName:"SsfCompareBar",getItemsAction:"GetCompareItemsInSession",addItemAction:"AddServiceOfferToCompare",removeItemAction:"DeleteServiceOfferFromCompare",clearItemsAction:"ClearCompareStore"})}return __extends(t,n),t}(r);i.ServiceSelectorCompareBar=u})(i=t.SppServiceSelectorBase||(t.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(n){var i=function(){function n(n){this.maxAmountOfVisiblePages=9;this.options=n;this.requiresCurrentPageRange=this.options.maxAmountOfPages>this.maxAmountOfVisiblePages;this.bindEvents()}return n.prototype.bindEvents=function(){var n=this;this.options.component.on("click","[data-selector='pagination']",function(t){t.preventDefault();n.options.pushHistory($(t.currentTarget).parent().data("value"))});this.options.component.on("click",".js-next-page",function(t){t.preventDefault();n.options.pushHistory(n.getCurrentPage()+1)});this.options.component.on("click",".js-previous-page",function(t){t.preventDefault();n.options.pushHistory(n.getCurrentPage()-1)})},n.prototype.createPagination=function(n,t){t&&(this.options.maxAmountOfPages=t);this.selectedPage=n;this.setPageItems(t);this.renderPager()},n.prototype.setPageItems=function(n){var i,r,u,t;if(this.pageItems=[],i=n?n:this.options.maxAmountOfPages,this.shownPages=i,i<=this.maxAmountOfVisiblePages){for(t=1;t<=i;t++)this.pageItems.push(this.createPageItem(t));return}if(r=this.selectedPage+2,this.selectedPage<6){for(t=1;t<=r;t++)this.pageItems.push(this.createPageItem(t));this.pageItems.push(this.createPageItem(i-1));this.pageItems.push(this.createPageItem(i));return}for(u=this.selectedPage-2,this.pageItems.push(this.createPageItem(1)),this.pageItems.push(this.createPageItem(2)),t=u;t<=r&&t<i-1;t++)this.pageItems.push(this.createPageItem(t));this.pageItems.push(this.createPageItem(i-1));this.pageItems.push(this.createPageItem(i))},n.prototype.createPageItem=function(n){return new t(n,this.selectedPage,this.options.maxAmountOfPages,this.requiresCurrentPageRange)},n.prototype.renderPager=function(){var n=$("<ul><\/ul>"),t,i;for(this.selectedPage>1&&this.shownPages>1&&n.append(this.renderPrevNextButton("pagination__item--previous",this.options.prevSelector,"js-previous-page","icon-chevron-left")),t=0;t<this.pageItems.length;t++)i=this.pageItems[t],n.append(i.createListEntry()),n.append(this.renderDynamicSpace(i)),n.append(this.renderSpace(i));this.selectedPage<this.shownPages&&this.shownPages>1&&n.append(this.renderPrevNextButton("pagination__item--next",this.options.nextSelector,"js-next-page","icon-chevron-right"));this.options.component.find(this.options.pagerContainer).html(n.prop("outerHTML"))},n.prototype.renderPrevNextButton=function(n,t,i,r){var o=$(t,this.options.component).text(),e=$("<li><\/li>"),u,f;return e.addClass(n),u=$('<a href="#!"><\/a>'),u.addClass(i),f=$("<i class='icon-font'><\/i>"),f.addClass(r),i.indexOf("next")>1?u.append(o,f):u.append(f,o),e.append(u),e},n.prototype.renderDynamicSpace=function(n){return this.requiresCurrentPageRange&&this.selectedPage>3&&this.selectedPage<6&&n.isFirstPage||!this.requiresCurrentPageRange&&(n.isFirstPage&&this.selectedPage>2||n.pageNumber==this.options.maxAmountOfPages-1&&this.selectedPage<this.options.maxAmountOfPages-1)?$("<li class='pagination__dynamic-space'>…<\/li>"):$()},n.prototype.renderSpace=function(n){return this.requiresCurrentPageRange&&(this.selectedPage-2>3&&n.pageNumber==2||n.pageNumber==this.selectedPage+2&&this.selectedPage<this.options.maxAmountOfPages-2)?$("<li class='pagination__space'>…<\/li>"):$()},n.prototype.getCurrentPage=function(){var n=1;return $.each(this.pageItems,function(){this.isCurrentPage&&(n=this.pageNumber)}),n},n}(),t;n.Pager=i;t=function(){function n(n,t,i,r){this.pageNumber=n;this.isCurrentPage=n==t;this.isFirstPage=n===1;this.isLastPage=n==i;this.isNextToCurrentPage=n==t+1||n==t-1;this.isCloseToCurrentPage=n==t+2||n==t-2;this.requiresCurrentPageRange=r}return n.prototype.createListEntry=function(){var n=$("<li data-value='"+this.pageNumber+"'><\/li>"),t;return n.addClass(this.getCssClass()),t=$("<a href='#' data-selector='pagination'><\/a>"),t.text(this.pageNumber.toString()),n.append(t),n},n.prototype.getCssClass=function(){return this.isCurrentPage&&this.isFirstPage?"pagination__item--first pagination__item--current":this.isFirstPage?"pagination__item--first":this.isCurrentPage&&this.isLastPage?"pagination__item--last pagination__item--current":this.isLastPage?"pagination__item--last":this.isCurrentPage?"pagination__item--current":this.isNextToCurrentPage&&this.requiresCurrentPageRange?"pagination__item--current-p1":this.isCloseToCurrentPage&&this.requiresCurrentPageRange?"pagination__item--current-p2":"pagination__item"},n}();n.PageItem=t})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n){this.component=n}return n.prototype.hideQuestion=function(n){n.hide();var t=n.find(":input:hidden");$.each(t,function(n,t){var i=$(t);i.prop("disabled",!0)})},n.prototype.showQuestion=function(n){n.show();var t=n.find(":input:visible");$.each(t,function(n,t){var i=$(t);i.prop("disabled",!1)})},n.prototype.showOrHideArrowBoxes=function(n){var t=$(n.target);t.is(":radio")&&this.showOrHideArrowBoxesForElement(t)},n.prototype.showOrHideArrowBoxForAllQuestion=function(){var n=this,t=$("[data-question]",this.component);$.each(t,function(t,i){var r=$(i).attr("data-question"),u=$("input[name='"+r+"']",i);$.each(u,function(t,i){n.showOrHideArrowBoxesForElement($(i))})})},n.prototype.getAnswerValue=function(n){return n.is(":radio")?n.filter(":checked").val():n.is(":checkbox")?n.is(":checked"):n.val()},n.prototype.showOrHideArrowBoxesForElement=function(n){for(var t,f,r,e=n.attr("name"),u=$("input:radio[name="+e+"]",this.component),i=0;i<u.length;i++)t=$("[data-arrowbox-for-option='"+u[i].id+"']",this.component),f=t.find("fieldset"),t.length>0&&(r=f.not("[data-question]").find(":input").not("input[type=submit]"),u.eq(i).is(":checked")?(t.show(),$.each(r,function(n,t){$(t).prop("disabled",!1)})):(t.hide(),$.each(r,function(n,t){$(t).prop("disabled",!0)})))},n}();n.BaseQuestions=t})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i,r){t.call(this,n);this.options=r;this.mainId="[data-selector='save-profile-component']";this.profileContainerId="#profile-update";this.bindEvents();var u=$($(this.mainId)[0]);u.find(this.profileContainerId).length===0&&u.after("<div id='profile-update' data-scope='profile-update-global-scope'><\/div>");this.profileContainer=u.find(this.profileContainerId);this.controllerName=i}return __extends(i,t),i.prototype.bindEvents=function(){$("[data-selector='saveProfile']","[data-selector='save-profile-component']").on("click",$.proxy(this.saveProfile,this));$("[data-selector='modify']","[data-selector='save-profile-component']").on("click",$.proxy(this.loadSummary,this,!1));$("[data-selector='start-adding-contracts']","[data-selector='save-profile-component']").on("click",$.proxy(this.loadSummary,this,!0))},i.prototype.saveProfile=function(){n.Ajax.sendDataToActionAndUpdate(this.controllerName,"SaveProfileToAscr",null,null,null,{useWaitPanel:!0,onSuccess:this.onSaveProfile})},i.prototype.onSaveProfile=function(){n.WaitPanel.increment();location.reload(!0)},i.prototype.loadSummary=function(t,i){i&&i.preventDefault();t&&($.unsubscribe(n.Events.slideToggleFinished),$.subscribe(n.Events.slideToggleFinished+"summary-add-profile-box",function(){t&&($(".mfp-wrap").scrollTo($("[data-selector='summary-add-profile-box']")),$.unsubscribe(n.Events.slideToggleFinished+"summary-add-profile-box"))}));n.Ajax.sendDataToActionAndUpdate(this.controllerName,"LoadSummaryModal",null,{replyUri:this.options.returnUri,addContractToggled:t},null,{useWaitPanel:!0,onSuccess:function(){n.SppHelper.openModal("#profile-update")}})},i}(n.BaseComponent);t.ProfileSummaryBox=i})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(n){function i(i,r,u){(n.call(this,i),this.showCostBreakDown=r,r)&&(this.options=u,this.costbreakDownList=[],this.costBreakTemplate=new t.TemplateUpdater($(this.options.costBreakDownTemplateSelector,this.component),$(this.options.costBreakDownPlaceholderSelector,this.component)),this.bindEvents())}return __extends(i,n),i.prototype.bindEvents=function(){var n=this;this.component.on("click",this.options.openElementSelector,function(t){var i=n.findCostBreakInfo($(t.currentTarget).data("serviceoffer"));n.costBreakTemplate.updateTemplateWithJson(i)})},i.prototype.updateCostBreakDown=function(n){this.showCostBreakDown&&this.costbreakDownList.push({id:n.ServiceOfferId,PriceDetailSections:n.PriceDetailSections,CostBreakDownFeatureGroup:n.CostBreakDownFeatureGroup})},i.prototype.findCostBreakInfo=function(n){for(var t=0;t<=this.costbreakDownList.length;t++)if(this.costbreakDownList[t].id==n)return this.costbreakDownList[t];return null},i}(n.ServiceSelector.BaseComponent);t.CostBreakDown=i})(i=t.SppServiceSelectorBase||(t.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){"use strict";var r=History,u=function(u){function f(t,f){u.call(this,t);this.options=$.extend({filterBlockSelector:"#filter-mobile",filterTemplateSelector:"#js-filteritem-template",costBreakDownTemplateSelector:"#js-costbreakdown-template",filterPlaceholderSelector:"#js-filter-placeholder",filterSections:[],listTemplateSelector:"#js-listitem-template",costBreakDownPlaceholderSelector:"#js-costbreakdown",listPlaceholderSelector:"#js-service-lister",maxAmountOfPages:1,controllerName:"",showCostBreakdown:!1},f);r.enabled&&r.Adapter.bind(window,"statechange",$.proxy(this.loadPageFromState,this));var e={component:this.component,prevSelector:"#PagerPrevious",nextSelector:"#PagerNext",pagerContainer:"#ListerPager",maxAmountOfPages:this.options.maxAmountOfPages,pushHistory:$.proxy(this.pushHistory,this)};this.pager=new i.Pager(e);this.pager.createPagination(1);this.sortElement=$(".js-sort-offers",this.component);this.initialize();this.bindEvents();this.compareBar=new n.ServiceSelector.SppServiceSelectorBase.ServiceSelectorCompareBar}return __extends(f,u),f.prototype.initialize=function(){var n=this;this.listTemplate=new i.TemplateUpdater($(this.options.listTemplateSelector,this.component),$(this.options.listPlaceholderSelector,this.component),this.options.isToRenderHtml);t.Observer.subscribe("update",$.proxy(function(){n.pushHistory(1)},this),null);t.Observer.subscribe("initializefilters",$.proxy(function(t){n.filters=t},this),null)},f.prototype.bindEvents=function(){this.options.showCostBreakdown&&(this.costBreakDown=new i.CostBreakDown(this.guid,!0,{costBreakDownPlaceholderSelector:this.options.costBreakDownPlaceholderSelector,openElementSelector:".js-costbreakdown-opener",costBreakDownTemplateSelector:this.options.costBreakDownTemplateSelector}));this.bindSorting();this.bindLoadMoreOffers()},f.prototype.checkHistoryOrFirstPage=function(n){var t=this,i=r.getState();i!=null&&(window.location.search.indexOf("list")!=-1?this.loadPageFromState():this.listTemplate.updateTemplate(n,function(){t.togglePagingandEvents(1);$(".js-collapse",t.component).collapsible();$("span.responsive-image").responsive_image()},function(n){t.options.showCostBreakdown&&t.costBreakDown.updateCostBreakDown(n)}))},f.prototype.hideMoreOffersForProvider=function(n){var t=$(n).data("moreoffers-provider"),i=$('[data-selector="load-more-offers"][data-moreoffers-provider="'+t+'"]'),r=$('[id="moreOffers-'+t+'"]');$(n).hide();i.show();r.slideToggle()},f.prototype.loadMoreOffersForProvider=function(n){var o=this,f;t.Observer.fire("triggerInitializefilters",null,null);t.Debug.logToConsole("loadMoreOffersForProvider called",!1,"ajax-update");var u=$(n).data("moreoffers-provider"),e=$('[data-selector="hide-more-offers"][data-moreoffers-provider="'+u+'"]'),s=$(n).data("moreoffers-dataloaded"),i=$('[id="moreOffers-'+u+'"]'),h=r.getState();s?($(n).hide(),e.show(),i.slideToggle()):(f=JSON.stringify({providerName:u,sortOption:this.sortElement.val(),filters:this.filters}),t.Ajax.getDataFromAction(this.options.controllerName,"GetMoreOffersForProvider",null,f,{contentType:"application/json"},{useWaitPanel:!0,onSuccess:function(r){t.Debug.logToConsole("GetMoreOffersForProvider("+JSON.stringify(r)+")",!1,"ajax-update");var u=r.offers;/</.test(u)||(u=$.parseHTML(u),u=u[0].textContent);i.empty().append(u);$(".js-popup",i).modal();$(n).data("moreoffers-dataloaded",!0);$(n).hide();e.show();i.slideToggle();o.compareBar.fetchCompareItemsInSession()}}))},f.prototype.loadPageFromState=function(){var n=this,i=r.getState(),u;i&&i.data.page&&(u=JSON.stringify({page:i.data.page,sortOption:i.data.sorting,filters:i.data.filters}),t.Ajax.getDataFromAction(this.options.controllerName,"GetList",null,u,{contentType:"application/json"},{useWaitPanel:!0,onSuccess:function(r){t.Debug.logToConsole("GetList("+JSON.stringify(r)+")",!1,"ajax-update");n.listTemplate.updateTemplate(r.offers,function(){n.togglePagingandEvents(i.data.page,r.pagecount);n.sortElement.val(i.data.sorting);$.uniform.update(n.sortElement);n.updateTotalResults(r.totalOffers);$(".js-collapse",n.component).collapsible();$("span.responsive-image").responsive_image()},function(t){n.options.showCostBreakdown&&n.costBreakDown.updateCostBreakDown(t)})}}))},f.prototype.updateTotalResults=function(n){$("[data-selector='result-count']",this.component).text(n);var t;t=n>1?$("#multipleOffers").text():$("#singleOffer").text();$("[data-selector='serviceOfferLabel']",this.component).text(t)},f.prototype.bindSorting=function(){var n=this;this.sortElement.on("change",function(){n.pushHistory(1,!0)})},f.prototype.bindLoadMoreOffers=function(){var n=this;$(this.component).on("click",'[data-selector="hide-more-offers"]',function(t){t.preventDefault();n.hideMoreOffersForProvider(t.target)});$(this.component).on("click",'[data-selector="load-more-offers"]',function(t){t.preventDefault();n.loadMoreOffersForProvider(t.target)})},f.prototype.togglePagingandEvents=function(n,t){$(".js-popup").modal();$.publish("domupdated.responsive-image",document.body);this.pager.createPagination(n,t);var i=$(".js-ssf-listing--desktop");i.data("cxSsf_compare_desktop")&&(i.ssf_compare_desktop("bindCheckboxes"),i.ssf_compare_desktop("countCheckButtons"));$(document.body).scrollTo(0)},f.prototype.pushHistory=function(n,i,u){t.Observer.fire("triggerInitializefilters",null,null);var f=$('[data-selector="switch-ascr-profile"]').val();r.pushState({time:(new Date).getTime(),page:n,sorting:u?u:this.sortElement.val(),sort:i?i:!1,filters:this.filters,selectedProfile:f},document.title,"?list")},f}(n.ServiceSelector.BaseComponent);i.ServiceLister=u})(i=t.SppServiceSelectorBase||(t.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i){t.call(this,n);this.options=$.extend({controller:null,locationOptions:[],locationQuestionSelector:"#loc_1",showAscr:!1,validationRequiredMessage:".selectorLocationRequiredValidationMessage"},i);this.initialize()}return __extends(i,t),i.prototype.initialize=function(){this._ac=$(this.options.locationQuestionSelector,this.component);this._ac.length!==0&&(this.initializeAutocomplete(),this.initializeValidation())},i.prototype.initializeAutocomplete=function(){for(var t,i=[],r=0;r<this.options.locationOptions.length;r++)t=this.options.locationOptions[r],i.push({label:t.Label,value:{Region:t.Group,Label:t.Label}});this._ac.data("ui-autocomplete")&&(n.Debug.logToConsole("Destroying existing autocomplete."),this._ac.autocomplete("destroy"));this._ac.autocomplete({source:function(n,t){var u=$.ui.autocomplete.escapeRegex(n.term),f=new RegExp("^"+u,"i"),e=new RegExp(u,"i"),r=$.grep(i,function(n){return f.test(n.label||n.value||n)});r=r.concat($.grep(i,function(n){return $.inArray(n,r)<0&&e.test(n.label||n.value||n)}));t(r.slice(0,15))},minLength:1,autoFocus:!0,focus:function(n){n.preventDefault()},select:function(n,t){n.preventDefault();var i=$(this);i.val(t.item.label)},change:function(n,t){if(t.item==null){var i=$(this);i.val("")}}}).off("keypress focus blur").focus(function(){var n=$(this);n.autocomplete("search",n.val())}).keypress(function(n){n.which==13&&(n.preventDefault(),$(this).blur(),$("form","#q_location").submit())}).blur(function(){var n=$(this);document.activeElement!==$("ul.ui-autocomplete").get(0)&&n.autocomplete("close")});this._ac.data("ui-autocomplete")._renderMenu=function(n,t){var i=this;$.each(t,function(t,r){i._renderItemData(n,r)});n.attr("data-selector","selectorLocationLookupWidget")}},i.prototype.initializeValidation=function(){var n=this;$("form","#q_location").ssfvalidator({showValidationMessages:!0,showSummary:!1});$("form","#q_location").ssfvalidator("addRule","energylocationrequired",function(t,i,r){var e=r.find("#"+i.attr("id")),u=e.val(),f;return u?(f=n.getLocationByLabel(u),f!=null):!1},this.options.validationRequiredMessage)},i.prototype.getLocationByLabel=function(n){for(var t,i=0;i<this.options.locationOptions.length;i++)if(t=this.options.locationOptions[i],t.Label==n)return t;return null},i.prototype.reset=function(){this._ac.val("")},i}(n.BaseComponent);t.ServiceSelectorLocation=i})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){i===void 0&&(i=!1);this.template=n.html();this.targetElement=t;Mustache.parse(this.template);this.isToRenderHtml=i}return n.prototype.updateTemplate=function(n,t,i){this.isToRenderHtml?this.updateTemplateWithHtml(n,t,i):this.updateTemplateWithJson(n,t,i)},n.prototype.updateTemplateWithJson=function(n,t,i){var r,u;if(typeof n=="string"&&(n=$.parseJSON(n)),r="",$.isArray(n))for(u in n)r+=Mustache.render(this.template,n[u]),typeof i=="function"&&i(n[u]);else r+=Mustache.render(this.template,n);this.targetElement.html(r);typeof t=="function"&&setTimeout(function(){t()},0)},n.prototype.updateTemplateWithHtml=function(n,t){if(this.targetElement.empty(),/</.test(n))this.targetElement.append(n);else{var i="",r=$.parseHTML(n);jQuery.each(r,function(n,t){i+=t.textContent});this.targetElement.append(i)}typeof t=="function"&&setTimeout(function(){t()},0)},n}();n.TemplateUpdater=t})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(i){function r(n,r){i.call(this,n);this.saveProfileQuestion="_saveProfile";this.options=$.extend({profilePrefixSelector:'[id$="_DefaultProfileNamePrefix"]',resultUrl:null,labelResultUrl:null,controllerName:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1},r);this.initialize();this.bindEvents();this.geoLocator=new t.GeoLocator;this.geoLocator.startLocatingAndSendToServer(this.options.controllerName,"CollectLocationInfo")}return __extends(r,i),r.prototype.initialize=function(){this.initializeNavigator()},r.prototype.initializeNavigator=function(){},r.prototype.bindEvents=function(){var t=this,i=this;this.component.on("submit","form",$.proxy(this.renderQuestionForm,this));this.component.on("change",'input:not([type="checkbox"]), select',$.proxy(this.questionAnswered,this));this.component.on("click",'input[type="checkbox"]',function(n){$(this).val($(this).is(":checked").toString());i.questionAnswered(n)});this.bindExtraEvents();$(".js-btn-start").on("click",function(n){n.preventDefault();var i=$("[data-selector='outOfDateError']",t.component),r=$("form","#q_location");i.length>0&&i.hide();r.length>0&&r.find("input").val("");t.navigator.goToNextStep()});$(document.body).on("click",'[data-selector="submitAscr"] button,[data-selector="submitAscr"] a',function(i){console.info("VIEW RESULTS",t.options.controllerName);i.preventDefault();var r={profile:$(i.target).closest("[data-ascr-id]").data("ascr-id")},u={onSuccess:function(){$("#location-redirect-link").length===0&&(t.navigator.goToNextStep(),t.reloadServiceSelector(),t.questionsAnsweredLogic(null))}};n.Ajax.sendDataToActionAndUpdate(t.options.controllerName,"LoadAscrProfile",null,r,null,u)})},r.prototype.bindExtraEvents=function(){},r.prototype.questionsAnsweredLogic=function(){},r.prototype.renderQuestionForm=function(t){var i=this,r;(t.preventDefault(),r=t.target,$(".field-validation-error",this.component).hide(),$(r).ssfvalidator("validate"))&&n.Ajax.submitFormAndUpdate(r,{useWaitPanel:!0,onSuccess:function(){i.navigator.goToNextStep();i.reloadServiceSelector();i.questionsAnsweredLogic(null)},onValidationFailed:function(){i.reloadServiceSelector();i.questionsAnsweredLogic(null)}})},r.prototype.reloadServiceSelector=function(){$(".js-popup",this.component).modal();$(".form__field--select",this.component).uniform();$("form",this.component).ssfvalidator({showValidationMessages:!0})},r.prototype.questionAnswered=function(n){this.questionsAnsweredLogic(n);$.uniform.update()},r}(n.BaseComponent);t.BaseQuestionnaire=i})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){"use strict";var r=function(i){function r(n){i.call(this,$("#profile-update"));this.options=n;this.component=$("#profile-update");this.controllerName=n.controllerName;this.resultPageUrl=n.resultPageUrl;this.reload=n.shouldReload;this.isNotSaved=!n.currentProfileIsSaved;this.contractsFeatureEnabled=n.contractsFeatureEnabled;this.initialize();this.bindEvents();this.setupDataScopeTracker(this);n.addContractToggled&&this.toggleAddContract()}return __extends(r,i),r.prototype.initialize=function(){$(".js-popup",this.component).modal();$(".js-collapse",this.component).collapsible();$(".js-reveal-panel",this.component).reveal_panel();$(".js-edit-field",this.component).edit_field();$(".form__field--select",this.component).uniform();this.requiredServiceValidationBox=$("#requiredServices");this.dirtyBit=!1;var n=this.component.find("[data-selector='summary-questions'][disabled='disabled']");n.find("input, textarea, select").prop("disabled",!0)},r.prototype.bindEvents=function(){$("[data-selector='remove-profile']",this.component).on("click",$.proxy(this.removeProfile,this));$("[data-selector='remove-current-profile']",this.component).on("click",$.proxy(this.removeCurrentProfile,this));$("[data-selector='switch-profile']",this.component).on("click",$.proxy(this.switchProfile,this));$("[data-action='add-profile']",this.component).on("click",$.proxy(this.addProfile,this));this.component.off("edit_field_save").on("edit_field_save",$.proxy(this.renameProfile,this));$("input, select",this.component).on("change",$.proxy(this.showHideQuestions,this));$("input[type=checkbox]",this.component).not(".default-checkbox-behaviour").on("click",function(){$(this).val($(this).is(":checked").toString())});$("h3.is-editable--active",this.component).keydown($.proxy(this.showHideQuestions,this));$("[data-selector='remove-service']",this.component).on("click",$.proxy(this.removeService,this));$("[href^='#modify-']",this.component).on("click",$.proxy(this.addOrUpdateClicked,this));$("form",this.component).on("submit",$.proxy(this.submitForm,this));$("[data-selector='close-popup']",this.component).on("click",$.proxy(this.onClosePopup,this))},r.prototype.showHideQuestions=function(n){this.showHideQuestionsLogic(n);$.uniform.update()},r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null)},r.prototype.changeScopeModifiedState=function(n,i){i===void 0&&(i=!1);t.ChangeTrackerDataScope.trackChange(n,i)},r.prototype.removeProfile=function(n){var r=this,i=$(n.target),u=i.data("profilename");t.Ajax.getDataFromAction(this.controllerName,"RemoveProfile",null,{id:u},null,{useWaitPanel:!0,onSuccess:function(){i.parents(".js-removeable").hide();r.toggleViewMoreAndAddProfileButtons()}})},r.prototype.toggleViewMoreAndAddProfileButtons=function(){var n=$("[data-selector='other-profiles']",this.component);n.find(".js-removeable:visible").length===0&&(n.hide(),$("[data-selector='add-profile-single']",this.component).show(),$("[href='#delete-profile']",this.component).hide())},r.prototype.removeService=function(n){this.changeScopeModifiedState(n,!0);var r=$(n.target),t=r.parents(".js-removeable"),u=t.find("[data-selector='add-link-panel']"),f=t.find("[data-hide]"),i=t.find("[data-selector='summary-questions']");u.show();f.hide();i.prop("disabled",!0);this.showHideQuestions(null);i.find("input, textarea, select").prop("disabled",!0)},r.prototype.addProfile=function(n){if(!this.confirmedUnsavedChanges()){n.preventDefault();return}},r.prototype.addOrUpdateClicked=function(n){var i=$(n.target),r=i.parents(".js-removeable"),t=r.find("[data-selector='summary-questions']");t.prop("disabled",!1);t.find("input, textarea, select").prop("disabled",!1);this.requiredServiceValidationBox.hide();this.showHideQuestions(null)},r.prototype.removeCurrentProfile=function(){this.confirmedUnsavedChanges()&&(this.contractsFeatureEnabled?(t.WaitPanel.increment(),t.Ajax.getDataFromAction(this.controllerName,"RemoveCurrentProfile",null,null,null,{useWaitPanel:!0,onSuccess:function(n){window.location.href=n.url}})):t.Ajax.sendDataToActionAndUpdate(this.controllerName,"RemoveCurrentProfile",null,null,null,{useWaitPanel:!0}))},r.prototype.switchProfile=function(n){if(this.confirmedUnsavedChanges()&&this.confirmedUnsavedProfile()){var i=this,r=$(n.target),u=r.data("profilename");t.Ajax.sendDataToActionAndUpdate(this.controllerName,"SwitchProfile",null,{id:u},null,{useWaitPanel:!0,onSuccess:function(){i.initialize()}})}},r.prototype.renameProfile=function(n,i){var r=this,u={profileName:i.text};t.Ajax.getDataFromAction(this.controllerName,"UpdateCurrentProfileName",null,u,null,{useWaitPanel:!0,onSuccess:function(t){i.complete(t);$("[data-selector='profile-name']","[data-selector='save-profile-component']").text(t.text);r.changeScopeModifiedState(n,!1)}})},r.prototype.submitForm=function(n){n.preventDefault();this.validateAndSumbitForm(this.resultPageUrl)},r.prototype.validateAndSumbitForm=function(){},r.prototype.onClosePopup=function(n){if(!this.confirmedUnsavedChanges()){n.preventDefault();n.stopPropagation();return}this.reload&&(t.WaitPanel.increment(),document.location.href=this.resultPageUrl);this.options.cancelUrl!==""&&(document.location.href=this.options.cancelUrl)},r.prototype.confirmedUnsavedChanges=function(){var n=$("#dirtybit_ascrprofile_message").text(),i=t.ChangeTrackerDataScope.hasPendingChanges();return!i||n!=""&&confirm(n)&&t.ChangeTrackerDataScope.resetPendingChanges()},r.prototype.confirmedUnsavedProfile=function(){var n=$("#dirtybit_ascrprofile_message").text();return!this.isNotSaved||n!=""&&confirm(n)},r.prototype.toggleAddContract=function(){$("[data-selector='summary-add-profile-box']").slideToggle(null,function(){return $.publish(n.ServiceSelector.Events.slideToggleFinished+"summary-add-profile-box")})},r.prototype.hideExpenses=function(){$("[data-selector='summaryModal_totalExpenses']").hide();$("[data-selector='summaryModal_bestSavingAmount']").hide();$("[data-selector='summaryModal_recalculateBestSavings']").show()},r.prototype.loadEditFrame=function(){var n=$(this).data("value");t.Ajax.sendDataToActionAndUpdate("ContractDetails","EditContract",null,{contractId:n,divId:"edit-contract-frame-"+n},null,{onSuccess:function(){return $("#edit-contract-frame-"+n).slideToggle()}})},r.prototype.actuallySelectAllSelectedContracts=function(){var n=this,t=$('div[data-selector="related-contracts"] input[type="checkbox"]:checked');t.each(function(t,i){return n.actuallyCheck(i)})},r.prototype.actuallyCheck=function(n){var t=$(n);t.val(t.data("value"))},r}(t.ChangesTrackableDataScope);i.SppBaseSummary=r})(i=t.SppServiceSelectorBase||(t.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(){function t(n){this.controllerName=n.controllerName;this.initialize();this.bindEvents()}return t.prototype.initialize=function(){this.loadFromState()},t.prototype.bindEvents=function(){$("[data-selector='switch-ascr-profile']").on("change",$.proxy(this.switchProfile,this))},t.prototype.loadFromState=function(){var n=i.getState();n&&n.data.page&&n.data.selectedProfile&&$("[data-selector='switch-ascr-profile']").val(n.data.selectedProfile)},t.prototype.switchProfile=function(t){if(this.confirmedUnsavedChanges()&&this.confirmedUnsavedProfile()){var i=this,r=$(t.target),u=r.children("option:selected").first().text();n.Ajax.sendDataToActionAndUpdate(this.controllerName,"ChangeAscrProfile",null,{profile:u},null,{useWaitPanel:!0,onSuccess:function(){i.initialize()}})}},t.prototype.confirmedUnsavedChanges=function(){var n=$("#dirtybit_ascrprofile_message").text();return!this.dirtyBit||n!=""&&confirm(n)},t.prototype.confirmedUnsavedProfile=function(){var n=$("#dirtybit_ascrprofile_message").text();return!this.isNotSaved||n!=""&&confirm(n)},t}();t.SppBaseProfileHeader=r})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(t){var f=function(){function t(n){this.options=n;this.initialize();this.bindEvents()}return t.prototype.initialize=function(){var t=this,n;this.Component=$("#alert-popup");this.form=$("form",this.Component);$(".js-conditional",this.Component).conditional_form_item();$(".form__field--select",this.Component).uniform();this.Component.ssfvalidator({showValidationMessages:!0});n=$("[data-selector$='_provider']",this.Component);$.each(n,function(n,i){t.showProviderTariffs(i)});this.showHideDefaultFrequencyBlock()},t.prototype.bindEvents=function(){var n=this,t=this;this.addTextAreaCallback("Consumption",$.proxy(this.usageTimeRangeChanged,this),400);$("[data-selector='usage_timerange']",this.Component).change($.proxy(this.usageTimeRangeChanged,this));$("[data-selector$='_provider']",this.Component).change(function(n){t.showProviderTariffs(n.target)});this.Component.on("click","[data-selector='submit-alert']",$.proxy(this.validateSubmit,this));if(this.options.cancelUrl!=="")this.Component.on("click","[data-selector='close-popup']",function(){window.location.href=n.options.cancelUrl})},t.prototype.updateDefaultFrequencyConsumption=function(){var r=this,u=$("[data-selector='usage_value']",this.Component).val(),f=$("[data-selector='usage_timerange']",this.Component).val(),t=this.getConsumptionValue(u),i;if(t===0){this.setDefaultFrequencyAmount(t);return}i={amount:$("#Consumption").val().replace(",","."),frequencyId:f};n.Ajax.getDataFromAction(this.options.controllerName,"GetTotalCasConsumptionAmountForJs",null,JSON.stringify(i),{contentType:"application/json"},{useWaitPanel:!1,onSuccess:function(n){return r.setDefaultFrequencyAmount(n)}})},t.prototype.usageTimeRangeChanged=function(){this.showHideDefaultFrequencyBlock();this.updateDefaultFrequencyConsumption()},t.prototype.showHideDefaultFrequencyBlock=function(){var n=$("[data-selector='yearblock']",this.Component),t=$("#ConsumptionFrequency").val();t===this.options.totalAmountFrequencyId?n.length>0&&n.hide():n.length>0&&n.show()},t.prototype.setDefaultFrequencyAmount=function(n){var t;t=n===0?"--":parseFloat(n.toFixed(2)).toString().replace(".",",");$("[data-selector='calculated-annual-consumption']",this.Component).text(t)},t.prototype.getConsumptionValue=function(n){if(n!=undefined){var t=n.lastIndexOf("."),i=n.lastIndexOf(","),u=t>i?".":",",f=t<=i?".":",",e=n.replace(f,"").replace(u,"."),r=parseFloat(e);return isNaN(r)?0:r}return 0},t.prototype.showProviderTariffs=function(n){var i=$(n),u=i.parents(".form__group__items"),t=u.find("[data-selector$='_tariff']"),f=u.find("[data-selector$='_tariff_ph']"),e=i.data("scope"),r=this.getProviderTariffs(i.val());t.empty();$("<option />").appendTo(t);$(r).each(function(){if(this.ServiceScopes.indexOf(e)!=-1){var n=$("<option />",{val:this.TariffName,text:this.TariffName});this.TariffName==t.data("initialvalue")&&n.attr("selected","selected");n.appendTo(t)}});$.uniform.update();r!=null&&r.length>0?f.show():f.hide()},t.prototype.getProviderTariffs=function(n){for(var t,i=0;i<this.options.providerAndTariffs.length;i++)if(t=this.options.providerAndTariffs[i],t.ProviderName==n)return t.Tariffs;return null},t.prototype.validateSubmit=function(t){var f,e,o;if(t.preventDefault(),t.stopPropagation(),this.Component.ssfvalidator("validate")){var i="",r=!0,u=$("#errorMessageBox"),s=$("[data-selector='alertcheckbox']",this.Component).filter(":checked");if(s.length<1&&(i+=$(this.options.alertTypeErrorMessageSelector).text(),i+="<br/>",r=!1),f=$("[data-selector='deliverycheckbox']",this.Component).filter(":checked"),f.length<1&&(i+=$(this.options.deliveryErrorMessageSelector).text(),r=!1),!r){u.html(i);u.show();return}u.hide();e=this;o=this.createPayload();n.Ajax.sendDataToActionAndUpdate(this.options.controllerName,"SaveAlerts",null,JSON.stringify(o),{contentType:"application/json"},{useWaitPanel:!0,onSuccess:function(){n.WaitPanel.increment();window.location.href=e.options.resultUrl}})}},t.prototype.createPayload=function(){var n=new i,t,o,s,f,h,l,e,c,a;return n.EmailAddress=$("#EmailAddress",this.Component).val(),n.GsmNr=$("#send-sms",this.Component).is(":checked")?$("#gsm_value",this.Component).val():"",t=$("#cheaper",this.Component),t.length>0&&t.is(":checked")&&(o=$("#Consumption",this.Component),s=$("#ConsumptionFrequency",this.Component),n.CheaperOfferAlertId=t.val(),n.AlertFrequency=$("#AlertFrequency",this.Component).val(),n.Consumption=o.length>0?o.val():"",n.ConsumptionFrequency=s.length>0?s.val():""),f=$("#supply",this.Component),f.length>0&&f.is(":checked")&&(n.ImportantServiceSupplyChangeAlertId=f.val(),h=[],l=$("[data-selector='contractchange']",this.Component),l.each(function(n,t){var i=$("[data-selector$='_provider']",t),u;i.length<1||i.val()===""||(u=$("[data-selector$='_tariff']",t),u.length<1||u.val()==="")||h.push(new r(i.data("scope"),i.val(),u.val()))}),n.ContractChanges=h),e=$("#contract",this.Component),e.length>0&&e.is(":checked")&&(n.ServiceSupplyContractEndAlertId=e.val(),c=[],a=$("[data-selector='contractend']",this.Component),a.each(function(n,t){var i=$(t);i.length<1||i.val()===""||c.push(new u(i.data("scope"),i.val()))}),n.ContractEnd=c),n},t.prototype.addTextAreaCallback=function(n,t,i){var r=null;$("#"+n).keydown(function(){r&&window.clearTimeout(r);r=window.setTimeout(function(){r=null;t()},i)})},t}(),i,r,u;t.Alerts=f;i=function(){function n(){}return n}();t.UpdateAlert=i;r=function(){function n(n,t,i){this.ServiceScope=n;this.ProviderName=t;this.TariffName=i}return n}();t.ContractChange=r;u=function(){function n(n,t){this.ServiceScope=n;this.EndDate=t}return n}();t.ContractEnd=u})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(){function t(n,t){var i={onBeforeShowResults:jQuery.noop,resultUrl:null,labelResultUrl:null,showFieldValidation:!0,firstStep:"location",shouldHideAdditionalRegions:!0,stepToHideAdditionalRegions:"location",onStepLoaded:null,contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1};this.element=n;this.options=$.extend(i,t);this.bindEvents()}return t.prototype.bindEvents=function(){if(!i.enabled){alert("This application requires window.History. Please enable or switch browser.");return}i.Adapter.bind(window,"statechange",$.proxy(this.loadStepFromState,this))},t.prototype.loadStepFromState=function(){var t=i.getState(),u=this.options.firstStep,e=!1,r,o,f,s;if(t.data.step!=undefined?t.data.step==u&&(e=!1):e=!0,t.data.step!=u?$("#questionnaire-wrapper").show():$("#questionnaire-wrapper").hide(),r=$("input:hidden[data-selector='sitestat-url']").val(),e)n.Debug.logToConsole("Set initial step: "+u),i.replaceState({step:u},document.title,"?"+u);else{n.Debug.logToConsole("Load step: "+t.data.step);try{t.data.step!=u&&(r==""||typeof r=="undefined"||(o=r.indexOf("&",r.indexOf("?")),f=r.substr(0,o)+".profilingpage."+window.location.search.substr(1)+r.substr(o),f=f+"&step="+t.data.step+"&ns_sc_href="+encodeURIComponent(document.URL),udm_(f)))}catch(e){}s=t.data.step;this.showStep(s)}},t.prototype.showStep=function(n){$("[id^='q_']",this.element).hide();var t=$("#q_"+n,this.element);if(n!=="landingpage"&&t.find("form").length===0&&i.replaceState({step:this.options.firstStep},document.title,"?"+this.options.firstStep),t.show(),this.options.shouldHideAdditionalRegions&&(n==this.options.stepToHideAdditionalRegions?$("#questionnaire-right-location-only",this.element).show():$("#questionnaire-right-location-only",this.element).hide()),t.offset().top<$(document).scrollTop()&&$.scrollTo(t,{duration:"medium"}),typeof this.options.onStepLoaded=="function")this.options.onStepLoaded(n)},t.prototype.getNextStepLogic=function(){return"Implement in subclasses"},t.prototype.getNextStep=function(){return this.getNextStepLogic()},t.prototype.goToNextStep=function(){var n=this.getNextStep();this.goToStep(n)},t.prototype.goToStep=function(t){var r=t,u;if(r==null){this.options.onBeforeShowResults();n.WaitPanel.increment();location.href=this.options.labelResultUrl;return}u=i.getState();$.publish("domupdated.conditional-form",$("[data-selector='saveprofile-panel']").get(0));i.pushState({step:r,modifyProfile:u.data.modifyProfile},document.title,"?"+r)},t.prototype.goToResults=function(){location.href=this.options.labelResultUrl},t.prototype.isAscrQuestionEnabled=function(){return $("#_saveProfile",this.element).length===1},t.prototype.userIsAuthenticated=function(){return this.options.userIsLoggedIn},t.prototype.shouldIncludeContractsFeatureInWizard=function(){return this.options.contractsFeatureEnabled},t}();t.BaseNavigator=r})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(t){function i(n,i,r){t.call(this,n);this.options=r;this.controllerName=i;this.bindEvents()}return __extends(i,t),i.prototype.bindEvents=function(){this.component.on("click","[data-selector='load-alerts']",$.proxy(this.loadAlerts,this));this.component.on("click","[data-selector='delete-alerts']",$.proxy(this.deleteAlerts,this))},i.prototype.loadAlerts=function(){n.Ajax.sendDataToActionAndUpdate(this.controllerName,"GetAlerts",null,{returnUri:this.options.returnUri},null,{onSuccess:function(){n.SppHelper.openModal("#alert-popup")}})},i.prototype.deleteAlerts=function(t){t.preventDefault();var i=$(t.currentTarget).data("confirm");i!=null&&confirm(i)&&n.Ajax.sendDataToActionAndUpdate(this.controllerName,"DeleteAlerts",null,null,null,null)},i}(n.BaseComponent);t.BaseAlertBox=i})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(t){var i=function(){function t(){this.goalocationoptions={maximumAge:12e5}}return t.prototype.canUseLocation=function(){return navigator.geolocation&&navigator.geolocation.getCurrentPosition?!0:!1},t.prototype.startLocatingAndSendToServer=function(t,i,r){this.canUseLocation()&&navigator.geolocation.getCurrentPosition(function(u){var f={lat:u.coords.latitude,lon:u.coords.longitude},e=u.timestamp,o=(new Date).getTime();o-e<1e3&&n.Ajax.getDataFromAction(t,i,null,f,null,{useWaitPanel:!1,onSuccess:function(){typeof r=="function"&&r(f)}})},null,this.goalocationoptions)},t}();t.GeoLocator=i})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){"use strict";var r=History,u=function(n){function u(t,i){n.call(this,t);this.options=$.extend({filterBlockSelector:"#filter-mobile",filterTemplateSelector:"#js-filteritem-template",filterPlaceholderSelector:"#js-filter-placeholder",filterSections:[],controllerName:""},i);this.initialize();this.bindEvents()}return __extends(u,n),u.prototype.initialize=function(){var n=this;t.Debug.logToConsole("Filter:initialize");this.filterBlock=$(this.options.filterBlockSelector,this.component);this.filterTemplate=new i.TemplateUpdater($(this.options.filterTemplateSelector,this.component),$(this.options.filterPlaceholderSelector,this.component));this.updateFilters(this.options.filterSections);this.filterBlock.on("change","input",function(){var i=JSON.stringify({filters:n.getCurrentFilters(),page:1});t.Observer.fire("update",i,null)});this.loadPageFromState();t.Observer.subscribe("update",$.proxy(function(t){n.doUpdate(t)},this),null);t.Observer.subscribe("triggerInitializefilters",$.proxy(function(){n.triggerIntitializeFilter()},this),null)},u.prototype.triggerIntitializeFilter=function(){t.Observer.fire("initializefilters",this.getCurrentFilters(),null)},u.prototype.doUpdate=function(n){var i=this;t.Debug.logToConsole("Filter:doUpdate");t.Ajax.getDataFromAction(this.options.controllerName,"GetFilters",null,n,{contentType:"application/json"},{useWaitPanel:!0,onSuccess:function(n){t.Debug.logToConsole("GetFilters("+JSON.stringify(n)+")",!1,"ajax-update");i.updateFilters(n.Sections)}})},u.prototype.bindEvents=function(){this.bindFilters()},u.prototype.loadPageFromState=function(){var u=this,n,i;t.Debug.logToConsole("Filter:loadPageFromState");n=r.getState();n&&n.data.page&&(i=JSON.stringify({page:n.data.page,sortOption:n.data.sorting,filters:n.data.filters}),t.Ajax.getDataFromAction(this.options.controllerName,"GetFilters",null,i,{contentType:"application/json"},{useWaitPanel:!0,onSuccess:function(n){t.Debug.logToConsole("GetFilters("+JSON.stringify(n)+")",!1,"ajax-update");u.updateFilters(n.Sections)}}))},u.prototype.bindFilters=function(){this.filterBlock.on("change","input:checkbox, input:radio",$.proxy(this.filterSelectionChanged,this));this.filterBlock.on("click","[data-selector='filter-clear-subsection']",$.proxy(this.clearCurrentFilter,this));this.filterBlock.on("click","[data-selector='filter-summary-item']",$.proxy(this.filterSummaryItemRemoved,this));this.filterBlock.find(".js-collapse").bind("collapsible_collapsible_before_open",$.proxy(this.hideFilterSummary,this)).bind("collapsible_collapsible_before_close",$.proxy(this.showFilterSummary,this))},u.prototype.updateFilters=function(n){var u,i,f,r;for(t.Debug.logToConsole("Filter:UpdateFilters: "+n),u=this,i=0;i<n.length;i++)f=n[i],r=$("[data-filter-section-id="+f.Id+"]"),r&&r.hasClass("is-collapsible--active")&&(n[i].IsCollapsibleOpen=!0);this.filterTemplate.updateTemplateWithJson(n,function(){u.initializeCollapsible();$(".js-popup").modal()})},u.prototype.initializeCollapsible=function(){t.Debug.logToConsole("Filter:initializeCollapsible");var n=$(".js-collapse",this.component);n.data("cx-collapsible")&&n.collapsible("destroy");n.collapsible()},u.prototype.filterSelectionChanged=function(n){n===void 0&&(n=null);n!=null&&n.preventDefault()},u.prototype.clearCurrentFilter=function(n){var i,r;n.preventDefault();i=$(n.target).data("clearfilter");this.filterBlock.find('input[data-filter-id="'+i+'"]').prop("checked",!1);r=JSON.stringify({filters:this.getCurrentFilters(),page:1});t.Observer.fire("update",r,null)},u.prototype.filterSummaryItemRemoved=function(n){var t,i;n.preventDefault();t=$(n.target);t.hasClass("icon-x")&&(t=$(n.target).parent());i=t.data("option-id");this.filterBlock.find('input[id="'+i+'"]').prop("checked",!1).change();t.data("should-hide-summary")&&t.parents("[data-selector=filter-summary-section]").hide();this.filterSelectionChanged(null)},u.prototype.showFilterSummary=function(n,t){var i=$(t.panel[0]);$("[data-selector=filter-summary-section]",i).slideDown()},u.prototype.hideFilterSummary=function(n,t){var i=$(t.panel[0]);$("[data-selector=filter-summary-section]",i).slideUp()},u.prototype.getCurrentFilters=function(){for(var n,t,r=[],u=this.filterBlock.find("input:checked"),i=0;i<u.length;i++)(n=u.eq(i),t=n.data("filter-id"),t)&&r.push({filter:t,option:n.val()});return r},u}(n.ServiceSelector.BaseComponent);i.Filter=u})(i=t.SppServiceSelectorBase||(t.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(t){var i=function(n){function i(i,r){n.call(this,i);this.options=$.extend({controllerName:""},r);this.compareBar=new t.ServiceSelectorCompareBar;this.compareBar.initializeCxCompareBar($("[data-js-guid='"+i+"']"),null)}return __extends(i,n),i}(n.ServiceSelector.BaseComponent);t.DetailHeader=i})(i=t.SppServiceSelectorBase||(t.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){"use strict";var r=function(i){function r(n,t,r,u){i.call(this,r);this.serviceSelectorControllerName=u;this.controllerName=n;this.actionName=t;this.form=this.component.find("form")}return __extends(r,i),r.prototype.initialize=function(){this.bindEvents();this.initializeValidation()},r.prototype.initializeValidation=function(){this.form.ssfvalidator({showValidationMessages:!0});this.form.ssfvalidator("addRule","required-contracts-if-needed",$.proxy(this.isValidContractSelection,this),"[data-selector='required-contracts-message']")},r.prototype.startAddingContractsOption=function(){return this.component.find('[data-selector="start-adding-contracts"]')},r.prototype.bindEvents=function(){var n=this;this.startAddingContractsOption().on("click",function(){n.showContractManagement()});this.component.find('[data-selector="dont-add-contracts"]').on("click",function(){n.hideContractManagement()});this.component.find("[data-selector='add-new-contract-button']").on("click",function(){return n.openContractDetailsModal()});this.component.find('[data-selector="continue-button"]').on("click",function(t){return n.submitContractSelection(t)})},r.prototype.submitContractSelection=function(n){this.form.ssfvalidator("validate")||n.preventDefault()},r.prototype.isValidContractSelection=function(){if(!this.startAddingContractsOption().is(":checked"))return!0;var n=this.component.find('[name="selectedContracts"]'),t=function(n,t){return $(t).is(":checked")};return n.filter(t).length>0},r.prototype.showContractManagement=function(){this.yourContractsComponent().show()},r.prototype.yourContractsComponent=function(){return this.component.find('[data-selector="your-contracts"]')},r.prototype.hideContractManagement=function(){this.yourContractsComponent().hide();$.publish(n.ServiceSelector.Commands.clearContractSelection,this.component[0])},r.prototype.openContractDetailsModal=function(){t.Ajax.sendDataToActionAndUpdate(this.controllerName,this.actionName,null,{serviceSelectorControllerName:this.serviceSelectorControllerName},null,{onSuccess:function(){return t.SppHelper.openModal("#contract-details-popup")}})},r}(t.BaseComponent);i.ContractOverview=r})(i=t.SsfContractManagement||(t.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i,r){t.call(this,n);this.form=this.component.find("[data-selector='contract-details-form']");this.controllerName=i;this.serviceSelectorControllerName=r;this.deleteButton=this.component.find("[data-selector='delete-contract-button']");this.deleteConfirmationBox=this.component.find("[data-selector='delete-confirmation-box']")}return __extends(i,t),i.prototype.initialize=function(n){this.bindEvents();n&&this.deleteButton.show();this.setupDataScopeTracker(this)},i.prototype.bindEvents=function(){var n=this;this.component.find("[data-selector='save-contract-button']").on("click",function(){return n.saveContract()});this.component.find("[data-selector='delete-contract-button']").on("click",function(){return n.showDeleteConfirmation()});this.component.find("[data-selector='delete-contract-cancel-button']").on("click",function(){return n.cancelDelete()});this.component.find("[data-selector='delete-contract-confirmation-button']").on("click",function(){return n.deleteContract()})},i.prototype.showDeleteConfirmation=function(){this.deleteButton.hide();this.deleteConfirmationBox.show()},i.prototype.cancelDelete=function(){this.deleteButton.show();this.deleteConfirmationBox.hide()},i.prototype.saveContract=function(){if(this.form.ssfvalidator("validate")){var n=this.form.find("[name='expensesAmount']").val();this.comscoreTrackExpenseAmount(n);this.submit()}else console.log("KO!")},i.prototype.submit=function(){var t=this;n.Ajax.getDataFromAction(this.controllerName,"SaveContract",this.form.find(":input").serialize(),{},null,{useWaitPanel:!0,onSuccess:function(){return t.onSuccessfullySavedContract()},onValidationFailed:function(){return alert("Contract details were invalidated by the backend!")}})},i.prototype.onSuccessfullySavedContract=function(){this.trackChange(!1);this.close();this.refreshContractsList()},i.prototype.close=function(){this.component.find("[data-selector='close-popup']").click()},i.prototype.deleteContract=function(){var t=this;n.Ajax.sendDataToActionAndUpdate(this.controllerName,"DeleteContract",null,{contractId:this.findContractId()},null,{onSuccess:function(){t.refreshContractsList();t.close()}})},i.prototype.findContractId=function(){return this.component.find("[data-selector='temporaryId']").val()},i.prototype.refreshContractsList=function(){n.Ajax.sendDataToActionAndUpdate("SSFContractOverview","Contracts",null,{divToUpdate:"contracts-list",serviceSelectorController:this.serviceSelectorControllerName},null,null)},i}(n.BaseContractComponent);t.ContractDetailsModal=i})(t=n.SsfContractManagement||(n.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i){t.call(this,n);this.form=this.component.find("[data-selector='contract-details-form']");this.controllerName=i;this.deleteButton=this.component.find("[data-selector='delete-contract-button']");this.deleteConfirmationBox=this.component.find("[data-selector='delete-confirmation-box']")}return __extends(i,t),i.prototype.initialize=function(n){this.bindEvents();n&&this.deleteButton.show();this.setupDataScopeTracker(this)},i.prototype.bindEvents=function(){var n=this;this.component.find("[data-selector='save-contract-button']").on("click",function(){return n.saveContract()});this.component.find("[data-selector='delete-contract-button']").on("click",function(){return n.showDeleteConfirmation()});this.component.find("[data-selector='delete-contract-cancel-button']").on("click",function(){return n.cancelDelete()});this.component.find("[data-selector='delete-contract-confirmation-button']").on("click",function(){return n.deleteContract()})},i.prototype.showDeleteConfirmation=function(){this.deleteButton.hide();this.deleteConfirmationBox.show()},i.prototype.cancelDelete=function(){this.deleteButton.show();this.deleteConfirmationBox.hide()},i.prototype.saveContract=function(){if(this.form.ssfvalidator("validate")){var n=this.form.find("[name='expensesAmount']").val();this.comscoreTrackExpenseAmount(n);this.submit()}else console.log("KO!")},i.prototype.submit=function(){var t=this;n.Ajax.getDataFromAction(this.controllerName,"SaveContract",this.form.find(":input").serialize(),{},null,{useWaitPanel:!0,onSuccess:function(){t.trackChange(!1);t.onContractChanged()},onValidationFailed:function(){return alert("Contract details were invalidated by the backend!")}})},i.prototype.refreshParent=function(){var t=this.component.parents("[data-service-selector-controller]").data("serviceSelectorController");n.Ajax.sendDataToActionAndUpdate(t,"LoadSummaryModal","",{},null,{})},i.prototype.onContractChanged=function(){$.publish(n.Events.contractInformationChanged)},i.prototype.deleteContract=function(){var t=this;n.Ajax.sendDataToActionAndUpdate(this.controllerName,"DeleteContract",null,{contractId:this.findContractId()},null,{onSuccess:function(){t.onContractChanged()}})},i.prototype.findContractId=function(){return this.component.find("[data-selector='temporaryId']").val()},i}(n.BaseContractComponent);t.EditContract=i})(t=n.SsfContractManagement||(n.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i){t.call(this,n);this.form=this.component.find("[data-selector='contract-details-form']");this.controllerName=i}return __extends(i,t),i.prototype.initialize=function(){this.bindEvents();this.setupDataScopeTracker(this)},i.prototype.bindEvents=function(){var n=this;this.component.find("[data-selector='save-contract-button']").on("click",function(){return n.addContract()});this.component.find("[data-selector='cancel-contract-button']").on("click",function(){return n.onCancelContract()});this.subscribeToEvents()},i.prototype.subscribeToEvents=function(){var t=this;$.unsubscribe(n.Events.contractInformationChanged);$.subscribe(n.Events.contractInformationChanged,function(){return t.onContractInformationChanged()})},i.prototype.addContract=function(){if(this.form.ssfvalidator("validate")){var n=this.form.find("[name='expensesAmount']").val();this.comscoreTrackExpenseAmount(n);this.submit()}else console.log("KO!")},i.prototype.submit=function(){var t=this;n.Ajax.getDataFromAction(this.controllerName,"SaveContract",this.form.find(":input").serialize(),{},null,{useWaitPanel:!0,onSuccess:function(){return t.onContractInformationChanged()},onValidationFailed:function(){return alert("Contract details were invalidated by the backend!")}})},i.prototype.onContractInformationChanged=function(){var t=this;this.trackChange(!1);var i=this.findContractHtmlElementsThatCanBeAddedToProfile().filter(":checked").map(function(n,t){return $(t).data("value")}).toArray(),r=this.findContractHtmlElementsThatCanBeAddedToProfile().map(function(n,t){return $(t).data("value")}).toArray(),u=this.component.parents("[data-service-selector-controller-name]").data("serviceSelectorControllerName"),f=$("[data-selector='related-contracts']").attr("id");n.Ajax.sendDataToActionAndUpdate(u,"RefreshContractsOfProfile","",{divToUpdate:f},null,{onSuccess:function(){return t.selectContractsIncludingNewlyCreated(r,i)}})},i.prototype.onCancelContract=function(){var t=this.component.parents("[data-selector='summary-add-profile-box']");n.Ajax.sendDataToActionAndUpdate(this.controllerName,"ResetAddContractToProfile","",{divToUpdate:this.component.parents("[data-selector='add-contract-to-profile-box']")[0].id},null,{onSuccess:function(){return t.slideToggle()}})},i.prototype.findContractHtmlElementsThatCanBeAddedToProfile=function(){return $('[data-selector="unselected-related-contract-id"]')},i.prototype.selectContractsIncludingNewlyCreated=function(n,t){var i=this,r=this.findContractHtmlElementsThatCanBeAddedToProfile(),e=r.filter(function(t,r){return!i.isAnElementOf(n,r)}),o=r.filter(function(n,r){return i.isAnElementOf(t,r)}),u=o.add(e),f;u.each(function(n,t){return i.select(t)});f=r.filter(function(n,t){return u.index(t)===-1});f.each(function(n,t){return i.unselect(t)})},i.prototype.isAnElementOf=function(n,t){var i=$(t).data("value");return n.indexOf(i)!==-1},i.prototype.select=function(n){var t=$(n);t.val("true");t.prop("checked",!0)},i.prototype.unselect=function(n){var t=$(n);t.val("false");t.prop("checked",!1)},i}(n.BaseContractComponent);t.AddContractToProfile=i})(t=n.SsfContractManagement||(n.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i){t.call(this,n);this.form=this.component.find("[data-selector='contract-details-form']");this.controllerName=i;this.tariffSelection=this.component.find("[data-selector='select-tariff']")}return __extends(i,t),i.prototype.initialize=function(){this.initializeEuroConsumersDropdowns();this.initializeValidation();this.bindEvents();this.setupDataScopeTracker(this)},i.prototype.initializeEuroConsumersDropdowns=function(){this.form.find(".form__field--select").uniform()},i.prototype.initializeValidation=function(){this.form.ssfvalidator({showValidationMessages:!0,showSummary:!1,summarySelector:"[data-selector=validation-summary]"})},i.prototype.bindEvents=function(){var n=this;this.component.find("[data-selector='select-provider']").on("change",function(t){return n.reloadTariffs($(t.target).val())})},i.prototype.reloadTariffs=function(n){n?this.loadTariffs(n):this.clearTariffs()},i.prototype.clearTariffs=function(){this.tariffSelection.children().not("[data-placeholder]").remove();this.tariffSelection.attr("selectedIndex",0);this.tariffSelection.trigger("change")},i.prototype.loadTariffs=function(t){var i=this;n.Ajax.getDataFromAction(this.controllerName,"Tariffs",null,{providerId:t},null,{onSuccess:function(n){return i.renderTariffs(n)}})},i.prototype.renderTariffs=function(n){var t=this;this.clearTariffs();n.forEach(function(n){return t.addTariff(n)})},i.prototype.addTariff=function(n){this.tariffSelection.append($("<option/>").attr("value",n.Id).text(n.Name))},i}(n.BaseComponent);t.ContractDetails=i})(t=n.SsfContractManagement||(n.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){"use strict";var r=function(i){function r(n,t,r){i.call(this,n);this.controllerName=t;this.serviceSelectorControllerName=r}return __extends(r,i),r.prototype.initialize=function(){this.bindEditContractEvents();this.subscribeToEvents();this.component.find("a.asr__contract__choice").on("click",function(n){n.preventDefault();$(this).toggleClass("asr__contract__choice--checked");$(this).children().first().prop("checked",!$(this).children().first().prop("checked"))})},r.prototype.subscribeToEvents=function(){var t=this;$.subscribe(n.ServiceSelector.Commands.clearContractSelection,function(){t.unselectAllContracts()})},r.prototype.unselectAllContracts=function(){this.component.find("a.asr__contract__choice").each(function(n,t){$(t).removeClass("asr__contract__choice--checked");$(t).children().prop("checked",!1)})},r.prototype.bindEditContractEvents=function(){var n=this;this.component.find("[data-selector=edit-contract]").on("click",function(t){var i=$(t.currentTarget).data("contract-id").toString();n.openContractDetailsModal(i)});this.component.find("[data-selector=add-new-contract-button]").on("click",function(){return n.openContractDetailsModal()})},r.prototype.openContractDetailsModal=function(n){t.Ajax.sendDataToActionAndUpdate("ContractDetails","Details",null,{contractId:n,serviceSelectorControllerName:this.serviceSelectorControllerName},null,{onSuccess:function(){return t.SppHelper.openModal("#contract-details-popup")}})},r}(t.BaseComponent);i.ContractsList=r})(i=t.SsfContractManagement||(t.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i){t.call(this,n);this.contractControllername=i}return __extends(i,t),i.prototype.initialize=function(){this.bindEvents()},i.prototype.bindEvents=function(){var n=this;this.component.find('[data-selector="active-contracts-button"]').on("click",function(t){t.preventDefault();n.toggleSelectedTab(t);n.loadContractsList()});this.component.find('[data-selector="archived-contracts-button"]').on("click",function(t){t.preventDefault();n.toggleSelectedTab(t);n.loadContractsList(!1)})},i.prototype.toggleSelectedTab=function(n){this.component.find('[data-selector="active-contracts-button"]').add(this.component.find('[data-selector="archived-contracts-button"]')).removeClass("is-active");$(n.currentTarget).addClass("is-active")},i.prototype.loadContractsList=function(t){t===void 0&&(t=!0);var i=this.component.find('[data-selector="my-contracts-list"]')[0].id;n.Ajax.sendDataToActionAndUpdate(this.contractControllername,"MyContractsList",null,{divToUpdate:i,activeTab:t},null,null)},i}(n.BaseComponent);t.MyContractOverview=i})(t=n.SsfContractManagement||(n.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n){t.call(this,n)}return __extends(i,t),i.prototype.initialize=function(){this.bindEvents()},i.prototype.bindEvents=function(){var n=this;this.component.find("[data-selector='add-new-contract-button']").on("click",function(t){t.preventDefault();var i=$(t.target).data("servicedomainId");n.openAddContractModal(i)});this.component.find('[data-selector="edit-contract-button"]').on("click",function(t){t.preventDefault();var i=$(t.target).data("contractId");n.openEditContractModal(i)});this.component.find('[data-selector="archive-contract-button"]').on("click",function(t){t.preventDefault();var i=$(t.target).data("contractId");n.askForArchiveConfirmation(i)});this.component.find('[data-selector="unarchive-contract-button"]').on("click",function(t){t.preventDefault();var i=$(t.target).data("contractId");n.askForArchiveConfirmation(i)})},i.prototype.askForArchiveConfirmation=function(t){var i=this.component.find('[data-selector="archive-contract-confirmation"]')[0].id;n.Ajax.sendDataToActionAndUpdate("SSFMyContractOverview","ArchiveConfirmation",null,{contractId:t,divToUpdate:i,moveToArchive:this.activeContractsTabIsSelected()},null,{onSuccess:function(){return n.SppHelper.openModal("#"+i)}})},i.prototype.openAddContractModal=function(t){n.Ajax.sendDataToActionAndUpdate("MyContractDetails","Details",null,{serviceDomainId:t},null,{onSuccess:function(){return n.SppHelper.openModal("#contract-details-popup")}})},i.prototype.openEditContractModal=function(t){n.Ajax.sendDataToActionAndUpdate("MyContractDetails","Details",null,{contractId:t},null,{onSuccess:function(){return n.SppHelper.openModal("#contract-details-popup")}})},i.prototype.activeContractsTabIsSelected=function(){return this.component.parents().find('[data-selector="active-contracts-button"]').hasClass("is-active")},i}(n.BaseComponent);t.MyContractsList=i})(t=n.SsfContractManagement||(n.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i){t.call(this,n);this.form=this.component.find("[data-selector='contract-details-form']");this.controllerName=i;this.deleteButton=this.component.find("[data-selector='delete-contract-button']");this.deleteConfirmationBox=this.component.find("[data-selector='delete-confirmation-box']")}return __extends(i,t),i.prototype.initialize=function(n){this.bindEvents();n&&this.deleteButton.show();this.setupDataScopeTracker(this)},i.prototype.bindEvents=function(){var n=this;this.component.find("[data-selector='save-contract-button']").on("click",function(){return n.saveContract()});this.component.find("[data-selector='delete-contract-button']").on("click",function(){return n.showDeleteConfirmation()});this.component.find("[data-selector='delete-contract-cancel-button']").on("click",function(){return n.cancelDelete()});this.component.find("[data-selector='delete-contract-confirmation-button']").on("click",function(){return n.deleteContract()})},i.prototype.showDeleteConfirmation=function(){this.deleteButton.hide();this.deleteConfirmationBox.show()},i.prototype.cancelDelete=function(){this.deleteButton.show();this.deleteConfirmationBox.hide()},i.prototype.saveContract=function(){if(this.form.ssfvalidator("validate")){var n=this.form.find("[name='expensesAmount']").val();this.comscoreTrackExpenseAmount(n);this.submit()}else console.log("KO!")},i.prototype.submit=function(){var t=this;n.Ajax.getDataFromAction(this.controllerName,"SaveContract",this.form.find(":input").serialize(),{},null,{useWaitPanel:!0,onSuccess:function(){return t.onSuccessfullySavedContract()},onValidationFailed:function(){return alert("Contract details were invalidated by the backend!")}})},i.prototype.onSuccessfullySavedContract=function(){this.trackChange(!1);this.close();this.refreshCurrentContractsTab()},i.prototype.close=function(){this.component.find("[data-selector='close-popup']").click()},i.prototype.deleteContract=function(){var t=this;n.Ajax.sendDataToActionAndUpdate(this.controllerName,"DeleteContract",null,{contractId:this.findContractId()},null,{onSuccess:function(){t.refreshCurrentContractsTab();t.close()}})},i.prototype.findContractId=function(){return this.component.find("[data-selector='contractId']").val()},i.prototype.refreshCurrentContractsTab=function(){var t=this.component.parents().find('[data-selector="my-contracts-list"]')[0].id,i=this.component.parents().find('[data-selector="active-contracts-button"]').hasClass("is-active"),r=this.component.parents().find("#filter-by").val();this.component.closest("body").hasClass("context-mycontracts")?n.Ajax.sendDataToActionAndUpdate("SSFMyContractOverviewV2","MyContractsList",null,{divToUpdate:t,activeTab:!0,serviceDomainId:r},null,null):n.Ajax.sendDataToActionAndUpdate("SSFMyContractOverview","MyContractsList",null,{divToUpdate:t,activeTab:i},null,null)},i}(n.BaseContractComponent);t.MyContractDetailsModal=i})(t=n.SsfContractManagement||(n.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i){t.call(this,n);this.controllerName=i}return __extends(i,t),i.prototype.initialize=function(){this.bindEvents()},i.prototype.bindEvents=function(){var n=this;this.component.find('[data-selector="archive-contract-button"]').on("click",function(t){t.preventDefault();n.moveContract(t)});this.component.find('[data-selector="cancel-archive-contract-button"]').on("click",function(t){t.preventDefault();n.closePopup()})},i.prototype.closePopup=function(){this.component.parent().find('[data-selector="close-popup"]').click()},i.prototype.moveContract=function(n){var t=n.currentTarget,i=$(t).data("contractId"),r=$(t).data("moveToArchive");r?this.archiveContract(i):this.unarchiveContract(i)},i.prototype.archiveContract=function(t){var i=this;n.Ajax.sendDataToActionAndUpdate("SSFMyContractOverview","Archive",null,{contractId:t},null,{onSuccess:function(){i.closePopup();i.refreshCurrentTab(!0)}})},i.prototype.unarchiveContract=function(t){var i=this;n.Ajax.sendDataToActionAndUpdate("SSFMyContractOverview","Unarchive",null,{contractId:t},null,{onSuccess:function(){i.closePopup();i.refreshCurrentTab(!1)}})},i.prototype.refreshCurrentTab=function(t){var i=this.component.parents().find('[data-selector="my-contracts-list"]')[0].id;n.Ajax.sendDataToActionAndUpdate("SSFMyContractOverview","MyContractsList",null,{divToUpdate:i,activeTab:t},null,null)},i}(n.BaseComponent);t.ArchiveContractConfirmation=i})(t=n.SsfContractManagement||(n.SsfContractManagement={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));window.EC=function(n,t){return t.SelfManagement=t.SelfManagement||{},t.SelfManagement.MyContracts=t.SelfManagement.MyContracts||{},t.SelfManagement.MyContracts.holder=jQuery(".mycontracts__holder"),t.SelfManagement.MyContracts.filterByHolder=jQuery(".selfmanagement__filterby .form__item--select"),t.SelfManagement.MyContracts.activeTab=jQuery("#requestTypeId"),t.SelfManagement.MyContracts.intervalAlive=null,t.SelfManagement.MyContracts.applyFilterByOption=function(n,i){t.SelfManagement.MyContracts.holder.empty().append(i.Content);t.SelfManagement.MyContracts.filterByHolder.empty().append(i.Filter)},t.SelfManagement.MyContracts.confirmDeleteContract=function(){jQuery(".js-opener").fadeOut("200",function(){jQuery(this).remove();t.SelfManagement.MyContracts.handleNoContracts()});jQuery.magnificPopup.instance.close()},t.SelfManagement.MyContracts.handleNoContracts=function(){console.log("ns.SelfManagement.MyContracts.handleNoContracts");jQuery(".domain-box__body").each(function(){jQuery(this).children().length===1&&jQuery(this).find(".js-nocontracts").removeClass("hidden")})},t.SelfManagement.MyContracts.populateTab=function(n,i){n.closest(".mycontracts__tabs").find(".js-navmenu-item").removeClass("is-active");n.find(".js-navmenu-item").addClass("is-active");window.location.hash=n.find(".js-navmenu-item").data("tabId");t.SelfManagement.MyContracts.holder.empty().append(i.Content);t.SelfManagement.MyContracts.filterByHolder.empty().append(i.Filter);t.SelfManagement.MyContracts.activeTab.val(n.index()+1);window.location.hash==="#tab1"?jQuery("[data-type='SppCallTeaserController']").hide():jQuery("[data-type='SppCallTeaserController']").show()},t.SelfManagement.MyContracts.reBindWidgets=function(){var n=jQuery(".mycontracts");n.find(".js-forminteraction").forminteraction({item:".js-forminteraction-item",cancel:".js-forminteraction-cancel",submit:".js-forminteraction-submit"});n.find(".js-popup").modal();n.find(".form__field--select").uniform({selectAutoWidth:!0,selectClass:"has-uniform"});t.SelfManagement.MyContracts.holder.prepend("<span class='working'/>");t.SelfManagement.MyContracts.handleNoContracts()},t}(window.jQuery,window.EC||{});jQuery(function(){if(jQuery(".mycontracts").length===1){jQuery(document).ajaxSuccess(function(){EC.SelfManagement.MyContracts.reBindWidgets()});jQuery("body").addClass("context-mycontracts");jQuery("body").on("click",".js-delete-contract",function(n){jQuery(".js-opener").removeClass("js-opener");$(n.target).closest(".domain-box__subpanel").addClass("js-opener")});window.location.hash?jQuery(".mycontracts__tabs").find("a[data-tab-id='"+window.location.hash+"']").trigger("click"):jQuery(".mycontracts__tabs").find("a[data-tab-id='#tab1']").trigger("click")}});jQuery.validator.setDefaults({errorElement:"div",errorClass:"form__item__note--error",errorPlacement:function(n,t){t.attr("type")==="checkbox"?t.next().append(n):n.insertAfter(t)}});jQuery.validator.addMethod("validphonenumber",function(n){return n?/\+[1-9]{1}[0-9]{9,11}$/.test(n):!0});jQuery("#form-change-phone").length&&jQuery("#form-change-phone").validate({messages:EC.ServiceSelector.Common.validationMessages});jQuery.subscribe("domupdated.popup-form",function(){$("#ff-privacy__messages").length&&$("#ff-privacy__messages").prop("checked",EC.ServiceSelector.Common.rejectCommunications)});jQuery("body").on("change","#ff-privacy__messages",function(){EC.ServiceSelector.Common.rejectCommunications=$(this).prop("checked");$("#eccoms").val(EC.ServiceSelector.Common.rejectCommunications)});jQuery("body").on("change","input[type='checkbox'][id$='-Sms']",function(){EC.ServiceSelector.Common.handleSMSNumber(this)});jQuery("body").on("click",".js-mfp-cancel",function(n){n.preventDefault();jQuery.magnificPopup.instance.close()});window.EC=function(n,t){return t.ServiceSelector=t.ServiceSelector||{},t.ServiceSelector.Common=t.ServiceSelector.Common||{},t.ServiceSelector.Common.deletedSMSNumber=function(n){n.closest(".popup__inner").find(".is-reveal--active.is-reveal--active").trigger("click");jQuery("#current-phone").empty();jQuery("#phone-number").val("");jQuery.magnificPopup.instance.close();window.location.reload()},t.ServiceSelector.Common.completeSMSChange=function(){var n=jQuery("#phone-number").val();jQuery("#current-phone").html(n);jQuery("#output-smschange").empty();jQuery(".contactpreferences .form__item__note--error").empty();jQuery.magnificPopup.instance.close()},t}(window.jQuery,window.EC||{});window.EC=function(n,t){function i(t,i){console.log("processErrorsList");i.empty();n.isArray(t)?n.each(t,function(t,r){n("<p/>",{text:r}).appendTo(i)}):n("<p/>",{text:t}).appendTo(i);i.show()}function r(n){for(var t=0;t<n.length;t++)n[t].forminteraction("processItems")}return t.ServiceSelector=t.ServiceSelector||{},t.ServiceSelector.Common=t.ServiceSelector.Common||{},t.ServiceSelector.Common.successfulInteractions=null,t.ServiceSelector.Common.handleRadios=function(t){var i=t.find('input[type="radio"]:checked').filter(function(){return n(this).val()==="True"}).length;i===0?(t.find(".has-uniform").addClass("disabled"),t.find("select").prop("disabled",!0)):(t.find(".has-uniform").removeClass("disabled"),t.find("select").prop("disabled",!1))},t.ServiceSelector.Common.validateChannel=function(n){var f=n.element,i=f.find(".js-forminteraction-item"),u=i.closest(".js-forminteraction-wrapper"),e=u.find('.form__field--radio[value="True"]:checked').length,o=u.find(".form__field--checkbox:checked").length,r={isValid:!0};return!i.prop("checked")&&e>0&&o===0?(i.closest("#alerts-modal-generic").length===0&&i.prop("checked",!0),r.isValid=!1,r.type="string",r.content=t.ServiceSelector.Common.Messages.DISABLE_NOT_ALLOWED):u.find(".channel-preferences-error").hide(),r},t.ServiceSelector.Common.channelNotValid=function(n,t){var i=n.element,r=i.closest(".js-forminteraction-wrapper");r.find(".channel-preferences-error").text(t.content).show()},t.ServiceSelector.Common.validateToggle=function(n){var i=n.element,r=i.closest(".js-forminteraction-wrapper"),u=r.find(".form__field--checkbox:checked").length,f=r.find('.form__field--radio[value="True"]:checked').length,t={isValid:!0};return f>0&&u===0&&(t.isValid=!1,t.type="string",t.content=EC.ServiceSelector.Common.Messages.ONE_CHANNEL_AT_LEAST,i.closest(".btn__double-action").addClass("shown")),t},t.ServiceSelector.Common.toggleNotValid=function(n,t){n.element.find(".form__item__note--error").show().html(t.content)},t.ServiceSelector.Common.saveToggle=function(n,t){if(n.find(".btn__double-action").removeClass("shown"),n.find(".form__item__note--error").empty().hide(),EC.ServiceSelector.Common.totalInteractions&&EC.ServiceSelector.Common.resolveGroup(),t.Data)for(var i in t.Data)t.Data.hasOwnProperty(i)&&n.find('input[name="'+i+'"]').val(t.Data[i])},t.ServiceSelector.Common.errorToggle=function(t,r){if(t.closest(".popup__inner").length)i(EC.ServiceSelector.Common.Messages.UNSPECIFIED_ERROR,n("#modal-toggles-error")),n("#save-all-changes").removeClass("btn--waiting");else{var u=t.find(".form__item__note--error");i(r.ValidationErrors,u)}},t.ServiceSelector.Common.saveChannelUpdate=function(n,t){console.log("EC.ServiceSelector.Common.saveChannelUpdate",t);EC.ServiceSelector.Common.totalInteractions&&EC.ServiceSelector.Common.resolveGroup();for(var i in t.Data)t.Data.hasOwnProperty(i)&&n.find('input[name="'+i+'"]').val(t.Data[i])},t.ServiceSelector.Common.failedSMSChange=function(t,r){console.log("Common.failedSMSChange");i(r.ValidationErrors,n("#output-smschange"))},t.ServiceSelector.Common.validateSMSChange=function(){var t=n("#form-change-phone").valid();return{isValid:t}},t.ServiceSelector.Common.bindFormElementsBehavior=function(){n(".js-forminteraction .js-form").each(function(){var t=n(this);t.on("click",".js-forminteraction-cancel",function(i){i.preventDefault();n(this).closest(".btn__double-action").removeClass("shown");t.find(".form__item__note--error").empty().hide();EC.ServiceSelector.Common.handleRadios(t)});t.on("change","input, select",function(t){t.preventDefault();n(this).closest(".card").find(".btn__double-action").addClass("shown");n(this).closest(".card").addClass("dirty")});t.on("change",'input[type="radio"]',function(){EC.ServiceSelector.Common.handleRadios(t)});EC.ServiceSelector.Common.handleRadios(t)})},t.ServiceSelector.Common.submitAllFormItems=function(){var t=[],i=[],u;if(EC.ServiceSelector.Common.successfulInteractions=0,n("#alerts-modal-generic .js-forminteraction.dirty").length===0){n("#save-all-changes").removeClass("btn--waiting");n.magnificPopup.close();return}if(n("#alerts-modal-generic .js-forminteraction.dirty").each(function(){n(this).hasClass("js-forminteraction-priority")?i.push(n(this)):t.push(n(this));var r=n(this).forminteraction("validate");if(!r.isValid)return n("#modal-toggles-error").html(EC.ServiceSelector.Common.Messages.ONE_CHANNEL_AT_LEAST).show(),t=i=[],n("#save-all-changes").removeClass("btn--waiting"),!1;n("#modal-toggles-error").empty().hide()}),EC.ServiceSelector.Common.totalInteractions=t.length+i.length,i.length){for(u=0;u<i.length;u++)i[u].forminteraction("processItems");setTimeout(r,3e3,t)}else t.length&&r(t)},t.ServiceSelector.Common.resolveGroup=function(){EC.ServiceSelector.Common.successfulInteractions++;console.log("totalInteractions",EC.ServiceSelector.Common.totalInteractions,"successfulInteractions",EC.ServiceSelector.Common.successfulInteractions);EC.ServiceSelector.Common.totalInteractions===EC.ServiceSelector.Common.successfulInteractions&&(n(".mfp-container").removeClass("dirty"),n.magnificPopup.close())},t.ServiceSelector.Common.handleSMSNumber=function(t){var i;i=t?n(t):n('input[type="checkbox"][id$="-Sms"]');n.each(i,function(t,i){var u=n(i).prop("checked"),r=n(i).closest(".js-forminteraction-wrapper");n("#current-phone").text().length===0&&u?r.find(".channel-preferences-warning").show():r.find(".channel-preferences-warning").hide()})},t}(window.jQuery,window.EC||{});jQuery(function(){EC.ServiceSelector.Common.bindFormElementsBehavior();EC.ServiceSelector.Common.handleSMSNumber()});window.EC=function(n,t){return t.BestDeal=t.BestDeal||{},t.BestDeal.domainsHolder=jQuery(".best-deal__domains-holder"),t.BestDeal.getAdditionalProfiles=function(i,r){var o=i.closest(".best-deal__domain"),u=o.find(".best-deal__offers-holder"),h=u.find(".best-deal__offer__additional").removeClass("js-forminteraction").clone(),s,f,e;u.empty().append(r);s=h.appendTo(u).clone().addClass("second-additional");u.find(".best-deal__offer:first").after(s);f=o.find(".best-deal__offer__additional-toggle").removeClass("js-forminteraction-item");e=f.find(".best-deal__offer__additional-prefix");f.removeClass("show-additional").addClass("hide-additional");e.removeClass("icon-positive2").addClass("icon-negative2");t.BestDeal.reBindWidgets(u);n.publish("spinner.close",[n("body")]);u.on("click",".hide-additional",function(t){t.preventDefault();f.removeClass("hide-additional").addClass("show-additional");e.removeClass("icon-negative2").addClass("icon-positive2");u.find(".best-deal__offer").not(":first").fadeOut(200);u.find(".second-additional").hide();n("html, body").animate({scrollTop:u.offset().top-100},1e3)});u.on("click",".show-additional",function(n){n.preventDefault();f.removeClass("show-additional").addClass("hide-additional");e.removeClass("icon-positive2").addClass("icon-negative2");u.find(".best-deal__offer").fadeIn(200);u.find(".second-additional").show()})},t.BestDeal.deleteProfile=function(){window.location.reload()},t.BestDeal.getMoreDomains=function(i,r){var u=jQuery(".best-deal__domain").last();u.after(r);t.BestDeal.reBindWidgets(t.BestDeal.domainsHolder);EC.BestDeal.Pagination.currentPage++;EC.BestDeal.Pagination.currentPage>EC.BestDeal.Pagination.lastPage&&n(".best-deal__more-domains").hide();n(".best-deal__page-number").val(EC.BestDeal.Pagination.currentPage);n.publish("spinner.close",[n("body")])},t.BestDeal.applyFilterByDomain=function(n,i){t.BestDeal.domainsHolder.empty().append(i);t.BestDeal.reBindWidgets(t.BestDeal.domainsHolder);jQuery.publish("spinner.close",[jQuery("body")])},t.BestDeal.validateFilterByDomain=function(){return document.getElementById("filter-by").selectedIndex===0?(jQuery.publish("spinner.open",[jQuery("body")]),location.reload(),!1):{isValid:!0}},t.BestDeal.reBindWidgets=function(n){var t={item:".js-forminteraction-item",cancel:".js-forminteraction-cancel",submit:".js-forminteraction-submit"};n.find(".form__item--toggle--inline.js-forminteraction").forminteraction(t);n.find(".best-deal__offer__additional.js-forminteraction").forminteraction(t);n.find(".btn__double-action.js-forminteraction").forminteraction(t);n.find(".js-popup").modal();n.find(".js-togglefade").togglefade();jQuery("span.responsive-image").responsive_image()},t}(window.jQuery,window.EC||{});jQuery(function(){jQuery(".best-deal__filterby").on("change",function(){jQuery.publish("spinner.open",[jQuery("body")])});jQuery(".best-deal__domains-holder").on("click",".best-deal__offer__additional-toggle.js-forminteraction-item",function(){jQuery.publish("spinner.open",[jQuery("body")])});jQuery(".best-deal__more-domains .js-forminteraction-item").on("click",function(){jQuery.publish("spinner.open",[jQuery("body")])})});__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.initialize=function(){this.bindEvents()},t.prototype.bindEvents=function(){var n=this;this.component.find('[data-selector="btn-call-to-action"]').on("click",function(t){var i=$(t.target).data("link");n.redirectTo(i)})},t.prototype.redirectTo=function(n){window.location.href=n},t}(n.BaseComponent);t.LandingPageStopContent=i})(t=n.SsfStopContent||(n.SsfStopContent={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i,r,u){t.call(this,n);this.serviceSelectorUrl=i;this.directSwitchSettings=r;this.relatedSelectorSettings=u}return __extends(i,t),i.prototype.initialize=function(){this.bindEvents();this.setupDataScopeTracker(this)},i.prototype.bindEvents=function(){var n=this;this.component.find('[data-selector="ssel-result-button"]').on("click",function(t){var i=$(t.target);n.showResults(i)});this.component.find('[data-selector="continue-without-profile-button"]').on("click",function(){n.continueWithoutProfile()});this.component.find('[data-selector="direct-switch-button"]').on("click",function(){n.directSwitch()})},i.prototype.onSuccessGoToResults=function(n){this.close();window.location.href=n},i.prototype.continueWithoutProfile=function(){var t={DivToUpdate:"compare-switch-popup",DirectSwitchServiceContract:this.directSwitchSettings.serviceContract,DirectSwitchQuestionSet:this.directSwitchSettings.questionSet,ServiceSelectorUrl:this.serviceSelectorUrl,RelatedSelectorServiceContract:this.relatedSelectorSettings.serviceContract,ProfileKey:this.relatedSelectorSettings.profileKey,ResultPageUrl:this.relatedSelectorSettings.resultsUrl};n.Ajax.sendDataToActionAndUpdate("SsfCompareOrSwitch","ContinueWithoutProfileAjax",null,t,{type:"POST"},{onSuccess:function(){return n.SppHelper.openModal("#compare-switch-popup")}})},i.prototype.directSwitch=function(){var t={divToUpdate:"go-direct-switch-popup",serviceContract:this.directSwitchSettings.serviceContract,questionSetVersion:this.directSwitchSettings.questionSet,switchUrl:this.directSwitchSettings.switchUrl};n.Ajax.sendDataToActionAndUpdate("SsfDirectSwitchOffers","DirectSwitchAjax",null,t,{type:"GET"},{onSuccess:function(){n.SppHelper.openModal("#go-direct-switch-popup")}})},i.prototype.showResults=function(t){var i=this,r={serviceContract:this.relatedSelectorSettings.serviceContract,profileKey:this.relatedSelectorSettings.profileKey,profile:t.data("profile"),resultsUrl:this.relatedSelectorSettings.resultsUrl};n.Ajax.getDataFromAction("SsfCompareOrSwitch","ShowResults",null,r,{type:"GET"},{useWaitPanel:!0,onSuccess:function(n){return i.onSuccessGoToResults(n)},onValidationFailed:function(){return alert("No redirect was done!")}})},i.prototype.close=function(){this.component.find("[data-selector='close-popup']").click()},i}(n.BaseComponent);t.CompareOrSwitch=i})(t=n.SsfDirectSwitch||(n.SsfDirectSwitch={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n,i,r,u,f){t.call(this,n);this.controllerName=i;this.form=this.component.find("[data-selector='direct-switch-form']");this.questionIds=r;this.locationQuestionId=u;this.providerSelection=this.component.find("[data-selector='select-provider']");this.offerSelection=this.component.find("[data-selector='select-offer']");this.switchButton=this.component.find("[data-selector='switch-now-button']");this.serviceSelectorLocator=f}return __extends(i,t),i.prototype.initialize=function(){this.switchButton.hide();this.initializeEuroConsumersDropdowns();this.initializeValidation();this.bindEvents();this.setupDataScopeTracker(this);this.noValidation=!0},i.prototype.initializeEuroConsumersDropdowns=function(){this.form.find(".form__field--select").uniform()},i.prototype.initializeValidation=function(){this.form.ssfvalidator({showValidationMessages:!0});var n=this;this.form.ssfvalidator("addRule","energylocationrequired",function(t,i,r){var e=r.find("#"+i.attr("id")),u=e.val(),f;return u?(f=n.serviceSelectorLocator.getLocationByLabel(u),f!=null):!1},"ValidationError_LocationRequired")},i.prototype.bindEvents=function(){var n=this;this.questionIds.forEach(function(t){return n.component.find("[name^='"+t+"']").change(function(){n.answerChanged()})});this.component.find("[name^='"+this.locationQuestionId+"']").blur(function(){n.answerChanged()});this.providerSelection.on("change",function(t){return n.reloadOffers($(t.target).val())});this.offerSelection.on("change",function(t){n.selectedServiceOffer=$(t.target).val();n.enableSwitch()});this.switchButton.on("click",function(t){return n.switch(t)})},i.prototype.answerChanged=function(){if(this.noValidation){this.noValidation=!1;return}this.clearProviders();this.clearOffers();this.form.ssfvalidator("validate")&&this.loadProviders()},i.prototype.clearProviders=function(){this.providerSelection.children().not("[data-placeholder]").remove();this.providerSelection.attr("selectedIndex",0);this.providerSelection.trigger("change")},i.prototype.loadProviders=function(){var t=this;n.Ajax.getDataFromAction(this.controllerName,"GetDirectOffers",null,this.form.find(":input").serialize(),null,{onSuccess:function(n){t.result=n.ServiceOffers;t.renderProviders(n.Providers)}})},i.prototype.renderProviders=function(n){var t=this;this.clearProviders();n.forEach(function(n){return t.addProvider(n)})},i.prototype.addProvider=function(n){this.providerSelection.append($("<option/>").attr("value",n).text(n))},i.prototype.filterOffers=function(n){var t=this.result.filter(function(t){return t.ProviderName===n});this.renderOffers(t)},i.prototype.reloadOffers=function(n){n?this.filterOffers(n):this.clearOffers()},i.prototype.clearOffers=function(){this.offerSelection.children().not("[data-placeholder]").remove();this.offerSelection.attr("selectedIndex",0);this.offerSelection.trigger("change")},i.prototype.renderOffers=function(n){var t=this;this.clearOffers();n.forEach(function(n){return t.addOffer(n)})},i.prototype.addOffer=function(n){this.offerSelection.append($("<option/>").attr("value",n.ServiceOfferId).text(n.ServiceOfferName))},i.prototype.switch=function(){var t=this;n.Ajax.getDataFromAction(this.controllerName,"SwitchNow",null,this.form.find(":input").serialize(),{type:"POST"},{useWaitPanel:!0,onSuccess:function(n){return t.onSuccessfullSwitch(n)},onValidationFailed:function(){return alert("No switch was done!")}})},i.prototype.enableSwitch=function(){this.selectedServiceOffer?(this.switchButton.show(),this.switchButton.removeAttr("disabled").removeClass("is-disabled")):(this.switchButton.attr("disabled","disabled"),this.switchButton.addClass("is-disabled"))},i.prototype.onSuccessfullSwitch=function(n){this.trackChange(!1);this.close();this.redirectWithWaitPanel(n)},i.prototype.redirectWithWaitPanel=function(t){n.WaitPanel.increment();window.location.href=t},i.prototype.close=function(){this.component.find("[data-selector='close-popup']").click()},i.prototype.disableQuestions=function(){var n=this;this.questionIds.forEach(function(t){n.component.find("[name^='"+t+"']").attr("disabled","disabled")})},i.prototype.enableQuestions=function(){var n=this;this.questionIds.forEach(function(t){return n.component.find("[name^='"+t+"']").removeAttr("disabled")})},i}(n.BaseComponent);t.DirectSwitchOffers=i})(t=n.SsfDirectSwitch||(n.SsfDirectSwitch={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(n){t.call(this,n)}return __extends(i,t),i.prototype.initialize=function(){console.log("DirectSwitchHub initialize");this.bindEvents()},i.prototype.bindEvents=function(){var n=this;this.component.find('[data-selector="open-switch-or-selector"]').on("click",function(t){var i=$(t.target),r=$(t.target).data("dsSkipCompare");r=="True"?n.directSwitch(i):n.compareOrSwitch(i)})},i.prototype.directSwitch=function(t){var i={divToUpdate:"direct-switch-popup",serviceContract:t.data("dsServiceContract"),questionSetVersion:t.data("dsQuestionSetVersion"),switchUrl:t.data("serviceSelectorUrl")+"/switch"};n.Ajax.sendDataToActionAndUpdate("SsfDirectSwitchOffers","DirectSwitchAjax",null,i,{type:"GET"},{onSuccess:function(){return n.SppHelper.openModal("#direct-switch-popup")}})},i.prototype.compareOrSwitch=function(t){var i={DivToUpdate:"compare-switch-popup",DirectSwitchServiceContract:t.data("dsServiceContract"),RelatedSelectorServiceContract:t.data("rsServiceContract"),DirectSwitchQuestionSet:t.data("dsQuestionSetVersion"),ServiceSelectorUrl:t.data("serviceSelectorUrl"),ProfileKey:t.data("rsProfileKey"),ResultPageUrl:t.data("rsResultsUrl")};n.Ajax.sendDataToActionAndUpdate("SsfCompareOrSwitch","CompareOrSwitchAjax",null,i,{type:"POST"},{onSuccess:function(){return n.SppHelper.openModal("#compare-switch-popup")}})},i}(n.BaseComponentNew);t.DirectSwitchHub=i;n.InitHelpers.initializeControlsByFactoryMethod("DirectSwitchHubComponent",function(n){return new i(n).initialize()});n.InitHelpers.initializeControlsByFactoryMethod("DirectSwitchHubSingleTeaserComponent",function(n){return new i(n).initialize()})})(t=n.SsfDirectSwitch||(n.SsfDirectSwitch={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));window.EC=function(n,t){return t.ServiceSelector=t.ServiceSelector||{},t.ServiceSelector.Common=t.ServiceSelector.Common||{},t.ServiceSelector.Common.ContactPreferences=t.ServiceSelector.Common.ContactPreferences||{},t.ServiceSelector.Common.ContactPreferences.reset=function(){jQuery(".js-opener").removeClass("js-opener");jQuery(".form__item__note--error").empty()},t.ServiceSelector.Common.ContactPreferences.confirmDeactivate=function(n){var i,r,u;jQuery.magnificPopup.instance.close();i=n.closest(".subpanel");r=n.closest(".js-alert");jQuery(".js-opener").find("input.form__field--checkbox").prop("checked",!1);t.ServiceSelector.Common.ContactPreferences.updateOngoingChannels(i);u=r.find(".form__field--checkbox:checked").length;u===0&&(r.find(".form__field--toggle").prop("checked",!1),i.find(".has-uniform").addClass("disabled"),i.find(".form__field--select").prop("disabled",!0),r.find("input.form__field--checkbox").prop("disabled",!0),t.ServiceSelector.Common.ContactPreferences.reset())},t.ServiceSelector.Common.ContactPreferences.confirmToggleDisable=function(){jQuery(".js-opener").find("input.form__field--checkbox").prop("disabled",!0).prop("checked",!1).end().find(".form__field--toggle").prop("checked",!1).end().find(".form__item__note--error").empty().end().find(".has-uniform").addClass("disabled").end().find("select").prop("disabled",!0).end().removeClass("js-opener");jQuery.magnificPopup.instance.close()},t.ServiceSelector.Common.ContactPreferences.confirmToggleEnable=function(){for(var n=jQuery(".js-opener").closest(".subpanel"),i=n.find(".js-channels-ongoing").val(),r=i.length>0?i.split(","):n.find(".js-alert").data("channelsDefaults"),t=0;t<r.length;t++)n.find("input[type='checkbox'][data-channel='"+r[t]+"']").prop("checked",!0);n.find("input.form__field--checkbox").prop("disabled",!1).end().find(".form__field--toggle").prop("checked",!0).end().find(".form__item__note--error").hide().end().find(".has-uniform").removeClass("disabled").end().find("select").prop("disabled",!1).end().removeClass("js-opener");jQuery.magnificPopup.instance.close()},t.ServiceSelector.Common.ContactPreferences.updateOngoingChannels=function(n){var t=[];n.find(".form__field--checkbox").each(function(){var n=jQuery(this);n.is(":checked")&&t.push(n.data("channel"))});n.find(".js-channels-ongoing").val(t.join())},t.ServiceSelector.Common.ContactPreferences.validateChannelActivation=function(t){var i={isValid:!0},r;return t.element.find(".js-forminteraction-item").hasClass("needsphone")&&n("#current-phone").length&&n("#current-phone").text().length===0&&(i.isValid=!1,i.type="string",i.content=EC.ServiceSelector.Common.validationMessages.NeedsPhone,r=t.element.closest(".js-alert").find(".form__item__note--error"),r.text(i.content).show()),i},t.ServiceSelector.Common.ContactPreferences.init=function(){jQuery(".contactpreferences").on("click",".form__field--toggle",function(n){var r=jQuery(n.target),t=r.closest(".subpanel"),u,f,i;return u=r.prop("checked")?t.find(".mfp-hide.enable"):t.find(".mfp-hide.disable"),f=t.find(".js-alert").data("channelsDefaults"),i=[],t.find(".js-channel-checkbox").each(function(){jQuery.inArray(jQuery(this).data("channel"),f)===0&&i.push(jQuery(this).prop("id").split("-")[2])}),t.find(".mfp-hide.enable input[name='activeChannels']").val(i),t.addClass("js-opener"),jQuery.magnificPopup.open({items:{src:"#"+u[0].id},showCloseBtn:!0,closeBtnInside:!0,closeMarkup:"<button class='mfp-close icon-x'><span class='visuallyhidden'>Close overlay<\/span><\/button>",mainClass:"popup",type:"inline",callbacks:{open:function(){jQuery.magnificPopup.instance.close=function(){EC.ServiceSelector.Common.ContactPreferences.reset();jQuery.magnificPopup.proto.close.call(this)}}}},0),!1});jQuery(".contactpreferences").on("click",".js-channel-checkbox",function(n){var r=jQuery(n.target),i=r.closest(".subpanel"),o=r.closest(".form__item"),u,f=i.find("select[name='frequency']"),e;if(f.length&&i.find("input[name='frequency']").val(f.val()),i.find(".deactivate input[name='alertType']").val(r.closest(".form__item--boolean").find("input[name='alertType']").val()),i.find(".deactivate input[name='channelName']").val(r.closest(".form__item--boolean").find("input[name='channelName']").val()),e=i.find(".form__field--checkbox:checked").length,e===0?i.find("input[name='isLast']").val("true"):i.find("input[name='isLast']").val("false"),r.prop("checked"))t.ServiceSelector.Common.ContactPreferences.updateOngoingChannels(i),r.hasClass("needsphone")&&jQuery("#current-phone").length&&jQuery("#current-phone").text().length===0&&r.prop("checked",!1);else return u=i.find(".mfp-hide.deactivate"),EC.ServiceSelector.Common.ContactPreferences.reset(),o.addClass("js-opener"),jQuery.magnificPopup.open({items:{src:"#"+u[0].id},showCloseBtn:!0,closeBtnInside:!0,closeMarkup:'<button class="mfp-close icon-x"><span class="visuallyhidden">Close overlay<\/span><\/button>',mainClass:"popup",type:"inline",callbacks:{open:function(){jQuery.magnificPopup.instance.close=function(){r.prop("checked",!0);jQuery.magnificPopup.proto.close.call(this)}}}},0),!1});jQuery(".contactpreferences").on("change",".form__field--select",function(n){var i=jQuery(n.target),t=i.closest(".subpanel");t.find("input[name='frequency']").val(t.find("select[name='frequency']").val())});jQuery(".js-alert").each(function(){var n=jQuery(this),i=n.data("channelsInitial"),t;if(n.find(".js-channels-ongoing").val(i),n.find(".form__field--toggle:checked").length)for(t=0;t<i.length;t++)n.find("input[type='checkbox'][data-channel='"+i[t]+"']").prop("checked",!0)})},t}(window.jQuery,window.EC||{});jQuery(function(){jQuery(".contactpreferences").length&&EC.ServiceSelector.Common.ContactPreferences.init()});__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeCarLoan||(n.SppServiceSelectorBeCarLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);$(".js-popup",this.component).modal();$(".form__field--select",this.component).uniform();$("form",this.component).ssfvalidator({showValidationMessages:!0});this.carLoanQuestions=new t.QuestionSections.CarLoanQuestions(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.carLoanQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeCarLoan||(n.SppServiceSelectorBeCarLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.carLoanQuestions=["car_isnew","car_age","credit_duration_months","credit_amount"]}return __extends(t,n),t.prototype.showHideCarLoanQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){var t=$("input[name="+this.carLoanQuestions[0]+"]",this.component),n=$("input[name="+this.carLoanQuestions[1]+"]",this.component),i=this.getAnswerValue(t);i==="No"?this.showQuestion(n):this.hideQuestion(n)},t}(n.SppServiceSelectorBase.BaseQuestions);t.CarLoanQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeCarLoan||(n.SppServiceSelectorBeCarLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.carLoanQuestions=new t.QuestionSections.CarLoanQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.carLoanQuestions.showHideCarLoanQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppCarLoanBeSummary=i})(t=n.SppServiceSelectorBeCarLoan||(n.SppServiceSelectorBeCarLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBePersonalLoan||(n.SppServiceSelectorBePersonalLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);$(".js-popup",this.component).modal();$(".form__field--select",this.component).uniform();$("form",this.component).ssfvalidator({showValidationMessages:!0});this.personalLoanQuestions=new t.QuestionSections.PersonalLoanQuestions(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.personalLoanQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBePersonalLoan||(n.SppServiceSelectorBePersonalLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.personalLoanQuestions=["credit_duration_months","credit_amount"]}return __extends(t,n),t.prototype.showHidePersonalLoanQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.PersonalLoanQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBePersonalLoan||(n.SppServiceSelectorBePersonalLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.personalLoanQuestions=new t.QuestionSections.PersonalLoanQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.personalLoanQuestions.showHidePersonalLoanQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppPersonalLoanBeSummary=i})(t=n.SppServiceSelectorBePersonalLoan||(n.SppServiceSelectorBePersonalLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeHomeRenovationLoan||(n.SppServiceSelectorBeHomeRenovationLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var r=History,i=function(n){function i(i,r){n.call(this,i,r);$(".js-popup",this.component).modal();$(".form__field--select",this.component).uniform();$("form",this.component).ssfvalidator({showValidationMessages:!0});this.homerenovationLoanQuestions=new t.QuestionSections.HomeRenovationLoanQuestions(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.homerenovationLoanQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeHomeRenovationLoan||(n.SppServiceSelectorBeHomeRenovationLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.homeRenovationLoanQuestions=["credit_duration_months","credit_amount"]}return __extends(t,n),t.prototype.showHideHomeRenovationLoanQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.HomeRenovationLoanQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeHomeRenovationLoan||(n.SppServiceSelectorBeHomeRenovationLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.homeRenovationLoanQuestions=new t.QuestionSections.HomeRenovationLoanQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.homeRenovationLoanQuestions.showHideHomeRenovationLoanQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppHomeRenovationLoanBeSummary=i})(t=n.SppServiceSelectorBeHomeRenovationLoan||(n.SppServiceSelectorBeHomeRenovationLoan={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var r=History,i=function(i){function r(n,r){i.call(this,n,r);$(".js-popup",this.component).modal();$(".form__field--select",this.component).uniform();$("form",this.component).ssfvalidator({showValidationMessages:!0});this.savingAccountsQuestions=new t.QuestionSections.SavingAccountsQuestions(this.component)}return __extends(r,i),r.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},r.prototype.bindExtraEvents=function(){var n=this;this.component.find("[data-selector='add-new-contract-button']").on("click",function(){return n.openAddContractModal()})},r.prototype.openAddContractModal=function(){n.Ajax.sendDataToActionAndUpdate("ContractDetails","Details",null,{},null,{onSuccess:function(){return n.SppHelper.openModal("#contract-details-popup")}})},r.prototype.questionsAnsweredLogic=function(){this.savingAccountsQuestions.showOrHideArrowBoxForAllQuestion()},r}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeSavingAccounts||(n.SppServiceSelectorBeSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.savingAccountQuestions=["com_language","sa_initialdepositamount","sa_monthlydeposit","sa_monthlydepositamount","sa_estimatedduration","sa_accountfor","sa_excludeinternet"]}return __extends(t,n),t.prototype.showHideSavingAccountQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){var t=$("input[name="+this.savingAccountQuestions[2]+"]",this.component),i=this.getAnswerValue(t),n=$("[data-question="+this.savingAccountQuestions[3]+"]",this.component);i==="Yes"?this.showQuestion(n):this.hideQuestion(n)},t}(n.SppServiceSelectorBase.BaseQuestions);t.SavingAccountsQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeSavingAccounts||(n.SppServiceSelectorBeSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeSavingAccounts||(n.SppServiceSelectorBeSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.savingAccountQuestions=new t.QuestionSections.SavingAccountsQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.savingAccountQuestions.showHideSavingAccountQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppSavingAccountsBeSummary=i})(t=n.SppServiceSelectorBeSavingAccounts||(n.SppServiceSelectorBeSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"location";case"location":return"serviceselection";case"serviceselection":return this.shouldIncludeContractsFeatureInWizard()?"selectcontracts":$("#ele_include",this.element).prop("checked")?"electricity":"gas";case"electricity":return $("#gas_include",this.element).prop("checked")?"gas":"reductions";case"gas":return"reductions";case"reductions":return null;case"selectcontracts":return $("#ele_include",this.element).prop("checked")?"electricity":"gas";default:return"landingpage"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeEnergy||(n.SppServiceSelectorBeEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.electricityQuestions=new t.QuestionSections.Electricity(this.component);this.gasQuestions=new t.QuestionSections.Gas(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!1,firstStep:"landingpage",shouldHideAdditionalRegions:!0,stepToHideAdditionalRegions:"location",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("location"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){this.component.on("click","input[name=energy]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},i.prototype.questionsAnsweredLogic=function(n){this.electricityQuestions.showHideElectricityQuestions(n);this.gasQuestions.showHideGasQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeEnergy||(n.SppServiceSelectorBeEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var r=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideGasQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){var r="gas_provide_profile_heating",u="gas_provide_profile_noheating",f=$("input[name='gas_for_heating']",this.component),t=this.component.find("[data-question='"+r+"']"),i=this.component.find("[data-question='"+u+"']"),n=this.component.find("[data-question='gas_provide_profile_personalised']").parent();f.is(":checked")?(this.showQuestion(t),this.hideQuestion(i),$("#"+r+"_personalized").is(":checked")?(n.appendTo(t.find(".form__item--boolean:last")),this.showQuestion(n)):this.hideQuestion(n)):(this.hideQuestion(t),this.showQuestion(i),$("#"+u+"_personalized").is(":checked")?(n.appendTo(i.find(".form__item--boolean:last")),this.showQuestion(n)):this.hideQuestion(n))},t}(n.SppServiceSelectorBase.BaseQuestions),i;t.Gas=r;i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideElectricityQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){var c="ele_annual_conso_known",l=$("input[name='ele_provide_meter']",this.component),o=this.getAnswerValue(l),a=$("input[name='ele_exclusive_night']",this.component),s=this.getAnswerValue(a),n=$("[data-question='ele_dual_annual_consumption']",this.component),t=$("[data-question='ele_usage_profile']",this.component),i=$("[data-question='ele_annual_consumption']",this.component),r=$("[data-question='ele_dual_usage_profile']",this.component),u=$("[data-question='ele_usage_profile_personalised_overall']",this.component),f=$("[data-question='ele_usage_profile_personalised_daily']",this.component),e=$("[data-question='ele_usage_profile_personalised_nightly']",this.component),h=$("[data-question='"+c+"']",this.component),y=$("input[name='"+c+"']",this.component),v=this.getAnswerValue(y);l.is(":checked")&&a.is(":checked")?this.component.find("[data-selector=ele_part2]").show():this.component.find("[data-selector=ele_part2]").hide();o==="normal"&&s==="no"?(this.showQuestion(h),v=="yes"?(this.showQuestion(u),this.hideQuestion(f),this.hideQuestion(e)):(this.hideQuestion(u),this.showQuestion(f),this.showQuestion(e)),this.showQuestion(t),this.hideQuestion(r),this.hideQuestion(i),this.hideQuestion(n)):o==="dual_meter"&&s==="no"?(this.showQuestion(h),v=="yes"?(this.hideQuestion(u),this.showQuestion(f),this.showQuestion(e)):(this.showQuestion(u),this.hideQuestion(f),this.hideQuestion(e)),this.hideQuestion(t),this.showQuestion(r),this.hideQuestion(i),this.hideQuestion(n)):o==="normal"&&s==="yes"?(this.hideQuestion(h),this.hideQuestion(t),this.hideQuestion(r),this.showQuestion(i),this.hideQuestion(n)):o==="dual_meter"&&s==="yes"?(this.hideQuestion(h),this.hideQuestion(t),this.hideQuestion(r),this.hideQuestion(i),this.showQuestion(n)):(this.hideQuestion(u),this.hideQuestion(f),this.hideQuestion(e),this.hideQuestion(t),this.hideQuestion(r),this.hideQuestion(i),this.hideQuestion(n))},t}(n.SppServiceSelectorBase.BaseQuestions);t.Electricity=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeEnergy||(n.SppServiceSelectorBeEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(t){var i=function(){function t(){$("#switch-provider-form").ssfvalidator({showValidationMessages:!0});this.bindEvents()}return t.prototype.bindEvents=function(){$(".switch-provider-form").on("blur","input",$.proxy(this.updatePartnerUrl,this));$(".switch-provider-form").on("click",".btn-partner-url",$.proxy(this.submitForm,this))},t.prototype.updatePartnerUrl=function(n){var i=$(n.currentTarget).closest("form"),t=i.find(".btn-partner-url").data("partnerurltemplate");t=t.replace(/(\{firstname\})/gi,i.find(".field-firstname").val());t=t.replace(/(\{lastname\})/gi,i.find(".field-lastname").val());t=t.replace(/(\{email\})/gi,i.find(".field-email").val());t=t.replace(/(\{memberid\})/gi,i.find(".field-membernumber").text());i.find(".btn-partner-url").attr("href",t)},t.prototype.submitForm=function(t){var i=$(t.currentTarget).closest("form");i.ssfvalidator("validate")?n.Ajax.getDataFromAction("SppServiceSelectorBeEnergy","ProcessSwitchProviderForm",null,i.serialize(),null,{useWaitPanel:!0,onValidationFailed:function(){i.find("[data-selector='form-validate-incorrect']").show()}}):t.preventDefault()},t}();t.SppEnergyBeSwitchProvider=i})(t=n.SppServiceSelectorBeEnergy||(n.SppServiceSelectorBeEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.electicity=new t.QuestionSections.Electricity(this.component);this.gas=new t.QuestionSections.Gas(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null);this.bindExtraEvents()}return __extends(r,i),r.prototype.bindExtraEvents=function(){this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame)},r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.electicity.showHideElectricityQuestions(n);this.gas.showHideGasQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppEnergyBeSummary=i})(t=n.SppServiceSelectorBeEnergy||(n.SppServiceSelectorBeEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(t){function r(n,i){t.call(this,n,i)}return __extends(r,t),r.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"location";case"location":return"serviceselection";case"serviceselection":return this.shouldIncludeContractsFeatureInWizard()?"selectcontracts":this.isServiceSelected("internet")?"internet":"telephone";case"internet":return this.isServiceSelected("telephone")?"telephone":this.isServiceSelected("television")?"television":this.isAscrQuestionEnabled()?"saveprofile":null;case"telephone":return this.isServiceSelected("television")?"television":this.isAscrQuestionEnabled()?"saveprofile":null;case"television":return this.isAscrQuestionEnabled()?"saveprofile":null;case"selectcontracts":return this.isServiceSelected("internet")?"internet":"telephone";case"saveprofile":return null;default:return"landingpage"}},r.prototype.isServiceSelected=function(t){var i=$("input[name='service_scope']:checked",this.element),r;i.length===0&&n.Debug.logToConsole("Service selection field not found.",!0);r=i.val();switch(r){case"fix_phone":return t==="telephone";case"fix_internet":return t==="internet";case"fix_internet_phone":return t==="telephone"||t==="internet";case"fix_internet_phone_tv":return!0;case"fix_internet_tv":return t==="internet"||t==="television";default:return n.Debug.logToConsole("Service selection field value could not be matched to known states.",!0),!1}},r}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeTelco||(n.SppServiceSelectorBeTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.telcoQuestions=new t.QuestionSections.TelcoQuestions(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!1,firstStep:"landingpage",shouldHideAdditionalRegions:!0,stepToHideAdditionalRegions:"location",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("location"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(n){this.telcoQuestions.showHideQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeTelco||(n.SppServiceSelectorBeTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.bindEvents()}return __extends(t,n),t.prototype.bindEvents=function(){var n=this,t=this;this.component.on("click","#add-country",function(){t.appendNewCountry($("#country-container",n.component))});this.component.on("click","[data-selector='remove-country']",function(t){n.removeCountry(t)})},t.prototype.showHideQuestions=function(n){this.showHidePersonalisation();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHidePersonalisation=function(){var n=$("#phone_personalisation",this.component),t=$("[name='ftel_profile']:checked",this.component);t.attr("id")==="ftel_profile_personal"?(n.appendTo(t.parent()).show(),this.showHidePersonalisationInternational()):n.hide()},t.prototype.showHidePersonalisationInternational=function(){var t=$("#phone-personalisation-international",this.component);if($("[name='ftel_include_international']",this.component).is(":checked")){this.showQuestion(t);var n=$("#country-container",this.component),i=n.children("[data-selector='country']").length,r=parseInt(n.attr("data-current-index"));i===0&&r===0&&this.appendNewCountry(n);this.showHideButtons(n)}else this.hideQuestion(t)},t.prototype.appendNewCountry=function(n){var r=this,u=n.children("[data-selector='country']").length,f=parseInt(n.attr("data-max-countries"));if(!(u>=f)){var e=$("#js-country-template").html(),t=parseInt(n.attr("data-current-index"))+1,i=$(e.replace(/_1/g,"_"+t));$(".form__field--select",i).uniform();n.append(i);this.recalculatePositions(n);n.attr("data-current-index",t);setTimeout(function(){$("form:visible",r.component).ssfvalidator("restart")},0);this.showHideButtons(n)}},t.prototype.recalculatePositions=function(n){var t=0,i=this;$(n).find("[data-selector='country']").each(function(){$(this).find("[name^='ftel_']").each(function(){var n=$(this).attr("name"),r=t+1,u="";i.endsWith(n,"_country")&&(u=n.substring(0,n.length-9)+r+"_country");u=i.endsWith(n,".Value")?n.substring(0,n.length-7)+r+".Value":n.substring(0,n.length-1)+r;$(this).attr("name",u)});t++})},t.prototype.endsWith=function(n,t){return n.indexOf(t,n.length-t.length)!==-1},t.prototype.removeCountry=function(n){var t=$("#country-container",this.component);$(n.currentTarget).closest("[data-selector='country']").remove();this.recalculatePositions(t);this.showHideButtons(t)},t.prototype.showHideButtons=function(n){var t=n.children("[data-selector='country']"),r=parseInt(n.attr("data-max-countries")),i=t.first().find("[data-selector='actions']");t.length<=1?i.addClass("hidden"):i.removeClass("hidden");t.length===r?$("#add-country").attr("class","hidden"):$("#add-country").attr("class","btn btn--secondary btn--small")},t}(n.SppServiceSelectorBase.BaseQuestions);t.TelcoQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeTelco||(n.SppServiceSelectorBeTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.telcoQuestions=new t.QuestionSections.TelcoQuestions(this.component);this.controllerName=n.controllerName;this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null);this.includeTelevision=$("#includeTelevision",this.component);this.televisionServiceValidationBox=$("#requiredOnlyTelevision",this.component);this.form.on("click.telcoSummary","[data-selector='add-link-panel'] .action-link",this.enableDisableServiceOnAdd);this.form.on("click.telcoSummary","[data-selector='remove-service']",this.enableDisableServiceOnRemove);this.form.on("click.telcoSummary","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click.telcoSummary","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click.telcoSummary","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click.telcoSummary","[data-selector='related-contracts']",this.hideExpenses);this.enableDisableService()}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.telcoQuestions.showHideQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){var n,t;return(this.requiredServiceValidationBox.hide(),this.televisionServiceValidationBox.hide(),n=this.form.find("[data-selector='summary-questions']").not(":disabled"),n.length===0)?(this.requiredServiceValidationBox.show(),!1):n.length===1&&(t=n.eq(0).data("tv"),t==="True")?(this.televisionServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){var i=this;this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t},onValidationFailed:function(){i.requiredServiceValidationBox.show()}})},r.prototype.enableDisableService=function(){var n=this.form.find("[data-section='internet-section']"),u=this.form.find("[data-section='telephone-section']"),f=this.form.find("[data-section='television-section']"),t=n.data("selected"),i=u.data("selected"),r=f.data("selected");return i&&!t&&!r?($(f).find("[data-selector='add-link-panel']").hide(),$(u).find("[data-selector='remove-link-panel']").hide(),!1):!i&&t&&!r?($(n).find("[data-selector='remove-link-panel']").hide(),!1):!i&&t&&r?($(n).find("[data-selector='remove-link-panel']").hide(),!1):void 0},r.prototype.enableDisableServiceOnAdd=function(){var n=$(this).closest(".js-removeable");n.data("section")==="television-section"?n.parent().find("[data-section='internet-section']").find("[data-selector='remove-link-panel']").hide():n.data("section")==="internet-section"&&(n.parent().find("[data-section='television-section']").find("[data-selector='add-link-panel']").show(),n.parent().find("[data-section='telephone-section']").find("[data-selector='remove-link-panel']").show())},r.prototype.enableDisableServiceOnRemove=function(){var n=$(this).closest(".js-removeable");n.data("section")==="television-section"&&n.parent().find("[data-section='internet-section']").find("[data-selector='remove-link-panel']").show();n.data("section")==="internet-section"&&n.parent().find("[data-section='television-section']").find("[data-selector='add-link-panel']").hide()},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppTelcoBeSummary=i})(t=n.SppServiceSelectorBeTelco||(n.SppServiceSelectorBeTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(){function t(n){var t=this;this.serviceOfferId=n;this.steps=$(".step");this.breadcrumb=$(".progress-bar__list");this.dataResume=$(".data-resume");this.form=$(".switch-provider-form");this.verificationStep=5;this.resumeTemplate='<div class="form__item form__item--string"><label class="form__label form__label--adjacent" style="padding-top:0;">{{label}}<\/label><span>{{value}}<\/span><\/div>';i.Adapter.bind(window,"statechange",$.proxy(this.loadStepFromState,this));this.steps.each(function(n,t){$(t).ssfvalidator({showValidationMessages:!0,showSummary:!0,summarySelector:".val-summary"})});this.form.ssfvalidator({showValidationMessages:!0,showSummary:!0,summarySelector:".val-summary",includeHiddenFields:!0});this.steps.find(".next-step").on("click",function(n){n.preventDefault();var r=$(n.currentTarget).parents(".step"),u=parseInt(r.data("step"))+1;r.ssfvalidator("validate")!=!1&&i.pushState({step:u},document.title,"?serviceOfferId="+t.serviceOfferId)});this.bindBreadCrumbClick();this.bindFormSubmit();this.bindEvents();i.replaceState({step:1},document.title,"?serviceOfferId="+this.serviceOfferId)}return t.prototype.bindEvents=function(){var n=this;$(".currentphoneprovider-text").hide();$("#FormValues_CurrentPhoneProviderId").on("change",function(n){$(n.currentTarget).val()!=""?$(".currentphoneprovider-text").show():$(".currentphoneprovider-text").hide()});$("#FormValues_CurrentPhoneProviderId").on("change",function(){n.changePhoneValidation()});$("#FormValues_CurrentPhoneProviderId, #FormValues_CurrentInternetProviderId, #FormValues_CurrentTvProviderId").on("change",function(n){var t=$(n.currentTarget);$("#"+t.attr("id").replace("Id","")).val(t.children("option").filter(":selected").text())})},t.prototype.loadStepFromState=function(){var r=i.getState(),n,t;r.data.step&&(n=r.data.step,t=$("div[data-step='"+n+"']"),this.showStep(n),this.updateBreadCrumb(n),t.data("completed",!0),$("body").scrollTo(t))},t.prototype.changePhoneValidation=function(){$("#FormValues_CurrentPhoneProviderId").val()?($("#FormValues_PhoneNumberToConvert").attr("data-validation","required BEphone"),$("#FormValues_ClientFixedPhone").attr("data-validation","required")):($("#FormValues_PhoneNumberToConvert").attr("data-validation",""),$("#FormValues_ClientFixedPhone").attr("data-validation",""))},t.prototype.bindFormSubmit=function(){var t=this;this.form.on("submit",function(i){i.preventDefault();t.changePhoneValidation();$(".switch-provider-form").ssfvalidator("restart");$(".switch-provider-form").ssfvalidator("validate")?n.Ajax.submitFormAndGetData(t.form[0],{onValidationFailed:function(){t.form.find("[data-selector='form-validate-incorrect']").show()},onSuccess:function(n){n.success?$(".confirmation").show():$(".confirmationFailed").show();$("[data-step]").addClass("hidden");t.breadcrumb.find("li").last().addClass("progress-bar__list__item--complete").removeClass("progress-bar__list__item--current");t.breadcrumb.find("li a").each(function(n,t){var i=$(t),r=i.text();i.parent().text(r);i.remove()})}}):t.showStep(t.form.find(".form__item--has-errors").first().parents("[data-step]").data("step"))})},t.prototype.bindBreadCrumbClick=function(){var n=this;this.breadcrumb.find("li a").off("click").on("click",function(t){var r,u;(t.preventDefault(),r=$(t.currentTarget).parent(),r.hasClass("progress-bar__list__item--incomplete"))||(u=n.breadcrumb.children().index(r)+1,i.pushState({step:u},document.title,null))})},t.prototype.showStep=function(n){var t;if($("[data-step],.confirmation").addClass("hidden"),$("[data-step="+n+"]").removeClass("hidden"),n==this.verificationStep){var u=this.steps.slice(0,this.verificationStep-1),i=this.createFormSummary(u),r="";for(t in i)r+=Mustache.render(this.resumeTemplate,i[t]);this.dataResume.html(r)}},t.prototype.createFormSummary=function(n){var t=[];return $.each(n,function(n,i){var r=$(i),u=r.find(":input:not([type=hidden],button)");$.each(u,function(n,i){var r=$(i),u={},f,e,o,s;if(u.id=r.attr("name"),r.is("input:text")||r.is("textarea"))f=r.parents(".date"),f.length?(e=t.pop(),e.type&&e.type=="date"||t.push(e),o=[],$.each(f.find("input[type=text]"),function(n,t){o.push($(t).val())}),u.type="date",u.label=f.find("label").text(),u.value=o.join("/")):(u.label=r.siblings("label").text(),u.value=r.val());else if(r.is("select"))u.value=r.find("option:selected").text(),u.label=r.parents(".form__item--select").find("label").text();else if(r.is(":radio"))t=$.grep(t,function(n){return n.id!=r.attr("name")}),s=r.parents(".form__group"),u.label=s.find(".form__group__title").text(),u.value=r.is(":checked")?r.siblings("label").text():s.find(":input:checked").siblings("label").text();else return;u.value&&u.value!=""&&t.push(u)})}),t},t.prototype.updateBreadCrumb=function(n){var i=this.breadcrumb.find("li:nth-child("+n+")"),f=this.breadcrumb.children().index($(".progress-bar__list__item--current"))+1,t,r,u;n<f||(t=i.prev(),i.addClass("progress-bar__list__item--current").removeClass("progress-bar__list__item--incomplete"),r=$('<a class="progress-bar__list__link">').attr("href","#").text(i.text()),i.html("").append(r),t.length&&(t.addClass("progress-bar__list__item--complete").removeClass("progress-bar__list__item--current"),u=$('<a class="progress-bar__list__link">').attr("href","#").text(t.text()),t.html("").append(u)),this.breadcrumb.find("li").slice(n).each(function(n,t){var i=$(t),r=i.text();i.removeClass("progress-bar__list__item--current","progress-bar__list__item--complete").addClass("progress-bar__list__item--incomplete").html(r)}),this.bindBreadCrumbClick())},t}();t.SwitchProvider=r})(t=n.SppServiceSelectorBeTelco||(n.SppServiceSelectorBeTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"serviceselection";case"serviceselection":return this.shouldIncludeContractsFeatureInWizard()?"selectcontracts":$("#service_mtel_include",this.element).prop("checked")?"mobilephone":"mobiledata";case"mobilephone":return $("#service_mint_include",this.element).prop("checked")?"mobiledata":"tarifftype";case"mobiledata":return"tarifftype";case"tarifftype":return null;case"selectcontracts":return $("#service_mtel_include",this.element).prop("checked")?"mobilephone":"mobiledata";default:return"landingpage"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeTelcoMobile||(n.SppServiceSelectorBeTelcoMobile={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(t,i){n.call(this,t,i);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.telcoMobileQuestions=new t.QuestionSections.TelcoMobileQuestions(this.component);this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!0,stepToHideAdditionalRegions:"location",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("serviceselection"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){this.component.on("click","input[name=service_scope]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},i.prototype.questionsAnsweredLogic=function(n){console.log("Questionnaire: questionsAnsweredLogic");this.telcoMobileQuestions.showHideTelcoMobileForms(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeTelcoMobile||(n.SppServiceSelectorBeTelcoMobile={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(n){function t(t){n.call(this,t);this.personalizedConst="personalized";this.mobilePhoneConst="mtel";this.mobileDataConst="mint";this.noServicesSelectedConst="none";this.bothServicesSelectedConst="both";this.mobilePhoneServiceSelectedConst="service_mtel_include";this.mobileDataServiceSelectedConst="service_mint_include";this.mobilePhoneFieldset=$("#modify-mobilephone-section",this.component).children("fieldset");this.mobileDataFieldset=$("#modify-mobiledata-section",this.component).children("fieldset");this.hasMobileData=this.component.find("a[href='#delete-mobiledata-section']:visible").length>0;this.hasMobilePhone=this.component.find("a[href='#delete-mobilephone-section']:visible").length>0;this.eventsBound=!1;this.personalisationMtelOpen=!1;this.personalisationMintOpen=!1;this.mobilePersonalizationBound=!1}return __extends(t,n),t.prototype.showHideTelcoMobileForms=function(n){n===void 0&&(n=null);this.showHidePersonalization();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.getSelectedServices=function(){var n,r,t,i;if(this.isSummaryContainerActive=!1,n=$("div[data-component-selector='serviceselection'] input[type='checkbox']:enabled:checked"),r=$("div[data-selector='summary-container']"),n.length===0){if(r.length===1){if(this.isSummaryContainerActive=!0,t=$("div[data-component-selector='mobilephone'] input[type='radio']:enabled:checked"),i=$("div[data-component-selector='mobiledata'] input[type='radio']:enabled:checked"),t.length===1&&i.length>0)return this.bothServicesSelectedConst;if(t.length===1)return this.mobilePhoneServiceSelectedConst;if(i.length>0)return this.mobileDataServiceSelectedConst}return this.noServicesSelectedConst}return n.length===1?n.val():this.bothServicesSelectedConst},t.prototype.showHidePersonalization=function(){var t=$("div[data-component-selector='mobilephone'] input[type='radio']:enabled:checked"),n=$("div[data-component-selector='mobiledata'] input[type='radio']:enabled:checked");switch(this.getSelectedServices()){case"both":this.includeExcludeMobilePhone(!0);t.val()===this.personalizedConst?this.personalizeMobilePhone(t):this.removePersonalization(this.mobilePhoneConst);n.length===2?n.last().val()===this.personalizedConst?this.personalizeMobileData(n.last()):this.removePersonalization(this.mobileDataConst):n.val()===this.personalizedConst?this.personalizeMobileData(n):this.removePersonalization(this.mobileDataConst);break;case"service_mtel_include":t.val()===this.personalizedConst?this.personalizeMobilePhone(t):this.removePersonalization(this.mobilePhoneConst);break;case"service_mint_include":this.includeExcludeMobilePhone(!1);n.val()===this.personalizedConst?this.personalizeMobileData(n):this.removePersonalization(this.mobileDataConst)}this.isSummaryContainerActive&&this.bindTelcoMobileSummaryEvents()},t.prototype.includeExcludeMobilePhone=function(n){var t=$("div[data-component-selector='mobiledata']"),i=t.find("[data-question='mint_profile_includephone']"),r=t.find("[data-question='mint_profile']");n?(this.showQuestion(i),this.hideQuestion(r)):(this.hideQuestion(i),this.showQuestion(r))},t.prototype.personalizeMobilePhone=function(n){var t=$("div[data-component-selector='mobilephone']"),u=t.find("#mobilephone_personalisation"),r,i;this.showQuestion(u.appendTo(n.parent()));r=t.find("#mtel_profile_personalized_fix_phone_include:checked");i=t.find("#mobilephone_personalisation_fixphone");r.length===1?this.showQuestion(i):this.hideQuestion(i)},t.prototype.personalizeMobileData=function(n){var i=$("div[data-component-selector='mobiledata']"),r=i.find("#mobiledata_personalisation"),t=n.parent().children("div");t.length===0&&this.showQuestion(r.appendTo(n.parent()));t.length===1&&this.showQuestion(t.first())},t.prototype.removePersonalization=function(n){switch(n){case this.mobileDataConst:this.hideQuestion($("div[data-component-selector='mobiledata'] #mobiledata_personalisation"));break;case this.mobilePhoneConst:this.hideQuestion($("div[data-component-selector='mobilephone'] #mobilephone_personalisation"))}},t.prototype.bindTelcoMobileSummaryEvents=function(){if(!this.eventsBound){console.log("bindTelcoMobileSummaryEvents: GENERAL");this.hasMobileData=this.component.find("a[href='#delete-mobiledata-section']:visible").length>0;this.hasMobilePhone=this.component.find("a[href='#delete-mobilephone-section']:visible").length>0;var n=this.component.find("[data-addremove-selector='mobilephone-section']"),i=n.find("[data-selector='add-link-panel']").children("a[href='#modify-mobilephone-section']"),r=n.find("a[role='button'][data-profilename='mobilephone-section']"),t=this.component.find("[data-addremove-selector='mobiledata-section']");i.on("click",$.proxy(this.clickMobilePhoneAdd,this,t));r.on("click",$.proxy(this.clickMobilePhoneRemove,this,t));console.log("bindTelcoMobileSummaryEvents: events bound");this.eventsBound=!0}},t.prototype.clickMobilePhoneAdd=function(n){this.hasMobileData&&(n.find("a[href='#modify-mobiledata-section']").click(),console.log("clickMobilePhoneAdd: click forced"))},t.prototype.clickMobilePhoneRemove=function(n){this.hasMobileData&&(n.find("a[href='#modify-mobiledata-section']").last().click(),console.log("clickMobilePhoneRemove: click forced"))},t}(n.SppServiceSelectorBase.BaseQuestions);t.TelcoMobileQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeTelcoMobile||(n.SppServiceSelectorBeTelcoMobile={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(i){function r(n){i.call(this,n);this.telcoMobileQuestions=new t.QuestionSections.TelcoMobileQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null);this.bindUiEvents()}return __extends(r,i),r.prototype.bindUiEvents=function(){this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses)},r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.telcoMobileQuestions.showHideTelcoMobileForms(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){var n,t;return(this.requiredServiceValidationBox.hide(),n=this.form.find("[data-selector='summary-questions']").not(":disabled"),n.length===0)?(this.requiredServiceValidationBox.show(),!1):(t=this.form.find("[data-selector='summary-tarifftype']").not(":disabled"),t.length===0)?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){for(var i,u=$('div[data-selector="related-contracts"] input[type="checkbox"]:checked'),r=0;r<u.length;r++)i=$(u[r]),i.val(i.attr("data-value"));n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppTelcoMobileBeSummary=i})(t=n.SppServiceSelectorBeTelcoMobile||(n.SppServiceSelectorBeTelcoMobile={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"location";case"location":return"familymembers";case"familymembers":return"productandoption";case"productandoption":return this.isAscrQuestionEnabled()?"saveprofile":null;case"saveprofile":return null;default:return"landingpage"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeSupermarket||(n.SppServiceSelectorBeSupermarket={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);$(".js-popup",this.component).modal();$("form",this.component).ssfvalidator({showValidationMessages:!0});this.supermarketQuestions=new t.QuestionSections.ProfileChoiceQuestions(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(n){this.supermarketQuestions.showHideQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeSupermarket||(n.SppServiceSelectorBeSupermarket={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideQuestions=function(n){n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.ProfileChoiceQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeSupermarket||(n.SppServiceSelectorBeSupermarket={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.profileChoiceQuestions=new t.QuestionSections.ProfileChoiceQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.profileChoiceQuestions.showHideQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppSupermarketBeSummary=i})(t=n.SppServiceSelectorBeSupermarket||(n.SppServiceSelectorBeSupermarket={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"location";case"location":return"family";case"family":return null;default:return"landingpage"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeMut||(n.SppServiceSelectorBeMut={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.mutQuestions=new t.QuestionSections.MutQuestions(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){var n={onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!1,firstStep:"landingpage",shouldHideAdditionalRegions:!0,stepToHideAdditionalRegions:"location",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn};this.navigator=new t.Navigator(this.component,n);location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("location"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.mutQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeMut||(n.SppServiceSelectorBeMut={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideMutQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.MutQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeMut||(n.SppServiceSelectorBeMut={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var r=History,i=function(n){function i(i,r){n.call(this,i,r);$(".js-popup",this.component).modal();$("form",this.component).ssfvalidator({showValidationMessages:!0});this.carInsurancesQuestions=new t.QuestionSections.CarInsurancesQuestions(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.openAddContractModal=function(){},i.prototype.questionsAnsweredLogic=function(n){this.carInsurancesQuestions.showHideQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBeCarInsurances||(n.SppServiceSelectorBeCarInsurances={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var r=function(n){function t(t){n.call(this,t);this.carMapProperties=null;this.fuelTypeId="#fueltypes";this.fuelTypeListId="#fueltypeslist";this.brandsId="#brands";this.brandsListId="#brandslist";this.modelsId="#models";this.modelsListId="#modelslist";this.versionsId="#versions";this.versionsListId="#versionslist";this.registrationId="#registrations";this.registrationListId="#registrationslist";this.locationsId="#location";this.isNewCarId="input[name=isnewcar]";this.postalCodeId="#postalcode";this.birthdateId="#birthdate";this.licencedateId="#licencedate";this.areparentsclientId="#areparentsclient";this.carpowerId="#carpower";this.carpriceId="#carprice";this.finalcheckId="#finalcheck";this.form=this.component.find("form");this.calculateBtn="#calculate";this.moreInfoId="#moreinfo";this.validator=new i(this);this.carMapProperties=["Price","Kw","Hp","FuelType","FuelTypeLabel"];this.isBirhdateValid=!1;this.isLicensedateValid=!1;this.isRegistrationValid=!1;this.initHandlers()}return __extends(t,n),t.prototype.initHandlers=function(){var n=this;$(this.form).find(".form__item__note--error").remove();$(this.registrationListId).on("change",this.onRegistrationClicked.bind(this));$(this.fuelTypeListId).on("change",this.getBrands.bind(this));$(this.brandsListId).on("change",this.getModels.bind(this));$(this.modelsListId).on("change",this.getCars.bind(this));$(this.versionsListId).on("change",this.onCarSelected.bind(this));$(this.isNewCarId).on("change",this.onIsNewCarClicked.bind(this));$(this.birthdateId).on("dateChanged",this.onBirthdateSelected.bind(this));$(this.licencedateId).on("dateChanged",this.onLicenseDateSelected.bind(this));$(this.calculateBtn).on("click",this.onCalculateClicked.bind(this));$(function(){var i;n.form.ssfvalidator("addRule","final-check",n.validator.validate.bind(n.validator),"");$(n.birthdateId).dateSelect();$(n.licencedateId).dateSelect();$(n.locationsId).autocomplete({source:window.__locations,select:n.onLocationSelected.bind(n)});var t=n.getParams(),r=t.registration,u=t.fuelType,f=t.brandId,e=t.modelId,o=t.versionId,s=[u,f,e,o].every(function(n){return n.length>0});s&&($(n.brandsListId).parents("section").show(),$(n.modelsListId).parents("section").show(),$(n.versionsListId).parents("section").show(),$(n.areparentsclientId).parents("section").show(),n.isBirhdateValid=!0,n.isLicensedateValid=!0,n.bindMetaData(),n.displayMoreInfo());i=n.isNewCar();n.isRegistrationValid=i;i||(n.isRegistrationValid=r.length>0,$(n.registrationId).parents("section").show())})},t.prototype.showHideQuestions=function(n){n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.onCalculateClicked=function(){var n=this.getParams(),t=n.registration,i=n.fuelType,r=n.brandId,u=n.modelId,f=n.versionId;$(this.modelsId).val(u);$(this.registrationId).val(t);$(this.fuelTypeId).val(i);$(this.brandsId).val(r);$(this.versionsId).val(f)},t.prototype.reset=function(n){var r=this,t=null,i=null;n===1?(t=[this.brandsListId,this.modelsListId,this.versionsListId],i=[this.brandsId,this.modelsId,this.versionsId]):n===2?(t=[this.modelsListId,this.versionsListId],i=[this.modelsId,this.versionsId]):n===3?(t=[this.versionsListId],i=[this.versionsId]):(t=[],i=[]);t.forEach(function(n){$(n,r.component).parents("section").hide();r.cleanDropDownList(n);r.resetDropDownList(n)});i.forEach(function(n){$(n,r.component).val("")});$(this.component).find("._warning").hide();$(this.carpriceId).val("");$(this.carpowerId).val("");$(this.finalcheckId).toggle(!1);this.displayMoreInfo()},t.prototype.onLocationSelected=function(n,t){var i=new RegExp("\\d{4}").exec(t.item.value);i.length>0&&$(this.postalCodeId).val(i[0])},t.prototype.onCarSelected=function(n){this.setPriceAndKw(n);this.displayMoreInfo()},t.prototype.displayMoreInfo=function(){var n=this.hasValue("kw"),t="";if(n){var i=$(this.versionsListId).find(":selected").data("fueltypelabel"),r=$(this.brandsListId).find(":selected").text(),u=$(this.modelsListId).find(":selected").text(),f=$(this.versionsListId).find(":selected").text(),e=this.getParams().kw,o=this.getParams().hp,s=[r,u,f,i,e+" kW",o+" "+window.__powerlabel.hp];t="<li><i>"+s.join(" - ")+"<\/i><\/li>"}$(this.moreInfoId).find("ul").html(t);$(this.moreInfoId).toggle(n)},t.prototype.onBirthdateSelected=function(n){var t=this,r=this.getUrl(n,"GetUserInfo"),i=this.getParams(),u=i.birthdate,f=i.licensedate,e=function(n){t.isBirhdateValid=n.IsBirthdateValid;t.isLicensedateValid=n.IsLicenceDateValid;var i=n.CalculatedLicenseDate?n.CalculatedLicenseDate:"";$(t.licencedateId,t.component).val(i);$(t.areparentsclientId,t.component).parents("section").toggle(n.IsInRange)},o=function(){};this.doAjax(r,{request:{birthdate:u,licensedate:f}},e,o)},t.prototype.onLicenseDateSelected=function(n){var t=this,r=this.getUrl(n,"GetUserInfo"),i=this.getParams(),u=i.birthdate,f=i.licensedate,e=function(n){t.isBirhdateValid=n.IsBirthdateValid;t.isLicensedateValid=n.IsLicenceDateValid},o=function(){};this.doAjax(r,{request:{birthdate:u,licensedate:f}},e,o)},t.prototype.onRegistrationClicked=function(){var n=this.isRegistrationValid;this.isRegistrationValid=!!this.getParams().registration;n&&this.isRegistrationValid||(n||this.isRegistrationValid)&&!n&&this.isRegistrationValid&&(this.reset(1),this.resetDropDownList(this.fuelTypeListId),$(this.fuelTypeId,this.component).parents("section").toggle(this.isRegistrationValid))},t.prototype.isNewCar=function(){return $(this.isNewCarId+":checked",this.component).val().toLowerCase()==="true"},t.prototype.onIsNewCarClicked=function(){var n=this.isNewCar(),t=!n;this.reset(1);this.resetDropDownList(this.registrationListId);n&&this.resetDropDownList(this.fuelTypeListId);$(this.registrationId,this.component).parents("section").toggle(t);$(this.fuelTypeId,this.component).parents("section").toggle(n);this.isRegistrationValid=n;t&&(this.isRegistrationValid=!!this.getParams().registration)},t.prototype.getBrands=function(n){this.hasValue("fuelType")?this.execute(n,this.brandsListId,"getBrands",1,"BrandId","BrandName",function(){}):this.reset(1)},t.prototype.getModels=function(n){var i=this,t;this.hasValue("brandId")?(t=function(){$(i.component).find("._warning._m").show()},this.execute(n,this.modelsListId,"getModels",2,"ModelId","ModelName",t)):this.reset(2)},t.prototype.getCars=function(n){var i=this,t;this.hasValue("modelId")?(t=function(){$(i.component).find("._warning._c").show()},this.execute(n,this.versionsListId,"getVersions",3,"VersionId","VersionName",t)):this.reset(3)},t.prototype.execute=function(n,t,i,r,u,f,e){var o=this,h=function(n){var i=n.map(function(n){var t=o.carMapProperties.map(function(t){return"data-"+t.toLowerCase()+'="'+n[t]+'"'});return'<option value="'+n[u]+'"'+t.join("")+">"+n[f]+"<\/option>"},o);o.cleanDropDownList(t);$(t,o.component).first().append(i.join(""));o.resetDropDownList(t);n.length>0?($(t,o.component).trigger("click"),$(t,o.component).parents("section").show()):(o.reset(r),e())},c=function(n){console.log(n)},l=this.getUrl(n,i),s;this.reset(r);this.setPriceAndKw(n);s=this.getParams();this.doAjax(l,{request:s},h,c)},t.prototype.hasValue=function(n){return!!this.getParams()[n]},t.prototype.setPriceAndKw=function(){var n=this.getParams();$(this.carpowerId,this.component).val(n.kw);$(this.carpriceId,this.component).val(n.price)},t.prototype.getParams=function(){var n=$(this.isNewCarId+":checked",this.component).val(),t=$(this.fuelTypeListId,this.component).find(":selected").val()||"",i=$(this.brandsListId,this.component).find(":selected").val()||0,r=$(this.modelsListId,this.component).find(":selected").val()||0,u=$(this.versionsListId,this.component).find(":selected").val()||0,f=$(this.registrationListId,this.component).find(":selected").val()||0,e=$(this.birthdateId,this.component).val(),o=$(this.licencedateId,this.component).val(),s=$(this.postalCodeId,this.component).val(),h=$(this.locationsId,this.component).val(),c=$(this.versionsListId).find(":selected").data("price")||"",l=$(this.versionsListId).find(":selected").data("kw")||"",a=$(this.versionsListId).find(":selected").data("hp")||"";return{isNew:n,fuelType:t,brandId:i,modelId:r,versionId:u,registration:f,birthdate:e,licensedate:o,postalcode:s,price:c,kw:l,hp:a,location:h}},t.prototype.cleanDropDownList=function(n){$(n,this.component).children().not(":first").remove()},t.prototype.resetDropDownList=function(n){$(n,this.component).find("option:eq(0)").prop("selected",!0)},t.prototype.getUrl=function(n,t){var r="",u=$(n.currentTarget).parents("form").attr("action"),i=u.split("/").filter(function(n){return n.length>0});return i.length===4&&(i[2]=t,r="/"+i.join("/")),r},t.prototype.bindMetaData=function(){var t=this,i=window.__carmetadata,n=null;$(this.versionsListId).find("option").toArray().forEach(function(r){n=i.filter(function(n){return n.VersionId===parseInt(r.value)});n.length>0&&t.carMapProperties.forEach(function(t){$(r).data(t.toLowerCase(),n[0][t])})},this)},t.prototype.doAjax=function(n,t,i,r){$.ajax({type:"POST",url:n,dataType:"json",contentType:"application/json; charset=utf-8",data:JSON.stringify(t)}).then(i).fail(r).always(function(n){console.log("always",n)})},t}(n.SppServiceSelectorBase.BaseQuestions),i;t.CarInsurancesQuestions=r;i=function(){function n(n){this.targetId="#carinsurancesvalidationerror";this.main=n}return n.prototype.validate=function(){var t=this.getDefaultMessage(),i=this.main.getParams(),n=[],r,u;return this.main.isPostalCodeValid=/\d{4}/.test(i.postalcode),this.main.isPostalCodeValid||n.push({label:this.findLabel(this.main.locationsId),message:this.findMessage(this.main.locationsId)}),this.main.isBirhdateValid||n.push({label:this.findLabel(this.main.birthdateId),message:this.findMessage(this.main.birthdateId)}),this.main.isLicensedateValid||n.push({label:this.findLabel(this.main.licencedateId),message:this.findMessage(this.main.licencedateId)}),this.main.isRegistrationValid||n.push({label:this.findLabel(this.main.registrationId),message:t}),!this.hasValue(i,"fuelType")&&this.isDisplay(this.main.fuelTypeListId)&&n.push({label:this.findLabel(this.main.fuelTypeId),message:t}),!this.hasValue(i,"brandId")&&this.isDisplay(this.main.brandsListId)&&n.push({label:this.findLabel(this.main.brandsId),message:t}),!this.hasValue(i,"modelId")&&this.isDisplay(this.main.modelsListId)&&n.push({label:this.findLabel(this.main.modelsId),message:t}),!this.hasValue(i,"versionId")&&this.isDisplay(this.main.versionsListId)&&n.push({label:this.findLabel(this.main.versionsId),message:t}),r=n.length===0,u=n.map(this.generate).join(""),$(this.targetId).find("ul").html(u),$(this.targetId).toggle(!r),r},n.prototype.findLabel=function(n){return $(n).parents("section").find("label").text()},n.prototype.findMessage=function(n){return $(n).parents("section").find("label").data("message")},n.prototype.hasValue=function(n,t){return n[t].length>0},n.prototype.getDefaultMessage=function(){return $(this.targetId).data("message")},n.prototype.isDisplay=function(n){return $(n).parents("section").is(":visible")},n.prototype.generate=function(n){var t=["<li>",'<a href="javascript:void(0);">',n.label+": "+n.message,"<\/a>","<\/li>"];return t.join("")},n}()})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBeCarInsurances||(n.SppServiceSelectorBeCarInsurances={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBeCarInsurances||(n.SppServiceSelectorBeCarInsurances={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.carInsurancesQuestions=new t.QuestionSections.CarInsurancesQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.carInsurancesQuestions.showHideQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppCarInsurancesBeSummary=i})(t=n.SppServiceSelectorBeCarInsurances||(n.SppServiceSelectorBeCarInsurances={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(i){function r(n,t){i.call(this,n,t);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(r,i),r.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},r.prototype.bindExtraEvents=function(){var n=this;this.component.find("[data-selector='add-new-contract-button']").on("click",function(){return n.openAddContractModal()})},r.prototype.openAddContractModal=function(){n.Ajax.sendDataToActionAndUpdate("ContractDetails","Details",null,{},null,{onSuccess:function(){return n.SppHelper.openModal("#contract-details-popup")}})},r.prototype.questionsAnsweredLogic=function(){},r}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorItSavingAccounts||(n.SppServiceSelectorItSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorItSavingAccounts||(n.SppServiceSelectorItSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(t){function i(n){t.call(this,n);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses);this.showHideQuestionsLogic(null)}return __extends(i,t),i.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0)},i.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},i.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},i.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},i}(n.SppServiceSelectorBase.SppBaseSummary);t.SppSavingAccountsItSummary=i})(t=n.SppServiceSelectorItSavingAccounts||(n.SppServiceSelectorItSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"location";case"location":return"serviceselection";case"serviceselection":return this.shouldIncludeContractsFeatureInWizard()?"selectcontracts":$("#com_ele_include",this.element).prop("checked")?"electricity":"gas";case"electricity":return $("#com_gas_include",this.element).prop("checked")?"gas":"reductions";case"gas":return"reductions";case"reductions":return null;case"selectcontracts":return $("#com_ele_include",this.element).prop("checked")?"electricity":"gas";default:return"landingpage"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorItEnergy||(n.SppServiceSelectorItEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.serviceSelectionQuestions=new t.QuestionSections.ServiceSelection(this.component,!1)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!1,firstStep:"landingpage",shouldHideAdditionalRegions:!0,stepToHideAdditionalRegions:"landingpage",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("location"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){this.component.on("click","input[name=energy]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},i.prototype.questionsAnsweredLogic=function(n){this.serviceSelectionQuestions.showHideSerciceSelectionQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorItEnergy||(n.SppServiceSelectorItEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t,i){n.call(this,t);this.includeGas="com_gas_include";this.includeElec="com_ele_include";this.energyMeterPersonalized="ele_meter_power_specific";this.energyMeter="ele_meter_power";this.disableGas=i;this.gasFieldset=$("#modify-gas-section",this.component).children("fieldset");this.elecFieldset=$("#modify-electricity-section",this.component).children("fieldset")}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion();this.showHideQuestions()},t.prototype.showHideQuestionsForQuestionnaire=function(){var n=this.component.find("[data-question='"+this.energyMeterPersonalized+"']"),i=$("input[id='"+this.includeGas+"']",this.component),t=$("select[id='"+this.energyMeter+"']",this.component);t.val()==="other"?this.showQuestion(n):this.hideQuestion(n)},t.prototype.gasIsIncluded=function(){var n=$("input[id='"+this.includeGas+"']",this.component);return n.is(":checked")||this.gasFieldset.length!==0&&!this.gasFieldset.is(":disabled")},t.prototype.elecIsIncluded=function(){var n=$("input[id='"+this.includeElec+"']",this.component);return n.is(":checked")||this.elecFieldset.length!==0&&!this.elecFieldset.is(":disabled")},t.prototype.showHideQuestions=function(){this.showHideQuestionsForQuestionnaire()},t}(n.SppServiceSelectorBase.BaseQuestions);t.ServiceSelection=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorItEnergy||(n.SppServiceSelectorItEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(t){function r(n,r){t.call(this,n);this.serviceSelection=new i.QuestionSections.ServiceSelection(this.component,r);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null);this.addEventListeners()}return __extends(r,t),r.prototype.addEventListeners=function(){this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses)},r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.serviceSelection.showHideSerciceSelectionQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.ServiceSelector.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=t}})},r}(t.SppServiceSelectorBase.SppBaseSummary);i.SppEnergyItSummary=r})(i=t.SppServiceSelectorItEnergy||(t.SppServiceSelectorItEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"serviceselection";case"serviceselection":return this.options.contractsFeatureEnabled?"selectcontracts":this.internetIsOnlyIncluded()?"internet":"telephone";case"telephone":return this.internetIsIncluded()?"internet":this.isAscrQuestionEnabled()?"saveprofile":null;case"internet":return this.isAscrQuestionEnabled()?"saveprofile":null;case"selectcontracts":return this.internetIsOnlyIncluded()?"internet":"telephone";case"saveprofile":return null;default:return"serviceselection"}},t.prototype.internetIsOnlyIncluded=function(){var n=$("select[name='m_mobile_device']").val();return n==="Smartphone"?!1:!0},t.prototype.internetIsIncluded=function(){var n=$("input[name='com_service_scope']:checked").val();return n==="calls_sms_data"},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorItTelcoMobile||(n.SppServiceSelectorItTelcoMobile={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var r=History,i=function(n){function i(t,i){n.call(this,t,i);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){var n=this;n.telcoMobileQuestions=new t.QuestionSections.TelcoMobileQuestions(n.component);this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn,onStepLoaded:function(t){t==="serviceselection"&&n.telcoMobileQuestions.showHideServiceSelectionQuestions()}});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("serviceselection"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){this.component.on("click","input[name=telco]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},i.prototype.questionsAnsweredLogic=function(n){this.telcoMobileQuestions.showHideServiceSelectionQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorItTelcoMobile||(n.SppServiceSelectorItTelcoMobile={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideServiceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion();this.showHideQuestions()},t.prototype.showHideSummaryQuestions=function(n){n===void 0&&(n=null);this.showHideQuestionSummary()},t.prototype.showHideQuestions=function(){var f=$("select[name='m_mobile_device']",this.component),r=this.component.find("[data-question='com_service_scope']"),n,t,u,i;this.getAnswerValue(f)==="Smartphone"?($("#com_service_scope_only_internet",this.component).prop("checked",!1),$("label[for=com_service_scope_only_internet],#com_service_scope_only_internet").hide(),this.showQuestion(r)):($("#com_service_scope_only_internet",this.component).prop("checked",!0),this.hideQuestion(r),$("#com_service_scope_only_internet",this.component).prop("disabled",!1));n=$("select[name='mtel_calls_type']",this.component);t=this.component.find("[data-question='mtel_calls_type_provider']");this.getAnswerValue(n)==="cellular"?this.showQuestion(t):this.hideQuestion(t);u=$("select[name='mtel_calls_type_provider']",this.component);i=this.component.find("[data-question='mtel_pref_number']");this.getAnswerValue(n)==="cellular"&&this.getAnswerValue(u)!="dont_know"?this.showQuestion(i):this.hideQuestion(i)},t.prototype.showHideQuestionSummary=function(){var n=$("select[name='m_mobile_device']",this.component),t=this.component.find("[data-question='com_service_scope']"),i;this.getAnswerValue(n)==="Smartphone"?($("#com_service_scope_only_internet",this.component).prop("checked",!1),$("label[for=com_service_scope_only_internet],#com_service_scope_only_internet").hide(),this.showQuestion(t)):($("#com_service_scope_only_internet",this.component).prop("checked",!0),this.hideQuestion(t),$("#com_service_scope_only_internet",this.component).prop("disabled",!1));this.getAnswerValue(n)==="Smartphone"?(this.ithasMobilePhone=!0,this.ithasMobileData=$("#com_service_scope_calls_sms").is(":checked")?!1:!0):(this.ithasMobileData=!0,this.ithasMobilePhone=!1);i=$("div[data-selector='summary-container']");i.length===1&&this.bindTelcoMobileSummaryEventsIT()},t.prototype.bindTelcoMobileSummaryEventsIT=function(){var n=this.component.find("[data-addremove-selector='telephone-section']"),i=n.find("#modify-telephone-section"),h=n.find("a[href='#delete-telephone-section']"),c=n.find("a[href='#modify-telephone-section']"),r,u,f,s,e;h.hide();c.hide();var t=this.component.find("[data-addremove-selector='internet-section']"),o=t.find("#modify-internet-section"),l=t.find("a[href='#delete-internet-section']"),a=t.find("a[href='#modify-internet-section']");l.hide();a.hide();this.ithasMobileData&&!this.ithasMobilePhone?($("#modify-internet-section",this.component).children("fieldset").prop("disabled",!1),this.hideQuestion(n),this.showQuestion(t),this.showQuestion(o),this.hideQuestion(i)):this.ithasMobileData&&this.ithasMobilePhone?($("#modify-internet-section",this.component).children("fieldset").prop("disabled",!1),$("#modify-telephone-section",this.component).children("fieldset").prop("disabled",!1),this.showQuestion(n),this.showQuestion(t),this.showQuestion(i),this.showQuestion(o)):($("#modify-telephone-section",this.component).children("fieldset").prop("disabled",!1),this.hideQuestion(t),this.showQuestion(n),this.showQuestion(i),this.hideQuestion(o));r=this.component.find("[data-arrowbox-for-option='mtel_profile_personalised']");$("#mtel_profile_personalised").is(":checked")?(this.showQuestion(r),u=$("select[name='mtel_calls_type']",this.component),f=this.component.find("[data-question='mtel_calls_type_provider']"),this.getAnswerValue(u)==="cellular"?this.showQuestion(f):this.hideQuestion(f),s=$("select[name='mtel_calls_type_provider']",this.component),e=this.component.find("[data-question='mtel_pref_number']"),this.getAnswerValue(u)==="cellular"&&this.getAnswerValue(s)!="dont_know"?this.showQuestion(e):this.hideQuestion(e)):this.hideQuestion(r)},t}(n.SppServiceSelectorBase.BaseQuestions);t.TelcoMobileQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorItTelcoMobile||(n.SppServiceSelectorItTelcoMobile={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(t){function r(n){t.call(this,n);this.telcoQuestions=new i.QuestionSections.TelcoMobileQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,t),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.telcoQuestions.showHideSummaryQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.ServiceSelector.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=t}})},r}(t.SppServiceSelectorBase.SppBaseSummary);i.SppTelcoMobileItSummary=r})(i=t.SppServiceSelectorItTelcoMobile||(t.SppServiceSelectorItTelcoMobile={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"serviceselection";case"serviceselection":return this.options.contractsFeatureEnabled?"selectcontracts":$("#com_fint_include",this.element).prop("checked")?"internet":"telephone";case"internet":return $("#com_ftel_include",this.element).prop("checked")?"telephone":this.isAscrQuestionEnabled()?"saveprofile":null;case"telephone":return this.isAscrQuestionEnabled()?"saveprofile":null;case"selectcontracts":return $("#com_fint_include",this.element).prop("checked")?"internet":"telephone";case"saveprofile":return null;default:return"serviceselection"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorItTelcoFix||(n.SppServiceSelectorItTelcoFix={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var r=History,i=function(n){function i(t,i){n.call(this,t,i);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){var n=this;n.telcoQuestions=new t.QuestionSections.TelcoQuestions(n.component);this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn,onStepLoaded:function(t){t==="serviceselection"&&n.telcoQuestions.showHideSerciceSelectionQuestions()}});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("serviceselection"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){this.component.on("click","input[name=telco]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},i.prototype.questionsAnsweredLogic=function(n){this.telcoQuestions.showHideSerciceSelectionQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorItTelcoFix||(n.SppServiceSelectorItTelcoFix={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.includeInternet="com_fint_include";this.includePhone="com_ftel_include";this.sameProviderTextMessageSelector=".form__item__note:not(.form__item__note--error)"}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion();this.showHideQuestions()},t.prototype.showHideQuestions=function(){var n=$("input[id='"+this.includeInternet+"']",this.component),t=$("input[id='"+this.includePhone+"']",this.component),i=n.is(":checked"),r=t.is(":checked")},t}(n.SppServiceSelectorBase.BaseQuestions);t.TelcoQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorItTelcoFix||(n.SppServiceSelectorItTelcoFix={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(r){function u(n){r.call(this,n);this.telcoQuestions=new i.QuestionSections.TelcoQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null);this.addEventListeners()}return __extends(u,r),u.prototype.addEventListeners=function(){this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses)},u.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);this.telcoQuestions.showHideSerciceSelectionQuestions(n)},u.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},u.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},u.prototype.doSubmit=function(i){var r=this;this.actuallySelectAllSelectedContracts();t.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=i},onValidationFailed:function(){r.requiredServiceValidationBox.show()}})},u}(t.SppServiceSelectorBase.SppBaseSummary);i.SppTelcoFixItSummary=r})(i=t.SppServiceSelectorItTelcoFix||(t.SppServiceSelectorItTelcoFix={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(t,i){n.call(this,t,i);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppSSFItHHLiabilityInsur||(n.SppSSFItHHLiabilityInsur={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppSSFItHHLiabilityInsur||(n.SppSSFItHHLiabilityInsur={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(t){function i(n){t.call(this,n);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,t),i.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0)},i.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},i.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},i.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},i}(n.SppServiceSelectorBase.SppBaseSummary);t.SppHHLiabilityInsurItSummary=i})(t=n.SppSSFItHHLiabilityInsur||(n.SppSSFItHHLiabilityInsur={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var r=History,i=function(n){function i(t,i){n.call(this,t,i);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){var n=this,i=this;i.PrepaidCardsQuestions=new t.QuestionSections.PrepaidCardsQuestions(this.component);this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn,onStepLoaded:function(t){t==="prepaidcardinput"&&n.PrepaidCardsQuestions.showHideServiceSelectionQuestions()}});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("serviceselection"):this.navigator.loadStepFromState(null)},i.prototype.questionsAnsweredLogic=function(n){this.PrepaidCardsQuestions.showHideServiceSelectionQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppSSFItPrepaidCards||(n.SppSSFItPrepaidCards={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"serviceselection";case"serviceselection":return"prepaidcardinput";case"prepaidcardinput":return null;default:return"serviceselection"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppSSFItPrepaidCards||(n.SppSSFItPrepaidCards={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.UseForeign="pc_use_foreign";this.Under18="pc_under_18";this.UseOnlyOnline="pc_online";this.initHandlers()}return __extends(t,n),t.prototype.initHandlers=function(){var n=$("input[name='"+this.Under18+"']:checked",this.component);n.val()&&n.val()==="Yes"?($("#pc_online_Yes_but_not_only_online").hide(),$("label[for='pc_online_Yes_only_online']").hide(),$("label[for='pc_online_Yes_but_not_only_online']").text("Sì")):($("#pc_online_Yes_but_not_only_online").show(),$("label[for='pc_online_Yes_only_online']").show(),$("label[for='pc_online_Yes_but_not_only_online']").text("Sì online e fisico"))},t.prototype.showHideServiceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):(this.showOrHideArrowBoxForAllQuestion(),this.showHidePrepaidCardsQuestions());this.showHideQuestions()},t.prototype.showHideSummaryQuestions=function(n){n===void 0&&(n=null);this.showHideQuestionSummary()},t.prototype.showHideQuestions=function(){var i=!1,u=!1,r=$("input[name='"+this.Under18+"']:checked",this.component),n,t;r.val()&&r.val()==="Yes"?($("#pc_online_Yes_but_not_only_online").hide(),$("label[for='pc_online_Yes_only_online']").hide(),$("#pc_online_Yes_only_online",this.component).prop("checked",!1),$("label[for='pc_online_Yes_but_not_only_online']").text("Sì"),i=!0):($("#pc_online_Yes_but_not_only_online").show(),$("label[for='pc_online_Yes_only_online']").show(),$("label[for='pc_online_Yes_but_not_only_online']").text("Sì online e fisico"));n=$("input[name='"+this.UseOnlyOnline+"']:checked",this.component);t=$("input[name='"+this.UseForeign+"']:checked",this.component);t.val()&&t.val()==="No"?($("#ItPrepaidCards_InfoUE_ExtraUE").hide(),$("#ItPrepaidCards_Info_ExtraUE_Online").hide()):(u=!0,$("#ItPrepaidCards_Info_ExtraUE_Online").show(),n.val()==="Yes_only_online"?($("label[for='pc_n_purchase_extraue']").text("Sì online e fisico"),$("#ItPrepaidCards_InfoUE_ExtraUE").hide(),$("label[for='pc_n_purchase_extraue']").text("N. pagamenti con carta sui siti esteri in valuta extraeuro"),$("label[for='pc_amount_purchases_xeu']").text("Importo medio di un pagamento su sito in valuta extraeuro")):$("#ItPrepaidCards_InfoUE_ExtraUE").show());i||n.val()!=="Yes_only_online"?$("#ItPrepaidCards_InfoNoOnlyOnline").show():$("#ItPrepaidCards_InfoNoOnlyOnline").hide()},t.prototype.showHidePrepaidCardsQuestions=function(){$("#pc_n_load_internet").val()===""&&($("#pc_n_load_internet").val("0"),$("#pc_n_load_bank").val("0"),$("#pc_n_load_atm").val("0"),$("#pc_n_it_atn_withdrawals_bank").val("0"),$("#pc_n_it_atmwithdrawalsob").val("0"),$("#pc_n_gasoline_purchased").val("0"),$("#pc_n_eu_atm_withdrawals").val("0"),$("#pc_n_xeu_atm_withdrawalsb").val("0"),$("#pc_n_purchase_extraue").val("0"),$("#pc_amount_purchases_xeu").val("0"))},t.prototype.showHideQuestionSummary=function(){var i=!1,u=!1,r=$("input[name='"+this.Under18+"']:checked",this.component),n,t;r.val()&&r.val()==="Yes"?($("#pc_online_Yes_but_not_only_online").hide(),$("label[for='pc_online_Yes_only_online']").hide(),$("#pc_online_Yes_only_online",this.component).prop("checked",!1),$("label[for='pc_online_Yes_but_not_only_online']").text("Sì"),i=!0):($("#pc_online_Yes_but_not_only_online").show(),$("label[for='pc_online_Yes_only_online']").show(),$("label[for='pc_online_Yes_but_not_only_online']").text("Sì online e fisico"));n=$("input[name='"+this.UseOnlyOnline+"']:checked",this.component);t=$("input[name='"+this.UseForeign+"']:checked",this.component);t.val()&&t.val()==="No"?($("#ItPrepaidCards_InfoUE_ExtraUE").hide(),$("#ItPrepaidCards_Info_ExtraUE_Online").hide(),this.DefaultValuePrepaidCards("1")):(u=!0,$("#ItPrepaidCards_Info_ExtraUE_Online").show(),n.val()==="Yes_only_online"?($("label[for='pc_n_purchase_extraue']").text("N. pagamenti con carta sui siti esteri in valuta extraeuro"),$("label[for='pc_amount_purchases_xeu']").text("Importo medio di un pagamento su sito in valuta extraeuro"),$("#ItPrepaidCards_InfoUE_ExtraUE").hide(),this.DefaultValuePrepaidCards("2")):($("label[for='pc_n_purchase_extraue']").text("N.pagamenti con carta all’estero in area extraeuro"),$("label[for='pc_amount_purchases_xeu']").text("Importo medio di un pagamento in area extraeuro"),$("#ItPrepaidCards_InfoUE_ExtraUE").show()));i||n.val()!=="Yes_only_online"?$("#ItPrepaidCards_InfoNoOnlyOnline").show():($("#ItPrepaidCards_InfoNoOnlyOnline").hide(),this.DefaultValuePrepaidCards("3"))},t.prototype.DefaultValuePrepaidCards=function(n){n=="1"&&($("#pc_n_eu_atm_withdrawals").val("0"),$("#pc_n_xeu_atm_withdrawalsb").val("0"),$("#pc_n_purchase_extraue").val("0"),$("#pc_amount_purchases_xeu").val("0"));n=="2"&&($("#pc_n_eu_atm_withdrawals").val("0"),$("#pc_n_xeu_atm_withdrawalsb").val("0"));n=="3"&&($("#pc_n_it_atn_withdrawals_bank").val("0"),$("#pc_n_it_atmwithdrawalsob").val("0"),$("#pc_n_gasoline_purchased").val("0"))},t}(n.SppServiceSelectorBase.BaseQuestions);t.PrepaidCardsQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppSSFItPrepaidCards||(n.SppSSFItPrepaidCards={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(r){function u(n){r.call(this,n);this.PrepaidCardsQuestions=new i.QuestionSections.PrepaidCardsQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(u,r),u.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.PrepaidCardsQuestions.showHideSummaryQuestions(n)},u.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},u.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},u.prototype.doSubmit=function(i){this.actuallySelectAllSelectedContracts();t.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=i}})},u}(t.SppServiceSelectorBase.SppBaseSummary);i.SppPrepaidCardsItSummary=r})(i=t.SppSSFItPrepaidCards||(t.SppSSFItPrepaidCards={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){n.widget("SelfManagement.managedButton",{options:{validation:!1},_create:function(){this.$errorDiv=n('<div class="form__error-summary padding-small"><\/div>');this.BindEvents()},_destroy:function(){},_setOption:function(){},BindEvents:function(){var t=this;this.element.click(function(i){return n(this).hasClass("is-disabled")?(i.preventDefault(),!1):t.options.validation&&!n(this).closest("form").valid()?!0:(t._ShowSpinnerAndDisableButton(),!0)})},ShowErrorMessage:function(n){this._RemoveSpinner();this.$errorDiv.html("<p>"+n+"<\/p>");this.element.before(this.$errorDiv)},ShowErrorMessagePlus:function(n,t,i){this._RemoveSpinner();this.$errorDiv.html("<p>"+n.replace("{0}",'<a href="'+i+'">'+t+"<\/a>")+"<\/p>");this.element.before(this.$errorDiv)},ShowSuccess:function(){this._RemoveSpinner();this.RemoveErrorMessage()},RemoveErrorMessage:function(){this.$errorDiv.remove()},_ShowSpinnerAndDisableButton:function(){this.RemoveErrorMessage();this.element.addClass("btn--waiting is-disabled")},_RemoveSpinner:function(){this.element.removeClass("btn--waiting is-disabled")}})}(jQuery),function(n){n.widget("RcaInsurance.PlateStep",{options:{genericErrorMessage:""},_create:function(){this.BindEvents();this.ParseForm()},_destroy:function(){},_setOption:function(){},BindEvents:function(){n("#btnSubmit").managedButton({validation:!0})},ParseForm:function(){n("#plateStepComponent").removeData("unobtrusiveValidation").removeData("validator");n.validator.unobtrusive.parse(document);n.each(n("form"),function(t,i){i.id=="CarInsurancePlateStep1"&&(n.data(i,"validator").settings.ignore=":hidden:not(.validable-hidden)")})},HandleResult:function(t){n.publish("spinner.close",[n("body")]);t.action=="redirect"?window.location.href=t.nextStep:t.action=="error"?n("#btnSubmit").managedButton("ShowErrorMessage",t.errorMessage):n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genericErrorMessage)},OnError:function(){n.publish("spinner.close",[n("body")]);n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genericErrorMessage)}})}(jQuery),function(n){n.widget("RcaInsurance.FinalizedQuotations",{options:{genericErrorMessage:"",pageSize:0,quotations:0},CurrentPage:1,_create:function(){this.BindEvents();this.ShowPage(1,this.options.pageSize);this.CurrentPage*this.options.pageSize>=this.options.quotations&&n("#quotationsWithError").show()},_destroy:function(){},_setOption:function(){},BindEvents:function(){var t=this;n("#quote-sort").on("change",{CompareQuality:t.CompareQuality,ComparePrice:t.ComparePrice},t.Sort);n(".previous-page").on("click",{Widget:t,ShowPage:t.ShowPage,PageSize:t.options.pageSize,Quotations:t.options.quotations},t.ShowPreviousPage);n(".next-page").on("click",{Widget:t,ShowPage:t.ShowPage,PageSize:t.options.pageSize,Quotations:t.options.quotations},t.ShowNextPage);n(".pagination-element").on("click",{Widget:t,ShowPage:t.ShowPage,PageSize:t.options.pageSize,Quotations:t.options.quotations},t.ShowPageByNumer)},Sort:function(t){var i=n(".js-quote").get(),r;for(n("#quote-sort").val()==="quality"?i.sort(t.data.CompareQuality):n("#quote-sort").val()==="price"&&i.sort(t.data.ComparePrice),r=0;r<i.length;r++)i[r].parentNode.appendChild(i[r]);n(n(".pagination-element").get(0)).click()},CompareQuality:function(t,i){var r=parseInt(n(t).data("quality")),u=parseInt(n(i).data("quality"));return r===u?0:r<u?1:-1},ComparePrice:function(t,i){var r=parseFloat(n(t).data("price")),u=parseFloat(n(i).data("price"));return r===u?0:r<u?-1:1},ShowPreviousPage:function(t){t.data.ShowPage(parseInt(t.data.Widget.CurrentPage)-1,t.data.PageSize);t.data.Widget.CurrentPage=parseInt(t.data.Widget.CurrentPage)-1;t.data.Widget.CurrentPage===1&&n(".previous-page-li").hide();n("#quotationsWithError").hide();n(".next-page-li").show();n(".pagination__item").removeClass("pagination__item--current");n(n(".pagination__item").get(parseInt(t.data.Widget.CurrentPage)-1)).addClass("pagination__item--current")},ShowNextPage:function(t){t.data.ShowPage(parseInt(t.data.Widget.CurrentPage)+1,t.data.PageSize);t.data.Widget.CurrentPage=parseInt(t.data.Widget.CurrentPage)+1;t.data.Widget.CurrentPage*t.data.PageSize>=t.data.Quotations&&(n("#quotationsWithError").show(),n(".next-page-li").hide());n(".previous-page-li").show();n(".pagination__item").removeClass("pagination__item--current");n(n(".pagination__item").get(parseInt(t.data.Widget.CurrentPage)-1)).addClass("pagination__item--current")},ShowPageByNumer:function(t){var i=n(t.target).data("page");t.data.ShowPage(parseInt(i),t.data.PageSize);t.data.Widget.CurrentPage=i;i===1?n(".previous-page-li").hide():n(".previous-page-li").show();t.data.Widget.CurrentPage*t.data.PageSize>=t.data.Quotations?(n(".next-page-li").hide(),n("#quotationsWithError").show()):(n(".next-page-li").show(),n("#quotationsWithError").hide());n(".pagination__item").removeClass("pagination__item--current");n(t.target).parent().addClass("pagination__item--current")},ShowPage:function(t,i){var r=n(".js-quote").get();n.each(r,function(t,i){n(i).hide()});r=r.slice((t-1)*i,t*i);n.each(r,function(t,i){n(i).show()})}})}(jQuery),function(n){function t(n){return{restrict:"A",link:function(t){t.$last===!0&&n(function(){t.$emit("ngRepeatFinished")})}}}var i=window.angular.module("rcaApp",["ngSanitize"]);i.controller("Quotations",["$scope","$http","$attrs","$timeout","$sce",function(t,i,r,u,f){var e,o;for(t.pageId=r.pageId,t.genericError=r.genericError,t.pageSize=r.pageSize,t.guaranteesNumber=r.guarantees,t.LoadingState=!0,t.Timespan=r.timespan,t.Timeout=r.timeout,t.Delay=r.delay,t.MinimumResults=r.minresults,t.StartDate=new Date,n.publish("spinner.open",[n("#filterPanel")]),t.pagedQuotations=[],t.quotationsWithError=[],t.Guarantees=[],e=0;e<t.guaranteesNumber;e++)o={Selected:"false"},t.Guarantees.push(o);t.quotations=[];t.currentPage=1;t.QuotationsFound=0;t.MaxQuotations=null;t.ProgressPercentage=0;t.ReceivedQuotations=null;t.sortCriteria="price";t.quoteRequest={method:"POST",url:"/ServiceSelectorsAPI/CarInsuranceQuotations/GetQuotes/"+t.pageId};t.filterRequest={method:"POST",url:"/ServiceSelectorsAPI/CarInsuranceQuotations/Filter/"+t.pageId};t.RequestTimeout=!1;t.SessionExpired=!1;t.ShowGenericError=!1;t.getQuotes=function(){t.RequestTimeout=!1;i(t.quoteRequest).then(t.updateQuotations,t.serviceError)};t.updateQuotations=function(i){if(i.data===undefined||i.data==null){n.publish("spinner.close",[n("#filterPanel")]);t.LoadingState=!1;t.ShowGenericError=!0;return}if(i.data.Error){n.publish("spinner.close",[n("#filterPanel")]);t.LoadingState=!1;t.ShowGenericError=!0;return}console.log(i.data);t.quotations=i.data.Quotations;t.quotationsWithError=i.data.QuotationsWithError;t.QuotationsFound=i.data.DisplayableQuotations;t.MaxQuotations=i.data.MaxQuotations;t.ReceivedQuotations=i.data.ReceivedQuotations;t.pagedQuotations=t.pageQuotations(t.quotations,t.pageSize,t.currentPage);t.ProgressPercentage=i.data.MaxQuotations===0?0:Math.round(t.ReceivedQuotations/t.MaxQuotations*100);i.data.IsComplete?(console.log("Date diff:"+(new Date-t.StartDate)),console.log(new Date),t.StartDate=new Date,n.publish("spinner.close",[n("#filterPanel")]),t.LoadingState=!1):new Date-t.StartDate<=t.Timeout*1e3?setTimeout(t.getQuotes,t.Timespan*1e3):(n.publish("spinner.close",[n("#filterPanel")]),t.LoadingState=!1,t.RequestTimeout=!0,t.StartDate=new Date)};t.serviceError=function(i){console.log(i);n.publish("spinner.close",[n("#filterPanel")]);t.ShowGenericError=!0};t.applyFilterError=function(i){console.log(i);t.LoadingState=!1;n.publish("spinner.close",[n("#filterPanel")]);i==="SessionExpired"?t.SessionExpired=!0:t.ShowGenericError=!0};t.pages=function(n,t){for(var r=[],u=Math.ceil(n.length/t),i=1;i<=u;i++)r.push(i);return r};t.pageQuotations=function(n,t,i){var r=Math.ceil(n.length/t);return n.length===0||r<i?[]:r===i?n.slice(t*(i-1)):n.slice(t*(i-1),t*(i-1)+parseInt(t))};t.switchPage=function(n){t.currentPage=n};t.sortQuotations=function(i){i==="quality"&&t.quotations.sort(t.dynamicSort("-Quality"));i==="price"&&t.quotations.sort(t.dynamicSort("Price"));t.pagedQuotations=t.pageQuotations(t.quotations,t.pageSize,t.currentPage);n(".responsive-image-angular").responsive_image()};t.dynamicSort=function(n){var t=1;return n[0]==="-"&&(t=-1,n=n.substr(1)),function(i,r){var u=parseFloat(i[n])<parseFloat(r[n])?-1:parseFloat(i[n])>parseFloat(r[n])?1:0;return u*t}};t.dynamicSortMultiple=function(){var n=arguments;return function(t,i){for(var r=0,u=0,f=n.length;u===0&&r<f;)u=dynamicSort(n[r])(t,i),r++;return u}};t.logAndReturn=function(n){return console.log(n),n};t.$watch("currentPage",function(){t.pagedQuotations=t.pageQuotations(t.quotations,t.pageSize,t.currentPage)});t.resetFilters=function(){n(".guarantee-checkbox:enabled:checked").prop("checked",!1)};t.applyFilters=function(){t.ShowGenericError=!1;t.LoadingState=!0;n.publish("spinner.open",[n("#filterPanel")]);var r=[];return t.StartDate=new Date,n(".guarantee-checkbox:enabled:checked").each(function(){r.push(n(this).data("id"))}),t.filterRequest.data=r,i(t.filterRequest).then(function(n){n.data!=undefined&&n.data.Error===!1?(setTimeout(t.getQuotes,t.Delay*1e3),t.currentPage=1):t.applyFilterError(n.data.ErrorMessage)},t.applyFilterError),!1};t.trustHtml=function(n){return f.trustAsHtml(n)};setTimeout(t.getQuotes,t.Delay*1e3);t.$on("ngRepeatFinished",function(){n(".js-popup").modal();n(".angular-responsive-image").responsive_image()})}]);t.$inject=["$timeout"];i.directive("onFinishRenderQuotations",t)}(jQuery),function(n){n.widget("RcaInsurance.InsuranceDataStep",{options:{genricErrorMessage:"",pageId:"",errorSessionExpired:"Sessione scaduta. {0}",errorSessionExpiredLinkTitle:"Clicca qui per iniziare un nuovo preventivo."},_create:function(){this.BindEvents()},_destroy:function(){},_setOption:function(){},_hideShowRiskCertificateFields:function(t){var r=this,i="";t.resultMessage!=null&&(i=new Date(t.resultMessage.RiskCertificateExpiryDate.match(/\d+/)[0]*1).toLocaleDateString("it-IT",{day:"2-digit",month:"2-digit",year:"numeric"}).split(" ").join("/"));t.isMine?t.resultMessage!=null?(r.UpdateYears(i,n("select[class*='jq_updateYears']").first().children().eq(1).text()),n("#CompanyIdBersaniMineSelected").val(t.resultMessage.CompanyId),n("#BersaniMineCompanyNamePrefilled").val(t.resultMessage.CompanyName),n("#BersaniMineCompanyNameHidden").val(t.resultMessage.CompanyName),n("#BersaniMineCompanyIdPrefilled").val(t.resultMessage.CompanyId),n("#CompanyIdBersaniMineSelected").val(t.resultMessage.CompanyId).trigger("change"),n("#UniversalClassNextSelected").val(t.resultMessage.UniversalClassNext).trigger("change"),parseInt(t.resultMessage.UniversalClassNext)!=1&&(parseInt(t.resultMessage.UniversalClassNext)<18?n("#UniversalClassPreviousSelected").val(parseInt(t.resultMessage.UniversalClassNext)+1).trigger("change"):n("#UniversalClassPreviousSelected").val(18).trigger("change")),n("#RiskCertificateExpiryDate").val(i),n("#BersaniMineCompanyNameDiv").hide(),n("#BersaniMineCompanyNamePrefilledDiv").show(),n("#riskCertificateDiv").show()):(n('#CompanyIdBersaniMineSelected option[value=""]').attr("selected","selected"),n("#BersaniMineCompanyNameDiv").show(),n("#BersaniMineCUNextPrefilledDiv").hide(),n("#BersaniMineCompanyNamePrefilledDiv").hide(),n("#riskCertificateDiv").show()):t.resultMessage!=null?(r.UpdateYears(i,n("select[class*='jq_updateYears']").first().children().eq(1).text()),n('#CompanyIdBersaniFamilySelected option[value="'+t.resultMessage.CompanyId+'"]').attr("selected","selected"),n("#BersaniFamilyCompanyNamePrefilled").val(t.resultMessage.CompanyName),n("#BersaniFamilyCompanyNameHidden").val(t.resultMessage.CompanyName),n("#BersaniFamilyCompanyIdPrefilled").val(t.resultMessage.CompanyId),n("#UniversalClassNextSelected").val(t.resultMessage.UniversalClassNext),parseInt(t.resultMessage.UniversalClassNext)!=1&&(parseInt(t.resultMessage.UniversalClassNext)<18?n("#UniversalClassPreviousSelected").val(parseInt(t.resultMessage.UniversalClassNext)+1):n("#UniversalClassPreviousSelected").val(18)),n("#RiskCertificateExpiryDate").val(i),n("#BersaniFamilyCompanyNameDiv").hide(),n("#BersaniFamilyCompanyNamePrefilledDiv").show(),n("#riskCertificateDiv").show()):(n('#CompanyIdBersaniFamilySelected option[value=""]').attr("selected","selected"),n("#BersaniFamilyCompanyNameDiv").show(),n("#BersaniFamilyCUNextPrefilledDiv").hide(),n("#BersaniFamilyCompanyNamePrefilledDiv").hide(),n("#riskCertificateDiv").show())},BindEvents:function(){var t=this;n("#btnSubmit").managedButton({validation:!0});n(".jq_hasPlaceholderInSelection").find('option[value=""]').attr("disabled","disabled");n("#BersaniMinePlate").change(function(){t.GetInsuranceData(n(this).val(),null)});n("#BersaniFamilyPlate").change(function(){t.GetInsuranceData(n(this).val(),n("#BersaniFamilyDoB").val())});n("#RiskCertificateExpiryDate").change(function(){t.UpdateYears(n(this).val(),n("select[class*='jq_updateYears']").first().children().eq(1).text())});n("input:radio[name=AlreadyInsured]").click(function(){n("#riskCertificateDiv").hide();var t=n(this).val();(t==1&&n("#BersaniMinePlate").val()!=""||t==2&&n("#BersaniFamilyPlate").val()!="")&&n("#riskCertificateDiv").show()});n("#ff-risk4").change(function(){n("#IncidentPrimaryGuiltCount").val(n(this).val())});n("#ff-accident-1").click(function(){n(this).is(":checked")?n("#IncidentPrimaryGuiltCount").val()=="0"&&n("#IncidentPrimaryGuiltCount").val("1"):n("#IncidentPrimaryGuiltCount").val("0")})},RepopulateForm:function(t){var u=this,i,r;if(t!=null&&(i=JSON.parse(t),i.alreadyInsured!=null&&(n("#rbAlreadyInsured"+i.alreadyInsured).attr("checked",!0),n(".js-filtered-result").find('[data-filter="ff-cu'+i.alreadyInsured+'"]').removeClass("mfp-hide")),i.PaymentLimitIdSelected!=null&&n("#PaymentLimitIdSelected").val(i.PaymentLimitIdSelected),i.OriginSelected!=null&&n("#OriginSelected").val(i.OriginSelected),i.UniversalClassPreviousSelected!=null&&n("#UniversalClassPreviousSelected").val(i.UniversalClassPreviousSelected),i.YearsInFirstClassSelected!=null&&(n("#YearsInFirstClassSelected").val(i.YearsInFirstClassSelected),n("#cu-classe1").show()),i.UniversalClassNextSelected!=null&&n("#UniversalClassNextSelected").val(i.UniversalClassNextSelected),i.CompanyIdSelected!=null&&n("#CompanyIdSelected").val(i.CompanyIdSelected),i.CompanyIdBersaniMineSelected!=null&&(n("#CompanyIdBersaniMineSelected").val(i.CompanyIdBersaniMineSelected),n("#riskCertificateDiv").show()),i.BersaniMineCompanyIdPrefilled!=null&&(n("#BersaniMineCompanyIdPrefilled").val(i.BersaniMineCompanyIdPrefilled),n("#BersaniMineCompanyNamePrefilled").val(i.BersaniMineCompanyNameHidden),n("#BersaniMineCompanyNameHidden").val(i.BersaniMineCompanyNameHidden),n("#CompanyIdBersaniMineSelected").val(i.CompanyIdBersaniMineSelected),n("#BersaniMineCompanyNameDiv").hide(),n("#BersaniMineCompanyNamePrefilledDiv").show(),n("#universalClassNextPrefilledDiv").hide(),n("#riskCertificateDiv").show()),i.NotInsuredYear0!=null?(n("#ff-car25").attr("checked",!0),n("input:radio[name=insurance]").trigger("click"),i.NotInsuredYear0.toLowerCase=="true"&&n("#NotInsuredYear0").trigger("click"),i.NotInsuredYear1.toLowerCase=="true"&&n("#NotInsuredYear1").trigger("click"),i.NotInsuredYear2.toLowerCase=="true"&&n("#NotInsuredYear2").trigger("click"),i.NotInsuredYear3.toLowerCase=="true"&&n("#NotInsuredYear3").trigger("click"),i.NotInsuredYear4.toLowerCase=="true"&&n("#NotInsuredYear4").trigger("click"),i.NotInsuredYear5.toLowerCase=="true"&&n("#NotInsuredYear5").trigger("click")):n("#ff-car24").attr("checked",!0),i.CompanyIdBersaniFamilySelected!=null&&(n("#CompanyIdBersaniFamilySelected").val(i.CompanyIdBersaniFamilySelected),n("#riskCertificateDiv").show()),i.BersaniFamilyBirthPlaceIdIdSelected!=null&&n("#BersaniFamilyBirthPlaceIdIdSelected").val(i.BersaniFamilyBirthPlaceIdIdSelected),i.BersaniFamilyCompanyIdPrefilled!=null&&(n("#BersaniFamilyCompanyIdPrefilled").val(i.BersaniFamilyCompanyIdPrefilled),n("#BersaniFamilyCompanyNamePrefilled").val(i.BersaniFamilyCompanyNameHidden),n("#BersaniFamilyCompanyNameHidden").val(i.BersaniFamilyCompanyNameHidden),n("#CompanyIdBersaniFamilySelected").val(i.CompanyIdBersaniFamilySelected),i.BersaniFamilyCompanyNameHidden>0&&(n("#BersaniFamilyCompanyNameDiv").hide(),n("#BersaniFamilyCompanyNamePrefilledDiv").show()),n("#universalClassNextPrefilledDiv").hide(),n("#riskCertificateDiv").show()),i.IncidentPrimaryGuiltCount!=null))for(n("#ff-accident-1").trigger("click"),n("#ff-risk4").val(i.IncidentPrimaryGuiltCount).trigger("change"),r=1;r<=parseInt(i.IncidentPrimaryGuiltCount);r++)n("#IncidentPrimaryGuiltYear"+r+"Selected").val(i["IncidentPrimaryGuiltYear"+r+"Selected"]).trigger("change")},UpdateYears:function(t,i){var u=this,r;t!==undefined&&t!=null&&t!==""&&(n.publish("spinner.open",[n("body")]),r="/ServiceSelectorsAPI/CarInsuranceInsuranceDataStep/UpdateIncidentYears/"+this.options.pageId+"?riskCertificateExpiryDate="+t+"&firstYearCurrent="+i,n.ajax({type:"POST",url:r,contentType:!1,processData:!1,success:function(t){if(n.publish("spinner.close",[n("body")]),t.needUpdate){var i=[t.year,t.year-1,t.year-2,t.year-3,t.year-4,t.year-5];n("select[class*='jq_updateYears']").empty().append("<option disabled='disabled' value=''>seleziona<\/option>");n.each(i,function(t,i){n("select[class*='jq_updateYears']").append(n("<option/>",{value:i,text:i}));n(".jq_updateYears_"+t).html(i)})}},error:function(){}}))},GetInsuranceData:function(t,i){var u=this,r;t!==undefined&&t!=null&&t!==""&&(n.publish("spinner.open",[n("body")]),r="/ServiceSelectorsAPI/CarInsuranceInsuranceDataStep/GetInsuranceDataFromPlate/"+this.options.pageId+"?plateNumber="+t+"&dateOfBirth="+i,n.ajax({type:"POST",url:r,contentType:!1,processData:!1,success:function(t){n.publish("spinner.close",[n("body")]);u._hideShowRiskCertificateFields(t)},error:function(){}}))},HandleResult:function(t){t.action=="redirect"?window.location.href=t.nextStep:t.action=="session-expired"?n("#btnSubmit").managedButton("ShowErrorMessagePlus",this.options.errorSessionExpired,this.options.errorSessionExpiredLinkTitle,t.nextStep):t.action=="error"?n("#btnSubmit").managedButton("ShowErrorMessage",t.errorMessage):n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genricErrorMessage)},OnError:function(){n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genricErrorMessage)}})}(jQuery),function(n){n.widget("RcaInsurance.CarDataStep",{options:{genricErrorMessage:"",pageId:"",isMocked:!1,isVehicleDataPrefilled:!1,msgInsertRegDateFirst:"Inserire prima la data di immatricolazione",msgInsertVehicleMake:"Marca...",msgInsertVehicleMakeFirst:"Seleziona prima la marca",msgInsertVehicleModel:"Modello...",msgInsertVehicleModelFirst:"Seleziona prima il modello",msgInsertVehicleModelVersion:"Allestimento...",msgNoResultFound:"NESSUN RISULTATO",errorSessionExpired:"Sessione scaduta. {0}",errorSessionExpiredLinkTitle:"Clicca qui per iniziare un nuovo preventivo."},_create:function(){this.BindEvents()},_destroy:function(){},_setOption:function(){},BindEvents:function(){var t=this;n("#btnSubmit").managedButton({validation:!0});n(".jq_hasPlaceholderInSelection").find('option[value=""]').attr("disabled","disabled");n("#RegistrationDateText").change(function(){t.RegistrationDateChanged()});n("#VehicleMakeSelected").change(function(){t.VehicleMakeSelected(n(this).val())});n("#VehicleModelSelected").change(function(){t.VehicleModelSelected(n(this).val())});this._CheckRegistrationDateAndResetDDLs()},RepopulateForm:function(t){var r=this,i;t!=null&&(i=JSON.parse(t),i.RegistrationDateText!=null&&n("#RegistrationDateText").val(i.RegistrationDateText),i.IsVehicleDataAvailable.toLowerCase()=="false"?i.VehicleMakeSelected!=null&&(n("#VehicleMakeSelected").val(i.VehicleMakeSelected).trigger("change"),r.VehicleMakeSelected(i.VehicleMakeSelected,i)):n("#VehicleModelVersionSelected").val(i.VehicleModelVersionSelected).trigger("change"),i.PurchaseDateText!=null&&n("#PurchaseDateText").val(i.PurchaseDateText),i.AlarmTypeSelected!=null&&n("#AlarmTypeSelected").val(i.AlarmTypeSelected),i.HasLpg!=null&&n("#HasLpg").val(i.HasLpg),i.HasTow!=null&&n("#HasTow").val(i.HasTow),i.HasTowBar!=null&&n("#HasTowBar").val(i.HasTowBar),i.KmPerYear!=null&&n("#KmPerYear").val(i.KmPerYear),i.ParkingTypeIdSelected!=null&&n("#ParkingTypeIdSelected").val(i.ParkingTypeIdSelected),i.TypicalUseIdSelected!=null&&n("#TypicalUseIdSelected").val(i.TypicalUseIdSelected),i.NumberVehiclesFamily!=null&&n("#NumberVehiclesFamily").val(i.NumberVehiclesFamily),i.VehicleValue!=null&&n("#VehicleValue").val(i.VehicleValue),i.IsAlreadyInsured!=null&&n("#IsAlreadyInsured").val(i.IsAlreadyInsured))},HandleResult:function(t){t.action=="redirect"?window.location.href=t.nextStep:t.action=="session-expired"?n("#btnSubmit").managedButton("ShowErrorMessagePlus",this.options.errorSessionExpired,this.options.errorSessionExpiredLinkTitle,t.nextStep):t.action=="error"?n("#btnSubmit").managedButton("ShowErrorMessage",t.errorMessage):n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genericErrorMessage)},OnError:function(){n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genricErrorMessage)},_setDDLMessage:function(t,i){n(t)[0].selectedIndex=0;n(t)[0].options[0].text=i;n(t).prev("span").text(i)},_CheckRegistrationDateAndResetDDLs:function(){this.options.isVehicleDataPrefilled||(n("#RegistrationDateText").val().length===0?(this._setDDLMessage("#VehicleMakeSelected",this.options.msgInsertRegDateFirst),n("#VehicleMakeSelected").attr("disabled",!0),this._clearDropDownList("#VehicleModelSelected"),this._clearDropDownList("#VehicleModelVersionSelected"),this._setDDLMessage("#VehicleModelSelected",this.options.msgInsertRegDateFirst),this._setDDLMessage("#VehicleModelVersionSelected",this.options.msgInsertRegDateFirst)):(n("#VehicleMakeSelected").attr("disabled",!1),n("#VehicleMakeSelected").parent().removeClass("disabled"),this._setDDLMessage("#VehicleMakeSelected",this.options.msgInsertVehicleMake),this._clearDropDownList("#VehicleModelSelected"),this._clearDropDownList("#VehicleModelVersionSelected"),this._setDDLMessage("#VehicleModelSelected",this.options.msgInsertVehicleMakeFirst),this._setDDLMessage("#VehicleModelVersionSelected",this.options.msgInsertVehicleMakeFirst)))},RegistrationDateChanged:function(){this._CheckRegistrationDateAndResetDDLs()},VehicleMakeSelected:function(t,i){var r=this,u,f;if(r._clearDropDownList("#VehicleModelSelected"),r._clearDropDownList("#VehicleModelVersionSelected"),t===undefined||t==null||t===""){r._CheckRegistrationDateAndResetDDLs();return}u=r.options.isMocked?"&mocked=1":"";f="/ServiceSelectorsAPI/CarInsuranceCarDataStep/GetVehicleModels/"+this.options.pageId+"?vehicleMakeId="+t+u+"&firstRegistrationDate="+n("#RegistrationDateText").val();n.ajax({type:"POST",url:f,contentType:!1,processData:!1,success:function(t){r._updateDropDownList("#VehicleModelSelected",t.vehicleModels);r._setDDLMessage("#VehicleModelSelected",r.options.msgInsertVehicleModel);r._setDDLMessage("#VehicleModelVersionSelected",r.options.msgInsertVehicleModelFirst);i!=null&&i.VehicleModelSelected!=null&&(console.log("selecting model"),n("#VehicleModelSelected").val(i.VehicleModelSelected).trigger("change"),r.VehicleModelSelected(i.VehicleModelSelected,i))},error:function(){}})},VehicleModelSelected:function(t,i){var r=this,u=n("#VehicleMakeSelected").val(),f,e;if(r._clearDropDownList("#VehicleModelVersionSelected"),t===undefined||t==null||t===""||u===undefined||u==null||u===""){r._setDDLMessage("#VehicleModelVersionSelected",r.options.msgInsertVehicleModelFirst);return}f=r.options.isMocked?"&mocked=1":"";e="/ServiceSelectorsAPI/CarInsuranceCarDataStep/GetVehicleModelVersions/"+this.options.pageId+"?vehicleMakeId="+u+"&vehicleModelId="+t+f+"&firstRegistrationDate="+n("#RegistrationDateText").val();n.ajax({type:"POST",url:e,contentType:!1,processData:!1,success:function(t){r._updateDropDownList("#VehicleModelVersionSelected",t.vehicleVersions);r._setDDLMessage("#VehicleModelVersionSelected",r.options.msgInsertVehicleModelVersion);i!=null&&i.VehicleModelVersionSelected!=null&&n("#VehicleModelVersionSelected").val(i.VehicleModelVersionSelected).trigger("change")},error:function(){}})},_clearDropDownList:function(t){n(t).children().remove();n(t).empty();n(t).append(n("<option><\/option>").attr("value","").text(""));n(t).prev("span").text("")},_updateDropDownList:function(t,i){if(i.length==0){console.log("zero");n(t).append(n("<option><\/option>").attr("value","").text(this.options.msgNoResultFound));return}console.log("adding");n(t).find('option[value=""]')==null&&n(t).append(n("<option><\/option>").attr("value","").text(""));n.each(i,function(){n(t).append(n("<option><\/option>").attr("value",this.Id).text(this.Name))});console.log("end adding")}})}(jQuery),function(n){n.widget("RcaInsurance.PersonalDataStep",{options:{genricErrorMessage:"",pageId:"",isMocked:!1,errorSessionExpired:"Sessione scaduta. {0}",errorSessionExpiredLinkTitle:"Clicca qui per iniziare un nuovo preventivo.",noResults:"nessun risultato trovato",extra_multiple:"molti risultati trovati, continua a digitare",extra_single:"seleziona l'elemento trovato"},_create:function(){this.BindEvents()},_destroy:function(){},_setOption:function(){},BindEvents:function(){var t=this,i=this.options.pageId;n("#btnSubmit").managedButton({validation:!0});this._InitDisplayConditional();n("#autosuggest-birthPlace").autosuggest({baseUrl:"/ServiceSelectorsAPI/CarInsurancePersonalDataStep/AutoSuggestBirthPlaces/"+i+"/?search=",messages:{noResults:this.options.noResults},templates:{extra_single:this.options.extra_single,extra_multiple:this.options.extra_multiple}});n("#autosuggest-nationality").autosuggest({baseUrl:"/ServiceSelectorsAPI/CarInsurancePersonalDataStep/AutoSuggestNationalityPlaces/"+i+"/?search=",messages:{noResults:this.options.noResults},templates:{extra_single:this.options.extra_single,extra_multiple:this.options.extra_multiple}});n("#autosuggest-address").autosuggest({baseUrl:"/ServiceSelectorsAPI/CarInsurancePersonalDataStep/AutoSuggestAddressPlaces/"+i+"/?search=",messages:{noResults:this.options.noResults},templates:{extra_single:this.options.extra_single,extra_multiple:this.options.extra_multiple}});n(document).on("change","#Person_HomePlaceName",function(){});n(document).on("change","#Person_NationalityName",function(){});n(".jq_hasPlaceholderInSelection").find('option[value=""]').attr("disabled","disabled");t._on("input[name=IsContractorOwner]:radio",{change:t.GenerateTaxCode});t._on("input[name=Person\\.Gender]:radio",{change:t.GenerateTaxCode});t._on("#Person_BirthPlaceIdSelected",{change:t.GenerateTaxCode});t._on("#Person_FirstName",{blur:t.GenerateTaxCode});t._on("#Person_LastName",{blur:t.GenerateTaxCode});t._on("#Person_DateOfBirthText",{blur:t.GenerateTaxCode});t._on("#Person_BirthPlaceName",{blur:t.UpdateBirthPlaceId});t._on("#Person_NationalityName",{blur:t.UpdateNationalityId});t._on("#Person_HomePlaceName",{blur:t.UpdateHomePlaceId})},UpdateBirthPlaceId:function(){var t=this.options.pageId,i=n("#Person_BirthPlaceName").val();n.ajax({url:"/ServiceSelectorsAPI/CarInsurancePersonalDataStep/GetIdOfPlace/"+t,method:"POST",data:{placeName:i,placeType:"birth"}}).done(function(t){t.hasError?n("#Person_BirthPlaceIdSelected").val("").change():n("#Person_BirthPlaceIdSelected").val(t.result).change()})},UpdateNationalityId:function(){var t=this.options.pageId,i=n("#Person_NationalityName").val();n.ajax({url:"/ServiceSelectorsAPI/CarInsurancePersonalDataStep/GetIdOfPlace/"+t,method:"POST",data:{placeName:i,placeType:"nationality"}}).done(function(t){t.hasError?n("#Person_NationalityIdSelected").val("").change():n("#Person_NationalityIdSelected").val(t.result).change()})},UpdateHomePlaceId:function(){var t=this.options.pageId,i=n("#Person_HomePlaceName").val();n.ajax({url:"/ServiceSelectorsAPI/CarInsurancePersonalDataStep/GetIdOfPlace/"+t,method:"POST",data:{placeName:i,placeType:"address"}}).done(function(t){t.hasError?n("#Person_HomePlaceIdSelected").val("").change():n("#Person_HomePlaceIdSelected").val(t.result).change()})},GenerateTaxCode:function(){var o=this.options.pageId,i=n("input[name=Person\\.Gender]:radio:checked").val(),t=n("#Person_DateOfBirthText").val(),r=n("#Person_BirthPlaceIdSelected").val(),u=n("#Person_FirstName").val(),f=n("#Person_LastName").val(),e;n("#Person_DateOfBirthPrefilledForOwner").is(":visible")&&(t=n("#Person_DateOfBirthPrefilledForOwner").val());i!=undefined&&i!=""&&t!=undefined&&t!=""&&r!=undefined&&r!=""&&u!=undefined&&u!=""&&f!=undefined&&f!=""?n.ajax({url:"/ServiceSelectorsAPI/CarInsurancePersonalDataStep/GenerateTaxCode/"+o,method:"POST",data:{dateOfBirth:t,firstname:u,lastname:f,gender:i,birthPlaceId:r}}).done(function(t){t.hasError||n("#Person_TaxCode").val(t.taxCode);var i=n("#CarInsurancePersonalDataStep1").validate();i.element("#Person_TaxCode")}):(n("#Person_TaxCode").val(""),e=n("#CarInsurancePersonalDataStep1").validate(),e.element("#Person_TaxCode"))},_InitDisplayConditional:function(){var t=this;n(".js-rb").change(function(){t._resetConditionalFields()});t._resetConditionalFields()},_resetConditionalFields:function(){this._DisplayConditional("#rbIsContractorOwnerYes",".js-iscontractorowner-yes",".js-iscontractorowner-no");this._DisplayConditional("#rbIsContractorOwnerNo",".js-iscontractorowner-no",".js-iscontractorowner-yes");this._DisplayConditional("#rbGenderMale",".js-only-male",".js-only-female");this._DisplayConditional("#rbGenderFemale",".js-only-female",".js-only-male")},_DisplayConditional:function(t,i,r){n(t).is(":checked")&&(n(i).show(),n(r).hide())},HandleResult:function(t){t.action=="redirect"?window.location.href=t.nextStep:t.action=="session-expired"?n("#btnSubmit").managedButton("ShowErrorMessagePlus",this.options.errorSessionExpired,this.options.errorSessionExpiredLinkTitle,t.nextStep):t.action=="error"?n("#btnSubmit").managedButton("ShowErrorMessage",t.errorMessage):n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genericErrorMessage)},OnError:function(){n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genricErrorMessage)}})}(jQuery),function(n){n.widget("RcaInsurance.RecapDataStep",{options:{genricErrorMessage:"",pageId:"",isMocked:!1,errorSessionExpired:"Sessione scaduta. {0}",errorSessionExpiredLinkTitle:"Clicca qui per iniziare un nuovo preventivo."},_create:function(){this.BindEvents()},_destroy:function(){},_setOption:function(){},BindEvents:function(){var t=this;n("#btnSubmit").managedButton({validation:!0})},HandleResult:function(t){t.action=="redirect"?window.location.href=t.nextStep:t.action=="session-expired"?n("#btnSubmit").managedButton("ShowErrorMessagePlus",this.options.errorSessionExpired,this.options.errorSessionExpiredLinkTitle,t.nextStep):t.action=="error"?n("#btnSubmit").managedButton("ShowErrorMessage",t.errorMessage):n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genericErrorMessage)},OnError:function(){n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genricErrorMessage)}})}(jQuery),function(n){n.widget("RcaInsurance.DocumentsAndPayMethods",{options:{genericErrorMessage:""},_create:function(){this.BindEvents();this.ParseForm()},_destroy:function(){},_setOption:function(){},BindEvents:function(){n("#btnSubmit").managedButton({validation:!0})},ParseForm:function(){n("#documentsAndPayMethodsComponent").removeData("unobtrusiveValidation").removeData("validator");n.validator.unobtrusive.parse(document);n.each(n("form"),function(t,i){i.id=="CarInsuranceDocumentsAndPayMethodsForm"&&(n.data(i,"validator").settings.ignore=":hidden:not(.validable-hidden)")})},HandleResult:function(t){t.action=="redirect"?window.location.href=t.nextStep:t.action=="error"?n("#btnSubmit").managedButton("ShowErrorMessage",t.errorMessage):n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genericErrorMessage)},OnError:function(){n("#btnSubmit").managedButton("ShowErrorMessage",this.options.genericErrorMessage)}})}(window.jQuery);__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorPtSavingAccounts||(n.SppServiceSelectorPtSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(i){function r(n,r){i.call(this,n,r);this.savingAccountsQuestions=new t.QuestionSections.SavingAccountsQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(r,i),r.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},r.prototype.bindExtraEvents=function(){var n=this;this.component.find("[data-selector='add-new-contract-button']").on("click",function(){return n.openAddContractModal()})},r.prototype.openAddContractModal=function(){n.Ajax.sendDataToActionAndUpdate("ContractDetails","Details",null,{},null,{onSuccess:function(){return n.SppHelper.openModal("#contract-details-popup")}})},r.prototype.questionsAnsweredLogic=function(){this.savingAccountsQuestions.showOrHideArrowBoxForAllQuestion()},r}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorPtSavingAccounts||(n.SppServiceSelectorPtSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.savingAccountQuestions=["sa_initial_investment","sa_investment_timeframe","sa_retired_person"]}return __extends(t,n),t.prototype.showHideSavingAccountQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){},t}(n.SppServiceSelectorBase.BaseQuestions);t.SavingAccountsQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorPtSavingAccounts||(n.SppServiceSelectorPtSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.savingAccountsQuestions=new t.QuestionSections.SavingAccountsQuestions(this.component);this.savingAccountsQuestions.showHideSavingAccountQuestions();this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses);this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0,this.savingAccountsQuestions.showHideSavingAccountQuestions(n))},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppSavingAccountsPtSummary=i})(t=n.SppServiceSelectorPtSavingAccounts||(n.SppServiceSelectorPtSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"insuranceSection";case"insuranceSection":return $("input[name=ci_driver_insurance_type]:checked",this.element).val()==="first insurance"?"vehicleSection":"currentInsuranceSection";case"currentInsuranceSection":return"vehicleSection";case"vehicleSection":return"driverSection";case"driverSection":return"agreementSection";case"agreementSection":return $("#q_landingpage",this.element).remove(),"thankyou";default:return"insuranceSection"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorPtCarInsuranceBroker||(n.SppServiceSelectorPtCarInsuranceBroker={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var r=History,i=function(i){function r(n,r){i.call(this,n,r);this.carInsuranceBrokerQuestions=new t.QuestionSections.CarInsuranceBrokerQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(r,i),r.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",onStepLoaded:"steploaded",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("insuranceSection"):this.navigator.loadStepFromState(null)},r.prototype.bindExtraEvents=function(){this.component.off("dateChanged","input[name='ci_vehicle_registration_date.Value']").on("dateChanged","input[name='ci_vehicle_registration_date.Value']",t.CarECHelper.updateBrands);this.component.off("change","select[name=ci_vehicle_brand]").on("change","select[name=ci_vehicle_brand]",t.CarECHelper.updateModels);this.component.off("change","select[name=ci_vehicle_model]").on("change","select[name=ci_vehicle_model]",t.CarECHelper.updateVersions);this.component.off("change","[name=com_locationtxt]").on("change","[name=com_locationtxt]",this.getLocation)},r.prototype.questionsAnsweredLogic=function(){this.carInsuranceBrokerQuestions.showHideServiceSelectionQuestions()},r.prototype.getLocation=function(){var t=$("[name = com_locationtxt]").val();t!=null&&t.length>0&&n.Ajax.getDataFromAction("SppServiceSelectorPtCarInsuranceBroker","GetLocationByPtPostalCode",null,{postalCode:t},null,{onSuccess:function(n){$(".locationpttxt").text(n.substring(9));$(".hiddenlocationpt").val(n);$(".hiddenlocationpt").text(n)},onError:function(){return n.Debug.logToConsole("Error")},useWaitPanel:!0})},r}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorPtCarInsuranceBroker||(n.SppServiceSelectorPtCarInsuranceBroker={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideServiceSelectionQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){},t}(n.SppServiceSelectorBase.BaseQuestions);t.CarInsuranceBrokerQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorPtCarInsuranceBroker||(n.SppServiceSelectorPtCarInsuranceBroker={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(r){function u(n){r.call(this,n);this.carInsuranceBrokerQuestions=new i.QuestionSections.CarInsuranceBrokerQuestions(this.component);this.carInsuranceBrokerQuestions.showHideServiceSelectionQuestions(null);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.component.off("blur dateChanged","input[name='ci_vehicle_registration_date.Value']").on("blur dateChanged","input[name='ci_vehicle_registration_date.Value']",i.CarECHelper.updateBrands);this.component.off("change","select[name=ci_vehicle_brand]").on("change","select[name=ci_vehicle_brand]",i.CarECHelper.updateModels);this.component.off("change","select[name=ci_vehicle_model]").on("change","select[name=ci_vehicle_model]",i.CarECHelper.updateVersions);this.component.off("change","[name=com_locationtxt]").on("change","[name=com_locationtxt]",this.getLocation);this.showHideSteps()}return __extends(u,r),u.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);this.showHideSteps();n!=null&&(this.dirtyBit=!0,this.carInsuranceBrokerQuestions.showHideServiceSelectionQuestions(n))},u.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},u.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},u.prototype.doSubmit=function(t){n.ServiceSelector.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=t}})},u.prototype.showHideSteps=function(){this.form.find("input[name=ci_driver_insurance_type]:checked").val()==="transfer"?this.form.find(".s_currentInsuranceSection").show():this.form.find(".s_currentInsuranceSection").hide()},u.prototype.getLocation=function(){var n=$("[name = com_locationtxt]").val();n!=null&&n.length>0&&t.Ajax.getDataFromAction("SppServiceSelectorPtCarInsuranceBroker","GetLocationByPtPostalCode",null,{postalCode:n},null,{onSuccess:function(n){$(".locationpttxt").text(n.substring(9));$(".hiddenlocationpt").val(n);$(".hiddenlocationpt").text(n)},onError:function(){return t.Debug.logToConsole("Error")},useWaitPanel:!0})},u}(t.SppServiceSelectorBase.SppBaseSummary);i.SppCarInsuranceBrokerPtSummary=r})(i=t.SppServiceSelectorPtCarInsuranceBroker||(t.SppServiceSelectorPtCarInsuranceBroker={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(t){var i=function(){function t(){this.nextStep=".next-step";this.step=".step";this.form="#switch-provider-form";this.formStep2="#examination-form";this.wrapper="#s_switch";this.acceptdifferentPriceBtn=".acceptDifferentPrice";this.examinationStep=".examinationStep";this.priceWarningStep=".priceWarningStep";this.requiresExamination="#RequiresExamination";this.selectAutoshop="#ExaminationAutoshop";this.autoshopDetails=".autoshopDetails";this.submitExaminationFormBtn=".submitExaminationForm";this.postalCode="input[name='FormValues.PostalCode']";this.ownerPostalCode="input[name='FormValues.OwnerPostalCode']";this.address="select[name='FormValues.Address']";this.ownerAddress="select[name='FormValues.OwnerAddress']";$(this.form).ssfvalidator({showValidationMessages:!0,showSummary:!0,summarySelector:".val-summary"});$(this.formStep2).ssfvalidator({showValidationMessages:!0,showSummary:!0,summarySelector:".examination-val-summary"});this.bindEvents();this.showHideLogic()}return t.prototype.bindEvents=function(){var n=this;$(this.nextStep).off("click").on("click",function(){n.loadNextStep()});$(this.form+" input[type='radio']").off("change").on("change",function(){n.showHideLogic()});$(this.selectAutoshop).off("change").on("change",function(){n.showAutoshopDetails()});$(this.acceptdifferentPriceBtn).off("click").on("click",function(){n.acceptDifferentPrice()});$(this.submitExaminationFormBtn).off("click").on("click",function(){n.submitStep2()});$(this.postalCode).off("blur").on("blur",function(){n.getOkStreets(n.postalCode,n.address)});$(this.ownerPostalCode).off("blur").on("blur",function(){n.getOkStreets(n.ownerPostalCode,n.ownerAddress)})},t.prototype.loadNextStep=function(){var n=$(this.step+":visible").data("step");switch(n){case 1:$(this.step).hide();$(this.step+"[data-step='2']").show();location.href="#switch-provider-form";break;case 2:this.doSwitch()}},t.prototype.doSwitch=function(){var t=this,i,r;$(".doSwitchBtn").hide();i=$(this.form).ssfvalidator("validate");i?(n.WaitPanel.increment(),r=$(this.form).serialize(),$.post($(this.form).attr("action"),r).done(function(i){$(t.wrapper).html(i.Updates[0].Html);$(t.step+"[data-step='2']").show();$(".doSwitchBtn").show();n.WaitPanel.decrement();location.href="#"}).fail(function(){$(".doSwitchBtn").show();n.WaitPanel.decrement()})):$(".doSwitchBtn").show()},t.prototype.showHideLogic=function(){var t=$("input[name='FormValues.DriverIsOwner']").filter(":checked").val(),n=$("input[name='FormValues.PaymentByDirectDebit']").filter(":checked").val(),i=$("input[name='FormValues.OwnerIsBankAccountHolder']").filter(":checked").val(),r=$("input[name='FormValues.IsTransference']").filter(":checked").val(),u=$("input[name='FormValues.IsLeasing']").filter(":checked").val();t==="False"?$(".ownerQuestion").show():$(".ownerQuestion").hide();n==="True"?$(".directDebitQuestion").show():$(".directDebitQuestion").hide();i==="False"&&n==="True"?$(".bankAccountHolderQuestion").show():$(".bankAccountHolderQuestion").hide();r==="True"?$(".transferenceQuestion").show():$(".transferenceQuestion").hide();u==="True"?$(".leasingQuestion").show():$(".leasingQuestion").hide()},t.prototype.acceptDifferentPrice=function(){$(this.requiresExamination).val()==="True"?($(this.examinationStep).show(),$(this.priceWarningStep).hide()):this.submitStep2()},t.prototype.showAutoshopDetails=function(){$(this.autoshopDetails).hide();$(this.selectAutoshop).val()&&$(this.autoshopDetails+"[data-autoshopid='"+$(this.selectAutoshop).val()+"']").show()},t.prototype.submitStep2=function(){var t=this,i,r;$(this.submitExaminationFormBtn).hide();i=$(this.formStep2).ssfvalidator("validate");i?(n.WaitPanel.increment(),r=$(this.formStep2).serialize(),$.post($(this.formStep2).attr("action"),r).done(function(i){$(t.wrapper).html(i.Updates[0].Html);$(t.submitExaminationFormBtn).show();n.WaitPanel.decrement();location.href="#"}).fail(function(){$(t.submitExaminationFormBtn).show();n.WaitPanel.decrement()})):$(this.submitExaminationFormBtn).show()},t.prototype.getOkStreets=function(t,i){var r=$(t).val();r!=null&&r.length>0&&n.Ajax.getDataFromAction("SppServiceSelectorPtCarInsuranceBroker","GetOkTelesegurosStreets",null,{postalCode:r},null,{onSuccess:function(n){for(var r="",t=0;t<n.length;t++)r+="<option value='"+n[t]+"'>"+n[t]+"<\/option>";$(i).html(r)},onError:function(){return n.Debug.logToConsole("Error")},useWaitPanel:!0})},t}();t.SppCarInsuranceBrokerPtSwitch=i})(t=n.SppServiceSelectorPtCarInsuranceBroker||(n.SppServiceSelectorPtCarInsuranceBroker={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){var t;(function(n){var t;(function(t){var i;(function(t){function i(){console.log("Updating brands");var i=$("select[name=ci_vehicle_category]").children("option:selected").val()===""?null:$("select[name=ci_vehicle_category]").children("option:selected").val(),t=$("input[name='ci_vehicle_registration_date.Value']").val()===""?null:$("input[name='ci_vehicle_registration_date.Value']").val();t!=null&&t.length===10&&(n.WaitPanel.increment(),$.getJSON("/ServiceSelectorsAPI/CarProviderPtCarInsuranceBroker/GetCarBrands",{categoryId:i,buildDate:t},function(t){var i="<option value=''>"+$("#SelectOption").html()+"<\/option>",r=$("select[name=ci_vehicle_brand]").data("previousanswer");$.each(t,function(n){i+="<option value='"+t[n].BrandId+"' "+(r==t[n].BrandId?"selected":"")+">"+t[n].BrandName+"<\/option>"});$("select[name=ci_vehicle_brand]").html(i);$("select[name=ci_vehicle_brand]").data("previousanswer","");$("select[name=ci_vehicle_brand]").trigger("change");n.WaitPanel.decrement()}))}function r(){var t=$("select[name=ci_vehicle_brand]").children("option:selected").val()===""?null:$("select[name=ci_vehicle_brand]").children("option:selected").val(),i=$("input[name='ci_vehicle_registration_date.Value']").val()===""?null:$("input[name='ci_vehicle_registration_date.Value']").val();t?(n.WaitPanel.increment(),console.log("Updating models for brand "+t),$.getJSON("/ServiceSelectorsAPI/CarProviderPtCarInsuranceBroker/GetCarModels",{brandId:t,buildDate:i},function(t){var i="<option value=''>"+$("#SelectOption").html()+"<\/option>",r=$("select[name=ci_vehicle_model]").data("previousanswer");$.each(t,function(n){i+="<option value='"+t[n].ModelId+"' "+(r==t[n].ModelId?"selected":"")+">"+t[n].ModelName+"<\/option>"});$("select[name=ci_vehicle_model]").html(i);$("select[name=ci_vehicle_model]").data("previousanswer","");$("select[name=ci_vehicle_model]").trigger("change");n.WaitPanel.decrement()})):(console.log("Clearing models and versions"),$("select[name=ci_vehicle_model]").html("<option selected=selected value=''>"+$("#SelectBrandFirst").html()+"<\/option>"),$("select[name=ci_vehicle_model]").trigger("change"),$("select[name=ci_vehicle_version]").html("<option selected=selected value=''>"+$("#SelectBrandFirst").html()+"<\/option>"),$("select[name=ci_vehicle_version]").trigger("change"))}function u(){var t=$("select[name=ci_vehicle_model]").children("option:selected").val()===""?null:$("select[name=ci_vehicle_model]").children("option:selected").val(),i=$("input[name='ci_vehicle_registration_date.Value']").val()===""?null:$("input[name='ci_vehicle_registration_date.Value']").val();t?(n.WaitPanel.increment(),$.getJSON("/ServiceSelectorsAPI/CarProviderPtCarInsuranceBroker/GetCarVersions",{modelId:t,buildDate:i},function(t){var i="<option value=''>"+$("#SelectOption").html()+"<\/option>",r=$("select[name=ci_vehicle_version]").data("previousanswer");$.each(t,function(n){i+="<option value='"+t[n].VersionId+"' "+(r==t[n].VersionId?"selected":"")+">"+t[n].VersionName+"<\/option>"});$("select[name=ci_vehicle_version]").html(i);$("select[name=ci_vehicle_version]").data("previousanswer","");$("select[name=ci_vehicle_version]").trigger("change");n.WaitPanel.decrement()}),console.log("Updating versions for model "+t)):(console.log("Clearing versions"),$("select[name=ci_vehicle_version]").html("<option selected=selected value=''>"+$("#SelectModelFirst").html()+"<\/option>"),$("select[name=ci_vehicle_version]").trigger("change"))}t.updateBrands=i;t.updateModels=r;t.updateVersions=u})(i=t.CarECHelper||(t.CarECHelper={}))})(t=n.SppServiceSelectorPtCarInsuranceBroker||(n.SppServiceSelectorPtCarInsuranceBroker={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(t){function r(n,i){t.call(this,n);this.loadingElement="<div class='loading_prices'><div class='waiting' style='position:relative;height:35px'><\/div><p style='text-align:center'>"+$("#loadingPricesTranslation").val()+"<\/p><a href='#FinishAlertPopup' class='js-popup info-link--after js-finish-alert-link'  style='text-align:center;margin-bottom: 8px; display:none;'>"+$("#FinishAlertLinkTranslation").val()+"<\/a><\/div>";this.priceTemplate='<del class="listing__item__price__value--old">{{OriginalPrice}}<\/del><div class="listing__item__price__value--large" style="white- space: nowrap; ">{{Price}}<small class="listing__item__price__period">'+$("#PriceTimeRangeTextTranslation").val()+"<\/small><\/div>";this.savingsTemplate='<p class="listing__item__interest" data-selector="saving-feature">'+$("#SavingsAmountTranslation").val()+' <span class="listing__item__price__value--small" > {{SavingsAmount}} <\/span><\/p>';this.elapsedTimeInMs=0;this.options=$.extend({controllerName:"",actionName:"GetUpdatedQuotes",initialRefreshRateInSeconds:30,refreshRateFactor:1.2,maxMinutesRefreshing:1,popupFinishAlertSubscriptionInitSeconds:30,itemWithoutPriceSelector:".price__pannel[data-hasprice='false']",requestIdSelector:"#ServiceSelectorRequestId",subscribeFinishAlertFormSelector:"[data-selector='finish-alert-form']",subscribeFinishAlertCloseSelector:"[data-selector='finish-alert-close']",subscribeFinishAlertConfirmationSelector:"[data-selector='finish-alert-confirmation']"},i);this.initialize()}return __extends(r,t),r.prototype.initialize=function(){var n=this;this.component=$("div[data-type='"+this.options.controllerName+"Controller'][data-rendering='ListerResults'] , div[data-type='"+this.options.controllerName+"Controller'][data-rendering='DetailHeader'] , div[data-type='"+this.options.controllerName+"Controller'][data-rendering='Compare']");i.replaceState({bymail:!0},document.title,window.location.href.split("?")[0]);this.currentRefreshRateInMs=this.options.initialRefreshRateInSeconds*1e3;this.showLoader();this.bindEvents();setTimeout(function(){n.timedRefreshes()},this.currentRefreshRateInMs);this.timedFinishAlertPopup()},r.prototype.showLoader=function(){if($(this.options.itemWithoutPriceSelector,this.component).children(".loading_prices").length<=0){$(this.options.itemWithoutPriceSelector,this.component).prepend(this.loadingElement);$(".hidden_on_realtime_quotes",this.component).hide();var t=n.SessionStore.getFromSession("FinishAlertSubscriptions");(t==null||$.inArray(this.getRequestId(),t)<0)&&$(".js-finish-alert-link",this.component).show()}},r.prototype.timedRefreshes=function(){var t=this;n.Debug.logToConsole("Refreshing "+this.elapsedTimeInMs/1e3+"s of "+this.options.maxMinutesRefreshing*60+"s @ "+this.currentRefreshRateInMs/1e3+"s");this.updatePrices();this.elapsedTimeInMs<this.options.maxMinutesRefreshing*6e4&&$(this.options.itemWithoutPriceSelector,this.component).length>0&&(setTimeout(function(){t.timedRefreshes()},this.currentRefreshRateInMs),this.elapsedTimeInMs+=this.currentRefreshRateInMs,this.currentRefreshRateInMs*=this.options.refreshRateFactor)},r.prototype.timedFinishAlertPopup=function(){var t=this;setTimeout(function(){var i=n.SessionStore.getFromSession("FinishAlertSubscriptions"),r=n.SessionStore.getFromSession("FinishAlertSubscriptionsClosed");(i==null||$.inArray(t.getRequestId(),i)<0)&&(r==null||$.inArray(t.getRequestId(),r)<0)&&$(t.options.itemWithoutPriceSelector,t.component).length>0&&(n.Debug.logToConsole("Showing popup after "+t.options.popupFinishAlertSubscriptionInitSeconds+"s"),$("<a/>").addClass("js-popup").attr("href","#FinishAlertPopup").modal().click())},this.options.popupFinishAlertSubscriptionInitSeconds*1e3)},r.prototype.updatePrices=function(){var t=$("meta[name='scID']").attr("content"),i="/ServiceSelectorsAPI/"+this.options.controllerName+"/"+this.options.actionName+"/"+t+"?requestId="+this.getRequestId(),n=this;$.ajax({url:i}).done(function(t){var i,r;if(t.Quotes!=null){for(i=0;i<t.Quotes.length;i++)r=$(n.options.itemWithoutPriceSelector+"[data-serviceoffer='"+t.Quotes[i].ServiceOfferId+"']",n.component),r.attr("data-hasprice","true"),r.children(".loading_prices").remove(),r.prepend(Mustache.render(n.priceTemplate,t.Quotes[i])+(t.Quotes[i].SavingsAmount.length>0?Mustache.render(n.savingsTemplate,t.Quotes[i]):""));$(".js-popup").modal()}}).fail(function(){})},r.prototype.getRequestId=function(){return $(this.options.requestIdSelector).val()},r.prototype.bindEvents=function(){var n=this;$(document).ajaxSuccess(function(t,i,r){r.url.indexOf(n.options.actionName)<0&&n.showLoader()});$(this.options.subscribeFinishAlertFormSelector).off("submit").on("submit","form",$.proxy(this.subscribeToFinishAlert,this));$(this.options.subscribeFinishAlertCloseSelector).off("click").on("click",$.proxy(this.toggleFinishAlertForm,this))},r.prototype.toggleFinishAlertForm=function(){var i=$("form",this.options.subscribeFinishAlertFormSelector),t,r;i.is(":hidden")&&(i[0].reset(),i.show(),$(this.options.subscribeFinishAlertConfirmationSelector).hide());t=n.SessionStore.getFromSession("FinishAlertSubscriptionsClosed");t==null&&(t=[]);t.push(this.getRequestId());n.SessionStore.storeInSession("FinishAlertSubscriptionsClosed",t);r=n.SessionStore.getFromSession("FinishAlertSubscriptionsClosed");n.Debug.logToConsole("Added to Closed -> "+JSON.stringify(r))},r.prototype.subscribeToFinishAlert=function(t){var u,i,r;(t.preventDefault(),u=t.currentTarget,i=$(t.currentTarget),i.data("ssfvalidator")||i.ssfvalidator({autoRevalidate:!0,showValidationMessages:!0}),i.ssfvalidator("validate"))&&(r=this,n.Ajax.submitFormAndGetData(u,{onSuccess:function(){$(i).hide().parent().find(r.options.subscribeFinishAlertConfirmationSelector).show();i.ssfvalidator("destroy");var t=n.SessionStore.getFromSession("FinishAlertSubscriptions");t==null&&(t=[]);t.push(r.getRequestId());n.SessionStore.storeInSession("FinishAlertSubscriptions",t);$(".js-finish-alert-link",r.component).hide()},useWaitPanel:!0}))},r}(n.BaseComponent);t.RealTimeQuotesHandler=r})(t=n.SppServiceSelectorBase||(n.SppServiceSelectorBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"profile";case"profile":return null;default:return"profile"}},t}(n.ServiceSelector.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(i=t.SsfPtCarInsuranceProfiler||(t.SsfPtCarInsuranceProfiler={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.savingAccountsQuestions=new t.QuestionSections.SsfPtCarInsuranceProfilerQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!1,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:null,contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("profile"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(n){this.savingAccountsQuestions.showHideServiceSelectionQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SsfPtCarInsuranceProfiler||(n.SsfPtCarInsuranceProfiler={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideServiceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.SsfPtCarInsuranceProfilerQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SsfPtCarInsuranceProfiler||(n.SsfPtCarInsuranceProfiler={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(t){function r(n){t.call(this,n);this.ssfPtCarInsuranceProfilerQuestions=new i.QuestionSections.SsfPtCarInsuranceProfilerQuestions(this.component);this.ssfPtCarInsuranceProfilerQuestions.showHideServiceSelectionQuestions(null);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(r,t),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0,this.ssfPtCarInsuranceProfilerQuestions.showHideServiceSelectionQuestions(n))},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.ServiceSelector.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=t}})},r}(t.SppServiceSelectorBase.SppBaseSummary);i.SsfPtCarInsuranceProfilerSummary=r})(i=t.SsfPtCarInsuranceProfiler||(t.SsfPtCarInsuranceProfiler={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return"account";case"account":return null;default:return"account"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorPtCondominiumSavingsAccount||(n.SppServiceSelectorPtCondominiumSavingsAccount={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.condominiumSavingsAccountQuestions=new t.QuestionSections.CondominiumSavingsAccountQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",onStepLoaded:"steploaded",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("account"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.condominiumSavingsAccountQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorPtCondominiumSavingsAccount||(n.SppServiceSelectorPtCondominiumSavingsAccount={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.CondominiumSavingsAccountQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorPtCondominiumSavingsAccount||(n.SppServiceSelectorPtCondominiumSavingsAccount={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(t){function r(n){t.call(this,n);this.condominiumSavingsAccountQuestions=new i.QuestionSections.CondominiumSavingsAccountQuestions(this.component);this.condominiumSavingsAccountQuestions.showHideSerciceSelectionQuestions(null);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(r,t),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0,this.condominiumSavingsAccountQuestions.showHideSerciceSelectionQuestions(n))},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.ServiceSelector.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=t}})},r}(t.SppServiceSelectorBase.SppBaseSummary);i.SppCondominiumSavingsAccountPtSummary=r})(i=t.SppServiceSelectorPtCondominiumSavingsAccount||(t.SppServiceSelectorPtCondominiumSavingsAccount={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(t){function r(n,i){t.call(this,n,i)}return __extends(r,t),r.prototype.getNextStepLogic=function(){var t=i.getState();switch(t.data.step){case"landingpage":return n.Debug.logToConsole("Next step: location"),"location";case"location":return n.Debug.logToConsole("Next step: serviceselection"),"serviceselection";case"serviceselection":return this.shouldIncludeContractsFeatureInWizard()?(n.Debug.logToConsole("Next step: selectcontracts"),"selectcontracts"):this.hasElectricity()?(n.Debug.logToConsole("Next step: electricity"),"electricity"):(n.Debug.logToConsole("Next step: gas"),"gas");case"electricity":return this.hasGas()?(n.Debug.logToConsole("Next step: gas"),"gas"):this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"gas":return this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"saveprofile":return null;case"selectcontracts":return this.hasElectricity()?(n.Debug.logToConsole("Next step: electricity"),"electricity"):(n.Debug.logToConsole("Next step: gas"),"gas");default:return"landingpage"}},r.prototype.hasElectricity=function(){return $("input[name=com_service_scope]:checked",this.element).val()==="electricity_gas"||$("input[name=com_service_scope]:checked",this.element).val()==="electricity"?!0:!1},r.prototype.hasGas=function(){return $("input[name=com_service_scope]:checked",this.element).val()==="electricity_gas"||$("input[name=com_service_scope]:checked",this.element).val()==="gas"?!0:!1},r}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorPtEnergy||(n.SppServiceSelectorPtEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.serviceSelectionQuestions=new t.QuestionSections.ServiceSelectionQuestions(this.component);this.electricityQuestions=new t.QuestionSections.ElectricityQuestions(this.component);this.gasQuestions=new t.QuestionSections.GasQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("location"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){this.component.on("click","input[name=energy]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},i.prototype.questionsAnsweredLogic=function(n){this.serviceSelectionQuestions.showHideSerciceSelectionQuestions(n);this.electricityQuestions.showHideElectricityQuestions(n);this.gasQuestions.showHideGasQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorPtEnergy||(n.SppServiceSelectorPtEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var u=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion();this.showHideQuestions()},t.prototype.showHideQuestions=function(){var r="com_service_scope",u="com_have_currentcontract",f=$("select[name='com_location_district']",this.component),n=$("input[name='"+r+"']",this.component),p=$("[data-question='"+r+"']",this.component),e=$("input[name='"+u+"']",this.component),o=$("[data-question='"+u+"']",this.component),s=$("[data-question='com_currentcontract1_tariff']",this.component),h=$("[data-question='com_currentcontract1_expenseamount']",this.component),c=$("[data-question='com_currentcontract1_expensefrequency']",this.component),t=$("[data-question='com_currentcontract2_tariff']",this.component),l=$("[data-question='com_currentcontract2_expenseamount']",this.component),a=$("[data-question='com_currentcontract2_expensefrequency']",this.component),i=$("[data-question='com_currentcontract3_tariff']",this.component),v=$("[data-question='com_currentcontract3_expenseamount']",this.component),y=$("[data-question='com_currentcontract3_expensefrequency']",this.component);this.getAnswerValue(f)==="Reg. Aut. dos Açores"||this.getAnswerValue(f)==="Reg. Aut. da Madeira"?($("#com_service_scope_electricity_gas").prop("disabled",!0),$("#com_service_scope_gas").prop("disabled",!0)):($("#com_service_scope_electricity_gas").prop("disabled",!1),$("#com_service_scope_gas").prop("disabled",!1));this.getAnswerValue(n)==="electricity_gas"?(this.showQuestion(o),this.showQuestion(h),this.showQuestion(c)):(this.hideQuestion(o),this.hideQuestion(h),this.hideQuestion(c));this.getAnswerValue(n)==="electricity_gas"&&this.getAnswerValue(e)==="currentcontract_yes"?this.showQuestion(s):this.hideQuestion(s);this.getAnswerValue(n)==="electricity_gas"&&this.getAnswerValue(e)==="currentcontract_no"?(this.showQuestion(t),this.showQuestion(i)):(this.hideQuestion(t),this.hideQuestion(i));this.getAnswerValue(n)==="electricity"?(this.showQuestion(t),this.showQuestion(l),this.showQuestion(a)):(this.hideQuestion(l),this.hideQuestion(a));this.getAnswerValue(n)==="gas"?(this.showQuestion(i),this.showQuestion(v),this.showQuestion(y)):(this.hideQuestion(v),this.hideQuestion(y))},t}(n.SppServiceSelectorBase.BaseQuestions),i,r;t.ServiceSelectionQuestions=u;i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideElectricityQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion();this.showHideQuestions()},t.prototype.showHideQuestions=function(){},t}(n.SppServiceSelectorBase.BaseQuestions);t.ElectricityQuestions=i;r=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideGasQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion();this.showHideQuestions()},t.prototype.showHideQuestions=function(){},t}(n.SppServiceSelectorBase.BaseQuestions);t.GasQuestions=r})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorPtEnergy||(n.SppServiceSelectorPtEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(t){function r(n){t.call(this,n);this.electicity=new i.QuestionSections.ElectricityQuestions(this.component);this.gas=new i.QuestionSections.GasQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null);this.bindExtraEvents()}return __extends(r,t),r.prototype.bindExtraEvents=function(){this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame)},r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.electicity.showHideElectricityQuestions(n);this.gas.showHideGasQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.ServiceSelector.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=t}})},r}(t.SppServiceSelectorBase.SppBaseSummary);i.SppEnergyPtSummary=r})(i=t.SppServiceSelectorPtEnergy||(t.SppServiceSelectorPtEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(r){function u(n,t){r.call(this,n,t)}return __extends(u,r),u.prototype.getNextStepLogic=function(){var r=i.getState();switch(r.data.step){case"landingpage":return"serviceselection";case"serviceselection":return this.shouldIncludeContractsFeatureInWizard()?"selectcontracts":$("#tel_include_television",this.element).prop("checked")?(n.Debug.logToConsole("Next step: television"),"television"):this.hasService(t.QuestionSections.TelcoQuestions.incNet)?(n.Debug.logToConsole("Next step: internet"),"internet"):this.hasService(t.QuestionSections.TelcoQuestions.incPhone)?(n.Debug.logToConsole("Next step: telephone"),"telephone"):this.hasService(t.QuestionSections.TelcoQuestions.incMobile)?(n.Debug.logToConsole("Next step: mobile"),"mobile"):this.hasService(t.QuestionSections.TelcoQuestions.incMobileNet)?(n.Debug.logToConsole("Next step: mobileinternet"),"mobileinternet"):this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"television":return this.hasService(t.QuestionSections.TelcoQuestions.incNet)?(n.Debug.logToConsole("Next step: internet"),"internet"):this.hasService(t.QuestionSections.TelcoQuestions.incPhone)?(n.Debug.logToConsole("Next step: telephone"),"telephone"):this.hasService(t.QuestionSections.TelcoQuestions.incMobile)?(n.Debug.logToConsole("Next step: mobile"),"mobile"):this.hasService(t.QuestionSections.TelcoQuestions.incMobileNet)?(n.Debug.logToConsole("Next step: mobileinternet"),"mobileinternet"):this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"internet":return this.hasService(t.QuestionSections.TelcoQuestions.incPhone)?(n.Debug.logToConsole("Next step: telephone"),"telephone"):this.hasService(t.QuestionSections.TelcoQuestions.incMobile)?(n.Debug.logToConsole("Next step: mobile"),"mobile"):this.hasService(t.QuestionSections.TelcoQuestions.incMobileNet)?(n.Debug.logToConsole("Next step: mobileinternet"),"mobileinternet"):this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"telephone":return this.hasService(t.QuestionSections.TelcoQuestions.incMobile)?(n.Debug.logToConsole("Next step: mobile"),"mobile"):this.hasService(t.QuestionSections.TelcoQuestions.incMobileNet)?(n.Debug.logToConsole("Next step: mobileinternet"),"mobileinternet"):this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"mobile":return this.hasService(t.QuestionSections.TelcoQuestions.incMobileNet)?(n.Debug.logToConsole("Next step: mobileinternet"),"mobileinternet"):this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"mobileinternet":return this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"selectcontracts":return this.hasService(t.QuestionSections.TelcoQuestions.incTelevision)?(n.Debug.logToConsole("Next step: television"),"television"):this.hasService(t.QuestionSections.TelcoQuestions.incNet)?(n.Debug.logToConsole("Next step: internet"),"internet"):this.hasService(t.QuestionSections.TelcoQuestions.incPhone)?(n.Debug.logToConsole("Next step: telephone"),"telephone"):this.hasService(t.QuestionSections.TelcoQuestions.incMobile)?(n.Debug.logToConsole("Next step: mobile"),"mobile"):this.hasService(t.QuestionSections.TelcoQuestions.incMobileNet)?(n.Debug.logToConsole("Next step: mobileinternet"),"mobileinternet"):this.isAscrQuestionEnabled()?(n.Debug.logToConsole("Next step: saveprofile"),"saveprofile"):null;case"saveprofile":return null;default:return"serviceselection"}},u.prototype.hasService=function(n){return this.getQuestion(n).is(":checked")},u.prototype.getQuestion=function(n){return $("#"+n,this.element)},u}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SsfPtTelco||(n.SsfPtTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(i){function r(n,r){i.call(this,n,r);this.telcoQuestions=new t.QuestionSections.TelcoQuestions(this.component);this.telcoQuestions.showHideServiceSelectionQuestions();$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(r,i),r.prototype.initializeNavigator=function(){var r,n,f,i,u;if(this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn}),location.search.indexOf("skiplanding")>=0){if(location.search.indexOf("services")>=0)for(r=location.href.slice(location.href.indexOf("?")+1).split("&"),n=0;n<r.length;n++)if(r[n].indexOf("services")>=0)for(f=r[n].split("=")[1],i=0;i<f.length;i++)f[i]==="1"&&(u=$("input[name=telco]")[i],u.setAttribute("checked","true"),u.setAttribute("value",u.id));this.navigator.goToStep("serviceselection")}else this.navigator.loadStepFromState(null)},r.prototype.bindExtraEvents=function(){var n=this;this.component.off("click",".js-addConsumption").on("click",".js-addConsumption",function(){var i=$(this),t=i.data("card");$(".consumptionBlock[data-card='"+t+"'].compHide",n.component).first().show().removeClass("compHide").addClass("compVisible");$(".js-removeConsumption[data-card='"+t+"']",n.component).show();$(".consumptionBlock[data-card='"+t+"'].compHide",n.component).length===0&&$(".js-addConsumption[data-card='"+t+"']",n.component).hide()});this.component.off("change","[name=com_locationtxt]").on("change","[name=com_locationtxt]",this.getLocation);this.component.off("click",".js-removeConsumption").on("click",".js-removeConsumption",function(){for(var r=$(this),t=r.data("card"),u=+r.data("consumption"),f=$(".consumptionBlock[data-card='"+t+"']",n.component).length,i=u;i<=f;i++)$("select[name='tel_card"+t+"_operator"+i+"']",n.component).val($(".compVisible select[name='tel_card"+t+"_operator"+(i+1)+"']",n.component).val()),$("input[name='tel_card"+t+"_min"+i+".Value']",n.component).val($(".compVisible input[name='tel_card"+t+"_min"+(i+1)+".Value']",n.component).val()),$("input[name='tel_card"+t+"_sms"+i+".Value']",n.component).val($(".compVisible input[name='tel_card"+t+"_sms"+(i+1)+".Value']",n.component).val());$(".consumptionBlock[data-card='"+t+"'].compVisible",n.component).last().hide().removeClass("compVisible").addClass("compHide");$(".js-addConsumption[data-card='"+t+"']",n.component).show();$(".consumptionBlock[data-card='"+t+"'].compVisible",n.component).length<=1&&$(".js-removeConsumption[data-card='"+t+"']",n.component).hide()});this.component.off("click",".js-addContract").on("click",".js-addContract",function(){var t=$(this);$(".contractBlock.contHide",n.component).first().show().removeClass("contHide").addClass("contVisible");$(".js-removeContract",n.component).show();$(".contractBlock.contHide",n.component).length===0&&$(".js-addContract",n.component).hide()});this.component.off("click",".js-removeContract").on("click",".js-removeContract",function(){for(var i=$(this),r=+i.data("contract"),u=$(".contractBlock",n.component).length,t=r;t<=u;t++)$("select[name='tel_provider"+t+"']",n.component).val($(".contVisible select[name='tel_provider"+(t+1)+"']",n.component).val()),$("select[name='tel_provider"+t+"']",n.component).change(),$("select[name='tel_provider"+t+"_service']",n.component).val($(".contVisible select[name='tel_provider"+(t+1)+"_service']",n.component).val()),$("select[name='tel_provider"+t+"_service']",n.component).change(),$("select[name='tel_provider"+t+"_technology']",n.component).val($(".contVisible select[name='tel_provider"+(t+1)+"_technology']",n.component).val()),$("select[name='tel_provider"+t+"_technology']",n.component).change();$(".contractBlock.contVisible",n.component).last().hide().removeClass("contVisible").addClass("contHide");$(".js-addContract",n.component).show();$(".contractBlock.contVisible",n.component).length<=1&&$(".js-removeContract",n.component).hide()});this.component.on("click","input[name=telco]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},r.prototype.questionsAnsweredLogic=function(){this.telcoQuestions.showHideServiceSelectionQuestions()},r.prototype.getLocation=function(){var t=$("[name = com_locationtxt]").val();t!=null&&t.length>0&&n.Ajax.getDataFromAction("SsfPtTelco","GetLocationByPtPostalCode",null,{postalCode:t},null,{onSuccess:function(n){$(".locationpttxt").text(n.substring(9));$(".hiddenlocationpt").val(n);$(".hiddenlocationpt").text(n)},onError:function(){return n.Debug.logToConsole("Error")},useWaitPanel:!0})},r}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SsfPtTelco||(n.SsfPtTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideServiceSelectionQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){var f=$("#"+t.incTelevision,this.component),e=$("#"+t.incNet,this.component),o=$("#"+t.incPhone,this.component),i=$("[data-question='"+t.location+"']",this.component),r=$("[data-question='"+t.currentcontracts+"']",this.component),u,n;this.getAnswerValue(e)||this.getAnswerValue(f)||this.getAnswerValue(o)?(this.showQuestion(i),this.showQuestion(r)):(this.hideQuestion(i),this.hideQuestion(r));u=$("input[name='"+t.extraSim+"']",this.component);n=$("[data-selector='"+t.extraSimBlock+"']",this.component);this.getAnswerValue(u)==="Yes"?this.showQuestion(n):this.hideQuestion(n)},t.incTelevision="tel_include_television",t.incNet="tel_include_fixedinternet",t.incPhone="tel_include_fixedtelephone",t.incMobile="tel_include_mobile",t.incMobileNet="tel_include_mobileinternet",t.location="com_postal_code",t.currentcontracts="tel_currentcontracts",t.extraSim="tel_mobile_extra_sim",t.extraSimBlock="card2Block",t}(n.SppServiceSelectorBase.BaseQuestions);t.TelcoQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SsfPtTelco||(n.SsfPtTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(r){function u(n){r.call(this,n);this.telcoQuestions=new i.QuestionSections.TelcoQuestions(this.component);this.controllerName=n.controllerName;this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null);this.form.on("click.telcoSummary","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click.telcoSummary","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click.telcoSummary","[data-selector='related-contracts']",this.hideExpenses);var t=this;this.component.off("click",".js-addConsumption").on("click",".js-addConsumption",function(){var i=$(this),n=i.data("card");$(".consumptionBlock[data-card='"+n+"'].compHide",t.component).first().show().removeClass("compHide").addClass("compVisible");$(".js-removeConsumption[data-card='"+n+"']",t.component).show();$(".consumptionBlock[data-card='"+n+"'].compHide",t.component).length===0&&$(".js-addConsumption[data-card='"+n+"']",t.component).hide()});this.component.off("click",".js-removeConsumption").on("click",".js-removeConsumption",function(){for(var r=$(this),n=r.data("card"),u=+r.data("consumption"),f=$(".consumptionBlock[data-card='"+n+"']",t.component).length,i=u;i<=f;i++)$("select[name='tel_card"+n+"_operator"+i+"']",t.component).val($(".compVisible select[name='tel_card"+n+"_operator"+(i+1)+"']",t.component).val()),$("input[name='tel_card"+n+"_min"+i+".Value']",t.component).val($(".compVisible input[name='tel_card"+n+"_min"+(i+1)+".Value']",t.component).val()),$("input[name='tel_card"+n+"_sms"+i+".Value']",t.component).val($(".compVisible input[name='tel_card"+n+"_sms"+(i+1)+".Value']",t.component).val());$(".consumptionBlock[data-card='"+n+"'].compVisible",t.component).last().hide().removeClass("compVisible").addClass("compHide");$(".js-addConsumption[data-card='"+n+"']",t.component).show();$(".consumptionBlock[data-card='"+n+"'].compVisible",t.component).length<=1&&$(".js-removeConsumption[data-card='"+n+"']",t.component).hide()})}return __extends(u,r),u.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.telcoQuestions.showHideServiceSelectionQuestions(n)},u.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},u.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},u.prototype.doSubmit=function(i){var e=this,u,r,f;for(this.actuallySelectAllSelectedContracts(),u=$('input[type="checkbox"]:checked'),r=0;r<u.length;r++)f=$(u[r]),f.val(f.attr("data-value"));t.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=i},onValidationFailed:function(){e.requiredServiceValidationBox.show()}})},u}(t.SppServiceSelectorBase.SppBaseSummary);i.SsfTelcoPtSummary=r})(i=t.SsfPtTelco||(t.SsfPtTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SsfPtHealthInsurance||(n.SsfPtHealthInsurance={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(i){function r(n,r){i.call(this,n,r);this.healthInsuranceQuestions=new t.QuestionSections.HealthInsuranceQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(r,i),r.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},r.prototype.bindExtraEvents=function(){var t=this,n;this.component.find("[data-selector='add-new-contract-button']").on("click",function(){return t.openAddContractModal()});n=this;this.component.off("click",".js-addContract").on("click",".js-addContract",function(){var t=$(this);$(".contractBlock.contHide",n.component).first().show().removeClass("contHide").addClass("contVisible");$(".js-removeContract",n.component).show();$(".contractBlock.contHide",n.component).length===0&&$(".js-addContract",n.component).hide()});this.component.off("click",".js-removeContract").on("click",".js-removeContract",function(){var t=$(this);$(".contractBlock.contVisible",n.component).last().hide().removeClass("contVisible").addClass("contHide");$(".js-addContract",n.component).show();$(".contractBlock.contVisible",n.component).length<=1&&$(".js-removeContract",n.component).hide()});this.component.on("click",".jq_allServices",function(){var n=$(this);$("input[name=services]").each(function(){var t=$(this);n.is(":checked")?(t.prop("checked",!0),t.val(t.attr("id"))):(t.prop("checked",!1),t.val(""),n.prop("checked",!1))})});this.component.on("click","input[name=services]",function(){var n=$(this);n.is(":checked")?(n.val(n.attr("id")),$("input[name=services]:checked").length==$("input[name=services]").length&&$(".jq_allServices").prop("checked",!0)):($(".jq_allServices").prop("checked",!1),n.val(""))})},r.prototype.openAddContractModal=function(){n.Ajax.sendDataToActionAndUpdate("ContractDetails","Details",null,{},null,{onSuccess:function(){return n.SppHelper.openModal("#contract-details-popup")}})},r.prototype.questionsAnsweredLogic=function(){this.healthInsuranceQuestions.showOrHideArrowBoxForAllQuestion()},r}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SsfPtHealthInsurance||(n.SsfPtHealthInsurance={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.healthInsurancetQuestions=["hi_titular_age","hi_first_person_age","hi_first_person_gender","hi_second_person_age","hi_second_person_gender","hi_third_person_age","hi_third_person_gender","hi_fourth_person_age","hi_fourth_person_gender","hi_fifth_person_age","hi_fifth_person_gender","hi_sixth_person_age","hi_sixth_person_gender","hi_first_coverage_plan","hi_second_coverage_plan","hi_third_coverage_plan","hi_fourth_coverage_plan","hi_fifth_coverage_plan","hi_sixth_coverage_plan","hi_all_coverage_plan","hi_more_persons"]}return __extends(t,n),t.prototype.showHideHealthInsuranceQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){},t}(n.SppServiceSelectorBase.BaseQuestions);t.HealthInsuranceQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SsfPtHealthInsurance||(n.SsfPtHealthInsurance={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.healthInsuranceQuestions=new t.QuestionSections.HealthInsuranceQuestions(this.component);this.healthInsuranceQuestions.showHideHealthInsuranceQuestions();this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses);var r=this;this.component.off("click",".js-addContract").on("click",".js-addContract",function(){var n=$(this);$(".contractBlock.contHide",r.component).first().show().removeClass("contHide").addClass("contVisible");$(".js-removeContract",r.component).show();$(".contractBlock.contHide",r.component).length===0&&$(".js-addContract",r.component).hide()});this.component.off("click",".js-removeContract").on("click",".js-removeContract",function(){var n=$(this);$(".contractBlock.contVisible",r.component).last().hide().removeClass("contVisible").addClass("contHide");$(".js-addContract",r.component).show();$(".contractBlock.contVisible",r.component).length<=1&&$(".js-removeContract",r.component).hide()});this.component.on("click",".jq_allServices",function(){var n=$(this);$("input[name=services]").each(function(){var t=$(this);n.is(":checked")?(t.prop("checked",!0),t.val(t.attr("id"))):(t.prop("checked",!1),t.val(""),n.prop("checked",!1))})});this.component.on("click","input[name=services]",function(){var n=$(this);n.is(":checked")?(n.val(n.attr("id")),$("input[name=services]:checked").length==$("input[name=services]").length&&$(".jq_allServices").prop("checked",!0)):($(".jq_allServices").prop("checked",!1),n.val(""))});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0,this.healthInsuranceQuestions.showHideHealthInsuranceQuestions(n))},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SsfPtHealthInsuranceSummary=i})(t=n.SsfPtHealthInsurance||(n.SsfPtHealthInsurance={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"travelinsurance";case"travelinsurance":return null}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBrTravelInsurance||(n.SppServiceSelectorBrTravelInsurance={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.travelInsuranceQuestions=new t.QuestionSections.TravelInsuranceQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("travelinsurance"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.travelInsuranceQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBrTravelInsurance||(n.SppServiceSelectorBrTravelInsurance={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.TravelInsuranceQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBrTravelInsurance||(n.SppServiceSelectorBrTravelInsurance={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.travelInsuranceQuestions=new t.QuestionSections.TravelInsuranceQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.travelInsuranceQuestions.showHideSerciceSelectionQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppTravelInsuranceSummary=i})(t=n.SppServiceSelectorBrTravelInsurance||(n.SppServiceSelectorBrTravelInsurance={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"ddd";case"ddd":return null}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBrDdd||(n.SppServiceSelectorBrDdd={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.dddQuestions=new t.QuestionSections.DddQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("ddd"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.dddQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBrDdd||(n.SppServiceSelectorBrDdd={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.DddQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBrDdd||(n.SppServiceSelectorBrDdd={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.dddQuestions=new t.QuestionSections.DddQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.dddQuestions.showHideSerciceSelectionQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppDddSummary=i})(t=n.SppServiceSelectorBrDdd||(n.SppServiceSelectorBrDdd={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"ddi";case"ddi":return null}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBrDdi||(n.SppServiceSelectorBrDdi={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.ddiQuestions=new t.QuestionSections.DdiQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("ddi"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.ddiQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBrDdi||(n.SppServiceSelectorBrDdi={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.DdiQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBrDdi||(n.SppServiceSelectorBrDdi={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.ddiQuestions=new t.QuestionSections.DdiQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.ddiQuestions.showHideSerciceSelectionQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppDdiSummary=i})(t=n.SppServiceSelectorBrDdi||(n.SppServiceSelectorBrDdi={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"MobileTariff";case"MobileTariff":return null}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBrMobileTariff||(n.SppServiceSelectorBrMobileTariff={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.MobileTariffQuestions=new t.QuestionSections.MobileTariffQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("MobileTariff"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.MobileTariffQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBrMobileTariff||(n.SppServiceSelectorBrMobileTariff={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.MobileTariffQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBrMobileTariff||(n.SppServiceSelectorBrMobileTariff={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.MobileTariffQuestions=new t.QuestionSections.MobileTariffQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.MobileTariffQuestions.showHideSerciceSelectionQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppMobileTariffSummary=i})(t=n.SppServiceSelectorBrMobileTariff||(n.SppServiceSelectorBrMobileTariff={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"PayTv";case"PayTv":return null}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorBrPayTv||(n.SppServiceSelectorBrPayTv={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.PayTvQuestions=new t.QuestionSections.PayTvQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("PayTv"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){},i.prototype.questionsAnsweredLogic=function(){this.PayTvQuestions.showOrHideArrowBoxForAllQuestion()},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorBrPayTv||(n.SppServiceSelectorBrPayTv={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideSerciceSelectionQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.PayTvQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorBrPayTv||(n.SppServiceSelectorBrPayTv={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.PayTvQuestions=new t.QuestionSections.PayTvQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.PayTvQuestions.showHideSerciceSelectionQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppPayTvSummary=i})(t=n.SppServiceSelectorBrPayTv||(n.SppServiceSelectorBrPayTv={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"location";case"location":return"serviceselection";case"serviceselection":return this.shouldIncludeContractsFeatureInWizard()?"selectcontracts":$("#e_include",this.element).prop("checked")?"electricity":"gas";case"selectcontracts":return $("#e_include",this.element).prop("checked")?"electricity":"gas";case"electricity":return $("#g_include",this.element).prop("checked")?"gas":this.isAscrQuestionEnabled()?"saveprofile":null;case"gas":return this.isAscrQuestionEnabled()?"saveprofile":null;case"saveprofile":return null;default:return"landingpage"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorEsEnergy||(n.SppServiceSelectorEsEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.electricityQuestions=new t.QuestionSections.Electricity(this.component);this.gasQuestions=new t.QuestionSections.Gas(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!1,firstStep:"landingpage",shouldHideAdditionalRegions:!0,stepToHideAdditionalRegions:"location",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("location"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){this.component.on("click","input[name=energy]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},i.prototype.questionsAnsweredLogic=function(n){this.electricityQuestions.showHideElectricityQuestions(n);this.gasQuestions.showHideGasQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorEsEnergy||(n.SppServiceSelectorEsEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var r=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideGasQuestions=function(n){n===void 0&&(n=null);n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions),i;t.Gas=r;i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideElectricityQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){var o=$("input[name='e_tariff']",this.component),n=this.getAnswerValue(o),t=$("[data-question='e_normal_profile']",this.component),i=$("[data-question='e_normal_consumption']",this.component),r=$("[data-question='e_dual_profile']",this.component),u=$("[data-question='e_dual_peak_cons']",this.component),f=$("[data-question='e_dual_offpeak_cons']",this.component),e=$("#step2container",this.component);n==="normal"?(this.showQuestion(t),this.showQuestion(i),this.hideQuestion(r),this.hideQuestion(u),this.hideQuestion(f)):(this.hideQuestion(t),this.hideQuestion(i),this.showQuestion(r),this.showQuestion(u),this.showQuestion(f));n?e.show():e.hide()},t}(n.SppServiceSelectorBase.BaseQuestions);t.Electricity=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorEsEnergy||(n.SppServiceSelectorEsEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){var r=function(t){function r(n){t.call(this,n);this.electicity=new i.QuestionSections.Electricity(this.component);this.gas=new i.QuestionSections.Gas(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.bindUiEvents();this.showHideQuestionsLogic(null)}return __extends(r,t),r.prototype.bindUiEvents=function(){this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses)},r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.electicity.showHideElectricityQuestions(n);this.gas.showHideGasQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.ServiceSelector.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.ServiceSelector.WaitPanel.increment();location.href=t}})},r}(t.SppServiceSelectorBase.SppBaseSummary);i.SppEnergyEsSummary=r})(i=t.SppServiceSelectorEsEnergy||(t.SppServiceSelectorEsEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"landingpage":return"location";case"location":return"serviceselection";case"serviceselection":if(this.shouldIncludeContractsFeatureInWizard())return"selectcontracts";if($("#fp_include",this.element).prop("checked"))return"fixphone";if($("#fi_include",this.element).prop("checked"))return"fixinternet";if($("#tv_include",this.element).prop("checked"))return"television";if($("#mp_include",this.element).prop("checked"))return"mobilephone";if($("#mi_include",this.element).prop("checked"))return"mobileinternet";case"fixphone":return $("#fi_include",this.element).prop("checked")?"fixinternet":$("#tv_include",this.element).prop("checked")?"television":$("#mp_include",this.element).prop("checked")?"mobilephone":$("#mi_include",this.element).prop("checked")?"mobileinternet":this.isAscrQuestionEnabled()?"saveprofile":null;case"fixinternet":return $("#tv_include",this.element).prop("checked")?"television":$("#mp_include",this.element).prop("checked")?"mobilephone":$("#mi_include",this.element).prop("checked")?"mobileinternet":this.isAscrQuestionEnabled()?"saveprofile":null;case"television":return $("#mp_include",this.element).prop("checked")?"mobilephone":$("#mi_include",this.element).prop("checked")?"mobileinternet":this.isAscrQuestionEnabled()?"saveprofile":null;case"mobilephone":return $("#mi_include",this.element).prop("checked")?"mobileinternet":this.isAscrQuestionEnabled()?"saveprofile":null;case"mobileinternet":return this.isAscrQuestionEnabled()?"saveprofile":null;case"saveprofile":return null;case"selectcontracts":if($("#fp_include",this.element).prop("checked"))return"fixphone";if($("#fi_include",this.element).prop("checked"))return"fixinternet";if($("#tv_include",this.element).prop("checked"))return"television";if($("#mp_include",this.element).prop("checked"))return"mobilephone";if($("#mi_include",this.element).prop("checked"))return"mobileinternet";default:return"landingpage"}},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorEsTelco||(n.SppServiceSelectorEsTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function i(i,r){n.call(this,i,r);this.telcoQuestions=new t.QuestionSections.TelcoQuestions(this.component)}return __extends(i,n),i.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!1,firstStep:"landingpage",shouldHideAdditionalRegions:!0,stepToHideAdditionalRegions:"location",contractsFeatureEnabled:this.options.contractsFeatureEnabled,ascrFeatureEnabled:this.options.ascrFeatureEnabled,userIsLoggedIn:this.options.userIsLoggedIn});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("location"):this.navigator.loadStepFromState(null)},i.prototype.bindExtraEvents=function(){this.component.on("click","input[name=telco]",function(){var n=$(this);n.is(":checked")?n.val(n.attr("id")):n.val("")})},i.prototype.questionsAnsweredLogic=function(n){this.telcoQuestions.showHideQuestions(n)},i}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorEsTelco||(n.SppServiceSelectorEsTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t)}return __extends(t,n),t.prototype.showHideQuestions=function(n){n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t}(n.SppServiceSelectorBase.BaseQuestions);t.TelcoQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorEsTelco||(n.SppServiceSelectorEsTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.telcoQuestions=new t.QuestionSections.TelcoQuestions(this.component);this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.showHideQuestionsLogic(null);this.bindUiEvents()}return __extends(r,i),r.prototype.bindUiEvents=function(){this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses)},r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0);this.telcoQuestions.showHideQuestions(n)},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){this.requiredServiceValidationBox.hide();var n=this.form.find("[data-selector='summary-questions']").not(":disabled");return n.length===0?(this.requiredServiceValidationBox.show(),!1):this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppTelcoEsSummary=i})(t=n.SppServiceSelectorEsTelco||(n.SppServiceSelectorEsTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=History,r=function(n){function t(t,i){n.call(this,t,i)}return __extends(t,n),t.prototype.getNextStepLogic=function(){var n=i.getState();switch(n.data.step){case"questionnaire":return null;case"landingpage":return"questionnaire"}return null},t}(n.SppServiceSelectorBase.BaseNavigator);t.Navigator=r})(t=n.SppServiceSelectorEsSavingAccounts||(n.SppServiceSelectorEsSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(i){function r(n,r){i.call(this,n,r);this.savingAccountsQuestions=new t.QuestionSections.SavingAccountsQuestions(this.component);$("form",this.component).ssfvalidator({showValidationMessages:!0})}return __extends(r,i),r.prototype.initializeNavigator=function(){this.navigator=new t.Navigator(this.component,{onBeforeShowResults:jQuery.noop,resultUrl:this.options.resultUrl,labelResultUrl:this.options.labelResultUrl,showFieldValidation:!0,firstStep:"landingpage",shouldHideAdditionalRegions:!1,stepToHideAdditionalRegions:"",contractsFeatureEnabled:!1,ascrFeatureEnabled:!1,userIsLoggedIn:!1});location.search.indexOf("skiplanding")>=0?this.navigator.goToStep("questionnaire"):this.navigator.loadStepFromState(null)},r.prototype.bindExtraEvents=function(){var n=this;this.component.find("[data-selector='add-new-contract-button']").on("click",function(){return n.openAddContractModal()})},r.prototype.openAddContractModal=function(){n.Ajax.sendDataToActionAndUpdate("ContractDetails","Details",null,{},null,{onSuccess:function(){return n.SppHelper.openModal("#contract-details-popup")}})},r.prototype.questionsAnsweredLogic=function(){this.savingAccountsQuestions.showOrHideArrowBoxForAllQuestion()},r}(n.SppServiceSelectorBase.BaseQuestionnaire);t.Questionnaire=i})(t=n.SppServiceSelectorEsSavingAccounts||(n.SppServiceSelectorEsSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(t){n.call(this,t);this.savingAccountQuestions=["want_to_invest","duration","type"]}return __extends(t,n),t.prototype.showHideSavingAccountQuestions=function(n){n===void 0&&(n=null);this.showHideQuestions();n!=null?this.showOrHideArrowBoxes(n):this.showOrHideArrowBoxForAllQuestion()},t.prototype.showHideQuestions=function(){},t}(n.SppServiceSelectorBase.BaseQuestions);t.SavingAccountsQuestions=i})(i=t.QuestionSections||(t.QuestionSections={}))})(t=n.SppServiceSelectorEsSavingAccounts||(n.SppServiceSelectorEsSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){var i=function(i){function r(n){i.call(this,n);this.savingAccountsQuestions=new t.QuestionSections.SavingAccountsQuestions(this.component);this.savingAccountsQuestions.showHideSavingAccountQuestions();this.form=$("form",this.component).ssfvalidator({showValidationMessages:!0});this.form.on("click","[data-selector='summary-add-profile']",this.toggleAddContract);this.form.on("click","[data-selector='start-adding-contracts']",this.loadEditFrame);this.form.on("click","[data-selector='edit-contract']",this.loadEditFrame);this.form.on("click","[data-selector='related-contracts']",this.hideExpenses);this.showHideQuestionsLogic(null)}return __extends(r,i),r.prototype.showHideQuestionsLogic=function(n){n===void 0&&(n=null);n!=null&&(this.dirtyBit=!0,this.savingAccountsQuestions.showHideSavingAccountQuestions(n))},r.prototype.validateAndSumbitForm=function(n){this.doValidate()&&this.doSubmit(n)},r.prototype.doValidate=function(){return this.form.ssfvalidator("validate")},r.prototype.doSubmit=function(t){this.actuallySelectAllSelectedContracts();n.Ajax.submitFormAndGetData(this.form[0],{onSuccess:function(){n.WaitPanel.increment();location.href=t}})},r}(n.SppServiceSelectorBase.SppBaseSummary);t.SppSavingAccountsEsSummary=i})(t=n.SppServiceSelectorEsSavingAccounts||(n.SppServiceSelectorEsSavingAccounts={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(t){var i;(function(i){"use strict";var o="e2e",c=History,s=function(){var n={};return function(t){return n[t]?n[t]:n[t]=$.parseJSON($(t).text())}}(),h=function(){function i(n,t,i,r){this.workflow=n;this.step=t;this.e2e=i;this.serviceOfferId=r}return i.prototype.extendValidation=function(){$.validator.addMethod("nonumber",this.checkNoNumbers);$.validator.unobtrusive.adapters.addBool("nonumber");$.validator.addMethod("autosuggest",this.checkAutosuggest);$.validator.unobtrusive.adapters.addBool("autosuggest");$('[data-plugin="date-select"]').removeAttr("data-val-date");var t=document.getElementById("switch-form"),n=this.$form=$(t),i={options:{errorPlacement:$.proxy(this.errorPlacement,this),invalidHandler:$.proxy(this.invalidHandler,this),submitHandler:$.proxy(this.submitHandler,this),highlight:this.highlight,unhighlight:this.unhighlight,messages:{},rules:{}},attachValidation:function(){n.validate(this.options)},validate:function(){return n.validate(),n.valid()}};this.$form.data("unobtrusiveValidation",i);n.find(":submit").on("click",function(t){t.preventDefault();n.submit()})},i.prototype.initComponents=function(){this.query=new u;this.$summary=this.$form.find("[data-valmsg-summary=true] > ul");$('[data-selector="zipcode-autocomplete"]').each(this.initSingleAutoCompleteComponent)},i.prototype.initSingleAutoCompleteComponent=function(n,t){var i=$(t),r=s(i.data("config")).fields["#"+i.attr("name")],u=$('[name="'+r.feed+'"]'),f=function(n){i.attr("data-autocomplete-shouldbe",n.value);u.val(n[r["feed-with"]]);u.attr("data-autocomplete-shouldbe",n[r["feed-with"]]);u.valid()};i.blur(function(){var n=$.Event("keydown");n.keyCode=$.ui.keyCode.ENTER;i.trigger(n)}).autocomplete({source:function(n,t){$.ajax({url:r.api,dataType:"json",data:{s:n.term},success:function(n){$.each(n,function(n,t){t.label=t.Zipcode+" "+t.City;t.value=t[r.use]});t(n)}})},autoFocus:!0,select:function(n,t){f(t.item)}})},i.prototype.errorPlacement=function(n,t){n.addClass("form__item__note form__item__note--error");var i=t.closest("div");t.is(":radio")?t.closest(".form__group__items").append(n):t.is(":checkbox")?t.next("label").append(n):i.hasClass("form__item form__item--inline")?i.nextAll(".jq_errorPlacement:eq(0)").empty().append(n):n.insertAfter(t)},i.prototype.invalidHandler=function(){},i.prototype.highlight=function(n){$(n).closest("div.form__item").addClass("form__item--has-errors")},i.prototype.unhighlight=function(n){$(n).closest("div.form__item").removeClass("form__item--has-errors")},i.prototype.highlightGroup=function(n,t){var i=this;n.forEach(function(n){i.highlight(n.get(0),t)})},i.prototype.unhighlightGroup=function(n,t){var i=this;n.forEach(function(n){i.unhighlight(n.get(0),t)})},i.prototype.serialize=function(n){var t=n.serializeArray();return $.each(t,function(n,t){var r=$("[name='"+t.name+"']"),i;if(r.is("[data-selector='datepicker']"))try{i=t.value.split("/");t.value=i[2]+"-"+i[1]+"-"+i[0]}catch(u){t.value=null}}),t},i.prototype.submitHandler=function(n){var i=this;this.$summary.empty();var r=this.serialize($(n)),u=n.action,f={url:u,type:n.method,data:r,traditional:!0};t.Ajax.getData(f,{onSuccess:function(n){n.errorFields?i.displayFieldErrors(n.errorFields):i.goToStep(++i.step)},onValidationFailed:$.proxy(this.displayOtherErrors,this)})},i.prototype.displayOtherErrors=function(n){for(var t=0;t<n.length;t++)$("<li />").html(n[t]).appendTo(this.$summary)},i.prototype.displayFieldErrors=function(n){for(var t in n){var r=t+"-error",i=this.$form.find("[name='"+t+"']"),u=$('<div id="'+r+'">'+n[t]+"<\/div>");this.highlight(i.get(0),"form__item--has-errors");this.errorPlacement(u,i)}},i.prototype.goToStep=function(t){n.ServiceSelector.WaitPanel.increment();this.query.setParam("s",this.workflow[t]);this.query.setParam("e2e",this.e2e);this.query.setParam("serviceOfferId",this.serviceOfferId.toString());this.query.setParam("_track","1");window.location.search=this.query.build()},i.prototype.checkNoNumbers=function(n){return n.length===0?!0:/^[^0-9]*$/.test(n)},i.prototype.checkAutosuggest=function(n,t){var i=$(t),r;return n.length===0||i.is(":focus")?!0:(r=i.attr("data-autocomplete-shouldbe"),n===r)},i}(),r,u,f,e;i.SwitchFormBase=h;r=function(){function n(n){this._map=n}return n.prototype.k=function(n){if(this._map.hasOwnProperty(n))return n;for(var t in this._map)if(t.toLowerCase()===n.toLowerCase())return t;return n},n.prototype.getParam=function(n){return this._map[this.k(n)]},n.prototype.remove=function(n){delete this._map[this.k(n)]},n.prototype.setParam=function(n,t){this._map[this.k(n)]=t},n}();i.UnsensitiveMap=r;u=function(n){function t(){for(var t,r=window.location.search.substr(1).split("&"),u={},i=0;i<r.length;i++)t=r[i].split("="),u[decodeURIComponent(t[0])]=decodeURIComponent(t[1]);n.call(this,u)}return __extends(t,n),t.prototype.build=function(){var n=[];for(var t in this._map)n.push(encodeURIComponent(t)+"="+encodeURIComponent(this._map[t]));return"?"+n.join("&")},t}(r);i.UrlQuery=u;f=function(){function n(){$("[data-tooltip-trigger]").each(function(n,t){var i=$(t),r=i.attr("data-tooltip-trigger"),u=$("[data-tooltip='"+r+"']");i.click(function(n){n.preventDefault();u.toggle()})})}return n}();i.Tooltip=f;e=function(){function n(n){this.settings=n}return n.prototype.start=function(){this.timeoutId!=null&&clearTimeout(this.timeoutId);this.timeoutId=setTimeout($.proxy(this.pool,this),this.settings.delay*1e3)},n.prototype.pool=function(){var n=this;t.Ajax.getDataFromAction(this.settings.poolingController,this.settings.poolingAction,o+"="+this.settings.end2endProcessId+"&_="+(new Date).getTime(),null,{type:"GET",success:function(){n.start()}},{useErrorWindow:!1,useWaitPanel:!1})},n}();i.SessionPooling=e})(i=t.SwitchBase||(t.SwitchBase={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function t(){n.apply(this,arguments)}return __extends(t,n),t.prototype.initComponents=function(){var t=this,i;n.prototype.initComponents.call(this);this.$domicileAddressWrapper=$("#domicileAddress-wrapper");this.$domicileAddressInputs=$("[name^='DomicileAddress']");this.$domicileAddressInputs.is(":visible")||this.$domicileAddressInputs.attr("disabled","disabled");this.$radioDomicileAddress=$("[name='HasDomicileAddress']");this.$radioDomicileAddress.change(function(n){$(n.currentTarget).val().toLowerCase()==="true"?(t.$domicileAddressInputs.removeAttr("disabled"),t.$domicileAddressWrapper.slideDown()):t.$domicileAddressWrapper.slideUp(function(){t.$domicileAddressInputs.attr("disabled","disabled")})});i=$("#MemberBirthday");i.datepicker("option","yearRange","-130:+130");i.datepicker("option","defaultDate","-23y")},t}(n.SwitchBase.SwitchFormBase);t.SwitchFormContactInfo=i})(t=n.SwitchBeTelco||(n.SwitchBeTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function t(){n.apply(this,arguments)}return __extends(t,n),t.prototype.initComponents=function(){var t=this;n.prototype.initComponents.call(this);this.$billingAddressWrapper=$("#billingAddress-wrapper");this.$billingAddressInputs=this.$billingAddressWrapper.find("[name^='BillingAddress']");this.$billingAddressInputs.is(":visible")||this.$billingAddressInputs.attr("disabled","disabled");this.$chkHasDifferentBillingAddress=$("[name^='HasDifferentBillingAddress']");this.$chkHasDifferentBillingAddress.change(function(n){$(n.currentTarget).val().toLowerCase()==="true"?(t.$billingAddressInputs.removeAttr("disabled"),t.$billingAddressWrapper.slideDown()):t.$billingAddressWrapper.slideUp(function(){t.$billingAddressInputs.attr("disabled","disabled")})});this.$phoneProvidersDropdown=$("#CurrentPhoneProvider");this.$phoneProviderInfosWrapper=$("#CurrentPhoneProviderInfos");this.$phoneProviderInfosInputs=$("#PhoneNumberToConvert,#CustomerNumber,#CurrentOtherPhoneProvider");this.$otherPhoneProviderInput=$("#CurrentOtherPhoneProvider");this.$phoneProvidersDropdown.change($.proxy(this.phoneProviderChange,this));this.$phoneProvidersDropdown.change($.proxy(this.trackOtherProviderHandler,this,this.$otherPhoneProviderInput));this.$internetProvidersDropdown=$("#CurrentInternetProvider");this.$otherInternetProviderInput=$("#CurrentOtherInternetProvider");this.$internetProvidersDropdown.change($.proxy(this.trackOtherProviderHandler,this,this.$otherInternetProviderInput));this.$tvProvidersDropdown=$("#CurrentTvProvider");this.$otherTvProviderInput=$("#CurrentOtherTvProvider");this.$tvProvidersDropdown.change($.proxy(this.trackOtherProviderHandler,this,this.$otherTvProviderInput))},t.prototype.phoneProviderChange=function(){var t=this,n=this.$phoneProvidersDropdown.val();n!=-1&&n?(this.$phoneProviderInfosInputs.removeAttr("disabled"),this.$phoneProviderInfosWrapper.slideDown()):this.$phoneProviderInfosWrapper.slideUp(function(){t.$phoneProviderInfosInputs.attr("disabled","disabled")})},t.prototype.trackOtherProviderHandler=function(n,t){var r=$(t.currentTarget).val(),i=n.closest("div");r==-2?(this.$phoneProviderInfosWrapper.find("span[data-selector='optional']").show(),n.removeAttr("disabled"),i.slideDown()):(this.$phoneProviderInfosWrapper.find("span[data-selector='optional']").hide(),i.slideUp(function(){n.attr("disabled","disabled")}))},t}(n.SwitchBase.SwitchFormBase);t.SwitchFormCurrentContract=i})(t=n.SwitchBeTelco||(n.SwitchBeTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(n){function t(){n.apply(this,arguments)}return __extends(t,n),t.prototype.initComponents=function(){var t=this;n.prototype.initComponents.call(this);this.$activationTimeWrapper=$("#postponedActivationDate-wrapper");this.$activationTimeInputs=$("[name^='ActivationDate']");this.$activationTimeInputs.is(":visible")||this.$activationTimeInputs.attr("disabled","disabled");this.$radioActivationTime=$("[name='UseActivationDate']");this.$radioActivationTime.change(function(n){$(n.currentTarget).val()==="True"?(t.$activationTimeInputs.removeAttr("disabled"),t.$activationTimeWrapper.slideDown()):t.$activationTimeWrapper.slideUp(function(){t.$activationTimeInputs.attr("disabled","disabled")})})},t}(n.SwitchBase.SwitchFormBase);t.SwitchFormCustomerPreference=i})(t=n.SwitchBeTelco||(n.SwitchBeTelco={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),i.prototype.invalidHandler=function(){},i.prototype.submitHandler=function(t){var i=this;$("#switchConfirmationBlock button[type='submit']").addClass(" btn--waiting is-disabled").attr("disabled","");var u=t.action,f={url:u,type:t.method,data:$(t).serialize(),traditional:!0,async:!1},r="";n.Ajax.getData(f,{onSuccess:function(n){n.errorFields?i.displayFieldErrors(n.errorFields):(n.data&&n.data.Uri&&(r=n.data.Uri),setTimeout($.proxy(i.goToStep,i,++i.step),1))},onValidationFailed:$.proxy(this.displayOtherErrors,this),onError:function(){},useWaitPanel:!0});r&&window.open(r,"_blank")},i}(n.SwitchBase.SwitchFormBase);t.SwitchFormPersonalData=i})(t=n.SppSwitchBeEnergy||(n.SppSwitchBeEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";function i(){n.WaitPanel.increment();window.location.reload()}var r=function(t){function i(n,i){t.call(this,n);this.controllerName=i;this.switchLoginButton=this.component.find("[data-selector='switch-login-button']");this.switchRegisterButton=this.component.find("[data-selector='switch-register-button']");this.switchIframeBlock=this.component.find("[data-selector='switch-iframe-block']");this.switchIframe=this.component.find("[data-selector='switch-iframe']");this.switchLoginRegisterBlock=this.component.find("[data-selector='switch-login-register-block']");this.switchConfirmationBlock=this.component.find("[data-selector='switch-confirmation-block']");this.switchForm=this.component.find("[id='switch-form']");this.signInUrl=this.switchIframe.data("sign-in-url");this.registerUrl=this.switchIframe.data("register-url")}return __extends(i,t),i.prototype.initialize=function(){this.bindEvents();this.switchIframe!=null&&this.hideIframe()},i.prototype.bindEvents=function(){var n=this;this.switchLoginButton.on("click",function(t){n.addLoadingAnimation($(t.target));n.storeFormDataInSession();n.setIframeUrl(n.signInUrl);n.showIframe()});this.switchRegisterButton.on("click",function(t){n.addLoadingAnimation($(t.target));n.storeFormDataInSession();n.setIframeUrl(n.registerUrl);n.showIframe()})},i.prototype.addLoadingAnimation=function(n){n.addClass("btn--waiting")},i.prototype.showIframe=function(){this.switchLoginRegisterBlock.hide();this.switchIframeBlock.show()},i.prototype.hideIframe=function(){this.switchIframeBlock.hide();this.switchLoginRegisterBlock.show()},i.prototype.setIframeUrl=function(n){this.switchIframe.prop("src",n)},i.prototype.storeFormDataInSession=function(){var t=this.switchForm.find(":input").serialize();n.Ajax.getDataFromAction(this.controllerName,"SessionStoreSwitchFormData",null,t,null,{useWaitPanel:!1})},i}(n.BaseComponent);t.SwitchFormIframe=r;t.reloadPage=i})(t=n.SppSwitchBeEnergy||(n.SppSwitchBeEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),i.prototype.invalidHandler=function(){},i.prototype.submitHandler=function(t){var i=this;$("#switchConfirmationBlock button[type='submit']").addClass(" btn--waiting is-disabled").attr("disabled","");var u=t.action,f={url:u,type:t.method,data:$(t).serialize(),traditional:!0,async:!1},r="";n.Ajax.getData(f,{onSuccess:function(n){n.errorFields?i.displayFieldErrors(n.errorFields):(n.data&&n.data.Uri&&(r=n.data.Uri),setTimeout($.proxy(i.goToStep,i,++i.step),1))},onValidationFailed:$.proxy(this.displayOtherErrors,this),onError:function(){},useWaitPanel:!0});r&&window.open(r,"_blank")},i}(n.SwitchBase.SwitchFormBase);t.SwitchFormEnergyItPersonalData=i})(t=n.SppSwitchItEnergy||(n.SppSwitchItEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){var t;(function(n){var t;(function(t){"use strict";function i(){n.WaitPanel.increment();window.location.reload()}var r=function(t){function i(n,i){t.call(this,n);this.controllerName=i;this.switchLoginButton=this.component.find("[data-selector='switch-login-button']");this.switchRegisterButton=this.component.find("[data-selector='switch-register-button']");this.switchIframeBlock=this.component.find("[data-selector='switch-iframe-block']");this.switchIframe=this.component.find("[data-selector='switch-iframe']");this.switchLoginRegisterBlock=this.component.find("[data-selector='switch-login-register-block']");this.switchConfirmationBlock=this.component.find("[data-selector='switch-confirmation-block']");this.switchForm=this.component.find("[id='switch-form']");this.signInUrl=this.switchIframe.data("sign-in-url");this.registerUrl=this.switchIframe.data("register-url")}return __extends(i,t),i.prototype.initialize=function(){this.bindEvents();this.switchIframe!=null&&this.hideIframe()},i.prototype.bindEvents=function(){var n=this;this.switchLoginButton.on("click",function(t){n.addLoadingAnimation($(t.target));n.storeFormDataInSession();n.setIframeUrl(n.signInUrl);n.showIframe()});this.switchRegisterButton.on("click",function(t){n.addLoadingAnimation($(t.target));n.storeFormDataInSession();n.setIframeUrl(n.registerUrl);n.showIframe()})},i.prototype.addLoadingAnimation=function(n){n.addClass("btn--waiting")},i.prototype.showIframe=function(){this.switchLoginRegisterBlock.hide();this.switchIframeBlock.show()},i.prototype.hideIframe=function(){this.switchIframeBlock.hide();this.switchLoginRegisterBlock.show()},i.prototype.setIframeUrl=function(n){this.switchIframe.prop("src",n)},i.prototype.storeFormDataInSession=function(){var t=this.switchForm.find(":input").serialize();n.Ajax.getDataFromAction(this.controllerName,"SessionStoreSwitchFormData",null,t,null,{useWaitPanel:!1})},i}(n.BaseComponent);t.SwitchFormIframe=r;t.reloadPage=i})(t=n.SppSwitchItEnergy||(n.SppSwitchItEnergy={}))})(t=n.ServiceSelector||(n.ServiceSelector={}))}(EC||(EC={})),function(n){n(document).trigger("BundleSSL.Executed");n(function(){n(document).trigger("BundleSSL.Ready")})}(jQuery)