sprof 0.0.144 → 0.0.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core/auth/Auth.d.ts
CHANGED
|
@@ -250,6 +250,7 @@ declare class Auth<UserT> {
|
|
|
250
250
|
readonly IsAuth: boolean;
|
|
251
251
|
readonly User: import('vue').UnwrapRef<UserT> | undefined;
|
|
252
252
|
SetUserConstructor: (c: import('../helpers/Classes').Constructable<import('../interfaces/IWithId').default>) => void;
|
|
253
|
+
SetUser: (u: UserT) => void;
|
|
253
254
|
SetState: (authInfo: import('../types/AuthInfo').AuthInfo) => void;
|
|
254
255
|
Logout: () => void;
|
|
255
256
|
Actualize: () => void;
|
|
@@ -11,6 +11,7 @@ export default class AuthStatus<UserT> {
|
|
|
11
11
|
get IsAuth(): boolean;
|
|
12
12
|
get User(): UserT | undefined;
|
|
13
13
|
SetUserConstructor(c: Constructable<IWithId>): void;
|
|
14
|
+
SetUser(u: UserT): void;
|
|
14
15
|
SetState(authInfo: AuthInfo): void;
|
|
15
16
|
Logout(): void;
|
|
16
17
|
Actualize(): void;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -252,6 +252,7 @@ export default abstract class PF {
|
|
|
252
252
|
readonly IsAuth: boolean;
|
|
253
253
|
readonly User: unknown;
|
|
254
254
|
SetUserConstructor: (c: import('./helpers/Classes').Constructable<import('./interfaces/IWithId').default>) => void;
|
|
255
|
+
SetUser: (u: unknown) => void;
|
|
255
256
|
SetState: (authInfo: import('./types/AuthInfo').AuthInfo) => void;
|
|
256
257
|
Logout: () => void;
|
|
257
258
|
Actualize: () => void;
|
package/dist/sprof.js
CHANGED
|
@@ -28,9 +28,10 @@ class kt {
|
|
|
28
28
|
}
|
|
29
29
|
class Bi extends kt {
|
|
30
30
|
constructor() {
|
|
31
|
-
super(
|
|
31
|
+
super();
|
|
32
32
|
l(this, "id", "auth-button");
|
|
33
33
|
l(this, "chunk", Re.Login);
|
|
34
|
+
l(this, "text", "");
|
|
34
35
|
l(this, "isSubmit", !1);
|
|
35
36
|
l(this, "isLink", !0);
|
|
36
37
|
}
|
|
@@ -532,8 +533,11 @@ class Ea {
|
|
|
532
533
|
SetUserConstructor(e) {
|
|
533
534
|
this.user.setUserConstructor(e);
|
|
534
535
|
}
|
|
536
|
+
SetUser(e) {
|
|
537
|
+
this.user.set(e);
|
|
538
|
+
}
|
|
535
539
|
SetState(e) {
|
|
536
|
-
this.
|
|
540
|
+
this.SetUser(e.user), this.tokens.set(e.tokens), this.isAuth = !0;
|
|
537
541
|
}
|
|
538
542
|
Logout() {
|
|
539
543
|
if (this.preventLogout) {
|
package/dist/sprof.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(E,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(E=typeof globalThis<"u"?globalThis:E||self,i(E.sprof={},E.Vue))})(this,function(E,i){"use strict";var rp=Object.defineProperty;var op=(E,i,Re)=>i in E?rp(E,i,{enumerable:!0,configurable:!0,writable:!0,value:Re}):E[i]=Re;var c=(E,i,Re)=>op(E,typeof i!="symbol"?i+"":i,Re);var Ye,be,qt,H,Ce,Je;var Re=typeof document<"u"?document.currentScript:null,se=(t=>(t.Login="login",t.Register="register",t.Restore="restore",t.Refresh="refresh",t))(se||{}),fe=(t=>(t.Primary="primary",t.Success="success",t.Warning="warning",t.Error="error",t.Info="info",t))(fe||{});class Ke{constructor(e,n,r,o){c(this,"text","Сохранить");c(this,"type",fe.Success);c(this,"condition",!0);c(this,"action");c(this,"id","button");c(this,"disabled",!1);this.text=e,this.type=r,this.action=n,o!==void 0&&(this.condition=o)}static Primary(e,n,r){return new Ke(e,n,fe.Primary,r)}static Success(e,n,r){return new Ke(e,n,fe.Success,r)}static Warning(e,n,r){return new Ke(e,n,fe.Warning,r)}static Error(e,n,r){return new Ke(e,n,fe.Error,r)}}class Wt extends Ke{constructor(){super(...arguments);c(this,"id","auth-button");c(this,"chunk",se.Login);c(this,"isSubmit",!1);c(this,"isLink",!0)}GetChunk(){return this.chunk}}let Tn=class extends Wt{constructor(){super(...arguments);c(this,"id","auth-button-login");c(this,"text","Войти");c(this,"isSubmit",!1);c(this,"chunk",se.Login)}};class ji extends Wt{constructor(){super(...arguments);c(this,"id","auth-button-refresh");c(this,"text","Обновить пароль");c(this,"isSubmit",!1);c(this,"chunk",se.Refresh)}}class Fn extends Wt{constructor(){super(...arguments);c(this,"id","auth-button-register");c(this,"text","Зарегистрироваться");c(this,"isSubmit",!1);c(this,"chunk",se.Register)}}class jt extends Wt{constructor(){super(...arguments);c(this,"id","auth-button-restore");c(this,"text","Забыли пароль?");c(this,"isSubmit",!1);c(this,"chunk",se.Restore)}}class Gi{constructor(){c(this,"value","");c(this,"label","");c(this,"placeholder","");c(this,"validator")}Validate(){return this.validator?(this.validator.validate(this.value),this.validator.errors):[]}Reset(){this.value=""}}class Gt extends Gi{constructor(){super(...arguments);c(this,"method");c(this,"id","field-auth");c(this,"name","")}}var dt=(t=>(t.Login="login",t.Email="email",t.Phone="phone",t.VK="vk",t.ESIA="esia",t))(dt||{});const za=/\S+@\S+\.\S+/;class Zi{constructor(){c(this,"errors",[])}validate(e){return(e===""||!e)&&this.errors.push("Введите email"),za.test(e)||this.errors.push("Некорректный email"),this.errors}}class Zt extends Gt{constructor(){super(...arguments);c(this,"id","field-auth-email");c(this,"label","Email");c(this,"name","email");c(this,"placeholder","Введите email");c(this,"validator",new Zi);c(this,"method",dt.Email)}}class Ta{constructor(){c(this,"errors",[]);c(this,"length",6)}validate(e){return e===""||!e?(this.errors.push("Введите пароль"),this.errors):(e.length<this.length&&this.errors.push("Пароль недостаточной длины"),this.errors)}}class Xt extends Gt{constructor(){super(...arguments);c(this,"label","Пароль");c(this,"validator",new Ta);c(this,"name","password");c(this,"placeholder","Введите пароль");c(this,"id","field-auth-password")}}class Xi extends Gt{constructor(){super(...arguments);c(this,"label","Повторите пароль");c(this,"id","field-auth-password-repeat")}}const Yi={allowRestore:!1,[se.Login]:{methods:[dt.Email],title:"Вход в систему",action:"login",buttons:[new Tn,new Fn,new jt],fields:[new Zt,new Xt],errorMessage:"Неверно указан email или пароль",successMessage:"Вы успешно вошли в систему"},[se.Register]:{methods:[],title:"Регистрация",action:"register",buttons:[new Fn,new Tn,new jt],fields:[new Zt,new Xt,new Xi],errorMessage:"Неверно указан email или пароль",successMessage:"Вы успешно зарегистрировались в системе, войдите под своим паролем"},[se.Restore]:{title:"Восстановление пароля",methods:[],action:"restorePassword",successMessage:"Ссылка для восстановления пароля отправлена на Вашу почту",errorMessage:"Неверно указан email",buttons:[new jt],fields:[new Zt]},[se.Refresh]:{methods:[],title:"Создание нового пароля",action:"passwordChange",successMessage:"Воспользуйтесь новым паролем для входа",errorMessage:"Неверно указан email",buttons:[new ji],fields:[new Xt]}};let Fa=class{constructor(){c(this,"settings",Yi);c(this,"chunk",se.Login);c(this,"selectedMethod",dt.Email)}async Block(e){await e()}GetValues(){const e=this.GetFields(),n=new Map;return e.forEach(r=>{r.value&&n.set(r.name,r.value)}),Object.fromEntries(n)}Validate(){return[]}GetFields(){return this.GetCurSet().fields.filter(e=>!e.method||e.method===this.selectedMethod)}GetMethods(){return this.GetCurSet().methods}Chunk(){return this.chunk}get Settings(){return this.settings}GetCurSet(){return this.settings[this.chunk]}get IsLogin(){return this.chunk===se.Login}get IsRegister(){return this.chunk===se.Register}get IsRestore(){return this.chunk===se.Restore}get IsRefresh(){return this.chunk===se.Refresh}SetChunk(e){this.chunk=e}GetTitle(){return this.GetCurSet().title}GetButtons(){const e=this.GetCurSet().buttons;return e.forEach(n=>{n.isSubmit=!1}),e[0].isSubmit=!0,e}GetSuccessMessage(){return this.GetCurSet().successMessage}GetErrorMessage(){return this.GetCurSet().errorMessage}GetAction(){return this.GetCurSet().action}ResetFields(){this.GetCurSet().fields.forEach(e=>e.Reset())}Reset(){this.chunk=se.Login}};class Oa{constructor(){c(this,"visible",!1);c(this,"closable",!1)}get Closable(){return this.closable}get Visible(){return this.visible}Close(){this.visible=!1}Open(e){e&&(this.closable=!0),this.visible=!0}}class Ji{constructor(){c(this,"visible",!1)}hide(){this.visible=!1}show(){this.hide(),this.visible=!0}IsVisible(){return this.visible}}class Qi extends Ji{constructor(){super(...arguments);c(this,"type",fe.Success);c(this,"text","");c(this,"title","")}showMessage(n,r){this.hide(),this.type=r,typeof n=="string"?this.text=n:(this.text=n.text,this.title=n.title??""),super.show()}GetText(){return this.text}GetTitle(){return this.title}GetType(){return this.type}Info(n){this.showMessage(n,fe.Info)}Success(n){this.showMessage(n,fe.Success)}Error(n){this.showMessage(n,fe.Error)}Warning(n){this.showMessage(n,fe.Warning)}FormMessage(n){let r="<strong>Проверьте правильность введенных данных:</strong><ul>";for(const o of Object.keys(n))n[o][0]&&n[o][0].message&&(r+=`<li>${n[o][0].message}</li>`);return r+="</ul>",r}}class On{static Get(e,n,r="-"){return!e||!n?"":`${e}${r}${n}`}static In(e,n,r){return e>=n&&e<=r}static Intersects(e,n,r,o){return e===r||n===o||e>r&&e<o||n>r&&n<o||n>o&&e<r}}const Ki=1e3,er=60*Ki,Ln=60*er;var Bt=(t=>(t.FiveMinutes="5",t.HourQuarter="15",t.HourHalf="30",t.Hour="60",t))(Bt||{});const Yt={5:["00","05","10","15","20","25","30","35","40","45","50","55"],15:["00","15","30","45"],30:["00","30"],60:["00"]};class D{static S(e){return Ki*e}static M(e){return er*e}static H(e){return Ln*e}static D(e){return Ln*e}static W(e){return Ln*e}static NormalizeTime(e){return String(e).padStart(2,"0")}static HMtoM(e){const n=D.SplitHM(e);return n.length>1?D.HtoM(n[0])+n[1]:D.HtoM(n[0])}static HtoM(e){return Number(e)*60}static SplitHM(e){if(!e)return[];const n=e.split(":");return[Number(n[0]),Number(n[1])]}static HmsToHm(e){const n=D.SplitHM(e);return D.ConcatHM(n[0],n[1])}static AddMtoHM(e,n){const r=new Date,o=D.SplitHM(e);r.setHours(o[0],o[1],0,0);const s=new Date(r.getTime()+n*6e4),a=s.getHours(),d=s.getMinutes();return D.ConcatHM(a,d)}static ConcatHM(e,n){return`${e}:${D.NormalizeTime(n)}`}static DiffM(e,n){return D.Gt(n,e)?D.HMtoM(n)-D.HMtoM(e):D.HMtoM(e)-D.HMtoM(n)}static GetPeriod(e,n){return On.Get(e,n)}static Gt(e,n){return D.HMtoM(e)>D.HMtoM(n)}static GtOrEq(e,n){return D.Gt(e,n)||D.Eq(e,n)}static Eq(e,n){return D.HMtoM(e)===D.HMtoM(n)}static PeriodInPeriod(e,n,r,o){return D.HMtoM(e)>=D.HMtoM(r)&&D.HMtoM(n)<=D.HMtoM(o)}static PeriodsIntersects(e,n,r,o){return On.Intersects(D.HMtoM(e),D.HMtoM(n),D.HMtoM(r),D.HMtoM(o))}}class Mt{static Wait(e,n){return new Promise(r=>setTimeout(()=>r(n),e))}static WaitS(e,n){return Mt.Wait(D.S(e),n)}static WaitM(e,n){return Mt.Wait(D.M(e),n)}}class La extends Qi{constructor(){super(...arguments);c(this,"duration",D.S(3))}showMessage(n,r){super.showMessage(n,r),typeof n!="string"&&(this.duration=n.duration??this.duration),Mt.Wait(this.GetDuration()).then(()=>super.hide())}GetDuration(){return this.duration}Dev(){const n="В режиме разработки",r=fe.Warning;super.showMessage(n,r)}Save(){const n="Изменения успешно сохранены",r=fe.Success;super.showMessage(n,r)}}const pe=new La;class $e{static Get(e){const n=localStorage.getItem(e);if(n)return JSON.parse(n)}static Set(e,n){n&&localStorage.setItem(e,JSON.stringify(n))}static Remove(e){localStorage.removeItem(e)}}var Se=(t=>(t.User="user",t.AccessToken="accessToken",t.RefreshToken="refreshToken",t))(Se||{});class Da{set(e){this.setAccessToken(e.accessToken),this.setRefreshToken(e.refreshToken)}getAccessToken(){return $e.Get(Se.AccessToken)}getRefreshToken(){return $e.Get(Se.RefreshToken)}setAccessToken(e){$e.Set(Se.AccessToken,e)}setRefreshToken(e){$e.Set(Se.RefreshToken,e)}reset(){$e.Remove(Se.AccessToken),$e.Remove(Se.RefreshToken)}actualize(){this.setAccessToken(this.getAccessToken()),this.setRefreshToken(this.getAccessToken())}}class Ha{constructor(){c(this,"user");c(this,"userConstructor")}AssignTo(e){e.user=this.get()}setUserConstructor(e){this.userConstructor=e}get(){if(this.userConstructor)return this.user=new this.userConstructor($e.Get(Se.User)),this.user}set(e){this.userConstructor&&(this.user=new this.userConstructor(e),$e.Set(Se.User,this.user))}reset(){this.user=void 0,$e.Remove(Se.User)}actualize(){const e=$e.Get(Se.User);e&&this.set(e)}}class qa{constructor(){c(this,"isAuth",!1);c(this,"user",new Ha);c(this,"tokens",new Da);c(this,"preventLogout",!1)}DeprecateLogout(){this.preventLogout=!0}AllowLogout(){this.preventLogout=!1}get IsAuth(){return this.isAuth}get User(){return this.user.get()}SetUserConstructor(e){this.user.setUserConstructor(e)}SetState(e){this.user.set(e.user),this.tokens.set(e.tokens),this.isAuth=!0}Logout(){if(this.preventLogout){pe.Warning("В текущий момент Вы не можете выйти из системы");return}this.user.reset(),this.tokens.reset(),this.isAuth=!1}Actualize(){if(this.tokens.actualize(),this.tokens.getAccessToken()){this.isAuth=!0;return}this.Logout()}}const St=class St{constructor(){c(this,"form",i.reactive(new Fa));c(this,"status",i.reactive(new qa));c(this,"modal",i.reactive(new Oa));if(St.instance)return St.instance;St.instance=this,Object.freeze(this)}get Form(){return this.form}get Status(){return this.status}get Modal(){return this.modal}};c(St,"instance");let Dn=St;const Ne=new Dn;var tr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/*! *****************************************************************************
|
|
1
|
+
(function(E,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(E=typeof globalThis<"u"?globalThis:E||self,i(E.sprof={},E.Vue))})(this,function(E,i){"use strict";var rp=Object.defineProperty;var op=(E,i,Re)=>i in E?rp(E,i,{enumerable:!0,configurable:!0,writable:!0,value:Re}):E[i]=Re;var c=(E,i,Re)=>op(E,typeof i!="symbol"?i+"":i,Re);var Ye,be,qt,H,Ce,Je;var Re=typeof document<"u"?document.currentScript:null,se=(t=>(t.Login="login",t.Register="register",t.Restore="restore",t.Refresh="refresh",t))(se||{}),fe=(t=>(t.Primary="primary",t.Success="success",t.Warning="warning",t.Error="error",t.Info="info",t))(fe||{});class Ke{constructor(e,n,r,o){c(this,"text","Сохранить");c(this,"type",fe.Success);c(this,"condition",!0);c(this,"action");c(this,"id","button");c(this,"disabled",!1);this.text=e,this.type=r,this.action=n,o!==void 0&&(this.condition=o)}static Primary(e,n,r){return new Ke(e,n,fe.Primary,r)}static Success(e,n,r){return new Ke(e,n,fe.Success,r)}static Warning(e,n,r){return new Ke(e,n,fe.Warning,r)}static Error(e,n,r){return new Ke(e,n,fe.Error,r)}}class Wt extends Ke{constructor(){super();c(this,"id","auth-button");c(this,"chunk",se.Login);c(this,"text","");c(this,"isSubmit",!1);c(this,"isLink",!0)}GetChunk(){return this.chunk}}let Tn=class extends Wt{constructor(){super(...arguments);c(this,"id","auth-button-login");c(this,"text","Войти");c(this,"isSubmit",!1);c(this,"chunk",se.Login)}};class ji extends Wt{constructor(){super(...arguments);c(this,"id","auth-button-refresh");c(this,"text","Обновить пароль");c(this,"isSubmit",!1);c(this,"chunk",se.Refresh)}}class Fn extends Wt{constructor(){super(...arguments);c(this,"id","auth-button-register");c(this,"text","Зарегистрироваться");c(this,"isSubmit",!1);c(this,"chunk",se.Register)}}class jt extends Wt{constructor(){super(...arguments);c(this,"id","auth-button-restore");c(this,"text","Забыли пароль?");c(this,"isSubmit",!1);c(this,"chunk",se.Restore)}}class Gi{constructor(){c(this,"value","");c(this,"label","");c(this,"placeholder","");c(this,"validator")}Validate(){return this.validator?(this.validator.validate(this.value),this.validator.errors):[]}Reset(){this.value=""}}class Gt extends Gi{constructor(){super(...arguments);c(this,"method");c(this,"id","field-auth");c(this,"name","")}}var dt=(t=>(t.Login="login",t.Email="email",t.Phone="phone",t.VK="vk",t.ESIA="esia",t))(dt||{});const za=/\S+@\S+\.\S+/;class Zi{constructor(){c(this,"errors",[])}validate(e){return(e===""||!e)&&this.errors.push("Введите email"),za.test(e)||this.errors.push("Некорректный email"),this.errors}}class Zt extends Gt{constructor(){super(...arguments);c(this,"id","field-auth-email");c(this,"label","Email");c(this,"name","email");c(this,"placeholder","Введите email");c(this,"validator",new Zi);c(this,"method",dt.Email)}}class Ta{constructor(){c(this,"errors",[]);c(this,"length",6)}validate(e){return e===""||!e?(this.errors.push("Введите пароль"),this.errors):(e.length<this.length&&this.errors.push("Пароль недостаточной длины"),this.errors)}}class Xt extends Gt{constructor(){super(...arguments);c(this,"label","Пароль");c(this,"validator",new Ta);c(this,"name","password");c(this,"placeholder","Введите пароль");c(this,"id","field-auth-password")}}class Xi extends Gt{constructor(){super(...arguments);c(this,"label","Повторите пароль");c(this,"id","field-auth-password-repeat")}}const Yi={allowRestore:!1,[se.Login]:{methods:[dt.Email],title:"Вход в систему",action:"login",buttons:[new Tn,new Fn,new jt],fields:[new Zt,new Xt],errorMessage:"Неверно указан email или пароль",successMessage:"Вы успешно вошли в систему"},[se.Register]:{methods:[],title:"Регистрация",action:"register",buttons:[new Fn,new Tn,new jt],fields:[new Zt,new Xt,new Xi],errorMessage:"Неверно указан email или пароль",successMessage:"Вы успешно зарегистрировались в системе, войдите под своим паролем"},[se.Restore]:{title:"Восстановление пароля",methods:[],action:"restorePassword",successMessage:"Ссылка для восстановления пароля отправлена на Вашу почту",errorMessage:"Неверно указан email",buttons:[new jt],fields:[new Zt]},[se.Refresh]:{methods:[],title:"Создание нового пароля",action:"passwordChange",successMessage:"Воспользуйтесь новым паролем для входа",errorMessage:"Неверно указан email",buttons:[new ji],fields:[new Xt]}};let Fa=class{constructor(){c(this,"settings",Yi);c(this,"chunk",se.Login);c(this,"selectedMethod",dt.Email)}async Block(e){await e()}GetValues(){const e=this.GetFields(),n=new Map;return e.forEach(r=>{r.value&&n.set(r.name,r.value)}),Object.fromEntries(n)}Validate(){return[]}GetFields(){return this.GetCurSet().fields.filter(e=>!e.method||e.method===this.selectedMethod)}GetMethods(){return this.GetCurSet().methods}Chunk(){return this.chunk}get Settings(){return this.settings}GetCurSet(){return this.settings[this.chunk]}get IsLogin(){return this.chunk===se.Login}get IsRegister(){return this.chunk===se.Register}get IsRestore(){return this.chunk===se.Restore}get IsRefresh(){return this.chunk===se.Refresh}SetChunk(e){this.chunk=e}GetTitle(){return this.GetCurSet().title}GetButtons(){const e=this.GetCurSet().buttons;return e.forEach(n=>{n.isSubmit=!1}),e[0].isSubmit=!0,e}GetSuccessMessage(){return this.GetCurSet().successMessage}GetErrorMessage(){return this.GetCurSet().errorMessage}GetAction(){return this.GetCurSet().action}ResetFields(){this.GetCurSet().fields.forEach(e=>e.Reset())}Reset(){this.chunk=se.Login}};class Oa{constructor(){c(this,"visible",!1);c(this,"closable",!1)}get Closable(){return this.closable}get Visible(){return this.visible}Close(){this.visible=!1}Open(e){e&&(this.closable=!0),this.visible=!0}}class Ji{constructor(){c(this,"visible",!1)}hide(){this.visible=!1}show(){this.hide(),this.visible=!0}IsVisible(){return this.visible}}class Qi extends Ji{constructor(){super(...arguments);c(this,"type",fe.Success);c(this,"text","");c(this,"title","")}showMessage(n,r){this.hide(),this.type=r,typeof n=="string"?this.text=n:(this.text=n.text,this.title=n.title??""),super.show()}GetText(){return this.text}GetTitle(){return this.title}GetType(){return this.type}Info(n){this.showMessage(n,fe.Info)}Success(n){this.showMessage(n,fe.Success)}Error(n){this.showMessage(n,fe.Error)}Warning(n){this.showMessage(n,fe.Warning)}FormMessage(n){let r="<strong>Проверьте правильность введенных данных:</strong><ul>";for(const o of Object.keys(n))n[o][0]&&n[o][0].message&&(r+=`<li>${n[o][0].message}</li>`);return r+="</ul>",r}}class On{static Get(e,n,r="-"){return!e||!n?"":`${e}${r}${n}`}static In(e,n,r){return e>=n&&e<=r}static Intersects(e,n,r,o){return e===r||n===o||e>r&&e<o||n>r&&n<o||n>o&&e<r}}const Ki=1e3,er=60*Ki,Ln=60*er;var Bt=(t=>(t.FiveMinutes="5",t.HourQuarter="15",t.HourHalf="30",t.Hour="60",t))(Bt||{});const Yt={5:["00","05","10","15","20","25","30","35","40","45","50","55"],15:["00","15","30","45"],30:["00","30"],60:["00"]};class D{static S(e){return Ki*e}static M(e){return er*e}static H(e){return Ln*e}static D(e){return Ln*e}static W(e){return Ln*e}static NormalizeTime(e){return String(e).padStart(2,"0")}static HMtoM(e){const n=D.SplitHM(e);return n.length>1?D.HtoM(n[0])+n[1]:D.HtoM(n[0])}static HtoM(e){return Number(e)*60}static SplitHM(e){if(!e)return[];const n=e.split(":");return[Number(n[0]),Number(n[1])]}static HmsToHm(e){const n=D.SplitHM(e);return D.ConcatHM(n[0],n[1])}static AddMtoHM(e,n){const r=new Date,o=D.SplitHM(e);r.setHours(o[0],o[1],0,0);const s=new Date(r.getTime()+n*6e4),a=s.getHours(),d=s.getMinutes();return D.ConcatHM(a,d)}static ConcatHM(e,n){return`${e}:${D.NormalizeTime(n)}`}static DiffM(e,n){return D.Gt(n,e)?D.HMtoM(n)-D.HMtoM(e):D.HMtoM(e)-D.HMtoM(n)}static GetPeriod(e,n){return On.Get(e,n)}static Gt(e,n){return D.HMtoM(e)>D.HMtoM(n)}static GtOrEq(e,n){return D.Gt(e,n)||D.Eq(e,n)}static Eq(e,n){return D.HMtoM(e)===D.HMtoM(n)}static PeriodInPeriod(e,n,r,o){return D.HMtoM(e)>=D.HMtoM(r)&&D.HMtoM(n)<=D.HMtoM(o)}static PeriodsIntersects(e,n,r,o){return On.Intersects(D.HMtoM(e),D.HMtoM(n),D.HMtoM(r),D.HMtoM(o))}}class Mt{static Wait(e,n){return new Promise(r=>setTimeout(()=>r(n),e))}static WaitS(e,n){return Mt.Wait(D.S(e),n)}static WaitM(e,n){return Mt.Wait(D.M(e),n)}}class La extends Qi{constructor(){super(...arguments);c(this,"duration",D.S(3))}showMessage(n,r){super.showMessage(n,r),typeof n!="string"&&(this.duration=n.duration??this.duration),Mt.Wait(this.GetDuration()).then(()=>super.hide())}GetDuration(){return this.duration}Dev(){const n="В режиме разработки",r=fe.Warning;super.showMessage(n,r)}Save(){const n="Изменения успешно сохранены",r=fe.Success;super.showMessage(n,r)}}const pe=new La;class $e{static Get(e){const n=localStorage.getItem(e);if(n)return JSON.parse(n)}static Set(e,n){n&&localStorage.setItem(e,JSON.stringify(n))}static Remove(e){localStorage.removeItem(e)}}var Se=(t=>(t.User="user",t.AccessToken="accessToken",t.RefreshToken="refreshToken",t))(Se||{});class Da{set(e){this.setAccessToken(e.accessToken),this.setRefreshToken(e.refreshToken)}getAccessToken(){return $e.Get(Se.AccessToken)}getRefreshToken(){return $e.Get(Se.RefreshToken)}setAccessToken(e){$e.Set(Se.AccessToken,e)}setRefreshToken(e){$e.Set(Se.RefreshToken,e)}reset(){$e.Remove(Se.AccessToken),$e.Remove(Se.RefreshToken)}actualize(){this.setAccessToken(this.getAccessToken()),this.setRefreshToken(this.getAccessToken())}}class Ha{constructor(){c(this,"user");c(this,"userConstructor")}AssignTo(e){e.user=this.get()}setUserConstructor(e){this.userConstructor=e}get(){if(this.userConstructor)return this.user=new this.userConstructor($e.Get(Se.User)),this.user}set(e){this.userConstructor&&(this.user=new this.userConstructor(e),$e.Set(Se.User,this.user))}reset(){this.user=void 0,$e.Remove(Se.User)}actualize(){const e=$e.Get(Se.User);e&&this.set(e)}}class qa{constructor(){c(this,"isAuth",!1);c(this,"user",new Ha);c(this,"tokens",new Da);c(this,"preventLogout",!1)}DeprecateLogout(){this.preventLogout=!0}AllowLogout(){this.preventLogout=!1}get IsAuth(){return this.isAuth}get User(){return this.user.get()}SetUserConstructor(e){this.user.setUserConstructor(e)}SetUser(e){this.user.set(e)}SetState(e){this.SetUser(e.user),this.tokens.set(e.tokens),this.isAuth=!0}Logout(){if(this.preventLogout){pe.Warning("В текущий момент Вы не можете выйти из системы");return}this.user.reset(),this.tokens.reset(),this.isAuth=!1}Actualize(){if(this.tokens.actualize(),this.tokens.getAccessToken()){this.isAuth=!0;return}this.Logout()}}const St=class St{constructor(){c(this,"form",i.reactive(new Fa));c(this,"status",i.reactive(new qa));c(this,"modal",i.reactive(new Oa));if(St.instance)return St.instance;St.instance=this,Object.freeze(this)}get Form(){return this.form}get Status(){return this.status}get Modal(){return this.modal}};c(St,"instance");let Dn=St;const Ne=new Dn;var tr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/*! *****************************************************************************
|
|
2
2
|
Copyright (C) Microsoft. All rights reserved.
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
4
|
this file except in compliance with the License. You may obtain a copy of the
|
package/package.json
CHANGED