@snabcentr/common-lib 1.49.2 → 1.50.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 (30) hide show
  1. package/dist/manifest.json +1 -1
  2. package/dist/release_notes.tmp +3 -3
  3. package/dist/sc-common-lib.js +375 -373
  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/discount-short-info.d.ts.map +1 -1
  8. package/dist/src/catalog/providers/properties-provider.d.ts +1 -0
  9. package/dist/src/catalog/providers/properties-provider.d.ts.map +1 -1
  10. package/dist/src/clients/classes/clients-list-filters.d.ts +4 -0
  11. package/dist/src/clients/classes/clients-list-filters.d.ts.map +1 -1
  12. package/dist/src/clients/interfaces/i-clients-list-filters.d.ts +4 -0
  13. package/dist/src/clients/interfaces/i-clients-list-filters.d.ts.map +1 -1
  14. package/dist/src/clients/providers/client-data-provider.d.ts +3 -1
  15. package/dist/src/clients/providers/client-data-provider.d.ts.map +1 -1
  16. package/dist/src/data-table/classes/data-table-pagination-request-params.d.ts +0 -6
  17. package/dist/src/data-table/classes/data-table-pagination-request-params.d.ts.map +1 -1
  18. package/dist/src/data-table/interfaces/i-pagination-request-params.d.ts +0 -6
  19. package/dist/src/data-table/interfaces/i-pagination-request-params.d.ts.map +1 -1
  20. package/dist/src/http/classes/http-base-cached-requester.d.ts +1 -3
  21. package/dist/src/http/classes/http-base-cached-requester.d.ts.map +1 -1
  22. package/dist/src/orders/providers/orders-data-provider.d.ts +1 -0
  23. package/dist/src/orders/providers/orders-data-provider.d.ts.map +1 -1
  24. package/dist/src/pagination/providers/base-pagination-provider.d.ts +5 -1
  25. package/dist/src/pagination/providers/base-pagination-provider.d.ts.map +1 -1
  26. package/dist/src/system/classes/deletable-named-identity.d.ts.map +1 -1
  27. package/dist/src/system/classes/updatable-named-identity.d.ts.map +1 -1
  28. package/dist/src/system/providers/typed-instance-factory.d.ts +2 -6
  29. package/dist/src/system/providers/typed-instance-factory.d.ts.map +1 -1
  30. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- (function(o,g){typeof exports=="object"&&typeof module<"u"?g(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"],g):(o=typeof globalThis<"u"?globalThis:o||self,g(o["SC Common Lib"]={},o["lodash-es"],o["date-fns"],o.axios,o["ts-case-convert"],o.pinia,o.vue))})(this,function(o,g,h,Ir,Te,he,f){"use strict";var ct=Object.defineProperty;var lt=(o,g,h)=>g in o?ct(o,g,{enumerable:!0,configurable:!0,writable:!0,value:h}):o[g]=h;var t=(o,g,h)=>lt(o,typeof g!="symbol"?g+"":g,h);class N{constructor(r){t(this,"id");t(this,"guid");this.id=(r==null?void 0:r.id)??-1,this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return this.id===-1}}class D extends N{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class be 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 me extends be{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class ee extends me{constructor(e){super(e);t(this,"isHidden");t(this,"parentCategoryId");t(this,"properties");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"}}var Ie=(s=>(s.K0="k0",s.K1="k1",s.K2="k2",s.K3="k3",s.K4="k4",s.Retail="retail",s))(Ie||{});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 re extends P{static getRetailPriceCoefficient(){return{id:-2,slug:Ie.Retail,name:"Розничная цена",guid:"",isNewRec:g.constant(!0)}}}class fe{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new re(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class _e{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 H extends P{}class te 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 H(n)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new _e(e==null?void 0:e.coordinates)}}class Qe{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new te(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const Z=class Z{static init(r){Z.config=r}static getConfig(){if(g.isUndefined(Z.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return Z.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(Z,"config");let A=Z;class Ye extends be{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 $ extends Ye{constructor(e){var n,c,u,p;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");t(this,"quantityUnit");t(this,"currency");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=g.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 Qe(C)))??[],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 me({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(C=>new me(C))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(C=>new Xe(C,A.getConfig().http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.priceCoefficients=((p=e==null?void 0:e.priceCoefficients)==null?void 0:p.map(C=>new fe(C)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){const e=A.getConfig().products.units;return[...e.linear,...e.square].includes(this.unit)}}class Ze extends N{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"height");t(this,"length");t(this,"width");t(this,"barcode");t(this,"marker");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");this.product=new $(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new ee,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&g.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class xe extends Ze{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 ie{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new xe(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Ee{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 er{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 rr{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 tr{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=g.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 _r{constructor(r){t(this,"environment");t(this,"currentDomain");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"products");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.currentDomain=(r==null?void 0:r.currentDomain)??"",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new er(r==null?void 0:r.http),this.deviceTypeByResolution=new Ee(r==null?void 0:r.deviceTypeByResolution),this.products={units:{linear:["пог.м.","м."],square:["м2"]},...r==null?void 0:r.products},this.sentry=new rr({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new tr(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 ye{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const L=class L{constructor(r,e){t(this,"httpClient");t(this,"defaultInstanceNotificationErrorResponseHandler",g.noop);const i=A.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=L.baseDefaultNotificationErrorResponseHandler,this.httpClient=Ir.create({baseURL:r,headers:{"APP-VERSION":`${i.name} (${i.version}, ${h.format(i.date,A.getConfig().dateFormats.api)})`,Accept:"application/json","Content-Type":"application/json",...e}}),this.httpClient.interceptors.request.use(n=>(n.method&&(n.method==="get"&&n.params&&(n.params=Te.objectToSnake(n.params)),["put","patch","post"].includes(g.toLower(n.method))&&n.data&&(n.data=Te.objectToSnake(n.data))),n),n=>Promise.reject(n)),this.httpClient.interceptors.response.use(n=>(n.data&&(n.data=Te.objectToCamel(n.data)),n),n=>L.convertHttpErrorResponse(n))}static setBaseDefaultNotificationErrorResponseHandler(r){L.baseDefaultNotificationErrorResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(L.instances,r.name)||(L.instances[r.name]=ye.simpleInstanceInitializer(r)),L.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(L,"instances",{}),t(L,"baseDefaultNotificationErrorResponseHandler",g.noop);let Ce=L;const x=class x extends Ce{constructor(e,i){super(e,i);t(this,"responseDataCacheTimeout");const n=A.getConfig();this.responseDataCacheTimeout=n.http.responseDataCacheTimeout}static getCachedResponse(e){const i=x.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){x.responseDataCache.set(e,{validTo:h.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,n=!1){const c=n?x.getCachedResponse(i):void 0;return c?Promise.resolve(c):this.get(i).then(u=>{const p=u.map(C=>ye.instanceInitializer(e,C));return n&&p&&this.cacheResponse(i,p),p})}};t(x,"responseDataCache",new Map);let Pe=x;class m extends Pe{constructor(){var i,n;const r=A.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 Lr extends m{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new ie(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 ie(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 ie(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 ie(e.data))}}var ir=(s=>(s.m2Cost="m2Cost",s.percent="percent",s.value="value",s))(ir||{}),we=(s=>(s.Discount="discount",s.PriceTemplate="price_template",s.ClientPrice="client_price",s.Product="product",s))(we||{}),nr=(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))(nr||{});class d extends ee{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 d(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new $(c))}}class Le extends D{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=e!=null&&e.updatedAt?g.isString(e.updatedAt)?h.parseISO(e.updatedAt):e.updatedAt:void 0}}class sr extends Le{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=e!=null&&e.deletedAt?g.isString(e.deletedAt)?h.parseISO(e.deletedAt):e.deletedAt:void 0}}class kr{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 q extends D{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class or 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=e!=null&&e.publishedAt?g.isString(e.publishedAt)?h.parseISO(e.publishedAt):e.publishedAt:void 0,this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new q(e==null?void 0:e.owner),this.deletedAt=e!=null&&e.deletedAt?g.isString(e.deletedAt)?h.parseISO(e.deletedAt):e.deletedAt:void 0}}class B extends Le{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}class z extends ${constructor(e){super(e);t(this,"costCoefficient");t(this,"costSource");t(this,"discount");t(this,"priceTemplate");t(this,"isPreviouslyOrdered");t(this,"isRequired");t(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??we.Product,this.discount=e!=null&&e.discount?new or(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new B(e.priceTemplate):void 0,this.isPreviouslyOrdered=e==null?void 0:e.isPreviouslyOrdered,this.isRequired=e==null?void 0:e.isRequired,this.isFavorite=e==null?void 0:e.isFavorite}}class cr{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class I extends P{}class ne extends D{constructor(e){super(e);t(this,"salesDirection",new I);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new I(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new cr(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class se extends ne{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 Or extends ee{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 se(e.manager):void 0}}class oe extends Or{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 oe(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new z(c))}}class ke{constructor(r){t(this,"coefficient");t(this,"increasePercent");this.coefficient=(r==null?void 0:r.coefficient)&&new re(r.coefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class ve extends ke{constructor(e){super(e);t(this,"productCategory");this.productCategory=new ee(e==null?void 0:e.productCategory)}}class W extends P{}class F extends P{constructor(e){super(e);t(this,"country",new W);e&&(this.country=new W(e.country))}}class ce extends P{constructor(e){super(e);t(this,"region",new F);e&&(this.region=new F(e.region))}}class Oe 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 I(e.salesDirection):void 0,this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=g.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 K extends Oe{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 I(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 ce(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 ne(n)))??[]}}class J extends N{constructor(e){super(e);t(this,"startAt");t(this,"endAt");t(this,"client");t(this,"priceTemplate");this.startAt=g.isString(e==null?void 0:e.startAt)?h.parseISO(e.startAt):(e==null?void 0:e.startAt)??new Date,this.endAt=g.isString(e==null?void 0:e.endAt)?h.parseISO(e.endAt):(e==null?void 0:e.endAt)??new Date,this.client=new K(e==null?void 0:e.client),this.priceTemplate=new B(e==null?void 0:e.priceTemplate)}}class ae extends ke{constructor(e){super(e);t(this,"product");this.product=new $(e==null?void 0:e.product)}}class Ne extends P{}class Q extends D{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new Ne(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class j{constructor(r){t(this,"property");t(this,"value");this.property=new Q(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class lr extends P{}class de extends P{}class Nr extends P{}class ur extends P{}class le extends D{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var S=(s=>(s.Person="individual",s.Ic="entrepreneur",s.UlR="legal",s.UlNr="non_resident_legal",s))(S||{});class U extends P{static generatePersonItem(){return new U({id:1,guid:"",slug:S.Person,name:""})}}class pr extends P{}class gr extends P{}class G extends P{}class hr extends P{}class mr extends P{}class qe extends P{}class Ue extends P{}class v extends m{getReference(r,e=!1){return this.getTypedDataArrayRequester(lr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(de,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(ur,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(le,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(G,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(U,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(pr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(gr,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(hr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(qe,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(I,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Ue,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(ce,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(F,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(W,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(H,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(te,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Ne,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(re,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(mr,"/public/references/product-file-type",!0)}}var fr=(s=>(s.Admin="admin",s.Manager="manager",s.Operator="operator",s.Client="client",s.Guest="guest",s))(fr||{});class yr extends Oe{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 Cr extends m{getCurrentUser(){return this.get("/internal/users/info",{},r=>new yr(r.data))}}class Pr{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=g.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 q(r.client):void 0,this.executor=r.executor?new q(r.executor):void 0,this.currency=r.currency?new le(r.currency):void 0}}class Ge{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new $(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new d(e)))}}class Y 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 Me{constructor(r){t(this,"role");t(this,"category");t(this,"minCoefficient");this.role=new Y(r==null?void 0:r.role),this.category=new ee(r==null?void 0:r.category),this.minCoefficient=new re(r==null?void 0:r.minCoefficient)}}var wr=(s=>(s.LastOrder="last_order",s.Contacts="contacts",s.PartnerGroups="partner_groups",s.PreferredDeliveryType="preferred_delivery_type",s))(wr||{});class Re extends N{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new le);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new le(e.currency))}}class De 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 M extends De{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=g.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class He extends D{constructor(e){super(e);t(this,"manager",new ne);t(this,"opf",U.generatePersonItem());t(this,"salesDirection",new I);t(this,"partnerGroup",new G);t(this,"contacts",[]);t(this,"bankAccounts",[]);t(this,"comment");t(this,"alternativeName");t(this,"createdAt");t(this,"creator");t(this,"updatedAt");t(this,"updater");if(e){if(this.opf=new U(e.opf),this.salesDirection=new I(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new q(e.creator):void 0,this.updatedAt=g.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new q(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new G(e.partnerGroup)),e.manager&&(this.manager=new ne(e.manager)),e.contacts){const i=[];e.contacts.forEach(n=>{i.push(new M(n))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(n=>{i.push(new Re(n))}),this.bankAccounts=i}}}}class vr extends He{constructor(r){super(r)}}class Be extends He{constructor(e){super(e);t(this,"inn","");t(this,"okpo","");t(this,"directorName","");t(this,"directorPosition","");t(this,"directorActsOn","");t(this,"legalAddress","");t(this,"postalAddress","");t(this,"actualAddress","");e&&(this.inn=e.inn??"",this.okpo=e.okpo??"",this.directorName=e.directorName??"",this.directorPosition=e.directorPosition??"",this.directorActsOn=e.directorActsOn??"",this.legalAddress=e.legalAddress??"",this.postalAddress=e.postalAddress??"",this.actualAddress=e.actualAddress??"")}}class ze extends Be{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class ar extends ze{constructor(e){super(e);t(this,"registrationCountry",new W);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new W(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class ue{static createInstance(r){switch(r.opf.slug){case S.Ic:return new Be(r);case S.UlR:return new ze(r);case S.UlNr:return new ar(r);default:return new vr(r)}}}class Ae extends N{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class Rr extends M{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 pe extends sr{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 _e(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(n=>new M(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 We extends K{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(p=>ue.createInstance(p)))??[],this.partnerGroups=((n=e==null?void 0:e.partnerGroups)==null?void 0:n.map(p=>new G(p)))??[],this.contacts=((c=e==null?void 0:e.contacts)==null?void 0:c.map(p=>new M(p)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(p=>new pe(p)))??[],this.channelPrimaryInterest=new de(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Ue(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new H(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new te(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class dr{constructor(r){t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"city");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",{from:null,to:null});t(this,"lastLoginDate",{from:null,to:null});t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"salesDirection");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"hasCostLessThenStop");t(this,"partnerGroup");t(this,"contact");t(this,"lastOrder");var e,i,n,c,u,p,C,w,R,T,b;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.city=new ce(r==null?void 0:r.city),this.region=new F(r==null?void 0:r.region),this.country=new W(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={from:g.isString((e=r==null?void 0:r.createdAt)==null?void 0:e.from)?h.parseISO((i=r==null?void 0:r.createdAt)==null?void 0:i.from):null,to:g.isString((n=r==null?void 0:r.createdAt)==null?void 0:n.to)?h.parseISO((c=r==null?void 0:r.createdAt)==null?void 0:c.to):null},this.lastLoginDate={from:g.isString((u=r==null?void 0:r.lastLoginDate)==null?void 0:u.from)?h.parseISO((p=r==null?void 0:r.lastLoginDate)==null?void 0:p.from):null,to:g.isString((C=r==null?void 0:r.lastLoginDate)==null?void 0:C.to)?h.parseISO((w=r==null?void 0:r.lastLoginDate)==null?void 0:w.to):null},this.lastLoginDateHasOrder=(r==null?void 0:r.lastLoginDateHasOrder)??void 0,this.managers=r!=null&&r.managers&&r.managers.length>0?r.managers.map(_=>new se(_)):[],this.salesDirection=new I(r==null?void 0:r.salesDirection),this.contragentInn=(r==null?void 0:r.contragentInn)??"",this.contragentType=new U(r==null?void 0:r.contragentType),this.preferredDeliveryType=new H(r==null?void 0:r.preferredDeliveryType),this.hasCostLessThenStop=r!=null&&r.hasCostLessThenStop?!0:void 0,this.partnerGroup=new G(r==null?void 0:r.partnerGroup),this.contact=new De(r==null?void 0:r.contact),this.lastOrder={createdAt:(R=r==null?void 0:r.lastOrder)==null?void 0:R.createdAt,creator:(T=r==null?void 0:r.lastOrder)==null?void 0:T.creator,isApproved:(b=r==null?void 0:r.lastOrder)==null?void 0:b.isApproved}}resetFilterValue(r){switch(r){case"id":case"phone":case"email":case"name":case"alternativeName":case"contragentInn":this[r]="";break;case"city":this.city=new ce;break;case"region":this.region=new F;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirection":this.salesDirection=new I;break;case"contragentType":this.contragentType=new U;break;case"preferredDeliveryType":this.preferredDeliveryType=new H;break;case"partnerGroup":this.partnerGroup=new G;break;case"hasCostLessThenStop":this.hasCostLessThenStop=void 0;break;case"contact":this.contact=new De;break}return this}asClearRaw(){var e,i,n,c;const r={};return Object.keys(this).forEach(u=>{const p=this[u];g.isNil(p)||g.isString(p)&&p.trim().length===0||g.isFunction(p.isNewRec)&&p.isNewRec()||(r[u]=p)}),!((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 je extends N{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new q(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Ve extends je{constructor(e){var i,n,c,u,p,C,w,R;super(e);t(this,"client");t(this,"payment");t(this,"delivery");t(this,"attachedUser");t(this,"status");t(this,"salesDirection");t(this,"pendingAt");t(this,"processedAt");t(this,"isOnOrder");t(this,"isNotInStock");this.client=new K(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:g.isString((p=e==null?void 0:e.delivery)==null?void 0:p.date)?h.parseISO(e.delivery.date):((C=e==null?void 0:e.delivery)==null?void 0:C.date)??new Date,address:(w=e==null?void 0:e.delivery)!=null&&w.address?new pe(e.delivery.address):void 0,warehouse:(R=e==null?void 0:e.delivery)!=null&&R.warehouse?new te(e.delivery.warehouse):void 0},this.attachedUser=new q(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new I(e==null?void 0:e.salesDirection),this.pendingAt=g.isString(e==null?void 0:e.pendingAt)?h.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=g.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 Dr extends N{constructor(e){super(e);t(this,"product");t(this,"quantity");t(this,"currency");t(this,"costOne");t(this,"costOneRub");t(this,"cost");t(this,"costRub");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"configurator");t(this,"configuratorParams");t(this,"sawing");this.product=new z(e.product),this.quantity=e.quantity,this.currency=e.currency,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.cost=e.cost,this.costRub=e.costRub,this.marker=e.marker,this.height=e.height,this.length=e.length,this.width=e.width,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams,this.sawing=e.sawing}}class Ar extends Ve{constructor(e){super(e);t(this,"products");t(this,"invoices");t(this,"comment");t(this,"image");t(this,"contragent");t(this,"barcode");t(this,"orderSource");t(this,"isAllowProcessingWithoutPayment");this.products=(e.products??[]).map(i=>new Dr(i)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?ue.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}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 Fe{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=g.isDate(this.value)?h.format(this.value,A.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 Fe(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 Fe&&g.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof X?r.toPrimitive():r)}}}class ge extends m{getPaginated(r,e,i,n,c,u){const p={page:(n==null?void 0:n.page)??1,per_page:(n==null?void 0:n.pageSize)??(n==null?void 0:n.perPage)??10};return e&&(p.filters=JSON.stringify((e instanceof X?e:new X(e)).toPrimitive())),g.isEmpty(i)||(g.isArray(i)?i:[i]).forEach((C,w)=>{p[`sort[${w}][field]`]=C.field,p[`sort[${w}][direction]`]=C.direction}),this.get(r,p,c,u)}}class qr extends ge{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 Ve(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 Ar(e.data))}}class $r extends D{constructor(e){var i,n;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");(i=e.contacts)!=null&&i.length&&(this.contacts=e.contacts.map(c=>new M(c))),e.lastOrder&&(this.lastOrder=new je(e.lastOrder)),(n=e.partnerGroups)!=null&&n.length&&(this.partnerGroups=e.partnerGroups.map(c=>new G(c))),e.preferredDeliveryType&&(this.preferredDeliveryType=new H(e.preferredDeliveryType))}}class Sr{constructor(r){t(this,"page",1);t(this,"pageSize",50);t(this,"perPage",50);this.page=(r==null?void 0:r.page)??1,this.perPage=(r==null?void 0:r.perPage)??50,this.pageSize=(r==null?void 0:r.pageSize)??this.perPage}}class Ur 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 Gr{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 Mr extends ge{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new We(e.data))}getClientsList(r,e,i){return this.getPaginated("/internal/clients",r,e,i,n=>{const c={...n.data};return c.data=c.data.map(u=>new K(u)),c})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:$e.Contains,value:r}]})}getAdditionalClientsData(r,e){return this.post("/internal/clients/additional-data",{clients:r,requested_data_types:e},i=>{let n=[];return(i==null?void 0:i.data.length)>0&&(n=i.data.map(c=>new $r(c))),n})}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 Rr(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 We(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,w,R,T,b,_,k,O;let n;const c=e,u=e,p=e;switch(e.opf.slug){case S.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:(w=c.manager)==null?void 0:w.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 S.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(R=u.partnerGroup)==null?void 0:R.id,manager_id:(T=u.manager)==null?void 0:T.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 S.UlNr:n={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(b=p.partnerGroup)==null?void 0:b.id,manager_id:(_=p.manager)==null?void 0:_.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};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:(O=e.manager)==null?void 0:O.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,n,V=>ue.createInstance(V.data),i)}updateContragentClientData(r,e,i={}){var C,w,R,T,b,_,k,O;let n;const c=e,u=e,p=e;switch(e.opf.slug){case S.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:(w=c.manager)==null?void 0:w.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 S.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(R=u.partnerGroup)==null?void 0:R.id,manager_id:(T=u.manager)==null?void 0:T.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 S.UlNr:n={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(b=p.partnerGroup)==null?void 0:b.id,manager_id:(_=p.manager)==null?void 0:_.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};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:(O=e.manager)==null?void 0:O.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,n,V=>ue.createInstance(V.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,p=>new pe(p.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,p=>new pe(p.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 Re(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 Re(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 M(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,p;const c={name:e.name,position:e.position,comment:e.comment,...i};return(u=e.phone)!=null&&u.length&&(c.phone=e.phone),(p=e.email)!=null&&p.length&&(c.email=e.email),this.post(`/internal/clients/${r}/contacts`,c,C=>new M(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 Hr 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 Se{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new K(r==null?void 0:r.client),this.product=new $(r==null?void 0:r.product),this.cost=(r==null?void 0:r.cost)??0,this.costCoefficient=(r==null?void 0:r.costCoefficient)??0,this.source=(r==null?void 0:r.source)??we.Product}}class Br 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=`${A.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 zr 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 z(c.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,i=>new z(i.data))}markProductRequired(r,e){return this.post(`/internal/clients/${r}/price/products/${e}/required`)}unmarkProductRequired(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}/required`)}getCommercialOfferHtml(r,e){return this.get(`/internal/clients/${r}/price/commercial-offer/view`,e,i=>new Blob([i.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,i=>new Blob([i.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class Wr extends m{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new J(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new J(e.data))}attachTemplate(r,e,i){const n=A.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 J(c.data))}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`)}changeTemplate(r,e,i,n){const c=A.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 J(u.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class jr extends m{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(i=>new d(i)))}getCategoryData(r,e=!1,i=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:i},n=>new d(n.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new d(e.data))}getCategoryProductsList(r,e=!0,i=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:i,withPriceCoefficients:e},n=>g.map(n.data,c=>new $(c)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return g.forEach(i,n=>n.map(c=>new fe(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 d(u)))}).catch(c=>{n(c)})})}}class Vr extends m{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new $(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new $(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>g.map(e.data,i=>new fe(i)))}getProductPriceHistory(r,e){const i={};return g.isNil(e)||(i.clientId=e),this.get(`/internal/price/products/${r}/history`,i,n=>g.map(n.data,c=>new Pr(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 $(u)))}).catch(c=>{n(c)})})}}class Fr extends m{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(n=>new oe(n)))}getCategoryData(r,e,i=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:n},c=>new oe(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=>g.map(c.data,u=>new z(u)))}}class Kr extends m{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},n=>new z(n.data))}}class Jr extends ge{getTemplateList(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 B(u)),c})}createTemplate(r){return this.post("/internal/price/templates",r,e=>new B(e.data))}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new B(e.data))}updateTemplate(r,e){return this.patch(`/internal/price/templates/${r}`,e,i=>new B(i.data))}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 ae(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new ae(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 ae(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 ve(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new ve(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 ve(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 J(i)))}}class Qr extends m{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new Y(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new Y(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new Y(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new Y(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 Me(i)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,i=>i.data.map(n=>new Me(n)))}}class Yr extends ge{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 Q(u)),c})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},n=>new Q(n.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new Q(e.data))}updateProperty(r,e){const{typeId:i,...n}=e;return this.patch(`/internal/catalog/properties/${r}`,{...n,type:i},c=>new Q(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 j(i)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},i=>new j(i.data))}updateProductProperty(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:i},n=>new j(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 j(i)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},i=>new j(i.data))}updateCategoryProperty(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:i},n=>new j(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 Xr extends m{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Ge(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Ge(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)})}}class Zr extends m{analyzeProductPrices(r,e){return this.get(`/internal/price/products/${r}/analyze`,{...e},i=>i.data.map(n=>new Se(n)))}analyzeCategoryPrices(r,e){return this.get(`/internal/price/categories/${r}/analyze`,{...e},i=>i.data.map(n=>new Se(n)))}analyzeCategoryPricesBySquare(r,e){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e},i=>i.data.map(n=>new Se(n)))}}class xr 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 $(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 Er{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 E=class E{static setLinearValues(r){E.linearValues=r}static productIsMeasurable(r){return E.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!E.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(E,"linearValues",["пог.м.","м.","м2"]);let Ke=E;class et{static generateUndefinedManagerInstance(){return new se({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=>ye.instanceInitializer(se,c));return n&&this.cacheResponse(r,n),n})}}class br{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class Je{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 qe(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(i=>new br(i)))??[]}}class rt extends m{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new Je(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new Je(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const a=he.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),p=f.ref(void 0),C=f.ref(void 0),w=f.ref(void 0),R=f.ref(void 0),T=f.ref(void 0),b=f.ref(void 0),_=f.ref(void 0),k=f.ref(void 0),O=f.ref(void 0),V=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:p,orderStatusReference:C,paymentTypeReference:w,partnerGroupReference:R,productFileTypeReference:T,resourceTypesReference:b,salesDirectionsReference:_,sourcePrimaryInterestReference:k,warehousesReference:O,propertyTypesReference:V,priceCoefficientsReference:l}}),tt=he.defineStore("references",()=>{const s=f.computed(()=>{const l=a();return!l.channelPrimaryInterestReference&&!l.dataLoaderList.channelPrimaryInterestReference&&(l.dataLoaderList.channelPrimaryInterestReference=!0,m.getInstance(v).getChannelPrimaryInterest().then(y=>{l.channelPrimaryInterestReference=y}).catch(g.noop)),l.channelPrimaryInterestReference}),r=f.computed(()=>{const l=a();return!l.contactPositionsReference&&!l.dataLoaderList.contactPositionsReference&&(l.dataLoaderList.contactPositionsReference=!0,m.getInstance(v).getContactPositions().then(y=>{l.contactPositionsReference=y}).catch(g.noop)),l.contactPositionsReference}),e=f.computed(()=>{const l=a();return!l.currencyReference&&!l.dataLoaderList.currencyReference&&(l.dataLoaderList.currencyReference=!0,m.getInstance(v).getCurrency().then(y=>{l.currencyReference=y}).catch(g.noop)),l.currencyReference}),i=f.computed(()=>{const l=a();return!l.opfReference&&!l.dataLoaderList.opfReference&&(l.dataLoaderList.opfReference=!0,m.getInstance(v).getOpf().then(y=>{l.opfReference=y}).catch(g.noop)),l.opfReference}),n=f.computed(()=>{const l=a();return!l.orderPaymentStatusReference&&!l.dataLoaderList.orderPaymentStatusReference&&(l.dataLoaderList.orderPaymentStatusReference=!0,m.getInstance(v).getOrderPaymentStatuses().then(y=>{l.orderPaymentStatusReference=y}).catch(g.noop)),l.orderPaymentStatusReference}),c=f.computed(()=>{const l=a();return!l.orderStatusReference&&!l.dataLoaderList.orderStatusReference&&(l.dataLoaderList.orderStatusReference=!0,m.getInstance(v).getOrderStatuses().then(y=>{l.orderStatusReference=y}).catch(g.noop)),l.orderStatusReference}),u=f.computed(()=>{const l=a();return!l.paymentTypeReference&&!l.dataLoaderList.paymentTypeReference&&(l.dataLoaderList.paymentTypeReference=!0,m.getInstance(v).getPaymentTypes().then(y=>{l.paymentTypeReference=y}).catch(g.noop)),l.paymentTypeReference}),p=f.computed(()=>{const l=a();return!l.partnerGroupReference&&!l.dataLoaderList.partnerGroupReference&&(l.dataLoaderList.partnerGroupReference=!0,m.getInstance(v).getPartnerGroup().then(y=>{l.partnerGroupReference=y}).catch(g.noop)),l.partnerGroupReference}),C=f.computed(()=>{const l=a();return!l.productFileTypeReference&&!l.dataLoaderList.productFileTypeReference&&(l.dataLoaderList.productFileTypeReference=!0,m.getInstance(v).getProductFileType().then(y=>{l.productFileTypeReference=y}).catch(g.noop)),l.productFileTypeReference}),w=f.computed(()=>{const l=a();return!l.resourceTypesReference&&!l.dataLoaderList.resourceTypesReference&&(l.dataLoaderList.resourceTypesReference=!0,m.getInstance(v).getResourceTypes().then(y=>{l.resourceTypesReference=y}).catch(g.noop)),l.resourceTypesReference}),R=f.computed(()=>{const l=a();return!l.salesDirectionsReference&&!l.dataLoaderList.salesDirectionsReference&&(l.dataLoaderList.salesDirectionsReference=!0,m.getInstance(v).getSalesDirections().then(y=>{l.salesDirectionsReference=y}).catch(g.noop)),l.salesDirectionsReference}),T=f.computed(()=>{const l=a();return!l.sourcePrimaryInterestReference&&!l.dataLoaderList.sourcePrimaryInterestReference&&(l.dataLoaderList.sourcePrimaryInterestReference=!0,m.getInstance(v).getSourcePrimaryInterest().then(y=>{l.sourcePrimaryInterestReference=y}).catch(g.noop)),l.sourcePrimaryInterestReference}),b=f.computed(()=>{const l=a();return!l.deliveryTypeReference&&!l.dataLoaderList.deliveryTypeReference&&(l.dataLoaderList.deliveryTypeReference=!0,m.getInstance(v).getDeliveryTypes().then(y=>{l.deliveryTypeReference=y}).catch(g.noop)),l.deliveryTypeReference}),_=f.computed(()=>{const l=a();return!l.managersList&&!l.dataLoaderList.managersList&&(l.dataLoaderList.managersList=!0,m.getInstance(Tr).getManagers().then(y=>{l.managersList=y}).catch(g.noop)),l.managersList}),k=f.computed(()=>{const l=a();return!l.warehousesReference&&!l.dataLoaderList.warehousesReference&&(l.dataLoaderList.warehousesReference=!0,m.getInstance(v).getWarehouses().then(y=>{l.warehousesReference=y}).catch(g.noop)),l.warehousesReference}),O=f.computed(()=>{const l=a();return!l.propertyTypesReference&&!l.dataLoaderList.propertyTypesReference&&(l.dataLoaderList.propertyTypesReference=!0,m.getInstance(v).getPropertyTypes().then(y=>{l.propertyTypesReference=y}).catch(g.noop)),l.propertyTypesReference}),V=f.computed(()=>{const l=a();return!l.priceCoefficientsReference&&!l.dataLoaderList.priceCoefficientsReference&&(l.dataLoaderList.priceCoefficientsReference=!0,m.getInstance(v).getPriceCoefficients().then(y=>{l.priceCoefficientsReference=y}).catch(g.noop)),l.priceCoefficientsReference});return{channelPrimaryInterestsReference:s,contactPositionsReference:r,currencyReference:e,opfReference:i,orderPaymentStatusReference:n,orderStatusReference:c,paymentTypeReference:u,partnerGroupsReference:p,productFilesTypesReference:C,resourceTypesReference:w,salesDirectionsReference:R,sourcePrimaryInterestsReference:T,deliveryTypeReference:b,managersList:_,warehousesReference:k,propertyTypesReference:O,priceCoefficientsReference:V}}),it=he.defineStore("__user_state_private",()=>{const s=f.ref({}),r=f.ref(void 0);return{dataLoaderList:s,currentUser:r}}),nt=he.defineStore("user_state",()=>({currentUser:f.computed(()=>{const r=it();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,m.getInstance(Cr).getCurrentUser().then(e=>{r.currentUser=e}).catch(g.noop).finally(g.noop)),r.currentUser})}));class st 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 ot{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}o.AnyReference=lr,o.AppBaseConfig=_r,o.AppConfigProvider=A,o.BankAccount=Re,o.BasePaginationProvider=ge,o.CalculationTypeEnum=ir,o.Cart=ie,o.CartItem=xe,o.CartItemBase=Ze,o.CartProvider=Lr,o.CatalogProvider=Br,o.CatalogableItem=be,o.Category=d,o.CategoryPricingRule=Me,o.ChannelPrimaryInterest=de,o.City=Nr,o.CityWithRegionAndCountry=ce,o.Client=We,o.ClientAdditionalData=$r,o.ClientCategory=oe,o.ClientDataProvider=Mr,o.ClientPriceProvider=zr,o.ClientPriceTemplateProvider=Wr,o.ClientProduct=z,o.ClientProductCategoryDataProvider=Fr,o.ClientProductDataProvider=Kr,o.ClientShortInfo=K,o.ClientsAdditionalDataRequestTypeEnum=wr,o.ClientsListFilters=dr,o.ConfiguratorProvider=xr,o.Contact=De,o.ContactLinks=cr,o.ContactPerson=M,o.ContactPersonRelated=Rr,o.ContactPosition=ur,o.ContactRelation=Ae,o.ContragentBase=He,o.ContragentFactory=ue,o.ContragentIc=Be,o.ContragentPerson=vr,o.ContragentUlNr=ar,o.ContragentUlR=ze,o.CostSourceEnum=we,o.Country=W,o.Currency=le,o.DataSuggestionProvider=st,o.DataTablePagination=Ur,o.DataTablePaginationRequestParams=Sr,o.DataTableSortRequestParams=Gr,o.DateTimeProvider=Er,o.DeletableNamedIdentity=sr,o.DeliveryAddress=pe,o.DeliveryType=H,o.DeviceTypeResolutionConfig=Ee,o.DiscountShortInfo=or,o.FieldValidationResultData=ot,o.FilterGroup=X,o.FilterItem=Fe,o.FilterOpEnum=$e,o.GeoCoordinates=_e,o.HiddenCatalogableItem=Ye,o.HttpBaseCachedRequester=Pe,o.HttpBaseRequester=Ce,o.HttpParamsConfig=er,o.HttpRequester=m,o.Identity=N,o.Image=Xe,o.Manager=se,o.ManagerCommon=ne,o.ManagerDataFactory=et,o.ManagerDataProvider=Tr,o.MetaTagItem=br,o.NamedIdentity=D,o.Opf=U,o.OpfEnum=S,o.Order=Ar,o.OrderInfo=Ve,o.OrderPaymentStatus=pr,o.OrderProduct=Dr,o.OrderShortInfo=je,o.OrderStatus=gr,o.OrdersDataProvider=qr,o.PartnerGroup=G,o.PaymentType=hr,o.PreferencesStorageProvider=kr,o.PriceAnalyze=Se,o.PriceAnalyzeProvider=Zr,o.PriceCoefficient=re,o.PriceCoefficientEnum=Ie,o.PriceTemplate=B,o.PriceTemplateCategory=ve,o.PriceTemplateClient=J,o.PriceTemplateICatalogableItem=ke,o.PriceTemplateProduct=ae,o.PriceTemplateProvider=Jr,o.PricingRole=Y,o.PricingRoleProvider=Qr,o.PrimaryCatalogableItem=me,o.Product=$,o.ProductCategoryDataProvider=jr,o.ProductDataProvider=Vr,o.ProductFileType=mr,o.ProductPriceCoefficient=fe,o.ProductPriceHistory=Pr,o.PropertiesProvider=Yr,o.Property=Q,o.PropertyType=Ne,o.PropertyTypeEnum=nr,o.PropertyValue=j,o.RecommendationsDataProvider=Xr,o.RecommendationsList=Ge,o.Reference=P,o.ReferenceDataProvider=v,o.Region=F,o.ResourceType=qe,o.SalesDirection=I,o.SentryConfig=rr,o.Seo=Je,o.SeoDataProvider=rt,o.SourcePrimaryInterest=Ue,o.StockCount=Qe,o.TypedInstanceFactory=ye,o.UnitsHelper=Ke,o.UnknownClientDataProvider=Hr,o.UpdatableNamedIdentity=Le,o.User=yr,o.UserCommonInfo=Oe,o.UserDataProvider=Cr,o.UserShortInfo=q,o.UserTypeEnum=fr,o.VersionConfig=tr,o.Warehouse=te,o.useReferencesStore=tt,o.useUserStateStore=nt,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
1
+ (function(o,g){typeof exports=="object"&&typeof module<"u"?g(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"],g):(o=typeof globalThis<"u"?globalThis:o||self,g(o["SC Common Lib"]={},o["lodash-es"],o["date-fns"],o.axios,o["ts-case-convert"],o.pinia,o.vue))})(this,function(o,g,h,Ir,Te,he,f){"use strict";var ct=Object.defineProperty;var lt=(o,g,h)=>g in o?ct(o,g,{enumerable:!0,configurable:!0,writable:!0,value:h}):o[g]=h;var t=(o,g,h)=>lt(o,typeof g!="symbol"?g+"":g,h);class q{constructor(r){t(this,"id");t(this,"guid");this.id=(r==null?void 0:r.id)??-1,this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return this.id===-1}}class a extends q{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class be extends a{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 me extends be{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class ee extends me{constructor(e){super(e);t(this,"isHidden");t(this,"parentCategoryId");t(this,"properties");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"}}var Ie=(s=>(s.K0="k0",s.K1="k1",s.K2="k2",s.K3="k3",s.K4="k4",s.Retail="retail",s))(Ie||{});class P extends a{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 re extends P{static getRetailPriceCoefficient(){return{id:-2,slug:Ie.Retail,name:"Розничная цена",guid:"",isNewRec:g.constant(!0)}}}class fe{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new re(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class _e{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 te 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 _e(e==null?void 0:e.coordinates)}}class Qe{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new te(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const Z=class Z{static init(r){Z.config=r}static getConfig(){if(g.isUndefined(Z.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return Z.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(Z,"config");let A=Z;class Ye extends be{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 $ extends Ye{constructor(e){var n,c,u,p;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");t(this,"quantityUnit");t(this,"currency");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=g.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(y=>new Qe(y)))??[],this.type="product";const i=(e==null?void 0:e.category)??((c=e==null?void 0:e.categories)==null?void 0:c.find(y=>y.isPrimary));i&&(this.category=new me({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(y=>new me(y))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(y=>new Xe(y,A.getConfig().http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.priceCoefficients=((p=e==null?void 0:e.priceCoefficients)==null?void 0:p.map(y=>new fe(y)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){const e=A.getConfig().products.units;return[...e.linear,...e.square].includes(this.unit)}}class Ze 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 $(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new ee,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&g.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class xe extends Ze{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 ie{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new xe(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Ee{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 er{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 rr{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 tr{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=g.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 _r{constructor(r){t(this,"environment");t(this,"currentDomain");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"products");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.currentDomain=(r==null?void 0:r.currentDomain)??"",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new er(r==null?void 0:r.http),this.deviceTypeByResolution=new Ee(r==null?void 0:r.deviceTypeByResolution),this.products={units:{linear:["пог.м.","м."],square:["м2"]},...r==null?void 0:r.products},this.sentry=new rr({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new tr(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 ye{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const O=class O{constructor(r,e){t(this,"httpClient");t(this,"defaultInstanceNotificationErrorResponseHandler",g.noop);const i=A.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=O.baseDefaultNotificationErrorResponseHandler,this.httpClient=Ir.create({baseURL:r,headers:{"APP-VERSION":`${i.name} (${i.version}, ${h.format(i.date,A.getConfig().dateFormats.api)})`,Accept:"application/json","Content-Type":"application/json",...e}}),this.httpClient.interceptors.request.use(n=>(n.method&&(n.method==="get"&&n.params&&(n.params=Te.objectToSnake(n.params)),["put","patch","post"].includes(g.toLower(n.method))&&n.data&&(n.data=Te.objectToSnake(n.data))),n),n=>Promise.reject(n)),this.httpClient.interceptors.response.use(n=>(n.data&&(n.data=Te.objectToCamel(n.data)),n),n=>O.convertHttpErrorResponse(n))}static setBaseDefaultNotificationErrorResponseHandler(r){O.baseDefaultNotificationErrorResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(O.instances,r.name)||(O.instances[r.name]=ye.simpleInstanceInitializer(r)),O.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(O,"instances",{}),t(O,"baseDefaultNotificationErrorResponseHandler",g.noop);let Ce=O;const x=class x extends Ce{constructor(e,i){super(e,i);t(this,"responseDataCacheTimeout");const n=A.getConfig();this.responseDataCacheTimeout=n.http.responseDataCacheTimeout}static getCachedResponse(e){const i=x.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){x.responseDataCache.set(e,{validTo:h.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,n=!1){const c=n?x.getCachedResponse(i):void 0;return c?Promise.resolve(c):this.get(i).then(u=>{const p=u.map(y=>ye.instanceInitializer(e,y));return n&&p&&this.cacheResponse(i,p),p})}};t(x,"responseDataCache",new Map);let Pe=x;class m extends Pe{constructor(){var i,n;const r=A.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 Lr extends m{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new ie(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 ie(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 ie(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 ie(e.data))}}var ir=(s=>(s.m2Cost="m2Cost",s.percent="percent",s.value="value",s))(ir||{}),we=(s=>(s.Discount="discount",s.PriceTemplate="price_template",s.ClientPrice="client_price",s.Product="product",s))(we||{}),nr=(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))(nr||{});class U extends ee{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 U(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new $(c))}}class Le extends a{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=g.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class sr extends Le{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=g.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class kr{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 G extends a{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class or extends a{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=g.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 G(e==null?void 0:e.owner),this.deletedAt=g.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class z extends Le{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}class W extends ${constructor(e){super(e);t(this,"costCoefficient");t(this,"costSource");t(this,"discount");t(this,"priceTemplate");t(this,"isPreviouslyOrdered");t(this,"isRequired");t(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??we.Product,this.discount=e!=null&&e.discount?new or(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 cr{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class k extends P{}class ne extends a{constructor(e){super(e);t(this,"salesDirection",new k);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new k(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new cr(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class se extends ne{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 Or extends ee{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 se(e.manager):void 0}}class oe extends Or{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 oe(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 re(r.coefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class ve extends ke{constructor(e){super(e);t(this,"productCategory");this.productCategory=new ee(e==null?void 0:e.productCategory)}}class j extends P{}class F extends P{constructor(e){super(e);t(this,"country",new j);e&&(this.country=new j(e.country))}}class ce extends P{constructor(e){super(e);t(this,"region",new F);e&&(this.region=new F(e.region))}}class Oe extends a{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 k(e.salesDirection):void 0,this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=g.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 K extends Oe{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 k(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 ce(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 ne(n)))??[]}}class J extends q{constructor(e){super(e);t(this,"startAt");t(this,"endAt");t(this,"client");t(this,"priceTemplate");this.startAt=g.isString(e==null?void 0:e.startAt)?h.parseISO(e.startAt):(e==null?void 0:e.startAt)??new Date,this.endAt=g.isString(e==null?void 0:e.endAt)?h.parseISO(e.endAt):(e==null?void 0:e.endAt)??new Date,this.client=new K(e==null?void 0:e.client),this.priceTemplate=new z(e==null?void 0:e.priceTemplate)}}class Re extends ke{constructor(e){super(e);t(this,"product");this.product=new $(e==null?void 0:e.product)}}class Ne extends P{}class Q extends a{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new Ne(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 Q(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class lr extends P{}class qe extends P{}class Nr extends P{}class ur extends P{}class le extends a{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var S=(s=>(s.Person="individual",s.Ic="entrepreneur",s.UlR="legal",s.UlNr="non_resident_legal",s))(S||{});class M extends P{static generatePersonItem(){return new M({id:1,guid:"",slug:S.Person,name:""})}}class pr extends P{}class gr extends P{}class H extends P{}class hr extends P{}class mr extends P{}class Ue extends P{}class Ge extends P{}class w extends m{getReference(r,e=!1){return this.getTypedDataArrayRequester(lr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(qe,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(ur,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(le,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(H,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(M,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(pr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(gr,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(hr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Ue,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(k,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Ge,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(ce,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(F,`/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(te,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Ne,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(re,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(mr,"/public/references/product-file-type",!0)}}var fr=(s=>(s.Admin="admin",s.Manager="manager",s.Operator="operator",s.Client="client",s.Guest="guest",s))(fr||{});class yr extends Oe{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 Cr extends m{getCurrentUser(){return this.get("/internal/users/info",{},r=>new yr(r.data))}}class Pr{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=g.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 G(r.client):void 0,this.executor=r.executor?new G(r.executor):void 0,this.currency=r.currency?new le(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 $(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new U(e)))}}class Y extends a{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 Y(r==null?void 0:r.role),this.category=new ee(r==null?void 0:r.category),this.minCoefficient=new re(r==null?void 0:r.minCoefficient)}}var wr=(s=>(s.LastOrder="last_order",s.Contacts="contacts",s.PartnerGroups="partner_groups",s.PreferredDeliveryType="preferred_delivery_type",s))(wr||{});class De extends q{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new le);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new le(e.currency))}}class ae extends a{constructor(e){super(e);t(this,"phone");t(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class d extends ae{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=g.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class de extends a{constructor(e){super(e);t(this,"manager",new ne);t(this,"opf",M.generatePersonItem());t(this,"salesDirection",new k);t(this,"partnerGroup",new H);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 M(e.opf),this.salesDirection=new k(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new G(e.creator):void 0,this.updatedAt=g.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new G(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new H(e.partnerGroup)),e.manager&&(this.manager=new ne(e.manager)),e.contacts){const i=[];e.contacts.forEach(n=>{i.push(new d(n))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(n=>{i.push(new De(n))}),this.bankAccounts=i}}}}class vr extends de{constructor(r){super(r)}}class Be extends de{constructor(e){super(e);t(this,"inn","");t(this,"okpo","");t(this,"directorName","");t(this,"directorPosition","");t(this,"directorActsOn","");t(this,"legalAddress","");t(this,"postalAddress","");t(this,"actualAddress","");e&&(this.inn=e.inn??"",this.okpo=e.okpo??"",this.directorName=e.directorName??"",this.directorPosition=e.directorPosition??"",this.directorActsOn=e.directorActsOn??"",this.legalAddress=e.legalAddress??"",this.postalAddress=e.postalAddress??"",this.actualAddress=e.actualAddress??"")}}class ze extends Be{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class Rr extends ze{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 ue{static createInstance(r){switch(r.opf.slug){case S.Ic:return new Be(r);case S.UlR:return new ze(r);case S.UlNr:return new Rr(r);default:return new vr(r)}}}class Ae extends q{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class Dr extends d{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(i=>new 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 pe extends sr{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 _e(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(n=>new d(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 We extends K{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(p=>ue.createInstance(p)))??[],this.partnerGroups=((n=e==null?void 0:e.partnerGroups)==null?void 0:n.map(p=>new H(p)))??[],this.contacts=((c=e==null?void 0:e.contacts)==null?void 0:c.map(p=>new d(p)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(p=>new pe(p)))??[],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 te(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class qr{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",{from:null,to:null});t(this,"lastLoginDate",{from:null,to:null});t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"salesDirection");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"hasCostLessThenStop");t(this,"partnerGroup");t(this,"contact");t(this,"lastOrder");var e,i,n,c,u,p,y,R,D,T,b,I,_,L,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 ce(r==null?void 0:r.city),this.region=new F(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={from:g.isString((e=r==null?void 0:r.createdAt)==null?void 0:e.from)?h.parseISO((i=r==null?void 0:r.createdAt)==null?void 0:i.from):(n=r==null?void 0:r.createdAt)==null?void 0:n.from,to:g.isString((c=r==null?void 0:r.createdAt)==null?void 0:c.to)?h.parseISO((u=r==null?void 0:r.createdAt)==null?void 0:u.to):(p=r==null?void 0:r.createdAt)==null?void 0:p.to},this.lastLoginDate={from:g.isString((y=r==null?void 0:r.lastLoginDate)==null?void 0:y.from)?h.parseISO((R=r==null?void 0:r.lastLoginDate)==null?void 0:R.from):(D=r==null?void 0:r.lastLoginDate)==null?void 0:D.from,to:g.isString((T=r==null?void 0:r.lastLoginDate)==null?void 0:T.to)?h.parseISO((b=r==null?void 0:r.lastLoginDate)==null?void 0:b.to):(I=r==null?void 0:r.lastLoginDate)==null?void 0:I.to},this.lastLoginDateHasOrder=(r==null?void 0:r.lastLoginDateHasOrder)??void 0,this.managers=r!=null&&r.managers&&r.managers.length>0?r.managers.map(l=>new se(l)):[],this.salesDirection=new k(r==null?void 0:r.salesDirection),this.contragentInn=(r==null?void 0:r.contragentInn)??"",this.contragentType=new M(r==null?void 0:r.contragentType),this.preferredDeliveryType=new B(r==null?void 0:r.preferredDeliveryType),this.hasCostLessThenStop=r!=null&&r.hasCostLessThenStop?!0:void 0,this.partnerGroup=new H(r==null?void 0:r.partnerGroup),this.contact=new ae(r==null?void 0:r.contact),this.lastOrder={createdAt:(_=r==null?void 0:r.lastOrder)==null?void 0:_.createdAt,creator:(L=r==null?void 0:r.lastOrder)==null?void 0:L.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]="";break;case"city":this.city=new ce;break;case"region":this.region=new F;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirection":this.salesDirection=new k;break;case"contragentType":this.contragentType=new M;break;case"preferredDeliveryType":this.preferredDeliveryType=new B;break;case"partnerGroup":this.partnerGroup=new H;break;case"hasCostLessThenStop":this.hasCostLessThenStop=void 0;break;case"contact":this.contact=new ae;break}return this}asClearRaw(){var e,i,n,c;const r={};return Object.keys(this).forEach(u=>{const p=this[u];g.isNil(p)||g.isString(p)&&p.trim().length===0||g.isFunction(p.isNewRec)&&p.isNewRec()||(r[u]=p)}),!((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 je extends q{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new G(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Ve extends je{constructor(e){var i,n,c,u,p,y,R,D;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 K(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:g.isString((p=e==null?void 0:e.delivery)==null?void 0:p.date)?h.parseISO(e.delivery.date):((y=e==null?void 0:e.delivery)==null?void 0:y.date)??new Date,address:(R=e==null?void 0:e.delivery)!=null&&R.address?new pe(e.delivery.address):void 0,warehouse:(D=e==null?void 0:e.delivery)!=null&&D.warehouse?new te(e.delivery.warehouse):void 0},this.attachedUser=new G(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new k(e==null?void 0:e.salesDirection),this.pendingAt=g.isString(e==null?void 0:e.pendingAt)?h.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=g.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 ar 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 Ar extends Ve{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 ar(i)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?ue.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}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 Fe{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=g.isDate(this.value)?h.format(this.value,A.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 Fe(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 Fe&&g.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof X?r.toPrimitive():r)}}}class ge extends m{getPaginated(r,e,i,n,c,u,p){let y={page:(n==null?void 0:n.page)??1,perPage:(n==null?void 0:n.pageSize)??10};return e&&(y.filters=JSON.stringify((e instanceof X?e:new X(e)).toPrimitive())),g.isEmpty(i)||(y.sort=i),c&&(y={...y,...c}),this.get(r,y,u,p)}}class Ur extends ge{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 Ve(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 Ar(e.data))}}class $r extends a{constructor(e){var i,n;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");(i=e.contacts)!=null&&i.length&&(this.contacts=e.contacts.map(c=>new d(c))),e.lastOrder&&(this.lastOrder=new je(e.lastOrder)),(n=e.partnerGroups)!=null&&n.length&&(this.partnerGroups=e.partnerGroups.map(c=>new H(c))),e.preferredDeliveryType&&(this.preferredDeliveryType=new B(e.preferredDeliveryType))}}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 Gr 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 Mr{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 Hr extends ge{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new We(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(p=>new K(p)),u})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:$e.Contains,value:r}]})}getAdditionalClientsData(r,e){return this.post("/internal/clients/additional-data",{clients:r,requested_data_types:e},i=>{let n=[];return(i==null?void 0:i.data.length)>0&&(n=i.data.map(c=>new $r(c))),n})}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 Dr(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 We(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 y,R,D,T,b,I,_,L;let n;const c=e,u=e,p=e;switch(e.opf.slug){case S.Ic:n={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(y=c.partnerGroup)==null?void 0:y.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 S.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(D=u.partnerGroup)==null?void 0:D.id,manager_id:(T=u.manager)==null?void 0:T.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 S.UlNr:n={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(b=p.partnerGroup)==null?void 0:b.id,manager_id:(I=p.manager)==null?void 0:I.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(_=e.partnerGroup)==null?void 0:_.id,manager_id:(L=e.manager)==null?void 0:L.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,n,N=>ue.createInstance(N.data),i)}updateContragentClientData(r,e,i={}){var y,R,D,T,b,I,_,L;let n;const c=e,u=e,p=e;switch(e.opf.slug){case S.Ic:n={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(y=c.partnerGroup)==null?void 0:y.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 S.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(D=u.partnerGroup)==null?void 0:D.id,manager_id:(T=u.manager)==null?void 0:T.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 S.UlNr:n={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(b=p.partnerGroup)==null?void 0:b.id,manager_id:(I=p.manager)==null?void 0:I.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(_=e.partnerGroup)==null?void 0:_.id,manager_id:(L=e.manager)==null?void 0:L.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,n,N=>ue.createInstance(N.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,p=>new pe(p.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,p=>new pe(p.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 De(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 De(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 d(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,p;const c={name:e.name,position:e.position,comment:e.comment,...i};return(u=e.phone)!=null&&u.length&&(c.phone=e.phone),(p=e.email)!=null&&p.length&&(c.email=e.email),this.post(`/internal/clients/${r}/contacts`,c,y=>new d(y.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 dr 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 Se{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new K(r==null?void 0:r.client),this.product=new $(r==null?void 0:r.product),this.cost=(r==null?void 0:r.cost)??0,this.costCoefficient=(r==null?void 0:r.costCoefficient)??0,this.source=(r==null?void 0:r.source)??we.Product}}class Br 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=`${A.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 zr 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 Wr extends m{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new J(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new J(e.data))}attachTemplate(r,e,i){const n=A.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 J(c.data))}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`)}changeTemplate(r,e,i,n){const c=A.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 J(u.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class jr 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=>g.map(n.data,c=>new $(c)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return g.forEach(i,n=>n.map(c=>new fe(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 U(u)))}).catch(c=>{n(c)})})}}class Vr extends m{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new $(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new $(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>g.map(e.data,i=>new fe(i)))}getProductPriceHistory(r,e){const i={};return g.isNil(e)||(i.clientId=e),this.get(`/internal/price/products/${r}/history`,i,n=>g.map(n.data,c=>new Pr(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 $(u)))}).catch(c=>{n(c)})})}}class Fr extends m{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(n=>new oe(n)))}getCategoryData(r,e,i=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:n},c=>new oe(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=>g.map(c.data,u=>new W(u)))}}class Kr extends m{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},n=>new W(n.data))}}class Jr extends ge{getTemplateList(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 z(u)),c})}createTemplate(r){return this.post("/internal/price/templates",r,e=>new z(e.data))}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new z(e.data))}updateTemplate(r,e){return this.patch(`/internal/price/templates/${r}`,e,i=>new z(i.data))}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 Re(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new Re(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 Re(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 ve(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new ve(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 ve(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 J(i)))}}class Qr extends m{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new Y(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new Y(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new Y(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new Y(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 Yr extends ge{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 Q(u)),c})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},n=>new Q(n.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new Q(e.data))}updateProperty(r,e){const{typeId:i,...n}=e;return this.patch(`/internal/catalog/properties/${r}`,{...n,type:i},c=>new Q(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 Xr 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)})}}class Zr extends m{analyzeProductPrices(r,e){return this.get(`/internal/price/products/${r}/analyze`,{...e},i=>i.data.map(n=>new Se(n)))}analyzeCategoryPrices(r,e){return this.get(`/internal/price/categories/${r}/analyze`,{...e},i=>i.data.map(n=>new Se(n)))}analyzeCategoryPricesBySquare(r,e){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e},i=>i.data.map(n=>new Se(n)))}}class xr 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 $(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 Er{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 E=class E{static setLinearValues(r){E.linearValues=r}static productIsMeasurable(r){return E.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!E.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(E,"linearValues",["пог.м.","м.","м2"]);let Ke=E;class et{static generateUndefinedManagerInstance(){return new se({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=>ye.instanceInitializer(se,c));return n&&this.cacheResponse(r,n),n})}}class br{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class Je{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 br(i)))??[]}}class rt extends m{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new Je(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new Je(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const v=he.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),p=f.ref(void 0),y=f.ref(void 0),R=f.ref(void 0),D=f.ref(void 0),T=f.ref(void 0),b=f.ref(void 0),I=f.ref(void 0),_=f.ref(void 0),L=f.ref(void 0),N=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:p,orderStatusReference:y,paymentTypeReference:R,partnerGroupReference:D,productFileTypeReference:T,resourceTypesReference:b,salesDirectionsReference:I,sourcePrimaryInterestReference:_,warehousesReference:L,propertyTypesReference:N,priceCoefficientsReference:l}}),tt=he.defineStore("references",()=>{const s=f.computed(()=>{const l=v();return!l.channelPrimaryInterestReference&&!l.dataLoaderList.channelPrimaryInterestReference&&(l.dataLoaderList.channelPrimaryInterestReference=!0,m.getInstance(w).getChannelPrimaryInterest().then(C=>{l.channelPrimaryInterestReference=C}).catch(g.noop)),l.channelPrimaryInterestReference}),r=f.computed(()=>{const l=v();return!l.contactPositionsReference&&!l.dataLoaderList.contactPositionsReference&&(l.dataLoaderList.contactPositionsReference=!0,m.getInstance(w).getContactPositions().then(C=>{l.contactPositionsReference=C}).catch(g.noop)),l.contactPositionsReference}),e=f.computed(()=>{const l=v();return!l.currencyReference&&!l.dataLoaderList.currencyReference&&(l.dataLoaderList.currencyReference=!0,m.getInstance(w).getCurrency().then(C=>{l.currencyReference=C}).catch(g.noop)),l.currencyReference}),i=f.computed(()=>{const l=v();return!l.opfReference&&!l.dataLoaderList.opfReference&&(l.dataLoaderList.opfReference=!0,m.getInstance(w).getOpf().then(C=>{l.opfReference=C}).catch(g.noop)),l.opfReference}),n=f.computed(()=>{const l=v();return!l.orderPaymentStatusReference&&!l.dataLoaderList.orderPaymentStatusReference&&(l.dataLoaderList.orderPaymentStatusReference=!0,m.getInstance(w).getOrderPaymentStatuses().then(C=>{l.orderPaymentStatusReference=C}).catch(g.noop)),l.orderPaymentStatusReference}),c=f.computed(()=>{const l=v();return!l.orderStatusReference&&!l.dataLoaderList.orderStatusReference&&(l.dataLoaderList.orderStatusReference=!0,m.getInstance(w).getOrderStatuses().then(C=>{l.orderStatusReference=C}).catch(g.noop)),l.orderStatusReference}),u=f.computed(()=>{const l=v();return!l.paymentTypeReference&&!l.dataLoaderList.paymentTypeReference&&(l.dataLoaderList.paymentTypeReference=!0,m.getInstance(w).getPaymentTypes().then(C=>{l.paymentTypeReference=C}).catch(g.noop)),l.paymentTypeReference}),p=f.computed(()=>{const l=v();return!l.partnerGroupReference&&!l.dataLoaderList.partnerGroupReference&&(l.dataLoaderList.partnerGroupReference=!0,m.getInstance(w).getPartnerGroup().then(C=>{l.partnerGroupReference=C}).catch(g.noop)),l.partnerGroupReference}),y=f.computed(()=>{const l=v();return!l.productFileTypeReference&&!l.dataLoaderList.productFileTypeReference&&(l.dataLoaderList.productFileTypeReference=!0,m.getInstance(w).getProductFileType().then(C=>{l.productFileTypeReference=C}).catch(g.noop)),l.productFileTypeReference}),R=f.computed(()=>{const l=v();return!l.resourceTypesReference&&!l.dataLoaderList.resourceTypesReference&&(l.dataLoaderList.resourceTypesReference=!0,m.getInstance(w).getResourceTypes().then(C=>{l.resourceTypesReference=C}).catch(g.noop)),l.resourceTypesReference}),D=f.computed(()=>{const l=v();return!l.salesDirectionsReference&&!l.dataLoaderList.salesDirectionsReference&&(l.dataLoaderList.salesDirectionsReference=!0,m.getInstance(w).getSalesDirections().then(C=>{l.salesDirectionsReference=C}).catch(g.noop)),l.salesDirectionsReference}),T=f.computed(()=>{const l=v();return!l.sourcePrimaryInterestReference&&!l.dataLoaderList.sourcePrimaryInterestReference&&(l.dataLoaderList.sourcePrimaryInterestReference=!0,m.getInstance(w).getSourcePrimaryInterest().then(C=>{l.sourcePrimaryInterestReference=C}).catch(g.noop)),l.sourcePrimaryInterestReference}),b=f.computed(()=>{const l=v();return!l.deliveryTypeReference&&!l.dataLoaderList.deliveryTypeReference&&(l.dataLoaderList.deliveryTypeReference=!0,m.getInstance(w).getDeliveryTypes().then(C=>{l.deliveryTypeReference=C}).catch(g.noop)),l.deliveryTypeReference}),I=f.computed(()=>{const l=v();return!l.managersList&&!l.dataLoaderList.managersList&&(l.dataLoaderList.managersList=!0,m.getInstance(Tr).getManagers().then(C=>{l.managersList=C}).catch(g.noop)),l.managersList}),_=f.computed(()=>{const l=v();return!l.warehousesReference&&!l.dataLoaderList.warehousesReference&&(l.dataLoaderList.warehousesReference=!0,m.getInstance(w).getWarehouses().then(C=>{l.warehousesReference=C}).catch(g.noop)),l.warehousesReference}),L=f.computed(()=>{const l=v();return!l.propertyTypesReference&&!l.dataLoaderList.propertyTypesReference&&(l.dataLoaderList.propertyTypesReference=!0,m.getInstance(w).getPropertyTypes().then(C=>{l.propertyTypesReference=C}).catch(g.noop)),l.propertyTypesReference}),N=f.computed(()=>{const l=v();return!l.priceCoefficientsReference&&!l.dataLoaderList.priceCoefficientsReference&&(l.dataLoaderList.priceCoefficientsReference=!0,m.getInstance(w).getPriceCoefficients().then(C=>{l.priceCoefficientsReference=C}).catch(g.noop)),l.priceCoefficientsReference});return{channelPrimaryInterestsReference:s,contactPositionsReference:r,currencyReference:e,opfReference:i,orderPaymentStatusReference:n,orderStatusReference:c,paymentTypeReference:u,partnerGroupsReference:p,productFilesTypesReference:y,resourceTypesReference:R,salesDirectionsReference:D,sourcePrimaryInterestsReference:T,deliveryTypeReference:b,managersList:I,warehousesReference:_,propertyTypesReference:L,priceCoefficientsReference:N}}),it=he.defineStore("__user_state_private",()=>{const s=f.ref({}),r=f.ref(void 0);return{dataLoaderList:s,currentUser:r}}),nt=he.defineStore("user_state",()=>({currentUser:f.computed(()=>{const r=it();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,m.getInstance(Cr).getCurrentUser().then(e=>{r.currentUser=e}).catch(g.noop).finally(g.noop)),r.currentUser})}));class st 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 ot{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}o.AnyReference=lr,o.AppBaseConfig=_r,o.AppConfigProvider=A,o.BankAccount=De,o.BasePaginationProvider=ge,o.CalculationTypeEnum=ir,o.Cart=ie,o.CartItem=xe,o.CartItemBase=Ze,o.CartProvider=Lr,o.CatalogProvider=Br,o.CatalogableItem=be,o.Category=U,o.CategoryPricingRule=He,o.ChannelPrimaryInterest=qe,o.City=Nr,o.CityWithRegionAndCountry=ce,o.Client=We,o.ClientAdditionalData=$r,o.ClientCategory=oe,o.ClientDataProvider=Hr,o.ClientPriceProvider=zr,o.ClientPriceTemplateProvider=Wr,o.ClientProduct=W,o.ClientProductCategoryDataProvider=Fr,o.ClientProductDataProvider=Kr,o.ClientShortInfo=K,o.ClientsAdditionalDataRequestTypeEnum=wr,o.ClientsListFilters=qr,o.ConfiguratorProvider=xr,o.Contact=ae,o.ContactLinks=cr,o.ContactPerson=d,o.ContactPersonRelated=Dr,o.ContactPosition=ur,o.ContactRelation=Ae,o.ContragentBase=de,o.ContragentFactory=ue,o.ContragentIc=Be,o.ContragentPerson=vr,o.ContragentUlNr=Rr,o.ContragentUlR=ze,o.CostSourceEnum=we,o.Country=j,o.Currency=le,o.DataSuggestionProvider=st,o.DataTablePagination=Gr,o.DataTablePaginationRequestParams=Sr,o.DataTableSortRequestParams=Mr,o.DateTimeProvider=Er,o.DeletableNamedIdentity=sr,o.DeliveryAddress=pe,o.DeliveryType=B,o.DeviceTypeResolutionConfig=Ee,o.DiscountShortInfo=or,o.FieldValidationResultData=ot,o.FilterGroup=X,o.FilterItem=Fe,o.FilterOpEnum=$e,o.GeoCoordinates=_e,o.HiddenCatalogableItem=Ye,o.HttpBaseCachedRequester=Pe,o.HttpBaseRequester=Ce,o.HttpParamsConfig=er,o.HttpRequester=m,o.Identity=q,o.Image=Xe,o.Manager=se,o.ManagerCommon=ne,o.ManagerDataFactory=et,o.ManagerDataProvider=Tr,o.MetaTagItem=br,o.NamedIdentity=a,o.Opf=M,o.OpfEnum=S,o.Order=Ar,o.OrderInfo=Ve,o.OrderPaymentStatus=pr,o.OrderProduct=ar,o.OrderShortInfo=je,o.OrderStatus=gr,o.OrdersDataProvider=Ur,o.PartnerGroup=H,o.PaymentType=hr,o.PreferencesStorageProvider=kr,o.PriceAnalyze=Se,o.PriceAnalyzeProvider=Zr,o.PriceCoefficient=re,o.PriceCoefficientEnum=Ie,o.PriceTemplate=z,o.PriceTemplateCategory=ve,o.PriceTemplateClient=J,o.PriceTemplateICatalogableItem=ke,o.PriceTemplateProduct=Re,o.PriceTemplateProvider=Jr,o.PricingRole=Y,o.PricingRoleProvider=Qr,o.PrimaryCatalogableItem=me,o.Product=$,o.ProductCategoryDataProvider=jr,o.ProductDataProvider=Vr,o.ProductFileType=mr,o.ProductPriceCoefficient=fe,o.ProductPriceHistory=Pr,o.PropertiesProvider=Yr,o.Property=Q,o.PropertyType=Ne,o.PropertyTypeEnum=nr,o.PropertyValue=V,o.RecommendationsDataProvider=Xr,o.RecommendationsList=Me,o.Reference=P,o.ReferenceDataProvider=w,o.Region=F,o.ResourceType=Ue,o.SalesDirection=k,o.SentryConfig=rr,o.Seo=Je,o.SeoDataProvider=rt,o.SourcePrimaryInterest=Ge,o.StockCount=Qe,o.TypedInstanceFactory=ye,o.UnitsHelper=Ke,o.UnknownClientDataProvider=dr,o.UpdatableNamedIdentity=Le,o.User=yr,o.UserCommonInfo=Oe,o.UserDataProvider=Cr,o.UserShortInfo=G,o.UserTypeEnum=fr,o.VersionConfig=tr,o.Warehouse=te,o.useReferencesStore=tt,o.useUserStateStore=nt,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=sc-common-lib.umd.cjs.map