sprof 0.1.51 → 0.1.52
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.
|
@@ -24,6 +24,7 @@ export default class BaseStore<T extends IWithId & IFileInfosGetter> {
|
|
|
24
24
|
GetAll(options?: GetAllOptions): Promise<void>;
|
|
25
25
|
Get(id?: string): Promise<void>;
|
|
26
26
|
GetBySlug(slug?: string): Promise<void>;
|
|
27
|
+
TestMethod(): Promise<void>;
|
|
27
28
|
FTSP(options?: GetAllOptions): Promise<void>;
|
|
28
29
|
Create(item?: T): Promise<T | void>;
|
|
29
30
|
CreateAndSet(item: T): Promise<void>;
|
|
@@ -37,6 +37,7 @@ export default abstract class S {
|
|
|
37
37
|
GetAll(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
38
38
|
Get(id?: string | undefined): Promise<void>;
|
|
39
39
|
GetBySlug(slug?: string | undefined): Promise<void>;
|
|
40
|
+
TestMethod(): Promise<void>;
|
|
40
41
|
FTSP(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
41
42
|
Create(item?: import('../classes/Contact').default | undefined): Promise<void | import('../classes/Contact').default>;
|
|
42
43
|
CreateAndSet(item: import('../classes/Contact').default): Promise<void>;
|
|
@@ -75,6 +76,7 @@ export default abstract class S {
|
|
|
75
76
|
GetAll(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
76
77
|
Get(id?: string | undefined): Promise<void>;
|
|
77
78
|
GetBySlug(slug?: string | undefined): Promise<void>;
|
|
79
|
+
TestMethod(): Promise<void>;
|
|
78
80
|
FTSP(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
79
81
|
Create(item?: import('../classes/Email').default | undefined): Promise<void | import('../classes/Email').default>;
|
|
80
82
|
CreateAndSet(item: import('../classes/Email').default): Promise<void>;
|
|
@@ -114,6 +116,7 @@ export default abstract class S {
|
|
|
114
116
|
GetAll(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
115
117
|
Get(id?: string | undefined): Promise<void>;
|
|
116
118
|
GetBySlug(slug?: string | undefined): Promise<void>;
|
|
119
|
+
TestMethod(): Promise<void>;
|
|
117
120
|
FTSP(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
118
121
|
Create(item?: import('../classes/FTSPPreset').default | undefined): Promise<void | import('../classes/FTSPPreset').default>;
|
|
119
122
|
CreateAndSet(item: import('../classes/FTSPPreset').default): Promise<void>;
|
|
@@ -152,6 +155,7 @@ export default abstract class S {
|
|
|
152
155
|
GetAll(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
153
156
|
Get(id?: string | undefined): Promise<void>;
|
|
154
157
|
GetBySlug(slug?: string | undefined): Promise<void>;
|
|
158
|
+
TestMethod(): Promise<void>;
|
|
155
159
|
FTSP(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
156
160
|
Create(item?: import('../classes/Human').default | undefined): Promise<void | import('../classes/Human').default>;
|
|
157
161
|
CreateAndSet(item: import('../classes/Human').default): Promise<void>;
|
|
@@ -190,6 +194,7 @@ export default abstract class S {
|
|
|
190
194
|
GetAll(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
191
195
|
Get(id?: string | undefined): Promise<void>;
|
|
192
196
|
GetBySlug(slug?: string | undefined): Promise<void>;
|
|
197
|
+
TestMethod(): Promise<void>;
|
|
193
198
|
FTSP(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
194
199
|
Create(item?: import('../classes/Phone').default | undefined): Promise<void | import('../classes/Phone').default>;
|
|
195
200
|
CreateAndSet(item: import('../classes/Phone').default): Promise<void>;
|
|
@@ -228,6 +233,7 @@ export default abstract class S {
|
|
|
228
233
|
GetAll(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
229
234
|
Get(id?: string | undefined): Promise<void>;
|
|
230
235
|
GetBySlug(slug?: string | undefined): Promise<void>;
|
|
236
|
+
TestMethod(): Promise<void>;
|
|
231
237
|
FTSP(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
232
238
|
Create(item?: import('../classes/Schema').default | undefined): Promise<void | import('../classes/Schema').default>;
|
|
233
239
|
CreateAndSet(item: import('../classes/Schema').default): Promise<void>;
|
|
@@ -266,6 +272,7 @@ export default abstract class S {
|
|
|
266
272
|
GetAll(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
267
273
|
Get(id?: string | undefined): Promise<void>;
|
|
268
274
|
GetBySlug(slug?: string | undefined): Promise<void>;
|
|
275
|
+
TestMethod(): Promise<void>;
|
|
269
276
|
FTSP(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
270
277
|
Create(item?: import('../classes/UserAccount').default | undefined): Promise<void | import('../classes/UserAccount').default>;
|
|
271
278
|
CreateAndSet(item: import('../classes/UserAccount').default): Promise<void>;
|
|
@@ -304,6 +311,7 @@ export default abstract class S {
|
|
|
304
311
|
GetAll(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
305
312
|
Get(id?: string | undefined): Promise<void>;
|
|
306
313
|
GetBySlug(slug?: string | undefined): Promise<void>;
|
|
314
|
+
TestMethod(): Promise<void>;
|
|
307
315
|
FTSP(options?: import('../helpers/BaseStore').GetAllOptions | undefined): Promise<void>;
|
|
308
316
|
Create(item?: import('../classes/ValueType').default | undefined): Promise<void | import('../classes/ValueType').default>;
|
|
309
317
|
CreateAndSet(item: import('../classes/ValueType').default): Promise<void>;
|
package/dist/sprof.js
CHANGED
|
@@ -4726,6 +4726,9 @@ class de {
|
|
|
4726
4726
|
async GetBySlug(e) {
|
|
4727
4727
|
e || (e = gt.Slug()), this.Set(await B.H.HttpClient.Get({ query: this.getUrl("by-slug/" + e) }));
|
|
4728
4728
|
}
|
|
4729
|
+
async TestMethod() {
|
|
4730
|
+
console.warn(this.items);
|
|
4731
|
+
}
|
|
4729
4732
|
async FTSP(e) {
|
|
4730
4733
|
var o;
|
|
4731
4734
|
console.warn("FTSP");
|
package/dist/sprof.umd.cjs
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
`);return a===-1?"":s.stack.slice(a+1)})();try{if(!r.stack)r.stack=o;else if(o){const a=o.indexOf(`
|
|
20
20
|
`),c=a===-1?-1:o.indexOf(`
|
|
21
21
|
`,a+1),d=c===-1?"":o.slice(c+1);String(r.stack).endsWith(d)||(r.stack+=`
|
|
22
|
-
`+o)}}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=bt(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&qn.assertOptions(r,{silentJSONParsing:Ie.transitional(Ie.boolean),forcedJSONParsing:Ie.transitional(Ie.boolean),clarifyTimeoutError:Ie.transitional(Ie.boolean),legacyInterceptorReqResOrdering:Ie.transitional(Ie.boolean)},!1),s!=null&&(y.isFunction(s)?n.paramsSerializer={serialize:s}:qn.assertOptions(s,{encode:Ie.function,serialize:Ie.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),qn.assertOptions(n,{baseUrl:Ie.spelling("baseURL"),withXsrfToken:Ie.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&y.merge(o.common,o[n.method]);o&&y.forEach(["delete","get","head","post","put","patch","query","common"],k=>{delete o[k]}),n.headers=be.concat(a,o);const c=[];let d=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;d=d&&w.synchronous;const b=n.transitional||zi;b&&b.legacyInterceptorReqResOrdering?c.unshift(w.fulfilled,w.rejected):c.push(w.fulfilled,w.rejected)});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let h,f=0,m;if(!d){const k=[Ms.bind(this),void 0];for(k.unshift(...c),k.push(...u),m=k.length,h=Promise.resolve(n);f<m;)h=h.then(k[f++],k[f++]);return h}m=c.length;let p=n;for(;f<m;){const k=c[f++],w=c[f++];try{p=k(p)}catch(b){w.call(this,b);break}}try{h=Ms.call(this,p)}catch(k){return Promise.reject(k)}for(f=0,m=u.length;f<m;)h=h.then(u[f++],u[f++]);return h}getUri(e){e=bt(this.defaults,e);const n=ys(e.baseURL,e.url,e.allowAbsoluteUrls);return ds(n,e.params,e.paramsSerializer)}};y.forEach(["delete","get","head","options"],function(e){Ct.prototype[e]=function(n,r){return this.request(bt(r||{},{method:e,url:n,data:(r||{}).data}))}}),y.forEach(["post","put","patch","query"],function(e){function n(r){return function(o,a,c){return this.request(bt(c||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}Ct.prototype[e]=n(),e!=="query"&&(Ct.prototype[e+"Form"]=n(!0))});let Cd=class hl{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const a=new Promise(c=>{r.subscribe(c),o=c}).then(s);return a.cancel=function(){r.unsubscribe(o)},a},e(function(o,a,c){r.reason||(r.reason=new on(o,a,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new hl(function(s){e=s}),cancel:e}}};function Sd(t){return function(n){return t.apply(null,n)}}function kd(t){return y.isObject(t)&&t.isAxiosError===!0}const Hi={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Hi).forEach(([t,e])=>{Hi[e]=t});function Rs(t){const e=new Ct(t),n=Jr(Ct.prototype.request,e);return y.extend(n,Ct.prototype,e,{allOwnKeys:!0}),y.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return Rs(bt(t,s))},n}const ne=Rs(sn);ne.Axios=Ct,ne.CanceledError=on,ne.CancelToken=Cd,ne.isCancel=fs,ne.VERSION=Fi,ne.toFormData=Fn,ne.AxiosError=N,ne.Cancel=ne.CanceledError,ne.all=function(e){return Promise.all(e)},ne.spread=Sd,ne.isAxiosError=kd,ne.mergeConfig=bt,ne.AxiosHeaders=be,ne.formToJSON=t=>hs(y.isHTMLForm(t)?new FormData(t):t),ne.getAdapter=vs.getAdapter,ne.HttpStatusCode=Hi,ne.default=ne;const{Axios:qg,AxiosError:_g,CanceledError:Ug,isCancel:jg,CancelToken:Wg,VERSION:Gg,all:Zg,Cancel:Xg,isAxiosError:Jg,spread:Yg,toFormData:Qg,AxiosHeaders:Kg,HttpStatusCode:e1,formToJSON:t1,getAdapter:n1,mergeConfig:i1,create:r1}=ne;var an=(t=>(t.GET="get",t.POST="post",t.PUT="put",t.DELETE="delete",t))(an||{});const ln=(()=>{function t(){const d=s();return!(!d||d==="undefined")}function e(d){d.accessToken&&localStorage.setItem("access_token",d.accessToken),d.refreshToken&&localStorage.setItem("refresh_token",d.refreshToken)}function n(){const d=localStorage.getItem("user");return d?JSON.parse(d).id:""}function r(){const d=localStorage.getItem("user");if(d)return JSON.parse(d)}function s(){return localStorage.getItem("access_token")}function o(){return localStorage.getItem("refresh_token")}function a(){localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")}function c(d){if(!t())return;const u=ln.getUser();u&&(u.human=d,localStorage.setItem("user",JSON.stringify(u)))}return{isAuth:t,setTokens:e,getAccessToken:s,getRefreshToken:o,getUserId:n,clearTokens:a,getUser:r,updateHuman:c}})();class qi{constructor(e){l(this,"code",400);l(this,"err","");R.BuildClass(this,e)}getErr(){return this.capitalizedErr()}capitalizedErr(){return this.err.charAt(0).toUpperCase()+this.err.slice(1)}static async Handle(e,n){const r=e.config;if(e.response){if(e.response.status===401&&!r._retry)return r._retry=!0,n.defaults.headers.common.token=ln.getAccessToken(),e.config.headers.token=ln.getAccessToken(),e.config.baseURL=void 0,n.request(r);if(e.response.status>=500){if(e.response.data==="неверный логин или пароль"){ke.Error("Неверный логин или пароль");return}ke.Error("Ошибка на сервере, попробуйте позже")}if(e.response.status>=400&&e.response.status<500){const s=new qi(e.response.data).getErr();s&&ke.Error(s)}return Promise.reject(e)}}}const Ot=ne.create();Ot.interceptors.response.use(t=>t,async t=>await qi.Handle(t,Ot));class cn{static async Get(e,n,r){return await Ot({method:an.GET,url:e,headers:n,responseType:r})}static async Post(e,n,r,s){return n["Content-Type"]="multipart/form-data",await Ot({method:an.POST,url:e,headers:n,responseType:r,data:s})}static async Put(e,n,r){return n["Content-Type"]="multipart/form-data",await Ot({method:an.PUT,url:e,headers:n,data:r})}static async Delete(e,n){return await Ot({method:an.DELETE,url:e,headers:n})}}class _n{constructor(e){l(this,"name","");R.BuildClass(this,e)}static Set(){}static Get(e,n){const r=sessionStorage.getItem(e);if(r){const s=JSON.parse(r),o=new Date,a=new Date(s.time),c=o.getTime()-a.getTime();return Math.round(c/6e4)>(n||10)?null:s.data}else return null}static async TryGet(e,n,r){let s;return s=_n.Get(e,r),s||(s=await n()),s}}var _i=(t=>(t.ContentType="Content-Type",t.Token="token",t))(_i||{}),$s=(t=>(t.ApplicationJson="application/json",t.MultipartFormData="multipart/form-data",t))($s||{});const J=class J{static Setup(e="http://localhost",n,r="api"){console.log(n,e),this.baseUrl=q.BuildSafeUrl(e,n,r),this.host=e,this.apiVersion=r}static newWebSocket(e){const n=this.host.replace("http","ws")+"/ws/"+e;return new WebSocket(n)}static download(e,n){const r=J.getDownloadFileName(e,n.headers),s=URL.createObjectURL(n.data),o=document.createElement("a");o.href=s,o.setAttribute("download",r),o.setAttribute("target","_blank"),document.body.appendChild(o),o.click()}static getDownloadFileName(e,n){if(e)return e;const r=n["content-disposition"];if(!r)return"file";const s=r.indexOf('"')+1,o=r.lastIndexOf('"'),a=r.substring(s,o);return a||"file"}static getHeaders(e){const n=qe.Get(Te.AccessToken);return e||(e=J.headers),n&&(e[_i.Token]=n),e??J.headers}static returnResponse(e,n){if(n)return e!=null&&e.isBlob?J.download(e.downloadFileName,n):n.data}static async Get(e){return J.returnResponse(e,await cn.Get(J.buildUrl((e==null?void 0:e.query)??""),J.getHeaders(e==null?void 0:e.headers),J.getResponseType(e==null?void 0:e.isBlob)))}static async Post(e){return J.returnResponse(e,await cn.Post(J.buildUrl(e==null?void 0:e.query),J.getHeaders(e==null?void 0:e.headers),J.getResponseType(e.isBlob),J.createFormDataPayload(e==null?void 0:e.payload,e==null?void 0:e.fileInfos)))}static async Put(e){return J.returnResponse(e,await cn.Put(J.buildUrl(e==null?void 0:e.query),J.getHeaders(e==null?void 0:e.headers),J.createFormDataPayload(e==null?void 0:e.payload,e==null?void 0:e.fileInfos)))}static async Delete(e){return J.returnResponse(e,await cn.Delete(J.buildUrl(e==null?void 0:e.query),J.getHeaders(e==null?void 0:e.headers)))}static async Subscribe(e){const{query:n}=e;return new EventSource(J.buildUrl(n))}static buildUrl(e=""){try{return Ei(this.baseUrl,e)}catch{throw new Error(`Invalid base URL: ${this.baseUrl}`)}}static getResponseType(e){return e?"blob":"json"}static createFormDataPayload(e,n){const r=new FormData;if(r.append("form",JSON.stringify(e)),n)for(const s of n)s.file&&r.append(s.id??"files",s.file,s.originalName);return r}};l(J,"baseUrl",""),l(J,"apiVersion","api"),l(J,"host",""),l(J,"headers",{[_i.ContentType]:$s.ApplicationJson});let te=J;const x=(t,e)=>{const n=t.__vccOpts||t;for(const[r,s]of e)n[r]=s;return n},Ed={},xd={style:{"text-align":"center"}};function vd(t,e){return i.openBlock(),i.createElementBlock("div",xd,e[0]||(e[0]=[i.createElementVNode("h1",null,"Страница не найдена",-1)]))}const Ui=x(Ed,[["render",vd]]),Md=[{path:"/:pathMatch(.*)*",name:"NotFound",component:Ui}],Pe=class Pe{static Setup(e,n=""){this.router=e,this.title=n,this.ChangeDocumentTitle(),this.AddRoutes(Md)}static Get(){return this.router}static AddRoutes(e){e.forEach(n=>{this.Get().addRoute(n)})}static async To(e){await this.Get().push(e)}static async ToHome(){}static async Replace(e){await this.Get().replace(e)}static Id(){return Pe.GetStringParam("id")}static Slug(){return Pe.GetStringParam("slug")}static async Back(){this.Get().go(-1)}static GetQid(){return Pe.GetStringQueryParam("qid")}static Route(){var e;return(e=this.Get())==null?void 0:e.currentRoute.value}static RouterPushBlank(e){const n=this.Get().resolve({path:e});window.open(n==null?void 0:n.href,"_blank")}static GetPath(){var n;const e=(n=Pe.Route())==null?void 0:n.path.split("/");return!e||e.length<=0?"":e[e.length-1]}static async ToAdmin(e){if(!e){await this.Get().push("/admin");return}let n=e;n[0]==="/"&&(n=e.substring(1)),await Pe.To(`/admin/${n}`)}static GetStringQueryParam(e){return String(this.Route().query[e])}static GetNumberQueryParam(e){return Number(this.Route().query[e]??0)}static GetStringParam(e){var n;return(n=this.Route())==null?void 0:n.params[e]}static SetQueryParam(e,n){const r=new URL(window.location);r.searchParams.set(e,String(n)),history.replaceState(null,"",r)}static Resolve(e){return this.Get().resolve(e)}};l(Pe,"router"),l(Pe,"title",""),l(Pe,"ChangeDocumentTitle",(e="")=>{let n=Pe.Route().meta.title??e;n&&(n=" | "+n),document.title=Pe.title+n});let _e=Pe;class Q{constructor(e,n){l(this,"items",i.reactive([]));l(this,"item");l(this,"options",i.reactive([]));l(this,"count",i.ref(0));l(this,"classConstructor");l(this,"url","");l(this,"searchStr",i.ref(""));this.classConstructor=e,this.item=i.reactive(new this.classConstructor),this.url=n}Set(e){Object.assign(this.item,new this.classConstructor(e))}getUrl(e){return e?`${this.url}/${e}`:this.url}async GetOptions(e="name",n="id"){const r=`${this.getUrl()}/options/${e}/${n}`,s=await te.Get({query:r});s&&(this.options.splice(0,this.options.length),this.options.push(...s))}async GetAll(e){let n;const r=te.Get;e&&e.withCache?n=await _n.TryGet(this.getUrl(),r):n=await r({query:this.getUrl()}),Array.isArray(n)?this.SetAll(n):this.SetAllWithCount(n)}async Get(e){e||(e=_e.Id()),this.Set(await te.Get({query:this.getUrl(e)}))}async GetBySlug(e){e||(e=_e.Slug()),this.Set(await $.H.HttpClient.Get({query:this.getUrl("by-slug/"+e)}))}async FTSP(e){var a;console.warn("FTSP");const r=((e==null?void 0:e.ftsp)??Ke.Get()).clearForHTTP(),s={payload:{ftsp:r},query:this.getUrl("ftsp")},o=await te.Post(s);if(!(!o||!o.ftsp))if(Array.isArray(o.data))this.SetAll(o.data);else{if(r.p.append){this.AppendToAll((a=o.data)==null?void 0:a.items);return}console.log(o.data),this.SetAllWithCount(o.data)}}async Create(e){const n=e??this.item,r={payload:n,query:this.getUrl()};return n.getFileInfos&&(r.fileInfos=n.getFileInfos()),await te.Post(r)}async CreateAndSet(e){const n=await this.Create(e);this.Set(n)}async CreateMany(e){if(!e)return;const n=[];e.forEach(r=>{n.push(new Promise(()=>this.Create(r)))}),Promise.all(n)}async Update(e){const n=e??this.item,r={query:this.getUrl(`${n.id}`),payload:n};return n.getFileInfos&&(r.fileInfos=n.getFileInfos(),r.fileInfos.forEach(s=>s.url="")),await te.Put(r)}async UpdateAndSet(e){const n=await this.Update(e);this.Set(n)}async UpdateAndReset(e){await this.Update(e??this.item),this.Set()}async Remove(e){if(!e){console.warn("BaseStore/Remove. id is undefined");return}await te.Delete({query:this.getUrl(`${e}`)}),this.RemoveItem(e)}async UpdateMany(e){if(e||(e=this.items),!e)return;const n=[];e.forEach(r=>{n.push(new Promise(()=>this.Update(r)))}),Promise.all(n)}SetAll(e){this.items.splice(0,this.items.length),console.log(this.items),e&&this.items.push(...e.map(n=>new this.classConstructor(n)))}SetAllWithCount(e){console.log(e),this.SetAll(e.items),this.count.value=e.count}RemoveItem(e){const n=this.items.findIndex(r=>r.id===e);this.items.splice(n,1)}AppendToAll(e){if(e){if(Array.isArray(e)){const n=e.map(r=>new this.classConstructor(r));this.items.push(...n);return}this.items.push(new this.classConstructor(e))}}ResetState(){this.ResetItem(),this.ClearItems(),this.count.value=0}ResetItem(){R.BuildClass(this.item,new this.classConstructor)}ClearItems(){this.items.splice(0,this.items.length)}UnshiftToAll(e){if(e){if(Array.isArray(e)){const n=e.map(r=>new this.classConstructor(r));this.items.unshift(...n);return}this.items.unshift(new this.classConstructor(e))}}get Items(){return this.items}get ItemsFiltered(){return this.searchStr.value.trim()?this.Items.filter(e=>$.H.Strings.SearchInFields(this.searchStr.value,e.SearchFields())):this.Items}get Options(){return this.options}get Item(){return this.item}get Count(){return this.count}get SearchStr(){return this.searchStr}}function Bd(t,e){t=="left"&&e.next(),t=="right"&&e.prev()}const Rd=["#31af5e","#ff4d3b","#006BB5","#f3911c"];class $d{static GetRandColor(e){return Qe.GetRandEL(e??Rd)}}function Is(t,e){const n=[],r=e||$e.Asc,s=r===$e.Asc?$e.Desc:$e.Asc;return Object.values(t).forEach(o=>{n.push(o(r)),n.push(o(s))}),n.length>0&&!n.some(o=>o.default)&&(n[0].default=!0),e&&n.forEach(o=>{o.default&&(o.default=o.order===e)}),n}let Id=class{constructor(){l(this,"startHour",9);l(this,"endHour",19);l(this,"timelinePxHeight",50);l(this,"timelineStep",Yt.FiveMinutes);l(this,"activeTime","");l(this,"activeObjectId","");l(this,"dragged",!1);l(this,"draggedStartTime","");l(this,"draggedEndTime","");l(this,"timelines",vn[Yt.FiveMinutes])}startDrag(e,n){this.draggedStartTime=e,this.draggedEndTime=n,this.dragged=!0}endDrag(){this.activeTime="",this.dragged=!1}setTimelineStep(e){this.timelineStep=e,this.setTimelines()}setTimelines(){this.timelines=vn[this.timelineStep]}getScheduleHeight(){return this.getHourHeight()*this.getHoursArr().length}getHourHeight(){return this.timelinePxHeight*this.timelines.length}getHoursArr(){return Qe.GenerateNumsRange(this.startHour,this.endHour)}};const ji=t=>t===8||t===46,Nd=t=>t>46&&t<58,Ad=t=>t>34&&t<41,Pd=t=>t+".",zd=(t,e,n)=>{ji(e)||Ad(e)||(!Nd(e)||n>9)&&t.preventDefault()};function Td(t,e){if(e>8){let n=t.substring(0,2).replace(".","1");Number(n)>31&&(n="31");let r=t.substring(3,5).replace(".","1");Number(r)>12&&(r="12");let s=t.substring(6,10).replace(".","1");Number(s)>2100&&(s="2100"),t=n+"."+r+"."+s}return t}function Vd(t){const e=t.keyCode;let n=t.srcElement.value;const r=n.length;zd(t,e,r),!ji(e)&&(r===2||r===5)&&(n=Pd(n));const s=t.srcElement.value+String.fromCharCode(t.which);if(ji(e)){t.srcElement.value=n;return}n.length===0&&Number(s)>3&&(n="3",t.preventDefault()),n.length===1&&Number(s)>31&&(n="31",t.preventDefault()),s.length===5&&Number(s.substring(3,5))>12&&(n=n.substring(0,3)+"12",t.preventDefault()),n=Td(n,r),t.srcElement.value=n}const Od=["ВС","ПН","ВТ","СР","ЧТ","ПТ","СБ"],Fd="ru-RU";class Ue{constructor(){l(this,"locale","ru-RU")}static Format(e,n){if(!e)return"";const r={year:"numeric",month:"2-digit",day:"2-digit",hour:void 0,minute:void 0};return n&&(r.year=n.year||n.year===void 0?n.year:r.year,r.month=n.month||n.month===void 0?n.month:r.month,r.day=n.day||n.day===void 0?n.day:r.day,r.hour=n.hour??r.hour,r.minute=n.minute??r.minute),Intl.DateTimeFormat(Fd,r).format(new Date(e))}static FormatWithTime(e){return Ue.Format(e,{month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric"})}static FromRuStr(e){const n=e.split(".");return new Date(`${n[2]}-${n[1]}-${n[0]}`)}static GetPeriod(e,n,r){return`${this.Format(e,r)}-${this.Format(n,r)}`}static GetShortDayName(e){return e?Od[e.getDay()]:""}static GetCurrentWeekPeriod(e){const n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-n.getDay()+1),s=new Date(n.getFullYear(),n.getMonth(),r.getDate()+7);return this.GetPeriod(r,s,e||{month:"2-digit",day:"numeric",year:void 0})}static GetDurationInDay(e,n){const r=new Date,s=new Date,o=Ue.SplitHourTime(e),a=Ue.SplitHourTime(n);return r.setHours(o[0],o[1],0,0),s.setHours(a[0],a[1],0,0),(s.getTime()-r.getTime())/1e3/60}static HourTimeinMunutes(e){const n=Ue.SplitHourTime(e);return n[0]*60+n[1]}static SplitHourTime(e){const n=e.split(":");return[Number(n[0]),Number(n[1])]}static AddMinutesToHM(e,n){const r=new Date,s=Ue.SplitHourTime(e);r.setHours(s[0],s[1],0,0);const o=new Date(r.getTime()+n*6e4),a=o.getHours(),c=o.getMinutes();return`${a}:${c}`}static GetMonthsDiff(e,n){return n.getMonth()-e.getMonth()+12*(n.getFullYear()-e.getFullYear())}static StringToDate(e){const n=e.split(".");return new Date(`${n[2]}-${n[1]}-${n[0]}`)}static GetDateOrToday(e){return e?e.date:new Date}static InPeriod(e,n,r){return new Date(e)>=new Date(n)&&new Date(e)<=new Date(r)}static GetDatesFromPeriod(e,n){const r=[new Date(e)];let s=e;for(;s<=n;)s=Ue.AddDays(s,1),r.push(s);return r}static AddDays(e,n){const r=new Date(e);return r.setDate(r.getDate()+n),r}static Eq(e,n){return e.getTime()===n.getTime()}}class Dd{constructor(){l(this,"dragged",!1);l(this,"dragImg",new Image);this.dragImg.src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="}start(e){this.dragged=!0,e&&e.dataTransfer&&e.dataTransfer.setDragImage(this.dragImg,0,0)}end(){this.dragged=!1}isDragged(){return this.dragged}}class Ns{static Get(e){const n=e.split(".");return n[n.length-1]}}const Ld=(()=>{function t(o,a){localStorage.setItem(`${o}_favourite`,a.toString())}function e(o,a){const c=localStorage.getItem(`${o}_favourite`);return c?c.split(",").includes(a):!1}function n(o,a){const c=localStorage.getItem(`${o}_favourite`);if(!c){t(o,[a]);return}const d=c.split(",");d.push(a),t(o,d)}function r(o,a){const c=localStorage.getItem(`${o}_favourite`);if(!c)return;const d=c.split(",").filter(u=>u!==a);t(o,d)}function s(){for(const o in localStorage)o.includes("_favourite")&&localStorage.removeItem(o)}return{addToFavourite:n,removeFromFavourite:r,setFavourite:t,isFavourite:e,clearFavourite:s}})();/*!
|
|
22
|
+
`+o)}}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=bt(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&qn.assertOptions(r,{silentJSONParsing:Ie.transitional(Ie.boolean),forcedJSONParsing:Ie.transitional(Ie.boolean),clarifyTimeoutError:Ie.transitional(Ie.boolean),legacyInterceptorReqResOrdering:Ie.transitional(Ie.boolean)},!1),s!=null&&(y.isFunction(s)?n.paramsSerializer={serialize:s}:qn.assertOptions(s,{encode:Ie.function,serialize:Ie.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),qn.assertOptions(n,{baseUrl:Ie.spelling("baseURL"),withXsrfToken:Ie.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&y.merge(o.common,o[n.method]);o&&y.forEach(["delete","get","head","post","put","patch","query","common"],k=>{delete o[k]}),n.headers=be.concat(a,o);const c=[];let d=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;d=d&&w.synchronous;const b=n.transitional||zi;b&&b.legacyInterceptorReqResOrdering?c.unshift(w.fulfilled,w.rejected):c.push(w.fulfilled,w.rejected)});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let h,f=0,m;if(!d){const k=[Ms.bind(this),void 0];for(k.unshift(...c),k.push(...u),m=k.length,h=Promise.resolve(n);f<m;)h=h.then(k[f++],k[f++]);return h}m=c.length;let p=n;for(;f<m;){const k=c[f++],w=c[f++];try{p=k(p)}catch(b){w.call(this,b);break}}try{h=Ms.call(this,p)}catch(k){return Promise.reject(k)}for(f=0,m=u.length;f<m;)h=h.then(u[f++],u[f++]);return h}getUri(e){e=bt(this.defaults,e);const n=ys(e.baseURL,e.url,e.allowAbsoluteUrls);return ds(n,e.params,e.paramsSerializer)}};y.forEach(["delete","get","head","options"],function(e){Ct.prototype[e]=function(n,r){return this.request(bt(r||{},{method:e,url:n,data:(r||{}).data}))}}),y.forEach(["post","put","patch","query"],function(e){function n(r){return function(o,a,c){return this.request(bt(c||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}Ct.prototype[e]=n(),e!=="query"&&(Ct.prototype[e+"Form"]=n(!0))});let Cd=class hl{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const a=new Promise(c=>{r.subscribe(c),o=c}).then(s);return a.cancel=function(){r.unsubscribe(o)},a},e(function(o,a,c){r.reason||(r.reason=new on(o,a,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new hl(function(s){e=s}),cancel:e}}};function Sd(t){return function(n){return t.apply(null,n)}}function kd(t){return y.isObject(t)&&t.isAxiosError===!0}const Hi={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Hi).forEach(([t,e])=>{Hi[e]=t});function Rs(t){const e=new Ct(t),n=Jr(Ct.prototype.request,e);return y.extend(n,Ct.prototype,e,{allOwnKeys:!0}),y.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return Rs(bt(t,s))},n}const ne=Rs(sn);ne.Axios=Ct,ne.CanceledError=on,ne.CancelToken=Cd,ne.isCancel=fs,ne.VERSION=Fi,ne.toFormData=Fn,ne.AxiosError=N,ne.Cancel=ne.CanceledError,ne.all=function(e){return Promise.all(e)},ne.spread=Sd,ne.isAxiosError=kd,ne.mergeConfig=bt,ne.AxiosHeaders=be,ne.formToJSON=t=>hs(y.isHTMLForm(t)?new FormData(t):t),ne.getAdapter=vs.getAdapter,ne.HttpStatusCode=Hi,ne.default=ne;const{Axios:qg,AxiosError:_g,CanceledError:Ug,isCancel:jg,CancelToken:Wg,VERSION:Gg,all:Zg,Cancel:Xg,isAxiosError:Jg,spread:Yg,toFormData:Qg,AxiosHeaders:Kg,HttpStatusCode:e1,formToJSON:t1,getAdapter:n1,mergeConfig:i1,create:r1}=ne;var an=(t=>(t.GET="get",t.POST="post",t.PUT="put",t.DELETE="delete",t))(an||{});const ln=(()=>{function t(){const d=s();return!(!d||d==="undefined")}function e(d){d.accessToken&&localStorage.setItem("access_token",d.accessToken),d.refreshToken&&localStorage.setItem("refresh_token",d.refreshToken)}function n(){const d=localStorage.getItem("user");return d?JSON.parse(d).id:""}function r(){const d=localStorage.getItem("user");if(d)return JSON.parse(d)}function s(){return localStorage.getItem("access_token")}function o(){return localStorage.getItem("refresh_token")}function a(){localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")}function c(d){if(!t())return;const u=ln.getUser();u&&(u.human=d,localStorage.setItem("user",JSON.stringify(u)))}return{isAuth:t,setTokens:e,getAccessToken:s,getRefreshToken:o,getUserId:n,clearTokens:a,getUser:r,updateHuman:c}})();class qi{constructor(e){l(this,"code",400);l(this,"err","");R.BuildClass(this,e)}getErr(){return this.capitalizedErr()}capitalizedErr(){return this.err.charAt(0).toUpperCase()+this.err.slice(1)}static async Handle(e,n){const r=e.config;if(e.response){if(e.response.status===401&&!r._retry)return r._retry=!0,n.defaults.headers.common.token=ln.getAccessToken(),e.config.headers.token=ln.getAccessToken(),e.config.baseURL=void 0,n.request(r);if(e.response.status>=500){if(e.response.data==="неверный логин или пароль"){ke.Error("Неверный логин или пароль");return}ke.Error("Ошибка на сервере, попробуйте позже")}if(e.response.status>=400&&e.response.status<500){const s=new qi(e.response.data).getErr();s&&ke.Error(s)}return Promise.reject(e)}}}const Ot=ne.create();Ot.interceptors.response.use(t=>t,async t=>await qi.Handle(t,Ot));class cn{static async Get(e,n,r){return await Ot({method:an.GET,url:e,headers:n,responseType:r})}static async Post(e,n,r,s){return n["Content-Type"]="multipart/form-data",await Ot({method:an.POST,url:e,headers:n,responseType:r,data:s})}static async Put(e,n,r){return n["Content-Type"]="multipart/form-data",await Ot({method:an.PUT,url:e,headers:n,data:r})}static async Delete(e,n){return await Ot({method:an.DELETE,url:e,headers:n})}}class _n{constructor(e){l(this,"name","");R.BuildClass(this,e)}static Set(){}static Get(e,n){const r=sessionStorage.getItem(e);if(r){const s=JSON.parse(r),o=new Date,a=new Date(s.time),c=o.getTime()-a.getTime();return Math.round(c/6e4)>(n||10)?null:s.data}else return null}static async TryGet(e,n,r){let s;return s=_n.Get(e,r),s||(s=await n()),s}}var _i=(t=>(t.ContentType="Content-Type",t.Token="token",t))(_i||{}),$s=(t=>(t.ApplicationJson="application/json",t.MultipartFormData="multipart/form-data",t))($s||{});const J=class J{static Setup(e="http://localhost",n,r="api"){console.log(n,e),this.baseUrl=q.BuildSafeUrl(e,n,r),this.host=e,this.apiVersion=r}static newWebSocket(e){const n=this.host.replace("http","ws")+"/ws/"+e;return new WebSocket(n)}static download(e,n){const r=J.getDownloadFileName(e,n.headers),s=URL.createObjectURL(n.data),o=document.createElement("a");o.href=s,o.setAttribute("download",r),o.setAttribute("target","_blank"),document.body.appendChild(o),o.click()}static getDownloadFileName(e,n){if(e)return e;const r=n["content-disposition"];if(!r)return"file";const s=r.indexOf('"')+1,o=r.lastIndexOf('"'),a=r.substring(s,o);return a||"file"}static getHeaders(e){const n=qe.Get(Te.AccessToken);return e||(e=J.headers),n&&(e[_i.Token]=n),e??J.headers}static returnResponse(e,n){if(n)return e!=null&&e.isBlob?J.download(e.downloadFileName,n):n.data}static async Get(e){return J.returnResponse(e,await cn.Get(J.buildUrl((e==null?void 0:e.query)??""),J.getHeaders(e==null?void 0:e.headers),J.getResponseType(e==null?void 0:e.isBlob)))}static async Post(e){return J.returnResponse(e,await cn.Post(J.buildUrl(e==null?void 0:e.query),J.getHeaders(e==null?void 0:e.headers),J.getResponseType(e.isBlob),J.createFormDataPayload(e==null?void 0:e.payload,e==null?void 0:e.fileInfos)))}static async Put(e){return J.returnResponse(e,await cn.Put(J.buildUrl(e==null?void 0:e.query),J.getHeaders(e==null?void 0:e.headers),J.createFormDataPayload(e==null?void 0:e.payload,e==null?void 0:e.fileInfos)))}static async Delete(e){return J.returnResponse(e,await cn.Delete(J.buildUrl(e==null?void 0:e.query),J.getHeaders(e==null?void 0:e.headers)))}static async Subscribe(e){const{query:n}=e;return new EventSource(J.buildUrl(n))}static buildUrl(e=""){try{return Ei(this.baseUrl,e)}catch{throw new Error(`Invalid base URL: ${this.baseUrl}`)}}static getResponseType(e){return e?"blob":"json"}static createFormDataPayload(e,n){const r=new FormData;if(r.append("form",JSON.stringify(e)),n)for(const s of n)s.file&&r.append(s.id??"files",s.file,s.originalName);return r}};l(J,"baseUrl",""),l(J,"apiVersion","api"),l(J,"host",""),l(J,"headers",{[_i.ContentType]:$s.ApplicationJson});let te=J;const x=(t,e)=>{const n=t.__vccOpts||t;for(const[r,s]of e)n[r]=s;return n},Ed={},xd={style:{"text-align":"center"}};function vd(t,e){return i.openBlock(),i.createElementBlock("div",xd,e[0]||(e[0]=[i.createElementVNode("h1",null,"Страница не найдена",-1)]))}const Ui=x(Ed,[["render",vd]]),Md=[{path:"/:pathMatch(.*)*",name:"NotFound",component:Ui}],Pe=class Pe{static Setup(e,n=""){this.router=e,this.title=n,this.ChangeDocumentTitle(),this.AddRoutes(Md)}static Get(){return this.router}static AddRoutes(e){e.forEach(n=>{this.Get().addRoute(n)})}static async To(e){await this.Get().push(e)}static async ToHome(){}static async Replace(e){await this.Get().replace(e)}static Id(){return Pe.GetStringParam("id")}static Slug(){return Pe.GetStringParam("slug")}static async Back(){this.Get().go(-1)}static GetQid(){return Pe.GetStringQueryParam("qid")}static Route(){var e;return(e=this.Get())==null?void 0:e.currentRoute.value}static RouterPushBlank(e){const n=this.Get().resolve({path:e});window.open(n==null?void 0:n.href,"_blank")}static GetPath(){var n;const e=(n=Pe.Route())==null?void 0:n.path.split("/");return!e||e.length<=0?"":e[e.length-1]}static async ToAdmin(e){if(!e){await this.Get().push("/admin");return}let n=e;n[0]==="/"&&(n=e.substring(1)),await Pe.To(`/admin/${n}`)}static GetStringQueryParam(e){return String(this.Route().query[e])}static GetNumberQueryParam(e){return Number(this.Route().query[e]??0)}static GetStringParam(e){var n;return(n=this.Route())==null?void 0:n.params[e]}static SetQueryParam(e,n){const r=new URL(window.location);r.searchParams.set(e,String(n)),history.replaceState(null,"",r)}static Resolve(e){return this.Get().resolve(e)}};l(Pe,"router"),l(Pe,"title",""),l(Pe,"ChangeDocumentTitle",(e="")=>{let n=Pe.Route().meta.title??e;n&&(n=" | "+n),document.title=Pe.title+n});let _e=Pe;class Q{constructor(e,n){l(this,"items",i.reactive([]));l(this,"item");l(this,"options",i.reactive([]));l(this,"count",i.ref(0));l(this,"classConstructor");l(this,"url","");l(this,"searchStr",i.ref(""));this.classConstructor=e,this.item=i.reactive(new this.classConstructor),this.url=n}Set(e){Object.assign(this.item,new this.classConstructor(e))}getUrl(e){return e?`${this.url}/${e}`:this.url}async GetOptions(e="name",n="id"){const r=`${this.getUrl()}/options/${e}/${n}`,s=await te.Get({query:r});s&&(this.options.splice(0,this.options.length),this.options.push(...s))}async GetAll(e){let n;const r=te.Get;e&&e.withCache?n=await _n.TryGet(this.getUrl(),r):n=await r({query:this.getUrl()}),Array.isArray(n)?this.SetAll(n):this.SetAllWithCount(n)}async Get(e){e||(e=_e.Id()),this.Set(await te.Get({query:this.getUrl(e)}))}async GetBySlug(e){e||(e=_e.Slug()),this.Set(await $.H.HttpClient.Get({query:this.getUrl("by-slug/"+e)}))}async TestMethod(){console.warn(this.items)}async FTSP(e){var a;console.warn("FTSP");const r=((e==null?void 0:e.ftsp)??Ke.Get()).clearForHTTP(),s={payload:{ftsp:r},query:this.getUrl("ftsp")},o=await te.Post(s);if(!(!o||!o.ftsp))if(Array.isArray(o.data))this.SetAll(o.data);else{if(r.p.append){this.AppendToAll((a=o.data)==null?void 0:a.items);return}console.log(o.data),this.SetAllWithCount(o.data)}}async Create(e){const n=e??this.item,r={payload:n,query:this.getUrl()};return n.getFileInfos&&(r.fileInfos=n.getFileInfos()),await te.Post(r)}async CreateAndSet(e){const n=await this.Create(e);this.Set(n)}async CreateMany(e){if(!e)return;const n=[];e.forEach(r=>{n.push(new Promise(()=>this.Create(r)))}),Promise.all(n)}async Update(e){const n=e??this.item,r={query:this.getUrl(`${n.id}`),payload:n};return n.getFileInfos&&(r.fileInfos=n.getFileInfos(),r.fileInfos.forEach(s=>s.url="")),await te.Put(r)}async UpdateAndSet(e){const n=await this.Update(e);this.Set(n)}async UpdateAndReset(e){await this.Update(e??this.item),this.Set()}async Remove(e){if(!e){console.warn("BaseStore/Remove. id is undefined");return}await te.Delete({query:this.getUrl(`${e}`)}),this.RemoveItem(e)}async UpdateMany(e){if(e||(e=this.items),!e)return;const n=[];e.forEach(r=>{n.push(new Promise(()=>this.Update(r)))}),Promise.all(n)}SetAll(e){this.items.splice(0,this.items.length),console.log(this.items),e&&this.items.push(...e.map(n=>new this.classConstructor(n)))}SetAllWithCount(e){console.log(e),this.SetAll(e.items),this.count.value=e.count}RemoveItem(e){const n=this.items.findIndex(r=>r.id===e);this.items.splice(n,1)}AppendToAll(e){if(e){if(Array.isArray(e)){const n=e.map(r=>new this.classConstructor(r));this.items.push(...n);return}this.items.push(new this.classConstructor(e))}}ResetState(){this.ResetItem(),this.ClearItems(),this.count.value=0}ResetItem(){R.BuildClass(this.item,new this.classConstructor)}ClearItems(){this.items.splice(0,this.items.length)}UnshiftToAll(e){if(e){if(Array.isArray(e)){const n=e.map(r=>new this.classConstructor(r));this.items.unshift(...n);return}this.items.unshift(new this.classConstructor(e))}}get Items(){return this.items}get ItemsFiltered(){return this.searchStr.value.trim()?this.Items.filter(e=>$.H.Strings.SearchInFields(this.searchStr.value,e.SearchFields())):this.Items}get Options(){return this.options}get Item(){return this.item}get Count(){return this.count}get SearchStr(){return this.searchStr}}function Bd(t,e){t=="left"&&e.next(),t=="right"&&e.prev()}const Rd=["#31af5e","#ff4d3b","#006BB5","#f3911c"];class $d{static GetRandColor(e){return Qe.GetRandEL(e??Rd)}}function Is(t,e){const n=[],r=e||$e.Asc,s=r===$e.Asc?$e.Desc:$e.Asc;return Object.values(t).forEach(o=>{n.push(o(r)),n.push(o(s))}),n.length>0&&!n.some(o=>o.default)&&(n[0].default=!0),e&&n.forEach(o=>{o.default&&(o.default=o.order===e)}),n}let Id=class{constructor(){l(this,"startHour",9);l(this,"endHour",19);l(this,"timelinePxHeight",50);l(this,"timelineStep",Yt.FiveMinutes);l(this,"activeTime","");l(this,"activeObjectId","");l(this,"dragged",!1);l(this,"draggedStartTime","");l(this,"draggedEndTime","");l(this,"timelines",vn[Yt.FiveMinutes])}startDrag(e,n){this.draggedStartTime=e,this.draggedEndTime=n,this.dragged=!0}endDrag(){this.activeTime="",this.dragged=!1}setTimelineStep(e){this.timelineStep=e,this.setTimelines()}setTimelines(){this.timelines=vn[this.timelineStep]}getScheduleHeight(){return this.getHourHeight()*this.getHoursArr().length}getHourHeight(){return this.timelinePxHeight*this.timelines.length}getHoursArr(){return Qe.GenerateNumsRange(this.startHour,this.endHour)}};const ji=t=>t===8||t===46,Nd=t=>t>46&&t<58,Ad=t=>t>34&&t<41,Pd=t=>t+".",zd=(t,e,n)=>{ji(e)||Ad(e)||(!Nd(e)||n>9)&&t.preventDefault()};function Td(t,e){if(e>8){let n=t.substring(0,2).replace(".","1");Number(n)>31&&(n="31");let r=t.substring(3,5).replace(".","1");Number(r)>12&&(r="12");let s=t.substring(6,10).replace(".","1");Number(s)>2100&&(s="2100"),t=n+"."+r+"."+s}return t}function Vd(t){const e=t.keyCode;let n=t.srcElement.value;const r=n.length;zd(t,e,r),!ji(e)&&(r===2||r===5)&&(n=Pd(n));const s=t.srcElement.value+String.fromCharCode(t.which);if(ji(e)){t.srcElement.value=n;return}n.length===0&&Number(s)>3&&(n="3",t.preventDefault()),n.length===1&&Number(s)>31&&(n="31",t.preventDefault()),s.length===5&&Number(s.substring(3,5))>12&&(n=n.substring(0,3)+"12",t.preventDefault()),n=Td(n,r),t.srcElement.value=n}const Od=["ВС","ПН","ВТ","СР","ЧТ","ПТ","СБ"],Fd="ru-RU";class Ue{constructor(){l(this,"locale","ru-RU")}static Format(e,n){if(!e)return"";const r={year:"numeric",month:"2-digit",day:"2-digit",hour:void 0,minute:void 0};return n&&(r.year=n.year||n.year===void 0?n.year:r.year,r.month=n.month||n.month===void 0?n.month:r.month,r.day=n.day||n.day===void 0?n.day:r.day,r.hour=n.hour??r.hour,r.minute=n.minute??r.minute),Intl.DateTimeFormat(Fd,r).format(new Date(e))}static FormatWithTime(e){return Ue.Format(e,{month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric"})}static FromRuStr(e){const n=e.split(".");return new Date(`${n[2]}-${n[1]}-${n[0]}`)}static GetPeriod(e,n,r){return`${this.Format(e,r)}-${this.Format(n,r)}`}static GetShortDayName(e){return e?Od[e.getDay()]:""}static GetCurrentWeekPeriod(e){const n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-n.getDay()+1),s=new Date(n.getFullYear(),n.getMonth(),r.getDate()+7);return this.GetPeriod(r,s,e||{month:"2-digit",day:"numeric",year:void 0})}static GetDurationInDay(e,n){const r=new Date,s=new Date,o=Ue.SplitHourTime(e),a=Ue.SplitHourTime(n);return r.setHours(o[0],o[1],0,0),s.setHours(a[0],a[1],0,0),(s.getTime()-r.getTime())/1e3/60}static HourTimeinMunutes(e){const n=Ue.SplitHourTime(e);return n[0]*60+n[1]}static SplitHourTime(e){const n=e.split(":");return[Number(n[0]),Number(n[1])]}static AddMinutesToHM(e,n){const r=new Date,s=Ue.SplitHourTime(e);r.setHours(s[0],s[1],0,0);const o=new Date(r.getTime()+n*6e4),a=o.getHours(),c=o.getMinutes();return`${a}:${c}`}static GetMonthsDiff(e,n){return n.getMonth()-e.getMonth()+12*(n.getFullYear()-e.getFullYear())}static StringToDate(e){const n=e.split(".");return new Date(`${n[2]}-${n[1]}-${n[0]}`)}static GetDateOrToday(e){return e?e.date:new Date}static InPeriod(e,n,r){return new Date(e)>=new Date(n)&&new Date(e)<=new Date(r)}static GetDatesFromPeriod(e,n){const r=[new Date(e)];let s=e;for(;s<=n;)s=Ue.AddDays(s,1),r.push(s);return r}static AddDays(e,n){const r=new Date(e);return r.setDate(r.getDate()+n),r}static Eq(e,n){return e.getTime()===n.getTime()}}class Dd{constructor(){l(this,"dragged",!1);l(this,"dragImg",new Image);this.dragImg.src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="}start(e){this.dragged=!0,e&&e.dataTransfer&&e.dataTransfer.setDragImage(this.dragImg,0,0)}end(){this.dragged=!1}isDragged(){return this.dragged}}class Ns{static Get(e){const n=e.split(".");return n[n.length-1]}}const Ld=(()=>{function t(o,a){localStorage.setItem(`${o}_favourite`,a.toString())}function e(o,a){const c=localStorage.getItem(`${o}_favourite`);return c?c.split(",").includes(a):!1}function n(o,a){const c=localStorage.getItem(`${o}_favourite`);if(!c){t(o,[a]);return}const d=c.split(",");d.push(a),t(o,d)}function r(o,a){const c=localStorage.getItem(`${o}_favourite`);if(!c)return;const d=c.split(",").filter(u=>u!==a);t(o,d)}function s(){for(const o in localStorage)o.includes("_favourite")&&localStorage.removeItem(o)}return{addToFavourite:n,removeFromFavourite:r,setFavourite:t,isFavourite:e,clearFavourite:s}})();/*!
|
|
23
23
|
* vue-router v4.5.1
|
|
24
24
|
* (c) 2025 Eduardo San Martin Morote
|
|
25
25
|
* @license MIT
|
package/package.json
CHANGED