@snabcentr/common-lib 1.39.0 → 1.40.0

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