sprof 0.0.167 → 0.0.168

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/sprof.js CHANGED
@@ -187,7 +187,7 @@ const $a = {
187
187
  };
188
188
  let Ea = class {
189
189
  constructor() {
190
- l(this, "block", !0);
190
+ l(this, "block", !1);
191
191
  l(this, "settings", $a);
192
192
  l(this, "chunk", Re.Login);
193
193
  l(this, "selectedMethod", di.Email);
@@ -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 sp=Object.defineProperty;var ap=(E,i,Me)=>i in E?sp(E,i,{enumerable:!0,configurable:!0,writable:!0,value:Me}):E[i]=Me;var c=(E,i,Me)=>ap(E,typeof i!="symbol"?i+"":i,Me);var Je,be,Ut,H,Ce,Qe;var Me=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 et{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 et(e,n,fe.Primary,r)}static Success(e,n,r){return new et(e,n,fe.Success,r)}static Warning(e,n,r){return new et(e,n,fe.Warning,r)}static Error(e,n,r){return new et(e,n,fe.Error,r)}}class jt extends et{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 Ln=class extends jt{constructor(){super(...arguments);c(this,"id","auth-button-login");c(this,"text","Войти");c(this,"isSubmit",!1);c(this,"chunk",se.Login)}};class Ji extends jt{constructor(){super(...arguments);c(this,"id","auth-button-refresh");c(this,"text","Обновить пароль");c(this,"isSubmit",!1);c(this,"chunk",se.Refresh)}}class Dn extends jt{constructor(){super(...arguments);c(this,"id","auth-button-register");c(this,"text","Зарегистрироваться");c(this,"isSubmit",!1);c(this,"chunk",se.Register)}}class Gt extends jt{constructor(){super(...arguments);c(this,"id","auth-button-restore");c(this,"text","Забыли пароль?");c(this,"isSubmit",!1);c(this,"chunk",se.Restore)}}class Qi{constructor(){c(this,"value","");c(this,"label","");c(this,"placeholder","");c(this,"validator")}Validate(){return this.validator?(this.validator.errors=[],this.validator.validate(this.value),this.validator.errors):[]}Reset(){this.value=""}}class Zt extends Qi{constructor(){super(...arguments);c(this,"method");c(this,"id","field-auth");c(this,"name","")}}var ht=(t=>(t.Login="login",t.Email="email",t.Phone="phone",t.VK="vk",t.ESIA="esia",t))(ht||{});const Ta=/\S+@\S+\.\S+/;class Ki{constructor(){c(this,"errors",[])}validate(e){return(e===""||!e)&&this.errors.push("Введите email"),Ta.test(e)||this.errors.push("Некорректный email"),this.errors}}var tt=(t=>(t.Email="field-auth-email",t.Password="field-auth-password",t.PasswordRepeat="field-auth-password-repeat",t))(tt||{});class Xt extends Zt{constructor(){super(...arguments);c(this,"id",tt.Email);c(this,"label","Email");c(this,"name","email");c(this,"placeholder","Введите email");c(this,"validator",new Ki);c(this,"method",ht.Email)}}class Fa{constructor(){c(this,"errors",[]);c(this,"length",3)}validate(e){return e===""||!e?(this.errors.push("Введите пароль"),this.errors):(e.length<this.length&&this.errors.push("Пароль должен быть длиннее 3 символов"),this.errors)}}class Yt extends Zt{constructor(){super(...arguments);c(this,"label","Пароль");c(this,"validator",new Fa);c(this,"name","password");c(this,"placeholder","Введите пароль");c(this,"id",tt.Password)}}class er extends Zt{constructor(){super(...arguments);c(this,"label","Повторите пароль");c(this,"id",tt.PasswordRepeat)}}const tr={allowRestore:!1,[se.Login]:{methods:[ht.Email],title:"Вход в систему",action:"login",buttons:[new Ln,new Dn,new Gt],fields:[new Xt,new Yt],errorMessage:"Неверно указан email или пароль",successMessage:"Вы успешно вошли в систему"},[se.Register]:{methods:[],title:"Регистрация",action:"register",buttons:[new Dn,new Ln,new Gt],fields:[new Xt,new Yt,new er],errorMessage:"Неверно указан email или пароль",successMessage:"Вы успешно зарегистрировались в системе, войдите под своим паролем"},[se.Restore]:{title:"Восстановление пароля",methods:[],action:"restorePassword",successMessage:"Ссылка для восстановления пароля отправлена на Вашу почту",errorMessage:"Неверно указан email",buttons:[new Gt],fields:[new Xt]},[se.Refresh]:{methods:[],title:"Создание нового пароля",action:"passwordChange",successMessage:"Воспользуйтесь новым паролем для входа",errorMessage:"Неверно указан email",buttons:[new Ji],fields:[new Yt]}};let Oa=class{constructor(){c(this,"block",!0);c(this,"settings",tr);c(this,"chunk",se.Login);c(this,"selectedMethod",ht.Email)}async Block(e){this.block=!0,await e(),this.block=!1}get IsBlock(){return this.block}GetValues(){const e=this.GetFields(),n=new Map;return e.forEach(r=>{r.value&&n.set(r.name,r.value)}),Object.fromEntries(n)}Validate(){if(this.IsRegister){const e=this.GetField(tt.Password),n=this.GetField(tt.PasswordRepeat);if((e==null?void 0:e.value)!==(n==null?void 0:n.value))return["Пароли не совпадают"]}return this.GetFields().map(e=>e.Validate()).flat()}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.SetChunk(se.Login),this.ResetFields()}GetField(e){return this.GetFields().find(n=>n.id===e)}};class La{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 nr{constructor(){c(this,"visible",!1)}hide(){console.log("hide"),this.visible=!1}show(){this.hide(),this.visible=!0}IsVisible(){return this.visible}}class ir extends nr{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 Hn{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 rr=1e3,or=60*rr,qn=60*or;var Mt=(t=>(t.FiveMinutes="5",t.HourQuarter="15",t.HourHalf="30",t.Hour="60",t))(Mt||{});const Jt={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 rr*e}static M(e){return or*e}static H(e){return qn*e}static D(e){return qn*e}static W(e){return qn*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 Hn.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 Hn.Intersects(D.HMtoM(e),D.HMtoM(n),D.HMtoM(r),D.HMtoM(o))}}class Rt{static Wait(e,n){return new Promise(r=>setTimeout(()=>r(n),e))}static WaitS(e,n){return Rt.Wait(D.S(e),n)}static WaitM(e,n){return Rt.Wait(D.M(e),n)}}class Da extends ir{constructor(){super(...arguments);c(this,"duration",D.S(3));c(this,"instance")}showMessage(n,r){super.showMessage(n,r),this.visible=!0,typeof n!="string"&&(this.duration=n.duration??this.duration),Rt.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 Ha=new Da,pe=i.reactive(Ha);class ve{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 Re=(t=>(t.User="user",t.AccessToken="accessToken",t.RefreshToken="refreshToken",t))(Re||{});class qa{set(e){this.setAccessToken(e.accessToken),this.setRefreshToken(e.refreshToken)}getAccessToken(){return ve.Get(Re.AccessToken)}getRefreshToken(){return ve.Get(Re.RefreshToken)}setAccessToken(e){ve.Set(Re.AccessToken,e)}setRefreshToken(e){ve.Set(Re.RefreshToken,e)}reset(){ve.Remove(Re.AccessToken),ve.Remove(Re.RefreshToken)}actualize(){this.setAccessToken(this.getAccessToken()),this.setRefreshToken(this.getAccessToken())}}class Ua{constructor(){c(this,"user");c(this,"userConstructor")}AssignTo(e){e.user=this.get()}setUserConstructor(e){this.userConstructor=e}get(){if(!this.userConstructor){console.warn("No userConstructor was set");return}return this.user}set(e){this.userConstructor&&(this.user=new this.userConstructor(e),ve.Set(Re.User,this.user))}reset(){this.user=void 0,ve.Remove(Re.User)}actualize(){const e=ve.Get(Re.User);e&&this.set(e)}}class Wa{constructor(){c(this,"isAuth",!1);c(this,"user",new Ua);c(this,"tokens",new qa);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.user.actualize(),this.tokens.actualize(),this.tokens.getAccessToken()){this.isAuth=!0;return}this.Logout()}}const Et=class Et{constructor(){c(this,"form",i.reactive(new Oa));c(this,"status",i.reactive(new Wa));c(this,"modal",i.reactive(new La));if(Et.instance)return Et.instance;Et.instance=this,Object.freeze(this)}get Form(){return this.form}get Status(){return this.status}get Modal(){return this.modal}};c(Et,"instance");let Un=Et;const Ne=new Un;var sr=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 sp=Object.defineProperty;var ap=(E,i,Me)=>i in E?sp(E,i,{enumerable:!0,configurable:!0,writable:!0,value:Me}):E[i]=Me;var c=(E,i,Me)=>ap(E,typeof i!="symbol"?i+"":i,Me);var Je,be,Ut,H,Ce,Qe;var Me=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 et{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 et(e,n,fe.Primary,r)}static Success(e,n,r){return new et(e,n,fe.Success,r)}static Warning(e,n,r){return new et(e,n,fe.Warning,r)}static Error(e,n,r){return new et(e,n,fe.Error,r)}}class jt extends et{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 Ln=class extends jt{constructor(){super(...arguments);c(this,"id","auth-button-login");c(this,"text","Войти");c(this,"isSubmit",!1);c(this,"chunk",se.Login)}};class Ji extends jt{constructor(){super(...arguments);c(this,"id","auth-button-refresh");c(this,"text","Обновить пароль");c(this,"isSubmit",!1);c(this,"chunk",se.Refresh)}}class Dn extends jt{constructor(){super(...arguments);c(this,"id","auth-button-register");c(this,"text","Зарегистрироваться");c(this,"isSubmit",!1);c(this,"chunk",se.Register)}}class Gt extends jt{constructor(){super(...arguments);c(this,"id","auth-button-restore");c(this,"text","Забыли пароль?");c(this,"isSubmit",!1);c(this,"chunk",se.Restore)}}class Qi{constructor(){c(this,"value","");c(this,"label","");c(this,"placeholder","");c(this,"validator")}Validate(){return this.validator?(this.validator.errors=[],this.validator.validate(this.value),this.validator.errors):[]}Reset(){this.value=""}}class Zt extends Qi{constructor(){super(...arguments);c(this,"method");c(this,"id","field-auth");c(this,"name","")}}var ht=(t=>(t.Login="login",t.Email="email",t.Phone="phone",t.VK="vk",t.ESIA="esia",t))(ht||{});const Ta=/\S+@\S+\.\S+/;class Ki{constructor(){c(this,"errors",[])}validate(e){return(e===""||!e)&&this.errors.push("Введите email"),Ta.test(e)||this.errors.push("Некорректный email"),this.errors}}var tt=(t=>(t.Email="field-auth-email",t.Password="field-auth-password",t.PasswordRepeat="field-auth-password-repeat",t))(tt||{});class Xt extends Zt{constructor(){super(...arguments);c(this,"id",tt.Email);c(this,"label","Email");c(this,"name","email");c(this,"placeholder","Введите email");c(this,"validator",new Ki);c(this,"method",ht.Email)}}class Fa{constructor(){c(this,"errors",[]);c(this,"length",3)}validate(e){return e===""||!e?(this.errors.push("Введите пароль"),this.errors):(e.length<this.length&&this.errors.push("Пароль должен быть длиннее 3 символов"),this.errors)}}class Yt extends Zt{constructor(){super(...arguments);c(this,"label","Пароль");c(this,"validator",new Fa);c(this,"name","password");c(this,"placeholder","Введите пароль");c(this,"id",tt.Password)}}class er extends Zt{constructor(){super(...arguments);c(this,"label","Повторите пароль");c(this,"id",tt.PasswordRepeat)}}const tr={allowRestore:!1,[se.Login]:{methods:[ht.Email],title:"Вход в систему",action:"login",buttons:[new Ln,new Dn,new Gt],fields:[new Xt,new Yt],errorMessage:"Неверно указан email или пароль",successMessage:"Вы успешно вошли в систему"},[se.Register]:{methods:[],title:"Регистрация",action:"register",buttons:[new Dn,new Ln,new Gt],fields:[new Xt,new Yt,new er],errorMessage:"Неверно указан email или пароль",successMessage:"Вы успешно зарегистрировались в системе, войдите под своим паролем"},[se.Restore]:{title:"Восстановление пароля",methods:[],action:"restorePassword",successMessage:"Ссылка для восстановления пароля отправлена на Вашу почту",errorMessage:"Неверно указан email",buttons:[new Gt],fields:[new Xt]},[se.Refresh]:{methods:[],title:"Создание нового пароля",action:"passwordChange",successMessage:"Воспользуйтесь новым паролем для входа",errorMessage:"Неверно указан email",buttons:[new Ji],fields:[new Yt]}};let Oa=class{constructor(){c(this,"block",!1);c(this,"settings",tr);c(this,"chunk",se.Login);c(this,"selectedMethod",ht.Email)}async Block(e){this.block=!0,await e(),this.block=!1}get IsBlock(){return this.block}GetValues(){const e=this.GetFields(),n=new Map;return e.forEach(r=>{r.value&&n.set(r.name,r.value)}),Object.fromEntries(n)}Validate(){if(this.IsRegister){const e=this.GetField(tt.Password),n=this.GetField(tt.PasswordRepeat);if((e==null?void 0:e.value)!==(n==null?void 0:n.value))return["Пароли не совпадают"]}return this.GetFields().map(e=>e.Validate()).flat()}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.SetChunk(se.Login),this.ResetFields()}GetField(e){return this.GetFields().find(n=>n.id===e)}};class La{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 nr{constructor(){c(this,"visible",!1)}hide(){console.log("hide"),this.visible=!1}show(){this.hide(),this.visible=!0}IsVisible(){return this.visible}}class ir extends nr{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 Hn{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 rr=1e3,or=60*rr,qn=60*or;var Mt=(t=>(t.FiveMinutes="5",t.HourQuarter="15",t.HourHalf="30",t.Hour="60",t))(Mt||{});const Jt={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 rr*e}static M(e){return or*e}static H(e){return qn*e}static D(e){return qn*e}static W(e){return qn*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 Hn.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 Hn.Intersects(D.HMtoM(e),D.HMtoM(n),D.HMtoM(r),D.HMtoM(o))}}class Rt{static Wait(e,n){return new Promise(r=>setTimeout(()=>r(n),e))}static WaitS(e,n){return Rt.Wait(D.S(e),n)}static WaitM(e,n){return Rt.Wait(D.M(e),n)}}class Da extends ir{constructor(){super(...arguments);c(this,"duration",D.S(3));c(this,"instance")}showMessage(n,r){super.showMessage(n,r),this.visible=!0,typeof n!="string"&&(this.duration=n.duration??this.duration),Rt.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 Ha=new Da,pe=i.reactive(Ha);class ve{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 Re=(t=>(t.User="user",t.AccessToken="accessToken",t.RefreshToken="refreshToken",t))(Re||{});class qa{set(e){this.setAccessToken(e.accessToken),this.setRefreshToken(e.refreshToken)}getAccessToken(){return ve.Get(Re.AccessToken)}getRefreshToken(){return ve.Get(Re.RefreshToken)}setAccessToken(e){ve.Set(Re.AccessToken,e)}setRefreshToken(e){ve.Set(Re.RefreshToken,e)}reset(){ve.Remove(Re.AccessToken),ve.Remove(Re.RefreshToken)}actualize(){this.setAccessToken(this.getAccessToken()),this.setRefreshToken(this.getAccessToken())}}class Ua{constructor(){c(this,"user");c(this,"userConstructor")}AssignTo(e){e.user=this.get()}setUserConstructor(e){this.userConstructor=e}get(){if(!this.userConstructor){console.warn("No userConstructor was set");return}return this.user}set(e){this.userConstructor&&(this.user=new this.userConstructor(e),ve.Set(Re.User,this.user))}reset(){this.user=void 0,ve.Remove(Re.User)}actualize(){const e=ve.Get(Re.User);e&&this.set(e)}}class Wa{constructor(){c(this,"isAuth",!1);c(this,"user",new Ua);c(this,"tokens",new qa);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.user.actualize(),this.tokens.actualize(),this.tokens.getAccessToken()){this.isAuth=!0;return}this.Logout()}}const Et=class Et{constructor(){c(this,"form",i.reactive(new Oa));c(this,"status",i.reactive(new Wa));c(this,"modal",i.reactive(new La));if(Et.instance)return Et.instance;Et.instance=this,Object.freeze(this)}get Form(){return this.form}get Status(){return this.status}get Modal(){return this.modal}};c(Et,"instance");let Un=Et;const Ne=new Un;var sr=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
@@ -2,7 +2,7 @@
2
2
  "name": "sprof",
3
3
  "description": "components for the designer and uikit",
4
4
  "author": "Stanislav Lushnikov, Daniil Gaivoronskiy",
5
- "version": "0.0.167",
5
+ "version": "0.0.168",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "./dist/sprof.umd.cjs",