@snabcentr/common-lib 2.0.7 → 2.2.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.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +1 -6
- package/dist/sc-common-lib.js +545 -455
- package/dist/sc-common-lib.js.map +1 -1
- package/dist/sc-common-lib.umd.cjs +1 -1
- package/dist/sc-common-lib.umd.cjs.map +1 -1
- package/dist/src/clients/classes/client-short-info.d.ts +5 -0
- package/dist/src/clients/classes/client-short-info.d.ts.map +1 -1
- package/dist/src/clients/classes/client.d.ts +9 -2
- package/dist/src/clients/classes/client.d.ts.map +1 -1
- package/dist/src/clients/classes/clients-list-filters.d.ts +12 -1
- package/dist/src/clients/classes/clients-list-filters.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-client-short-info.d.ts +5 -0
- package/dist/src/clients/interfaces/i-client-short-info.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-client.d.ts +9 -2
- package/dist/src/clients/interfaces/i-client.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-clients-list-filters.d.ts +5 -0
- package/dist/src/clients/interfaces/i-clients-list-filters.d.ts.map +1 -1
- package/dist/src/clients/providers/client-data-provider.d.ts +34 -0
- package/dist/src/clients/providers/client-data-provider.d.ts.map +1 -1
- package/dist/src/config/interfaces/i-catalog-config.d.ts +7 -2
- package/dist/src/config/interfaces/i-catalog-config.d.ts.map +1 -1
- package/dist/src/managers/classes/curator.d.ts +28 -0
- package/dist/src/managers/classes/curator.d.ts.map +1 -0
- package/dist/src/managers/classes/index.d.ts +1 -0
- package/dist/src/managers/classes/index.d.ts.map +1 -1
- package/dist/src/managers/classes/manager.d.ts +5 -0
- package/dist/src/managers/classes/manager.d.ts.map +1 -1
- package/dist/src/managers/interfaces/i-curator.d.ts +21 -0
- package/dist/src/managers/interfaces/i-curator.d.ts.map +1 -0
- package/dist/src/managers/interfaces/i-manager.d.ts +5 -0
- package/dist/src/managers/interfaces/i-manager.d.ts.map +1 -1
- package/dist/src/managers/interfaces/index.d.ts +1 -0
- package/dist/src/managers/interfaces/index.d.ts.map +1 -1
- package/dist/src/references/classes/curated-direction.d.ts +8 -0
- package/dist/src/references/classes/curated-direction.d.ts.map +1 -0
- package/dist/src/references/classes/index.d.ts +1 -0
- package/dist/src/references/classes/index.d.ts.map +1 -1
- package/dist/src/references/interfaces/i-curated-direction.d.ts +7 -0
- package/dist/src/references/interfaces/i-curated-direction.d.ts.map +1 -0
- package/dist/src/references/interfaces/index.d.ts +1 -0
- package/dist/src/references/interfaces/index.d.ts.map +1 -1
- package/dist/src/references/providers/reference-data-provider.d.ts +5 -0
- package/dist/src/references/providers/reference-data-provider.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(c,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("date-fns"),require("pinia"),require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","date-fns","pinia","vue","axios"],S):(c=typeof globalThis<"u"?globalThis:c||self,S(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c["date-fns"],c.pinia,c.vue,c.axios))})(this,function(c,S,u,le,m,V,f,Fr){"use strict";var St=Object.defineProperty;var at=(c,S,u)=>S in c?St(c,S,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[S]=u;var t=(c,S,u)=>at(c,typeof S!="symbol"?S+"":S,u);class _{constructor(r){t(this,"exp",0);t(this,"iat",0);t(this,"authTime",0);t(this,"jti","");t(this,"iss","");t(this,"aud",[]);t(this,"sub","");t(this,"typ","Bearer");t(this,"azp","");t(this,"sid","");t(this,"acr","");t(this,"allowedOrigins",[]);t(this,"realmAccess",{roles:[]});t(this,"resourceAccess",{});t(this,"scope","");t(this,"emailVerified",!1);t(this,"name","");t(this,"guid","");t(this,"preferredUsername","");t(this,"givenName","");t(this,"email","");u.merge(this,r)}static getJwtPayload(r){const e=S.jwtDecode(r),i=new _(le.objectToCamel(e));return i.resourceAccess=e.resource_access,i}}class Wr extends _{constructor(e){super(e);t(this,"familyName");t(this,"middleName");t(this,"locale");t(this,"phoneNumber");t(this,"phoneNumberVerified");t(this,"address");u.merge(this,e)}static getJwtPayload(e){return new _(le.objectToCamel(S.jwtDecode(e)))}}const ie=class ie{static init(r){ie.config=r}static getConfig(){if(u.isUndefined(ie.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return ie.config}static loadRemoteConfig(r="/config.json"){const e=fetch(r).then(i=>i.ok?i.json():(console.error(new Error(`Ошибка загрузки ${r}: ${i.statusText}`)),new Promise(s=>{s({})})));return e.catch(i=>{console.error(i)}),e}};t(ie,"config");let v=ie;class ue{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const i=JSON.parse(e);if(!i.availableFor||m.isAfter(m.parseISO(i.availableFor)||m.startOfToday(),new Date)){if(u.isNil(i.data)||u.isEmpty(i.data))throw new Error("Data is empty");return i.data}}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,i){if(this.isLocalStorageAvailable())try{if(u.isNil(e)||u.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:i,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:i,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 i=localStorage.key(e);if(i)try{const s=localStorage.getItem(i);if(s){const o=JSON.parse(s);o.availableFor&&!m.isAfter(m.parseISO(o.availableFor)||m.startOfToday(),new Date)&&r.push(i)}}catch{r.push(i)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function sr(n){try{const r=_.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const x=V.defineStore("__auth_state_private",()=>{const n=f.ref((()=>{var h;const o=ue.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const l=(h=v.getConfig().devMode)==null?void 0:h.initAuthBearerToken;return l?Promise.resolve(l):void 0})()),r=f.ref(void 0),e=f.ref(void 0),i=f.markRaw(new Map);function s(){e.value=void 0,u.isNil(n.value)||n.value.then(o=>{const l=_.getJwtPayload(o);e.value=l.exp*1e3>Date.now()?u.mapValues(l.resourceAccess,h=>(h==null?void 0:h.roles)??[]):void 0}).catch(u.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:i,recalculateUserPermissions:s}}),Re=V.defineStore("__auth_state",()=>{const n=f.computed(()=>{const o=x();if(u.isNil(o.jwtToken)&&!u.isNil(o.jwtTokenUpdater)){const l=o.jwtTokenUpdater();o.jwtToken=l,l.then(h=>{o.jwtToken=Promise.resolve(h),ue.saveActualDataToStorage("sc.token",h,sr(h)),o.recalculateUserPermissions()}).catch(u.noop)}return o.jwtToken});function r(o){x().jwtTokenUpdater=o}function e(o){const l=x();l.jwtToken=Promise.resolve(o),ue.saveActualDataToStorage("sc.token",o,sr(o)),l.recalculateUserPermissions()}function i(){const o=x();o.jwtToken=void 0,o.userPermissions=void 0,ue.saveActualDataToStorage("sc.token",void 0)}function s(o){const l=x();!u.isNil(l.jwtToken)&&u.isNil(l.userPermissions)&&l.jwtToken.then(w=>{const R=_.getJwtPayload(w);l.userPermissions=R.exp*1e3>Date.now()?u.mapValues(R.resourceAccess,a=>(a==null?void 0:a.roles)??[]):void 0}).catch(u.noop);const h=u.isArray(o)?o.join(" && "):o;if(l.userPermissionsComputedRefs.has(h))return l.userPermissionsComputedRefs.get(h);const g=f.computed(()=>{const w=R=>{var ce;const a=u.split(R,".");if(a.length<2)return!1;const[M,j]=a,oe=(ce=x().userPermissions)==null?void 0:ce[M];return u.isArray(oe)&&oe.includes(j)};return u.isArray(o)?u.every(o,R=>w(R)):w(o)});return l.userPermissionsComputedRefs.set(h,g),g}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:i,hasUserPermission:s}});class N{constructor(r,e){t(this,"id");t(this,"guid");this.id=r==null?void 0:r.id,u.isNil(this.id)&&(u.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==="":u.isNil(this.id)}}class T extends N{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class K extends T{constructor(e){super(e);t(this,"code","");this.code=(e==null?void 0:e.code)??""}}class Ne extends K{constructor(e){super(e);t(this,"slug");t(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class De extends Ne{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class pe extends De{constructor(e){super(e);t(this,"isHidden");t(this,"parentCategoryId");t(this,"properties");t(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(([i,s])=>[u.toUpper(i),s])):void 0}}var qe=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(qe||{});class P extends T{constructor(e){super(e);t(this,"slug");t(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class he extends P{static getRetailPriceCoefficient(){return{id:-2,slug:qe.Retail,name:"Розн. цена",guid:"",isNewRec:u.constant(!0)}}}class Ae{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new he(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 Ue{constructor(r){t(this,"lat");t(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class G extends P{}class ge extends P{constructor(e){var i;super(e);t(this,"address");t(this,"isMain");t(this,"deliveryTypes");t(this,"regions");t(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((i=e==null?void 0:e.deliveryTypes)==null?void 0:i.map(s=>new G(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Ue(e==null?void 0:e.coordinates)}}class nr{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new ge(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class or extends Ne{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class cr{constructor(r,e){t(this,"image");t(this,"preview");t(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class $ extends or{constructor(e){var s,o,l,h;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");t(this,"quantityUnit");t(this,"currency");t(this,"currencySignature");t(this,"cost");t(this,"costRub");t(this,"costDate");t(this,"onOrder");t(this,"stockCount");t(this,"category");t(this,"categories");t(this,"images");t(this,"properties");t(this,"retailCost");t(this,"retailCostRub");t(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=(e==null?void 0:e.unit)??"",this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.quantityUnit=e==null?void 0:e.quantityUnit,this.currency=(e==null?void 0:e.currency)??"",this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=u.isString(e==null?void 0:e.costDate)?m.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(g=>new nr(g)))??[],this.currencySignature=(e==null?void 0:e.currencySignature)??"",this.type="product";const i=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(g=>g.isPrimary));i&&(this.category=new De({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(g=>new De(g))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(g=>new cr(g,v.getConfig().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=((h=e==null?void 0:e.priceCoefficients)==null?void 0:h.map(g=>new Ae(g)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){var i;const e=(i=v.getConfig().catalog)==null?void 0:i.products.units;return[...(e==null?void 0:e.linear)??["пог.м.","м."],...(e==null?void 0:e.square)??["м2"]].includes(this.unit)}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}class lr extends N{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"height");t(this,"length");t(this,"width");t(this,"barcode");t(this,"marker");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");this.product=new $(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new pe,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&u.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class ur extends lr{constructor(e){super(e);t(this,"currency");t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");this.currency=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=e.sawing}}class me{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new ur(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Te{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const L=class L{constructor(){t(this,"httpClient");t(this,"baseUrl",`${v.getConfig().http.portalApiUrl}/api`);t(this,"errorResponseHandler",u.noop);t(this,"interceptorIds",{request:{},response:{}});t(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));t(this,"authRequestInterceptor",async r=>{let e;return u.isNil(Re().jwtToken)||(e=await Re().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});t(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=le.objectToSnake(r.params)),["put","patch","post"].includes(u.toLower(r.method))&&r.data&&(r.data=le.objectToSnake(r.data))),r));t(this,"authErrorsResponseInterceptors",r=>{var i;const e=r.rawError?(i=r.rawError)==null?void 0:i.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(Re().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});t(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=le.objectToCamel(r.data)),r));const r=v.getConfig().version;this.errorResponseHandler=L.defaultErrorsResponseHandler,this.httpClient=Fr.create({headers:{"APP-VERSION":`${r.name} (${r.version}, ${m.format(r.date,v.getConfig().dateFormats.uiDate)})`,Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,e=>Promise.reject(e)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,e=>Promise.reject(e)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,e=>Promise.reject(e)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(e=>e,e=>L.convertHttpErrorResponse(e)),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(e=>e,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,e=>Promise.reject(e))}static setDefaultErrorsResponseHandler(r){L.defaultErrorsResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(L.instances,r.name)||(L.instances[r.name]=Te.simpleInstanceInitializer(r)),L.instances[r.name]}static convertHttpErrorResponse(r){var e,i;if(!u.isNil(r.request)||!u.isNil(r.response)){const s=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:(i=s==null?void 0:s.data)==null?void 0:i.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,i={},s=!1){const o=this.httpClient.request(r).then(l=>e?e(l):l.data);return o.catch(l=>{this.errorResponseHandler(l,i,s)}),o}get(r,e={},i=void 0,s=!1){return this.request({method:"GET",url:r,params:e},i,{},s)}getBlob(r,e={},i=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},i,{},s)}patch(r,e={},i=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},i,s,o)}post(r,e={},i=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},i,s,o)}delete(r,e=void 0,i=!1){return this.request({method:"DELETE",url:r},e,{},i)}};t(L,"instances",{}),t(L,"defaultErrorsResponseHandler",u.noop);let y=L;class Jr extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new me(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},s=>new me(s.data),i)}patchCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},s=>new me(s.data),i)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,i=>new me(i.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 pr=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(pr||{}),Se=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Se||{}),hr=(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))(hr||{});class H extends pe{constructor(e){var i,s;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new H(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new $(o))}}class de extends T{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=u.isString(e==null?void 0:e.updatedAt)?m.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class gr extends de{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?m.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class q extends T{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class mr extends T{constructor(e){super(e);t(this,"costCoefficient");t(this,"isLowPriceAllowed");t(this,"publishedAt");t(this,"description");t(this,"percent");t(this,"owner");t(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=u.isString(e==null?void 0:e.publishedAt)?m.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 q(e==null?void 0:e.owner),this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?m.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class B extends de{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}class z extends ${constructor(e){super(e);t(this,"costCoefficient");t(this,"costSource");t(this,"discount");t(this,"priceTemplate");t(this,"isPreviouslyOrdered");t(this,"isRequired");t(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??Se.Product,this.discount=e!=null&&e.discount?new mr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new B(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 fr{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class b extends P{}class Q extends T{constructor(e){super(e);t(this,"salesDirection");t(this,"photo");t(this,"contacts");t(this,"isDefault");t(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new b(e.salesDirection):new b,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new fr(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class yr extends T{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class fe extends Q{constructor(e){super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");t(this,"pricingRole");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 yr(e.pricingRole):void 0}}class Vr extends pe{constructor(e){super(e);t(this,"isDisabled");t(this,"isRequired");t(this,"isFavorite");t(this,"hidingComment");t(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 fe(e.manager):void 0}}class ye extends Vr{constructor(e){var i,s;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new ye(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new z(o))}}class Me{constructor(r){t(this,"priceCoefficient");t(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new he(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class ae extends Me{constructor(e){super(e);t(this,"productCategory");this.productCategory=new pe(e==null?void 0:e.productCategory)}}class F extends P{}class Y extends P{constructor(e){super(e);t(this,"country",new F);e&&(this.country=new F(e.country))}}class $e extends P{constructor(e){super(e);t(this,"region",new Y);e&&(this.region=new Y(e.region))}}class je extends T{constructor(e){super(e);t(this,"phone");t(this,"email");t(this,"getNews");t(this,"salesDirection");t(this,"createdAt");t(this,"lastLoginAt");t(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 b(e.salesDirection):void 0,this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=u.isString(e==null?void 0:e.lastLoginAt)?m.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class X extends je{constructor(e){var i;super(e);t(this,"salesDirection");t(this,"debt");t(this,"alternativeName");t(this,"city");t(this,"comment");t(this,"isPhoneApproved");t(this,"isEmailApproved");t(this,"managers");this.salesDirection=new b(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=((i=e==null?void 0:e.managers)==null?void 0:i.map(s=>new Q(s)))??[]}}class Z extends N{constructor(e){super(e);t(this,"createdAt");t(this,"deletedAt");t(this,"client");t(this,"priceTemplate");this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?m.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new X(e==null?void 0:e.client),this.priceTemplate=new B(e==null?void 0:e.priceTemplate)}}class be extends Me{constructor(e){super(e);t(this,"product");this.product=new $(e==null?void 0:e.product)}}class Ge extends P{}class E extends T{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new Ge(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class W{constructor(r){t(this,"property");t(this,"value");this.property=new E(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class k{constructor(r){t(this,"from");t(this,"to");this.from=u.isString(r==null?void 0:r.from)?m.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=u.isString(r==null?void 0:r.to)?m.parseISO(r.to):(r==null?void 0:r.to)??null}}class xr{constructor(r){t(this,"id");t(this,"name");t(this,"description");t(this,"createdAt",new k);t(this,"updatedAt",new k);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.createdAt=new k(r==null?void 0:r.createdAt),this.updatedAt=new k(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":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,i,s,o;const r={};return Object.keys(this).forEach(l=>{const h=this[l];u.isNil(h)||u.isString(h)&&h.trim().length===0||u.isFunction(h.isNewRec)&&h.isNewRec()||(r[l]=h)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.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 ee extends T{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");t(this,"subRoles",[]);t(this,"parentRole");t(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 He{constructor(r){t(this,"role");t(this,"category");t(this,"minCoefficient");this.role=new ee(r==null?void 0:r.role),this.category=new pe(r==null?void 0:r.category),this.minCoefficient=new he(r==null?void 0:r.minCoefficient)}}class Cr{constructor(r){t(this,"phone");t(this,"tablet");t(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 Pr{constructor(r){t(this,"portalApiUrl");t(this,"priceHistoryApiUrl");t(this,"recommendationsApiUrl");t(this,"mediaUrl");t(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.priceHistoryApiUrl=(r==null?void 0:r.priceHistoryApiUrl)??"",this.recommendationsApiUrl=(r==null?void 0:r.recommendationsApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class wr{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,i,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|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((i=r==null?void 0:r.trace)==null?void 0:i.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 vr{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=u.isString(r==null?void 0:r.date)?m.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"}}class Rr{constructor(r){t(this,"broadcaster");t(this,"key");t(this,"wsHost");t(this,"wsPort");t(this,"wssPort");t(this,"forceTLS");t(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 Kr{constructor(r){t(this,"environment");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"sentry");t(this,"tableDefaultHeightCoefficient");t(this,"urls");t(this,"version");t(this,"websocket");t(this,"dateFormats");var e,i,s;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new Pr(r==null?void 0:r.http),this.deviceTypeByResolution=new Cr(r==null?void 0:r.deviceTypeByResolution),this.sentry=new wr({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.version=new vr(r==null?void 0:r.version),this.websocket=r!=null&&r.websocket?new Rr(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:((i=r==null?void 0:r.dateFormats)==null?void 0:i.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}class Qr extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,i=void 0,s=void 0){let l=`${v.getConfig().http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return i&&(l+=`&category_id=${i}`),s&&(l+=`&client_id=${s}`),l}}class Yr extends y{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,i){var s;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.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,i){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:i})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,i){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:i})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}updateProductPrice(r,e,i){var s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value},o=>new z(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,i=>new z(i.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,i=>new Blob([i.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,i=>new Blob([i.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class Xr extends y{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new Z(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new Z(e.data),!0)}attachTemplate(r,e,i){const s=v.getConfig().dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,i&&{startAt:i.startAt&&m.format(i.startAt,s),endAt:i.endAt&&m.format(i.endAt,s)},o=>new Z(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,i,s){const o=v.getConfig().dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${i}`,s&&{startAt:s.startAt&&m.format(s.startAt,o),endAt:s.endAt&&m.format(s.endAt,o)},l=>new Z(l.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class Zr extends y{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(i=>new H(i)))}getCategoryData(r,e=!1,i=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:i},s=>new H(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new H(e.data))}getCategoryProductsList(r,e=!0,i=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:i,withPriceCoefficients:e},s=>u.map(s.data,o=>new $(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return u.forEach(i,s=>s.map(o=>new Ae(o))),i})}publicSimpleSearch(r,e=10){return new Promise((i,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.categories.map(l=>new H(l)))}).catch(o=>{s(o)})})}}class Er extends y{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new $(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new $(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>u.map(e.data,i=>new Ae(i)))}publicSimpleSearch(r,e=10){return new Promise((i,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.products.map(l=>new $(l)))}).catch(o=>{s(o)})})}}class et extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(s=>new ye(s)))}getCategoryData(r,e,i=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:s},o=>new ye(o.data))}getCategoryProductsList(r,e,i=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:i},o=>u.map(o.data,l=>new z(l)))}}class rt extends y{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},s=>new z(s.data))}}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 Be{constructor(r){t(this,"field");t(this,"op");t(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={field:this.field,op:this.op};return r.value=u.isDate(this.value)?m.format(this.value,v.getConfig().dateFormats.api):this.value,r}}class re{constructor(r){t(this,"groupOp");t(this,"filters");t(this,"groups");var e,i;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 Be(s)))??[],this.groups=((i=r==null?void 0:r.groups)==null?void 0:i.map(s=>new re(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Be&&u.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof re?r.toPrimitive():r)}}}class Ce extends y{getPaginated(r,e,i,s,o,l,h){let g={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(g.filters=JSON.stringify((e instanceof re?e:new re(e)).toPrimitive())),u.isEmpty(i)||(g.sort=u.isArray(i)?i:[i]),o&&(g={...g,...o}),this.get(r,g,l,h)}}class tt extends Ce{getTemplateList(r,e,i){return this.getPaginated("/internal/price/templates",r,e,i,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new B(l)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,i=>new B(i.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new B(e.data))}updateTemplate(r,e,i={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new B(s.data),i)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.get(`/internal/price/templates/${r}/products`,{},e=>e.data.map(i=>new be(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new be(i.data))}saveProductTemplatePrice(r,e,i){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value},o=>new be(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.get(`/internal/price/templates/${r}/categories`,{},e=>e.data.map(i=>new ae(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new ae(i.data))}saveCategoryTemplatePrice(r,e,i,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=i.coefficient)==null?void 0:o.id,increase_percent:i.value},params:s?{recursively:!0}:{}},l=>new ae(l.data))}deleteCategoryTemplatePrice(r,e,i=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:i?{recursively:!0}:{}})}getTemplateClients(r){return this.get(`/internal/price/templates/${r}/clients`,{},e=>e.data.map(i=>new Z(i)))}}class it extends y{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new ee(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new ee(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new ee(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new ee(i.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.get(`/internal/price/roles/rules/categories/${r}`,{},e=>e.data.map(i=>new He(i)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,i=>i.data.map(s=>new He(s)))}}class st extends Ce{getProperties(r,e,i){return this.getPaginated("/internal/catalog/properties",r,e,i,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new E(l)),o})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},s=>new E(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new E(e.data))}updateProperty(r,e){const{typeId:i,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:i},o=>new E(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.get(`/internal/catalog/products/${r}/properties`,{},e=>e.data.map(i=>new W(i)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},i=>new W(i.data))}updateProductProperty(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:i},s=>new W(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,i){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,i)}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.get(`/internal/catalog/categories/${r}/properties`,{},e=>e.data.map(i=>new W(i)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},i=>new W(i.data))}updateCategoryProperty(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:i},s=>new W(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,i){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,i)}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})}}function ze(n,r,e){let i;return n.some(s=>{if(s.type===e&&s.id===r)return i=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const l=ze(o.products,r,e);if(l)return i=l,!0}if(o.categories&&o.categories.length>0){const l=ze(o.categories,r,e);if(l)return i=l,!0}return!1}),i}function Fe(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const i=e;i.products&&i.products.length>0&&r.push(...Fe(i.products)),i.categories&&i.categories.length>0&&r.push(...Fe(i.categories))}}),r}var Dr=(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))(Dr||{}),O=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(O||{});class Ar extends P{}class We extends P{}class nt extends P{}class Tr extends P{}class Pe extends T{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}class U extends P{static generatePersonItem(){return new U({id:1,guid:"",slug:O.Person,name:""})}}class Sr extends P{}class ar extends P{}class J extends P{}class $r extends P{}class br extends P{}class Je extends P{}class Ve extends P{}class Le extends N{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new Pe);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new Pe(e.currency))}}class ke extends T{constructor(e){super(e);t(this,"phone");t(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 d extends ke{constructor(e){super(e);t(this,"isPrimary");t(this,"position");t(this,"notDisturb");t(this,"comment");t(this,"updatedAt");t(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=u.isString(e==null?void 0:e.deletedAt)?m.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class xe extends T{constructor(e){super(e);t(this,"manager",new Q);t(this,"opf",U.generatePersonItem());t(this,"salesDirection",new b);t(this,"partnerGroup",new J);t(this,"contacts",[]);t(this,"bankAccounts",[]);t(this,"comment");t(this,"alternativeName");t(this,"createdAt");t(this,"creator");t(this,"updatedAt");t(this,"updater");if(e){if(this.opf=new U(e.opf),this.salesDirection=new b(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new q(e.creator):void 0,this.updatedAt=u.isString(e==null?void 0:e.updatedAt)?m.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new q(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new J(e.partnerGroup)),e.manager&&(this.manager=new Q(e.manager)),e.contacts){const i=[];e.contacts.forEach(s=>{i.push(new d(s))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(s=>{i.push(new Le(s))}),this.bankAccounts=i}}}}class Ir extends xe{constructor(r){super(r)}}class Ke extends xe{constructor(e){super(e);t(this,"inn","");t(this,"okpo","");t(this,"directorName","");t(this,"directorPosition","");t(this,"directorActsOn","");t(this,"legalAddress","");t(this,"postalAddress","");t(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 Qe extends Ke{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class Lr extends Qe{constructor(e){super(e);t(this,"registrationCountry",new F);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new F(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class we{static createInstance(r){switch(r.opf.slug){case O.Ic:return new Ke(r);case O.UlR:return new Qe(r);case O.UlNr:return new Lr(r);default:return new Ir(r)}}}class Oe extends N{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class kr extends d{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(i=>new Oe(i))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(i=>new Oe(i))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(i=>new Oe(i))))}}class ve extends gr{constructor(e){var i;super(e);t(this,"address","");t(this,"coordinates");t(this,"contacts");t(this,"comment");t(this,"operatingHours");t(this,"isOneTime");t(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new Ue(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(s=>new d(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 Ye extends X{constructor(e){var i,s,o,l;super(e);t(this,"contragents");t(this,"partnerGroups");t(this,"contacts");t(this,"deliveryAddresses");t(this,"channelPrimaryInterest");t(this,"sourcePrimaryInterest");t(this,"preferredDeliveryType");t(this,"primaryDemand");t(this,"isExcludedFromMsCallsToClients");t(this,"reasonExcludedFromMsCallsToClients");t(this,"preferredWarehouse");t(this,"extraData");this.contragents=((i=e==null?void 0:e.contragents)==null?void 0:i.map(h=>we.createInstance(h)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(h=>new J(h)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(h=>new d(h)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(h=>new ve(h)))??[],this.channelPrimaryInterest=new We(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Ve(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new G(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.reasonExcludedFromMsCallsToClients=e==null?void 0:e.reasonExcludedFromMsCallsToClients,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new ge(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class ot{constructor(r){t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"searchTerm");t(this,"cities");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",new k);t(this,"lastLoginDate",new k);t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"isManagerRequired");t(this,"salesDirections");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"partnerGroups");t(this,"contact");t(this,"lastOrder");t(this,"isExcludedFromMsCallsToClients");var e,i,s,o,l,h;this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.alternativeName=r==null?void 0:r.alternativeName,this.searchTerm=r==null?void 0:r.searchTerm,this.cities=(e=r==null?void 0:r.cities)==null?void 0:e.map(g=>new $e(g)),this.region=new Y(r==null?void 0:r.region),this.country=new F(r==null?void 0:r.country),this.phone=r==null?void 0:r.phone,this.email=r==null?void 0:r.email,this.isActive=r&&Object.prototype.hasOwnProperty.call(r,"isActive")?r==null?void 0:r.isActive:!0,this.createdAt=new k(r==null?void 0:r.createdAt),this.lastLoginDate=new k(r==null?void 0:r.lastLoginDate),this.lastLoginDateHasOrder=(r==null?void 0:r.lastLoginDateHasOrder)??void 0,this.managers=r!=null&&r.managers&&r.managers.length>0?r.managers.map(g=>new fe(g)):[],this.salesDirections=(i=r==null?void 0:r.salesDirections)==null?void 0:i.map(g=>new b(g)),this.contragentInn=r==null?void 0:r.contragentInn,this.contragentType=new U(r==null?void 0:r.contragentType),this.preferredDeliveryType=new G(r==null?void 0:r.preferredDeliveryType),this.partnerGroups=(s=r==null?void 0:r.partnerGroups)==null?void 0:s.map(g=>new J(g)),this.contact=new ke(r==null?void 0:r.contact),this.lastOrder={createdAt:new k((o=r==null?void 0:r.lastOrder)==null?void 0:o.createdAt),creator:(l=r==null?void 0:r.lastOrder)==null?void 0:l.creator,isApproved:(h=r==null?void 0:r.lastOrder)==null?void 0:h.isApproved},this.isExcludedFromMsCallsToClients=r==null?void 0:r.isExcludedFromMsCallsToClients}resetFilterValue(r){switch(r){case"cities":this.cities=[];break;case"region":this.region=new Y;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"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new U;break;case"preferredDeliveryType":this.preferredDeliveryType=new G;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new ke;break;default:this[r]=void 0;break}return this}asClearRaw(){var e,i,s,o;const r={};return Object.keys(this).forEach(l=>{const h=this[l];u.isNil(h)||u.isString(h)&&h.trim().length===0||u.isFunction(h.isNewRec)&&h.isNewRec()||(r[l]=h)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((s=r==null?void 0:r.lastLoginDate)!=null&&s.from)&&!((o=r==null?void 0:r.lastLoginDate)!=null&&o.to)&&delete r.lastLoginDate,r}}class Xe extends N{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new q(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Or extends T{constructor(e){var i,s;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");t(this,"salesDirection");t(this,"managers");(i=e.contacts)!=null&&i.length&&(this.contacts=e.contacts.map(o=>new d(o))),e.lastOrder&&(this.lastOrder=new Xe(e.lastOrder)),(s=e.partnerGroups)!=null&&s.length&&(this.partnerGroups=e.partnerGroups.map(o=>new J(o))),e.preferredDeliveryType&&(this.preferredDeliveryType=new G(e.preferredDeliveryType)),e.salesDirection&&(this.salesDirection=new b(e.salesDirection)),e.managers&&(this.managers=e.managers.map(o=>new Q(o)))}}class _r{constructor(r){t(this,"page",1);t(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class ct extends _r{constructor(e){super(e);t(this,"itemCount",0);t(this,"pageCount",1);t(this,"pageSlot",5);t(this,"pageSizes",[25,50,100]);t(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 lt{constructor(r){t(this,"field");t(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class I extends Ce{static transformClientDataToRequest(r){var i;const e={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,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(i=r.preferredWarehouse)==null?void 0:i.id};return r.isExcludedFromMsCallsToClients&&(e.reason_excluded_from_ms_calls_to_clients=r.reasonExcludedFromMsCallsToClients),e}static transformContragentClientDataToRequest(r){var l,h,g,w,R,a,M,j;let e;const i=r,s=r,o=r;switch(r.opf.slug){case O.Ic:e={opf:i.opf.slug,name:i.name,alternative_name:i.alternativeName,partner_group_id:(l=i.partnerGroup)==null?void 0:l.id,manager_id:(h=i.manager)==null?void 0:h.id,comment:i.comment,inn:i.inn,okpo:i.okpo,director_name:i.directorName,director_position:i.directorPosition,director_acts_on:i.directorActsOn,legal_address:i.legalAddress,postal_address:i.postalAddress,actual_address:i.actualAddress};break;case O.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(g=s.partnerGroup)==null?void 0:g.id,manager_id:(w=s.manager)==null?void 0:w.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 O.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(R=o.partnerGroup)==null?void 0:R.id,manager_id:(a=o.manager)==null?void 0:a.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:(M=r.partnerGroup)==null?void 0:M.id,manager_id:(j=r.manager)==null?void 0:j.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var i,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:(i=r.coordinates)==null?void 0:i.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 Ye(e.data))}getClientsList(r,e,i,s){return this.getPaginated("/internal/clients",r,e,i,s,o=>{const l={...o.data};return l.data=l.data.map(h=>new X(h)),l})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Ie.Contains,value:r}]})}getAdditionalClientsData(r,e){const i=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:i,requested_data_types:e},s=>{let o=[];return(s==null?void 0:s.data.length)>0&&(o=s.data.map(l=>new Or(l))),o})}getAllClientContacts(r){return this.get(`/internal/clients/${r}/contacts/all`,{},e=>{let i=[];return(e==null?void 0:e.data.length)>0&&(i=e.data.map(s=>new kr(s))),i})}createClientCommonData(r,e={}){return this.post("/internal/clients",I.transformClientDataToRequest(r),i=>new Ye(i.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,I.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const i={get_news:r.getNews,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients};return r.isExcludedFromMsCallsToClients&&(i.reason_excluded_from_ms_calls_to_clients=r.reasonExcludedFromMsCallsToClients),this.patch(`/internal/clients/${r.id}`,i,void 0,e)}changeClientPassword(r,e,i,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:i},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 i=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(i)}async detachClientFromManagers(r,e){const i=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(i)}createContragentClientData(r,e,i={}){return this.post(`/internal/clients/${r}/contragents`,I.transformContragentClientDataToRequest(e),s=>we.createInstance(s.data),i)}updateContragentClientData(r,e,i={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,I.transformContragentClientDataToRequest(e),s=>we.createInstance(s.data),i)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,i={}){return this.post(`/internal/clients/${r}/delivery-addresses`,I.transformClientDeliveryAddressToRequest(e),s=>new ve(s.data),i)}updateClientDeliveryAddress(r,e,i={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,I.transformClientDeliveryAddressToRequest(e),s=>new ve(s.data),i)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,i,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,I.transformClientContragentBankAccountToRequest(i),o=>new Le(o.data),s)}updateContragentBankAccount(r,e,i,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`,I.transformClientContragentBankAccountToRequest(i),o=>new Le(o.data),s)}deleteContragentBankAccount(r,e,i){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`)}createClientContact(r,e,i={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},i)}updateClientContact(r,e,i={}){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 d(s.data),i)}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,i,s={}){return this.createContact(r,i,{contragents:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,i){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${i.id}/primary`,i.isPrimary??!1)}detachContragentContact(r,e,i){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${i.id}/detach`)}createDeliveryAddressContact(r,e,i,s={}){return this.createContact(r,i,{addresses:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,i){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${i.id}/primary`,i.isPrimary??!1)}detachDeliveryAddressContact(r,e,i){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${i.id}/detach`)}createContact(r,e,i,s={}){var l,h;const o={name:e.name,position:e.position,comment:e.comment,...i};return(l=e.phone)!=null&&l.length&&(o.phone=e.phone),(h=e.email)!=null&&h.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,g=>new d(g.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}`)}}const se=class se extends y{constructor(){super();t(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=v.getConfig().http.responseDataCacheTimeout}static getCachedResponse(e){const i=se.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){se.responseDataCache.set(e,{validTo:m.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,s=!1,o={}){const l=i+(u.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),h=s?se.getCachedResponse(l):void 0;return h?Promise.resolve(h):this.get(i,o).then(g=>{const w=g.map(R=>Te.instanceInitializer(e,R));return s&&w&&this.cacheResponse(i,w),w})}};t(se,"responseDataCache",new Map);let te=se;class ut extends y{checkPhoneIsBusy(r){return new Promise((e,i)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(i)})}}class pt extends y{getConfiguratorSettings(r){var e;return this.get(`internal/catalog/categories/${r.id}/configurators/${(e=r.properties)==null?void 0:e.configurator}/settings`)}searchProduct(r,e,i={}){var o;const s=this.get(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/product`,{params:e},l=>new $(l.data));return s.catch(l=>{this.errorResponseHandler(l,i)}),s}createTemplate(r,e,i={}){var s;return this.post(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template`,{...e},()=>{},i)}removeTemplate(r,e){var i;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.configurator}/template/${e}`)}}class ht{static defaultDateRanges(){const r=m.addBusinessDays(new Date,1);return{nextWorkingDay:{label:"Следующий рабочий день",from:m.startOfDay(r),to:m.endOfDay(r)},today:{label:"Сегодня",from:m.startOfToday(),to:m.endOfToday()},yesterday:{label:"Вчера",from:m.startOfYesterday(),to:m.endOfYesterday()},tomorrow:{label:"Завтра",from:m.startOfTomorrow(),to:m.endOfTomorrow()}}}}const ne=class ne{static setLinearValues(r){ne.linearValues=r}static productIsMeasurable(r){return ne.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!ne.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,i,s;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((i=r.properties)!=null&&i.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)?r.properties.minCount:.01}};t(ne,"linearValues",["пог.м.","м.","м2"]);let Ze=ne;class gt{static generateUndefinedManagerInstance(){return new fe({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Nr extends te{async getManagers(){const r="/internal/managers",e=te.getCachedResponse(r);if(e)return e;const s=(await this.get(r)).data.map(o=>Te.instanceInitializer(fe,o));return this.cacheResponse(r,s),s}}class Ee extends Xe{constructor(e){var i,s,o,l,h,g,w,R;super(e);t(this,"client");t(this,"payment");t(this,"delivery");t(this,"attachedUser");t(this,"status");t(this,"salesDirection");t(this,"pendingAt");t(this,"processedAt");t(this,"isOnOrder");t(this,"isNotInStock");this.client=new X(e==null?void 0:e.client),this.payment={type:((i=e==null?void 0:e.payment)==null?void 0:i.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:((l=e==null?void 0:e.delivery)==null?void 0:l.type)??-1,date:u.isString((h=e==null?void 0:e.delivery)==null?void 0:h.date)?m.parseISO(e.delivery.date):((g=e==null?void 0:e.delivery)==null?void 0:g.date)??new Date,address:(w=e==null?void 0:e.delivery)!=null&&w.address?new ve(e.delivery.address):void 0,warehouse:(R=e==null?void 0:e.delivery)!=null&&R.warehouse?new ge(e.delivery.warehouse):void 0},this.attachedUser=new q(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new b(e==null?void 0:e.salesDirection),this.pendingAt=u.isString(e==null?void 0:e.pendingAt)?m.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=u.isString(e==null?void 0:e.processedAt)?m.parseISO(e.processedAt):e==null?void 0:e.processedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1}}class qr extends N{constructor(e){super(e);t(this,"product");t(this,"quantity");t(this,"currency");t(this,"costOne");t(this,"costOneRub");t(this,"cost");t(this,"costRub");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"configurator");t(this,"configuratorParams");t(this,"sawing");this.product=new z(e.product),this.quantity=e.quantity,this.currency=e.currency,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.cost=e.cost,this.costRub=e.costRub,this.marker=e.marker,this.height=e.height,this.length=e.length,this.width=e.width,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams,this.sawing=e.sawing}}class Ur extends Ee{constructor(e){super(e);t(this,"products");t(this,"invoices");t(this,"comment");t(this,"image");t(this,"contragent");t(this,"barcode");t(this,"orderSource");t(this,"isAllowProcessingWithoutPayment");this.products=(e.products??[]).map(i=>new qr(i)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?we.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class mt extends Ce{getOrders(r,e,i){return this.getPaginated("/internal/orders",r,e?[e]:void 0,i,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new Ee(l)),o})}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new Ur(e.data))}}class _e{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new X(r==null?void 0:r.client),this.product=new $(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)??Se.Product}}const er=n=>{var r,e,i,s,o;return n?u.omitBy({cities:(r=n.cities)==null?void 0:r.map(l=>l.id),clients:(e=n.clients)==null?void 0:e.map(l=>l.id),managers:(i=n.managers)==null?void 0:i.map(l=>l.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(l=>l.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(l=>l.id),hideNotActive:n.hideNotActive},l=>u.isNil(l)||(u.isArray(l)||u.isObject(l))&&u.isEmpty(l)):{}},dr=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 ft extends y{analyzeProductPrices(r,e,i){return this.get(`/internal/price/products/${r}/analyze`,{...dr(e),filters:er(i)},s=>s.data.map(o=>new _e(o)))}analyzeCategoryPrices(r,e,i){return this.get(`/internal/price/categories/${r}/analyze`,{...dr(e),filters:er(i)},s=>s.data.map(o=>new _e(o)))}analyzeCategoryPricesBySquare(r,e,i){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:er(i)},s=>s.data.map(o=>new _e(o)))}}class Mr{constructor(r){t(this,"cost");t(this,"isLowCost");t(this,"isRetail");t(this,"costDate");t(this,"discountName");t(this,"priceTemplateName");t(this,"product");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=u.isString(r.costDate)?m.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new K(r.product):void 0,this.client=r.client?new q(r.client):void 0,this.executor=r.executor?new q(r.executor):void 0,this.currency=r.currency?new Pe(r.currency):void 0}}class jr extends K{constructor(e){super(e);t(this,"history");this.history=u.map(e.history,i=>new Mr(i))}}class yt extends y{constructor(){super(),this.baseUrl=`${v.getConfig().http.priceHistoryApiUrl??""}/api`}getProductPriceHistory(r){var s,o,l,h;const e=v.getConfig().dateFormats.api,i=u.omitBy(u.merge(r,{costDate:{from:u.isDate((s=r.costDate)==null?void 0:s.from)?m.format(r.costDate.from,e):(o=r.costDate)==null?void 0:o.from,to:u.isDate((l=r.costDate)==null?void 0:l.to)?m.format(r.costDate.to,e):(h=r.costDate)==null?void 0:h.to}}),g=>u.isNil(g)||(u.isArray(g)||u.isObject(g))&&u.isEmpty(g));return this.get("/internal/history",i,g=>u.map(g.data,w=>new jr(w)))}}class rr{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new K(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new K(e)))}}class Ct extends y{constructor(){super(),this.baseUrl=`${v.getConfig().http.recommendationsApiUrl??""}/api`}getProductCategoryRecommendations(r){return this.get(`/internal/recommendations/categories/${r.id}`,{},e=>new rr(e.data))}getProductRecommendations(r){return this.get(`/internal/recommendations/products/${r.id}`,{},e=>new rr(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}saveProductRecommendations(r,e){return this.post(`/internal/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}}class D extends te{getReference(r,e=!1){return this.getTypedDataArrayRequester(Ar,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(We,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(Tr,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(Pe,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(J,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(U,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(Sr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(ar,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester($r,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Je,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(b,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Ve,"/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(Y,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(F,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(G,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(ge,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Ge,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(he,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(br,"/public/references/product-file-type",!0)}}const A=V.defineStore("__references_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0),i=f.ref(void 0),s=f.ref(void 0),o=f.ref(void 0),l=f.ref(void 0),h=f.ref(void 0),g=f.ref(void 0),w=f.ref(void 0),R=f.ref(void 0),a=f.ref(void 0),M=f.ref(void 0),j=f.ref(void 0),oe=f.ref(void 0),ce=f.ref(void 0),ir=f.ref(void 0),p=f.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:i,deliveryTypeReference:s,managersList:o,opfReference:l,orderPaymentStatusReference:h,orderStatusReference:g,paymentTypeReference:w,partnerGroupReference:R,productFileTypeReference:a,resourceTypesReference:M,salesDirectionsReference:j,sourcePrimaryInterestReference:oe,warehousesReference:ce,propertyTypesReference:ir,priceCoefficientsReference:p}}),Pt=V.defineStore("references",()=>{const n=f.computed(()=>{const p=A();return!p.channelPrimaryInterestReference&&!p.dataLoaderList.channelPrimaryInterestReference&&(p.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(D).getChannelPrimaryInterest().then(C=>{p.channelPrimaryInterestReference=C}).catch(u.noop)),p.channelPrimaryInterestReference}),r=f.computed(()=>{const p=A();return!p.contactPositionsReference&&!p.dataLoaderList.contactPositionsReference&&(p.dataLoaderList.contactPositionsReference=!0,y.getInstance(D).getContactPositions().then(C=>{p.contactPositionsReference=C}).catch(u.noop)),p.contactPositionsReference}),e=f.computed(()=>{const p=A();return!p.currencyReference&&!p.dataLoaderList.currencyReference&&(p.dataLoaderList.currencyReference=!0,y.getInstance(D).getCurrency().then(C=>{p.currencyReference=C}).catch(u.noop)),p.currencyReference}),i=f.computed(()=>{const p=A();return!p.opfReference&&!p.dataLoaderList.opfReference&&(p.dataLoaderList.opfReference=!0,y.getInstance(D).getOpf().then(C=>{p.opfReference=C}).catch(u.noop)),p.opfReference}),s=f.computed(()=>{const p=A();return!p.orderPaymentStatusReference&&!p.dataLoaderList.orderPaymentStatusReference&&(p.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(D).getOrderPaymentStatuses().then(C=>{p.orderPaymentStatusReference=C}).catch(u.noop)),p.orderPaymentStatusReference}),o=f.computed(()=>{const p=A();return!p.orderStatusReference&&!p.dataLoaderList.orderStatusReference&&(p.dataLoaderList.orderStatusReference=!0,y.getInstance(D).getOrderStatuses().then(C=>{p.orderStatusReference=C}).catch(u.noop)),p.orderStatusReference}),l=f.computed(()=>{const p=A();return!p.paymentTypeReference&&!p.dataLoaderList.paymentTypeReference&&(p.dataLoaderList.paymentTypeReference=!0,y.getInstance(D).getPaymentTypes().then(C=>{p.paymentTypeReference=C}).catch(u.noop)),p.paymentTypeReference}),h=f.computed(()=>{const p=A();return!p.partnerGroupReference&&!p.dataLoaderList.partnerGroupReference&&(p.dataLoaderList.partnerGroupReference=!0,y.getInstance(D).getPartnerGroup().then(C=>{p.partnerGroupReference=C}).catch(u.noop)),p.partnerGroupReference}),g=f.computed(()=>{const p=A();return!p.productFileTypeReference&&!p.dataLoaderList.productFileTypeReference&&(p.dataLoaderList.productFileTypeReference=!0,y.getInstance(D).getProductFileType().then(C=>{p.productFileTypeReference=C}).catch(u.noop)),p.productFileTypeReference}),w=f.computed(()=>{const p=A();return!p.resourceTypesReference&&!p.dataLoaderList.resourceTypesReference&&(p.dataLoaderList.resourceTypesReference=!0,y.getInstance(D).getResourceTypes().then(C=>{p.resourceTypesReference=C}).catch(u.noop)),p.resourceTypesReference}),R=f.computed(()=>{const p=A();return!p.salesDirectionsReference&&!p.dataLoaderList.salesDirectionsReference&&(p.dataLoaderList.salesDirectionsReference=!0,y.getInstance(D).getSalesDirections().then(C=>{p.salesDirectionsReference=C}).catch(u.noop)),p.salesDirectionsReference}),a=f.computed(()=>{const p=A();return!p.sourcePrimaryInterestReference&&!p.dataLoaderList.sourcePrimaryInterestReference&&(p.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(D).getSourcePrimaryInterest().then(C=>{p.sourcePrimaryInterestReference=C}).catch(u.noop)),p.sourcePrimaryInterestReference}),M=f.computed(()=>{const p=A();return!p.deliveryTypeReference&&!p.dataLoaderList.deliveryTypeReference&&(p.dataLoaderList.deliveryTypeReference=!0,y.getInstance(D).getDeliveryTypes().then(C=>{p.deliveryTypeReference=C}).catch(u.noop)),p.deliveryTypeReference}),j=f.computed(()=>{const p=A();return!p.managersList&&!p.dataLoaderList.managersList&&(p.dataLoaderList.managersList=!0,y.getInstance(Nr).getManagers().then(C=>{p.managersList=C}).catch(u.noop)),p.managersList}),oe=f.computed(()=>{const p=A();return!p.warehousesReference&&!p.dataLoaderList.warehousesReference&&(p.dataLoaderList.warehousesReference=!0,y.getInstance(D).getWarehouses().then(C=>{p.warehousesReference=C}).catch(u.noop)),p.warehousesReference}),ce=f.computed(()=>{const p=A();return!p.propertyTypesReference&&!p.dataLoaderList.propertyTypesReference&&(p.dataLoaderList.propertyTypesReference=!0,y.getInstance(D).getPropertyTypes().then(C=>{p.propertyTypesReference=C}).catch(u.noop)),p.propertyTypesReference}),ir=f.computed(()=>{const p=A();return!p.priceCoefficientsReference&&!p.dataLoaderList.priceCoefficientsReference&&(p.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(D).getPriceCoefficients().then(C=>{p.priceCoefficientsReference=C}).catch(u.noop)),p.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:i,orderPaymentStatusReference:s,orderStatusReference:o,paymentTypeReference:l,partnerGroupsReference:h,productFilesTypesReference:g,resourceTypesReference:w,salesDirectionsReference:R,sourcePrimaryInterestsReference:a,deliveryTypeReference:M,managersList:j,warehousesReference:oe,propertyTypesReference:ce,priceCoefficientsReference:ir}});class Gr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class tr{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");var e;this.resourceType=new Je(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(i=>new Gr(i)))??[]}}class wt extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new tr(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new tr(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class vt 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(i=>{const s=[...i];let o=1;return s.forEach(l=>{l.id=o++}),s})}}var Hr=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.Guest="guest",n))(Hr||{});class Br extends je{constructor(e){super(e);t(this,"type");t(this,"canDoReclamations");t(this,"photo");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}}class Rt extends y{constructor(){super(),this.baseUrl=`${v.getConfig().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 zr extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Br(r.data))}}const Dt=V.defineStore("__user_state_private",()=>{const n=f.ref({}),r=f.ref(void 0);return{dataLoaderList:n,currentUser:r}}),At=V.defineStore("user_state",()=>({currentUser:f.computed(()=>{const r=Dt();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,y.getInstance(zr).getCurrentUser().then(e=>{r.currentUser=e}).catch(u.noop).finally(()=>{r.dataLoaderList.currentUser=!1})),r.currentUser})}));class Tt{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=Ar,c.AppBaseConfig=Kr,c.AppConfigProvider=v,c.BankAccount=Le,c.BasePaginationProvider=Ce,c.CalculationTypeEnum=pr,c.Cart=me,c.CartItem=ur,c.CartItemBase=lr,c.CartProvider=Jr,c.CatalogProvider=Qr,c.CatalogableItem=Ne,c.Category=H,c.CategoryPricingRule=He,c.ChannelPrimaryInterest=We,c.City=nt,c.CityWithRegionAndCountry=$e,c.Client=Ye,c.ClientAdditionalData=Or,c.ClientCategory=ye,c.ClientDataProvider=I,c.ClientPriceProvider=Yr,c.ClientPriceTemplateProvider=Xr,c.ClientProduct=z,c.ClientProductCategoryDataProvider=et,c.ClientProductDataProvider=rt,c.ClientShortInfo=X,c.ClientsAdditionalDataRequestTypeEnum=Dr,c.ClientsListFilters=ot,c.CodedIdentity=K,c.ConfiguratorProvider=pt,c.Contact=ke,c.ContactLinks=fr,c.ContactPerson=d,c.ContactPersonRelated=kr,c.ContactPosition=Tr,c.ContactRelation=Oe,c.ContragentBase=xe,c.ContragentFactory=we,c.ContragentIc=Ke,c.ContragentPerson=Ir,c.ContragentUlNr=Lr,c.ContragentUlR=Qe,c.CostSourceEnum=Se,c.Country=F,c.Currency=Pe,c.DataSuggestionProvider=vt,c.DataTablePagination=ct,c.DataTablePaginationRequestParams=_r,c.DataTableSortRequestParams=lt,c.DateTimeProvider=ht,c.DeletableNamedIdentity=gr,c.DeliveryAddress=ve,c.DeliveryType=G,c.DetailedJwtPayload=Wr,c.DeviceTypeResolutionConfig=Cr,c.DiscountShortInfo=mr,c.FieldValidationResultData=Tt,c.FilterGroup=re,c.FilterItem=Be,c.FilterOpEnum=Ie,c.GeoCoordinates=Ue,c.HiddenCatalogableItem=or,c.HttpCachedRequester=te,c.HttpParamsConfig=Pr,c.HttpRequester=y,c.Identity=N,c.Image=cr,c.JwtPayload=_,c.Manager=fe,c.ManagerCommon=Q,c.ManagerDataFactory=gt,c.ManagerDataProvider=Nr,c.MetaTagItem=Gr,c.NamedIdentity=T,c.Opf=U,c.OpfEnum=O,c.Order=Ur,c.OrderInfo=Ee,c.OrderPaymentStatus=Sr,c.OrderProduct=qr,c.OrderShortInfo=Xe,c.OrderStatus=ar,c.OrdersDataProvider=mt,c.PartnerGroup=J,c.PaymentType=$r,c.PreferencesStorageProvider=ue,c.PriceAnalyze=_e,c.PriceAnalyzeProvider=ft,c.PriceCoefficient=he,c.PriceCoefficientEnum=qe,c.PriceHistoryDataProvider=yt,c.PriceHistoryItem=Mr,c.PriceTemplate=B,c.PriceTemplateCategory=ae,c.PriceTemplateClient=Z,c.PriceTemplateICatalogableItem=Me,c.PriceTemplateProduct=be,c.PriceTemplateProvider=tt,c.PricingRole=ee,c.PricingRoleProvider=it,c.PrimaryCatalogableItem=De,c.Product=$,c.ProductCategoryDataProvider=Zr,c.ProductDataProvider=Er,c.ProductFileType=br,c.ProductPriceCoefficient=Ae,c.ProductPriceHistory=jr,c.PropertiesProvider=st,c.Property=E,c.PropertyType=Ge,c.PropertyTypeEnum=hr,c.PropertyValue=W,c.RecommendationsDataProvider=Ct,c.RecommendationsList=rr,c.Reference=P,c.ReferenceDataProvider=D,c.Region=Y,c.ResourceType=Je,c.SalesDirection=b,c.SentryConfig=wr,c.Seo=tr,c.SeoDataProvider=wt,c.SourcePrimaryInterest=Ve,c.StockCount=nr,c.TemplatesListFilters=xr,c.TypedInstanceFactory=Te,c.UnitsHelper=Ze,c.UnknownClientDataProvider=ut,c.UpdatableNamedIdentity=de,c.User=Br,c.UserAuthDataProvider=Rt,c.UserCommonInfo=je,c.UserDataProvider=zr,c.UserPricingRole=yr,c.UserShortInfo=q,c.UserTypeEnum=Hr,c.VersionConfig=vr,c.Warehouse=ge,c.WebSocketConfig=Rr,c.findCatalogItemByIdRecursive=ze,c.flattenCatalogItems=Fe,c.useAuthStateStore=Re,c.useReferencesStore=Pt,c.useUserStateStore=At,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(c,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("date-fns"),require("pinia"),require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","date-fns","pinia","vue","axios"],S):(c=typeof globalThis<"u"?globalThis:c||self,S(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c["date-fns"],c.pinia,c.vue,c.axios))})(this,function(c,S,u,le,g,V,m,Jr){"use strict";var $t=Object.defineProperty;var bt=(c,S,u)=>S in c?$t(c,S,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[S]=u;var t=(c,S,u)=>bt(c,typeof S!="symbol"?S+"":S,u);class _{constructor(r){t(this,"exp",0);t(this,"iat",0);t(this,"authTime",0);t(this,"jti","");t(this,"iss","");t(this,"aud",[]);t(this,"sub","");t(this,"typ","Bearer");t(this,"azp","");t(this,"sid","");t(this,"acr","");t(this,"allowedOrigins",[]);t(this,"realmAccess",{roles:[]});t(this,"resourceAccess",{});t(this,"scope","");t(this,"emailVerified",!1);t(this,"name","");t(this,"guid","");t(this,"preferredUsername","");t(this,"givenName","");t(this,"email","");u.merge(this,r)}static getJwtPayload(r){const e=S.jwtDecode(r),i=new _(le.objectToCamel(e));return i.resourceAccess=e.resource_access,i}}class Vr extends _{constructor(e){super(e);t(this,"familyName");t(this,"middleName");t(this,"locale");t(this,"phoneNumber");t(this,"phoneNumberVerified");t(this,"address");u.merge(this,e)}static getJwtPayload(e){return new _(le.objectToCamel(S.jwtDecode(e)))}}const ie=class ie{static init(r){ie.config=r}static getConfig(){if(u.isUndefined(ie.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return ie.config}static loadRemoteConfig(r="/config.json"){const e=fetch(r).then(i=>i.ok?i.json():(console.error(new Error(`Ошибка загрузки ${r}: ${i.statusText}`)),new Promise(s=>{s({})})));return e.catch(i=>{console.error(i)}),e}};t(ie,"config");let R=ie;class ue{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const i=JSON.parse(e);if(!i.availableFor||g.isAfter(g.parseISO(i.availableFor)||g.startOfToday(),new Date)){if(u.isNil(i.data)||u.isEmpty(i.data))throw new Error("Data is empty");return i.data}}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,i){if(this.isLocalStorageAvailable())try{if(u.isNil(e)||u.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:i,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:i,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 i=localStorage.key(e);if(i)try{const s=localStorage.getItem(i);if(s){const o=JSON.parse(s);o.availableFor&&!g.isAfter(g.parseISO(o.availableFor)||g.startOfToday(),new Date)&&r.push(i)}}catch{r.push(i)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function cr(n){try{const r=_.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const x=V.defineStore("__auth_state_private",()=>{const n=m.ref((()=>{var h;const o=ue.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const l=(h=R.getConfig().devMode)==null?void 0:h.initAuthBearerToken;return l?Promise.resolve(l):void 0})()),r=m.ref(void 0),e=m.ref(void 0),i=m.markRaw(new Map);function s(){e.value=void 0,u.isNil(n.value)||n.value.then(o=>{const l=_.getJwtPayload(o);e.value=l.exp*1e3>Date.now()?u.mapValues(l.resourceAccess,h=>(h==null?void 0:h.roles)??[]):void 0}).catch(u.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:i,recalculateUserPermissions:s}}),Re=V.defineStore("__auth_state",()=>{const n=m.computed(()=>{const o=x();if(u.isNil(o.jwtToken)&&!u.isNil(o.jwtTokenUpdater)){const l=o.jwtTokenUpdater();o.jwtToken=l,l.then(h=>{o.jwtToken=Promise.resolve(h),ue.saveActualDataToStorage("sc.token",h,cr(h)),o.recalculateUserPermissions()}).catch(u.noop)}return o.jwtToken});function r(o){x().jwtTokenUpdater=o}function e(o){const l=x();l.jwtToken=Promise.resolve(o),ue.saveActualDataToStorage("sc.token",o,cr(o)),l.recalculateUserPermissions()}function i(){const o=x();o.jwtToken=void 0,o.userPermissions=void 0,ue.saveActualDataToStorage("sc.token",void 0)}function s(o){const l=x();!u.isNil(l.jwtToken)&&u.isNil(l.userPermissions)&&l.jwtToken.then(v=>{const w=_.getJwtPayload(v);l.userPermissions=w.exp*1e3>Date.now()?u.mapValues(w.resourceAccess,a=>(a==null?void 0:a.roles)??[]):void 0}).catch(u.noop);const h=u.isArray(o)?o.join(" && "):o;if(l.userPermissionsComputedRefs.has(h))return l.userPermissionsComputedRefs.get(h);const f=m.computed(()=>{const v=w=>{var ce;const a=u.split(w,".");if(a.length<2)return!1;const[M,j]=a,oe=(ce=x().userPermissions)==null?void 0:ce[M];return u.isArray(oe)&&oe.includes(j)};return u.isArray(o)?u.every(o,w=>v(w)):v(o)});return l.userPermissionsComputedRefs.set(h,f),f}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:i,hasUserPermission:s}});class N{constructor(r,e){t(this,"id");t(this,"guid");this.id=r==null?void 0:r.id,u.isNil(this.id)&&(u.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==="":u.isNil(this.id)}}class T extends N{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class K extends T{constructor(e){super(e);t(this,"code","");this.code=(e==null?void 0:e.code)??""}}class qe extends K{constructor(e){super(e);t(this,"slug");t(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class De extends qe{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class pe extends De{constructor(e){super(e);t(this,"isHidden");t(this,"parentCategoryId");t(this,"properties");t(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(([i,s])=>[u.toUpper(i),s])):void 0}}var Ue=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(Ue||{});class P extends T{constructor(e){super(e);t(this,"slug");t(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class he extends P{static getRetailPriceCoefficient(){return{id:-2,slug:Ue.Retail,name:"Розн. цена",guid:"",isNewRec:u.constant(!0)}}}class Ae{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new he(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 de{constructor(r){t(this,"lat");t(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class G extends P{}class ge extends P{constructor(e){var i;super(e);t(this,"address");t(this,"isMain");t(this,"deliveryTypes");t(this,"regions");t(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((i=e==null?void 0:e.deliveryTypes)==null?void 0:i.map(s=>new G(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new de(e==null?void 0:e.coordinates)}}class lr{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new ge(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class ur extends qe{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class pr{constructor(r,e){t(this,"image");t(this,"preview");t(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class $ extends ur{constructor(e){var s,o,l,h;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");t(this,"quantityUnit");t(this,"currency");t(this,"currencySignature");t(this,"cost");t(this,"costRub");t(this,"costDate");t(this,"onOrder");t(this,"stockCount");t(this,"category");t(this,"categories");t(this,"images");t(this,"properties");t(this,"retailCost");t(this,"retailCostRub");t(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=(e==null?void 0:e.unit)??"",this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.quantityUnit=e==null?void 0:e.quantityUnit,this.currency=(e==null?void 0:e.currency)??"",this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=u.isString(e==null?void 0:e.costDate)?g.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 lr(f)))??[],this.currencySignature=(e==null?void 0:e.currencySignature)??"",this.type="product";const i=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(f=>f.isPrimary));i&&(this.category=new De({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(f=>new De(f))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(f=>new pr(f,R.getConfig().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=((h=e==null?void 0:e.priceCoefficients)==null?void 0:h.map(f=>new Ae(f)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){var i;const e=(i=R.getConfig().catalog)==null?void 0:i.products.units;return[...(e==null?void 0:e.linear)??["пог.м.","м."],...(e==null?void 0:e.square)??["м2"]].includes(this.unit)}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}class hr extends N{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"height");t(this,"length");t(this,"width");t(this,"barcode");t(this,"marker");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");this.product=new $(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new pe,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&u.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class gr extends hr{constructor(e){super(e);t(this,"currency");t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");this.currency=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=e.sawing}}class me{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new gr(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Te{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const L=class L{constructor(){t(this,"httpClient");t(this,"baseUrl",`${R.getConfig().http.portalApiUrl}/api`);t(this,"errorResponseHandler",u.noop);t(this,"interceptorIds",{request:{},response:{}});t(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));t(this,"authRequestInterceptor",async r=>{let e;return u.isNil(Re().jwtToken)||(e=await Re().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});t(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=le.objectToSnake(r.params)),["put","patch","post"].includes(u.toLower(r.method))&&r.data&&(r.data=le.objectToSnake(r.data))),r));t(this,"authErrorsResponseInterceptors",r=>{var i;const e=r.rawError?(i=r.rawError)==null?void 0:i.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(Re().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});t(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=le.objectToCamel(r.data)),r));const r=R.getConfig().version;this.errorResponseHandler=L.defaultErrorsResponseHandler,this.httpClient=Jr.create({headers:{"APP-VERSION":`${r.name} (${r.version}, ${g.format(r.date,R.getConfig().dateFormats.uiDate)})`,Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,e=>Promise.reject(e)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,e=>Promise.reject(e)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,e=>Promise.reject(e)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(e=>e,e=>L.convertHttpErrorResponse(e)),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(e=>e,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,e=>Promise.reject(e))}static setDefaultErrorsResponseHandler(r){L.defaultErrorsResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(L.instances,r.name)||(L.instances[r.name]=Te.simpleInstanceInitializer(r)),L.instances[r.name]}static convertHttpErrorResponse(r){var e,i;if(!u.isNil(r.request)||!u.isNil(r.response)){const s=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:(i=s==null?void 0:s.data)==null?void 0:i.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,i={},s=!1){const o=this.httpClient.request(r).then(l=>e?e(l):l.data);return o.catch(l=>{this.errorResponseHandler(l,i,s)}),o}get(r,e={},i=void 0,s=!1){return this.request({method:"GET",url:r,params:e},i,{},s)}getBlob(r,e={},i=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},i,{},s)}patch(r,e={},i=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},i,s,o)}post(r,e={},i=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},i,s,o)}delete(r,e=void 0,i=!1){return this.request({method:"DELETE",url:r},e,{},i)}};t(L,"instances",{}),t(L,"defaultErrorsResponseHandler",u.noop);let y=L;class xr extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new me(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},s=>new me(s.data),i)}patchCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},s=>new me(s.data),i)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,i=>new me(i.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 mr=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(mr||{}),Se=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Se||{}),fr=(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))(fr||{});class H extends pe{constructor(e){var i,s;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new H(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new $(o))}}class Me extends T{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=u.isString(e==null?void 0:e.updatedAt)?g.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class yr extends Me{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?g.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class q extends T{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class Cr extends T{constructor(e){super(e);t(this,"costCoefficient");t(this,"isLowPriceAllowed");t(this,"publishedAt");t(this,"description");t(this,"percent");t(this,"owner");t(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=u.isString(e==null?void 0:e.publishedAt)?g.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 q(e==null?void 0:e.owner),this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?g.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class B extends Me{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}class z extends ${constructor(e){super(e);t(this,"costCoefficient");t(this,"costSource");t(this,"discount");t(this,"priceTemplate");t(this,"isPreviouslyOrdered");t(this,"isRequired");t(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??Se.Product,this.discount=e!=null&&e.discount?new Cr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new B(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 je{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class b extends P{}class Q extends T{constructor(e){super(e);t(this,"salesDirection");t(this,"photo");t(this,"contacts");t(this,"isDefault");t(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new b(e.salesDirection):new b,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new je(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class ae extends P{}class wr extends T{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class fe extends Q{constructor(e){var i;super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");t(this,"pricingRole");t(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 wr(e.pricingRole):void 0,this.curatedDirections=((i=e==null?void 0:e.curatedDirections)==null?void 0:i.map(s=>new ae(s)))??[]}}class Kr extends pe{constructor(e){super(e);t(this,"isDisabled");t(this,"isRequired");t(this,"isFavorite");t(this,"hidingComment");t(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 fe(e.manager):void 0}}class ye extends Kr{constructor(e){var i,s;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new ye(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new z(o))}}class Ge{constructor(r){t(this,"priceCoefficient");t(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new he(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class $e extends Ge{constructor(e){super(e);t(this,"productCategory");this.productCategory=new pe(e==null?void 0:e.productCategory)}}class He extends T{constructor(e){super(e);t(this,"photo");t(this,"contacts");t(this,"curatedDirection");this.photo=e.photo,this.contacts=new je(e.contacts),this.curatedDirection=new ae(e.curatedDirection)}}class F extends P{}class Y extends P{constructor(e){super(e);t(this,"country",new F);e&&(this.country=new F(e.country))}}class be extends P{constructor(e){super(e);t(this,"region",new Y);e&&(this.region=new Y(e.region))}}class Be extends T{constructor(e){super(e);t(this,"phone");t(this,"email");t(this,"getNews");t(this,"salesDirection");t(this,"createdAt");t(this,"lastLoginAt");t(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 b(e.salesDirection):void 0,this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=u.isString(e==null?void 0:e.lastLoginAt)?g.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class X extends Be{constructor(e){var i,s;super(e);t(this,"salesDirection");t(this,"debt");t(this,"alternativeName");t(this,"city");t(this,"comment");t(this,"isPhoneApproved");t(this,"isEmailApproved");t(this,"managers");t(this,"curators");this.salesDirection=new b(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 be(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=((i=e==null?void 0:e.managers)==null?void 0:i.map(o=>new Q(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new He(o)))??[]}}class Z extends N{constructor(e){super(e);t(this,"createdAt");t(this,"deletedAt");t(this,"client");t(this,"priceTemplate");this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?g.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new X(e==null?void 0:e.client),this.priceTemplate=new B(e==null?void 0:e.priceTemplate)}}class Ie extends Ge{constructor(e){super(e);t(this,"product");this.product=new $(e==null?void 0:e.product)}}class ze extends P{}class E extends T{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new ze(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class W{constructor(r){t(this,"property");t(this,"value");this.property=new E(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class k{constructor(r){t(this,"from");t(this,"to");this.from=u.isString(r==null?void 0:r.from)?g.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=u.isString(r==null?void 0:r.to)?g.parseISO(r.to):(r==null?void 0:r.to)??null}}class Qr{constructor(r){t(this,"id");t(this,"name");t(this,"description");t(this,"createdAt",new k);t(this,"updatedAt",new k);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.createdAt=new k(r==null?void 0:r.createdAt),this.updatedAt=new k(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":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,i,s,o;const r={};return Object.keys(this).forEach(l=>{const h=this[l];u.isNil(h)||u.isString(h)&&h.trim().length===0||u.isFunction(h.isNewRec)&&h.isNewRec()||(r[l]=h)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.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 ee extends T{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");t(this,"subRoles",[]);t(this,"parentRole");t(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 Fe{constructor(r){t(this,"role");t(this,"category");t(this,"minCoefficient");this.role=new ee(r==null?void 0:r.role),this.category=new pe(r==null?void 0:r.category),this.minCoefficient=new he(r==null?void 0:r.minCoefficient)}}class Pr{constructor(r){t(this,"phone");t(this,"tablet");t(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 vr{constructor(r){t(this,"portalApiUrl");t(this,"priceHistoryApiUrl");t(this,"recommendationsApiUrl");t(this,"mediaUrl");t(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.priceHistoryApiUrl=(r==null?void 0:r.priceHistoryApiUrl)??"",this.recommendationsApiUrl=(r==null?void 0:r.recommendationsApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class Rr{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,i,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|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((i=r==null?void 0:r.trace)==null?void 0:i.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 Dr{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=u.isString(r==null?void 0:r.date)?g.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"}}class Ar{constructor(r){t(this,"broadcaster");t(this,"key");t(this,"wsHost");t(this,"wsPort");t(this,"wssPort");t(this,"forceTLS");t(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 Yr{constructor(r){t(this,"environment");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"sentry");t(this,"tableDefaultHeightCoefficient");t(this,"urls");t(this,"version");t(this,"websocket");t(this,"dateFormats");var e,i,s;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new vr(r==null?void 0:r.http),this.deviceTypeByResolution=new Pr(r==null?void 0:r.deviceTypeByResolution),this.sentry=new Rr({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.version=new Dr(r==null?void 0:r.version),this.websocket=r!=null&&r.websocket?new Ar(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:((i=r==null?void 0:r.dateFormats)==null?void 0:i.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}class Xr extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,i=void 0,s=void 0){let l=`${R.getConfig().http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return i&&(l+=`&category_id=${i}`),s&&(l+=`&client_id=${s}`),l}}class Zr extends y{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,i){var s;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.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,i){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:i})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,i){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:i})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}updateProductPrice(r,e,i){var s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value},o=>new z(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,i=>new z(i.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,i=>new Blob([i.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,i=>new Blob([i.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class Er extends y{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new Z(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new Z(e.data),!0)}attachTemplate(r,e,i){const s=R.getConfig().dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,i&&{startAt:i.startAt&&g.format(i.startAt,s),endAt:i.endAt&&g.format(i.endAt,s)},o=>new Z(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,i,s){const o=R.getConfig().dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${i}`,s&&{startAt:s.startAt&&g.format(s.startAt,o),endAt:s.endAt&&g.format(s.endAt,o)},l=>new Z(l.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class et extends y{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(i=>new H(i)))}getCategoryData(r,e=!1,i=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:i},s=>new H(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new H(e.data))}getCategoryProductsList(r,e=!0,i=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:i,withPriceCoefficients:e},s=>u.map(s.data,o=>new $(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return u.forEach(i,s=>s.map(o=>new Ae(o))),i})}publicSimpleSearch(r,e=10){return new Promise((i,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.categories.map(l=>new H(l)))}).catch(o=>{s(o)})})}}class rt extends y{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new $(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new $(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>u.map(e.data,i=>new Ae(i)))}publicSimpleSearch(r,e=10){return new Promise((i,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.products.map(l=>new $(l)))}).catch(o=>{s(o)})})}}class tt extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(s=>new ye(s)))}getCategoryData(r,e,i=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:s},o=>new ye(o.data))}getCategoryProductsList(r,e,i=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:i},o=>u.map(o.data,l=>new z(l)))}}class it extends y{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},s=>new z(s.data))}}var Le=(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))(Le||{});class We{constructor(r){t(this,"field");t(this,"op");t(this,"value");this.field=(r==null?void 0:r.field)??"",this.op=(r==null?void 0:r.op)??Le.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r={field:this.field,op:this.op};return r.value=u.isDate(this.value)?g.format(this.value,R.getConfig().dateFormats.api):this.value,r}}class re{constructor(r){t(this,"groupOp");t(this,"filters");t(this,"groups");var e,i;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 We(s)))??[],this.groups=((i=r==null?void 0:r.groups)==null?void 0:i.map(s=>new re(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof We&&u.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof re?r.toPrimitive():r)}}}class Ce extends y{getPaginated(r,e,i,s,o,l,h){let f={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(f.filters=JSON.stringify((e instanceof re?e:new re(e)).toPrimitive())),u.isEmpty(i)||(f.sort=u.isArray(i)?i:[i]),o&&(f={...f,...o}),this.get(r,f,l,h)}}class st extends Ce{getTemplateList(r,e,i){return this.getPaginated("/internal/price/templates",r,e,i,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new B(l)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,i=>new B(i.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new B(e.data))}updateTemplate(r,e,i={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new B(s.data),i)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.get(`/internal/price/templates/${r}/products`,{},e=>e.data.map(i=>new Ie(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new Ie(i.data))}saveProductTemplatePrice(r,e,i){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value},o=>new Ie(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.get(`/internal/price/templates/${r}/categories`,{},e=>e.data.map(i=>new $e(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new $e(i.data))}saveCategoryTemplatePrice(r,e,i,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=i.coefficient)==null?void 0:o.id,increase_percent:i.value},params:s?{recursively:!0}:{}},l=>new $e(l.data))}deleteCategoryTemplatePrice(r,e,i=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:i?{recursively:!0}:{}})}getTemplateClients(r){return this.get(`/internal/price/templates/${r}/clients`,{},e=>e.data.map(i=>new Z(i)))}}class nt extends y{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new ee(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new ee(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new ee(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new ee(i.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.get(`/internal/price/roles/rules/categories/${r}`,{},e=>e.data.map(i=>new Fe(i)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,i=>i.data.map(s=>new Fe(s)))}}class ot extends Ce{getProperties(r,e,i){return this.getPaginated("/internal/catalog/properties",r,e,i,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new E(l)),o})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},s=>new E(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new E(e.data))}updateProperty(r,e){const{typeId:i,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:i},o=>new E(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.get(`/internal/catalog/products/${r}/properties`,{},e=>e.data.map(i=>new W(i)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},i=>new W(i.data))}updateProductProperty(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:i},s=>new W(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,i){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,i)}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.get(`/internal/catalog/categories/${r}/properties`,{},e=>e.data.map(i=>new W(i)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},i=>new W(i.data))}updateCategoryProperty(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:i},s=>new W(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,i){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,i)}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})}}function Je(n,r,e){let i;return n.some(s=>{if(s.type===e&&s.id===r)return i=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const l=Je(o.products,r,e);if(l)return i=l,!0}if(o.categories&&o.categories.length>0){const l=Je(o.categories,r,e);if(l)return i=l,!0}return!1}),i}function Ve(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const i=e;i.products&&i.products.length>0&&r.push(...Ve(i.products)),i.categories&&i.categories.length>0&&r.push(...Ve(i.categories))}}),r}var Tr=(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))(Tr||{}),O=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(O||{});class Sr extends P{}class xe extends P{}class ct extends P{}class ar extends P{}class we extends T{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}class U extends P{static generatePersonItem(){return new U({id:1,guid:"",slug:O.Person,name:""})}}class $r extends P{}class br extends P{}class J extends P{}class Ir extends P{}class Lr extends P{}class Ke extends P{}class Qe extends P{}class ke extends N{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new we);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new we(e.currency))}}class Oe extends T{constructor(e){super(e);t(this,"phone");t(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 d extends Oe{constructor(e){super(e);t(this,"isPrimary");t(this,"position");t(this,"notDisturb");t(this,"comment");t(this,"updatedAt");t(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=u.isString(e==null?void 0:e.deletedAt)?g.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class Ye extends T{constructor(e){super(e);t(this,"manager",new Q);t(this,"opf",U.generatePersonItem());t(this,"salesDirection",new b);t(this,"partnerGroup",new J);t(this,"contacts",[]);t(this,"bankAccounts",[]);t(this,"comment");t(this,"alternativeName");t(this,"createdAt");t(this,"creator");t(this,"updatedAt");t(this,"updater");if(e){if(this.opf=new U(e.opf),this.salesDirection=new b(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new q(e.creator):void 0,this.updatedAt=u.isString(e==null?void 0:e.updatedAt)?g.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new q(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new J(e.partnerGroup)),e.manager&&(this.manager=new Q(e.manager)),e.contacts){const i=[];e.contacts.forEach(s=>{i.push(new d(s))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(s=>{i.push(new ke(s))}),this.bankAccounts=i}}}}class kr extends Ye{constructor(r){super(r)}}class Xe extends Ye{constructor(e){super(e);t(this,"inn","");t(this,"okpo","");t(this,"directorName","");t(this,"directorPosition","");t(this,"directorActsOn","");t(this,"legalAddress","");t(this,"postalAddress","");t(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 Ze extends Xe{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class Or extends Ze{constructor(e){super(e);t(this,"registrationCountry",new F);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new F(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class Pe{static createInstance(r){switch(r.opf.slug){case O.Ic:return new Xe(r);case O.UlR:return new Ze(r);case O.UlNr:return new Or(r);default:return new kr(r)}}}class _e extends N{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class _r extends d{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(i=>new _e(i))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(i=>new _e(i))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(i=>new _e(i))))}}class ve extends yr{constructor(e){var i;super(e);t(this,"address","");t(this,"coordinates");t(this,"contacts");t(this,"comment");t(this,"operatingHours");t(this,"isOneTime");t(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new de(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(s=>new d(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 Ee extends X{constructor(e){var i,s,o,l;super(e);t(this,"contragents");t(this,"partnerGroups");t(this,"contacts");t(this,"deliveryAddresses");t(this,"channelPrimaryInterest");t(this,"sourcePrimaryInterest");t(this,"preferredDeliveryType");t(this,"primaryDemand");t(this,"isExcludedFromMsCallsToClients");t(this,"reasonExcludedFromMsCallsToClients");t(this,"preferredWarehouse");t(this,"extraData");this.contragents=((i=e==null?void 0:e.contragents)==null?void 0:i.map(h=>Pe.createInstance(h)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(h=>new J(h)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(h=>new d(h)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(h=>new ve(h)))??[],this.channelPrimaryInterest=new xe(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Qe(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new G(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.reasonExcludedFromMsCallsToClients=e==null?void 0:e.reasonExcludedFromMsCallsToClients,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new ge(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class lt{constructor(r){t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"searchTerm");t(this,"cities");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",new k);t(this,"lastLoginDate",new k);t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"curators");t(this,"isManagerRequired");t(this,"salesDirections");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"partnerGroups");t(this,"contact");t(this,"lastOrder");t(this,"isExcludedFromMsCallsToClients");var e,i,s,o,l,h,f,v;this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.alternativeName=r==null?void 0:r.alternativeName,this.searchTerm=r==null?void 0:r.searchTerm,this.cities=(e=r==null?void 0:r.cities)==null?void 0:e.map(w=>new be(w)),this.region=new Y(r==null?void 0:r.region),this.country=new F(r==null?void 0:r.country),this.phone=r==null?void 0:r.phone,this.email=r==null?void 0:r.email,this.isActive=r&&Object.prototype.hasOwnProperty.call(r,"isActive")?r==null?void 0:r.isActive:!0,this.createdAt=new k(r==null?void 0:r.createdAt),this.lastLoginDate=new k(r==null?void 0:r.lastLoginDate),this.lastLoginDateHasOrder=(r==null?void 0:r.lastLoginDateHasOrder)??void 0,this.managers=((i=r==null?void 0:r.managers)==null?void 0:i.map(w=>new fe(w)))??[],this.curators=((s=r==null?void 0:r.curators)==null?void 0:s.map(w=>new He(w)))??[],this.salesDirections=(o=r==null?void 0:r.salesDirections)==null?void 0:o.map(w=>new b(w)),this.contragentInn=r==null?void 0:r.contragentInn,this.contragentType=new U(r==null?void 0:r.contragentType),this.preferredDeliveryType=new G(r==null?void 0:r.preferredDeliveryType),this.partnerGroups=(l=r==null?void 0:r.partnerGroups)==null?void 0:l.map(w=>new J(w)),this.contact=new Oe(r==null?void 0:r.contact),this.lastOrder={createdAt:new k((h=r==null?void 0:r.lastOrder)==null?void 0:h.createdAt),creator:(f=r==null?void 0:r.lastOrder)==null?void 0:f.creator,isApproved:(v=r==null?void 0:r.lastOrder)==null?void 0:v.isApproved},this.isExcludedFromMsCallsToClients=r==null?void 0:r.isExcludedFromMsCallsToClients}resetFilterValue(r){switch(r){case"cities":this.cities=[];break;case"region":this.region=new Y;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"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new U;break;case"preferredDeliveryType":this.preferredDeliveryType=new G;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Oe;break;default:this[r]=void 0;break}return this}asClearRaw(){var e,i,s,o;const r={};return Object.keys(this).forEach(l=>{const h=this[l];u.isNil(h)||u.isString(h)&&h.trim().length===0||u.isFunction(h.isNewRec)&&h.isNewRec()||(r[l]=h)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((s=r==null?void 0:r.lastLoginDate)!=null&&s.from)&&!((o=r==null?void 0:r.lastLoginDate)!=null&&o.to)&&delete r.lastLoginDate,r}}class er extends N{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new q(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Nr extends T{constructor(e){var i,s;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");t(this,"salesDirection");t(this,"managers");(i=e.contacts)!=null&&i.length&&(this.contacts=e.contacts.map(o=>new d(o))),e.lastOrder&&(this.lastOrder=new er(e.lastOrder)),(s=e.partnerGroups)!=null&&s.length&&(this.partnerGroups=e.partnerGroups.map(o=>new J(o))),e.preferredDeliveryType&&(this.preferredDeliveryType=new G(e.preferredDeliveryType)),e.salesDirection&&(this.salesDirection=new b(e.salesDirection)),e.managers&&(this.managers=e.managers.map(o=>new Q(o)))}}class qr{constructor(r){t(this,"page",1);t(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class ut extends qr{constructor(e){super(e);t(this,"itemCount",0);t(this,"pageCount",1);t(this,"pageSlot",5);t(this,"pageSizes",[25,50,100]);t(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 pt{constructor(r){t(this,"field");t(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class I extends Ce{static transformClientDataToRequest(r){var i;const e={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,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(i=r.preferredWarehouse)==null?void 0:i.id};return r.isExcludedFromMsCallsToClients&&(e.reason_excluded_from_ms_calls_to_clients=r.reasonExcludedFromMsCallsToClients),e}static transformContragentClientDataToRequest(r){var l,h,f,v,w,a,M,j;let e;const i=r,s=r,o=r;switch(r.opf.slug){case O.Ic:e={opf:i.opf.slug,name:i.name,alternative_name:i.alternativeName,partner_group_id:(l=i.partnerGroup)==null?void 0:l.id,manager_id:(h=i.manager)==null?void 0:h.id,comment:i.comment,inn:i.inn,okpo:i.okpo,director_name:i.directorName,director_position:i.directorPosition,director_acts_on:i.directorActsOn,legal_address:i.legalAddress,postal_address:i.postalAddress,actual_address:i.actualAddress};break;case O.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(f=s.partnerGroup)==null?void 0:f.id,manager_id:(v=s.manager)==null?void 0:v.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 O.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(w=o.partnerGroup)==null?void 0:w.id,manager_id:(a=o.manager)==null?void 0:a.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:(M=r.partnerGroup)==null?void 0:M.id,manager_id:(j=r.manager)==null?void 0:j.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var i,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:(i=r.coordinates)==null?void 0:i.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 Ee(e.data))}getClientsList(r,e,i,s){return this.getPaginated("/internal/clients",r,e,i,s,o=>{const l={...o.data};return l.data=l.data.map(h=>new X(h)),l})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Le.Contains,value:r}]})}getAdditionalClientsData(r,e){const i=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:i,requested_data_types:e},s=>{let o=[];return(s==null?void 0:s.data.length)>0&&(o=s.data.map(l=>new Nr(l))),o})}getAllClientContacts(r){return this.get(`/internal/clients/${r}/contacts/all`,{},e=>{let i=[];return(e==null?void 0:e.data.length)>0&&(i=e.data.map(s=>new _r(s))),i})}createClientCommonData(r,e={}){return this.post("/internal/clients",I.transformClientDataToRequest(r),i=>new Ee(i.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,I.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const i={get_news:r.getNews,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients};return r.isExcludedFromMsCallsToClients&&(i.reason_excluded_from_ms_calls_to_clients=r.reasonExcludedFromMsCallsToClients),this.patch(`/internal/clients/${r.id}`,i,void 0,e)}changeClientPassword(r,e,i,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:i},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 i=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(i)}async detachClientFromManagers(r,e){const i=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(i)}attachToCurator(r,e,i){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:i.id})}detachFromCurator(r,e,i){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:i.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(i=>({curator_id:i.curatorId,curated_direction_id:i.curatedDirection.id}))})}createContragentClientData(r,e,i={}){return this.post(`/internal/clients/${r}/contragents`,I.transformContragentClientDataToRequest(e),s=>Pe.createInstance(s.data),i)}updateContragentClientData(r,e,i={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,I.transformContragentClientDataToRequest(e),s=>Pe.createInstance(s.data),i)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,i={}){return this.post(`/internal/clients/${r}/delivery-addresses`,I.transformClientDeliveryAddressToRequest(e),s=>new ve(s.data),i)}updateClientDeliveryAddress(r,e,i={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,I.transformClientDeliveryAddressToRequest(e),s=>new ve(s.data),i)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,i,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,I.transformClientContragentBankAccountToRequest(i),o=>new ke(o.data),s)}updateContragentBankAccount(r,e,i,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`,I.transformClientContragentBankAccountToRequest(i),o=>new ke(o.data),s)}deleteContragentBankAccount(r,e,i){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`)}createClientContact(r,e,i={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},i)}updateClientContact(r,e,i={}){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 d(s.data),i)}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,i,s={}){return this.createContact(r,i,{contragents:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,i){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${i.id}/primary`,i.isPrimary??!1)}detachContragentContact(r,e,i){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${i.id}/detach`)}createDeliveryAddressContact(r,e,i,s={}){return this.createContact(r,i,{addresses:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,i){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${i.id}/primary`,i.isPrimary??!1)}detachDeliveryAddressContact(r,e,i){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${i.id}/detach`)}createContact(r,e,i,s={}){var l,h;const o={name:e.name,position:e.position,comment:e.comment,...i};return(l=e.phone)!=null&&l.length&&(o.phone=e.phone),(h=e.email)!=null&&h.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,f=>new d(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}`)}}const se=class se extends y{constructor(){super();t(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=R.getConfig().http.responseDataCacheTimeout}static getCachedResponse(e){const i=se.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){se.responseDataCache.set(e,{validTo:g.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,s=!1,o={}){const l=i+(u.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),h=s?se.getCachedResponse(l):void 0;return h?Promise.resolve(h):this.get(i,o).then(f=>{const v=f.map(w=>Te.instanceInitializer(e,w));return s&&v&&this.cacheResponse(i,v),v})}};t(se,"responseDataCache",new Map);let te=se;class ht extends y{checkPhoneIsBusy(r){return new Promise((e,i)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(i)})}}class gt extends y{getConfiguratorSettings(r){var e;return this.get(`internal/catalog/categories/${r.id}/configurators/${(e=r.properties)==null?void 0:e.configurator}/settings`)}searchProduct(r,e,i={}){var o;const s=this.get(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/product`,{params:e},l=>new $(l.data));return s.catch(l=>{this.errorResponseHandler(l,i)}),s}createTemplate(r,e,i={}){var s;return this.post(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template`,{...e},()=>{},i)}removeTemplate(r,e){var i;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.configurator}/template/${e}`)}}class mt{static defaultDateRanges(){const r=g.addBusinessDays(new Date,1);return{nextWorkingDay:{label:"Следующий рабочий день",from:g.startOfDay(r),to:g.endOfDay(r)},today:{label:"Сегодня",from:g.startOfToday(),to:g.endOfToday()},yesterday:{label:"Вчера",from:g.startOfYesterday(),to:g.endOfYesterday()},tomorrow:{label:"Завтра",from:g.startOfTomorrow(),to:g.endOfTomorrow()}}}}const ne=class ne{static setLinearValues(r){ne.linearValues=r}static productIsMeasurable(r){return ne.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!ne.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,i,s;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((i=r.properties)!=null&&i.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)?r.properties.minCount:.01}};t(ne,"linearValues",["пог.м.","м.","м2"]);let rr=ne;class ft{static generateUndefinedManagerInstance(){return new fe({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Ur extends te{async getManagers(){const r="/internal/managers",e=te.getCachedResponse(r);if(e)return e;const s=(await this.get(r)).data.map(o=>Te.instanceInitializer(fe,o));return this.cacheResponse(r,s),s}}class tr extends er{constructor(e){var i,s,o,l,h,f,v,w;super(e);t(this,"client");t(this,"payment");t(this,"delivery");t(this,"attachedUser");t(this,"status");t(this,"salesDirection");t(this,"pendingAt");t(this,"processedAt");t(this,"isOnOrder");t(this,"isNotInStock");this.client=new X(e==null?void 0:e.client),this.payment={type:((i=e==null?void 0:e.payment)==null?void 0:i.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:((l=e==null?void 0:e.delivery)==null?void 0:l.type)??-1,date:u.isString((h=e==null?void 0:e.delivery)==null?void 0:h.date)?g.parseISO(e.delivery.date):((f=e==null?void 0:e.delivery)==null?void 0:f.date)??new Date,address:(v=e==null?void 0:e.delivery)!=null&&v.address?new ve(e.delivery.address):void 0,warehouse:(w=e==null?void 0:e.delivery)!=null&&w.warehouse?new ge(e.delivery.warehouse):void 0},this.attachedUser=new q(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new b(e==null?void 0:e.salesDirection),this.pendingAt=u.isString(e==null?void 0:e.pendingAt)?g.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=u.isString(e==null?void 0:e.processedAt)?g.parseISO(e.processedAt):e==null?void 0:e.processedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1}}class dr extends N{constructor(e){super(e);t(this,"product");t(this,"quantity");t(this,"currency");t(this,"costOne");t(this,"costOneRub");t(this,"cost");t(this,"costRub");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"configurator");t(this,"configuratorParams");t(this,"sawing");this.product=new z(e.product),this.quantity=e.quantity,this.currency=e.currency,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.cost=e.cost,this.costRub=e.costRub,this.marker=e.marker,this.height=e.height,this.length=e.length,this.width=e.width,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams,this.sawing=e.sawing}}class Mr extends tr{constructor(e){super(e);t(this,"products");t(this,"invoices");t(this,"comment");t(this,"image");t(this,"contragent");t(this,"barcode");t(this,"orderSource");t(this,"isAllowProcessingWithoutPayment");this.products=(e.products??[]).map(i=>new dr(i)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?Pe.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class yt extends Ce{getOrders(r,e,i){return this.getPaginated("/internal/orders",r,e?[e]:void 0,i,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new tr(l)),o})}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new Mr(e.data))}}class Ne{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new X(r==null?void 0:r.client),this.product=new $(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)??Se.Product}}const ir=n=>{var r,e,i,s,o;return n?u.omitBy({cities:(r=n.cities)==null?void 0:r.map(l=>l.id),clients:(e=n.clients)==null?void 0:e.map(l=>l.id),managers:(i=n.managers)==null?void 0:i.map(l=>l.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(l=>l.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(l=>l.id),hideNotActive:n.hideNotActive},l=>u.isNil(l)||(u.isArray(l)||u.isObject(l))&&u.isEmpty(l)):{}},jr=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 Ct extends y{analyzeProductPrices(r,e,i){return this.get(`/internal/price/products/${r}/analyze`,{...jr(e),filters:ir(i)},s=>s.data.map(o=>new Ne(o)))}analyzeCategoryPrices(r,e,i){return this.get(`/internal/price/categories/${r}/analyze`,{...jr(e),filters:ir(i)},s=>s.data.map(o=>new Ne(o)))}analyzeCategoryPricesBySquare(r,e,i){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:ir(i)},s=>s.data.map(o=>new Ne(o)))}}class Gr{constructor(r){t(this,"cost");t(this,"isLowCost");t(this,"isRetail");t(this,"costDate");t(this,"discountName");t(this,"priceTemplateName");t(this,"product");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=u.isString(r.costDate)?g.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new K(r.product):void 0,this.client=r.client?new q(r.client):void 0,this.executor=r.executor?new q(r.executor):void 0,this.currency=r.currency?new we(r.currency):void 0}}class Hr extends K{constructor(e){super(e);t(this,"history");this.history=u.map(e.history,i=>new Gr(i))}}class wt extends y{constructor(){super(),this.baseUrl=`${R.getConfig().http.priceHistoryApiUrl??""}/api`}getProductPriceHistory(r){var s,o,l,h;const e=R.getConfig().dateFormats.api,i=u.omitBy(u.merge(r,{costDate:{from:u.isDate((s=r.costDate)==null?void 0:s.from)?g.format(r.costDate.from,e):(o=r.costDate)==null?void 0:o.from,to:u.isDate((l=r.costDate)==null?void 0:l.to)?g.format(r.costDate.to,e):(h=r.costDate)==null?void 0:h.to}}),f=>u.isNil(f)||(u.isArray(f)||u.isObject(f))&&u.isEmpty(f));return this.get("/internal/history",i,f=>u.map(f.data,v=>new Hr(v)))}}class sr{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new K(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new K(e)))}}class Pt extends y{constructor(){super(),this.baseUrl=`${R.getConfig().http.recommendationsApiUrl??""}/api`}getProductCategoryRecommendations(r){return this.get(`/internal/recommendations/categories/${r.id}`,{},e=>new sr(e.data))}getProductRecommendations(r){return this.get(`/internal/recommendations/products/${r.id}`,{},e=>new sr(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}saveProductRecommendations(r,e){return this.post(`/internal/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}}class D extends te{getReference(r,e=!1){return this.getTypedDataArrayRequester(Sr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(xe,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(ar,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester(ae,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(we,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(J,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(U,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester($r,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(br,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(Ir,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Ke,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(b,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Qe,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(be,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(Y,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(F,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(G,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(ge,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(ze,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(he,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(Lr,"/public/references/product-file-type",!0)}}const A=V.defineStore("__references_private",()=>{const n=m.ref({}),r=m.ref(void 0),e=m.ref(void 0),i=m.ref(void 0),s=m.ref(void 0),o=m.ref(void 0),l=m.ref(void 0),h=m.ref(void 0),f=m.ref(void 0),v=m.ref(void 0),w=m.ref(void 0),a=m.ref(void 0),M=m.ref(void 0),j=m.ref(void 0),oe=m.ref(void 0),ce=m.ref(void 0),or=m.ref(void 0),p=m.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:i,deliveryTypeReference:s,managersList:o,opfReference:l,orderPaymentStatusReference:h,orderStatusReference:f,paymentTypeReference:v,partnerGroupReference:w,productFileTypeReference:a,resourceTypesReference:M,salesDirectionsReference:j,sourcePrimaryInterestReference:oe,warehousesReference:ce,propertyTypesReference:or,priceCoefficientsReference:p}}),vt=V.defineStore("references",()=>{const n=m.computed(()=>{const p=A();return!p.channelPrimaryInterestReference&&!p.dataLoaderList.channelPrimaryInterestReference&&(p.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(D).getChannelPrimaryInterest().then(C=>{p.channelPrimaryInterestReference=C}).catch(u.noop)),p.channelPrimaryInterestReference}),r=m.computed(()=>{const p=A();return!p.contactPositionsReference&&!p.dataLoaderList.contactPositionsReference&&(p.dataLoaderList.contactPositionsReference=!0,y.getInstance(D).getContactPositions().then(C=>{p.contactPositionsReference=C}).catch(u.noop)),p.contactPositionsReference}),e=m.computed(()=>{const p=A();return!p.currencyReference&&!p.dataLoaderList.currencyReference&&(p.dataLoaderList.currencyReference=!0,y.getInstance(D).getCurrency().then(C=>{p.currencyReference=C}).catch(u.noop)),p.currencyReference}),i=m.computed(()=>{const p=A();return!p.opfReference&&!p.dataLoaderList.opfReference&&(p.dataLoaderList.opfReference=!0,y.getInstance(D).getOpf().then(C=>{p.opfReference=C}).catch(u.noop)),p.opfReference}),s=m.computed(()=>{const p=A();return!p.orderPaymentStatusReference&&!p.dataLoaderList.orderPaymentStatusReference&&(p.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(D).getOrderPaymentStatuses().then(C=>{p.orderPaymentStatusReference=C}).catch(u.noop)),p.orderPaymentStatusReference}),o=m.computed(()=>{const p=A();return!p.orderStatusReference&&!p.dataLoaderList.orderStatusReference&&(p.dataLoaderList.orderStatusReference=!0,y.getInstance(D).getOrderStatuses().then(C=>{p.orderStatusReference=C}).catch(u.noop)),p.orderStatusReference}),l=m.computed(()=>{const p=A();return!p.paymentTypeReference&&!p.dataLoaderList.paymentTypeReference&&(p.dataLoaderList.paymentTypeReference=!0,y.getInstance(D).getPaymentTypes().then(C=>{p.paymentTypeReference=C}).catch(u.noop)),p.paymentTypeReference}),h=m.computed(()=>{const p=A();return!p.partnerGroupReference&&!p.dataLoaderList.partnerGroupReference&&(p.dataLoaderList.partnerGroupReference=!0,y.getInstance(D).getPartnerGroup().then(C=>{p.partnerGroupReference=C}).catch(u.noop)),p.partnerGroupReference}),f=m.computed(()=>{const p=A();return!p.productFileTypeReference&&!p.dataLoaderList.productFileTypeReference&&(p.dataLoaderList.productFileTypeReference=!0,y.getInstance(D).getProductFileType().then(C=>{p.productFileTypeReference=C}).catch(u.noop)),p.productFileTypeReference}),v=m.computed(()=>{const p=A();return!p.resourceTypesReference&&!p.dataLoaderList.resourceTypesReference&&(p.dataLoaderList.resourceTypesReference=!0,y.getInstance(D).getResourceTypes().then(C=>{p.resourceTypesReference=C}).catch(u.noop)),p.resourceTypesReference}),w=m.computed(()=>{const p=A();return!p.salesDirectionsReference&&!p.dataLoaderList.salesDirectionsReference&&(p.dataLoaderList.salesDirectionsReference=!0,y.getInstance(D).getSalesDirections().then(C=>{p.salesDirectionsReference=C}).catch(u.noop)),p.salesDirectionsReference}),a=m.computed(()=>{const p=A();return!p.sourcePrimaryInterestReference&&!p.dataLoaderList.sourcePrimaryInterestReference&&(p.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(D).getSourcePrimaryInterest().then(C=>{p.sourcePrimaryInterestReference=C}).catch(u.noop)),p.sourcePrimaryInterestReference}),M=m.computed(()=>{const p=A();return!p.deliveryTypeReference&&!p.dataLoaderList.deliveryTypeReference&&(p.dataLoaderList.deliveryTypeReference=!0,y.getInstance(D).getDeliveryTypes().then(C=>{p.deliveryTypeReference=C}).catch(u.noop)),p.deliveryTypeReference}),j=m.computed(()=>{const p=A();return!p.managersList&&!p.dataLoaderList.managersList&&(p.dataLoaderList.managersList=!0,y.getInstance(Ur).getManagers().then(C=>{p.managersList=C}).catch(u.noop)),p.managersList}),oe=m.computed(()=>{const p=A();return!p.warehousesReference&&!p.dataLoaderList.warehousesReference&&(p.dataLoaderList.warehousesReference=!0,y.getInstance(D).getWarehouses().then(C=>{p.warehousesReference=C}).catch(u.noop)),p.warehousesReference}),ce=m.computed(()=>{const p=A();return!p.propertyTypesReference&&!p.dataLoaderList.propertyTypesReference&&(p.dataLoaderList.propertyTypesReference=!0,y.getInstance(D).getPropertyTypes().then(C=>{p.propertyTypesReference=C}).catch(u.noop)),p.propertyTypesReference}),or=m.computed(()=>{const p=A();return!p.priceCoefficientsReference&&!p.dataLoaderList.priceCoefficientsReference&&(p.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(D).getPriceCoefficients().then(C=>{p.priceCoefficientsReference=C}).catch(u.noop)),p.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:i,orderPaymentStatusReference:s,orderStatusReference:o,paymentTypeReference:l,partnerGroupsReference:h,productFilesTypesReference:f,resourceTypesReference:v,salesDirectionsReference:w,sourcePrimaryInterestsReference:a,deliveryTypeReference:M,managersList:j,warehousesReference:oe,propertyTypesReference:ce,priceCoefficientsReference:or}});class Br{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class nr{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");var e;this.resourceType=new Ke(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(i=>new Br(i)))??[]}}class Rt extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new nr(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new nr(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class Dt 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(i=>{const s=[...i];let o=1;return s.forEach(l=>{l.id=o++}),s})}}var zr=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.Guest="guest",n))(zr||{});class Fr extends Be{constructor(e){super(e);t(this,"type");t(this,"canDoReclamations");t(this,"photo");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}}class At extends y{constructor(){super(),this.baseUrl=`${R.getConfig().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 Wr extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Fr(r.data))}}const Tt=V.defineStore("__user_state_private",()=>{const n=m.ref({}),r=m.ref(void 0);return{dataLoaderList:n,currentUser:r}}),St=V.defineStore("user_state",()=>({currentUser:m.computed(()=>{const r=Tt();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,y.getInstance(Wr).getCurrentUser().then(e=>{r.currentUser=e}).catch(u.noop).finally(()=>{r.dataLoaderList.currentUser=!1})),r.currentUser})}));class at{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=Sr,c.AppBaseConfig=Yr,c.AppConfigProvider=R,c.BankAccount=ke,c.BasePaginationProvider=Ce,c.CalculationTypeEnum=mr,c.Cart=me,c.CartItem=gr,c.CartItemBase=hr,c.CartProvider=xr,c.CatalogProvider=Xr,c.CatalogableItem=qe,c.Category=H,c.CategoryPricingRule=Fe,c.ChannelPrimaryInterest=xe,c.City=ct,c.CityWithRegionAndCountry=be,c.Client=Ee,c.ClientAdditionalData=Nr,c.ClientCategory=ye,c.ClientDataProvider=I,c.ClientPriceProvider=Zr,c.ClientPriceTemplateProvider=Er,c.ClientProduct=z,c.ClientProductCategoryDataProvider=tt,c.ClientProductDataProvider=it,c.ClientShortInfo=X,c.ClientsAdditionalDataRequestTypeEnum=Tr,c.ClientsListFilters=lt,c.CodedIdentity=K,c.ConfiguratorProvider=gt,c.Contact=Oe,c.ContactLinks=je,c.ContactPerson=d,c.ContactPersonRelated=_r,c.ContactPosition=ar,c.ContactRelation=_e,c.ContragentBase=Ye,c.ContragentFactory=Pe,c.ContragentIc=Xe,c.ContragentPerson=kr,c.ContragentUlNr=Or,c.ContragentUlR=Ze,c.CostSourceEnum=Se,c.Country=F,c.CuratedDirection=ae,c.Curator=He,c.Currency=we,c.DataSuggestionProvider=Dt,c.DataTablePagination=ut,c.DataTablePaginationRequestParams=qr,c.DataTableSortRequestParams=pt,c.DateTimeProvider=mt,c.DeletableNamedIdentity=yr,c.DeliveryAddress=ve,c.DeliveryType=G,c.DetailedJwtPayload=Vr,c.DeviceTypeResolutionConfig=Pr,c.DiscountShortInfo=Cr,c.FieldValidationResultData=at,c.FilterGroup=re,c.FilterItem=We,c.FilterOpEnum=Le,c.GeoCoordinates=de,c.HiddenCatalogableItem=ur,c.HttpCachedRequester=te,c.HttpParamsConfig=vr,c.HttpRequester=y,c.Identity=N,c.Image=pr,c.JwtPayload=_,c.Manager=fe,c.ManagerCommon=Q,c.ManagerDataFactory=ft,c.ManagerDataProvider=Ur,c.MetaTagItem=Br,c.NamedIdentity=T,c.Opf=U,c.OpfEnum=O,c.Order=Mr,c.OrderInfo=tr,c.OrderPaymentStatus=$r,c.OrderProduct=dr,c.OrderShortInfo=er,c.OrderStatus=br,c.OrdersDataProvider=yt,c.PartnerGroup=J,c.PaymentType=Ir,c.PreferencesStorageProvider=ue,c.PriceAnalyze=Ne,c.PriceAnalyzeProvider=Ct,c.PriceCoefficient=he,c.PriceCoefficientEnum=Ue,c.PriceHistoryDataProvider=wt,c.PriceHistoryItem=Gr,c.PriceTemplate=B,c.PriceTemplateCategory=$e,c.PriceTemplateClient=Z,c.PriceTemplateICatalogableItem=Ge,c.PriceTemplateProduct=Ie,c.PriceTemplateProvider=st,c.PricingRole=ee,c.PricingRoleProvider=nt,c.PrimaryCatalogableItem=De,c.Product=$,c.ProductCategoryDataProvider=et,c.ProductDataProvider=rt,c.ProductFileType=Lr,c.ProductPriceCoefficient=Ae,c.ProductPriceHistory=Hr,c.PropertiesProvider=ot,c.Property=E,c.PropertyType=ze,c.PropertyTypeEnum=fr,c.PropertyValue=W,c.RecommendationsDataProvider=Pt,c.RecommendationsList=sr,c.Reference=P,c.ReferenceDataProvider=D,c.Region=Y,c.ResourceType=Ke,c.SalesDirection=b,c.SentryConfig=Rr,c.Seo=nr,c.SeoDataProvider=Rt,c.SourcePrimaryInterest=Qe,c.StockCount=lr,c.TemplatesListFilters=Qr,c.TypedInstanceFactory=Te,c.UnitsHelper=rr,c.UnknownClientDataProvider=ht,c.UpdatableNamedIdentity=Me,c.User=Fr,c.UserAuthDataProvider=At,c.UserCommonInfo=Be,c.UserDataProvider=Wr,c.UserPricingRole=wr,c.UserShortInfo=q,c.UserTypeEnum=zr,c.VersionConfig=Dr,c.Warehouse=ge,c.WebSocketConfig=Ar,c.findCatalogItemByIdRecursive=Je,c.flattenCatalogItems=Ve,c.useAuthStateStore=Re,c.useReferencesStore=vt,c.useUserStateStore=St,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=sc-common-lib.umd.cjs.map
|