"use strict";var $j=jQuery,vfnz=null!==vfnz||void 0!==vfnz?window.vfnz||{}:vfnz;if("undefined"==typeof STATIC)var STATIC="/static";!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){function t(e){return e}function r(e){return decodeURIComponent(e.replace(s," "))}function i(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a.json?JSON.parse(e):e}catch(t){}}var s=/\+/g,a=e.cookie=function(s,n,o){if(void 0!==n){if(o=e.extend({},a.defaults,o),"number"==typeof o.expires){var d=o.expires,l=o.expires=new Date;l.setDate(l.getDate()+d)}return n=a.json?JSON.stringify(n):String(n),document.cookie=[a.raw?s:encodeURIComponent(s),"=",a.raw?n:encodeURIComponent(n),o.expires?"; expires="+o.expires.toUTCString():"",o.path?"; path="+o.path:"",o.domain?"; domain="+o.domain:"",o.secure?"; secure":""].join("")}for(var c=a.raw?t:r,h=document.cookie.split("; "),f=s?void 0:{},m=0,u=h.length;u>m;m++){var p=h[m].split("="),g=c(p.shift()),v=c(p.join("="));if(s&&s===g){f=i(v);break}s||(f[g]=i(v))}return f};a.defaults={},e.removeCookie=function(t,r){return void 0!==e.cookie(t)?(e.cookie(t,"",e.extend({},r,{expires:-1})),!0):!1}}),vfnz=window.vfnz||{},vfnz.uploadVideo={updateVideoHeightOnLoadImage:function(e){$j(e).parent().find("video").css("height",$j(e).parent().css("height"))},prepareUploadVideoModalOptions:function(){var e=$j('a[data-reveal-id^="videostream_"]');e&&e.each(function(e,t){$j(t).data({animation:"fade"})})},onClickPlayIcon:function(e){"none"===$j('video[data-tag="inlineVideoTag-'+e+'"]').css("display")&&($j('video[data-tag="inlineVideoTag-'+e+'"]').css("display","block"),$j('img[data-tag="inlineImageTag-'+e+'"]').css("display","none"))}},$j(document).ready(function(){vfnz.uploadVideo.prepareUploadVideoModalOptions()});var idmService={IDM_MIN_PASSWORD_LENGTH:6,IDM_MIN_REGISTER_AGE_YEARS:5,IDM_MAX_REGISTER_AGE_YEARS:110,prevInput:"",authenticate:function(e,t,r){var i=JSON.stringify({username:t,password:r});return $j.ajax(e,this.buildRequest("POST",i))},buildRequest:function(e,t){var r={"Content-Type":"application/json","x-request-application":this.getRequestApp()},i={headers:r,method:e};return t&&(i.data=t),i},completePasswordReset:function(e,t){var r=JSON.stringify({newPassword:t});return $j.ajax(e,this.buildRequest("PATCH",r))},isMobileDevice:function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},isXSessionRedirect:function(){return"redirect"===this.getSessionCookie()},getRedirectUrl:function(e){if("ATG"!==this.getRequestApp())return"";if(e&&e.length)for(var t=window.location.pathname,r=0;rs)){var a=t.substr(s,i.length);if(a===t)return""}}return window.location.pathname+window.location.search},getResponseException:function(e){try{return JSON.parse(e.responseText).exception}catch(t){return""}},getResponseExceptionMessage:function(e){try{return JSON.parse(e.responseText).message}catch(t){return""}},getParsedResponse:function(e){try{return JSON.parse(e.responseText)}catch(t){return[]}},getErrorDataFromResponseData:function(e,t,r,i,s,a){for(var n={},o=0;o=0){var a=this.isMobileDevice();a?(a=r,e=e.replace("[[number]]",''+a+"")):(a=r,e=e.replace("[[number]]",""+a+""))}return null!=i&&null!=s&&e.indexOf("[[resetLink]]")>=0&&(e=e.replace("[[resetLink]]",'reset password")),e.indexOf("[[forgotPasswordLink]]")>=0&&(e=e.replace("[[forgotPasswordLink]]",'')),e},unserializeErrorMessages:function(e){try{return null==e||""==e?[]:JSON.parse(e)}catch(t){return[]}},getRequestApp:function(){var e;return e=this.isXSessionRedirect()&&""!==window.vf_referrer?window.vf_referrer:window.location.pathname,e=e.substr(1,e.substr(1).indexOf("/")),"myvodafone"===e?"MyVf":"shop"===e?"ATG":"CMS"},getSessionCookie:function(){return $j.cookie("x-session")},logout:function(e){return $j.ajax(e,this.buildRequest("DELETE"))},registerUser:function(e,t,r,i,s,a){var n=JSON.stringify({username:t,password:r,firstname:i,lastname:s,dob:a});return $j.ajax(e,this.buildRequest("POST",n))},resendRegisterEmail:function(e,t){var r=JSON.stringify({email:t});return $j.ajax(e,this.buildRequest("PUT",r))},removeCookie:function(e){$j.removeCookie(e,{path:"/"})},sendEmail:function(e,t){var r=JSON.stringify({username:t});return $j.ajax(e,this.buildRequest("PUT",r))},validatePasswordAgainstRequirements:function(e){return null==e||e.length-1?!1:idmService.isValidEmailAddress(e)},isValidEmailAddress:function(e){return/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)},validateNameAgainstRequirements:function(e){if(null==e||0==e.length)return!1;var t=/\#|\%|\(|\)|\[|\{|\]|\}|\\|\'|\<|\,|\.|\>|\/|\""|\;|\:|\--|script|iframe|alert/g;return t.test(e)?!1:!0},validateCaptchaAgainstRequirements:function(e){return null==e||0==e.length?!1:!0},validateBirthDate:function(e){String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")});var t=e.trim();if(""==t)return!0;var r=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,i=r.exec(t);if(null==i)return!1;var s=parseInt(i[1]),a=parseInt(i[2]),n=parseInt(i[3]),o=new Date(n,a-1,s);if(o.getDate()!=s||o.getMonth()+1!=a||o.getFullYear()!=n)return!1;var d=new Date;return d.setFullYear(d.getFullYear()-idmService.IDM_MIN_REGISTER_AGE_YEARS),o>d?!1:(d.setFullYear(d.getFullYear()-(idmService.IDM_MAX_REGISTER_AGE_YEARS-idmService.IDM_MIN_REGISTER_AGE_YEARS)),d>o?!1:!0)},validateToken:function(e){return $j.ajax(e,this.buildRequest("GET"))},validateCaptcha:function(e,t){var r=JSON.stringify({captchaText:t});return $j.ajax(e,this.buildRequest("POST",r))},validateEmailToken:function(e){return $j.ajax(e,this.buildRequest("POST"))},resendEmailToken:function(e){return $j.ajax(e,this.buildRequest("PUT"))},printLogs:function(e,t){var r=window.location.host,i=r.split("."),s=i[0];("dev"==s||"deva"==s||"devb"==s||"localhost"==r)&&console.info(e,t)},validateResetPasswordToken:function(e){return $j.ajax(e,this.buildRequest("GET"))},sendOtp:function(e,t){return $j.ajax(e,this.buildOtpRequest("GET",t))},resendOtp:function(e){return $j.ajax(e,this.buildRequest("PUT"))},resetPreIdmPassword:function(e,t){var r=JSON.stringify({newPassword:t});return $j.ajax(e,this.buildRequest("PATCH",r))},buildOtpRequest:function(e,t){var r={"Content-Type":"application/json","x-request-application":this.getRequestApp(),"x-otp":t},i={headers:r,method:e};return i},parseNumbers:function(e){var t=e.match(/(\d{1,2})?(\d{1,2})?(\d{1,4})?/);return{day:t[1]||"",month:t[2]||"",year:t[3]||""}},cleanInput:function(e){return e.replace(/[^0-9]/g,"")},getSeparator:function(e,t){return 2===e.length||t?"/":""},addSeparators:function(e,t,r){var i=this.getSeparator(e,t),s=this.getSeparator(t,r);return e+i+t+s+r},wasDelete:function(e,t){return e.length>t.length},wasDeleteOnEnd:function(e,t){return e.slice(-1)!==t.slice(-1)},hadSeparator:function(e){return"/"===e.slice(-1)},formatDobInput:function(e){var t=this.parseNumbers(this.cleanInput(e)),r=this.addSeparators(t.day,t.month,t.year);return this.wasDelete(idmService.prevInput,e)&&this.wasDeleteOnEnd(idmService.prevInput,e)&&this.hadSeparator(idmService.prevInput)&&e.length>1&&(r=r.slice(0,-2)),idmService.prevInput=r,r},isInReactApp:function(){return window.navigator?window.navigator.userAgent.includes("VFNZReact"):!1},postReactMessage:function(e){window.__REACT_WEB_VIEW_BRIDGE&&window.__REACT_WEB_VIEW_BRIDGE.postMessage?window.__REACT_WEB_VIEW_BRIDGE.postMessage(e):window.postMessage(e,"*")}},forgotCtrl={parent:null,formBinder:null,sendEmailAgainFlag:!1,resendOtpAgainFlag:!1,url:"",confirmOtpUrl:"",resendconfirmOtpUrl:"",msisdn:"",otpCounter:0,init:function(e){this.parent=e,this.bindListeners(),this.setupForm(),this.type=this.parent.getQueryVariable("type"),this.username=this.parent.getQueryVariable("username"),this.formSignInBinder=$j(e.dialog).find('[data-vft="login-form"]'),this.username&&($j(this.formBinder).find(".emailBinder").val(this.username),$j(this.formSignInBinder).find(".usernameBinder").val(this.username))},reinititalize:function(){this.formBinder=$j(this.parent.dialog).find('[data-vft="forgot-password-form"]'),this.formOtpBinder=$j(this.parent.dialog).find('[data-vft="pre-idm-otp-form"]'),this.formOtpResetBinder=$j(this.parent.dialog).find('[data-vft="pre-idm-reset-password-form"]');var e=$j(this.formSignInBinder).find(".usernameBinder").val();$j(this.formBinder).find(".emailBinder").val(e);var t=this.formBinder.find(".forgot-password-form").data("module-instances")._validation;t.updateSubmitState(),$j(this.formBinder).find(".excess-request-form").hide(),$j(this.formOtpBinder).find(".excess-otp-request-form").hide()},bindListeners:function(){$j(this.parent.body).off("click",".forgot-password-form .sendEmailButtonBinder"),$j(this.parent.body).on("click",".forgot-password-form .sendEmailButtonBinder",this.onSendEmail.bind(this)),$j(this.parent.body).off("click",".forgot-password-form .sendEmailAgainBinder"),$j(this.parent.body).on("click",".forgot-password-form .sendEmailAgainBinder",this.onResend.bind(this)),$j(this.parent.body).off("click",".pre-idm-otp-form .submitOtpBinder"),$j(this.parent.body).on("click",".pre-idm-otp-form .submitOtpBinder",this.onSendOtpCode.bind(this)),$j(this.parent.body).off("click",".pre-idm-otp-form .resendOtpAgainBinder"),$j(this.parent.body).on("click",".pre-idm-otp-form .resendOtpAgainBinder",this.onResendOtp.bind(this)),$j(this.parent.body).off("click",".pre-idm-otp-form .backButtonbinder"),$j(this.parent.body).on("click",".pre-idm-otp-form .backButtonbinder",this.backButton.bind(this))},setupForm:function(){this.formBinder=$j(this.parent.body).find('[data-vft="forgot-password-form"]');var e=this.formBinder.attr("data-forgot-password-sub-headline"),t=this.formBinder.attr("data-invalid-email-error");if(this.formOtpBinder=$j(this.parent.dialog).find('[data-vft="pre-idm-otp-form"]'),this.formOtpResetBinder=$j(this.parent.dialog).find('[data-vft="pre-idm-reset-password-form"]'),e){var r=this.parent.getSupportNumber(this.formBinder);e=e.replace("[[number]]",''+r+""),this.formBinder.find(".subHeadlineBinder").html(e),t=t.replace("[[number]]",''+r+""),this.formBinder.find("#email-error-invalid").html(t)}},onResend:function(){this.sendEmailAgainFlag=!0,this.send($j(this.formBinder).find(".emailBinder").val())},onSendEmail:function(e){e.preventDefault(),this.formBinder=$j(this.parent.dialog).find('[data-vft="forgot-password-form"]');var t=$j(this.formBinder).find(".captchaBinder").val();$j(this.formBinder).find(".forgotPasswordErrorMessageBinder").hide(),this.sendEmailAgainFlag=!1,this.capatchaValidationUrl=this.formBinder.attr("data-captcha-validation-url"),this.url=this.formBinder.attr("data-forgot-password-submit-url"),this.validateCaptcha(t)},send:function(e){idmService.sendEmail(this.url,e).then(this.successCallback.bind(this),this.failureCallback.bind(this))},successCallback:function(e){if(this.showRequestInProgress(!1),this.resendOtpAgainFlag=!1,e.preIdm===!0){this.msisdn=e.linkedMsisdn,this.msisdn=this.msisdn.replace(/\s/g,""),this.msisdn=this.msisdn.replace(/^(64|\+64|0064|001164)/,"0"),this.msisdn.match(/^02/)?this.msisdn=this.msisdn.substring(0,3)+" "+this.msisdn.substring(3,6)+" "+this.msisdn.substring(6):this.msisdn.match(/^(0800|0508)/)?this.msisdn=this.msisdn.substring(0,4)+" "+this.msisdn.substring(4):this.msisdn.match(/^0/)&&(this.msisdn=this.msisdn.substring(0,2)+" "+this.msisdn.substring(2,5)+" "+this.msisdn.substring(5)),$j(this.formBinder).find(".forgot-password-form").hide(),$j(this.formBinder).find(".forgot-password-success-form-error").hide(),$j(this.formBinder).find(".forgot-password-success-form-detail").hide(),$j(this.formOtpBinder).find(".otpCodeBinder").val(""),$j(this.formOtpBinder).find(".otpCodeBinder").attr("disabled",!1),$j(this.formOtpBinder).find(".subHeadBinder").show(),$j(this.formOtpBinder).find(".confirmOtpErrorMessageBinder").hide(),$j(this.formOtpBinder).find(".successMessageBinder").hide();var t=this.formOtpBinder.attr("data-pre-idm-sub-headline");t=t.replace("[[number]]",'
'+this.msisdn+"
"),$j(this.formOtpBinder).find(".subHeadBinder").html(t),$j(this.formBinder).find(".pre-idm-otp-confirmation-form").show();var r=this.formOtpBinder.find(".pre-idm-otp-form").data("module-instances")._validation;r.updateSubmitState()}else{if(this.sendEmailAgainFlag)$j(this.formBinder).find(".emailLabelBinder").html(this.formBinder.attr("data-forgot-password-alt-text"));else{$j(this.formBinder).find(".emailLabelBinder").html(this.formBinder.attr("data-forgot-password-email-label"));var i=$j.trim($j(this.formBinder).find(".emailBinder").val());$j(this.formBinder).find(".emailBinder").html(i)}$j(this.formBinder).find(".forgot-password-form").hide(),$j(this.formBinder).find(".forgot-password-success-form-error").hide(),$j(this.formBinder).find(".pre-idm-otp-confirmation-form").hide(),$j(this.formBinder).find(".forgot-password-success-form-detail").show()}},failureCallback:function(e){if(this.showRequestInProgress(!1),200==e.status)this.successCallback();else{var t=this.parent.getAuthErrorDataFromResponseData("data-forgot-password-error-messages",e,this.formBinder);this.displayForgotPasswordError(t.title,t.message),$j(this.formBinder).find(".forgot-password-success-form-error .sendEmailAgainBinder").hide(),t.isFatalFormError&&($j(this.formBinder).find(".forgot-password-form").hide(),$j(this.formBinder).find(".excess-request-form").show())}},displayForgotPasswordError:function(e,t){t=idmService.replaceTokensInErrorMessage(t,this.parent.getMobileNumber(this.formBinder),this.parent.getLandlineNumber(this.formBinder),this.formBinder.attr("data-reset-link"),this.formBinder.attr("data-open-in")),$j(this.formBinder).find(".forgotPasswordErrorMessageTitleBinder").html(e),$j(this.formBinder).find(".forgotPasswordErrorMessageDescriptionBinder").html(t),$j(this.formBinder).find(".forgotPasswordErrorMessageBinder").show(),this.sendEmailAgainFlag&&($j(this.formBinder).find(".forgot-password-success-form-detail").hide(),$j(this.formBinder).find(".forgot-password-success-form-error").show())},validateCaptcha:function(e){this.showHideCaptchaError("",!1),this.showRequestInProgress(!0),idmService.validateCaptcha(this.capatchaValidationUrl,e).then(this.captchaValidateSuccessCallback.bind(this),this.captchaValidateFailureCallback.bind(this))},captchaValidateSuccessCallback:function(){this.send($j(this.formBinder).find(".emailBinder").val())},captchaValidateFailureCallback:function(e){if(this.showRequestInProgress(!1),200==e.status)this.captchaValidateSuccessCallback();else{var t=this.parent.getAuthErrorDataFromResponseData("data-forgot-password-error-messages",e,this.formBinder);$j(this.formBinder).find(".forgot-password-success-form-error .sendEmailAgainBinder").hide(),this.showHideCaptchaError(t.message,!0)}},showHideCaptchaError:function(e,t){t?($j(this.formBinder).find("#captcha-error-invalid").html(e).show(),$j(this.formBinder).find("#captcha-error").show()):($j(this.formBinder).find("#captcha-error-invalid").hide(),$j(this.formBinder).find("#captcha-error").hide())},showRequestInProgress:function(e){var t=this.formBinder.attr("data-forgot-password-submit-processing-text"),r=this.formBinder.attr("data-forgot-password-submit-text");e?$j(this.parent.body).find(".forgot-password-form .sendEmailButtonBinder").text(t).addClass("ellipsis-loading"):$j(this.parent.body).find(".forgot-password-form .sendEmailButtonBinder").text(r).removeClass("ellipsis-loading")},showOtpRequestInProgress:function(e){var t=this.formOtpBinder.attr("data-confirm-otp-submit-processing-text"),r=this.formOtpBinder.attr("data-confirm-otp-submit-text");e?$j(this.parent.body).find(".pre-idm-otp-form .submitOtpBinder").text(t).addClass("ellipsis-loading"):$j(this.parent.body).find(".pre-idm-otp-form .submitOtpBinder").text(r).removeClass("ellipsis-loading")},onSendOtpCode:function(e){e.preventDefault(),this.onOtpSend(this.formOtpBinder.find(".otpCodeBinder").val())},onOtpSend:function(e){this.showOtpRequestInProgress(!0),this.confirmOtpUrl=this.formOtpBinder.attr("data-pre-idm-otp-submit-url"),idmService.sendOtp(this.confirmOtpUrl,e).then(this.successOtpCallback.bind(this),this.failureOtpCallback.bind(this))},successOtpCallback:function(){if(this.showOtpRequestInProgress(!1),$j(this.formBinder).find(".forgot-password-form").hide(),$j(this.formBinder).find(".forgot-password-success-form-error").hide(),$j(this.formBinder).find(".forgot-password-success-form-detail").hide(),$j(this.formBinder).find(".pre-idm-otp-confirmation-form").hide(),$j(this.formOtpResetBinder).find(".passwordBinder").val(""),$j(this.formOtpResetBinder).find(".resetPasswordSystemErrorMessageBinder").hide(),idmService.isInReactApp()){var e=$j.cookie("x-resetPassword");return void idmService.postReactMessage("OTP_SUCCESS:"+e,"*")}$j(this.formBinder).find(".preidm-password-success-form").show();var t=this.formOtpResetBinder.find(".pre-idm-reset-password").data("module-instances")._validation;t.updateSubmitState()},failureOtpCallback:function(e){if(this.showOtpRequestInProgress(!1),200==e.status)this.successOtpCallback(e);else{var t=this.parent.getAuthErrorDataFromResponseData("data-pre-idm-error-messages",e,this.formOtpBinder);$j(this.formOtpBinder).find(".subHeadBinder").show(),$j(this.formOtpBinder).find(".confirmOtpErrorMessageBinder").show(),$j(this.formOtpBinder).find(".successMessageBinder").hide(),this.displayConfirmOtpError(t.title,t.message,t.webServiceErrorMessage,e)}},displayConfirmOtpError:function(e,t,r,i){var s=idmService.getResponseExceptionMessage(i);if(r===s&&(this.otpCounter=this.otpCounter+1),this.otpCounter>3){t=idmService.replaceTokensInErrorMessage(t,this.parent.getMobileNumber(this.formBinder),this.parent.getLandlineNumber(this.formBinder),this.formBinder.attr("data-reset-link"),this.formBinder.attr("data-open-in")),$j(this.formOtpBinder).find(".otpCodeBinder").val(""),$j(this.formOtpBinder).find(".otpCodeBinder").attr("disabled",!0);var a=this.formOtpBinder.attr("data-alt-error-text"),n=this.formOtpBinder.find(".pre-idm-otp-form").data("module-instances")._validation;n.updateSubmitState();var o=this.formOtpBinder.attr("data-pre-idm-resendOtp-link-text");t=t.replace(t,a);var d=''+o+"";$j(this.formOtpBinder).find(".confirmOtpErrorMessageTitleBinder").html(e),$j(this.formOtpBinder).find(".confirmOtpErrorMessageDescriptionBinder").html(t+d),$j(this.formOtpBinder).find(".confirmOtpErrorMessageBinder").show()}else t=idmService.replaceTokensInErrorMessage(t,this.parent.getMobileNumber(this.formBinder),this.parent.getLandlineNumber(this.formBinder),this.formBinder.attr("data-reset-link"),this.formBinder.attr("data-open-in")),$j(this.formOtpBinder).find(".confirmOtpErrorMessageTitleBinder").html(e),$j(this.formOtpBinder).find(".confirmOtpErrorMessageDescriptionBinder").html(t),$j(this.formOtpBinder).find(".confirmOtpErrorMessageBinder").show()},onResendOtp:function(e){e.preventDefault(),this.resendconfirmOtpUrl=this.formOtpBinder.attr("data-pre-idm-resendOtp-url"),this.resendOtp($j(this.formOtpBinder).find(".otpCodeBinder").val())},resendOtp:function(){this.otpCounter=0,idmService.resendOtp(this.resendconfirmOtpUrl).then(this.successResendOtpCallback.bind(this),this.failureResendOtpCallback.bind(this))},successResendOtpCallback:function(e){if($j(this.formOtpBinder).find(".subHeadBinder").hide(),$j(this.formOtpBinder).find(".confirmOtpErrorMessageBinder").hide(),$j(this.formOtpBinder).find(".otpCodeBinder").attr("disabled",!1),this.resendOtpAgainFlag){this.resendOtpAgainFlag=!1;var t=this.formOtpBinder.attr("data-alt-success-message")}else{var t=this.formOtpBinder.attr("data-success-message");this.resendOtpAgainFlag=!0}t=idmService.isMobileDevice()?t.replace("[[number]]",""+this.msisdn+""):t.replace("[[number]]","
"+this.msisdn+"
"),$j(this.formOtpBinder).find(".successMessageTitleBinder").html(t),$j(this.formOtpBinder).find(".successMessageBinder").show()},failureResendOtpCallback:function(e){if(200==e.status)this.successOtpCallback(e);else{var t=this.parent.getAuthErrorDataFromResponseData("data-pre-idm-error-messages",e,this.formOtpBinder);$j(this.formOtpBinder).find(".subHeadBinder").show(),$j(this.formOtpBinder).find(".confirmOtpErrorMessageBinder").show(),$j(this.formOtpBinder).find(".successMessageBinder").hide(),this.displayResendOtpError(t.title,t.message),t.isFatalFormError&&($j(this.formOtpBinder).find(".pre-idm-otp-form").hide(),$j(this.formOtpBinder).find(".excess-otp-request-form").show())}},displayResendOtpError:function(e,t){t=idmService.replaceTokensInErrorMessage(t,this.parent.getMobileNumber(this.formBinder),this.parent.getLandlineNumber(this.formBinder),this.formBinder.attr("data-reset-link"),this.formBinder.attr("data-open-in")),$j(this.formOtpBinder).find(".confirmOtpErrorMessageTitleBinder").html(e),$j(this.formOtpBinder).find(".confirmOtpErrorMessageDescriptionBinder").html(t),$j(this.formOtpBinder).find(".confirmOtpErrorMessageBinder").show()},backButton:function(){this.otpCounter=0,$j(this.formBinder).find(".forgot-password-form").show(),$j(this.formBinder).find(".emailBinder").val(""),$j(this.formBinder).find(".captchaBinder").val("");var e=this.formBinder.find(".forgot-password-form").data("module-instances")._validation;e.updateSubmitState(),$j(this.formBinder).find(".pre-idm-otp-confirmation-form").hide()}},registerCtrl={parent:null,formBinder:null,formsSetup:!1,formSetupAttempts:0,formSetupMaxAttempts:15,formSetupWaitTimeMS:200,registerFormRequiredFieldNames:["email","password","first-name","last-name","captcha"],registerFormOptionFieldNames:["date-of-birth"],setupForms:[],registerFormDisplayNameLookup:{email:"an email address",password:"a password","first-name":"your first name","last-name":"your last name","date-of-birth":"a valid date of birth (DD/MM/YYYY)",captcha:"the text you see below"},registerFormFieldNames:[],originalEmailSent:!1,validationFunctionLookup:{},buttonDisabledClass:"button--disabled",toggleButtonHideClass:"icon--silver",toggleButtonShowClass:"icon--black",init:function(e){this.parent=e,idmService.prevInput="",this.registerFormFieldNames=this.registerFormRequiredFieldNames.concat(this.registerFormOptionFieldNames),this.validationFunctionLookup={password:idmService.validatePasswordAgainstRequirements,email:idmService.validateEmailAddressAgainstRequirements,"first-name":idmService.validateNameAgainstRequirements,"last-name":idmService.validateNameAgainstRequirements,"date-of-birth":idmService.validateBirthDate,captcha:idmService.validateCaptchaAgainstRequirements},this.token=idmCtrl.getQueryVariable("token"),this.type=idmCtrl.getQueryVariable("type"),this.token||"register"!=this.type?"register"==this.type&&this.registerEmailVerification():$j(this.parent.dialog).find(".register-form-container").show(),this.formSetupAttempts=0,this.setupForms=[],this.setupFormContainers()},reinititalize:function(e){this.originalEmailSent=!1},displayFormErrorInFormContainer:function(e,t,r){var i=this.getAssetIdForFormContainer(e);$j("#form-error-title-"+i).text(t),$j("#form-error-message-"+i).html(this.formatErrorMessage(e,r)),idmService.isInReactApp()?$j(this.getFormErrorDisplayInForm(e)).show(0,function(){$j(".login-resetpassword-link").on("click",function(){idmService.postReactMessage("REGISTER_RESET-REDIRECT","*")})}):$j(this.getFormErrorDisplayInForm(e)).show()},displayCaptchaFormErrorInFormContainer:function(e,t,r){var i=this.getAssetIdForFormContainer(e);r?($j("#captcha-error-invalid-"+i).html(t).show(),$j("#captcha-error-"+i).show()):($j("#captcha-error-invalid-"+i).hide(),$j("#captcha-error-"+i).hide())},formatErrorMessage:function(e,t){return idmService.replaceTokensInErrorMessage(t,$j(e).attr("data-mobile-support-number"),$j(e).attr("data-landline-support-number"),null,null)},setupFormContainers:function(){var e=$j(this.parent.dialog).find(".form--register");if(e.length!=this.setupForms.length)for(var t=0;t0:!1}),r=0;r'+i+""),$j(this.formPreIdmResetPasswordBinder).find(".preIdmResetPasswordErrorMessageTitleBinder").html(e),$j(this.formPreIdmResetPasswordBinder).find(".preIdmResetPasswordErrorMessageDescriptionBinder").html(r),$j(this.formPreIdmResetPasswordBinder).find(".resetPasswordSystemErrorMessageBinder").show()},redirect:function(e){e.preventDefault(),$j(this.formForgotBinder).find(".forgot-password-form").show(),$j(this.formForgotBinder).find(".emailBinder").val(""),$j(this.formForgotBinder).find(".captchaBinder").val("");var t=this.formForgotBinder.find(".forgot-password-form").data("module-instances")._validation;t.updateSubmitState(),$j(this.formForgotBinder).find(".pre-idm-otp-confirmation-form").hide(),$j(this.formForgotBinder).find(".preidm-password-success-form").hide()},successAutoLoginCallback:function(){var e=this.formSignInBinder.attr("data-blacklist"),t=idmService.getRedirectUrl(e),r=$j(".landing-redirection").val();if(""===t){var i=this.formSignInBinder.attr("data-login-redirect");t=i+window.vf_referrer,"undefined"!=typeof r&&(sessionStorage&&""!=window.vf_referrer&&sessionStorage.setItem("vf_referrer",window.vf_referrer),t=i)}"undefined"!=typeof r&&vfnz.headerCtrl.destroyCookieAfterLogin(),window.location=t},failureAutoLoginCallback:function(e){if(200==e.status)this.successAutoLoginCallback(e);else{this.showPreIdmRequestInProgress(!1);var t=(this.formPreIdmResetPasswordBinder.attr("data-pre-idm-post-reset-redirect"),this.formPreIdmResetPasswordBinder.attr("data-pre-idm-reset-success-text")),r=this.formPreIdmResetPasswordBinder.attr("data-pre-idm-reset-success-title");this.parent.hideLoginTitleTab(!1);var i=this.getLoginFormBinder();$j(i).find(".list").removeClass("login__frames--first"),$j(i).find(".successMessageBinder .errorMessageTitleBinder").text(r),$j(i).find(".successMessageBinder .errorMessageDescriptionBinder").text(t),$j(i).find(".successMessageBinder").show(),$j(this.formForgotBinder).find(".forgot-password-form").show(),$j(this.formForgotBinder).find(".emailBinder").val(""),$j(this.formForgotBinder).find(".captchaBinder").val("");var s=this.formForgotBinder.find(".forgot-password-form").data("module-instances")._validation;s.updateSubmitState(),$j(this.formPreIdmResetPasswordBinder).find(".passwordBinder").val(""),$j(this.formForgotBinder).find(".preidm-password-success-form").hide()}}},signInCtrl={parent:null,formBinder:null,init:function(e){this.parent=e,this.bindListeners()},bindListeners:function(){this.parent.body.off("click",".ajax .login__framer .submitButtonBinder:visible"),this.parent.body.on("click",".ajax .login__framer .submitButtonBinder:visible",this.onSignInClick.bind(this))},onSignInClick:function(e){window.localStorage.removeItem("preIDM");var t=this.parent;this.formBinder=$j(t.dialog).find('[data-vft="login-form"]:visible');var r=this.formBinder.attr("data-submit-type");if("REST"===r){e.preventDefault(),$j(this.formBinder).find(".successMessageBinder").hide();var i=$j(this.formBinder).find("input.usernameBinder:visible").val();i=$j.trim(i);var s=$j(this.formBinder).find("input.passwordBinder:visible").val(),a=this.formBinder.attr("data-submit-url");idmService.authenticate(a,i,s).then(this.successCallback.bind(this),this.failureCallback.bind(this))}else $j(this.formBinder).find("input.usernameBinder:visible").removeAttr("required"),$j(this.formBinder).find("input.passwordBinder:visible").removeAttr("required")},successCallback:function(){var e=(this.parent,this.formBinder.attr("data-login-type"));localStorage.setItem("loginType",e);var t=this.formBinder.attr("data-blacklist"),r=idmService.getRedirectUrl(t),i=$j(".landing-redirection").val();if(""===r){var s=this.formBinder.attr("data-login-redirect");r=s+window.vf_referrer,"undefined"!=typeof i&&(sessionStorage&&""!=window.vf_referrer&&sessionStorage.setItem("vf_referrer",window.vf_referrer),r=s)}"undefined"!=typeof i&&vfnz.headerCtrl.destroyCookieAfterLogin(),window.location=r},failureCallback:function(e){if(200==e.status)this.successCallback();else{if("undefined"!=typeof $j(this.parent.dialog).find(".landing-redirection").val()&&400===e.status)this.checkUserVerificationStatus(e);else{var t=this.parent.getAuthErrorDataFromResponseData("data-error-messages",e,this.formBinder);this.parent.displayLoginError(this.formBinder,t.title,t.message)}vfnz.tealium&&vfnz.tealium.setTealiumEventToDataLayer("page_errors",e,"myvf-web:sign in")}},checkUserVerificationStatus:function(e){var t=idmService.getParsedResponse(e),r=$j(this.formBinder).find("input.usernameBinder:visible").val();r=$j.trim(r);var i=idmService.isValidEmailAddress(r);if("UserUnverified"!=t.error&&"PreIdmUser"!=t.error||!i){var s=this.parent.getAuthErrorDataFromResponseData("data-error-messages",e,this.formBinder);this.parent.displayLoginError(this.formBinder,s.title,s.message)}else vfnz.headerCtrl.destroyCookieAfterLogin(),this.redirectUnVerifiedUser(r)},redirectUnVerifiedUser:function(e){var t=this.formBinder.attr("data-unverifiedUser-redirect");t&&($j.cookie("vf-unverified-user",e,{path:"/myvodafone",secure:!0,domain:".vodafone.co.nz"}),window.location=t)}},idmCtrl={refreshCount:0,bindListeners:function(){var e=this;$j(this.body).on("click",".ajax .login-forgot-link:visible , .ajax .login-register-link:visible , .ajax .login-resetpassword-link:visible",function(){$j(this).hasClass("login-forgot-link")?($j(e.dialog).find('[data-vft="reset-password-form"]').hide(),$j(e.dialog).find('[data-vft="forgot-password-form"]').show(),forgotCtrl.reinititalize(e)):$j(this).hasClass("login-resetpassword-link")?($j(e.dialog).find("#login__framer-list").removeClass("login__frames--last").addClass("login__frames--first"),$j(e.dialog).find('[data-vft="reset-password-form"]').hide(),$j(e.dialog).find('[data-vft="forgot-password-form"]').show(),forgotCtrl.reinititalize(e)):(registerCtrl.reinititalize(e),$j(e.dialog).find(".register-form-container").show()),e.refreshCaptchaText(),e.hideLoginTitleTab(!0)}),$j(this.body).on("click",".ajax button.back-to-login:visible",function(){e.hideLoginTitleTab(!1)}),$j(this.body).off("click","span.password-reveal"),$j(this.body).on("click","span.password-reveal",function(){var e,t,r=$j(this).parent().find("input"),i=$j(this).find("svg use"),s="#icon-viewed-show",a="#icon-viewed-hide";"password"==r.attr("type")?(e=a,t="text"):(e=s,t="password"),i.attr("xlink:href",e),r.attr("type",t)}),$j(this.body).off("click",".captcha-refresh"),$j(this.body).on("click",".captcha-refresh",function(){e.refreshCaptchaText()})},getMobileNumber:function(e){return e.attr("data-number-mobile")},getLandlineNumber:function(e){return e.attr("data-number-landline")},getSupportNumber:function(e){return idmService.isMobileDevice()?this.getMobileNumber(e):this.getLandlineNumber(e)},getAuthErrorDataFromResponseData:function(e,t,r){var i=r.attr(e),s=idmService.unserializeErrorMessages(i),a=idmService.getResponseException(t),n=idmService.getResponseExceptionMessage(t),o=r.attr("data-default-error-title"),d=r.attr("data-default-error-text");return idmService.getErrorDataFromResponseData(o,d,s,t.status,a,n)},displayLoginError:function(e,t,r){r=idmService.replaceTokensInErrorMessage(r,this.getMobileNumber(e),this.getLandlineNumber(e),e.attr("data-reset-link"),e.attr("data-open-in")),this.displayError(e,t,r)},getQueryVariable:function(e){var t=window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var r=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),i=r.exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},detectFormToDisplay:function(){var e=this.getQueryVariable("type"),t=["register","forgot","reset"];if(e&&-1!==$j.inArray(e,t)){switch(e){case"register":$j(this.dialog).find("#login__framer-list").addClass("login__frames--last");break;case"forgot":$j(this.dialog).find("#login__framer-list").addClass("login__frames--first"),$j(this.dialog).find('[data-vft="forgot-password-form"]').show();break;case"reset":$j(this.dialog).find("#login__framer-list").addClass("login__frames--first");break;default:console.info("unknown form type",e)}this.hideLoginTitleTab(!0)}},displayError:function(e,t,r){var i=e.attr("data-reset-link"),s=e.attr("data-open-in");if(r=r||"",r.indexOf("[[number]]")>=0){var a=this.getSupportNumber(e);r=r.replace("[[number]]",''+a+"")}else r.indexOf("[[resetLink]]")>=0&&(r=r.replace("[[resetLink]]",'reset password"));$j(e).find(".errorMessageTitleBinder").html(t),$j(e).find(".errorMessageDescriptionBinder").html(r),$j(e).find(".errorMessageBinder").show()},hideLoginTitleTab:function(e){e?($j(this.dialog).find(".login-headline--2").hide(),$j(this.dialog).find(".loginTabNav").hide()):($j("#dialog").scrollTop(0),$j(this.dialog).find(".login-headline--2").show(),$j(this.dialog).find(".loginTabNav").show(),$j(this.dialog).find(".register-form-container").hide(),$j(this.dialog).find('[data-vft="forgot-password-form"]').hide())},refreshCaptchaText:function(){this.refreshCount++,$j(this.dialog).find(".captcha-image").attr("src",$j(".captcha-image").attr("data-src")+this.refreshCount)},body:$j("body"),dialog:null,selectedLoginType:null,init:function(e){this.dialog=e,this.bindListeners(),this.detectFormToDisplay(),idmService.isXSessionRedirect()&&idmService.removeCookie("x-session"),forgotCtrl.init(this),signInCtrl.init(this),registerCtrl.init(this),resetCtrl.init(this)},standAlonePageInit:function(){var e=this;this.dialog=$j(document),this.bindListeners();var t=[{ctrl:forgotCtrl,id:"forgot-password-form"},{ctrl:resetCtrl,id:"reset-password-form"},{ctrl:registerCtrl,id:"idm-register-form"}];t.forEach(function(t){0!=$(document).find("div[data-vft="+t.id+"]").length&&t.ctrl.init(e)})}};$j(document).ready(function(){0!=$j(document).find("div.stand-alone-form").length&&idmCtrl.standAlonePageInit();var e=$j('[data-vft="login-dialog"] .ajax');"none"===e.css("display")&&e.show()}),$j(document).on("vf::dialog::loaded",function(e){var t=e.target;if(t){"login-dialog"===$j(t).attr("data-vft")&&idmCtrl.init(t),$j(t).find(".ajax").show();var r=$j(t).find(".js-dialog-content.dialog__content");"none"===r.css("display")&&r.show()}}),$j(document).on("vf::dialog::closed",function(e){var t=window.location.pathname,r=new RegExp("^/(email-verification|forgot-password)/","g"),i=r.test(t);if(i){var s=$j(dialog).find('[data-vft="login-form"]').attr("data-post-verification-redirection");window.location.href=s?s:"/"}}),function(){function e(){if(1==r.length){var e=[],t=3,i=0,s=r.find(".chevron").length,a=-1;r.find(".chevron").each(function(e,r){var i=$j(r).offset().top;return-1==a?(a=i,!0):i!=a?!1:void(t=e+1)}),r.find(".chevron").each(function(r,a){$j(a).outerHeight()>i&&(i=$j(a).outerHeight()),(r>0&&r%(t-1)==0||r==s-1)&&(e.push(i),i=0)}),r.find(".chevron").each(function(r,i){var s=Math.floor(r/t),a=e[s];$j(i).height(a)})}}function t(){r.find(".chevron").each(function(e,t){$j(t).height("auto")})}$j(document).ready(setTimeout(e,100));var r=$j(".level4-in-page-nav");$j(window).resize(function(){t(),e()})}();var vfnz=vfnz||{};vfnz.headerCtrl={cookieFlag:!1,sessionFlag:!1,LOGIN_NUDGE_COUNTER:"loginNudgeCounter",LOGIN_NUDGE_ACTIVE_CLASS:window.isWs2Version6Nav?"login-nudge-v6--active":"login-nudge--active",LOGIN_NUDGE_NO_SERVICE_FLAG:"loginNudgeNoServiceFlag",checkLogInStatusIntervaltimeout:3e5,loggedIn:!1,idmAuthUrl:$j("nav.header").attr("data-auth-url"),idmIdentityUrl:$j("nav.header").attr("data-identity-url"),logoutFailureMessage:$j("nav.header").attr("data-logout-failure-message"),idmAuthCookieName:"x-authorization",sessionCookie:$j.cookie("x-session"),checkLogInStatusInterval:{},cartHasItems:!1,counterLimit:0,sessionExpiryMessage:$j("nav.header").attr("data-session-expiry-message"),sessionExpiryCTALink:$j("nav.header").attr("data-session-expiry-ctaLink"),sessionExpiryCTALabel:$j("nav.header").attr("data-session-expiry-ctaLabel"),destroyCookie:["vf-unverified-user","vfUserType","vfSkipChangeSignIn","primaryMsisdn","x-msisdnToken"],destroyLocalStorage:["userEmail"],destroySessionStorage:["primaryMsisdn"],init:function(){this.setCounterLimit(parseInt($j("#loginNudgeLi").attr("counter-limit")));var e=parseInt($j.cookie(this.LOGIN_NUDGE_COUNTER));if(isNaN(e)?($j.cookie(this.LOGIN_NUDGE_COUNTER,0,{expires:30,path:"/"}),this.setCookieFlag(this.counterLimit>0)):this.setCookieFlag(et})}function i(e){var t=e.searchGroup;if(t){if(t===g.entertainment||t===g.vodafoneFoundation)return g.other;var r=Object.keys(g).filter(function(e){return t.toLowerCase()===g[e].toLowerCase()});if(r&&r.length)return g[r]}for(var i=0;i-1});if(a.length>0)return s.type}return g.other}function s(e,t,r){if(r[t]&&r[t].length){var i={type:t,items:r[t]};e.push(i)}}function a(){$searchParent.find(".search-overlay__search-results__empty__title").text("We couldn't find any results for \""+m+'"');for(var e=$j(".searchExampleTemplate"),t=e.find(".search-overlay__search-results__empty__results__mobile"),r=e.find(".search-overlay__search-results__empty__results"),i=0;i a").text(n[0]),t.find("span > a").attr("href",n[1]),r.find("li > a > span").text(n[0]),r.find("li > a").attr("href",n[1]),$searchParent.find(".search-overlay__search-results__examples").find(".search-overlay__search-results__empty__results__mobile").eq(i).append(t.html()),$searchParent.find(".search-overlay__search-results__examples").find(".search-overlay__search-results__empty__results").eq(i).append(r.html())}}d("search example")}function n(){m="",$searchParent.find("#search-overlay-input")[0].value="",$searchParent.find("#search-overlay-input")[0].focus(),o()}function o(){d("none"),$searchParent.find(".search-overlay__search-results__examples").empty(),$searchParent.find(".search-overlay__search-results__response").empty()}function d(e){var t="search response"==e?"block":"none",r="search example"==e?"block":"none";$searchParent.find(".search-overlay__search-results__response").css({display:t}),$searchParent.find(".search-overlay__search-results__view-all").css({display:t}),$searchParent.find(".search-overlay__search-results__empty").css({display:r})}function l(){c(),m&&e()}function c(){u&&(clearTimeout(u),u=null)}var h=2,f=500,m="",u=null,p=[["General",[["iPhone","/search?start=0&q=iphone"],["smartphone","/search?start=0&q=smartphone"],["Nokia","/search?start=0&q=nokia"]]],["Support",[["iPhone MMS","/search?start=0&q=iphone mms"],["roaming","/search?start=0&q=roaming"],["phone bill","/search?start=0&q=phone bill"]]],["Discussion",[["htc magic","/search?start=0&q=htc magic"],["how can I get kudos","/search?start=0&q=how can I get kudos"],["change avatar","/search?start=0&q=change avatar"]]]],g={shop:"Shop",storeLocations:"Store Locations",support:"Support",entertainment:"Entertainment",business:"Business",about:"About",vodafoneFoundation:"Vodafone Foundation",other:"Other"},v="www.vodafone.co.nz",w=[{type:g.shop,items:[v.concat("/shop"),v.concat("/iphone"),v.concat("/coming-soon"),v.concat("/specials-promos")]},{type:g.business,items:[v.concat("/business")]},{type:g.support,items:["help.vodafone.co.nz/app/answers",v.concat("/myaccount"),v.concat("/help")]},{type:g.about,items:[v.concat("/about")]}];$j("body").on("input",".search-overlay .search-overlay__input",function(t){m=t.currentTarget.value,c(),o(),m.length>=h&&(u=setTimeout(function(){e(m)},f))}),$j("body").on("click",".search-overlay .search-overlay__reset-button",function(){n()}),$j("body").on("click",".search-overlay .search-overlay__search-button",function(){l()})}),vfnz.ws2=window.vfnz||{},vfnz.ws2.postscript={init:function(){this.enableCloak(),this.enableMediaWedge(),this.updateCarouselEqualRow(),this.addCustomFormValidations()},pageLoad:function(){this.updateGridsEqualRow()},enableCloak:function(){$j(".ng-cloak").removeClass("ng-cloak")},enableMediaWedge:function(){if($j('[data-js="_mediaWedge"]').length){var e=$j(".js-tabs-tab");e.length&&e.on("click",function(){$j(window).trigger("vf::resize")});var t=$j(".accordion__item");t.length&&t.each(function(e){$j(this).has('[data-js="_mediaWedge"]').length&&$j(this).on("click",function(){$j(window).trigger("vf::resize")})}),$j(window).trigger("vf::resize")}},updateGridsEqualRow:function(){var e=$j(".card-eqrow");e.length&&(e.css("height","auto"),$j(window).trigger("vf::resize"))},updateCarouselEqualRow:function(){var e=$j(".carousel-eqrow");e.length&&$j(window).on("vf::carousel-load",function(){$j(window).trigger("vf::resize")})},addCustomFormValidations:function(){if($j("form").length){var e=$j("[phonenz]");e.length&&(jQuery.validator.addMethod("phoneNZ",function(e,t){return this.optional(t)||/^((\+?642)|(02))([0278](\s?)\d{3,4}(\s?)\d{4,5}|1(\s?)\d{3,4}(\s?)\d{3,5}|[69](\s?)\d{3}(\s?)\d{4})$/.test(e)},"Please enter a valid NZ mobile phone number (e.g. +64292345678, 021 569 8456)"),e.rules("add",{phoneNZ:!0}));var t=$j("[datenz]");if(t.length&&(jQuery.validator.addMethod("dateNZ",function(e,t){var r,i,s,a,n,o=!1,d=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return d.test(e)&&(r=e.split("/"),i=parseInt(r[0],10),s=parseInt(r[1],10),a=parseInt(r[2],10),n=new Date(Date.UTC(a,s-1,i,12,0,0,0)),o=n.getUTCFullYear()===a&&n.getUTCMonth()===s-1&&n.getUTCDate()===i),this.optional(t)||o},jQuery.validator.messages.date),t.rules("add",{dateNZ:!0})),window.validation_override_msgs&&$j.validator.messages)for(var r in window.validation_override_msgs){var i=window.validation_override_msgs[r];i&&($j.validator.messages[r]=window.validation_override_msgs[r])}$j(window).on("vf::validation-error",function(){vfnz.deepLinks.initValidationDeepLink()})}}},$j(window).on("load",function(){vfnz.ws2.postscript.pageLoad()}),$j(document).ready(function(){vfnz.ws2.postscript.init()}),vfnz.header_carousel={toggleHeaderControlArrow:function(){var e=window.carouselHeaderTag,t=$j("div[data-id="+e+"]");t&&t.find(".js-carousel-slides")&&t.find(".js-carousel-slides").click()}},$j(window).resize(function(){window.carouselHeaderTag&&vfnz.header_carousel.toggleHeaderControlArrow()}),$j(document).ready(function(){window.carouselHeaderTag&&vfnz.header_carousel.toggleHeaderControlArrow()});