2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
import{x as S,_ as K,ae as z,ag as J,s as W,q as U,K as Z,J as w,N as X,D as ee,v as te,b as ne,V as ae,r as M,e as h,f as u,g as N,t as y,O as C,P as O,h as c,n as $,F as L,i as T,j as I,ac as re,ah as V,M as j,l as oe,E as se,w as ie,ai as le,a as ce,c as p,k as ue}from"./index.243aaeea.js";import{c as b,r as k,m as P,e as de,u as me}from"./index.esm.2bb3a7a3.js";import"./Main.bbf5bf30.js";import{_ as fe}from"./Main.50f21f28.js";import{_ as pe}from"./Main.76663f1a.js";var B={},D={},E={},he=S&&S.__awaiter||function(e,r,n,o){function i(t){return t instanceof n?t:new n(function(d){d(t)})}return new(n||(n=Promise))(function(t,d){function m(a){try{s(o.next(a))}catch(A){d(A)}}function g(a){try{s(o.throw(a))}catch(A){d(A)}}function s(a){a.done?t(a.value):i(a.value).then(m,g)}s((o=o.apply(e,r||[])).next())})},ye=S&&S.__generator||function(e,r){var n={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},o,i,t,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(s){return function(a){return g([s,a])}}function g(s){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,i&&(t=s[0]&2?i.return:s[0]?i.throw||((t=i.return)&&t.call(i),0):i.next)&&!(t=t.call(i,s[1])).done)return t;switch(i=0,t&&(s=[s[0]&2,t.value]),s[0]){case 0:case 1:t=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(t=n.trys,!(t=t.length>0&&t[t.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!t||s[1]>t[0]&&s[1]<t[3])){n.label=s[1];break}if(s[0]===6&&n.label<t[1]){n.label=t[1],t=s;break}if(t&&n.label<t[2]){n.label=t[2],n.ops.push(s);break}t[2]&&n.ops.pop(),n.trys.pop();continue}s=r.call(e,n)}catch(a){s=[6,a],i=0}finally{o=t=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}};Object.defineProperty(E,"__esModule",{value:!0});E.ReCaptchaInstance=void 0;var _e=function(){function e(r,n,o){this.siteKey=r,this.recaptchaID=n,this.recaptcha=o,this.styleContainer=null}return e.prototype.execute=function(r){return he(this,void 0,void 0,function(){return ye(this,function(n){return[2,this.recaptcha.enterprise?this.recaptcha.enterprise.execute(this.recaptchaID,{action:r}):this.recaptcha.execute(this.recaptchaID,{action:r})]})})},e.prototype.getSiteKey=function(){return this.siteKey},e.prototype.hideBadge=function(){this.styleContainer===null&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},e.prototype.showBadge=function(){this.styleContainer!==null&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},e}();E.ReCaptchaInstance=_e;Object.defineProperty(D,"__esModule",{value:!0});D.getInstance=D.load=void 0;var ge=E,x;(function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(x||(x={}));var G=function(){function e(){}return e.load=function(r,n){if(n===void 0&&(n={}),typeof document=="undefined")return Promise.reject(new Error("This is a library for the browser!"));if(e.getLoadingState()===x.LOADED)return e.instance.getSiteKey()===r?Promise.resolve(e.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(e.getLoadingState()===x.LOADING)return r!==e.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise(function(i,t){e.successfulLoadingConsumers.push(function(d){return i(d)}),e.errorLoadingRunnable.push(function(d){return t(d)})});e.instanceSiteKey=r,e.setLoadingState(x.LOADING);var o=new e;return new Promise(function(i,t){o.loadScript(r,n.useRecaptchaNet||!1,n.useEnterprise||!1,n.renderParameters?n.renderParameters:{},n.customUrl).then(function(){e.setLoadingState(x.LOADED);var d=o.doExplicitRender(grecaptcha,r,n.explicitRenderParameters?n.explicitRenderParameters:{},n.useEnterprise||!1),m=new ge.ReCaptchaInstance(r,d,grecaptcha);e.successfulLoadingConsumers.forEach(function(g){return g(m)}),e.successfulLoadingConsumers=[],n.autoHideBadge&&m.hideBadge(),e.instance=m,i(m)}).catch(function(d){e.errorLoadingRunnable.forEach(function(m){return m(d)}),e.errorLoadingRunnable=[],t(d)})})},e.getInstance=function(){return e.instance},e.setLoadingState=function(r){e.loadingState=r},e.getLoadingState=function(){return e.loadingState===null?x.NOT_LOADED:e.loadingState},e.prototype.loadScript=function(r,n,o,i,t){var d=this;n===void 0&&(n=!1),o===void 0&&(o=!1),i===void 0&&(i={}),t===void 0&&(t="");var m=document.createElement("script");m.setAttribute("recaptcha-v3-script","");var g="https://www.google.com/recaptcha/api.js";n&&(o?g="https://recaptcha.net/recaptcha/enterprise.js":g="https://recaptcha.net/recaptcha/api.js"),o&&(g="https://www.google.com/recaptcha/enterprise.js"),t&&(g=t),i.render&&(i.render=void 0);var s=this.buildQueryString(i);return m.src=g+"?render=explicit"+s,new Promise(function(a,A){m.addEventListener("load",d.waitForScriptToLoad(function(){a(m)},o),!1),m.onerror=function(R){e.setLoadingState(x.NOT_LOADED),A(R)},document.head.appendChild(m)})},e.prototype.buildQueryString=function(r){var n=Object.keys(r);return n.length<1?"":"&"+Object.keys(r).filter(function(o){return!!r[o]}).map(function(o){return o+"="+r[o]}).join("&")},e.prototype.waitForScriptToLoad=function(r,n){var o=this;return function(){window.grecaptcha===void 0?setTimeout(function(){o.waitForScriptToLoad(r,n)},e.SCRIPT_LOAD_DELAY):n?window.grecaptcha.enterprise.ready(function(){r()}):window.grecaptcha.ready(function(){r()})}},e.prototype.doExplicitRender=function(r,n,o,i){var t={sitekey:n,badge:o.badge,size:o.size,tabindex:o.tabindex};return o.container?i?r.enterprise.render(o.container,t):r.render(o.container,t):i?r.enterprise.render(t):r.render(t)},e.loadingState=null,e.instance=null,e.instanceSiteKey=null,e.successfulLoadingConsumers=[],e.errorLoadingRunnable=[],e.SCRIPT_LOAD_DELAY=25,e}();D.load=G.load;D.getInstance=G.getInstance;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var r=D;Object.defineProperty(e,"load",{enumerable:!0,get:function(){return r.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return r.getInstance}});var n=E;Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})})(B);const ve={class:"container"},we={class:"block xl:grid grid-cols-2 gap-4"},be={class:"h-screen xl:h-auto flex py-5 xl:py-0 my-10 xl:my-0"},Ie={class:"my-auto mx-auto xl:ml-20 bg-white dark:bg-darkmode-600 xl:bg-transparent px-5 sm:px-8 py-8 xl:p-0 rounded-md shadow-md xl:shadow-none w-full sm:w-3/4 lg:w-2/4 xl:w-auto"},xe={class:"flex items-center justify-between"},Ae={class:"intro-x font-bold text-2xl xl:text-3xl text-center xl:text-left"},Ce={class:"intro-x mt-2 text-slate-400 dark:text-slate-400 xl:hidden text-center"},Le={class:"intro-x mt-8"},Te=["placeholder"],ke=["placeholder"],De=["placeholder"],$e={class:"relative"},Ee=["placeholder"],Ne={value:"",disabled:""},Oe=["value"],Se={class:"mt-3"},Re={class:"flex flex-col sm:flex-row mt-2"},Me={class:"form-check mr-5"},Pe={class:"form-check-label",for:"radio-switch-4"},Ue={class:"form-check mr-2 mt-2 sm:mt-0"},Ve={class:"form-check-label",for:"radio-switch-6"},je={class:"intro-x mt-5 xl:mt-8 text-center xl:text-left"},Be=["onClick","disabled"],Ge={class:"intro-x mt-5 xl:mt-8 text-primary xl:text-left"},qe=["onClick"],He={__name:"Main",setup(e){const r="6LdUu4IiAAAAANdTz63BEqFBbo0lysHyTLaqvhZs",n=z();J();const{countries:o}=W(n),i=U(!1),t=Z({firstname:"",lastname:"",email:"",password:"",country:"",accountType:"",recaptchaToken:""}),d=U(null),m=async()=>{d.value=await B.load(r),t.recaptchaToken=await d.value.execute(le)},g={firstname:{required:b.withMessage(w.global.t("REQUIRED_VALIDATION"),k),minLength:b.withMessage(w.global.t("MIN_LENGTH_VALIDATION",{min:2}),P(2))},lastname:{required:b.withMessage(w.global.t("REQUIRED_VALIDATION"),k),minLength:b.withMessage(w.global.t("MIN_LENGTH_VALIDATION",{min:2}),P(2))},email:{required:b.withMessage(w.global.t("REQUIRED_VALIDATION"),k),email:b.withMessage(w.global.t("EMAIL_VALIDATION"),de)},password:{required:b.withMessage(w.global.t("REQUIRED_VALIDATION"),k),minLength:b.withMessage(w.global.t("MIN_LENGTH_VALIDATION",{min:8}),P(8))},country:{required:b.withMessage(w.global.t("REQUIRED_VALIDATION"),k)},accountType:{required:b.withMessage(w.global.t("ACCOUNT_TYPE_REQUIRED"),k)}},s=()=>{setTimeout(()=>document.location.reload(),5e3)},a=me(g,X(t)),A=async()=>{const _=ce();if(a.value.$touch(),t.recaptchaToken===""&&s(),!a.value.$invalid){let f={firstname:t.firstname,lastname:t.lastname,email:t.email,password:t.password,account_type:t.accountType,country:t.country};i.value=!0,await _.register(f),i.value=!1}},R=()=>ue.push({path:"/login"}),q=()=>{document.querySelector("input[name='password']").type="text"},H=()=>{document.querySelector("input[name='password']").type="password"};return ee(()=>{te("body").removeClass("main").removeClass("error-page").addClass("login")}),ne(async()=>{await n.getAll(),await m(),console.log("recaptcha token: "+t.recaptchaToken),d.value.showBadge()}),ae(async()=>{d.value.hideBadge()}),(_,f)=>{const Q=M("EyeIcon"),Y=M("LoadingIcon"),F=M("i18n-t");return p(),h("div",null,[u("div",ve,[u("div",we,[N(fe),u("div",be,[u("div",Ie,[u("div",xe,[u("h2",Ae,y(_.$t("SIGN_UP")),1),N(pe)]),u("div",Ce,y(_.$t("SING_IN_MOTIVATION_MOBILE")),1),u("div",Le,[C(u("input",{type:"text","onUpdate:modelValue":f[0]||(f[0]=l=>c(a).firstname.$model=l),class:$(["intro-x login__input form-control py-3 px-4 block",{"border-danger":c(a).firstname.$error}]),placeholder:_.$t("FIRSTNAME")},null,10,Te),[[O,c(a).firstname.$model,void 0,{trim:!0}]]),c(a).firstname.$error?(p(!0),h(L,{key:0},T(c(a).firstname.$errors,(l,v)=>(p(),h("div",{key:v,class:"text-danger mt-2"},y(l.$message),1))),128)):I("",!0),C(u("input",{type:"text","onUpdate:modelValue":f[1]||(f[1]=l=>c(a).lastname.$model=l),class:$(["intro-x login__input form-control py-3 px-4 block mt-4",{"border-danger":c(a).lastname.$error}]),placeholder:_.$t("LASTNAME")},null,10,ke),[[O,c(a).lastname.$model,void 0,{trim:!0}]]),c(a).lastname.$error?(p(!0),h(L,{key:1},T(c(a).lastname.$errors,(l,v)=>(p(),h("div",{key:v,class:"text-danger mt-2"},y(l.$message),1))),128)):I("",!0),C(u("input",{type:"text","onUpdate:modelValue":f[2]||(f[2]=l=>c(a).email.$model=l),class:$(["intro-x login__input form-control py-3 px-4 block mt-4",{"border-danger":c(a).email.$error}]),placeholder:_.$t("EMAIL")},null,10,De),[[O,c(a).email.$model,void 0,{trim:!0}]]),c(a).email.$error?(p(!0),h(L,{key:2},T(c(a).email.$errors,(l,v)=>(p(),h("div",{key:v,class:"text-danger mt-2"},y(l.$message),1))),128)):I("",!0),u("div",$e,[C(u("input",{type:"password","onUpdate:modelValue":f[3]||(f[3]=l=>c(a).password.$model=l),class:$(["login__input form-control py-3 px-4 block mt-4",{"border-danger":c(a).password.$error}]),placeholder:_.$t("PASSWORD"),name:"password"},null,10,Ee),[[O,c(a).password.$model,void 0,{trim:!0}]]),N(Q,{class:"block mx-auto absolute top-1/2 transform -translate-y-1/2 right-3 text-slate-400 cursor-pointer",onMousedown:q,onMouseup:H})]),c(a).password.$error?(p(!0),h(L,{key:3},T(c(a).password.$errors,(l,v)=>(p(),h("div",{key:v,class:"text-danger mt-2"},y(l.$message),1))),128)):I("",!0),C(u("select",{class:$(["form-select py-3 px-4 block mt-4 sm:mr-2",{"border-danger":c(a).country.$error}]),"aria-label":"Default select example","onUpdate:modelValue":f[4]||(f[4]=l=>c(a).country.$model=l),name:"country"},[u("option",Ne,y(_.$t("SELECT_COUNTRY")),1),c(o).length?(p(!0),h(L,{key:0},T(c(o),l=>(p(),h("option",{key:l.id,value:l.id},y(l.name),9,Oe))),128)):I("",!0)],2),[[re,c(a).country.$model]]),c(a).country.$error?(p(!0),h(L,{key:4},T(c(a).country.$errors,(l,v)=>(p(),h("div",{key:v,class:"text-danger mt-2"},y(l.$message),1))),128)):I("",!0),u("div",Se,[u("label",null,y(_.$t("ACCOUNT_TYPE")),1),u("div",Re,[u("div",Me,[C(u("input",{id:"radio-switch-4",class:"form-check-input",type:"radio","onUpdate:modelValue":f[5]||(f[5]=l=>t.accountType=l),name:"accountType",value:"business"},null,512),[[V,t.accountType]]),u("label",Pe,y(_.$t("ACCOUNT_TYPE_BUSINESS")),1)]),u("div",Ue,[C(u("input",{id:"radio-switch-6",class:"form-check-input",type:"radio","onUpdate:modelValue":f[6]||(f[6]=l=>t.accountType=l),name:"accountType",value:"company"},null,512),[[V,t.accountType]]),u("label",Ve,y(_.$t("ACCOUNT_TYPE_COMPANY")),1)])])]),c(a).accountType.$error?(p(!0),h(L,{key:5},T(c(a).accountType.$errors,(l,v)=>(p(),h("div",{key:v,class:"text-danger mt-2"},y(l.$message),1))),128)):I("",!0)]),u("div",je,[u("button",{class:"btn btn-primary py-3 px-4 xl:mr-3 align-top w-full custom-btns",onClick:j(A,["prevent"]),disabled:i.value},[oe(y(_.$t("SIGN_UP"))+" ",1),i.value?(p(),se(Y,{key:0,icon:"oval",color:"white",class:"w-4 h-4 ml-2"})):I("",!0)],8,Be)]),u("div",Ge,[N(F,{keypath:"ALREADY_HAS_ACCOUNT",for:"SIGN_IN",class:"w-full text-center",tag:"p"},{default:ie(()=>[u("a",{onClick:j(R,["prevent"]),href:"#",class:"font-bold underline"},y(_.$t("SIGN_IN")),9,qe)]),_:1})])])])])])])}}};var Je=K(He,[["__scopeId","data-v-c8e96066"]]);export{Je as default};
|