@snabcentr/common-lib 1.37.0 → 1.37.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +3 -3
- package/dist/sc-common-lib.js +106 -106
- package/dist/sc-common-lib.js.map +1 -1
- package/dist/sc-common-lib.umd.cjs +1 -1
- package/dist/sc-common-lib.umd.cjs.map +1 -1
- package/dist/src/catalog/classes/property.d.ts.map +1 -1
- package/dist/src/catalog/types/search-result.d.ts +1 -1
- package/dist/src/catalog/types/search-result.d.ts.map +1 -1
- package/package.json +1 -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,hr,ge,re,f){"use strict";var Br=Object.defineProperty;var Wr=(o,h,g)=>h in o?Br(o,h,{enumerable:!0,configurable:!0,writable:!0,value:g}):o[h]=g;var t=(o,h,g)=>Wr(o,typeof h!="symbol"?h+"":h,g);class q{constructor(r){t(this,"id");t(this,"guid");this.id=(r==null?void 0:r.id)??-1,this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return this.id===-1}}class D extends q{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class me extends D{constructor(e){super(e);t(this,"slug");t(this,"code");t(this,"type");this.slug=(e==null?void 0:e.slug)??"",this.code=(e==null?void 0:e.code)??""}}class te extends me{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class fe extends te{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 P extends D{constructor(e){super(e);t(this,"slug");t(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class se{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new P(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 ye{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 M extends P{}class x extends P{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(i=>new M(i)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new ye(e==null?void 0:e.coordinates)}}class Oe{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new x(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const z=class z{static init(r){z.config=r}static getConfig(){if(h.isUndefined(z.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return z.config}static loadRemoteConfig(r="/config.json"){const e=fetch(r).then(s=>s.ok?s.json():(console.error(new Error(`Ошибка загрузки ${r}: ${s.statusText}`)),new Promise(i=>{i({})})));return e.catch(s=>{console.error(s)}),e}};t(z,"config");let L=z;class de extends me{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Ue{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 de{constructor(e){var i,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=((i=e==null?void 0:e.stockCount)==null?void 0:i.map(C=>new Oe(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 te({...s,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(C=>new te(C))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(C=>{var w;return new Ue(C,(w=L.getConfig().urls)==null?void 0:w.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 se(C)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){const e=L.getConfig().products.units;return[...e.linear,...e.square].includes(this.unit)}}class qe extends q{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"height");t(this,"length");t(this,"width");t(this,"barcode");t(this,"marker");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");this.product=new T(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new fe,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 Me extends qe{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 Me(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Ge{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 He{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 Be{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,s,i,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:((i=r==null?void 0:r.replay)==null?void 0:i.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 We{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 gr{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 He(r==null?void 0:r.http),this.deviceTypeByResolution=new Ge(r==null?void 0:r.deviceTypeByResolution),this.products={units:{linear:["пог.м.","м."],square:["м2"]},...r==null?void 0:r.products},this.sentry=new Be({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new We(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=L.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=b.baseDefaultNotificationErrorResponseHandler,this.httpClient=hr.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(i=>(i.method&&(i.method==="get"&&i.params&&(i.params=ge.objectToSnake(i.params)),["put","patch","post"].includes(h.toLower(i.method))&&i.data&&(i.data=ge.objectToSnake(i.data))),i),i=>Promise.reject(i)),this.httpClient.interceptors.response.use(i=>(i.data&&(i.data=ge.objectToCamel(i.data)),i),i=>b.convertHttpErrorResponse(i))}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,i;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:(i=e==null?void 0:e.data)==null?void 0:i.errors,headers:(e==null?void 0:e.headers)??{},rawError:r})}request(r,e=void 0,s={},i=!1){const c=this.httpClient.request(r).then(l=>e?e(l):l.data);return i||c.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,s)}),c}get(r,e={},s=void 0,i=!1){return this.request({method:"GET",url:r,params:e},s,{},i)}patch(r,e={},s=void 0,i={},c=!1){return this.request({method:"PATCH",url:r,data:e},s,i,c)}post(r,e={},s=void 0,i={},c=!1){return this.request({method:"POST",url:r,data:e},s,i,c)}delete(r,e=!1){return this.request({method:"DELETE",url:r},h.noop,{},e)}};t(b,"instances",{}),t(b,"baseDefaultNotificationErrorResponseHandler",h.noop);let ne=b;const j=class j extends ne{constructor(e,s){super(e,s);t(this,"responseDataCacheTimeout");const i=L.getConfig();this.responseDataCacheTimeout=i.http.responseDataCacheTimeout}static getCachedResponse(e){const s=j.responseDataCache.get(e);if(s&&s.validTo>new Date)return s.val}cacheResponse(e,s){j.responseDataCache.set(e,{validTo:g.addSeconds(new Date,this.responseDataCacheTimeout),val:s})}getTypedDataArrayRequester(e,s,i=!1){const c=i?j.getCachedResponse(s):void 0;return c?Promise.resolve(c):this.get(s).then(l=>{const p=l.map(C=>ie.instanceInitializer(e,C));return i&&p&&this.cacheResponse(s,p),p})}};t(j,"responseDataCache",new Map);let oe=j;class y extends oe{constructor(){var s,i;const r=L.getConfig(),e={};(s=r.devMode)!=null&&s.authBearerToken&&(e.Authorization=`Bearer ${(i=r.devMode)==null?void 0:i.authBearerToken}`),super(`${r.http.apiUri}/api`,e)}}class mr extends y{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},i=>new Q(i.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},i=>new Q(i.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 Ce=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Ce||{});class k extends fe{constructor(e){var s,i;super(e);t(this,"categories");t(this,"products");this.categories=(s=e==null?void 0:e.categories)==null?void 0:s.map(c=>new k(c)),this.products=(i=e==null?void 0:e.products)==null?void 0:i.map(c=>new T(c))}}class Pe extends D{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=e==null?void 0:e.updatedAt}}class ze 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 fr{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 N extends D{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class je extends D{constructor(e){super(e);t(this,"costCoefficient");t(this,"isLowPriceAllowed");t(this,"publishedAt");t(this,"description");t(this,"percent");t(this,"owner");t(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=e!=null&&e.publishedAt?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 N(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 Ve 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 J 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)??Ce.Product,this.discount=e!=null&&e.discount?new je(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new Ve(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 xe{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class a extends P{}class Y extends D{constructor(e){super(e);t(this,"salesDirection",new a);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new a(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new xe(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class K extends Y{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 yr extends fe{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 K(e.manager):void 0}}class X extends yr{constructor(e){var s,i;super(e);t(this,"categories");t(this,"products");this.categories=(s=e==null?void 0:e.categories)==null?void 0:s.map(c=>new X(c)),this.products=(i=e==null?void 0:e.products)==null?void 0:i.map(c=>new J(c))}}class B extends D{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=(e==null?void 0:e.type)??new D,this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class Cr extends D{}class G{constructor(r){t(this,"property");t(this,"value");this.property=(r==null?void 0:r.property)??new B,this.value=(r==null?void 0:r.value)??""}}class Qe extends P{}class we extends P{}class Pr extends P{}class H extends P{}class W extends P{constructor(e){super(e);t(this,"country",new H);e&&(this.country=new H(e.country))}}class Z extends P{constructor(e){super(e);t(this,"region",new W);e&&(this.region=new W(e.region))}}class Je extends P{}class F extends D{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var A=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(A||{});class O extends P{static generatePersonItem(){return new O({id:1,guid:"",slug:A.Person,name:""})}}class Ye extends P{}class Ke extends P{}class d extends P{}class Xe extends P{}class De extends P{}class ve extends P{}class v extends y{getReference(r,e=!1){return this.getTypedDataArrayRequester(Qe,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(we,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(Je,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(F,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(d,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(O,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(Ye,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(Ke,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(Xe,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(De,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(a,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(ve,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(Z,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(W,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(H,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(M,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(x,"/public/references/warehouse",!0)}}var Ze=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.Guest="guest",n))(Ze||{});class Re extends D{constructor(e){super(e);t(this,"phone");t(this,"email");t(this,"getNews");t(this,"salesDirection");t(this,"createdAt");t(this,"lastLoginAt");t(this,"isActive");this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:(e==null?void 0:e.phone)??"",this.email=(e==null?void 0:e.email)??"",this.getNews=(e==null?void 0:e.getNews)??!1,this.salesDirection=e!=null&&e.salesDirection?new a(e.salesDirection):void 0,this.createdAt=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 Fe extends Re{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 Ee extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Fe(r.data))}}class er{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 N(r.client):void 0,this.executor=r.executor?new N(r.executor):void 0,this.currency=r.currency?new F(r.currency):void 0}}class Ae{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 k(e)))}}class wr extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}}class Dr extends y{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(s=>new k(s)))}getCategoryData(r,e=!1,s=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:s},i=>new k(i.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new k(e.data))}getCategoryProductsList(r,e=!0,s=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:s,withPriceCoefficients:e},i=>h.map(i.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,i=>i.map(c=>new se(c))),s})}publicSimpleSearch(r,e=10){return new Promise((s,i)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{s(c.categories.map(l=>new k(l)))}).catch(c=>{i(c)})})}}class vr extends y{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 se(s)))}getProductPriceHistory(r,e){const s={};return h.isNil(e)||(s.clientId=e),this.get(`/internal/price/products/${r}/history`,s,i=>h.map(i.data,c=>new er(c)))}publicSimpleSearch(r,e=10){return new Promise((s,i)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{s(c.products.map(l=>new T(l)))}).catch(c=>{i(c)})})}}class Rr extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},s=>s.data.map(i=>new X(i)))}getCategoryData(r,e,s=!1,i=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:s,withNestedCategories:i},c=>new X(c.data))}getCategoryProductsList(r,e,s=!0,i=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:i,withPriceCoefficients:s},c=>h.map(c.data,l=>new J(l)))}}class Ar extends y{getProductData(r,e,s=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:s},i=>new J(i.data))}}class ce extends y{getPaginated(r,e,s,i,c,l){const p={page:(i==null?void 0:i.page)??1,per_page:(i==null?void 0:i.pageSize)??(i==null?void 0:i.perPage)??10};return e&&(p.filters=JSON.stringify(e)),h.isEmpty(s)||(h.isArray(s)?s:[s]).forEach((C,w)=>{p[`sort[${w}][field]`]=C.field,p[`sort[${w}][direction]`]=C.direction}),this.get(r,p,c,l)}}class Sr extends ce{getProperties(r,e,s){return this.getPaginated("/internal/catalog/properties",r,e,s,i=>{const c={...i.data};return c.data=c.data.map(l=>new B(l)),c})}createProperty(r){const{typeId:e,...s}=r;return this.post("/internal/catalog/properties",{...s,type:e},i=>new B(i.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new B(e.data))}updateProperty(r,e){const{typeId:s,...i}=e;return this.patch(`/internal/catalog/properties/${r}`,{...i,type:s},c=>new B(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 G(s)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},s=>new G(s.data))}updateProductProperty(r,e,s){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:s},i=>new G(i.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 G(s)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},s=>new G(s.data))}updateCategoryProperty(r,e,s){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:s},i=>new G(i.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 ar extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Ae(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Ae(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 rr=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n))(rr||{});class ue extends q{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new F);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new F(e.currency))}}class le extends D{constructor(e){super(e);t(this,"phone");t(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class U extends le{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 Se extends D{constructor(e){super(e);t(this,"manager",new Y);t(this,"opf",O.generatePersonItem());t(this,"salesDirection",new a);t(this,"partnerGroup",new d);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 O(e.opf),this.salesDirection=new a(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 N(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 N(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new d(e.partnerGroup)),e.manager&&(this.manager=new Y(e.manager)),e.contacts){const s=[];e.contacts.forEach(i=>{s.push(new U(i))}),this.contacts=s}if(e.bankAccounts){const s=[];e.bankAccounts.forEach(i=>{s.push(new ue(i))}),this.bankAccounts=s}}}}class tr extends Se{constructor(r){super(r)}}class ae extends Se{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 Te extends ae{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class sr extends Te{constructor(e){super(e);t(this,"registrationCountry",new H);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new H(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class E{static createInstance(r){switch(r.opf.slug){case A.Ic:return new ae(r);case A.UlR:return new Te(r);case A.UlNr:return new sr(r);default:return new tr(r)}}}class pe extends Re{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 a(e==null?void 0:e.salesDirection),this.debt=(e==null?void 0:e.debt)??0,this.alternativeName=(e==null?void 0:e.alternativeName)??"",this.city=new Z(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(i=>new Y(i)))??[]}}class he extends q{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class ir extends U{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(s=>new he(s))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(s=>new he(s))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(s=>new he(s))))}}class ee extends ze{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 ye(e==null?void 0:e.coordinates),this.contacts=((s=e==null?void 0:e.contacts)==null?void 0:s.map(i=>new U(i)))??[],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 be extends pe{constructor(e){var s,i,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=>E.createInstance(p)))??[],this.partnerGroups=((i=e==null?void 0:e.partnerGroups)==null?void 0:i.map(p=>new d(p)))??[],this.contacts=((c=e==null?void 0:e.contacts)==null?void 0:c.map(p=>new U(p)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(p=>new ee(p)))??[],this.channelPrimaryInterest=new we(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new ve(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new M(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 x(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class Tr{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,i,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 Z(r==null?void 0:r.city),this.region=new W(r==null?void 0:r.region),this.country=new H(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:((i=r==null?void 0:r.lastLoginDate)==null?void 0:i.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(w=>new K(w)):[],this.salesDirection=new a(r==null?void 0:r.salesDirection),this.contragentInn=(r==null?void 0:r.contragentInn)??"",this.contragentType=new O(r==null?void 0:r.contragentType),this.preferredDeliveryType=new M(r==null?void 0:r.preferredDeliveryType),this.hasCostLessThenStop=r!=null&&r.hasCostLessThenStop?!0:void 0,this.partnerGroup=new d(r==null?void 0:r.partnerGroup),this.contact=new le(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 Z;break;case"region":this.region=new W;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirection":this.salesDirection=new a;break;case"contragentType":this.contragentType=new O;break;case"preferredDeliveryType":this.preferredDeliveryType=new M;break;case"partnerGroup":this.partnerGroup=new d;break;case"hasCostLessThenStop":this.hasCostLessThenStop=void 0;break;case"contact":this.contact=new le;break}return this}asClearRaw(){var e,s,i,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,!((i=r==null?void 0:r.lastLoginDate)!=null&&i.from)&&!((c=r==null?void 0:r.lastLoginDate)!=null&&c.to)&&delete r.lastLoginDate,r}}class $e extends q{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 N(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class _e extends $e{constructor(e){var s,i,c,l,p,C,w,S;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 pe(e==null?void 0:e.client),this.payment={type:((s=e==null?void 0:e.payment)==null?void 0:s.type)??-1,status:((i=e==null?void 0:e.payment)==null?void 0:i.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:(w=e==null?void 0:e.delivery)!=null&&w.address?new ee(e.delivery.address):void 0,warehouse:(S=e==null?void 0:e.delivery)!=null&&S.warehouse?new x(e.delivery.warehouse):void 0},this.attachedUser=new N(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new a(e==null?void 0:e.salesDirection),this.pendingAt=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 nr extends q{constructor(e){super(e);t(this,"product");t(this,"quantity");t(this,"currency");t(this,"costOne");t(this,"costOneRub");t(this,"cost");t(this,"costRub");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"configurator");t(this,"configuratorParams");t(this,"sawing");this.product=new J(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 or extends _e{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 nr(s)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?E.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class br extends ce{getOrders(r,e,s){return this.getPaginated("/internal/orders",r,e?[e]:void 0,s,i=>{const c={...i.data};return c.data=c.data.map(l=>new _e(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 or(e.data))}}class cr extends D{constructor(e){var s,i;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 U(c))),e.lastOrder&&(this.lastOrder=new $e(e.lastOrder)),(i=e.partnerGroups)!=null&&i.length&&(this.partnerGroups=e.partnerGroups.map(c=>new d(c))),e.preferredDeliveryType&&(this.preferredDeliveryType=new M(e.preferredDeliveryType))}}var Ie=(n=>(n.BeginWith="bw",n.Contains="cn",n.Custom="custom",n.EndsWith="ew",n.Equals="eq",n.GreaterOrEqual="ge",n.GreaterThan="gt",n.InList="in",n.LessOrEqual="le",n.LessThan="lt",n.NotBeginWith="bn",n.NotContains="nc",n.NotEndsWith="en",n.NotEqual="ne",n.NotInList="ni",n.NotNull="nn",n.Null="nu",n))(Ie||{});class ur{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 ur{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 _r{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 Ir extends ce{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new be(e.data))}getClientsList(r,e,s){return this.getPaginated("/internal/clients",r,e,s,i=>{const c={...i.data};return c.data=c.data.map(l=>new pe(l)),c})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Ie.Contains,value:r}]})}getAdditionalClientsData(r,e){return this.post("/internal/clients/additional-data",{clients:r,requested_data_types:e},s=>{let i=[];return(s==null?void 0:s.data.length)>0&&(i=s.data.map(c=>new cr(c))),i})}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(i=>new ir(i))),s})}createClientCommonData(r,e={}){var s;return this.post("/internal/clients",{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(i=>i.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},i=>new be(i.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(i=>i.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,i={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:s},void 0,i)}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(i=>this.patch(`/internal/clients/${r}/managers/${i.id}/attach`,{is_primary:i.isDefault}));await Promise.all(s)}async detachClientFromManagers(r,e){const s=e.map(i=>this.patch(`/internal/clients/${r}/managers/${i.id}/detach`));await Promise.all(s)}createContragentClientData(r,e,s={}){var C,w,S,$,_,I,u,m;let i;const c=e,l=e,p=e;switch(e.opf.slug){case A.Ic:i={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(w=c.manager)==null?void 0:w.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case A.UlR:i={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:(S=l.partnerGroup)==null?void 0:S.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:i={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(_=p.partnerGroup)==null?void 0:_.id,manager_id:(I=p.manager)==null?void 0:I.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:i={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(u=e.partnerGroup)==null?void 0:u.id,manager_id:(m=e.manager)==null?void 0:m.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,i,Ne=>E.createInstance(Ne.data),s)}updateContragentClientData(r,e,s={}){var C,w,S,$,_,I,u,m;let i;const c=e,l=e,p=e;switch(e.opf.slug){case A.Ic:i={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(w=c.manager)==null?void 0:w.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case A.UlR:i={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:(S=l.partnerGroup)==null?void 0:S.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:i={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(_=p.partnerGroup)==null?void 0:_.id,manager_id:(I=p.manager)==null?void 0:I.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:i={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(u=e.partnerGroup)==null?void 0:u.id,manager_id:(m=e.manager)==null?void 0:m.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,i,Ne=>E.createInstance(Ne.data),s)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,s={}){var c,l;const i={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.coordinates&&(i.coordinates={lat:(c=e.coordinates)==null?void 0:c.lat,long:(l=e.coordinates)==null?void 0:l.long}),e.operatingHours&&(i.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),this.post(`/internal/clients/${r}/delivery-addresses`,i,p=>new ee(p.data),s)}updateClientDeliveryAddress(r,e,s={}){var c,l;const i={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.operatingHours&&(i.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),e.coordinates&&(i.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}`,i,p=>new ee(p.data),s)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,s,i={}){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 ue(c.data),i)}updateContragentBankAccount(r,e,s,i={}){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 ue(c.data),i)}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},i=>new U(i.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,i={}){return this.createContact(r,s,{contragents:[{id:e,is_primary:s.isPrimary??!1,not_disturb:s.notDisturb??!1}]},i)}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,i={}){return this.createContact(r,s,{addresses:[{id:e,is_primary:s.isPrimary??!1,not_disturb:s.notDisturb??!1}]},i)}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,i={}){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 U(C.data),i)}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 Lr extends y{checkPhoneIsBusy(r){return new Promise((e,s)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(i=>{e(!!i.isBusy)}).catch(s)})}}class kr extends y{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 i=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 i.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,s)}),i}createTemplate(r,e,s={}){var i;return this.post(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.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 Nr{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 V=class V{static setLinearValues(r){V.linearValues=r}static productIsMeasurable(r){return V.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,s;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)&&!V.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,s,i;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((s=r.properties)!=null&&s.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)?r.properties.minCount:.01}};t(V,"linearValues",["пог.м.","м.","м2"]);let Le=V;class Or{static generateUndefinedManagerInstance(){return new K({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class lr extends y{getManagers(){const r="/internal/managers",e=y.getCachedResponse(r);return e?Promise.resolve(e):this.get(r).then(s=>{const i=s.data.map(c=>ie.instanceInitializer(K,c));return i&&this.cacheResponse(r,i),i})}}class pr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class ke{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");var e;this.resourceType=new De(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(s=>new pr(s)))??[]}}class dr extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},s=>new ke(s.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,s=>new ke(s.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const R=re.defineStore("__references_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0),s=f.ref(void 0),i=f.ref(void 0),c=f.ref(void 0),l=f.ref(void 0),p=f.ref(void 0),C=f.ref(void 0),w=f.ref(void 0),S=f.ref(void 0),$=f.ref(void 0),_=f.ref(void 0),I=f.ref(void 0),u=f.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:s,deliveryTypeReference:i,managersList:c,opfReference:l,orderPaymentStatusReference:p,orderStatusReference:C,paymentTypeReference:w,partnerGroupReference:S,resourceTypesReference:$,salesDirectionsReference:_,sourcePrimaryInterestReference:I,warehousesReference:u}}),Ur=re.defineStore("references",()=>{const n=f.computed(()=>{const u=R();return!u.channelPrimaryInterestReference&&!u.dataLoaderList.channelPrimaryInterestReference&&(u.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(v).getChannelPrimaryInterest().then(m=>{u.channelPrimaryInterestReference=m}).catch(h.noop)),u.channelPrimaryInterestReference}),r=f.computed(()=>{const u=R();return!u.contactPositionsReference&&!u.dataLoaderList.contactPositionsReference&&(u.dataLoaderList.contactPositionsReference=!0,y.getInstance(v).getContactPositions().then(m=>{u.contactPositionsReference=m}).catch(h.noop)),u.contactPositionsReference}),e=f.computed(()=>{const u=R();return!u.currencyReference&&!u.dataLoaderList.currencyReference&&(u.dataLoaderList.currencyReference=!0,y.getInstance(v).getCurrency().then(m=>{u.currencyReference=m}).catch(h.noop)),u.currencyReference}),s=f.computed(()=>{const u=R();return!u.opfReference&&!u.dataLoaderList.opfReference&&(u.dataLoaderList.opfReference=!0,y.getInstance(v).getOpf().then(m=>{u.opfReference=m}).catch(h.noop)),u.opfReference}),i=f.computed(()=>{const u=R();return!u.orderPaymentStatusReference&&!u.dataLoaderList.orderPaymentStatusReference&&(u.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(v).getOrderPaymentStatuses().then(m=>{u.orderPaymentStatusReference=m}).catch(h.noop)),u.orderPaymentStatusReference}),c=f.computed(()=>{const u=R();return!u.orderStatusReference&&!u.dataLoaderList.orderStatusReference&&(u.dataLoaderList.orderStatusReference=!0,y.getInstance(v).getOrderStatuses().then(m=>{u.orderStatusReference=m}).catch(h.noop)),u.orderStatusReference}),l=f.computed(()=>{const u=R();return!u.paymentTypeReference&&!u.dataLoaderList.paymentTypeReference&&(u.dataLoaderList.paymentTypeReference=!0,y.getInstance(v).getPaymentTypes().then(m=>{u.paymentTypeReference=m}).catch(h.noop)),u.paymentTypeReference}),p=f.computed(()=>{const u=R();return!u.partnerGroupReference&&!u.dataLoaderList.partnerGroupReference&&(u.dataLoaderList.partnerGroupReference=!0,y.getInstance(v).getPartnerGroup().then(m=>{u.partnerGroupReference=m}).catch(h.noop)),u.partnerGroupReference}),C=f.computed(()=>{const u=R();return!u.resourceTypesReference&&!u.dataLoaderList.resourceTypesReference&&(u.dataLoaderList.resourceTypesReference=!0,y.getInstance(v).getResourceTypes().then(m=>{u.resourceTypesReference=m}).catch(h.noop)),u.resourceTypesReference}),w=f.computed(()=>{const u=R();return!u.salesDirectionsReference&&!u.dataLoaderList.salesDirectionsReference&&(u.dataLoaderList.salesDirectionsReference=!0,y.getInstance(v).getSalesDirections().then(m=>{u.salesDirectionsReference=m}).catch(h.noop)),u.salesDirectionsReference}),S=f.computed(()=>{const u=R();return!u.sourcePrimaryInterestReference&&!u.dataLoaderList.sourcePrimaryInterestReference&&(u.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(v).getSourcePrimaryInterest().then(m=>{u.sourcePrimaryInterestReference=m}).catch(h.noop)),u.sourcePrimaryInterestReference}),$=f.computed(()=>{const u=R();return!u.deliveryTypeReference&&!u.dataLoaderList.deliveryTypeReference&&(u.dataLoaderList.deliveryTypeReference=!0,y.getInstance(v).getDeliveryTypes().then(m=>{u.deliveryTypeReference=m}).catch(h.noop)),u.deliveryTypeReference}),_=f.computed(()=>{const u=R();return!u.managersList&&!u.dataLoaderList.managersList&&(u.dataLoaderList.managersList=!0,y.getInstance(lr).getManagers().then(m=>{u.managersList=m}).catch(h.noop)),u.managersList}),I=f.computed(()=>{const u=R();return!u.warehousesReference&&!u.dataLoaderList.warehousesReference&&(u.dataLoaderList.warehousesReference=!0,y.getInstance(v).getWarehouses().then(m=>{u.warehousesReference=m}).catch(h.noop)),u.warehousesReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:s,orderPaymentStatusReference:i,orderStatusReference:c,paymentTypeReference:l,partnerGroupsReference:p,resourceTypesReference:C,salesDirectionsReference:w,sourcePrimaryInterestsReference:S,deliveryTypeReference:$,managersList:_,warehousesReference:I}}),qr=re.defineStore("__user_state_private",()=>{const n=f.ref({}),r=f.ref(void 0);return{dataLoaderList:n,currentUser:r}}),Mr=re.defineStore("user_state",()=>({currentUser:f.computed(()=>{const r=qr();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,y.getInstance(Ee).getCurrentUser().then(e=>{r.currentUser=e}).catch(h.noop).finally(h.noop)),r.currentUser})}));class Gr extends y{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(s=>{const i=[...s];let c=1;return i.forEach(l=>{l.id=c++}),i})}}class Hr{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}o.AnyReference=Qe,o.AppBaseConfig=gr,o.AppConfigProvider=L,o.BankAccount=ue,o.BasePaginationProvider=ce,o.Cart=Q,o.CartItem=Me,o.CartItemBase=qe,o.CartProvider=mr,o.CatalogProvider=wr,o.CatalogableItem=me,o.Category=k,o.ChannelPrimaryInterest=we,o.City=Pr,o.CityWithRegionAndCountry=Z,o.Client=be,o.ClientAdditionalData=cr,o.ClientCategory=X,o.ClientDataProvider=Ir,o.ClientProduct=J,o.ClientProductCategoryDataProvider=Rr,o.ClientProductDataProvider=Ar,o.ClientShortInfo=pe,o.ClientsAdditionalDataRequestTypeEnum=rr,o.ClientsListFilters=Tr,o.ConfiguratorProvider=kr,o.Contact=le,o.ContactLinks=xe,o.ContactPerson=U,o.ContactPersonRelated=ir,o.ContactPosition=Je,o.ContactRelation=he,o.ContragentBase=Se,o.ContragentFactory=E,o.ContragentIc=ae,o.ContragentPerson=tr,o.ContragentUlNr=sr,o.ContragentUlR=Te,o.CostSourceEnum=Ce,o.Country=H,o.Currency=F,o.DataSuggestionProvider=Gr,o.DataTablePagination=$r,o.DataTablePaginationRequestParams=ur,o.DataTableSortRequestParams=_r,o.DateTimeProvider=Nr,o.DeletableNamedIdentity=ze,o.DeliveryAddress=ee,o.DeliveryType=M,o.DeviceTypeResolutionConfig=Ge,o.DiscountShortInfo=je,o.FieldValidationResultData=Hr,o.FilterOpEnum=Ie,o.GeoCoordinates=ye,o.HiddenCatalogableItem=de,o.HttpBaseCachedRequester=oe,o.HttpBaseRequester=ne,o.HttpParamsConfig=He,o.HttpRequester=y,o.Identity=q,o.Image=Ue,o.Manager=K,o.ManagerCommon=Y,o.ManagerDataFactory=Or,o.ManagerDataProvider=lr,o.MetaTagItem=pr,o.NamedIdentity=D,o.Opf=O,o.OpfEnum=A,o.Order=or,o.OrderInfo=_e,o.OrderPaymentStatus=Ye,o.OrderProduct=nr,o.OrderShortInfo=$e,o.OrderStatus=Ke,o.OrdersDataProvider=br,o.PartnerGroup=d,o.PaymentType=Xe,o.PreferencesStorageProvider=fr,o.PriceCoefficient=se,o.PriceTemplate=Ve,o.PrimaryCatalogableItem=te,o.Product=T,o.ProductCategoryDataProvider=Dr,o.ProductDataProvider=vr,o.ProductPriceHistory=er,o.PropertiesProvider=Sr,o.Property=B,o.PropertyType=Cr,o.PropertyValue=G,o.RecommendationsDataProvider=ar,o.RecommendationsList=Ae,o.Reference=P,o.ReferenceDataProvider=v,o.Region=W,o.ResourceType=De,o.SalesDirection=a,o.SentryConfig=Be,o.Seo=ke,o.SeoDataProvider=dr,o.SourcePrimaryInterest=ve,o.StockCount=Oe,o.TypedInstanceFactory=ie,o.UnitsHelper=Le,o.UnknownClientDataProvider=Lr,o.UpdatableNamedIdentity=Pe,o.User=Fe,o.UserCommonInfo=Re,o.UserDataProvider=Ee,o.UserShortInfo=N,o.UserTypeEnum=Ze,o.VersionConfig=We,o.Warehouse=x,o.useReferencesStore=Ur,o.useUserStateStore=Mr,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,gr,ge,re,f){"use strict";var Br=Object.defineProperty;var Wr=(o,h,g)=>h in o?Br(o,h,{enumerable:!0,configurable:!0,writable:!0,value:g}):o[h]=g;var t=(o,h,g)=>Wr(o,typeof h!="symbol"?h+"":h,g);class q{constructor(r){t(this,"id");t(this,"guid");this.id=(r==null?void 0:r.id)??-1,this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return this.id===-1}}class D extends q{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class me extends D{constructor(e){super(e);t(this,"slug");t(this,"code");t(this,"type");this.slug=(e==null?void 0:e.slug)??"",this.code=(e==null?void 0:e.code)??""}}class te extends me{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class fe extends te{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 P extends D{constructor(e){super(e);t(this,"slug");t(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class se{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new P(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 ye{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 M extends P{}class x extends P{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(i=>new M(i)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new ye(e==null?void 0:e.coordinates)}}class Oe{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new x(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const z=class z{static init(r){z.config=r}static getConfig(){if(h.isUndefined(z.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return z.config}static loadRemoteConfig(r="/config.json"){const e=fetch(r).then(s=>s.ok?s.json():(console.error(new Error(`Ошибка загрузки ${r}: ${s.statusText}`)),new Promise(i=>{i({})})));return e.catch(s=>{console.error(s)}),e}};t(z,"config");let L=z;class de extends me{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Ue{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 de{constructor(e){var i,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=((i=e==null?void 0:e.stockCount)==null?void 0:i.map(C=>new Oe(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 te({...s,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(C=>new te(C))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(C=>{var w;return new Ue(C,(w=L.getConfig().urls)==null?void 0:w.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 se(C)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){const e=L.getConfig().products.units;return[...e.linear,...e.square].includes(this.unit)}}class qe extends q{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"height");t(this,"length");t(this,"width");t(this,"barcode");t(this,"marker");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");this.product=new T(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new fe,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 Me extends qe{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 Me(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Ge{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 He{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 Be{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,s,i,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:((i=r==null?void 0:r.replay)==null?void 0:i.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 We{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 mr{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 He(r==null?void 0:r.http),this.deviceTypeByResolution=new Ge(r==null?void 0:r.deviceTypeByResolution),this.products={units:{linear:["пог.м.","м."],square:["м2"]},...r==null?void 0:r.products},this.sentry=new Be({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new We(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=L.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=b.baseDefaultNotificationErrorResponseHandler,this.httpClient=gr.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(i=>(i.method&&(i.method==="get"&&i.params&&(i.params=ge.objectToSnake(i.params)),["put","patch","post"].includes(h.toLower(i.method))&&i.data&&(i.data=ge.objectToSnake(i.data))),i),i=>Promise.reject(i)),this.httpClient.interceptors.response.use(i=>(i.data&&(i.data=ge.objectToCamel(i.data)),i),i=>b.convertHttpErrorResponse(i))}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,i;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:(i=e==null?void 0:e.data)==null?void 0:i.errors,headers:(e==null?void 0:e.headers)??{},rawError:r})}request(r,e=void 0,s={},i=!1){const c=this.httpClient.request(r).then(l=>e?e(l):l.data);return i||c.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,s)}),c}get(r,e={},s=void 0,i=!1){return this.request({method:"GET",url:r,params:e},s,{},i)}patch(r,e={},s=void 0,i={},c=!1){return this.request({method:"PATCH",url:r,data:e},s,i,c)}post(r,e={},s=void 0,i={},c=!1){return this.request({method:"POST",url:r,data:e},s,i,c)}delete(r,e=!1){return this.request({method:"DELETE",url:r},h.noop,{},e)}};t(b,"instances",{}),t(b,"baseDefaultNotificationErrorResponseHandler",h.noop);let ne=b;const j=class j extends ne{constructor(e,s){super(e,s);t(this,"responseDataCacheTimeout");const i=L.getConfig();this.responseDataCacheTimeout=i.http.responseDataCacheTimeout}static getCachedResponse(e){const s=j.responseDataCache.get(e);if(s&&s.validTo>new Date)return s.val}cacheResponse(e,s){j.responseDataCache.set(e,{validTo:g.addSeconds(new Date,this.responseDataCacheTimeout),val:s})}getTypedDataArrayRequester(e,s,i=!1){const c=i?j.getCachedResponse(s):void 0;return c?Promise.resolve(c):this.get(s).then(l=>{const p=l.map(C=>ie.instanceInitializer(e,C));return i&&p&&this.cacheResponse(s,p),p})}};t(j,"responseDataCache",new Map);let oe=j;class y extends oe{constructor(){var s,i;const r=L.getConfig(),e={};(s=r.devMode)!=null&&s.authBearerToken&&(e.Authorization=`Bearer ${(i=r.devMode)==null?void 0:i.authBearerToken}`),super(`${r.http.apiUri}/api`,e)}}class fr extends y{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},i=>new Q(i.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},i=>new Q(i.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 Ce=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Ce||{});class k extends fe{constructor(e){var s,i;super(e);t(this,"categories");t(this,"products");this.categories=(s=e==null?void 0:e.categories)==null?void 0:s.map(c=>new k(c)),this.products=(i=e==null?void 0:e.products)==null?void 0:i.map(c=>new T(c))}}class Pe extends D{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=e==null?void 0:e.updatedAt}}class ze 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 yr{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 N extends D{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class je extends D{constructor(e){super(e);t(this,"costCoefficient");t(this,"isLowPriceAllowed");t(this,"publishedAt");t(this,"description");t(this,"percent");t(this,"owner");t(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=e!=null&&e.publishedAt?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 N(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 Ve 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 J 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)??Ce.Product,this.discount=e!=null&&e.discount?new je(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new Ve(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 xe{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class a extends P{}class Y extends D{constructor(e){super(e);t(this,"salesDirection",new a);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new a(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new xe(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class K extends Y{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 Cr extends fe{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 K(e.manager):void 0}}class X extends Cr{constructor(e){var s,i;super(e);t(this,"categories");t(this,"products");this.categories=(s=e==null?void 0:e.categories)==null?void 0:s.map(c=>new X(c)),this.products=(i=e==null?void 0:e.products)==null?void 0:i.map(c=>new J(c))}}class Qe extends D{}class B extends D{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new Qe(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class G{constructor(r){t(this,"property");t(this,"value");this.property=new B(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class Je extends P{}class we extends P{}class Pr extends P{}class H extends P{}class W extends P{constructor(e){super(e);t(this,"country",new H);e&&(this.country=new H(e.country))}}class Z extends P{constructor(e){super(e);t(this,"region",new W);e&&(this.region=new W(e.region))}}class Ye extends P{}class F extends D{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var A=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(A||{});class O extends P{static generatePersonItem(){return new O({id:1,guid:"",slug:A.Person,name:""})}}class Ke extends P{}class Xe extends P{}class d extends P{}class Ze extends P{}class De extends P{}class ve extends P{}class v extends y{getReference(r,e=!1){return this.getTypedDataArrayRequester(Je,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(we,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(Ye,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(F,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(d,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(O,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(Ke,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(Xe,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(Ze,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(De,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(a,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(ve,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(Z,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(W,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(H,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(M,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(x,"/public/references/warehouse",!0)}}var Fe=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.Guest="guest",n))(Fe||{});class Re extends D{constructor(e){super(e);t(this,"phone");t(this,"email");t(this,"getNews");t(this,"salesDirection");t(this,"createdAt");t(this,"lastLoginAt");t(this,"isActive");this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:(e==null?void 0:e.phone)??"",this.email=(e==null?void 0:e.email)??"",this.getNews=(e==null?void 0:e.getNews)??!1,this.salesDirection=e!=null&&e.salesDirection?new a(e.salesDirection):void 0,this.createdAt=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 Ee extends Re{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 er extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Ee(r.data))}}class rr{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 N(r.client):void 0,this.executor=r.executor?new N(r.executor):void 0,this.currency=r.currency?new F(r.currency):void 0}}class Ae{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 k(e)))}}class wr extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}}class Dr extends y{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(s=>new k(s)))}getCategoryData(r,e=!1,s=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:s},i=>new k(i.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new k(e.data))}getCategoryProductsList(r,e=!0,s=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:s,withPriceCoefficients:e},i=>h.map(i.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,i=>i.map(c=>new se(c))),s})}publicSimpleSearch(r,e=10){return new Promise((s,i)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{s(c.categories.map(l=>new k(l)))}).catch(c=>{i(c)})})}}class vr extends y{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 se(s)))}getProductPriceHistory(r,e){const s={};return h.isNil(e)||(s.clientId=e),this.get(`/internal/price/products/${r}/history`,s,i=>h.map(i.data,c=>new rr(c)))}publicSimpleSearch(r,e=10){return new Promise((s,i)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{s(c.products.map(l=>new T(l)))}).catch(c=>{i(c)})})}}class Rr extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},s=>s.data.map(i=>new X(i)))}getCategoryData(r,e,s=!1,i=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:s,withNestedCategories:i},c=>new X(c.data))}getCategoryProductsList(r,e,s=!0,i=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:i,withPriceCoefficients:s},c=>h.map(c.data,l=>new J(l)))}}class Ar extends y{getProductData(r,e,s=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:s},i=>new J(i.data))}}class ce extends y{getPaginated(r,e,s,i,c,l){const p={page:(i==null?void 0:i.page)??1,per_page:(i==null?void 0:i.pageSize)??(i==null?void 0:i.perPage)??10};return e&&(p.filters=JSON.stringify(e)),h.isEmpty(s)||(h.isArray(s)?s:[s]).forEach((C,w)=>{p[`sort[${w}][field]`]=C.field,p[`sort[${w}][direction]`]=C.direction}),this.get(r,p,c,l)}}class Sr extends ce{getProperties(r,e,s){return this.getPaginated("/internal/catalog/properties",r,e,s,i=>{const c={...i.data};return c.data=c.data.map(l=>new B(l)),c})}createProperty(r){const{typeId:e,...s}=r;return this.post("/internal/catalog/properties",{...s,type:e},i=>new B(i.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new B(e.data))}updateProperty(r,e){const{typeId:s,...i}=e;return this.patch(`/internal/catalog/properties/${r}`,{...i,type:s},c=>new B(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 G(s)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},s=>new G(s.data))}updateProductProperty(r,e,s){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:s},i=>new G(i.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 G(s)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},s=>new G(s.data))}updateCategoryProperty(r,e,s){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:s},i=>new G(i.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 ar extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Ae(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Ae(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 tr=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n))(tr||{});class ue extends q{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new F);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new F(e.currency))}}class le extends D{constructor(e){super(e);t(this,"phone");t(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class U extends le{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 Se extends D{constructor(e){super(e);t(this,"manager",new Y);t(this,"opf",O.generatePersonItem());t(this,"salesDirection",new a);t(this,"partnerGroup",new d);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 O(e.opf),this.salesDirection=new a(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 N(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 N(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new d(e.partnerGroup)),e.manager&&(this.manager=new Y(e.manager)),e.contacts){const s=[];e.contacts.forEach(i=>{s.push(new U(i))}),this.contacts=s}if(e.bankAccounts){const s=[];e.bankAccounts.forEach(i=>{s.push(new ue(i))}),this.bankAccounts=s}}}}class sr extends Se{constructor(r){super(r)}}class ae extends Se{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 Te extends ae{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class ir extends Te{constructor(e){super(e);t(this,"registrationCountry",new H);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new H(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class E{static createInstance(r){switch(r.opf.slug){case A.Ic:return new ae(r);case A.UlR:return new Te(r);case A.UlNr:return new ir(r);default:return new sr(r)}}}class pe extends Re{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 a(e==null?void 0:e.salesDirection),this.debt=(e==null?void 0:e.debt)??0,this.alternativeName=(e==null?void 0:e.alternativeName)??"",this.city=new Z(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(i=>new Y(i)))??[]}}class he extends q{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class nr extends U{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(s=>new he(s))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(s=>new he(s))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(s=>new he(s))))}}class ee extends ze{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 ye(e==null?void 0:e.coordinates),this.contacts=((s=e==null?void 0:e.contacts)==null?void 0:s.map(i=>new U(i)))??[],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 be extends pe{constructor(e){var s,i,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=>E.createInstance(p)))??[],this.partnerGroups=((i=e==null?void 0:e.partnerGroups)==null?void 0:i.map(p=>new d(p)))??[],this.contacts=((c=e==null?void 0:e.contacts)==null?void 0:c.map(p=>new U(p)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(p=>new ee(p)))??[],this.channelPrimaryInterest=new we(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new ve(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new M(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 x(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class Tr{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,i,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 Z(r==null?void 0:r.city),this.region=new W(r==null?void 0:r.region),this.country=new H(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:((i=r==null?void 0:r.lastLoginDate)==null?void 0:i.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(w=>new K(w)):[],this.salesDirection=new a(r==null?void 0:r.salesDirection),this.contragentInn=(r==null?void 0:r.contragentInn)??"",this.contragentType=new O(r==null?void 0:r.contragentType),this.preferredDeliveryType=new M(r==null?void 0:r.preferredDeliveryType),this.hasCostLessThenStop=r!=null&&r.hasCostLessThenStop?!0:void 0,this.partnerGroup=new d(r==null?void 0:r.partnerGroup),this.contact=new le(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 Z;break;case"region":this.region=new W;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirection":this.salesDirection=new a;break;case"contragentType":this.contragentType=new O;break;case"preferredDeliveryType":this.preferredDeliveryType=new M;break;case"partnerGroup":this.partnerGroup=new d;break;case"hasCostLessThenStop":this.hasCostLessThenStop=void 0;break;case"contact":this.contact=new le;break}return this}asClearRaw(){var e,s,i,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,!((i=r==null?void 0:r.lastLoginDate)!=null&&i.from)&&!((c=r==null?void 0:r.lastLoginDate)!=null&&c.to)&&delete r.lastLoginDate,r}}class $e extends q{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 N(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class _e extends $e{constructor(e){var s,i,c,l,p,C,w,S;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 pe(e==null?void 0:e.client),this.payment={type:((s=e==null?void 0:e.payment)==null?void 0:s.type)??-1,status:((i=e==null?void 0:e.payment)==null?void 0:i.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:(w=e==null?void 0:e.delivery)!=null&&w.address?new ee(e.delivery.address):void 0,warehouse:(S=e==null?void 0:e.delivery)!=null&&S.warehouse?new x(e.delivery.warehouse):void 0},this.attachedUser=new N(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new a(e==null?void 0:e.salesDirection),this.pendingAt=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 or extends q{constructor(e){super(e);t(this,"product");t(this,"quantity");t(this,"currency");t(this,"costOne");t(this,"costOneRub");t(this,"cost");t(this,"costRub");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"configurator");t(this,"configuratorParams");t(this,"sawing");this.product=new J(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 cr extends _e{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 or(s)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?E.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class br extends ce{getOrders(r,e,s){return this.getPaginated("/internal/orders",r,e?[e]:void 0,s,i=>{const c={...i.data};return c.data=c.data.map(l=>new _e(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 cr(e.data))}}class ur extends D{constructor(e){var s,i;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 U(c))),e.lastOrder&&(this.lastOrder=new $e(e.lastOrder)),(i=e.partnerGroups)!=null&&i.length&&(this.partnerGroups=e.partnerGroups.map(c=>new d(c))),e.preferredDeliveryType&&(this.preferredDeliveryType=new M(e.preferredDeliveryType))}}var Ie=(n=>(n.BeginWith="bw",n.Contains="cn",n.Custom="custom",n.EndsWith="ew",n.Equals="eq",n.GreaterOrEqual="ge",n.GreaterThan="gt",n.InList="in",n.LessOrEqual="le",n.LessThan="lt",n.NotBeginWith="bn",n.NotContains="nc",n.NotEndsWith="en",n.NotEqual="ne",n.NotInList="ni",n.NotNull="nn",n.Null="nu",n))(Ie||{});class lr{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 lr{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 _r{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 Ir extends ce{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new be(e.data))}getClientsList(r,e,s){return this.getPaginated("/internal/clients",r,e,s,i=>{const c={...i.data};return c.data=c.data.map(l=>new pe(l)),c})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Ie.Contains,value:r}]})}getAdditionalClientsData(r,e){return this.post("/internal/clients/additional-data",{clients:r,requested_data_types:e},s=>{let i=[];return(s==null?void 0:s.data.length)>0&&(i=s.data.map(c=>new ur(c))),i})}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(i=>new nr(i))),s})}createClientCommonData(r,e={}){var s;return this.post("/internal/clients",{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(i=>i.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},i=>new be(i.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(i=>i.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,i={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:s},void 0,i)}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(i=>this.patch(`/internal/clients/${r}/managers/${i.id}/attach`,{is_primary:i.isDefault}));await Promise.all(s)}async detachClientFromManagers(r,e){const s=e.map(i=>this.patch(`/internal/clients/${r}/managers/${i.id}/detach`));await Promise.all(s)}createContragentClientData(r,e,s={}){var C,w,S,$,_,I,u,m;let i;const c=e,l=e,p=e;switch(e.opf.slug){case A.Ic:i={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(w=c.manager)==null?void 0:w.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case A.UlR:i={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:(S=l.partnerGroup)==null?void 0:S.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:i={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(_=p.partnerGroup)==null?void 0:_.id,manager_id:(I=p.manager)==null?void 0:I.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:i={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(u=e.partnerGroup)==null?void 0:u.id,manager_id:(m=e.manager)==null?void 0:m.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,i,Ne=>E.createInstance(Ne.data),s)}updateContragentClientData(r,e,s={}){var C,w,S,$,_,I,u,m;let i;const c=e,l=e,p=e;switch(e.opf.slug){case A.Ic:i={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(w=c.manager)==null?void 0:w.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case A.UlR:i={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:(S=l.partnerGroup)==null?void 0:S.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:i={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(_=p.partnerGroup)==null?void 0:_.id,manager_id:(I=p.manager)==null?void 0:I.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:i={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(u=e.partnerGroup)==null?void 0:u.id,manager_id:(m=e.manager)==null?void 0:m.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,i,Ne=>E.createInstance(Ne.data),s)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,s={}){var c,l;const i={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.coordinates&&(i.coordinates={lat:(c=e.coordinates)==null?void 0:c.lat,long:(l=e.coordinates)==null?void 0:l.long}),e.operatingHours&&(i.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),this.post(`/internal/clients/${r}/delivery-addresses`,i,p=>new ee(p.data),s)}updateClientDeliveryAddress(r,e,s={}){var c,l;const i={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.operatingHours&&(i.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),e.coordinates&&(i.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}`,i,p=>new ee(p.data),s)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,s,i={}){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 ue(c.data),i)}updateContragentBankAccount(r,e,s,i={}){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 ue(c.data),i)}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},i=>new U(i.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,i={}){return this.createContact(r,s,{contragents:[{id:e,is_primary:s.isPrimary??!1,not_disturb:s.notDisturb??!1}]},i)}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,i={}){return this.createContact(r,s,{addresses:[{id:e,is_primary:s.isPrimary??!1,not_disturb:s.notDisturb??!1}]},i)}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,i={}){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 U(C.data),i)}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 Lr extends y{checkPhoneIsBusy(r){return new Promise((e,s)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(i=>{e(!!i.isBusy)}).catch(s)})}}class kr extends y{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 i=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 i.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,s)}),i}createTemplate(r,e,s={}){var i;return this.post(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.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 Nr{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 V=class V{static setLinearValues(r){V.linearValues=r}static productIsMeasurable(r){return V.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,s;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)&&!V.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,s,i;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((s=r.properties)!=null&&s.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)?r.properties.minCount:.01}};t(V,"linearValues",["пог.м.","м.","м2"]);let Le=V;class Or{static generateUndefinedManagerInstance(){return new K({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class pr extends y{getManagers(){const r="/internal/managers",e=y.getCachedResponse(r);return e?Promise.resolve(e):this.get(r).then(s=>{const i=s.data.map(c=>ie.instanceInitializer(K,c));return i&&this.cacheResponse(r,i),i})}}class hr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class ke{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");var e;this.resourceType=new De(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(s=>new hr(s)))??[]}}class dr extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},s=>new ke(s.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,s=>new ke(s.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const R=re.defineStore("__references_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0),s=f.ref(void 0),i=f.ref(void 0),c=f.ref(void 0),l=f.ref(void 0),p=f.ref(void 0),C=f.ref(void 0),w=f.ref(void 0),S=f.ref(void 0),$=f.ref(void 0),_=f.ref(void 0),I=f.ref(void 0),u=f.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:s,deliveryTypeReference:i,managersList:c,opfReference:l,orderPaymentStatusReference:p,orderStatusReference:C,paymentTypeReference:w,partnerGroupReference:S,resourceTypesReference:$,salesDirectionsReference:_,sourcePrimaryInterestReference:I,warehousesReference:u}}),Ur=re.defineStore("references",()=>{const n=f.computed(()=>{const u=R();return!u.channelPrimaryInterestReference&&!u.dataLoaderList.channelPrimaryInterestReference&&(u.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(v).getChannelPrimaryInterest().then(m=>{u.channelPrimaryInterestReference=m}).catch(h.noop)),u.channelPrimaryInterestReference}),r=f.computed(()=>{const u=R();return!u.contactPositionsReference&&!u.dataLoaderList.contactPositionsReference&&(u.dataLoaderList.contactPositionsReference=!0,y.getInstance(v).getContactPositions().then(m=>{u.contactPositionsReference=m}).catch(h.noop)),u.contactPositionsReference}),e=f.computed(()=>{const u=R();return!u.currencyReference&&!u.dataLoaderList.currencyReference&&(u.dataLoaderList.currencyReference=!0,y.getInstance(v).getCurrency().then(m=>{u.currencyReference=m}).catch(h.noop)),u.currencyReference}),s=f.computed(()=>{const u=R();return!u.opfReference&&!u.dataLoaderList.opfReference&&(u.dataLoaderList.opfReference=!0,y.getInstance(v).getOpf().then(m=>{u.opfReference=m}).catch(h.noop)),u.opfReference}),i=f.computed(()=>{const u=R();return!u.orderPaymentStatusReference&&!u.dataLoaderList.orderPaymentStatusReference&&(u.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(v).getOrderPaymentStatuses().then(m=>{u.orderPaymentStatusReference=m}).catch(h.noop)),u.orderPaymentStatusReference}),c=f.computed(()=>{const u=R();return!u.orderStatusReference&&!u.dataLoaderList.orderStatusReference&&(u.dataLoaderList.orderStatusReference=!0,y.getInstance(v).getOrderStatuses().then(m=>{u.orderStatusReference=m}).catch(h.noop)),u.orderStatusReference}),l=f.computed(()=>{const u=R();return!u.paymentTypeReference&&!u.dataLoaderList.paymentTypeReference&&(u.dataLoaderList.paymentTypeReference=!0,y.getInstance(v).getPaymentTypes().then(m=>{u.paymentTypeReference=m}).catch(h.noop)),u.paymentTypeReference}),p=f.computed(()=>{const u=R();return!u.partnerGroupReference&&!u.dataLoaderList.partnerGroupReference&&(u.dataLoaderList.partnerGroupReference=!0,y.getInstance(v).getPartnerGroup().then(m=>{u.partnerGroupReference=m}).catch(h.noop)),u.partnerGroupReference}),C=f.computed(()=>{const u=R();return!u.resourceTypesReference&&!u.dataLoaderList.resourceTypesReference&&(u.dataLoaderList.resourceTypesReference=!0,y.getInstance(v).getResourceTypes().then(m=>{u.resourceTypesReference=m}).catch(h.noop)),u.resourceTypesReference}),w=f.computed(()=>{const u=R();return!u.salesDirectionsReference&&!u.dataLoaderList.salesDirectionsReference&&(u.dataLoaderList.salesDirectionsReference=!0,y.getInstance(v).getSalesDirections().then(m=>{u.salesDirectionsReference=m}).catch(h.noop)),u.salesDirectionsReference}),S=f.computed(()=>{const u=R();return!u.sourcePrimaryInterestReference&&!u.dataLoaderList.sourcePrimaryInterestReference&&(u.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(v).getSourcePrimaryInterest().then(m=>{u.sourcePrimaryInterestReference=m}).catch(h.noop)),u.sourcePrimaryInterestReference}),$=f.computed(()=>{const u=R();return!u.deliveryTypeReference&&!u.dataLoaderList.deliveryTypeReference&&(u.dataLoaderList.deliveryTypeReference=!0,y.getInstance(v).getDeliveryTypes().then(m=>{u.deliveryTypeReference=m}).catch(h.noop)),u.deliveryTypeReference}),_=f.computed(()=>{const u=R();return!u.managersList&&!u.dataLoaderList.managersList&&(u.dataLoaderList.managersList=!0,y.getInstance(pr).getManagers().then(m=>{u.managersList=m}).catch(h.noop)),u.managersList}),I=f.computed(()=>{const u=R();return!u.warehousesReference&&!u.dataLoaderList.warehousesReference&&(u.dataLoaderList.warehousesReference=!0,y.getInstance(v).getWarehouses().then(m=>{u.warehousesReference=m}).catch(h.noop)),u.warehousesReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:s,orderPaymentStatusReference:i,orderStatusReference:c,paymentTypeReference:l,partnerGroupsReference:p,resourceTypesReference:C,salesDirectionsReference:w,sourcePrimaryInterestsReference:S,deliveryTypeReference:$,managersList:_,warehousesReference:I}}),qr=re.defineStore("__user_state_private",()=>{const n=f.ref({}),r=f.ref(void 0);return{dataLoaderList:n,currentUser:r}}),Mr=re.defineStore("user_state",()=>({currentUser:f.computed(()=>{const r=qr();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,y.getInstance(er).getCurrentUser().then(e=>{r.currentUser=e}).catch(h.noop).finally(h.noop)),r.currentUser})}));class Gr extends y{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(s=>{const i=[...s];let c=1;return i.forEach(l=>{l.id=c++}),i})}}class Hr{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}o.AnyReference=Je,o.AppBaseConfig=mr,o.AppConfigProvider=L,o.BankAccount=ue,o.BasePaginationProvider=ce,o.Cart=Q,o.CartItem=Me,o.CartItemBase=qe,o.CartProvider=fr,o.CatalogProvider=wr,o.CatalogableItem=me,o.Category=k,o.ChannelPrimaryInterest=we,o.City=Pr,o.CityWithRegionAndCountry=Z,o.Client=be,o.ClientAdditionalData=ur,o.ClientCategory=X,o.ClientDataProvider=Ir,o.ClientProduct=J,o.ClientProductCategoryDataProvider=Rr,o.ClientProductDataProvider=Ar,o.ClientShortInfo=pe,o.ClientsAdditionalDataRequestTypeEnum=tr,o.ClientsListFilters=Tr,o.ConfiguratorProvider=kr,o.Contact=le,o.ContactLinks=xe,o.ContactPerson=U,o.ContactPersonRelated=nr,o.ContactPosition=Ye,o.ContactRelation=he,o.ContragentBase=Se,o.ContragentFactory=E,o.ContragentIc=ae,o.ContragentPerson=sr,o.ContragentUlNr=ir,o.ContragentUlR=Te,o.CostSourceEnum=Ce,o.Country=H,o.Currency=F,o.DataSuggestionProvider=Gr,o.DataTablePagination=$r,o.DataTablePaginationRequestParams=lr,o.DataTableSortRequestParams=_r,o.DateTimeProvider=Nr,o.DeletableNamedIdentity=ze,o.DeliveryAddress=ee,o.DeliveryType=M,o.DeviceTypeResolutionConfig=Ge,o.DiscountShortInfo=je,o.FieldValidationResultData=Hr,o.FilterOpEnum=Ie,o.GeoCoordinates=ye,o.HiddenCatalogableItem=de,o.HttpBaseCachedRequester=oe,o.HttpBaseRequester=ne,o.HttpParamsConfig=He,o.HttpRequester=y,o.Identity=q,o.Image=Ue,o.Manager=K,o.ManagerCommon=Y,o.ManagerDataFactory=Or,o.ManagerDataProvider=pr,o.MetaTagItem=hr,o.NamedIdentity=D,o.Opf=O,o.OpfEnum=A,o.Order=cr,o.OrderInfo=_e,o.OrderPaymentStatus=Ke,o.OrderProduct=or,o.OrderShortInfo=$e,o.OrderStatus=Xe,o.OrdersDataProvider=br,o.PartnerGroup=d,o.PaymentType=Ze,o.PreferencesStorageProvider=yr,o.PriceCoefficient=se,o.PriceTemplate=Ve,o.PrimaryCatalogableItem=te,o.Product=T,o.ProductCategoryDataProvider=Dr,o.ProductDataProvider=vr,o.ProductPriceHistory=rr,o.PropertiesProvider=Sr,o.Property=B,o.PropertyType=Qe,o.PropertyValue=G,o.RecommendationsDataProvider=ar,o.RecommendationsList=Ae,o.Reference=P,o.ReferenceDataProvider=v,o.Region=W,o.ResourceType=De,o.SalesDirection=a,o.SentryConfig=Be,o.Seo=ke,o.SeoDataProvider=dr,o.SourcePrimaryInterest=ve,o.StockCount=Oe,o.TypedInstanceFactory=ie,o.UnitsHelper=Le,o.UnknownClientDataProvider=Lr,o.UpdatableNamedIdentity=Pe,o.User=Ee,o.UserCommonInfo=Re,o.UserDataProvider=er,o.UserShortInfo=N,o.UserTypeEnum=Fe,o.VersionConfig=We,o.Warehouse=x,o.useReferencesStore=Ur,o.useUserStateStore=Mr,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=sc-common-lib.umd.cjs.map
|