@snabcentr/common-lib 1.60.5 → 1.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/manifest.json +1 -1
  2. package/dist/release_notes.tmp +2 -2
  3. package/dist/sc-common-lib.js +617 -584
  4. package/dist/sc-common-lib.js.map +1 -1
  5. package/dist/sc-common-lib.umd.cjs +1 -1
  6. package/dist/sc-common-lib.umd.cjs.map +1 -1
  7. package/dist/src/catalog/classes/index.d.ts +0 -1
  8. package/dist/src/catalog/classes/index.d.ts.map +1 -1
  9. package/dist/src/catalog/classes/price-template-catalogable-item.d.ts +1 -1
  10. package/dist/src/catalog/classes/price-template-catalogable-item.d.ts.map +1 -1
  11. package/dist/src/catalog/classes/product.d.ts +8 -0
  12. package/dist/src/catalog/classes/product.d.ts.map +1 -1
  13. package/dist/src/catalog/interfaces/i-price-template-catalogable-item.d.ts +1 -1
  14. package/dist/src/catalog/interfaces/i-price-template-catalogable-item.d.ts.map +1 -1
  15. package/dist/src/catalog/interfaces/i-product.d.ts +8 -0
  16. package/dist/src/catalog/interfaces/i-product.d.ts.map +1 -1
  17. package/dist/src/catalog/interfaces/index.d.ts +0 -2
  18. package/dist/src/catalog/interfaces/index.d.ts.map +1 -1
  19. package/dist/src/catalog/providers/index.d.ts +0 -1
  20. package/dist/src/catalog/providers/index.d.ts.map +1 -1
  21. package/dist/src/index.d.ts +1 -0
  22. package/dist/src/index.d.ts.map +1 -1
  23. package/dist/src/price-analyze/classes/index.d.ts +2 -0
  24. package/dist/src/price-analyze/classes/index.d.ts.map +1 -0
  25. package/dist/src/{catalog → price-analyze}/classes/price-analyze.d.ts +3 -3
  26. package/dist/src/price-analyze/classes/price-analyze.d.ts.map +1 -0
  27. package/dist/src/price-analyze/converters/price-analyze-filters.d.ts +8 -0
  28. package/dist/src/price-analyze/converters/price-analyze-filters.d.ts.map +1 -0
  29. package/dist/src/{catalog/providers/converters/price-analyze.d.ts → price-analyze/converters/price-analyze-params.d.ts} +3 -3
  30. package/dist/src/price-analyze/converters/price-analyze-params.d.ts.map +1 -0
  31. package/dist/src/price-analyze/index.d.ts +4 -0
  32. package/dist/src/price-analyze/index.d.ts.map +1 -0
  33. package/dist/src/price-analyze/interfaces/i-price-analyze-filters.d.ts +36 -0
  34. package/dist/src/price-analyze/interfaces/i-price-analyze-filters.d.ts.map +1 -0
  35. package/dist/src/price-analyze/interfaces/i-price-analyze-parameter.d.ts.map +1 -0
  36. package/dist/src/{catalog → price-analyze}/interfaces/i-price-analyze-params.d.ts +1 -1
  37. package/dist/src/price-analyze/interfaces/i-price-analyze-params.d.ts.map +1 -0
  38. package/dist/src/{catalog → price-analyze}/interfaces/i-price-analyze.d.ts +2 -2
  39. package/dist/src/price-analyze/interfaces/i-price-analyze.d.ts.map +1 -0
  40. package/dist/src/price-analyze/interfaces/index.d.ts +4 -0
  41. package/dist/src/price-analyze/interfaces/index.d.ts.map +1 -0
  42. package/dist/src/price-analyze/providers/index.d.ts +2 -0
  43. package/dist/src/price-analyze/providers/index.d.ts.map +1 -0
  44. package/dist/src/{catalog → price-analyze}/providers/price-analyze-provider.d.ts +8 -4
  45. package/dist/src/price-analyze/providers/price-analyze-provider.d.ts.map +1 -0
  46. package/package.json +1 -1
  47. package/dist/src/catalog/classes/price-analyze.d.ts.map +0 -1
  48. package/dist/src/catalog/interfaces/i-price-analyze-params.d.ts.map +0 -1
  49. package/dist/src/catalog/interfaces/i-price-analyze.d.ts.map +0 -1
  50. package/dist/src/catalog/providers/converters/price-analyze.d.ts.map +0 -1
  51. package/dist/src/catalog/providers/interfaces/i-price-analyze-parameter.d.ts.map +0 -1
  52. package/dist/src/catalog/providers/price-analyze-provider.d.ts.map +0 -1
  53. /package/dist/src/{catalog/providers → price-analyze}/interfaces/i-price-analyze-parameter.d.ts +0 -0
