@snabcentr/common-lib 2.22.0 → 2.24.0

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.
Files changed (56) hide show
  1. package/dist/manifest.json +1 -1
  2. package/dist/release_notes.tmp +2 -2
  3. package/dist/sc-common-lib.js +1077 -838
  4. package/dist/sc-common-lib.js.map +1 -1
  5. package/dist/sc-common-lib.umd.cjs +1 -1
  6. package/dist/sc-common-lib.umd.cjs.map +1 -1
  7. package/dist/src/date-time/helpers/date-helper.d.ts +13 -0
  8. package/dist/src/date-time/helpers/date-helper.d.ts.map +1 -0
  9. package/dist/src/date-time/helpers/index.d.ts +1 -0
  10. package/dist/src/date-time/helpers/index.d.ts.map +1 -1
  11. package/dist/src/managers/classes/manager.d.ts +21 -0
  12. package/dist/src/managers/classes/manager.d.ts.map +1 -1
  13. package/dist/src/managers/interfaces/i-manager.d.ts +21 -0
  14. package/dist/src/managers/interfaces/i-manager.d.ts.map +1 -1
  15. package/dist/src/managers/providers/manager-data-provider.d.ts +8 -0
  16. package/dist/src/managers/providers/manager-data-provider.d.ts.map +1 -1
  17. package/dist/src/offers/classes/index.d.ts +2 -0
  18. package/dist/src/offers/classes/index.d.ts.map +1 -1
  19. package/dist/src/offers/classes/offer-actualization.d.ts +50 -0
  20. package/dist/src/offers/classes/offer-actualization.d.ts.map +1 -0
  21. package/dist/src/offers/classes/offer-short-info.d.ts +14 -0
  22. package/dist/src/offers/classes/offer-short-info.d.ts.map +1 -1
  23. package/dist/src/offers/classes/offer.d.ts.map +1 -1
  24. package/dist/src/offers/classes/profstroy-offer-item.d.ts +38 -0
  25. package/dist/src/offers/classes/profstroy-offer-item.d.ts.map +1 -0
  26. package/dist/src/offers/enums/index.d.ts +2 -0
  27. package/dist/src/offers/enums/index.d.ts.map +1 -0
  28. package/dist/src/offers/enums/offer-actualization-status.d.ts +22 -0
  29. package/dist/src/offers/enums/offer-actualization-status.d.ts.map +1 -0
  30. package/dist/src/offers/helpers/index.d.ts +2 -0
  31. package/dist/src/offers/helpers/index.d.ts.map +1 -0
  32. package/dist/src/offers/helpers/offer-helper.d.ts +22 -0
  33. package/dist/src/offers/helpers/offer-helper.d.ts.map +1 -0
  34. package/dist/src/offers/index.d.ts +2 -0
  35. package/dist/src/offers/index.d.ts.map +1 -1
  36. package/dist/src/offers/interfaces/i-offer-actualization.d.ts +49 -0
  37. package/dist/src/offers/interfaces/i-offer-actualization.d.ts.map +1 -0
  38. package/dist/src/offers/interfaces/i-offer-short-info.d.ts +14 -0
  39. package/dist/src/offers/interfaces/i-offer-short-info.d.ts.map +1 -1
  40. package/dist/src/offers/interfaces/i-profstroy-offer-file.d.ts +14 -0
  41. package/dist/src/offers/interfaces/i-profstroy-offer-file.d.ts.map +1 -0
  42. package/dist/src/offers/interfaces/i-profstroy-offer-item.d.ts +32 -0
  43. package/dist/src/offers/interfaces/i-profstroy-offer-item.d.ts.map +1 -0
  44. package/dist/src/offers/interfaces/i-profstroy-offer.d.ts +21 -0
  45. package/dist/src/offers/interfaces/i-profstroy-offer.d.ts.map +1 -0
  46. package/dist/src/offers/interfaces/index.d.ts +4 -0
  47. package/dist/src/offers/interfaces/index.d.ts.map +1 -1
  48. package/dist/src/offers/providers/offers-data-provider.d.ts +32 -0
  49. package/dist/src/offers/providers/offers-data-provider.d.ts.map +1 -1
  50. package/dist/src/orders/classes/order-info.d.ts +4 -0
  51. package/dist/src/orders/classes/order-info.d.ts.map +1 -1
  52. package/dist/src/orders/interfaces/i-order-info.d.ts +5 -0
  53. package/dist/src/orders/interfaces/i-order-info.d.ts.map +1 -1
  54. package/dist/src/user/states/user-state-store.d.ts +14 -1
  55. package/dist/src/user/states/user-state-store.d.ts.map +1 -1
  56. package/package.json +1 -1
