@ozdao/prometheus-framework 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
package/dist/auth.client.cjs
CHANGED
@@ -4,5 +4,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xt(e,n){if(e){if(typeof e=="string")return ve(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ve(e,n)}}function ve(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,d=new Array(n);t<n;t++)d[t]=e[t];return d}var Yt=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function te(e,n,t){if(n=n||{},!!e.country){t=new b(t),t.selectNumberingPlan(e.country,e.countryCallingCode);var d=n.v2?e.nationalNumber:e.phone;if(E(d,t.nationalNumberPattern())){if(V(d,"FIXED_LINE",t))return t.type("MOBILE")&&t.type("MOBILE").pattern()===""||!t.type("MOBILE")||V(d,"MOBILE",t)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var o=qt(Yt),i;!(i=o()).done;){var a=i.value;if(V(d,a,t))return a}}}}function V(e,n,t){return n=t.type(n),!n||!n.pattern()||n.possibleLengths()&&n.possibleLengths().indexOf(e.length)<0?!1:E(e,n.pattern())}function Zt(e,n,t){if(n=n||{},t=new b(t),t.selectNumberingPlan(e.country,e.countryCallingCode),t.hasTypes())return te(e,n,t.metadata)!==void 0;var d=n.v2?e.nationalNumber:e.phone;return E(d,t.nationalNumberPattern())}function Jt(e,n,t){var d=new b(t),o=d.getCountryCodesForCallingCode(e);return o?o.filter(function(i){return Qt(n,i,t)}):[]}function Qt(e,n,t){var d=new b(t);return d.selectNumberingPlan(n),d.numberingPlan.possibleLengths().indexOf(e.length)>=0}function en(e){return e.replace(new RegExp("[".concat(R,"]+"),"g")," ").trim()}var tn=/(\$\d)/;function nn(e,n,t){var d=t.useInternationalFormat,o=t.withNationalPrefix;t.carrierCode,t.metadata;var i=e.replace(new RegExp(n.pattern()),d?n.internationalFormat():o&&n.nationalPrefixFormattingRule()?n.format().replace(tn,n.nationalPrefixFormattingRule()):n.format());return d?en(i):i}var dn=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function rn(e,n,t){var d=new b(t);if(d.selectNumberingPlan(e,n),d.defaultIDDPrefix())return d.defaultIDDPrefix();if(dn.test(d.IDDPrefix()))return d.IDDPrefix()}function on(e){var n=e.number,t=e.ext;if(!n)return"";if(n[0]!=="+")throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(n).concat(t?";ext="+t:"")}function an(e,n){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=sn(e))||n&&e&&typeof e.length=="number"){t&&(e=t);var d=0;return function(){return d>=e.length?{done:!0}:{done:!1,value:e[d++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
5
5
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sn(e,n){if(e){if(typeof e=="string")return be(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return be(e,n)}}function be(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,d=new Array(n);t<n;t++)d[t]=e[t];return d}function _e(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);n&&(d=d.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,d)}return t}function Ce(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?_e(Object(t),!0).forEach(function(d){ln(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):_e(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function ln(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var we={formatExtension:function(n,t,d){return"".concat(n).concat(d.ext()).concat(t)}};function un(e,n,t,d){if(t?t=Ce(Ce({},we),t):t=we,d=new b(d),e.country&&e.country!=="001"){if(!d.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));d.country(e.country)}else if(e.countryCallingCode)d.selectNumberingPlan(e.countryCallingCode);else return e.phone||"";var o=d.countryCallingCode(),i=t.v2?e.nationalNumber:e.phone,a;switch(n){case"NATIONAL":return i?(a=M(i,e.carrierCode,"NATIONAL",d,t),j(a,e.ext,d,t.formatExtension)):"";case"INTERNATIONAL":return i?(a=M(i,null,"INTERNATIONAL",d,t),a="+".concat(o," ").concat(a),j(a,e.ext,d,t.formatExtension)):"+".concat(o);case"E.164":return"+".concat(o).concat(i);case"RFC3966":return on({number:"+".concat(o).concat(i),ext:e.ext});case"IDD":if(!t.fromCountry)return;var s=cn(i,e.carrierCode,o,t.fromCountry,d);return j(s,e.ext,d,t.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(n,'"'))}}function M(e,n,t,d,o){var i=$n(d.formats(),e);return i?nn(e,i,{useInternationalFormat:t==="INTERNATIONAL",withNationalPrefix:!(i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&o&&o.nationalPrefix===!1),carrierCode:n,metadata:d}):e}function $n(e,n){for(var t=an(e),d;!(d=t()).done;){var o=d.value;if(o.leadingDigitsPatterns().length>0){var i=o.leadingDigitsPatterns()[o.leadingDigitsPatterns().length-1];if(n.search(i)!==0)continue}if(E(n,o.pattern()))return o}}function j(e,n,t,d){return n?d(e,n,t):e}function cn(e,n,t,d,o){var i=Q(d,o.metadata);if(i===t){var a=M(e,n,"NATIONAL",o);return t==="1"?t+" "+a:a}var s=rn(d,void 0,o.metadata);if(s)return"".concat(s," ").concat(t," ").concat(M(e,null,"INTERNATIONAL",o))}function Pe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);n&&(d=d.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,d)}return t}function Ne(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?Pe(Object(t),!0).forEach(function(d){fn(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Pe(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function fn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function pn(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function Ee(e,n){for(var t=0;t<n.length;t++){var d=n[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,d.key,d)}}function mn(e,n,t){return n&&Ee(e.prototype,n),t&&Ee(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var hn=function(){function e(n,t,d){if(pn(this,e),!n)throw new TypeError("`country` or `countryCallingCode` not passed");if(!t)throw new TypeError("`nationalNumber` not passed");if(!d)throw new TypeError("`metadata` not passed");var o=gn(n,d),i=o.country,a=o.countryCallingCode;this.country=i,this.countryCallingCode=a,this.nationalNumber=t,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return d}}return mn(e,[{key:"setExt",value:function(t){this.ext=t}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Jt(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return Wt(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return Zt(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var t=new b(this.getMetadata());return t.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(t){return this.number===t.number&&this.ext===t.ext}},{key:"getType",value:function(){return te(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(t,d){return un(this,t,d?Ne(Ne({},d),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(t){return this.format("NATIONAL",t)}},{key:"formatInternational",value:function(t){return this.format("INTERNATIONAL",t)}},{key:"getURI",value:function(t){return this.format("RFC3966",t)}}]),e}(),yn=function(n){return/^[A-Z]{2}$/.test(n)};function gn(e,n){var t,d,o=new b(n);return yn(e)?(t=e,o.selectNumberingPlan(t),d=o.countryCallingCode()):d=e,{country:t,countryCallingCode:d}}var vn=new RegExp("(["+C+"])");function bn(e,n,t,d){if(n){var o=new b(d);o.selectNumberingPlan(n,t);var i=new RegExp(o.IDDPrefix());if(e.search(i)===0){e=e.slice(e.match(i)[0].length);var a=e.match(vn);if(!(a&&a[1]!=null&&a[1].length>0&&a[1]==="0"))return e}}}function _n(e,n){if(e&&n.numberingPlan.nationalPrefixForParsing()){var t=new RegExp("^(?:"+n.numberingPlan.nationalPrefixForParsing()+")"),d=t.exec(e);if(d){var o,i,a=d.length-1,s=a>0&&d[a];if(n.nationalPrefixTransformRule()&&s)o=e.replace(t,n.nationalPrefixTransformRule()),a>1&&(i=d[1]);else{var $=d[0];o=e.slice($.length),s&&(i=d[1])}var u;if(s){var f=e.indexOf(d[1]),c=e.slice(0,f);c===n.numberingPlan.nationalPrefix()&&(u=n.numberingPlan.nationalPrefix())}else u=d[0];return{nationalNumber:o,nationalPrefix:u,carrierCode:i}}}return{nationalNumber:e}}function K(e,n){var t=_n(e,n),d=t.carrierCode,o=t.nationalNumber;if(o!==e){if(!Cn(e,o,n))return{nationalNumber:e};if(n.possibleLengths()&&!wn(o,n))return{nationalNumber:e}}return{nationalNumber:o,carrierCode:d}}function Cn(e,n,t){return!(E(e,t.nationalNumberPattern())&&!E(n,t.nationalNumberPattern()))}function wn(e,n){switch(ee(e,n)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function Pn(e,n,t,d){var o=n?Q(n,d):t;if(e.indexOf(o)===0){d=new b(d),d.selectNumberingPlan(n,t);var i=e.slice(o.length),a=K(i,d),s=a.nationalNumber,$=K(e,d),u=$.nationalNumber;if(!E(u,d.nationalNumberPattern())&&E(s,d.nationalNumberPattern())||ee(u,d)==="TOO_LONG")return{countryCallingCode:o,number:i}}return{number:e}}function Nn(e,n,t,d){if(!e)return{};var o;if(e[0]!=="+"){var i=bn(e,n,t,d);if(i&&i!==e)o=!0,e="+"+i;else{if(n||t){var a=Pn(e,n,t,d),s=a.countryCallingCode,$=a.number;if(s)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:s,number:$}}return{number:e}}}if(e[1]==="0")return{};d=new b(d);for(var u=2;u-1<=pt&&u<=e.length;){var f=e.slice(1,u);if(d.hasCallingCode(f))return d.selectNumberingPlan(f),{countryCallingCodeSource:o?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:f,number:e.slice(u)};u++}return{}}function En(e,n){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=Sn(e))||n&&e&&typeof e.length=="number"){t&&(e=t);var d=0;return function(){return d>=e.length?{done:!0}:{done:!1,value:e[d++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
6
6
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sn(e,n){if(e){if(typeof e=="string")return Se(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Se(e,n)}}function Se(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,d=new Array(n);t<n;t++)d[t]=e[t];return d}function On(e,n){var t=n.countries,d=n.defaultCountry,o=n.metadata;o=new b(o);for(var i=[],a=En(t),s;!(s=a()).done;){var $=s.value;if(o.country($),o.leadingDigits()){if(e&&e.search(o.leadingDigits())===0)return $}else if(te({phone:e,country:$},void 0,o.metadata))if(d){if($===d)return $;i.push($)}else return $}if(i.length>0)return i[0]}var In=!1;function Tn(e,n){var t=n.nationalNumber,d=n.defaultCountry,o=n.metadata;if(In&&o.isNonGeographicCallingCode(e))return"001";var i=o.getCountryCodesForCallingCode(e);if(i)return i.length===1?i[0]:On(t,{countries:i,defaultCountry:d,metadata:o.metadata})}var qe="+",An="[\\-\\.\\(\\)]?",Oe="(["+C+"]|"+An+")",Fn="^\\"+qe+Oe+"*["+C+"]"+Oe+"*$",Dn=new RegExp(Fn,"g"),W=C,kn="["+W+"]+((\\-)*["+W+"])*",Rn="a-zA-Z",xn="["+Rn+"]+((\\-)*["+W+"])*",Mn="^("+kn+"\\.)*"+xn+"\\.?$",zn=new RegExp(Mn,"g"),Ie="tel:",q=";phone-context=",Ln=";isub=";function Bn(e){var n=e.indexOf(q);if(n<0)return null;var t=n+q.length;if(t>=e.length)return"";var d=e.indexOf(";",t);return d>=0?e.substring(t,d):e.substring(t)}function Vn(e){return e===null?!0:e.length===0?!1:Dn.test(e)||zn.test(e)}function jn(e,n){var t=n.extractFormattedPhoneNumber,d=Bn(e);if(!Vn(d))throw new P("NOT_A_NUMBER");var o;if(d===null)o=t(e)||"";else{o="",d.charAt(0)===qe&&(o+=d);var i=e.indexOf(Ie),a;i>=0?a=i+Ie.length:a=0;var s=e.indexOf(q);o+=e.substring(a,s)}var $=o.indexOf(Ln);if($>0&&(o=o.substring(0,$)),o!=="")return o}var Un=250,Gn=new RegExp("["+J+C+"]"),Hn=new RegExp("[^"+C+"#]+$");function Kn(e,n,t){if(n=n||{},t=new b(t),n.defaultCountry&&!t.hasCountry(n.defaultCountry))throw n.v2?new P("INVALID_COUNTRY"):new Error("Unknown country: ".concat(n.defaultCountry));var d=qn(e,n.v2,n.extract),o=d.number,i=d.ext,a=d.error;if(!o){if(n.v2)throw a==="TOO_SHORT"?new P("TOO_SHORT"):new P("NOT_A_NUMBER");return{}}var s=Yn(o,n.defaultCountry,n.defaultCallingCode,t),$=s.country,u=s.nationalNumber,f=s.countryCallingCode,c=s.countryCallingCodeSource,p=s.carrierCode;if(!t.hasSelectedNumberingPlan()){if(n.v2)throw new P("INVALID_COUNTRY");return{}}if(!u||u.length<Z){if(n.v2)throw new P("TOO_SHORT");return{}}if(u.length>ft){if(n.v2)throw new P("TOO_LONG");return{}}if(n.v2){var m=new hn(f,u,t.metadata);return $&&(m.country=$),p&&(m.carrierCode=p),i&&(m.ext=i),m.__countryCallingCodeSource=c,m}var h=(n.extended?t.hasSelectedNumberingPlan():$)?E(u,t.nationalNumberPattern()):!1;return n.extended?{country:$,countryCallingCode:f,carrierCode:p,valid:h,possible:h?!0:!!(n.extended===!0&&t.possibleLengths()&&We(u,t)),phone:u,ext:i}:h?Xn($,u,i):{}}function Wn(e,n,t){if(e){if(e.length>Un){if(t)throw new P("TOO_LONG");return}if(n===!1)return e;var d=e.search(Gn);if(!(d<0))return e.slice(d).replace(Hn,"")}}function qn(e,n,t){var d=jn(e,{extractFormattedPhoneNumber:function(a){return Wn(a,t,n)}});if(!d)return{};if(!xt(d))return Mt(d)?{error:"TOO_SHORT"}:{};var o=zt(d);return o.ext?o:{number:d}}function Xn(e,n,t){var d={country:e,phone:n};return t&&(d.ext=t),d}function Yn(e,n,t,d){var o=Nn(ye(e),n,t,d.metadata),i=o.countryCallingCodeSource,a=o.countryCallingCode,s=o.number,$;if(a)d.selectNumberingPlan(a);else if(s&&(n||t))d.selectNumberingPlan(n,t),n&&($=n),a=t||Q(n,d.metadata);else return{};if(!s)return{countryCallingCodeSource:i,countryCallingCode:a};var u=K(ye(s),d),f=u.nationalNumber,c=u.carrierCode,p=Tn(a,{nationalNumber:f,defaultCountry:n,metadata:d});return p&&($=p,p==="001"||d.country($)),{country:$,countryCallingCode:a,countryCallingCodeSource:i,nationalNumber:f,carrierCode:c}}function Te(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);n&&(d=d.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,d)}return t}function Ae(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?Te(Object(t),!0).forEach(function(d){Zn(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Te(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function Zn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Jn(e,n,t){return Kn(e,Ae(Ae({},n),{},{v2:!0}),t)}function X(e){"@babel/helpers - typeof";return X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},X(e)}function Fe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);n&&(d=d.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,d)}return t}function Qn(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?Fe(Object(t),!0).forEach(function(d){ed(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Fe(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function ed(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function td(e,n){return od(e)||rd(e,n)||dd(e,n)||nd()}function nd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
7
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dd(e,n){if(e){if(typeof e=="string")return De(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return De(e,n)}}function De(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,d=new Array(n);t<n;t++)d[t]=e[t];return d}function rd(e,n){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var d=[],o=!0,i=!1,a,s;try{for(t=t.call(e);!(o=(a=t.next()).done)&&(d.push(a.value),!(n&&d.length===n));o=!0);}catch($){i=!0,s=$}finally{try{!o&&t.return!=null&&t.return()}finally{if(i)throw s}}return d}}function od(e){if(Array.isArray(e))return e}function id(e){var n=Array.prototype.slice.call(e),t=td(n,4),d=t[0],o=t[1],i=t[2],a=t[3],s,$,u;if(typeof d=="string")s=d;else throw new TypeError("A text for parsing must be a string.");if(!o||typeof o=="string")a?($=i,u=a):($=void 0,u=i),o&&($=Qn({defaultCountry:o},$));else if(ad(o))i?($=o,u=i):u=o;else throw new Error("Invalid second argument: ".concat(o));return{text:s,options:$,metadata:u}}var ad=function(n){return X(n)==="object"};function ke(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);n&&(d=d.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,d)}return t}function Re(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?ke(Object(t),!0).forEach(function(d){sd(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ke(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function sd(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ld(e,n,t){n&&n.defaultCountry&&!It(n.defaultCountry,t)&&(n=Re(Re({},n),{},{defaultCountry:void 0}));try{return Jn(e,n,t)}catch(d){if(!(d instanceof P))throw d}}function ud(){var e=id(arguments),n=e.text,t=e.options,d=e.metadata;return ld(n,t,d)}function U(){return it(ud,arguments)}const $d={class:"cols-2-1_2 gap-small pd-small bg-white"},cd=r.createElementVNode("section",{class:"w-100 desktop-only o-hidden radius-big bg-grad-main"},null,-1),Xe={__name:"Auth",setup(e){return r.ref(null),r.ref(null),r.ref(null),_.useRoute(),_.useRouter(),r.ref("email"),(n,t)=>{const d=r.resolveComponent("router-view");return r.openBlock(),r.createElementBlock("div",$d,[r.createVNode(d,{class:"pd-medium br-solid br-1px br-grey radius-big w-m-66r t-center"},{default:r.withCtx(({Component:o,route:i})=>[r.createVNode(r.Transition,{name:"scaleIn",mode:"out-in"},{default:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(o),{ref:"page",key:i.path,localPosition:n.localPosition},null,8,["localPosition"]))]),_:2},1024)]),_:1}),cd])}}};function xe(e){const n=e;n.__i18n=n.__i18n||[],n.__i18n.push({locale:"",resource:{en:{verifyNumberTitle:t=>{const{normalize:d}=t;return d(["Verify Number"])},instructions:t=>{const{normalize:d}=t;return d(["We have sent a registration code to your phone number. Please enter it in the field below:"])},resendCode:t=>{const{normalize:d}=t;return d(["Send the code again"])},secondsResend:t=>{const{normalize:d}=t;return d(["seconds to the possibility of sending the code again."])}},ru:{verifyNumberTitle:t=>{const{normalize:d}=t;return d(["Подтвердите номер"])},instructions:t=>{const{normalize:d}=t;return d(["Мы отправили код регистрации на ваш номер телефона. Введите его в поле ниже:"])},resendCode:t=>{const{normalize:d}=t;return d(["Отправить код еще раз"])},secondsResend:t=>{const{normalize:d}=t;return d(["секунд до возможности отправить код еще раз."])}}}})}const fd={class:"t-center pd-medium"},pd={class:"mn-medium"},md={class:"mn-big t-transp"},hd={class:"w-100 mn-big flex-nowrap flex"},yd={key:1},ne={__name:"EnterCode",setup(e){const n=_.useRoute(),t=_.useRouter(),{t:d}=A.useI18n({inheritLocale:!0,useScope:"local"}),o=r.reactive({digits:["","","",""],error:null});r.watch(()=>o.digits[0],f=>{if(console.log(String(f)),console.log(String(f).length),f&&String(f).length>1){let c=String(f).split("");console.log(c);let p=[...o.digits];c.forEach((m,h)=>{console.log(h),console.log(p[h]),console.log(m),p[h]=m}),o.digits=p,u(3)}});const i=r.ref(null),a=r.ref(0);async function s(){try{await l.sendCode(l.state.user,n.query.type,l.state.user.phone?"phone":"email"),a.value=30;const f=setInterval(()=>{a.value>0?a.value-=1:clearInterval(f)},1e3)}catch{O.setError({response:{data:{errorCode:"CODE_NOT_SENT"}}})}}const $=(f,c)=>{if(f.key==="Backspace"&&(o.digits[c]===null||o.digits[c]===void 0||o.digits[c]==="")){f.preventDefault();const p=document.querySelectorAll("input"),m=c>0?p[c-1]:null;m&&(m.focus(),m.setSelectionRange(m.value.length,m.value.length))}},u=f=>{const c=document.querySelectorAll("input"),p=c[f+1],m=f>0?c[f-1]:null;if(o.digits[f]!==""&&o.digits[f]!==null&&o.digits[f]!==void 0&&f<4&&(f<3?p.focus():i.value.focus()),(o.digits[f]===null||o.digits[f]===void 0||o.digits[f]==="")&&f>0&&m.focus(),o.digits.every(h=>h!=="")){const h=o.digits.join(""),S=l.state$1.code.code.toString();h===S?(l.state$1.code.isValid=!0,t.push({path:"/auth/enter-password",query:{type:l.state$1.code.type,method:n.query.method}})):(O.setError({response:{data:{errorCode:"WRONG_CODE"}}}),i.value.focus(),o.digits=["","","",""])}};return(f,c)=>(r.openBlock(),r.createElementBlock("section",fd,[r.createElementVNode("h3",pd,r.toDisplayString(r.unref(d)("verifyNumberTitle")),1),r.createTextVNode(" "+r.toDisplayString(o.digits)+" ",1),r.createElementVNode("p",md,r.toDisplayString(r.unref(d)("instructions")),1),r.createElementVNode("div",hd,[r.withDirectives(r.createElementVNode("input",{type:"number","onUpdate:modelValue":c[0]||(c[0]=p=>o.digits[0]=p),ref_key:"firstInput",ref:i,maxlength:"1",onInput:c[1]||(c[1]=p=>u(0)),onPaste:c[2]||(c[2]=p=>f.onPaste(p,0)),onKeydown:c[3]||(c[3]=p=>$(p,0)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[r.vModelText,o.digits[0]]]),r.withDirectives(r.createElementVNode("input",{type:"number","onUpdate:modelValue":c[4]||(c[4]=p=>o.digits[1]=p),maxlength:"1",onInput:c[5]||(c[5]=p=>u(1)),onPaste:c[6]||(c[6]=p=>f.onPaste(p,1)),onKeydown:c[7]||(c[7]=p=>$(p,1)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[r.vModelText,o.digits[1]]]),r.withDirectives(r.createElementVNode("input",{type:"number","onUpdate:modelValue":c[8]||(c[8]=p=>o.digits[2]=p),maxlength:"1",onInput:c[9]||(c[9]=p=>u(2)),onPaste:c[10]||(c[10]=p=>f.onPaste(p,2)),onKeydown:c[11]||(c[11]=p=>$(p,2)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[r.vModelText,o.digits[2]]]),r.withDirectives(r.createElementVNode("input",{type:"number","onUpdate:modelValue":c[12]||(c[12]=p=>o.digits[3]=p),maxlength:"1",onInput:c[13]||(c[13]=p=>u(3)),onPaste:c[14]||(c[14]=p=>f.onPaste(p,3)),onKeydown:c[15]||(c[15]=p=>$(p,3)),class:"w-100 h1 pd-small t-center bg-grey radius-small"},null,544),[[r.vModelText,o.digits[3]]])]),a.value<1?(r.openBlock(),r.createElementBlock("a",{key:0,onClick:s,class:"t-blue"},r.toDisplayString(r.unref(d)("resendCode")),1)):(r.openBlock(),r.createElementBlock("span",yd,r.toDisplayString(a.value)+" "+r.toDisplayString(r.unref(d)("secondsResend")),1))]))}};typeof xe=="function"&&xe(ne);const gd=Object.freeze(Object.defineProperty({__proto__:null,default:ne},Symbol.toStringTag,{value:"Module"})),T=l.axios.create({baseURL:process.env.API_URL,withCredentials:!0});T.defaults.withCredentials=!0;const N=r.reactive({invites:[],invite:null,error:null}),Ye={async read(e){await T.get(`/api/invites/${e}`).then(n=>{N.invites=n.data,N.error=null}).catch(n=>{O.setError(n)})},async readOne(e){await T.get(`/api/invites/get/${e}`).then(n=>{N.invite=n.data,l.state.user.phone=n.data.invitedPhone,l.state.user.email=n.data.invitedEmail}).catch(n=>{O.setError(n)})},async create(e,n){await T.post(`/api/invites/${e}/create`,n).then(()=>{N.error=null}).catch(t=>{O.setError(t)})},async update(e,n){await T.put(`/api/invites/${e}/update`,n).then(()=>{N.error=null}).catch(t=>{O.setError(t)})},async delete(e){await T.delete(`/api/invites/${e}/delete`).then(()=>{N.error=null}).catch(n=>{O.setError(n)})}};r.watch(N,(e,n)=>{});const vd=Object.freeze(Object.defineProperty({__proto__:null,actions:Ye,state:N},Symbol.toStringTag,{value:"Module"}));const bd={class:"t-left pd-medium"},_d=r.createElementVNode("h3",{class:"mn-small"},"Вы были пригилашены в организацию",-1),Cd=r.createElementVNode("p",{class:"mn-semi t-transp"},"Пожалуйста, укажите пароль, на этом регистрация будет закочена.",-1),wd={class:"mn-semi radius-small o-hidden"},Pd={key:0},Nd={key:1},Ze={__name:"Invite",async setup(e){let n,t;const d=r.ref(null),o=_.useRoute(),i=_.useRouter();[n,t]=r.withAsyncContext(()=>Ye.readOne(o.query.inviteCode)),await n,t();async function a(){try{await y.validateInputs(d,y.validatePassword,l.state.user.password,"Некорректный пароль")}catch{throw new Error}await l.actions.signup(l.state.user,o.query.type,o.query.inviteCode)}function s(){i.push({name:"Dashboard"})}return($,u)=>(r.openBlock(),r.createElementBlock("section",bd,[_d,Cd,r.createElementVNode("div",wd,[r.createVNode(l.Field,{field:l.state.user.password,"onUpdate:field":u[0]||(u[0]=f=>l.state.user.password=f),type:"password",validation:d.value,label:"Пароль",placeholder:"******",class:"bg-white radius-small mn-small"},null,8,["field","validation"]),r.createVNode(l.Field,{field:l.state.user.passwordRepeat,"onUpdate:field":u[1]||(u[1]=f=>l.state.user.passwordRepeat=f),type:"password",label:"Повторите пароль",placeholder:"******",class:"bg-white radius-small mn-semi"},null,8,["field"])]),r.createVNode(l._sfc_main,{disabled:N.invite===null,submit:a,callback:s,class:"mn-big"},{default:r.withCtx(()=>[r.unref(o).query.method==="reset-password"?(r.openBlock(),r.createElementBlock("span",Pd,"Поменять пароль")):(r.openBlock(),r.createElementBlock("span",Nd,"Зарегистрироваться"))]),_:1},8,["disabled"])]))}},Ed=Object.freeze(Object.defineProperty({__proto__:null,default:Ze},Symbol.toStringTag,{value:"Module"}));function Me(e){const n=e;n.__i18n=n.__i18n||[],n.__i18n.push({locale:"",resource:{en:{almostDone:t=>{const{normalize:d}=t;return d(["Almost there!"])},newPasswordPrompt:t=>{const{normalize:d}=t;return d(["Please, set a new password."])},registrationPasswordPrompt:t=>{const{normalize:d}=t;return d(["Please, set your password to complete the registration."])},passwordPlaceholder:t=>{const{normalize:d}=t;return d(["Password"])},repeatPasswordPlaceholder:t=>{const{normalize:d}=t;return d(["Repeat Password"])},changePasswordBtn:t=>{const{normalize:d}=t;return d(["Change Password"])},registerBtn:t=>{const{normalize:d}=t;return d(["Register"])}},ru:{almostDone:t=>{const{normalize:d}=t;return d(["Почти все!"])},newPasswordPrompt:t=>{const{normalize:d}=t;return d(["Пожалуйста, укажите новый пароль."])},registrationPasswordPrompt:t=>{const{normalize:d}=t;return d(["Пожалуйста, укажите пароль, на этом регистрация будет закончена."])},passwordPlaceholder:t=>{const{normalize:d}=t;return d(["Пароль"])},repeatPasswordPlaceholder:t=>{const{normalize:d}=t;return d(["Повторите пароль"])},changePasswordBtn:t=>{const{normalize:d}=t;return d(["Поменять пароль"])},registerBtn:t=>{const{normalize:d}=t;return d(["Зарегистрироваться"])}}}})}const Sd={class:"t-left pd-medium"},Od={class:"mn-small"},Id={key:0,class:"mn-semi t-transp"},Td={key:1,class:"mn-semi t-transp"},Ad={class:"mn-semi radius-small o-hidden"},Fd={key:0},Dd={key:1},de={__name:"EnterPassword",setup(e){const n=r.ref(null),{t}=A.useI18n({inheritLocale:!0,useScope:"local"}),d=_.useRoute(),o=_.useRouter();r.ref("phone");async function i(){try{await y.validateInputs(n,y.validatePassword,l.state.user.password,"Некорректный пароль")}catch{throw new Error}d.query.method==="reset-password"&&await l.actions.updatePassword(l.state.user,d.query.type),d.query.method!=="reset-password"&&await l.actions.signup(l.state.user,d.query.type)}function a(){o.push({name:"User Profile",params:{_id:l.state.user._id}})}return(s,$)=>(r.openBlock(),r.createElementBlock("section",Sd,[r.createElementVNode("h3",Od,r.toDisplayString(r.unref(t)("almostDone")),1),r.unref(d).query.method==="reset-password"?(r.openBlock(),r.createElementBlock("p",Id,r.toDisplayString(r.unref(t)("newPasswordPrompt")),1)):(r.openBlock(),r.createElementBlock("p",Td,r.toDisplayString(r.unref(t)("registrationPasswordPrompt")),1)),r.createElementVNode("div",Ad,[r.createVNode(l.Field,{field:l.state.user.password,"onUpdate:field":$[0]||($[0]=u=>l.state.user.password=u),type:"password",validation:n.value,placeholder:r.unref(t)("passwordPlaceholder"),class:"bg-grey pd-small radius-small mn-thin"},null,8,["field","validation","placeholder"]),r.createVNode(l.Field,{field:l.state.user.passwordRepeat,"onUpdate:field":$[1]||($[1]=u=>l.state.user.passwordRepeat=u),type:"password",placeholder:r.unref(t)("repeatPasswordPlaceholder"),class:"bg-grey pd-small radius-small mn-thin"},null,8,["field","placeholder"])]),r.createVNode(l._sfc_main,{submit:i,callback:a,class:"mn-big"},{default:r.withCtx(()=>[r.unref(d).query.method==="reset-password"?(r.openBlock(),r.createElementBlock("span",Fd,r.toDisplayString(r.unref(t)("changePasswordBtn")),1)):(r.openBlock(),r.createElementBlock("span",Dd,r.toDisplayString(r.unref(t)("registerBtn")),1))]),_:1})]))}};typeof Me=="function"&&Me(de);const kd=Object.freeze(Object.defineProperty({__proto__:null,default:de},Symbol.toStringTag,{value:"Module"})),Rd=[["افغانستان","af","93",,"🇦🇫"],["Shqipëri","al","355",,"🇦🇱"],["الجزائر","dz","213",,"🇩🇿"],["American Samoa","as","1684",,"🇦🇸"],["Andorra","ad","376",,"🇦🇩"],["Angola","ao","244",,"🇦🇴"],["Anguilla","ai","1264",,"🇦🇮"],["Antigua and Barbuda","ag","1268",,"🇦🇬"],["Argentina","ar","54",,"🇦🇷"],["Հայաստան","am","374",,"🇦🇲"],["Aruba","aw","297",,"🇦🇼"],["Australia","au","61",0,,"🇦🇺"],["Österreich","at","43",,"🇦🇹"],["Azərbaycan","az","994",,"🇦🇿"],["Bahamas","bs","1242",,"🇧🇸"],["البحرين","bh","973",,"🇧🇭"],["বাংলাদেশ","bd","880",,"🇧🇩"],["Barbados","bb","1246",,"🇧🇧"],["Беларусь","by","375",,"🇧🇾"],["België","be","32",,"🇧🇪"],["Belize","bz","501",,"🇧🇿"],["Bénin","bj","229",,"🇧🇯"],["Bermuda","bm","1441",,"🇧🇲"],["འབྲུག","bt","975",,"🇧🇹"],["Bolivia","bo","591",,"🇧🇴"],["Босна и Херцеговина","ba","387",,"🇧🇦"],["Botswana","bw","267",,"🇧🇼"],["Brasil","br","55",,"🇧🇷"],["British Indian Ocean Territory","io","246",,"🇮🇴"],["British Virgin Islands","vg","1284",,"🇻🇬"],["Brunei","bn","673",,"🇧🇳"],["България","bg","359",,"🇧🇬"],["Burkina Faso","bf","226",,"🇧🇫"],["Uburundi","bi","257",,"🇧🇮"],["កម្ពុជា","kh","855",,"🇰🇭"],["Cameroun","cm","237",,"🇨🇲"],["Canada","ca","1",1,"🇨🇦"],["Kabu Verdi","cv","238",,"🇨🇻"],["Caribbean Netherlands","bq","599",1,,"🇧🇶"],["Cayman Islands","ky","1345",,"🇰🇾"],["République centrafricaine","cf","236",,"🇨🇫"],["Tchad","td","235",,"🇹🇩"],["Chile","cl","56",,"🇨🇱"],["中国","cn","86",,"🇨🇳"],["Christmas Island","cx","61",2,,"🇨🇽"],["Keeling","cc","61",1,,"🇨🇨"],["Colombia","co","57",,"🇨🇴"],["جزر القمر","km","269",,"🇰🇲"],["DRC","cd","243",,"🇨🇩"],["Republic","cg","242",,"🇨🇬"],["Cook Islands","ck","682",,"🇨🇰"],["Costa Rica","cr","506",,"🇨🇷"],["Côte d’Ivoire","ci","225",,"🇨🇮"],["Hrvatska","hr","385",,"🇭🇷"],["Cuba","cu","53",,"🇨🇺"],["Curaçao","cw","599",0,,"🇨🇼"],["Κύπρος","cy","357",,"🇨🇾"],["Česká republika","cz","420",,"🇨🇿"],["Danmark","dk","45",,"🇩🇰"],["Djibouti","dj","253",,"🇩🇯"],["Dominica","dm","1767",,"🇩🇲"],["República Dominicana","do","1",2,["809","829","849","🇩🇴"]],["Ecuador","ec","593",,"🇪🇨"],["مصر","eg","20",,"🇪🇬"],["El Salvador","sv","503",,"🇸🇻"],["Guinea Ecuatorial","gq","240",,"🇬🇶"],["Eritrea","er","291",,"🇪🇷"],["Eesti","ee","372",,"🇪🇪"],["Ethiopia","et","251",,"🇪🇹"],["Islas Malvinas","fk","500",,"🇫🇰"],["Føroyar","fo","298",,"🇫🇴"],["Fiji","fj","679",,"🇫🇯"],["Suomi","fi","358",0,,"🇫🇮"],["France","fr","33",,"🇫🇷"],["Guyane française","gf","594",,"🇬🇫"],["Polynésie française","pf","689",,"🇵🇫"],["Gabon","ga","241",,"🇬🇦"],["Gambia","gm","220",,"🇬🇲"],["საქართველო","ge","995",,"🇬🇪"],["Deutschland","de","49",,"🇩🇪"],["Gaana","gh","233",,"🇬🇭"],["Gibraltar","gi","350",,"🇬🇮"],["Ελλάδα","gr","30",,"🇬🇷"],["Kalaallit Nunaat","gl","299",,"🇬🇱"],["Grenada","gd","1473",,"🇬🇩"],["Guadeloupe","gp","590",0,,"🇬🇵"],["Guam","gu","1671",,"🇬🇺"],["Guatemala","gt","502",,"🇬🇹"],["Guernsey","gg","44",1,,"🇬🇬"],["Guinée","gn","224",,"🇬🇳"],["Guiné Bissau","gw","245",,"🇬🇼"],["Guyana","gy","592",,"🇬🇾"],["Haiti","ht","509",,"🇭🇹"],["Honduras","hn","504",,"🇭🇳"],["香港","hk","852",,"🇭🇰"],["Magyarország","hu","36",,"🇭🇺"],["Ísland","is","354",,"🇮🇸"],["भारत","in","91",,"🇮🇳"],["Indonesia","id","62",,"🇮🇩"],["ایران","ir","98",,"🇮🇷"],["العراق","iq","964",,"🇮🇶"],["Ireland","ie","353",,"🇮🇪"],["Isle of Man","im","44",2,,"🇮🇲"],["ישראל","il","972",,"🇮🇱"],["Italia","it","39",0,,"🇮🇹"],["Jamaica","jm","1876",,"🇯🇲"],["日本","jp","81",,"🇯🇵"],["Jersey","je","44",3,,"🇯🇪"],["الأردن","jo","962",,"🇯🇴"],["Казахстан","kz","7",1,,"🇰🇿"],["Kenya","ke","254",,"🇰🇪"],["Kiribati","ki","686",,"🇰🇮"],["Kosovo","xk","383",,"🇽🇰"],["الكويت","kw","965",,"🇰🇼"],["Кыргызстан","kg","996",,"🇰🇬"],["ລາວ","la","856",,"🇱🇦"],["Latvija","lv","371",,"🇱🇻"],["لبنان","lb","961",,"🇱🇧"],["Lesotho","ls","266",,"🇱🇸"],["Liberia","lr","231",,"🇱🇷"],["ليبيا","ly","218",,"🇱🇾"],["Liechtenstein","li","423",,"🇱🇮"],["Lietuva","lt","370",,"🇱🇹"],["Luxembourg","lu","352",,"🇱🇺"],["澳門","mo","853",,"🇲🇴"],["FYROM","mk","389",,"🇲🇰"],["Madagasikara","mg","261",,"🇲🇬"],["Malawi","mw","265",,"🇲🇼"],["Malaysia","my","60",,"🇲🇾"],["Maldives","mv","960",,"🇲🇻"],["Mali","ml","223",,"🇲🇱"],["Malta","mt","356",,"🇲🇹"],["Marshall Islands","mh","692",,"🇲🇭"],["Martinique","mq","596",,"🇲🇶"],["موريتانيا","mr","222",,"🇲🇷"],["Moris","mu","230",,"🇲🇺"],["Mayotte","yt","262",1,,"🇾🇹"],["México","mx","52",,"🇲🇽"],["Micronesia","fm","691",,"🇫🇲"],["Republica Moldova","md","373",,"🇲🇩"],["Monaco","mc","377",,"🇲🇨"],["Монгол","mn","976",,"🇲🇳"],["Crna Gora","me","382",,"🇲🇪"],["Montserrat","ms","1664",,"🇲🇸"],["المغرب","ma","212",0,,"🇲🇦"],["Moçambique","mz","258",,"🇲🇿"],["Burma","mm","95",,"🇲🇲"],["Namibië","na","264",,"🇳🇦"],["Nauru","nr","674",,"🇳🇷"],["नेपाल","np","977",,"🇳🇵"],["Nederland","nl","31",,"🇳🇱"],["Nouvelle-Calédonie","nc","687",,"🇳🇨"],["New Zealand","nz","64",,"🇳🇿"],["Nicaragua","ni","505",,"🇳🇮"],["Nijar","ne","227",,"🇳🇪"],["Nigeria","ng","234",,"🇳🇬"],["Niue","nu","683",,"🇳🇺"],["Norfolk Island","nf","672",,"🇳🇫"],["조선 민주주의 인민 공화국","kp","850",,"🇰🇵"],["Northern Mariana Islands","mp","1670",,"🇲🇵"],["Norge","no","47",0,,"🇳🇴"],["عُمان","om","968",,"🇴🇲"],["پاکستان","pk","92",,"🇵🇰"],["Palau","pw","680",,"🇵🇼"],["فلسطين","ps","970",,"🇵🇸"],["Panamá","pa","507",,"🇵🇦"],["Papua New Guinea","pg","675",,"🇵🇬"],["Paraguay","py","595",,"🇵🇾"],["Perú","pe","51",,"🇵🇪"],["Philippines","ph","63",,"🇵🇭"],["Polska","pl","48",,"🇵🇱"],["Portugal","pt","351",,"🇵🇹"],["Puerto Rico","pr","1",3,["787","939","🇵🇷"]],["قطر","qa","974",,"🇶🇦"],["La Réunion","re","262",0,,"🇷🇪"],["România","ro","40",,"🇷🇴"],["Россия","ru","7",0,,"🇷🇺"],["Rwanda","rw","250",,"🇷🇼"],["Saint Barthélemy","bl","590",1,,"🇧🇱"],["Saint Helena","sh","290",,"🇸🇭"],["Saint Kitts and Nevis","kn","1869",,"🇰🇳"],["Saint Lucia","lc","1758",,"🇱🇨"],["Saint-Martin (partie française","mf","590",2,,"🇲🇫"],["Saint-Pierre-et-Miquelon","pm","508",,"🇵🇲"],["Saint Vincent and the Grenadines","vc","1784",,"🇻🇨"],["Samoa","ws","685",,"🇼🇸"],["San Marino","sm","378",,"🇸🇲"],["São Tomé e Príncipe","st","239",,"🇸🇹"],["المملكة العربية السعودية","sa","966",,"🇸🇦"],["Sénégal","sn","221",,"🇸🇳"],["Србија","rs","381",,"🇷🇸"],["Seychelles","sc","248",,"🇸🇨"],["Sierra Leone","sl","232",,"🇸🇱"],["Singapore","sg","65",,"🇸🇬"],["Sint Maarten","sx","1721",,"🇸🇽"],["Slovensko","sk","421",,"🇸🇰"],["Slovenija","si","386",,"🇸🇮"],["Solomon Islands","sb","677",,"🇸🇧"],["Soomaaliya","so","252",,"🇸🇴"],["South Africa","za","27",,"🇿🇦"],["대한민국","kr","82",,"🇰🇷"],["جنوب السودان","ss","211",,"🇸🇸"],["España","es","34",,"🇪🇸"],["ශ්රී ලංකාව","lk","94",,"🇱🇰"],["السودان","sd","249",,"🇸🇩"],["Suriname","sr","597",,"🇸🇷"],["Svalbard and Jan Mayen","sj","47",1,,"🇸🇯"],["Swaziland","sz","268",,"🇸🇿"],["Sverige","se","46",,"🇸🇪"],["Schweiz","ch","41",,"🇨🇭"],["سوريا","sy","963",,"🇸🇾"],["台灣","tw","886",,"🇹🇼"],["Tajikistan","tj","992",,"🇹🇯"],["Tanzania","tz","255",,"🇹🇿"],["ไทย","th","66",,"🇹🇭"],["Timor-Leste","tl","670",,"🇹🇱"],["Togo","tg","228",,"🇹🇬"],["Tokelau","tk","690",,"🇹🇰"],["Tonga","to","676",,"🇹🇴"],["Trinidad and Tobago","tt","1868",,"🇹🇹"],["تونس","tn","216",,"🇹🇳"],["Türkiye","tr","90",,"🇹🇷"],["Turkmenistan","tm","993",,"🇹🇲"],["Turks and Caicos Islands","tc","1649",,"🇹🇨"],["Tuvalu","tv","688",,"🇹🇻"],["U.S. Virgin Islands","vi","1340",,"🇻🇮"],["Uganda","ug","256",,"🇺🇬"],["Україна","ua","380",,"🇺🇦"],["الإمارات العربية المتحدة","ae","971",,"🇦🇪"],["United Kingdom","gb","44",0,,"🇬🇧"],["United States","us","1",0,,"🇺🇸"],["Uruguay","uy","598",,"🇺🇾"],["Oʻzbekiston","uz","998",,"🇺🇿"],["Vanuatu","vu","678",,"🇻🇺"],["Città del Vaticano","va","39",1,,"🇻🇦"],["Venezuela","ve","58",,"🇻🇪"],["Việt Nam","vn","84",,"🇻🇳"],["Wallis-et-Futuna","wf","681",,"🇼🇫"],["الصحراء الغربية","eh","212",1,,"🇪🇭"],["اليمن","ye","967",,"🇾🇪"],["Zambia","zm","260",,"🇿🇲"],["Zimbabwe","zw","263",,"🇿🇼"],["Åland Islands","ax","358",1,,"🇦🇽"]],xd=Rd.map(e=>({name:e[0],iso2:e[1].toUpperCase(),dialCode:e[2],priority:e[3]||0,areaCodes:e[4]||null,flag:e[e.length-1]||null}));function Md(){return fetch("https://ip2c.org/s").then(e=>e.text()).then(e=>{const n=(e||"").toString();if(!n||n[0]!=="1")throw new Error("unable to fetch the country");return n.substr(2,2)})}function zd(e,n){if(e.setSelectionRange)e.focus(),e.setSelectionRange(n,n);else if(e.createTextRange){const t=e.createTextRange();t.collapse(!0),t.moveEnd("character",n),t.moveStart("character",n),t.select()}}const Ld=[{name:"allCountries",type:Array,default:xd,description:"All countries that are used in <code>libphonenumber-js</code>, can be overridden by this prop",inDemo:!1},{name:"autoFormat",type:Boolean,default:!0,description:"Auto update the input to the formatted phone number when it's valid",inDemo:!0},{name:"customValidate",type:[Boolean,RegExp],default:!1,description:"Custom validation RegExp for input",inDemo:!1},{name:"defaultCountry",default:"",type:String,description:"Default country, will override the country fetched from IP address of user",inDemo:!1},{name:"disabled",default:!1,type:Boolean,description:"Disable <code>vue-tel-input</code>, including the input & flag dropdown",inDemo:!1},{name:"autoDefaultCountry",default:!0,type:Boolean,description:"To fetch default country based on IP address of user",inDemo:!1},{name:"dropdownOptions",type:Object,description:"Options for dropdown, see below",inDemo:!1},{name:"dropdownOptions.showDialCodeInList",default:!0,type:Boolean,description:"Show dial code in the dropdown list",inDemo:!0},{name:"dropdownOptions.showDialCodeInSelection",default:!1,type:Boolean,description:"Show dial code in the dropdown selection",inDemo:!0},{name:"dropdownOptions.showFlags",default:!0,type:Boolean,description:"Show flags in the dropdown selection and list",inDemo:!0},{name:"dropdownOptions.tabindex",default:0,type:Number,description:"Native dropdown <code>tabindex</code> attribute",inDemo:!1},{name:"ignoredCountries",default:[],type:Array,description:"List of countries will NOT be shown on the dropdown",inDemo:!1},{name:"inputOptions",type:Object,description:"Options for input, see below",inDemo:!1},{name:"inputOptions.autocomplete",type:String,default:"on",description:"Native input <code>autocomplete</code> attribute",inDemo:!1},{name:"inputOptions.autofocus",type:Boolean,default:!1,description:"Native input <code>autofocus</code> attribute",inDemo:!1},{name:"inputOptions.id",default:"",type:String,description:"Native input <code>id</code> attribute",inDemo:!1},{name:"inputOptions.maxlength",default:25,type:Number,description:"Native input <code>maxlength</code> attribute",inDemo:!1},{name:"inputOptions.name",default:"telephone",type:String,description:"Native input <code>name</code> attribute",inDemo:!1},{name:"inputOptions.placeholder",default:"Enter a phone number",type:String,description:"Placeholder for the input",inDemo:!1},{name:"inputOptions.readonly",default:!1,type:Boolean,description:"Native input <code>readonly</code> attribute",inDemo:!1},{name:"inputOptions.required",default:!1,type:Boolean,description:"Native input <code>required</code> attribute",inDemo:!1},{name:"inputOptions.tabindex",default:0,type:Number,description:"Native input <code>tabindex</code> attribute",inDemo:!1},{name:"inputOptions.type",default:"tel",type:String,description:"Native input <code>type</code> attribute",inDemo:!1},{name:"inputOptions.styleClasses",default:"",type:[String,Array,Object],description:"Custom classes for the <code>input</code>",inDemo:!1},{name:"invalidMsg",default:"",type:String,description:"",inDemo:!1},{name:"mode",default:"auto",type:String,description:"Allowed values: <code>'auto'</code> (Default set by phone), <code>'international'</code> (Format number with the dial code i.e. + 61), <code>'national'</code> (Format number without dial code i.e. 0321232)",inDemo:!0,options:["auto","national","international"]},{name:"onlyCountries",default:[],type:Array,description:"List of countries will be shown on the dropdown",inDemo:!1},{name:"preferredCountries",default:[],type:Array,description:"Preferred countries list, will be on top of the dropdown",inDemo:!1},{name:"styleClasses",default:"",type:[String,Array,Object],description:"Custom classes for the wrapper",inDemo:!1},{name:"validCharactersOnly",default:!1,type:Boolean,description:"Only allow valid characters in a phone number (will also verify in <code>mounted</code>, so phone number with invalid characters will be shown as an empty string)",inDemo:!1}],Bd=[...Ld].reduce((e,n)=>{if(n.name.includes(".")){const[t,d]=n.name.split(".");e[t]?Object.assign(e[t],{[d]:n.default}):Object.assign(e,{[t]:{[d]:n.default}})}else Object.assign(e,{[n.name]:n.default});return e},{}),ze={options:{...Bd}},Vd={beforeMount(e,n,t){if(typeof n.value!="function"){const d=t.context.name;let o=`[Vue-click-outside:] provided expression ${n.expression}
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dd(e,n){if(e){if(typeof e=="string")return De(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return De(e,n)}}function De(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,d=new Array(n);t<n;t++)d[t]=e[t];return d}function rd(e,n){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var d=[],o=!0,i=!1,a,s;try{for(t=t.call(e);!(o=(a=t.next()).done)&&(d.push(a.value),!(n&&d.length===n));o=!0);}catch($){i=!0,s=$}finally{try{!o&&t.return!=null&&t.return()}finally{if(i)throw s}}return d}}function od(e){if(Array.isArray(e))return e}function id(e){var n=Array.prototype.slice.call(e),t=td(n,4),d=t[0],o=t[1],i=t[2],a=t[3],s,$,u;if(typeof d=="string")s=d;else throw new TypeError("A text for parsing must be a string.");if(!o||typeof o=="string")a?($=i,u=a):($=void 0,u=i),o&&($=Qn({defaultCountry:o},$));else if(ad(o))i?($=o,u=i):u=o;else throw new Error("Invalid second argument: ".concat(o));return{text:s,options:$,metadata:u}}var ad=function(n){return X(n)==="object"};function ke(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);n&&(d=d.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,d)}return t}function Re(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?ke(Object(t),!0).forEach(function(d){sd(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ke(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function sd(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ld(e,n,t){n&&n.defaultCountry&&!It(n.defaultCountry,t)&&(n=Re(Re({},n),{},{defaultCountry:void 0}));try{return Jn(e,n,t)}catch(d){if(!(d instanceof P))throw d}}function ud(){var e=id(arguments),n=e.text,t=e.options,d=e.metadata;return ld(n,t,d)}function U(){return it(ud,arguments)}const $d={class:"cols-2-1_2 gap-small pd-small bg-white"},cd=r.createElementVNode("section",{class:"w-100 desktop-only o-hidden radius-big bg-grad-main"},null,-1),Xe={__name:"Auth",setup(e){return r.ref(null),r.ref(null),r.ref(null),_.useRoute(),_.useRouter(),r.ref("email"),(n,t)=>{const d=r.resolveComponent("router-view");return r.openBlock(),r.createElementBlock("div",$d,[r.createVNode(d,{class:"pd-medium br-solid br-1px br-grey radius-big w-m-66r t-center"},{default:r.withCtx(({Component:o,route:i})=>[r.createVNode(r.Transition,{name:"scaleIn",mode:"out-in"},{default:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(o),{ref:"page",key:i.path,localPosition:n.localPosition},null,8,["localPosition"]))]),_:2},1024)]),_:1}),cd])}}};function xe(e){const n=e;n.__i18n=n.__i18n||[],n.__i18n.push({locale:"",resource:{en:{verifyNumberTitle:t=>{const{normalize:d}=t;return d(["Verify Number"])},instructions:t=>{const{normalize:d}=t;return d(["We have sent a registration code to your phone number. Please enter it in the field below:"])},resendCode:t=>{const{normalize:d}=t;return d(["Send the code again"])},secondsResend:t=>{const{normalize:d}=t;return d(["seconds to the possibility of sending the code again."])}},ru:{verifyNumberTitle:t=>{const{normalize:d}=t;return d(["Подтвердите номер"])},instructions:t=>{const{normalize:d}=t;return d(["Мы отправили код регистрации на ваш номер телефона. Введите его в поле ниже:"])},resendCode:t=>{const{normalize:d}=t;return d(["Отправить код еще раз"])},secondsResend:t=>{const{normalize:d}=t;return d(["секунд до возможности отправить код еще раз."])}}}})}const fd={class:"t-center pd-medium"},pd={class:"mn-medium"},md={class:"mn-big t-transp"},hd={class:"w-100 mn-big flex-nowrap flex"},yd={key:1},ne={__name:"EnterCode",setup(e){const n=_.useRoute(),t=_.useRouter(),{t:d}=A.useI18n({inheritLocale:!0,useScope:"local"}),o=r.reactive({digits:["","","",""],error:null});r.watch(()=>o.digits[0],f=>{if(console.log(String(f)),console.log(String(f).length),f&&String(f).length>1){let c=String(f).split("");console.log(c);let p=[...o.digits];c.forEach((m,h)=>{console.log(h),console.log(p[h]),console.log(m),p[h]=m}),o.digits=p,u(3)}});const i=r.ref(null),a=r.ref(0);async function s(){try{await l.sendCode(l.state.user,n.query.type,l.state.user.phone?"phone":"email"),a.value=30;const f=setInterval(()=>{a.value>0?a.value-=1:clearInterval(f)},1e3)}catch{O.setError({response:{data:{errorCode:"CODE_NOT_SENT"}}})}}const $=(f,c)=>{if(f.key==="Backspace"&&(o.digits[c]===null||o.digits[c]===void 0||o.digits[c]==="")){f.preventDefault();const p=document.querySelectorAll("input"),m=c>0?p[c-1]:null;m&&(m.focus(),m.setSelectionRange(m.value.length,m.value.length))}},u=f=>{const c=document.querySelectorAll("input"),p=c[f+1],m=f>0?c[f-1]:null;if(o.digits[f]!==""&&o.digits[f]!==null&&o.digits[f]!==void 0&&f<4&&(f<3?p.focus():i.value.focus()),(o.digits[f]===null||o.digits[f]===void 0||o.digits[f]==="")&&f>0&&m.focus(),o.digits.every(h=>h!=="")){const h=o.digits.join(""),S=l.state$1.code.code.toString();h===S?(l.state$1.code.isValid=!0,t.push({path:"/auth/enter-password",query:{type:l.state$1.code.type,method:n.query.method}})):(O.setError({response:{data:{errorCode:"WRONG_CODE"}}}),i.value.focus(),o.digits=["","","",""])}};return(f,c)=>(r.openBlock(),r.createElementBlock("section",fd,[r.createElementVNode("h3",pd,r.toDisplayString(r.unref(d)("verifyNumberTitle")),1),r.createElementVNode("p",md,r.toDisplayString(r.unref(d)("instructions")),1),r.createElementVNode("div",hd,[r.withDirectives(r.createElementVNode("input",{type:"number","onUpdate:modelValue":c[0]||(c[0]=p=>o.digits[0]=p),ref_key:"firstInput",ref:i,maxlength:"1",onInput:c[1]||(c[1]=p=>u(0)),onPaste:c[2]||(c[2]=p=>f.onPaste(p,0)),onKeydown:c[3]||(c[3]=p=>$(p,0)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[r.vModelText,o.digits[0]]]),r.withDirectives(r.createElementVNode("input",{type:"number","onUpdate:modelValue":c[4]||(c[4]=p=>o.digits[1]=p),maxlength:"1",onInput:c[5]||(c[5]=p=>u(1)),onPaste:c[6]||(c[6]=p=>f.onPaste(p,1)),onKeydown:c[7]||(c[7]=p=>$(p,1)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[r.vModelText,o.digits[1]]]),r.withDirectives(r.createElementVNode("input",{type:"number","onUpdate:modelValue":c[8]||(c[8]=p=>o.digits[2]=p),maxlength:"1",onInput:c[9]||(c[9]=p=>u(2)),onPaste:c[10]||(c[10]=p=>f.onPaste(p,2)),onKeydown:c[11]||(c[11]=p=>$(p,2)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[r.vModelText,o.digits[2]]]),r.withDirectives(r.createElementVNode("input",{type:"number","onUpdate:modelValue":c[12]||(c[12]=p=>o.digits[3]=p),maxlength:"1",onInput:c[13]||(c[13]=p=>u(3)),onPaste:c[14]||(c[14]=p=>f.onPaste(p,3)),onKeydown:c[15]||(c[15]=p=>$(p,3)),class:"w-100 h1 pd-small t-center bg-grey radius-small"},null,544),[[r.vModelText,o.digits[3]]])]),a.value<1?(r.openBlock(),r.createElementBlock("a",{key:0,onClick:s,class:"t-blue"},r.toDisplayString(r.unref(d)("resendCode")),1)):(r.openBlock(),r.createElementBlock("span",yd,r.toDisplayString(a.value)+" "+r.toDisplayString(r.unref(d)("secondsResend")),1))]))}};typeof xe=="function"&&xe(ne);const gd=Object.freeze(Object.defineProperty({__proto__:null,default:ne},Symbol.toStringTag,{value:"Module"})),T=l.axios.create({baseURL:process.env.API_URL,withCredentials:!0});T.defaults.withCredentials=!0;const N=r.reactive({invites:[],invite:null,error:null}),Ye={async read(e){await T.get(`/api/invites/${e}`).then(n=>{N.invites=n.data,N.error=null}).catch(n=>{O.setError(n)})},async readOne(e){await T.get(`/api/invites/get/${e}`).then(n=>{N.invite=n.data,l.state.user.phone=n.data.invitedPhone,l.state.user.email=n.data.invitedEmail}).catch(n=>{O.setError(n)})},async create(e,n){await T.post(`/api/invites/${e}/create`,n).then(()=>{N.error=null}).catch(t=>{O.setError(t)})},async update(e,n){await T.put(`/api/invites/${e}/update`,n).then(()=>{N.error=null}).catch(t=>{O.setError(t)})},async delete(e){await T.delete(`/api/invites/${e}/delete`).then(()=>{N.error=null}).catch(n=>{O.setError(n)})}};r.watch(N,(e,n)=>{});const vd=Object.freeze(Object.defineProperty({__proto__:null,actions:Ye,state:N},Symbol.toStringTag,{value:"Module"}));const bd={class:"t-left pd-medium"},_d=r.createElementVNode("h3",{class:"mn-small"},"Вы были пригилашены в организацию",-1),Cd=r.createElementVNode("p",{class:"mn-semi t-transp"},"Пожалуйста, укажите пароль, на этом регистрация будет закочена.",-1),wd={class:"mn-semi radius-small o-hidden"},Pd={key:0},Nd={key:1},Ze={__name:"Invite",async setup(e){let n,t;const d=r.ref(null),o=_.useRoute(),i=_.useRouter();[n,t]=r.withAsyncContext(()=>Ye.readOne(o.query.inviteCode)),await n,t();async function a(){try{await y.validateInputs(d,y.validatePassword,l.state.user.password,"Некорректный пароль")}catch{throw new Error}await l.actions.signup(l.state.user,o.query.type,o.query.inviteCode)}function s(){i.push({name:"Dashboard"})}return($,u)=>(r.openBlock(),r.createElementBlock("section",bd,[_d,Cd,r.createElementVNode("div",wd,[r.createVNode(l.Field,{field:l.state.user.password,"onUpdate:field":u[0]||(u[0]=f=>l.state.user.password=f),type:"password",validation:d.value,label:"Пароль",placeholder:"******",class:"bg-white radius-small mn-small"},null,8,["field","validation"]),r.createVNode(l.Field,{field:l.state.user.passwordRepeat,"onUpdate:field":u[1]||(u[1]=f=>l.state.user.passwordRepeat=f),type:"password",label:"Повторите пароль",placeholder:"******",class:"bg-white radius-small mn-semi"},null,8,["field"])]),r.createVNode(l._sfc_main,{disabled:N.invite===null,submit:a,callback:s,class:"mn-big"},{default:r.withCtx(()=>[r.unref(o).query.method==="reset-password"?(r.openBlock(),r.createElementBlock("span",Pd,"Поменять пароль")):(r.openBlock(),r.createElementBlock("span",Nd,"Зарегистрироваться"))]),_:1},8,["disabled"])]))}},Ed=Object.freeze(Object.defineProperty({__proto__:null,default:Ze},Symbol.toStringTag,{value:"Module"}));function Me(e){const n=e;n.__i18n=n.__i18n||[],n.__i18n.push({locale:"",resource:{en:{almostDone:t=>{const{normalize:d}=t;return d(["Almost there!"])},newPasswordPrompt:t=>{const{normalize:d}=t;return d(["Please, set a new password."])},registrationPasswordPrompt:t=>{const{normalize:d}=t;return d(["Please, set your password to complete the registration."])},passwordPlaceholder:t=>{const{normalize:d}=t;return d(["Password"])},repeatPasswordPlaceholder:t=>{const{normalize:d}=t;return d(["Repeat Password"])},changePasswordBtn:t=>{const{normalize:d}=t;return d(["Change Password"])},registerBtn:t=>{const{normalize:d}=t;return d(["Register"])}},ru:{almostDone:t=>{const{normalize:d}=t;return d(["Почти все!"])},newPasswordPrompt:t=>{const{normalize:d}=t;return d(["Пожалуйста, укажите новый пароль."])},registrationPasswordPrompt:t=>{const{normalize:d}=t;return d(["Пожалуйста, укажите пароль, на этом регистрация будет закончена."])},passwordPlaceholder:t=>{const{normalize:d}=t;return d(["Пароль"])},repeatPasswordPlaceholder:t=>{const{normalize:d}=t;return d(["Повторите пароль"])},changePasswordBtn:t=>{const{normalize:d}=t;return d(["Поменять пароль"])},registerBtn:t=>{const{normalize:d}=t;return d(["Зарегистрироваться"])}}}})}const Sd={class:"t-left pd-medium"},Od={class:"mn-small"},Id={key:0,class:"mn-semi t-transp"},Td={key:1,class:"mn-semi t-transp"},Ad={class:"mn-semi radius-small o-hidden"},Fd={key:0},Dd={key:1},de={__name:"EnterPassword",setup(e){const n=r.ref(null),{t}=A.useI18n({inheritLocale:!0,useScope:"local"}),d=_.useRoute(),o=_.useRouter();r.ref("phone");async function i(){try{await y.validateInputs(n,y.validatePassword,l.state.user.password,"Некорректный пароль")}catch{throw new Error}d.query.method==="reset-password"&&await l.actions.updatePassword(l.state.user,d.query.type),d.query.method!=="reset-password"&&await l.actions.signup(l.state.user,d.query.type)}function a(){o.push({name:"User Profile",params:{_id:l.state.user._id}})}return(s,$)=>(r.openBlock(),r.createElementBlock("section",Sd,[r.createElementVNode("h3",Od,r.toDisplayString(r.unref(t)("almostDone")),1),r.unref(d).query.method==="reset-password"?(r.openBlock(),r.createElementBlock("p",Id,r.toDisplayString(r.unref(t)("newPasswordPrompt")),1)):(r.openBlock(),r.createElementBlock("p",Td,r.toDisplayString(r.unref(t)("registrationPasswordPrompt")),1)),r.createElementVNode("div",Ad,[r.createVNode(l.Field,{field:l.state.user.password,"onUpdate:field":$[0]||($[0]=u=>l.state.user.password=u),type:"password",validation:n.value,placeholder:r.unref(t)("passwordPlaceholder"),class:"bg-grey pd-small radius-small mn-thin"},null,8,["field","validation","placeholder"]),r.createVNode(l.Field,{field:l.state.user.passwordRepeat,"onUpdate:field":$[1]||($[1]=u=>l.state.user.passwordRepeat=u),type:"password",placeholder:r.unref(t)("repeatPasswordPlaceholder"),class:"bg-grey pd-small radius-small mn-thin"},null,8,["field","placeholder"])]),r.createVNode(l._sfc_main,{submit:i,callback:a,class:"mn-big"},{default:r.withCtx(()=>[r.unref(d).query.method==="reset-password"?(r.openBlock(),r.createElementBlock("span",Fd,r.toDisplayString(r.unref(t)("changePasswordBtn")),1)):(r.openBlock(),r.createElementBlock("span",Dd,r.toDisplayString(r.unref(t)("registerBtn")),1))]),_:1})]))}};typeof Me=="function"&&Me(de);const kd=Object.freeze(Object.defineProperty({__proto__:null,default:de},Symbol.toStringTag,{value:"Module"})),Rd=[["افغانستان","af","93",,"🇦🇫"],["Shqipëri","al","355",,"🇦🇱"],["الجزائر","dz","213",,"🇩🇿"],["American Samoa","as","1684",,"🇦🇸"],["Andorra","ad","376",,"🇦🇩"],["Angola","ao","244",,"🇦🇴"],["Anguilla","ai","1264",,"🇦🇮"],["Antigua and Barbuda","ag","1268",,"🇦🇬"],["Argentina","ar","54",,"🇦🇷"],["Հայաստան","am","374",,"🇦🇲"],["Aruba","aw","297",,"🇦🇼"],["Australia","au","61",0,,"🇦🇺"],["Österreich","at","43",,"🇦🇹"],["Azərbaycan","az","994",,"🇦🇿"],["Bahamas","bs","1242",,"🇧🇸"],["البحرين","bh","973",,"🇧🇭"],["বাংলাদেশ","bd","880",,"🇧🇩"],["Barbados","bb","1246",,"🇧🇧"],["Беларусь","by","375",,"🇧🇾"],["België","be","32",,"🇧🇪"],["Belize","bz","501",,"🇧🇿"],["Bénin","bj","229",,"🇧🇯"],["Bermuda","bm","1441",,"🇧🇲"],["འབྲུག","bt","975",,"🇧🇹"],["Bolivia","bo","591",,"🇧🇴"],["Босна и Херцеговина","ba","387",,"🇧🇦"],["Botswana","bw","267",,"🇧🇼"],["Brasil","br","55",,"🇧🇷"],["British Indian Ocean Territory","io","246",,"🇮🇴"],["British Virgin Islands","vg","1284",,"🇻🇬"],["Brunei","bn","673",,"🇧🇳"],["България","bg","359",,"🇧🇬"],["Burkina Faso","bf","226",,"🇧🇫"],["Uburundi","bi","257",,"🇧🇮"],["កម្ពុជា","kh","855",,"🇰🇭"],["Cameroun","cm","237",,"🇨🇲"],["Canada","ca","1",1,"🇨🇦"],["Kabu Verdi","cv","238",,"🇨🇻"],["Caribbean Netherlands","bq","599",1,,"🇧🇶"],["Cayman Islands","ky","1345",,"🇰🇾"],["République centrafricaine","cf","236",,"🇨🇫"],["Tchad","td","235",,"🇹🇩"],["Chile","cl","56",,"🇨🇱"],["中国","cn","86",,"🇨🇳"],["Christmas Island","cx","61",2,,"🇨🇽"],["Keeling","cc","61",1,,"🇨🇨"],["Colombia","co","57",,"🇨🇴"],["جزر القمر","km","269",,"🇰🇲"],["DRC","cd","243",,"🇨🇩"],["Republic","cg","242",,"🇨🇬"],["Cook Islands","ck","682",,"🇨🇰"],["Costa Rica","cr","506",,"🇨🇷"],["Côte d’Ivoire","ci","225",,"🇨🇮"],["Hrvatska","hr","385",,"🇭🇷"],["Cuba","cu","53",,"🇨🇺"],["Curaçao","cw","599",0,,"🇨🇼"],["Κύπρος","cy","357",,"🇨🇾"],["Česká republika","cz","420",,"🇨🇿"],["Danmark","dk","45",,"🇩🇰"],["Djibouti","dj","253",,"🇩🇯"],["Dominica","dm","1767",,"🇩🇲"],["República Dominicana","do","1",2,["809","829","849","🇩🇴"]],["Ecuador","ec","593",,"🇪🇨"],["مصر","eg","20",,"🇪🇬"],["El Salvador","sv","503",,"🇸🇻"],["Guinea Ecuatorial","gq","240",,"🇬🇶"],["Eritrea","er","291",,"🇪🇷"],["Eesti","ee","372",,"🇪🇪"],["Ethiopia","et","251",,"🇪🇹"],["Islas Malvinas","fk","500",,"🇫🇰"],["Føroyar","fo","298",,"🇫🇴"],["Fiji","fj","679",,"🇫🇯"],["Suomi","fi","358",0,,"🇫🇮"],["France","fr","33",,"🇫🇷"],["Guyane française","gf","594",,"🇬🇫"],["Polynésie française","pf","689",,"🇵🇫"],["Gabon","ga","241",,"🇬🇦"],["Gambia","gm","220",,"🇬🇲"],["საქართველო","ge","995",,"🇬🇪"],["Deutschland","de","49",,"🇩🇪"],["Gaana","gh","233",,"🇬🇭"],["Gibraltar","gi","350",,"🇬🇮"],["Ελλάδα","gr","30",,"🇬🇷"],["Kalaallit Nunaat","gl","299",,"🇬🇱"],["Grenada","gd","1473",,"🇬🇩"],["Guadeloupe","gp","590",0,,"🇬🇵"],["Guam","gu","1671",,"🇬🇺"],["Guatemala","gt","502",,"🇬🇹"],["Guernsey","gg","44",1,,"🇬🇬"],["Guinée","gn","224",,"🇬🇳"],["Guiné Bissau","gw","245",,"🇬🇼"],["Guyana","gy","592",,"🇬🇾"],["Haiti","ht","509",,"🇭🇹"],["Honduras","hn","504",,"🇭🇳"],["香港","hk","852",,"🇭🇰"],["Magyarország","hu","36",,"🇭🇺"],["Ísland","is","354",,"🇮🇸"],["भारत","in","91",,"🇮🇳"],["Indonesia","id","62",,"🇮🇩"],["ایران","ir","98",,"🇮🇷"],["العراق","iq","964",,"🇮🇶"],["Ireland","ie","353",,"🇮🇪"],["Isle of Man","im","44",2,,"🇮🇲"],["ישראל","il","972",,"🇮🇱"],["Italia","it","39",0,,"🇮🇹"],["Jamaica","jm","1876",,"🇯🇲"],["日本","jp","81",,"🇯🇵"],["Jersey","je","44",3,,"🇯🇪"],["الأردن","jo","962",,"🇯🇴"],["Казахстан","kz","7",1,,"🇰🇿"],["Kenya","ke","254",,"🇰🇪"],["Kiribati","ki","686",,"🇰🇮"],["Kosovo","xk","383",,"🇽🇰"],["الكويت","kw","965",,"🇰🇼"],["Кыргызстан","kg","996",,"🇰🇬"],["ລາວ","la","856",,"🇱🇦"],["Latvija","lv","371",,"🇱🇻"],["لبنان","lb","961",,"🇱🇧"],["Lesotho","ls","266",,"🇱🇸"],["Liberia","lr","231",,"🇱🇷"],["ليبيا","ly","218",,"🇱🇾"],["Liechtenstein","li","423",,"🇱🇮"],["Lietuva","lt","370",,"🇱🇹"],["Luxembourg","lu","352",,"🇱🇺"],["澳門","mo","853",,"🇲🇴"],["FYROM","mk","389",,"🇲🇰"],["Madagasikara","mg","261",,"🇲🇬"],["Malawi","mw","265",,"🇲🇼"],["Malaysia","my","60",,"🇲🇾"],["Maldives","mv","960",,"🇲🇻"],["Mali","ml","223",,"🇲🇱"],["Malta","mt","356",,"🇲🇹"],["Marshall Islands","mh","692",,"🇲🇭"],["Martinique","mq","596",,"🇲🇶"],["موريتانيا","mr","222",,"🇲🇷"],["Moris","mu","230",,"🇲🇺"],["Mayotte","yt","262",1,,"🇾🇹"],["México","mx","52",,"🇲🇽"],["Micronesia","fm","691",,"🇫🇲"],["Republica Moldova","md","373",,"🇲🇩"],["Monaco","mc","377",,"🇲🇨"],["Монгол","mn","976",,"🇲🇳"],["Crna Gora","me","382",,"🇲🇪"],["Montserrat","ms","1664",,"🇲🇸"],["المغرب","ma","212",0,,"🇲🇦"],["Moçambique","mz","258",,"🇲🇿"],["Burma","mm","95",,"🇲🇲"],["Namibië","na","264",,"🇳🇦"],["Nauru","nr","674",,"🇳🇷"],["नेपाल","np","977",,"🇳🇵"],["Nederland","nl","31",,"🇳🇱"],["Nouvelle-Calédonie","nc","687",,"🇳🇨"],["New Zealand","nz","64",,"🇳🇿"],["Nicaragua","ni","505",,"🇳🇮"],["Nijar","ne","227",,"🇳🇪"],["Nigeria","ng","234",,"🇳🇬"],["Niue","nu","683",,"🇳🇺"],["Norfolk Island","nf","672",,"🇳🇫"],["조선 민주주의 인민 공화국","kp","850",,"🇰🇵"],["Northern Mariana Islands","mp","1670",,"🇲🇵"],["Norge","no","47",0,,"🇳🇴"],["عُمان","om","968",,"🇴🇲"],["پاکستان","pk","92",,"🇵🇰"],["Palau","pw","680",,"🇵🇼"],["فلسطين","ps","970",,"🇵🇸"],["Panamá","pa","507",,"🇵🇦"],["Papua New Guinea","pg","675",,"🇵🇬"],["Paraguay","py","595",,"🇵🇾"],["Perú","pe","51",,"🇵🇪"],["Philippines","ph","63",,"🇵🇭"],["Polska","pl","48",,"🇵🇱"],["Portugal","pt","351",,"🇵🇹"],["Puerto Rico","pr","1",3,["787","939","🇵🇷"]],["قطر","qa","974",,"🇶🇦"],["La Réunion","re","262",0,,"🇷🇪"],["România","ro","40",,"🇷🇴"],["Россия","ru","7",0,,"🇷🇺"],["Rwanda","rw","250",,"🇷🇼"],["Saint Barthélemy","bl","590",1,,"🇧🇱"],["Saint Helena","sh","290",,"🇸🇭"],["Saint Kitts and Nevis","kn","1869",,"🇰🇳"],["Saint Lucia","lc","1758",,"🇱🇨"],["Saint-Martin (partie française","mf","590",2,,"🇲🇫"],["Saint-Pierre-et-Miquelon","pm","508",,"🇵🇲"],["Saint Vincent and the Grenadines","vc","1784",,"🇻🇨"],["Samoa","ws","685",,"🇼🇸"],["San Marino","sm","378",,"🇸🇲"],["São Tomé e Príncipe","st","239",,"🇸🇹"],["المملكة العربية السعودية","sa","966",,"🇸🇦"],["Sénégal","sn","221",,"🇸🇳"],["Србија","rs","381",,"🇷🇸"],["Seychelles","sc","248",,"🇸🇨"],["Sierra Leone","sl","232",,"🇸🇱"],["Singapore","sg","65",,"🇸🇬"],["Sint Maarten","sx","1721",,"🇸🇽"],["Slovensko","sk","421",,"🇸🇰"],["Slovenija","si","386",,"🇸🇮"],["Solomon Islands","sb","677",,"🇸🇧"],["Soomaaliya","so","252",,"🇸🇴"],["South Africa","za","27",,"🇿🇦"],["대한민국","kr","82",,"🇰🇷"],["جنوب السودان","ss","211",,"🇸🇸"],["España","es","34",,"🇪🇸"],["ශ්රී ලංකාව","lk","94",,"🇱🇰"],["السودان","sd","249",,"🇸🇩"],["Suriname","sr","597",,"🇸🇷"],["Svalbard and Jan Mayen","sj","47",1,,"🇸🇯"],["Swaziland","sz","268",,"🇸🇿"],["Sverige","se","46",,"🇸🇪"],["Schweiz","ch","41",,"🇨🇭"],["سوريا","sy","963",,"🇸🇾"],["台灣","tw","886",,"🇹🇼"],["Tajikistan","tj","992",,"🇹🇯"],["Tanzania","tz","255",,"🇹🇿"],["ไทย","th","66",,"🇹🇭"],["Timor-Leste","tl","670",,"🇹🇱"],["Togo","tg","228",,"🇹🇬"],["Tokelau","tk","690",,"🇹🇰"],["Tonga","to","676",,"🇹🇴"],["Trinidad and Tobago","tt","1868",,"🇹🇹"],["تونس","tn","216",,"🇹🇳"],["Türkiye","tr","90",,"🇹🇷"],["Turkmenistan","tm","993",,"🇹🇲"],["Turks and Caicos Islands","tc","1649",,"🇹🇨"],["Tuvalu","tv","688",,"🇹🇻"],["U.S. Virgin Islands","vi","1340",,"🇻🇮"],["Uganda","ug","256",,"🇺🇬"],["Україна","ua","380",,"🇺🇦"],["الإمارات العربية المتحدة","ae","971",,"🇦🇪"],["United Kingdom","gb","44",0,,"🇬🇧"],["United States","us","1",0,,"🇺🇸"],["Uruguay","uy","598",,"🇺🇾"],["Oʻzbekiston","uz","998",,"🇺🇿"],["Vanuatu","vu","678",,"🇻🇺"],["Città del Vaticano","va","39",1,,"🇻🇦"],["Venezuela","ve","58",,"🇻🇪"],["Việt Nam","vn","84",,"🇻🇳"],["Wallis-et-Futuna","wf","681",,"🇼🇫"],["الصحراء الغربية","eh","212",1,,"🇪🇭"],["اليمن","ye","967",,"🇾🇪"],["Zambia","zm","260",,"🇿🇲"],["Zimbabwe","zw","263",,"🇿🇼"],["Åland Islands","ax","358",1,,"🇦🇽"]],xd=Rd.map(e=>({name:e[0],iso2:e[1].toUpperCase(),dialCode:e[2],priority:e[3]||0,areaCodes:e[4]||null,flag:e[e.length-1]||null}));function Md(){return fetch("https://ip2c.org/s").then(e=>e.text()).then(e=>{const n=(e||"").toString();if(!n||n[0]!=="1")throw new Error("unable to fetch the country");return n.substr(2,2)})}function zd(e,n){if(e.setSelectionRange)e.focus(),e.setSelectionRange(n,n);else if(e.createTextRange){const t=e.createTextRange();t.collapse(!0),t.moveEnd("character",n),t.moveStart("character",n),t.select()}}const Ld=[{name:"allCountries",type:Array,default:xd,description:"All countries that are used in <code>libphonenumber-js</code>, can be overridden by this prop",inDemo:!1},{name:"autoFormat",type:Boolean,default:!0,description:"Auto update the input to the formatted phone number when it's valid",inDemo:!0},{name:"customValidate",type:[Boolean,RegExp],default:!1,description:"Custom validation RegExp for input",inDemo:!1},{name:"defaultCountry",default:"",type:String,description:"Default country, will override the country fetched from IP address of user",inDemo:!1},{name:"disabled",default:!1,type:Boolean,description:"Disable <code>vue-tel-input</code>, including the input & flag dropdown",inDemo:!1},{name:"autoDefaultCountry",default:!0,type:Boolean,description:"To fetch default country based on IP address of user",inDemo:!1},{name:"dropdownOptions",type:Object,description:"Options for dropdown, see below",inDemo:!1},{name:"dropdownOptions.showDialCodeInList",default:!0,type:Boolean,description:"Show dial code in the dropdown list",inDemo:!0},{name:"dropdownOptions.showDialCodeInSelection",default:!1,type:Boolean,description:"Show dial code in the dropdown selection",inDemo:!0},{name:"dropdownOptions.showFlags",default:!0,type:Boolean,description:"Show flags in the dropdown selection and list",inDemo:!0},{name:"dropdownOptions.tabindex",default:0,type:Number,description:"Native dropdown <code>tabindex</code> attribute",inDemo:!1},{name:"ignoredCountries",default:[],type:Array,description:"List of countries will NOT be shown on the dropdown",inDemo:!1},{name:"inputOptions",type:Object,description:"Options for input, see below",inDemo:!1},{name:"inputOptions.autocomplete",type:String,default:"on",description:"Native input <code>autocomplete</code> attribute",inDemo:!1},{name:"inputOptions.autofocus",type:Boolean,default:!1,description:"Native input <code>autofocus</code> attribute",inDemo:!1},{name:"inputOptions.id",default:"",type:String,description:"Native input <code>id</code> attribute",inDemo:!1},{name:"inputOptions.maxlength",default:25,type:Number,description:"Native input <code>maxlength</code> attribute",inDemo:!1},{name:"inputOptions.name",default:"telephone",type:String,description:"Native input <code>name</code> attribute",inDemo:!1},{name:"inputOptions.placeholder",default:"Enter a phone number",type:String,description:"Placeholder for the input",inDemo:!1},{name:"inputOptions.readonly",default:!1,type:Boolean,description:"Native input <code>readonly</code> attribute",inDemo:!1},{name:"inputOptions.required",default:!1,type:Boolean,description:"Native input <code>required</code> attribute",inDemo:!1},{name:"inputOptions.tabindex",default:0,type:Number,description:"Native input <code>tabindex</code> attribute",inDemo:!1},{name:"inputOptions.type",default:"tel",type:String,description:"Native input <code>type</code> attribute",inDemo:!1},{name:"inputOptions.styleClasses",default:"",type:[String,Array,Object],description:"Custom classes for the <code>input</code>",inDemo:!1},{name:"invalidMsg",default:"",type:String,description:"",inDemo:!1},{name:"mode",default:"auto",type:String,description:"Allowed values: <code>'auto'</code> (Default set by phone), <code>'international'</code> (Format number with the dial code i.e. + 61), <code>'national'</code> (Format number without dial code i.e. 0321232)",inDemo:!0,options:["auto","national","international"]},{name:"onlyCountries",default:[],type:Array,description:"List of countries will be shown on the dropdown",inDemo:!1},{name:"preferredCountries",default:[],type:Array,description:"Preferred countries list, will be on top of the dropdown",inDemo:!1},{name:"styleClasses",default:"",type:[String,Array,Object],description:"Custom classes for the wrapper",inDemo:!1},{name:"validCharactersOnly",default:!1,type:Boolean,description:"Only allow valid characters in a phone number (will also verify in <code>mounted</code>, so phone number with invalid characters will be shown as an empty string)",inDemo:!1}],Bd=[...Ld].reduce((e,n)=>{if(n.name.includes(".")){const[t,d]=n.name.split(".");e[t]?Object.assign(e[t],{[d]:n.default}):Object.assign(e,{[t]:{[d]:n.default}})}else Object.assign(e,{[n.name]:n.default});return e},{}),ze={options:{...Bd}},Vd={beforeMount(e,n,t){if(typeof n.value!="function"){const d=t.context.name;let o=`[Vue-click-outside:] provided expression ${n.expression}
|
8
8
|
is not a function, but has to be`;d&&(o+=`Found in component ${d}`),console.warn(o)}e.clickOutsideEvent=function(d){e===d.target||e.contains(d.target)||n.value(d,e)},document.body.addEventListener("click",e.clickOutsideEvent)},unmounted(e){document.body.removeEventListener("click",e.clickOutsideEvent)}};function v(e){const n=ze.options[e];return typeof n>"u"?ze.options[e]:n}const jd=r.defineComponent({name:"Vue3ReactiveTelInput",directives:{clickOutside:Vd},props:{modelValue:{type:String,default:""},badClass:{type:[String,Array,Object],default:""},goodClass:{type:[String,Array,Object],default:""},badStyle:{type:[String,Array,Object],default:""},goodStyle:{type:[String,Array,Object],default:""},badInputClass:{type:[String,Array,Object],default:""},goodInputClass:{type:[String,Array,Object],default:""},badInputStyle:{type:[String,Array,Object],default:""},goodInputStyle:{type:[String,Array,Object],default:""},allCountries:{type:Array,default:()=>v("allCountries")},autoFormat:{type:Boolean,default:()=>v("autoFormat")},validation:{type:[Boolean,Object],default:!1},customValidate:{type:[Boolean,RegExp],default:()=>v("customValidate")},defaultCountry:{type:String,default:()=>v("defaultCountry")},disabled:{type:Boolean,default:()=>v("disabled")},autoDefaultCountry:{type:Boolean,default:()=>v("autoDefaultCountry")},dropdownOptions:{type:Object,default:()=>v("dropdownOptions")},ignoredCountries:{type:Array,default:()=>v("ignoredCountries")},inputOptions:{type:Object,default:()=>v("inputOptions")},invalidMsg:{type:String,default:()=>v("invalidMsg")},mode:{type:String,default:()=>v("mode")},onlyCountries:{type:Array,default:()=>v("onlyCountries")},preferredCountries:{type:Array,default:()=>v("preferredCountries")},validCharactersOnly:{type:Boolean,default:()=>v("validCharactersOnly")},rootClass:{type:[String,Array,Object],default:()=>v("styleClasses")},inputClass:{type:[String,Array,Object],default:()=>""},divInputClass:{type:[String,Array,Object],default:()=>""},rootStyle:{type:[String,Array,Object],default:()=>""},dropdownStyle:{type:[String,Array,Object],default:()=>""},listStyle:{type:[String,Array,Object],default:()=>""},inputStyle:{type:[String,Array,Object],default:()=>""},inputId:{type:[String,Array,Object],default:()=>""},Placeholder:{type:[String,Object,Function],default:()=>""}},data(){return{counter:5,initCounter:5,message:{action:null,amount:null},phone:this.modelValue?this.modelValue:"",activeCountryCode:"",open:!1,finishMounted:!1,selectedIndex:null,typeToFindInput:"",typeToFindTimer:null,dropdownOpenDirection:"below",parsedPlaceholder:this.Placeholder!==""?this.Placeholder:this.inputOptions.placeholder}},watch:{activeCountry(e,n){if(!e&&(n!=null&&n.iso2)){this.activeCountryCode=n.iso2;return}e!=null&&e.iso2&&this.$emit("country-changed",e)},"phoneObject.countryCode":function(e){this.activeCountryCode=e},"phoneObject.valid":function(){this.$emit("validate",this.phoneObject)},"phoneObject.formatted":function(e){!this.autoFormat||this.customValidate||(this.emitInput(e),this.$nextTick(()=>{e&&!this.value&&(this.phone=e)}))},"inputOptions.placeholder":function(){this.resetPlaceholder()},value(e,n){this.testCharacters()?this.phone=e:this.$nextTick(()=>{this.phone=n,this.onInput()})},open(e){e?(this.setDropdownPosition(),this.$emit("open")):this.$emit("close")}},mounted(){this.cleanInvalidCharacters(),this.initializeCountry().then(()=>{var e;!this.phone&&((e=this.inputOptions)!=null&&e.showDialCode)&&this.activeCountryCode&&(this.phone=`+${this.activeCountryCode}`),this.$emit("validate",this.phoneObject)}).catch(console.error).then(()=>{this.finishMounted=!0})},computed:{activeCountry(){return this.findCountry(this.activeCountryCode)},activeCountryFlag(){return this.activeCountry?this.activeCountry.flag:null},parsedMode(){return this.mode==="auto"?!this.phone||this.phone[0]!=="+"?"national":"international":["international","national"].includes(this.mode)?this.mode:(console.error('Invalid value of prop "mode"'),"international")},filteredCountries(){return this.onlyCountries.length?this.allCountries.filter(({iso2:e})=>this.onlyCountries.some(n=>n.toUpperCase()===e)):this.ignoredCountries.length?this.allCountries.filter(({iso2:e})=>!this.ignoredCountries.includes(e.toUpperCase())&&!this.ignoredCountries.includes(e.toLowerCase())):this.allCountries},sortedCountries(){return[...this.getCountries(this.preferredCountries).map(n=>({...n,preferred:!0})),...this.filteredCountries]},phoneObject(){var i,a,s;let e;((i=this.phone)==null?void 0:i[0])==="+"?e=U(this.phone)||{}:e=U(this.phone,this.activeCountryCode)||{};const{metadata:n,...t}=e;console.log(e);let d=(a=e.isValid)==null?void 0:a.call(e),o=this.phone;return d&&(o=(s=e.format)==null?void 0:s.call(e,this.parsedMode.toUpperCase(),{nationalPrefix:!1})),e.country&&(this.ignoredCountries.length||this.onlyCountries.length)&&(this.findCountry(e.country)||(d=!1,Object.assign(e,{country:null}))),Object.assign(t,{countryCode:e.country,valid:d,country:this.activeCountry,formatted:o}),t},classes(){return this.phoneObject.valid===!0?this.goodClass:this.phoneObject.valid===!1?this.badClass:void 0},styles(){return this.phoneObject.valid===!0?this.goodStyle:this.phoneObject.valid===!1?this.badStyle:void 0},Iclasses(){return this.phoneObject.valid===!0?this.goodInputClass:this.phoneObject.valid===!1?this.badInputClass:void 0},Istyles(){return this.phoneObject.valid===!0?this.goodInputStyle:this.phoneObject.valid===!1?this.badInputStyle:void 0}},methods:{resetPlaceholder(){this.parsedPlaceholder=this.inputOptions.placeholder},initializeCountry(){return new Promise(e=>{var t;if(((t=this.phone)==null?void 0:t[0])==="+"){e();return}if(this.defaultCountry){this.choose(this.defaultCountry),e();return}const n=this.preferredCountries[0]||this.filteredCountries[0];this.autoDefaultCountry?Md().then(d=>{this.choose(d||this.activeCountryCode)}).catch(d=>{console.warn(d),this.choose(n)}).then(()=>{e()}):(this.choose(n),e())})},getCountries(e=[]){return e.map(n=>this.findCountry(n)).filter(Boolean)},findCountry(e=""){return this.filteredCountries.find(n=>n.iso2===e.toUpperCase())},getItemClass(e,n){const t=this.selectedIndex===e,d=e===this.preferredCountries.length-1,o=this.preferredCountries.some(i=>i.toUpperCase()===n);return{highlighted:t,"last-preferred":d,preferred:o}},choose(e){var t,d;let n=e;if(typeof n=="string"&&(n=this.findCountry(n)),!!n){if(((t=this.phone)==null?void 0:t[0])==="+"&&n.iso2&&this.phoneObject.nationalNumber){this.activeCountryCode=n.iso2,this.phone=U(this.phoneObject.nationalNumber,n.iso2).formatInternational();return}if((d=this.inputOptions)!=null&&d.showDialCode&&n){this.phone=`+${n.dialCode}`;return}this.activeCountryCode=n.iso2,this.emitInput(this.phone)}},cleanInvalidCharacters(){const e=this.phone;if(this.validCharactersOnly){const n=this.phone.match(/[()\-+0-9\s]*/g);this.phone=n.join("")}if(this.customValidate&&this.customValidate instanceof RegExp){const n=this.phone.match(this.customValidate);this.phone=n.join("")}e!==this.phone&&this.emitInput(this.phone)},testCharacters(){return this.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(this.phone)?!1:this.customValidate?this.testCustomValidate():!0},testCustomValidate(){return this.customValidate instanceof RegExp?this.customValidate.test(this.phone):!1},onInput(){this.$refs.input.setCustomValidity(this.phoneObject.valid?"":this.invalidMsg),this.emitInput(this.phoneObject)},emitInput(e){this.$emit("update:modelValue",e)},onBlur(){this.$emit("blur")},onFocus(){zd(this.$refs.input,this.phone.length),this.$emit("focus")},onEnter(){this.$emit("enter")},onSpace(){this.$emit("space")},focus(){this.$refs.input.focus()},toggleDropdown(){this.disabled||(this.open=!this.open)},clickedOutside(){this.open=!1},keyboardNav(e){if(e.keyCode===40){e.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=0:this.selectedIndex=Math.min(this.sortedCountries.length-1,this.selectedIndex+1);const n=this.$refs.list.children[this.selectedIndex];n.offsetTop+n.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight&&(this.$refs.list.scrollTop=n.offsetTop-this.$refs.list.clientHeight+n.clientHeight)}else if(e.keyCode===38){e.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=this.sortedCountries.length-1:this.selectedIndex=Math.max(0,this.selectedIndex-1);const n=this.$refs.list.children[this.selectedIndex];n.offsetTop<this.$refs.list.scrollTop&&(this.$refs.list.scrollTop=n.offsetTop)}else if(e.keyCode===13)this.selectedIndex!==null&&this.choose(this.sortedCountries[this.selectedIndex]),this.open=!this.open;else{this.typeToFindInput+=e.key,clearTimeout(this.typeToFindTimer),this.typeToFindTimer=setTimeout(()=>{this.typeToFindInput=""},700);const n=this.sortedCountries.slice(this.preferredCountries.length).findIndex(t=>t.name.toLowerCase().startsWith(this.typeToFindInput));if(n>=0){this.selectedIndex=this.preferredCountries.length+n;const t=this.$refs.list.children[this.selectedIndex],d=t.offsetTop<this.$refs.list.scrollTop,o=t.offsetTop+t.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight;(d||o)&&(this.$refs.list.scrollTop=t.offsetTop-this.$refs.list.clientHeight/2)}}},reset(){this.selectedIndex=this.sortedCountries.map(e=>e.iso2).indexOf(this.activeCountryCode),this.open=!1},setDropdownPosition(){window.innerHeight-this.$refs.rootElement.getBoundingClientRect().bottom>200?this.dropdownOpenDirection="below":this.dropdownOpenDirection="above"}}}),Ud=["tabindex"],Gd={class:"flex-nowrap flex flex-v-center p-medium vti__selection"},Hd=["innerHTML"],Kd={key:1,class:"vti__country-code"},Wd=["onClick","onMousemove"],qd=["innerHTML"],Xd={key:1},Yd=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex"],Zd={key:0,class:"mn-t-thin mn-b-thin invalid-feedback"};function Jd(e,n,t,d,o,i){const a=r.resolveDirective("click-outside");return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{class:r.normalizeClass(["vue3-reactive-tel-input",{"bg-fourth-nano":e.validation},e.$attrs.class,e.rootClass,{disabled:e.disabled},e.classes]),style:r.normalizeStyle([e.rootStyle,e.styles]),ref:"rootElement"},[r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([["vti__dropdown",{open:e.open}],"br-solid br-black-transp br-1px radius-medium"]),tabindex:e.dropdownOptions.tabindex,onKeydown:[n[0]||(n[0]=(...s)=>e.keyboardNav&&e.keyboardNav(...s)),n[2]||(n[2]=r.withKeys((...s)=>e.reset&&e.reset(...s),["esc"]))],onClick:n[1]||(n[1]=(...s)=>e.toggleDropdown&&e.toggleDropdown(...s)),style:r.normalizeStyle([e.dropdownStyle])},[r.createElementVNode("span",Gd,[e.dropdownOptions.showFlags?(r.openBlock(),r.createElementBlock("span",{key:0,innerHTML:e.activeCountryFlag,class:"mn-r-thin"},null,8,Hd)):r.createCommentVNode("",!0),e.dropdownOptions.showDialCodeInSelection?(r.openBlock(),r.createElementBlock("span",Kd," +"+r.toDisplayString(e.activeCountry&&e.activeCountry.dialCode),1)):r.createCommentVNode("",!0)]),r.withDirectives(r.createElementVNode("ul",{ref:"list",class:r.normalizeClass(["bs-black radius-small vti__dropdown-list",e.dropdownOpenDirection]),style:r.normalizeStyle([e.listStyle])},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.sortedCountries,(s,$)=>(r.openBlock(),r.createElementBlock("li",{class:r.normalizeClass(["flex-nowrap flex w-max",["vti__dropdown-item",e.getItemClass($,s.iso2)]]),key:s.iso2+(s.preferred?"-preferred":""),onClick:u=>e.choose(s),onMousemove:u=>e.selectedIndex=$},[e.dropdownOptions.showFlags?(r.openBlock(),r.createElementBlock("span",{key:0,innerHTML:s.flag,class:"mn-r-thin"},null,8,qd)):r.createCommentVNode("",!0),r.createElementVNode("strong",null,r.toDisplayString(s.name),1),e.dropdownOptions.showDialCodeInList?(r.openBlock(),r.createElementBlock("span",Xd," +"+r.toDisplayString(s.dialCode),1)):r.createCommentVNode("",!0)],42,Wd))),128))],6),[[r.vShow,e.open]])],46,Ud)),[[a,e.clickedOutside]]),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":n[3]||(n[3]=s=>e.phone=s),pattern:"[0-9]*",ref:"input",type:e.inputOptions.type,autocomplete:e.inputOptions.autocomplete,autofocus:e.inputOptions.autofocus,class:r.normalizeClass(["vti__input",e.inputOptions.styleClasses,e.inputClass,e.Iclasses]),style:r.normalizeStyle([e.inputStyle,e.Istyles]),disabled:e.disabled,id:e.inputId!==""?e.inputId:e.inputOptions.id,maxlength:e.inputOptions.maxlength,name:e.inputId!==""?e.inputId:e.inputOptions.name,placeholder:e.parsedPlaceholder,readonly:e.inputOptions.readonly,required:e.inputOptions.required,tabindex:e.inputOptions.tabindex,onBlur:n[4]||(n[4]=(...s)=>e.onBlur&&e.onBlur(...s)),onFocus:n[5]||(n[5]=(...s)=>e.onFocus&&e.onFocus(...s)),onInput:n[6]||(n[6]=(...s)=>e.onInput&&e.onInput(...s)),onKeyup:[n[7]||(n[7]=r.withKeys((...s)=>e.onEnter&&e.onEnter(...s),["enter"])),n[8]||(n[8]=r.withKeys((...s)=>e.onSpace&&e.onSpace(...s),["space"]))]},null,46,Yd),[[r.vModelDynamic,e.phone]]),r.renderSlot(e.$slots,"default",{},void 0,!0)],6),r.createVNode(r.Transition,{name:"fade"},{default:r.withCtx(()=>[e.validation?(r.openBlock(),r.createElementBlock("div",Zd," * "+r.toDisplayString(e.validation.message),1)):r.createCommentVNode("",!0)]),_:1})],64)}const re=et._export_sfc(jd,[["render",Jd],["__scopeId","data-v-50353ca7"]]);function Le(e){const n=e;n.__i18n=n.__i18n||[],n.__i18n.push({locale:"",resource:{en:{forgotPasswordTitle:t=>{const{normalize:d}=t;return d(["Forgot Password?"])},instructions:t=>{const{normalize:d}=t;return d(["To reset your password, specify the phone or email used during registration."])},smsInfo:t=>{const{normalize:d}=t;return d(["We will send you an SMS with a confirmation code to reset your password, which you will need to enter in the next step."])},emailInfo:t=>{const{normalize:d}=t;return d(["We will send you an email with a confirmation code to reset your password, which you will need to enter in the next step."])},phone:t=>{const{normalize:d}=t;return d(["Phone"])},email:t=>{const{normalize:d}=t;return d(["Email"])},phonePlaceholder:t=>{const{normalize:d}=t;return d(["Enter your phone"])},emailPlaceholder:t=>{const{normalize:d}=t;return d(["Enter your email"])},sendCode:t=>{const{normalize:d}=t;return d(["Send code"])}},ru:{forgotPasswordTitle:t=>{const{normalize:d}=t;return d(["Забыли пароль?"])},instructions:t=>{const{normalize:d}=t;return d(["Чтобы сбросить пароль, укажите телефон или email, использованные при регистрации."])},smsInfo:t=>{const{normalize:d}=t;return d(["Мы вышлем вам SMS с кодом подтверждения для сброса пароля, который вы должны будете ввести в следующем шаге."])},emailInfo:t=>{const{normalize:d}=t;return d(["Мы отправим вам электронное письмо с кодом подтверждения для сброса пароля, который вы должны будете ввести в следующем шаге."])},phone:t=>{const{normalize:d}=t;return d(["Телефон"])},email:t=>{const{normalize:d}=t;return d(["Email"])},phonePlaceholder:t=>{const{normalize:d}=t;return d(["Введите ваш телефон"])},emailPlaceholder:t=>{const{normalize:d}=t;return d(["Введите ваш email"])},sendCode:t=>{const{normalize:d}=t;return d(["Отправить код"])}}}})}const Qd={class:"t-left pd-medium"},er={class:"mn-small"},tr={class:"mn-small t-transp"},nr={class:"mn-small p-small uppercase t-semi bg-grey radius-big o-hidden"},dr={key:0,class:"mn-semi radius-small o-hidden"},rr={class:"mn-small t-transp"},or={key:0,class:"mn-semi radius-small o-hidden"},ir={class:"mn-small t-transp"},oe={__name:"ResetPassword",setup(e){const{t:n}=A.useI18n({inheritLocale:!0,useScope:"local"}),t=r.ref(null),d=r.ref(null);_.useRoute();const o=_.useRouter(),i=r.ref("phone");async function a(){try{i.value==="phone"&&await y.validateInputs(t,y.validatePhone,l.state.user.phone,"Некорректный телефон"),i.value==="email"&&await y.validateInputs(d,y.validateEmail,l.state.user.email,"Некорректный email")}catch{throw new Error}try{await l.actions.resetPassword(l.state.user,i.value,"reset-password")}catch($){throw console.log($),new Error}}function s(){o.push({name:"Enter Code",query:{type:i.value,method:"reset-password"}})}return($,u)=>(r.openBlock(),r.createElementBlock("section",Qd,[r.createElementVNode("h3",er,r.toDisplayString(r.unref(n)("forgotPasswordTitle")),1),r.createElementVNode("p",tr,r.toDisplayString(r.unref(n)("instructions")),1),r.createElementVNode("div",nr,[r.createVNode(Y._sfc_main,{selected:i.value,"onUpdate:selected":u[0]||(u[0]=f=>i.value=f),tabs:[{name:r.unref(n)("phone"),value:"phone"},{name:r.unref(n)("email"),value:"email"}]},null,8,["selected","tabs"])]),r.createElementVNode("div",null,[r.createVNode(r.Transition,{name:"slide-fade"},{default:r.withCtx(()=>[i.value==="phone"?(r.openBlock(),r.createElementBlock("div",dr,[r.createElementVNode("p",rr,r.toDisplayString(r.unref(n)("smsInfo")),1),r.createVNode(re,{modelValue:l.state.user.phone,"onUpdate:modelValue":u[1]||(u[1]=f=>l.state.user.phone=f),dropdownOptions:{showDialCodeInSelection:!0,showFlags:!0,showDialCodeInList:!0},validation:t.value,mode:"national",inputOptions:{placeholder:r.unref(n)("phonePlaceholder")},class:"bg-grey pd-small radius-small mn-thin"},null,8,["modelValue","validation","inputOptions"])])):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.Transition,{name:"slide-fade"},{default:r.withCtx(()=>[i.value==="email"?(r.openBlock(),r.createElementBlock("div",or,[r.createElementVNode("p",ir,r.toDisplayString(r.unref(n)("emailInfo")),1),r.createVNode(l.Field,{field:l.state.user.email,"onUpdate:field":u[2]||(u[2]=f=>l.state.user.email=f),placeholder:r.unref(n)("emailPlaceholder"),validation:d.value,class:"bg-grey pd-medium radius-small"},null,8,["field","placeholder","validation"])])):r.createCommentVNode("",!0)]),_:1})]),r.createVNode(l._sfc_main,{submit:a,callback:s,class:"mn-big"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(n)("sendCode")),1)]),_:1})]))}};typeof Le=="function"&&Le(oe);const ar=Object.freeze(Object.defineProperty({__proto__:null,default:oe},Symbol.toStringTag,{value:"Module"}));function Be(e){const n=e;n.__i18n=n.__i18n||[],n.__i18n.push({locale:"",resource:{en:{title:t=>{const{normalize:d}=t;return d(["Sign Up to The Commune"])},description:t=>{const{normalize:d}=t;return d(["Choose a convenient way to register via phone or email:"])},phone:t=>{const{normalize:d}=t;return d(["Phone"])},email:t=>{const{normalize:d}=t;return d(["Email"])},phonePlaceholder:t=>{const{normalize:d}=t;return d(["Enter your phone"])},emailPlaceholder:t=>{const{normalize:d}=t;return d(["Enter your email"])},emailNotice:t=>{const{normalize:d}=t;return d(["We will send you an email with a confirmation code that you will need to enter in the next step."])},smsNotice:t=>{const{normalize:d}=t;return d(["We will send you an SMS with a confirmation code that you will need to enter in the next step."])},sendCode:t=>{const{normalize:d}=t;return d(["Send Code"])},haveAccount:t=>{const{normalize:d}=t;return d(["Already have an account?"])}},ru:{title:t=>{const{normalize:d}=t;return d(["Новая учетная запись"])},description:t=>{const{normalize:d}=t;return d(["Выберите удобный способ регистрации через телефон или email:"])},phone:t=>{const{normalize:d}=t;return d(["Телефон"])},email:t=>{const{normalize:d}=t;return d(["Email"])},phonePlaceholder:t=>{const{normalize:d}=t;return d(["Введите ваш телефон"])},emailPlaceholder:t=>{const{normalize:d}=t;return d(["Введите ваш email"])},emailNotice:t=>{const{normalize:d}=t;return d(["Мы отправим вам электронное письмо с кодом подтверждения, который вы должны будете ввести в следующем шаге."])},smsNotice:t=>{const{normalize:d}=t;return d(["Мы вышлем вам SMS с кодом подтверждения, который вы должны будете ввести в следующем шаге."])},sendCode:t=>{const{normalize:d}=t;return d(["Отправить код"])},haveAccount:t=>{const{normalize:d}=t;return d(["У вас уже есть аккаунт?"])}}}})}const sr={class:"t-left pd-medium"},lr={class:"mn-small"},ur={class:"mn-small t-transp"},$r={class:"mn-small p-small uppercase t-semi bg-grey radius-big o-hidden"},cr={class:""},fr={class:"mn-semi radius-small"},pr={class:"mn-small t-transp"},mr={class:"mn-semi radius-small o-hidden"},hr={class:"mn-small t-transp"},yr={class:"w-100"},ie={__name:"SignUp",setup(e){const{t:n}=A.useI18n({inheritLocale:!0,useScope:"local"}),t=r.ref(null),d=r.ref(null);_.useRoute();const o=_.useRouter(),i=r.ref("phone");async function a(){try{i.value==="phone"&&await y.validateInputs(t,y.validatePhone,l.state.user.phone,"Некорректный телефон"),i.value==="email"&&await y.validateInputs(d,y.validateEmail,l.state.user.email,"Некорректный email")}catch{throw new Error}try{await l.sendCode(l.state.user,"signup",i.value)}catch{throw new Error}}function s(){o.push({name:"Enter Code"})}return($,u)=>{const f=r.resolveComponent("router-link");return r.openBlock(),r.createElementBlock("section",sr,[r.createElementVNode("h3",lr,r.toDisplayString(r.unref(n)("title")),1),r.createElementVNode("p",ur,r.toDisplayString(r.unref(n)("description")),1),r.createElementVNode("div",$r,[r.createVNode(Y._sfc_main,{selected:i.value,"onUpdate:selected":u[0]||(u[0]=c=>i.value=c),tabs:[{name:r.unref(n)("phone"),value:"phone"},{name:r.unref(n)("email"),value:"email"}]},null,8,["selected","tabs"])]),r.createElementVNode("div",cr,[r.createVNode(r.Transition,{name:"slide-fade"},{default:r.withCtx(()=>[r.withDirectives(r.createElementVNode("div",fr,[r.createElementVNode("p",pr,r.toDisplayString(r.unref(n)("smsNotice")),1),r.createVNode(re,{modelValue:l.state.user.phone,"onUpdate:modelValue":u[1]||(u[1]=c=>l.state.user.phone=c),dropdownOptions:{showDialCodeInSelection:!0,showFlags:!0,showDialCodeInList:!0},validation:t.value,mode:"national",inputOptions:{placeholder:r.unref(n)("phonePlaceholder")},class:"bg-grey pd-small radius-small mn-thin"},null,8,["modelValue","validation","inputOptions"])],512),[[r.vShow,i.value==="phone"]])]),_:1}),r.createVNode(r.Transition,{name:"slide-fade"},{default:r.withCtx(()=>[r.withDirectives(r.createElementVNode("div",mr,[r.createElementVNode("p",hr,r.toDisplayString(r.unref(n)("emailNotice")),1),r.createVNode(l.Field,{field:l.state.user.email,"onUpdate:field":u[2]||(u[2]=c=>l.state.user.email=c),placeholder:r.unref(n)("emailPlaceholder"),validation:d.value,class:"bg-grey pd-medium radius-small"},null,8,["field","placeholder","validation"])],512),[[r.vShow,i.value==="email"]])]),_:1})]),r.createVNode(l._sfc_main,{submit:a,callback:s,class:"mn-big"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(n)("sendCode")),1)]),_:1}),r.createElementVNode("div",yr,[r.createVNode(f,{to:"/auth/signin",class:"underline mn-medium d-block t-blue"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(n)("haveAccount")),1)]),_:1})])])}}};typeof Be=="function"&&Be(ie);const gr=Object.freeze(Object.defineProperty({__proto__:null,default:ie},Symbol.toStringTag,{value:"Module"}));function Ve(e){const n=e;n.__i18n=n.__i18n||[],n.__i18n.push({locale:"",resource:{en:{title:t=>{const{normalize:d}=t;return d(["Welcome to The Commune"])},subtitle:t=>{const{normalize:d}=t;return d(["Sign In to Continue"])},signup:t=>{const{normalize:d}=t;return d(["Don't have an account?"])},phone:t=>{const{normalize:d}=t;return d(["Phone"])},email:t=>{const{normalize:d}=t;return d(["Email"])},phonePlaceholder:t=>{const{normalize:d}=t;return d(["Enter your phone"])},emailPlaceholder:t=>{const{normalize:d}=t;return d(["Enter your email"])},haveAccount:t=>{const{normalize:d}=t;return d(["Don't have an account? Sign Up"])},passwordPlaceholder:t=>{const{normalize:d}=t;return d(["Enter your password"])},forgotPassword:t=>{const{normalize:d}=t;return d(["Forgot Password?"])},signin:t=>{const{normalize:d}=t;return d(["Sign In"])},signin_apple:t=>{const{normalize:d}=t;return d(["Sign In with Apple"])},soon:t=>{const{normalize:d}=t;return d(["SOON"])}},ru:{title:t=>{const{normalize:d}=t;return d(["Приветствуем вас,"])},subtitle:t=>{const{normalize:d}=t;return d(["Войдите для продолжения"])},signup:t=>{const{normalize:d}=t;return d(["Нет аккаунта?"])},phone:t=>{const{normalize:d}=t;return d(["Телефон"])},email:t=>{const{normalize:d}=t;return d(["Email"])},phonePlaceholder:t=>{const{normalize:d}=t;return d(["Введите ваш телефон"])},emailPlaceholder:t=>{const{normalize:d}=t;return d(["Введите ваш email"])},haveAccount:t=>{const{normalize:d}=t;return d(["Нет аккаунта? Зарегистрироваться"])},passwordPlaceholder:t=>{const{normalize:d}=t;return d(["Введите ваш пароль"])},forgotPassword:t=>{const{normalize:d}=t;return d(["Забыли пароль?"])},signin:t=>{const{normalize:d}=t;return d(["Войти"])},signin_apple:t=>{const{normalize:d}=t;return d(["Войти через Apple"])},soon:t=>{const{normalize:d}=t;return d(["СКОРО"])}}}})}const vr={class:""},br={class:"mn-medium"},_r=r.createElementVNode("br",null,null,-1),Cr={class:"t-semi"},wr={class:"mn-big"},Pr={class:"mn-small p-small uppercase t-semi bg-grey radius-big o-hidden"},Nr={class:""},Er={class:"mn-thin radius-small"},Sr={class:"mn-thin radius-small o-hidden"},Or={class:"w-100 mn-big"},ae={__name:"SignIn",setup(e){const{t:n}=A.useI18n({inheritLocale:!0,useScope:"local"}),t=r.ref(null),d=r.ref(null),o=r.ref(null);_.useRoute();const i=_.useRouter(),a=r.ref("phone"),s=r.inject("APPLE_CLIENTID"),$=r.inject("APPLE_REDIRECT_URL"),u=m=>new Promise((h,S)=>{const g=document.createElement("script");g.type="text/javascript",g.src=m,g.onload=h,g.onerror=S,document.head.appendChild(g)});r.onMounted(async()=>{await u("https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js")});async function f(){try{a.value==="phone"&&await y.validateInputs(t,y.validatePhone,l.state.user.phone,"Некорректный телефон"),a.value==="email"&&await y.validateInputs(o,y.validateEmail,l.state.user.email,"Некорректный email")}catch{throw new Error}l.state.user.phone=l.state.user.phone.number,await l.actions.login(l.state.user,a.value)}async function c(){try{window.AppleID.auth.init({clientId:s,scope:"email name",redirectURI:$,usePopup:!0});let m=await window.AppleID.auth.signIn();m&&(console.log(m),await l.actions.login(m,"apple"))}catch(m){throw console.error(m),new Error("Error during Apple authentication")}}function p(){i.push({name:"User Profile",params:{_id:l.state.user._id}})}return(m,h)=>{const S=r.resolveComponent("router-link");return r.openBlock(),r.createElementBlock("section",vr,[r.createElementVNode("h3",br,[r.createTextVNode(r.toDisplayString(r.unref(n)("title"))+" ",1),_r,r.createElementVNode("span",Cr,r.toDisplayString(r.unref(n)("subtitle")),1)]),r.createElementVNode("p",wr,[r.createVNode(S,{to:{name:"Sign Up"},class:"underline t-second"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(n)("signup")),1)]),_:1})]),r.createElementVNode("div",Pr,[r.createVNode(Y._sfc_main,{selected:a.value,"onUpdate:selected":h[0]||(h[0]=g=>a.value=g),tabs:[{name:r.unref(n)("phone"),value:"phone"},{name:r.unref(n)("email"),value:"email"}]},null,8,["selected","tabs"])]),r.createElementVNode("div",Nr,[r.createVNode(r.Transition,{name:"slide-fade"},{default:r.withCtx(()=>[r.withDirectives(r.createElementVNode("div",Er,[r.createVNode(re,{modelValue:l.state.user.phone,"onUpdate:modelValue":h[1]||(h[1]=g=>l.state.user.phone=g),dropdownOptions:{showDialCodeInSelection:!0,showFlags:!0,showDialCodeInList:!0},validation:t.value,mode:"national",inputOptions:{placeholder:r.unref(n)("phonePlaceholder")},class:"bg-grey pd-small radius-small mn-thin"},null,8,["modelValue","validation","inputOptions"])],512),[[r.vShow,a.value==="phone"]])]),_:1}),r.createVNode(r.Transition,{name:"slide-fade"},{default:r.withCtx(()=>[r.withDirectives(r.createElementVNode("div",Sr,[r.createVNode(l.Field,{field:l.state.user.email,"onUpdate:field":h[2]||(h[2]=g=>l.state.user.email=g),placeholder:r.unref(n)("emailPlaceholder"),validation:o.value,class:"bg-grey pd-medium radius-small"},null,8,["field","placeholder","validation"])],512),[[r.vShow,a.value==="email"]])]),_:1})]),r.createVNode(l.Field,{field:l.state.user.password,"onUpdate:field":h[3]||(h[3]=g=>l.state.user.password=g),type:"password",validation:d.value,placeholder:r.unref(n)("passwordPlaceholder"),class:"bg-grey pd-medium radius-small mn-semi"},null,8,["field","validation","placeholder"]),r.createElementVNode("div",Or,[r.createVNode(S,{to:"/auth/reset-password",class:"underline d-block t-blue"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(n)("forgotPassword")),1)]),_:1})]),r.createVNode(l._sfc_main,{submit:f,callback:p,class:"mn-thin"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(n)("signin")),1)]),_:1}),r.createVNode(l._sfc_main,{submit:c,callback:p,class:"mn-thin bg-black t-white"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(n)("signin_apple")),1)]),_:1})])}}};typeof Ve=="function"&&Ve(ae);const Ir=Object.freeze(Object.defineProperty({__proto__:null,default:ae},Symbol.toStringTag,{value:"Module"})),Tr=[{path:"auth",name:"Authentication",meta:{title:{en:"Sign In",ru:"Вход"}},component:Xe,children:[{path:"signin",name:"Sign In",beforeEnter:[w.requiresNoAuth,w.resetUser],meta:{title:{en:"Sign In",ru:"Вход"}},component:()=>Promise.resolve().then(()=>Ir)},{path:"reset-password",name:"Reset Password",beforeEnter:[w.requiresNoAuth,w.resetUser],meta:{title:{en:"Reset Password",ru:"Сбросить Пароль"}},component:()=>Promise.resolve().then(()=>ar)},{path:"signup",name:"Sign Up",beforeEnter:[w.requiresNoAuth,w.resetUser],meta:{title:{en:"Sign Up",ru:"Регистрация"}},component:()=>Promise.resolve().then(()=>gr)},{path:"enter-code",name:"Enter Code",beforeEnter:[w.requiresNoAuth,w.checkUser],meta:{title:{en:"Enter Code",ru:"Введите Код"}},component:()=>Promise.resolve().then(()=>gd)},{path:"enter-password",name:"Enter Password",beforeEnter:[w.requiresNoAuth,w.checkUser],meta:{title:{en:"Enter Password",ru:"Введите Пароль"}},component:()=>Promise.resolve().then(()=>kd)},{path:"invite",name:"Invite",meta:{title:{en:"Invite",ru:"Приглашение"}},component:()=>Promise.resolve().then(()=>Ed)}]}];exports.authStore=l.auth;exports.twofaStore=l.twofa;exports.Auth=Xe;exports.EnterCode=ne;exports.EnterPassword=de;exports.Invite=Ze;exports.ResetPassword=oe;exports.SignIn=ae;exports.SignUp=ie;exports.SliderFeatures=rt;exports.authRoutes=Tr;exports.invitesStore=vd;
|
package/dist/auth.client.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ref as C, onMounted as ut, openBlock as g, createBlock as ce, unref as f, withCtx as w, createElementBlock as b, Fragment as fe, renderList as ct, createElementVNode as p, normalizeStyle as q, toDisplayString as h, resolveComponent as be, createVNode as y, Transition as R, resolveDynamicComponent as Ft, reactive as ft, watch as pt,
|
1
|
+
import { ref as C, onMounted as ut, openBlock as g, createBlock as ce, unref as f, withCtx as w, createElementBlock as b, Fragment as fe, renderList as ct, createElementVNode as p, normalizeStyle as q, toDisplayString as h, resolveComponent as be, createVNode as y, Transition as R, resolveDynamicComponent as Ft, reactive as ft, watch as pt, withDirectives as I, vModelText as J, withAsyncContext as Dt, defineComponent as Rt, resolveDirective as Mt, normalizeClass as K, withKeys as ie, createCommentVNode as L, vShow as X, vModelDynamic as zt, renderSlot as Lt, createTextVNode as D, inject as Te } from "vue";
|
2
2
|
import { v as M, b as mt, c as _e, d as Ce } from "./inputs.validation-14e8e01f.mjs";
|
3
3
|
import { c as oe, d as ht, s as m, a as xt, F as z, _ as G, b as V } from "./auth-962e3b73.mjs";
|
4
4
|
import { e as Fi, t as Di } from "./auth-962e3b73.mjs";
|
@@ -679,8 +679,8 @@ var yn = ";ext=", B = function(n) {
|
|
679
679
|
return "([".concat(N, "]{1,").concat(n, "})");
|
680
680
|
};
|
681
681
|
function bt(e) {
|
682
|
-
var n = "20", t = "15", d = "9", r = "6", i = "[ \\t,]*", o = "[:\\..]?[ \\t,-]*", a = "#?", l = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)", s = "(?:[xx##~~]|int|int)", u = "[- ]+", $ = "[ \\t]*", c = "(?:,{2}|;)", v = yn + B(n), _ = i + l + o + B(n) + a,
|
683
|
-
return v + "|" + _ + "|" +
|
682
|
+
var n = "20", t = "15", d = "9", r = "6", i = "[ \\t,]*", o = "[:\\..]?[ \\t,-]*", a = "#?", l = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)", s = "(?:[xx##~~]|int|int)", u = "[- ]+", $ = "[ \\t]*", c = "(?:,{2}|;)", v = yn + B(n), _ = i + l + o + B(n) + a, F = i + s + o + B(d) + a, P = u + B(r) + "#", Tt = $ + c + o + B(t) + a, At = $ + "(?:,)+" + o + B(d) + a;
|
683
|
+
return v + "|" + _ + "|" + F + "|" + P + "|" + Tt + "|" + At;
|
684
684
|
}
|
685
685
|
var gn = "[" + N + "]{" + Pe + "}", vn = "[" + Oe + "]{0,1}(?:[" + ee + "]*[" + N + "]){3,}[" + ee + N + "]*", bn = new RegExp("^[" + Oe + "]{0,1}(?:[" + ee + "]*[" + N + "]){1,2}$", "i"), _n = vn + // Phone number extensions
|
686
686
|
"(?:" + bt() + ")?", Cn = new RegExp(
|
@@ -913,7 +913,7 @@ function Ct(e, n) {
|
|
913
913
|
return !1;
|
914
914
|
}
|
915
915
|
}
|
916
|
-
function
|
916
|
+
function A(e, n) {
|
917
917
|
return e = e || "", new RegExp("^(?:" + n + ")$").test(e);
|
918
918
|
}
|
919
919
|
function Mn(e, n) {
|
@@ -952,7 +952,7 @@ function Ne(e, n, t) {
|
|
952
952
|
if (n = n || {}, !!e.country) {
|
953
953
|
t = new S(t), t.selectNumberingPlan(e.country, e.countryCallingCode);
|
954
954
|
var d = n.v2 ? e.nationalNumber : e.phone;
|
955
|
-
if (
|
955
|
+
if (A(d, t.nationalNumberPattern())) {
|
956
956
|
if (le(d, "FIXED_LINE", t))
|
957
957
|
return t.type("MOBILE") && t.type("MOBILE").pattern() === "" || !t.type("MOBILE") || le(d, "MOBILE", t) ? "FIXED_LINE_OR_MOBILE" : "FIXED_LINE";
|
958
958
|
for (var r = Mn(Ln), i; !(i = r()).done; ) {
|
@@ -964,13 +964,13 @@ function Ne(e, n, t) {
|
|
964
964
|
}
|
965
965
|
}
|
966
966
|
function le(e, n, t) {
|
967
|
-
return n = t.type(n), !n || !n.pattern() || n.possibleLengths() && n.possibleLengths().indexOf(e.length) < 0 ? !1 :
|
967
|
+
return n = t.type(n), !n || !n.pattern() || n.possibleLengths() && n.possibleLengths().indexOf(e.length) < 0 ? !1 : A(e, n.pattern());
|
968
968
|
}
|
969
969
|
function xn(e, n, t) {
|
970
970
|
if (n = n || {}, t = new S(t), t.selectNumberingPlan(e.country, e.countryCallingCode), t.hasTypes())
|
971
971
|
return Ne(e, n, t.metadata) !== void 0;
|
972
972
|
var d = n.v2 ? e.nationalNumber : e.phone;
|
973
|
-
return
|
973
|
+
return A(d, t.nationalNumberPattern());
|
974
974
|
}
|
975
975
|
function kn(e, n, t) {
|
976
976
|
var d = new S(t), r = d.getCountryCodesForCallingCode(e);
|
@@ -1131,7 +1131,7 @@ function Zn(e, n) {
|
|
1131
1131
|
if (n.search(i) !== 0)
|
1132
1132
|
continue;
|
1133
1133
|
}
|
1134
|
-
if (
|
1134
|
+
if (A(n, r.pattern()))
|
1135
1135
|
return r;
|
1136
1136
|
}
|
1137
1137
|
}
|
@@ -1349,7 +1349,7 @@ function he(e, n) {
|
|
1349
1349
|
};
|
1350
1350
|
}
|
1351
1351
|
function sd(e, n, t) {
|
1352
|
-
return !(
|
1352
|
+
return !(A(e, t.nationalNumberPattern()) && !A(n, t.nationalNumberPattern()));
|
1353
1353
|
}
|
1354
1354
|
function ld(e, n) {
|
1355
1355
|
switch (Ie(e, n)) {
|
@@ -1365,7 +1365,7 @@ function $d(e, n, t, d) {
|
|
1365
1365
|
if (e.indexOf(r) === 0) {
|
1366
1366
|
d = new S(d), d.selectNumberingPlan(n, t);
|
1367
1367
|
var i = e.slice(r.length), o = he(i, d), a = o.nationalNumber, l = he(e, d), s = l.nationalNumber;
|
1368
|
-
if (!
|
1368
|
+
if (!A(s, d.nationalNumberPattern()) && A(a, d.nationalNumberPattern()) || Ie(s, d) === "TOO_LONG")
|
1369
1369
|
return {
|
1370
1370
|
countryCallingCode: r,
|
1371
1371
|
number: i
|
@@ -1543,7 +1543,7 @@ function Fd(e, n, t) {
|
|
1543
1543
|
var v = new nd(u, s, t.metadata);
|
1544
1544
|
return l && (v.country = l), c && (v.carrierCode = c), i && (v.ext = i), v.__countryCallingCodeSource = $, v;
|
1545
1545
|
}
|
1546
|
-
var _ = (n.extended ? t.hasSelectedNumberingPlan() : l) ?
|
1546
|
+
var _ = (n.extended ? t.hasSelectedNumberingPlan() : l) ? A(s, t.nationalNumberPattern()) : !1;
|
1547
1547
|
return n.extended ? {
|
1548
1548
|
country: l,
|
1549
1549
|
countryCallingCode: u,
|
@@ -1908,8 +1908,8 @@ const er = { class: "t-center pd-medium" }, tr = { class: "mn-medium" }, nr = {
|
|
1908
1908
|
}, s = (u) => {
|
1909
1909
|
const $ = document.querySelectorAll("input"), c = $[u + 1], v = u > 0 ? $[u - 1] : null;
|
1910
1910
|
if (r.digits[u] !== "" && r.digits[u] !== null && r.digits[u] !== void 0 && u < 4 && (u < 3 ? c.focus() : i.value.focus()), (r.digits[u] === null || r.digits[u] === void 0 || r.digits[u] === "") && u > 0 && v.focus(), r.digits.every((_) => _ !== "")) {
|
1911
|
-
const _ = r.digits.join(""),
|
1912
|
-
_ ===
|
1911
|
+
const _ = r.digits.join(""), F = oe.code.code.toString();
|
1912
|
+
_ === F ? (oe.code.isValid = !0, t.push({
|
1913
1913
|
path: "/auth/enter-password",
|
1914
1914
|
query: { type: oe.code.type, method: n.query.method }
|
1915
1915
|
})) : (x({ response: { data: { errorCode: "WRONG_CODE" } } }), i.value.focus(), r.digits = ["", "", "", ""]);
|
@@ -1917,7 +1917,6 @@ const er = { class: "t-center pd-medium" }, tr = { class: "mn-medium" }, nr = {
|
|
1917
1917
|
};
|
1918
1918
|
return (u, $) => (g(), b("section", er, [
|
1919
1919
|
p("h3", tr, h(f(d)("verifyNumberTitle")), 1),
|
1920
|
-
A(" " + h(r.digits) + " ", 1),
|
1921
1920
|
p("p", nr, h(f(d)("instructions")), 1),
|
1922
1921
|
p("div", dr, [
|
1923
1922
|
I(p("input", {
|
@@ -3263,7 +3262,7 @@ const jr = { class: "t-left pd-medium" }, Br = { class: "mn-small" }, Ur = { cla
|
|
3263
3262
|
class: "mn-big"
|
3264
3263
|
}, {
|
3265
3264
|
default: w(() => [
|
3266
|
-
|
3265
|
+
D(h(f(n)("sendCode")), 1)
|
3267
3266
|
]),
|
3268
3267
|
_: 1
|
3269
3268
|
})
|
@@ -3464,7 +3463,7 @@ const Xr = { class: "t-left pd-medium" }, Yr = { class: "mn-small" }, Zr = { cla
|
|
3464
3463
|
class: "mn-big"
|
3465
3464
|
}, {
|
3466
3465
|
default: w(() => [
|
3467
|
-
|
3466
|
+
D(h(f(n)("sendCode")), 1)
|
3468
3467
|
]),
|
3469
3468
|
_: 1
|
3470
3469
|
}),
|
@@ -3474,7 +3473,7 @@ const Xr = { class: "t-left pd-medium" }, Yr = { class: "mn-small" }, Zr = { cla
|
|
3474
3473
|
class: "underline mn-medium d-block t-blue"
|
3475
3474
|
}, {
|
3476
3475
|
default: w(() => [
|
3477
|
-
|
3476
|
+
D(h(f(n)("haveAccount")), 1)
|
3478
3477
|
]),
|
3479
3478
|
_: 1
|
3480
3479
|
})
|
@@ -3612,9 +3611,9 @@ const oi = { class: "" }, ai = { class: "mn-medium" }, si = /* @__PURE__ */ p("b
|
|
3612
3611
|
useScope: "local"
|
3613
3612
|
}), t = C(null), d = C(null), r = C(null);
|
3614
3613
|
k();
|
3615
|
-
const i = j(), o = C("phone"), a = Te("APPLE_CLIENTID"), l = Te("APPLE_REDIRECT_URL"), s = (v) => new Promise((_,
|
3614
|
+
const i = j(), o = C("phone"), a = Te("APPLE_CLIENTID"), l = Te("APPLE_REDIRECT_URL"), s = (v) => new Promise((_, F) => {
|
3616
3615
|
const P = document.createElement("script");
|
3617
|
-
P.type = "text/javascript", P.src = v, P.onload = _, P.onerror =
|
3616
|
+
P.type = "text/javascript", P.src = v, P.onload = _, P.onerror = F, document.head.appendChild(P);
|
3618
3617
|
});
|
3619
3618
|
ut(async () => {
|
3620
3619
|
await s("https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js");
|
@@ -3655,20 +3654,20 @@ const oi = { class: "" }, ai = { class: "mn-medium" }, si = /* @__PURE__ */ p("b
|
|
3655
3654
|
i.push({ name: "User Profile", params: { _id: m.user._id } });
|
3656
3655
|
}
|
3657
3656
|
return (v, _) => {
|
3658
|
-
const
|
3657
|
+
const F = be("router-link");
|
3659
3658
|
return g(), b("section", oi, [
|
3660
3659
|
p("h3", ai, [
|
3661
|
-
|
3660
|
+
D(h(f(n)("title")) + " ", 1),
|
3662
3661
|
si,
|
3663
3662
|
p("span", li, h(f(n)("subtitle")), 1)
|
3664
3663
|
]),
|
3665
3664
|
p("p", $i, [
|
3666
|
-
y(
|
3665
|
+
y(F, {
|
3667
3666
|
to: { name: "Sign Up" },
|
3668
3667
|
class: "underline t-second"
|
3669
3668
|
}, {
|
3670
3669
|
default: w(() => [
|
3671
|
-
|
3670
|
+
D(h(f(n)("signup")), 1)
|
3672
3671
|
]),
|
3673
3672
|
_: 1
|
3674
3673
|
})
|
@@ -3732,12 +3731,12 @@ const oi = { class: "" }, ai = { class: "mn-medium" }, si = /* @__PURE__ */ p("b
|
|
3732
3731
|
class: "bg-grey pd-medium radius-small mn-semi"
|
3733
3732
|
}, null, 8, ["field", "validation", "placeholder"]),
|
3734
3733
|
p("div", mi, [
|
3735
|
-
y(
|
3734
|
+
y(F, {
|
3736
3735
|
to: "/auth/reset-password",
|
3737
3736
|
class: "underline d-block t-blue"
|
3738
3737
|
}, {
|
3739
3738
|
default: w(() => [
|
3740
|
-
|
3739
|
+
D(h(f(n)("forgotPassword")), 1)
|
3741
3740
|
]),
|
3742
3741
|
_: 1
|
3743
3742
|
})
|
@@ -3748,7 +3747,7 @@ const oi = { class: "" }, ai = { class: "mn-medium" }, si = /* @__PURE__ */ p("b
|
|
3748
3747
|
class: "mn-thin"
|
3749
3748
|
}, {
|
3750
3749
|
default: w(() => [
|
3751
|
-
|
3750
|
+
D(h(f(n)("signin")), 1)
|
3752
3751
|
]),
|
3753
3752
|
_: 1
|
3754
3753
|
}),
|
@@ -3758,7 +3757,7 @@ const oi = { class: "" }, ai = { class: "mn-medium" }, si = /* @__PURE__ */ p("b
|
|
3758
3757
|
class: "mn-thin bg-black t-white"
|
3759
3758
|
}, {
|
3760
3759
|
default: w(() => [
|
3761
|
-
|
3760
|
+
D(h(f(n)("signin_apple")), 1)
|
3762
3761
|
]),
|
3763
3762
|
_: 1
|
3764
3763
|
})
|
package/package.json
CHANGED