var __assign=this&&this.__assign||function(){__assign=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a))r[a]=e[a]}return r};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(r,e,t,n){function a(r){return r instanceof t?r:new t((function(e){e(r)}))}return new(t||(t=Promise))((function(t,i){function o(r){try{l(n.next(r))}catch(r){i(r)}}function s(r){try{l(n["throw"](r))}catch(r){i(r)}}function l(r){r.done?t(r.value):a(r.value).then(o,s)}l((n=n.apply(r,e||[])).next())}))};var __generator=this&&this.__generator||function(r,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(r){return function(e){return l([r,e])}}function l(o){if(n)throw new TypeError("Generator is already executing.");while(t)try{if(n=1,a&&(i=o[0]&2?a["return"]:o[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;if(a=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:t.label++;return{value:o[1],done:false};case 5:t.label++;a=o[1];o=[0];continue;case 7:o=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){t=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){t.label=o[1];break}if(o[0]===6&&t.label<i[1]){t.label=i[1];i=o;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(o);break}if(i[2])t.ops.pop();t.trys.pop();continue}o=e.call(r,t)}catch(r){o=[6,r];a=0}finally{n=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./p-b6504987.system.js","./p-30c1ef36.system.js","./p-b2295bc5.system.js","./p-7b59e13c.system.js"],(function(r){"use strict";var e,t,n,a,i;return{setters:[function(r){e=r.k},function(r){t=r.L;n=r.v},function(r){a=r.j},function(r){i=r.u}],execute:function(){r("u",o);function o(r){var o=this;var s=t();var l=new URLSearchParams(window.location.search);var u=l===null||l===void 0?void 0:l.get("_saasquatch");var c=i(),f=c.registrationFormState,v=c.setRegistrationFormState;var d=n(),_=d[0],g=d[1],h=g.loading,p=g.errors,m=g.data;var y=e(""),b=y[0],w=y[1];var E=function(e){return __awaiter(o,void 0,void 0,(function(){var t,n,i,o,l,c,d;return __generator(this,(function(g){switch(g.label){case 0:w("");n=e.target.getFormControls();i=e.detail.formData;o={};n===null||n===void 0?void 0:n.map((function(e){if(!e.name)return;var t=e.name;var n=e.value;a.set(i,t,n);if(e.required&&!n){a.set(o,t,r.requiredFieldErrorMessage)}if(typeof e.validationError==="function"){var s=e.validationError;var l=s({control:e,key:t,value:n});if(l)a.set(o,t,l)}}));l=__assign({firstName:i.firstName,lastName:i.lastName,email:i.email,locale:s},(r===null||r===void 0?void 0:r.includeCookies)&&u?{cookies:u}:{});g.label=1;case 1:g.trys.push([1,3,,4]);return[4,_(l)];case 2:c=g.sent();if(c instanceof Error){throw c}v(__assign(__assign({},f),{loading:false,error:"",validationErrors:{}}));return[3,4];case 3:d=g.sent();if((t=d===null||d===void 0?void 0:d.message)===null||t===void 0?void 0:t.includes("is not valid")){v(__assign(__assign({},f),{loading:false,error:"",validationErrors:{email:r.invalidEmailErrorMessage}}))}else if((d===null||d===void 0?void 0:d.name)==="fraud_error"){v(__assign(__assign({},f),{loading:false,error:"FRAUD"}))}else{v(__assign(__assign({},f),{loading:false,error:r.networkErrorMessage,validationErrors:{}}))}return[3,4];case 4:return[2]}}))}))};return{states:{loading:h,error:f===null||f===void 0?void 0:f.error,registrationFormState:f},callbacks:{submit:E}}}}}}));