@@ -1 +1 @@
1
- (function(c,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("pinia"),require("vue"),require("date-fns"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","pinia","vue","date-fns","axios"],d):(c=typeof globalThis<"u"?globalThis:c||self,d(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c.pinia,c.vue,c["date-fns"],c.axios))})(this,function(c,d,p,ve,J,m,l,_r){"use strict";var fi=Object.defineProperty;var mi=(c,d,p)=>d in c?fi(c,d,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[d]=p;var i=(c,d,p)=>mi(c,typeof d!="symbol"?d+"":d,p);class x{constructor(r){i(this,"exp",0);i(this,"iat",0);i(this,"authTime",0);i(this,"jti","");i(this,"iss","");i(this,"aud",[]);i(this,"sub","");i(this,"typ","Bearer");i(this,"azp","");i(this,"sid","");i(this,"acr","");i(this,"allowedOrigins",[]);i(this,"realmAccess",{roles:[]});i(this,"resourceAccess",{});i(this,"scope","");i(this,"emailVerified",!1);i(this,"name","");i(this,"guid","");i(this,"preferredUsername","");i(this,"givenName","");i(this,"email","");p.merge(this,r)}static getJwtPayload(r){const e=d.jwtDecode(r),t=new x(ve.objectToCamel(e));return t.resourceAccess=e.resource_access,t}}class xe extends x{constructor(e){super(e);i(this,"familyName");i(this,"middleName");i(this,"locale");i(this,"phoneNumber");i(this,"phoneNumberVerified");i(this,"address");p.merge(this,e)}static getJwtPayload(e){const t=d.jwtDecode(e),s=new xe(ve.objectToCamel(t));return s.resourceAccess=t.resource_access,s}}class qr{constructor(r){i(this,"phone");i(this,"tablet");i(this,"laptop");this.phone=(r==null?void 0:r.phone)??360,this.tablet=(r==null?void 0:r.tablet)??600,this.laptop=(r==null?void 0:r.laptop)??1024}}class Nr{constructor(r){i(this,"portalApiUrl");i(this,"mediaUrl");i(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class Mr{constructor(r){i(this,"dsn");i(this,"environment");i(this,"ignoreErrors");i(this,"trace");i(this,"replay");i(this,"additionalParams");var e,t,s,o;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|404|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((t=r==null?void 0:r.trace)==null?void 0:t.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((s=r==null?void 0:r.replay)==null?void 0:s.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((o=r==null?void 0:r.replay)==null?void 0:o.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class Ur{constructor(r){i(this,"broadcaster");i(this,"key");i(this,"wsHost");i(this,"wsPort");i(this,"wssPort");i(this,"forceTLS");i(this,"enabledTransports");this.broadcaster=r.broadcaster??"reverb",this.key=r.key??"",this.wsHost=r.wsHost??"",this.wsPort=r.wsPort??8080,this.wssPort=r.wssPort??8080,this.forceTLS=r.forceTLS??!1,this.enabledTransports=r.enabledTransports??["wss"]}}class Hr{constructor(r){i(this,"environment");i(this,"devMode");i(this,"http");i(this,"deviceTypeByResolution");i(this,"sentry");i(this,"tableDefaultHeightCoefficient");i(this,"urls");i(this,"websocket");i(this,"dateFormats");var e,t,s;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new Nr(r==null?void 0:r.http),this.deviceTypeByResolution=new qr(r==null?void 0:r.deviceTypeByResolution),this.sentry=new Mr({environment:this.environment,...r==null?void 0:r.sentry}),this.tableDefaultHeightCoefficient=(r==null?void 0:r.tableDefaultHeightCoefficient)??.7,this.urls=r==null?void 0:r.urls,this.websocket=r!=null&&r.websocket?new Ur(r.websocket):void 0,this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((t=r==null?void 0:r.dateFormats)==null?void 0:t.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}const A=J.defineStore("common.config",()=>{const n=m.ref(new Hr);return{config:n,getConfig:()=>n.value,setConfig:t=>{n.value=p.merge(n.value,t)}}});class Ce{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const t=JSON.parse(e);if(!t.availableFor||l.isAfter(l.parseISO(t.availableFor)||l.startOfToday(),new Date)){if(p.isNil(t.data)||p.isEmpty(t.data))throw new Error("Data is empty");return t.data}localStorage.removeItem(r)}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,t){if(this.isLocalStorageAvailable())try{if(p.isNil(e)||p.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,s)}catch(s){if(s instanceof DOMException&&s.code===DOMException.QUOTA_EXCEEDED_ERR){this.clearOldData();try{const o=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,o)}catch{}}else try{localStorage.removeItem(r)}catch{}}}static isLocalStorageAvailable(){try{const r="__localStorage_test__";return localStorage.setItem(r,"test"),localStorage.removeItem(r),!0}catch{return!1}}static clearOldData(){try{const r=[];for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t)try{const s=localStorage.getItem(t);if(s){const o=JSON.parse(s);o.availableFor&&!l.isAfter(l.parseISO(o.availableFor)||l.startOfToday(),new Date)&&r.push(t)}}catch{r.push(t)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function Br(n){try{const r=x.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const se=J.defineStore("common.auth_state_private",()=>{const n=m.ref((()=>{var g;const o=Ce.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const u=(g=A().config.devMode)==null?void 0:g.initAuthBearerToken;return u?Promise.resolve(u):void 0})()),r=m.ref(void 0),e=m.ref(void 0),t=m.markRaw(new Map);function s(){e.value=void 0,p.isNil(n.value)||n.value.then(o=>{const u=x.getJwtPayload(o);e.value=u.exp*1e3>Date.now()?p.mapValues(u.resourceAccess,g=>(g==null?void 0:g.roles)??[]):void 0}).catch(p.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:t,recalculateUserPermissions:s}}),$e=J.defineStore("common.auth_state",()=>{const n=m.computed(()=>{const o=se();if(p.isNil(o.jwtToken)&&!p.isNil(o.jwtTokenUpdater)){const u=o.jwtTokenUpdater();o.jwtToken=u,u.then(g=>{o.jwtToken=Promise.resolve(g),Ce.saveActualDataToStorage("sc.token",g,Br(g)),o.recalculateUserPermissions()}).catch(p.noop)}return o.jwtToken});function r(o){se().jwtTokenUpdater=o}function e(o){const u=se();u.jwtToken=Promise.resolve(o),Ce.saveActualDataToStorage("sc.token",o,Br(o)),u.recalculateUserPermissions()}function t(){const o=se();o.jwtToken=void 0,o.userPermissions=void 0,Ce.saveActualDataToStorage("sc.token",void 0)}function s(o){const u=se();!p.isNil(u.jwtToken)&&p.isNil(u.userPermissions)&&u.jwtToken.then(a=>{const C=x.getJwtPayload(a);u.userPermissions=C.exp*1e3>Date.now()?p.mapValues(C.resourceAccess,P=>(P==null?void 0:P.roles)??[]):void 0}).catch(p.noop);const g=p.isArray(o)?o.join(" && "):o;if(u.userPermissionsComputedRefs.has(g))return u.userPermissionsComputedRefs.get(g);const f=m.computed(()=>{const a=C=>{var we;const P=p.split(C,".");if(P.length<2)return!1;const[Ae,Oe]=P,ae=(we=se().userPermissions)==null?void 0:we[Ae];return p.isArray(ae)&&ae.includes(Oe)};return p.isArray(o)?p.every(o,C=>a(C)):a(o)});return u.userPermissionsComputedRefs.set(g,f),f}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:t,hasUserPermission:s}});var De=(n=>(n.Image="image",n.Video="video",n))(De||{});class q{constructor(r,e){i(this,"id");i(this,"guid");this.id=r==null?void 0:r.id,p.isNil(this.id)&&(p.isNil(e)?typeof(r==null?void 0:r.id)=="number"?this.id=-1:typeof(r==null?void 0:r.id)=="string"&&(this.id=""):this.id=e),this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return typeof this.id=="number"?this.id===-1:typeof this.id=="string"?this.id==="":p.isNil(this.id)}}class de extends q{constructor(e){super(e,"");i(this,"mediaType");i(this,"isCover");i(this,"isUnused");i(this,"url");i(this,"urlWebp");this.mediaType=(e==null?void 0:e.mediaType)??De.Image,this.isCover=(e==null?void 0:e.isCover)??!1,this.isUnused=(e==null?void 0:e.isUnused)??!1,this.url=(e==null?void 0:e.url)??"",this.urlWebp=e==null?void 0:e.urlWebp}isImage(){return this.mediaType===De.Image}isVideo(){return this.mediaType===De.Video}}var Pe=(n=>(n.Draft="draft",n.Published="published",n.Scheduled="scheduled",n))(Pe||{});class K extends q{constructor(e){super(e,-1);i(this,"slug");i(this,"title");i(this,"publishedAt");i(this,"createdAt");this.slug=(e==null?void 0:e.slug)??"",this.title=(e==null?void 0:e.title)??"",this.publishedAt=K.parseDate(e==null?void 0:e.publishedAt),this.createdAt=K.parseDate(e==null?void 0:e.createdAt)??new Date}static resolvePublicationStatus(e){return p.isNil(e)?Pe.Draft:e.getTime()>Date.now()?Pe.Scheduled:Pe.Published}static getSlugError(e){return e?/[^a-z0-9-]/.test(e)?"Допустимы только строчные латинские буквы, цифры и дефис: пример «kak-vybrat-podokonnik».":p.startsWith(e,"-")||p.endsWith(e,"-")?"Обозначение не может начинаться или заканчиваться дефисом.":p.includes(e,"--")?"Дефисы не могут идти подряд: разделяйте слова одним дефисом.":"":""}static parseDate(e){return p.isNil(e)?null:p.isString(e)?l.parseISO(e):e}getPublicationStatus(){return K.resolvePublicationStatus(this.publishedAt)}}class ke extends K{constructor(e){super(e);i(this,"content");i(this,"media");this.content=(e==null?void 0:e.content)??"",this.media=((e==null?void 0:e.media)??[]).map(t=>new de(t))}toSaveData(e=!1){return{title:this.title,slug:this.slug.length>0?this.slug:void 0,content:e?this.content:void 0,publishedAt:this.publishedAt}}getCover(){return this.media.find(e=>e.isCover)}getUnusedMedia(){return this.media.filter(e=>e.isUnused)}}class ne{asClearRaw(){const r={};return Object.keys(this).forEach(e=>{const t=this[e];p.isNil(t)||p.isString(t)&&t.trim().length===0||p.isFunction(t.isNewRec)&&t.isNewRec()||(r[e]=t)}),r}}class S{constructor(r){i(this,"from");i(this,"to");this.from=p.isString(r==null?void 0:r.from)?l.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=p.isString(r==null?void 0:r.to)?l.parseISO(r.to):(r==null?void 0:r.to)??null}}class Rt extends ne{constructor(e){super();i(this,"id");i(this,"title");i(this,"slug");i(this,"content");i(this,"publicationStatus");i(this,"publishedAt");i(this,"createdAt");this.id=e==null?void 0:e.id,this.title=e==null?void 0:e.title,this.slug=e==null?void 0:e.slug,this.content=e==null?void 0:e.content,this.publicationStatus=e==null?void 0:e.publicationStatus,this.publishedAt=new S(e==null?void 0:e.publishedAt),this.createdAt=new S(e==null?void 0:e.createdAt)}resetFilterValue(e){switch(e){case"id":case"title":case"slug":case"content":case"publicationStatus":this[e]=void 0;break;case"publishedAt":this.publishedAt.from=null,this.publishedAt.to=null;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break}return this}asClearRaw(){var t,s,o,u;const e=super.asClearRaw();return!((t=e==null?void 0:e.publishedAt)!=null&&t.from)&&!((s=e==null?void 0:e.publishedAt)!=null&&s.to)&&delete e.publishedAt,!((o=e==null?void 0:e.createdAt)!=null&&o.from)&&!((u=e==null?void 0:e.createdAt)!=null&&u.to)&&delete e.createdAt,e}}class k{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}static instanceListInitializer(r,e){if(!p.isArray(e))throw new TypeError(`Ожидался список данных для инициализации "${r.name}", получены данные типа "${typeof e}".`);return p.map(e,t=>k.instanceInitializer(r,t))}}const R=class R{constructor(){i(this,"httpClient");i(this,"baseUrl",`${A().config.http.portalApiUrl}/api`);i(this,"errorResponseHandler",p.noop);i(this,"interceptorIds",{request:{},response:{}});i(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));i(this,"authRequestInterceptor",async r=>{let e;return p.isNil($e().jwtToken)||(e=await $e().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});i(this,"userRequestHooksInterceptor",async r=>R.requestHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=ve.objectToSnake(r.params)),["put","patch","post"].includes(p.toLower(r.method))&&r.data&&(r.data=ve.objectToSnake(r.data))),r));i(this,"authErrorsResponseInterceptors",r=>{var t;const e=r.rawError?(t=r.rawError)==null?void 0:t.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):($e().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});i(this,"canceledResponseInterceptor",r=>{const e=r.rawError??r;if(e.name==="CanceledError"||e.code==="ERR_CANCELED")throw new _r.CanceledError("Request canceled");return Promise.reject(r)});i(this,"userResponseHooksInterceptor",async r=>R.responseHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=ve.objectToCamel(r.data)),r));this.errorResponseHandler=R.defaultErrorsResponseHandler,this.httpClient=_r.create({headers:{Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.userRequestHooksInterceptor=this.httpClient.interceptors.request.use(this.userRequestHooksInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,r=>R.convertHttpErrorResponse(r)),this.interceptorIds.response.canceledResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.canceledResponseInterceptor),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.userResponseHooksInterceptor=this.httpClient.interceptors.response.use(this.userResponseHooksInterceptor,r=>Promise.reject(r))}static setDefaultErrorsResponseHandler(r){R.defaultErrorsResponseHandler=r}static addRequestHook(r){R.requestHooks.includes(r)||R.requestHooks.push(r)}static removeRequestHook(r){const e=R.requestHooks.indexOf(r);e!==-1&&R.requestHooks.splice(e,1)}static addResponseHook(r){R.responseHooks.includes(r)||R.responseHooks.push(r)}static removeResponseHook(r){const e=R.responseHooks.indexOf(r);e!==-1&&R.responseHooks.splice(e,1)}static getInstance(r){return Object.prototype.hasOwnProperty.call(R.instances,r.name)||(R.instances[r.name]=k.simpleInstanceInitializer(r)),R.instances[r.name]}static toHttpResponseError(r){return p.isObject(r)&&"status"in r?r:{status:0,statusText:"Invalid response data",message:p.isError(r)?r.message:"Не удалось обработать данные ответа сервера.",headers:{},rawError:p.isError(r)?r:new Error(String(r))}}static convertHttpErrorResponse(r){var e,t;if(p.isNil(r)||!p.isNil(r.request)||!p.isNil(r.response)){const s=p.isNil(r)?{}:r==null?void 0:r.response;return Promise.reject({status:(s==null?void 0:s.status)??0,statusText:(s==null?void 0:s.statusText)??"Unknown",message:((e=s==null?void 0:s.data)==null?void 0:e.message)??"Unknown Error. Probably network error.",errors:(t=s==null?void 0:s.data)==null?void 0:t.errors,headers:(s==null?void 0:s.headers)??{},data:s==null?void 0:s.data,rawError:r})}return Promise.reject(r)}request(r,e=void 0,t={},s=!1){const o=this.httpClient.request(r).then(u=>e?e(u):u.data);return o.catch(u=>{(u==null?void 0:u.name)!=="CanceledError"&&this.errorResponseHandler(R.toHttpResponseError(u),t,s)}),o}get(r,e={},t=void 0,s=!1,o=void 0){return this.request({method:"GET",url:r,params:e,signal:o},t,{},s)}getTypedList(r,e,t={},s=!1,o=void 0){return this.get(e,t,u=>k.instanceListInitializer(r,u.data),s,o)}getBlob(r,e={},t=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},t,{},s)}patch(r,e={},t=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},t,s,o)}post(r,e={},t=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},t,s,o)}delete(r,e=void 0,t=!1){return this.request({method:"DELETE",url:r},e,{},t)}};i(R,"instances",{}),i(R,"defaultErrorsResponseHandler",p.noop),i(R,"requestHooks",[]),i(R,"responseHooks",[]);let y=R;var Ie=(n=>(n.BeginWith="bw",n.Contains="cn",n.Custom="custom",n.EndsWith="ew",n.Equals="eq",n.GreaterOrEqual="ge",n.GreaterThan="gt",n.InList="in",n.LessOrEqual="le",n.LessThan="lt",n.NotBeginWith="bn",n.NotContains="nc",n.NotEndsWith="en",n.NotEqual="ne",n.NotInList="ni",n.NotNull="nn",n.Null="nu",n))(Ie||{});class Ke{constructor(r){i(this,"field");i(this,"op");i(this,"value");this.field=(r==null?void 0:r.field)??"",this.op=(r==null?void 0:r.op)??Ie.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r=A().config.dateFormats.api,e={field:this.field,op:this.op};if(p.isDate(this.value))e.value=l.format(this.value,r);else if(p.isPlainObject(this.value)){const t=this.value;e.value={from:t.from?l.format(t.from,r):null,to:t.to?l.format(t.to,r):null}}else e.value=this.value;return e}}class G{constructor(r){i(this,"groupOp");i(this,"filters");i(this,"groups");var e,t;this.groupOp=(r==null?void 0:r.groupOp)??"and",this.filters=((e=r==null?void 0:r.filters)==null?void 0:e.map(s=>new Ke(s)))??[],this.groups=((t=r==null?void 0:r.groups)==null?void 0:t.map(s=>new G(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Ke&&p.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof G?r.toPrimitive():r)}}}class N extends y{getPaginated(r,e,t,s,o,u,g,f=void 0){let a={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(a.filters=JSON.stringify((e instanceof G?e:new G(e)).toPrimitive())),p.isEmpty(t)||(a.sort=p.isArray(t)?t:[t]),o&&(a={...a,...o}),this.get(r,a,u,g,f)}getTypedPaginated(r,e,t,s,o,u,g,f=void 0){return this.getPaginated(e,t,s,o,u,a=>({...a.data,data:k.instanceListInitializer(r,a.data.data)}),g,f)}}class Le extends N{static preparePostSaveData(r){const e={};if(p.isUndefined(r.title)||(e.title=r.title),p.isUndefined(r.slug)||(e.slug=r.slug),p.isUndefined(r.content)||(e.content=r.content),!p.isUndefined(r.publishedAt)){const t=A().config.dateFormats.api;e.publishedAt=p.isNil(r.publishedAt)?null:l.format(r.publishedAt,t)}return e}getPostList(r,e,t){return this.getPaginated("/internal/blog",r,e,t,{},s=>({...s.data,data:s.data.data.map(o=>new K(o))}))}getPost(r){return this.get(`/internal/blog/${r}`,{},e=>new ke(e.data))}createPost(r,e={}){return this.post("/internal/blog",Le.preparePostSaveData(r),t=>new ke(t.data),e)}updatePost(r,e,t={}){return this.patch(`/internal/blog/${r}`,Le.preparePostSaveData(e),s=>new ke(s.data),t)}removePost(r){return this.delete(`/internal/blog/${r}`)}uploadMedia(r,e,t,s,o={}){return this.request({method:"POST",url:`/internal/blog/${r}/media`,data:{file:e,isCover:t??!1},onUploadProgress:u=>{s&&s(u.total?Math.round(u.loaded/u.total*100):0)}},u=>new de(u.data),o)}updateMedia(r,e,t,s={}){return this.patch(`/internal/blog/${r}/media/${e}`,{isCover:t},o=>new de(o.data),s)}removeMedia(r,e){return this.delete(`/internal/blog/${r}/media/${e}`)}}class O extends q{constructor(e){super(e);i(this,"name","");this.name=(e==null?void 0:e.name)??""}}class I extends O{constructor(e){super(e);i(this,"type");i(this,"isActive");this.type=e==null?void 0:e.type,this.isActive=(e==null?void 0:e.isActive)??!0}}class Wr extends O{constructor(e){super(e);i(this,"costCoefficient");i(this,"isLowPriceAllowed");i(this,"publishedAt");i(this,"description");i(this,"percent");i(this,"owner");i(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=p.isString(e==null?void 0:e.publishedAt)?l.parseISO(e.publishedAt):e==null?void 0:e.publishedAt,this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new I(e==null?void 0:e.owner),this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class Xe extends O{constructor(e){super(e);i(this,"updatedAt");this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?l.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class X extends Xe{constructor(e){super(e);i(this,"description");i(this,"createdAt");i(this,"owner");this.description=(e==null?void 0:e.description)??"",this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.owner=e!=null&&e.owner?new I(e.owner):void 0}}var Ze=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(Ze||{});class D extends O{constructor(e){super(e);i(this,"slug");i(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class Re extends D{static getRetailPriceCoefficient(){return{id:-2,slug:Ze.Retail,name:"Розн. цена",guid:"",isNewRec:p.constant(!0)}}}class _e{constructor(r){i(this,"coefficient");i(this,"value");i(this,"cost");i(this,"percent");i(this,"readOnly");this.coefficient=new Re(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class Fe{constructor(r){i(this,"lat");i(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class H extends D{}class oe extends D{constructor(e){var t;super(e);i(this,"address");i(this,"isMain");i(this,"deliveryTypes");i(this,"regions");i(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((t=e==null?void 0:e.deliveryTypes)==null?void 0:t.map(s=>new H(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Fe(e==null?void 0:e.coordinates)}}class jr{constructor(r){i(this,"warehouse");i(this,"count");this.warehouse=new oe(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class M extends O{constructor(e){super(e);i(this,"signature","");i(this,"code");i(this,"symbol","");i(this,"precision");e&&(this.signature=e.signature??"",this.code=e.code,this.symbol=e.symbol??"",this.precision=e.precision)}}class Ee extends O{constructor(e){super(e);i(this,"slug","");i(this,"description");i(this,"isSquare",!1);i(this,"isLinear",!1);e&&(this.slug=e.slug??"",this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}}class ce extends O{constructor(e){super(e);i(this,"code","");this.code=(e==null?void 0:e.code)??""}}class er extends ce{constructor(e){super(e);i(this,"slug");i(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class Yr extends er{constructor(e){super(e);i(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Gr{constructor(r,e){i(this,"image");i(this,"preview");i(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class qe extends er{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class L extends Yr{constructor(e){var s,o,u,g;super(e);i(this,"supplierSku");i(this,"unit");i(this,"pack");i(this,"minCount");i(this,"currency");i(this,"cost");i(this,"costRub");i(this,"costDate");i(this,"onOrder");i(this,"stockCount");i(this,"category");i(this,"categories");i(this,"images");i(this,"properties");i(this,"retailCost");i(this,"retailCostRub");i(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=e!=null&&e.unit?new Ee(e.unit):new Ee,this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.currency=e!=null&&e.currency?new M(e.currency):new M,this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=p.isString(e==null?void 0:e.costDate)?l.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((s=e==null?void 0:e.stockCount)==null?void 0:s.map(f=>new jr(f)))??[],this.type="product";const t=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(f=>f.isPrimary));t&&(this.category=new qe({...t,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(f=>new qe(f))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(f=>new Gr(f,A().config.http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.retailCost=e==null?void 0:e.retailCost,this.retailCostRub=e==null?void 0:e.retailCostRub,this.priceCoefficients=((g=e==null?void 0:e.priceCoefficients)==null?void 0:g.map(f=>new _e(f)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}var Ne=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Ne||{});class B extends L{constructor(e){super(e);i(this,"costCoefficient");i(this,"costSource");i(this,"discount");i(this,"priceTemplate");i(this,"isPreviouslyOrdered");i(this,"isRequired");i(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??Ne.Product,this.discount=e!=null&&e.discount?new Wr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new X(e.priceTemplate):void 0,this.isPreviouslyOrdered=e==null?void 0:e.isPreviouslyOrdered,this.isRequired=e==null?void 0:e.isRequired,this.isFavorite=e==null?void 0:e.isFavorite}}class le extends qe{constructor(e){super(e);i(this,"isHidden");i(this,"parentCategoryId");i(this,"properties");i(this,"currencyRates");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category",this.currencyRates=e!=null&&e.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([t,s])=>[p.toUpper(t),s])):void 0}}class rr extends q{constructor(e){super(e);i(this,"category");i(this,"product");i(this,"quantity");i(this,"currency");i(this,"marker");i(this,"height");i(this,"length");i(this,"width");i(this,"configurator");i(this,"configuratorParams");i(this,"isAdditionalSale");i(this,"creator");i(this,"isRemoved");i(this,"ord");i(this,"onOrder");i(this,"originalId");i(this,"replacementId");this.product=new B(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new le,this.currency=e.currency?new M(e.currency):void 0,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&p.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale,this.creator=e.creator&&new I(e.creator),this.isRemoved=e.isRemoved,this.ord=e.ord,this.onOrder=e.onOrder,this.originalId=e.originalId,this.replacementId=e.replacementId}}let zr=class extends rr{constructor(e){super(e);i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=p.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new M(e.currency)}};class ue{constructor(r){i(this,"items");i(this,"resultSum");i(this,"directionsSum");this.items=r.items.map(e=>new zr(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class St extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new ue(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new ue(s.data),t)}patchCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new ue(s.data),t)}deleteCartItem(r,e){return this.delete(`internal/clients/${r.id}/cart/${e.id}`,t=>new ue(t.data))}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,t=>new ue(t.data))}getCartItemFromCSVExample(r){return this.get(`internal/clients/${r.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:"text/csv"}))}}var Qr=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(Qr||{}),Vr=(n=>(n.Unknown="unknown",n.Bool="bool",n.Integer="integer",n.Float="float",n.String="string",n.Range="range",n.Json="json",n.Object="object",n))(Vr||{}),tr=(n=>(n.Checkbox="checkbox",n.Range="range",n.Toggle="toggle",n))(tr||{});class W extends le{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new W(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new L(o))}}class ir{constructor(r){i(this,"phone");i(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class _ extends D{}class Me extends O{constructor(e){super(e);i(this,"salesDirection");i(this,"photo");i(this,"contacts");i(this,"isDefault");i(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new _(e.salesDirection):new _,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new ir(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class Ue extends D{}class sr extends O{constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class pe extends Me{constructor(e){var t;super(e);i(this,"isActive");i(this,"isSupervisor");i(this,"canDoReclamations");i(this,"createdAt");i(this,"supervisorId");i(this,"pricingRole");i(this,"curatedDirections");this.isActive=(e==null?void 0:e.isActive)??!1,this.isSupervisor=(e==null?void 0:e.isSupervisor)??!1,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.createdAt=e==null?void 0:e.createdAt,this.supervisorId=e==null?void 0:e.supervisorId,this.pricingRole=e!=null&&e.pricingRole?new sr(e.pricingRole):void 0,this.curatedDirections=((t=e==null?void 0:e.curatedDirections)==null?void 0:t.map(s=>new Ue(s)))??[]}}class bt extends le{constructor(e){super(e);i(this,"isDisabled");i(this,"isRequired");i(this,"isFavorite");i(this,"hidingComment");i(this,"manager");this.isDisabled=(e==null?void 0:e.isDisabled)??!1,this.isRequired=(e==null?void 0:e.isRequired)??!1,this.isFavorite=(e==null?void 0:e.isFavorite)??!1,this.hidingComment=e==null?void 0:e.hidingComment,this.manager=e!=null&&e.manager?new pe(e.manager):void 0}}class Se extends bt{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new Se(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new B(o))}}class nr{constructor(r){i(this,"priceCoefficient");i(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new Re(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class He extends nr{constructor(e){super(e);i(this,"productCategory");this.productCategory=new le(e==null?void 0:e.productCategory)}}class Be extends O{constructor(e){super(e);i(this,"photo");i(this,"contacts");i(this,"curatedDirection");this.photo=e.photo,this.contacts=new ir(e.contacts),this.curatedDirection=new Ue(e.curatedDirection)}}class Z extends D{}class F extends D{constructor(e){super(e);i(this,"country",new Z);e&&(this.country=new Z(e.country))}}class E extends D{constructor(e){super(e);i(this,"region",new F);e&&(this.region=new F(e.region))}}class or extends O{constructor(e){super(e);i(this,"phone");i(this,"email");i(this,"getNews");i(this,"salesDirection");i(this,"createdAt");i(this,"lastLoginAt");i(this,"isActive");this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:(e==null?void 0:e.phone)??"",this.email=(e==null?void 0:e.email)??"",this.getNews=(e==null?void 0:e.getNews)??!1,this.salesDirection=e!=null&&e.salesDirection?new _(e.salesDirection):void 0,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class z extends or{constructor(e){var t,s;super(e);i(this,"salesDirection");i(this,"debt");i(this,"alternativeName");i(this,"city");i(this,"comment");i(this,"isPhoneApproved");i(this,"isEmailApproved");i(this,"managers");i(this,"curators");this.salesDirection=new _(e==null?void 0:e.salesDirection),this.debt=(e==null?void 0:e.debt)??0,this.alternativeName=(e==null?void 0:e.alternativeName)??"",this.city=new E(e==null?void 0:e.city),this.comment=e==null?void 0:e.comment,this.isPhoneApproved=(e==null?void 0:e.isPhoneApproved)??!1,this.isEmailApproved=(e==null?void 0:e.isEmailApproved)??!1,this.managers=((t=e==null?void 0:e.managers)==null?void 0:t.map(o=>new Me(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new Be(o)))??void 0}}class he extends q{constructor(e){super(e);i(this,"createdAt");i(this,"deletedAt");i(this,"client");i(this,"priceTemplate");this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new z(e==null?void 0:e.client),this.priceTemplate=new X(e==null?void 0:e.priceTemplate)}}class We extends nr{constructor(e){super(e);i(this,"product");this.product=new L(e==null?void 0:e.product)}}class cr extends D{}class ee extends O{constructor(e){super(e);i(this,"type");i(this,"description");i(this,"metadata");i(this,"isFilterable");this.type=new cr(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata,this.isFilterable=e==null?void 0:e.isFilterable}}class re{constructor(r){i(this,"property");i(this,"value");this.property=new ee(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class Tt{constructor(r){i(this,"id");i(this,"name");i(this,"description");i(this,"ownerName");i(this,"createdAt",new S);i(this,"updatedAt",new S);this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.description=r==null?void 0:r.description,this.ownerName=r==null?void 0:r.ownerName,this.createdAt=new S(r==null?void 0:r.createdAt),this.updatedAt=new S(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":case"ownerName":this[r]=void 0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"updatedAt":this.updatedAt.from=null,this.updatedAt.to=null;break}return this}asClearRaw(){var e,t,s,o;const r={};return Object.keys(this).forEach(u=>{const g=this[u];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[u]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((t=r==null?void 0:r.createdAt)!=null&&t.to)&&delete r.createdAt,!((s=r==null?void 0:r.updatedAt)!=null&&s.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class ge extends O{constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");i(this,"subRoles",[]);i(this,"parentRole");i(this,"level",0);this.description=e==null?void 0:e.description,this.canChangeLowCost=(e==null?void 0:e.canChangeLowCost)??!1,this.parentRoleId=e==null?void 0:e.parentRoleId}}class lr{constructor(r){i(this,"role");i(this,"category");i(this,"minCoefficient");this.role=new ge(r==null?void 0:r.role),this.category=new le(r==null?void 0:r.category),this.minCoefficient=new Re(r==null?void 0:r.minCoefficient)}}class Jr{constructor(r){i(this,"isFake");i(this,"isHidden");i(this,"isMultiple");i(this,"type");i(this,"ord");this.isFake=(r==null?void 0:r.isFake)??!1,this.isHidden=(r==null?void 0:r.isHidden)??!1,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.type=(r==null?void 0:r.type)??null,this.ord=(r==null?void 0:r.ord)??0}}class ur{constructor(r){i(this,"category");i(this,"property");i(this,"settings");this.category=new le(r==null?void 0:r.category),this.property=new ee(r==null?void 0:r.property),this.settings=new Jr(r==null?void 0:r.settings)}}class xr{constructor(r){i(this,"id");i(this,"label");this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??""}}class Kr{constructor(r){i(this,"id");i(this,"label");i(this,"type");i(this,"ord");i(this,"isMultiple");i(this,"values");i(this,"min");i(this,"max");var e;this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??"",this.type=(r==null?void 0:r.type)??tr.Checkbox,this.ord=(r==null?void 0:r.ord)??0,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.values=((e=r==null?void 0:r.values)==null?void 0:e.map(t=>new xr(t)))??[],this.min=(r==null?void 0:r.min)??null,this.max=(r==null?void 0:r.max)??null}}class At extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,t=void 0,s=void 0){let u=`${A().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return t&&(u+=`&category_id=${t}`),s&&(u+=`&client_id=${s}`),u}}class Ot extends y{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value})}removeCategoryPrices(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}`)}markCategoryRequired(r,e){return this.post(`/internal/clients/${r}/price/categories/${e}/required`)}unmarkCategoryRequired(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/required`)}markCategoryDisabled(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:t})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:t})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}updateProductPrice(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new B(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,t=>new B(t.data))}markProductRequired(r,e){return this.post(`/internal/clients/${r}/price/products/${e}/required`)}unmarkProductRequired(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}/required`)}getCommercialOfferHtml(r,e){return this.get(`/internal/clients/${r}/price/commercial-offer/view`,e,t=>new Blob([t.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,t=>new Blob([t.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class $t extends y{getTemplateList(r){return this.getTypedList(he,`/internal/clients/${r}/price/templates`)}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new he(e.data),!0)}attachTemplate(r,e,t){const s=A().config.dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,t&&{startAt:t.startAt&&l.format(t.startAt,s),endAt:t.endAt&&l.format(t.endAt,s)},o=>new he(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,t,s){const o=A().config.dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${t}`,s&&{startAt:s.startAt&&l.format(s.startAt,o),endAt:s.endAt&&l.format(s.endAt,o)},u=>new he(u.data))}detachTemplate(r,e,t){return this.delete(`/internal/clients/${r}/price/templates/${e}/${t}`)}}class dt extends y{getRootCategoriesList(r=!1){return this.getTypedList(W,"/internal/catalog/categories",{showHidden:r})}getCategoryData(r,e=!1,t=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:t},s=>new W(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new W(e.data))}getCategoryProductsList(r,e=!0,t=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:t,withPriceCoefficients:e},s=>p.map(s.data,o=>new L(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:t}=e;return p.forEach(t,s=>s.map(o=>new _e(o))),t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.categories.map(u=>new W(u)))}).catch(o=>{s(o)})})}}class kt extends N{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},t=>new L(t.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new L(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>p.map(e.data,t=>new _e(t)))}getNewProducts(r,e,t=!0){const s=A().config.dateFormats.api;return this.getTypedPaginated(L,"/internal/catalog/products/new",void 0,void 0,e,{period:{from:l.format(r,s)},withPriceCoefficients:t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.products.map(u=>new L(u)))}).catch(o=>{s(o)})})}}class It extends y{getRootCategoriesList(r,e=!1){return this.getTypedList(Se,"/internal/catalog/categories",{clientId:r,showHidden:e})}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:t,withNestedCategories:s},o=>new Se(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:t},o=>p.map(o.data,u=>new B(u)))}}class Lt extends N{getProductData(r,e,t=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:t},s=>new B(s.data))}getNewProducts(r,e,t,s=!0){const o=A().config.dateFormats.api;return this.getTypedPaginated(B,"/internal/catalog/products/new",void 0,void 0,t,{clientId:r,period:{from:l.format(e,o)},withPriceCoefficients:s})}}class _t extends N{getTemplateList(r,e,t){return this.getTypedPaginated(X,"/internal/price/templates",r,e,t)}createTemplate(r,e={}){return this.post("/internal/price/templates",r,t=>new X(t.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new X(e.data))}updateTemplate(r,e,t={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new X(s.data),t)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.getTypedList(We,`/internal/price/templates/${r}/products`)}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},t=>new We(t.data))}saveProductTemplatePrice(r,e,t){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new We(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.getTypedList(He,`/internal/price/templates/${r}/categories`)}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},t=>new He(t.data))}saveCategoryTemplatePrice(r,e,t,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=t.coefficient)==null?void 0:o.id,increase_percent:t.value},params:s?{recursively:!0}:{}},u=>new He(u.data))}deleteCategoryTemplatePrice(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:t?{recursively:!0}:{}})}getTemplateClients(r){return this.getTypedList(he,`/internal/price/templates/${r}/clients`)}}class qt extends y{getRoles(){return this.getTypedList(ge,"/internal/price/roles")}createRole(r){return this.post("/internal/price/roles",r,e=>new ge(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new ge(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,t=>new ge(t.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.getTypedList(lr,`/internal/price/roles/rules/categories/${r}`)}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,t=>k.instanceListInitializer(lr,t.data))}}class Nt extends N{getProperties(r,e,t){return this.getTypedPaginated(ee,"/internal/catalog/properties",r,e,t)}createProperty(r){const{typeId:e,...t}=r;return this.post("/internal/catalog/properties",{...t,type:e},s=>new ee(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new ee(e.data))}updateProperty(r,e){const{typeId:t,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:t},o=>new ee(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.getTypedList(re,`/internal/catalog/products/${r}/properties`)}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},t=>new re(t.data))}updateProductProperty(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:t},s=>new re(s.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,t)}deleteProductFile(r,e){return this.delete(`/internal/catalog/products/${r}/properties/files/${e}`)}updateProductSlug(r,e){return this.patch(`/internal/catalog/products/${r}/properties/slug`,{slug:e})}getCategoryProperties(r){return this.getTypedList(re,`/internal/catalog/categories/${r}/properties`)}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},t=>new re(t.data))}updateCategoryProperty(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:t},s=>new re(s.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,t)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}updateCategoryImage(r,e){return this.post(`/internal/catalog/categories/${r}/image`,{image:e})}getCategoryFilters(r,e=!1){return this.get(`/internal/catalog/categories/${r}/filters`,{recursively:e},t=>t.data.map(s=>new Kr(s)))}getCategoryFilterSettings(r){return this.getTypedList(ur,`/internal/catalog/categories/${r}/filter-settings`)}saveCategoryFilterSetting(r,e,t){return this.patch(`/internal/catalog/categories/${r}/filter-settings/${e}`,t,s=>new ur(s.data))}deleteCategoryFilterSetting(r,e){return this.delete(`/internal/catalog/categories/${r}/filter-settings/${e}`)}}class Mt extends y{getRootCategoriesList(r,e=!1){return this.getTypedList(W,"/internal/catalog/categories",{priceTemplateId:r,showHidden:e})}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{priceTemplateId:r,showHidden:t,withNestedCategories:s},o=>new W(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{priceTemplateId:r,showHidden:s,withPriceCoefficients:t},o=>p.map(o.data,u=>new L(u)))}}function pr(n,r,e){let t;return n.some(s=>{if(s.type===e&&s.id===r)return t=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const u=pr(o.products,r,e);if(u)return t=u,!0}if(o.categories&&o.categories.length>0){const u=pr(o.categories,r,e);if(u)return t=u,!0}return!1}),t}function hr(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const t=e;t.products&&t.products.length>0&&r.push(...hr(t.products)),t.categories&&t.categories.length>0&&r.push(...hr(t.categories))}}),r}var Xr=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n.SalesDirection="sales_direction",n.Managers="managers",n.Curators="curators",n))(Xr||{}),j=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(j||{});class je extends q{constructor(e){super(e);i(this,"bankName","");i(this,"bic","");i(this,"accountNumber","");i(this,"correspondentAccount","");i(this,"currency",new M);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new M(e.currency))}}class Ye extends O{constructor(e){super(e);i(this,"phone");i(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class Q extends Ye{constructor(e){super(e);i(this,"isPrimary");i(this,"position");i(this,"notDisturb");i(this,"comment");i(this,"updatedAt");i(this,"deletedAt");this.isPrimary=(e==null?void 0:e.isPrimary)??!1,this.position=e==null?void 0:e.position,this.notDisturb=(e==null?void 0:e.notDisturb)??!1,this.comment=e==null?void 0:e.comment,this.updatedAt=e==null?void 0:e.updatedAt,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class V extends D{static generatePersonItem(){return new V({id:1,guid:"",slug:j.Person,name:""})}}class te extends D{}class gr extends Xe{constructor(e){super(e);i(this,"deletedAt");this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class fr extends gr{constructor(e){super(e);i(this,"opf",V.generatePersonItem());i(this,"partnerGroup",new te);i(this,"contacts",[]);i(this,"bankAccounts",[]);i(this,"comment");i(this,"alternativeName");i(this,"createdAt");i(this,"creator");i(this,"updater");if(e){if(this.opf=new V(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new I(e.creator):void 0,this.updater=e.updater?new I(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new te(e.partnerGroup)),e.contacts){const t=[];e.contacts.forEach(s=>{t.push(new Q(s))}),this.contacts=t}if(e.bankAccounts){const t=[];e.bankAccounts.forEach(s=>{t.push(new je(s))}),this.bankAccounts=t}}}}class Zr extends fr{constructor(r){super(r)}}class mr extends fr{constructor(e){super(e);i(this,"inn","");i(this,"okpo","");i(this,"directorName","");i(this,"directorPosition","");i(this,"directorActsOn","");i(this,"legalAddress","");i(this,"postalAddress","");i(this,"actualAddress","");e&&(this.inn=e.inn??"",this.okpo=e.okpo??"",this.directorName=e.directorName??"",this.directorPosition=e.directorPosition??"",this.directorActsOn=e.directorActsOn??"",this.legalAddress=e.legalAddress??"",this.postalAddress=e.postalAddress??"",this.actualAddress=e.actualAddress??"")}}class yr extends mr{constructor(e){super(e);i(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class Fr extends yr{constructor(e){super(e);i(this,"registrationCountry",new Z);i(this,"registrationNumber","");i(this,"taxNumber","");e&&(this.registrationCountry=new Z(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class be{static createInstance(r){switch(r.opf.slug){case j.Ic:return new mr(r);case j.UlR:return new yr(r);case j.UlNr:return new Fr(r);default:return new Zr(r)}}}class fe extends gr{constructor(e){var t;super(e);i(this,"address","");i(this,"coordinates");i(this,"contacts");i(this,"comment");i(this,"operatingHours");i(this,"isOneTime");i(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new Fe(e==null?void 0:e.coordinates),this.contacts=((t=e==null?void 0:e.contacts)==null?void 0:t.map(s=>new Q(s)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class ar extends D{}class wr extends D{}class vr extends z{constructor(e){var t,s,o,u;super(e);i(this,"contragents");i(this,"partnerGroups");i(this,"contacts");i(this,"deliveryAddresses");i(this,"channelPrimaryInterest");i(this,"sourcePrimaryInterest");i(this,"preferredDeliveryType");i(this,"primaryDemand");i(this,"preferredWarehouse");i(this,"extraData");this.contragents=((t=e==null?void 0:e.contragents)==null?void 0:t.map(g=>be.createInstance(g)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(g=>new te(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new Q(g)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(g=>new fe(g)))??[],this.channelPrimaryInterest=new ar(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new wr(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new H(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new oe(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class Ut extends ne{constructor(e){var t,s,o,u,g,f,a,C;super();i(this,"id");i(this,"guid");i(this,"name");i(this,"alternativeName");i(this,"searchTerm");i(this,"cities");i(this,"region");i(this,"country");i(this,"phone");i(this,"email");i(this,"isActive");i(this,"createdAt",new S);i(this,"lastLoginDate",new S);i(this,"lastLoginDateHasOrder");i(this,"managers");i(this,"includeSubordinateManagers");i(this,"curators");i(this,"isManagerRequired");i(this,"salesDirections");i(this,"contragentInn");i(this,"contragentType");i(this,"preferredDeliveryType");i(this,"partnerGroups");i(this,"contact");i(this,"lastOrder");i(this,"noOrdersPeriod",new S);this.id=e==null?void 0:e.id,this.guid=e==null?void 0:e.guid,this.name=e==null?void 0:e.name,this.alternativeName=e==null?void 0:e.alternativeName,this.searchTerm=e==null?void 0:e.searchTerm,this.cities=(t=e==null?void 0:e.cities)==null?void 0:t.map(P=>new E(P)),this.region=new F(e==null?void 0:e.region),this.country=new Z(e==null?void 0:e.country),this.phone=e==null?void 0:e.phone,this.email=e==null?void 0:e.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,"isActive")?e==null?void 0:e.isActive:!0,this.createdAt=new S(e==null?void 0:e.createdAt),this.lastLoginDate=new S(e==null?void 0:e.lastLoginDate),this.lastLoginDateHasOrder=(e==null?void 0:e.lastLoginDateHasOrder)??void 0,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(P=>new pe(P)))??[],this.includeSubordinateManagers=(e==null?void 0:e.includeSubordinateManagers)??!0,this.curators=((o=e==null?void 0:e.curators)==null?void 0:o.map(P=>new Be(P)))??[],this.salesDirections=(u=e==null?void 0:e.salesDirections)==null?void 0:u.map(P=>new _(P)),this.contragentInn=e==null?void 0:e.contragentInn,this.contragentType=new V(e==null?void 0:e.contragentType),this.preferredDeliveryType=e!=null&&e.preferredDeliveryType?new H(e==null?void 0:e.preferredDeliveryType):void 0,this.partnerGroups=(g=e==null?void 0:e.partnerGroups)==null?void 0:g.map(P=>new te(P)),this.contact=new Ye(e==null?void 0:e.contact),this.lastOrder={createdAt:new S((f=e==null?void 0:e.lastOrder)==null?void 0:f.createdAt),creator:(a=e==null?void 0:e.lastOrder)==null?void 0:a.creator,isApproved:(C=e==null?void 0:e.lastOrder)==null?void 0:C.isApproved},this.noOrdersPeriod=new S(e==null?void 0:e.noOrdersPeriod)}resetFilterValue(e){switch(e){case"cities":this.cities=[];break;case"region":this.region=new F;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"noOrdersPeriod":this.noOrdersPeriod.from=null,this.noOrdersPeriod.to=null;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new V;break;case"preferredDeliveryType":this.preferredDeliveryType=new H;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Ye;break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,u,g,f;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.lastLoginDate)!=null&&o.from)&&!((u=e==null?void 0:e.lastLoginDate)!=null&&u.to)&&delete e.lastLoginDate,!((g=e==null?void 0:e.noOrdersPeriod)!=null&&g.from)&&!((f=e==null?void 0:e.noOrdersPeriod)!=null&&f.to)&&delete e.noOrdersPeriod,e}}class Cr extends q{constructor(e){super(e);i(this,"createdAt");i(this,"creator");this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new I(e==null?void 0:e.creator)}}class Er extends O{constructor(e){var t,s,o,u;super(e);i(this,"contacts",[]);i(this,"preferredDeliveryType");i(this,"partnerGroups",[]);i(this,"lastOrder");i(this,"salesDirection");i(this,"managers");i(this,"curators");this.contacts=((t=e.contacts)==null?void 0:t.map(g=>new Q(g)))??void 0,this.lastOrder=e.lastOrder?new Cr(e.lastOrder):void 0,this.partnerGroups=((s=e.partnerGroups)==null?void 0:s.map(g=>new te(g)))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new H(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new _(e.salesDirection):void 0,this.managers=((o=e.managers)==null?void 0:o.map(g=>new Me(g)))??void 0,this.curators=((u=e.curators)==null?void 0:u.map(g=>new Be(g)))??void 0}}class Ge extends q{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=e.isPrimary}}class et extends Q{constructor(e){super(e);i(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(t=>new Ge(t))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(t=>new Ge(t))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(t=>new Ge(t))))}}class U extends N{static transformClientDataToRequest(r){var t;return{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(s=>s.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,preferred_warehouse_id:(t=r.preferredWarehouse)==null?void 0:t.id}}static transformContragentClientDataToRequest(r){var u,g,f,a;let e;const t=r,s=r,o=r;switch(r.opf.slug){case j.Ic:e={opf:t.opf.slug,name:t.name,alternative_name:t.alternativeName,partner_group_id:(u=t.partnerGroup)==null?void 0:u.id,comment:t.comment,inn:t.inn,okpo:t.okpo,director_name:t.directorName,director_position:t.directorPosition,director_acts_on:t.directorActsOn,legal_address:t.legalAddress,postal_address:t.postalAddress,actual_address:t.actualAddress};break;case j.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(g=s.partnerGroup)==null?void 0:g.id,comment:s.comment,inn:s.inn,kpp:s.kpp,okpo:s.okpo,director_name:s.directorName,director_position:s.directorPosition,director_acts_on:s.directorActsOn,legal_address:s.legalAddress,postal_address:s.postalAddress,actual_address:s.actualAddress};break;case j.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(f=o.partnerGroup)==null?void 0:f.id,comment:o.comment,director_name:o.directorName,director_position:o.directorPosition,director_acts_on:o.directorActsOn,legal_address:o.legalAddress,postal_address:o.postalAddress,actual_address:o.actualAddress,registration_country_id:o.registrationCountry.id,registration_number:o.registrationNumber,tax_number:o.taxNumber||void 0};break;default:e={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:(a=r.partnerGroup)==null?void 0:a.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var t,s;const e={address:r.address,is_one_time:r.isOneTime??!1,is_transport_company_address:r.isTransportCompanyAddress??!1,comment:r.comment??""};return r.coordinates&&(e.coordinates={lat:(t=r.coordinates)==null?void 0:t.lat,long:(s=r.coordinates)==null?void 0:s.long}),r.operatingHours&&(e.operating_hours={from:r.operatingHours.from,to:r.operatingHours.to}),e}static transformClientContragentBankAccountToRequest(r){return{bank_name:r.bankName,bic:r.bic,account_number:r.accountNumber,correspondent_account:r.correspondentAccount,currency_id:r.currency.id}}getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new vr(e.data))}getClientsList(r,e,t,s,o=void 0){return this.getTypedPaginated(z,"/internal/clients",r,e,t,s,void 0,o)}searchClient(r){return this.getClientsList(void 0,void 0,void 0,{searchTerm:r}).then(e=>e.data)}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Ie.Contains,value:r}]})}getAdditionalClientsData(r,e){const t=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:t,requested_data_types:e},s=>k.instanceListInitializer(Er,s.data))}getAllClientContacts(r){return this.getTypedList(et,`/internal/clients/${r}/contacts/all`)}createClientCommonData(r,e={}){return this.post("/internal/clients",U.transformClientDataToRequest(r),t=>new vr(t.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,U.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const t={get_news:r.getNews};return this.patch(`/internal/clients/${r.id}`,t,void 0,e)}changeClientPassword(r,e,t,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:t},void 0,s)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(t)}async detachClientFromManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(t)}attachToCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:t.id})}detachFromCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:t.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(t=>({curator_id:t.curatorId,curated_direction_id:t.curatedDirection.id}))})}createContragentClientData(r,e,t={}){return this.post(`/internal/clients/${r}/contragents`,U.transformContragentClientDataToRequest(e),s=>be.createInstance(s.data),t)}updateContragentClientData(r,e,t={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,U.transformContragentClientDataToRequest(e),s=>be.createInstance(s.data),t)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}getClientDeliveryAddresses(r){return this.getTypedList(fe,`/internal/clients/${r}/delivery-addresses`)}createClientDeliveryAddress(r,e,t={}){return this.post(`/internal/clients/${r}/delivery-addresses`,U.transformClientDeliveryAddressToRequest(e),s=>new fe(s.data),t)}updateClientDeliveryAddress(r,e,t={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,U.transformClientDeliveryAddressToRequest(e),s=>new fe(s.data),t)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,t,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,U.transformClientContragentBankAccountToRequest(t),o=>new je(o.data),s)}updateContragentBankAccount(r,e,t,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`,U.transformClientContragentBankAccountToRequest(t),o=>new je(o.data),s)}deleteContragentBankAccount(r,e,t){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`)}createClientContact(r,e,t={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},t)}updateClientContact(r,e,t={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},s=>new Q(s.data),t)}setPrimaryClientContact(r,e){return this.setPrimaryContact(`/internal/clients/${r}/contacts/${e.id}/primary`,e.isPrimary??!1)}detachClientContact(r,e){return this.detachContact(`/internal/clients/${r}/contacts/${e.id}/detach`)}createContragentContact(r,e,t,s={}){return this.createContact(r,t,{contragents:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachContragentContact(r,e,t){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/detach`)}createDeliveryAddressContact(r,e,t,s={}){return this.createContact(r,t,{addresses:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachDeliveryAddressContact(r,e,t){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/detach`)}createContact(r,e,t,s={}){var u,g;const o={name:e.name,position:e.position,comment:e.comment,...t};return(u=e.phone)!=null&&u.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,f=>new Q(f.data),s)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class Ht extends y{checkPhoneIsBusy(r){return new Promise((e,t)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(t)})}}class Bt{constructor(r){i(this,"date");i(this,"name");i(this,"version");this.date=p.isString(r==null?void 0:r.date)?l.parseISO(r.date):(r==null?void 0:r.date)??new Date,this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}var rt=(n=>(n.Kozyrek="kozyrek",n.Mosquitto="mosquitto",n.Strip="strip",n.MetalForDoors="metal_for_doors",n.Sandwich="sandwich",n.SandwichM2="sandwich_m2",n))(rt||{});class Wt extends y{getConfiguratorSettings(r,e){var t;return this.get(`internal/catalog/categories/${r.id}/configurators/${(t=r.properties)==null?void 0:t.configurator}/settings?client_id=${e}`)}searchProduct(r,e,t,s={}){var u;const o=this.get(`internal/catalog/categories/${r.id}/configurators/${(u=r.properties)==null?void 0:u.configurator}/product`,{params:t,client_id:e},g=>new L(g.data));return o.catch(g=>{this.errorResponseHandler(g,s)}),o}createTemplate(r,e,t,s={}){var o;return this.post(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/template?client_id=${e}`,{...t},()=>{},s)}removeTemplate(r,e,t){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template/${t}?client_id=${e}`)}calculate(r,e,t){var s;return this.get(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/calculate`,{client_id:e,...t})}}class tt{constructor(r){i(this,"page",1);i(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class jt extends tt{constructor(e){super(e);i(this,"itemCount",0);i(this,"pageCount",1);i(this,"pageSlot",5);i(this,"pageSizes",[25,50,100]);i(this,"showSizePicker",!0);this.itemCount=(e==null?void 0:e.itemCount)??0,this.pageCount=(e==null?void 0:e.pageCount)??1,this.pageSlot=(e==null?void 0:e.pageSlot)??5,this.pageSizes=(e==null?void 0:e.pageSizes)??[25,50,100],this.showSizePicker=(e==null?void 0:e.showSizePicker)??!0}}class Yt{constructor(r){i(this,"field");i(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class v{static decadeInterval(r){const[e,t]=v.shiftedDecadeBounds(r,0);return{from:e,to:t}}static shiftDecadeInterval(r,e){const[t,s]=v.shiftedDecadeBounds(r,e);return{from:t,to:s}}static startOfHalfYear(r){return new Date(r.getFullYear(),r.getMonth()<6?0:6,1)}static endOfHalfYear(r){return l.endOfMonth(new Date(r.getFullYear(),r.getMonth()<6?5:11,1))}static addHalfYears(r,e){return l.addMonths(r,e*6)}static intervalTillSameDate(r,e,t){const s=l.differenceInCalendarMonths(l.startOfMonth(t),l.startOfMonth(r)),o=l.startOfMonth(l.addMonths(e,s)),u=Math.min(l.getDate(t),l.getDaysInMonth(o));return{from:l.startOfDay(e),to:l.endOfDay(l.setDate(o,u))}}static weekTillSameWeekday(r,e){const t=l.startOfWeek(l.addWeeks(r,e),{weekStartsOn:1}),s=l.differenceInCalendarDays(r,l.startOfWeek(r,{weekStartsOn:1}));return{from:t,to:l.endOfDay(l.addDays(t,s))}}static decadeTillSameDayNumber(r,e){const[t]=v.shiftedDecadeBounds(r,0),s=l.differenceInCalendarDays(r,t)+1,[o,u]=v.shiftedDecadeBounds(r,e),g=l.differenceInCalendarDays(u,o)+1;return{from:o,to:l.endOfDay(l.addDays(o,Math.min(s,g)-1))}}static shiftedDecadeBounds(r,e){const t=l.getDate(r);let s=2;t<=10?s=0:t<=20&&(s=1);const o=s+e,u=Math.floor(o/3),g=(o%3+3)%3,f=l.startOfMonth(l.addMonths(r,u)),a=l.addDays(f,g*10),C=g===2?l.endOfMonth(f):l.endOfDay(l.addDays(a,9));return[a,C]}}class Gt{static defaultDateRanges(r){const e=l.addBusinessDays(new Date,1),t=new Date,s=l.startOfYear(r===void 0?t:new Date(r,0,1)),o=l.endOfYear(s);return{nextWorkingDay:{label:"Следующий рабочий день",from:l.startOfDay(e),to:l.endOfDay(e)},today:{label:"Сегодня",from:l.startOfToday(),to:l.endOfToday()},yesterday:{label:"Вчера",from:l.startOfYesterday(),to:l.endOfYesterday()},tomorrow:{label:"Завтра",from:l.startOfTomorrow(),to:l.endOfTomorrow()},currentWeek:{label:"Неделя",from:l.startOfWeek(t,{weekStartsOn:1}),to:l.endOfWeek(t,{weekStartsOn:1})},currentMonth:{label:"Месяц",from:l.startOfMonth(t),to:l.endOfMonth(t)},oneMonth:{label:"1 месяц",from:s,to:l.endOfMonth(s)},threeMonths:{label:"3 месяца",from:s,to:l.endOfMonth(l.addMonths(s,2))},nineMonths:{label:"9 месяцев",from:s,to:l.endOfMonth(l.addMonths(s,8))},firstQuarter:{label:"I квартал",from:s,to:l.endOfMonth(l.addMonths(s,2))},secondQuarter:{label:"II квартал",from:l.addMonths(s,3),to:l.endOfMonth(l.addMonths(s,5))},thirdQuarter:{label:"III квартал",from:l.addMonths(s,6),to:l.endOfMonth(l.addMonths(s,8))},fourthQuarter:{label:"IV квартал",from:l.addMonths(s,9),to:l.endOfMonth(l.addMonths(s,11))},firstHalfYear:{label:"I полугодие",from:s,to:l.endOfMonth(l.addMonths(s,5))},secondHalfYear:{label:"II полугодие",from:l.addMonths(s,6),to:o},currentYear:{label:"12 месяцев",from:s,to:o}}}static standardPeriods(r=new Date){const e={weekStartsOn:1},t=l.startOfDay(r),s=l.endOfDay(r),o=v.decadeInterval(r),u=l.startOfMonth(r),g=l.startOfQuarter(r),f=v.startOfHalfYear(r),a=l.startOfYear(r),C=v.addHalfYears(r,-1),P=v.addHalfYears(r,1);return{yesterday:{label:"Вчера",group:"day",from:l.startOfDay(l.subDays(r,1)),to:l.endOfDay(l.subDays(r,1))},today:{label:"Сегодня",group:"day",from:t,to:s},tomorrow:{label:"Завтра",group:"day",from:l.startOfDay(l.addDays(r,1)),to:l.endOfDay(l.addDays(r,1))},lastWeek:{label:"Прошлая неделя",group:"week",from:l.startOfWeek(l.subWeeks(r,1),e),to:l.endOfWeek(l.subWeeks(r,1),e)},thisWeek:{label:"Эта неделя",group:"week",from:l.startOfWeek(r,e),to:l.endOfWeek(r,e)},nextWeek:{label:"Следующая неделя",group:"week",from:l.startOfWeek(l.addWeeks(r,1),e),to:l.endOfWeek(l.addWeeks(r,1),e)},lastTenDays:{label:"Прошлая декада",group:"decade",...v.shiftDecadeInterval(r,-1)},thisTenDays:{label:"Эта декада",group:"decade",...o},nextTenDays:{label:"Следующая декада",group:"decade",...v.shiftDecadeInterval(r,1)},lastMonth:{label:"Прошлый месяц",group:"month",from:l.startOfMonth(l.subMonths(r,1)),to:l.endOfMonth(l.subMonths(r,1))},thisMonth:{label:"Этот месяц",group:"month",from:u,to:l.endOfMonth(r)},nextMonth:{label:"Следующий месяц",group:"month",from:l.startOfMonth(l.addMonths(r,1)),to:l.endOfMonth(l.addMonths(r,1))},lastQuarter:{label:"Прошлый квартал",group:"quarter",from:l.startOfQuarter(l.subQuarters(r,1)),to:l.endOfQuarter(l.subQuarters(r,1))},thisQuarter:{label:"Этот квартал",group:"quarter",from:g,to:l.endOfQuarter(r)},nextQuarter:{label:"Следующий квартал",group:"quarter",from:l.startOfQuarter(l.addQuarters(r,1)),to:l.endOfQuarter(l.addQuarters(r,1))},lastHalfYear:{label:"Прошлое полугодие",group:"halfYear",from:v.startOfHalfYear(C),to:v.endOfHalfYear(C)},thisHalfYear:{label:"Это полугодие",group:"halfYear",from:f,to:v.endOfHalfYear(r)},nextHalfYear:{label:"Следующее полугодие",group:"halfYear",from:v.startOfHalfYear(P),to:v.endOfHalfYear(P)},lastYear:{label:"Прошлый год",group:"year",from:l.startOfYear(l.subYears(r,1)),to:l.endOfYear(l.subYears(r,1))},thisYear:{label:"Этот год",group:"year",from:a,to:l.endOfYear(r)},nextYear:{label:"Следующий год",group:"year",from:l.startOfYear(l.addYears(r,1)),to:l.endOfYear(l.addYears(r,1))},fromBeginningOfThisWeek:{label:"С начала этой недели",group:"other",section:"fromBeginning",from:l.startOfWeek(r,e),to:s},fromBeginningOfThisTenDays:{label:"С начала этой декады",group:"other",section:"fromBeginning",from:o.from,to:s},fromBeginningOfThisMonth:{label:"С начала этого месяца",group:"other",section:"fromBeginning",from:u,to:s},fromBeginningOfThisQuarter:{label:"С начала этого квартала",group:"other",section:"fromBeginning",from:g,to:s},fromBeginningOfThisHalfYear:{label:"С начала этого полугодия",group:"other",section:"fromBeginning",from:f,to:s},fromBeginningOfThisYear:{label:"С начала этого года",group:"other",section:"fromBeginning",from:a,to:s},tillEndOfThisWeek:{label:"До конца этой недели",group:"other",section:"tillEnd",from:t,to:l.endOfWeek(r,e)},tillEndOfThisTenDays:{label:"До конца этой декады",group:"other",section:"tillEnd",from:t,to:o.to},tillEndOfThisMonth:{label:"До конца этого месяца",group:"other",section:"tillEnd",from:t,to:l.endOfMonth(r)},tillEndOfThisQuarter:{label:"До конца этого квартала",group:"other",section:"tillEnd",from:t,to:l.endOfQuarter(r)},tillEndOfThisHalfYear:{label:"До конца этого полугодия",group:"other",section:"tillEnd",from:t,to:v.endOfHalfYear(r)},tillEndOfThisYear:{label:"До конца этого года",group:"other",section:"tillEnd",from:t,to:l.endOfYear(r)},lastWeekTillSameWeekDay:{label:"Прошлая неделя, до такого же дня недели",group:"other",section:"lastTillSame",...v.weekTillSameWeekday(r,-1)},lastTenDaysTillSameDayNumber:{label:"Прошлая декада, до такого же номера дня",group:"other",section:"lastTillSame",...v.decadeTillSameDayNumber(r,-1)},lastMonthTillSameDate:{label:"Прошлый месяц, до такой же даты",group:"other",section:"lastTillSame",...v.intervalTillSameDate(u,l.startOfMonth(l.subMonths(r,1)),r)},lastQuarterTillSameDate:{label:"Прошлый квартал, до такой же даты",group:"other",section:"lastTillSame",...v.intervalTillSameDate(g,l.startOfQuarter(l.subQuarters(r,1)),r)},lastHalfYearTillSameDate:{label:"Прошлое полугодие, до такой же даты",group:"other",section:"lastTillSame",...v.intervalTillSameDate(f,v.startOfHalfYear(C),r)},lastYearTillSameDate:{label:"Прошлый год, до такой же даты",group:"other",section:"lastTillSame",...v.intervalTillSameDate(a,l.startOfYear(l.subYears(r,1)),r)},nextWeekTillSameWeekDay:{label:"Следующая неделя, до такого же дня недели",group:"other",section:"nextTillSame",...v.weekTillSameWeekday(r,1)},nextTenDaysTillSameDayNumber:{label:"Следующая декада, до такого же номера дня",group:"other",section:"nextTillSame",...v.decadeTillSameDayNumber(r,1)},nextMonthTillSameDate:{label:"Следующий месяц, до такой же даты",group:"other",section:"nextTillSame",...v.intervalTillSameDate(u,l.startOfMonth(l.addMonths(r,1)),r)},nextQuarterTillSameDate:{label:"Следующий квартал, до такой же даты",group:"other",section:"nextTillSame",...v.intervalTillSameDate(g,l.startOfQuarter(l.addQuarters(r,1)),r)},nextHalfYearTillSameDate:{label:"Следующее полугодие, до такой же даты",group:"other",section:"nextTillSame",...v.intervalTillSameDate(f,v.startOfHalfYear(P),r)},nextYearTillSameDate:{label:"Следующий год, до такой же даты",group:"other",section:"nextTillSame",...v.intervalTillSameDate(a,l.startOfYear(l.addYears(r,1)),r)},last7Days:{label:"Последние 7 дней",group:"other",section:"rollingDays",from:l.startOfDay(l.subDays(r,6)),to:s},next7Days:{label:"Следующие 7 дней",group:"other",section:"rollingDays",from:t,to:l.endOfDay(l.addDays(r,6))}}}}const zt=[{key:"day",label:"День"},{key:"week",label:"Неделя"},{key:"decade",label:"Декада"},{key:"month",label:"Месяц"},{key:"quarter",label:"Квартал"},{key:"halfYear",label:"Полугодие"},{key:"year",label:"Год"},{key:"other",label:"Прочее"}],Qt=[{key:"fromBeginning",label:"С начала периода"},{key:"tillEnd",label:"До конца периода"},{key:"lastTillSame",label:"Прошлые, до такой же даты"},{key:"nextTillSame",label:"Следующие, до такой же даты"},{key:"rollingDays",label:"7 дней"}];class Dr{static productIsMeasurable(r){return r.unit.isLinear||r.unit.isSquare}static getProductMultiplicity(r){var e,t;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((t=r.properties)==null?void 0:t.minCount)!=null&&!Dr.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,t,s;return((e=r.properties)==null?void 0:e.lengthStep)!=null?r.properties.lengthStep:!((t=r.properties)!=null&&t.ignoreMinCountCheck)&&((s=r.properties)==null?void 0:s.minCount)!=null?r.properties.minCount:.01}}const ye=class ye extends y{constructor(){super();i(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=A().config.http.responseDataCacheTimeout}static getCachedResponse(e){const t=ye.responseDataCache.get(e);if(t&&t.validTo>new Date)return t.val}cacheResponse(e,t){ye.responseDataCache.set(e,{validTo:l.addSeconds(new Date,this.responseDataCacheTimeout),val:t})}getTypedDataArrayRequester(e,t,s=!1,o={},u=void 0){const g=t+(p.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),f=s?ye.getCachedResponse(g):void 0;return f?Promise.resolve(f):this.getTypedList(e,t,o,!1,u).then(a=>(s&&a&&this.cacheResponse(g,a),a))}};i(ye,"responseDataCache",new Map);let me=ye;function Vt(n,r){const e=[2,0,1,1,1,2],t=Math.floor(Math.abs(n));return r[t%100>4&&t%100<20?2:e[Math.min(t%10,5)]]}class Jt{static generateUndefinedManagerInstance(){return new pe({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class it extends me{async getManagers(){const r="/internal/managers",e=me.getCachedResponse(r);if(e)return e;const t=await this.get(r),s=k.instanceListInitializer(pe,t.data);return this.cacheResponse(r,s),s}}class Pr extends q{constructor(e){super(e);i(this,"name");i(this,"createdAt");i(this,"client");i(this,"sum");this.name=e==null?void 0:e.name,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.client=new z(e==null?void 0:e.client),this.sum=e==null?void 0:e.sum}}class ie extends Pr{constructor(e){super(e);i(this,"sum");i(this,"products");this.sum=e.sum??0,this.products=(e.products??[]).map(t=>new zr(t))}}class xt extends ne{constructor(e){super();i(this,"id");i(this,"clientSearchTerm");i(this,"name");i(this,"createdAt",new S);this.id=e==null?void 0:e.id,this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.name=e==null?void 0:e.name,this.createdAt=new S(e==null?void 0:e.createdAt)}resetFilterValue(e){return e==="createdAt"?(this.createdAt.from=null,this.createdAt.to=null):this[e]=void 0,this}asClearRaw(){var t,s;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,e}}class Te extends D{}class Rr extends Cr{constructor(e){var t,s,o,u,g,f,a,C;super(e);i(this,"client");i(this,"payment");i(this,"delivery");i(this,"attachedUser");i(this,"status");i(this,"statusDetail");i(this,"salesDirection");i(this,"attachedAt");i(this,"isOnOrder");i(this,"isNotInStock");i(this,"sum");i(this,"isLargeOrder");this.client=new z(e==null?void 0:e.client),this.payment={type:((t=e==null?void 0:e.payment)==null?void 0:t.type)??-1,status:((s=e==null?void 0:e.payment)==null?void 0:s.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((u=e==null?void 0:e.delivery)==null?void 0:u.type)??-1,date:p.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?l.parseISO(e.delivery.date):((f=e==null?void 0:e.delivery)==null?void 0:f.date)??new Date,address:(a=e==null?void 0:e.delivery)!=null&&a.address?new fe(e.delivery.address):void 0,warehouse:(C=e==null?void 0:e.delivery)!=null&&C.warehouse?new oe(e.delivery.warehouse):void 0},this.attachedUser=e!=null&&e.attachedUser?new I(e==null?void 0:e.attachedUser):void 0,this.status=new Te(e==null?void 0:e.status),this.statusDetail=e!=null&&e.statusDetail?new D(e.statusDetail):void 0,this.salesDirection=new _(e==null?void 0:e.salesDirection),this.attachedAt=p.isString(e==null?void 0:e.attachedAt)?l.parseISO(e.attachedAt):e==null?void 0:e.attachedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1,this.sum=(e==null?void 0:e.sum)??0,this.isLargeOrder=(e==null?void 0:e.isLargeOrder)??!1}}class st extends rr{constructor(e,t){super(e);i(this,"product");i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");i(this,"changedFields",[]);i(this,"replacement");this.product=new B(e.product),this.currency=new M(e.currency),this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=p.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,t&&(this.replacement=t,this.quantity!==t.quantity&&this.changedFields.push("quantity"),this.length!==t.length&&this.changedFields.push("length"))}}class $ extends Rr{constructor(e){var t;super(e);i(this,"products");i(this,"invoices");i(this,"comment");i(this,"image");i(this,"contragent");i(this,"barcode");i(this,"orderSource");i(this,"isAllowProcessingWithoutPayment");i(this,"nextStatuses");i(this,"actions");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"erpOrderUrl");this.products=(e.products??[]).map(s=>{var u;const o=s.replacementId?(u=e.products)==null?void 0:u.find(g=>g.id===s.replacementId):void 0;return new st(s,o)}),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?be.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new D(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment,this.nextStatuses=(t=e.nextStatuses)==null?void 0:t.map(s=>new Te(s)),this.actions=e.actions,this.operatorsComment=e.operatorsComment,this.operatorsForWarehouseComment=e.operatorsForWarehouseComment,this.erpOrderUrl=e.erpOrderUrl}}class Kt extends N{getOffers(r,e,t,s=void 0){return this.getTypedPaginated(Pr,"/internal/orders/offers",r,e,t,{},void 0,s)}createOfferFromCart(r,e,t){return this.post(`/internal/orders/offers/${r}`,{name:e,items:t!=null&&t.length?t:void 0},s=>new ie(s.data))}getOffer(r){return this.get(`/internal/orders/offers/${r}`,{},e=>new ie(e.data))}updateOffer(r,e){return this.patch(`/internal/orders/offers/${r}`,{name:e},t=>new ie(t.data))}deleteOffer(r){return this.delete(`/internal/orders/offers/${r}`)}createOrderFromDraft(r,e,t,s={}){const o=A().config.dateFormats.api;return this.post(`/internal/orders/offers/${r}/create-order`,{...e,deliveryDate:e.deliveryDate?l.format(e.deliveryDate,o):void 0,items:t!=null&&t.length?t:void 0},u=>k.instanceListInitializer($,u.data),s)}addOfferProduct(r,e,t={}){return this.post(`/internal/orders/offers/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new ie(s.data),t)}patchOfferProduct(r,e,t,s={}){return this.patch(`/internal/orders/offers/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},o=>new ie(o.data),s)}deleteOfferProduct(r,e){return this.delete(`/internal/orders/offers/${r}/products/${e}`,t=>new ie(t.data))}getOfferHtml(r,e){return this.get(`/internal/orders/offers/${r}/view`,e?{recipientText:e}:{},t=>new Blob([t.data],{type:"text/html"}))}getOfferPdf(r,e){return this.getBlob(`/internal/orders/offers/${r}/download`,e?{recipientText:e}:{},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOffer(r,e){return this.post(`/internal/orders/offers/${r}/send`,e)}}var nt=(n=>(n.View="view",n.Share="share",n.EditTags="edit_tags",n.SaveOrderIgnoredProducts="save_order_ignored_products",n.ChangeStatus="change_status",n.ChangeProducts="change_products",n.ChangeOrderParameters="change_order_parameters",n.Recalculate="recalculate",n.AttachOrder="attach_order",n.DetachOrder="detach_order",n.ChangeAttachedOperator="change_attached_operator",n.SendOnlinePaymentLink="send_online_payment_link",n.ConfirmOnlineFullPayment="confirm_online_full_payment",n.MergeOrders="merge_orders",n.GetHistory="get_history",n.CloneOrder="clone_order",n.DeleteAttachedFile="delete_attached_file",n))(nt||{});class Xt{constructor(r){i(this,"paymentType");i(this,"deliveryType");i(this,"contragentId");i(this,"deliveryDate");i(this,"addressId");i(this,"warehouseId");i(this,"image");i(this,"comment");i(this,"barcode");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"additionalEmails");i(this,"isAllowProcessingWithoutPayment");i(this,"isAdditionalSale");var e,t,s;this.paymentType=r==null?void 0:r.payment.type,this.deliveryType=r==null?void 0:r.delivery.type,this.contragentId=(e=r==null?void 0:r.contragent)==null?void 0:e.id,this.deliveryDate=r!=null&&r.delivery.date?new Date(r.delivery.date):void 0,this.addressId=(t=r==null?void 0:r.delivery.address)==null?void 0:t.id,this.warehouseId=(s=r==null?void 0:r.delivery.warehouse)==null?void 0:s.id,this.comment=r==null?void 0:r.comment,this.barcode=r==null?void 0:r.barcode,this.operatorsComment=r==null?void 0:r.operatorsComment,this.operatorsForWarehouseComment=r==null?void 0:r.operatorsForWarehouseComment,this.isAllowProcessingWithoutPayment=r==null?void 0:r.isAllowProcessingWithoutPayment}}class Sr extends D{}class br extends D{}class Zt extends ne{constructor(e){var t,s,o,u;super();i(this,"attachedUsers");i(this,"clientSearchTerm");i(this,"client");i(this,"contragent");i(this,"createdAt",new S);i(this,"creator");i(this,"deliveryDate",new S);i(this,"deliveryAddressSearch");i(this,"clientCities");i(this,"id");i(this,"isApproved");i(this,"isNotInStock");i(this,"isOnOrder");i(this,"attachedAt",new S);i(this,"salesDirections");i(this,"status");i(this,"statusDetail");i(this,"deliveryType");i(this,"paymentType");i(this,"warehouses");i(this,"isLargeOrder");i(this,"isToProcess");i(this,"onlyMyRegions");this.attachedUsers=(t=e==null?void 0:e.attachedUsers)==null?void 0:t.map(g=>"isActive"in g?new pe(g):new Sr(g)),this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.client=e!=null&&e.client?new z(e.client):void 0,this.contragent=e==null?void 0:e.contragent,this.createdAt=new S(e==null?void 0:e.createdAt),this.creator=e!=null&&e.creator?new I(e.creator):void 0,this.deliveryDate=new S(e==null?void 0:e.deliveryDate),this.deliveryAddressSearch=e==null?void 0:e.deliveryAddressSearch,this.clientCities=(s=e==null?void 0:e.clientCities)==null?void 0:s.map(g=>new E(g)),this.id=e==null?void 0:e.id,this.isApproved=e==null?void 0:e.isApproved,this.isNotInStock=e==null?void 0:e.isNotInStock,this.isOnOrder=e==null?void 0:e.isOnOrder,this.isLargeOrder=e==null?void 0:e.isLargeOrder,this.attachedAt=new S(e==null?void 0:e.attachedAt),this.salesDirections=(o=e==null?void 0:e.salesDirections)==null?void 0:o.map(g=>new _(g)),this.status=e==null?void 0:e.status,this.statusDetail=e==null?void 0:e.statusDetail,this.deliveryType=e!=null&&e.deliveryType?new H(e.deliveryType):void 0,this.paymentType=e!=null&&e.paymentType?new br(e.paymentType):void 0,this.warehouses=(u=e==null?void 0:e.warehouses)==null?void 0:u.map(g=>new oe(g)),this.isToProcess=e==null?void 0:e.isToProcess}resetFilterValue(e){switch(e){case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"creator":this.creator=void 0;break;case"deliveryDate":this.deliveryDate.from=null,this.deliveryDate.to=null;break;case"deliveryType":this.deliveryType=new H;break;case"clientCities":this.clientCities=[];break;case"attachedAt":this.attachedAt.from=null,this.attachedAt.to=null;break;case"salesDirection":case"salesDirections":this.salesDirections=[];break;case"status":this.status=[];break;case"warehouse":case"warehouses":this.warehouses=[];break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,u,g,f;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.deliveryDate)!=null&&o.from)&&!((u=e==null?void 0:e.deliveryDate)!=null&&u.to)&&delete e.deliveryDate,!((g=e==null?void 0:e.attachedAt)!=null&&g.from)&&!((f=e==null?void 0:e.attachedAt)!=null&&f.to)&&delete e.attachedAt,e}}class ot{constructor(r){i(this,"user");i(this,"status");i(this,"statusDetail");i(this,"createdAt");this.user=new I(r==null?void 0:r.user),this.status=new Te(r==null?void 0:r.status),this.statusDetail=r!=null&&r.statusDetail?new D(r.statusDetail):void 0,this.createdAt=p.isString(r==null?void 0:r.createdAt)?l.parseISO(r.createdAt):(r==null?void 0:r.createdAt)??new Date}}class Ft extends N{getOrders(r,e,t,s=void 0){return this.getTypedPaginated(Rr,"/internal/orders",r,e,t,{},void 0,s)}getOrdersCount(r,e=void 0){return this.get("/internal/orders/count",r?{filters:JSON.stringify((r instanceof G?r:new G(r)).toPrimitive())}:{},void 0,void 0,e).then(t=>t.count)}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new $(e.data))}createClientOrder(r,e,t,s,o={}){const u=A().config.dateFormats.api;return this.post(`/internal/clients/${r}/orders/${e}`,{...t,deliveryDate:l.format(t.deliveryDate,u),items:s!=null&&s.length?s:void 0},g=>k.instanceListInitializer($,g.data),o)}attachOrder(r){return this.patch(`/internal/orders/${r}/attach`,{},e=>new $(e.data))}detachOrder(r){return this.patch(`/internal/orders/${r}/detach`,{},e=>new $(e.data))}mergeOrders(r,e){return this.patch(`/internal/orders/${r}/merge`,{ids:e},t=>new $(t.data))}recalculateOrder(r){return this.patch(`/internal/orders/${r}/recalculate`,{},e=>new $(e.data))}cloneOrder(r){return this.get(`/internal/orders/${r}/clone`,{})}updateOrder(r,e,t={}){const s=A().config.dateFormats.api;return this.patch(`/internal/orders/${r}`,{...e,deliveryDate:e.deliveryDate?l.format(e.deliveryDate,s):void 0},o=>new $(o.data),t)}addOrderProduct(r,e,t={}){return this.post(`/internal/orders/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new $(s.data),t)}changeOrderStatus(r,e,t,s={}){return this.patch(`/internal/orders/${r}/status`,{status:e,statusDetail:t},o=>new $(o.data),s)}changeOrderStatusDetail(r,e){return this.patch(`/internal/orders/${r}/status`,{statusDetail:e},t=>new $(t.data))}getOrderStatusHistory(r){return this.getTypedList(ot,`/internal/orders/${r}/history`)}getOrderPrintHtml(r,e){return this.get(`/internal/orders/${r}/print/view`,{...e},t=>new Blob([t.data],{type:"text/html"}))}getOrderPrintPdf(r,e){return this.getBlob(`/internal/orders/${r}/print/download`,{...e},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOrderPrint(r,e){return this.post(`/internal/orders/${r}/print/send`,e)}changeAttachedOperator(r,e){return this.patch(`/internal/orders/${r}/change-attached-operator`,{operatorId:e},t=>new $(t.data))}deleteOrderAttachedFile(r){return this.delete(`/internal/orders/${r}/file/attached`,e=>new $(e.data))}deleteOrderProduct(r,e){return this.delete(`/internal/orders/${r}/products/${e}`,t=>new $(t.data))}patchOrderProduct(r,e,t,s={}){return this.patch(`/internal/orders/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},o=>new $(o.data),s)}getDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getSelfDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/self-delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getDeliveryCost(r,e,t,s=void 0){const o=A().config.dateFormats.api;return this.get(`/internal/orders/delivery/${r}/cost`,{date:l.format(e,o),warehouse_id:t},u=>u.data,void 0,s)}}const Et=Symbol("currentOrder");class ze{constructor(r){i(this,"client");i(this,"product");i(this,"cost");i(this,"costCoefficient");i(this,"source");this.client=new z(r==null?void 0:r.client),this.product=new L(r==null?void 0:r.product),this.cost=(r==null?void 0:r.cost)??0,this.costCoefficient=(r==null?void 0:r.costCoefficient)??0,this.source=(r==null?void 0:r.source)??Ne.Product}}const Tr=n=>{var r,e,t,s,o;return n?p.omitBy({cities:(r=n.cities)==null?void 0:r.map(u=>u.id),clients:(e=n.clients)==null?void 0:e.map(u=>u.id),managers:(t=n.managers)==null?void 0:t.map(u=>u.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(u=>u.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(u=>u.id),hideNotActive:n.hideNotActive},u=>p.isNil(u)||(p.isArray(u)||p.isObject(u))&&p.isEmpty(u)):{}},ct=n=>{const r={};return n.from&&(n.from.coefficient||n.from.value)&&(r.from={},n.from.coefficient&&(r.from.priceCoefficientId=n.from.coefficient.id),n.from.value&&(r.from.increasePercent=n.from.value)),n.to&&(n.to.coefficient||n.to.value)&&(r.to={},n.to.coefficient&&(r.to.priceCoefficientId=n.to.coefficient.id),n.to.value&&(r.to.increasePercent=n.to.value)),r};class ei extends y{analyzeProductPrices(r,e,t){return this.get(`/internal/price/products/${r}/analyze`,{...ct(e),filters:Tr(t)},s=>k.instanceListInitializer(ze,s.data))}analyzeCategoryPrices(r,e,t){return this.get(`/internal/price/categories/${r}/analyze`,{...ct(e),filters:Tr(t)},s=>k.instanceListInitializer(ze,s.data))}analyzeCategoryPricesBySquare(r,e,t){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:Tr(t)},s=>k.instanceListInitializer(ze,s.data))}}class lt{constructor(r){i(this,"cost");i(this,"isLowCost");i(this,"isRetail");i(this,"costDate");i(this,"discountName");i(this,"priceTemplateName");i(this,"product");i(this,"client");i(this,"executor");i(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=p.isString(r.costDate)?l.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new ce(r.product):void 0,this.client=r.client?new I(r.client):void 0,this.executor=r.executor?new I(r.executor):void 0,this.currency=r.currency?new M(r.currency):void 0}}class ut extends ce{constructor(e){super(e);i(this,"history");this.history=p.map(e.history,t=>new lt(t))}}class ri extends y{getProductPriceHistory(r){var o,u,g,f,a;const e=A().config.dateFormats.api,t=p.omitBy(p.merge(r,{costDate:{from:p.isDate((o=r.costDate)==null?void 0:o.from)?l.format(r.costDate.from,e):(u=r.costDate)==null?void 0:u.from,to:p.isDate((g=r.costDate)==null?void 0:g.to)?l.format(r.costDate.to,e):(f=r.costDate)==null?void 0:f.to}}),C=>p.isNil(C)||(p.isArray(C)||p.isObject(C))&&p.isEmpty(C)),s=((a=r.product)==null?void 0:a[0])??0;return delete t.product,this.get(`/internal/price/products/${s}/history`,t).then(C=>[new ut(p.merge(C[0],{history:C}))])}}class Ar{constructor(r){i(this,"products",[]);i(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new ce(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new ce(e)))}}class ti extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Ar(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Ar(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}}var pt=(n=>(n.New="new",n.Processing="processing",n.AwaitingSupplyProducts="awaiting_supply_products",n.InvoiceIssued="invoice_issued",n.ProcessingOnStock="processing_on_stock",n.Finished="finished",n.OrderUpdated="order_updated",n.Canceled="canceled",n.Error="error",n))(pt||{}),ht=(n=>(n.CanceledBy1c="canceled_by1c",n.CanceledByClient="canceled_by_client",n.FinishedNotApproved="finished_not_approved",n.ProcessingByPurchasingDepartment="processing_by_purchasing_department",n.WillWaiting="will_waiting",n))(ht||{});class gt extends D{}class ft extends D{}class Qe extends O{constructor(e){super(e);i(this,"abbr");this.abbr=(e==null?void 0:e.abbr)??""}}class Or extends D{constructor(e){var t;super(e);i(this,"userRegions");this.userRegions=((t=e==null?void 0:e.userRegions)==null?void 0:t.map(s=>new Qe(s)))??[]}}class mt extends D{}class yt extends D{}class at extends D{}class wt extends D{}class ii{static generateUndefinedInstance(r,e="- Не определён -"){return new r({id:0,name:e,slug:"-undefined-"})}static isUndefinedInstance(r){return r.id===0&&r.slug==="-undefined-"}}class $r extends D{}const Y=class Y extends me{static withoutUnknownLocation(r){return r.filter(e=>e.id!==Y.unknownLocationId)}getReference(r,e=!1){return this.getTypedDataArrayRequester(gt,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(ar,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(mt,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester(Ue,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(M,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(te,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(V,"/public/references/opf",!0)}getOperators(){return this.getTypedDataArrayRequester(Sr,"/internal/references/operator",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(yt,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(Te,"/internal/references/order-status",!0)}getOrderStatusDetails(){return this.getTypedDataArrayRequester(at,"/internal/references/order-status-detail",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(br,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester($r,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(_,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(wr,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(E,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(F,`/internal/references/region-with-country/search?term=${r}`)}getRegionsByCountry(r){return this.getTypedDataArrayRequester(F,"/internal/references/region",!1,{params:{countryId:r}}).then(e=>Y.withoutUnknownLocation(e))}getCitiesByRegion(r){return this.getTypedDataArrayRequester(ft,"/internal/references/city",!1,{params:{regionId:r}}).then(e=>Y.withoutUnknownLocation(e))}getCitiesWithUserRegionByRegion(r){return this.getTypedDataArrayRequester(Or,"/internal/references/city-with-user-region",!1,{params:{regionId:r}}).then(e=>Y.withoutUnknownLocation(e))}searchCityWithRegion(r,e,t=void 0){return this.getTypedDataArrayRequester(E,"/internal/references/city-with-region/search",!1,{term:r,...e?{params:{countryId:e}}:{}},t).then(s=>Y.withoutUnknownLocation(s))}searchCityWithUserRegion(r,e=void 0){return this.getTypedDataArrayRequester(Or,"/internal/references/city-with-user-region/search",!1,{term:r},e).then(t=>Y.withoutUnknownLocation(t))}searchCountry(r){return this.getTypedDataArrayRequester(Z,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(H,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(oe,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(cr,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(Re,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(wt,"/public/references/product-file-type",!0)}};i(Y,"unknownLocationId",1);let b=Y;const T=J.defineStore("common.references_private",()=>{const n=m.ref({}),r=m.ref(void 0),e=m.ref(void 0),t=m.ref(void 0),s=m.ref(void 0),o=m.ref(void 0),u=m.ref(void 0),g=m.ref(void 0),f=m.ref(void 0),a=m.ref(void 0),C=m.ref(void 0),P=m.ref(void 0),Ae=m.ref(void 0),Oe=m.ref(void 0),ae=m.ref(void 0),we=m.ref(void 0),kr=m.ref(void 0),Ir=m.ref(void 0),Lr=m.ref(void 0),h=m.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:t,deliveryTypeReference:s,managersList:o,opfReference:u,operatorReference:g,orderPaymentStatusReference:f,orderStatusReference:a,orderStatusDetailReference:C,paymentTypeReference:P,partnerGroupReference:Ae,productFileTypeReference:Oe,resourceTypesReference:ae,salesDirectionsReference:we,sourcePrimaryInterestReference:kr,warehousesReference:Ir,propertyTypesReference:Lr,priceCoefficientsReference:h}}),si=J.defineStore("common.references",()=>{const n=m.computed(()=>{const h=T();return!h.channelPrimaryInterestReference&&!h.dataLoaderList.channelPrimaryInterestReference&&(h.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(b).getChannelPrimaryInterest().then(w=>{h.channelPrimaryInterestReference=w}).catch(p.noop)),h.channelPrimaryInterestReference}),r=m.computed(()=>{const h=T();return!h.contactPositionsReference&&!h.dataLoaderList.contactPositionsReference&&(h.dataLoaderList.contactPositionsReference=!0,y.getInstance(b).getContactPositions().then(w=>{h.contactPositionsReference=w}).catch(p.noop)),h.contactPositionsReference}),e=m.computed(()=>{const h=T();return!h.currencyReference&&!h.dataLoaderList.currencyReference&&(h.dataLoaderList.currencyReference=!0,y.getInstance(b).getCurrency().then(w=>{h.currencyReference=w}).catch(p.noop)),h.currencyReference}),t=m.computed(()=>{const h=T();return!h.opfReference&&!h.dataLoaderList.opfReference&&(h.dataLoaderList.opfReference=!0,y.getInstance(b).getOpf().then(w=>{h.opfReference=w}).catch(p.noop)),h.opfReference}),s=m.computed(()=>{const h=T();return!h.operatorReference&&!h.dataLoaderList.operatorReference&&(h.dataLoaderList.operatorReference=!0,y.getInstance(b).getOperators().then(w=>{h.operatorReference=w}).catch(p.noop)),h.operatorReference}),o=m.computed(()=>{const h=T();return!h.orderPaymentStatusReference&&!h.dataLoaderList.orderPaymentStatusReference&&(h.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(b).getOrderPaymentStatuses().then(w=>{h.orderPaymentStatusReference=w}).catch(p.noop)),h.orderPaymentStatusReference}),u=m.computed(()=>{const h=T();return!h.orderStatusReference&&!h.dataLoaderList.orderStatusReference&&(h.dataLoaderList.orderStatusReference=!0,y.getInstance(b).getOrderStatuses().then(w=>{h.orderStatusReference=w}).catch(p.noop)),h.orderStatusReference}),g=m.computed(()=>{const h=T();return!h.orderStatusDetailReference&&!h.dataLoaderList.orderStatusDetailReference&&(h.dataLoaderList.orderStatusDetailReference=!0,y.getInstance(b).getOrderStatusDetails().then(w=>{h.orderStatusDetailReference=w}).catch(p.noop)),h.orderStatusDetailReference}),f=m.computed(()=>{const h=T();return!h.paymentTypeReference&&!h.dataLoaderList.paymentTypeReference&&(h.dataLoaderList.paymentTypeReference=!0,y.getInstance(b).getPaymentTypes().then(w=>{h.paymentTypeReference=w}).catch(p.noop)),h.paymentTypeReference}),a=m.computed(()=>{const h=T();return!h.partnerGroupReference&&!h.dataLoaderList.partnerGroupReference&&(h.dataLoaderList.partnerGroupReference=!0,y.getInstance(b).getPartnerGroup().then(w=>{h.partnerGroupReference=w}).catch(p.noop)),h.partnerGroupReference}),C=m.computed(()=>{const h=T();return!h.productFileTypeReference&&!h.dataLoaderList.productFileTypeReference&&(h.dataLoaderList.productFileTypeReference=!0,y.getInstance(b).getProductFileType().then(w=>{h.productFileTypeReference=w}).catch(p.noop)),h.productFileTypeReference}),P=m.computed(()=>{const h=T();return!h.resourceTypesReference&&!h.dataLoaderList.resourceTypesReference&&(h.dataLoaderList.resourceTypesReference=!0,y.getInstance(b).getResourceTypes().then(w=>{h.resourceTypesReference=w}).catch(p.noop)),h.resourceTypesReference}),Ae=m.computed(()=>{const h=T();return!h.salesDirectionsReference&&!h.dataLoaderList.salesDirectionsReference&&(h.dataLoaderList.salesDirectionsReference=!0,y.getInstance(b).getSalesDirections().then(w=>{h.salesDirectionsReference=w}).catch(p.noop)),h.salesDirectionsReference}),Oe=m.computed(()=>{const h=T();return!h.sourcePrimaryInterestReference&&!h.dataLoaderList.sourcePrimaryInterestReference&&(h.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(b).getSourcePrimaryInterest().then(w=>{h.sourcePrimaryInterestReference=w}).catch(p.noop)),h.sourcePrimaryInterestReference}),ae=m.computed(()=>{const h=T();return!h.deliveryTypeReference&&!h.dataLoaderList.deliveryTypeReference&&(h.dataLoaderList.deliveryTypeReference=!0,y.getInstance(b).getDeliveryTypes().then(w=>{h.deliveryTypeReference=w}).catch(p.noop)),h.deliveryTypeReference}),we=m.computed(()=>{const h=T();return!h.managersList&&!h.dataLoaderList.managersList&&(h.dataLoaderList.managersList=!0,y.getInstance(it).getManagers().then(w=>{h.managersList=w}).catch(p.noop)),h.managersList}),kr=m.computed(()=>{const h=T();return!h.warehousesReference&&!h.dataLoaderList.warehousesReference&&(h.dataLoaderList.warehousesReference=!0,y.getInstance(b).getWarehouses().then(w=>{h.warehousesReference=w}).catch(p.noop)),h.warehousesReference}),Ir=m.computed(()=>{const h=T();return!h.propertyTypesReference&&!h.dataLoaderList.propertyTypesReference&&(h.dataLoaderList.propertyTypesReference=!0,y.getInstance(b).getPropertyTypes().then(w=>{h.propertyTypesReference=w}).catch(p.noop)),h.propertyTypesReference}),Lr=m.computed(()=>{const h=T();return!h.priceCoefficientsReference&&!h.dataLoaderList.priceCoefficientsReference&&(h.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(b).getPriceCoefficients().then(w=>{h.priceCoefficientsReference=w}).catch(p.noop)),h.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:t,operatorReference:s,orderPaymentStatusReference:o,orderStatusReference:u,orderStatusDetailReference:g,paymentTypeReference:f,partnerGroupsReference:a,productFilesTypesReference:C,resourceTypesReference:P,salesDirectionsReference:Ae,sourcePrimaryInterestsReference:Oe,deliveryTypeReference:ae,managersList:we,warehousesReference:kr,propertyTypesReference:Ir,priceCoefficientsReference:Lr}});class vt{constructor(r){i(this,"name");i(this,"content");this.name=r.name,this.content=r.content}}class dr{constructor(r){i(this,"resourceType");i(this,"resourceId");i(this,"h1");i(this,"title");i(this,"description");i(this,"keywords");i(this,"meta");i(this,"tags");var e;this.resourceType=new $r(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(t=>new vt(t)))??[],this.tags=r==null?void 0:r.tags}}class ni extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},t=>new dr(t.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,t=>new dr(t.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class oi extends y{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(t=>{const s=[...t];let o=1;return s.forEach(u=>{u.id=o++}),s})}}var Ct=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.ExternalSeo="external_seo",n.Guest="guest",n))(Ct||{});class Dt extends or{constructor(e){super(e);i(this,"type");i(this,"canDoReclamations");i(this,"photo");i(this,"pricingRole");this.type=e==null?void 0:e.type,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.photo=e==null?void 0:e.photo,this.pricingRole=e!=null&&e.pricingRole?new sr(e.pricingRole):void 0}}class ci extends y{constructor(){super(),this.baseUrl=`${A().config.http.portalApiUrl}/api`,this.interceptorIds.request.authRequestInterceptor&&this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor)}getAccessToken(){return this.get("internal/users/current-tokens").then(r=>r.accessToken)}}class Pt extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Dt(r.data),!0)}}const li=J.defineStore("common.user_state_private",()=>{const n=m.ref({}),r=m.ref(void 0);return{dataLoaderList:n,currentUser:r}}),ui=J.defineStore("common.user_state",()=>({currentUser:m.computed(()=>{const r=li();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,y.getInstance(Pt).getCurrentUser().then(e=>{r.currentUser=e}).catch(p.noop).finally(()=>{r.dataLoaderList.currentUser=!1})),r.currentUser})}));class Ve{constructor(r){i(this,"user");i(this,"salesDirection");this.user=new I(r==null?void 0:r.user),this.salesDirection=new _(r==null?void 0:r.salesDirection)}}class Je extends Qe{constructor(e){var t,s;super(e);i(this,"cities");i(this,"users");this.cities=((t=e==null?void 0:e.cities)==null?void 0:t.map(o=>new E(o)))??[],this.users=((s=e==null?void 0:e.users)==null?void 0:s.map(o=>new Ve(o)))??[]}}class pi extends ne{constructor(e){super();i(this,"id");i(this,"name");i(this,"abbr");this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.abbr=e==null?void 0:e.abbr}resetFilterValue(e){switch(e){case"id":case"name":case"abbr":this[e]=void 0;break}return this}}class hi extends N{getRegionsList(r,e,t){return this.getTypedPaginated(Qe,"/internal/users/regions",r,e,t)}getRegion(r){return this.get(`/internal/users/regions/${r}`,{},e=>new Je(e.data))}createRegion(r,e={}){return this.post("/internal/users/regions",r,t=>new Je(t.data),e)}updateRegion(r,e,t={}){return this.patch(`/internal/users/regions/${r}`,e,s=>new Je(s.data),t)}removeRegion(r){return this.delete(`/internal/users/regions/${r}`)}getRegionEmployees(r){return this.getTypedList(Ve,`/internal/users/regions/${r}/users`)}attachRegionEmployee(r,e,t){return this.post(`/internal/users/regions/${r}/users/${e}`,{salesDirectionId:t},s=>new Ve(s.data))}detachRegionEmployee(r,e,t){return this.request({method:"DELETE",url:`/internal/users/regions/${r}/users/${e}`,params:{sales_direction_id:t}})}}class gi{constructor(r,e){i(this,"showFeedback",!1);i(this,"feedback","");i(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=gt,c.AppBaseConfig=Hr,c.BankAccount=je,c.BasePaginationProvider=N,c.BlogPost=ke,c.BlogPostMediaFile=de,c.BlogPostMediaTypeEnum=De,c.BlogPostPublicationStatusEnum=Pe,c.BlogPostShortInfo=K,c.BlogPostsListFilters=Rt,c.BlogProvider=Le,c.CalculationTypeEnum=Qr,c.CalendarHelper=v,c.Cart=ue,c.CartProvider=St,c.CatalogProvider=At,c.CatalogableItem=er,c.Category=W,c.CategoryFilter=Kr,c.CategoryFilterSetting=ur,c.CategoryFilterValue=xr,c.CategoryPricingRule=lr,c.ChannelPrimaryInterest=ar,c.City=ft,c.CityWithRegionAndCountry=E,c.CityWithUserRegion=Or,c.Client=vr,c.ClientAdditionalData=Er,c.ClientCategory=Se,c.ClientDataProvider=U,c.ClientPriceProvider=Ot,c.ClientPriceTemplateProvider=$t,c.ClientProduct=B,c.ClientProductCategoryDataProvider=It,c.ClientProductDataProvider=Lt,c.ClientShortInfo=z,c.ClientsAdditionalDataRequestTypeEnum=Xr,c.ClientsListFilters=Ut,c.CodedIdentity=ce,c.ConfiguratorProvider=Wt,c.ConfiguratorsEnum=rt,c.Contact=Ye,c.ContactLinks=ir,c.ContactPerson=Q,c.ContactPersonRelated=et,c.ContactPosition=mt,c.ContactRelation=Ge,c.ContragentBase=fr,c.ContragentFactory=be,c.ContragentIc=mr,c.ContragentPerson=Zr,c.ContragentUlNr=Fr,c.ContragentUlR=yr,c.CostSourceEnum=Ne,c.Country=Z,c.CuratedDirection=Ue,c.Curator=Be,c.Currency=M,c.DataSuggestionProvider=oi,c.DateTimeProvider=Gt,c.DeletableNamedIdentity=gr,c.DeliveryAddress=fe,c.DeliveryType=H,c.DetailedJwtPayload=xe,c.DeviceTypeResolutionConfig=qr,c.DiscountShortInfo=Wr,c.FieldValidationResultData=gi,c.FilterGroup=G,c.FilterItem=Ke,c.FilterOpEnum=Ie,c.FilterSettings=Jr,c.GeoCoordinates=Fe,c.HiddenCatalogableItem=Yr,c.HttpCachedRequester=me,c.HttpParamsConfig=Nr,c.HttpRequester=y,c.Identity=q,c.Image=Gr,c.JwtPayload=x,c.Manager=pe,c.ManagerCommon=Me,c.ManagerDataFactory=Jt,c.ManagerDataProvider=it,c.MetaTagItem=vt,c.NamedIdentity=O,c.Offer=ie,c.OfferShortInfo=Pr,c.OffersDataProvider=Kt,c.OffersListFilters=xt,c.Operator=Sr,c.Opf=V,c.OpfEnum=j,c.Order=$,c.OrderAction=nt,c.OrderEditorData=Xt,c.OrderInfo=Rr,c.OrderItem=st,c.OrderItemBase=rr,c.OrderPaymentStatus=yt,c.OrderShortInfo=Cr,c.OrderStatus=Te,c.OrderStatusDetail=at,c.OrderStatusDetailEnum=ht,c.OrderStatusEnum=pt,c.OrderStatusHistoryInfo=ot,c.OrdersDataProvider=Ft,c.OrdersListFilters=Zt,c.PaginationFiltersBase=ne,c.PartnerGroup=te,c.PaymentType=br,c.PreferencesStorageProvider=Ce,c.PriceAnalyze=ze,c.PriceAnalyzeProvider=ei,c.PriceCoefficient=Re,c.PriceCoefficientEnum=Ze,c.PriceHistoryDataProvider=ri,c.PriceHistoryItem=lt,c.PriceTemplate=X,c.PriceTemplateCategory=He,c.PriceTemplateClient=he,c.PriceTemplateICatalogableItem=nr,c.PriceTemplateProduct=We,c.PriceTemplateProvider=_t,c.PricingRole=ge,c.PricingRoleProvider=qt,c.PrimaryCatalogableItem=qe,c.Product=L,c.ProductCategoryDataProvider=dt,c.ProductDataProvider=kt,c.ProductFileType=wt,c.ProductFilterTypeEnum=tr,c.ProductPriceCoefficient=_e,c.ProductPriceHistory=ut,c.ProductUnit=Ee,c.PropertiesProvider=Nt,c.Property=ee,c.PropertyType=cr,c.PropertyTypeEnum=Vr,c.PropertyValue=re,c.RecommendationsDataProvider=ti,c.RecommendationsList=Ar,c.Reference=D,c.ReferenceDataFactory=ii,c.ReferenceDataProvider=b,c.Region=F,c.ResourceType=$r,c.STANDARD_PERIOD_GROUPS=zt,c.STANDARD_PERIOD_SECTIONS=Qt,c.SalesDirection=_,c.SentryConfig=Mr,c.Seo=dr,c.SeoDataProvider=ni,c.SourcePrimaryInterest=wr,c.StockCount=jr,c.TableDataPagination=jt,c.TableDataPaginationRequestParams=tt,c.TableDataSortRequestParams=Yt,c.TemplateProductCategoryDataProvider=Mt,c.TemplatesListFilters=Tt,c.TypedInstanceFactory=k,c.UnitsHelper=Dr,c.UnknownClientDataProvider=Ht,c.UpdatableNamedIdentity=Xe,c.User=Dt,c.UserAuthDataProvider=ci,c.UserCommonInfo=or,c.UserDataProvider=Pt,c.UserPricingRole=sr,c.UserRegion=Je,c.UserRegionEmployee=Ve,c.UserRegionProvider=hi,c.UserRegionShortInfo=Qe,c.UserRegionsListFilters=pi,c.UserShortInfo=I,c.UserTypeEnum=Ct,c.VersionConfig=Bt,c.Warehouse=oe,c.WebSocketConfig=Ur,c.currentOrderInjectionKey=Et,c.findCatalogItemByIdRecursive=pr,c.flattenCatalogItems=hr,c.pluralize=Vt,c.useAuthStateStore=$e,c.useBaseConfigStateStore=A,c.useReferencesStore=si,c.useUserStateStore=ui,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("pinia"),require("vue"),require("date-fns"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","pinia","vue","date-fns","axios"],k):(c=typeof globalThis<"u"?globalThis:c||self,k(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c.pinia,c.vue,c["date-fns"],c.axios))})(this,function(c,k,p,Ce,K,f,l,Br){"use strict";var Ci=Object.defineProperty;var Di=(c,k,p)=>k in c?Ci(c,k,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[k]=p;var i=(c,k,p)=>Di(c,typeof k!="symbol"?k+"":k,p);class X{constructor(r){i(this,"exp",0);i(this,"iat",0);i(this,"authTime",0);i(this,"jti","");i(this,"iss","");i(this,"aud",[]);i(this,"sub","");i(this,"typ","Bearer");i(this,"azp","");i(this,"sid","");i(this,"acr","");i(this,"allowedOrigins",[]);i(this,"realmAccess",{roles:[]});i(this,"resourceAccess",{});i(this,"scope","");i(this,"emailVerified",!1);i(this,"name","");i(this,"guid","");i(this,"preferredUsername","");i(this,"givenName","");i(this,"email","");p.merge(this,r)}static getJwtPayload(r){const e=k.jwtDecode(r),t=new X(Ce.objectToCamel(e));return t.resourceAccess=e.resource_access,t}}class Xe extends X{constructor(e){super(e);i(this,"familyName");i(this,"middleName");i(this,"locale");i(this,"phoneNumber");i(this,"phoneNumberVerified");i(this,"address");p.merge(this,e)}static getJwtPayload(e){const t=k.jwtDecode(e),s=new Xe(Ce.objectToCamel(t));return s.resourceAccess=t.resource_access,s}}class Wr{constructor(r){i(this,"phone");i(this,"tablet");i(this,"laptop");this.phone=(r==null?void 0:r.phone)??360,this.tablet=(r==null?void 0:r.tablet)??600,this.laptop=(r==null?void 0:r.laptop)??1024}}class jr{constructor(r){i(this,"portalApiUrl");i(this,"mediaUrl");i(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class zr{constructor(r){i(this,"dsn");i(this,"environment");i(this,"ignoreErrors");i(this,"trace");i(this,"replay");i(this,"additionalParams");var e,t,s,o;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|404|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((t=r==null?void 0:r.trace)==null?void 0:t.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((s=r==null?void 0:r.replay)==null?void 0:s.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((o=r==null?void 0:r.replay)==null?void 0:o.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class Yr{constructor(r){i(this,"broadcaster");i(this,"key");i(this,"wsHost");i(this,"wsPort");i(this,"wssPort");i(this,"forceTLS");i(this,"enabledTransports");this.broadcaster=r.broadcaster??"reverb",this.key=r.key??"",this.wsHost=r.wsHost??"",this.wsPort=r.wsPort??8080,this.wssPort=r.wssPort??8080,this.forceTLS=r.forceTLS??!1,this.enabledTransports=r.enabledTransports??["wss"]}}class Gr{constructor(r){i(this,"environment");i(this,"devMode");i(this,"http");i(this,"deviceTypeByResolution");i(this,"sentry");i(this,"tableDefaultHeightCoefficient");i(this,"urls");i(this,"websocket");i(this,"dateFormats");var e,t,s;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new jr(r==null?void 0:r.http),this.deviceTypeByResolution=new Wr(r==null?void 0:r.deviceTypeByResolution),this.sentry=new zr({environment:this.environment,...r==null?void 0:r.sentry}),this.tableDefaultHeightCoefficient=(r==null?void 0:r.tableDefaultHeightCoefficient)??.7,this.urls=r==null?void 0:r.urls,this.websocket=r!=null&&r.websocket?new Yr(r.websocket):void 0,this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((t=r==null?void 0:r.dateFormats)==null?void 0:t.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}const A=K.defineStore("common.config",()=>{const n=f.ref(new Gr);return{config:n,getConfig:()=>n.value,setConfig:t=>{n.value=p.merge(n.value,t)}}});class De{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const t=JSON.parse(e);if(!t.availableFor||l.isAfter(l.parseISO(t.availableFor)||l.startOfToday(),new Date)){if(p.isNil(t.data)||p.isEmpty(t.data))throw new Error("Data is empty");return t.data}localStorage.removeItem(r)}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,t){if(this.isLocalStorageAvailable())try{if(p.isNil(e)||p.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,s)}catch(s){if(s instanceof DOMException&&s.code===DOMException.QUOTA_EXCEEDED_ERR){this.clearOldData();try{const o=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,o)}catch{}}else try{localStorage.removeItem(r)}catch{}}}static isLocalStorageAvailable(){try{const r="__localStorage_test__";return localStorage.setItem(r,"test"),localStorage.removeItem(r),!0}catch{return!1}}static clearOldData(){try{const r=[];for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t)try{const s=localStorage.getItem(t);if(s){const o=JSON.parse(s);o.availableFor&&!l.isAfter(l.parseISO(o.availableFor)||l.startOfToday(),new Date)&&r.push(t)}}catch{r.push(t)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function Qr(n){try{const r=X.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const ne=K.defineStore("common.auth_state_private",()=>{const n=f.ref((()=>{var g;const o=De.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const u=(g=A().config.devMode)==null?void 0:g.initAuthBearerToken;return u?Promise.resolve(u):void 0})()),r=f.ref(void 0),e=f.ref(void 0),t=f.markRaw(new Map);function s(){e.value=void 0,p.isNil(n.value)||n.value.then(o=>{const u=X.getJwtPayload(o);e.value=u.exp*1e3>Date.now()?p.mapValues(u.resourceAccess,g=>(g==null?void 0:g.roles)??[]):void 0}).catch(p.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:t,recalculateUserPermissions:s}}),Ie=K.defineStore("common.auth_state",()=>{const n=f.computed(()=>{const o=ne();if(p.isNil(o.jwtToken)&&!p.isNil(o.jwtTokenUpdater)){const u=o.jwtTokenUpdater();o.jwtToken=u,u.then(g=>{o.jwtToken=Promise.resolve(g),De.saveActualDataToStorage("sc.token",g,Qr(g)),o.recalculateUserPermissions()}).catch(p.noop)}return o.jwtToken});function r(o){ne().jwtTokenUpdater=o}function e(o){const u=ne();u.jwtToken=Promise.resolve(o),De.saveActualDataToStorage("sc.token",o,Qr(o)),u.recalculateUserPermissions()}function t(){const o=ne();o.jwtToken=void 0,o.userPermissions=void 0,De.saveActualDataToStorage("sc.token",void 0)}function s(o){const u=ne();!p.isNil(u.jwtToken)&&p.isNil(u.userPermissions)&&u.jwtToken.then(a=>{const C=X.getJwtPayload(a);u.userPermissions=C.exp*1e3>Date.now()?p.mapValues(C.resourceAccess,P=>(P==null?void 0:P.roles)??[]):void 0}).catch(p.noop);const g=p.isArray(o)?o.join(" && "):o;if(u.userPermissionsComputedRefs.has(g))return u.userPermissionsComputedRefs.get(g);const m=f.computed(()=>{const a=C=>{var ve;const P=p.split(C,".");if(P.length<2)return!1;const[$e,ke]=P,we=(ve=ne().userPermissions)==null?void 0:ve[$e];return p.isArray(we)&&we.includes(ke)};return p.isArray(o)?p.every(o,C=>a(C)):a(o)});return u.userPermissionsComputedRefs.set(g,m),m}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:t,hasUserPermission:s}});var Pe=(n=>(n.Image="image",n.Video="video",n))(Pe||{});class N{constructor(r,e){i(this,"id");i(this,"guid");this.id=r==null?void 0:r.id,p.isNil(this.id)&&(p.isNil(e)?typeof(r==null?void 0:r.id)=="number"?this.id=-1:typeof(r==null?void 0:r.id)=="string"&&(this.id=""):this.id=e),this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return typeof this.id=="number"?this.id===-1:typeof this.id=="string"?this.id==="":p.isNil(this.id)}}class de extends N{constructor(e){super(e,"");i(this,"mediaType");i(this,"isCover");i(this,"isUnused");i(this,"url");i(this,"urlWebp");this.mediaType=(e==null?void 0:e.mediaType)??Pe.Image,this.isCover=(e==null?void 0:e.isCover)??!1,this.isUnused=(e==null?void 0:e.isUnused)??!1,this.url=(e==null?void 0:e.url)??"",this.urlWebp=e==null?void 0:e.urlWebp}isImage(){return this.mediaType===Pe.Image}isVideo(){return this.mediaType===Pe.Video}}var Re=(n=>(n.Draft="draft",n.Published="published",n.Scheduled="scheduled",n))(Re||{});class Z extends N{constructor(e){super(e,-1);i(this,"slug");i(this,"title");i(this,"publishedAt");i(this,"createdAt");this.slug=(e==null?void 0:e.slug)??"",this.title=(e==null?void 0:e.title)??"",this.publishedAt=Z.parseDate(e==null?void 0:e.publishedAt),this.createdAt=Z.parseDate(e==null?void 0:e.createdAt)??new Date}static resolvePublicationStatus(e){return p.isNil(e)?Re.Draft:e.getTime()>Date.now()?Re.Scheduled:Re.Published}static getSlugError(e){return e?/[^a-z0-9-]/.test(e)?"Допустимы только строчные латинские буквы, цифры и дефис: пример «kak-vybrat-podokonnik».":p.startsWith(e,"-")||p.endsWith(e,"-")?"Обозначение не может начинаться или заканчиваться дефисом.":p.includes(e,"--")?"Дефисы не могут идти подряд: разделяйте слова одним дефисом.":"":""}static parseDate(e){return p.isNil(e)?null:p.isString(e)?l.parseISO(e):e}getPublicationStatus(){return Z.resolvePublicationStatus(this.publishedAt)}}class Le extends Z{constructor(e){super(e);i(this,"content");i(this,"media");this.content=(e==null?void 0:e.content)??"",this.media=((e==null?void 0:e.media)??[]).map(t=>new de(t))}toSaveData(e=!1){return{title:this.title,slug:this.slug.length>0?this.slug:void 0,content:e?this.content:void 0,publishedAt:this.publishedAt}}getCover(){return this.media.find(e=>e.isCover)}getUnusedMedia(){return this.media.filter(e=>e.isUnused)}}class oe{asClearRaw(){const r={};return Object.keys(this).forEach(e=>{const t=this[e];p.isNil(t)||p.isString(t)&&t.trim().length===0||p.isFunction(t.isNewRec)&&t.isNewRec()||(r[e]=t)}),r}}class S{constructor(r){i(this,"from");i(this,"to");this.from=p.isString(r==null?void 0:r.from)?l.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=p.isString(r==null?void 0:r.to)?l.parseISO(r.to):(r==null?void 0:r.to)??null}}class $t extends oe{constructor(e){super();i(this,"id");i(this,"title");i(this,"slug");i(this,"content");i(this,"publicationStatus");i(this,"publishedAt");i(this,"createdAt");this.id=e==null?void 0:e.id,this.title=e==null?void 0:e.title,this.slug=e==null?void 0:e.slug,this.content=e==null?void 0:e.content,this.publicationStatus=e==null?void 0:e.publicationStatus,this.publishedAt=new S(e==null?void 0:e.publishedAt),this.createdAt=new S(e==null?void 0:e.createdAt)}resetFilterValue(e){switch(e){case"id":case"title":case"slug":case"content":case"publicationStatus":this[e]=void 0;break;case"publishedAt":this.publishedAt.from=null,this.publishedAt.to=null;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break}return this}asClearRaw(){var t,s,o,u;const e=super.asClearRaw();return!((t=e==null?void 0:e.publishedAt)!=null&&t.from)&&!((s=e==null?void 0:e.publishedAt)!=null&&s.to)&&delete e.publishedAt,!((o=e==null?void 0:e.createdAt)!=null&&o.from)&&!((u=e==null?void 0:e.createdAt)!=null&&u.to)&&delete e.createdAt,e}}class I{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}static instanceListInitializer(r,e){if(!p.isArray(e))throw new TypeError(`Ожидался список данных для инициализации "${r.name}", получены данные типа "${typeof e}".`);return p.map(e,t=>I.instanceInitializer(r,t))}}const R=class R{constructor(){i(this,"httpClient");i(this,"baseUrl",`${A().config.http.portalApiUrl}/api`);i(this,"errorResponseHandler",p.noop);i(this,"interceptorIds",{request:{},response:{}});i(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));i(this,"authRequestInterceptor",async r=>{let e;return p.isNil(Ie().jwtToken)||(e=await Ie().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});i(this,"userRequestHooksInterceptor",async r=>R.requestHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=Ce.objectToSnake(r.params)),["put","patch","post"].includes(p.toLower(r.method))&&r.data&&(r.data=Ce.objectToSnake(r.data))),r));i(this,"authErrorsResponseInterceptors",r=>{var t;const e=r.rawError?(t=r.rawError)==null?void 0:t.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(Ie().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});i(this,"canceledResponseInterceptor",r=>{const e=r.rawError??r;if(e.name==="CanceledError"||e.code==="ERR_CANCELED")throw new Br.CanceledError("Request canceled");return Promise.reject(r)});i(this,"userResponseHooksInterceptor",async r=>R.responseHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=Ce.objectToCamel(r.data)),r));this.errorResponseHandler=R.defaultErrorsResponseHandler,this.httpClient=Br.create({headers:{Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.userRequestHooksInterceptor=this.httpClient.interceptors.request.use(this.userRequestHooksInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,r=>R.convertHttpErrorResponse(r)),this.interceptorIds.response.canceledResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.canceledResponseInterceptor),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.userResponseHooksInterceptor=this.httpClient.interceptors.response.use(this.userResponseHooksInterceptor,r=>Promise.reject(r))}static setDefaultErrorsResponseHandler(r){R.defaultErrorsResponseHandler=r}static addRequestHook(r){R.requestHooks.includes(r)||R.requestHooks.push(r)}static removeRequestHook(r){const e=R.requestHooks.indexOf(r);e!==-1&&R.requestHooks.splice(e,1)}static addResponseHook(r){R.responseHooks.includes(r)||R.responseHooks.push(r)}static removeResponseHook(r){const e=R.responseHooks.indexOf(r);e!==-1&&R.responseHooks.splice(e,1)}static getInstance(r){return Object.prototype.hasOwnProperty.call(R.instances,r.name)||(R.instances[r.name]=I.simpleInstanceInitializer(r)),R.instances[r.name]}static toHttpResponseError(r){return p.isObject(r)&&"status"in r?r:{status:0,statusText:"Invalid response data",message:p.isError(r)?r.message:"Не удалось обработать данные ответа сервера.",headers:{},rawError:p.isError(r)?r:new Error(String(r))}}static convertHttpErrorResponse(r){var e,t;if(p.isNil(r)||!p.isNil(r.request)||!p.isNil(r.response)){const s=p.isNil(r)?{}:r==null?void 0:r.response;return Promise.reject({status:(s==null?void 0:s.status)??0,statusText:(s==null?void 0:s.statusText)??"Unknown",message:((e=s==null?void 0:s.data)==null?void 0:e.message)??"Unknown Error. Probably network error.",errors:(t=s==null?void 0:s.data)==null?void 0:t.errors,headers:(s==null?void 0:s.headers)??{},data:s==null?void 0:s.data,rawError:r})}return Promise.reject(r)}request(r,e=void 0,t={},s=!1){const o=this.httpClient.request(r).then(u=>e?e(u):u.data);return o.catch(u=>{(u==null?void 0:u.name)!=="CanceledError"&&this.errorResponseHandler(R.toHttpResponseError(u),t,s)}),o}get(r,e={},t=void 0,s=!1,o=void 0){return this.request({method:"GET",url:r,params:e,signal:o},t,{},s)}getTypedList(r,e,t={},s=!1,o=void 0){return this.get(e,t,u=>I.instanceListInitializer(r,u.data),s,o)}getBlob(r,e={},t=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},t,{},s)}patch(r,e={},t=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},t,s,o)}post(r,e={},t=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},t,s,o)}delete(r,e=void 0,t=!1){return this.request({method:"DELETE",url:r},e,{},t)}};i(R,"instances",{}),i(R,"defaultErrorsResponseHandler",p.noop),i(R,"requestHooks",[]),i(R,"responseHooks",[]);let y=R;var _e=(n=>(n.BeginWith="bw",n.Contains="cn",n.Custom="custom",n.EndsWith="ew",n.Equals="eq",n.GreaterOrEqual="ge",n.GreaterThan="gt",n.InList="in",n.LessOrEqual="le",n.LessThan="lt",n.NotBeginWith="bn",n.NotContains="nc",n.NotEndsWith="en",n.NotEqual="ne",n.NotInList="ni",n.NotNull="nn",n.Null="nu",n))(_e||{});class Ze{constructor(r){i(this,"field");i(this,"op");i(this,"value");this.field=(r==null?void 0:r.field)??"",this.op=(r==null?void 0:r.op)??_e.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r=A().config.dateFormats.api,e={field:this.field,op:this.op};if(p.isDate(this.value))e.value=l.format(this.value,r);else if(p.isPlainObject(this.value)){const t=this.value;e.value={from:t.from?l.format(t.from,r):null,to:t.to?l.format(t.to,r):null}}else e.value=this.value;return e}}class Q{constructor(r){i(this,"groupOp");i(this,"filters");i(this,"groups");var e,t;this.groupOp=(r==null?void 0:r.groupOp)??"and",this.filters=((e=r==null?void 0:r.filters)==null?void 0:e.map(s=>new Ze(s)))??[],this.groups=((t=r==null?void 0:r.groups)==null?void 0:t.map(s=>new Q(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Ze&&p.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof Q?r.toPrimitive():r)}}}class q extends y{getPaginated(r,e,t,s,o,u,g,m=void 0){let a={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(a.filters=JSON.stringify((e instanceof Q?e:new Q(e)).toPrimitive())),p.isEmpty(t)||(a.sort=p.isArray(t)?t:[t]),o&&(a={...a,...o}),this.get(r,a,u,g,m)}getTypedPaginated(r,e,t,s,o,u,g,m=void 0){return this.getPaginated(e,t,s,o,u,a=>({...a.data,data:I.instanceListInitializer(r,a.data.data)}),g,m)}}class Ne extends q{static preparePostSaveData(r){const e={};if(p.isUndefined(r.title)||(e.title=r.title),p.isUndefined(r.slug)||(e.slug=r.slug),p.isUndefined(r.content)||(e.content=r.content),!p.isUndefined(r.publishedAt)){const t=A().config.dateFormats.api;e.publishedAt=p.isNil(r.publishedAt)?null:l.format(r.publishedAt,t)}return e}getPostList(r,e,t){return this.getPaginated("/internal/blog",r,e,t,{},s=>({...s.data,data:s.data.data.map(o=>new Z(o))}))}getPost(r){return this.get(`/internal/blog/${r}`,{},e=>new Le(e.data))}createPost(r,e={}){return this.post("/internal/blog",Ne.preparePostSaveData(r),t=>new Le(t.data),e)}updatePost(r,e,t={}){return this.patch(`/internal/blog/${r}`,Ne.preparePostSaveData(e),s=>new Le(s.data),t)}removePost(r){return this.delete(`/internal/blog/${r}`)}uploadMedia(r,e,t,s,o={}){return this.request({method:"POST",url:`/internal/blog/${r}/media`,data:{file:e,isCover:t??!1},onUploadProgress:u=>{s&&s(u.total?Math.round(u.loaded/u.total*100):0)}},u=>new de(u.data),o)}updateMedia(r,e,t,s={}){return this.patch(`/internal/blog/${r}/media/${e}`,{isCover:t},o=>new de(o.data),s)}removeMedia(r,e){return this.delete(`/internal/blog/${r}/media/${e}`)}}class O extends N{constructor(e){super(e);i(this,"name","");this.name=(e==null?void 0:e.name)??""}}class d extends O{constructor(e){super(e);i(this,"type");i(this,"isActive");this.type=e==null?void 0:e.type,this.isActive=(e==null?void 0:e.isActive)??!0}}class Vr extends O{constructor(e){super(e);i(this,"costCoefficient");i(this,"isLowPriceAllowed");i(this,"publishedAt");i(this,"description");i(this,"percent");i(this,"owner");i(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=p.isString(e==null?void 0:e.publishedAt)?l.parseISO(e.publishedAt):e==null?void 0:e.publishedAt,this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new d(e==null?void 0:e.owner),this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class Fe extends O{constructor(e){super(e);i(this,"updatedAt");this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?l.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class F extends Fe{constructor(e){super(e);i(this,"description");i(this,"createdAt");i(this,"owner");this.description=(e==null?void 0:e.description)??"",this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.owner=e!=null&&e.owner?new d(e.owner):void 0}}var Ee=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(Ee||{});class D extends O{constructor(e){super(e);i(this,"slug");i(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class Se extends D{static getRetailPriceCoefficient(){return{id:-2,slug:Ee.Retail,name:"Розн. цена",guid:"",isNewRec:p.constant(!0)}}}class qe{constructor(r){i(this,"coefficient");i(this,"value");i(this,"cost");i(this,"percent");i(this,"readOnly");this.coefficient=new Se(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class er{constructor(r){i(this,"lat");i(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class B extends D{}class ce extends D{constructor(e){var t;super(e);i(this,"address");i(this,"isMain");i(this,"deliveryTypes");i(this,"regions");i(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((t=e==null?void 0:e.deliveryTypes)==null?void 0:t.map(s=>new B(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new er(e==null?void 0:e.coordinates)}}class Jr{constructor(r){i(this,"warehouse");i(this,"count");this.warehouse=new ce(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class M extends O{constructor(e){super(e);i(this,"signature","");i(this,"code");i(this,"symbol","");i(this,"precision");e&&(this.signature=e.signature??"",this.code=e.code,this.symbol=e.symbol??"",this.precision=e.precision)}}class rr extends O{constructor(e){super(e);i(this,"slug","");i(this,"description");i(this,"isSquare",!1);i(this,"isLinear",!1);e&&(this.slug=e.slug??"",this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}}class le extends O{constructor(e){super(e);i(this,"code","");this.code=(e==null?void 0:e.code)??""}}class tr extends le{constructor(e){super(e);i(this,"slug");i(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class xr extends tr{constructor(e){super(e);i(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Kr{constructor(r,e){i(this,"image");i(this,"preview");i(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class Me extends tr{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class L extends xr{constructor(e){var s,o,u,g;super(e);i(this,"supplierSku");i(this,"unit");i(this,"pack");i(this,"minCount");i(this,"currency");i(this,"cost");i(this,"costRub");i(this,"costDate");i(this,"onOrder");i(this,"stockCount");i(this,"category");i(this,"categories");i(this,"images");i(this,"properties");i(this,"retailCost");i(this,"retailCostRub");i(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=e!=null&&e.unit?new rr(e.unit):new rr,this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.currency=e!=null&&e.currency?new M(e.currency):new M,this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=p.isString(e==null?void 0:e.costDate)?l.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((s=e==null?void 0:e.stockCount)==null?void 0:s.map(m=>new Jr(m)))??[],this.type="product";const t=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(m=>m.isPrimary));t&&(this.category=new Me({...t,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(m=>new Me(m))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(m=>new Kr(m,A().config.http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.retailCost=e==null?void 0:e.retailCost,this.retailCostRub=e==null?void 0:e.retailCostRub,this.priceCoefficients=((g=e==null?void 0:e.priceCoefficients)==null?void 0:g.map(m=>new qe(m)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}var Ue=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Ue||{});class W extends L{constructor(e){super(e);i(this,"costCoefficient");i(this,"costSource");i(this,"discount");i(this,"priceTemplate");i(this,"isPreviouslyOrdered");i(this,"isRequired");i(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??Ue.Product,this.discount=e!=null&&e.discount?new Vr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new F(e.priceTemplate):void 0,this.isPreviouslyOrdered=e==null?void 0:e.isPreviouslyOrdered,this.isRequired=e==null?void 0:e.isRequired,this.isFavorite=e==null?void 0:e.isFavorite}}class ue extends Me{constructor(e){super(e);i(this,"isHidden");i(this,"parentCategoryId");i(this,"properties");i(this,"currencyRates");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category",this.currencyRates=e!=null&&e.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([t,s])=>[p.toUpper(t),s])):void 0}}class ir extends N{constructor(e){super(e);i(this,"category");i(this,"product");i(this,"quantity");i(this,"currency");i(this,"marker");i(this,"height");i(this,"length");i(this,"width");i(this,"configurator");i(this,"configuratorParams");i(this,"isAdditionalSale");i(this,"creator");i(this,"isRemoved");i(this,"ord");i(this,"onOrder");i(this,"originalId");i(this,"replacementId");this.product=new W(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new ue,this.currency=e.currency?new M(e.currency):void 0,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&p.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale,this.creator=e.creator&&new d(e.creator),this.isRemoved=e.isRemoved,this.ord=e.ord,this.onOrder=e.onOrder,this.originalId=e.originalId,this.replacementId=e.replacementId}}let sr=class extends ir{constructor(e){super(e);i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=p.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new M(e.currency)}};class pe{constructor(r){i(this,"items");i(this,"resultSum");i(this,"directionsSum");this.items=r.items.map(e=>new sr(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class kt extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new pe(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new pe(s.data),t)}patchCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new pe(s.data),t)}deleteCartItem(r,e){return this.delete(`internal/clients/${r.id}/cart/${e.id}`,t=>new pe(t.data))}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,t=>new pe(t.data))}getCartItemFromCSVExample(r){return this.get(`internal/clients/${r.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:"text/csv"}))}}var Xr=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(Xr||{}),Zr=(n=>(n.Unknown="unknown",n.Bool="bool",n.Integer="integer",n.Float="float",n.String="string",n.Range="range",n.Json="json",n.Object="object",n))(Zr||{}),nr=(n=>(n.Checkbox="checkbox",n.Range="range",n.Toggle="toggle",n))(nr||{});class j extends ue{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new j(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new L(o))}}class or{constructor(r){i(this,"phone");i(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class _ extends D{}class He extends O{constructor(e){super(e);i(this,"salesDirection");i(this,"photo");i(this,"contacts");i(this,"isDefault");i(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new _(e.salesDirection):new _,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new or(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class Be extends D{}class cr extends O{constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class be extends O{constructor(e){super(e);i(this,"abbr");this.abbr=(e==null?void 0:e.abbr)??""}}class z extends He{constructor(e){var t,s,o;super(e);i(this,"isActive");i(this,"isSupervisor");i(this,"canDoReclamations");i(this,"createdAt");i(this,"supervisorId");i(this,"pricingRole");i(this,"curatedDirections");i(this,"showAllCosts");i(this,"authAsOperator");i(this,"managerRegions");i(this,"managers");i(this,"lastLoginAt");this.isActive=(e==null?void 0:e.isActive)??!1,this.isSupervisor=(e==null?void 0:e.isSupervisor)??!1,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.supervisorId=e==null?void 0:e.supervisorId,this.pricingRole=e!=null&&e.pricingRole?new cr(e.pricingRole):void 0,this.curatedDirections=((t=e==null?void 0:e.curatedDirections)==null?void 0:t.map(u=>new Be(u)))??[],this.showAllCosts=e==null?void 0:e.showAllCosts,this.authAsOperator=e==null?void 0:e.authAsOperator,this.managerRegions=(s=e==null?void 0:e.managerRegions)==null?void 0:s.map(u=>new be(u)),this.managers=(o=e==null?void 0:e.managers)==null?void 0:o.map(u=>new z(u)),this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt}}class It extends ue{constructor(e){super(e);i(this,"isDisabled");i(this,"isRequired");i(this,"isFavorite");i(this,"hidingComment");i(this,"manager");this.isDisabled=(e==null?void 0:e.isDisabled)??!1,this.isRequired=(e==null?void 0:e.isRequired)??!1,this.isFavorite=(e==null?void 0:e.isFavorite)??!1,this.hidingComment=e==null?void 0:e.hidingComment,this.manager=e!=null&&e.manager?new z(e.manager):void 0}}class Te extends It{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new Te(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new W(o))}}class lr{constructor(r){i(this,"priceCoefficient");i(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new Se(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class We extends lr{constructor(e){super(e);i(this,"productCategory");this.productCategory=new ue(e==null?void 0:e.productCategory)}}class je extends O{constructor(e){super(e);i(this,"photo");i(this,"contacts");i(this,"curatedDirection");this.photo=e.photo,this.contacts=new or(e.contacts),this.curatedDirection=new Be(e.curatedDirection)}}class E extends D{}class ee extends D{constructor(e){super(e);i(this,"country",new E);e&&(this.country=new E(e.country))}}class re extends D{constructor(e){super(e);i(this,"region",new ee);e&&(this.region=new ee(e.region))}}class ur extends O{constructor(e){super(e);i(this,"phone");i(this,"email");i(this,"getNews");i(this,"salesDirection");i(this,"createdAt");i(this,"lastLoginAt");i(this,"isActive");this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:(e==null?void 0:e.phone)??"",this.email=(e==null?void 0:e.email)??"",this.getNews=(e==null?void 0:e.getNews)??!1,this.salesDirection=e!=null&&e.salesDirection?new _(e.salesDirection):void 0,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class V extends ur{constructor(e){var t,s;super(e);i(this,"salesDirection");i(this,"debt");i(this,"alternativeName");i(this,"city");i(this,"comment");i(this,"isPhoneApproved");i(this,"isEmailApproved");i(this,"managers");i(this,"curators");this.salesDirection=new _(e==null?void 0:e.salesDirection),this.debt=(e==null?void 0:e.debt)??0,this.alternativeName=(e==null?void 0:e.alternativeName)??"",this.city=new re(e==null?void 0:e.city),this.comment=e==null?void 0:e.comment,this.isPhoneApproved=(e==null?void 0:e.isPhoneApproved)??!1,this.isEmailApproved=(e==null?void 0:e.isEmailApproved)??!1,this.managers=((t=e==null?void 0:e.managers)==null?void 0:t.map(o=>new He(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new je(o)))??void 0}}class he extends N{constructor(e){super(e);i(this,"createdAt");i(this,"deletedAt");i(this,"client");i(this,"priceTemplate");this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new V(e==null?void 0:e.client),this.priceTemplate=new F(e==null?void 0:e.priceTemplate)}}class ze extends lr{constructor(e){super(e);i(this,"product");this.product=new L(e==null?void 0:e.product)}}class pr extends D{}class te extends O{constructor(e){super(e);i(this,"type");i(this,"description");i(this,"metadata");i(this,"isFilterable");this.type=new pr(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata,this.isFilterable=e==null?void 0:e.isFilterable}}class ie{constructor(r){i(this,"property");i(this,"value");this.property=new te(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class dt{constructor(r){i(this,"id");i(this,"name");i(this,"description");i(this,"ownerName");i(this,"createdAt",new S);i(this,"updatedAt",new S);this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.description=r==null?void 0:r.description,this.ownerName=r==null?void 0:r.ownerName,this.createdAt=new S(r==null?void 0:r.createdAt),this.updatedAt=new S(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":case"ownerName":this[r]=void 0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"updatedAt":this.updatedAt.from=null,this.updatedAt.to=null;break}return this}asClearRaw(){var e,t,s,o;const r={};return Object.keys(this).forEach(u=>{const g=this[u];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[u]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((t=r==null?void 0:r.createdAt)!=null&&t.to)&&delete r.createdAt,!((s=r==null?void 0:r.updatedAt)!=null&&s.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class ge extends O{constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");i(this,"subRoles",[]);i(this,"parentRole");i(this,"level",0);this.description=e==null?void 0:e.description,this.canChangeLowCost=(e==null?void 0:e.canChangeLowCost)??!1,this.parentRoleId=e==null?void 0:e.parentRoleId}}class hr{constructor(r){i(this,"role");i(this,"category");i(this,"minCoefficient");this.role=new ge(r==null?void 0:r.role),this.category=new ue(r==null?void 0:r.category),this.minCoefficient=new Se(r==null?void 0:r.minCoefficient)}}class Fr{constructor(r){i(this,"isFake");i(this,"isHidden");i(this,"isMultiple");i(this,"type");i(this,"ord");this.isFake=(r==null?void 0:r.isFake)??!1,this.isHidden=(r==null?void 0:r.isHidden)??!1,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.type=(r==null?void 0:r.type)??null,this.ord=(r==null?void 0:r.ord)??0}}class gr{constructor(r){i(this,"category");i(this,"property");i(this,"settings");this.category=new ue(r==null?void 0:r.category),this.property=new te(r==null?void 0:r.property),this.settings=new Fr(r==null?void 0:r.settings)}}class Er{constructor(r){i(this,"id");i(this,"label");this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??""}}class et{constructor(r){i(this,"id");i(this,"label");i(this,"type");i(this,"ord");i(this,"isMultiple");i(this,"values");i(this,"min");i(this,"max");var e;this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??"",this.type=(r==null?void 0:r.type)??nr.Checkbox,this.ord=(r==null?void 0:r.ord)??0,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.values=((e=r==null?void 0:r.values)==null?void 0:e.map(t=>new Er(t)))??[],this.min=(r==null?void 0:r.min)??null,this.max=(r==null?void 0:r.max)??null}}class Lt extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,t=void 0,s=void 0){let u=`${A().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return t&&(u+=`&category_id=${t}`),s&&(u+=`&client_id=${s}`),u}}class _t extends y{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value})}removeCategoryPrices(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}`)}markCategoryRequired(r,e){return this.post(`/internal/clients/${r}/price/categories/${e}/required`)}unmarkCategoryRequired(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/required`)}markCategoryDisabled(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:t})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:t})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}updateProductPrice(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new W(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,t=>new W(t.data))}markProductRequired(r,e){return this.post(`/internal/clients/${r}/price/products/${e}/required`)}unmarkProductRequired(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}/required`)}getCommercialOfferHtml(r,e){return this.get(`/internal/clients/${r}/price/commercial-offer/view`,e,t=>new Blob([t.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,t=>new Blob([t.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class Nt extends y{getTemplateList(r){return this.getTypedList(he,`/internal/clients/${r}/price/templates`)}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new he(e.data),!0)}attachTemplate(r,e,t){const s=A().config.dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,t&&{startAt:t.startAt&&l.format(t.startAt,s),endAt:t.endAt&&l.format(t.endAt,s)},o=>new he(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,t,s){const o=A().config.dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${t}`,s&&{startAt:s.startAt&&l.format(s.startAt,o),endAt:s.endAt&&l.format(s.endAt,o)},u=>new he(u.data))}detachTemplate(r,e,t){return this.delete(`/internal/clients/${r}/price/templates/${e}/${t}`)}}class qt extends y{getRootCategoriesList(r=!1){return this.getTypedList(j,"/internal/catalog/categories",{showHidden:r})}getCategoryData(r,e=!1,t=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:t},s=>new j(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new j(e.data))}getCategoryProductsList(r,e=!0,t=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:t,withPriceCoefficients:e},s=>p.map(s.data,o=>new L(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:t}=e;return p.forEach(t,s=>s.map(o=>new qe(o))),t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.categories.map(u=>new j(u)))}).catch(o=>{s(o)})})}}class Mt extends q{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},t=>new L(t.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new L(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>p.map(e.data,t=>new qe(t)))}getNewProducts(r,e,t=!0){const s=A().config.dateFormats.api;return this.getTypedPaginated(L,"/internal/catalog/products/new",void 0,void 0,e,{period:{from:l.format(r,s)},withPriceCoefficients:t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.products.map(u=>new L(u)))}).catch(o=>{s(o)})})}}class Ut extends y{getRootCategoriesList(r,e=!1){return this.getTypedList(Te,"/internal/catalog/categories",{clientId:r,showHidden:e})}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:t,withNestedCategories:s},o=>new Te(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:t},o=>p.map(o.data,u=>new W(u)))}}class Ht extends q{getProductData(r,e,t=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:t},s=>new W(s.data))}getNewProducts(r,e,t,s=!0){const o=A().config.dateFormats.api;return this.getTypedPaginated(W,"/internal/catalog/products/new",void 0,void 0,t,{clientId:r,period:{from:l.format(e,o)},withPriceCoefficients:s})}}class Bt extends q{getTemplateList(r,e,t){return this.getTypedPaginated(F,"/internal/price/templates",r,e,t)}createTemplate(r,e={}){return this.post("/internal/price/templates",r,t=>new F(t.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new F(e.data))}updateTemplate(r,e,t={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new F(s.data),t)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.getTypedList(ze,`/internal/price/templates/${r}/products`)}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},t=>new ze(t.data))}saveProductTemplatePrice(r,e,t){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new ze(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.getTypedList(We,`/internal/price/templates/${r}/categories`)}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},t=>new We(t.data))}saveCategoryTemplatePrice(r,e,t,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=t.coefficient)==null?void 0:o.id,increase_percent:t.value},params:s?{recursively:!0}:{}},u=>new We(u.data))}deleteCategoryTemplatePrice(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:t?{recursively:!0}:{}})}getTemplateClients(r){return this.getTypedList(he,`/internal/price/templates/${r}/clients`)}}class Wt extends y{getRoles(){return this.getTypedList(ge,"/internal/price/roles")}createRole(r){return this.post("/internal/price/roles",r,e=>new ge(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new ge(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,t=>new ge(t.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.getTypedList(hr,`/internal/price/roles/rules/categories/${r}`)}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,t=>I.instanceListInitializer(hr,t.data))}}class jt extends q{getProperties(r,e,t){return this.getTypedPaginated(te,"/internal/catalog/properties",r,e,t)}createProperty(r){const{typeId:e,...t}=r;return this.post("/internal/catalog/properties",{...t,type:e},s=>new te(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new te(e.data))}updateProperty(r,e){const{typeId:t,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:t},o=>new te(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.getTypedList(ie,`/internal/catalog/products/${r}/properties`)}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},t=>new ie(t.data))}updateProductProperty(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:t},s=>new ie(s.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,t)}deleteProductFile(r,e){return this.delete(`/internal/catalog/products/${r}/properties/files/${e}`)}updateProductSlug(r,e){return this.patch(`/internal/catalog/products/${r}/properties/slug`,{slug:e})}getCategoryProperties(r){return this.getTypedList(ie,`/internal/catalog/categories/${r}/properties`)}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},t=>new ie(t.data))}updateCategoryProperty(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:t},s=>new ie(s.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,t)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}updateCategoryImage(r,e){return this.post(`/internal/catalog/categories/${r}/image`,{image:e})}getCategoryFilters(r,e=!1){return this.get(`/internal/catalog/categories/${r}/filters`,{recursively:e},t=>t.data.map(s=>new et(s)))}getCategoryFilterSettings(r){return this.getTypedList(gr,`/internal/catalog/categories/${r}/filter-settings`)}saveCategoryFilterSetting(r,e,t){return this.patch(`/internal/catalog/categories/${r}/filter-settings/${e}`,t,s=>new gr(s.data))}deleteCategoryFilterSetting(r,e){return this.delete(`/internal/catalog/categories/${r}/filter-settings/${e}`)}}class zt extends y{getRootCategoriesList(r,e=!1){return this.getTypedList(j,"/internal/catalog/categories",{priceTemplateId:r,showHidden:e})}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{priceTemplateId:r,showHidden:t,withNestedCategories:s},o=>new j(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{priceTemplateId:r,showHidden:s,withPriceCoefficients:t},o=>p.map(o.data,u=>new L(u)))}}function fr(n,r,e){let t;return n.some(s=>{if(s.type===e&&s.id===r)return t=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const u=fr(o.products,r,e);if(u)return t=u,!0}if(o.categories&&o.categories.length>0){const u=fr(o.categories,r,e);if(u)return t=u,!0}return!1}),t}function mr(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const t=e;t.products&&t.products.length>0&&r.push(...mr(t.products)),t.categories&&t.categories.length>0&&r.push(...mr(t.categories))}}),r}var rt=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n.SalesDirection="sales_direction",n.Managers="managers",n.Curators="curators",n))(rt||{}),Y=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(Y||{});class Ye extends N{constructor(e){super(e);i(this,"bankName","");i(this,"bic","");i(this,"accountNumber","");i(this,"correspondentAccount","");i(this,"currency",new M);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new M(e.currency))}}class Ge extends O{constructor(e){super(e);i(this,"phone");i(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class J extends Ge{constructor(e){super(e);i(this,"isPrimary");i(this,"position");i(this,"notDisturb");i(this,"comment");i(this,"updatedAt");i(this,"deletedAt");this.isPrimary=(e==null?void 0:e.isPrimary)??!1,this.position=e==null?void 0:e.position,this.notDisturb=(e==null?void 0:e.notDisturb)??!1,this.comment=e==null?void 0:e.comment,this.updatedAt=e==null?void 0:e.updatedAt,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class x extends D{static generatePersonItem(){return new x({id:1,guid:"",slug:Y.Person,name:""})}}class se extends D{}class yr extends Fe{constructor(e){super(e);i(this,"deletedAt");this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class ar extends yr{constructor(e){super(e);i(this,"opf",x.generatePersonItem());i(this,"partnerGroup",new se);i(this,"contacts",[]);i(this,"bankAccounts",[]);i(this,"comment");i(this,"alternativeName");i(this,"createdAt");i(this,"creator");i(this,"updater");if(e){if(this.opf=new x(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new d(e.creator):void 0,this.updater=e.updater?new d(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new se(e.partnerGroup)),e.contacts){const t=[];e.contacts.forEach(s=>{t.push(new J(s))}),this.contacts=t}if(e.bankAccounts){const t=[];e.bankAccounts.forEach(s=>{t.push(new Ye(s))}),this.bankAccounts=t}}}}class tt extends ar{constructor(r){super(r)}}class wr extends ar{constructor(e){super(e);i(this,"inn","");i(this,"okpo","");i(this,"directorName","");i(this,"directorPosition","");i(this,"directorActsOn","");i(this,"legalAddress","");i(this,"postalAddress","");i(this,"actualAddress","");e&&(this.inn=e.inn??"",this.okpo=e.okpo??"",this.directorName=e.directorName??"",this.directorPosition=e.directorPosition??"",this.directorActsOn=e.directorActsOn??"",this.legalAddress=e.legalAddress??"",this.postalAddress=e.postalAddress??"",this.actualAddress=e.actualAddress??"")}}class vr extends wr{constructor(e){super(e);i(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class it extends vr{constructor(e){super(e);i(this,"registrationCountry",new E);i(this,"registrationNumber","");i(this,"taxNumber","");e&&(this.registrationCountry=new E(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class Ae{static createInstance(r){switch(r.opf.slug){case Y.Ic:return new wr(r);case Y.UlR:return new vr(r);case Y.UlNr:return new it(r);default:return new tt(r)}}}class fe extends yr{constructor(e){var t;super(e);i(this,"address","");i(this,"coordinates");i(this,"contacts");i(this,"comment");i(this,"operatingHours");i(this,"isOneTime");i(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new er(e==null?void 0:e.coordinates),this.contacts=((t=e==null?void 0:e.contacts)==null?void 0:t.map(s=>new J(s)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class Cr extends D{}class Dr extends D{}class Pr extends V{constructor(e){var t,s,o,u;super(e);i(this,"contragents");i(this,"partnerGroups");i(this,"contacts");i(this,"deliveryAddresses");i(this,"channelPrimaryInterest");i(this,"sourcePrimaryInterest");i(this,"preferredDeliveryType");i(this,"primaryDemand");i(this,"preferredWarehouse");i(this,"extraData");this.contragents=((t=e==null?void 0:e.contragents)==null?void 0:t.map(g=>Ae.createInstance(g)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(g=>new se(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new J(g)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(g=>new fe(g)))??[],this.channelPrimaryInterest=new Cr(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Dr(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new B(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new ce(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class Yt extends oe{constructor(e){var t,s,o,u,g,m,a,C;super();i(this,"id");i(this,"guid");i(this,"name");i(this,"alternativeName");i(this,"searchTerm");i(this,"cities");i(this,"region");i(this,"country");i(this,"phone");i(this,"email");i(this,"isActive");i(this,"createdAt",new S);i(this,"lastLoginDate",new S);i(this,"lastLoginDateHasOrder");i(this,"managers");i(this,"includeSubordinateManagers");i(this,"curators");i(this,"isManagerRequired");i(this,"salesDirections");i(this,"contragentInn");i(this,"contragentType");i(this,"preferredDeliveryType");i(this,"partnerGroups");i(this,"contact");i(this,"lastOrder");i(this,"noOrdersPeriod",new S);this.id=e==null?void 0:e.id,this.guid=e==null?void 0:e.guid,this.name=e==null?void 0:e.name,this.alternativeName=e==null?void 0:e.alternativeName,this.searchTerm=e==null?void 0:e.searchTerm,this.cities=(t=e==null?void 0:e.cities)==null?void 0:t.map(P=>new re(P)),this.region=new ee(e==null?void 0:e.region),this.country=new E(e==null?void 0:e.country),this.phone=e==null?void 0:e.phone,this.email=e==null?void 0:e.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,"isActive")?e==null?void 0:e.isActive:!0,this.createdAt=new S(e==null?void 0:e.createdAt),this.lastLoginDate=new S(e==null?void 0:e.lastLoginDate),this.lastLoginDateHasOrder=(e==null?void 0:e.lastLoginDateHasOrder)??void 0,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(P=>new z(P)))??[],this.includeSubordinateManagers=(e==null?void 0:e.includeSubordinateManagers)??!0,this.curators=((o=e==null?void 0:e.curators)==null?void 0:o.map(P=>new je(P)))??[],this.salesDirections=(u=e==null?void 0:e.salesDirections)==null?void 0:u.map(P=>new _(P)),this.contragentInn=e==null?void 0:e.contragentInn,this.contragentType=new x(e==null?void 0:e.contragentType),this.preferredDeliveryType=e!=null&&e.preferredDeliveryType?new B(e==null?void 0:e.preferredDeliveryType):void 0,this.partnerGroups=(g=e==null?void 0:e.partnerGroups)==null?void 0:g.map(P=>new se(P)),this.contact=new Ge(e==null?void 0:e.contact),this.lastOrder={createdAt:new S((m=e==null?void 0:e.lastOrder)==null?void 0:m.createdAt),creator:(a=e==null?void 0:e.lastOrder)==null?void 0:a.creator,isApproved:(C=e==null?void 0:e.lastOrder)==null?void 0:C.isApproved},this.noOrdersPeriod=new S(e==null?void 0:e.noOrdersPeriod)}resetFilterValue(e){switch(e){case"cities":this.cities=[];break;case"region":this.region=new ee;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"noOrdersPeriod":this.noOrdersPeriod.from=null,this.noOrdersPeriod.to=null;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new x;break;case"preferredDeliveryType":this.preferredDeliveryType=new B;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Ge;break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,u,g,m;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.lastLoginDate)!=null&&o.from)&&!((u=e==null?void 0:e.lastLoginDate)!=null&&u.to)&&delete e.lastLoginDate,!((g=e==null?void 0:e.noOrdersPeriod)!=null&&g.from)&&!((m=e==null?void 0:e.noOrdersPeriod)!=null&&m.to)&&delete e.noOrdersPeriod,e}}class Rr extends N{constructor(e){super(e);i(this,"createdAt");i(this,"creator");this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new d(e==null?void 0:e.creator)}}class st extends O{constructor(e){var t,s,o,u;super(e);i(this,"contacts",[]);i(this,"preferredDeliveryType");i(this,"partnerGroups",[]);i(this,"lastOrder");i(this,"salesDirection");i(this,"managers");i(this,"curators");this.contacts=((t=e.contacts)==null?void 0:t.map(g=>new J(g)))??void 0,this.lastOrder=e.lastOrder?new Rr(e.lastOrder):void 0,this.partnerGroups=((s=e.partnerGroups)==null?void 0:s.map(g=>new se(g)))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new B(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new _(e.salesDirection):void 0,this.managers=((o=e.managers)==null?void 0:o.map(g=>new He(g)))??void 0,this.curators=((u=e.curators)==null?void 0:u.map(g=>new je(g)))??void 0}}class Qe extends N{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=e.isPrimary}}class nt extends J{constructor(e){super(e);i(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(t=>new Qe(t))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(t=>new Qe(t))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(t=>new Qe(t))))}}class U extends q{static transformClientDataToRequest(r){var t;return{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(s=>s.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,preferred_warehouse_id:(t=r.preferredWarehouse)==null?void 0:t.id}}static transformContragentClientDataToRequest(r){var u,g,m,a;let e;const t=r,s=r,o=r;switch(r.opf.slug){case Y.Ic:e={opf:t.opf.slug,name:t.name,alternative_name:t.alternativeName,partner_group_id:(u=t.partnerGroup)==null?void 0:u.id,comment:t.comment,inn:t.inn,okpo:t.okpo,director_name:t.directorName,director_position:t.directorPosition,director_acts_on:t.directorActsOn,legal_address:t.legalAddress,postal_address:t.postalAddress,actual_address:t.actualAddress};break;case Y.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(g=s.partnerGroup)==null?void 0:g.id,comment:s.comment,inn:s.inn,kpp:s.kpp,okpo:s.okpo,director_name:s.directorName,director_position:s.directorPosition,director_acts_on:s.directorActsOn,legal_address:s.legalAddress,postal_address:s.postalAddress,actual_address:s.actualAddress};break;case Y.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(m=o.partnerGroup)==null?void 0:m.id,comment:o.comment,director_name:o.directorName,director_position:o.directorPosition,director_acts_on:o.directorActsOn,legal_address:o.legalAddress,postal_address:o.postalAddress,actual_address:o.actualAddress,registration_country_id:o.registrationCountry.id,registration_number:o.registrationNumber,tax_number:o.taxNumber||void 0};break;default:e={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:(a=r.partnerGroup)==null?void 0:a.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var t,s;const e={address:r.address,is_one_time:r.isOneTime??!1,is_transport_company_address:r.isTransportCompanyAddress??!1,comment:r.comment??""};return r.coordinates&&(e.coordinates={lat:(t=r.coordinates)==null?void 0:t.lat,long:(s=r.coordinates)==null?void 0:s.long}),r.operatingHours&&(e.operating_hours={from:r.operatingHours.from,to:r.operatingHours.to}),e}static transformClientContragentBankAccountToRequest(r){return{bank_name:r.bankName,bic:r.bic,account_number:r.accountNumber,correspondent_account:r.correspondentAccount,currency_id:r.currency.id}}getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new Pr(e.data))}getClientsList(r,e,t,s,o=void 0){return this.getTypedPaginated(V,"/internal/clients",r,e,t,s,void 0,o)}searchClient(r){return this.getClientsList(void 0,void 0,void 0,{searchTerm:r}).then(e=>e.data)}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:_e.Contains,value:r}]})}getAdditionalClientsData(r,e){const t=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:t,requested_data_types:e},s=>I.instanceListInitializer(st,s.data))}getAllClientContacts(r){return this.getTypedList(nt,`/internal/clients/${r}/contacts/all`)}createClientCommonData(r,e={}){return this.post("/internal/clients",U.transformClientDataToRequest(r),t=>new Pr(t.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,U.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const t={get_news:r.getNews};return this.patch(`/internal/clients/${r.id}`,t,void 0,e)}changeClientPassword(r,e,t,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:t},void 0,s)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(t)}async detachClientFromManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(t)}attachToCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:t.id})}detachFromCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:t.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(t=>({curator_id:t.curatorId,curated_direction_id:t.curatedDirection.id}))})}createContragentClientData(r,e,t={}){return this.post(`/internal/clients/${r}/contragents`,U.transformContragentClientDataToRequest(e),s=>Ae.createInstance(s.data),t)}updateContragentClientData(r,e,t={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,U.transformContragentClientDataToRequest(e),s=>Ae.createInstance(s.data),t)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}getClientDeliveryAddresses(r){return this.getTypedList(fe,`/internal/clients/${r}/delivery-addresses`)}createClientDeliveryAddress(r,e,t={}){return this.post(`/internal/clients/${r}/delivery-addresses`,U.transformClientDeliveryAddressToRequest(e),s=>new fe(s.data),t)}updateClientDeliveryAddress(r,e,t={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,U.transformClientDeliveryAddressToRequest(e),s=>new fe(s.data),t)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,t,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,U.transformClientContragentBankAccountToRequest(t),o=>new Ye(o.data),s)}updateContragentBankAccount(r,e,t,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`,U.transformClientContragentBankAccountToRequest(t),o=>new Ye(o.data),s)}deleteContragentBankAccount(r,e,t){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`)}createClientContact(r,e,t={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},t)}updateClientContact(r,e,t={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},s=>new J(s.data),t)}setPrimaryClientContact(r,e){return this.setPrimaryContact(`/internal/clients/${r}/contacts/${e.id}/primary`,e.isPrimary??!1)}detachClientContact(r,e){return this.detachContact(`/internal/clients/${r}/contacts/${e.id}/detach`)}createContragentContact(r,e,t,s={}){return this.createContact(r,t,{contragents:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachContragentContact(r,e,t){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/detach`)}createDeliveryAddressContact(r,e,t,s={}){return this.createContact(r,t,{addresses:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachDeliveryAddressContact(r,e,t){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/detach`)}createContact(r,e,t,s={}){var u,g;const o={name:e.name,position:e.position,comment:e.comment,...t};return(u=e.phone)!=null&&u.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,m=>new J(m.data),s)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class Gt extends y{checkPhoneIsBusy(r){return new Promise((e,t)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(t)})}}class Qt{constructor(r){i(this,"date");i(this,"name");i(this,"version");this.date=p.isString(r==null?void 0:r.date)?l.parseISO(r.date):(r==null?void 0:r.date)??new Date,this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}var ot=(n=>(n.Kozyrek="kozyrek",n.Mosquitto="mosquitto",n.Strip="strip",n.MetalForDoors="metal_for_doors",n.Sandwich="sandwich",n.SandwichM2="sandwich_m2",n))(ot||{});class Vt extends y{getConfiguratorSettings(r,e){var t;return this.get(`internal/catalog/categories/${r.id}/configurators/${(t=r.properties)==null?void 0:t.configurator}/settings?client_id=${e}`)}searchProduct(r,e,t,s={}){var u;const o=this.get(`internal/catalog/categories/${r.id}/configurators/${(u=r.properties)==null?void 0:u.configurator}/product`,{params:t,client_id:e},g=>new L(g.data));return o.catch(g=>{this.errorResponseHandler(g,s)}),o}createTemplate(r,e,t,s={}){var o;return this.post(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/template?client_id=${e}`,{...t},()=>{},s)}removeTemplate(r,e,t){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template/${t}?client_id=${e}`)}calculate(r,e,t){var s;return this.get(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/calculate`,{client_id:e,...t})}}class ct{constructor(r){i(this,"page",1);i(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class Jt extends ct{constructor(e){super(e);i(this,"itemCount",0);i(this,"pageCount",1);i(this,"pageSlot",5);i(this,"pageSizes",[25,50,100]);i(this,"showSizePicker",!0);this.itemCount=(e==null?void 0:e.itemCount)??0,this.pageCount=(e==null?void 0:e.pageCount)??1,this.pageSlot=(e==null?void 0:e.pageSlot)??5,this.pageSizes=(e==null?void 0:e.pageSizes)??[25,50,100],this.showSizePicker=(e==null?void 0:e.showSizePicker)??!0}}class xt{constructor(r){i(this,"field");i(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class v{static decadeInterval(r){const[e,t]=v.shiftedDecadeBounds(r,0);return{from:e,to:t}}static shiftDecadeInterval(r,e){const[t,s]=v.shiftedDecadeBounds(r,e);return{from:t,to:s}}static startOfHalfYear(r){return new Date(r.getFullYear(),r.getMonth()<6?0:6,1)}static endOfHalfYear(r){return l.endOfMonth(new Date(r.getFullYear(),r.getMonth()<6?5:11,1))}static addHalfYears(r,e){return l.addMonths(r,e*6)}static intervalTillSameDate(r,e,t){const s=l.differenceInCalendarMonths(l.startOfMonth(t),l.startOfMonth(r)),o=l.startOfMonth(l.addMonths(e,s)),u=Math.min(l.getDate(t),l.getDaysInMonth(o));return{from:l.startOfDay(e),to:l.endOfDay(l.setDate(o,u))}}static weekTillSameWeekday(r,e){const t=l.startOfWeek(l.addWeeks(r,e),{weekStartsOn:1}),s=l.differenceInCalendarDays(r,l.startOfWeek(r,{weekStartsOn:1}));return{from:t,to:l.endOfDay(l.addDays(t,s))}}static decadeTillSameDayNumber(r,e){const[t]=v.shiftedDecadeBounds(r,0),s=l.differenceInCalendarDays(r,t)+1,[o,u]=v.shiftedDecadeBounds(r,e),g=l.differenceInCalendarDays(u,o)+1;return{from:o,to:l.endOfDay(l.addDays(o,Math.min(s,g)-1))}}static shiftedDecadeBounds(r,e){const t=l.getDate(r);let s=2;t<=10?s=0:t<=20&&(s=1);const o=s+e,u=Math.floor(o/3),g=(o%3+3)%3,m=l.startOfMonth(l.addMonths(r,u)),a=l.addDays(m,g*10),C=g===2?l.endOfMonth(m):l.endOfDay(l.addDays(a,9));return[a,C]}}class Ve{static parse(r){if(p.isNil(r))return;const e=p.isString(r)?l.parseISO(r):r;return l.isValid(e)?e:void 0}}class Kt{static defaultDateRanges(r){const e=l.addBusinessDays(new Date,1),t=new Date,s=l.startOfYear(r===void 0?t:new Date(r,0,1)),o=l.endOfYear(s);return{nextWorkingDay:{label:"Следующий рабочий день",from:l.startOfDay(e),to:l.endOfDay(e)},today:{label:"Сегодня",from:l.startOfToday(),to:l.endOfToday()},yesterday:{label:"Вчера",from:l.startOfYesterday(),to:l.endOfYesterday()},tomorrow:{label:"Завтра",from:l.startOfTomorrow(),to:l.endOfTomorrow()},currentWeek:{label:"Неделя",from:l.startOfWeek(t,{weekStartsOn:1}),to:l.endOfWeek(t,{weekStartsOn:1})},currentMonth:{label:"Месяц",from:l.startOfMonth(t),to:l.endOfMonth(t)},oneMonth:{label:"1 месяц",from:s,to:l.endOfMonth(s)},threeMonths:{label:"3 месяца",from:s,to:l.endOfMonth(l.addMonths(s,2))},nineMonths:{label:"9 месяцев",from:s,to:l.endOfMonth(l.addMonths(s,8))},firstQuarter:{label:"I квартал",from:s,to:l.endOfMonth(l.addMonths(s,2))},secondQuarter:{label:"II квартал",from:l.addMonths(s,3),to:l.endOfMonth(l.addMonths(s,5))},thirdQuarter:{label:"III квартал",from:l.addMonths(s,6),to:l.endOfMonth(l.addMonths(s,8))},fourthQuarter:{label:"IV квартал",from:l.addMonths(s,9),to:l.endOfMonth(l.addMonths(s,11))},firstHalfYear:{label:"I полугодие",from:s,to:l.endOfMonth(l.addMonths(s,5))},secondHalfYear:{label:"II полугодие",from:l.addMonths(s,6),to:o},currentYear:{label:"12 месяцев",from:s,to:o}}}static standardPeriods(r=new Date){const e={weekStartsOn:1},t=l.startOfDay(r),s=l.endOfDay(r),o=v.decadeInterval(r),u=l.startOfMonth(r),g=l.startOfQuarter(r),m=v.startOfHalfYear(r),a=l.startOfYear(r),C=v.addHalfYears(r,-1),P=v.addHalfYears(r,1);return{yesterday:{label:"Вчера",group:"day",from:l.startOfDay(l.subDays(r,1)),to:l.endOfDay(l.subDays(r,1))},today:{label:"Сегодня",group:"day",from:t,to:s},tomorrow:{label:"Завтра",group:"day",from:l.startOfDay(l.addDays(r,1)),to:l.endOfDay(l.addDays(r,1))},lastWeek:{label:"Прошлая неделя",group:"week",from:l.startOfWeek(l.subWeeks(r,1),e),to:l.endOfWeek(l.subWeeks(r,1),e)},thisWeek:{label:"Эта неделя",group:"week",from:l.startOfWeek(r,e),to:l.endOfWeek(r,e)},nextWeek:{label:"Следующая неделя",group:"week",from:l.startOfWeek(l.addWeeks(r,1),e),to:l.endOfWeek(l.addWeeks(r,1),e)},lastTenDays:{label:"Прошлая декада",group:"decade",...v.shiftDecadeInterval(r,-1)},thisTenDays:{label:"Эта декада",group:"decade",...o},nextTenDays:{label:"Следующая декада",group:"decade",...v.shiftDecadeInterval(r,1)},lastMonth:{label:"Прошлый месяц",group:"month",from:l.startOfMonth(l.subMonths(r,1)),to:l.endOfMonth(l.subMonths(r,1))},thisMonth:{label:"Этот месяц",group:"month",from:u,to:l.endOfMonth(r)},nextMonth:{label:"Следующий месяц",group:"month",from:l.startOfMonth(l.addMonths(r,1)),to:l.endOfMonth(l.addMonths(r,1))},lastQuarter:{label:"Прошлый квартал",group:"quarter",from:l.startOfQuarter(l.subQuarters(r,1)),to:l.endOfQuarter(l.subQuarters(r,1))},thisQuarter:{label:"Этот квартал",group:"quarter",from:g,to:l.endOfQuarter(r)},nextQuarter:{label:"Следующий квартал",group:"quarter",from:l.startOfQuarter(l.addQuarters(r,1)),to:l.endOfQuarter(l.addQuarters(r,1))},lastHalfYear:{label:"Прошлое полугодие",group:"halfYear",from:v.startOfHalfYear(C),to:v.endOfHalfYear(C)},thisHalfYear:{label:"Это полугодие",group:"halfYear",from:m,to:v.endOfHalfYear(r)},nextHalfYear:{label:"Следующее полугодие",group:"halfYear",from:v.startOfHalfYear(P),to:v.endOfHalfYear(P)},lastYear:{label:"Прошлый год",group:"year",from:l.startOfYear(l.subYears(r,1)),to:l.endOfYear(l.subYears(r,1))},thisYear:{label:"Этот год",group:"year",from:a,to:l.endOfYear(r)},nextYear:{label:"Следующий год",group:"year",from:l.startOfYear(l.addYears(r,1)),to:l.endOfYear(l.addYears(r,1))},fromBeginningOfThisWeek:{label:"С начала этой недели",group:"other",section:"fromBeginning",from:l.startOfWeek(r,e),to:s},fromBeginningOfThisTenDays:{label:"С начала этой декады",group:"other",section:"fromBeginning",from:o.from,to:s},fromBeginningOfThisMonth:{label:"С начала этого месяца",group:"other",section:"fromBeginning",from:u,to:s},fromBeginningOfThisQuarter:{label:"С начала этого квартала",group:"other",section:"fromBeginning",from:g,to:s},fromBeginningOfThisHalfYear:{label:"С начала этого полугодия",group:"other",section:"fromBeginning",from:m,to:s},fromBeginningOfThisYear:{label:"С начала этого года",group:"other",section:"fromBeginning",from:a,to:s},tillEndOfThisWeek:{label:"До конца этой недели",group:"other",section:"tillEnd",from:t,to:l.endOfWeek(r,e)},tillEndOfThisTenDays:{label:"До конца этой декады",group:"other",section:"tillEnd",from:t,to:o.to},tillEndOfThisMonth:{label:"До конца этого месяца",group:"other",section:"tillEnd",from:t,to:l.endOfMonth(r)},tillEndOfThisQuarter:{label:"До конца этого квартала",group:"other",section:"tillEnd",from:t,to:l.endOfQuarter(r)},tillEndOfThisHalfYear:{label:"До конца этого полугодия",group:"other",section:"tillEnd",from:t,to:v.endOfHalfYear(r)},tillEndOfThisYear:{label:"До конца этого года",group:"other",section:"tillEnd",from:t,to:l.endOfYear(r)},lastWeekTillSameWeekDay:{label:"Прошлая неделя, до такого же дня недели",group:"other",section:"lastTillSame",...v.weekTillSameWeekday(r,-1)},lastTenDaysTillSameDayNumber:{label:"Прошлая декада, до такого же номера дня",group:"other",section:"lastTillSame",...v.decadeTillSameDayNumber(r,-1)},lastMonthTillSameDate:{label:"Прошлый месяц, до такой же даты",group:"other",section:"lastTillSame",...v.intervalTillSameDate(u,l.startOfMonth(l.subMonths(r,1)),r)},lastQuarterTillSameDate:{label:"Прошлый квартал, до такой же даты",group:"other",section:"lastTillSame",...v.intervalTillSameDate(g,l.startOfQuarter(l.subQuarters(r,1)),r)},lastHalfYearTillSameDate:{label:"Прошлое полугодие, до такой же даты",group:"other",section:"lastTillSame",...v.intervalTillSameDate(m,v.startOfHalfYear(C),r)},lastYearTillSameDate:{label:"Прошлый год, до такой же даты",group:"other",section:"lastTillSame",...v.intervalTillSameDate(a,l.startOfYear(l.subYears(r,1)),r)},nextWeekTillSameWeekDay:{label:"Следующая неделя, до такого же дня недели",group:"other",section:"nextTillSame",...v.weekTillSameWeekday(r,1)},nextTenDaysTillSameDayNumber:{label:"Следующая декада, до такого же номера дня",group:"other",section:"nextTillSame",...v.decadeTillSameDayNumber(r,1)},nextMonthTillSameDate:{label:"Следующий месяц, до такой же даты",group:"other",section:"nextTillSame",...v.intervalTillSameDate(u,l.startOfMonth(l.addMonths(r,1)),r)},nextQuarterTillSameDate:{label:"Следующий квартал, до такой же даты",group:"other",section:"nextTillSame",...v.intervalTillSameDate(g,l.startOfQuarter(l.addQuarters(r,1)),r)},nextHalfYearTillSameDate:{label:"Следующее полугодие, до такой же даты",group:"other",section:"nextTillSame",...v.intervalTillSameDate(m,v.startOfHalfYear(P),r)},nextYearTillSameDate:{label:"Следующий год, до такой же даты",group:"other",section:"nextTillSame",...v.intervalTillSameDate(a,l.startOfYear(l.addYears(r,1)),r)},last7Days:{label:"Последние 7 дней",group:"other",section:"rollingDays",from:l.startOfDay(l.subDays(r,6)),to:s},next7Days:{label:"Следующие 7 дней",group:"other",section:"rollingDays",from:t,to:l.endOfDay(l.addDays(r,6))}}}}const Xt=[{key:"day",label:"День"},{key:"week",label:"Неделя"},{key:"decade",label:"Декада"},{key:"month",label:"Месяц"},{key:"quarter",label:"Квартал"},{key:"halfYear",label:"Полугодие"},{key:"year",label:"Год"},{key:"other",label:"Прочее"}],Zt=[{key:"fromBeginning",label:"С начала периода"},{key:"tillEnd",label:"До конца периода"},{key:"lastTillSame",label:"Прошлые, до такой же даты"},{key:"nextTillSame",label:"Следующие, до такой же даты"},{key:"rollingDays",label:"7 дней"}];class Sr{static productIsMeasurable(r){return r.unit.isLinear||r.unit.isSquare}static getProductMultiplicity(r){var e,t;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((t=r.properties)==null?void 0:t.minCount)!=null&&!Sr.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,t,s;return((e=r.properties)==null?void 0:e.lengthStep)!=null?r.properties.lengthStep:!((t=r.properties)!=null&&t.ignoreMinCountCheck)&&((s=r.properties)==null?void 0:s.minCount)!=null?r.properties.minCount:.01}}const ae=class ae extends y{constructor(){super();i(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=A().config.http.responseDataCacheTimeout}static getCachedResponse(e){const t=ae.responseDataCache.get(e);if(t&&t.validTo>new Date)return t.val}cacheResponse(e,t){ae.responseDataCache.set(e,{validTo:l.addSeconds(new Date,this.responseDataCacheTimeout),val:t})}getTypedDataArrayRequester(e,t,s=!1,o={},u=void 0){const g=t+(p.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),m=s?ae.getCachedResponse(g):void 0;return m?Promise.resolve(m):this.getTypedList(e,t,o,!1,u).then(a=>(s&&a&&this.cacheResponse(g,a),a))}};i(ae,"responseDataCache",new Map);let me=ae;function Ft(n,r){const e=[2,0,1,1,1,2],t=Math.floor(Math.abs(n));return r[t%100>4&&t%100<20?2:e[Math.min(t%10,5)]]}class Et{static generateUndefinedManagerInstance(){return new z({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class br extends me{async getManagers(){const r="/internal/managers",e=me.getCachedResponse(r);if(e)return e;const t=await this.get(r),s=I.instanceListInitializer(z,t.data);return this.cacheResponse(r,s),s}getManager(r){return this.get(`/internal/managers/${r}`,{},e=>new z(e.data))}}var ye=(n=>(n.Processing="processing",n.Completed="completed",n.Error="error",n.NeedsActualization="needs_actualization",n))(ye||{});class lt{constructor(r){i(this,"status");i(this,"actualizedAt");i(this,"expiresAt");i(this,"error");this.status=(r==null?void 0:r.status)??ye.Processing,this.actualizedAt=Ve.parse(r==null?void 0:r.actualizedAt),this.expiresAt=Ve.parse(r==null?void 0:r.expiresAt),this.error=r==null?void 0:r.error}get isProcessing(){return this.status===ye.Processing}get isOutdated(){return this.isOutdatedAt(new Date)}get isOrderAllowed(){return this.isOrderAllowedAt(new Date)}isOutdatedAt(r){return this.status!==ye.Completed||p.isNil(this.actualizedAt)?!0:!p.isNil(this.expiresAt)&&this.expiresAt.getTime()<r.getTime()}isOrderAllowedAt(r){return this.status===ye.Completed&&!this.isOutdatedAt(r)}}class Tr extends N{constructor(e){super(e);i(this,"name");i(this,"createdAt");i(this,"client");i(this,"sum");i(this,"isProfstroy");i(this,"actualization");i(this,"file");this.name=e==null?void 0:e.name,this.createdAt=Ve.parse(e==null?void 0:e.createdAt)??new Date,this.client=new V(e==null?void 0:e.client),this.sum=e==null?void 0:e.sum,this.isProfstroy=e==null?void 0:e.isProfstroy,this.actualization=(e==null?void 0:e.actualization)&&new lt(e.actualization),this.file=e==null?void 0:e.file}}class ut extends sr{constructor(e){super(e);i(this,"groupName");i(this,"supplierSku");i(this,"isIgnored");i(this,"lineError");this.groupName=e.groupName,this.supplierSku=e.supplierSku??e.product.supplierSku,this.isIgnored=e.isIgnored,this.lineError=e.lineError}get isProductStub(){return p.isNil(this.product.id)}get isOrderable(){return!this.isProductStub&&!this.isIgnored&&p.isEmpty(this.lineError)}}class H extends Tr{constructor(e){super(e);i(this,"sum");i(this,"products");this.sum=e.sum??0,this.products=(e.products??[]).map(t=>e.isProfstroy?new ut(t):new sr(t))}}class ei extends oe{constructor(e){super();i(this,"id");i(this,"clientSearchTerm");i(this,"name");i(this,"createdAt",new S);this.id=e==null?void 0:e.id,this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.name=e==null?void 0:e.name,this.createdAt=new S(e==null?void 0:e.createdAt)}resetFilterValue(e){return e==="createdAt"?(this.createdAt.from=null,this.createdAt.to=null):this[e]=void 0,this}asClearRaw(){var t,s;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,e}}class Oe extends D{}class Ar extends Rr{constructor(e){var t,s,o,u,g,m,a,C;super(e);i(this,"client");i(this,"payment");i(this,"delivery");i(this,"attachedUser");i(this,"status");i(this,"statusDetail");i(this,"salesDirection");i(this,"attachedAt");i(this,"isOnOrder");i(this,"isProfstroy");i(this,"isNotInStock");i(this,"sum");i(this,"isLargeOrder");this.client=new V(e==null?void 0:e.client),this.payment={type:((t=e==null?void 0:e.payment)==null?void 0:t.type)??-1,status:((s=e==null?void 0:e.payment)==null?void 0:s.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((u=e==null?void 0:e.delivery)==null?void 0:u.type)??-1,date:p.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?l.parseISO(e.delivery.date):((m=e==null?void 0:e.delivery)==null?void 0:m.date)??new Date,address:(a=e==null?void 0:e.delivery)!=null&&a.address?new fe(e.delivery.address):void 0,warehouse:(C=e==null?void 0:e.delivery)!=null&&C.warehouse?new ce(e.delivery.warehouse):void 0},this.attachedUser=e!=null&&e.attachedUser?new d(e==null?void 0:e.attachedUser):void 0,this.status=new Oe(e==null?void 0:e.status),this.statusDetail=e!=null&&e.statusDetail?new D(e.statusDetail):void 0,this.salesDirection=new _(e==null?void 0:e.salesDirection),this.attachedAt=p.isString(e==null?void 0:e.attachedAt)?l.parseISO(e.attachedAt):e==null?void 0:e.attachedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isProfstroy=(e==null?void 0:e.isProfstroy)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1,this.sum=(e==null?void 0:e.sum)??0,this.isLargeOrder=(e==null?void 0:e.isLargeOrder)??!1}}class pt extends ir{constructor(e,t){super(e);i(this,"product");i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");i(this,"changedFields",[]);i(this,"replacement");this.product=new W(e.product),this.currency=new M(e.currency),this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=p.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,t&&(this.replacement=t,this.quantity!==t.quantity&&this.changedFields.push("quantity"),this.length!==t.length&&this.changedFields.push("length"))}}class $ extends Ar{constructor(e){var t;super(e);i(this,"products");i(this,"invoices");i(this,"comment");i(this,"image");i(this,"contragent");i(this,"barcode");i(this,"orderSource");i(this,"isAllowProcessingWithoutPayment");i(this,"nextStatuses");i(this,"actions");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"erpOrderUrl");this.products=(e.products??[]).map(s=>{var u;const o=s.replacementId?(u=e.products)==null?void 0:u.find(g=>g.id===s.replacementId):void 0;return new pt(s,o)}),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?Ae.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new D(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment,this.nextStatuses=(t=e.nextStatuses)==null?void 0:t.map(s=>new Oe(s)),this.actions=e.actions,this.operatorsComment=e.operatorsComment,this.operatorsForWarehouseComment=e.operatorsForWarehouseComment,this.erpOrderUrl=e.erpOrderUrl}}class ri extends q{getOffers(r,e,t,s=void 0){return this.getTypedPaginated(Tr,"/internal/orders/offers",r,e,t,{},void 0,s)}createOfferFromCart(r,e,t){return this.post(`/internal/orders/offers/${r}`,{name:e,items:t!=null&&t.length?t:void 0},s=>new H(s.data))}createProfstroyOffer(r,e,t,s={}){return this.post(`/internal/orders/offers/${r}/profstroy`,{file:e,name:t},o=>new H(o.data),s)}actualizeProfstroyOffer(r){return this.post(`/internal/orders/offers/${r}/profstroy/actualize`,{},e=>new H(e.data))}reloadProfstroyOffer(r){return this.post(`/internal/orders/offers/${r}/profstroy/reload`,{},e=>new H(e.data))}getOffer(r){return this.get(`/internal/orders/offers/${r}`,{},e=>new H(e.data))}updateOffer(r,e){return this.patch(`/internal/orders/offers/${r}`,{name:e},t=>new H(t.data))}deleteOffer(r){return this.delete(`/internal/orders/offers/${r}`)}createOrderFromDraft(r,e,t,s={}){const o=A().config.dateFormats.api;return this.post(`/internal/orders/offers/${r}/create-order`,{...e,deliveryDate:e.deliveryDate?l.format(e.deliveryDate,o):void 0,items:t!=null&&t.length?t:void 0},u=>I.instanceListInitializer($,u.data),s)}addOfferProduct(r,e,t={}){return this.post(`/internal/orders/offers/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new H(s.data),t)}patchOfferProduct(r,e,t,s={}){return this.patch(`/internal/orders/offers/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},o=>new H(o.data),s)}deleteOfferProduct(r,e){return this.delete(`/internal/orders/offers/${r}/products/${e}`,t=>new H(t.data))}getOfferHtml(r,e){return this.get(`/internal/orders/offers/${r}/view`,e?{recipientText:e}:{},t=>new Blob([t.data],{type:"text/html"}))}getOfferPdf(r,e){return this.getBlob(`/internal/orders/offers/${r}/download`,e?{recipientText:e}:{},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOffer(r,e){return this.post(`/internal/orders/offers/${r}/send`,e)}}class ti{static isProfstroy(r){return!!(r!=null&&r.isProfstroy)}static isProfstroyOffer(r){return!p.isNil(r)&&r.isProfstroy===!0&&!p.isNil(r.actualization)}}var ht=(n=>(n.View="view",n.Share="share",n.EditTags="edit_tags",n.SaveOrderIgnoredProducts="save_order_ignored_products",n.ChangeStatus="change_status",n.ChangeProducts="change_products",n.ChangeOrderParameters="change_order_parameters",n.Recalculate="recalculate",n.AttachOrder="attach_order",n.DetachOrder="detach_order",n.ChangeAttachedOperator="change_attached_operator",n.SendOnlinePaymentLink="send_online_payment_link",n.ConfirmOnlineFullPayment="confirm_online_full_payment",n.MergeOrders="merge_orders",n.GetHistory="get_history",n.CloneOrder="clone_order",n.DeleteAttachedFile="delete_attached_file",n))(ht||{});class ii{constructor(r){i(this,"paymentType");i(this,"deliveryType");i(this,"contragentId");i(this,"deliveryDate");i(this,"addressId");i(this,"warehouseId");i(this,"image");i(this,"comment");i(this,"barcode");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"additionalEmails");i(this,"isAllowProcessingWithoutPayment");i(this,"isAdditionalSale");var e,t,s;this.paymentType=r==null?void 0:r.payment.type,this.deliveryType=r==null?void 0:r.delivery.type,this.contragentId=(e=r==null?void 0:r.contragent)==null?void 0:e.id,this.deliveryDate=r!=null&&r.delivery.date?new Date(r.delivery.date):void 0,this.addressId=(t=r==null?void 0:r.delivery.address)==null?void 0:t.id,this.warehouseId=(s=r==null?void 0:r.delivery.warehouse)==null?void 0:s.id,this.comment=r==null?void 0:r.comment,this.barcode=r==null?void 0:r.barcode,this.operatorsComment=r==null?void 0:r.operatorsComment,this.operatorsForWarehouseComment=r==null?void 0:r.operatorsForWarehouseComment,this.isAllowProcessingWithoutPayment=r==null?void 0:r.isAllowProcessingWithoutPayment}}class Or extends D{}class $r extends D{}class si extends oe{constructor(e){var t,s,o,u;super();i(this,"attachedUsers");i(this,"clientSearchTerm");i(this,"client");i(this,"contragent");i(this,"createdAt",new S);i(this,"creator");i(this,"deliveryDate",new S);i(this,"deliveryAddressSearch");i(this,"clientCities");i(this,"id");i(this,"isApproved");i(this,"isNotInStock");i(this,"isOnOrder");i(this,"attachedAt",new S);i(this,"salesDirections");i(this,"status");i(this,"statusDetail");i(this,"deliveryType");i(this,"paymentType");i(this,"warehouses");i(this,"isLargeOrder");i(this,"isToProcess");i(this,"onlyMyRegions");this.attachedUsers=(t=e==null?void 0:e.attachedUsers)==null?void 0:t.map(g=>"isActive"in g?new z(g):new Or(g)),this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.client=e!=null&&e.client?new V(e.client):void 0,this.contragent=e==null?void 0:e.contragent,this.createdAt=new S(e==null?void 0:e.createdAt),this.creator=e!=null&&e.creator?new d(e.creator):void 0,this.deliveryDate=new S(e==null?void 0:e.deliveryDate),this.deliveryAddressSearch=e==null?void 0:e.deliveryAddressSearch,this.clientCities=(s=e==null?void 0:e.clientCities)==null?void 0:s.map(g=>new re(g)),this.id=e==null?void 0:e.id,this.isApproved=e==null?void 0:e.isApproved,this.isNotInStock=e==null?void 0:e.isNotInStock,this.isOnOrder=e==null?void 0:e.isOnOrder,this.isLargeOrder=e==null?void 0:e.isLargeOrder,this.attachedAt=new S(e==null?void 0:e.attachedAt),this.salesDirections=(o=e==null?void 0:e.salesDirections)==null?void 0:o.map(g=>new _(g)),this.status=e==null?void 0:e.status,this.statusDetail=e==null?void 0:e.statusDetail,this.deliveryType=e!=null&&e.deliveryType?new B(e.deliveryType):void 0,this.paymentType=e!=null&&e.paymentType?new $r(e.paymentType):void 0,this.warehouses=(u=e==null?void 0:e.warehouses)==null?void 0:u.map(g=>new ce(g)),this.isToProcess=e==null?void 0:e.isToProcess}resetFilterValue(e){switch(e){case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"creator":this.creator=void 0;break;case"deliveryDate":this.deliveryDate.from=null,this.deliveryDate.to=null;break;case"deliveryType":this.deliveryType=new B;break;case"clientCities":this.clientCities=[];break;case"attachedAt":this.attachedAt.from=null,this.attachedAt.to=null;break;case"salesDirection":case"salesDirections":this.salesDirections=[];break;case"status":this.status=[];break;case"warehouse":case"warehouses":this.warehouses=[];break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,u,g,m;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.deliveryDate)!=null&&o.from)&&!((u=e==null?void 0:e.deliveryDate)!=null&&u.to)&&delete e.deliveryDate,!((g=e==null?void 0:e.attachedAt)!=null&&g.from)&&!((m=e==null?void 0:e.attachedAt)!=null&&m.to)&&delete e.attachedAt,e}}class gt{constructor(r){i(this,"user");i(this,"status");i(this,"statusDetail");i(this,"createdAt");this.user=new d(r==null?void 0:r.user),this.status=new Oe(r==null?void 0:r.status),this.statusDetail=r!=null&&r.statusDetail?new D(r.statusDetail):void 0,this.createdAt=p.isString(r==null?void 0:r.createdAt)?l.parseISO(r.createdAt):(r==null?void 0:r.createdAt)??new Date}}class ni extends q{getOrders(r,e,t,s=void 0){return this.getTypedPaginated(Ar,"/internal/orders",r,e,t,{},void 0,s)}getOrdersCount(r,e=void 0){return this.get("/internal/orders/count",r?{filters:JSON.stringify((r instanceof Q?r:new Q(r)).toPrimitive())}:{},void 0,void 0,e).then(t=>t.count)}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new $(e.data))}createClientOrder(r,e,t,s,o={}){const u=A().config.dateFormats.api;return this.post(`/internal/clients/${r}/orders/${e}`,{...t,deliveryDate:l.format(t.deliveryDate,u),items:s!=null&&s.length?s:void 0},g=>I.instanceListInitializer($,g.data),o)}attachOrder(r){return this.patch(`/internal/orders/${r}/attach`,{},e=>new $(e.data))}detachOrder(r){return this.patch(`/internal/orders/${r}/detach`,{},e=>new $(e.data))}mergeOrders(r,e){return this.patch(`/internal/orders/${r}/merge`,{ids:e},t=>new $(t.data))}recalculateOrder(r){return this.patch(`/internal/orders/${r}/recalculate`,{},e=>new $(e.data))}cloneOrder(r){return this.get(`/internal/orders/${r}/clone`,{})}updateOrder(r,e,t={}){const s=A().config.dateFormats.api;return this.patch(`/internal/orders/${r}`,{...e,deliveryDate:e.deliveryDate?l.format(e.deliveryDate,s):void 0},o=>new $(o.data),t)}addOrderProduct(r,e,t={}){return this.post(`/internal/orders/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new $(s.data),t)}changeOrderStatus(r,e,t,s={}){return this.patch(`/internal/orders/${r}/status`,{status:e,statusDetail:t},o=>new $(o.data),s)}changeOrderStatusDetail(r,e){return this.patch(`/internal/orders/${r}/status`,{statusDetail:e},t=>new $(t.data))}getOrderStatusHistory(r){return this.getTypedList(gt,`/internal/orders/${r}/history`)}getOrderPrintHtml(r,e){return this.get(`/internal/orders/${r}/print/view`,{...e},t=>new Blob([t.data],{type:"text/html"}))}getOrderPrintPdf(r,e){return this.getBlob(`/internal/orders/${r}/print/download`,{...e},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOrderPrint(r,e){return this.post(`/internal/orders/${r}/print/send`,e)}changeAttachedOperator(r,e){return this.patch(`/internal/orders/${r}/change-attached-operator`,{operatorId:e},t=>new $(t.data))}deleteOrderAttachedFile(r){return this.delete(`/internal/orders/${r}/file/attached`,e=>new $(e.data))}deleteOrderProduct(r,e){return this.delete(`/internal/orders/${r}/products/${e}`,t=>new $(t.data))}patchOrderProduct(r,e,t,s={}){return this.patch(`/internal/orders/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},o=>new $(o.data),s)}getDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getSelfDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/self-delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getDeliveryCost(r,e,t,s=void 0){const o=A().config.dateFormats.api;return this.get(`/internal/orders/delivery/${r}/cost`,{date:l.format(e,o),warehouse_id:t},u=>u.data,void 0,s)}}const oi=Symbol("currentOrder");class Je{constructor(r){i(this,"client");i(this,"product");i(this,"cost");i(this,"costCoefficient");i(this,"source");this.client=new V(r==null?void 0:r.client),this.product=new L(r==null?void 0:r.product),this.cost=(r==null?void 0:r.cost)??0,this.costCoefficient=(r==null?void 0:r.costCoefficient)??0,this.source=(r==null?void 0:r.source)??Ue.Product}}const kr=n=>{var r,e,t,s,o;return n?p.omitBy({cities:(r=n.cities)==null?void 0:r.map(u=>u.id),clients:(e=n.clients)==null?void 0:e.map(u=>u.id),managers:(t=n.managers)==null?void 0:t.map(u=>u.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(u=>u.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(u=>u.id),hideNotActive:n.hideNotActive},u=>p.isNil(u)||(p.isArray(u)||p.isObject(u))&&p.isEmpty(u)):{}},ft=n=>{const r={};return n.from&&(n.from.coefficient||n.from.value)&&(r.from={},n.from.coefficient&&(r.from.priceCoefficientId=n.from.coefficient.id),n.from.value&&(r.from.increasePercent=n.from.value)),n.to&&(n.to.coefficient||n.to.value)&&(r.to={},n.to.coefficient&&(r.to.priceCoefficientId=n.to.coefficient.id),n.to.value&&(r.to.increasePercent=n.to.value)),r};class ci extends y{analyzeProductPrices(r,e,t){return this.get(`/internal/price/products/${r}/analyze`,{...ft(e),filters:kr(t)},s=>I.instanceListInitializer(Je,s.data))}analyzeCategoryPrices(r,e,t){return this.get(`/internal/price/categories/${r}/analyze`,{...ft(e),filters:kr(t)},s=>I.instanceListInitializer(Je,s.data))}analyzeCategoryPricesBySquare(r,e,t){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:kr(t)},s=>I.instanceListInitializer(Je,s.data))}}class mt{constructor(r){i(this,"cost");i(this,"isLowCost");i(this,"isRetail");i(this,"costDate");i(this,"discountName");i(this,"priceTemplateName");i(this,"product");i(this,"client");i(this,"executor");i(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=p.isString(r.costDate)?l.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new le(r.product):void 0,this.client=r.client?new d(r.client):void 0,this.executor=r.executor?new d(r.executor):void 0,this.currency=r.currency?new M(r.currency):void 0}}class yt extends le{constructor(e){super(e);i(this,"history");this.history=p.map(e.history,t=>new mt(t))}}class li extends y{getProductPriceHistory(r){var o,u,g,m,a;const e=A().config.dateFormats.api,t=p.omitBy(p.merge(r,{costDate:{from:p.isDate((o=r.costDate)==null?void 0:o.from)?l.format(r.costDate.from,e):(u=r.costDate)==null?void 0:u.from,to:p.isDate((g=r.costDate)==null?void 0:g.to)?l.format(r.costDate.to,e):(m=r.costDate)==null?void 0:m.to}}),C=>p.isNil(C)||(p.isArray(C)||p.isObject(C))&&p.isEmpty(C)),s=((a=r.product)==null?void 0:a[0])??0;return delete t.product,this.get(`/internal/price/products/${s}/history`,t).then(C=>[new yt(p.merge(C[0],{history:C}))])}}class Ir{constructor(r){i(this,"products",[]);i(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new le(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new le(e)))}}class ui extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Ir(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Ir(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}}var at=(n=>(n.New="new",n.Processing="processing",n.AwaitingSupplyProducts="awaiting_supply_products",n.InvoiceIssued="invoice_issued",n.ProcessingOnStock="processing_on_stock",n.Finished="finished",n.OrderUpdated="order_updated",n.Canceled="canceled",n.Error="error",n))(at||{}),wt=(n=>(n.CanceledBy1c="canceled_by1c",n.CanceledByClient="canceled_by_client",n.FinishedNotApproved="finished_not_approved",n.ProcessingByPurchasingDepartment="processing_by_purchasing_department",n.WillWaiting="will_waiting",n))(wt||{});class vt extends D{}class Ct extends D{}class dr extends D{constructor(e){var t;super(e);i(this,"userRegions");this.userRegions=((t=e==null?void 0:e.userRegions)==null?void 0:t.map(s=>new be(s)))??[]}}class Dt extends D{}class Pt extends D{}class Rt extends D{}class St extends D{}class pi{static generateUndefinedInstance(r,e="- Не определён -"){return new r({id:0,name:e,slug:"-undefined-"})}static isUndefinedInstance(r){return r.id===0&&r.slug==="-undefined-"}}class Lr extends D{}const G=class G extends me{static withoutUnknownLocation(r){return r.filter(e=>e.id!==G.unknownLocationId)}getReference(r,e=!1){return this.getTypedDataArrayRequester(vt,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Cr,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(Dt,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester(Be,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(M,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(se,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(x,"/public/references/opf",!0)}getOperators(){return this.getTypedDataArrayRequester(Or,"/internal/references/operator",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(Pt,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(Oe,"/internal/references/order-status",!0)}getOrderStatusDetails(){return this.getTypedDataArrayRequester(Rt,"/internal/references/order-status-detail",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester($r,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Lr,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(_,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Dr,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(re,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(ee,`/internal/references/region-with-country/search?term=${r}`)}getRegionsByCountry(r){return this.getTypedDataArrayRequester(ee,"/internal/references/region",!1,{params:{countryId:r}}).then(e=>G.withoutUnknownLocation(e))}getCitiesByRegion(r){return this.getTypedDataArrayRequester(Ct,"/internal/references/city",!1,{params:{regionId:r}}).then(e=>G.withoutUnknownLocation(e))}getCitiesWithUserRegionByRegion(r){return this.getTypedDataArrayRequester(dr,"/internal/references/city-with-user-region",!1,{params:{regionId:r}}).then(e=>G.withoutUnknownLocation(e))}searchCityWithRegion(r,e,t=void 0){return this.getTypedDataArrayRequester(re,"/internal/references/city-with-region/search",!1,{term:r,...e?{params:{countryId:e}}:{}},t).then(s=>G.withoutUnknownLocation(s))}searchCityWithUserRegion(r,e=void 0){return this.getTypedDataArrayRequester(dr,"/internal/references/city-with-user-region/search",!1,{term:r},e).then(t=>G.withoutUnknownLocation(t))}searchCountry(r){return this.getTypedDataArrayRequester(E,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(B,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(ce,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(pr,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(Se,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(St,"/public/references/product-file-type",!0)}};i(G,"unknownLocationId",1);let b=G;const T=K.defineStore("common.references_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0),t=f.ref(void 0),s=f.ref(void 0),o=f.ref(void 0),u=f.ref(void 0),g=f.ref(void 0),m=f.ref(void 0),a=f.ref(void 0),C=f.ref(void 0),P=f.ref(void 0),$e=f.ref(void 0),ke=f.ref(void 0),we=f.ref(void 0),ve=f.ref(void 0),Mr=f.ref(void 0),Ur=f.ref(void 0),Hr=f.ref(void 0),h=f.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:t,deliveryTypeReference:s,managersList:o,opfReference:u,operatorReference:g,orderPaymentStatusReference:m,orderStatusReference:a,orderStatusDetailReference:C,paymentTypeReference:P,partnerGroupReference:$e,productFileTypeReference:ke,resourceTypesReference:we,salesDirectionsReference:ve,sourcePrimaryInterestReference:Mr,warehousesReference:Ur,propertyTypesReference:Hr,priceCoefficientsReference:h}}),hi=K.defineStore("common.references",()=>{const n=f.computed(()=>{const h=T();return!h.channelPrimaryInterestReference&&!h.dataLoaderList.channelPrimaryInterestReference&&(h.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(b).getChannelPrimaryInterest().then(w=>{h.channelPrimaryInterestReference=w}).catch(p.noop)),h.channelPrimaryInterestReference}),r=f.computed(()=>{const h=T();return!h.contactPositionsReference&&!h.dataLoaderList.contactPositionsReference&&(h.dataLoaderList.contactPositionsReference=!0,y.getInstance(b).getContactPositions().then(w=>{h.contactPositionsReference=w}).catch(p.noop)),h.contactPositionsReference}),e=f.computed(()=>{const h=T();return!h.currencyReference&&!h.dataLoaderList.currencyReference&&(h.dataLoaderList.currencyReference=!0,y.getInstance(b).getCurrency().then(w=>{h.currencyReference=w}).catch(p.noop)),h.currencyReference}),t=f.computed(()=>{const h=T();return!h.opfReference&&!h.dataLoaderList.opfReference&&(h.dataLoaderList.opfReference=!0,y.getInstance(b).getOpf().then(w=>{h.opfReference=w}).catch(p.noop)),h.opfReference}),s=f.computed(()=>{const h=T();return!h.operatorReference&&!h.dataLoaderList.operatorReference&&(h.dataLoaderList.operatorReference=!0,y.getInstance(b).getOperators().then(w=>{h.operatorReference=w}).catch(p.noop)),h.operatorReference}),o=f.computed(()=>{const h=T();return!h.orderPaymentStatusReference&&!h.dataLoaderList.orderPaymentStatusReference&&(h.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(b).getOrderPaymentStatuses().then(w=>{h.orderPaymentStatusReference=w}).catch(p.noop)),h.orderPaymentStatusReference}),u=f.computed(()=>{const h=T();return!h.orderStatusReference&&!h.dataLoaderList.orderStatusReference&&(h.dataLoaderList.orderStatusReference=!0,y.getInstance(b).getOrderStatuses().then(w=>{h.orderStatusReference=w}).catch(p.noop)),h.orderStatusReference}),g=f.computed(()=>{const h=T();return!h.orderStatusDetailReference&&!h.dataLoaderList.orderStatusDetailReference&&(h.dataLoaderList.orderStatusDetailReference=!0,y.getInstance(b).getOrderStatusDetails().then(w=>{h.orderStatusDetailReference=w}).catch(p.noop)),h.orderStatusDetailReference}),m=f.computed(()=>{const h=T();return!h.paymentTypeReference&&!h.dataLoaderList.paymentTypeReference&&(h.dataLoaderList.paymentTypeReference=!0,y.getInstance(b).getPaymentTypes().then(w=>{h.paymentTypeReference=w}).catch(p.noop)),h.paymentTypeReference}),a=f.computed(()=>{const h=T();return!h.partnerGroupReference&&!h.dataLoaderList.partnerGroupReference&&(h.dataLoaderList.partnerGroupReference=!0,y.getInstance(b).getPartnerGroup().then(w=>{h.partnerGroupReference=w}).catch(p.noop)),h.partnerGroupReference}),C=f.computed(()=>{const h=T();return!h.productFileTypeReference&&!h.dataLoaderList.productFileTypeReference&&(h.dataLoaderList.productFileTypeReference=!0,y.getInstance(b).getProductFileType().then(w=>{h.productFileTypeReference=w}).catch(p.noop)),h.productFileTypeReference}),P=f.computed(()=>{const h=T();return!h.resourceTypesReference&&!h.dataLoaderList.resourceTypesReference&&(h.dataLoaderList.resourceTypesReference=!0,y.getInstance(b).getResourceTypes().then(w=>{h.resourceTypesReference=w}).catch(p.noop)),h.resourceTypesReference}),$e=f.computed(()=>{const h=T();return!h.salesDirectionsReference&&!h.dataLoaderList.salesDirectionsReference&&(h.dataLoaderList.salesDirectionsReference=!0,y.getInstance(b).getSalesDirections().then(w=>{h.salesDirectionsReference=w}).catch(p.noop)),h.salesDirectionsReference}),ke=f.computed(()=>{const h=T();return!h.sourcePrimaryInterestReference&&!h.dataLoaderList.sourcePrimaryInterestReference&&(h.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(b).getSourcePrimaryInterest().then(w=>{h.sourcePrimaryInterestReference=w}).catch(p.noop)),h.sourcePrimaryInterestReference}),we=f.computed(()=>{const h=T();return!h.deliveryTypeReference&&!h.dataLoaderList.deliveryTypeReference&&(h.dataLoaderList.deliveryTypeReference=!0,y.getInstance(b).getDeliveryTypes().then(w=>{h.deliveryTypeReference=w}).catch(p.noop)),h.deliveryTypeReference}),ve=f.computed(()=>{const h=T();return!h.managersList&&!h.dataLoaderList.managersList&&(h.dataLoaderList.managersList=!0,y.getInstance(br).getManagers().then(w=>{h.managersList=w}).catch(p.noop)),h.managersList}),Mr=f.computed(()=>{const h=T();return!h.warehousesReference&&!h.dataLoaderList.warehousesReference&&(h.dataLoaderList.warehousesReference=!0,y.getInstance(b).getWarehouses().then(w=>{h.warehousesReference=w}).catch(p.noop)),h.warehousesReference}),Ur=f.computed(()=>{const h=T();return!h.propertyTypesReference&&!h.dataLoaderList.propertyTypesReference&&(h.dataLoaderList.propertyTypesReference=!0,y.getInstance(b).getPropertyTypes().then(w=>{h.propertyTypesReference=w}).catch(p.noop)),h.propertyTypesReference}),Hr=f.computed(()=>{const h=T();return!h.priceCoefficientsReference&&!h.dataLoaderList.priceCoefficientsReference&&(h.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(b).getPriceCoefficients().then(w=>{h.priceCoefficientsReference=w}).catch(p.noop)),h.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:t,operatorReference:s,orderPaymentStatusReference:o,orderStatusReference:u,orderStatusDetailReference:g,paymentTypeReference:m,partnerGroupsReference:a,productFilesTypesReference:C,resourceTypesReference:P,salesDirectionsReference:$e,sourcePrimaryInterestsReference:ke,deliveryTypeReference:we,managersList:ve,warehousesReference:Mr,propertyTypesReference:Ur,priceCoefficientsReference:Hr}});class bt{constructor(r){i(this,"name");i(this,"content");this.name=r.name,this.content=r.content}}class _r{constructor(r){i(this,"resourceType");i(this,"resourceId");i(this,"h1");i(this,"title");i(this,"description");i(this,"keywords");i(this,"meta");i(this,"tags");var e;this.resourceType=new Lr(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(t=>new bt(t)))??[],this.tags=r==null?void 0:r.tags}}class gi extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},t=>new _r(t.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,t=>new _r(t.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class fi extends y{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(t=>{const s=[...t];let o=1;return s.forEach(u=>{u.id=o++}),s})}}var Nr=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.ExternalSeo="external_seo",n.Guest="guest",n))(Nr||{});class Tt extends ur{constructor(e){super(e);i(this,"type");i(this,"canDoReclamations");i(this,"photo");i(this,"pricingRole");this.type=e==null?void 0:e.type,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.photo=e==null?void 0:e.photo,this.pricingRole=e!=null&&e.pricingRole?new cr(e.pricingRole):void 0}}class mi extends y{constructor(){super(),this.baseUrl=`${A().config.http.portalApiUrl}/api`,this.interceptorIds.request.authRequestInterceptor&&this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor)}getAccessToken(){return this.get("internal/users/current-tokens").then(r=>r.accessToken)}}class At extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Tt(r.data),!0)}}const qr=K.defineStore("common.user_state_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0);return{dataLoaderList:n,currentUser:r,currentManager:e}});function Ot(n){const r=qr();(n==null?void 0:n.type)!==Nr.Manager||r.currentManager||r.dataLoaderList.currentManager||(r.dataLoaderList.currentManager=!0,y.getInstance(br).getManager(n.id).then(e=>{r.currentManager=e}).catch(p.noop).finally(()=>{r.dataLoaderList.currentManager=!1}))}const yi=K.defineStore("common.user_state",()=>{const n=f.computed(()=>{const e=qr();return!e.currentUser&&!e.dataLoaderList.currentUser&&(e.dataLoaderList.currentUser=!0,y.getInstance(At).getCurrentUser().then(t=>{e.currentUser=t,Ot(t)}).catch(p.noop).finally(()=>{e.dataLoaderList.currentUser=!1})),e.currentUser}),r=f.computed(()=>(Ot(n.value),qr().currentManager));return{currentUser:n,currentManager:r}});class xe{constructor(r){i(this,"user");i(this,"salesDirection");this.user=new d(r==null?void 0:r.user),this.salesDirection=new _(r==null?void 0:r.salesDirection)}}class Ke extends be{constructor(e){var t,s;super(e);i(this,"cities");i(this,"users");this.cities=((t=e==null?void 0:e.cities)==null?void 0:t.map(o=>new re(o)))??[],this.users=((s=e==null?void 0:e.users)==null?void 0:s.map(o=>new xe(o)))??[]}}class ai extends oe{constructor(e){super();i(this,"id");i(this,"name");i(this,"abbr");this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.abbr=e==null?void 0:e.abbr}resetFilterValue(e){switch(e){case"id":case"name":case"abbr":this[e]=void 0;break}return this}}class wi extends q{getRegionsList(r,e,t){return this.getTypedPaginated(be,"/internal/users/regions",r,e,t)}getRegion(r){return this.get(`/internal/users/regions/${r}`,{},e=>new Ke(e.data))}createRegion(r,e={}){return this.post("/internal/users/regions",r,t=>new Ke(t.data),e)}updateRegion(r,e,t={}){return this.patch(`/internal/users/regions/${r}`,e,s=>new Ke(s.data),t)}removeRegion(r){return this.delete(`/internal/users/regions/${r}`)}getRegionEmployees(r){return this.getTypedList(xe,`/internal/users/regions/${r}/users`)}attachRegionEmployee(r,e,t){return this.post(`/internal/users/regions/${r}/users/${e}`,{salesDirectionId:t},s=>new xe(s.data))}detachRegionEmployee(r,e,t){return this.request({method:"DELETE",url:`/internal/users/regions/${r}/users/${e}`,params:{sales_direction_id:t}})}}class vi{constructor(r,e){i(this,"showFeedback",!1);i(this,"feedback","");i(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=vt,c.AppBaseConfig=Gr,c.BankAccount=Ye,c.BasePaginationProvider=q,c.BlogPost=Le,c.BlogPostMediaFile=de,c.BlogPostMediaTypeEnum=Pe,c.BlogPostPublicationStatusEnum=Re,c.BlogPostShortInfo=Z,c.BlogPostsListFilters=$t,c.BlogProvider=Ne,c.CalculationTypeEnum=Xr,c.CalendarHelper=v,c.Cart=pe,c.CartProvider=kt,c.CatalogProvider=Lt,c.CatalogableItem=tr,c.Category=j,c.CategoryFilter=et,c.CategoryFilterSetting=gr,c.CategoryFilterValue=Er,c.CategoryPricingRule=hr,c.ChannelPrimaryInterest=Cr,c.City=Ct,c.CityWithRegionAndCountry=re,c.CityWithUserRegion=dr,c.Client=Pr,c.ClientAdditionalData=st,c.ClientCategory=Te,c.ClientDataProvider=U,c.ClientPriceProvider=_t,c.ClientPriceTemplateProvider=Nt,c.ClientProduct=W,c.ClientProductCategoryDataProvider=Ut,c.ClientProductDataProvider=Ht,c.ClientShortInfo=V,c.ClientsAdditionalDataRequestTypeEnum=rt,c.ClientsListFilters=Yt,c.CodedIdentity=le,c.ConfiguratorProvider=Vt,c.ConfiguratorsEnum=ot,c.Contact=Ge,c.ContactLinks=or,c.ContactPerson=J,c.ContactPersonRelated=nt,c.ContactPosition=Dt,c.ContactRelation=Qe,c.ContragentBase=ar,c.ContragentFactory=Ae,c.ContragentIc=wr,c.ContragentPerson=tt,c.ContragentUlNr=it,c.ContragentUlR=vr,c.CostSourceEnum=Ue,c.Country=E,c.CuratedDirection=Be,c.Curator=je,c.Currency=M,c.DataSuggestionProvider=fi,c.DateHelper=Ve,c.DateTimeProvider=Kt,c.DeletableNamedIdentity=yr,c.DeliveryAddress=fe,c.DeliveryType=B,c.DetailedJwtPayload=Xe,c.DeviceTypeResolutionConfig=Wr,c.DiscountShortInfo=Vr,c.FieldValidationResultData=vi,c.FilterGroup=Q,c.FilterItem=Ze,c.FilterOpEnum=_e,c.FilterSettings=Fr,c.GeoCoordinates=er,c.HiddenCatalogableItem=xr,c.HttpCachedRequester=me,c.HttpParamsConfig=jr,c.HttpRequester=y,c.Identity=N,c.Image=Kr,c.JwtPayload=X,c.Manager=z,c.ManagerCommon=He,c.ManagerDataFactory=Et,c.ManagerDataProvider=br,c.MetaTagItem=bt,c.NamedIdentity=O,c.Offer=H,c.OfferActualization=lt,c.OfferActualizationStatus=ye,c.OfferHelper=ti,c.OfferShortInfo=Tr,c.OffersDataProvider=ri,c.OffersListFilters=ei,c.Operator=Or,c.Opf=x,c.OpfEnum=Y,c.Order=$,c.OrderAction=ht,c.OrderEditorData=ii,c.OrderInfo=Ar,c.OrderItem=pt,c.OrderItemBase=ir,c.OrderPaymentStatus=Pt,c.OrderShortInfo=Rr,c.OrderStatus=Oe,c.OrderStatusDetail=Rt,c.OrderStatusDetailEnum=wt,c.OrderStatusEnum=at,c.OrderStatusHistoryInfo=gt,c.OrdersDataProvider=ni,c.OrdersListFilters=si,c.PaginationFiltersBase=oe,c.PartnerGroup=se,c.PaymentType=$r,c.PreferencesStorageProvider=De,c.PriceAnalyze=Je,c.PriceAnalyzeProvider=ci,c.PriceCoefficient=Se,c.PriceCoefficientEnum=Ee,c.PriceHistoryDataProvider=li,c.PriceHistoryItem=mt,c.PriceTemplate=F,c.PriceTemplateCategory=We,c.PriceTemplateClient=he,c.PriceTemplateICatalogableItem=lr,c.PriceTemplateProduct=ze,c.PriceTemplateProvider=Bt,c.PricingRole=ge,c.PricingRoleProvider=Wt,c.PrimaryCatalogableItem=Me,c.Product=L,c.ProductCategoryDataProvider=qt,c.ProductDataProvider=Mt,c.ProductFileType=St,c.ProductFilterTypeEnum=nr,c.ProductPriceCoefficient=qe,c.ProductPriceHistory=yt,c.ProductUnit=rr,c.ProfstroyOfferItem=ut,c.PropertiesProvider=jt,c.Property=te,c.PropertyType=pr,c.PropertyTypeEnum=Zr,c.PropertyValue=ie,c.RecommendationsDataProvider=ui,c.RecommendationsList=Ir,c.Reference=D,c.ReferenceDataFactory=pi,c.ReferenceDataProvider=b,c.Region=ee,c.ResourceType=Lr,c.STANDARD_PERIOD_GROUPS=Xt,c.STANDARD_PERIOD_SECTIONS=Zt,c.SalesDirection=_,c.SentryConfig=zr,c.Seo=_r,c.SeoDataProvider=gi,c.SourcePrimaryInterest=Dr,c.StockCount=Jr,c.TableDataPagination=Jt,c.TableDataPaginationRequestParams=ct,c.TableDataSortRequestParams=xt,c.TemplateProductCategoryDataProvider=zt,c.TemplatesListFilters=dt,c.TypedInstanceFactory=I,c.UnitsHelper=Sr,c.UnknownClientDataProvider=Gt,c.UpdatableNamedIdentity=Fe,c.User=Tt,c.UserAuthDataProvider=mi,c.UserCommonInfo=ur,c.UserDataProvider=At,c.UserPricingRole=cr,c.UserRegion=Ke,c.UserRegionEmployee=xe,c.UserRegionProvider=wi,c.UserRegionShortInfo=be,c.UserRegionsListFilters=ai,c.UserShortInfo=d,c.UserTypeEnum=Nr,c.VersionConfig=Qt,c.Warehouse=ce,c.WebSocketConfig=Yr,c.currentOrderInjectionKey=oi,c.findCatalogItemByIdRecursive=fr,c.flattenCatalogItems=mr,c.pluralize=Ft,c.useAuthStateStore=Ie,c.useBaseConfigStateStore=A,c.useReferencesStore=hi,c.useUserStateStore=yi,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});