@snabcentr/common-lib 2.8.3 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +2 -4
- package/dist/sc-common-lib.js +1911 -1611
- package/dist/sc-common-lib.js.map +1 -1
- package/dist/sc-common-lib.umd.cjs +1 -1
- package/dist/sc-common-lib.umd.cjs.map +1 -1
- package/dist/src/clients/classes/clients-list-filters.d.ts +4 -0
- package/dist/src/clients/classes/clients-list-filters.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-clients-list-filters.d.ts +4 -0
- package/dist/src/clients/interfaces/i-clients-list-filters.d.ts.map +1 -1
- package/dist/src/data-table/classes/filter-item.d.ts +3 -2
- package/dist/src/data-table/classes/filter-item.d.ts.map +1 -1
- package/dist/src/data-table/interfaces/i-filter-item.d.ts +2 -1
- package/dist/src/data-table/interfaces/i-filter-item.d.ts.map +1 -1
- package/dist/src/data-table/interfaces/i-filter-range-value.d.ts +17 -0
- package/dist/src/data-table/interfaces/i-filter-range-value.d.ts.map +1 -0
- package/dist/src/data-table/interfaces/index.d.ts +1 -0
- package/dist/src/data-table/interfaces/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/offers/classes/index.d.ts +4 -0
- package/dist/src/offers/classes/index.d.ts.map +1 -0
- package/dist/src/offers/classes/offer-short-info.d.ts +31 -0
- package/dist/src/offers/classes/offer-short-info.d.ts.map +1 -0
- package/dist/src/offers/classes/offer.d.ts +23 -0
- package/dist/src/offers/classes/offer.d.ts.map +1 -0
- package/dist/src/offers/classes/offers-list-filters.d.ts +39 -0
- package/dist/src/offers/classes/offers-list-filters.d.ts.map +1 -0
- package/dist/src/offers/index.d.ts +4 -0
- package/dist/src/offers/index.d.ts.map +1 -0
- package/dist/src/offers/interfaces/i-offer-send-data.d.ts +19 -0
- package/dist/src/offers/interfaces/i-offer-send-data.d.ts.map +1 -0
- package/dist/src/offers/interfaces/i-offer-short-info.d.ts +24 -0
- package/dist/src/offers/interfaces/i-offer-short-info.d.ts.map +1 -0
- package/dist/src/offers/interfaces/i-offer.d.ts +16 -0
- package/dist/src/offers/interfaces/i-offer.d.ts.map +1 -0
- package/dist/src/offers/interfaces/i-offers-list-filters.d.ts +24 -0
- package/dist/src/offers/interfaces/i-offers-list-filters.d.ts.map +1 -0
- package/dist/src/offers/interfaces/index.d.ts +5 -0
- package/dist/src/offers/interfaces/index.d.ts.map +1 -0
- package/dist/src/offers/providers/index.d.ts +2 -0
- package/dist/src/offers/providers/index.d.ts.map +1 -0
- package/dist/src/offers/providers/offers-data-provider.d.ts +130 -0
- package/dist/src/offers/providers/offers-data-provider.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(c,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("pinia"),require("vue"),require("date-fns"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","pinia","vue","date-fns","axios"],I):(c=typeof globalThis<"u"?globalThis:c||self,I(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c.pinia,c.vue,c["date-fns"],c.axios))})(this,function(c,I,u,ue,F,g,m,yr){"use strict";var jt=Object.defineProperty;var Mt=(c,I,u)=>I in c?jt(c,I,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[I]=u;var t=(c,I,u)=>Mt(c,typeof I!="symbol"?I+"":I,u);class H{constructor(r){t(this,"exp",0);t(this,"iat",0);t(this,"authTime",0);t(this,"jti","");t(this,"iss","");t(this,"aud",[]);t(this,"sub","");t(this,"typ","Bearer");t(this,"azp","");t(this,"sid","");t(this,"acr","");t(this,"allowedOrigins",[]);t(this,"realmAccess",{roles:[]});t(this,"resourceAccess",{});t(this,"scope","");t(this,"emailVerified",!1);t(this,"name","");t(this,"guid","");t(this,"preferredUsername","");t(this,"givenName","");t(this,"email","");u.merge(this,r)}static getJwtPayload(r){const e=I.jwtDecode(r),i=new H(ue.objectToCamel(e));return i.resourceAccess=e.resource_access,i}}class xr extends H{constructor(e){super(e);t(this,"familyName");t(this,"middleName");t(this,"locale");t(this,"phoneNumber");t(this,"phoneNumberVerified");t(this,"address");u.merge(this,e)}static getJwtPayload(e){return new H(ue.objectToCamel(I.jwtDecode(e)))}}class ar{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 wr{constructor(r){t(this,"portalApiUrl");t(this,"mediaUrl");t(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class Cr{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,i,s,o;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|404|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((i=r==null?void 0:r.trace)==null?void 0:i.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((s=r==null?void 0:r.replay)==null?void 0:s.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((o=r==null?void 0:r.replay)==null?void 0:o.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class vr{constructor(r){t(this,"broadcaster");t(this,"key");t(this,"wsHost");t(this,"wsPort");t(this,"wssPort");t(this,"forceTLS");t(this,"enabledTransports");this.broadcaster=r.broadcaster??"reverb",this.key=r.key??"",this.wsHost=r.wsHost??"",this.wsPort=r.wsPort??8080,this.wssPort=r.wssPort??8080,this.forceTLS=r.forceTLS??!1,this.enabledTransports=r.enabledTransports??["wss"]}}class Pr{constructor(r){t(this,"environment");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"sentry");t(this,"tableDefaultHeightCoefficient");t(this,"urls");t(this,"websocket");t(this,"dateFormats");var e,i,s;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new wr(r==null?void 0:r.http),this.deviceTypeByResolution=new ar(r==null?void 0:r.deviceTypeByResolution),this.sentry=new Cr({environment:this.environment,...r==null?void 0:r.sentry}),this.tableDefaultHeightCoefficient=(r==null?void 0:r.tableDefaultHeightCoefficient)??.7,this.urls=r==null?void 0:r.urls,this.websocket=r!=null&&r.websocket?new vr(r.websocket):void 0,this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((i=r==null?void 0:r.dateFormats)==null?void 0:i.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}const b=F.defineStore("common.config",()=>{const n=g.ref(new Pr);return{config:n,getConfig:()=>n.value,setConfig:i=>{n.value=u.merge(n.value,i)}}});class pe{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const i=JSON.parse(e);if(!i.availableFor||m.isAfter(m.parseISO(i.availableFor)||m.startOfToday(),new Date)){if(u.isNil(i.data)||u.isEmpty(i.data))throw new Error("Data is empty");return i.data}}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,i){if(this.isLocalStorageAvailable())try{if(u.isNil(e)||u.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:i,data:e});localStorage.setItem(r,s)}catch(s){if(s instanceof DOMException&&s.code===DOMException.QUOTA_EXCEEDED_ERR){this.clearOldData();try{const o=JSON.stringify({availableFor:i,data:e});localStorage.setItem(r,o)}catch{}}else try{localStorage.removeItem(r)}catch{}}}static isLocalStorageAvailable(){try{const r="__localStorage_test__";return localStorage.setItem(r,"test"),localStorage.removeItem(r),!0}catch{return!1}}static clearOldData(){try{const r=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);if(i)try{const s=localStorage.getItem(i);if(s){const o=JSON.parse(s);o.availableFor&&!m.isAfter(m.parseISO(o.availableFor)||m.startOfToday(),new Date)&&r.push(i)}}catch{r.push(i)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function Rr(n){try{const r=H.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const Y=F.defineStore("common.auth_state_private",()=>{const n=g.ref((()=>{var h;const o=pe.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const l=(h=b().config.devMode)==null?void 0:h.initAuthBearerToken;return l?Promise.resolve(l):void 0})()),r=g.ref(void 0),e=g.ref(void 0),i=g.markRaw(new Map);function s(){e.value=void 0,u.isNil(n.value)||n.value.then(o=>{const l=H.getJwtPayload(o);e.value=l.exp*1e3>Date.now()?u.mapValues(l.resourceAccess,h=>(h==null?void 0:h.roles)??[]):void 0}).catch(u.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:i,recalculateUserPermissions:s}}),Pe=F.defineStore("common.auth_state",()=>{const n=g.computed(()=>{const o=Y();if(u.isNil(o.jwtToken)&&!u.isNil(o.jwtTokenUpdater)){const l=o.jwtTokenUpdater();o.jwtToken=l,l.then(h=>{o.jwtToken=Promise.resolve(h),pe.saveActualDataToStorage("sc.token",h,Rr(h)),o.recalculateUserPermissions()}).catch(u.noop)}return o.jwtToken});function r(o){Y().jwtTokenUpdater=o}function e(o){const l=Y();l.jwtToken=Promise.resolve(o),pe.saveActualDataToStorage("sc.token",o,Rr(o)),l.recalculateUserPermissions()}function i(){const o=Y();o.jwtToken=void 0,o.userPermissions=void 0,pe.saveActualDataToStorage("sc.token",void 0)}function s(o){const l=Y();!u.isNil(l.jwtToken)&&u.isNil(l.userPermissions)&&l.jwtToken.then(w=>{const v=H.getJwtPayload(w);l.userPermissions=v.exp*1e3>Date.now()?u.mapValues(v.resourceAccess,R=>(R==null?void 0:R.roles)??[]):void 0}).catch(u.noop);const h=u.isArray(o)?o.join(" && "):o;if(l.userPermissionsComputedRefs.has(h))return l.userPermissionsComputedRefs.get(h);const y=g.computed(()=>{const w=v=>{var le;const R=u.split(v,".");if(R.length<2)return!1;const[Ce,ve]=R,ce=(le=Y().userPermissions)==null?void 0:le[Ce];return u.isArray(ce)&&ce.includes(ve)};return u.isArray(o)?u.every(o,v=>w(v)):w(o)});return l.userPermissionsComputedRefs.set(h,y),y}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:i,hasUserPermission:s}});class z{constructor(r,e){t(this,"id");t(this,"guid");this.id=r==null?void 0:r.id,u.isNil(this.id)&&(u.isNil(e)?typeof(r==null?void 0:r.id)=="number"?this.id=-1:typeof(r==null?void 0:r.id)=="string"&&(this.id=""):this.id=e),this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return typeof this.id=="number"?this.id===-1:typeof this.id=="string"?this.id==="":u.isNil(this.id)}}class S extends z{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class X extends S{constructor(e){super(e);t(this,"code","");this.code=(e==null?void 0:e.code)??""}}class C extends S{constructor(e){super(e);t(this,"slug");t(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class Ne extends S{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=u.isString(e==null?void 0:e.updatedAt)?m.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class Ue extends Ne{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?m.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class Dr{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 He extends X{constructor(e){super(e);t(this,"slug");t(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class Ar extends He{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Re extends He{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class De{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}class d extends S{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class Sr extends S{constructor(e){super(e);t(this,"costCoefficient");t(this,"isLowPriceAllowed");t(this,"publishedAt");t(this,"description");t(this,"percent");t(this,"owner");t(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=u.isString(e==null?void 0:e.publishedAt)?m.parseISO(e.publishedAt):e==null?void 0:e.publishedAt,this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new d(e==null?void 0:e.owner),this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?m.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class W extends Ne{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}var je=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(je||{});class he extends C{static getRetailPriceCoefficient(){return{id:-2,slug:je.Retail,name:"Розн. цена",guid:"",isNewRec:u.constant(!0)}}}class Ae{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new he(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class Me{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 q extends C{}class Z extends C{constructor(e){var i;super(e);t(this,"address");t(this,"isMain");t(this,"deliveryTypes");t(this,"regions");t(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((i=e==null?void 0:e.deliveryTypes)==null?void 0:i.map(s=>new q(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Me(e==null?void 0:e.coordinates)}}class Tr{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new Z(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class L extends S{constructor(e){super(e);t(this,"signature","");t(this,"code");t(this,"symbol","");t(this,"precision");e&&(this.signature=e.signature??"",this.code=e.code,this.symbol=e.symbol??"",this.precision=e.precision)}}class Be extends S{constructor(e){super(e);t(this,"slug","");t(this,"description");t(this,"isSquare",!1);t(this,"isLinear",!1);e&&(this.slug=e.slug??"",this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}}class k extends Ar{constructor(e){var s,o,l,h;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");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,"retailCost");t(this,"retailCostRub");t(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=e!=null&&e.unit?new Be(e.unit):new Be,this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.currency=e!=null&&e.currency?new L(e.currency):new L,this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=u.isString(e==null?void 0:e.costDate)?m.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((s=e==null?void 0:e.stockCount)==null?void 0:s.map(y=>new Tr(y)))??[],this.type="product";const i=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(y=>y.isPrimary));i&&(this.category=new Re({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(y=>new Re(y))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(y=>new Dr(y,b().config.http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.retailCost=e==null?void 0:e.retailCost,this.retailCostRub=e==null?void 0:e.retailCostRub,this.priceCoefficients=((h=e==null?void 0:e.priceCoefficients)==null?void 0:h.map(y=>new Ae(y)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}var Se=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Se||{});class j extends k{constructor(e){super(e);t(this,"costCoefficient");t(this,"costSource");t(this,"discount");t(this,"priceTemplate");t(this,"isPreviouslyOrdered");t(this,"isRequired");t(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??Se.Product,this.discount=e!=null&&e.discount?new Sr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new W(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 ge extends Re{constructor(e){super(e);t(this,"isHidden");t(this,"parentCategoryId");t(this,"properties");t(this,"currencyRates");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category",this.currencyRates=e!=null&&e.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([i,s])=>[u.toUpper(i),s])):void 0}}class Ge extends z{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"currency");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");t(this,"creator");t(this,"isRemoved");t(this,"ord");t(this,"onOrder");t(this,"originalId");t(this,"replacementId");this.product=new j(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new ge,this.currency=e.currency?new L(e.currency):void 0,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&u.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale,this.creator=e.creator&&new d(e.creator),this.isRemoved=e.isRemoved,this.ord=e.ord,this.onOrder=e.onOrder,this.originalId=e.originalId,this.replacementId=e.replacementId}}let Er=class extends Ge{constructor(e){super(e);t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");t(this,"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=u.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new L(e.currency)}};class x{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new Er(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}const P=class P{constructor(){t(this,"httpClient");t(this,"baseUrl",`${b().config.http.portalApiUrl}/api`);t(this,"errorResponseHandler",u.noop);t(this,"interceptorIds",{request:{},response:{}});t(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));t(this,"authRequestInterceptor",async r=>{let e;return u.isNil(Pe().jwtToken)||(e=await Pe().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});t(this,"userRequestHooksInterceptor",async r=>P.requestHooks.reduce(async(e,i)=>i(await e),Promise.resolve(r)));t(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=ue.objectToSnake(r.params)),["put","patch","post"].includes(u.toLower(r.method))&&r.data&&(r.data=ue.objectToSnake(r.data))),r));t(this,"authErrorsResponseInterceptors",r=>{var i;const e=r.rawError?(i=r.rawError)==null?void 0:i.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(Pe().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});t(this,"canceledResponseInterceptor",r=>{const e=r.rawError??r;if(e.name==="CanceledError"||e.code==="ERR_CANCELED")throw new yr.CanceledError("Request canceled");return Promise.reject(r)});t(this,"userResponseHooksInterceptor",async r=>P.responseHooks.reduce(async(e,i)=>i(await e),Promise.resolve(r)));t(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=ue.objectToCamel(r.data)),r));this.errorResponseHandler=P.defaultErrorsResponseHandler,this.httpClient=yr.create({headers:{Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.userRequestHooksInterceptor=this.httpClient.interceptors.request.use(this.userRequestHooksInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,r=>P.convertHttpErrorResponse(r)),this.interceptorIds.response.canceledResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.canceledResponseInterceptor),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.userResponseHooksInterceptor=this.httpClient.interceptors.response.use(this.userResponseHooksInterceptor,r=>Promise.reject(r))}static setDefaultErrorsResponseHandler(r){P.defaultErrorsResponseHandler=r}static addRequestHook(r){P.requestHooks.includes(r)||P.requestHooks.push(r)}static removeRequestHook(r){const e=P.requestHooks.indexOf(r);e!==-1&&P.requestHooks.splice(e,1)}static addResponseHook(r){P.responseHooks.includes(r)||P.responseHooks.push(r)}static removeResponseHook(r){const e=P.responseHooks.indexOf(r);e!==-1&&P.responseHooks.splice(e,1)}static getInstance(r){return Object.prototype.hasOwnProperty.call(P.instances,r.name)||(P.instances[r.name]=De.simpleInstanceInitializer(r)),P.instances[r.name]}static convertHttpErrorResponse(r){var e,i;if(u.isNil(r)||!u.isNil(r.request)||!u.isNil(r.response)){const s=u.isNil(r)?{}:r==null?void 0:r.response;return Promise.reject({status:(s==null?void 0:s.status)??0,statusText:(s==null?void 0:s.statusText)??"Unknown",message:((e=s==null?void 0:s.data)==null?void 0:e.message)??"Unknown Error. Probably network error.",errors:(i=s==null?void 0:s.data)==null?void 0:i.errors,headers:(s==null?void 0:s.headers)??{},data:s==null?void 0:s.data,rawError:r})}return Promise.reject(r)}request(r,e=void 0,i={},s=!1){const o=this.httpClient.request(r).then(l=>e?e(l):l.data);return o.catch(l=>{(l==null?void 0:l.name)!=="CanceledError"&&this.errorResponseHandler(l,i,s)}),o}get(r,e={},i=void 0,s=!1,o=void 0){return this.request({method:"GET",url:r,params:e,signal:o},i,{},s)}getBlob(r,e={},i=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},i,{},s)}patch(r,e={},i=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},i,s,o)}post(r,e={},i=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},i,s,o)}delete(r,e=void 0,i=!1){return this.request({method:"DELETE",url:r},e,{},i)}};t(P,"instances",{}),t(P,"defaultErrorsResponseHandler",u.noop),t(P,"requestHooks",[]),t(P,"responseHooks",[]);let f=P;class et extends f{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new x(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new x(s.data),i)}patchCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new x(s.data),i)}deleteCartItem(r,e){return this.delete(`internal/clients/${r.id}/cart/${e.id}`,i=>new x(i.data))}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,i=>new x(i.data))}getCartItemFromCSVExample(r){return this.get(`internal/clients/${r.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:"text/csv"}))}}var $r=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))($r||{}),Ir=(n=>(n.Unknown="unknown",n.Bool="bool",n.Integer="integer",n.Float="float",n.String="string",n.Range="range",n.Json="json",n.Object="object",n))(Ir||{});class N extends ge{constructor(e){var i,s;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new N(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new k(o))}}class Fe{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class O extends C{}class Te extends S{constructor(e){super(e);t(this,"salesDirection");t(this,"photo");t(this,"contacts");t(this,"isDefault");t(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new O(e.salesDirection):new O,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new Fe(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class $e extends C{}class ze extends S{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class E extends Te{constructor(e){var i;super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");t(this,"pricingRole");t(this,"curatedDirections");this.isActive=(e==null?void 0:e.isActive)??!1,this.isSupervisor=(e==null?void 0:e.isSupervisor)??!1,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.createdAt=e==null?void 0:e.createdAt,this.supervisorId=e==null?void 0:e.supervisorId,this.pricingRole=e!=null&&e.pricingRole?new ze(e.pricingRole):void 0,this.curatedDirections=((i=e==null?void 0:e.curatedDirections)==null?void 0:i.map(s=>new $e(s)))??[]}}class rt extends ge{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 E(e.manager):void 0}}class me extends rt{constructor(e){var i,s;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new me(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new j(o))}}class We{constructor(r){t(this,"priceCoefficient");t(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new he(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class Ie extends We{constructor(e){super(e);t(this,"productCategory");this.productCategory=new ge(e==null?void 0:e.productCategory)}}class be extends S{constructor(e){super(e);t(this,"photo");t(this,"contacts");t(this,"curatedDirection");this.photo=e.photo,this.contacts=new Fe(e.contacts),this.curatedDirection=new $e(e.curatedDirection)}}class J extends C{}class ee extends C{constructor(e){super(e);t(this,"country",new J);e&&(this.country=new J(e.country))}}class fe extends C{constructor(e){super(e);t(this,"region",new ee);e&&(this.region=new ee(e.region))}}class Je extends S{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 O(e.salesDirection):void 0,this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=u.isString(e==null?void 0:e.lastLoginAt)?m.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class V extends Je{constructor(e){var i,s;super(e);t(this,"salesDirection");t(this,"debt");t(this,"alternativeName");t(this,"city");t(this,"comment");t(this,"isPhoneApproved");t(this,"isEmailApproved");t(this,"managers");t(this,"curators");this.salesDirection=new O(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 fe(e==null?void 0:e.city),this.comment=e==null?void 0:e.comment,this.isPhoneApproved=(e==null?void 0:e.isPhoneApproved)??!1,this.isEmailApproved=(e==null?void 0:e.isEmailApproved)??!1,this.managers=((i=e==null?void 0:e.managers)==null?void 0:i.map(o=>new Te(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new be(o)))??void 0}}class re extends z{constructor(e){super(e);t(this,"createdAt");t(this,"deletedAt");t(this,"client");t(this,"priceTemplate");this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?m.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new V(e==null?void 0:e.client),this.priceTemplate=new W(e==null?void 0:e.priceTemplate)}}class de extends We{constructor(e){super(e);t(this,"product");this.product=new k(e==null?void 0:e.product)}}class Ve extends C{}class te extends S{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new Ve(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class K{constructor(r){t(this,"property");t(this,"value");this.property=new te(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class T{constructor(r){t(this,"from");t(this,"to");this.from=u.isString(r==null?void 0:r.from)?m.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=u.isString(r==null?void 0:r.to)?m.parseISO(r.to):(r==null?void 0:r.to)??null}}class tt{constructor(r){t(this,"id");t(this,"name");t(this,"description");t(this,"createdAt",new T);t(this,"updatedAt",new T);this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.description=r==null?void 0:r.description,this.createdAt=new T(r==null?void 0:r.createdAt),this.updatedAt=new T(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":this[r]=void 0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"updatedAt":this.updatedAt.from=null,this.updatedAt.to=null;break}return this}asClearRaw(){var e,i,s,o;const r={};return Object.keys(this).forEach(l=>{const h=this[l];u.isNil(h)||u.isString(h)&&h.trim().length===0||u.isFunction(h.isNewRec)&&h.isNewRec()||(r[l]=h)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((s=r==null?void 0:r.updatedAt)!=null&&s.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class ie extends S{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");t(this,"subRoles",[]);t(this,"parentRole");t(this,"level",0);this.description=e==null?void 0:e.description,this.canChangeLowCost=(e==null?void 0:e.canChangeLowCost)??!1,this.parentRoleId=e==null?void 0:e.parentRoleId}}class Ke{constructor(r){t(this,"role");t(this,"category");t(this,"minCoefficient");this.role=new ie(r==null?void 0:r.role),this.category=new ge(r==null?void 0:r.category),this.minCoefficient=new he(r==null?void 0:r.minCoefficient)}}class it extends f{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,i=void 0,s=void 0){let l=`${b().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return i&&(l+=`&category_id=${i}`),s&&(l+=`&client_id=${s}`),l}}class st extends f{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,i){var s;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value})}removeCategoryPrices(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}`)}markCategoryRequired(r,e){return this.post(`/internal/clients/${r}/price/categories/${e}/required`)}unmarkCategoryRequired(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/required`)}markCategoryDisabled(r,e,i){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:i})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,i){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:i})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}updateProductPrice(r,e,i){var s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value},o=>new j(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,i=>new j(i.data))}markProductRequired(r,e){return this.post(`/internal/clients/${r}/price/products/${e}/required`)}unmarkProductRequired(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}/required`)}getCommercialOfferHtml(r,e){return this.get(`/internal/clients/${r}/price/commercial-offer/view`,e,i=>new Blob([i.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,i=>new Blob([i.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class nt extends f{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new re(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new re(e.data),!0)}attachTemplate(r,e,i){const s=b().config.dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,i&&{startAt:i.startAt&&m.format(i.startAt,s),endAt:i.endAt&&m.format(i.endAt,s)},o=>new re(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,i,s){const o=b().config.dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${i}`,s&&{startAt:s.startAt&&m.format(s.startAt,o),endAt:s.endAt&&m.format(s.endAt,o)},l=>new re(l.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class ot extends f{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(i=>new N(i)))}getCategoryData(r,e=!1,i=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:i},s=>new N(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new N(e.data))}getCategoryProductsList(r,e=!0,i=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:i,withPriceCoefficients:e},s=>u.map(s.data,o=>new k(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return u.forEach(i,s=>s.map(o=>new Ae(o))),i})}publicSimpleSearch(r,e=10){return new Promise((i,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.categories.map(l=>new N(l)))}).catch(o=>{s(o)})})}}class ct extends f{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new k(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new k(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>u.map(e.data,i=>new Ae(i)))}publicSimpleSearch(r,e=10){return new Promise((i,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.products.map(l=>new k(l)))}).catch(o=>{s(o)})})}}class lt extends f{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(s=>new me(s)))}getCategoryData(r,e,i=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:s},o=>new me(o.data))}getCategoryProductsList(r,e,i=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:i},o=>u.map(o.data,l=>new j(l)))}}class ut extends f{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},s=>new j(s.data))}}var ke=(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))(ke||{});class Qe{constructor(r){t(this,"field");t(this,"op");t(this,"value");this.field=(r==null?void 0:r.field)??"",this.op=(r==null?void 0:r.op)??ke.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r={field:this.field,op:this.op};return r.value=u.isDate(this.value)?m.format(this.value,b().config.dateFormats.api):this.value,r}}class M{constructor(r){t(this,"groupOp");t(this,"filters");t(this,"groups");var e,i;this.groupOp=(r==null?void 0:r.groupOp)??"and",this.filters=((e=r==null?void 0:r.filters)==null?void 0:e.map(s=>new Qe(s)))??[],this.groups=((i=r==null?void 0:r.groups)==null?void 0:i.map(s=>new M(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Qe&&u.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof M?r.toPrimitive():r)}}}class ye extends f{getPaginated(r,e,i,s,o,l,h,y=void 0){let w={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(w.filters=JSON.stringify((e instanceof M?e:new M(e)).toPrimitive())),u.isEmpty(i)||(w.sort=u.isArray(i)?i:[i]),o&&(w={...w,...o}),this.get(r,w,l,h,y)}}class pt extends ye{getTemplateList(r,e,i){return this.getPaginated("/internal/price/templates",r,e,i,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new W(l)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,i=>new W(i.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new W(e.data))}updateTemplate(r,e,i={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new W(s.data),i)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.get(`/internal/price/templates/${r}/products`,{},e=>e.data.map(i=>new de(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new de(i.data))}saveProductTemplatePrice(r,e,i){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value},o=>new de(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.get(`/internal/price/templates/${r}/categories`,{},e=>e.data.map(i=>new Ie(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new Ie(i.data))}saveCategoryTemplatePrice(r,e,i,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=i.coefficient)==null?void 0:o.id,increase_percent:i.value},params:s?{recursively:!0}:{}},l=>new Ie(l.data))}deleteCategoryTemplatePrice(r,e,i=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:i?{recursively:!0}:{}})}getTemplateClients(r){return this.get(`/internal/price/templates/${r}/clients`,{},e=>e.data.map(i=>new re(i)))}}class ht extends f{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new ie(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new ie(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new ie(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new ie(i.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.get(`/internal/price/roles/rules/categories/${r}`,{},e=>e.data.map(i=>new Ke(i)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,i=>i.data.map(s=>new Ke(s)))}}class gt extends ye{getProperties(r,e,i){return this.getPaginated("/internal/catalog/properties",r,e,i,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new te(l)),o})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},s=>new te(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new te(e.data))}updateProperty(r,e){const{typeId:i,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:i},o=>new te(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.get(`/internal/catalog/products/${r}/properties`,{},e=>e.data.map(i=>new K(i)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},i=>new K(i.data))}updateProductProperty(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:i},s=>new K(s.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,i)}deleteProductFile(r,e){return this.delete(`/internal/catalog/products/${r}/properties/files/${e}`)}updateProductSlug(r,e){return this.patch(`/internal/catalog/products/${r}/properties/slug`,{slug:e})}getCategoryProperties(r){return this.get(`/internal/catalog/categories/${r}/properties`,{},e=>e.data.map(i=>new K(i)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},i=>new K(i.data))}updateCategoryProperty(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:i},s=>new K(s.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,i)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}updateCategoryImage(r,e){return this.post(`/internal/catalog/categories/${r}/image`,{image:e})}}class mt extends f{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{priceTemplateId:r,showHidden:e},i=>i.data.map(s=>new N(s)))}getCategoryData(r,e,i=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{priceTemplateId:r,showHidden:i,withNestedCategories:s},o=>new N(o.data))}getCategoryProductsList(r,e,i=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{priceTemplateId:r,showHidden:s,withPriceCoefficients:i},o=>u.map(o.data,l=>new k(l)))}}function Ye(n,r,e){let i;return n.some(s=>{if(s.type===e&&s.id===r)return i=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const l=Ye(o.products,r,e);if(l)return i=l,!0}if(o.categories&&o.categories.length>0){const l=Ye(o.categories,r,e);if(l)return i=l,!0}return!1}),i}function Xe(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const i=e;i.products&&i.products.length>0&&r.push(...Xe(i.products)),i.categories&&i.categories.length>0&&r.push(...Xe(i.categories))}}),r}var br=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n.SalesDirection="sales_direction",n.Managers="managers",n.Curators="curators",n))(br||{}),U=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(U||{});class dr extends C{}class Ze extends C{}class ft extends C{}class kr extends C{}class B extends C{static generatePersonItem(){return new B({id:1,guid:"",slug:U.Person,name:""})}}class xe extends C{}class Lr extends C{}class ae extends C{}class Q extends C{}class Ee extends C{}class Or extends C{}class yt{static generateUndefinedInstance(r,e="- Не определён -"){return new r({id:0,name:e,slug:"-undefined-"})}static isUndefinedInstance(r){return r.id===0&&r.slug==="-undefined-"}}class er extends C{}class rr extends C{}class Le extends z{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new L);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new L(e.currency))}}class Oe extends S{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 G extends Oe{constructor(e){super(e);t(this,"isPrimary");t(this,"position");t(this,"notDisturb");t(this,"comment");t(this,"updatedAt");t(this,"deletedAt");this.isPrimary=(e==null?void 0:e.isPrimary)??!1,this.position=e==null?void 0:e.position,this.notDisturb=(e==null?void 0:e.notDisturb)??!1,this.comment=e==null?void 0:e.comment,this.updatedAt=e==null?void 0:e.updatedAt,this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?m.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class tr extends Ue{constructor(e){super(e);t(this,"opf",B.generatePersonItem());t(this,"partnerGroup",new Q);t(this,"contacts",[]);t(this,"bankAccounts",[]);t(this,"comment");t(this,"alternativeName");t(this,"createdAt");t(this,"creator");t(this,"updater");if(e){if(this.opf=new B(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new d(e.creator):void 0,this.updater=e.updater?new d(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new Q(e.partnerGroup)),e.contacts){const i=[];e.contacts.forEach(s=>{i.push(new G(s))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(s=>{i.push(new Le(s))}),this.bankAccounts=i}}}}class _r extends tr{constructor(r){super(r)}}class ir extends tr{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 sr extends ir{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class qr extends sr{constructor(e){super(e);t(this,"registrationCountry",new J);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new J(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class we{static createInstance(r){switch(r.opf.slug){case U.Ic:return new ir(r);case U.UlR:return new sr(r);case U.UlNr:return new qr(r);default:return new _r(r)}}}class _e extends z{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class Nr extends G{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(i=>new _e(i))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(i=>new _e(i))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(i=>new _e(i))))}}class se extends Ue{constructor(e){var i;super(e);t(this,"address","");t(this,"coordinates");t(this,"contacts");t(this,"comment");t(this,"operatingHours");t(this,"isOneTime");t(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new Me(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(s=>new G(s)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class nr extends V{constructor(e){var i,s,o,l;super(e);t(this,"contragents");t(this,"partnerGroups");t(this,"contacts");t(this,"deliveryAddresses");t(this,"channelPrimaryInterest");t(this,"sourcePrimaryInterest");t(this,"preferredDeliveryType");t(this,"primaryDemand");t(this,"preferredWarehouse");t(this,"extraData");this.contragents=((i=e==null?void 0:e.contragents)==null?void 0:i.map(h=>we.createInstance(h)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(h=>new Q(h)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(h=>new G(h)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(h=>new se(h)))??[],this.channelPrimaryInterest=new Ze(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new rr(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new q(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new Z(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class or{asClearRaw(){const r={};return Object.keys(this).forEach(e=>{const i=this[e];u.isNil(i)||u.isString(i)&&i.trim().length===0||u.isFunction(i.isNewRec)&&i.isNewRec()||(r[e]=i)}),r}}class at extends or{constructor(e){var i,s,o,l,h,y,w,v;super();t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"searchTerm");t(this,"cities");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",new T);t(this,"lastLoginDate",new T);t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"includeSubordinateManagers");t(this,"curators");t(this,"isManagerRequired");t(this,"salesDirections");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"partnerGroups");t(this,"contact");t(this,"lastOrder");this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.alternativeName=e==null?void 0:e.alternativeName,this.searchTerm=e==null?void 0:e.searchTerm,this.cities=(i=e==null?void 0:e.cities)==null?void 0:i.map(R=>new fe(R)),this.region=new ee(e==null?void 0:e.region),this.country=new J(e==null?void 0:e.country),this.phone=e==null?void 0:e.phone,this.email=e==null?void 0:e.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,"isActive")?e==null?void 0:e.isActive:!0,this.createdAt=new T(e==null?void 0:e.createdAt),this.lastLoginDate=new T(e==null?void 0:e.lastLoginDate),this.lastLoginDateHasOrder=(e==null?void 0:e.lastLoginDateHasOrder)??void 0,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(R=>new E(R)))??[],this.includeSubordinateManagers=(e==null?void 0:e.includeSubordinateManagers)??!0,this.curators=((o=e==null?void 0:e.curators)==null?void 0:o.map(R=>new be(R)))??[],this.salesDirections=(l=e==null?void 0:e.salesDirections)==null?void 0:l.map(R=>new O(R)),this.contragentInn=e==null?void 0:e.contragentInn,this.contragentType=new B(e==null?void 0:e.contragentType),this.preferredDeliveryType=e!=null&&e.preferredDeliveryType?new q(e==null?void 0:e.preferredDeliveryType):void 0,this.partnerGroups=(h=e==null?void 0:e.partnerGroups)==null?void 0:h.map(R=>new Q(R)),this.contact=new Oe(e==null?void 0:e.contact),this.lastOrder={createdAt:new T((y=e==null?void 0:e.lastOrder)==null?void 0:y.createdAt),creator:(w=e==null?void 0:e.lastOrder)==null?void 0:w.creator,isApproved:(v=e==null?void 0:e.lastOrder)==null?void 0:v.isApproved}}resetFilterValue(e){switch(e){case"cities":this.cities=[];break;case"region":this.region=new ee;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new B;break;case"preferredDeliveryType":this.preferredDeliveryType=new q;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Oe;break;default:this[e]=void 0;break}return this}asClearRaw(){var i,s,o,l;const e=super.asClearRaw();return!((i=e==null?void 0:e.createdAt)!=null&&i.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.lastLoginDate)!=null&&o.from)&&!((l=e==null?void 0:e.lastLoginDate)!=null&&l.to)&&delete e.lastLoginDate,e}}class cr extends z{constructor(e){super(e);t(this,"createdAt");t(this,"creator");this.createdAt=u.isString(e==null?void 0:e.createdAt)?m.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new d(e==null?void 0:e.creator)}}class Ur extends S{constructor(e){var i,s,o,l;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");t(this,"salesDirection");t(this,"managers");t(this,"curators");this.contacts=((i=e.contacts)==null?void 0:i.map(h=>new G(h)))??void 0,this.lastOrder=e.lastOrder?new cr(e.lastOrder):void 0,this.partnerGroups=((s=e.partnerGroups)==null?void 0:s.map(h=>new Q(h)))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new q(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new O(e.salesDirection):void 0,this.managers=((o=e.managers)==null?void 0:o.map(h=>new Te(h)))??void 0,this.curators=((l=e.curators)==null?void 0:l.map(h=>new be(h)))??void 0}}class Hr{constructor(r){t(this,"page",1);t(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class wt extends Hr{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 Ct{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 _ extends ye{static transformClientDataToRequest(r){var i;return{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(s=>s.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,preferred_warehouse_id:(i=r.preferredWarehouse)==null?void 0:i.id}}static transformContragentClientDataToRequest(r){var l,h,y,w;let e;const i=r,s=r,o=r;switch(r.opf.slug){case U.Ic:e={opf:i.opf.slug,name:i.name,alternative_name:i.alternativeName,partner_group_id:(l=i.partnerGroup)==null?void 0:l.id,comment:i.comment,inn:i.inn,okpo:i.okpo,director_name:i.directorName,director_position:i.directorPosition,director_acts_on:i.directorActsOn,legal_address:i.legalAddress,postal_address:i.postalAddress,actual_address:i.actualAddress};break;case U.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(h=s.partnerGroup)==null?void 0:h.id,comment:s.comment,inn:s.inn,kpp:s.kpp,okpo:s.okpo,director_name:s.directorName,director_position:s.directorPosition,director_acts_on:s.directorActsOn,legal_address:s.legalAddress,postal_address:s.postalAddress,actual_address:s.actualAddress};break;case U.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(y=o.partnerGroup)==null?void 0:y.id,comment:o.comment,director_name:o.directorName,director_position:o.directorPosition,director_acts_on:o.directorActsOn,legal_address:o.legalAddress,postal_address:o.postalAddress,actual_address:o.actualAddress,registration_country_id:o.registrationCountry.id,registration_number:o.registrationNumber,tax_number:o.taxNumber||void 0};break;default:e={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:(w=r.partnerGroup)==null?void 0:w.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var i,s;const e={address:r.address,is_one_time:r.isOneTime??!1,is_transport_company_address:r.isTransportCompanyAddress??!1,comment:r.comment??""};return r.coordinates&&(e.coordinates={lat:(i=r.coordinates)==null?void 0:i.lat,long:(s=r.coordinates)==null?void 0:s.long}),r.operatingHours&&(e.operating_hours={from:r.operatingHours.from,to:r.operatingHours.to}),e}static transformClientContragentBankAccountToRequest(r){return{bank_name:r.bankName,bic:r.bic,account_number:r.accountNumber,correspondent_account:r.correspondentAccount,currency_id:r.currency.id}}getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new nr(e.data))}getClientsList(r,e,i,s,o=void 0){return this.getPaginated("/internal/clients",r,e,i,s,l=>{const h={...l.data};return h.data=h.data.map(y=>new V(y)),h},void 0,o)}searchClient(r){return this.getClientsList(void 0,void 0,void 0,{searchTerm:r}).then(e=>e.data)}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:ke.Contains,value:r}]})}getAdditionalClientsData(r,e){const i=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:i,requested_data_types:e},s=>{let o=[];return(s==null?void 0:s.data.length)>0&&(o=s.data.map(l=>new Ur(l))),o})}getAllClientContacts(r){return this.get(`/internal/clients/${r}/contacts/all`,{},e=>{let i=[];return(e==null?void 0:e.data.length)>0&&(i=e.data.map(s=>new Nr(s))),i})}createClientCommonData(r,e={}){return this.post("/internal/clients",_.transformClientDataToRequest(r),i=>new nr(i.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,_.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const i={get_news:r.getNews};return this.patch(`/internal/clients/${r.id}`,i,void 0,e)}changeClientPassword(r,e,i,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:i},void 0,s)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const i=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(i)}async detachClientFromManagers(r,e){const i=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(i)}attachToCurator(r,e,i){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:i.id})}detachFromCurator(r,e,i){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:i.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(i=>({curator_id:i.curatorId,curated_direction_id:i.curatedDirection.id}))})}createContragentClientData(r,e,i={}){return this.post(`/internal/clients/${r}/contragents`,_.transformContragentClientDataToRequest(e),s=>we.createInstance(s.data),i)}updateContragentClientData(r,e,i={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,_.transformContragentClientDataToRequest(e),s=>we.createInstance(s.data),i)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}getClientDeliveryAddresses(r){return this.get(`/internal/clients/${r}/delivery-addresses`,{},e=>e.data.map(i=>new se(i)))}createClientDeliveryAddress(r,e,i={}){return this.post(`/internal/clients/${r}/delivery-addresses`,_.transformClientDeliveryAddressToRequest(e),s=>new se(s.data),i)}updateClientDeliveryAddress(r,e,i={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,_.transformClientDeliveryAddressToRequest(e),s=>new se(s.data),i)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,i,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,_.transformClientContragentBankAccountToRequest(i),o=>new Le(o.data),s)}updateContragentBankAccount(r,e,i,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`,_.transformClientContragentBankAccountToRequest(i),o=>new Le(o.data),s)}deleteContragentBankAccount(r,e,i){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`)}createClientContact(r,e,i={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},i)}updateClientContact(r,e,i={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},s=>new G(s.data),i)}setPrimaryClientContact(r,e){return this.setPrimaryContact(`/internal/clients/${r}/contacts/${e.id}/primary`,e.isPrimary??!1)}detachClientContact(r,e){return this.detachContact(`/internal/clients/${r}/contacts/${e.id}/detach`)}createContragentContact(r,e,i,s={}){return this.createContact(r,i,{contragents:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,i){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${i.id}/primary`,i.isPrimary??!1)}detachContragentContact(r,e,i){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${i.id}/detach`)}createDeliveryAddressContact(r,e,i,s={}){return this.createContact(r,i,{addresses:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,i){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${i.id}/primary`,i.isPrimary??!1)}detachDeliveryAddressContact(r,e,i){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${i.id}/detach`)}createContact(r,e,i,s={}){var l,h;const o={name:e.name,position:e.position,comment:e.comment,...i};return(l=e.phone)!=null&&l.length&&(o.phone=e.phone),(h=e.email)!=null&&h.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,y=>new G(y.data),s)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}const oe=class oe extends f{constructor(){super();t(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=b().config.http.responseDataCacheTimeout}static getCachedResponse(e){const i=oe.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){oe.responseDataCache.set(e,{validTo:m.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,s=!1,o={}){const l=i+(u.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),h=s?oe.getCachedResponse(l):void 0;return h?Promise.resolve(h):this.get(i,o).then(y=>{const w=y.map(v=>De.instanceInitializer(e,v));return s&&w&&this.cacheResponse(i,w),w})}};t(oe,"responseDataCache",new Map);let ne=oe;class vt extends f{checkPhoneIsBusy(r){return new Promise((e,i)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(i)})}}class Pt{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=u.isString(r==null?void 0:r.date)?m.parseISO(r.date):(r==null?void 0:r.date)??new Date,this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}var jr=(n=>(n.Kozyrek="kozyrek",n.Mosquitto="mosquitto",n.Strip="strip",n.MetalForDoors="metal_for_doors",n.Sandwich="sandwich",n.SandwichM2="sandwich_m2",n))(jr||{});class Rt extends f{getConfiguratorSettings(r,e){var i;return this.get(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.configurator}/settings?client_id=${e}`)}searchProduct(r,e,i,s={}){var l;const o=this.get(`internal/catalog/categories/${r.id}/configurators/${(l=r.properties)==null?void 0:l.configurator}/product`,{params:i,client_id:e},h=>new k(h.data));return o.catch(h=>{this.errorResponseHandler(h,s)}),o}createTemplate(r,e,i,s={}){var o;return this.post(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/template?client_id=${e}`,{...i},()=>{},s)}removeTemplate(r,e,i){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template/${i}?client_id=${e}`)}calculate(r,e,i){var s;return this.get(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/calculate`,{client_id:e,...i})}}class Dt{static defaultDateRanges(){const r=m.addBusinessDays(new Date,1);return{nextWorkingDay:{label:"Следующий рабочий день",from:m.startOfDay(r),to:m.endOfDay(r)},today:{label:"Сегодня",from:m.startOfToday(),to:m.endOfToday()},yesterday:{label:"Вчера",from:m.startOfYesterday(),to:m.endOfYesterday()},tomorrow:{label:"Завтра",from:m.startOfTomorrow(),to:m.endOfTomorrow()}}}}class lr{static productIsMeasurable(r){return r.unit.isLinear||r.unit.isSquare}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!lr.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,i,s;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((i=r.properties)!=null&&i.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)?r.properties.minCount:.01}}function At(n,r){const e=[2,0,1,1,1,2];return r[n%100>4&&n%100<20?2:e[Math.min(n%10,5)]]}class St{static generateUndefinedManagerInstance(){return new E({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Mr extends ne{async getManagers(){const r="/internal/managers",e=ne.getCachedResponse(r);if(e)return e;const s=(await this.get(r)).data.map(o=>De.instanceInitializer(E,o));return this.cacheResponse(r,s),s}}var Br=(n=>(n.View="view",n.Share="share",n.EditTags="edit_tags",n.SaveOrderIgnoredProducts="save_order_ignored_products",n.ChangeStatus="change_status",n.ChangeProducts="change_products",n.ChangeOrderParameters="change_order_parameters",n.Recalculate="recalculate",n.AttachOrder="attach_order",n.DetachOrder="detach_order",n.ChangeAttachedOperator="change_attached_operator",n.SendOnlinePaymentLink="send_online_payment_link",n.ConfirmOnlineFullPayment="confirm_online_full_payment",n.MergeOrders="merge_orders",n.GetHistory="get_history",n.CloneOrder="clone_order",n.DeleteAttachedFile="delete_attached_file",n))(Br||{});class Tt{constructor(r){t(this,"paymentType");t(this,"deliveryType");t(this,"contragentId");t(this,"deliveryDate");t(this,"addressId");t(this,"warehouseId");t(this,"image");t(this,"comment");t(this,"barcode");t(this,"operatorsComment");t(this,"operatorsForWarehouseComment");t(this,"additionalEmails");t(this,"isAllowProcessingWithoutPayment");t(this,"isAdditionalSale");var e,i,s;this.paymentType=r==null?void 0:r.payment.type,this.deliveryType=r==null?void 0:r.delivery.type,this.contragentId=(e=r==null?void 0:r.contragent)==null?void 0:e.id,this.deliveryDate=r!=null&&r.delivery.date?new Date(r.delivery.date):void 0,this.addressId=(i=r==null?void 0:r.delivery.address)==null?void 0:i.id,this.warehouseId=(s=r==null?void 0:r.delivery.warehouse)==null?void 0:s.id,this.comment=r==null?void 0:r.comment,this.barcode=r==null?void 0:r.barcode,this.operatorsComment=r==null?void 0:r.operatorsComment,this.operatorsForWarehouseComment=r==null?void 0:r.operatorsForWarehouseComment,this.isAllowProcessingWithoutPayment=r==null?void 0:r.isAllowProcessingWithoutPayment}}class ur extends cr{constructor(e){var i,s,o,l,h,y,w,v;super(e);t(this,"client");t(this,"payment");t(this,"delivery");t(this,"attachedUser");t(this,"status");t(this,"statusDetail");t(this,"salesDirection");t(this,"attachedAt");t(this,"isOnOrder");t(this,"isNotInStock");t(this,"sum");t(this,"isLargeOrder");this.client=new V(e==null?void 0:e.client),this.payment={type:((i=e==null?void 0:e.payment)==null?void 0:i.type)??-1,status:((s=e==null?void 0:e.payment)==null?void 0:s.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((l=e==null?void 0:e.delivery)==null?void 0:l.type)??-1,date:u.isString((h=e==null?void 0:e.delivery)==null?void 0:h.date)?m.parseISO(e.delivery.date):((y=e==null?void 0:e.delivery)==null?void 0:y.date)??new Date,address:(w=e==null?void 0:e.delivery)!=null&&w.address?new se(e.delivery.address):void 0,warehouse:(v=e==null?void 0:e.delivery)!=null&&v.warehouse?new Z(e.delivery.warehouse):void 0},this.attachedUser=e!=null&&e.attachedUser?new d(e==null?void 0:e.attachedUser):void 0,this.status=new ae(e==null?void 0:e.status),this.statusDetail=e!=null&&e.statusDetail?new C(e.statusDetail):void 0,this.salesDirection=new O(e==null?void 0:e.salesDirection),this.attachedAt=u.isString(e==null?void 0:e.attachedAt)?m.parseISO(e.attachedAt):e==null?void 0:e.attachedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1,this.sum=(e==null?void 0:e.sum)??0,this.isLargeOrder=(e==null?void 0:e.isLargeOrder)??!1}}var Gr=(n=>(n.New="new",n.Processing="processing",n.AwaitingSupplyProducts="awaiting_supply_products",n.InvoiceIssued="invoice_issued",n.ProcessingOnStock="processing_on_stock",n.Finished="finished",n.OrderUpdated="order_updated",n.Canceled="canceled",n.Error="error",n))(Gr||{}),Fr=(n=>(n.WillWaiting="will_waiting",n))(Fr||{});class D extends ne{getReference(r,e=!1){return this.getTypedDataArrayRequester(dr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Ze,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(kr,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester($e,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(L,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(Q,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(B,"/public/references/opf",!0)}getOperators(){return this.getTypedDataArrayRequester(xe,"/internal/references/operator",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(Lr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(ae,"/internal/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(Ee,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(er,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(O,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(rr,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(fe,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(ee,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(J,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(q,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(Z,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Ve,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(he,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(Or,"/public/references/product-file-type",!0)}}const A=F.defineStore("common.references_private",()=>{const n=g.ref({}),r=g.ref(void 0),e=g.ref(void 0),i=g.ref(void 0),s=g.ref(void 0),o=g.ref(void 0),l=g.ref(void 0),h=g.ref(void 0),y=g.ref(void 0),w=g.ref(void 0),v=g.ref(void 0),R=g.ref(void 0),Ce=g.ref(void 0),ve=g.ref(void 0),ce=g.ref(void 0),le=g.ref(void 0),mr=g.ref(void 0),fr=g.ref(void 0),p=g.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:i,deliveryTypeReference:s,managersList:o,opfReference:l,operatorReference:h,orderPaymentStatusReference:y,orderStatusReference:w,paymentTypeReference:v,partnerGroupReference:R,productFileTypeReference:Ce,resourceTypesReference:ve,salesDirectionsReference:ce,sourcePrimaryInterestReference:le,warehousesReference:mr,propertyTypesReference:fr,priceCoefficientsReference:p}}),$t=F.defineStore("common.references",()=>{const n=g.computed(()=>{const p=A();return!p.channelPrimaryInterestReference&&!p.dataLoaderList.channelPrimaryInterestReference&&(p.dataLoaderList.channelPrimaryInterestReference=!0,f.getInstance(D).getChannelPrimaryInterest().then(a=>{p.channelPrimaryInterestReference=a}).catch(u.noop)),p.channelPrimaryInterestReference}),r=g.computed(()=>{const p=A();return!p.contactPositionsReference&&!p.dataLoaderList.contactPositionsReference&&(p.dataLoaderList.contactPositionsReference=!0,f.getInstance(D).getContactPositions().then(a=>{p.contactPositionsReference=a}).catch(u.noop)),p.contactPositionsReference}),e=g.computed(()=>{const p=A();return!p.currencyReference&&!p.dataLoaderList.currencyReference&&(p.dataLoaderList.currencyReference=!0,f.getInstance(D).getCurrency().then(a=>{p.currencyReference=a}).catch(u.noop)),p.currencyReference}),i=g.computed(()=>{const p=A();return!p.opfReference&&!p.dataLoaderList.opfReference&&(p.dataLoaderList.opfReference=!0,f.getInstance(D).getOpf().then(a=>{p.opfReference=a}).catch(u.noop)),p.opfReference}),s=g.computed(()=>{const p=A();return!p.operatorReference&&!p.dataLoaderList.operatorReference&&(p.dataLoaderList.operatorReference=!0,f.getInstance(D).getOperators().then(a=>{p.operatorReference=a}).catch(u.noop)),p.operatorReference}),o=g.computed(()=>{const p=A();return!p.orderPaymentStatusReference&&!p.dataLoaderList.orderPaymentStatusReference&&(p.dataLoaderList.orderPaymentStatusReference=!0,f.getInstance(D).getOrderPaymentStatuses().then(a=>{p.orderPaymentStatusReference=a}).catch(u.noop)),p.orderPaymentStatusReference}),l=g.computed(()=>{const p=A();return!p.orderStatusReference&&!p.dataLoaderList.orderStatusReference&&(p.dataLoaderList.orderStatusReference=!0,f.getInstance(D).getOrderStatuses().then(a=>{p.orderStatusReference=a}).catch(u.noop)),p.orderStatusReference}),h=g.computed(()=>{const p=A();return!p.paymentTypeReference&&!p.dataLoaderList.paymentTypeReference&&(p.dataLoaderList.paymentTypeReference=!0,f.getInstance(D).getPaymentTypes().then(a=>{p.paymentTypeReference=a}).catch(u.noop)),p.paymentTypeReference}),y=g.computed(()=>{const p=A();return!p.partnerGroupReference&&!p.dataLoaderList.partnerGroupReference&&(p.dataLoaderList.partnerGroupReference=!0,f.getInstance(D).getPartnerGroup().then(a=>{p.partnerGroupReference=a}).catch(u.noop)),p.partnerGroupReference}),w=g.computed(()=>{const p=A();return!p.productFileTypeReference&&!p.dataLoaderList.productFileTypeReference&&(p.dataLoaderList.productFileTypeReference=!0,f.getInstance(D).getProductFileType().then(a=>{p.productFileTypeReference=a}).catch(u.noop)),p.productFileTypeReference}),v=g.computed(()=>{const p=A();return!p.resourceTypesReference&&!p.dataLoaderList.resourceTypesReference&&(p.dataLoaderList.resourceTypesReference=!0,f.getInstance(D).getResourceTypes().then(a=>{p.resourceTypesReference=a}).catch(u.noop)),p.resourceTypesReference}),R=g.computed(()=>{const p=A();return!p.salesDirectionsReference&&!p.dataLoaderList.salesDirectionsReference&&(p.dataLoaderList.salesDirectionsReference=!0,f.getInstance(D).getSalesDirections().then(a=>{p.salesDirectionsReference=a}).catch(u.noop)),p.salesDirectionsReference}),Ce=g.computed(()=>{const p=A();return!p.sourcePrimaryInterestReference&&!p.dataLoaderList.sourcePrimaryInterestReference&&(p.dataLoaderList.sourcePrimaryInterestReference=!0,f.getInstance(D).getSourcePrimaryInterest().then(a=>{p.sourcePrimaryInterestReference=a}).catch(u.noop)),p.sourcePrimaryInterestReference}),ve=g.computed(()=>{const p=A();return!p.deliveryTypeReference&&!p.dataLoaderList.deliveryTypeReference&&(p.dataLoaderList.deliveryTypeReference=!0,f.getInstance(D).getDeliveryTypes().then(a=>{p.deliveryTypeReference=a}).catch(u.noop)),p.deliveryTypeReference}),ce=g.computed(()=>{const p=A();return!p.managersList&&!p.dataLoaderList.managersList&&(p.dataLoaderList.managersList=!0,f.getInstance(Mr).getManagers().then(a=>{p.managersList=a}).catch(u.noop)),p.managersList}),le=g.computed(()=>{const p=A();return!p.warehousesReference&&!p.dataLoaderList.warehousesReference&&(p.dataLoaderList.warehousesReference=!0,f.getInstance(D).getWarehouses().then(a=>{p.warehousesReference=a}).catch(u.noop)),p.warehousesReference}),mr=g.computed(()=>{const p=A();return!p.propertyTypesReference&&!p.dataLoaderList.propertyTypesReference&&(p.dataLoaderList.propertyTypesReference=!0,f.getInstance(D).getPropertyTypes().then(a=>{p.propertyTypesReference=a}).catch(u.noop)),p.propertyTypesReference}),fr=g.computed(()=>{const p=A();return!p.priceCoefficientsReference&&!p.dataLoaderList.priceCoefficientsReference&&(p.dataLoaderList.priceCoefficientsReference=!0,f.getInstance(D).getPriceCoefficients().then(a=>{p.priceCoefficientsReference=a}).catch(u.noop)),p.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:i,operatorReference:s,orderPaymentStatusReference:o,orderStatusReference:l,paymentTypeReference:h,partnerGroupsReference:y,productFilesTypesReference:w,resourceTypesReference:v,salesDirectionsReference:R,sourcePrimaryInterestsReference:Ce,deliveryTypeReference:ve,managersList:ce,warehousesReference:le,propertyTypesReference:mr,priceCoefficientsReference:fr}});class It extends or{constructor(e){var i,s,o,l;super();t(this,"attachedUsers");t(this,"clientSearchTerm");t(this,"client");t(this,"contragent");t(this,"createdAt",new T);t(this,"creator");t(this,"deliveryDate",new T);t(this,"deliveryAddressSearch");t(this,"clientCities");t(this,"id");t(this,"isApproved");t(this,"isNotInStock");t(this,"isOnOrder");t(this,"attachedAt",new T);t(this,"salesDirections");t(this,"status");t(this,"statusDetail");t(this,"deliveryType");t(this,"paymentType");t(this,"warehouses");t(this,"isLargeOrder");t(this,"isToProcess");t(this,"onlyMyRegions");this.attachedUsers=(i=e==null?void 0:e.attachedUsers)==null?void 0:i.map(h=>"isActive"in h?new E(h):new xe(h)),this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.client=e!=null&&e.client?new V(e.client):void 0,this.contragent=e==null?void 0:e.contragent,this.createdAt=new T(e==null?void 0:e.createdAt),this.creator=e!=null&&e.creator?new d(e.creator):void 0,this.deliveryDate=new T(e==null?void 0:e.deliveryDate),this.deliveryAddressSearch=e==null?void 0:e.deliveryAddressSearch,this.clientCities=(s=e==null?void 0:e.clientCities)==null?void 0:s.map(h=>new fe(h)),this.id=e==null?void 0:e.id,this.isApproved=e==null?void 0:e.isApproved,this.isNotInStock=e==null?void 0:e.isNotInStock,this.isOnOrder=e==null?void 0:e.isOnOrder,this.isLargeOrder=e==null?void 0:e.isLargeOrder,this.attachedAt=new T(e==null?void 0:e.attachedAt),this.salesDirections=(o=e==null?void 0:e.salesDirections)==null?void 0:o.map(h=>new O(h)),this.status=e==null?void 0:e.status,this.statusDetail=e==null?void 0:e.statusDetail,this.deliveryType=e!=null&&e.deliveryType?new q(e.deliveryType):void 0,this.paymentType=e!=null&&e.paymentType?new Ee(e.paymentType):void 0,this.warehouses=(l=e==null?void 0:e.warehouses)==null?void 0:l.map(h=>new Z(h)),this.isToProcess=e==null?void 0:e.isToProcess}resetFilterValue(e){switch(e){case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"creator":this.creator=void 0;break;case"deliveryDate":this.deliveryDate.from=null,this.deliveryDate.to=null;break;case"deliveryType":this.deliveryType=new q;break;case"clientCities":this.clientCities=[];break;case"attachedAt":this.attachedAt.from=null,this.attachedAt.to=null;break;case"salesDirection":this.salesDirections=[];break;case"status":this.status=[];break;case"warehouse":this.warehouses=[];break;default:this[e]=void 0;break}return this}asClearRaw(){var i,s,o,l,h,y;const e=super.asClearRaw();return!((i=e==null?void 0:e.createdAt)!=null&&i.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.deliveryDate)!=null&&o.from)&&!((l=e==null?void 0:e.deliveryDate)!=null&&l.to)&&delete e.deliveryDate,!((h=e==null?void 0:e.attachedAt)!=null&&h.from)&&!((y=e==null?void 0:e.attachedAt)!=null&&y.to)&&delete e.attachedAt,e}}class zr extends Ge{constructor(e,i){super(e);t(this,"product");t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");t(this,"currency");t(this,"changedFields",[]);t(this,"replacement");this.product=new j(e.product),this.currency=new L(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,i&&(this.replacement=i,this.quantity!==i.quantity&&this.changedFields.push("quantity"),this.length!==i.length&&this.changedFields.push("length"))}}class $ extends ur{constructor(e){var i;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");t(this,"nextStatuses");t(this,"actions");t(this,"operatorsComment");t(this,"operatorsForWarehouseComment");t(this,"erpOrderUrl");this.products=(e.products??[]).map(s=>{var l;const o=s.replacementId?(l=e.products)==null?void 0:l.find(h=>h.id===s.replacementId):void 0;return new zr(s,o)}),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?we.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new C(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment,this.nextStatuses=(i=e.nextStatuses)==null?void 0:i.map(s=>new ae(s)),this.actions=e.actions,this.operatorsComment=e.operatorsComment,this.operatorsForWarehouseComment=e.operatorsForWarehouseComment,this.erpOrderUrl=e.erpOrderUrl}}class Wr{constructor(r){t(this,"user");t(this,"status");t(this,"statusDetail");t(this,"createdAt");this.user=new d(r==null?void 0:r.user),this.status=new ae(r==null?void 0:r.status),this.statusDetail=r!=null&&r.statusDetail?new C(r.statusDetail):void 0,this.createdAt=u.isString(r==null?void 0:r.createdAt)?m.parseISO(r.createdAt):(r==null?void 0:r.createdAt)??new Date}}class bt extends ye{getOrders(r,e,i,s=void 0){return this.getPaginated("/internal/orders",r,e,i,{},o=>{const l={...o.data};return l.data=l.data.map(h=>new ur(h)),l},void 0,s)}getOrdersCount(r,e=void 0){return this.get("/internal/orders/count",r?{filters:JSON.stringify((r instanceof M?r:new M(r)).toPrimitive())}:{},void 0,void 0,e).then(i=>i.count)}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new $(e.data))}createClientOrder(r,e,i,s,o={}){const l=b().config.dateFormats.api;return this.post(`/internal/clients/${r}/orders/${e}`,{...i,deliveryDate:m.format(i.deliveryDate,l),items:s!=null&&s.length?s:void 0},h=>h.data.map(y=>new $(y)),o)}attachOrder(r){return this.patch(`/internal/orders/${r}/attach`,{},e=>new $(e.data))}detachOrder(r){return this.patch(`/internal/orders/${r}/detach`,{},e=>new $(e.data))}mergeOrders(r,e){return this.patch(`/internal/orders/${r}/merge`,{ids:e},i=>new $(i.data))}recalculateOrder(r){return this.patch(`/internal/orders/${r}/recalculate`,{},e=>new $(e.data))}cloneOrder(r){return this.get(`/internal/orders/${r}/clone`,{})}updateOrder(r,e,i={}){const s=b().config.dateFormats.api;return this.patch(`/internal/orders/${r}`,{...e,deliveryDate:e.deliveryDate?m.format(e.deliveryDate,s):void 0},o=>new $(o.data),i)}addOrderProduct(r,e,i={}){return this.post(`/internal/orders/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new $(s.data),i)}changeOrderStatus(r,e,i,s={}){return this.patch(`/internal/orders/${r}/status`,{status:e,statusDetail:i},o=>new $(o.data),s)}changeOrderStatusDetail(r,e){return this.patch(`/internal/orders/${r}/status`,{statusDetail:e},i=>new $(i.data))}getOrderStatusHistory(r){return this.get(`/internal/orders/${r}/history`,{},e=>e.data.map(i=>new Wr(i)))}changeAttachedOperator(r,e){return this.patch(`/internal/orders/${r}/change-attached-operator`,{operatorId:e},i=>new $(i.data))}deleteOrderAttachedFile(r){return this.delete(`/internal/orders/${r}/file/attached`,e=>new $(e.data))}deleteOrderProduct(r,e){return this.delete(`/internal/orders/${r}/products/${e}`,i=>new $(i.data))}patchOrderProduct(r,e,i,s={}){return this.patch(`/internal/orders/${r}/products/${e}`,{product_id:i.product.id,product_category_id:i.configurator?i.category.id:void 0,quantity:i.quantity,height:i.height,length:i.length,width:i.width,configurator:i.configurator,marker:i.marker,...i.configuratorParams},o=>new $(o.data),s)}getDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/delivery/${r}/nearest-dates`,{},i=>i.data,void 0,e)}getSelfDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/self-delivery/${r}/nearest-dates`,{},i=>i.data,void 0,e)}getDeliveryCost(r,e,i,s=void 0){const o=b().config.dateFormats.api;return this.get(`/internal/orders/delivery/${r}/cost`,{date:m.format(e,o),warehouse_id:i},l=>l.data,void 0,s)}}class qe{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new V(r==null?void 0:r.client),this.product=new k(r==null?void 0:r.product),this.cost=(r==null?void 0:r.cost)??0,this.costCoefficient=(r==null?void 0:r.costCoefficient)??0,this.source=(r==null?void 0:r.source)??Se.Product}}const pr=n=>{var r,e,i,s,o;return n?u.omitBy({cities:(r=n.cities)==null?void 0:r.map(l=>l.id),clients:(e=n.clients)==null?void 0:e.map(l=>l.id),managers:(i=n.managers)==null?void 0:i.map(l=>l.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(l=>l.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(l=>l.id),hideNotActive:n.hideNotActive},l=>u.isNil(l)||(u.isArray(l)||u.isObject(l))&&u.isEmpty(l)):{}},Jr=n=>{const r={};return n.from&&(n.from.coefficient||n.from.value)&&(r.from={},n.from.coefficient&&(r.from.priceCoefficientId=n.from.coefficient.id),n.from.value&&(r.from.increasePercent=n.from.value)),n.to&&(n.to.coefficient||n.to.value)&&(r.to={},n.to.coefficient&&(r.to.priceCoefficientId=n.to.coefficient.id),n.to.value&&(r.to.increasePercent=n.to.value)),r};class dt extends f{analyzeProductPrices(r,e,i){return this.get(`/internal/price/products/${r}/analyze`,{...Jr(e),filters:pr(i)},s=>s.data.map(o=>new qe(o)))}analyzeCategoryPrices(r,e,i){return this.get(`/internal/price/categories/${r}/analyze`,{...Jr(e),filters:pr(i)},s=>s.data.map(o=>new qe(o)))}analyzeCategoryPricesBySquare(r,e,i){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:pr(i)},s=>s.data.map(o=>new qe(o)))}}class Vr{constructor(r){t(this,"cost");t(this,"isLowCost");t(this,"isRetail");t(this,"costDate");t(this,"discountName");t(this,"priceTemplateName");t(this,"product");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=u.isString(r.costDate)?m.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new X(r.product):void 0,this.client=r.client?new d(r.client):void 0,this.executor=r.executor?new d(r.executor):void 0,this.currency=r.currency?new L(r.currency):void 0}}class Kr extends X{constructor(e){super(e);t(this,"history");this.history=u.map(e.history,i=>new Vr(i))}}class kt extends f{getProductPriceHistory(r){var o,l,h,y,w;const e=b().config.dateFormats.api,i=u.omitBy(u.merge(r,{costDate:{from:u.isDate((o=r.costDate)==null?void 0:o.from)?m.format(r.costDate.from,e):(l=r.costDate)==null?void 0:l.from,to:u.isDate((h=r.costDate)==null?void 0:h.to)?m.format(r.costDate.to,e):(y=r.costDate)==null?void 0:y.to}}),v=>u.isNil(v)||(u.isArray(v)||u.isObject(v))&&u.isEmpty(v)),s=((w=r.product)==null?void 0:w[0])??0;return delete i.product,this.get(`/internal/price/products/${s}/history`,i).then(v=>[new Kr(u.merge(v[0],{history:v}))])}}class hr{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new X(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new X(e)))}}class Lt extends f{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new hr(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new hr(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}}class Qr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class gr{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");t(this,"tags");var e;this.resourceType=new er(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(i=>new Qr(i)))??[],this.tags=r==null?void 0:r.tags}}class Ot extends f{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new gr(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new gr(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class _t extends f{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(i=>{const s=[...i];let o=1;return s.forEach(l=>{l.id=o++}),s})}}var Yr=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.Guest="guest",n))(Yr||{});class Xr extends Je{constructor(e){super(e);t(this,"type");t(this,"canDoReclamations");t(this,"photo");t(this,"pricingRole");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,this.pricingRole=e!=null&&e.pricingRole?new ze(e.pricingRole):void 0}}class qt extends f{constructor(){super(),this.baseUrl=`${b().config.http.portalApiUrl}/api`,this.interceptorIds.request.authRequestInterceptor&&this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor)}getAccessToken(){return this.get("internal/users/current-tokens").then(r=>r.accessToken)}}class Zr extends f{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Xr(r.data),!0)}}const Nt=F.defineStore("common.user_state_private",()=>{const n=g.ref({}),r=g.ref(void 0);return{dataLoaderList:n,currentUser:r}}),Ut=F.defineStore("common.user_state",()=>({currentUser:g.computed(()=>{const r=Nt();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,f.getInstance(Zr).getCurrentUser().then(e=>{r.currentUser=e}).catch(u.noop).finally(()=>{r.dataLoaderList.currentUser=!1})),r.currentUser})}));class Ht{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=dr,c.AppBaseConfig=Pr,c.BankAccount=Le,c.BasePaginationProvider=ye,c.CalculationTypeEnum=$r,c.Cart=x,c.CartProvider=et,c.CatalogProvider=it,c.CatalogableItem=He,c.Category=N,c.CategoryPricingRule=Ke,c.ChannelPrimaryInterest=Ze,c.City=ft,c.CityWithRegionAndCountry=fe,c.Client=nr,c.ClientAdditionalData=Ur,c.ClientCategory=me,c.ClientDataProvider=_,c.ClientPriceProvider=st,c.ClientPriceTemplateProvider=nt,c.ClientProduct=j,c.ClientProductCategoryDataProvider=lt,c.ClientProductDataProvider=ut,c.ClientShortInfo=V,c.ClientsAdditionalDataRequestTypeEnum=br,c.ClientsListFilters=at,c.CodedIdentity=X,c.ConfiguratorProvider=Rt,c.ConfiguratorsEnum=jr,c.Contact=Oe,c.ContactLinks=Fe,c.ContactPerson=G,c.ContactPersonRelated=Nr,c.ContactPosition=kr,c.ContactRelation=_e,c.ContragentBase=tr,c.ContragentFactory=we,c.ContragentIc=ir,c.ContragentPerson=_r,c.ContragentUlNr=qr,c.ContragentUlR=sr,c.CostSourceEnum=Se,c.Country=J,c.CuratedDirection=$e,c.Curator=be,c.Currency=L,c.DataSuggestionProvider=_t,c.DataTablePagination=wt,c.DataTablePaginationRequestParams=Hr,c.DataTableSortRequestParams=Ct,c.DateTimeProvider=Dt,c.DeletableNamedIdentity=Ue,c.DeliveryAddress=se,c.DeliveryType=q,c.DetailedJwtPayload=xr,c.DeviceTypeResolutionConfig=ar,c.DiscountShortInfo=Sr,c.FieldValidationResultData=Ht,c.FilterGroup=M,c.FilterItem=Qe,c.FilterOpEnum=ke,c.GeoCoordinates=Me,c.HiddenCatalogableItem=Ar,c.HttpCachedRequester=ne,c.HttpParamsConfig=wr,c.HttpRequester=f,c.Identity=z,c.Image=Dr,c.JwtPayload=H,c.Manager=E,c.ManagerCommon=Te,c.ManagerDataFactory=St,c.ManagerDataProvider=Mr,c.MetaTagItem=Qr,c.NamedIdentity=S,c.Operator=xe,c.Opf=B,c.OpfEnum=U,c.Order=$,c.OrderAction=Br,c.OrderEditorData=Tt,c.OrderInfo=ur,c.OrderItem=zr,c.OrderItemBase=Ge,c.OrderPaymentStatus=Lr,c.OrderShortInfo=cr,c.OrderStatus=ae,c.OrderStatusDetailEnum=Fr,c.OrderStatusEnum=Gr,c.OrderStatusHistoryInfo=Wr,c.OrdersDataProvider=bt,c.OrdersListFilters=It,c.PaginationFiltersBase=or,c.PartnerGroup=Q,c.PaymentType=Ee,c.PreferencesStorageProvider=pe,c.PriceAnalyze=qe,c.PriceAnalyzeProvider=dt,c.PriceCoefficient=he,c.PriceCoefficientEnum=je,c.PriceHistoryDataProvider=kt,c.PriceHistoryItem=Vr,c.PriceTemplate=W,c.PriceTemplateCategory=Ie,c.PriceTemplateClient=re,c.PriceTemplateICatalogableItem=We,c.PriceTemplateProduct=de,c.PriceTemplateProvider=pt,c.PricingRole=ie,c.PricingRoleProvider=ht,c.PrimaryCatalogableItem=Re,c.Product=k,c.ProductCategoryDataProvider=ot,c.ProductDataProvider=ct,c.ProductFileType=Or,c.ProductPriceCoefficient=Ae,c.ProductPriceHistory=Kr,c.ProductUnit=Be,c.PropertiesProvider=gt,c.Property=te,c.PropertyType=Ve,c.PropertyTypeEnum=Ir,c.PropertyValue=K,c.RecommendationsDataProvider=Lt,c.RecommendationsList=hr,c.Reference=C,c.ReferenceDataFactory=yt,c.ReferenceDataProvider=D,c.Region=ee,c.ResourceType=er,c.SalesDirection=O,c.SentryConfig=Cr,c.Seo=gr,c.SeoDataProvider=Ot,c.SourcePrimaryInterest=rr,c.StockCount=Tr,c.TemplateProductCategoryDataProvider=mt,c.TemplatesListFilters=tt,c.TypedInstanceFactory=De,c.UnitsHelper=lr,c.UnknownClientDataProvider=vt,c.UpdatableNamedIdentity=Ne,c.User=Xr,c.UserAuthDataProvider=qt,c.UserCommonInfo=Je,c.UserDataProvider=Zr,c.UserPricingRole=ze,c.UserShortInfo=d,c.UserTypeEnum=Yr,c.VersionConfig=Pt,c.Warehouse=Z,c.WebSocketConfig=vr,c.findCatalogItemByIdRecursive=Ye,c.flattenCatalogItems=Xe,c.pluralize=At,c.useAuthStateStore=Pe,c.useBaseConfigStateStore=b,c.useReferencesStore=$t,c.useUserStateStore=Ut,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(c,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("pinia"),require("vue"),require("date-fns"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","pinia","vue","date-fns","axios"],b):(c=typeof globalThis<"u"?globalThis:c||self,b(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c.pinia,c.vue,c["date-fns"],c.axios))})(this,function(c,b,u,he,W,m,g,ar){"use strict";var Ft=Object.defineProperty;var zt=(c,b,u)=>b in c?Ft(c,b,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[b]=u;var i=(c,b,u)=>zt(c,typeof b!="symbol"?b+"":b,u);class H{constructor(r){i(this,"exp",0);i(this,"iat",0);i(this,"authTime",0);i(this,"jti","");i(this,"iss","");i(this,"aud",[]);i(this,"sub","");i(this,"typ","Bearer");i(this,"azp","");i(this,"sid","");i(this,"acr","");i(this,"allowedOrigins",[]);i(this,"realmAccess",{roles:[]});i(this,"resourceAccess",{});i(this,"scope","");i(this,"emailVerified",!1);i(this,"name","");i(this,"guid","");i(this,"preferredUsername","");i(this,"givenName","");i(this,"email","");u.merge(this,r)}static getJwtPayload(r){const e=b.jwtDecode(r),t=new H(he.objectToCamel(e));return t.resourceAccess=e.resource_access,t}}class rt extends H{constructor(e){super(e);i(this,"familyName");i(this,"middleName");i(this,"locale");i(this,"phoneNumber");i(this,"phoneNumberVerified");i(this,"address");u.merge(this,e)}static getJwtPayload(e){return new H(he.objectToCamel(b.jwtDecode(e)))}}class Cr{constructor(r){i(this,"phone");i(this,"tablet");i(this,"laptop");this.phone=(r==null?void 0:r.phone)??360,this.tablet=(r==null?void 0:r.tablet)??600,this.laptop=(r==null?void 0:r.laptop)??1024}}class vr{constructor(r){i(this,"portalApiUrl");i(this,"mediaUrl");i(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class Pr{constructor(r){i(this,"dsn");i(this,"environment");i(this,"ignoreErrors");i(this,"trace");i(this,"replay");i(this,"additionalParams");var e,t,s,o;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|404|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((t=r==null?void 0:r.trace)==null?void 0:t.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((s=r==null?void 0:r.replay)==null?void 0:s.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((o=r==null?void 0:r.replay)==null?void 0:o.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class Dr{constructor(r){i(this,"broadcaster");i(this,"key");i(this,"wsHost");i(this,"wsPort");i(this,"wssPort");i(this,"forceTLS");i(this,"enabledTransports");this.broadcaster=r.broadcaster??"reverb",this.key=r.key??"",this.wsHost=r.wsHost??"",this.wsPort=r.wsPort??8080,this.wssPort=r.wssPort??8080,this.forceTLS=r.forceTLS??!1,this.enabledTransports=r.enabledTransports??["wss"]}}class Rr{constructor(r){i(this,"environment");i(this,"devMode");i(this,"http");i(this,"deviceTypeByResolution");i(this,"sentry");i(this,"tableDefaultHeightCoefficient");i(this,"urls");i(this,"websocket");i(this,"dateFormats");var e,t,s;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new vr(r==null?void 0:r.http),this.deviceTypeByResolution=new Cr(r==null?void 0:r.deviceTypeByResolution),this.sentry=new Pr({environment:this.environment,...r==null?void 0:r.sentry}),this.tableDefaultHeightCoefficient=(r==null?void 0:r.tableDefaultHeightCoefficient)??.7,this.urls=r==null?void 0:r.urls,this.websocket=r!=null&&r.websocket?new Dr(r.websocket):void 0,this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((t=r==null?void 0:r.dateFormats)==null?void 0:t.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}const d=W.defineStore("common.config",()=>{const n=m.ref(new Rr);return{config:n,getConfig:()=>n.value,setConfig:t=>{n.value=u.merge(n.value,t)}}});class ge{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const t=JSON.parse(e);if(!t.availableFor||g.isAfter(g.parseISO(t.availableFor)||g.startOfToday(),new Date)){if(u.isNil(t.data)||u.isEmpty(t.data))throw new Error("Data is empty");return t.data}}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,t){if(this.isLocalStorageAvailable())try{if(u.isNil(e)||u.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,s)}catch(s){if(s instanceof DOMException&&s.code===DOMException.QUOTA_EXCEEDED_ERR){this.clearOldData();try{const o=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,o)}catch{}}else try{localStorage.removeItem(r)}catch{}}}static isLocalStorageAvailable(){try{const r="__localStorage_test__";return localStorage.setItem(r,"test"),localStorage.removeItem(r),!0}catch{return!1}}static clearOldData(){try{const r=[];for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t)try{const s=localStorage.getItem(t);if(s){const o=JSON.parse(s);o.availableFor&&!g.isAfter(g.parseISO(o.availableFor)||g.startOfToday(),new Date)&&r.push(t)}}catch{r.push(t)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function Ar(n){try{const r=H.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const X=W.defineStore("common.auth_state_private",()=>{const n=m.ref((()=>{var h;const o=ge.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const l=(h=d().config.devMode)==null?void 0:h.initAuthBearerToken;return l?Promise.resolve(l):void 0})()),r=m.ref(void 0),e=m.ref(void 0),t=m.markRaw(new Map);function s(){e.value=void 0,u.isNil(n.value)||n.value.then(o=>{const l=H.getJwtPayload(o);e.value=l.exp*1e3>Date.now()?u.mapValues(l.resourceAccess,h=>(h==null?void 0:h.roles)??[]):void 0}).catch(u.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:t,recalculateUserPermissions:s}}),De=W.defineStore("common.auth_state",()=>{const n=m.computed(()=>{const o=X();if(u.isNil(o.jwtToken)&&!u.isNil(o.jwtTokenUpdater)){const l=o.jwtTokenUpdater();o.jwtToken=l,l.then(h=>{o.jwtToken=Promise.resolve(h),ge.saveActualDataToStorage("sc.token",h,Ar(h)),o.recalculateUserPermissions()}).catch(u.noop)}return o.jwtToken});function r(o){X().jwtTokenUpdater=o}function e(o){const l=X();l.jwtToken=Promise.resolve(o),ge.saveActualDataToStorage("sc.token",o,Ar(o)),l.recalculateUserPermissions()}function t(){const o=X();o.jwtToken=void 0,o.userPermissions=void 0,ge.saveActualDataToStorage("sc.token",void 0)}function s(o){const l=X();!u.isNil(l.jwtToken)&&u.isNil(l.userPermissions)&&l.jwtToken.then(a=>{const v=H.getJwtPayload(a);l.userPermissions=v.exp*1e3>Date.now()?u.mapValues(v.resourceAccess,D=>(D==null?void 0:D.roles)??[]):void 0}).catch(u.noop);const h=u.isArray(o)?o.join(" && "):o;if(l.userPermissionsComputedRefs.has(h))return l.userPermissionsComputedRefs.get(h);const f=m.computed(()=>{const a=v=>{var pe;const D=u.split(v,".");if(D.length<2)return!1;const[ve,Pe]=D,ue=(pe=X().userPermissions)==null?void 0:pe[ve];return u.isArray(ue)&&ue.includes(Pe)};return u.isArray(o)?u.every(o,v=>a(v)):a(o)});return l.userPermissionsComputedRefs.set(h,f),f}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:t,hasUserPermission:s}});class j{constructor(r,e){i(this,"id");i(this,"guid");this.id=r==null?void 0:r.id,u.isNil(this.id)&&(u.isNil(e)?typeof(r==null?void 0:r.id)=="number"?this.id=-1:typeof(r==null?void 0:r.id)=="string"&&(this.id=""):this.id=e),this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return typeof this.id=="number"?this.id===-1:typeof this.id=="string"?this.id==="":u.isNil(this.id)}}class T extends j{constructor(e){super(e);i(this,"name","");this.name=(e==null?void 0:e.name)??""}}class Z extends T{constructor(e){super(e);i(this,"code","");this.code=(e==null?void 0:e.code)??""}}class C extends T{constructor(e){super(e);i(this,"slug");i(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class He extends T{constructor(e){super(e);i(this,"updatedAt");this.updatedAt=u.isString(e==null?void 0:e.updatedAt)?g.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class je extends He{constructor(e){super(e);i(this,"deletedAt");this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?g.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class Sr{constructor(r,e){i(this,"image");i(this,"preview");i(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class Me extends Z{constructor(e){super(e);i(this,"slug");i(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class Tr extends Me{constructor(e){super(e);i(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Re extends Me{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class Ae{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}class I extends T{constructor(e){super(e);i(this,"type");this.type=e==null?void 0:e.type}}class $r extends T{constructor(e){super(e);i(this,"costCoefficient");i(this,"isLowPriceAllowed");i(this,"publishedAt");i(this,"description");i(this,"percent");i(this,"owner");i(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=u.isString(e==null?void 0:e.publishedAt)?g.parseISO(e.publishedAt):e==null?void 0:e.publishedAt,this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new I(e==null?void 0:e.owner),this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?g.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class J extends He{constructor(e){super(e);i(this,"description");i(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}var Be=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(Be||{});class me extends C{static getRetailPriceCoefficient(){return{id:-2,slug:Be.Retail,name:"Розн. цена",guid:"",isNewRec:u.constant(!0)}}}class Se{constructor(r){i(this,"coefficient");i(this,"value");i(this,"cost");i(this,"percent");i(this,"readOnly");this.coefficient=new me(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 Ge{constructor(r){i(this,"lat");i(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class q extends C{}class x extends C{constructor(e){var t;super(e);i(this,"address");i(this,"isMain");i(this,"deliveryTypes");i(this,"regions");i(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((t=e==null?void 0:e.deliveryTypes)==null?void 0:t.map(s=>new q(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Ge(e==null?void 0:e.coordinates)}}class dr{constructor(r){i(this,"warehouse");i(this,"count");this.warehouse=new x(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class k extends T{constructor(e){super(e);i(this,"signature","");i(this,"code");i(this,"symbol","");i(this,"precision");e&&(this.signature=e.signature??"",this.code=e.code,this.symbol=e.symbol??"",this.precision=e.precision)}}class Fe extends T{constructor(e){super(e);i(this,"slug","");i(this,"description");i(this,"isSquare",!1);i(this,"isLinear",!1);e&&(this.slug=e.slug??"",this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}}class O extends Tr{constructor(e){var s,o,l,h;super(e);i(this,"supplierSku");i(this,"unit");i(this,"pack");i(this,"minCount");i(this,"currency");i(this,"cost");i(this,"costRub");i(this,"costDate");i(this,"onOrder");i(this,"stockCount");i(this,"category");i(this,"categories");i(this,"images");i(this,"properties");i(this,"retailCost");i(this,"retailCostRub");i(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=e!=null&&e.unit?new Fe(e.unit):new Fe,this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.currency=e!=null&&e.currency?new k(e.currency):new k,this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=u.isString(e==null?void 0:e.costDate)?g.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((s=e==null?void 0:e.stockCount)==null?void 0:s.map(f=>new dr(f)))??[],this.type="product";const t=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(f=>f.isPrimary));t&&(this.category=new Re({...t,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(f=>new Re(f))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(f=>new Sr(f,d().config.http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.retailCost=e==null?void 0:e.retailCost,this.retailCostRub=e==null?void 0:e.retailCostRub,this.priceCoefficients=((h=e==null?void 0:e.priceCoefficients)==null?void 0:h.map(f=>new Se(f)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}var Te=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Te||{});class M extends O{constructor(e){super(e);i(this,"costCoefficient");i(this,"costSource");i(this,"discount");i(this,"priceTemplate");i(this,"isPreviouslyOrdered");i(this,"isRequired");i(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??Te.Product,this.discount=e!=null&&e.discount?new $r(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new J(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 fe extends Re{constructor(e){super(e);i(this,"isHidden");i(this,"parentCategoryId");i(this,"properties");i(this,"currencyRates");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category",this.currencyRates=e!=null&&e.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([t,s])=>[u.toUpper(t),s])):void 0}}class ze extends j{constructor(e){super(e);i(this,"category");i(this,"product");i(this,"quantity");i(this,"currency");i(this,"marker");i(this,"height");i(this,"length");i(this,"width");i(this,"configurator");i(this,"configuratorParams");i(this,"isAdditionalSale");i(this,"creator");i(this,"isRemoved");i(this,"ord");i(this,"onOrder");i(this,"originalId");i(this,"replacementId");this.product=new M(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new fe,this.currency=e.currency?new k(e.currency):void 0,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&u.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale,this.creator=e.creator&&new I(e.creator),this.isRemoved=e.isRemoved,this.ord=e.ord,this.onOrder=e.onOrder,this.originalId=e.originalId,this.replacementId=e.replacementId}}let br=class extends ze{constructor(e){super(e);i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"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=u.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new k(e.currency)}};class E{constructor(r){i(this,"items");i(this,"resultSum");i(this,"directionsSum");this.items=r.items.map(e=>new br(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}const P=class P{constructor(){i(this,"httpClient");i(this,"baseUrl",`${d().config.http.portalApiUrl}/api`);i(this,"errorResponseHandler",u.noop);i(this,"interceptorIds",{request:{},response:{}});i(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));i(this,"authRequestInterceptor",async r=>{let e;return u.isNil(De().jwtToken)||(e=await De().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});i(this,"userRequestHooksInterceptor",async r=>P.requestHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=he.objectToSnake(r.params)),["put","patch","post"].includes(u.toLower(r.method))&&r.data&&(r.data=he.objectToSnake(r.data))),r));i(this,"authErrorsResponseInterceptors",r=>{var t;const e=r.rawError?(t=r.rawError)==null?void 0:t.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(De().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});i(this,"canceledResponseInterceptor",r=>{const e=r.rawError??r;if(e.name==="CanceledError"||e.code==="ERR_CANCELED")throw new ar.CanceledError("Request canceled");return Promise.reject(r)});i(this,"userResponseHooksInterceptor",async r=>P.responseHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=he.objectToCamel(r.data)),r));this.errorResponseHandler=P.defaultErrorsResponseHandler,this.httpClient=ar.create({headers:{Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.userRequestHooksInterceptor=this.httpClient.interceptors.request.use(this.userRequestHooksInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,r=>P.convertHttpErrorResponse(r)),this.interceptorIds.response.canceledResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.canceledResponseInterceptor),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.userResponseHooksInterceptor=this.httpClient.interceptors.response.use(this.userResponseHooksInterceptor,r=>Promise.reject(r))}static setDefaultErrorsResponseHandler(r){P.defaultErrorsResponseHandler=r}static addRequestHook(r){P.requestHooks.includes(r)||P.requestHooks.push(r)}static removeRequestHook(r){const e=P.requestHooks.indexOf(r);e!==-1&&P.requestHooks.splice(e,1)}static addResponseHook(r){P.responseHooks.includes(r)||P.responseHooks.push(r)}static removeResponseHook(r){const e=P.responseHooks.indexOf(r);e!==-1&&P.responseHooks.splice(e,1)}static getInstance(r){return Object.prototype.hasOwnProperty.call(P.instances,r.name)||(P.instances[r.name]=Ae.simpleInstanceInitializer(r)),P.instances[r.name]}static convertHttpErrorResponse(r){var e,t;if(u.isNil(r)||!u.isNil(r.request)||!u.isNil(r.response)){const s=u.isNil(r)?{}:r==null?void 0:r.response;return Promise.reject({status:(s==null?void 0:s.status)??0,statusText:(s==null?void 0:s.statusText)??"Unknown",message:((e=s==null?void 0:s.data)==null?void 0:e.message)??"Unknown Error. Probably network error.",errors:(t=s==null?void 0:s.data)==null?void 0:t.errors,headers:(s==null?void 0:s.headers)??{},data:s==null?void 0:s.data,rawError:r})}return Promise.reject(r)}request(r,e=void 0,t={},s=!1){const o=this.httpClient.request(r).then(l=>e?e(l):l.data);return o.catch(l=>{(l==null?void 0:l.name)!=="CanceledError"&&this.errorResponseHandler(l,t,s)}),o}get(r,e={},t=void 0,s=!1,o=void 0){return this.request({method:"GET",url:r,params:e,signal:o},t,{},s)}getBlob(r,e={},t=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},t,{},s)}patch(r,e={},t=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},t,s,o)}post(r,e={},t=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},t,s,o)}delete(r,e=void 0,t=!1){return this.request({method:"DELETE",url:r},e,{},t)}};i(P,"instances",{}),i(P,"defaultErrorsResponseHandler",u.noop),i(P,"requestHooks",[]),i(P,"responseHooks",[]);let y=P;class tt extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new E(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new E(s.data),t)}patchCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new E(s.data),t)}deleteCartItem(r,e){return this.delete(`internal/clients/${r.id}/cart/${e.id}`,t=>new E(t.data))}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,t=>new E(t.data))}getCartItemFromCSVExample(r){return this.get(`internal/clients/${r.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:"text/csv"}))}}var Ir=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(Ir||{}),Or=(n=>(n.Unknown="unknown",n.Bool="bool",n.Integer="integer",n.Float="float",n.String="string",n.Range="range",n.Json="json",n.Object="object",n))(Or||{});class N extends fe{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new N(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new O(o))}}class We{constructor(r){i(this,"phone");i(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class L extends C{}class $e extends T{constructor(e){super(e);i(this,"salesDirection");i(this,"photo");i(this,"contacts");i(this,"isDefault");i(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new L(e.salesDirection):new L,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new We(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class de extends C{}class Je extends T{constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class ee extends $e{constructor(e){var t;super(e);i(this,"isActive");i(this,"isSupervisor");i(this,"canDoReclamations");i(this,"createdAt");i(this,"supervisorId");i(this,"pricingRole");i(this,"curatedDirections");this.isActive=(e==null?void 0:e.isActive)??!1,this.isSupervisor=(e==null?void 0:e.isSupervisor)??!1,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.createdAt=e==null?void 0:e.createdAt,this.supervisorId=e==null?void 0:e.supervisorId,this.pricingRole=e!=null&&e.pricingRole?new Je(e.pricingRole):void 0,this.curatedDirections=((t=e==null?void 0:e.curatedDirections)==null?void 0:t.map(s=>new de(s)))??[]}}class it extends fe{constructor(e){super(e);i(this,"isDisabled");i(this,"isRequired");i(this,"isFavorite");i(this,"hidingComment");i(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 ee(e.manager):void 0}}class ye extends it{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new ye(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new M(o))}}class Ve{constructor(r){i(this,"priceCoefficient");i(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new me(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class be extends Ve{constructor(e){super(e);i(this,"productCategory");this.productCategory=new fe(e==null?void 0:e.productCategory)}}class Ie extends T{constructor(e){super(e);i(this,"photo");i(this,"contacts");i(this,"curatedDirection");this.photo=e.photo,this.contacts=new We(e.contacts),this.curatedDirection=new de(e.curatedDirection)}}class V extends C{}class re extends C{constructor(e){super(e);i(this,"country",new V);e&&(this.country=new V(e.country))}}class we extends C{constructor(e){super(e);i(this,"region",new re);e&&(this.region=new re(e.region))}}class Ke extends T{constructor(e){super(e);i(this,"phone");i(this,"email");i(this,"getNews");i(this,"salesDirection");i(this,"createdAt");i(this,"lastLoginAt");i(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 L(e.salesDirection):void 0,this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=u.isString(e==null?void 0:e.lastLoginAt)?g.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class B extends Ke{constructor(e){var t,s;super(e);i(this,"salesDirection");i(this,"debt");i(this,"alternativeName");i(this,"city");i(this,"comment");i(this,"isPhoneApproved");i(this,"isEmailApproved");i(this,"managers");i(this,"curators");this.salesDirection=new L(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 we(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=((t=e==null?void 0:e.managers)==null?void 0:t.map(o=>new $e(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new Ie(o)))??void 0}}class te extends j{constructor(e){super(e);i(this,"createdAt");i(this,"deletedAt");i(this,"client");i(this,"priceTemplate");this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?g.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new B(e==null?void 0:e.client),this.priceTemplate=new J(e==null?void 0:e.priceTemplate)}}class Oe extends Ve{constructor(e){super(e);i(this,"product");this.product=new O(e==null?void 0:e.product)}}class Qe extends C{}class ie extends T{constructor(e){super(e);i(this,"type");i(this,"description");i(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 K{constructor(r){i(this,"property");i(this,"value");this.property=new ie(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class R{constructor(r){i(this,"from");i(this,"to");this.from=u.isString(r==null?void 0:r.from)?g.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=u.isString(r==null?void 0:r.to)?g.parseISO(r.to):(r==null?void 0:r.to)??null}}class st{constructor(r){i(this,"id");i(this,"name");i(this,"description");i(this,"createdAt",new R);i(this,"updatedAt",new R);this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.description=r==null?void 0:r.description,this.createdAt=new R(r==null?void 0:r.createdAt),this.updatedAt=new R(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":this[r]=void 0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"updatedAt":this.updatedAt.from=null,this.updatedAt.to=null;break}return this}asClearRaw(){var e,t,s,o;const r={};return Object.keys(this).forEach(l=>{const h=this[l];u.isNil(h)||u.isString(h)&&h.trim().length===0||u.isFunction(h.isNewRec)&&h.isNewRec()||(r[l]=h)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((t=r==null?void 0:r.createdAt)!=null&&t.to)&&delete r.createdAt,!((s=r==null?void 0:r.updatedAt)!=null&&s.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class se extends T{constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");i(this,"subRoles",[]);i(this,"parentRole");i(this,"level",0);this.description=e==null?void 0:e.description,this.canChangeLowCost=(e==null?void 0:e.canChangeLowCost)??!1,this.parentRoleId=e==null?void 0:e.parentRoleId}}class Ye{constructor(r){i(this,"role");i(this,"category");i(this,"minCoefficient");this.role=new se(r==null?void 0:r.role),this.category=new fe(r==null?void 0:r.category),this.minCoefficient=new me(r==null?void 0:r.minCoefficient)}}class nt extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,t=void 0,s=void 0){let l=`${d().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return t&&(l+=`&category_id=${t}`),s&&(l+=`&client_id=${s}`),l}}class ot extends y{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value})}removeCategoryPrices(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}`)}markCategoryRequired(r,e){return this.post(`/internal/clients/${r}/price/categories/${e}/required`)}unmarkCategoryRequired(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/required`)}markCategoryDisabled(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:t})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:t})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}updateProductPrice(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new M(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,t=>new M(t.data))}markProductRequired(r,e){return this.post(`/internal/clients/${r}/price/products/${e}/required`)}unmarkProductRequired(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}/required`)}getCommercialOfferHtml(r,e){return this.get(`/internal/clients/${r}/price/commercial-offer/view`,e,t=>new Blob([t.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,t=>new Blob([t.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class ct extends y{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(t=>new te(t)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new te(e.data),!0)}attachTemplate(r,e,t){const s=d().config.dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,t&&{startAt:t.startAt&&g.format(t.startAt,s),endAt:t.endAt&&g.format(t.endAt,s)},o=>new te(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,t,s){const o=d().config.dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${t}`,s&&{startAt:s.startAt&&g.format(s.startAt,o),endAt:s.endAt&&g.format(s.endAt,o)},l=>new te(l.data))}detachTemplate(r,e,t){return this.delete(`/internal/clients/${r}/price/templates/${e}/${t}`)}}class lt extends y{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(t=>new N(t)))}getCategoryData(r,e=!1,t=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:t},s=>new N(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new N(e.data))}getCategoryProductsList(r,e=!0,t=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:t,withPriceCoefficients:e},s=>u.map(s.data,o=>new O(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:t}=e;return u.forEach(t,s=>s.map(o=>new Se(o))),t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.categories.map(l=>new N(l)))}).catch(o=>{s(o)})})}}class ut extends y{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},t=>new O(t.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new O(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>u.map(e.data,t=>new Se(t)))}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.products.map(l=>new O(l)))}).catch(o=>{s(o)})})}}class pt extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},t=>t.data.map(s=>new ye(s)))}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:t,withNestedCategories:s},o=>new ye(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:t},o=>u.map(o.data,l=>new M(l)))}}class ht extends y{getProductData(r,e,t=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:t},s=>new M(s.data))}}var ke=(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))(ke||{});class Xe{constructor(r){i(this,"field");i(this,"op");i(this,"value");this.field=(r==null?void 0:r.field)??"",this.op=(r==null?void 0:r.op)??ke.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r=d().config.dateFormats.api,e={field:this.field,op:this.op};return u.isDate(this.value)?e.value=g.format(this.value,r):u.isObject(this.value)?e.value={from:this.value.from?g.format(this.value.from,r):null,to:this.value.to?g.format(this.value.to,r):null}:e.value=this.value,e}}class G{constructor(r){i(this,"groupOp");i(this,"filters");i(this,"groups");var e,t;this.groupOp=(r==null?void 0:r.groupOp)??"and",this.filters=((e=r==null?void 0:r.filters)==null?void 0:e.map(s=>new Xe(s)))??[],this.groups=((t=r==null?void 0:r.groups)==null?void 0:t.map(s=>new G(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Xe&&u.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof G?r.toPrimitive():r)}}}class ne extends y{getPaginated(r,e,t,s,o,l,h,f=void 0){let a={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(a.filters=JSON.stringify((e instanceof G?e:new G(e)).toPrimitive())),u.isEmpty(t)||(a.sort=u.isArray(t)?t:[t]),o&&(a={...a,...o}),this.get(r,a,l,h,f)}}class gt extends ne{getTemplateList(r,e,t){return this.getPaginated("/internal/price/templates",r,e,t,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new J(l)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,t=>new J(t.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new J(e.data))}updateTemplate(r,e,t={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new J(s.data),t)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.get(`/internal/price/templates/${r}/products`,{},e=>e.data.map(t=>new Oe(t)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},t=>new Oe(t.data))}saveProductTemplatePrice(r,e,t){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new Oe(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.get(`/internal/price/templates/${r}/categories`,{},e=>e.data.map(t=>new be(t)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},t=>new be(t.data))}saveCategoryTemplatePrice(r,e,t,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=t.coefficient)==null?void 0:o.id,increase_percent:t.value},params:s?{recursively:!0}:{}},l=>new be(l.data))}deleteCategoryTemplatePrice(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:t?{recursively:!0}:{}})}getTemplateClients(r){return this.get(`/internal/price/templates/${r}/clients`,{},e=>e.data.map(t=>new te(t)))}}class mt extends y{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new se(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new se(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new se(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,t=>new se(t.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.get(`/internal/price/roles/rules/categories/${r}`,{},e=>e.data.map(t=>new Ye(t)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,t=>t.data.map(s=>new Ye(s)))}}class ft extends ne{getProperties(r,e,t){return this.getPaginated("/internal/catalog/properties",r,e,t,{},s=>{const o={...s.data};return o.data=o.data.map(l=>new ie(l)),o})}createProperty(r){const{typeId:e,...t}=r;return this.post("/internal/catalog/properties",{...t,type:e},s=>new ie(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new ie(e.data))}updateProperty(r,e){const{typeId:t,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:t},o=>new ie(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.get(`/internal/catalog/products/${r}/properties`,{},e=>e.data.map(t=>new K(t)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},t=>new K(t.data))}updateProductProperty(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:t},s=>new K(s.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,t)}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(t=>new K(t)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},t=>new K(t.data))}updateCategoryProperty(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:t},s=>new K(s.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,t)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}updateCategoryImage(r,e){return this.post(`/internal/catalog/categories/${r}/image`,{image:e})}}class yt extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{priceTemplateId:r,showHidden:e},t=>t.data.map(s=>new N(s)))}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{priceTemplateId:r,showHidden:t,withNestedCategories:s},o=>new N(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{priceTemplateId:r,showHidden:s,withPriceCoefficients:t},o=>u.map(o.data,l=>new O(l)))}}function Ze(n,r,e){let t;return n.some(s=>{if(s.type===e&&s.id===r)return t=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const l=Ze(o.products,r,e);if(l)return t=l,!0}if(o.categories&&o.categories.length>0){const l=Ze(o.categories,r,e);if(l)return t=l,!0}return!1}),t}function xe(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const t=e;t.products&&t.products.length>0&&r.push(...xe(t.products)),t.categories&&t.categories.length>0&&r.push(...xe(t.categories))}}),r}var kr=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n.SalesDirection="sales_direction",n.Managers="managers",n.Curators="curators",n))(kr||{}),U=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(U||{});class Lr extends C{}class Ee extends C{}class wt extends C{}class _r extends C{}class F extends C{static generatePersonItem(){return new F({id:1,guid:"",slug:U.Person,name:""})}}class er extends C{}class qr extends C{}class ae extends C{}class Q extends C{}class rr extends C{}class Nr extends C{}class at{static generateUndefinedInstance(r,e="- Не определён -"){return new r({id:0,name:e,slug:"-undefined-"})}static isUndefinedInstance(r){return r.id===0&&r.slug==="-undefined-"}}class tr extends C{}class ir extends C{}class Le extends j{constructor(e){super(e);i(this,"bankName","");i(this,"bic","");i(this,"accountNumber","");i(this,"correspondentAccount","");i(this,"currency",new k);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new k(e.currency))}}class _e extends T{constructor(e){super(e);i(this,"phone");i(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 z extends _e{constructor(e){super(e);i(this,"isPrimary");i(this,"position");i(this,"notDisturb");i(this,"comment");i(this,"updatedAt");i(this,"deletedAt");this.isPrimary=(e==null?void 0:e.isPrimary)??!1,this.position=e==null?void 0:e.position,this.notDisturb=(e==null?void 0:e.notDisturb)??!1,this.comment=e==null?void 0:e.comment,this.updatedAt=e==null?void 0:e.updatedAt,this.deletedAt=u.isString(e==null?void 0:e.deletedAt)?g.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class sr extends je{constructor(e){super(e);i(this,"opf",F.generatePersonItem());i(this,"partnerGroup",new Q);i(this,"contacts",[]);i(this,"bankAccounts",[]);i(this,"comment");i(this,"alternativeName");i(this,"createdAt");i(this,"creator");i(this,"updater");if(e){if(this.opf=new F(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new I(e.creator):void 0,this.updater=e.updater?new I(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new Q(e.partnerGroup)),e.contacts){const t=[];e.contacts.forEach(s=>{t.push(new z(s))}),this.contacts=t}if(e.bankAccounts){const t=[];e.bankAccounts.forEach(s=>{t.push(new Le(s))}),this.bankAccounts=t}}}}class Ur extends sr{constructor(r){super(r)}}class nr extends sr{constructor(e){super(e);i(this,"inn","");i(this,"okpo","");i(this,"directorName","");i(this,"directorPosition","");i(this,"directorActsOn","");i(this,"legalAddress","");i(this,"postalAddress","");i(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 or extends nr{constructor(e){super(e);i(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class Hr extends or{constructor(e){super(e);i(this,"registrationCountry",new V);i(this,"registrationNumber","");i(this,"taxNumber","");e&&(this.registrationCountry=new V(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class Ce{static createInstance(r){switch(r.opf.slug){case U.Ic:return new nr(r);case U.UlR:return new or(r);case U.UlNr:return new Hr(r);default:return new Ur(r)}}}class qe extends j{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=e.isPrimary}}class jr extends z{constructor(e){super(e);i(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(t=>new qe(t))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(t=>new qe(t))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(t=>new qe(t))))}}class oe extends je{constructor(e){var t;super(e);i(this,"address","");i(this,"coordinates");i(this,"contacts");i(this,"comment");i(this,"operatingHours");i(this,"isOneTime");i(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new Ge(e==null?void 0:e.coordinates),this.contacts=((t=e==null?void 0:e.contacts)==null?void 0:t.map(s=>new z(s)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class cr extends B{constructor(e){var t,s,o,l;super(e);i(this,"contragents");i(this,"partnerGroups");i(this,"contacts");i(this,"deliveryAddresses");i(this,"channelPrimaryInterest");i(this,"sourcePrimaryInterest");i(this,"preferredDeliveryType");i(this,"primaryDemand");i(this,"preferredWarehouse");i(this,"extraData");this.contragents=((t=e==null?void 0:e.contragents)==null?void 0:t.map(h=>Ce.createInstance(h)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(h=>new Q(h)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(h=>new z(h)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(h=>new oe(h)))??[],this.channelPrimaryInterest=new Ee(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new ir(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new q(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new x(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class Ne{asClearRaw(){const r={};return Object.keys(this).forEach(e=>{const t=this[e];u.isNil(t)||u.isString(t)&&t.trim().length===0||u.isFunction(t.isNewRec)&&t.isNewRec()||(r[e]=t)}),r}}class Ct extends Ne{constructor(e){var t,s,o,l,h,f,a,v;super();i(this,"id");i(this,"name");i(this,"alternativeName");i(this,"searchTerm");i(this,"cities");i(this,"region");i(this,"country");i(this,"phone");i(this,"email");i(this,"isActive");i(this,"createdAt",new R);i(this,"lastLoginDate",new R);i(this,"lastLoginDateHasOrder");i(this,"managers");i(this,"includeSubordinateManagers");i(this,"curators");i(this,"isManagerRequired");i(this,"salesDirections");i(this,"contragentInn");i(this,"contragentType");i(this,"preferredDeliveryType");i(this,"partnerGroups");i(this,"contact");i(this,"lastOrder");i(this,"noOrdersPeriod",new R);this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.alternativeName=e==null?void 0:e.alternativeName,this.searchTerm=e==null?void 0:e.searchTerm,this.cities=(t=e==null?void 0:e.cities)==null?void 0:t.map(D=>new we(D)),this.region=new re(e==null?void 0:e.region),this.country=new V(e==null?void 0:e.country),this.phone=e==null?void 0:e.phone,this.email=e==null?void 0:e.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,"isActive")?e==null?void 0:e.isActive:!0,this.createdAt=new R(e==null?void 0:e.createdAt),this.lastLoginDate=new R(e==null?void 0:e.lastLoginDate),this.lastLoginDateHasOrder=(e==null?void 0:e.lastLoginDateHasOrder)??void 0,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(D=>new ee(D)))??[],this.includeSubordinateManagers=(e==null?void 0:e.includeSubordinateManagers)??!0,this.curators=((o=e==null?void 0:e.curators)==null?void 0:o.map(D=>new Ie(D)))??[],this.salesDirections=(l=e==null?void 0:e.salesDirections)==null?void 0:l.map(D=>new L(D)),this.contragentInn=e==null?void 0:e.contragentInn,this.contragentType=new F(e==null?void 0:e.contragentType),this.preferredDeliveryType=e!=null&&e.preferredDeliveryType?new q(e==null?void 0:e.preferredDeliveryType):void 0,this.partnerGroups=(h=e==null?void 0:e.partnerGroups)==null?void 0:h.map(D=>new Q(D)),this.contact=new _e(e==null?void 0:e.contact),this.lastOrder={createdAt:new R((f=e==null?void 0:e.lastOrder)==null?void 0:f.createdAt),creator:(a=e==null?void 0:e.lastOrder)==null?void 0:a.creator,isApproved:(v=e==null?void 0:e.lastOrder)==null?void 0:v.isApproved},this.noOrdersPeriod=new R(e==null?void 0:e.noOrdersPeriod)}resetFilterValue(e){switch(e){case"cities":this.cities=[];break;case"region":this.region=new re;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"noOrdersPeriod":this.noOrdersPeriod.from=null,this.noOrdersPeriod.to=null;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new F;break;case"preferredDeliveryType":this.preferredDeliveryType=new q;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new _e;break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,l,h,f;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.lastLoginDate)!=null&&o.from)&&!((l=e==null?void 0:e.lastLoginDate)!=null&&l.to)&&delete e.lastLoginDate,!((h=e==null?void 0:e.noOrdersPeriod)!=null&&h.from)&&!((f=e==null?void 0:e.noOrdersPeriod)!=null&&f.to)&&delete e.noOrdersPeriod,e}}class lr extends j{constructor(e){super(e);i(this,"createdAt");i(this,"creator");this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new I(e==null?void 0:e.creator)}}class Mr extends T{constructor(e){var t,s,o,l;super(e);i(this,"contacts",[]);i(this,"preferredDeliveryType");i(this,"partnerGroups",[]);i(this,"lastOrder");i(this,"salesDirection");i(this,"managers");i(this,"curators");this.contacts=((t=e.contacts)==null?void 0:t.map(h=>new z(h)))??void 0,this.lastOrder=e.lastOrder?new lr(e.lastOrder):void 0,this.partnerGroups=((s=e.partnerGroups)==null?void 0:s.map(h=>new Q(h)))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new q(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new L(e.salesDirection):void 0,this.managers=((o=e.managers)==null?void 0:o.map(h=>new $e(h)))??void 0,this.curators=((l=e.curators)==null?void 0:l.map(h=>new Ie(h)))??void 0}}class Br{constructor(r){i(this,"page",1);i(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class vt extends Br{constructor(e){super(e);i(this,"itemCount",0);i(this,"pageCount",1);i(this,"pageSlot",5);i(this,"pageSizes",[25,50,100]);i(this,"showSizePicker",!0);this.itemCount=(e==null?void 0:e.itemCount)??0,this.pageCount=(e==null?void 0:e.pageCount)??1,this.pageSlot=(e==null?void 0:e.pageSlot)??5,this.pageSizes=(e==null?void 0:e.pageSizes)??[25,50,100],this.showSizePicker=(e==null?void 0:e.showSizePicker)??!0}}class Pt{constructor(r){i(this,"field");i(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class _ extends ne{static transformClientDataToRequest(r){var t;return{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(s=>s.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,preferred_warehouse_id:(t=r.preferredWarehouse)==null?void 0:t.id}}static transformContragentClientDataToRequest(r){var l,h,f,a;let e;const t=r,s=r,o=r;switch(r.opf.slug){case U.Ic:e={opf:t.opf.slug,name:t.name,alternative_name:t.alternativeName,partner_group_id:(l=t.partnerGroup)==null?void 0:l.id,comment:t.comment,inn:t.inn,okpo:t.okpo,director_name:t.directorName,director_position:t.directorPosition,director_acts_on:t.directorActsOn,legal_address:t.legalAddress,postal_address:t.postalAddress,actual_address:t.actualAddress};break;case U.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(h=s.partnerGroup)==null?void 0:h.id,comment:s.comment,inn:s.inn,kpp:s.kpp,okpo:s.okpo,director_name:s.directorName,director_position:s.directorPosition,director_acts_on:s.directorActsOn,legal_address:s.legalAddress,postal_address:s.postalAddress,actual_address:s.actualAddress};break;case U.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(f=o.partnerGroup)==null?void 0:f.id,comment:o.comment,director_name:o.directorName,director_position:o.directorPosition,director_acts_on:o.directorActsOn,legal_address:o.legalAddress,postal_address:o.postalAddress,actual_address:o.actualAddress,registration_country_id:o.registrationCountry.id,registration_number:o.registrationNumber,tax_number:o.taxNumber||void 0};break;default:e={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:(a=r.partnerGroup)==null?void 0:a.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var t,s;const e={address:r.address,is_one_time:r.isOneTime??!1,is_transport_company_address:r.isTransportCompanyAddress??!1,comment:r.comment??""};return r.coordinates&&(e.coordinates={lat:(t=r.coordinates)==null?void 0:t.lat,long:(s=r.coordinates)==null?void 0:s.long}),r.operatingHours&&(e.operating_hours={from:r.operatingHours.from,to:r.operatingHours.to}),e}static transformClientContragentBankAccountToRequest(r){return{bank_name:r.bankName,bic:r.bic,account_number:r.accountNumber,correspondent_account:r.correspondentAccount,currency_id:r.currency.id}}getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new cr(e.data))}getClientsList(r,e,t,s,o=void 0){return this.getPaginated("/internal/clients",r,e,t,s,l=>{const h={...l.data};return h.data=h.data.map(f=>new B(f)),h},void 0,o)}searchClient(r){return this.getClientsList(void 0,void 0,void 0,{searchTerm:r}).then(e=>e.data)}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:ke.Contains,value:r}]})}getAdditionalClientsData(r,e){const t=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:t,requested_data_types:e},s=>{let o=[];return(s==null?void 0:s.data.length)>0&&(o=s.data.map(l=>new Mr(l))),o})}getAllClientContacts(r){return this.get(`/internal/clients/${r}/contacts/all`,{},e=>{let t=[];return(e==null?void 0:e.data.length)>0&&(t=e.data.map(s=>new jr(s))),t})}createClientCommonData(r,e={}){return this.post("/internal/clients",_.transformClientDataToRequest(r),t=>new cr(t.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,_.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const t={get_news:r.getNews};return this.patch(`/internal/clients/${r.id}`,t,void 0,e)}changeClientPassword(r,e,t,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:t},void 0,s)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(t)}async detachClientFromManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(t)}attachToCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:t.id})}detachFromCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:t.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(t=>({curator_id:t.curatorId,curated_direction_id:t.curatedDirection.id}))})}createContragentClientData(r,e,t={}){return this.post(`/internal/clients/${r}/contragents`,_.transformContragentClientDataToRequest(e),s=>Ce.createInstance(s.data),t)}updateContragentClientData(r,e,t={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,_.transformContragentClientDataToRequest(e),s=>Ce.createInstance(s.data),t)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}getClientDeliveryAddresses(r){return this.get(`/internal/clients/${r}/delivery-addresses`,{},e=>e.data.map(t=>new oe(t)))}createClientDeliveryAddress(r,e,t={}){return this.post(`/internal/clients/${r}/delivery-addresses`,_.transformClientDeliveryAddressToRequest(e),s=>new oe(s.data),t)}updateClientDeliveryAddress(r,e,t={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,_.transformClientDeliveryAddressToRequest(e),s=>new oe(s.data),t)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,t,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,_.transformClientContragentBankAccountToRequest(t),o=>new Le(o.data),s)}updateContragentBankAccount(r,e,t,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`,_.transformClientContragentBankAccountToRequest(t),o=>new Le(o.data),s)}deleteContragentBankAccount(r,e,t){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`)}createClientContact(r,e,t={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},t)}updateClientContact(r,e,t={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},s=>new z(s.data),t)}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,t,s={}){return this.createContact(r,t,{contragents:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachContragentContact(r,e,t){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/detach`)}createDeliveryAddressContact(r,e,t,s={}){return this.createContact(r,t,{addresses:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachDeliveryAddressContact(r,e,t){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/detach`)}createContact(r,e,t,s={}){var l,h;const o={name:e.name,position:e.position,comment:e.comment,...t};return(l=e.phone)!=null&&l.length&&(o.phone=e.phone),(h=e.email)!=null&&h.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,f=>new z(f.data),s)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}const le=class le extends y{constructor(){super();i(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=d().config.http.responseDataCacheTimeout}static getCachedResponse(e){const t=le.responseDataCache.get(e);if(t&&t.validTo>new Date)return t.val}cacheResponse(e,t){le.responseDataCache.set(e,{validTo:g.addSeconds(new Date,this.responseDataCacheTimeout),val:t})}getTypedDataArrayRequester(e,t,s=!1,o={}){const l=t+(u.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),h=s?le.getCachedResponse(l):void 0;return h?Promise.resolve(h):this.get(t,o).then(f=>{const a=f.map(v=>Ae.instanceInitializer(e,v));return s&&a&&this.cacheResponse(t,a),a})}};i(le,"responseDataCache",new Map);let ce=le;class Dt extends y{checkPhoneIsBusy(r){return new Promise((e,t)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(t)})}}class Rt{constructor(r){i(this,"date");i(this,"name");i(this,"version");this.date=u.isString(r==null?void 0:r.date)?g.parseISO(r.date):(r==null?void 0:r.date)??new Date,this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}var Gr=(n=>(n.Kozyrek="kozyrek",n.Mosquitto="mosquitto",n.Strip="strip",n.MetalForDoors="metal_for_doors",n.Sandwich="sandwich",n.SandwichM2="sandwich_m2",n))(Gr||{});class At extends y{getConfiguratorSettings(r,e){var t;return this.get(`internal/catalog/categories/${r.id}/configurators/${(t=r.properties)==null?void 0:t.configurator}/settings?client_id=${e}`)}searchProduct(r,e,t,s={}){var l;const o=this.get(`internal/catalog/categories/${r.id}/configurators/${(l=r.properties)==null?void 0:l.configurator}/product`,{params:t,client_id:e},h=>new O(h.data));return o.catch(h=>{this.errorResponseHandler(h,s)}),o}createTemplate(r,e,t,s={}){var o;return this.post(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/template?client_id=${e}`,{...t},()=>{},s)}removeTemplate(r,e,t){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template/${t}?client_id=${e}`)}calculate(r,e,t){var s;return this.get(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/calculate`,{client_id:e,...t})}}class St{static defaultDateRanges(){const r=g.addBusinessDays(new Date,1);return{nextWorkingDay:{label:"Следующий рабочий день",from:g.startOfDay(r),to:g.endOfDay(r)},today:{label:"Сегодня",from:g.startOfToday(),to:g.endOfToday()},yesterday:{label:"Вчера",from:g.startOfYesterday(),to:g.endOfYesterday()},tomorrow:{label:"Завтра",from:g.startOfTomorrow(),to:g.endOfTomorrow()}}}}class ur{static productIsMeasurable(r){return r.unit.isLinear||r.unit.isSquare}static getProductMultiplicity(r){var e,t;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((t=r.properties)!=null&&t.minCount)&&!ur.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,t,s;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((t=r.properties)!=null&&t.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)?r.properties.minCount:.01}}function Tt(n,r){const e=[2,0,1,1,1,2];return r[n%100>4&&n%100<20?2:e[Math.min(n%10,5)]]}class $t{static generateUndefinedManagerInstance(){return new ee({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Fr extends ce{async getManagers(){const r="/internal/managers",e=ce.getCachedResponse(r);if(e)return e;const s=(await this.get(r)).data.map(o=>Ae.instanceInitializer(ee,o));return this.cacheResponse(r,s),s}}class pr extends j{constructor(e){super(e);i(this,"name");i(this,"createdAt");i(this,"client");i(this,"sum");this.name=e==null?void 0:e.name,this.createdAt=u.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.client=new B(e==null?void 0:e.client),this.sum=e==null?void 0:e.sum}}class Y extends pr{constructor(e){super(e);i(this,"sum");i(this,"products");this.sum=e.sum??0,this.products=(e.products??[]).map(t=>new br(t))}}class dt extends Ne{constructor(e){super();i(this,"id");i(this,"clientSearchTerm");i(this,"name");i(this,"createdAt",new R);this.id=e==null?void 0:e.id,this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.name=e==null?void 0:e.name,this.createdAt=new R(e==null?void 0:e.createdAt)}resetFilterValue(e){return e==="createdAt"?(this.createdAt.from=null,this.createdAt.to=null):this[e]=void 0,this}asClearRaw(){var t,s;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,e}}class hr extends lr{constructor(e){var t,s,o,l,h,f,a,v;super(e);i(this,"client");i(this,"payment");i(this,"delivery");i(this,"attachedUser");i(this,"status");i(this,"statusDetail");i(this,"salesDirection");i(this,"attachedAt");i(this,"isOnOrder");i(this,"isNotInStock");i(this,"sum");i(this,"isLargeOrder");this.client=new B(e==null?void 0:e.client),this.payment={type:((t=e==null?void 0:e.payment)==null?void 0:t.type)??-1,status:((s=e==null?void 0:e.payment)==null?void 0:s.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((l=e==null?void 0:e.delivery)==null?void 0:l.type)??-1,date:u.isString((h=e==null?void 0:e.delivery)==null?void 0:h.date)?g.parseISO(e.delivery.date):((f=e==null?void 0:e.delivery)==null?void 0:f.date)??new Date,address:(a=e==null?void 0:e.delivery)!=null&&a.address?new oe(e.delivery.address):void 0,warehouse:(v=e==null?void 0:e.delivery)!=null&&v.warehouse?new x(e.delivery.warehouse):void 0},this.attachedUser=e!=null&&e.attachedUser?new I(e==null?void 0:e.attachedUser):void 0,this.status=new ae(e==null?void 0:e.status),this.statusDetail=e!=null&&e.statusDetail?new C(e.statusDetail):void 0,this.salesDirection=new L(e==null?void 0:e.salesDirection),this.attachedAt=u.isString(e==null?void 0:e.attachedAt)?g.parseISO(e.attachedAt):e==null?void 0:e.attachedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1,this.sum=(e==null?void 0:e.sum)??0,this.isLargeOrder=(e==null?void 0:e.isLargeOrder)??!1}}class zr extends ze{constructor(e,t){super(e);i(this,"product");i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");i(this,"changedFields",[]);i(this,"replacement");this.product=new M(e.product),this.currency=new k(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,t&&(this.replacement=t,this.quantity!==t.quantity&&this.changedFields.push("quantity"),this.length!==t.length&&this.changedFields.push("length"))}}class $ extends hr{constructor(e){var t;super(e);i(this,"products");i(this,"invoices");i(this,"comment");i(this,"image");i(this,"contragent");i(this,"barcode");i(this,"orderSource");i(this,"isAllowProcessingWithoutPayment");i(this,"nextStatuses");i(this,"actions");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"erpOrderUrl");this.products=(e.products??[]).map(s=>{var l;const o=s.replacementId?(l=e.products)==null?void 0:l.find(h=>h.id===s.replacementId):void 0;return new zr(s,o)}),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?Ce.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new C(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment,this.nextStatuses=(t=e.nextStatuses)==null?void 0:t.map(s=>new ae(s)),this.actions=e.actions,this.operatorsComment=e.operatorsComment,this.operatorsForWarehouseComment=e.operatorsForWarehouseComment,this.erpOrderUrl=e.erpOrderUrl}}class bt extends ne{getOffers(r,e,t,s=void 0){return this.getPaginated("/internal/orders/offers",r,e,t,{},o=>{const l={...o.data};return l.data=l.data.map(h=>new pr(h)),l},void 0,s)}createOfferFromCart(r,e,t){return this.post(`/internal/orders/offers/${r}`,{name:e,items:t!=null&&t.length?t:void 0},s=>new Y(s.data))}getOffer(r){return this.get(`/internal/orders/offers/${r}`,{},e=>new Y(e.data))}updateOffer(r,e){return this.patch(`/internal/orders/offers/${r}`,{name:e},t=>new Y(t.data))}deleteOffer(r){return this.delete(`/internal/orders/offers/${r}`)}createOrderFromDraft(r,e,t,s={}){const o=d().config.dateFormats.api;return this.post(`/internal/orders/offers/${r}/create-order`,{...e,deliveryDate:e.deliveryDate?g.format(e.deliveryDate,o):void 0,items:t!=null&&t.length?t:void 0},l=>l.data.map(h=>new $(h)),s)}addOfferProduct(r,e,t={}){return this.post(`/internal/orders/offers/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new Y(s.data),t)}patchOfferProduct(r,e,t,s={}){return this.patch(`/internal/orders/offers/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,...t.configuratorParams},o=>new Y(o.data),s)}deleteOfferProduct(r,e){return this.delete(`/internal/orders/offers/${r}/products/${e}`,t=>new Y(t.data))}getOfferPdf(r,e){return this.getBlob(`/internal/orders/offers/${r}/download`,e?{recipientText:e}:{},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOffer(r,e){return this.post(`/internal/orders/offers/${r}/send`,e)}}var Wr=(n=>(n.View="view",n.Share="share",n.EditTags="edit_tags",n.SaveOrderIgnoredProducts="save_order_ignored_products",n.ChangeStatus="change_status",n.ChangeProducts="change_products",n.ChangeOrderParameters="change_order_parameters",n.Recalculate="recalculate",n.AttachOrder="attach_order",n.DetachOrder="detach_order",n.ChangeAttachedOperator="change_attached_operator",n.SendOnlinePaymentLink="send_online_payment_link",n.ConfirmOnlineFullPayment="confirm_online_full_payment",n.MergeOrders="merge_orders",n.GetHistory="get_history",n.CloneOrder="clone_order",n.DeleteAttachedFile="delete_attached_file",n))(Wr||{});class It{constructor(r){i(this,"paymentType");i(this,"deliveryType");i(this,"contragentId");i(this,"deliveryDate");i(this,"addressId");i(this,"warehouseId");i(this,"image");i(this,"comment");i(this,"barcode");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"additionalEmails");i(this,"isAllowProcessingWithoutPayment");i(this,"isAdditionalSale");var e,t,s;this.paymentType=r==null?void 0:r.payment.type,this.deliveryType=r==null?void 0:r.delivery.type,this.contragentId=(e=r==null?void 0:r.contragent)==null?void 0:e.id,this.deliveryDate=r!=null&&r.delivery.date?new Date(r.delivery.date):void 0,this.addressId=(t=r==null?void 0:r.delivery.address)==null?void 0:t.id,this.warehouseId=(s=r==null?void 0:r.delivery.warehouse)==null?void 0:s.id,this.comment=r==null?void 0:r.comment,this.barcode=r==null?void 0:r.barcode,this.operatorsComment=r==null?void 0:r.operatorsComment,this.operatorsForWarehouseComment=r==null?void 0:r.operatorsForWarehouseComment,this.isAllowProcessingWithoutPayment=r==null?void 0:r.isAllowProcessingWithoutPayment}}var Jr=(n=>(n.New="new",n.Processing="processing",n.AwaitingSupplyProducts="awaiting_supply_products",n.InvoiceIssued="invoice_issued",n.ProcessingOnStock="processing_on_stock",n.Finished="finished",n.OrderUpdated="order_updated",n.Canceled="canceled",n.Error="error",n))(Jr||{}),Vr=(n=>(n.WillWaiting="will_waiting",n))(Vr||{});class A extends ce{getReference(r,e=!1){return this.getTypedDataArrayRequester(Lr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Ee,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(_r,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester(de,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(k,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(Q,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(F,"/public/references/opf",!0)}getOperators(){return this.getTypedDataArrayRequester(er,"/internal/references/operator",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(qr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(ae,"/internal/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(rr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(tr,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(L,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(ir,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(we,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(re,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(V,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(q,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(x,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Qe,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(me,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(Nr,"/public/references/product-file-type",!0)}}const S=W.defineStore("common.references_private",()=>{const n=m.ref({}),r=m.ref(void 0),e=m.ref(void 0),t=m.ref(void 0),s=m.ref(void 0),o=m.ref(void 0),l=m.ref(void 0),h=m.ref(void 0),f=m.ref(void 0),a=m.ref(void 0),v=m.ref(void 0),D=m.ref(void 0),ve=m.ref(void 0),Pe=m.ref(void 0),ue=m.ref(void 0),pe=m.ref(void 0),yr=m.ref(void 0),wr=m.ref(void 0),p=m.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:t,deliveryTypeReference:s,managersList:o,opfReference:l,operatorReference:h,orderPaymentStatusReference:f,orderStatusReference:a,paymentTypeReference:v,partnerGroupReference:D,productFileTypeReference:ve,resourceTypesReference:Pe,salesDirectionsReference:ue,sourcePrimaryInterestReference:pe,warehousesReference:yr,propertyTypesReference:wr,priceCoefficientsReference:p}}),Ot=W.defineStore("common.references",()=>{const n=m.computed(()=>{const p=S();return!p.channelPrimaryInterestReference&&!p.dataLoaderList.channelPrimaryInterestReference&&(p.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(A).getChannelPrimaryInterest().then(w=>{p.channelPrimaryInterestReference=w}).catch(u.noop)),p.channelPrimaryInterestReference}),r=m.computed(()=>{const p=S();return!p.contactPositionsReference&&!p.dataLoaderList.contactPositionsReference&&(p.dataLoaderList.contactPositionsReference=!0,y.getInstance(A).getContactPositions().then(w=>{p.contactPositionsReference=w}).catch(u.noop)),p.contactPositionsReference}),e=m.computed(()=>{const p=S();return!p.currencyReference&&!p.dataLoaderList.currencyReference&&(p.dataLoaderList.currencyReference=!0,y.getInstance(A).getCurrency().then(w=>{p.currencyReference=w}).catch(u.noop)),p.currencyReference}),t=m.computed(()=>{const p=S();return!p.opfReference&&!p.dataLoaderList.opfReference&&(p.dataLoaderList.opfReference=!0,y.getInstance(A).getOpf().then(w=>{p.opfReference=w}).catch(u.noop)),p.opfReference}),s=m.computed(()=>{const p=S();return!p.operatorReference&&!p.dataLoaderList.operatorReference&&(p.dataLoaderList.operatorReference=!0,y.getInstance(A).getOperators().then(w=>{p.operatorReference=w}).catch(u.noop)),p.operatorReference}),o=m.computed(()=>{const p=S();return!p.orderPaymentStatusReference&&!p.dataLoaderList.orderPaymentStatusReference&&(p.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(A).getOrderPaymentStatuses().then(w=>{p.orderPaymentStatusReference=w}).catch(u.noop)),p.orderPaymentStatusReference}),l=m.computed(()=>{const p=S();return!p.orderStatusReference&&!p.dataLoaderList.orderStatusReference&&(p.dataLoaderList.orderStatusReference=!0,y.getInstance(A).getOrderStatuses().then(w=>{p.orderStatusReference=w}).catch(u.noop)),p.orderStatusReference}),h=m.computed(()=>{const p=S();return!p.paymentTypeReference&&!p.dataLoaderList.paymentTypeReference&&(p.dataLoaderList.paymentTypeReference=!0,y.getInstance(A).getPaymentTypes().then(w=>{p.paymentTypeReference=w}).catch(u.noop)),p.paymentTypeReference}),f=m.computed(()=>{const p=S();return!p.partnerGroupReference&&!p.dataLoaderList.partnerGroupReference&&(p.dataLoaderList.partnerGroupReference=!0,y.getInstance(A).getPartnerGroup().then(w=>{p.partnerGroupReference=w}).catch(u.noop)),p.partnerGroupReference}),a=m.computed(()=>{const p=S();return!p.productFileTypeReference&&!p.dataLoaderList.productFileTypeReference&&(p.dataLoaderList.productFileTypeReference=!0,y.getInstance(A).getProductFileType().then(w=>{p.productFileTypeReference=w}).catch(u.noop)),p.productFileTypeReference}),v=m.computed(()=>{const p=S();return!p.resourceTypesReference&&!p.dataLoaderList.resourceTypesReference&&(p.dataLoaderList.resourceTypesReference=!0,y.getInstance(A).getResourceTypes().then(w=>{p.resourceTypesReference=w}).catch(u.noop)),p.resourceTypesReference}),D=m.computed(()=>{const p=S();return!p.salesDirectionsReference&&!p.dataLoaderList.salesDirectionsReference&&(p.dataLoaderList.salesDirectionsReference=!0,y.getInstance(A).getSalesDirections().then(w=>{p.salesDirectionsReference=w}).catch(u.noop)),p.salesDirectionsReference}),ve=m.computed(()=>{const p=S();return!p.sourcePrimaryInterestReference&&!p.dataLoaderList.sourcePrimaryInterestReference&&(p.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(A).getSourcePrimaryInterest().then(w=>{p.sourcePrimaryInterestReference=w}).catch(u.noop)),p.sourcePrimaryInterestReference}),Pe=m.computed(()=>{const p=S();return!p.deliveryTypeReference&&!p.dataLoaderList.deliveryTypeReference&&(p.dataLoaderList.deliveryTypeReference=!0,y.getInstance(A).getDeliveryTypes().then(w=>{p.deliveryTypeReference=w}).catch(u.noop)),p.deliveryTypeReference}),ue=m.computed(()=>{const p=S();return!p.managersList&&!p.dataLoaderList.managersList&&(p.dataLoaderList.managersList=!0,y.getInstance(Fr).getManagers().then(w=>{p.managersList=w}).catch(u.noop)),p.managersList}),pe=m.computed(()=>{const p=S();return!p.warehousesReference&&!p.dataLoaderList.warehousesReference&&(p.dataLoaderList.warehousesReference=!0,y.getInstance(A).getWarehouses().then(w=>{p.warehousesReference=w}).catch(u.noop)),p.warehousesReference}),yr=m.computed(()=>{const p=S();return!p.propertyTypesReference&&!p.dataLoaderList.propertyTypesReference&&(p.dataLoaderList.propertyTypesReference=!0,y.getInstance(A).getPropertyTypes().then(w=>{p.propertyTypesReference=w}).catch(u.noop)),p.propertyTypesReference}),wr=m.computed(()=>{const p=S();return!p.priceCoefficientsReference&&!p.dataLoaderList.priceCoefficientsReference&&(p.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(A).getPriceCoefficients().then(w=>{p.priceCoefficientsReference=w}).catch(u.noop)),p.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:t,operatorReference:s,orderPaymentStatusReference:o,orderStatusReference:l,paymentTypeReference:h,partnerGroupsReference:f,productFilesTypesReference:a,resourceTypesReference:v,salesDirectionsReference:D,sourcePrimaryInterestsReference:ve,deliveryTypeReference:Pe,managersList:ue,warehousesReference:pe,propertyTypesReference:yr,priceCoefficientsReference:wr}});class kt extends Ne{constructor(e){var t,s,o,l;super();i(this,"attachedUsers");i(this,"clientSearchTerm");i(this,"client");i(this,"contragent");i(this,"createdAt",new R);i(this,"creator");i(this,"deliveryDate",new R);i(this,"deliveryAddressSearch");i(this,"clientCities");i(this,"id");i(this,"isApproved");i(this,"isNotInStock");i(this,"isOnOrder");i(this,"attachedAt",new R);i(this,"salesDirections");i(this,"status");i(this,"statusDetail");i(this,"deliveryType");i(this,"paymentType");i(this,"warehouses");i(this,"isLargeOrder");i(this,"isToProcess");i(this,"onlyMyRegions");this.attachedUsers=(t=e==null?void 0:e.attachedUsers)==null?void 0:t.map(h=>"isActive"in h?new ee(h):new er(h)),this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.client=e!=null&&e.client?new B(e.client):void 0,this.contragent=e==null?void 0:e.contragent,this.createdAt=new R(e==null?void 0:e.createdAt),this.creator=e!=null&&e.creator?new I(e.creator):void 0,this.deliveryDate=new R(e==null?void 0:e.deliveryDate),this.deliveryAddressSearch=e==null?void 0:e.deliveryAddressSearch,this.clientCities=(s=e==null?void 0:e.clientCities)==null?void 0:s.map(h=>new we(h)),this.id=e==null?void 0:e.id,this.isApproved=e==null?void 0:e.isApproved,this.isNotInStock=e==null?void 0:e.isNotInStock,this.isOnOrder=e==null?void 0:e.isOnOrder,this.isLargeOrder=e==null?void 0:e.isLargeOrder,this.attachedAt=new R(e==null?void 0:e.attachedAt),this.salesDirections=(o=e==null?void 0:e.salesDirections)==null?void 0:o.map(h=>new L(h)),this.status=e==null?void 0:e.status,this.statusDetail=e==null?void 0:e.statusDetail,this.deliveryType=e!=null&&e.deliveryType?new q(e.deliveryType):void 0,this.paymentType=e!=null&&e.paymentType?new rr(e.paymentType):void 0,this.warehouses=(l=e==null?void 0:e.warehouses)==null?void 0:l.map(h=>new x(h)),this.isToProcess=e==null?void 0:e.isToProcess}resetFilterValue(e){switch(e){case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"creator":this.creator=void 0;break;case"deliveryDate":this.deliveryDate.from=null,this.deliveryDate.to=null;break;case"deliveryType":this.deliveryType=new q;break;case"clientCities":this.clientCities=[];break;case"attachedAt":this.attachedAt.from=null,this.attachedAt.to=null;break;case"salesDirection":this.salesDirections=[];break;case"status":this.status=[];break;case"warehouse":this.warehouses=[];break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,l,h,f;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.deliveryDate)!=null&&o.from)&&!((l=e==null?void 0:e.deliveryDate)!=null&&l.to)&&delete e.deliveryDate,!((h=e==null?void 0:e.attachedAt)!=null&&h.from)&&!((f=e==null?void 0:e.attachedAt)!=null&&f.to)&&delete e.attachedAt,e}}class Kr{constructor(r){i(this,"user");i(this,"status");i(this,"statusDetail");i(this,"createdAt");this.user=new I(r==null?void 0:r.user),this.status=new ae(r==null?void 0:r.status),this.statusDetail=r!=null&&r.statusDetail?new C(r.statusDetail):void 0,this.createdAt=u.isString(r==null?void 0:r.createdAt)?g.parseISO(r.createdAt):(r==null?void 0:r.createdAt)??new Date}}class Lt extends ne{getOrders(r,e,t,s=void 0){return this.getPaginated("/internal/orders",r,e,t,{},o=>{const l={...o.data};return l.data=l.data.map(h=>new hr(h)),l},void 0,s)}getOrdersCount(r,e=void 0){return this.get("/internal/orders/count",r?{filters:JSON.stringify((r instanceof G?r:new G(r)).toPrimitive())}:{},void 0,void 0,e).then(t=>t.count)}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new $(e.data))}createClientOrder(r,e,t,s,o={}){const l=d().config.dateFormats.api;return this.post(`/internal/clients/${r}/orders/${e}`,{...t,deliveryDate:g.format(t.deliveryDate,l),items:s!=null&&s.length?s:void 0},h=>h.data.map(f=>new $(f)),o)}attachOrder(r){return this.patch(`/internal/orders/${r}/attach`,{},e=>new $(e.data))}detachOrder(r){return this.patch(`/internal/orders/${r}/detach`,{},e=>new $(e.data))}mergeOrders(r,e){return this.patch(`/internal/orders/${r}/merge`,{ids:e},t=>new $(t.data))}recalculateOrder(r){return this.patch(`/internal/orders/${r}/recalculate`,{},e=>new $(e.data))}cloneOrder(r){return this.get(`/internal/orders/${r}/clone`,{})}updateOrder(r,e,t={}){const s=d().config.dateFormats.api;return this.patch(`/internal/orders/${r}`,{...e,deliveryDate:e.deliveryDate?g.format(e.deliveryDate,s):void 0},o=>new $(o.data),t)}addOrderProduct(r,e,t={}){return this.post(`/internal/orders/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new $(s.data),t)}changeOrderStatus(r,e,t,s={}){return this.patch(`/internal/orders/${r}/status`,{status:e,statusDetail:t},o=>new $(o.data),s)}changeOrderStatusDetail(r,e){return this.patch(`/internal/orders/${r}/status`,{statusDetail:e},t=>new $(t.data))}getOrderStatusHistory(r){return this.get(`/internal/orders/${r}/history`,{},e=>e.data.map(t=>new Kr(t)))}changeAttachedOperator(r,e){return this.patch(`/internal/orders/${r}/change-attached-operator`,{operatorId:e},t=>new $(t.data))}deleteOrderAttachedFile(r){return this.delete(`/internal/orders/${r}/file/attached`,e=>new $(e.data))}deleteOrderProduct(r,e){return this.delete(`/internal/orders/${r}/products/${e}`,t=>new $(t.data))}patchOrderProduct(r,e,t,s={}){return this.patch(`/internal/orders/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,...t.configuratorParams},o=>new $(o.data),s)}getDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getSelfDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/self-delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getDeliveryCost(r,e,t,s=void 0){const o=d().config.dateFormats.api;return this.get(`/internal/orders/delivery/${r}/cost`,{date:g.format(e,o),warehouse_id:t},l=>l.data,void 0,s)}}class Ue{constructor(r){i(this,"client");i(this,"product");i(this,"cost");i(this,"costCoefficient");i(this,"source");this.client=new B(r==null?void 0:r.client),this.product=new O(r==null?void 0:r.product),this.cost=(r==null?void 0:r.cost)??0,this.costCoefficient=(r==null?void 0:r.costCoefficient)??0,this.source=(r==null?void 0:r.source)??Te.Product}}const gr=n=>{var r,e,t,s,o;return n?u.omitBy({cities:(r=n.cities)==null?void 0:r.map(l=>l.id),clients:(e=n.clients)==null?void 0:e.map(l=>l.id),managers:(t=n.managers)==null?void 0:t.map(l=>l.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(l=>l.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(l=>l.id),hideNotActive:n.hideNotActive},l=>u.isNil(l)||(u.isArray(l)||u.isObject(l))&&u.isEmpty(l)):{}},Qr=n=>{const r={};return n.from&&(n.from.coefficient||n.from.value)&&(r.from={},n.from.coefficient&&(r.from.priceCoefficientId=n.from.coefficient.id),n.from.value&&(r.from.increasePercent=n.from.value)),n.to&&(n.to.coefficient||n.to.value)&&(r.to={},n.to.coefficient&&(r.to.priceCoefficientId=n.to.coefficient.id),n.to.value&&(r.to.increasePercent=n.to.value)),r};class _t extends y{analyzeProductPrices(r,e,t){return this.get(`/internal/price/products/${r}/analyze`,{...Qr(e),filters:gr(t)},s=>s.data.map(o=>new Ue(o)))}analyzeCategoryPrices(r,e,t){return this.get(`/internal/price/categories/${r}/analyze`,{...Qr(e),filters:gr(t)},s=>s.data.map(o=>new Ue(o)))}analyzeCategoryPricesBySquare(r,e,t){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:gr(t)},s=>s.data.map(o=>new Ue(o)))}}class Yr{constructor(r){i(this,"cost");i(this,"isLowCost");i(this,"isRetail");i(this,"costDate");i(this,"discountName");i(this,"priceTemplateName");i(this,"product");i(this,"client");i(this,"executor");i(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=u.isString(r.costDate)?g.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new Z(r.product):void 0,this.client=r.client?new I(r.client):void 0,this.executor=r.executor?new I(r.executor):void 0,this.currency=r.currency?new k(r.currency):void 0}}class Xr extends Z{constructor(e){super(e);i(this,"history");this.history=u.map(e.history,t=>new Yr(t))}}class qt extends y{getProductPriceHistory(r){var o,l,h,f,a;const e=d().config.dateFormats.api,t=u.omitBy(u.merge(r,{costDate:{from:u.isDate((o=r.costDate)==null?void 0:o.from)?g.format(r.costDate.from,e):(l=r.costDate)==null?void 0:l.from,to:u.isDate((h=r.costDate)==null?void 0:h.to)?g.format(r.costDate.to,e):(f=r.costDate)==null?void 0:f.to}}),v=>u.isNil(v)||(u.isArray(v)||u.isObject(v))&&u.isEmpty(v)),s=((a=r.product)==null?void 0:a[0])??0;return delete t.product,this.get(`/internal/price/products/${s}/history`,t).then(v=>[new Xr(u.merge(v[0],{history:v}))])}}class mr{constructor(r){i(this,"products",[]);i(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new Z(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new Z(e)))}}class Nt extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new mr(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new mr(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}}class Zr{constructor(r){i(this,"name");i(this,"content");this.name=r.name,this.content=r.content}}class fr{constructor(r){i(this,"resourceType");i(this,"resourceId");i(this,"h1");i(this,"title");i(this,"description");i(this,"keywords");i(this,"meta");i(this,"tags");var e;this.resourceType=new tr(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(t=>new Zr(t)))??[],this.tags=r==null?void 0:r.tags}}class Ut extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},t=>new fr(t.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,t=>new fr(t.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class Ht 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(t=>{const s=[...t];let o=1;return s.forEach(l=>{l.id=o++}),s})}}var xr=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.Guest="guest",n))(xr||{});class Er extends Ke{constructor(e){super(e);i(this,"type");i(this,"canDoReclamations");i(this,"photo");i(this,"pricingRole");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,this.pricingRole=e!=null&&e.pricingRole?new Je(e.pricingRole):void 0}}class jt extends y{constructor(){super(),this.baseUrl=`${d().config.http.portalApiUrl}/api`,this.interceptorIds.request.authRequestInterceptor&&this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor)}getAccessToken(){return this.get("internal/users/current-tokens").then(r=>r.accessToken)}}class et extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Er(r.data),!0)}}const Mt=W.defineStore("common.user_state_private",()=>{const n=m.ref({}),r=m.ref(void 0);return{dataLoaderList:n,currentUser:r}}),Bt=W.defineStore("common.user_state",()=>({currentUser:m.computed(()=>{const r=Mt();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,y.getInstance(et).getCurrentUser().then(e=>{r.currentUser=e}).catch(u.noop).finally(()=>{r.dataLoaderList.currentUser=!1})),r.currentUser})}));class Gt{constructor(r,e){i(this,"showFeedback",!1);i(this,"feedback","");i(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=Lr,c.AppBaseConfig=Rr,c.BankAccount=Le,c.BasePaginationProvider=ne,c.CalculationTypeEnum=Ir,c.Cart=E,c.CartProvider=tt,c.CatalogProvider=nt,c.CatalogableItem=Me,c.Category=N,c.CategoryPricingRule=Ye,c.ChannelPrimaryInterest=Ee,c.City=wt,c.CityWithRegionAndCountry=we,c.Client=cr,c.ClientAdditionalData=Mr,c.ClientCategory=ye,c.ClientDataProvider=_,c.ClientPriceProvider=ot,c.ClientPriceTemplateProvider=ct,c.ClientProduct=M,c.ClientProductCategoryDataProvider=pt,c.ClientProductDataProvider=ht,c.ClientShortInfo=B,c.ClientsAdditionalDataRequestTypeEnum=kr,c.ClientsListFilters=Ct,c.CodedIdentity=Z,c.ConfiguratorProvider=At,c.ConfiguratorsEnum=Gr,c.Contact=_e,c.ContactLinks=We,c.ContactPerson=z,c.ContactPersonRelated=jr,c.ContactPosition=_r,c.ContactRelation=qe,c.ContragentBase=sr,c.ContragentFactory=Ce,c.ContragentIc=nr,c.ContragentPerson=Ur,c.ContragentUlNr=Hr,c.ContragentUlR=or,c.CostSourceEnum=Te,c.Country=V,c.CuratedDirection=de,c.Curator=Ie,c.Currency=k,c.DataSuggestionProvider=Ht,c.DataTablePagination=vt,c.DataTablePaginationRequestParams=Br,c.DataTableSortRequestParams=Pt,c.DateTimeProvider=St,c.DeletableNamedIdentity=je,c.DeliveryAddress=oe,c.DeliveryType=q,c.DetailedJwtPayload=rt,c.DeviceTypeResolutionConfig=Cr,c.DiscountShortInfo=$r,c.FieldValidationResultData=Gt,c.FilterGroup=G,c.FilterItem=Xe,c.FilterOpEnum=ke,c.GeoCoordinates=Ge,c.HiddenCatalogableItem=Tr,c.HttpCachedRequester=ce,c.HttpParamsConfig=vr,c.HttpRequester=y,c.Identity=j,c.Image=Sr,c.JwtPayload=H,c.Manager=ee,c.ManagerCommon=$e,c.ManagerDataFactory=$t,c.ManagerDataProvider=Fr,c.MetaTagItem=Zr,c.NamedIdentity=T,c.Offer=Y,c.OfferShortInfo=pr,c.OffersDataProvider=bt,c.OffersListFilters=dt,c.Operator=er,c.Opf=F,c.OpfEnum=U,c.Order=$,c.OrderAction=Wr,c.OrderEditorData=It,c.OrderInfo=hr,c.OrderItem=zr,c.OrderItemBase=ze,c.OrderPaymentStatus=qr,c.OrderShortInfo=lr,c.OrderStatus=ae,c.OrderStatusDetailEnum=Vr,c.OrderStatusEnum=Jr,c.OrderStatusHistoryInfo=Kr,c.OrdersDataProvider=Lt,c.OrdersListFilters=kt,c.PaginationFiltersBase=Ne,c.PartnerGroup=Q,c.PaymentType=rr,c.PreferencesStorageProvider=ge,c.PriceAnalyze=Ue,c.PriceAnalyzeProvider=_t,c.PriceCoefficient=me,c.PriceCoefficientEnum=Be,c.PriceHistoryDataProvider=qt,c.PriceHistoryItem=Yr,c.PriceTemplate=J,c.PriceTemplateCategory=be,c.PriceTemplateClient=te,c.PriceTemplateICatalogableItem=Ve,c.PriceTemplateProduct=Oe,c.PriceTemplateProvider=gt,c.PricingRole=se,c.PricingRoleProvider=mt,c.PrimaryCatalogableItem=Re,c.Product=O,c.ProductCategoryDataProvider=lt,c.ProductDataProvider=ut,c.ProductFileType=Nr,c.ProductPriceCoefficient=Se,c.ProductPriceHistory=Xr,c.ProductUnit=Fe,c.PropertiesProvider=ft,c.Property=ie,c.PropertyType=Qe,c.PropertyTypeEnum=Or,c.PropertyValue=K,c.RecommendationsDataProvider=Nt,c.RecommendationsList=mr,c.Reference=C,c.ReferenceDataFactory=at,c.ReferenceDataProvider=A,c.Region=re,c.ResourceType=tr,c.SalesDirection=L,c.SentryConfig=Pr,c.Seo=fr,c.SeoDataProvider=Ut,c.SourcePrimaryInterest=ir,c.StockCount=dr,c.TemplateProductCategoryDataProvider=yt,c.TemplatesListFilters=st,c.TypedInstanceFactory=Ae,c.UnitsHelper=ur,c.UnknownClientDataProvider=Dt,c.UpdatableNamedIdentity=He,c.User=Er,c.UserAuthDataProvider=jt,c.UserCommonInfo=Ke,c.UserDataProvider=et,c.UserPricingRole=Je,c.UserShortInfo=I,c.UserTypeEnum=xr,c.VersionConfig=Rt,c.Warehouse=x,c.WebSocketConfig=Dr,c.findCatalogItemByIdRecursive=Ze,c.flattenCatalogItems=xe,c.pluralize=Tt,c.useAuthStateStore=De,c.useBaseConfigStateStore=d,c.useReferencesStore=Ot,c.useUserStateStore=Bt,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|