@@ -1,2 +1,2 @@
1
- (function(o,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("lodash-es"),require("date-fns"),require("axios"),require("ts-case-convert"),require("pinia"),require("vue")):typeof define=="function"&&define.amd?define(["exports","lodash-es","date-fns","axios","ts-case-convert","pinia","vue"],p):(o=typeof globalThis<"u"?globalThis:o||self,p(o["SC Common Lib"]={},o["lodash-es"],o["date-fns"],o.axios,o["ts-case-convert"],o.pinia,o.vue))})(this,function(o,p,h,Lr,be,me,f){"use strict";var pt=Object.defineProperty;var gt=(o,p,h)=>p in o?pt(o,p,{enumerable:!0,configurable:!0,writable:!0,value:h}):o[p]=h;var t=(o,p,h)=>gt(o,typeof p!="symbol"?p+"":p,h);class d{constructor(r){t(this,"id");t(this,"guid");this.id=r==null?void 0:r.id,p.isNil(this.id)&&(typeof(r==null?void 0:r.id)=="number"?this.id=-1:typeof(r==null?void 0:r.id)=="string"&&(this.id="")),this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return typeof this.id=="number"?this.id===-1:(typeof this.id=="string"&&(this.id=""),p.isNil(this.id))}}class D extends d{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class Ie extends D{constructor(e){super(e);t(this,"slug");t(this,"code");t(this,"type");this.slug=(e==null?void 0:e.slug)??"",this.code=(e==null?void 0:e.code)??""}}class fe extends Ie{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class te extends fe{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,n])=>[p.toUpper(i),n])):void 0}}var _e=(s=>(s.K0="k0",s.K1="k1",s.K2="k2",s.K3="k3",s.K4="k4",s.Retail="retail",s))(_e||{});class P extends D{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 ie extends P{static getRetailPriceCoefficient(){return{id:-2,slug:_e.Retail,name:"Розн. цена",guid:"",isNewRec:p.constant(!0)}}}class ye{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new ie(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 Le{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 B extends P{}class ne 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(n=>new B(n)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Le(e==null?void 0:e.coordinates)}}class Ye{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new ne(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const E=class E{static init(r){E.config=r}static getConfig(){if(p.isUndefined(E.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return E.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(n=>{n({})})));return e.catch(i=>{console.error(i)}),e}};t(E,"config");let $=E;class Xe extends Ie{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Ze{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 a extends Xe{constructor(e){var n,c,u,g;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,"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=p.isString(e==null?void 0:e.costDate)?h.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((n=e==null?void 0:e.stockCount)==null?void 0:n.map(C=>new Ye(C)))??[],this.currencySignature=(e==null?void 0:e.currencySignature)??"",this.type="product";const i=(e==null?void 0:e.category)??((c=e==null?void 0:e.categories)==null?void 0:c.find(C=>C.isPrimary));i&&(this.category=new fe({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(C=>new fe(C))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(C=>new Ze(C,$.getConfig().http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.priceCoefficients=((g=e==null?void 0:e.priceCoefficients)==null?void 0:g.map(C=>new ye(C)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){var i;const e=(i=$.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)}}class xe extends d{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 a(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new te,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&p.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class Ee extends xe{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 se{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new Ee(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class er{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 rr{constructor(r){t(this,"apiUri");t(this,"mediaUrl");t(this,"responseDataCacheTimeout");this.apiUri=(r==null?void 0:r.apiUri)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class tr{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,i,n,c;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:((n=r==null?void 0:r.replay)==null?void 0:n.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((c=r==null?void 0:r.replay)==null?void 0:c.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class ir{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=p.isString(r==null?void 0:r.date)?h.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 Or{constructor(r){t(this,"environment");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"sentry");t(this,"urls");t(this,"version");t(this,"dateFormats");var e,i,n;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new rr(r==null?void 0:r.http),this.deviceTypeByResolution=new er(r==null?void 0:r.deviceTypeByResolution),this.sentry=new tr({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new ir(r==null?void 0:r.version),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:((n=r==null?void 0:r.dateFormats)==null?void 0:n.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}class Ce{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const b=class b{constructor(r,e){t(this,"httpClient");t(this,"defaultInstanceNotificationErrorResponseHandler",p.noop);const i=$.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=b.baseDefaultNotificationErrorResponseHandler,this.httpClient=Lr.create({baseURL:r,headers:{"APP-VERSION":`${i.name} (${i.version}, ${h.format(i.date,$.getConfig().dateFormats.uiDate)})`,Accept:"application/json","Content-Type":"application/json",...e}}),this.httpClient.interceptors.request.use(n=>(n.method&&(n.method==="get"&&n.params&&(n.params=be.objectToSnake(n.params)),["put","patch","post"].includes(p.toLower(n.method))&&n.data&&(n.data=be.objectToSnake(n.data))),n),n=>Promise.reject(n)),this.httpClient.interceptors.response.use(n=>(n.data&&(n.data=be.objectToCamel(n.data)),n),n=>b.convertHttpErrorResponse(n))}static setBaseDefaultNotificationErrorResponseHandler(r){b.baseDefaultNotificationErrorResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(b.instances,r.name)||(b.instances[r.name]=Ce.simpleInstanceInitializer(r)),b.instances[r.name]}static convertHttpErrorResponse(r){var i,n;const e=r==null?void 0:r.response;return Promise.reject({status:(e==null?void 0:e.status)??0,statusText:(e==null?void 0:e.statusText)??"Unknown",message:((i=e==null?void 0:e.data)==null?void 0:i.message)??"Unknown Error. Probably network error.",errors:(n=e==null?void 0:e.data)==null?void 0:n.errors,headers:(e==null?void 0:e.headers)??{},data:e==null?void 0:e.data,rawError:r})}request(r,e=void 0,i={},n=!1){const c=this.httpClient.request(r).then(u=>e?e(u):u.data);return n||c.catch(u=>{this.defaultInstanceNotificationErrorResponseHandler(u,i)}),c}get(r,e={},i=void 0,n=!1){return this.request({method:"GET",url:r,params:e},i,{},n)}getBlob(r,e={},i=void 0,n=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},i,{},n)}patch(r,e={},i=void 0,n={},c=!1){return this.request({method:"PATCH",url:r,data:e},i,n,c)}post(r,e={},i=void 0,n={},c=!1){return this.request({method:"POST",url:r,data:e},i,n,c)}delete(r,e=void 0,i=!1){return this.request({method:"DELETE",url:r},e,{},i)}};t(b,"instances",{}),t(b,"baseDefaultNotificationErrorResponseHandler",p.noop);let Pe=b;const ee=class ee extends Pe{constructor(e,i){super(e,i);t(this,"responseDataCacheTimeout");const n=$.getConfig();this.responseDataCacheTimeout=n.http.responseDataCacheTimeout}static getCachedResponse(e){const i=ee.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){ee.responseDataCache.set(e,{validTo:h.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,n=!1,c={}){const u=i+(p.isEmpty(c)?"":` >>> ${JSON.stringify(c)}`),g=n?ee.getCachedResponse(u):void 0;return g?Promise.resolve(g):this.get(i,c).then(C=>{const R=C.map(A=>Ce.instanceInitializer(e,A));return n&&R&&this.cacheResponse(i,R),R})}};t(ee,"responseDataCache",new Map);let we=ee;class m extends we{constructor(){var i,n;const r=$.getConfig(),e={};(i=r.devMode)!=null&&i.authBearerToken&&(e.Authorization=`Bearer ${(n=r.devMode)==null?void 0:n.authBearerToken}`),super(`${r.http.apiUri}/api`,e)}}class kr extends m{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new se(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},n=>new se(n.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},n=>new se(n.data),i)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,{},e=>new se(e.data))}}var nr=(s=>(s.m2Cost="m2Cost",s.percent="percent",s.value="value",s))(nr||{}),ve=(s=>(s.Discount="discount",s.PriceTemplate="price_template",s.ClientPrice="client_price",s.Product="product",s))(ve||{}),sr=(s=>(s.Unknown="unknown",s.Bool="bool",s.Integer="integer",s.Float="float",s.String="string",s.Range="range",s.Json="json",s.Object="object",s))(sr||{});class q extends te{constructor(e){var i,n;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(c=>new q(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new a(c))}}class Oe extends D{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class or extends Oe{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class Nr{static getActualDataFromStorage(r){const e=localStorage.getItem(r);if(e)try{const i=JSON.parse(e);if(h.isAfter(h.parseISO(i.availableFor)||h.startOfToday(),new Date))return i.data??{}}catch{localStorage.removeItem(r)}}static saveActualDataToStorage(r,e,i){localStorage.setItem(r,JSON.stringify({availableFor:i,data:e}))}}class U extends D{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class cr extends D{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=p.isString(e==null?void 0:e.publishedAt)?h.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 U(e==null?void 0:e.owner),this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class z extends Oe{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}class W extends a{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)??ve.Product,this.discount=e!=null&&e.discount?new cr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new z(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 lr{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class S extends P{}class K extends D{constructor(e){super(e);t(this,"salesDirection",new S);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new S(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new lr(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class oe extends K{constructor(e){super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");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}}class dr extends te{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 oe(e.manager):void 0}}class ce extends dr{constructor(e){var i,n;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(c=>new ce(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new W(c))}}class ke{constructor(r){t(this,"coefficient");t(this,"increasePercent");this.coefficient=(r==null?void 0:r.coefficient)&&new ie(r.coefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class Re extends ke{constructor(e){super(e);t(this,"productCategory");this.productCategory=new te(e==null?void 0:e.productCategory)}}class j extends P{}class J extends P{constructor(e){super(e);t(this,"country",new j);e&&(this.country=new j(e.country))}}class le extends P{constructor(e){super(e);t(this,"region",new J);e&&(this.region=new J(e.region))}}class Ne extends D{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 S(e.salesDirection):void 0,this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?h.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class Q extends Ne{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 S(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 le(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(n=>new K(n)))??[]}}class Y extends d{constructor(e){super(e);t(this,"startAt");t(this,"endAt");t(this,"client");t(this,"priceTemplate");this.startAt=p.isString(e==null?void 0:e.startAt)?h.parseISO(e.startAt):(e==null?void 0:e.startAt)??new Date,this.endAt=p.isString(e==null?void 0:e.endAt)?h.parseISO(e.endAt):(e==null?void 0:e.endAt)??new Date,this.client=new Q(e==null?void 0:e.client),this.priceTemplate=new z(e==null?void 0:e.priceTemplate)}}class De extends ke{constructor(e){super(e);t(this,"product");this.product=new a(e==null?void 0:e.product)}}class de extends P{}class X extends D{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new de(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class V{constructor(r){t(this,"property");t(this,"value");this.property=new X(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class I{constructor(r){t(this,"from");t(this,"to");this.from=p.isString(r==null?void 0:r.from)?h.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=p.isString(r==null?void 0:r.to)?h.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 I);t(this,"updatedAt",new I);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 I(r==null?void 0:r.createdAt),this.updatedAt=new I(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,n,c;const r={};return Object.keys(this).forEach(u=>{const g=this[u];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[u]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((n=r==null?void 0:r.updatedAt)!=null&&n.from)&&!((c=r==null?void 0:r.updatedAt)!=null&&c.to)&&delete r.updatedAt,r}}class ur extends P{}class qe extends P{}class Ur extends P{}class pr extends P{}class ue extends D{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var T=(s=>(s.Person="individual",s.Ic="entrepreneur",s.UlR="legal",s.UlNr="non_resident_legal",s))(T||{});class G extends P{static generatePersonItem(){return new G({id:1,guid:"",slug:T.Person,name:""})}}class gr extends P{}class hr extends P{}class M extends P{}class mr extends P{}class fr extends P{}class Ue extends P{}class Ge extends P{}class w extends m{getReference(r,e=!1){return this.getTypedDataArrayRequester(ur,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(qe,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(pr,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(ue,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(M,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(G,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(gr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(hr,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(mr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Ue,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(S,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Ge,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(le,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(J,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(j,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(B,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(ne,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(de,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(ie,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(fr,"/public/references/product-file-type",!0)}}var yr=(s=>(s.Admin="admin",s.Manager="manager",s.Operator="operator",s.Client="client",s.Guest="guest",s))(yr||{});class Cr extends Ne{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 Pr extends m{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Cr(r.data))}}class wr{constructor(r){t(this,"cost");t(this,"costDate");t(this,"isLowCost");t(this,"isRetail");t(this,"discountName");t(this,"priceTemplateName");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost,this.costDate=p.isString(r.costDate)?h.parseISO(r.costDate):r.costDate,this.isLowCost=r.isLowCost,this.isRetail=r.isRetail,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.client=r.client?new U(r.client):void 0,this.executor=r.executor?new U(r.executor):void 0,this.currency=r.currency?new ue(r.currency):void 0}}class Me{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new a(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new q(e)))}}class Z extends D{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 Z(r==null?void 0:r.role),this.category=new te(r==null?void 0:r.category),this.minCoefficient=new ie(r==null?void 0:r.minCoefficient)}}class Ae{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new Q(r==null?void 0:r.client),this.product=new a(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)??ve.Product}}class Gr extends m{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,i=void 0,n=void 0){let u=`${$.getConfig().http.apiUri}/api/internal/price/export?format=${r}&show_hidden=${e}`;return i&&(u+=`&category_id=${i}`),n&&(u+=`&client_id=${n}`),u}}class Mr extends m{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,i){var n;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.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 n;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value},c=>new W(c.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,i=>new W(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 Hr extends m{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new Y(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new Y(e.data))}attachTemplate(r,e,i){const n=$.getConfig().dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,i&&{startAt:i.startAt&&h.format(i.startAt,n),endAt:i.endAt&&h.format(i.endAt,n)},c=>new Y(c.data))}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`)}changeTemplate(r,e,i,n){const c=$.getConfig().dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${i}`,n&&{startAt:n.startAt&&h.format(n.startAt,c),endAt:n.endAt&&h.format(n.endAt,c)},u=>new Y(u.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class Br extends m{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(i=>new q(i)))}getCategoryData(r,e=!1,i=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:i},n=>new q(n.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new q(e.data))}getCategoryProductsList(r,e=!0,i=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:i,withPriceCoefficients:e},n=>p.map(n.data,c=>new a(c)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return p.forEach(i,n=>n.map(c=>new ye(c))),i})}publicSimpleSearch(r,e=10){return new Promise((i,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{i(c.categories.map(u=>new q(u)))}).catch(c=>{n(c)})})}}class zr extends m{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new a(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new a(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>p.map(e.data,i=>new ye(i)))}getProductPriceHistory(r,e){const i={};return p.isNil(e)||(i.clientId=e),this.get(`/internal/price/products/${r}/history`,i,n=>p.map(n.data,c=>new wr(c)))}publicSimpleSearch(r,e=10){return new Promise((i,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{i(c.products.map(u=>new a(u)))}).catch(c=>{n(c)})})}}class Wr extends m{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(n=>new ce(n)))}getCategoryData(r,e,i=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:n},c=>new ce(c.data))}getCategoryProductsList(r,e,i=!0,n=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:n,withPriceCoefficients:i},c=>p.map(c.data,u=>new W(u)))}}class jr extends m{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},n=>new W(n.data))}}var $e=(s=>(s.BeginWith="bw",s.Contains="cn",s.Custom="custom",s.EndsWith="ew",s.Equals="eq",s.GreaterOrEqual="ge",s.GreaterThan="gt",s.InList="in",s.LessOrEqual="le",s.LessThan="lt",s.NotBeginWith="bn",s.NotContains="nc",s.NotEndsWith="en",s.NotEqual="ne",s.NotInList="ni",s.NotNull="nn",s.Null="nu",s))($e||{});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)??$e.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r={field:this.field,op:this.op};return r.value=p.isDate(this.value)?h.format(this.value,$.getConfig().dateFormats.api):this.value,r}}class x{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(n=>new Be(n)))??[],this.groups=((i=r==null?void 0:r.groups)==null?void 0:i.map(n=>new x(n)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Be&&p.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof x?r.toPrimitive():r)}}}class pe extends m{getPaginated(r,e,i,n,c,u,g){let C={page:(n==null?void 0:n.page)??1,perPage:(n==null?void 0:n.pageSize)??10};return e&&(C.filters=JSON.stringify((e instanceof x?e:new x(e)).toPrimitive())),p.isEmpty(i)||(C.sort=p.isArray(i)?i:[i]),c&&(C={...C,...c}),this.get(r,C,u,g)}}class Vr extends pe{getTemplateList(r,e,i){return this.getPaginated("/internal/price/templates",r,e,i,{},n=>{const c={...n.data};return c.data=c.data.map(u=>new z(u)),c})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,i=>new z(i.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new z(e.data))}updateTemplate(r,e,i={}){return this.patch(`/internal/price/templates/${r}`,e,n=>new z(n.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 De(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new De(i.data))}saveProductTemplatePrice(r,e,i){var n;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value},c=>new De(c.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 Re(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new Re(i.data))}saveCategoryTemplatePrice(r,e,i){var n;return this.post(`/internal/price/templates/${r}/categories/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value},c=>new Re(c.data))}deleteCategoryTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/categories/${e}`)}getTemplateClients(r){return this.get(`/internal/price/templates/${r}/clients`,{},e=>e.data.map(i=>new Y(i)))}}class Fr extends m{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new Z(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new Z(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new Z(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new Z(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(n=>new He(n)))}}class Kr extends pe{getProperties(r,e,i){return this.getPaginated("/internal/catalog/properties",r,e,i,{},n=>{const c={...n.data};return c.data=c.data.map(u=>new X(u)),c})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},n=>new X(n.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new X(e.data))}updateProperty(r,e){const{typeId:i,...n}=e;return this.patch(`/internal/catalog/properties/${r}`,{...n,type:i},c=>new X(c.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 V(i)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},i=>new V(i.data))}updateProductProperty(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:i},n=>new V(n.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 V(i)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},i=>new V(i.data))}updateCategoryProperty(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:i},n=>new V(n.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})}}class Jr extends m{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Me(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Me(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/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/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}}const vr=s=>{const r={};return s.from&&(s.from.coefficient||s.from.value)&&(r.from={},s.from.coefficient&&(r.from.priceCoefficientId=s.from.coefficient.id),s.from.value&&(r.from.increasePercent=s.from.value)),s.to&&(s.to.coefficient||s.to.value)&&(r.to={},s.to.coefficient&&(r.to.priceCoefficientId=s.to.coefficient.id),s.to.value&&(r.to.increasePercent=s.to.value)),r};class Qr extends m{analyzeProductPrices(r,e){return this.get(`/internal/price/products/${r}/analyze`,{...vr(e)},i=>i.data.map(n=>new Ae(n)))}analyzeCategoryPrices(r,e){return this.get(`/internal/price/categories/${r}/analyze`,{...vr(e)},i=>i.data.map(n=>new Ae(n)))}analyzeCategoryPricesBySquare(r,e){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e},i=>i.data.map(n=>new Ae(n)))}}var Rr=(s=>(s.LastOrder="last_order",s.Contacts="contacts",s.PartnerGroups="partner_groups",s.PreferredDeliveryType="preferred_delivery_type",s.SalesDirection="sales_direction",s.Managers="managers",s))(Rr||{});class ae extends d{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new ue);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new ue(e.currency))}}class Se extends D{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 H extends Se{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=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class ze extends D{constructor(e){super(e);t(this,"manager",new K);t(this,"opf",G.generatePersonItem());t(this,"salesDirection",new S);t(this,"partnerGroup",new M);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 G(e.opf),this.salesDirection=new S(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new U(e.creator):void 0,this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new U(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new M(e.partnerGroup)),e.manager&&(this.manager=new K(e.manager)),e.contacts){const i=[];e.contacts.forEach(n=>{i.push(new H(n))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(n=>{i.push(new ae(n))}),this.bankAccounts=i}}}}class Dr extends ze{constructor(r){super(r)}}class We extends ze{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 je extends We{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class Ar extends je{constructor(e){super(e);t(this,"registrationCountry",new j);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new j(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class ge{static createInstance(r){switch(r.opf.slug){case T.Ic:return new We(r);case T.UlR:return new je(r);case T.UlNr:return new Ar(r);default:return new Dr(r)}}}class Te extends d{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class $r extends H{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(i=>new Te(i))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(i=>new Te(i))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(i=>new Te(i))))}}class he extends or{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 Le(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(n=>new H(n)))??[],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 Ve extends Q{constructor(e){var i,n,c,u;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,"preferredWarehouse");t(this,"extraData");this.contragents=((i=e==null?void 0:e.contragents)==null?void 0:i.map(g=>ge.createInstance(g)))??[],this.partnerGroups=((n=e==null?void 0:e.partnerGroups)==null?void 0:n.map(g=>new M(g)))??[],this.contacts=((c=e==null?void 0:e.contacts)==null?void 0:c.map(g=>new H(g)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(g=>new he(g)))??[],this.channelPrimaryInterest=new qe(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Ge(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new B(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new ne(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class Yr{constructor(r){t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"searchTerm");t(this,"city");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",new I);t(this,"lastLoginDate",new I);t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"salesDirection");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"partnerGroup");t(this,"contact");t(this,"lastOrder");var e,i,n;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.city=new le(r==null?void 0:r.city),this.region=new J(r==null?void 0:r.region),this.country=new j(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 I(r==null?void 0:r.createdAt),this.lastLoginDate=new I(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(c=>new oe(c)):[],this.salesDirection=new S(r==null?void 0:r.salesDirection),this.contragentInn=r==null?void 0:r.contragentInn,this.contragentType=new G(r==null?void 0:r.contragentType),this.preferredDeliveryType=new B(r==null?void 0:r.preferredDeliveryType),this.partnerGroup=new M(r==null?void 0:r.partnerGroup),this.contact=new Se(r==null?void 0:r.contact),this.lastOrder={createdAt:new I((e=r==null?void 0:r.lastOrder)==null?void 0:e.createdAt),creator:(i=r==null?void 0:r.lastOrder)==null?void 0:i.creator,isApproved:(n=r==null?void 0:r.lastOrder)==null?void 0:n.isApproved}}resetFilterValue(r){switch(r){case"id":case"phone":case"email":case"name":case"alternativeName":case"searchTerm":case"contragentInn":this[r]=void 0;break;case"city":this.city=new le;break;case"region":this.region=new J;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"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirection":this.salesDirection=new S;break;case"contragentType":this.contragentType=new G;break;case"preferredDeliveryType":this.preferredDeliveryType=new B;break;case"partnerGroup":this.partnerGroup=new M;break;case"contact":this.contact=new Se;break}return this}asClearRaw(){var e,i,n,c;const r={};return Object.keys(this).forEach(u=>{const g=this[u];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[u]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((n=r==null?void 0:r.lastLoginDate)!=null&&n.from)&&!((c=r==null?void 0:r.lastLoginDate)!=null&&c.to)&&delete r.lastLoginDate,r}}class Fe extends d{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new U(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class ar extends D{constructor(e){var i,n;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(c=>new H(c))),e.lastOrder&&(this.lastOrder=new Fe(e.lastOrder)),(n=e.partnerGroups)!=null&&n.length&&(this.partnerGroups=e.partnerGroups.map(c=>new M(c))),e.preferredDeliveryType&&(this.preferredDeliveryType=new B(e.preferredDeliveryType)),e.salesDirection&&(this.salesDirection=new S(e.salesDirection)),e.managers&&(this.managers=e.managers.map(c=>new K(c)))}}class Sr{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 Xr extends Sr{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 Zr{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 xr extends pe{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new Ve(e.data))}getClientsList(r,e,i,n){return this.getPaginated("/internal/clients",r,e,i,n,c=>{const u={...c.data};return u.data=u.data.map(g=>new Q(g)),u})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:$e.Contains,value:r}]})}getAdditionalClientsData(r,e){const i=r.map(n=>n.id);return this.post("/internal/clients/additional-data",{clients:i,requested_data_types:e},n=>{let c=[];return(n==null?void 0:n.data.length)>0&&(c=n.data.map(u=>new ar(u))),c})}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(n=>new $r(n))),i})}createClientCommonData(r,e={}){var i;return this.post("/internal/clients",{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.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},n=>new Ve(n.data),e)}updateClientCommonData(r,e={}){var i;return this.patch(`/internal/clients/${r.id}`,{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.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},void 0,e)}changeClientPassword(r,e,i,n={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:i},void 0,n)}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(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/attach`,{is_primary:n.isDefault}));await Promise.all(i)}async detachClientFromManagers(r,e){const i=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/detach`));await Promise.all(i)}createContragentClientData(r,e,i={}){var C,R,A,_,L,O,k,N;let n;const c=e,u=e,g=e;switch(e.opf.slug){case T.Ic:n={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(R=c.manager)==null?void 0:R.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case T.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(A=u.partnerGroup)==null?void 0:A.id,manager_id:(_=u.manager)==null?void 0:_.id,comment:u.comment,inn:u.inn,kpp:u.kpp,okpo:u.okpo,director_name:u.directorName,director_position:u.directorPosition,director_acts_on:u.directorActsOn,legal_address:u.legalAddress,postal_address:u.postalAddress,actual_address:u.actualAddress};break;case T.UlNr:n={opf:g.opf.slug,name:g.name,alternative_name:g.alternativeName,partner_group_id:(L=g.partnerGroup)==null?void 0:L.id,manager_id:(O=g.manager)==null?void 0:O.id,comment:g.comment,director_name:g.directorName,director_position:g.directorPosition,director_acts_on:g.directorActsOn,legal_address:g.legalAddress,postal_address:g.postalAddress,actual_address:g.actualAddress,registration_country_id:g.registrationCountry.id,registration_number:g.registrationNumber,tax_number:g.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(N=e.manager)==null?void 0:N.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,n,F=>ge.createInstance(F.data),i)}updateContragentClientData(r,e,i={}){var C,R,A,_,L,O,k,N;let n;const c=e,u=e,g=e;switch(e.opf.slug){case T.Ic:n={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(R=c.manager)==null?void 0:R.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case T.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(A=u.partnerGroup)==null?void 0:A.id,manager_id:(_=u.manager)==null?void 0:_.id,comment:u.comment,inn:u.inn,kpp:u.kpp,okpo:u.okpo,director_name:u.directorName,director_position:u.directorPosition,director_acts_on:u.directorActsOn,legal_address:u.legalAddress,postal_address:u.postalAddress,actual_address:u.actualAddress};break;case T.UlNr:n={opf:g.opf.slug,name:g.name,alternative_name:g.alternativeName,partner_group_id:(L=g.partnerGroup)==null?void 0:L.id,manager_id:(O=g.manager)==null?void 0:O.id,comment:g.comment,director_name:g.directorName,director_position:g.directorPosition,director_acts_on:g.directorActsOn,legal_address:g.legalAddress,postal_address:g.postalAddress,actual_address:g.actualAddress,registration_country_id:g.registrationCountry.id,registration_number:g.registrationNumber,tax_number:g.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(N=e.manager)==null?void 0:N.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,n,F=>ge.createInstance(F.data),i)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,i={}){var c,u;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.coordinates&&(n.coordinates={lat:(c=e.coordinates)==null?void 0:c.lat,long:(u=e.coordinates)==null?void 0:u.long}),e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),this.post(`/internal/clients/${r}/delivery-addresses`,n,g=>new he(g.data),i)}updateClientDeliveryAddress(r,e,i={}){var c,u;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),e.coordinates&&(n.coordinates={lat:(c=e.coordinates)==null?void 0:c.lat,long:(u=e.coordinates)==null?void 0:u.long}),this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,n,g=>new he(g.data),i)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,i,n={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,{bank_name:i.bankName,bic:i.bic,account_number:i.accountNumber,correspondent_account:i.correspondentAccount,currency_id:i.currency.id},c=>new ae(c.data),n)}updateContragentBankAccount(r,e,i,n={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`,{bank_name:i.bankName,bic:i.bic,account_number:i.accountNumber,correspondent_account:i.correspondentAccount,currency_id:i.currency.id},c=>new ae(c.data),n)}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},n=>new H(n.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,n={}){return this.createContact(r,i,{contragents:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},n)}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,n={}){return this.createContact(r,i,{addresses:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},n)}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,n={}){var u,g;const c={name:e.name,position:e.position,comment:e.comment,...i};return(u=e.phone)!=null&&u.length&&(c.phone=e.phone),(g=e.email)!=null&&g.length&&(c.email=e.email),this.post(`/internal/clients/${r}/contacts`,c,C=>new H(C.data),n)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class Er extends m{checkPhoneIsBusy(r){return new Promise((e,i)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(n=>{e(!!n.isBusy)}).catch(i)})}}class et extends m{getConfiguratorSettings(r){var e;return this.get(`internal/catalog/categories/${r.id}/configurators/${(e=r.properties)==null?void 0:e.editor}/settings`)}searchProduct(r,e,i={}){var c;const n=this.get(`internal/catalog/categories/${r.id}/configurators/${(c=r.properties)==null?void 0:c.editor}/product`,{params:e},u=>new a(u.data));return n.catch(u=>{this.defaultInstanceNotificationErrorResponseHandler(u,i)}),n}createTemplate(r,e,i={}){var n;return this.post(`internal/catalog/categories/${r.id}/configurators/${(n=r.properties)==null?void 0:n.editor}/template`,{...e},()=>{},i)}removeTemplate(r,e){var i;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.editor}/template/${e}`)}}class rt{static defaultDateRanges(){const r=h.addBusinessDays(new Date,1);return{nextWorkingDay:{label:"Следующий рабочий день",from:h.startOfDay(r),to:h.endOfDay(r)},today:{label:"Сегодня",from:h.startOfToday(),to:h.endOfToday()},yesterday:{label:"Вчера",from:h.startOfYesterday(),to:h.endOfYesterday()},tomorrow:{label:"Завтра",from:h.startOfTomorrow(),to:h.endOfTomorrow()}}}}const re=class re{static setLinearValues(r){re.linearValues=r}static productIsMeasurable(r){return re.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!re.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,i,n;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((i=r.properties)!=null&&i.ignoreMinCountCheck)&&((n=r.properties)!=null&&n.minCount)?r.properties.minCount:.01}};t(re,"linearValues",["пог.м.","м.","м2"]);let Ke=re;class tt{static generateUndefinedManagerInstance(){return new oe({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Tr extends m{getManagers(){const r="/internal/managers",e=m.getCachedResponse(r);return e?Promise.resolve(e):this.get(r).then(i=>{const n=i.data.map(c=>Ce.instanceInitializer(oe,c));return n&&this.cacheResponse(r,n),n})}}class Je extends Fe{constructor(e){var i,n,c,u,g,C,R,A;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 Q(e==null?void 0:e.client),this.payment={type:((i=e==null?void 0:e.payment)==null?void 0:i.type)??-1,status:((n=e==null?void 0:e.payment)==null?void 0:n.status)??-1,onlinePaymentLink:(c=e==null?void 0:e.payment)==null?void 0:c.onlinePaymentLink},this.delivery={type:((u=e==null?void 0:e.delivery)==null?void 0:u.type)??-1,date:p.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?h.parseISO(e.delivery.date):((C=e==null?void 0:e.delivery)==null?void 0:C.date)??new Date,address:(R=e==null?void 0:e.delivery)!=null&&R.address?new he(e.delivery.address):void 0,warehouse:(A=e==null?void 0:e.delivery)!=null&&A.warehouse?new ne(e.delivery.warehouse):void 0},this.attachedUser=new U(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new S(e==null?void 0:e.salesDirection),this.pendingAt=p.isString(e==null?void 0:e.pendingAt)?h.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=p.isString(e==null?void 0:e.processedAt)?h.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 br extends d{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 W(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 Ir extends Je{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 br(i)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?ge.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class it extends pe{getOrders(r,e,i){return this.getPaginated("/internal/orders",r,e?[e]:void 0,i,{},n=>{const c={...n.data};return c.data=c.data.map(u=>new Je(u)),c})}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new Ir(e.data))}}class _r{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class Qe{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 Ue(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 _r(i)))??[]}}class nt extends m{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new Qe(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new Qe(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const v=me.defineStore("__references_private",()=>{const s=f.ref({}),r=f.ref(void 0),e=f.ref(void 0),i=f.ref(void 0),n=f.ref(void 0),c=f.ref(void 0),u=f.ref(void 0),g=f.ref(void 0),C=f.ref(void 0),R=f.ref(void 0),A=f.ref(void 0),_=f.ref(void 0),L=f.ref(void 0),O=f.ref(void 0),k=f.ref(void 0),N=f.ref(void 0),F=f.ref(void 0),l=f.ref(void 0);return{dataLoaderList:s,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:i,deliveryTypeReference:n,managersList:c,opfReference:u,orderPaymentStatusReference:g,orderStatusReference:C,paymentTypeReference:R,partnerGroupReference:A,productFileTypeReference:_,resourceTypesReference:L,salesDirectionsReference:O,sourcePrimaryInterestReference:k,warehousesReference:N,propertyTypesReference:F,priceCoefficientsReference:l}}),st=me.defineStore("references",()=>{const s=f.computed(()=>{const l=v();return!l.channelPrimaryInterestReference&&!l.dataLoaderList.channelPrimaryInterestReference&&(l.dataLoaderList.channelPrimaryInterestReference=!0,m.getInstance(w).getChannelPrimaryInterest().then(y=>{l.channelPrimaryInterestReference=y}).catch(p.noop)),l.channelPrimaryInterestReference}),r=f.computed(()=>{const l=v();return!l.contactPositionsReference&&!l.dataLoaderList.contactPositionsReference&&(l.dataLoaderList.contactPositionsReference=!0,m.getInstance(w).getContactPositions().then(y=>{l.contactPositionsReference=y}).catch(p.noop)),l.contactPositionsReference}),e=f.computed(()=>{const l=v();return!l.currencyReference&&!l.dataLoaderList.currencyReference&&(l.dataLoaderList.currencyReference=!0,m.getInstance(w).getCurrency().then(y=>{l.currencyReference=y}).catch(p.noop)),l.currencyReference}),i=f.computed(()=>{const l=v();return!l.opfReference&&!l.dataLoaderList.opfReference&&(l.dataLoaderList.opfReference=!0,m.getInstance(w).getOpf().then(y=>{l.opfReference=y}).catch(p.noop)),l.opfReference}),n=f.computed(()=>{const l=v();return!l.orderPaymentStatusReference&&!l.dataLoaderList.orderPaymentStatusReference&&(l.dataLoaderList.orderPaymentStatusReference=!0,m.getInstance(w).getOrderPaymentStatuses().then(y=>{l.orderPaymentStatusReference=y}).catch(p.noop)),l.orderPaymentStatusReference}),c=f.computed(()=>{const l=v();return!l.orderStatusReference&&!l.dataLoaderList.orderStatusReference&&(l.dataLoaderList.orderStatusReference=!0,m.getInstance(w).getOrderStatuses().then(y=>{l.orderStatusReference=y}).catch(p.noop)),l.orderStatusReference}),u=f.computed(()=>{const l=v();return!l.paymentTypeReference&&!l.dataLoaderList.paymentTypeReference&&(l.dataLoaderList.paymentTypeReference=!0,m.getInstance(w).getPaymentTypes().then(y=>{l.paymentTypeReference=y}).catch(p.noop)),l.paymentTypeReference}),g=f.computed(()=>{const l=v();return!l.partnerGroupReference&&!l.dataLoaderList.partnerGroupReference&&(l.dataLoaderList.partnerGroupReference=!0,m.getInstance(w).getPartnerGroup().then(y=>{l.partnerGroupReference=y}).catch(p.noop)),l.partnerGroupReference}),C=f.computed(()=>{const l=v();return!l.productFileTypeReference&&!l.dataLoaderList.productFileTypeReference&&(l.dataLoaderList.productFileTypeReference=!0,m.getInstance(w).getProductFileType().then(y=>{l.productFileTypeReference=y}).catch(p.noop)),l.productFileTypeReference}),R=f.computed(()=>{const l=v();return!l.resourceTypesReference&&!l.dataLoaderList.resourceTypesReference&&(l.dataLoaderList.resourceTypesReference=!0,m.getInstance(w).getResourceTypes().then(y=>{l.resourceTypesReference=y}).catch(p.noop)),l.resourceTypesReference}),A=f.computed(()=>{const l=v();return!l.salesDirectionsReference&&!l.dataLoaderList.salesDirectionsReference&&(l.dataLoaderList.salesDirectionsReference=!0,m.getInstance(w).getSalesDirections().then(y=>{l.salesDirectionsReference=y}).catch(p.noop)),l.salesDirectionsReference}),_=f.computed(()=>{const l=v();return!l.sourcePrimaryInterestReference&&!l.dataLoaderList.sourcePrimaryInterestReference&&(l.dataLoaderList.sourcePrimaryInterestReference=!0,m.getInstance(w).getSourcePrimaryInterest().then(y=>{l.sourcePrimaryInterestReference=y}).catch(p.noop)),l.sourcePrimaryInterestReference}),L=f.computed(()=>{const l=v();return!l.deliveryTypeReference&&!l.dataLoaderList.deliveryTypeReference&&(l.dataLoaderList.deliveryTypeReference=!0,m.getInstance(w).getDeliveryTypes().then(y=>{l.deliveryTypeReference=y}).catch(p.noop)),l.deliveryTypeReference}),O=f.computed(()=>{const l=v();return!l.managersList&&!l.dataLoaderList.managersList&&(l.dataLoaderList.managersList=!0,m.getInstance(Tr).getManagers().then(y=>{l.managersList=y}).catch(p.noop)),l.managersList}),k=f.computed(()=>{const l=v();return!l.warehousesReference&&!l.dataLoaderList.warehousesReference&&(l.dataLoaderList.warehousesReference=!0,m.getInstance(w).getWarehouses().then(y=>{l.warehousesReference=y}).catch(p.noop)),l.warehousesReference}),N=f.computed(()=>{const l=v();return!l.propertyTypesReference&&!l.dataLoaderList.propertyTypesReference&&(l.dataLoaderList.propertyTypesReference=!0,m.getInstance(w).getPropertyTypes().then(y=>{l.propertyTypesReference=y}).catch(p.noop)),l.propertyTypesReference}),F=f.computed(()=>{const l=v();return!l.priceCoefficientsReference&&!l.dataLoaderList.priceCoefficientsReference&&(l.dataLoaderList.priceCoefficientsReference=!0,m.getInstance(w).getPriceCoefficients().then(y=>{l.priceCoefficientsReference=y}).catch(p.noop)),l.priceCoefficientsReference});return{channelPrimaryInterestsReference:s,contactPositionsReference:r,currencyReference:e,opfReference:i,orderPaymentStatusReference:n,orderStatusReference:c,paymentTypeReference:u,partnerGroupsReference:g,productFilesTypesReference:C,resourceTypesReference:R,salesDirectionsReference:A,sourcePrimaryInterestsReference:_,deliveryTypeReference:L,managersList:O,warehousesReference:k,propertyTypesReference:N,priceCoefficientsReference:F}}),ot=me.defineStore("__user_state_private",()=>{const s=f.ref({}),r=f.ref(void 0);return{dataLoaderList:s,currentUser:r}}),ct=me.defineStore("user_state",()=>({currentUser:f.computed(()=>{const r=ot();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,m.getInstance(Pr).getCurrentUser().then(e=>{r.currentUser=e}).catch(p.noop).finally(p.noop)),r.currentUser})}));class lt extends m{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 n=[...i];let c=1;return n.forEach(u=>{u.id=c++}),n})}}class ut{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}o.AnyReference=ur,o.AppBaseConfig=Or,o.AppConfigProvider=$,o.BankAccount=ae,o.BasePaginationProvider=pe,o.CalculationTypeEnum=nr,o.Cart=se,o.CartItem=Ee,o.CartItemBase=xe,o.CartProvider=kr,o.CatalogProvider=Gr,o.CatalogableItem=Ie,o.Category=q,o.CategoryPricingRule=He,o.ChannelPrimaryInterest=qe,o.City=Ur,o.CityWithRegionAndCountry=le,o.Client=Ve,o.ClientAdditionalData=ar,o.ClientCategory=ce,o.ClientDataProvider=xr,o.ClientPriceProvider=Mr,o.ClientPriceTemplateProvider=Hr,o.ClientProduct=W,o.ClientProductCategoryDataProvider=Wr,o.ClientProductDataProvider=jr,o.ClientShortInfo=Q,o.ClientsAdditionalDataRequestTypeEnum=Rr,o.ClientsListFilters=Yr,o.ConfiguratorProvider=et,o.Contact=Se,o.ContactLinks=lr,o.ContactPerson=H,o.ContactPersonRelated=$r,o.ContactPosition=pr,o.ContactRelation=Te,o.ContragentBase=ze,o.ContragentFactory=ge,o.ContragentIc=We,o.ContragentPerson=Dr,o.ContragentUlNr=Ar,o.ContragentUlR=je,o.CostSourceEnum=ve,o.Country=j,o.Currency=ue,o.DataSuggestionProvider=lt,o.DataTablePagination=Xr,o.DataTablePaginationRequestParams=Sr,o.DataTableSortRequestParams=Zr,o.DateTimeProvider=rt,o.DeletableNamedIdentity=or,o.DeliveryAddress=he,o.DeliveryType=B,o.DeviceTypeResolutionConfig=er,o.DiscountShortInfo=cr,o.FieldValidationResultData=ut,o.FilterGroup=x,o.FilterItem=Be,o.FilterOpEnum=$e,o.GeoCoordinates=Le,o.HiddenCatalogableItem=Xe,o.HttpBaseCachedRequester=we,o.HttpBaseRequester=Pe,o.HttpParamsConfig=rr,o.HttpRequester=m,o.Identity=d,o.Image=Ze,o.Manager=oe,o.ManagerCommon=K,o.ManagerDataFactory=tt,o.ManagerDataProvider=Tr,o.MetaTagItem=_r,o.NamedIdentity=D,o.Opf=G,o.OpfEnum=T,o.Order=Ir,o.OrderInfo=Je,o.OrderPaymentStatus=gr,o.OrderProduct=br,o.OrderShortInfo=Fe,o.OrderStatus=hr,o.OrdersDataProvider=it,o.PartnerGroup=M,o.PaymentType=mr,o.PreferencesStorageProvider=Nr,o.PriceAnalyze=Ae,o.PriceAnalyzeProvider=Qr,o.PriceCoefficient=ie,o.PriceCoefficientEnum=_e,o.PriceTemplate=z,o.PriceTemplateCategory=Re,o.PriceTemplateClient=Y,o.PriceTemplateICatalogableItem=ke,o.PriceTemplateProduct=De,o.PriceTemplateProvider=Vr,o.PricingRole=Z,o.PricingRoleProvider=Fr,o.PrimaryCatalogableItem=fe,o.Product=a,o.ProductCategoryDataProvider=Br,o.ProductDataProvider=zr,o.ProductFileType=fr,o.ProductPriceCoefficient=ye,o.ProductPriceHistory=wr,o.PropertiesProvider=Kr,o.Property=X,o.PropertyType=de,o.PropertyTypeEnum=sr,o.PropertyValue=V,o.RecommendationsDataProvider=Jr,o.RecommendationsList=Me,o.Reference=P,o.ReferenceDataProvider=w,o.Region=J,o.ResourceType=Ue,o.SalesDirection=S,o.SentryConfig=tr,o.Seo=Qe,o.SeoDataProvider=nt,o.SourcePrimaryInterest=Ge,o.StockCount=Ye,o.TemplatesListFilters=qr,o.TypedInstanceFactory=Ce,o.UnitsHelper=Ke,o.UnknownClientDataProvider=Er,o.UpdatableNamedIdentity=Oe,o.User=Cr,o.UserCommonInfo=Ne,o.UserDataProvider=Pr,o.UserShortInfo=U,o.UserTypeEnum=yr,o.VersionConfig=ir,o.Warehouse=ne,o.useReferencesStore=st,o.useUserStateStore=ct,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("lodash-es"),require("date-fns"),require("axios"),require("ts-case-convert"),require("pinia"),require("vue")):typeof define=="function"&&define.amd?define(["exports","lodash-es","date-fns","axios","ts-case-convert","pinia","vue"],p):(c=typeof globalThis<"u"?globalThis:c||self,p(c["SC Common Lib"]={},c["lodash-es"],c["date-fns"],c.axios,c["ts-case-convert"],c.pinia,c.vue))})(this,function(c,p,h,Or,be,me,f){"use strict";var gt=Object.defineProperty;var ht=(c,p,h)=>p in c?gt(c,p,{enumerable:!0,configurable:!0,writable:!0,value:h}):c[p]=h;var t=(c,p,h)=>ht(c,typeof p!="symbol"?p+"":p,h);class q{constructor(r){t(this,"id");t(this,"guid");this.id=r==null?void 0:r.id,p.isNil(this.id)&&(typeof(r==null?void 0:r.id)=="number"?this.id=-1:typeof(r==null?void 0:r.id)=="string"&&(this.id="")),this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return typeof this.id=="number"?this.id===-1:(typeof this.id=="string"&&(this.id=""),p.isNil(this.id))}}class D extends q{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class Ie extends D{constructor(e){super(e);t(this,"slug");t(this,"code");t(this,"type");this.slug=(e==null?void 0:e.slug)??"",this.code=(e==null?void 0:e.code)??""}}class fe extends Ie{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class te extends fe{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,n])=>[p.toUpper(i),n])):void 0}}var _e=(s=>(s.K0="k0",s.K1="k1",s.K2="k2",s.K3="k3",s.K4="k4",s.Retail="retail",s))(_e||{});class P extends D{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 ie extends P{static getRetailPriceCoefficient(){return{id:-2,slug:_e.Retail,name:"Розн. цена",guid:"",isNewRec:p.constant(!0)}}}class ye{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new ie(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 Le{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 B extends P{}class ne 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(n=>new B(n)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Le(e==null?void 0:e.coordinates)}}class Xe{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new ne(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const E=class E{static init(r){E.config=r}static getConfig(){if(p.isUndefined(E.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return E.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(n=>{n({})})));return e.catch(i=>{console.error(i)}),e}};t(E,"config");let $=E;class Ze extends Ie{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class xe{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 S extends Ze{constructor(e){var n,o,l,g;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=p.isString(e==null?void 0:e.costDate)?h.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((n=e==null?void 0:e.stockCount)==null?void 0:n.map(C=>new Xe(C)))??[],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(C=>C.isPrimary));i&&(this.category=new fe({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(C=>new fe(C))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(C=>new xe(C,$.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=((g=e==null?void 0:e.priceCoefficients)==null?void 0:g.map(C=>new ye(C)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){var i;const e=(i=$.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)}}class Ee extends q{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 S(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new te,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&p.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class er extends Ee{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 se{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new er(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class rr{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 tr{constructor(r){t(this,"apiUri");t(this,"mediaUrl");t(this,"responseDataCacheTimeout");this.apiUri=(r==null?void 0:r.apiUri)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class ir{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,i,n,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:((n=r==null?void 0:r.replay)==null?void 0:n.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 nr{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=p.isString(r==null?void 0:r.date)?h.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 kr{constructor(r){t(this,"environment");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"sentry");t(this,"urls");t(this,"version");t(this,"dateFormats");var e,i,n;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new tr(r==null?void 0:r.http),this.deviceTypeByResolution=new rr(r==null?void 0:r.deviceTypeByResolution),this.sentry=new ir({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new nr(r==null?void 0:r.version),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:((n=r==null?void 0:r.dateFormats)==null?void 0:n.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}class Ce{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const b=class b{constructor(r,e){t(this,"httpClient");t(this,"defaultInstanceNotificationErrorResponseHandler",p.noop);const i=$.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=b.baseDefaultNotificationErrorResponseHandler,this.httpClient=Or.create({baseURL:r,headers:{"APP-VERSION":`${i.name} (${i.version}, ${h.format(i.date,$.getConfig().dateFormats.uiDate)})`,Accept:"application/json","Content-Type":"application/json",...e}}),this.httpClient.interceptors.request.use(n=>(n.method&&(n.method==="get"&&n.params&&(n.params=be.objectToSnake(n.params)),["put","patch","post"].includes(p.toLower(n.method))&&n.data&&(n.data=be.objectToSnake(n.data))),n),n=>Promise.reject(n)),this.httpClient.interceptors.response.use(n=>(n.data&&(n.data=be.objectToCamel(n.data)),n),n=>b.convertHttpErrorResponse(n))}static setBaseDefaultNotificationErrorResponseHandler(r){b.baseDefaultNotificationErrorResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(b.instances,r.name)||(b.instances[r.name]=Ce.simpleInstanceInitializer(r)),b.instances[r.name]}static convertHttpErrorResponse(r){var i,n;const e=r==null?void 0:r.response;return Promise.reject({status:(e==null?void 0:e.status)??0,statusText:(e==null?void 0:e.statusText)??"Unknown",message:((i=e==null?void 0:e.data)==null?void 0:i.message)??"Unknown Error. Probably network error.",errors:(n=e==null?void 0:e.data)==null?void 0:n.errors,headers:(e==null?void 0:e.headers)??{},data:e==null?void 0:e.data,rawError:r})}request(r,e=void 0,i={},n=!1){const o=this.httpClient.request(r).then(l=>e?e(l):l.data);return n||o.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,i)}),o}get(r,e={},i=void 0,n=!1){return this.request({method:"GET",url:r,params:e},i,{},n)}getBlob(r,e={},i=void 0,n=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},i,{},n)}patch(r,e={},i=void 0,n={},o=!1){return this.request({method:"PATCH",url:r,data:e},i,n,o)}post(r,e={},i=void 0,n={},o=!1){return this.request({method:"POST",url:r,data:e},i,n,o)}delete(r,e=void 0,i=!1){return this.request({method:"DELETE",url:r},e,{},i)}};t(b,"instances",{}),t(b,"baseDefaultNotificationErrorResponseHandler",p.noop);let Pe=b;const ee=class ee extends Pe{constructor(e,i){super(e,i);t(this,"responseDataCacheTimeout");const n=$.getConfig();this.responseDataCacheTimeout=n.http.responseDataCacheTimeout}static getCachedResponse(e){const i=ee.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){ee.responseDataCache.set(e,{validTo:h.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,n=!1,o={}){const l=i+(p.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),g=n?ee.getCachedResponse(l):void 0;return g?Promise.resolve(g):this.get(i,o).then(C=>{const R=C.map(A=>Ce.instanceInitializer(e,A));return n&&R&&this.cacheResponse(i,R),R})}};t(ee,"responseDataCache",new Map);let we=ee;class m extends we{constructor(){var i,n;const r=$.getConfig(),e={};(i=r.devMode)!=null&&i.authBearerToken&&(e.Authorization=`Bearer ${(n=r.devMode)==null?void 0:n.authBearerToken}`),super(`${r.http.apiUri}/api`,e)}}class Nr extends m{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new se(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},n=>new se(n.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},n=>new se(n.data),i)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,{},e=>new se(e.data))}}var sr=(s=>(s.m2Cost="m2Cost",s.percent="percent",s.value="value",s))(sr||{}),ve=(s=>(s.Discount="discount",s.PriceTemplate="price_template",s.ClientPrice="client_price",s.Product="product",s))(ve||{}),or=(s=>(s.Unknown="unknown",s.Bool="bool",s.Integer="integer",s.Float="float",s.String="string",s.Range="range",s.Json="json",s.Object="object",s))(or||{});class U extends te{constructor(e){var i,n;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new U(o)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(o=>new S(o))}}class Oe extends D{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class cr extends Oe{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class qr{static getActualDataFromStorage(r){const e=localStorage.getItem(r);if(e)try{const i=JSON.parse(e);if(h.isAfter(h.parseISO(i.availableFor)||h.startOfToday(),new Date))return i.data??{}}catch{localStorage.removeItem(r)}}static saveActualDataToStorage(r,e,i){localStorage.setItem(r,JSON.stringify({availableFor:i,data:e}))}}class d extends D{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class lr extends D{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=p.isString(e==null?void 0:e.publishedAt)?h.parseISO(e.publishedAt):e==null?void 0:e.publishedAt,this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new d(e==null?void 0:e.owner),this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class z extends Oe{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}class W extends S{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)??ve.Product,this.discount=e!=null&&e.discount?new lr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new z(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 ur{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class a extends P{}class K extends D{constructor(e){super(e);t(this,"salesDirection",new a);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new a(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new ur(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class oe extends K{constructor(e){super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");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}}class Ur extends te{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 oe(e.manager):void 0}}class ce extends Ur{constructor(e){var i,n;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new ce(o)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(o=>new W(o))}}class ke{constructor(r){t(this,"priceCoefficient");t(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new ie(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class Re extends ke{constructor(e){super(e);t(this,"productCategory");this.productCategory=new te(e==null?void 0:e.productCategory)}}class j extends P{}class J extends P{constructor(e){super(e);t(this,"country",new j);e&&(this.country=new j(e.country))}}class le extends P{constructor(e){super(e);t(this,"region",new J);e&&(this.region=new J(e.region))}}class Ne extends D{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 a(e.salesDirection):void 0,this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?h.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class Q extends Ne{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 a(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 le(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(n=>new K(n)))??[]}}class Y extends q{constructor(e){super(e);t(this,"startAt");t(this,"endAt");t(this,"client");t(this,"priceTemplate");this.startAt=p.isString(e==null?void 0:e.startAt)?h.parseISO(e.startAt):(e==null?void 0:e.startAt)??new Date,this.endAt=p.isString(e==null?void 0:e.endAt)?h.parseISO(e.endAt):(e==null?void 0:e.endAt)??new Date,this.client=new Q(e==null?void 0:e.client),this.priceTemplate=new z(e==null?void 0:e.priceTemplate)}}class De extends ke{constructor(e){super(e);t(this,"product");this.product=new S(e==null?void 0:e.product)}}class qe extends P{}class X extends D{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new qe(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class V{constructor(r){t(this,"property");t(this,"value");this.property=new X(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class I{constructor(r){t(this,"from");t(this,"to");this.from=p.isString(r==null?void 0:r.from)?h.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=p.isString(r==null?void 0:r.to)?h.parseISO(r.to):(r==null?void 0:r.to)??null}}class dr{constructor(r){t(this,"id");t(this,"name");t(this,"description");t(this,"createdAt",new I);t(this,"updatedAt",new I);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 I(r==null?void 0:r.createdAt),this.updatedAt=new I(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,n,o;const r={};return Object.keys(this).forEach(l=>{const g=this[l];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[l]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((n=r==null?void 0:r.updatedAt)!=null&&n.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class pr extends P{}class Ue extends P{}class Gr extends P{}class gr extends P{}class ue extends D{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var T=(s=>(s.Person="individual",s.Ic="entrepreneur",s.UlR="legal",s.UlNr="non_resident_legal",s))(T||{});class G extends P{static generatePersonItem(){return new G({id:1,guid:"",slug:T.Person,name:""})}}class hr extends P{}class mr extends P{}class M extends P{}class fr extends P{}class yr extends P{}class de extends P{}class Ge extends P{}class w extends m{getReference(r,e=!1){return this.getTypedDataArrayRequester(pr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Ue,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(gr,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(ue,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(M,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(G,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(hr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(mr,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(fr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(de,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(a,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Ge,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(le,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(J,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(j,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(B,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(ne,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(qe,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(ie,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(yr,"/public/references/product-file-type",!0)}}var Cr=(s=>(s.Admin="admin",s.Manager="manager",s.Operator="operator",s.Client="client",s.Guest="guest",s))(Cr||{});class Pr extends Ne{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 wr extends m{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Pr(r.data))}}class vr{constructor(r){t(this,"cost");t(this,"costDate");t(this,"isLowCost");t(this,"isRetail");t(this,"discountName");t(this,"priceTemplateName");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost,this.costDate=p.isString(r.costDate)?h.parseISO(r.costDate):r.costDate,this.isLowCost=r.isLowCost,this.isRetail=r.isRetail,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.client=r.client?new d(r.client):void 0,this.executor=r.executor?new d(r.executor):void 0,this.currency=r.currency?new ue(r.currency):void 0}}class Me{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new S(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new U(e)))}}class Z extends D{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 Z(r==null?void 0:r.role),this.category=new te(r==null?void 0:r.category),this.minCoefficient=new ie(r==null?void 0:r.minCoefficient)}}class Mr extends m{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,i=void 0,n=void 0){let l=`${$.getConfig().http.apiUri}/api/internal/price/export?format=${r}&show_hidden=${e}`;return i&&(l+=`&category_id=${i}`),n&&(l+=`&client_id=${n}`),l}}class Hr extends m{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,i){var n;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.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 n;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value},o=>new W(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,i=>new W(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 Br extends m{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new Y(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new Y(e.data))}attachTemplate(r,e,i){const n=$.getConfig().dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,i&&{startAt:i.startAt&&h.format(i.startAt,n),endAt:i.endAt&&h.format(i.endAt,n)},o=>new Y(o.data))}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`)}changeTemplate(r,e,i,n){const o=$.getConfig().dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${i}`,n&&{startAt:n.startAt&&h.format(n.startAt,o),endAt:n.endAt&&h.format(n.endAt,o)},l=>new Y(l.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class zr extends m{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(i=>new U(i)))}getCategoryData(r,e=!1,i=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:i},n=>new U(n.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new U(e.data))}getCategoryProductsList(r,e=!0,i=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:i,withPriceCoefficients:e},n=>p.map(n.data,o=>new S(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return p.forEach(i,n=>n.map(o=>new ye(o))),i})}publicSimpleSearch(r,e=10){return new Promise((i,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.categories.map(l=>new U(l)))}).catch(o=>{n(o)})})}}class Wr extends m{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new S(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new S(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>p.map(e.data,i=>new ye(i)))}getProductPriceHistory(r,e){const i={};return p.isNil(e)||(i.clientId=e),this.get(`/internal/price/products/${r}/history`,i,n=>p.map(n.data,o=>new vr(o)))}publicSimpleSearch(r,e=10){return new Promise((i,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.products.map(l=>new S(l)))}).catch(o=>{n(o)})})}}class jr extends m{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(n=>new ce(n)))}getCategoryData(r,e,i=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:n},o=>new ce(o.data))}getCategoryProductsList(r,e,i=!0,n=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:n,withPriceCoefficients:i},o=>p.map(o.data,l=>new W(l)))}}class Vr extends m{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},n=>new W(n.data))}}var Ae=(s=>(s.BeginWith="bw",s.Contains="cn",s.Custom="custom",s.EndsWith="ew",s.Equals="eq",s.GreaterOrEqual="ge",s.GreaterThan="gt",s.InList="in",s.LessOrEqual="le",s.LessThan="lt",s.NotBeginWith="bn",s.NotContains="nc",s.NotEndsWith="en",s.NotEqual="ne",s.NotInList="ni",s.NotNull="nn",s.Null="nu",s))(Ae||{});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)??Ae.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r={field:this.field,op:this.op};return r.value=p.isDate(this.value)?h.format(this.value,$.getConfig().dateFormats.api):this.value,r}}class x{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(n=>new Be(n)))??[],this.groups=((i=r==null?void 0:r.groups)==null?void 0:i.map(n=>new x(n)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Be&&p.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof x?r.toPrimitive():r)}}}class pe extends m{getPaginated(r,e,i,n,o,l,g){let C={page:(n==null?void 0:n.page)??1,perPage:(n==null?void 0:n.pageSize)??10};return e&&(C.filters=JSON.stringify((e instanceof x?e:new x(e)).toPrimitive())),p.isEmpty(i)||(C.sort=p.isArray(i)?i:[i]),o&&(C={...C,...o}),this.get(r,C,l,g)}}class Fr extends pe{getTemplateList(r,e,i){return this.getPaginated("/internal/price/templates",r,e,i,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new z(l)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,i=>new z(i.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new z(e.data))}updateTemplate(r,e,i={}){return this.patch(`/internal/price/templates/${r}`,e,n=>new z(n.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 De(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new De(i.data))}saveProductTemplatePrice(r,e,i){var n;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value},o=>new De(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 Re(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new Re(i.data))}saveCategoryTemplatePrice(r,e,i){var n;return this.post(`/internal/price/templates/${r}/categories/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value},o=>new Re(o.data))}deleteCategoryTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/categories/${e}`)}getTemplateClients(r){return this.get(`/internal/price/templates/${r}/clients`,{},e=>e.data.map(i=>new Y(i)))}}class Kr extends m{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new Z(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new Z(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new Z(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new Z(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(n=>new He(n)))}}class Jr extends pe{getProperties(r,e,i){return this.getPaginated("/internal/catalog/properties",r,e,i,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new X(l)),o})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},n=>new X(n.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new X(e.data))}updateProperty(r,e){const{typeId:i,...n}=e;return this.patch(`/internal/catalog/properties/${r}`,{...n,type:i},o=>new X(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 V(i)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},i=>new V(i.data))}updateProductProperty(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:i},n=>new V(n.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 V(i)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},i=>new V(i.data))}updateCategoryProperty(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:i},n=>new V(n.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})}}class Qr extends m{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Me(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Me(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/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/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}}var Rr=(s=>(s.LastOrder="last_order",s.Contacts="contacts",s.PartnerGroups="partner_groups",s.PreferredDeliveryType="preferred_delivery_type",s.SalesDirection="sales_direction",s.Managers="managers",s))(Rr||{});class $e extends q{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new ue);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new ue(e.currency))}}class Se extends D{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 H extends Se{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=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class ze extends D{constructor(e){super(e);t(this,"manager",new K);t(this,"opf",G.generatePersonItem());t(this,"salesDirection",new a);t(this,"partnerGroup",new M);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 G(e.opf),this.salesDirection=new a(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new d(e.creator):void 0,this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new d(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new M(e.partnerGroup)),e.manager&&(this.manager=new K(e.manager)),e.contacts){const i=[];e.contacts.forEach(n=>{i.push(new H(n))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(n=>{i.push(new $e(n))}),this.bankAccounts=i}}}}class Dr extends ze{constructor(r){super(r)}}class We extends ze{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 je extends We{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class Ar extends je{constructor(e){super(e);t(this,"registrationCountry",new j);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new j(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class ge{static createInstance(r){switch(r.opf.slug){case T.Ic:return new We(r);case T.UlR:return new je(r);case T.UlNr:return new Ar(r);default:return new Dr(r)}}}class ae extends q{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class $r extends H{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(i=>new ae(i))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(i=>new ae(i))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(i=>new ae(i))))}}class he extends cr{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 Le(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(n=>new H(n)))??[],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 Ve extends Q{constructor(e){var i,n,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,"preferredWarehouse");t(this,"extraData");this.contragents=((i=e==null?void 0:e.contragents)==null?void 0:i.map(g=>ge.createInstance(g)))??[],this.partnerGroups=((n=e==null?void 0:e.partnerGroups)==null?void 0:n.map(g=>new M(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new H(g)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(g=>new he(g)))??[],this.channelPrimaryInterest=new Ue(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Ge(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new B(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new ne(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class Yr{constructor(r){t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"searchTerm");t(this,"city");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",new I);t(this,"lastLoginDate",new I);t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"salesDirection");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"partnerGroup");t(this,"contact");t(this,"lastOrder");var e,i,n;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.city=new le(r==null?void 0:r.city),this.region=new J(r==null?void 0:r.region),this.country=new j(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 I(r==null?void 0:r.createdAt),this.lastLoginDate=new I(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(o=>new oe(o)):[],this.salesDirection=new a(r==null?void 0:r.salesDirection),this.contragentInn=r==null?void 0:r.contragentInn,this.contragentType=new G(r==null?void 0:r.contragentType),this.preferredDeliveryType=new B(r==null?void 0:r.preferredDeliveryType),this.partnerGroup=new M(r==null?void 0:r.partnerGroup),this.contact=new Se(r==null?void 0:r.contact),this.lastOrder={createdAt:new I((e=r==null?void 0:r.lastOrder)==null?void 0:e.createdAt),creator:(i=r==null?void 0:r.lastOrder)==null?void 0:i.creator,isApproved:(n=r==null?void 0:r.lastOrder)==null?void 0:n.isApproved}}resetFilterValue(r){switch(r){case"id":case"phone":case"email":case"name":case"alternativeName":case"searchTerm":case"contragentInn":this[r]=void 0;break;case"city":this.city=new le;break;case"region":this.region=new J;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"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirection":this.salesDirection=new a;break;case"contragentType":this.contragentType=new G;break;case"preferredDeliveryType":this.preferredDeliveryType=new B;break;case"partnerGroup":this.partnerGroup=new M;break;case"contact":this.contact=new Se;break}return this}asClearRaw(){var e,i,n,o;const r={};return Object.keys(this).forEach(l=>{const g=this[l];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[l]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((n=r==null?void 0:r.lastLoginDate)!=null&&n.from)&&!((o=r==null?void 0:r.lastLoginDate)!=null&&o.to)&&delete r.lastLoginDate,r}}class Fe extends q{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new d(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Sr extends D{constructor(e){var i,n;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 H(o))),e.lastOrder&&(this.lastOrder=new Fe(e.lastOrder)),(n=e.partnerGroups)!=null&&n.length&&(this.partnerGroups=e.partnerGroups.map(o=>new M(o))),e.preferredDeliveryType&&(this.preferredDeliveryType=new B(e.preferredDeliveryType)),e.salesDirection&&(this.salesDirection=new a(e.salesDirection)),e.managers&&(this.managers=e.managers.map(o=>new K(o)))}}class ar{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 Xr extends ar{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 Zr{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 xr extends pe{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new Ve(e.data))}getClientsList(r,e,i,n){return this.getPaginated("/internal/clients",r,e,i,n,o=>{const l={...o.data};return l.data=l.data.map(g=>new Q(g)),l})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Ae.Contains,value:r}]})}getAdditionalClientsData(r,e){const i=r.map(n=>n.id);return this.post("/internal/clients/additional-data",{clients:i,requested_data_types:e},n=>{let o=[];return(n==null?void 0:n.data.length)>0&&(o=n.data.map(l=>new Sr(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(n=>new $r(n))),i})}createClientCommonData(r,e={}){var i;return this.post("/internal/clients",{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.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},n=>new Ve(n.data),e)}updateClientCommonData(r,e={}){var i;return this.patch(`/internal/clients/${r.id}`,{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.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},void 0,e)}changeClientPassword(r,e,i,n={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:i},void 0,n)}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(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/attach`,{is_primary:n.isDefault}));await Promise.all(i)}async detachClientFromManagers(r,e){const i=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/detach`));await Promise.all(i)}createContragentClientData(r,e,i={}){var C,R,A,_,L,O,k,N;let n;const o=e,l=e,g=e;switch(e.opf.slug){case T.Ic:n={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(C=o.partnerGroup)==null?void 0:C.id,manager_id:(R=o.manager)==null?void 0:R.id,comment:o.comment,inn:o.inn,okpo:o.okpo,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};break;case T.UlR:n={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:(A=l.partnerGroup)==null?void 0:A.id,manager_id:(_=l.manager)==null?void 0:_.id,comment:l.comment,inn:l.inn,kpp:l.kpp,okpo:l.okpo,director_name:l.directorName,director_position:l.directorPosition,director_acts_on:l.directorActsOn,legal_address:l.legalAddress,postal_address:l.postalAddress,actual_address:l.actualAddress};break;case T.UlNr:n={opf:g.opf.slug,name:g.name,alternative_name:g.alternativeName,partner_group_id:(L=g.partnerGroup)==null?void 0:L.id,manager_id:(O=g.manager)==null?void 0:O.id,comment:g.comment,director_name:g.directorName,director_position:g.directorPosition,director_acts_on:g.directorActsOn,legal_address:g.legalAddress,postal_address:g.postalAddress,actual_address:g.actualAddress,registration_country_id:g.registrationCountry.id,registration_number:g.registrationNumber,tax_number:g.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(N=e.manager)==null?void 0:N.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,n,F=>ge.createInstance(F.data),i)}updateContragentClientData(r,e,i={}){var C,R,A,_,L,O,k,N;let n;const o=e,l=e,g=e;switch(e.opf.slug){case T.Ic:n={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(C=o.partnerGroup)==null?void 0:C.id,manager_id:(R=o.manager)==null?void 0:R.id,comment:o.comment,inn:o.inn,okpo:o.okpo,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};break;case T.UlR:n={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:(A=l.partnerGroup)==null?void 0:A.id,manager_id:(_=l.manager)==null?void 0:_.id,comment:l.comment,inn:l.inn,kpp:l.kpp,okpo:l.okpo,director_name:l.directorName,director_position:l.directorPosition,director_acts_on:l.directorActsOn,legal_address:l.legalAddress,postal_address:l.postalAddress,actual_address:l.actualAddress};break;case T.UlNr:n={opf:g.opf.slug,name:g.name,alternative_name:g.alternativeName,partner_group_id:(L=g.partnerGroup)==null?void 0:L.id,manager_id:(O=g.manager)==null?void 0:O.id,comment:g.comment,director_name:g.directorName,director_position:g.directorPosition,director_acts_on:g.directorActsOn,legal_address:g.legalAddress,postal_address:g.postalAddress,actual_address:g.actualAddress,registration_country_id:g.registrationCountry.id,registration_number:g.registrationNumber,tax_number:g.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(N=e.manager)==null?void 0:N.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,n,F=>ge.createInstance(F.data),i)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,i={}){var o,l;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.coordinates&&(n.coordinates={lat:(o=e.coordinates)==null?void 0:o.lat,long:(l=e.coordinates)==null?void 0:l.long}),e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),this.post(`/internal/clients/${r}/delivery-addresses`,n,g=>new he(g.data),i)}updateClientDeliveryAddress(r,e,i={}){var o,l;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),e.coordinates&&(n.coordinates={lat:(o=e.coordinates)==null?void 0:o.lat,long:(l=e.coordinates)==null?void 0:l.long}),this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,n,g=>new he(g.data),i)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,i,n={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,{bank_name:i.bankName,bic:i.bic,account_number:i.accountNumber,correspondent_account:i.correspondentAccount,currency_id:i.currency.id},o=>new $e(o.data),n)}updateContragentBankAccount(r,e,i,n={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`,{bank_name:i.bankName,bic:i.bic,account_number:i.accountNumber,correspondent_account:i.correspondentAccount,currency_id:i.currency.id},o=>new $e(o.data),n)}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},n=>new H(n.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,n={}){return this.createContact(r,i,{contragents:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},n)}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,n={}){return this.createContact(r,i,{addresses:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},n)}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,n={}){var l,g;const o={name:e.name,position:e.position,comment:e.comment,...i};return(l=e.phone)!=null&&l.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,C=>new H(C.data),n)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class Er extends m{checkPhoneIsBusy(r){return new Promise((e,i)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(n=>{e(!!n.isBusy)}).catch(i)})}}class et extends m{getConfiguratorSettings(r){var e;return this.get(`internal/catalog/categories/${r.id}/configurators/${(e=r.properties)==null?void 0:e.editor}/settings`)}searchProduct(r,e,i={}){var o;const n=this.get(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.editor}/product`,{params:e},l=>new S(l.data));return n.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,i)}),n}createTemplate(r,e,i={}){var n;return this.post(`internal/catalog/categories/${r.id}/configurators/${(n=r.properties)==null?void 0:n.editor}/template`,{...e},()=>{},i)}removeTemplate(r,e){var i;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.editor}/template/${e}`)}}class rt{static defaultDateRanges(){const r=h.addBusinessDays(new Date,1);return{nextWorkingDay:{label:"Следующий рабочий день",from:h.startOfDay(r),to:h.endOfDay(r)},today:{label:"Сегодня",from:h.startOfToday(),to:h.endOfToday()},yesterday:{label:"Вчера",from:h.startOfYesterday(),to:h.endOfYesterday()},tomorrow:{label:"Завтра",from:h.startOfTomorrow(),to:h.endOfTomorrow()}}}}const re=class re{static setLinearValues(r){re.linearValues=r}static productIsMeasurable(r){return re.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!re.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,i,n;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((i=r.properties)!=null&&i.ignoreMinCountCheck)&&((n=r.properties)!=null&&n.minCount)?r.properties.minCount:.01}};t(re,"linearValues",["пог.м.","м.","м2"]);let Ke=re;class tt{static generateUndefinedManagerInstance(){return new oe({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Tr extends m{getManagers(){const r="/internal/managers",e=m.getCachedResponse(r);return e?Promise.resolve(e):this.get(r).then(i=>{const n=i.data.map(o=>Ce.instanceInitializer(oe,o));return n&&this.cacheResponse(r,n),n})}}class Je extends Fe{constructor(e){var i,n,o,l,g,C,R,A;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 Q(e==null?void 0:e.client),this.payment={type:((i=e==null?void 0:e.payment)==null?void 0:i.type)??-1,status:((n=e==null?void 0:e.payment)==null?void 0:n.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:p.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?h.parseISO(e.delivery.date):((C=e==null?void 0:e.delivery)==null?void 0:C.date)??new Date,address:(R=e==null?void 0:e.delivery)!=null&&R.address?new he(e.delivery.address):void 0,warehouse:(A=e==null?void 0:e.delivery)!=null&&A.warehouse?new ne(e.delivery.warehouse):void 0},this.attachedUser=new d(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new a(e==null?void 0:e.salesDirection),this.pendingAt=p.isString(e==null?void 0:e.pendingAt)?h.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=p.isString(e==null?void 0:e.processedAt)?h.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 br extends q{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 W(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 Ir extends Je{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 br(i)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?ge.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class it extends pe{getOrders(r,e,i){return this.getPaginated("/internal/orders",r,e?[e]:void 0,i,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new Je(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 Ir(e.data))}}class Te{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new Q(r==null?void 0:r.client),this.product=new S(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)??ve.Product}}const Qe=s=>{var r,e,i,n,o;return s?p.omitBy({cities:(r=s.cities)==null?void 0:r.map(l=>l.id),clients:(e=s.clients)==null?void 0:e.map(l=>l.id),managers:(i=s.managers)==null?void 0:i.map(l=>l.id),partnerGroups:(n=s.partnerGroups)==null?void 0:n.map(l=>l.id),salesDirections:(o=s.salesDirections)==null?void 0:o.map(l=>l.id),hideNotActive:s.hideNotActive},l=>p.isNil(l)||(p.isArray(l)||p.isObject(l))&&p.isEmpty(l)):{}},_r=s=>{const r={};return s.from&&(s.from.coefficient||s.from.value)&&(r.from={},s.from.coefficient&&(r.from.priceCoefficientId=s.from.coefficient.id),s.from.value&&(r.from.increasePercent=s.from.value)),s.to&&(s.to.coefficient||s.to.value)&&(r.to={},s.to.coefficient&&(r.to.priceCoefficientId=s.to.coefficient.id),s.to.value&&(r.to.increasePercent=s.to.value)),r};class nt extends m{analyzeProductPrices(r,e,i){return this.get(`/internal/price/products/${r}/analyze`,{..._r(e),filters:Qe(i)},n=>n.data.map(o=>new Te(o)))}analyzeCategoryPrices(r,e,i){return this.get(`/internal/price/categories/${r}/analyze`,{..._r(e),filters:Qe(i)},n=>n.data.map(o=>new Te(o)))}analyzeCategoryPricesBySquare(r,e,i){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:Qe(i)},n=>n.data.map(o=>new Te(o)))}}class Lr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class Ye{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 de(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 Lr(i)))??[]}}class st extends m{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new Ye(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new Ye(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const v=me.defineStore("__references_private",()=>{const s=f.ref({}),r=f.ref(void 0),e=f.ref(void 0),i=f.ref(void 0),n=f.ref(void 0),o=f.ref(void 0),l=f.ref(void 0),g=f.ref(void 0),C=f.ref(void 0),R=f.ref(void 0),A=f.ref(void 0),_=f.ref(void 0),L=f.ref(void 0),O=f.ref(void 0),k=f.ref(void 0),N=f.ref(void 0),F=f.ref(void 0),u=f.ref(void 0);return{dataLoaderList:s,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:i,deliveryTypeReference:n,managersList:o,opfReference:l,orderPaymentStatusReference:g,orderStatusReference:C,paymentTypeReference:R,partnerGroupReference:A,productFileTypeReference:_,resourceTypesReference:L,salesDirectionsReference:O,sourcePrimaryInterestReference:k,warehousesReference:N,propertyTypesReference:F,priceCoefficientsReference:u}}),ot=me.defineStore("references",()=>{const s=f.computed(()=>{const u=v();return!u.channelPrimaryInterestReference&&!u.dataLoaderList.channelPrimaryInterestReference&&(u.dataLoaderList.channelPrimaryInterestReference=!0,m.getInstance(w).getChannelPrimaryInterest().then(y=>{u.channelPrimaryInterestReference=y}).catch(p.noop)),u.channelPrimaryInterestReference}),r=f.computed(()=>{const u=v();return!u.contactPositionsReference&&!u.dataLoaderList.contactPositionsReference&&(u.dataLoaderList.contactPositionsReference=!0,m.getInstance(w).getContactPositions().then(y=>{u.contactPositionsReference=y}).catch(p.noop)),u.contactPositionsReference}),e=f.computed(()=>{const u=v();return!u.currencyReference&&!u.dataLoaderList.currencyReference&&(u.dataLoaderList.currencyReference=!0,m.getInstance(w).getCurrency().then(y=>{u.currencyReference=y}).catch(p.noop)),u.currencyReference}),i=f.computed(()=>{const u=v();return!u.opfReference&&!u.dataLoaderList.opfReference&&(u.dataLoaderList.opfReference=!0,m.getInstance(w).getOpf().then(y=>{u.opfReference=y}).catch(p.noop)),u.opfReference}),n=f.computed(()=>{const u=v();return!u.orderPaymentStatusReference&&!u.dataLoaderList.orderPaymentStatusReference&&(u.dataLoaderList.orderPaymentStatusReference=!0,m.getInstance(w).getOrderPaymentStatuses().then(y=>{u.orderPaymentStatusReference=y}).catch(p.noop)),u.orderPaymentStatusReference}),o=f.computed(()=>{const u=v();return!u.orderStatusReference&&!u.dataLoaderList.orderStatusReference&&(u.dataLoaderList.orderStatusReference=!0,m.getInstance(w).getOrderStatuses().then(y=>{u.orderStatusReference=y}).catch(p.noop)),u.orderStatusReference}),l=f.computed(()=>{const u=v();return!u.paymentTypeReference&&!u.dataLoaderList.paymentTypeReference&&(u.dataLoaderList.paymentTypeReference=!0,m.getInstance(w).getPaymentTypes().then(y=>{u.paymentTypeReference=y}).catch(p.noop)),u.paymentTypeReference}),g=f.computed(()=>{const u=v();return!u.partnerGroupReference&&!u.dataLoaderList.partnerGroupReference&&(u.dataLoaderList.partnerGroupReference=!0,m.getInstance(w).getPartnerGroup().then(y=>{u.partnerGroupReference=y}).catch(p.noop)),u.partnerGroupReference}),C=f.computed(()=>{const u=v();return!u.productFileTypeReference&&!u.dataLoaderList.productFileTypeReference&&(u.dataLoaderList.productFileTypeReference=!0,m.getInstance(w).getProductFileType().then(y=>{u.productFileTypeReference=y}).catch(p.noop)),u.productFileTypeReference}),R=f.computed(()=>{const u=v();return!u.resourceTypesReference&&!u.dataLoaderList.resourceTypesReference&&(u.dataLoaderList.resourceTypesReference=!0,m.getInstance(w).getResourceTypes().then(y=>{u.resourceTypesReference=y}).catch(p.noop)),u.resourceTypesReference}),A=f.computed(()=>{const u=v();return!u.salesDirectionsReference&&!u.dataLoaderList.salesDirectionsReference&&(u.dataLoaderList.salesDirectionsReference=!0,m.getInstance(w).getSalesDirections().then(y=>{u.salesDirectionsReference=y}).catch(p.noop)),u.salesDirectionsReference}),_=f.computed(()=>{const u=v();return!u.sourcePrimaryInterestReference&&!u.dataLoaderList.sourcePrimaryInterestReference&&(u.dataLoaderList.sourcePrimaryInterestReference=!0,m.getInstance(w).getSourcePrimaryInterest().then(y=>{u.sourcePrimaryInterestReference=y}).catch(p.noop)),u.sourcePrimaryInterestReference}),L=f.computed(()=>{const u=v();return!u.deliveryTypeReference&&!u.dataLoaderList.deliveryTypeReference&&(u.dataLoaderList.deliveryTypeReference=!0,m.getInstance(w).getDeliveryTypes().then(y=>{u.deliveryTypeReference=y}).catch(p.noop)),u.deliveryTypeReference}),O=f.computed(()=>{const u=v();return!u.managersList&&!u.dataLoaderList.managersList&&(u.dataLoaderList.managersList=!0,m.getInstance(Tr).getManagers().then(y=>{u.managersList=y}).catch(p.noop)),u.managersList}),k=f.computed(()=>{const u=v();return!u.warehousesReference&&!u.dataLoaderList.warehousesReference&&(u.dataLoaderList.warehousesReference=!0,m.getInstance(w).getWarehouses().then(y=>{u.warehousesReference=y}).catch(p.noop)),u.warehousesReference}),N=f.computed(()=>{const u=v();return!u.propertyTypesReference&&!u.dataLoaderList.propertyTypesReference&&(u.dataLoaderList.propertyTypesReference=!0,m.getInstance(w).getPropertyTypes().then(y=>{u.propertyTypesReference=y}).catch(p.noop)),u.propertyTypesReference}),F=f.computed(()=>{const u=v();return!u.priceCoefficientsReference&&!u.dataLoaderList.priceCoefficientsReference&&(u.dataLoaderList.priceCoefficientsReference=!0,m.getInstance(w).getPriceCoefficients().then(y=>{u.priceCoefficientsReference=y}).catch(p.noop)),u.priceCoefficientsReference});return{channelPrimaryInterestsReference:s,contactPositionsReference:r,currencyReference:e,opfReference:i,orderPaymentStatusReference:n,orderStatusReference:o,paymentTypeReference:l,partnerGroupsReference:g,productFilesTypesReference:C,resourceTypesReference:R,salesDirectionsReference:A,sourcePrimaryInterestsReference:_,deliveryTypeReference:L,managersList:O,warehousesReference:k,propertyTypesReference:N,priceCoefficientsReference:F}}),ct=me.defineStore("__user_state_private",()=>{const s=f.ref({}),r=f.ref(void 0);return{dataLoaderList:s,currentUser:r}}),lt=me.defineStore("user_state",()=>({currentUser:f.computed(()=>{const r=ct();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,m.getInstance(wr).getCurrentUser().then(e=>{r.currentUser=e}).catch(p.noop).finally(p.noop)),r.currentUser})}));class ut extends m{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 n=[...i];let o=1;return n.forEach(l=>{l.id=o++}),n})}}class pt{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=pr,c.AppBaseConfig=kr,c.AppConfigProvider=$,c.BankAccount=$e,c.BasePaginationProvider=pe,c.CalculationTypeEnum=sr,c.Cart=se,c.CartItem=er,c.CartItemBase=Ee,c.CartProvider=Nr,c.CatalogProvider=Mr,c.CatalogableItem=Ie,c.Category=U,c.CategoryPricingRule=He,c.ChannelPrimaryInterest=Ue,c.City=Gr,c.CityWithRegionAndCountry=le,c.Client=Ve,c.ClientAdditionalData=Sr,c.ClientCategory=ce,c.ClientDataProvider=xr,c.ClientPriceProvider=Hr,c.ClientPriceTemplateProvider=Br,c.ClientProduct=W,c.ClientProductCategoryDataProvider=jr,c.ClientProductDataProvider=Vr,c.ClientShortInfo=Q,c.ClientsAdditionalDataRequestTypeEnum=Rr,c.ClientsListFilters=Yr,c.ConfiguratorProvider=et,c.Contact=Se,c.ContactLinks=ur,c.ContactPerson=H,c.ContactPersonRelated=$r,c.ContactPosition=gr,c.ContactRelation=ae,c.ContragentBase=ze,c.ContragentFactory=ge,c.ContragentIc=We,c.ContragentPerson=Dr,c.ContragentUlNr=Ar,c.ContragentUlR=je,c.CostSourceEnum=ve,c.Country=j,c.Currency=ue,c.DataSuggestionProvider=ut,c.DataTablePagination=Xr,c.DataTablePaginationRequestParams=ar,c.DataTableSortRequestParams=Zr,c.DateTimeProvider=rt,c.DeletableNamedIdentity=cr,c.DeliveryAddress=he,c.DeliveryType=B,c.DeviceTypeResolutionConfig=rr,c.DiscountShortInfo=lr,c.FieldValidationResultData=pt,c.FilterGroup=x,c.FilterItem=Be,c.FilterOpEnum=Ae,c.GeoCoordinates=Le,c.HiddenCatalogableItem=Ze,c.HttpBaseCachedRequester=we,c.HttpBaseRequester=Pe,c.HttpParamsConfig=tr,c.HttpRequester=m,c.Identity=q,c.Image=xe,c.Manager=oe,c.ManagerCommon=K,c.ManagerDataFactory=tt,c.ManagerDataProvider=Tr,c.MetaTagItem=Lr,c.NamedIdentity=D,c.Opf=G,c.OpfEnum=T,c.Order=Ir,c.OrderInfo=Je,c.OrderPaymentStatus=hr,c.OrderProduct=br,c.OrderShortInfo=Fe,c.OrderStatus=mr,c.OrdersDataProvider=it,c.PartnerGroup=M,c.PaymentType=fr,c.PreferencesStorageProvider=qr,c.PriceAnalyze=Te,c.PriceAnalyzeProvider=nt,c.PriceCoefficient=ie,c.PriceCoefficientEnum=_e,c.PriceTemplate=z,c.PriceTemplateCategory=Re,c.PriceTemplateClient=Y,c.PriceTemplateICatalogableItem=ke,c.PriceTemplateProduct=De,c.PriceTemplateProvider=Fr,c.PricingRole=Z,c.PricingRoleProvider=Kr,c.PrimaryCatalogableItem=fe,c.Product=S,c.ProductCategoryDataProvider=zr,c.ProductDataProvider=Wr,c.ProductFileType=yr,c.ProductPriceCoefficient=ye,c.ProductPriceHistory=vr,c.PropertiesProvider=Jr,c.Property=X,c.PropertyType=qe,c.PropertyTypeEnum=or,c.PropertyValue=V,c.RecommendationsDataProvider=Qr,c.RecommendationsList=Me,c.Reference=P,c.ReferenceDataProvider=w,c.Region=J,c.ResourceType=de,c.SalesDirection=a,c.SentryConfig=ir,c.Seo=Ye,c.SeoDataProvider=st,c.SourcePrimaryInterest=Ge,c.StockCount=Xe,c.TemplatesListFilters=dr,c.TypedInstanceFactory=Ce,c.UnitsHelper=Ke,c.UnknownClientDataProvider=Er,c.UpdatableNamedIdentity=Oe,c.User=Pr,c.UserCommonInfo=Ne,c.UserDataProvider=wr,c.UserShortInfo=d,c.UserTypeEnum=Cr,c.VersionConfig=nr,c.Warehouse=ne,c.useReferencesStore=ot,c.useUserStateStore=lt,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=sc-common-lib.umd.cjs.map