@snabcentr/common-lib 4.0.0 → 4.0.1
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/sc-common-lib.js +3 -7
- 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/blog/classes/blog-post-media-file.d.ts.map +1 -1
- package/dist/src/blog/classes/blog-post-short-info.d.ts.map +1 -1
- package/dist/src/blog/classes/blog-post.d.ts.map +1 -1
- package/dist/src/blog/classes/blog-posts-list-filters.d.ts.map +1 -1
- package/dist/src/blog/interfaces/i-blog-post-media-file.d.ts.map +1 -1
- package/dist/src/blog/interfaces/i-blog-post-short-info.d.ts.map +1 -1
- package/dist/src/blog/interfaces/i-blog-post.d.ts.map +1 -1
- package/dist/src/blog/interfaces/i-blog-posts-list-filters.d.ts.map +1 -1
- package/dist/src/blog/providers/blog-provider.d.ts.map +1 -1
- package/dist/src/cart/classes/cart.d.ts.map +1 -1
- package/dist/src/cart/classes/order-item.d.ts.map +1 -1
- package/dist/src/cart/interfaces/i-base-cart-validation-result.d.ts.map +1 -1
- package/dist/src/cart/interfaces/i-cart.d.ts.map +1 -1
- package/dist/src/cart/interfaces/i-order-item-base.d.ts.map +1 -1
- package/dist/src/cart/interfaces/i-order-item.d.ts.map +1 -1
- package/dist/src/cart/providers/cart-provider.d.ts.map +1 -1
- package/dist/src/catalog/classes/category-filter-setting.d.ts.map +1 -1
- package/dist/src/catalog/classes/category-filter-value.d.ts.map +1 -1
- package/dist/src/catalog/classes/category-filter.d.ts.map +1 -1
- package/dist/src/catalog/classes/category-pricing-rule.d.ts.map +1 -1
- package/dist/src/catalog/classes/category.d.ts.map +1 -1
- package/dist/src/catalog/classes/client-category.d.ts.map +1 -1
- package/dist/src/catalog/classes/client-price-catalogable-item.d.ts.map +1 -1
- package/dist/src/catalog/classes/client-price-category.d.ts.map +1 -1
- package/dist/src/catalog/classes/client-price-product.d.ts.map +1 -1
- package/dist/src/catalog/classes/client-product.d.ts.map +1 -1
- package/dist/src/catalog/classes/discount-short-info.d.ts.map +1 -1
- package/dist/src/catalog/classes/filter-settings.d.ts.map +1 -1
- package/dist/src/catalog/classes/internal/base/base-category.d.ts.map +1 -1
- package/dist/src/catalog/classes/internal/base/base-client-category.d.ts.map +1 -1
- package/dist/src/catalog/classes/price-catalogable-item.d.ts.map +1 -1
- package/dist/src/catalog/classes/price-template-catalogable-item.d.ts.map +1 -1
- package/dist/src/catalog/classes/price-template-category.d.ts.map +1 -1
- package/dist/src/catalog/classes/price-template-client.d.ts.map +1 -1
- package/dist/src/catalog/classes/price-template-product.d.ts.map +1 -1
- package/dist/src/catalog/classes/price-template.d.ts.map +1 -1
- package/dist/src/catalog/classes/pricing-role.d.ts.map +1 -1
- package/dist/src/catalog/classes/product-price-coefficient.d.ts.map +1 -1
- package/dist/src/catalog/classes/product.d.ts.map +1 -1
- package/dist/src/catalog/classes/property-value.d.ts.map +1 -1
- package/dist/src/catalog/classes/property.d.ts.map +1 -1
- package/dist/src/catalog/classes/stock-count.d.ts.map +1 -1
- package/dist/src/catalog/classes/templates-list-filters.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-category-filter-setting-update-data.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-category-filter-setting.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-category-filter.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-category-pricing-rule.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-category.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-client-category.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-client-price-catalogable-item.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-client-price-category.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-client-price-product.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-client-product.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-commercial-offer-params.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-commercial-offer.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-discount-short-info.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-file-update-data.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-file-upload-data.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-filter-settings.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-predefined-properties.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-price-template-catalogable-item.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-price-template-category.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-price-template-client.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-price-template-product.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-price-template.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-pricing-role.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-product.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-property-value.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-property.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-templates-list-filters.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/internal/base/i-base-category.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/internal/base/i-base-client-category.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/internal/properties/i-categories-property.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/internal/properties/i-products-property.d.ts.map +1 -1
- package/dist/src/catalog/methods/find-catalog-item.d.ts.map +1 -1
- package/dist/src/catalog/methods/flatten-catalog-items.d.ts.map +1 -1
- package/dist/src/catalog/providers/catalog-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/client-price-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/client-price-template-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/client-product-category-data-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/client-product-data-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/price-template-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/pricing-role-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/product-category-data-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/product-data-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/properties-provider.d.ts.map +1 -1
- package/dist/src/catalog/providers/template-product-category-data-provider.d.ts.map +1 -1
- package/dist/src/catalog/types/category-data.d.ts.map +1 -1
- package/dist/src/catalog/types/product-data.d.ts.map +1 -1
- package/dist/src/catalog/types/properties-list.d.ts.map +1 -1
- package/dist/src/clients/classes/bank-account.d.ts.map +1 -1
- package/dist/src/clients/classes/client-additional-data.d.ts.map +1 -1
- package/dist/src/clients/classes/client-short-info.d.ts.map +1 -1
- package/dist/src/clients/classes/client.d.ts.map +1 -1
- package/dist/src/clients/classes/clients-list-filters.d.ts.map +1 -1
- package/dist/src/clients/classes/contragent/contragent-base.d.ts.map +1 -1
- package/dist/src/clients/classes/contragent/contragent-factory.d.ts.map +1 -1
- package/dist/src/clients/classes/contragent/contragent-ic.d.ts.map +1 -1
- package/dist/src/clients/classes/contragent/contragent-person.d.ts.map +1 -1
- package/dist/src/clients/classes/contragent/contragent-ul-nr.d.ts.map +1 -1
- package/dist/src/clients/classes/contragent/contragent-ul-r.d.ts.map +1 -1
- package/dist/src/clients/classes/delivery-address.d.ts.map +1 -1
- package/dist/src/clients/interfaces/contragent/i-contragent-base.d.ts.map +1 -1
- package/dist/src/clients/interfaces/contragent/i-contragent-ic.d.ts.map +1 -1
- package/dist/src/clients/interfaces/contragent/i-contragent-person.d.ts.map +1 -1
- package/dist/src/clients/interfaces/contragent/i-contragent-ul-nr.d.ts.map +1 -1
- package/dist/src/clients/interfaces/contragent/i-contragent-ul-r.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-client-additional-data.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-client-short-info.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-client.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-clients-list-filters.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-delivery-address.d.ts.map +1 -1
- package/dist/src/clients/providers/client-data-provider.d.ts.map +1 -1
- package/dist/src/config/classes/version-config.d.ts.map +1 -1
- package/dist/src/configurator/providers/configurator-provider.d.ts.map +1 -1
- package/dist/src/configurator/types/configurator-name.d.ts.map +1 -1
- package/dist/src/contacts/classes/contact-person-related.d.ts.map +1 -1
- package/dist/src/contacts/classes/contact-person.d.ts.map +1 -1
- package/dist/src/contacts/classes/contact-relation.d.ts.map +1 -1
- package/dist/src/contacts/classes/contact.d.ts.map +1 -1
- package/dist/src/contacts/interfaces/i-contact.d.ts.map +1 -1
- package/dist/src/date-time/interfaces/i-standard-period.d.ts.map +1 -1
- package/dist/src/date-time/providers/date-time-provider.d.ts.map +1 -1
- package/dist/src/date-time/values/standard-period-groups.d.ts.map +1 -1
- package/dist/src/discounts/classes/discount-client-eligibility.d.ts.map +1 -1
- package/dist/src/discounts/classes/discount-client.d.ts.map +1 -1
- package/dist/src/discounts/classes/discount-conditions.d.ts.map +1 -1
- package/dist/src/discounts/classes/discount.d.ts.map +1 -1
- package/dist/src/discounts/classes/discounts-list-filters.d.ts.map +1 -1
- package/dist/src/discounts/helpers/discount-state-helper.d.ts.map +1 -1
- package/dist/src/discounts/interfaces/i-discount-client-eligibility.d.ts.map +1 -1
- package/dist/src/discounts/interfaces/i-discount-conditions-save-request-data.d.ts.map +1 -1
- package/dist/src/discounts/interfaces/i-discount-conditions.d.ts.map +1 -1
- package/dist/src/discounts/interfaces/i-discount-save-data.d.ts.map +1 -1
- package/dist/src/discounts/interfaces/i-discount-save-request-data.d.ts.map +1 -1
- package/dist/src/discounts/interfaces/i-discount.d.ts.map +1 -1
- package/dist/src/discounts/interfaces/i-discounts-list-filters.d.ts.map +1 -1
- package/dist/src/discounts/providers/discount-provider.d.ts.map +1 -1
- package/dist/src/faq/classes/faq-group.d.ts.map +1 -1
- package/dist/src/faq/classes/faq.d.ts.map +1 -1
- package/dist/src/faq/interfaces/i-faq.d.ts.map +1 -1
- package/dist/src/faq/providers/faq-provider.d.ts.map +1 -1
- package/dist/src/helpers/units-helper.d.ts.map +1 -1
- package/dist/src/managers/classes/curator.d.ts.map +1 -1
- package/dist/src/offers/classes/offer-actualization.d.ts.map +1 -1
- package/dist/src/offers/classes/offer-short-info.d.ts.map +1 -1
- package/dist/src/offers/classes/offer.d.ts.map +1 -1
- package/dist/src/offers/classes/offers-list-filters.d.ts.map +1 -1
- package/dist/src/offers/classes/profstroy-offer-item.d.ts.map +1 -1
- package/dist/src/offers/helpers/offer-helper.d.ts.map +1 -1
- package/dist/src/offers/interfaces/i-offer-actualization.d.ts.map +1 -1
- package/dist/src/offers/interfaces/i-offer-send-data.d.ts.map +1 -1
- package/dist/src/offers/interfaces/i-offer-short-info.d.ts.map +1 -1
- package/dist/src/offers/interfaces/i-offer.d.ts.map +1 -1
- package/dist/src/offers/interfaces/i-offers-list-filters.d.ts.map +1 -1
- package/dist/src/offers/interfaces/i-profstroy-offer-item.d.ts.map +1 -1
- package/dist/src/offers/interfaces/i-profstroy-offer.d.ts.map +1 -1
- package/dist/src/offers/providers/offers-data-provider.d.ts.map +1 -1
- package/dist/src/orders/classes/order-editor-data.d.ts.map +1 -1
- package/dist/src/orders/classes/order-info.d.ts.map +1 -1
- package/dist/src/orders/classes/order-item-base.d.ts.map +1 -1
- package/dist/src/orders/classes/order-item.d.ts.map +1 -1
- package/dist/src/orders/classes/order-short-info.d.ts.map +1 -1
- package/dist/src/orders/classes/order-status-history-info.d.ts.map +1 -1
- package/dist/src/orders/classes/order.d.ts.map +1 -1
- package/dist/src/orders/classes/orders-list-filters.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-client-order-create-data.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order-editor-data.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order-info.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order-item-base.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order-item.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order-print-send-data.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order-short-info.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order-status-history-info.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-orders-list-filters.d.ts.map +1 -1
- package/dist/src/orders/providers/orders-data-provider.d.ts.map +1 -1
- package/dist/src/orders/symbols/current-order-injection-key.d.ts.map +1 -1
- package/dist/src/pagination/filters/pagination-filters-base.d.ts.map +1 -1
- package/dist/src/pagination/providers/base-pagination-provider.d.ts.map +1 -1
- package/dist/src/price-analyze/classes/price-analyze.d.ts.map +1 -1
- package/dist/src/price-analyze/converters/price-analyze-filters.d.ts.map +1 -1
- package/dist/src/price-analyze/converters/price-analyze-params.d.ts.map +1 -1
- package/dist/src/price-analyze/interfaces/i-price-analyze-filters.d.ts.map +1 -1
- package/dist/src/price-analyze/interfaces/i-price-analyze-params.d.ts.map +1 -1
- package/dist/src/price-analyze/interfaces/i-price-analyze.d.ts.map +1 -1
- package/dist/src/price-analyze/providers/price-analyze-provider.d.ts.map +1 -1
- package/dist/src/price-history/classes/price-history-item.d.ts.map +1 -1
- package/dist/src/price-history/classes/product-price-history.d.ts.map +1 -1
- package/dist/src/price-history/interfaces/i-price-history-item.d.ts.map +1 -1
- package/dist/src/price-history/interfaces/i-product-price-history.d.ts.map +1 -1
- package/dist/src/price-history/providers/price-history-data-provider.d.ts.map +1 -1
- package/dist/src/recommendations/classes/recommendations-list.d.ts.map +1 -1
- package/dist/src/recommendations/interfaces/i-recommendations-list.d.ts.map +1 -1
- package/dist/src/recommendations/providers/recommendations-data-provider.d.ts.map +1 -1
- package/dist/src/references/classes/product-unit.d.ts.map +1 -1
- package/dist/src/seo/classes/meta-tag-item.d.ts.map +1 -1
- package/dist/src/seo/classes/seo.d.ts.map +1 -1
- package/dist/src/seo/interfaces/i-seo.d.ts.map +1 -1
- package/dist/src/seo/providers/seo-data-provider.d.ts.map +1 -1
- package/dist/src/statistics/classes/search-product-statistic.d.ts.map +1 -1
- package/dist/src/statistics/providers/statistics-provider.d.ts.map +1 -1
- package/dist/src/suggestion/helpers/address-quality-helper.d.ts +2 -0
- package/dist/src/suggestion/helpers/address-quality-helper.d.ts.map +1 -1
- package/dist/src/suggestion/interfaces/i-address-suggestion.d.ts.map +1 -1
- package/dist/src/suggestion/interfaces/i-organization-suggestion.d.ts.map +1 -1
- package/dist/src/suggestion/providers/data-suggestion-provider.d.ts.map +1 -1
- package/dist/src/system/classes/catalogable-item.d.ts.map +1 -1
- package/dist/src/system/classes/coded-identity.d.ts.map +1 -1
- package/dist/src/system/classes/creatable-identity.d.ts.map +1 -1
- package/dist/src/system/classes/deletable-identity.d.ts.map +1 -1
- package/dist/src/system/classes/deletable-named-identity.d.ts.map +1 -1
- package/dist/src/system/classes/hidden-catalogable-item.d.ts.map +1 -1
- package/dist/src/system/classes/image.d.ts.map +1 -1
- package/dist/src/system/classes/primary-catalogable-item.d.ts.map +1 -1
- package/dist/src/system/interfaces/i-catalogable-item.d.ts.map +1 -1
- package/dist/src/system/interfaces/i-deletable-identity.d.ts.map +1 -1
- package/dist/src/system/interfaces/i-deletable-named-identity.d.ts.map +1 -1
- package/dist/src/system/interfaces/i-hidden-catalogable-item.d.ts.map +1 -1
- package/dist/src/system/interfaces/i-primary-catalogable-item.d.ts.map +1 -1
- package/dist/src/table-data/classes/filter-group.d.ts.map +1 -1
- package/dist/src/table-data/classes/filter-item.d.ts.map +1 -1
- package/dist/src/table-data/classes/table-data-pagination-request-params.d.ts.map +1 -1
- package/dist/src/table-data/classes/table-data-pagination.d.ts.map +1 -1
- package/dist/src/table-data/classes/table-data-sort-request-params.d.ts.map +1 -1
- package/dist/src/table-data/interfaces/i-filter-group.d.ts.map +1 -1
- package/dist/src/table-data/interfaces/i-filter-item.d.ts.map +1 -1
- package/dist/src/user/classes/user-short-info.d.ts.map +1 -1
- package/dist/src/user-regions/classes/user-region-employee.d.ts.map +1 -1
- package/dist/src/user-regions/classes/user-region.d.ts.map +1 -1
- package/dist/src/user-regions/classes/user-regions-list-filters.d.ts.map +1 -1
- package/dist/src/user-regions/interfaces/i-user-region-employee.d.ts.map +1 -1
- package/dist/src/user-regions/interfaces/i-user-region.d.ts.map +1 -1
- package/dist/src/user-regions/interfaces/i-user-regions-list-filters.d.ts.map +1 -1
- package/dist/src/user-regions/providers/user-region-provider.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@snabcentr/common-core"),require("date-fns"),require("lodash-es")):typeof define==`function`&&define.amd?define([`exports`,`@snabcentr/common-core`,`date-fns`,`lodash-es`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`SC Common Lib`]={},e[`@snabcentr/common-core`],e[`date-fns`],e[`lodash-es`]))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=function(e){return e.Image=`image`,e.Video=`video`,e}({}),a=class extends t.Identity{mediaType;isCover;isUnused;url;urlWebp;constructor(e){super(e,``),this.mediaType=e?.mediaType??i.Image,this.isCover=e?.isCover??!1,this.isUnused=e?.isUnused??!1,this.url=e?.url??``,this.urlWebp=e?.urlWebp}isImage(){return this.mediaType===i.Image}isVideo(){return this.mediaType===i.Video}},o=function(e){return e.Draft=`draft`,e.Published=`published`,e.Scheduled=`scheduled`,e}({}),s=class extends t.Identity{createdAt;constructor(e,n){super(e,n),this.createdAt=t.DateHelper.parse(e?.createdAt)??new Date}},c=class e extends s{static resolvePublicationStatus(e){return(0,r.isNil)(e)?o.Draft:e.getTime()>Date.now()?o.Scheduled:o.Published}static getSlugError(e){return e?/[^a-z0-9-]/.test(e)?`Допустимы только строчные латинские буквы, цифры и дефис: пример «kak-vybrat-podokonnik».`:(0,r.startsWith)(e,`-`)||(0,r.endsWith)(e,`-`)?`Обозначение не может начинаться или заканчиваться дефисом.`:(0,r.includes)(e,`--`)?`Дефисы не могут идти подряд: разделяйте слова одним дефисом.`:``:``}static parseDate(e){return(0,r.isNil)(e)?null:(0,r.isString)(e)?(0,n.parseISO)(e):e}slug;title;publishedAt;constructor(t){super(t,-1),this.slug=t?.slug??``,this.title=t?.title??``,this.publishedAt=e.parseDate(t?.publishedAt)}getPublicationStatus(){return e.resolvePublicationStatus(this.publishedAt)}},l=class extends c{content;media;constructor(e){super(e),this.content=e?.content??``,this.media=(e?.media??[]).map(e=>new a(e))}toSaveData(e=!1){return{title:this.title,slug:this.slug.length>0?this.slug:void 0,content:e?this.content:void 0,publishedAt:this.publishedAt}}getCover(){return this.media.find(e=>e.isCover)}getUnusedMedia(){return this.media.filter(e=>e.isUnused)}},u=class{asClearRaw(){let e={};return Object.keys(this).forEach(t=>{let n=this[t];(0,r.isNil)(n)||(0,r.isString)(n)&&n.trim().length===0||(0,r.isFunction)(n.isNewRec)&&n.isNewRec()||(e[t]=n)}),e}},d=class{from;to;constructor(e){this.from=(0,r.isString)(e?.from)?(0,n.parseISO)(e.from):e?.from??null,this.to=(0,r.isString)(e?.to)?(0,n.parseISO)(e.to):e?.to??null}},ee=class extends u{id;title;slug;content;publicationStatus;publishedAt;createdAt;constructor(e){super(),this.id=e?.id,this.title=e?.title,this.slug=e?.slug,this.content=e?.content,this.publicationStatus=e?.publicationStatus,this.publishedAt=new d(e?.publishedAt),this.createdAt=new d(e?.createdAt)}resetFilterValue(e){switch(e){case`id`:case`title`:case`slug`:case`content`:case`publicationStatus`:this[e]=void 0;break;case`publishedAt`:this.publishedAt.from=null,this.publishedAt.to=null;break;case`createdAt`:this.createdAt.from=null,this.createdAt.to=null}return this}asClearRaw(){let e=super.asClearRaw();return!e?.publishedAt?.from&&!e?.publishedAt?.to&&delete e.publishedAt,!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,e}},te=function(e){return e.BeginWith=`bw`,e.Contains=`cn`,e.Custom=`custom`,e.EndsWith=`ew`,e.Equals=`eq`,e.GreaterOrEqual=`ge`,e.GreaterThan=`gt`,e.InList=`in`,e.LessOrEqual=`le`,e.LessThan=`lt`,e.NotBeginWith=`bn`,e.NotContains=`nc`,e.NotEndsWith=`en`,e.NotEqual=`ne`,e.NotInList=`ni`,e.NotNull=`nn`,e.Null=`nu`,e}({}),ne=class{field;op;value;constructor(e){this.field=e?.field??``,this.op=e?.op??te.Equals,this.value=e?.value??``}toPrimitive(){let e=(0,t.useBaseConfigStore)().config.dateFormats.api,i={field:this.field,op:this.op};if((0,r.isDate)(this.value))i.value=(0,n.format)(this.value,e);else if((0,r.isPlainObject)(this.value)){let t=this.value;i.value={from:t.from?(0,n.format)(t.from,e):null,to:t.to?(0,n.format)(t.to,e):null}}else i.value=this.value;return i}},f=class e{groupOp;filters;groups;constructor(t){this.groupOp=t?.groupOp??`and`,this.filters=t?.filters?.map(e=>new ne(e))??[],this.groups=t?.groups?.map(t=>new e(t))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(e=>e instanceof ne&&(0,r.isFunction)(e.toPrimitive)?e.toPrimitive():e),groups:this.groups.map(t=>t instanceof e?t.toPrimitive():t)}}},p=class extends t.HttpRequester{getPaginated(e,t,n,i,a,o,s,c){let l={page:i?.page??1,perPage:i?.pageSize??10};return t&&(l.filters=JSON.stringify((t instanceof f?t:new f(t)).toPrimitive())),(0,r.isEmpty)(n)||(l.sort=(0,r.isArray)(n)?n:[n]),a&&(l={...l,...a}),this.get(e,l,o,s,c)}getTypedPaginated(e,n,r,i,a,o,s,c){return this.getPaginated(n,r,i,a,o,n=>({...n.data,data:t.TypedInstanceFactory.instanceListInitializer(e,n.data.data)}),s,c)}},re=class e extends p{static preparePostSaveData(e){let i={};if((0,r.isUndefined)(e.title)||(i.title=e.title),(0,r.isUndefined)(e.slug)||(i.slug=e.slug),(0,r.isUndefined)(e.content)||(i.content=e.content),!(0,r.isUndefined)(e.publishedAt)){let a=(0,t.useBaseConfigStore)().config.dateFormats.api;i.publishedAt=(0,r.isNil)(e.publishedAt)?null:(0,n.format)(e.publishedAt,a)}return i}getPostList(e,t,n){return this.getPaginated(`/internal/blog`,e,t,n,{},e=>({...e.data,data:e.data.data.map(e=>new c(e))}))}getPost(e){return this.get(`/internal/blog/${e}`,{},e=>new l(e.data))}createPost(t,n={}){return this.post(`/internal/blog`,e.preparePostSaveData(t),e=>new l(e.data),n)}updatePost(t,n,r={}){return this.patch(`/internal/blog/${t}`,e.preparePostSaveData(n),e=>new l(e.data),r)}removePost(e){return this.delete(`/internal/blog/${e}`)}uploadMedia(e,t,n,r,i={}){return this.request({method:`POST`,url:`/internal/blog/${e}/media`,data:{file:t,isCover:n??!1},onUploadProgress:e=>{r&&r(e.total?Math.round(e.loaded/e.total*100):0)}},e=>new a(e.data),i)}updateMedia(e,t,n,r={}){return this.patch(`/internal/blog/${e}/media/${t}`,{isCover:n},e=>new a(e.data),r)}removeMedia(e,t){return this.delete(`/internal/blog/${e}/media/${t}`)}},m=class extends t.UpdatableNamedIdentity{deletedAt;constructor(e){super(e),this.deletedAt=t.DateHelper.parse(e?.deletedAt)}},h=class extends t.NamedIdentity{type;isActive;constructor(e){super(e),this.type=e?.type,this.isActive=e?.isActive??!0}},g=class extends m{costCoefficient;isLowPriceAllowed;publishedAt;description;percent;owner;constructor(e){super(e),this.costCoefficient=e?.costCoefficient??0,this.isLowPriceAllowed=e?.isLowPriceAllowed??!1,this.publishedAt=t.DateHelper.parse(e?.publishedAt),this.description=e?.description??void 0,this.percent=e?.percent??0,this.owner=new h(e?.owner)}},_=class extends t.UpdatableNamedIdentity{description;owner;constructor(e){super(e),this.description=e?.description??``,this.owner=e?.owner?new h(e.owner):void 0}},v=class{coefficient;value;cost;percent;readOnly;constructor(e){this.coefficient=new t.PriceCoefficient(e?.coefficient),this.value=e?.value??0,this.cost=e?.cost??0,this.percent=e?.percent??0,this.readOnly=e?.readOnly??!0}},ie=class{warehouse;count;constructor(e){this.warehouse=new t.Warehouse(e?.warehouse),this.count=e?.count??0}},ae=class extends t.NamedIdentity{slug=``;description;isSquare=!1;isLinear=!1;constructor(e){super(e),e&&(this.slug=e.slug??``,this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}},y=class extends t.NamedIdentity{code=``;constructor(e){super(e),this.code=e?.code??``}},oe=class extends y{slug;type;constructor(e){super(e),this.slug=e?.slug??``}},se=class extends oe{isHidden;constructor(e){super(e),this.isHidden=e?.isHidden??!1}},ce=class{image;preview;isDefault;constructor(e,t){this.image=`${t??``}${e.image}`,this.preview=`${t??``}${e.preview}`,this.isDefault=e.isDefault}},b=class extends oe{isPrimary;constructor(e){super(e),this.isPrimary=e?.isPrimary??!1}},x=class extends se{supplierSku;unit;pack;minCount;currency;cost;costRub;costDate;onOrder;stockCount;category;categories;images;properties;retailCost;retailCostRub;priceCoefficients;constructor(e){super(e),this.supplierSku=e?.supplierSku,this.unit=e?.unit?new ae(e.unit):new ae,this.pack=e?.pack,this.minCount=e?.minCount,this.currency=e?.currency?new t.Currency(e.currency):new t.Currency,this.cost=e?.cost??0,this.costRub=e?.costRub??0,this.costDate=(0,r.isString)(e?.costDate)?(0,n.parseISO)(e.costDate):e?.costDate,this.onOrder=e?.onOrder??!1,this.stockCount=e?.stockCount?.map(e=>new ie(e))??[],this.type=`product`;let i=e?.category??e?.categories?.find(e=>e.isPrimary);i&&(this.category=new b({...i,isPrimary:!0}),this.categories=[this.category]),e?.categories&&(this.categories=e.categories.map(e=>new b(e))),this.images=e?.images?.map(e=>new ce(e,(0,t.useBaseConfigStore)().config.http.mediaUrl))??[],this.properties=e?.properties??{},this.retailCost=e?.retailCost,this.retailCostRub=e?.retailCostRub,this.priceCoefficients=e?.priceCoefficients?.map(e=>new v(e))??[],e&&`codeNumber`in e&&!e.code&&(this.code=e?.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}},le=function(e){return e.Discount=`discount`,e.PriceTemplate=`price_template`,e.ClientPrice=`client_price`,e.Product=`product`,e}({}),S=class extends x{costCoefficient;costSource;discount;priceTemplate;priceCoefficient;increasePercent;isPreviouslyOrdered;isRequired;isFavorite;constructor(e){super(e),this.costCoefficient=e?.costCoefficient??0,this.costSource=e?.costSource??le.Product,this.discount=e?.discount?new g(e.discount):void 0,this.priceTemplate=e?.priceTemplate?new _(e.priceTemplate):void 0,this.priceCoefficient=e?.priceCoefficient?new t.PriceCoefficient(e.priceCoefficient):void 0,this.increasePercent=e?.increasePercent,this.isPreviouslyOrdered=e?.isPreviouslyOrdered,this.isRequired=e?.isRequired,this.isFavorite=e?.isFavorite}},C=class extends b{isHidden;parentCategoryId;properties;currencyRates;constructor(e){super(e),this.isHidden=e?.isHidden??!1,this.parentCategoryId=e?.parentCategoryId,this.properties=e?.properties,this.type=`category`,this.currencyRates=e?.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([e,t])=>[(0,r.toUpper)(e),t])):void 0}},ue=class extends t.Identity{category;product;quantity;currency;marker;height;length;width;configurator;configuratorParams;isAdditionalSale;creator;isRemoved;ord;onOrder;originalId;replacementId;constructor(e){super(e),this.product=new S(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new C,this.currency=e.currency?new t.Currency(e.currency):void 0,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&(0,r.cloneDeep)(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale,this.creator=e.creator&&new h(e.creator),this.isRemoved=e.isRemoved,this.ord=e.ord,this.onOrder=e.onOrder,this.originalId=e.originalId,this.replacementId=e.replacementId}},de=class extends ue{cost;costOne;costOneRub;costRub;logicGroupId;salesDirection;specificationImgUrl;sawing;currency;constructor(e){super(e),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=(0,r.isArray)(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new t.Currency(e.currency)}},w=class{items;resultSum;directionsSum;constructor(e){this.items=e.items.map(e=>new de(e)),this.resultSum=e.resultSum,this.directionsSum=e.directionsSum}},fe=class extends t.HttpRequester{getCart(e){return this.get(`internal/clients/${e.id}/cart`,{},e=>new w(e.data))}deleteCart(e){return this.delete(`internal/clients/${e.id}/cart`)}addCartItem(e,t,n={}){return this.patch(`internal/clients/${e.id}/cart`,{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,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},e=>new w(e.data),n)}patchCartItem(e,t,n={}){return this.patch(`internal/clients/${e.id}/cart/${t.id}`,{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,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},e=>new w(e.data),n)}deleteCartItem(e,t){return this.delete(`internal/clients/${e.id}/cart/${t.id}`,e=>new w(e.data))}addCartItemFromCSV(e,t){return this.post(`internal/clients/${e.id}/cart/add-products-from-csv`,t,e=>new w(e.data))}getCartItemFromCSVExample(e){return this.get(`internal/clients/${e.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:`text/csv`}))}},pe=function(e){return e.m2Cost=`m2Cost`,e.percent=`percent`,e.value=`value`,e}({}),me=function(e){return e.Checkbox=`checkbox`,e.Range=`range`,e.Toggle=`toggle`,e}({}),T=class e extends C{categories;products;constructor(t){super(t),this.categories=t?.categories?.map(t=>new e(t)),this.products=t?.products?.map(e=>new x(e))}},he=class extends C{isDisabled;isRequired;isFavorite;hidingComment;manager;constructor(e){super(e),this.isDisabled=e?.isDisabled??!1,this.isRequired=e?.isRequired??!1,this.isFavorite=e?.isFavorite??!1,this.hidingComment=e?.hidingComment,this.manager=e?.manager?new t.Manager(e.manager):void 0}},ge=class e extends he{categories;products;constructor(t){super(t),this.categories=t?.categories?.map(t=>new e(t)),this.products=t?.products?.map(e=>new S(e))}},_e=class{priceCoefficient;increasePercent;constructor(e){this.priceCoefficient=e?.priceCoefficient&&new t.PriceCoefficient(e.priceCoefficient),this.increasePercent=e?.increasePercent}},ve=class extends _e{constructor(e){super(e)}},E=class extends ve{productCategory;constructor(e){super(e),this.productCategory=new C(e?.productCategory)}},D=class extends t.NamedIdentity{photo;contacts;curatedDirection;constructor(e){super(e),this.photo=e.photo,this.contacts=new t.ContactLinks(e.contacts),this.curatedDirection=new t.CuratedDirection(e.curatedDirection)}},O=class extends t.UserCommonInfo{salesDirection;debt;alternativeName;city;comment;isPhoneApproved;isEmailApproved;managers;curators;constructor(e){super(e),this.salesDirection=new t.SalesDirection(e?.salesDirection),this.debt=e?.debt??0,this.alternativeName=e?.alternativeName??``,this.city=new t.CityWithRegionAndCountry(e?.city),this.comment=e?.comment,this.isPhoneApproved=e?.isPhoneApproved??!1,this.isEmailApproved=e?.isEmailApproved??!1,this.managers=e?.managers?.map(e=>new t.ManagerCommon(e))??[],this.curators=e?.curators?.map(e=>new D(e))??void 0}},ye=class extends s{deletedAt;constructor(e,n){super(e,n),this.deletedAt=t.DateHelper.parse(e?.deletedAt)}},k=class extends ye{client;priceTemplate;constructor(e){super(e),this.client=new O(e?.client),this.priceTemplate=new _(e?.priceTemplate)}},A=class extends ve{product;constructor(e){super(e),this.product=new x(e?.product)}},j=class extends t.NamedIdentity{type;description;metadata;isFilterable;constructor(e){super(e),this.type=new t.PropertyType(e?.type),this.description=e?.description??``,this.metadata=e?.metadata,this.isFilterable=e?.isFilterable}},M=class{property;value;constructor(e){this.property=new j(e?.property),this.value=e?.value??``}},be=class{id;name;description;ownerName;createdAt=new d;updatedAt=new d;constructor(e){this.id=e?.id,this.name=e?.name,this.description=e?.description,this.ownerName=e?.ownerName,this.createdAt=new d(e?.createdAt),this.updatedAt=new d(e?.updatedAt)}resetFilterValue(e){switch(e){case`id`:case`name`:case`description`:case`ownerName`:this[e]=void 0;break;case`createdAt`:this.createdAt.from=null,this.createdAt.to=null;break;case`updatedAt`:this.updatedAt.from=null,this.updatedAt.to=null}return this}asClearRaw(){let e={};return Object.keys(this).forEach(t=>{let n=this[t];(0,r.isNil)(n)||(0,r.isString)(n)&&n.trim().length===0||(0,r.isFunction)(n.isNewRec)&&n.isNewRec()||(e[t]=n)}),!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,!e?.updatedAt?.from&&!e?.updatedAt?.to&&delete e.updatedAt,e}},xe=class extends _e{executor;createdAt;constructor(e){super(e),this.executor=e?.executor?new h(e.executor):void 0,this.createdAt=t.DateHelper.parse(e?.createdAt)}},N=class extends xe{product;constructor(e){super(e),this.product=new x(e?.product)}},Se=class extends xe{productCategory;constructor(e){super(e),this.productCategory=new C(e?.productCategory)}},P=class extends t.NamedIdentity{description;canChangeLowCost;parentRoleId;subRoles=[];parentRole;level=0;constructor(e){super(e),this.description=e?.description,this.canChangeLowCost=e?.canChangeLowCost??!1,this.parentRoleId=e?.parentRoleId}},Ce=class{role;category;minCoefficient;constructor(e){this.role=new P(e?.role),this.category=new C(e?.category),this.minCoefficient=new t.PriceCoefficient(e?.minCoefficient)}},we=class{isFake;isHidden;isMultiple;type;ord;constructor(e){this.isFake=e?.isFake??!1,this.isHidden=e?.isHidden??!1,this.isMultiple=e?.isMultiple??null,this.type=e?.type??null,this.ord=e?.ord??0}},Te=class{category;property;settings;constructor(e){this.category=new C(e?.category),this.property=new j(e?.property),this.settings=new we(e?.settings)}},Ee=class{id;label;constructor(e){this.id=e?.id??``,this.label=e?.label??``}},De=class{id;label;type;ord;isMultiple;values;min;max;constructor(e){this.id=e?.id??``,this.label=e?.label??``,this.type=e?.type??me.Checkbox,this.ord=e?.ord??0,this.isMultiple=e?.isMultiple??null,this.values=e?.values?.map(e=>new Ee(e))??[],this.min=e?.min??null,this.max=e?.max??null}},Oe=class extends t.HttpRequester{search(e,t=!1){return this.get(`/internal/catalog/search`,{term:e,show_hidden:t})}getPriceExportLink(e=`csv`,n=!1,r=void 0,i=void 0){let a=`${(0,t.useBaseConfigStore)().config.http.portalApiUrl}/api/internal/price/export?format=${e}&show_hidden=${n}`;return r&&(a+=`&category_id=${r}`),i&&(a+=`&client_id=${i}`),a}},ke=class extends t.HttpRequester{importPrices(e,t,n=!1){return this.post(`/internal/clients/${e}/price/import`,t,void 0,{},n)}getCategoryPrices(e){return this.getTypedList(Se,`/internal/clients/${e}/price/categories`)}getCategoryPrice(e,t){return this.get(`/internal/clients/${e}/price/categories/${t}`,{},e=>new Se(e.data))}updateCategoryPrices(e,t,n,r=!1){return this.request({method:`PATCH`,url:`/internal/clients/${e}/price/categories/${t}`,data:{price_coefficient_id:n.coefficient?.id,increase_percent:n.value},params:r?{recursively:!0}:{}})}removeCategoryPrices(e,t,n=!1){return this.request({method:`DELETE`,url:`/internal/clients/${e}/price/categories/${t}`,params:n?{recursively:!0}:{}})}removeCategoryProductsPrices(e,t,n=!1){return this.request({method:`DELETE`,url:`/internal/clients/${e}/price/categories/${t}/products`,params:n?{recursively:!0}:{}})}markCategoryRequired(e,t){return this.post(`/internal/clients/${e}/price/categories/${t}/required`)}unmarkCategoryRequired(e,t){return this.delete(`/internal/clients/${e}/price/categories/${t}/required`)}markCategoryDisabled(e,t,n){return this.post(`/internal/clients/${e}/price/categories/${t}/disabled`,{comment:n})}unmarkCategoryDisabled(e,t){return this.delete(`/internal/clients/${e}/price/categories/${t}/disabled`)}addCategoryManager(e,t,n){return this.post(`/internal/clients/${e}/price/categories/${t}/manager`,{manager_id:n})}removeCategoryManager(e,t){return this.delete(`/internal/clients/${e}/price/categories/${t}/manager`)}getProductPrices(e){return this.getTypedList(N,`/internal/clients/${e}/price/products`)}getProductPrice(e,t){return this.get(`/internal/clients/${e}/price/products/${t}`,{},e=>new N(e.data))}updateProductPrice(e,t,n){return this.patch(`/internal/clients/${e}/price/products/${t}`,{price_coefficient_id:n.coefficient?.id,increase_percent:n.value},e=>new N(e.data))}removeProductPrice(e,t){return this.delete(`/internal/clients/${e}/price/products/${t}`)}markProductRequired(e,t){return this.post(`/internal/clients/${e}/price/products/${t}/required`)}unmarkProductRequired(e,t){return this.delete(`/internal/clients/${e}/price/products/${t}/required`)}getCommercialOfferHtml(e,t){return this.get(`/internal/clients/${e}/price/commercial-offer/view`,t,e=>new Blob([e.data],{type:`text/html`}))}getCommercialOfferPdf(e,t){return this.getBlob(`/internal/clients/${e}/price/commercial-offer/download`,t,e=>new Blob([e.request.response],{type:`application/pdf`}))}sendCommercialOffer(e,t){return this.post(`/internal/clients/${e}/price/commercial-offer/send`,t)}},Ae=class extends t.HttpRequester{getTemplateList(e){return this.getTypedList(k,`/internal/clients/${e}/price/templates`)}getActiveTemplate(e){return this.get(`/internal/clients/${e}/price/templates/active`,{},e=>new k(e.data),!0)}attachTemplate(e,r,i){let a=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.post(`/internal/clients/${e}/price/templates/${r}`,i&&{startAt:i.startAt&&(0,n.format)(i.startAt,a),endAt:i.endAt&&(0,n.format)(i.endAt,a)},e=>new k(e.data),{},!0)}applyTemplate(e,t){return this.post(`/internal/clients/${e}/price/templates/${t}/apply`,{},void 0,{},!0)}changeTemplate(e,r,i,a){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.patch(`/internal/clients/${e}/price/templates/${r}/${i}`,a&&{startAt:a.startAt&&(0,n.format)(a.startAt,o),endAt:a.endAt&&(0,n.format)(a.endAt,o)},e=>new k(e.data))}detachTemplate(e,t,n){return this.delete(`/internal/clients/${e}/price/templates/${t}/${n}`)}},je=class extends t.HttpRequester{getRootCategoriesList(e=!1){return this.getTypedList(T,`/internal/catalog/categories`,{showHidden:e})}getCategoryData(e,t=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{showHidden:t,withNestedCategories:n},e=>new T(e.data))}getPublicCategoryData(e){return this.get(`/public/catalog/categories/${e}`,{},e=>new T(e.data))}getCategoryProductsList(e,t=!0,n=!1){return this.get(`/internal/catalog/categories/${e}/products`,{showHidden:n,withPriceCoefficients:t},e=>(0,r.map)(e.data,e=>new x(e)))}getCategoryProductsCoefficients(e){return this.get(`/internal/catalog/categories/${e}/products/coefficients`,{},e=>{let{data:t}=e;return(0,r.forEach)(t,e=>e.map(e=>new v(e))),t})}publicSimpleSearch(e,t=10){return new Promise((n,r)=>{this.get(`/public/catalog/search/simple?limit=${t}&term=${e}`).then(e=>{n(e.categories.map(e=>new T(e)))}).catch(e=>{r(e)})})}},Me=class extends p{getProductData(e,t=!1){return this.get(`/internal/catalog/products/${e}`,{withPriceCoefficients:t},e=>new x(e.data))}getPublicProductData(e){return this.get(`/public/catalog/products/${e}`,{},e=>new x(e.data))}getProductPriceCoefficients(e){return this.get(`/internal/catalog/products/${e}/coefficients`,{},e=>(0,r.map)(e.data,e=>new v(e)))}getNewProducts(e,r,i=!0){let a=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.getTypedPaginated(x,`/internal/catalog/products/new`,void 0,void 0,r,{period:{from:(0,n.format)(e,a)},withPriceCoefficients:i})}publicSimpleSearch(e,t=10){return new Promise((n,r)=>{this.get(`/public/catalog/search/simple?limit=${t}&term=${e}`).then(e=>{n(e.products.map(e=>new x(e)))}).catch(e=>{r(e)})})}},Ne=class extends t.HttpRequester{getRootCategoriesList(e,t=!1){return this.getTypedList(ge,`/internal/catalog/categories`,{clientId:e,showHidden:t})}getCategoryData(e,t,n=!1,r=!1){return this.get(`/internal/catalog/categories/${t}`,{clientId:e,showHidden:n,withNestedCategories:r},e=>new ge(e.data))}getCategoryProductsList(e,t,n=!0,i=!1){return this.get(`/internal/catalog/categories/${t}/products`,{client_id:e,showHidden:i,withPriceCoefficients:n},e=>(0,r.map)(e.data,e=>new S(e)))}},Pe=class extends p{getProductData(e,t,n=!1){return this.get(`/internal/catalog/products/${e}`,{clientId:t,withPriceCoefficients:n},e=>new S(e.data))}getNewProducts(e,r,i,a=!0){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.getTypedPaginated(S,`/internal/catalog/products/new`,void 0,void 0,i,{clientId:e,period:{from:(0,n.format)(r,o)},withPriceCoefficients:a})}},Fe=class extends p{getTemplateList(e,t,n){return this.getTypedPaginated(_,`/internal/price/templates`,e,t,n)}createTemplate(e,t={}){return this.post(`/internal/price/templates`,e,e=>new _(e.data),t)}getTemplate(e){return this.get(`/internal/price/templates/${e}`,{},e=>new _(e.data))}updateTemplate(e,t,n={}){return this.patch(`/internal/price/templates/${e}`,t,e=>new _(e.data),n)}removeTemplate(e){return this.delete(`/internal/price/templates/${e}`)}getProductTemplatePrices(e){return this.getTypedList(A,`/internal/price/templates/${e}/products`)}getProductTemplatePrice(e,t){return this.get(`/internal/price/templates/${e}/products/${t}`,{},e=>new A(e.data))}saveProductTemplatePrice(e,t,n){return this.post(`/internal/price/templates/${e}/products/${t}`,{price_coefficient_id:n.coefficient?.id,increase_percent:n.value},e=>new A(e.data))}deleteProductTemplatePrice(e,t){return this.delete(`/internal/price/templates/${e}/products/${t}`)}getCategoryTemplatePrices(e){return this.getTypedList(E,`/internal/price/templates/${e}/categories`)}getCategoryTemplatePrice(e,t){return this.get(`/internal/price/templates/${e}/categories/${t}`,{},e=>new E(e.data))}saveCategoryTemplatePrice(e,t,n,r=!1){return this.request({method:`POST`,url:`/internal/price/templates/${e}/categories/${t}`,data:{price_coefficient_id:n.coefficient?.id,increase_percent:n.value},params:r?{recursively:!0}:{}},e=>new E(e.data))}deleteCategoryTemplatePrice(e,t,n=!1){return this.request({method:`DELETE`,url:`/internal/price/templates/${e}/categories/${t}`,params:n?{recursively:!0}:{}})}getTemplateClients(e){return this.getTypedList(k,`/internal/price/templates/${e}/clients`)}},Ie=class extends t.HttpRequester{getRoles(){return this.getTypedList(P,`/internal/price/roles`)}createRole(e){return this.post(`/internal/price/roles`,e,e=>new P(e.data))}getRole(e){return this.get(`/internal/price/roles/${e}`,{},e=>new P(e.data))}updateRole(e,t){return this.patch(`/internal/price/roles/${e}`,t,e=>new P(e.data))}deleteRole(e){return this.delete(`/internal/price/roles/${e}`)}getCategoryRules(e){return this.getTypedList(Ce,`/internal/price/roles/rules/categories/${e}`)}updateCategoryRules(e,n){return this.patch(`/internal/price/roles/rules/categories/${e}`,n,e=>t.TypedInstanceFactory.instanceListInitializer(Ce,e.data))}},Le=class extends p{getProperties(e,t,n){return this.getTypedPaginated(j,`/internal/catalog/properties`,e,t,n)}createProperty(e){let{typeId:t,...n}=e;return this.post(`/internal/catalog/properties`,{...n,type:t},e=>new j(e.data))}getProperty(e){return this.get(`/internal/catalog/properties/${e}`,{},e=>new j(e.data))}updateProperty(e,t){let{typeId:n,...r}=t;return this.patch(`/internal/catalog/properties/${e}`,{...r,type:n},e=>new j(e.data))}deleteProperty(e){return this.delete(`/internal/catalog/properties/${e}`)}getProductProperties(e){return this.getTypedList(M,`/internal/catalog/products/${e}/properties`)}getProductProperty(e,t){return this.get(`/internal/catalog/products/${e}/properties/${t}`,{},e=>new M(e.data))}updateProductProperty(e,t,n){return this.patch(`/internal/catalog/products/${e}/properties/${t}`,{value:n},e=>new M(e.data))}deleteProductProperty(e,t){return this.delete(`/internal/catalog/products/${e}/properties/${t}`)}getProductDescription(e){return this.get(`/internal/catalog/products/${e}/properties/description`)}updateProductDescription(e,t){return this.patch(`/internal/catalog/products/${e}/properties/description`,{text:t})}deleteProductDescription(e){return this.delete(`/internal/catalog/products/${e}/properties/description`)}getProductSpecification(e){return this.get(`/internal/catalog/products/${e}/properties/specification`)}updateProductSpecification(e,t){return this.patch(`/internal/catalog/products/${e}/properties/specification`,{text:t})}deleteProductSpecification(e){return this.delete(`/internal/catalog/products/${e}/properties/specification`)}getProductFiles(e){return this.get(`/internal/catalog/products/${e}/properties/files`)}addProductFile(e,t){return this.post(`/internal/catalog/products/${e}/properties/files`,t)}updateProductFile(e,t,n){return this.patch(`/internal/catalog/products/${e}/properties/files/${t}`,n)}deleteProductFile(e,t){return this.delete(`/internal/catalog/products/${e}/properties/files/${t}`)}updateProductSlug(e,t){return this.patch(`/internal/catalog/products/${e}/properties/slug`,{slug:t})}getCategoryProperties(e){return this.getTypedList(M,`/internal/catalog/categories/${e}/properties`)}getCategoryProperty(e,t){return this.get(`/internal/catalog/categories/${e}/properties/${t}`,{},e=>new M(e.data))}updateCategoryProperty(e,t,n){return this.patch(`/internal/catalog/categories/${e}/properties/${t}`,{value:n},e=>new M(e.data))}deleteCategoryProperty(e,t){return this.delete(`/internal/catalog/categories/${e}/properties/${t}`)}getCategoryDescription(e){return this.get(`/internal/catalog/categories/${e}/properties/description`)}updateCategoryDescription(e,t){return this.patch(`/internal/catalog/categories/${e}/properties/description`,{text:t})}deleteCategoryDescription(e){return this.delete(`/internal/catalog/categories/${e}/properties/description`)}getCategorySpecification(e){return this.get(`/internal/catalog/categories/${e}/properties/specification`)}updateCategorySpecification(e,t){return this.patch(`/internal/catalog/categories/${e}/properties/specification`,{text:t})}deleteCategorySpecification(e){return this.delete(`/internal/catalog/categories/${e}/properties/specification`)}getCategoryFiles(e){return this.get(`/internal/catalog/categories/${e}/properties/files`)}addCategoryFile(e,t){return this.post(`/internal/catalog/categories/${e}/properties/files`,t)}updateCategoryFile(e,t,n){return this.patch(`/internal/catalog/categories/${e}/properties/files/${t}`,n)}deleteCategoryFile(e,t){return this.delete(`/internal/catalog/categories/${e}/properties/files/${t}`)}updateCategorySlug(e,t){return this.patch(`/internal/catalog/categories/${e}/properties/slug`,{slug:t})}updateCategoryImage(e,t){return this.post(`/internal/catalog/categories/${e}/image`,{image:t})}getCategoryFilters(e,t=!1){return this.get(`/internal/catalog/categories/${e}/filters`,{recursively:t},e=>e.data.map(e=>new De(e)))}getCategoryFilterSettings(e){return this.getTypedList(Te,`/internal/catalog/categories/${e}/filter-settings`)}saveCategoryFilterSetting(e,t,n){return this.patch(`/internal/catalog/categories/${e}/filter-settings/${t}`,n,e=>new Te(e.data))}deleteCategoryFilterSetting(e,t){return this.delete(`/internal/catalog/categories/${e}/filter-settings/${t}`)}},Re=class extends t.HttpRequester{getRootCategoriesList(e,t=!1){return this.getTypedList(T,`/internal/catalog/categories`,{priceTemplateId:e,showHidden:t})}getCategoryData(e,t,n=!1,r=!1){return this.get(`/internal/catalog/categories/${t}`,{priceTemplateId:e,showHidden:n,withNestedCategories:r},e=>new T(e.data))}getCategoryProductsList(e,t,n=!0,i=!1){return this.get(`/internal/catalog/categories/${t}/products`,{priceTemplateId:e,showHidden:i,withPriceCoefficients:n},e=>(0,r.map)(e.data,e=>new x(e)))}};function ze(e,t,n){let r;return e.some(e=>{if(e.type===n&&e.id===t)return r=e,!0;if(e.type===`product`)return!1;let i=e;if(i.products&&i.products.length>0){let e=ze(i.products,t,n);if(e)return r=e,!0}if(i.categories&&i.categories.length>0){let e=ze(i.categories,t,n);if(e)return r=e,!0}return!1}),r}function Be(e){let t=[];return e.forEach(e=>{if(t.push(e),e.type===`category`){let n=e;n.products&&n.products.length>0&&t.push(...Be(n.products)),n.categories&&n.categories.length>0&&t.push(...Be(n.categories))}}),t}var Ve=function(e){return e.LastOrder=`last_order`,e.Contacts=`contacts`,e.PartnerGroups=`partner_groups`,e.PreferredDeliveryType=`preferred_delivery_type`,e.SalesDirection=`sales_direction`,e.Managers=`managers`,e.Curators=`curators`,e}({}),F=class extends t.Identity{bankName=``;bic=``;accountNumber=``;correspondentAccount=``;currency=new t.Currency;constructor(e){super(e),e&&(this.bankName=e.bankName??``,this.bic=e.bic??``,this.accountNumber=e.accountNumber??``,this.correspondentAccount=e.correspondentAccount??``,this.currency=new t.Currency(e.currency))}},I=class extends m{phone;email;constructor(e){super(e),this.email=e?.email,this.phone=/^\d+$/.test(e?.phone??``)?`+${e?.phone}`:e?.phone}},L=class extends I{isPrimary;position;notDisturb;comment;constructor(e){super(e),this.isPrimary=e?.isPrimary??!1,this.position=e?.position,this.notDisturb=e?.notDisturb??!1,this.comment=e?.comment}},He=class extends m{opf=t.Opf.generatePersonItem();partnerGroup=new t.PartnerGroup;contacts=[];bankAccounts=[];comment;alternativeName;creator;updater;constructor(e){if(super(e),e){if(this.opf=new t.Opf(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.creator=e.creator?new h(e.creator):void 0,this.updater=e.updater?new h(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new t.PartnerGroup(e.partnerGroup)),e.contacts){let t=[];e.contacts.forEach(e=>{t.push(new L(e))}),this.contacts=t}if(e.bankAccounts){let t=[];e.bankAccounts.forEach(e=>{t.push(new F(e))}),this.bankAccounts=t}}}},Ue=class extends He{constructor(e){super(e)}},We=class extends He{inn=``;okpo=``;ogrn=``;directorName=``;directorPosition=``;directorActsOn=``;legalAddress=``;postalAddress=``;actualAddress=``;constructor(e){super(e),e&&(this.inn=e.inn??``,this.okpo=e.okpo??``,this.ogrn=e.ogrn??``,this.directorName=e.directorName??``,this.directorPosition=e.directorPosition??``,this.directorActsOn=e.directorActsOn??``,this.legalAddress=e.legalAddress??``,this.postalAddress=e.postalAddress??``,this.actualAddress=e.actualAddress??``)}},Ge=class extends We{kpp=``;constructor(e){super(e),e&&(this.kpp=e.kpp??``)}},Ke=class extends Ge{registrationCountry=new t.Country;registrationNumber=``;taxNumber=``;constructor(e){super(e),e&&(this.registrationCountry=new t.Country(e.registrationCountry),this.registrationNumber=e.registrationNumber??``,this.taxNumber=e.taxNumber??``)}},R=class{static createInstance(e){switch(e.opf.slug){case t.OpfEnum.Ic:return new We(e);case t.OpfEnum.UlR:return new Ge(e);case t.OpfEnum.UlNr:return new Ke(e);default:return new Ue(e)}}},z=class extends m{address=``;coordinates;contacts;comment;operatingHours;isOneTime;isTransportCompanyAddress;constructor(e){super(e),this.address=e?.address??``,this.coordinates=new t.GeoCoordinates(e?.coordinates),this.contacts=e?.contacts?.map(e=>new L(e))??[],this.comment=e?.comment,this.operatingHours=e?.operatingHours,this.isOneTime=e?.isOneTime,this.isTransportCompanyAddress=e?.isTransportCompanyAddress}},qe=class extends O{contragents;partnerGroups;contacts;deliveryAddresses;channelPrimaryInterest;sourcePrimaryInterest;preferredDeliveryType;primaryDemand;preferredWarehouse;extraData;constructor(e){super(e),this.contragents=e?.contragents?.map(e=>R.createInstance(e))??[],this.partnerGroups=e?.partnerGroups?.map(e=>new t.PartnerGroup(e))??[],this.contacts=e?.contacts?.map(e=>new L(e))??[],this.deliveryAddresses=e?.deliveryAddresses?.map(e=>new z(e))??[],this.channelPrimaryInterest=new t.ChannelPrimaryInterest(e?.channelPrimaryInterest),this.sourcePrimaryInterest=new t.SourcePrimaryInterest(e?.sourcePrimaryInterest),this.preferredDeliveryType=new t.DeliveryType(e?.preferredDeliveryType),this.primaryDemand=e?.primaryDemand,this.preferredWarehouse=e?.preferredWarehouse?new t.Warehouse(e.preferredWarehouse):void 0,this.extraData=e?.extraData??{}}},Je=class extends u{id;guid;name;alternativeName;searchTerm;cities;region;country;phone;email;isActive;createdAt=new d;lastLoginDate=new d;lastLoginDateHasOrder;managers;includeSubordinateManagers;curators;isManagerRequired;salesDirections;contragentInn;contragentType;preferredDeliveryType;partnerGroups;contact;lastOrder;noOrdersPeriod=new d;constructor(e){super(),this.id=e?.id,this.guid=e?.guid,this.name=e?.name,this.alternativeName=e?.alternativeName,this.searchTerm=e?.searchTerm,this.cities=e?.cities?.map(e=>new t.CityWithRegionAndCountry(e)),this.region=new t.Region(e?.region),this.country=new t.Country(e?.country),this.phone=e?.phone,this.email=e?.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,`isActive`)?e?.isActive:!0,this.createdAt=new d(e?.createdAt),this.lastLoginDate=new d(e?.lastLoginDate),this.lastLoginDateHasOrder=e?.lastLoginDateHasOrder??void 0,this.managers=e?.managers?.map(e=>new t.Manager(e))??[],this.includeSubordinateManagers=e?.includeSubordinateManagers??!0,this.curators=e?.curators?.map(e=>new D(e))??[],this.salesDirections=e?.salesDirections?.map(e=>new t.SalesDirection(e)),this.contragentInn=e?.contragentInn,this.contragentType=new t.Opf(e?.contragentType),this.preferredDeliveryType=e?.preferredDeliveryType?new t.DeliveryType(e?.preferredDeliveryType):void 0,this.partnerGroups=e?.partnerGroups?.map(e=>new t.PartnerGroup(e)),this.contact=new I(e?.contact),this.lastOrder={createdAt:new d(e?.lastOrder?.createdAt),creator:e?.lastOrder?.creator,isApproved:e?.lastOrder?.isApproved},this.noOrdersPeriod=new d(e?.noOrdersPeriod)}resetFilterValue(e){switch(e){case`cities`:this.cities=[];break;case`region`:this.region=new t.Region;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 t.Opf;break;case`preferredDeliveryType`:this.preferredDeliveryType=new t.DeliveryType;break;case`partnerGroups`:this.partnerGroups=[];break;case`contact`:this.contact=new I;break;default:this[e]=void 0}return this}asClearRaw(){let e=super.asClearRaw();return!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,!e?.lastLoginDate?.from&&!e?.lastLoginDate?.to&&delete e.lastLoginDate,!e?.noOrdersPeriod?.from&&!e?.noOrdersPeriod?.to&&delete e.noOrdersPeriod,e}},Ye=class extends s{creator;constructor(e){super(e),this.creator=new h(e?.creator)}},Xe=class extends t.NamedIdentity{contacts=[];preferredDeliveryType;partnerGroups=[];lastOrder;salesDirection;managers;curators;constructor(e){super(e),this.contacts=e.contacts?.map(e=>new L(e))??void 0,this.lastOrder=e.lastOrder?new Ye(e.lastOrder):void 0,this.partnerGroups=e.partnerGroups?.map(e=>new t.PartnerGroup(e))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new t.DeliveryType(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new t.SalesDirection(e.salesDirection):void 0,this.managers=e.managers?.map(e=>new t.ManagerCommon(e))??void 0,this.curators=e.curators?.map(e=>new D(e))??void 0}},B=class extends t.Identity{isPrimary;constructor(e){super(e),this.isPrimary=e.isPrimary}},Ze=class extends L{relations={clients:[],contragents:[],addresses:[]};constructor(e){super(e),e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(e=>new B(e))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(e=>new B(e))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(e=>new B(e))))}},Qe=class e extends p{static transformClientDataToRequest(e){return{name:e.name,alternative_name:e.alternativeName,partner_groups:e.partnerGroups.map(e=>e.id),phone:e.phone,email:e.email,city_id:e.city.id,get_news:e.getNews,channel_primary_interest_id:e.channelPrimaryInterest.id,source_primary_interest_id:e.sourcePrimaryInterest.id,primary_demand:e.primaryDemand,preferred_warehouse_id:e.preferredWarehouse?.id}}static transformContragentClientDataToRequest(e){let n,r=e,i=e,a=e;switch(e.opf.slug){case t.OpfEnum.Ic:n={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:r.partnerGroup?.id,comment:r.comment,inn:r.inn,okpo:r.okpo,ogrn:r.ogrn||void 0,director_name:r.directorName,director_position:r.directorPosition,director_acts_on:r.directorActsOn,legal_address:r.legalAddress,postal_address:r.postalAddress,actual_address:r.actualAddress};break;case t.OpfEnum.UlR:n={opf:i.opf.slug,name:i.name,alternative_name:i.alternativeName,partner_group_id:i.partnerGroup?.id,comment:i.comment,inn:i.inn,kpp:i.kpp,okpo:i.okpo,ogrn:i.ogrn||void 0,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 t.OpfEnum.UlNr:n={opf:a.opf.slug,name:a.name,alternative_name:a.alternativeName,partner_group_id:a.partnerGroup?.id,comment:a.comment,director_name:a.directorName,director_position:a.directorPosition,director_acts_on:a.directorActsOn,legal_address:a.legalAddress,postal_address:a.postalAddress,actual_address:a.actualAddress,registration_country_id:a.registrationCountry.id,registration_number:a.registrationNumber,tax_number:a.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:e.partnerGroup?.id,comment:e.comment}}return n}static transformClientDeliveryAddressToRequest(e){let t={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??``};return e.coordinates&&(t.coordinates={lat:e.coordinates?.lat,long:e.coordinates?.long}),e.operatingHours&&(t.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),t}static transformClientContragentBankAccountToRequest(e){return{bank_name:e.bankName,bic:e.bic,account_number:e.accountNumber,correspondent_account:e.correspondentAccount,currency_id:e.currency.id}}getClient(e){return this.get(`/internal/clients/${e}`,{},e=>new qe(e.data))}getClientsList(e,t,n,r,i){return this.getTypedPaginated(O,`/internal/clients`,e,t,n,r,void 0,i)}searchClient(e){return this.getClientsList(void 0,void 0,void 0,{searchTerm:e}).then(e=>e.data)}getClientByPhone(e){return this.getClientsList({groupOp:`and`,groups:[],filters:[{field:`phone`,op:te.Contains,value:e}]})}getAdditionalClientsData(e,n){let r=e.map(e=>e.id);return this.post(`/internal/clients/additional-data`,{clients:r,requested_data_types:n},e=>t.TypedInstanceFactory.instanceListInitializer(Xe,e.data))}getAllClientContacts(e){return this.getTypedList(Ze,`/internal/clients/${e}/contacts/all`)}createClientCommonData(t,n={}){return this.post(`/internal/clients`,e.transformClientDataToRequest(t),e=>new qe(e.data),n)}updateClientCommonData(t,n={}){return this.patch(`/internal/clients/${t.id}`,e.transformClientDataToRequest(t),void 0,n)}updateClientNotDistribCommonData(e,t={}){let n={get_news:e.getNews};return this.patch(`/internal/clients/${e.id}`,n,void 0,t)}changeClientPassword(e,t,n,r={}){return this.patch(`/internal/clients/${e}`,{password:t,password_confirmation:n},void 0,r)}updateClientComment(e){return this.patch(`/internal/clients/${e.id}`,{comment:e.comment})}changeClientActivation(e){return this.patch(`/internal/clients/${e.id}`,{is_active:e.isActive})}async attachClientToManagers(e,t){let n=t.map(t=>this.patch(`/internal/clients/${e}/managers/${t.id}/attach`,{is_primary:t.isDefault}));await Promise.all(n)}async detachClientFromManagers(e,t){let n=t.map(t=>this.patch(`/internal/clients/${e}/managers/${t.id}/detach`));await Promise.all(n)}attachToCurator(e,t,n){return this.patch(`/internal/clients/${e}/curators/${t}/attach`,{curated_direction_id:n.id})}detachFromCurator(e,t,n){return this.patch(`/internal/clients/${e}/curators/${t}/detach`,{curated_direction_id:n.id})}setCurators(e,t){return this.patch(`/internal/clients/${e}/curators`,{curators:t.map(e=>({curator_id:e.curatorId,curated_direction_id:e.curatedDirection.id}))})}createContragentClientData(t,n,r={}){return this.post(`/internal/clients/${t}/contragents`,e.transformContragentClientDataToRequest(n),e=>R.createInstance(e.data),r)}updateContragentClientData(t,n,r={}){return this.patch(`/internal/clients/${t}/contragents/${n.id}`,e.transformContragentClientDataToRequest(n),e=>R.createInstance(e.data),r)}deleteClientContragent(e,t){return this.delete(`/internal/clients/${e}/contragents/${t.id}`)}getClientDeliveryAddresses(e){return this.getTypedList(z,`/internal/clients/${e}/delivery-addresses`)}createClientDeliveryAddress(t,n,r={}){return this.post(`/internal/clients/${t}/delivery-addresses`,e.transformClientDeliveryAddressToRequest(n),e=>new z(e.data),r)}updateClientDeliveryAddress(t,n,r={}){return this.patch(`/internal/clients/${t}/delivery-addresses/${n.id}`,e.transformClientDeliveryAddressToRequest(n),e=>new z(e.data),r)}deleteClientDeliveryAddress(e,t){return this.delete(`/internal/clients/${e}/delivery-addresses/${t.id}`)}createContragentBankAccount(t,n,r,i={}){return this.post(`/internal/clients/${t}/contragents/${n}/bank-accounts`,e.transformClientContragentBankAccountToRequest(r),e=>new F(e.data),i)}updateContragentBankAccount(t,n,r,i={}){return this.patch(`/internal/clients/${t}/contragents/${n}/bank-accounts/${r.id}`,e.transformClientContragentBankAccountToRequest(r),e=>new F(e.data),i)}deleteContragentBankAccount(e,t,n){return this.delete(`/internal/clients/${e}/contragents/${t}/bank-accounts/${n.id}`)}createClientContact(e,t,n={}){return this.createContact(e,t,{client:{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}},n)}updateClientContact(e,t,n={}){return this.patch(`/internal/clients/${e}/contacts/${t.id}`,{name:t.name,position:t.position,phone:t.phone,email:t.email,comment:t.comment,not_disturb:t.notDisturb},e=>new L(e.data),n)}setPrimaryClientContact(e,t){return this.setPrimaryContact(`/internal/clients/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachClientContact(e,t){return this.detachContact(`/internal/clients/${e}/contacts/${t.id}/detach`)}createContragentContact(e,t,n,r={}){return this.createContact(e,n,{contragents:[{id:t,is_primary:n.isPrimary??!1,not_disturb:n.notDisturb??!1}]},r)}setPrimaryContragentContact(e,t,n){return this.setPrimaryContact(`/internal/clients/${e}/contragents/${t}/contacts/${n.id}/primary`,n.isPrimary??!1)}detachContragentContact(e,t,n){return this.detachContact(`/internal/clients/${e}/contragents/${t}/contacts/${n.id}/detach`)}createDeliveryAddressContact(e,t,n,r={}){return this.createContact(e,n,{addresses:[{id:t,is_primary:n.isPrimary??!1,not_disturb:n.notDisturb??!1}]},r)}setPrimaryDeliveryAddressContact(e,t,n){return this.setPrimaryContact(`/internal/clients/${e}/delivery-addresses/${t}/contacts/${n.id}/primary`,n.isPrimary??!1)}detachDeliveryAddressContact(e,t,n){return this.detachContact(`/internal/clients/${e}/delivery-addresses/${t}/contacts/${n.id}/detach`)}createContact(e,t,n,r={}){let i={name:t.name,position:t.position,comment:t.comment,...n};return t.phone?.length&&(i.phone=t.phone),t.email?.length&&(i.email=t.email),this.post(`/internal/clients/${e}/contacts`,i,e=>new L(e.data),r)}setPrimaryContact(e,t){return this.patch(e,{is_primary:t})}detachContact(e){return this.patch(e)}sendClientEmailConfirmation(e){return this.get(`/internal/clients/${e.id}/verification/email?email=${e.email}`)}},$e=class extends t.HttpRequester{checkPhoneIsBusy(e){return new Promise((t,n)=>{this.request({method:`GET`,url:`/public/user/verification/phone/check`,params:{phone:e}}).then(e=>{t(!!e.isBusy)}).catch(n)})}},et=class{date;name;version;constructor(e){this.date=(0,r.isString)(e?.date)?(0,n.parseISO)(e.date):e?.date??new Date,this.name=e?.name??``,this.version=e?.version??`0.0.0`}},tt=function(e){return e.Kozyrek=`kozyrek`,e.Mosquitto=`mosquitto`,e.Strip=`strip`,e.MetalForDoors=`metal_for_doors`,e.Sandwich=`sandwich`,e.SandwichM2=`sandwich_m2`,e}({}),nt=class extends t.HttpRequester{getConfiguratorSettings(e,t){return this.get(`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/settings?client_id=${t}`)}searchProduct(e,t,n,r={}){return this.request({method:`GET`,url:`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/product`,params:{params:n,client_id:t}},e=>new x(e.data),r)}createTemplate(e,t,n,r={}){return this.post(`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/template?client_id=${t}`,{...n},()=>{},r)}removeTemplate(e,t,n){return this.delete(`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/template/${n}?client_id=${t}`)}calculate(e,t,n){return this.get(`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/calculate`,{client_id:t,...n})}},rt=class{page=1;pageSize=50;constructor(e){this.page=e?.page??1,this.pageSize=e?.pageSize??50}},it=class extends rt{itemCount=0;pageCount=1;pageSlot=5;pageSizes=[25,50,100];showSizePicker=!0;constructor(e){super(e),this.itemCount=e?.itemCount??0,this.pageCount=e?.pageCount??1,this.pageSlot=e?.pageSlot??5,this.pageSizes=e?.pageSizes??[25,50,100],this.showSizePicker=e?.showSizePicker??!0}},at=class{field;direction;constructor(e){this.field=e?.field??``,this.direction=e?.direction??`asc`}},V=class e{static decadeInterval(t){let[n,r]=e.shiftedDecadeBounds(t,0);return{from:n,to:r}}static shiftDecadeInterval(t,n){let[r,i]=e.shiftedDecadeBounds(t,n);return{from:r,to:i}}static startOfHalfYear(e){return new Date(e.getFullYear(),e.getMonth()<6?0:6,1)}static endOfHalfYear(e){return(0,n.endOfMonth)(new Date(e.getFullYear(),e.getMonth()<6?5:11,1))}static addHalfYears(e,t){return(0,n.addMonths)(e,t*6)}static intervalTillSameDate(e,t,r){let i=(0,n.differenceInCalendarMonths)((0,n.startOfMonth)(r),(0,n.startOfMonth)(e)),a=(0,n.startOfMonth)((0,n.addMonths)(t,i)),o=Math.min((0,n.getDate)(r),(0,n.getDaysInMonth)(a));return{from:(0,n.startOfDay)(t),to:(0,n.endOfDay)((0,n.setDate)(a,o))}}static weekTillSameWeekday(e,t){let r=(0,n.startOfWeek)((0,n.addWeeks)(e,t),{weekStartsOn:1}),i=(0,n.differenceInCalendarDays)(e,(0,n.startOfWeek)(e,{weekStartsOn:1}));return{from:r,to:(0,n.endOfDay)((0,n.addDays)(r,i))}}static decadeTillSameDayNumber(t,r){let[i]=e.shiftedDecadeBounds(t,0),a=(0,n.differenceInCalendarDays)(t,i)+1,[o,s]=e.shiftedDecadeBounds(t,r),c=(0,n.differenceInCalendarDays)(s,o)+1;return{from:o,to:(0,n.endOfDay)((0,n.addDays)(o,Math.min(a,c)-1))}}static shiftedDecadeBounds(e,t){let r=(0,n.getDate)(e),i=2;r<=10?i=0:r<=20&&(i=1);let a=i+t,o=Math.floor(a/3),s=(a%3+3)%3,c=(0,n.startOfMonth)((0,n.addMonths)(e,o)),l=(0,n.addDays)(c,s*10);return[l,s===2?(0,n.endOfMonth)(c):(0,n.endOfDay)((0,n.addDays)(l,9))]}};function ot(e){return(0,n.format)((0,n.subDays)((0,n.startOfToday)(),e),`yyyy-MM-dd`)}function st(e,t){let n=[2,0,1,1,1,2],r=Math.floor(Math.abs(e));return t[r%100>4&&r%100<20?2:n[Math.min(r%10,5)]]}function ct(e){let t=(0,n.parseISO)(e),r=(0,n.differenceInCalendarDays)((0,n.startOfToday)(),t);switch(!0){case r===0:return`Сегодня`;case r===1:return`Вчера`;case r<0:return e;default:return`${r} ${st(r,[`день`,`дня`,`дней`])} назад`}}var lt=class{static defaultDateRanges(e){let t=(0,n.addBusinessDays)(new Date,1),r=new Date,i=(0,n.startOfYear)(e===void 0?r:new Date(e,0,1)),a=(0,n.endOfYear)(i);return{nextWorkingDay:{label:`Следующий рабочий день`,from:(0,n.startOfDay)(t),to:(0,n.endOfDay)(t)},today:{label:`Сегодня`,from:(0,n.startOfToday)(),to:(0,n.endOfToday)()},yesterday:{label:`Вчера`,from:(0,n.startOfYesterday)(),to:(0,n.endOfYesterday)()},tomorrow:{label:`Завтра`,from:(0,n.startOfTomorrow)(),to:(0,n.endOfTomorrow)()},currentWeek:{label:`Неделя`,from:(0,n.startOfWeek)(r,{weekStartsOn:1}),to:(0,n.endOfWeek)(r,{weekStartsOn:1})},currentMonth:{label:`Месяц`,from:(0,n.startOfMonth)(r),to:(0,n.endOfMonth)(r)},oneMonth:{label:`1 месяц`,from:i,to:(0,n.endOfMonth)(i)},threeMonths:{label:`3 месяца`,from:i,to:(0,n.endOfMonth)((0,n.addMonths)(i,2))},nineMonths:{label:`9 месяцев`,from:i,to:(0,n.endOfMonth)((0,n.addMonths)(i,8))},firstQuarter:{label:`I квартал`,from:i,to:(0,n.endOfMonth)((0,n.addMonths)(i,2))},secondQuarter:{label:`II квартал`,from:(0,n.addMonths)(i,3),to:(0,n.endOfMonth)((0,n.addMonths)(i,5))},thirdQuarter:{label:`III квартал`,from:(0,n.addMonths)(i,6),to:(0,n.endOfMonth)((0,n.addMonths)(i,8))},fourthQuarter:{label:`IV квартал`,from:(0,n.addMonths)(i,9),to:(0,n.endOfMonth)((0,n.addMonths)(i,11))},firstHalfYear:{label:`I полугодие`,from:i,to:(0,n.endOfMonth)((0,n.addMonths)(i,5))},secondHalfYear:{label:`II полугодие`,from:(0,n.addMonths)(i,6),to:a},currentYear:{label:`12 месяцев`,from:i,to:a}}}static standardPeriods(e=new Date){let t={weekStartsOn:1},r=(0,n.startOfDay)(e),i=(0,n.endOfDay)(e),a=V.decadeInterval(e),o=(0,n.startOfMonth)(e),s=(0,n.startOfQuarter)(e),c=V.startOfHalfYear(e),l=(0,n.startOfYear)(e),u=V.addHalfYears(e,-1),d=V.addHalfYears(e,1);return{yesterday:{label:`Вчера`,group:`day`,from:(0,n.startOfDay)((0,n.subDays)(e,1)),to:(0,n.endOfDay)((0,n.subDays)(e,1))},today:{label:`Сегодня`,group:`day`,from:r,to:i},tomorrow:{label:`Завтра`,group:`day`,from:(0,n.startOfDay)((0,n.addDays)(e,1)),to:(0,n.endOfDay)((0,n.addDays)(e,1))},lastWeek:{label:`Прошлая неделя`,group:`week`,from:(0,n.startOfWeek)((0,n.subWeeks)(e,1),t),to:(0,n.endOfWeek)((0,n.subWeeks)(e,1),t)},thisWeek:{label:`Эта неделя`,group:`week`,from:(0,n.startOfWeek)(e,t),to:(0,n.endOfWeek)(e,t)},nextWeek:{label:`Следующая неделя`,group:`week`,from:(0,n.startOfWeek)((0,n.addWeeks)(e,1),t),to:(0,n.endOfWeek)((0,n.addWeeks)(e,1),t)},lastTenDays:{label:`Прошлая декада`,group:`decade`,...V.shiftDecadeInterval(e,-1)},thisTenDays:{label:`Эта декада`,group:`decade`,...a},nextTenDays:{label:`Следующая декада`,group:`decade`,...V.shiftDecadeInterval(e,1)},lastMonth:{label:`Прошлый месяц`,group:`month`,from:(0,n.startOfMonth)((0,n.subMonths)(e,1)),to:(0,n.endOfMonth)((0,n.subMonths)(e,1))},thisMonth:{label:`Этот месяц`,group:`month`,from:o,to:(0,n.endOfMonth)(e)},nextMonth:{label:`Следующий месяц`,group:`month`,from:(0,n.startOfMonth)((0,n.addMonths)(e,1)),to:(0,n.endOfMonth)((0,n.addMonths)(e,1))},lastQuarter:{label:`Прошлый квартал`,group:`quarter`,from:(0,n.startOfQuarter)((0,n.subQuarters)(e,1)),to:(0,n.endOfQuarter)((0,n.subQuarters)(e,1))},thisQuarter:{label:`Этот квартал`,group:`quarter`,from:s,to:(0,n.endOfQuarter)(e)},nextQuarter:{label:`Следующий квартал`,group:`quarter`,from:(0,n.startOfQuarter)((0,n.addQuarters)(e,1)),to:(0,n.endOfQuarter)((0,n.addQuarters)(e,1))},lastHalfYear:{label:`Прошлое полугодие`,group:`halfYear`,from:V.startOfHalfYear(u),to:V.endOfHalfYear(u)},thisHalfYear:{label:`Это полугодие`,group:`halfYear`,from:c,to:V.endOfHalfYear(e)},nextHalfYear:{label:`Следующее полугодие`,group:`halfYear`,from:V.startOfHalfYear(d),to:V.endOfHalfYear(d)},lastYear:{label:`Прошлый год`,group:`year`,from:(0,n.startOfYear)((0,n.subYears)(e,1)),to:(0,n.endOfYear)((0,n.subYears)(e,1))},thisYear:{label:`Этот год`,group:`year`,from:l,to:(0,n.endOfYear)(e)},nextYear:{label:`Следующий год`,group:`year`,from:(0,n.startOfYear)((0,n.addYears)(e,1)),to:(0,n.endOfYear)((0,n.addYears)(e,1))},fromBeginningOfThisWeek:{label:`С начала этой недели`,group:`other`,section:`fromBeginning`,from:(0,n.startOfWeek)(e,t),to:i},fromBeginningOfThisTenDays:{label:`С начала этой декады`,group:`other`,section:`fromBeginning`,from:a.from,to:i},fromBeginningOfThisMonth:{label:`С начала этого месяца`,group:`other`,section:`fromBeginning`,from:o,to:i},fromBeginningOfThisQuarter:{label:`С начала этого квартала`,group:`other`,section:`fromBeginning`,from:s,to:i},fromBeginningOfThisHalfYear:{label:`С начала этого полугодия`,group:`other`,section:`fromBeginning`,from:c,to:i},fromBeginningOfThisYear:{label:`С начала этого года`,group:`other`,section:`fromBeginning`,from:l,to:i},tillEndOfThisWeek:{label:`До конца этой недели`,group:`other`,section:`tillEnd`,from:r,to:(0,n.endOfWeek)(e,t)},tillEndOfThisTenDays:{label:`До конца этой декады`,group:`other`,section:`tillEnd`,from:r,to:a.to},tillEndOfThisMonth:{label:`До конца этого месяца`,group:`other`,section:`tillEnd`,from:r,to:(0,n.endOfMonth)(e)},tillEndOfThisQuarter:{label:`До конца этого квартала`,group:`other`,section:`tillEnd`,from:r,to:(0,n.endOfQuarter)(e)},tillEndOfThisHalfYear:{label:`До конца этого полугодия`,group:`other`,section:`tillEnd`,from:r,to:V.endOfHalfYear(e)},tillEndOfThisYear:{label:`До конца этого года`,group:`other`,section:`tillEnd`,from:r,to:(0,n.endOfYear)(e)},lastWeekTillSameWeekDay:{label:`Прошлая неделя, до такого же дня недели`,group:`other`,section:`lastTillSame`,...V.weekTillSameWeekday(e,-1)},lastTenDaysTillSameDayNumber:{label:`Прошлая декада, до такого же номера дня`,group:`other`,section:`lastTillSame`,...V.decadeTillSameDayNumber(e,-1)},lastMonthTillSameDate:{label:`Прошлый месяц, до такой же даты`,group:`other`,section:`lastTillSame`,...V.intervalTillSameDate(o,(0,n.startOfMonth)((0,n.subMonths)(e,1)),e)},lastQuarterTillSameDate:{label:`Прошлый квартал, до такой же даты`,group:`other`,section:`lastTillSame`,...V.intervalTillSameDate(s,(0,n.startOfQuarter)((0,n.subQuarters)(e,1)),e)},lastHalfYearTillSameDate:{label:`Прошлое полугодие, до такой же даты`,group:`other`,section:`lastTillSame`,...V.intervalTillSameDate(c,V.startOfHalfYear(u),e)},lastYearTillSameDate:{label:`Прошлый год, до такой же даты`,group:`other`,section:`lastTillSame`,...V.intervalTillSameDate(l,(0,n.startOfYear)((0,n.subYears)(e,1)),e)},nextWeekTillSameWeekDay:{label:`Следующая неделя, до такого же дня недели`,group:`other`,section:`nextTillSame`,...V.weekTillSameWeekday(e,1)},nextTenDaysTillSameDayNumber:{label:`Следующая декада, до такого же номера дня`,group:`other`,section:`nextTillSame`,...V.decadeTillSameDayNumber(e,1)},nextMonthTillSameDate:{label:`Следующий месяц, до такой же даты`,group:`other`,section:`nextTillSame`,...V.intervalTillSameDate(o,(0,n.startOfMonth)((0,n.addMonths)(e,1)),e)},nextQuarterTillSameDate:{label:`Следующий квартал, до такой же даты`,group:`other`,section:`nextTillSame`,...V.intervalTillSameDate(s,(0,n.startOfQuarter)((0,n.addQuarters)(e,1)),e)},nextHalfYearTillSameDate:{label:`Следующее полугодие, до такой же даты`,group:`other`,section:`nextTillSame`,...V.intervalTillSameDate(c,V.startOfHalfYear(d),e)},nextYearTillSameDate:{label:`Следующий год, до такой же даты`,group:`other`,section:`nextTillSame`,...V.intervalTillSameDate(l,(0,n.startOfYear)((0,n.addYears)(e,1)),e)},last7Days:{label:`Последние 7 дней`,group:`other`,section:`rollingDays`,from:(0,n.startOfDay)((0,n.subDays)(e,6)),to:i},next7Days:{label:`Следующие 7 дней`,group:`other`,section:`rollingDays`,from:r,to:(0,n.endOfDay)((0,n.addDays)(e,6))}}}},ut=[{key:`day`,label:`День`},{key:`week`,label:`Неделя`},{key:`decade`,label:`Декада`},{key:`month`,label:`Месяц`},{key:`quarter`,label:`Квартал`},{key:`halfYear`,label:`Полугодие`},{key:`year`,label:`Год`},{key:`other`,label:`Прочее`}],dt=[{key:`fromBeginning`,label:`С начала периода`},{key:`tillEnd`,label:`До конца периода`},{key:`lastTillSame`,label:`Прошлые, до такой же даты`},{key:`nextTillSame`,label:`Следующие, до такой же даты`},{key:`rollingDays`,label:`7 дней`}],H=class extends t.NamedIdentity{city;isActive;constructor(e){super(e),this.city=e?.city?new t.CityWithRegionAndCountry(e.city):void 0,this.isActive=e?.isActive??!1}},ft=class{salesDirections;partnerGroups;managers;additionalClients;fixedClients;regions;cities;lastLoginDate;lastOrderDate;constructor(e){this.salesDirections=(0,r.map)(e?.salesDirections??[],e=>new t.SalesDirection(e)),this.partnerGroups=(0,r.map)(e?.partnerGroups??[],e=>new t.PartnerGroup(e)),this.managers=(0,r.map)(e?.managers??[],e=>new h(e)),this.additionalClients=(0,r.map)(e?.additionalClients??[],e=>new H(e)),this.fixedClients=(0,r.map)(e?.fixedClients??[],e=>new H(e)),this.regions=(0,r.map)(e?.regions??[],e=>new t.Region(e)),this.cities=(0,r.map)(e?.cities??[],e=>new t.CityWithRegionAndCountry(e)),this.lastLoginDate=new d(e?.lastLoginDate),this.lastOrderDate=new d(e?.lastOrderDate)}hasClientConditions(){return(0,r.some)([this.salesDirections,this.partnerGroups,this.managers,this.additionalClients,this.fixedClients,this.regions,this.cities],e=>!(0,r.isEmpty)(e))||(0,r.some)([this.lastLoginDate,this.lastOrderDate],e=>!!e.from||!!e.to)}setPeriod(e,t){return this[e]=new d({from:t?.from?(0,n.startOfDay)(t.from):null,to:t?.to?(0,n.endOfDay)(t.to):null}),this}toSaveData(){return{salesDirections:(0,r.map)(this.salesDirections,`id`),partnerGroups:(0,r.map)(this.partnerGroups,`id`),managers:(0,r.map)(this.managers,`id`),additionalClients:(0,r.map)(this.additionalClients,`id`),regions:(0,r.map)(this.regions,`id`),cities:(0,r.map)(this.cities,`id`),lastLoginDate:new d(this.lastLoginDate),lastOrderDate:new d(this.lastOrderDate)}}},U=function(e){return e.Active=`active`,e.Scheduled=`scheduled`,e.Completed=`completed`,e}({}),pt=class{static resolve(e,t=new Date){return e.deletedAt&&e.deletedAt.getTime()<=t.getTime()?U.Completed:e.publishedAt&&e.publishedAt.getTime()>t.getTime()?U.Scheduled:U.Active}},W=class extends g{conditions;products;productCategories;countDiscountedPrices;expectedCountDiscountedPrices;countDiscountedProducts;countDiscountedClients;constructor(e){super(e),this.conditions=new ft(e?.conditions),this.products=(0,r.map)(e?.products??[],e=>new x(e)),this.productCategories=(0,r.map)(e?.productCategories??[],e=>new T(e)),this.countDiscountedPrices=e?.countDiscountedPrices??0,this.expectedCountDiscountedPrices=e?.expectedCountDiscountedPrices??0,this.countDiscountedProducts=e?.countDiscountedProducts??0,this.countDiscountedClients=e?.countDiscountedClients??0}getState(e=new Date){return pt.resolve(this,e)}assignCounters(e){this.countDiscountedPrices=e.countDiscountedPrices,this.expectedCountDiscountedPrices=e.expectedCountDiscountedPrices,this.countDiscountedProducts=e.countDiscountedProducts,this.countDiscountedClients=e.countDiscountedClients}isPricesUpdating(){return this.countDiscountedPrices!==this.expectedCountDiscountedPrices}toSaveData(){return{name:this.name,percent:this.percent,isLowPriceAllowed:this.isLowPriceAllowed,publishedAt:this.publishedAt??null,deletedAt:this.deletedAt??null,description:this.description??``,products:(0,r.map)(this.products,`id`),productCategories:(0,r.map)(this.productCategories,`id`),conditions:this.conditions.toSaveData()}}},mt=class{client;additionalClientsCondition;fixedClientsCondition;partnerGroupsCondition;managersCondition;citiesCondition;regionsCondition;salesDirectionsCondition;constructor(e){this.client=new H(e?.client),this.additionalClientsCondition=e?.additionalClientsCondition??!1,this.fixedClientsCondition=e?.fixedClientsCondition??!1,this.partnerGroupsCondition=e?.partnerGroupsCondition??!1,this.managersCondition=e?.managersCondition??!1,this.citiesCondition=e?.citiesCondition??!1,this.regionsCondition=e?.regionsCondition??!1,this.salesDirectionsCondition=e?.salesDirectionsCondition??!1}isEligible(){return this.additionalClientsCondition||this.fixedClientsCondition||this.partnerGroupsCondition||this.managersCondition||this.citiesCondition||this.regionsCondition||this.salesDirectionsCondition}},ht=class extends u{id;name;states;constructor(e){super(),this.id=e?.id,this.name=e?.name,this.states=e?.states}resetFilterValue(e){switch(e){case`id`:case`name`:case`states`:this[e]=void 0}return this}},gt=class e extends p{static prepareSaveData(e,n){return{...e,publishedAt:t.DateHelper.toApiFormat(e.publishedAt),deletedAt:t.DateHelper.toApiFormat(e.deletedAt),conditions:{...e.conditions,lastLoginDate:t.DateHelper.periodToApiFormat(e.conditions.lastLoginDate),lastOrderDate:t.DateHelper.periodToApiFormat(e.conditions.lastOrderDate),updateFixedClients:n}}}getDiscountsList(e,t,n,r){return this.getTypedPaginated(g,`/internal/price/discounts`,e,t,n,{},void 0,r)}getDiscount(e){return this.get(`/internal/price/discounts/${e}`,{},e=>new W(e.data))}createDiscount(t,n,r={}){return this.post(`/internal/price/discounts`,e.prepareSaveData(t,n),e=>new W(e.data),r)}updateDiscount(t,n,r,i={}){return this.patch(`/internal/price/discounts/${t}`,e.prepareSaveData(n,r),e=>new W(e.data),i)}removeDiscount(e){return this.delete(`/internal/price/discounts/${e}`)}getEligibleClients(e){return this.getTypedList(mt,`/internal/price/discounts/${e}/clients`)}checkClient(e,t){return this.get(`/internal/price/discounts/${e}/clients/${t}/check`,{},e=>new mt(e.data))}},G=class extends t.NamedIdentity{constructor(e){super(e)}},K=class extends t.Identity{question;answer;groups;constructor(e){super(e,-1),this.question=e?.question??``,this.answer=e?.answer??``,this.groups=(0,r.map)(e?.groups??[],e=>new G(e))}toSaveData(){return{question:this.question,answer:this.answer,groups:(0,r.map)(this.groups,`id`)}}},_t=class extends p{getFaqList(e,t){return this.getTypedPaginated(K,`/internal/faq`,void 0,void 0,t,(0,r.isNil)(e)?{}:{group:e})}getFaq(e){return this.get(`/internal/faq/${e}`,{},e=>new K(e.data))}createFaq(e,t={}){return this.post(`/internal/faq`,e,e=>new K(e.data),t)}updateFaq(e,t,n={}){return this.patch(`/internal/faq/${e}`,t,e=>new K(e.data),n)}removeFaq(e){return this.delete(`/internal/faq/${e}`)}getGroupsList(){return this.getTypedList(G,`/internal/faq/groups`)}createGroup(e,t={}){return this.post(`/internal/faq/groups`,e,e=>new G(e.data),t)}updateGroup(e,t,n={}){return this.patch(`/internal/faq/groups/${e}`,t,e=>new G(e.data),n)}removeGroup(e){return this.delete(`/internal/faq/groups/${e}`)}};function vt(e){let t=(0,r.round)(e*100);return`${t>=0?`+`:``}${t}%`}var yt=class e{static productIsMeasurable(e){return e.unit.isLinear||e.unit.isSquare}static getProductMultiplicity(t){return!t.properties?.ignoreMinCountCheck&&t.properties?.minCount!=null&&!e.productIsMeasurable(t)?t.properties.minCount:1}static getProductLengthMultiplicity(e){return e.properties?.lengthStep==null?!e.properties?.ignoreMinCountCheck&&e.properties?.minCount!=null?e.properties.minCount:.01:e.properties.lengthStep}},bt=class{static generateUndefinedManagerInstance(){return new t.Manager({id:0,name:`- Не назначен -`,isActive:!0,guid:`-undefined-`})}static isUndefinedManagerInstance(e){return e.id===0&&e.guid===`-undefined-`}},q=function(e){return e.Processing=`processing`,e.Completed=`completed`,e.Error=`error`,e.NeedsActualization=`needs_actualization`,e}({}),xt=class{status;actualizedAt;expiresAt;error;constructor(e){this.status=e?.status??q.Processing,this.actualizedAt=t.DateHelper.parse(e?.actualizedAt),this.expiresAt=t.DateHelper.parse(e?.expiresAt),this.error=e?.error}get isProcessing(){return this.status===q.Processing}get isOutdated(){return this.isOutdatedAt(new Date)}get isOrderAllowed(){return this.isOrderAllowedAt(new Date)}isOutdatedAt(e){return this.status!==q.Completed||(0,r.isNil)(this.actualizedAt)?!0:!(0,r.isNil)(this.expiresAt)&&this.expiresAt.getTime()<e.getTime()}isOrderAllowedAt(e){return this.status===q.Completed&&!this.isOutdatedAt(e)}},St=class extends s{name;client;sum;isProfstroy;actualization;file;constructor(e){super(e),this.name=e?.name,this.client=new O(e?.client),this.sum=e?.sum,this.isProfstroy=e?.isProfstroy,this.actualization=e?.actualization&&new xt(e.actualization),this.file=e?.file}},Ct=class extends de{groupName;supplierSku;isIgnored;lineError;constructor(e){super(e),this.groupName=e.groupName,this.supplierSku=e.supplierSku??e.product.supplierSku,this.isIgnored=e.isIgnored,this.lineError=e.lineError}get isProductStub(){return(0,r.isNil)(this.product.id)}get isOrderable(){return!this.isProductStub&&!this.isIgnored&&(0,r.isEmpty)(this.lineError)}},J=class extends St{sum;products;constructor(e){super(e),this.sum=e.sum??0,this.products=(e.products??[]).map(t=>e.isProfstroy?new Ct(t):new de(t))}},wt=class extends u{id;clientSearchTerm;name;createdAt=new d;constructor(e){super(),this.id=e?.id,this.clientSearchTerm=e?.clientSearchTerm,this.name=e?.name,this.createdAt=new d(e?.createdAt)}resetFilterValue(e){return e===`createdAt`?(this.createdAt.from=null,this.createdAt.to=null):this[e]=void 0,this}asClearRaw(){let e=super.asClearRaw();return!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,e}},Tt=class extends Ye{client;payment;delivery;attachedUser;status;statusDetail;salesDirection;attachedAt;isOnOrder;isProfstroy;isNotInStock;sum;isLargeOrder;constructor(e){super(e),this.client=new O(e?.client),this.payment={type:e?.payment?.type??-1,status:e?.payment?.status??-1,onlinePaymentLink:e?.payment?.onlinePaymentLink},this.delivery={type:e?.delivery?.type??-1,date:(0,r.isString)(e?.delivery?.date)?(0,n.parseISO)(e.delivery.date):e?.delivery?.date??new Date,address:e?.delivery?.address?new z(e.delivery.address):void 0,warehouse:e?.delivery?.warehouse?new t.Warehouse(e.delivery.warehouse):void 0},this.attachedUser=e?.attachedUser?new h(e?.attachedUser):void 0,this.status=new t.OrderStatus(e?.status),this.statusDetail=e?.statusDetail?new t.Reference(e.statusDetail):void 0,this.salesDirection=new t.SalesDirection(e?.salesDirection);let i=e?.attachedAt;this.attachedAt=(0,r.isString)(i)?(0,n.parseISO)(i):e?.attachedAt,this.isOnOrder=e?.isOnOrder??!1,this.isProfstroy=e?.isProfstroy??!1,this.isNotInStock=e?.isNotInStock??!1,this.sum=e?.sum??0,this.isLargeOrder=e?.isLargeOrder??!1}},Et=class extends ue{product;cost;costOne;costOneRub;costRub;logicGroupId;salesDirection;specificationImgUrl;sawing;currency;changedFields=[];replacement;constructor(e,n){super(e),this.product=new S(e.product),this.currency=new t.Currency(e.currency),this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=(0,r.isArray)(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,n&&(this.replacement=n,this.quantity!==n.quantity&&this.changedFields.push(`quantity`),this.length!==n.length&&this.changedFields.push(`length`))}},Y=class extends Tt{products;invoices;comment;image;contragent;barcode;orderSource;isAllowProcessingWithoutPayment;nextStatuses;actions;operatorsComment;operatorsForWarehouseComment;erpOrderUrl;numberDoc;constructor(e){super(e),this.products=(e.products??[]).map(t=>new Et(t,t.replacementId?e.products?.find(e=>e.id===t.replacementId):void 0)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?R.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new t.Reference(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment,this.nextStatuses=e.nextStatuses?.map(e=>new t.OrderStatus(e)),this.actions=e.actions,this.operatorsComment=e.operatorsComment,this.operatorsForWarehouseComment=e.operatorsForWarehouseComment,this.erpOrderUrl=e.erpOrderUrl,this.numberDoc=e.numberDoc}},Dt=class extends p{getOffers(e,t,n,r){return this.getTypedPaginated(St,`/internal/orders/offers`,e,t,n,{},void 0,r)}createOfferFromCart(e,t,n){return this.post(`/internal/orders/offers/${e}`,{name:t,items:n?.length?n:void 0},e=>new J(e.data))}createProfstroyOffer(e,t,n,r={}){return this.post(`/internal/orders/offers/${e}/profstroy`,{file:t,name:n},e=>new J(e.data),r)}actualizeProfstroyOffer(e){return this.post(`/internal/orders/offers/${e}/profstroy/actualize`,{},e=>new J(e.data))}reloadProfstroyOffer(e){return this.post(`/internal/orders/offers/${e}/profstroy/reload`,{},e=>new J(e.data))}getOffer(e){return this.get(`/internal/orders/offers/${e}`,{},e=>new J(e.data))}updateOffer(e,t){return this.patch(`/internal/orders/offers/${e}`,{name:t},e=>new J(e.data))}deleteOffer(e){return this.delete(`/internal/orders/offers/${e}`)}createOrderFromDraft(e,r,i,a={}){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.post(`/internal/orders/offers/${e}/create-order`,{...r,deliveryDate:r.deliveryDate?(0,n.format)(r.deliveryDate,o):void 0,items:i?.length?i:void 0},e=>t.TypedInstanceFactory.instanceListInitializer(Y,e.data),a)}addOfferProduct(e,t,n={}){return this.post(`/internal/orders/offers/${e}/products`,{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,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},e=>new J(e.data),n)}patchOfferProduct(e,t,n,r={}){return this.patch(`/internal/orders/offers/${e}/products/${t}`,{product_id:n.product.id,product_category_id:n.configurator?n.category.id:void 0,quantity:n.quantity,height:n.height,length:n.length,width:n.width,configurator:n.configurator,marker:n.marker,is_additional_sale:n.isAdditionalSale,...n.configuratorParams},e=>new J(e.data),r)}deleteOfferProduct(e,t){return this.delete(`/internal/orders/offers/${e}/products/${t}`,e=>new J(e.data))}getOfferHtml(e,t){return this.get(`/internal/orders/offers/${e}/view`,t?{recipientText:t}:{},e=>new Blob([e.data],{type:`text/html`}))}getOfferPdf(e,t){return this.getBlob(`/internal/orders/offers/${e}/download`,t?{recipientText:t}:{},e=>new Blob([e.request.response],{type:`application/pdf`}))}sendOffer(e,t){return this.post(`/internal/orders/offers/${e}/send`,t)}},Ot=class{static isProfstroy(e){return!!e?.isProfstroy}static isProfstroyOffer(e){return!(0,r.isNil)(e)&&e.isProfstroy===!0&&!(0,r.isNil)(e.actualization)}},kt=function(e){return e.View=`view`,e.Share=`share`,e.EditTags=`edit_tags`,e.SaveOrderIgnoredProducts=`save_order_ignored_products`,e.ChangeStatus=`change_status`,e.ChangeProducts=`change_products`,e.ChangeOrderParameters=`change_order_parameters`,e.Recalculate=`recalculate`,e.AttachOrder=`attach_order`,e.DetachOrder=`detach_order`,e.ChangeAttachedOperator=`change_attached_operator`,e.SendOnlinePaymentLink=`send_online_payment_link`,e.ConfirmOnlineFullPayment=`confirm_online_full_payment`,e.MergeOrders=`merge_orders`,e.GetHistory=`get_history`,e.CloneOrder=`clone_order`,e.DeleteAttachedFile=`delete_attached_file`,e}({}),At=class{paymentType;deliveryType;contragentId;deliveryDate;addressId;warehouseId;image;comment;barcode;operatorsComment;operatorsForWarehouseComment;additionalEmails;isAllowProcessingWithoutPayment;isAdditionalSale;constructor(e){this.paymentType=e?.payment.type,this.deliveryType=e?.delivery.type,this.contragentId=e?.contragent?.id,this.deliveryDate=e?.delivery.date?new Date(e.delivery.date):void 0,this.addressId=e?.delivery.address?.id,this.warehouseId=e?.delivery.warehouse?.id,this.comment=e?.comment,this.barcode=e?.barcode,this.operatorsComment=e?.operatorsComment,this.operatorsForWarehouseComment=e?.operatorsForWarehouseComment,this.isAllowProcessingWithoutPayment=e?.isAllowProcessingWithoutPayment}},jt=class extends u{attachedUsers;clientSearchTerm;client;contragent;createdAt=new d;creator;deliveryDate=new d;deliveryAddressSearch;clientCities;id;isApproved;isNotInStock;isOnOrder;attachedAt=new d;salesDirections;status;statusDetail;deliveryType;paymentType;warehouses;isLargeOrder;isToProcess;onlyMyRegions;constructor(e){super(),this.attachedUsers=e?.attachedUsers?.map(e=>`isActive`in e?new t.Manager(e):new t.Operator(e)),this.clientSearchTerm=e?.clientSearchTerm,this.client=e?.client?new O(e.client):void 0,this.contragent=e?.contragent,this.createdAt=new d(e?.createdAt),this.creator=e?.creator?new h(e.creator):void 0,this.deliveryDate=new d(e?.deliveryDate),this.deliveryAddressSearch=e?.deliveryAddressSearch,this.clientCities=e?.clientCities?.map(e=>new t.CityWithRegionAndCountry(e)),this.id=e?.id,this.isApproved=e?.isApproved,this.isNotInStock=e?.isNotInStock,this.isOnOrder=e?.isOnOrder,this.isLargeOrder=e?.isLargeOrder,this.attachedAt=new d(e?.attachedAt),this.salesDirections=e?.salesDirections?.map(e=>new t.SalesDirection(e)),this.status=e?.status,this.statusDetail=e?.statusDetail,this.deliveryType=e?.deliveryType?new t.DeliveryType(e.deliveryType):void 0,this.paymentType=e?.paymentType?new t.PaymentType(e.paymentType):void 0,this.warehouses=e?.warehouses?.map(e=>new t.Warehouse(e)),this.isToProcess=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 t.DeliveryType;break;case`clientCities`:this.clientCities=[];break;case`attachedAt`:this.attachedAt.from=null,this.attachedAt.to=null;break;case`salesDirection`:case`salesDirections`:this.salesDirections=[];break;case`status`:this.status=[];break;case`warehouse`:case`warehouses`:this.warehouses=[];break;default:this[e]=void 0}return this}asClearRaw(){let e=super.asClearRaw();return!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,!e?.deliveryDate?.from&&!e?.deliveryDate?.to&&delete e.deliveryDate,!e?.attachedAt?.from&&!e?.attachedAt?.to&&delete e.attachedAt,e}},Mt=class{user;status;statusDetail;createdAt;constructor(e){this.user=new h(e?.user),this.status=new t.OrderStatus(e?.status),this.statusDetail=e?.statusDetail?new t.Reference(e.statusDetail):void 0;let i=e?.createdAt;this.createdAt=(0,r.isString)(i)?(0,n.parseISO)(i):e?.createdAt??new Date}},Nt=class extends p{getOrders(e,t,n,r){return this.getTypedPaginated(Tt,`/internal/orders`,e,t,n,{},void 0,r)}getOrdersCount(e,t){return this.get(`/internal/orders/count`,e?{filters:JSON.stringify((e instanceof f?e:new f(e)).toPrimitive())}:{},void 0,void 0,t).then(e=>e.count)}getClientOrderStatistics(e,t){return this.get(`/internal/clients/${e}/orders/statistics`,t?{period:t}:{})}getOrder(e){return this.get(`/internal/orders/${e}`,{},e=>new Y(e.data))}createClientOrder(e,r,i,a={}){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.post(`/internal/clients/${e}/orders`,{...r,deliveryDate:(0,n.format)(r.deliveryDate,o),items:i?.length?i:void 0},e=>t.TypedInstanceFactory.instanceListInitializer(Y,e.data),a)}attachOrder(e){return this.patch(`/internal/orders/${e}/attach`,{},e=>new Y(e.data))}detachOrder(e){return this.patch(`/internal/orders/${e}/detach`,{},e=>new Y(e.data))}mergeOrders(e,t){return this.patch(`/internal/orders/${e}/merge`,{ids:t},e=>new Y(e.data))}recalculateOrder(e){return this.patch(`/internal/orders/${e}/recalculate`,{},e=>new Y(e.data))}cloneOrder(e){return this.get(`/internal/orders/${e}/clone`,{})}updateOrder(e,r,i={}){let a=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.patch(`/internal/orders/${e}`,{...r,deliveryDate:r.deliveryDate?(0,n.format)(r.deliveryDate,a):void 0},e=>new Y(e.data),i)}addOrderProduct(e,t,n={}){return this.post(`/internal/orders/${e}/products`,{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,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},e=>new Y(e.data),n)}changeOrderStatus(e,t,n,r={}){return this.patch(`/internal/orders/${e}/status`,{status:t,statusDetail:n},e=>new Y(e.data),r)}changeOrderStatusDetail(e,t){return this.patch(`/internal/orders/${e}/status`,{statusDetail:t},e=>new Y(e.data))}getOrderStatusHistory(e){return this.getTypedList(Mt,`/internal/orders/${e}/history`)}getOrderPrintHtml(e,t){return this.get(`/internal/orders/${e}/print/view`,{...t},e=>new Blob([e.data],{type:`text/html`}))}getOrderPrintPdf(e,t){return this.getBlob(`/internal/orders/${e}/print/download`,{...t},e=>new Blob([e.request.response],{type:`application/pdf`}))}sendOrderPrint(e,t){return this.post(`/internal/orders/${e}/print/send`,t)}changeAttachedOperator(e,t){return this.patch(`/internal/orders/${e}/change-attached-operator`,{operatorId:t},e=>new Y(e.data))}deleteOrderAttachedFile(e){return this.delete(`/internal/orders/${e}/file/attached`,e=>new Y(e.data))}deleteOrderProduct(e,t){return this.delete(`/internal/orders/${e}/products/${t}`,e=>new Y(e.data))}patchOrderProduct(e,t,n,r={}){return this.patch(`/internal/orders/${e}/products/${t}`,{product_id:n.product.id,product_category_id:n.configurator?n.category.id:void 0,quantity:n.quantity,height:n.height,length:n.length,width:n.width,configurator:n.configurator,marker:n.marker,is_additional_sale:n.isAdditionalSale,...n.configuratorParams},e=>new Y(e.data),r)}getDeliveryNearestDates(e,t){return this.get(`/internal/orders/delivery/${e}/nearest-dates`,{},e=>e.data,void 0,t)}getSelfDeliveryNearestDates(e,t){return this.get(`/internal/orders/self-delivery/${e}/nearest-dates`,{},e=>e.data,void 0,t)}getDeliveryCost(e,r,i,a){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.get(`/internal/orders/delivery/${e}/cost`,{date:(0,n.format)(r,o),warehouse_id:i},e=>e.data,void 0,a)}},Pt=Symbol(`currentOrder`),X=class{client;product;cost;costCoefficient;source;constructor(e){this.client=new O(e?.client),this.product=new x(e?.product),this.cost=e?.cost??0,this.costCoefficient=e?.costCoefficient??0,this.source=e?.source??le.Product}},Ft=e=>e?(0,r.omitBy)({cities:e.cities?.map(e=>e.id),clients:e.clients?.map(e=>e.id),managers:e.managers?.map(e=>e.id),partnerGroups:e.partnerGroups?.map(e=>e.id),salesDirections:e.salesDirections?.map(e=>e.id),hideNotActive:e.hideNotActive},e=>(0,r.isNil)(e)||((0,r.isArray)(e)||(0,r.isObject)(e))&&(0,r.isEmpty)(e)):{},It=e=>{let t={};return e.from&&(e.from.coefficient||e.from.value)&&(t.from={},e.from.coefficient&&(t.from.priceCoefficientId=e.from.coefficient.id),e.from.value&&(t.from.increasePercent=e.from.value)),e.to&&(e.to.coefficient||e.to.value)&&(t.to={},e.to.coefficient&&(t.to.priceCoefficientId=e.to.coefficient.id),e.to.value&&(t.to.increasePercent=e.to.value)),t},Lt=class extends t.HttpRequester{analyzeProductPrices(e,n,r){return this.get(`/internal/price/products/${e}/analyze`,{...It(n),filters:Ft(r)},e=>t.TypedInstanceFactory.instanceListInitializer(X,e.data))}analyzeCategoryPrices(e,n,r){return this.get(`/internal/price/categories/${e}/analyze`,{...It(n),filters:Ft(r)},e=>t.TypedInstanceFactory.instanceListInitializer(X,e.data))}analyzeCategoryPricesBySquare(e,n,r){return this.get(`/internal/price/categories/${e}/analyze/square`,{...n,filters:Ft(r)},e=>t.TypedInstanceFactory.instanceListInitializer(X,e.data))}},Rt=class{cost;isLowCost;isRetail;costDate;discountName;priceTemplateName;product;client;executor;currency;constructor(e){this.cost=e.cost??0,this.isLowCost=e.isLowCost??!1,this.isRetail=e.isRetail??!1,this.costDate=(0,r.isString)(e.costDate)?(0,n.parseISO)(e.costDate):e.costDate??new Date,this.discountName=e.discountName,this.priceTemplateName=e.priceTemplateName,this.product=e.product?new y(e.product):void 0,this.client=e.client?new h(e.client):void 0,this.executor=e.executor?new h(e.executor):void 0,this.currency=e.currency?new t.Currency(e.currency):void 0}},zt=class extends y{history;constructor(e){super(e),this.history=(0,r.map)(e.history,e=>new Rt(e))}},Bt=class extends t.HttpRequester{getProductPriceHistory(e){let i=(0,t.useBaseConfigStore)().config.dateFormats.api,a=(0,r.omitBy)((0,r.merge)(e,{costDate:{from:(0,r.isDate)(e.costDate?.from)?(0,n.format)(e.costDate.from,i):e.costDate?.from,to:(0,r.isDate)(e.costDate?.to)?(0,n.format)(e.costDate.to,i):e.costDate?.to}}),e=>(0,r.isNil)(e)||((0,r.isArray)(e)||(0,r.isObject)(e))&&(0,r.isEmpty)(e)),o=e.product?.[0]??0;return delete a.product,this.get(`/internal/price/products/${o}/history`,a).then(e=>[new zt((0,r.merge)(e[0],{history:e}))])}},Vt=class{products=[];productCategories=[];constructor(e){e?.products&&(this.products=e.products.map(e=>new y(e))),e?.productCategories&&(this.productCategories=e.productCategories.map(e=>new y(e)))}},Ht=class extends t.HttpRequester{getProductCategoryRecommendations(e){return this.get(`/internal/catalog/recommendations/categories/${e.id}`,{},e=>new Vt(e.data))}getProductRecommendations(e){return this.get(`/internal/catalog/recommendations/products/${e.id}`,{},e=>new Vt(e.data))}saveProductCategoryRecommendations(e,t){return this.post(`/internal/catalog/recommendations/categories/${e.id}`,{product_categories:t.productCategories.map(e=>e.id),products:t.products.map(e=>e.id)})}saveProductRecommendations(e,t){return this.post(`/internal/catalog/recommendations/products/${e.id}`,{product_categories:t.productCategories.map(e=>e.id),products:t.products.map(e=>e.id)})}},Ut=class{static generateUndefinedInstance(e,t=`- Не определён -`){return new e({id:0,name:t,slug:`-undefined-`})}static isUndefinedInstance(e){return e.id===0&&e.slug===`-undefined-`}},Wt=class{name;content;constructor(e){this.name=e.name,this.content=e.content}},Gt=class{resourceType;resourceId;h1;title;description;keywords;meta;tags;constructor(e){this.resourceType=new t.ResourceType(e?.resourceType),this.resourceId=e?.resourceId??``,this.h1=e?.h1,this.title=e?.title,this.description=e?.description,this.keywords=e?.keywords,this.meta=e?.meta?.map(e=>new Wt(e))??[],this.tags=e?.tags}},Kt=class extends t.HttpRequester{getResourceSeoData(e,t){return this.get(`/internal/seo/${e.slug}/${t}`,{},e=>new Gt(e.data))}saveResourceSeoData(e,t={}){return this.post(`/internal/seo/${e.resourceType.slug}/${e.resourceId}`,e,e=>new Gt(e.data),t)}deleteResourceSeoData(e,t){return this.delete(`/internal/seo/${e.slug}/${t}`)}},qt=class extends t.Identity{text;searchCount;lastSearchedAt;constructor(e){super(e),this.text=e?.text??``,this.searchCount=e?.searchCount??0,this.lastSearchedAt=t.DateHelper.parse(e?.lastSearchedAt)}},Jt=class extends t.HttpRequester{getSearchProductsStatistics(e,n){return this.getTypedList(qt,`/internal/statistics/search/products`,{date:t.DateHelper.periodToApiFormat(e)},!1,n)}removeSearchProductStatistic(e){return this.delete(`/internal/statistics/search/products/${e}`)}},Z=function(e){return e[e.Undetermined=0]=`Undetermined`,e[e.Complete=1]=`Complete`,e[e.Incomplete=2]=`Incomplete`,e}({}),Yt=class{static isBlocked(e,t){return t&&e===Z.Incomplete}static getValidationResult(e,n){switch(e){case Z.Incomplete:return n?new t.FieldValidationResultData(`Адрес неполный, выберите более точный вариант из подсказок`,`error`):new t.FieldValidationResultData(`Адрес неполный, проверьте его`,`warning`);case Z.Undetermined:return new t.FieldValidationResultData(`Не удалось определить полноту адреса, проверьте его`,`warning`);default:return}}},Xt=class extends t.HttpRequester{searchAddresses(e){return this.execSuggestionQuery(`/public/suggestions/address`,e)}searchBank(e){return this.execSuggestionQuery(`/public/suggestions/bank`,e)}searchOrganization(e){return this.execSuggestionQuery(`/public/suggestions/organization`,e)}execSuggestionQuery(e,t){return this.get(e,{query:t}).then(e=>{let t=[...e],n=1;return t.forEach(e=>{e.id=n++}),t})}},Zt=class extends t.HttpRequester{constructor(){super(),this.baseUrl=`${(0,t.useBaseConfigStore)().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(e=>e.accessToken)}},Q=class{user;salesDirection;constructor(e){this.user=new h(e?.user),this.salesDirection=new t.SalesDirection(e?.salesDirection)}},$=class extends t.UserRegionShortInfo{cities;users;constructor(e){super(e),this.cities=e?.cities?.map(e=>new t.CityWithRegionAndCountry(e))??[],this.users=e?.users?.map(e=>new Q(e))??[]}},Qt=class extends u{id;name;abbr;constructor(e){super(),this.id=e?.id,this.name=e?.name,this.abbr=e?.abbr}resetFilterValue(e){switch(e){case`id`:case`name`:case`abbr`:this[e]=void 0}return this}},$t=class extends p{getRegionsList(e,n,r){return this.getTypedPaginated(t.UserRegionShortInfo,`/internal/users/regions`,e,n,r)}getRegion(e){return this.get(`/internal/users/regions/${e}`,{},e=>new $(e.data))}createRegion(e,t={}){return this.post(`/internal/users/regions`,e,e=>new $(e.data),t)}updateRegion(e,t,n={}){return this.patch(`/internal/users/regions/${e}`,t,e=>new $(e.data),n)}removeRegion(e){return this.delete(`/internal/users/regions/${e}`)}getRegionEmployees(e){return this.getTypedList(Q,`/internal/users/regions/${e}/users`)}attachRegionEmployee(e,t,n){return this.post(`/internal/users/regions/${e}/users/${t}`,{salesDirectionId:n},e=>new Q(e.data))}detachRegionEmployee(e,t,n){return this.request({method:`DELETE`,url:`/internal/users/regions/${e}/users/${t}`,params:{sales_direction_id:n}})}};e.AddressQualityEnum=Z,e.AddressQualityHelper=Yt,e.BankAccount=F,e.BasePaginationProvider=p,e.BlogPost=l,e.BlogPostMediaFile=a,e.BlogPostMediaTypeEnum=i,e.BlogPostPublicationStatusEnum=o,e.BlogPostShortInfo=c,e.BlogPostsListFilters=ee,e.BlogProvider=re,e.CalculationTypeEnum=pe,e.CalendarHelper=V,e.Cart=w,e.CartProvider=fe,e.CatalogProvider=Oe,e.CatalogableItem=oe,e.Category=T,e.CategoryFilter=De,e.CategoryFilterSetting=Te,e.CategoryFilterValue=Ee,e.CategoryPricingRule=Ce,e.Client=qe,e.ClientAdditionalData=Xe,e.ClientCategory=ge,e.ClientDataProvider=Qe,e.ClientPriceCatalogableItem=xe,e.ClientPriceCategory=Se,e.ClientPriceProduct=N,e.ClientPriceProvider=ke,e.ClientPriceTemplateProvider=Ae,e.ClientProduct=S,e.ClientProductCategoryDataProvider=Ne,e.ClientProductDataProvider=Pe,e.ClientShortInfo=O,e.ClientsAdditionalDataRequestTypeEnum=Ve,e.ClientsListFilters=Je,e.CodedIdentity=y,e.ConfiguratorProvider=nt,e.ConfiguratorsEnum=tt,e.Contact=I,e.ContactPerson=L,e.ContactPersonRelated=Ze,e.ContactRelation=B,e.ContragentBase=He,e.ContragentFactory=R,e.ContragentIc=We,e.ContragentPerson=Ue,e.ContragentUlNr=Ke,e.ContragentUlR=Ge,e.CostSourceEnum=le,e.CreatableIdentity=s,e.Curator=D,e.DataSuggestionProvider=Xt,e.DateTimeProvider=lt,e.DeletableIdentity=ye,e.DeletableNamedIdentity=m,e.DeliveryAddress=z,e.Discount=W,e.DiscountClient=H,e.DiscountClientEligibility=mt,e.DiscountConditions=ft,e.DiscountProvider=gt,e.DiscountShortInfo=g,e.DiscountStateEnum=U,e.DiscountStateHelper=pt,e.DiscountsListFilters=ht,e.Faq=K,e.FaqGroup=G,e.FaqProvider=_t,e.FilterGroup=f,e.FilterItem=ne,e.FilterOpEnum=te,e.FilterSettings=we,e.HiddenCatalogableItem=se,e.Image=ce,e.ManagerDataFactory=bt,e.MetaTagItem=Wt,e.Offer=J,e.OfferActualization=xt,e.OfferActualizationStatus=q,e.OfferHelper=Ot,e.OfferShortInfo=St,e.OffersDataProvider=Dt,e.OffersListFilters=wt,e.Order=Y,e.OrderAction=kt,e.OrderEditorData=At,e.OrderInfo=Tt,e.OrderItem=Et,e.OrderItemBase=ue,e.OrderShortInfo=Ye,e.OrderStatusHistoryInfo=Mt,e.OrdersDataProvider=Nt,e.OrdersListFilters=jt,e.PaginationFiltersBase=u,e.PriceAnalyze=X,e.PriceAnalyzeProvider=Lt,e.PriceCatalogableItem=_e,e.PriceHistoryDataProvider=Bt,e.PriceHistoryItem=Rt,e.PriceTemplate=_,e.PriceTemplateCategory=E,e.PriceTemplateClient=k,e.PriceTemplateICatalogableItem=ve,e.PriceTemplateProduct=A,e.PriceTemplateProvider=Fe,e.PricingRole=P,e.PricingRoleProvider=Ie,e.PrimaryCatalogableItem=b,e.Product=x,e.ProductCategoryDataProvider=je,e.ProductDataProvider=Me,e.ProductFilterTypeEnum=me,e.ProductPriceCoefficient=v,e.ProductPriceHistory=zt,e.ProductUnit=ae,e.ProfstroyOfferItem=Ct,e.PropertiesProvider=Le,e.Property=j,e.PropertyValue=M,e.RecommendationsDataProvider=Ht,e.RecommendationsList=Vt,e.ReferenceDataFactory=Ut,e.STANDARD_PERIOD_GROUPS=ut,e.STANDARD_PERIOD_SECTIONS=dt,e.SearchProductStatistic=qt,e.Seo=Gt,e.SeoDataProvider=Kt,e.StatisticsProvider=Jt,e.StockCount=ie,e.TableDataPagination=it,e.TableDataPaginationRequestParams=rt,e.TableDataSortRequestParams=at,e.TemplateProductCategoryDataProvider=Re,e.TemplatesListFilters=be,e.UnitsHelper=yt,e.UnknownClientDataProvider=$e,e.UserAuthDataProvider=Zt,e.UserRegion=$,e.UserRegionEmployee=Q,e.UserRegionProvider=$t,e.UserRegionsListFilters=Qt,e.UserShortInfo=h,e.VersionConfig=et,e.currentOrderInjectionKey=Pt,e.daysAgoIso=ot,e.findCatalogItemByIdRecursive=ze,e.flattenCatalogItems=Be,e.formatPercentChange=vt,e.formatRelativeDate=ct,e.pluralize=st,Object.keys(t).forEach(function(n){n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@snabcentr/common-core"),require("date-fns"),require("lodash-es")):typeof define==`function`&&define.amd?define([`exports`,`@snabcentr/common-core`,`date-fns`,`lodash-es`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`SC Common Lib`]={},e[`@snabcentr/common-core`],e[`date-fns`],e[`lodash-es`]))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=function(e){return e.Image=`image`,e.Video=`video`,e}({}),a=class extends t.Identity{mediaType;isCover;isUnused;url;urlWebp;constructor(e){super(e,``),this.mediaType=e?.mediaType??i.Image,this.isCover=e?.isCover??!1,this.isUnused=e?.isUnused??!1,this.url=e?.url??``,this.urlWebp=e?.urlWebp}isImage(){return this.mediaType===i.Image}isVideo(){return this.mediaType===i.Video}},o=function(e){return e.Draft=`draft`,e.Published=`published`,e.Scheduled=`scheduled`,e}({}),s=class extends t.Identity{createdAt;constructor(e,n){super(e,n),this.createdAt=t.DateHelper.parse(e?.createdAt)??new Date}},c=class e extends s{static resolvePublicationStatus(e){return(0,r.isNil)(e)?o.Draft:e.getTime()>Date.now()?o.Scheduled:o.Published}static getSlugError(e){return e?/[^a-z0-9-]/.test(e)?`Допустимы только строчные латинские буквы, цифры и дефис: пример «kak-vybrat-podokonnik».`:(0,r.startsWith)(e,`-`)||(0,r.endsWith)(e,`-`)?`Обозначение не может начинаться или заканчиваться дефисом.`:(0,r.includes)(e,`--`)?`Дефисы не могут идти подряд: разделяйте слова одним дефисом.`:``:``}static parseDate(e){return(0,r.isNil)(e)?null:(0,r.isString)(e)?(0,n.parseISO)(e):e}slug;title;publishedAt;constructor(t){super(t,-1),this.slug=t?.slug??``,this.title=t?.title??``,this.publishedAt=e.parseDate(t?.publishedAt)}getPublicationStatus(){return e.resolvePublicationStatus(this.publishedAt)}},l=class extends c{content;media;constructor(e){super(e),this.content=e?.content??``,this.media=(e?.media??[]).map(e=>new a(e))}toSaveData(e=!1){return{title:this.title,slug:this.slug.length>0?this.slug:void 0,content:e?this.content:void 0,publishedAt:this.publishedAt}}getCover(){return this.media.find(e=>e.isCover)}getUnusedMedia(){return this.media.filter(e=>e.isUnused)}},u=class{asClearRaw(){let e={};return Object.keys(this).forEach(t=>{let n=this[t];(0,r.isNil)(n)||(0,r.isString)(n)&&n.trim().length===0||(0,r.isFunction)(n.isNewRec)&&n.isNewRec()||(e[t]=n)}),e}},d=class{from;to;constructor(e){this.from=(0,r.isString)(e?.from)?(0,n.parseISO)(e.from):e?.from??null,this.to=(0,r.isString)(e?.to)?(0,n.parseISO)(e.to):e?.to??null}},ee=class extends u{id;title;slug;content;publicationStatus;publishedAt;createdAt;constructor(e){super(),this.id=e?.id,this.title=e?.title,this.slug=e?.slug,this.content=e?.content,this.publicationStatus=e?.publicationStatus,this.publishedAt=new d(e?.publishedAt),this.createdAt=new d(e?.createdAt)}resetFilterValue(e){switch(e){case`id`:case`title`:case`slug`:case`content`:case`publicationStatus`:this[e]=void 0;break;case`publishedAt`:this.publishedAt.from=null,this.publishedAt.to=null;break;case`createdAt`:this.createdAt.from=null,this.createdAt.to=null}return this}asClearRaw(){let e=super.asClearRaw();return!e?.publishedAt?.from&&!e?.publishedAt?.to&&delete e.publishedAt,!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,e}},te=function(e){return e.BeginWith=`bw`,e.Contains=`cn`,e.Custom=`custom`,e.EndsWith=`ew`,e.Equals=`eq`,e.GreaterOrEqual=`ge`,e.GreaterThan=`gt`,e.InList=`in`,e.LessOrEqual=`le`,e.LessThan=`lt`,e.NotBeginWith=`bn`,e.NotContains=`nc`,e.NotEndsWith=`en`,e.NotEqual=`ne`,e.NotInList=`ni`,e.NotNull=`nn`,e.Null=`nu`,e}({}),ne=class{field;op;value;constructor(e){this.field=e?.field??``,this.op=e?.op??te.Equals,this.value=e?.value??``}toPrimitive(){let e=(0,t.useBaseConfigStore)().config.dateFormats.api,i={field:this.field,op:this.op};if((0,r.isDate)(this.value))i.value=(0,n.format)(this.value,e);else if((0,r.isPlainObject)(this.value)){let t=this.value;i.value={from:t.from?(0,n.format)(t.from,e):null,to:t.to?(0,n.format)(t.to,e):null}}else i.value=this.value;return i}},f=class e{groupOp;filters;groups;constructor(t){this.groupOp=t?.groupOp??`and`,this.filters=t?.filters?.map(e=>new ne(e))??[],this.groups=t?.groups?.map(t=>new e(t))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(e=>e instanceof ne&&(0,r.isFunction)(e.toPrimitive)?e.toPrimitive():e),groups:this.groups.map(t=>t instanceof e?t.toPrimitive():t)}}},p=class extends t.HttpRequester{getPaginated(e,t,n,i,a,o,s,c){let l={page:i?.page??1,perPage:i?.pageSize??10};return t&&(l.filters=JSON.stringify((t instanceof f?t:new f(t)).toPrimitive())),(0,r.isEmpty)(n)||(l.sort=(0,r.isArray)(n)?n:[n]),a&&(l={...l,...a}),this.get(e,l,o,s,c)}getTypedPaginated(e,n,r,i,a,o,s,c){return this.getPaginated(n,r,i,a,o,n=>({...n.data,data:t.TypedInstanceFactory.instanceListInitializer(e,n.data.data)}),s,c)}},re=class e extends p{static preparePostSaveData(e){let i={};if((0,r.isUndefined)(e.title)||(i.title=e.title),(0,r.isUndefined)(e.slug)||(i.slug=e.slug),(0,r.isUndefined)(e.content)||(i.content=e.content),!(0,r.isUndefined)(e.publishedAt)){let a=(0,t.useBaseConfigStore)().config.dateFormats.api;i.publishedAt=(0,r.isNil)(e.publishedAt)?null:(0,n.format)(e.publishedAt,a)}return i}getPostList(e,t,n){return this.getPaginated(`/internal/blog`,e,t,n,{},e=>({...e.data,data:e.data.data.map(e=>new c(e))}))}getPost(e){return this.get(`/internal/blog/${e}`,{},e=>new l(e.data))}createPost(t,n={}){return this.post(`/internal/blog`,e.preparePostSaveData(t),e=>new l(e.data),n)}updatePost(t,n,r={}){return this.patch(`/internal/blog/${t}`,e.preparePostSaveData(n),e=>new l(e.data),r)}removePost(e){return this.delete(`/internal/blog/${e}`)}uploadMedia(e,t,n,r,i={}){return this.request({method:`POST`,url:`/internal/blog/${e}/media`,data:{file:t,isCover:n??!1},onUploadProgress:e=>{r&&r(e.total?Math.round(e.loaded/e.total*100):0)}},e=>new a(e.data),i)}updateMedia(e,t,n,r={}){return this.patch(`/internal/blog/${e}/media/${t}`,{isCover:n},e=>new a(e.data),r)}removeMedia(e,t){return this.delete(`/internal/blog/${e}/media/${t}`)}},m=class extends t.UpdatableNamedIdentity{deletedAt;constructor(e){super(e),this.deletedAt=t.DateHelper.parse(e?.deletedAt)}},h=class extends t.NamedIdentity{type;isActive;constructor(e){super(e),this.type=e?.type,this.isActive=e?.isActive??!0}},g=class extends m{costCoefficient;isLowPriceAllowed;publishedAt;description;percent;owner;constructor(e){super(e),this.costCoefficient=e?.costCoefficient??0,this.isLowPriceAllowed=e?.isLowPriceAllowed??!1,this.publishedAt=t.DateHelper.parse(e?.publishedAt),this.description=e?.description??void 0,this.percent=e?.percent??0,this.owner=new h(e?.owner)}},_=class extends t.UpdatableNamedIdentity{description;owner;constructor(e){super(e),this.description=e?.description??``,this.owner=e?.owner?new h(e.owner):void 0}},v=class{coefficient;value;cost;percent;readOnly;constructor(e){this.coefficient=new t.PriceCoefficient(e?.coefficient),this.value=e?.value??0,this.cost=e?.cost??0,this.percent=e?.percent??0,this.readOnly=e?.readOnly??!0}},ie=class{warehouse;count;constructor(e){this.warehouse=new t.Warehouse(e?.warehouse),this.count=e?.count??0}},ae=class extends t.NamedIdentity{slug=``;description;isSquare=!1;isLinear=!1;constructor(e){super(e),e&&(this.slug=e.slug??``,this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}},y=class extends t.NamedIdentity{code=``;constructor(e){super(e),this.code=e?.code??``}},oe=class extends y{slug;type;constructor(e){super(e),this.slug=e?.slug??``}},se=class extends oe{isHidden;constructor(e){super(e),this.isHidden=e?.isHidden??!1}},ce=class{image;preview;isDefault;constructor(e,t){this.image=`${t??``}${e.image}`,this.preview=`${t??``}${e.preview}`,this.isDefault=e.isDefault}},b=class extends oe{isPrimary;constructor(e){super(e),this.isPrimary=e?.isPrimary??!1}},x=class extends se{supplierSku;unit;pack;minCount;currency;cost;costRub;costDate;onOrder;stockCount;category;categories;images;properties;retailCost;retailCostRub;priceCoefficients;constructor(e){super(e),this.supplierSku=e?.supplierSku,this.unit=e?.unit?new ae(e.unit):new ae,this.pack=e?.pack,this.minCount=e?.minCount,this.currency=e?.currency?new t.Currency(e.currency):new t.Currency,this.cost=e?.cost??0,this.costRub=e?.costRub??0,this.costDate=(0,r.isString)(e?.costDate)?(0,n.parseISO)(e.costDate):e?.costDate,this.onOrder=e?.onOrder??!1,this.stockCount=e?.stockCount?.map(e=>new ie(e))??[],this.type=`product`;let i=e?.category??e?.categories?.find(e=>e.isPrimary);i&&(this.category=new b({...i,isPrimary:!0}),this.categories=[this.category]),e?.categories&&(this.categories=e.categories.map(e=>new b(e))),this.images=e?.images?.map(e=>new ce(e,(0,t.useBaseConfigStore)().config.http.mediaUrl))??[],this.properties=e?.properties??{},this.retailCost=e?.retailCost,this.retailCostRub=e?.retailCostRub,this.priceCoefficients=e?.priceCoefficients?.map(e=>new v(e))??[],e&&`codeNumber`in e&&!e.code&&(this.code=e?.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}},le=function(e){return e.Discount=`discount`,e.PriceTemplate=`price_template`,e.ClientPrice=`client_price`,e.Product=`product`,e}({}),S=class extends x{costCoefficient;costSource;discount;priceTemplate;priceCoefficient;increasePercent;isPreviouslyOrdered;isRequired;isFavorite;constructor(e){super(e),this.costCoefficient=e?.costCoefficient??0,this.costSource=e?.costSource??le.Product,this.discount=e?.discount?new g(e.discount):void 0,this.priceTemplate=e?.priceTemplate?new _(e.priceTemplate):void 0,this.priceCoefficient=e?.priceCoefficient?new t.PriceCoefficient(e.priceCoefficient):void 0,this.increasePercent=e?.increasePercent,this.isPreviouslyOrdered=e?.isPreviouslyOrdered,this.isRequired=e?.isRequired,this.isFavorite=e?.isFavorite}},C=class extends b{isHidden;parentCategoryId;properties;currencyRates;constructor(e){super(e),this.isHidden=e?.isHidden??!1,this.parentCategoryId=e?.parentCategoryId,this.properties=e?.properties,this.type=`category`,this.currencyRates=e?.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([e,t])=>[(0,r.toUpper)(e),t])):void 0}},ue=class extends t.Identity{category;product;quantity;currency;marker;height;length;width;configurator;configuratorParams;isAdditionalSale;creator;isRemoved;ord;onOrder;originalId;replacementId;constructor(e){super(e),this.product=new S(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new C,this.currency=e.currency?new t.Currency(e.currency):void 0,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&(0,r.cloneDeep)(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale,this.creator=e.creator&&new h(e.creator),this.isRemoved=e.isRemoved,this.ord=e.ord,this.onOrder=e.onOrder,this.originalId=e.originalId,this.replacementId=e.replacementId}},de=class extends ue{cost;costOne;costOneRub;costRub;logicGroupId;salesDirection;specificationImgUrl;sawing;currency;constructor(e){super(e),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=(0,r.isArray)(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new t.Currency(e.currency)}},w=class{items;resultSum;directionsSum;constructor(e){this.items=e.items.map(e=>new de(e)),this.resultSum=e.resultSum,this.directionsSum=e.directionsSum}},fe=class extends t.HttpRequester{getCart(e){return this.get(`internal/clients/${e.id}/cart`,{},e=>new w(e.data))}deleteCart(e){return this.delete(`internal/clients/${e.id}/cart`)}addCartItem(e,t,n={}){return this.patch(`internal/clients/${e.id}/cart`,{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,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},e=>new w(e.data),n)}patchCartItem(e,t,n={}){return this.patch(`internal/clients/${e.id}/cart/${t.id}`,{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,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},e=>new w(e.data),n)}deleteCartItem(e,t){return this.delete(`internal/clients/${e.id}/cart/${t.id}`,e=>new w(e.data))}addCartItemFromCSV(e,t){return this.post(`internal/clients/${e.id}/cart/add-products-from-csv`,t,e=>new w(e.data))}getCartItemFromCSVExample(e){return this.get(`internal/clients/${e.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:`text/csv`}))}},pe=function(e){return e.m2Cost=`m2Cost`,e.percent=`percent`,e.value=`value`,e}({}),me=function(e){return e.Checkbox=`checkbox`,e.Range=`range`,e.Toggle=`toggle`,e}({}),T=class e extends C{categories;products;constructor(t){super(t),this.categories=t?.categories?.map(t=>new e(t)),this.products=t?.products?.map(e=>new x(e))}},he=class extends C{isDisabled;isRequired;isFavorite;hidingComment;manager;constructor(e){super(e),this.isDisabled=e?.isDisabled??!1,this.isRequired=e?.isRequired??!1,this.isFavorite=e?.isFavorite??!1,this.hidingComment=e?.hidingComment,this.manager=e?.manager?new t.Manager(e.manager):void 0}},ge=class e extends he{categories;products;constructor(t){super(t),this.categories=t?.categories?.map(t=>new e(t)),this.products=t?.products?.map(e=>new S(e))}},_e=class{priceCoefficient;increasePercent;constructor(e){this.priceCoefficient=e?.priceCoefficient&&new t.PriceCoefficient(e.priceCoefficient),this.increasePercent=e?.increasePercent}},ve=class extends _e{constructor(e){super(e)}},E=class extends ve{productCategory;constructor(e){super(e),this.productCategory=new C(e?.productCategory)}},D=class extends t.NamedIdentity{photo;contacts;curatedDirection;constructor(e){super(e),this.photo=e.photo,this.contacts=new t.ContactLinks(e.contacts),this.curatedDirection=new t.CuratedDirection(e.curatedDirection)}},O=class extends t.UserCommonInfo{salesDirection;debt;alternativeName;city;comment;isPhoneApproved;isEmailApproved;managers;curators;constructor(e){super(e),this.salesDirection=new t.SalesDirection(e?.salesDirection),this.debt=e?.debt??0,this.alternativeName=e?.alternativeName??``,this.city=new t.CityWithRegionAndCountry(e?.city),this.comment=e?.comment,this.isPhoneApproved=e?.isPhoneApproved??!1,this.isEmailApproved=e?.isEmailApproved??!1,this.managers=e?.managers?.map(e=>new t.ManagerCommon(e))??[],this.curators=e?.curators?.map(e=>new D(e))??void 0}},ye=class extends s{deletedAt;constructor(e,n){super(e,n),this.deletedAt=t.DateHelper.parse(e?.deletedAt)}},k=class extends ye{client;priceTemplate;constructor(e){super(e),this.client=new O(e?.client),this.priceTemplate=new _(e?.priceTemplate)}},A=class extends ve{product;constructor(e){super(e),this.product=new x(e?.product)}},j=class extends t.NamedIdentity{type;description;metadata;isFilterable;constructor(e){super(e),this.type=new t.PropertyType(e?.type),this.description=e?.description??``,this.metadata=e?.metadata,this.isFilterable=e?.isFilterable}},M=class{property;value;constructor(e){this.property=new j(e?.property),this.value=e?.value??``}},be=class{id;name;description;ownerName;createdAt=new d;updatedAt=new d;constructor(e){this.id=e?.id,this.name=e?.name,this.description=e?.description,this.ownerName=e?.ownerName,this.createdAt=new d(e?.createdAt),this.updatedAt=new d(e?.updatedAt)}resetFilterValue(e){switch(e){case`id`:case`name`:case`description`:case`ownerName`:this[e]=void 0;break;case`createdAt`:this.createdAt.from=null,this.createdAt.to=null;break;case`updatedAt`:this.updatedAt.from=null,this.updatedAt.to=null}return this}asClearRaw(){let e={};return Object.keys(this).forEach(t=>{let n=this[t];(0,r.isNil)(n)||(0,r.isString)(n)&&n.trim().length===0||(0,r.isFunction)(n.isNewRec)&&n.isNewRec()||(e[t]=n)}),!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,!e?.updatedAt?.from&&!e?.updatedAt?.to&&delete e.updatedAt,e}},xe=class extends _e{executor;createdAt;constructor(e){super(e),this.executor=e?.executor?new h(e.executor):void 0,this.createdAt=t.DateHelper.parse(e?.createdAt)}},N=class extends xe{product;constructor(e){super(e),this.product=new x(e?.product)}},Se=class extends xe{productCategory;constructor(e){super(e),this.productCategory=new C(e?.productCategory)}},P=class extends t.NamedIdentity{description;canChangeLowCost;parentRoleId;subRoles=[];parentRole;level=0;constructor(e){super(e),this.description=e?.description,this.canChangeLowCost=e?.canChangeLowCost??!1,this.parentRoleId=e?.parentRoleId}},Ce=class{role;category;minCoefficient;constructor(e){this.role=new P(e?.role),this.category=new C(e?.category),this.minCoefficient=new t.PriceCoefficient(e?.minCoefficient)}},we=class{isFake;isHidden;isMultiple;type;ord;constructor(e){this.isFake=e?.isFake??!1,this.isHidden=e?.isHidden??!1,this.isMultiple=e?.isMultiple??null,this.type=e?.type??null,this.ord=e?.ord??0}},Te=class{category;property;settings;constructor(e){this.category=new C(e?.category),this.property=new j(e?.property),this.settings=new we(e?.settings)}},Ee=class{id;label;constructor(e){this.id=e?.id??``,this.label=e?.label??``}},De=class{id;label;type;ord;isMultiple;values;min;max;constructor(e){this.id=e?.id??``,this.label=e?.label??``,this.type=e?.type??me.Checkbox,this.ord=e?.ord??0,this.isMultiple=e?.isMultiple??null,this.values=e?.values?.map(e=>new Ee(e))??[],this.min=e?.min??null,this.max=e?.max??null}},Oe=class extends t.HttpRequester{search(e,t=!1){return this.get(`/internal/catalog/search`,{term:e,show_hidden:t})}getPriceExportLink(e=`csv`,n=!1,r=void 0,i=void 0){let a=`${(0,t.useBaseConfigStore)().config.http.portalApiUrl}/api/internal/price/export?format=${e}&show_hidden=${n}`;return r&&(a+=`&category_id=${r}`),i&&(a+=`&client_id=${i}`),a}},ke=class extends t.HttpRequester{importPrices(e,t,n=!1){return this.post(`/internal/clients/${e}/price/import`,t,void 0,{},n)}getCategoryPrices(e){return this.getTypedList(Se,`/internal/clients/${e}/price/categories`)}getCategoryPrice(e,t){return this.get(`/internal/clients/${e}/price/categories/${t}`,{},e=>new Se(e.data))}updateCategoryPrices(e,t,n,r=!1){return this.request({method:`PATCH`,url:`/internal/clients/${e}/price/categories/${t}`,data:{price_coefficient_id:n.coefficient?.id,increase_percent:n.value},params:r?{recursively:!0}:{}})}removeCategoryPrices(e,t,n=!1){return this.request({method:`DELETE`,url:`/internal/clients/${e}/price/categories/${t}`,params:n?{recursively:!0}:{}})}removeCategoryProductsPrices(e,t,n=!1){return this.request({method:`DELETE`,url:`/internal/clients/${e}/price/categories/${t}/products`,params:n?{recursively:!0}:{}})}markCategoryRequired(e,t){return this.post(`/internal/clients/${e}/price/categories/${t}/required`)}unmarkCategoryRequired(e,t){return this.delete(`/internal/clients/${e}/price/categories/${t}/required`)}markCategoryDisabled(e,t,n){return this.post(`/internal/clients/${e}/price/categories/${t}/disabled`,{comment:n})}unmarkCategoryDisabled(e,t){return this.delete(`/internal/clients/${e}/price/categories/${t}/disabled`)}addCategoryManager(e,t,n){return this.post(`/internal/clients/${e}/price/categories/${t}/manager`,{manager_id:n})}removeCategoryManager(e,t){return this.delete(`/internal/clients/${e}/price/categories/${t}/manager`)}getProductPrices(e){return this.getTypedList(N,`/internal/clients/${e}/price/products`)}getProductPrice(e,t){return this.get(`/internal/clients/${e}/price/products/${t}`,{},e=>new N(e.data))}updateProductPrice(e,t,n){return this.patch(`/internal/clients/${e}/price/products/${t}`,{price_coefficient_id:n.coefficient?.id,increase_percent:n.value},e=>new N(e.data))}removeProductPrice(e,t){return this.delete(`/internal/clients/${e}/price/products/${t}`)}markProductRequired(e,t){return this.post(`/internal/clients/${e}/price/products/${t}/required`)}unmarkProductRequired(e,t){return this.delete(`/internal/clients/${e}/price/products/${t}/required`)}getCommercialOfferHtml(e,t){return this.get(`/internal/clients/${e}/price/commercial-offer/view`,t,e=>new Blob([e.data],{type:`text/html`}))}getCommercialOfferPdf(e,t){return this.getBlob(`/internal/clients/${e}/price/commercial-offer/download`,t,e=>new Blob([e.request.response],{type:`application/pdf`}))}sendCommercialOffer(e,t){return this.post(`/internal/clients/${e}/price/commercial-offer/send`,t)}},Ae=class extends t.HttpRequester{getTemplateList(e){return this.getTypedList(k,`/internal/clients/${e}/price/templates`)}getActiveTemplate(e){return this.get(`/internal/clients/${e}/price/templates/active`,{},e=>new k(e.data),!0)}attachTemplate(e,r,i){let a=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.post(`/internal/clients/${e}/price/templates/${r}`,i&&{startAt:i.startAt&&(0,n.format)(i.startAt,a),endAt:i.endAt&&(0,n.format)(i.endAt,a)},e=>new k(e.data),{},!0)}applyTemplate(e,t){return this.post(`/internal/clients/${e}/price/templates/${t}/apply`,{},void 0,{},!0)}changeTemplate(e,r,i,a){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.patch(`/internal/clients/${e}/price/templates/${r}/${i}`,a&&{startAt:a.startAt&&(0,n.format)(a.startAt,o),endAt:a.endAt&&(0,n.format)(a.endAt,o)},e=>new k(e.data))}detachTemplate(e,t,n){return this.delete(`/internal/clients/${e}/price/templates/${t}/${n}`)}},je=class extends t.HttpRequester{getRootCategoriesList(e=!1){return this.getTypedList(T,`/internal/catalog/categories`,{showHidden:e})}getCategoryData(e,t=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{showHidden:t,withNestedCategories:n},e=>new T(e.data))}getPublicCategoryData(e){return this.get(`/public/catalog/categories/${e}`,{},e=>new T(e.data))}getCategoryProductsList(e,t=!0,n=!1){return this.get(`/internal/catalog/categories/${e}/products`,{showHidden:n,withPriceCoefficients:t},e=>(0,r.map)(e.data,e=>new x(e)))}getCategoryProductsCoefficients(e){return this.get(`/internal/catalog/categories/${e}/products/coefficients`,{},e=>{let{data:t}=e;return(0,r.forEach)(t,e=>e.map(e=>new v(e))),t})}publicSimpleSearch(e,t=10){return new Promise((n,r)=>{this.get(`/public/catalog/search/simple?limit=${t}&term=${e}`).then(e=>{n(e.categories.map(e=>new T(e)))}).catch(e=>{r(e)})})}},Me=class extends p{getProductData(e,t=!1){return this.get(`/internal/catalog/products/${e}`,{withPriceCoefficients:t},e=>new x(e.data))}getPublicProductData(e){return this.get(`/public/catalog/products/${e}`,{},e=>new x(e.data))}getProductPriceCoefficients(e){return this.get(`/internal/catalog/products/${e}/coefficients`,{},e=>(0,r.map)(e.data,e=>new v(e)))}getNewProducts(e,r,i=!0){let a=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.getTypedPaginated(x,`/internal/catalog/products/new`,void 0,void 0,r,{period:{from:(0,n.format)(e,a)},withPriceCoefficients:i})}publicSimpleSearch(e,t=10){return new Promise((n,r)=>{this.get(`/public/catalog/search/simple?limit=${t}&term=${e}`).then(e=>{n(e.products.map(e=>new x(e)))}).catch(e=>{r(e)})})}},Ne=class extends t.HttpRequester{getRootCategoriesList(e,t=!1){return this.getTypedList(ge,`/internal/catalog/categories`,{clientId:e,showHidden:t})}getCategoryData(e,t,n=!1,r=!1){return this.get(`/internal/catalog/categories/${t}`,{clientId:e,showHidden:n,withNestedCategories:r},e=>new ge(e.data))}getCategoryProductsList(e,t,n=!0,i=!1){return this.get(`/internal/catalog/categories/${t}/products`,{client_id:e,showHidden:i,withPriceCoefficients:n},e=>(0,r.map)(e.data,e=>new S(e)))}},Pe=class extends p{getProductData(e,t,n=!1){return this.get(`/internal/catalog/products/${e}`,{clientId:t,withPriceCoefficients:n},e=>new S(e.data))}getNewProducts(e,r,i,a=!0){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.getTypedPaginated(S,`/internal/catalog/products/new`,void 0,void 0,i,{clientId:e,period:{from:(0,n.format)(r,o)},withPriceCoefficients:a})}},Fe=class extends p{getTemplateList(e,t,n){return this.getTypedPaginated(_,`/internal/price/templates`,e,t,n)}createTemplate(e,t={}){return this.post(`/internal/price/templates`,e,e=>new _(e.data),t)}getTemplate(e){return this.get(`/internal/price/templates/${e}`,{},e=>new _(e.data))}updateTemplate(e,t,n={}){return this.patch(`/internal/price/templates/${e}`,t,e=>new _(e.data),n)}removeTemplate(e){return this.delete(`/internal/price/templates/${e}`)}getProductTemplatePrices(e){return this.getTypedList(A,`/internal/price/templates/${e}/products`)}getProductTemplatePrice(e,t){return this.get(`/internal/price/templates/${e}/products/${t}`,{},e=>new A(e.data))}saveProductTemplatePrice(e,t,n){return this.post(`/internal/price/templates/${e}/products/${t}`,{price_coefficient_id:n.coefficient?.id,increase_percent:n.value},e=>new A(e.data))}deleteProductTemplatePrice(e,t){return this.delete(`/internal/price/templates/${e}/products/${t}`)}getCategoryTemplatePrices(e){return this.getTypedList(E,`/internal/price/templates/${e}/categories`)}getCategoryTemplatePrice(e,t){return this.get(`/internal/price/templates/${e}/categories/${t}`,{},e=>new E(e.data))}saveCategoryTemplatePrice(e,t,n,r=!1){return this.request({method:`POST`,url:`/internal/price/templates/${e}/categories/${t}`,data:{price_coefficient_id:n.coefficient?.id,increase_percent:n.value},params:r?{recursively:!0}:{}},e=>new E(e.data))}deleteCategoryTemplatePrice(e,t,n=!1){return this.request({method:`DELETE`,url:`/internal/price/templates/${e}/categories/${t}`,params:n?{recursively:!0}:{}})}getTemplateClients(e){return this.getTypedList(k,`/internal/price/templates/${e}/clients`)}},Ie=class extends t.HttpRequester{getRoles(){return this.getTypedList(P,`/internal/price/roles`)}createRole(e){return this.post(`/internal/price/roles`,e,e=>new P(e.data))}getRole(e){return this.get(`/internal/price/roles/${e}`,{},e=>new P(e.data))}updateRole(e,t){return this.patch(`/internal/price/roles/${e}`,t,e=>new P(e.data))}deleteRole(e){return this.delete(`/internal/price/roles/${e}`)}getCategoryRules(e){return this.getTypedList(Ce,`/internal/price/roles/rules/categories/${e}`)}updateCategoryRules(e,n){return this.patch(`/internal/price/roles/rules/categories/${e}`,n,e=>t.TypedInstanceFactory.instanceListInitializer(Ce,e.data))}},Le=class extends p{getProperties(e,t,n){return this.getTypedPaginated(j,`/internal/catalog/properties`,e,t,n)}createProperty(e){let{typeId:t,...n}=e;return this.post(`/internal/catalog/properties`,{...n,type:t},e=>new j(e.data))}getProperty(e){return this.get(`/internal/catalog/properties/${e}`,{},e=>new j(e.data))}updateProperty(e,t){let{typeId:n,...r}=t;return this.patch(`/internal/catalog/properties/${e}`,{...r,type:n},e=>new j(e.data))}deleteProperty(e){return this.delete(`/internal/catalog/properties/${e}`)}getProductProperties(e){return this.getTypedList(M,`/internal/catalog/products/${e}/properties`)}getProductProperty(e,t){return this.get(`/internal/catalog/products/${e}/properties/${t}`,{},e=>new M(e.data))}updateProductProperty(e,t,n){return this.patch(`/internal/catalog/products/${e}/properties/${t}`,{value:n},e=>new M(e.data))}deleteProductProperty(e,t){return this.delete(`/internal/catalog/products/${e}/properties/${t}`)}getProductDescription(e){return this.get(`/internal/catalog/products/${e}/properties/description`)}updateProductDescription(e,t){return this.patch(`/internal/catalog/products/${e}/properties/description`,{text:t})}deleteProductDescription(e){return this.delete(`/internal/catalog/products/${e}/properties/description`)}getProductSpecification(e){return this.get(`/internal/catalog/products/${e}/properties/specification`)}updateProductSpecification(e,t){return this.patch(`/internal/catalog/products/${e}/properties/specification`,{text:t})}deleteProductSpecification(e){return this.delete(`/internal/catalog/products/${e}/properties/specification`)}getProductFiles(e){return this.get(`/internal/catalog/products/${e}/properties/files`)}addProductFile(e,t){return this.post(`/internal/catalog/products/${e}/properties/files`,t)}updateProductFile(e,t,n){return this.patch(`/internal/catalog/products/${e}/properties/files/${t}`,n)}deleteProductFile(e,t){return this.delete(`/internal/catalog/products/${e}/properties/files/${t}`)}updateProductSlug(e,t){return this.patch(`/internal/catalog/products/${e}/properties/slug`,{slug:t})}getCategoryProperties(e){return this.getTypedList(M,`/internal/catalog/categories/${e}/properties`)}getCategoryProperty(e,t){return this.get(`/internal/catalog/categories/${e}/properties/${t}`,{},e=>new M(e.data))}updateCategoryProperty(e,t,n){return this.patch(`/internal/catalog/categories/${e}/properties/${t}`,{value:n},e=>new M(e.data))}deleteCategoryProperty(e,t){return this.delete(`/internal/catalog/categories/${e}/properties/${t}`)}getCategoryDescription(e){return this.get(`/internal/catalog/categories/${e}/properties/description`)}updateCategoryDescription(e,t){return this.patch(`/internal/catalog/categories/${e}/properties/description`,{text:t})}deleteCategoryDescription(e){return this.delete(`/internal/catalog/categories/${e}/properties/description`)}getCategorySpecification(e){return this.get(`/internal/catalog/categories/${e}/properties/specification`)}updateCategorySpecification(e,t){return this.patch(`/internal/catalog/categories/${e}/properties/specification`,{text:t})}deleteCategorySpecification(e){return this.delete(`/internal/catalog/categories/${e}/properties/specification`)}getCategoryFiles(e){return this.get(`/internal/catalog/categories/${e}/properties/files`)}addCategoryFile(e,t){return this.post(`/internal/catalog/categories/${e}/properties/files`,t)}updateCategoryFile(e,t,n){return this.patch(`/internal/catalog/categories/${e}/properties/files/${t}`,n)}deleteCategoryFile(e,t){return this.delete(`/internal/catalog/categories/${e}/properties/files/${t}`)}updateCategorySlug(e,t){return this.patch(`/internal/catalog/categories/${e}/properties/slug`,{slug:t})}updateCategoryImage(e,t){return this.post(`/internal/catalog/categories/${e}/image`,{image:t})}getCategoryFilters(e,t=!1){return this.get(`/internal/catalog/categories/${e}/filters`,{recursively:t},e=>e.data.map(e=>new De(e)))}getCategoryFilterSettings(e){return this.getTypedList(Te,`/internal/catalog/categories/${e}/filter-settings`)}saveCategoryFilterSetting(e,t,n){return this.patch(`/internal/catalog/categories/${e}/filter-settings/${t}`,n,e=>new Te(e.data))}deleteCategoryFilterSetting(e,t){return this.delete(`/internal/catalog/categories/${e}/filter-settings/${t}`)}},Re=class extends t.HttpRequester{getRootCategoriesList(e,t=!1){return this.getTypedList(T,`/internal/catalog/categories`,{priceTemplateId:e,showHidden:t})}getCategoryData(e,t,n=!1,r=!1){return this.get(`/internal/catalog/categories/${t}`,{priceTemplateId:e,showHidden:n,withNestedCategories:r},e=>new T(e.data))}getCategoryProductsList(e,t,n=!0,i=!1){return this.get(`/internal/catalog/categories/${t}/products`,{priceTemplateId:e,showHidden:i,withPriceCoefficients:n},e=>(0,r.map)(e.data,e=>new x(e)))}};function ze(e,t,n){let r;return e.some(e=>{if(e.type===n&&e.id===t)return r=e,!0;if(e.type===`product`)return!1;let i=e;if(i.products&&i.products.length>0){let e=ze(i.products,t,n);if(e)return r=e,!0}if(i.categories&&i.categories.length>0){let e=ze(i.categories,t,n);if(e)return r=e,!0}return!1}),r}function Be(e){let t=[];return e.forEach(e=>{if(t.push(e),e.type===`category`){let n=e;n.products&&n.products.length>0&&t.push(...Be(n.products)),n.categories&&n.categories.length>0&&t.push(...Be(n.categories))}}),t}var Ve=function(e){return e.LastOrder=`last_order`,e.Contacts=`contacts`,e.PartnerGroups=`partner_groups`,e.PreferredDeliveryType=`preferred_delivery_type`,e.SalesDirection=`sales_direction`,e.Managers=`managers`,e.Curators=`curators`,e}({}),F=class extends t.Identity{bankName=``;bic=``;accountNumber=``;correspondentAccount=``;currency=new t.Currency;constructor(e){super(e),e&&(this.bankName=e.bankName??``,this.bic=e.bic??``,this.accountNumber=e.accountNumber??``,this.correspondentAccount=e.correspondentAccount??``,this.currency=new t.Currency(e.currency))}},I=class extends m{phone;email;constructor(e){super(e),this.email=e?.email,this.phone=/^\d+$/.test(e?.phone??``)?`+${e?.phone}`:e?.phone}},L=class extends I{isPrimary;position;notDisturb;comment;constructor(e){super(e),this.isPrimary=e?.isPrimary??!1,this.position=e?.position,this.notDisturb=e?.notDisturb??!1,this.comment=e?.comment}},He=class extends m{opf=t.Opf.generatePersonItem();partnerGroup=new t.PartnerGroup;contacts=[];bankAccounts=[];comment;alternativeName;creator;updater;constructor(e){if(super(e),e){if(this.opf=new t.Opf(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.creator=e.creator?new h(e.creator):void 0,this.updater=e.updater?new h(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new t.PartnerGroup(e.partnerGroup)),e.contacts){let t=[];e.contacts.forEach(e=>{t.push(new L(e))}),this.contacts=t}if(e.bankAccounts){let t=[];e.bankAccounts.forEach(e=>{t.push(new F(e))}),this.bankAccounts=t}}}},Ue=class extends He{constructor(e){super(e)}},We=class extends He{inn=``;okpo=``;ogrn=``;directorName=``;directorPosition=``;directorActsOn=``;legalAddress=``;postalAddress=``;actualAddress=``;constructor(e){super(e),e&&(this.inn=e.inn??``,this.okpo=e.okpo??``,this.ogrn=e.ogrn??``,this.directorName=e.directorName??``,this.directorPosition=e.directorPosition??``,this.directorActsOn=e.directorActsOn??``,this.legalAddress=e.legalAddress??``,this.postalAddress=e.postalAddress??``,this.actualAddress=e.actualAddress??``)}},Ge=class extends We{kpp=``;constructor(e){super(e),e&&(this.kpp=e.kpp??``)}},Ke=class extends Ge{registrationCountry=new t.Country;registrationNumber=``;taxNumber=``;constructor(e){super(e),e&&(this.registrationCountry=new t.Country(e.registrationCountry),this.registrationNumber=e.registrationNumber??``,this.taxNumber=e.taxNumber??``)}},R=class{static createInstance(e){switch(e.opf.slug){case t.OpfEnum.Ic:return new We(e);case t.OpfEnum.UlR:return new Ge(e);case t.OpfEnum.UlNr:return new Ke(e);default:return new Ue(e)}}},z=class extends m{address=``;coordinates;contacts;comment;operatingHours;isOneTime;isTransportCompanyAddress;constructor(e){super(e),this.address=e?.address??``,this.coordinates=new t.GeoCoordinates(e?.coordinates),this.contacts=e?.contacts?.map(e=>new L(e))??[],this.comment=e?.comment,this.operatingHours=e?.operatingHours,this.isOneTime=e?.isOneTime,this.isTransportCompanyAddress=e?.isTransportCompanyAddress}},qe=class extends O{contragents;partnerGroups;contacts;deliveryAddresses;channelPrimaryInterest;sourcePrimaryInterest;preferredDeliveryType;primaryDemand;preferredWarehouse;extraData;constructor(e){super(e),this.contragents=e?.contragents?.map(e=>R.createInstance(e))??[],this.partnerGroups=e?.partnerGroups?.map(e=>new t.PartnerGroup(e))??[],this.contacts=e?.contacts?.map(e=>new L(e))??[],this.deliveryAddresses=e?.deliveryAddresses?.map(e=>new z(e))??[],this.channelPrimaryInterest=new t.ChannelPrimaryInterest(e?.channelPrimaryInterest),this.sourcePrimaryInterest=new t.SourcePrimaryInterest(e?.sourcePrimaryInterest),this.preferredDeliveryType=new t.DeliveryType(e?.preferredDeliveryType),this.primaryDemand=e?.primaryDemand,this.preferredWarehouse=e?.preferredWarehouse?new t.Warehouse(e.preferredWarehouse):void 0,this.extraData=e?.extraData??{}}},Je=class extends u{id;guid;name;alternativeName;searchTerm;cities;region;country;phone;email;isActive;createdAt=new d;lastLoginDate=new d;lastLoginDateHasOrder;managers;includeSubordinateManagers;curators;isManagerRequired;salesDirections;contragentInn;contragentType;preferredDeliveryType;partnerGroups;contact;lastOrder;noOrdersPeriod=new d;constructor(e){super(),this.id=e?.id,this.guid=e?.guid,this.name=e?.name,this.alternativeName=e?.alternativeName,this.searchTerm=e?.searchTerm,this.cities=e?.cities?.map(e=>new t.CityWithRegionAndCountry(e)),this.region=new t.Region(e?.region),this.country=new t.Country(e?.country),this.phone=e?.phone,this.email=e?.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,`isActive`)?e?.isActive:!0,this.createdAt=new d(e?.createdAt),this.lastLoginDate=new d(e?.lastLoginDate),this.lastLoginDateHasOrder=e?.lastLoginDateHasOrder??void 0,this.managers=e?.managers?.map(e=>new t.Manager(e))??[],this.includeSubordinateManagers=e?.includeSubordinateManagers??!0,this.curators=e?.curators?.map(e=>new D(e))??[],this.salesDirections=e?.salesDirections?.map(e=>new t.SalesDirection(e)),this.contragentInn=e?.contragentInn,this.contragentType=new t.Opf(e?.contragentType),this.preferredDeliveryType=e?.preferredDeliveryType?new t.DeliveryType(e?.preferredDeliveryType):void 0,this.partnerGroups=e?.partnerGroups?.map(e=>new t.PartnerGroup(e)),this.contact=new I(e?.contact),this.lastOrder={createdAt:new d(e?.lastOrder?.createdAt),creator:e?.lastOrder?.creator,isApproved:e?.lastOrder?.isApproved},this.noOrdersPeriod=new d(e?.noOrdersPeriod)}resetFilterValue(e){switch(e){case`cities`:this.cities=[];break;case`region`:this.region=new t.Region;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 t.Opf;break;case`preferredDeliveryType`:this.preferredDeliveryType=new t.DeliveryType;break;case`partnerGroups`:this.partnerGroups=[];break;case`contact`:this.contact=new I;break;default:this[e]=void 0}return this}asClearRaw(){let e=super.asClearRaw();return!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,!e?.lastLoginDate?.from&&!e?.lastLoginDate?.to&&delete e.lastLoginDate,!e?.noOrdersPeriod?.from&&!e?.noOrdersPeriod?.to&&delete e.noOrdersPeriod,e}},Ye=class extends s{creator;constructor(e){super(e),this.creator=new h(e?.creator)}},Xe=class extends t.NamedIdentity{contacts=[];preferredDeliveryType;partnerGroups=[];lastOrder;salesDirection;managers;curators;constructor(e){super(e),this.contacts=e.contacts?.map(e=>new L(e))??void 0,this.lastOrder=e.lastOrder?new Ye(e.lastOrder):void 0,this.partnerGroups=e.partnerGroups?.map(e=>new t.PartnerGroup(e))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new t.DeliveryType(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new t.SalesDirection(e.salesDirection):void 0,this.managers=e.managers?.map(e=>new t.ManagerCommon(e))??void 0,this.curators=e.curators?.map(e=>new D(e))??void 0}},B=class extends t.Identity{isPrimary;constructor(e){super(e),this.isPrimary=e.isPrimary}},Ze=class extends L{relations={clients:[],contragents:[],addresses:[]};constructor(e){super(e),e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(e=>new B(e))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(e=>new B(e))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(e=>new B(e))))}},Qe=class e extends p{static transformClientDataToRequest(e){return{name:e.name,alternative_name:e.alternativeName,partner_groups:e.partnerGroups.map(e=>e.id),phone:e.phone,email:e.email,city_id:e.city.id,get_news:e.getNews,channel_primary_interest_id:e.channelPrimaryInterest.id,source_primary_interest_id:e.sourcePrimaryInterest.id,primary_demand:e.primaryDemand,preferred_warehouse_id:e.preferredWarehouse?.id}}static transformContragentClientDataToRequest(e){let n,r=e,i=e,a=e;switch(e.opf.slug){case t.OpfEnum.Ic:n={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:r.partnerGroup?.id,comment:r.comment,inn:r.inn,okpo:r.okpo,ogrn:r.ogrn||void 0,director_name:r.directorName,director_position:r.directorPosition,director_acts_on:r.directorActsOn,legal_address:r.legalAddress,postal_address:r.postalAddress,actual_address:r.actualAddress};break;case t.OpfEnum.UlR:n={opf:i.opf.slug,name:i.name,alternative_name:i.alternativeName,partner_group_id:i.partnerGroup?.id,comment:i.comment,inn:i.inn,kpp:i.kpp,okpo:i.okpo,ogrn:i.ogrn||void 0,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 t.OpfEnum.UlNr:n={opf:a.opf.slug,name:a.name,alternative_name:a.alternativeName,partner_group_id:a.partnerGroup?.id,comment:a.comment,director_name:a.directorName,director_position:a.directorPosition,director_acts_on:a.directorActsOn,legal_address:a.legalAddress,postal_address:a.postalAddress,actual_address:a.actualAddress,registration_country_id:a.registrationCountry.id,registration_number:a.registrationNumber,tax_number:a.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:e.partnerGroup?.id,comment:e.comment}}return n}static transformClientDeliveryAddressToRequest(e){let t={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??``};return e.coordinates&&(t.coordinates={lat:e.coordinates?.lat,long:e.coordinates?.long}),e.operatingHours&&(t.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),t}static transformClientContragentBankAccountToRequest(e){return{bank_name:e.bankName,bic:e.bic,account_number:e.accountNumber,correspondent_account:e.correspondentAccount,currency_id:e.currency.id}}getClient(e){return this.get(`/internal/clients/${e}`,{},e=>new qe(e.data))}getClientsList(e,t,n,r,i){return this.getTypedPaginated(O,`/internal/clients`,e,t,n,r,void 0,i)}searchClient(e){return this.getClientsList(void 0,void 0,void 0,{searchTerm:e}).then(e=>e.data)}getClientByPhone(e){return this.getClientsList({groupOp:`and`,groups:[],filters:[{field:`phone`,op:te.Contains,value:e}]})}getAdditionalClientsData(e,n){let r=e.map(e=>e.id);return this.post(`/internal/clients/additional-data`,{clients:r,requested_data_types:n},e=>t.TypedInstanceFactory.instanceListInitializer(Xe,e.data))}getAllClientContacts(e){return this.getTypedList(Ze,`/internal/clients/${e}/contacts/all`)}createClientCommonData(t,n={}){return this.post(`/internal/clients`,e.transformClientDataToRequest(t),e=>new qe(e.data),n)}updateClientCommonData(t,n={}){return this.patch(`/internal/clients/${t.id}`,e.transformClientDataToRequest(t),void 0,n)}updateClientNotDistribCommonData(e,t={}){let n={get_news:e.getNews};return this.patch(`/internal/clients/${e.id}`,n,void 0,t)}changeClientPassword(e,t,n,r={}){return this.patch(`/internal/clients/${e}`,{password:t,password_confirmation:n},void 0,r)}updateClientComment(e){return this.patch(`/internal/clients/${e.id}`,{comment:e.comment})}changeClientActivation(e){return this.patch(`/internal/clients/${e.id}`,{is_active:e.isActive})}async attachClientToManagers(e,t){let n=t.map(t=>this.patch(`/internal/clients/${e}/managers/${t.id}/attach`,{is_primary:t.isDefault}));await Promise.all(n)}async detachClientFromManagers(e,t){let n=t.map(t=>this.patch(`/internal/clients/${e}/managers/${t.id}/detach`));await Promise.all(n)}attachToCurator(e,t,n){return this.patch(`/internal/clients/${e}/curators/${t}/attach`,{curated_direction_id:n.id})}detachFromCurator(e,t,n){return this.patch(`/internal/clients/${e}/curators/${t}/detach`,{curated_direction_id:n.id})}setCurators(e,t){return this.patch(`/internal/clients/${e}/curators`,{curators:t.map(e=>({curator_id:e.curatorId,curated_direction_id:e.curatedDirection.id}))})}createContragentClientData(t,n,r={}){return this.post(`/internal/clients/${t}/contragents`,e.transformContragentClientDataToRequest(n),e=>R.createInstance(e.data),r)}updateContragentClientData(t,n,r={}){return this.patch(`/internal/clients/${t}/contragents/${n.id}`,e.transformContragentClientDataToRequest(n),e=>R.createInstance(e.data),r)}deleteClientContragent(e,t){return this.delete(`/internal/clients/${e}/contragents/${t.id}`)}getClientDeliveryAddresses(e){return this.getTypedList(z,`/internal/clients/${e}/delivery-addresses`)}createClientDeliveryAddress(t,n,r={}){return this.post(`/internal/clients/${t}/delivery-addresses`,e.transformClientDeliveryAddressToRequest(n),e=>new z(e.data),r)}updateClientDeliveryAddress(t,n,r={}){return this.patch(`/internal/clients/${t}/delivery-addresses/${n.id}`,e.transformClientDeliveryAddressToRequest(n),e=>new z(e.data),r)}deleteClientDeliveryAddress(e,t){return this.delete(`/internal/clients/${e}/delivery-addresses/${t.id}`)}createContragentBankAccount(t,n,r,i={}){return this.post(`/internal/clients/${t}/contragents/${n}/bank-accounts`,e.transformClientContragentBankAccountToRequest(r),e=>new F(e.data),i)}updateContragentBankAccount(t,n,r,i={}){return this.patch(`/internal/clients/${t}/contragents/${n}/bank-accounts/${r.id}`,e.transformClientContragentBankAccountToRequest(r),e=>new F(e.data),i)}deleteContragentBankAccount(e,t,n){return this.delete(`/internal/clients/${e}/contragents/${t}/bank-accounts/${n.id}`)}createClientContact(e,t,n={}){return this.createContact(e,t,{client:{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}},n)}updateClientContact(e,t,n={}){return this.patch(`/internal/clients/${e}/contacts/${t.id}`,{name:t.name,position:t.position,phone:t.phone,email:t.email,comment:t.comment,not_disturb:t.notDisturb},e=>new L(e.data),n)}setPrimaryClientContact(e,t){return this.setPrimaryContact(`/internal/clients/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachClientContact(e,t){return this.detachContact(`/internal/clients/${e}/contacts/${t.id}/detach`)}createContragentContact(e,t,n,r={}){return this.createContact(e,n,{contragents:[{id:t,is_primary:n.isPrimary??!1,not_disturb:n.notDisturb??!1}]},r)}setPrimaryContragentContact(e,t,n){return this.setPrimaryContact(`/internal/clients/${e}/contragents/${t}/contacts/${n.id}/primary`,n.isPrimary??!1)}detachContragentContact(e,t,n){return this.detachContact(`/internal/clients/${e}/contragents/${t}/contacts/${n.id}/detach`)}createDeliveryAddressContact(e,t,n,r={}){return this.createContact(e,n,{addresses:[{id:t,is_primary:n.isPrimary??!1,not_disturb:n.notDisturb??!1}]},r)}setPrimaryDeliveryAddressContact(e,t,n){return this.setPrimaryContact(`/internal/clients/${e}/delivery-addresses/${t}/contacts/${n.id}/primary`,n.isPrimary??!1)}detachDeliveryAddressContact(e,t,n){return this.detachContact(`/internal/clients/${e}/delivery-addresses/${t}/contacts/${n.id}/detach`)}createContact(e,t,n,r={}){let i={name:t.name,position:t.position,comment:t.comment,...n};return t.phone?.length&&(i.phone=t.phone),t.email?.length&&(i.email=t.email),this.post(`/internal/clients/${e}/contacts`,i,e=>new L(e.data),r)}setPrimaryContact(e,t){return this.patch(e,{is_primary:t})}detachContact(e){return this.patch(e)}sendClientEmailConfirmation(e){return this.get(`/internal/clients/${e.id}/verification/email?email=${e.email}`)}},$e=class extends t.HttpRequester{checkPhoneIsBusy(e){return new Promise((t,n)=>{this.request({method:`GET`,url:`/public/user/verification/phone/check`,params:{phone:e}}).then(e=>{t(!!e.isBusy)}).catch(n)})}},et=class{date;name;version;constructor(e){this.date=(0,r.isString)(e?.date)?(0,n.parseISO)(e.date):e?.date??new Date,this.name=e?.name??``,this.version=e?.version??`0.0.0`}},tt=function(e){return e.Kozyrek=`kozyrek`,e.Mosquitto=`mosquitto`,e.Strip=`strip`,e.MetalForDoors=`metal_for_doors`,e.Sandwich=`sandwich`,e.SandwichM2=`sandwich_m2`,e}({}),nt=class extends t.HttpRequester{getConfiguratorSettings(e,t){return this.get(`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/settings?client_id=${t}`)}searchProduct(e,t,n,r={}){return this.request({method:`GET`,url:`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/product`,params:{params:n,client_id:t}},e=>new x(e.data),r)}createTemplate(e,t,n,r={}){return this.post(`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/template?client_id=${t}`,{...n},()=>{},r)}removeTemplate(e,t,n){return this.delete(`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/template/${n}?client_id=${t}`)}calculate(e,t,n){return this.get(`internal/catalog/categories/${e.id}/configurators/${e.properties?.configurator}/calculate`,{client_id:t,...n})}},rt=class{page=1;pageSize=50;constructor(e){this.page=e?.page??1,this.pageSize=e?.pageSize??50}},it=class extends rt{itemCount=0;pageCount=1;pageSlot=5;pageSizes=[25,50,100];showSizePicker=!0;constructor(e){super(e),this.itemCount=e?.itemCount??0,this.pageCount=e?.pageCount??1,this.pageSlot=e?.pageSlot??5,this.pageSizes=e?.pageSizes??[25,50,100],this.showSizePicker=e?.showSizePicker??!0}},at=class{field;direction;constructor(e){this.field=e?.field??``,this.direction=e?.direction??`asc`}},V=class e{static decadeInterval(t){let[n,r]=e.shiftedDecadeBounds(t,0);return{from:n,to:r}}static shiftDecadeInterval(t,n){let[r,i]=e.shiftedDecadeBounds(t,n);return{from:r,to:i}}static startOfHalfYear(e){return new Date(e.getFullYear(),e.getMonth()<6?0:6,1)}static endOfHalfYear(e){return(0,n.endOfMonth)(new Date(e.getFullYear(),e.getMonth()<6?5:11,1))}static addHalfYears(e,t){return(0,n.addMonths)(e,t*6)}static intervalTillSameDate(e,t,r){let i=(0,n.differenceInCalendarMonths)((0,n.startOfMonth)(r),(0,n.startOfMonth)(e)),a=(0,n.startOfMonth)((0,n.addMonths)(t,i)),o=Math.min((0,n.getDate)(r),(0,n.getDaysInMonth)(a));return{from:(0,n.startOfDay)(t),to:(0,n.endOfDay)((0,n.setDate)(a,o))}}static weekTillSameWeekday(e,t){let r=(0,n.startOfWeek)((0,n.addWeeks)(e,t),{weekStartsOn:1}),i=(0,n.differenceInCalendarDays)(e,(0,n.startOfWeek)(e,{weekStartsOn:1}));return{from:r,to:(0,n.endOfDay)((0,n.addDays)(r,i))}}static decadeTillSameDayNumber(t,r){let[i]=e.shiftedDecadeBounds(t,0),a=(0,n.differenceInCalendarDays)(t,i)+1,[o,s]=e.shiftedDecadeBounds(t,r),c=(0,n.differenceInCalendarDays)(s,o)+1;return{from:o,to:(0,n.endOfDay)((0,n.addDays)(o,Math.min(a,c)-1))}}static shiftedDecadeBounds(e,t){let r=(0,n.getDate)(e),i=2;r<=10?i=0:r<=20&&(i=1);let a=i+t,o=Math.floor(a/3),s=(a%3+3)%3,c=(0,n.startOfMonth)((0,n.addMonths)(e,o)),l=(0,n.addDays)(c,s*10);return[l,s===2?(0,n.endOfMonth)(c):(0,n.endOfDay)((0,n.addDays)(l,9))]}};function ot(e){return(0,n.format)((0,n.subDays)((0,n.startOfToday)(),e),`yyyy-MM-dd`)}function st(e,t){let n=[2,0,1,1,1,2],r=Math.floor(Math.abs(e));return t[r%100>4&&r%100<20?2:n[Math.min(r%10,5)]]}function ct(e){let t=(0,n.parseISO)(e),r=(0,n.differenceInCalendarDays)((0,n.startOfToday)(),t);switch(!0){case r===0:return`Сегодня`;case r===1:return`Вчера`;case r<0:return e;default:return`${r} ${st(r,[`день`,`дня`,`дней`])} назад`}}var lt=class{static defaultDateRanges(e){let t=(0,n.addBusinessDays)(new Date,1),r=new Date,i=(0,n.startOfYear)(e===void 0?r:new Date(e,0,1)),a=(0,n.endOfYear)(i);return{nextWorkingDay:{label:`Следующий рабочий день`,from:(0,n.startOfDay)(t),to:(0,n.endOfDay)(t)},today:{label:`Сегодня`,from:(0,n.startOfToday)(),to:(0,n.endOfToday)()},yesterday:{label:`Вчера`,from:(0,n.startOfYesterday)(),to:(0,n.endOfYesterday)()},tomorrow:{label:`Завтра`,from:(0,n.startOfTomorrow)(),to:(0,n.endOfTomorrow)()},currentWeek:{label:`Неделя`,from:(0,n.startOfWeek)(r,{weekStartsOn:1}),to:(0,n.endOfWeek)(r,{weekStartsOn:1})},currentMonth:{label:`Месяц`,from:(0,n.startOfMonth)(r),to:(0,n.endOfMonth)(r)},oneMonth:{label:`1 месяц`,from:i,to:(0,n.endOfMonth)(i)},threeMonths:{label:`3 месяца`,from:i,to:(0,n.endOfMonth)((0,n.addMonths)(i,2))},nineMonths:{label:`9 месяцев`,from:i,to:(0,n.endOfMonth)((0,n.addMonths)(i,8))},firstQuarter:{label:`I квартал`,from:i,to:(0,n.endOfMonth)((0,n.addMonths)(i,2))},secondQuarter:{label:`II квартал`,from:(0,n.addMonths)(i,3),to:(0,n.endOfMonth)((0,n.addMonths)(i,5))},thirdQuarter:{label:`III квартал`,from:(0,n.addMonths)(i,6),to:(0,n.endOfMonth)((0,n.addMonths)(i,8))},fourthQuarter:{label:`IV квартал`,from:(0,n.addMonths)(i,9),to:(0,n.endOfMonth)((0,n.addMonths)(i,11))},firstHalfYear:{label:`I полугодие`,from:i,to:(0,n.endOfMonth)((0,n.addMonths)(i,5))},secondHalfYear:{label:`II полугодие`,from:(0,n.addMonths)(i,6),to:a},currentYear:{label:`12 месяцев`,from:i,to:a}}}static standardPeriods(e=new Date){let t={weekStartsOn:1},r=(0,n.startOfDay)(e),i=(0,n.endOfDay)(e),a=V.decadeInterval(e),o=(0,n.startOfMonth)(e),s=(0,n.startOfQuarter)(e),c=V.startOfHalfYear(e),l=(0,n.startOfYear)(e),u=V.addHalfYears(e,-1),d=V.addHalfYears(e,1);return{yesterday:{label:`Вчера`,group:`day`,from:(0,n.startOfDay)((0,n.subDays)(e,1)),to:(0,n.endOfDay)((0,n.subDays)(e,1))},today:{label:`Сегодня`,group:`day`,from:r,to:i},tomorrow:{label:`Завтра`,group:`day`,from:(0,n.startOfDay)((0,n.addDays)(e,1)),to:(0,n.endOfDay)((0,n.addDays)(e,1))},lastWeek:{label:`Прошлая неделя`,group:`week`,from:(0,n.startOfWeek)((0,n.subWeeks)(e,1),t),to:(0,n.endOfWeek)((0,n.subWeeks)(e,1),t)},thisWeek:{label:`Эта неделя`,group:`week`,from:(0,n.startOfWeek)(e,t),to:(0,n.endOfWeek)(e,t)},nextWeek:{label:`Следующая неделя`,group:`week`,from:(0,n.startOfWeek)((0,n.addWeeks)(e,1),t),to:(0,n.endOfWeek)((0,n.addWeeks)(e,1),t)},lastTenDays:{label:`Прошлая декада`,group:`decade`,...V.shiftDecadeInterval(e,-1)},thisTenDays:{label:`Эта декада`,group:`decade`,...a},nextTenDays:{label:`Следующая декада`,group:`decade`,...V.shiftDecadeInterval(e,1)},lastMonth:{label:`Прошлый месяц`,group:`month`,from:(0,n.startOfMonth)((0,n.subMonths)(e,1)),to:(0,n.endOfMonth)((0,n.subMonths)(e,1))},thisMonth:{label:`Этот месяц`,group:`month`,from:o,to:(0,n.endOfMonth)(e)},nextMonth:{label:`Следующий месяц`,group:`month`,from:(0,n.startOfMonth)((0,n.addMonths)(e,1)),to:(0,n.endOfMonth)((0,n.addMonths)(e,1))},lastQuarter:{label:`Прошлый квартал`,group:`quarter`,from:(0,n.startOfQuarter)((0,n.subQuarters)(e,1)),to:(0,n.endOfQuarter)((0,n.subQuarters)(e,1))},thisQuarter:{label:`Этот квартал`,group:`quarter`,from:s,to:(0,n.endOfQuarter)(e)},nextQuarter:{label:`Следующий квартал`,group:`quarter`,from:(0,n.startOfQuarter)((0,n.addQuarters)(e,1)),to:(0,n.endOfQuarter)((0,n.addQuarters)(e,1))},lastHalfYear:{label:`Прошлое полугодие`,group:`halfYear`,from:V.startOfHalfYear(u),to:V.endOfHalfYear(u)},thisHalfYear:{label:`Это полугодие`,group:`halfYear`,from:c,to:V.endOfHalfYear(e)},nextHalfYear:{label:`Следующее полугодие`,group:`halfYear`,from:V.startOfHalfYear(d),to:V.endOfHalfYear(d)},lastYear:{label:`Прошлый год`,group:`year`,from:(0,n.startOfYear)((0,n.subYears)(e,1)),to:(0,n.endOfYear)((0,n.subYears)(e,1))},thisYear:{label:`Этот год`,group:`year`,from:l,to:(0,n.endOfYear)(e)},nextYear:{label:`Следующий год`,group:`year`,from:(0,n.startOfYear)((0,n.addYears)(e,1)),to:(0,n.endOfYear)((0,n.addYears)(e,1))},fromBeginningOfThisWeek:{label:`С начала этой недели`,group:`other`,section:`fromBeginning`,from:(0,n.startOfWeek)(e,t),to:i},fromBeginningOfThisTenDays:{label:`С начала этой декады`,group:`other`,section:`fromBeginning`,from:a.from,to:i},fromBeginningOfThisMonth:{label:`С начала этого месяца`,group:`other`,section:`fromBeginning`,from:o,to:i},fromBeginningOfThisQuarter:{label:`С начала этого квартала`,group:`other`,section:`fromBeginning`,from:s,to:i},fromBeginningOfThisHalfYear:{label:`С начала этого полугодия`,group:`other`,section:`fromBeginning`,from:c,to:i},fromBeginningOfThisYear:{label:`С начала этого года`,group:`other`,section:`fromBeginning`,from:l,to:i},tillEndOfThisWeek:{label:`До конца этой недели`,group:`other`,section:`tillEnd`,from:r,to:(0,n.endOfWeek)(e,t)},tillEndOfThisTenDays:{label:`До конца этой декады`,group:`other`,section:`tillEnd`,from:r,to:a.to},tillEndOfThisMonth:{label:`До конца этого месяца`,group:`other`,section:`tillEnd`,from:r,to:(0,n.endOfMonth)(e)},tillEndOfThisQuarter:{label:`До конца этого квартала`,group:`other`,section:`tillEnd`,from:r,to:(0,n.endOfQuarter)(e)},tillEndOfThisHalfYear:{label:`До конца этого полугодия`,group:`other`,section:`tillEnd`,from:r,to:V.endOfHalfYear(e)},tillEndOfThisYear:{label:`До конца этого года`,group:`other`,section:`tillEnd`,from:r,to:(0,n.endOfYear)(e)},lastWeekTillSameWeekDay:{label:`Прошлая неделя, до такого же дня недели`,group:`other`,section:`lastTillSame`,...V.weekTillSameWeekday(e,-1)},lastTenDaysTillSameDayNumber:{label:`Прошлая декада, до такого же номера дня`,group:`other`,section:`lastTillSame`,...V.decadeTillSameDayNumber(e,-1)},lastMonthTillSameDate:{label:`Прошлый месяц, до такой же даты`,group:`other`,section:`lastTillSame`,...V.intervalTillSameDate(o,(0,n.startOfMonth)((0,n.subMonths)(e,1)),e)},lastQuarterTillSameDate:{label:`Прошлый квартал, до такой же даты`,group:`other`,section:`lastTillSame`,...V.intervalTillSameDate(s,(0,n.startOfQuarter)((0,n.subQuarters)(e,1)),e)},lastHalfYearTillSameDate:{label:`Прошлое полугодие, до такой же даты`,group:`other`,section:`lastTillSame`,...V.intervalTillSameDate(c,V.startOfHalfYear(u),e)},lastYearTillSameDate:{label:`Прошлый год, до такой же даты`,group:`other`,section:`lastTillSame`,...V.intervalTillSameDate(l,(0,n.startOfYear)((0,n.subYears)(e,1)),e)},nextWeekTillSameWeekDay:{label:`Следующая неделя, до такого же дня недели`,group:`other`,section:`nextTillSame`,...V.weekTillSameWeekday(e,1)},nextTenDaysTillSameDayNumber:{label:`Следующая декада, до такого же номера дня`,group:`other`,section:`nextTillSame`,...V.decadeTillSameDayNumber(e,1)},nextMonthTillSameDate:{label:`Следующий месяц, до такой же даты`,group:`other`,section:`nextTillSame`,...V.intervalTillSameDate(o,(0,n.startOfMonth)((0,n.addMonths)(e,1)),e)},nextQuarterTillSameDate:{label:`Следующий квартал, до такой же даты`,group:`other`,section:`nextTillSame`,...V.intervalTillSameDate(s,(0,n.startOfQuarter)((0,n.addQuarters)(e,1)),e)},nextHalfYearTillSameDate:{label:`Следующее полугодие, до такой же даты`,group:`other`,section:`nextTillSame`,...V.intervalTillSameDate(c,V.startOfHalfYear(d),e)},nextYearTillSameDate:{label:`Следующий год, до такой же даты`,group:`other`,section:`nextTillSame`,...V.intervalTillSameDate(l,(0,n.startOfYear)((0,n.addYears)(e,1)),e)},last7Days:{label:`Последние 7 дней`,group:`other`,section:`rollingDays`,from:(0,n.startOfDay)((0,n.subDays)(e,6)),to:i},next7Days:{label:`Следующие 7 дней`,group:`other`,section:`rollingDays`,from:r,to:(0,n.endOfDay)((0,n.addDays)(e,6))}}}},ut=[{key:`day`,label:`День`},{key:`week`,label:`Неделя`},{key:`decade`,label:`Декада`},{key:`month`,label:`Месяц`},{key:`quarter`,label:`Квартал`},{key:`halfYear`,label:`Полугодие`},{key:`year`,label:`Год`},{key:`other`,label:`Прочее`}],dt=[{key:`fromBeginning`,label:`С начала периода`},{key:`tillEnd`,label:`До конца периода`},{key:`lastTillSame`,label:`Прошлые, до такой же даты`},{key:`nextTillSame`,label:`Следующие, до такой же даты`},{key:`rollingDays`,label:`7 дней`}],H=class extends t.NamedIdentity{city;isActive;constructor(e){super(e),this.city=e?.city?new t.CityWithRegionAndCountry(e.city):void 0,this.isActive=e?.isActive??!1}},ft=class{salesDirections;partnerGroups;managers;additionalClients;fixedClients;regions;cities;lastLoginDate;lastOrderDate;constructor(e){this.salesDirections=(0,r.map)(e?.salesDirections??[],e=>new t.SalesDirection(e)),this.partnerGroups=(0,r.map)(e?.partnerGroups??[],e=>new t.PartnerGroup(e)),this.managers=(0,r.map)(e?.managers??[],e=>new h(e)),this.additionalClients=(0,r.map)(e?.additionalClients??[],e=>new H(e)),this.fixedClients=(0,r.map)(e?.fixedClients??[],e=>new H(e)),this.regions=(0,r.map)(e?.regions??[],e=>new t.Region(e)),this.cities=(0,r.map)(e?.cities??[],e=>new t.CityWithRegionAndCountry(e)),this.lastLoginDate=new d(e?.lastLoginDate),this.lastOrderDate=new d(e?.lastOrderDate)}hasClientConditions(){return(0,r.some)([this.salesDirections,this.partnerGroups,this.managers,this.additionalClients,this.fixedClients,this.regions,this.cities],e=>!(0,r.isEmpty)(e))||(0,r.some)([this.lastLoginDate,this.lastOrderDate],e=>!!e.from||!!e.to)}setPeriod(e,t){return this[e]=new d({from:t?.from?(0,n.startOfDay)(t.from):null,to:t?.to?(0,n.endOfDay)(t.to):null}),this}toSaveData(){return{salesDirections:(0,r.map)(this.salesDirections,`id`),partnerGroups:(0,r.map)(this.partnerGroups,`id`),managers:(0,r.map)(this.managers,`id`),additionalClients:(0,r.map)(this.additionalClients,`id`),regions:(0,r.map)(this.regions,`id`),cities:(0,r.map)(this.cities,`id`),lastLoginDate:new d(this.lastLoginDate),lastOrderDate:new d(this.lastOrderDate)}}},U=function(e){return e.Active=`active`,e.Scheduled=`scheduled`,e.Completed=`completed`,e}({}),pt=class{static resolve(e,t=new Date){return e.deletedAt&&e.deletedAt.getTime()<=t.getTime()?U.Completed:e.publishedAt&&e.publishedAt.getTime()>t.getTime()?U.Scheduled:U.Active}},W=class extends g{conditions;products;productCategories;countDiscountedPrices;expectedCountDiscountedPrices;countDiscountedProducts;countDiscountedClients;constructor(e){super(e),this.conditions=new ft(e?.conditions),this.products=(0,r.map)(e?.products??[],e=>new x(e)),this.productCategories=(0,r.map)(e?.productCategories??[],e=>new T(e)),this.countDiscountedPrices=e?.countDiscountedPrices??0,this.expectedCountDiscountedPrices=e?.expectedCountDiscountedPrices??0,this.countDiscountedProducts=e?.countDiscountedProducts??0,this.countDiscountedClients=e?.countDiscountedClients??0}getState(e=new Date){return pt.resolve(this,e)}assignCounters(e){this.countDiscountedPrices=e.countDiscountedPrices,this.expectedCountDiscountedPrices=e.expectedCountDiscountedPrices,this.countDiscountedProducts=e.countDiscountedProducts,this.countDiscountedClients=e.countDiscountedClients}isPricesUpdating(){return this.countDiscountedPrices!==this.expectedCountDiscountedPrices}toSaveData(){return{name:this.name,percent:this.percent,isLowPriceAllowed:this.isLowPriceAllowed,publishedAt:this.publishedAt??null,deletedAt:this.deletedAt??null,description:this.description??``,products:(0,r.map)(this.products,`id`),productCategories:(0,r.map)(this.productCategories,`id`),conditions:this.conditions.toSaveData()}}},mt=class{client;additionalClientsCondition;fixedClientsCondition;partnerGroupsCondition;managersCondition;citiesCondition;regionsCondition;salesDirectionsCondition;constructor(e){this.client=new H(e?.client),this.additionalClientsCondition=e?.additionalClientsCondition??!1,this.fixedClientsCondition=e?.fixedClientsCondition??!1,this.partnerGroupsCondition=e?.partnerGroupsCondition??!1,this.managersCondition=e?.managersCondition??!1,this.citiesCondition=e?.citiesCondition??!1,this.regionsCondition=e?.regionsCondition??!1,this.salesDirectionsCondition=e?.salesDirectionsCondition??!1}isEligible(){return this.additionalClientsCondition||this.fixedClientsCondition||this.partnerGroupsCondition||this.managersCondition||this.citiesCondition||this.regionsCondition||this.salesDirectionsCondition}},ht=class extends u{id;name;states;constructor(e){super(),this.id=e?.id,this.name=e?.name,this.states=e?.states}resetFilterValue(e){switch(e){case`id`:case`name`:case`states`:this[e]=void 0}return this}},gt=class e extends p{static prepareSaveData(e,n){return{...e,publishedAt:t.DateHelper.toApiFormat(e.publishedAt),deletedAt:t.DateHelper.toApiFormat(e.deletedAt),conditions:{...e.conditions,lastLoginDate:t.DateHelper.periodToApiFormat(e.conditions.lastLoginDate),lastOrderDate:t.DateHelper.periodToApiFormat(e.conditions.lastOrderDate),updateFixedClients:n}}}getDiscountsList(e,t,n,r){return this.getTypedPaginated(g,`/internal/price/discounts`,e,t,n,{},void 0,r)}getDiscount(e){return this.get(`/internal/price/discounts/${e}`,{},e=>new W(e.data))}createDiscount(t,n,r={}){return this.post(`/internal/price/discounts`,e.prepareSaveData(t,n),e=>new W(e.data),r)}updateDiscount(t,n,r,i={}){return this.patch(`/internal/price/discounts/${t}`,e.prepareSaveData(n,r),e=>new W(e.data),i)}removeDiscount(e){return this.delete(`/internal/price/discounts/${e}`)}getEligibleClients(e){return this.getTypedList(mt,`/internal/price/discounts/${e}/clients`)}checkClient(e,t){return this.get(`/internal/price/discounts/${e}/clients/${t}/check`,{},e=>new mt(e.data))}},G=class extends t.NamedIdentity{constructor(e){super(e)}},K=class extends t.Identity{question;answer;groups;constructor(e){super(e,-1),this.question=e?.question??``,this.answer=e?.answer??``,this.groups=(0,r.map)(e?.groups??[],e=>new G(e))}toSaveData(){return{question:this.question,answer:this.answer,groups:(0,r.map)(this.groups,`id`)}}},_t=class extends p{getFaqList(e,t){return this.getTypedPaginated(K,`/internal/faq`,void 0,void 0,t,(0,r.isNil)(e)?{}:{group:e})}getFaq(e){return this.get(`/internal/faq/${e}`,{},e=>new K(e.data))}createFaq(e,t={}){return this.post(`/internal/faq`,e,e=>new K(e.data),t)}updateFaq(e,t,n={}){return this.patch(`/internal/faq/${e}`,t,e=>new K(e.data),n)}removeFaq(e){return this.delete(`/internal/faq/${e}`)}getGroupsList(){return this.getTypedList(G,`/internal/faq/groups`)}createGroup(e,t={}){return this.post(`/internal/faq/groups`,e,e=>new G(e.data),t)}updateGroup(e,t,n={}){return this.patch(`/internal/faq/groups/${e}`,t,e=>new G(e.data),n)}removeGroup(e){return this.delete(`/internal/faq/groups/${e}`)}};function vt(e){let t=(0,r.round)(e*100);return`${t>=0?`+`:``}${t}%`}var yt=class e{static productIsMeasurable(e){return e.unit.isLinear||e.unit.isSquare}static getProductMultiplicity(t){return!t.properties?.ignoreMinCountCheck&&t.properties?.minCount!=null&&!e.productIsMeasurable(t)?t.properties.minCount:1}static getProductLengthMultiplicity(e){return e.properties?.lengthStep==null?!e.properties?.ignoreMinCountCheck&&e.properties?.minCount!=null?e.properties.minCount:.01:e.properties.lengthStep}},bt=class{static generateUndefinedManagerInstance(){return new t.Manager({id:0,name:`- Не назначен -`,isActive:!0,guid:`-undefined-`})}static isUndefinedManagerInstance(e){return e.id===0&&e.guid===`-undefined-`}},q=function(e){return e.Processing=`processing`,e.Completed=`completed`,e.Error=`error`,e.NeedsActualization=`needs_actualization`,e}({}),xt=class{status;actualizedAt;expiresAt;error;constructor(e){this.status=e?.status??q.Processing,this.actualizedAt=t.DateHelper.parse(e?.actualizedAt),this.expiresAt=t.DateHelper.parse(e?.expiresAt),this.error=e?.error}get isProcessing(){return this.status===q.Processing}get isOutdated(){return this.isOutdatedAt(new Date)}get isOrderAllowed(){return this.isOrderAllowedAt(new Date)}isOutdatedAt(e){return this.status!==q.Completed||(0,r.isNil)(this.actualizedAt)?!0:!(0,r.isNil)(this.expiresAt)&&this.expiresAt.getTime()<e.getTime()}isOrderAllowedAt(e){return this.status===q.Completed&&!this.isOutdatedAt(e)}},St=class extends s{name;client;sum;isProfstroy;actualization;file;constructor(e){super(e),this.name=e?.name,this.client=new O(e?.client),this.sum=e?.sum,this.isProfstroy=e?.isProfstroy,this.actualization=e?.actualization&&new xt(e.actualization),this.file=e?.file}},Ct=class extends de{groupName;supplierSku;isIgnored;lineError;constructor(e){super(e),this.groupName=e.groupName,this.supplierSku=e.supplierSku??e.product.supplierSku,this.isIgnored=e.isIgnored,this.lineError=e.lineError}get isProductStub(){return(0,r.isNil)(this.product.id)}get isOrderable(){return!this.isProductStub&&!this.isIgnored&&(0,r.isEmpty)(this.lineError)}},J=class extends St{sum;products;constructor(e){super(e),this.sum=e.sum??0,this.products=(e.products??[]).map(t=>e.isProfstroy?new Ct(t):new de(t))}},wt=class extends u{id;clientSearchTerm;name;createdAt=new d;constructor(e){super(),this.id=e?.id,this.clientSearchTerm=e?.clientSearchTerm,this.name=e?.name,this.createdAt=new d(e?.createdAt)}resetFilterValue(e){return e===`createdAt`?(this.createdAt.from=null,this.createdAt.to=null):this[e]=void 0,this}asClearRaw(){let e=super.asClearRaw();return!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,e}},Tt=class extends Ye{client;payment;delivery;attachedUser;status;statusDetail;salesDirection;attachedAt;isOnOrder;isProfstroy;isNotInStock;sum;isLargeOrder;constructor(e){super(e),this.client=new O(e?.client),this.payment={type:e?.payment?.type??-1,status:e?.payment?.status??-1,onlinePaymentLink:e?.payment?.onlinePaymentLink},this.delivery={type:e?.delivery?.type??-1,date:(0,r.isString)(e?.delivery?.date)?(0,n.parseISO)(e.delivery.date):e?.delivery?.date??new Date,address:e?.delivery?.address?new z(e.delivery.address):void 0,warehouse:e?.delivery?.warehouse?new t.Warehouse(e.delivery.warehouse):void 0},this.attachedUser=e?.attachedUser?new h(e?.attachedUser):void 0,this.status=new t.OrderStatus(e?.status),this.statusDetail=e?.statusDetail?new t.Reference(e.statusDetail):void 0,this.salesDirection=new t.SalesDirection(e?.salesDirection);let i=e?.attachedAt;this.attachedAt=(0,r.isString)(i)?(0,n.parseISO)(i):e?.attachedAt,this.isOnOrder=e?.isOnOrder??!1,this.isProfstroy=e?.isProfstroy??!1,this.isNotInStock=e?.isNotInStock??!1,this.sum=e?.sum??0,this.isLargeOrder=e?.isLargeOrder??!1}},Et=class extends ue{product;cost;costOne;costOneRub;costRub;logicGroupId;salesDirection;specificationImgUrl;sawing;currency;changedFields=[];replacement;constructor(e,n){super(e),this.product=new S(e.product),this.currency=new t.Currency(e.currency),this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=(0,r.isArray)(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,n&&(this.replacement=n,this.quantity!==n.quantity&&this.changedFields.push(`quantity`),this.length!==n.length&&this.changedFields.push(`length`))}},Y=class extends Tt{products;invoices;comment;image;contragent;barcode;orderSource;isAllowProcessingWithoutPayment;nextStatuses;actions;operatorsComment;operatorsForWarehouseComment;erpOrderUrl;numberDoc;constructor(e){super(e),this.products=(e.products??[]).map(t=>new Et(t,t.replacementId?e.products?.find(e=>e.id===t.replacementId):void 0)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?R.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new t.Reference(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment,this.nextStatuses=e.nextStatuses?.map(e=>new t.OrderStatus(e)),this.actions=e.actions,this.operatorsComment=e.operatorsComment,this.operatorsForWarehouseComment=e.operatorsForWarehouseComment,this.erpOrderUrl=e.erpOrderUrl,this.numberDoc=e.numberDoc}},Dt=class extends p{getOffers(e,t,n,r){return this.getTypedPaginated(St,`/internal/orders/offers`,e,t,n,{},void 0,r)}createOfferFromCart(e,t,n){return this.post(`/internal/orders/offers/${e}`,{name:t,items:n?.length?n:void 0},e=>new J(e.data))}createProfstroyOffer(e,t,n,r={}){return this.post(`/internal/orders/offers/${e}/profstroy`,{file:t,name:n},e=>new J(e.data),r)}actualizeProfstroyOffer(e){return this.post(`/internal/orders/offers/${e}/profstroy/actualize`,{},e=>new J(e.data))}reloadProfstroyOffer(e){return this.post(`/internal/orders/offers/${e}/profstroy/reload`,{},e=>new J(e.data))}getOffer(e){return this.get(`/internal/orders/offers/${e}`,{},e=>new J(e.data))}updateOffer(e,t){return this.patch(`/internal/orders/offers/${e}`,{name:t},e=>new J(e.data))}deleteOffer(e){return this.delete(`/internal/orders/offers/${e}`)}createOrderFromDraft(e,r,i,a={}){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.post(`/internal/orders/offers/${e}/create-order`,{...r,deliveryDate:r.deliveryDate?(0,n.format)(r.deliveryDate,o):void 0,items:i?.length?i:void 0},e=>t.TypedInstanceFactory.instanceListInitializer(Y,e.data),a)}addOfferProduct(e,t,n={}){return this.post(`/internal/orders/offers/${e}/products`,{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,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},e=>new J(e.data),n)}patchOfferProduct(e,t,n,r={}){return this.patch(`/internal/orders/offers/${e}/products/${t}`,{product_id:n.product.id,product_category_id:n.configurator?n.category.id:void 0,quantity:n.quantity,height:n.height,length:n.length,width:n.width,configurator:n.configurator,marker:n.marker,is_additional_sale:n.isAdditionalSale,...n.configuratorParams},e=>new J(e.data),r)}deleteOfferProduct(e,t){return this.delete(`/internal/orders/offers/${e}/products/${t}`,e=>new J(e.data))}getOfferHtml(e,t){return this.get(`/internal/orders/offers/${e}/view`,t?{recipientText:t}:{},e=>new Blob([e.data],{type:`text/html`}))}getOfferPdf(e,t){return this.getBlob(`/internal/orders/offers/${e}/download`,t?{recipientText:t}:{},e=>new Blob([e.request.response],{type:`application/pdf`}))}sendOffer(e,t){return this.post(`/internal/orders/offers/${e}/send`,t)}},Ot=class{static isProfstroy(e){return!!e?.isProfstroy}static isProfstroyOffer(e){return!(0,r.isNil)(e)&&e.isProfstroy===!0&&!(0,r.isNil)(e.actualization)}},kt=function(e){return e.View=`view`,e.Share=`share`,e.EditTags=`edit_tags`,e.SaveOrderIgnoredProducts=`save_order_ignored_products`,e.ChangeStatus=`change_status`,e.ChangeProducts=`change_products`,e.ChangeOrderParameters=`change_order_parameters`,e.Recalculate=`recalculate`,e.AttachOrder=`attach_order`,e.DetachOrder=`detach_order`,e.ChangeAttachedOperator=`change_attached_operator`,e.SendOnlinePaymentLink=`send_online_payment_link`,e.ConfirmOnlineFullPayment=`confirm_online_full_payment`,e.MergeOrders=`merge_orders`,e.GetHistory=`get_history`,e.CloneOrder=`clone_order`,e.DeleteAttachedFile=`delete_attached_file`,e}({}),At=class{paymentType;deliveryType;contragentId;deliveryDate;addressId;warehouseId;image;comment;barcode;operatorsComment;operatorsForWarehouseComment;additionalEmails;isAllowProcessingWithoutPayment;isAdditionalSale;constructor(e){this.paymentType=e?.payment.type,this.deliveryType=e?.delivery.type,this.contragentId=e?.contragent?.id,this.deliveryDate=e?.delivery.date?new Date(e.delivery.date):void 0,this.addressId=e?.delivery.address?.id,this.warehouseId=e?.delivery.warehouse?.id,this.comment=e?.comment,this.barcode=e?.barcode,this.operatorsComment=e?.operatorsComment,this.operatorsForWarehouseComment=e?.operatorsForWarehouseComment,this.isAllowProcessingWithoutPayment=e?.isAllowProcessingWithoutPayment}},jt=class extends u{attachedUsers;clientSearchTerm;client;contragent;createdAt=new d;creator;deliveryDate=new d;deliveryAddressSearch;clientCities;id;isApproved;isNotInStock;isOnOrder;attachedAt=new d;salesDirections;status;statusDetail;deliveryType;paymentType;warehouses;isLargeOrder;isToProcess;onlyMyRegions;constructor(e){super(),this.attachedUsers=e?.attachedUsers?.map(e=>`isActive`in e?new t.Manager(e):new t.Operator(e)),this.clientSearchTerm=e?.clientSearchTerm,this.client=e?.client?new O(e.client):void 0,this.contragent=e?.contragent,this.createdAt=new d(e?.createdAt),this.creator=e?.creator?new h(e.creator):void 0,this.deliveryDate=new d(e?.deliveryDate),this.deliveryAddressSearch=e?.deliveryAddressSearch,this.clientCities=e?.clientCities?.map(e=>new t.CityWithRegionAndCountry(e)),this.id=e?.id,this.isApproved=e?.isApproved,this.isNotInStock=e?.isNotInStock,this.isOnOrder=e?.isOnOrder,this.isLargeOrder=e?.isLargeOrder,this.attachedAt=new d(e?.attachedAt),this.salesDirections=e?.salesDirections?.map(e=>new t.SalesDirection(e)),this.status=e?.status,this.statusDetail=e?.statusDetail,this.deliveryType=e?.deliveryType?new t.DeliveryType(e.deliveryType):void 0,this.paymentType=e?.paymentType?new t.PaymentType(e.paymentType):void 0,this.warehouses=e?.warehouses?.map(e=>new t.Warehouse(e)),this.isToProcess=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 t.DeliveryType;break;case`clientCities`:this.clientCities=[];break;case`attachedAt`:this.attachedAt.from=null,this.attachedAt.to=null;break;case`salesDirection`:case`salesDirections`:this.salesDirections=[];break;case`status`:this.status=[];break;case`warehouse`:case`warehouses`:this.warehouses=[];break;default:this[e]=void 0}return this}asClearRaw(){let e=super.asClearRaw();return!e?.createdAt?.from&&!e?.createdAt?.to&&delete e.createdAt,!e?.deliveryDate?.from&&!e?.deliveryDate?.to&&delete e.deliveryDate,!e?.attachedAt?.from&&!e?.attachedAt?.to&&delete e.attachedAt,e}},Mt=class{user;status;statusDetail;createdAt;constructor(e){this.user=new h(e?.user),this.status=new t.OrderStatus(e?.status),this.statusDetail=e?.statusDetail?new t.Reference(e.statusDetail):void 0;let i=e?.createdAt;this.createdAt=(0,r.isString)(i)?(0,n.parseISO)(i):e?.createdAt??new Date}},Nt=class extends p{getOrders(e,t,n,r){return this.getTypedPaginated(Tt,`/internal/orders`,e,t,n,{},void 0,r)}getOrdersCount(e,t){return this.get(`/internal/orders/count`,e?{filters:JSON.stringify((e instanceof f?e:new f(e)).toPrimitive())}:{},void 0,void 0,t).then(e=>e.count)}getClientOrderStatistics(e,t){return this.get(`/internal/clients/${e}/orders/statistics`,t?{period:t}:{})}getOrder(e){return this.get(`/internal/orders/${e}`,{},e=>new Y(e.data))}createClientOrder(e,r,i,a={}){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.post(`/internal/clients/${e}/orders`,{...r,deliveryDate:(0,n.format)(r.deliveryDate,o),items:i?.length?i:void 0},e=>t.TypedInstanceFactory.instanceListInitializer(Y,e.data),a)}attachOrder(e){return this.patch(`/internal/orders/${e}/attach`,{},e=>new Y(e.data))}detachOrder(e){return this.patch(`/internal/orders/${e}/detach`,{},e=>new Y(e.data))}mergeOrders(e,t){return this.patch(`/internal/orders/${e}/merge`,{ids:t},e=>new Y(e.data))}recalculateOrder(e){return this.patch(`/internal/orders/${e}/recalculate`,{},e=>new Y(e.data))}cloneOrder(e){return this.get(`/internal/orders/${e}/clone`,{})}updateOrder(e,r,i={}){let a=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.patch(`/internal/orders/${e}`,{...r,deliveryDate:r.deliveryDate?(0,n.format)(r.deliveryDate,a):void 0},e=>new Y(e.data),i)}addOrderProduct(e,t,n={}){return this.post(`/internal/orders/${e}/products`,{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,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},e=>new Y(e.data),n)}changeOrderStatus(e,t,n,r={}){return this.patch(`/internal/orders/${e}/status`,{status:t,statusDetail:n},e=>new Y(e.data),r)}changeOrderStatusDetail(e,t){return this.patch(`/internal/orders/${e}/status`,{statusDetail:t},e=>new Y(e.data))}getOrderStatusHistory(e){return this.getTypedList(Mt,`/internal/orders/${e}/history`)}getOrderPrintHtml(e,t){return this.get(`/internal/orders/${e}/print/view`,{...t},e=>new Blob([e.data],{type:`text/html`}))}getOrderPrintPdf(e,t){return this.getBlob(`/internal/orders/${e}/print/download`,{...t},e=>new Blob([e.request.response],{type:`application/pdf`}))}sendOrderPrint(e,t){return this.post(`/internal/orders/${e}/print/send`,t)}changeAttachedOperator(e,t){return this.patch(`/internal/orders/${e}/change-attached-operator`,{operatorId:t},e=>new Y(e.data))}deleteOrderAttachedFile(e){return this.delete(`/internal/orders/${e}/file/attached`,e=>new Y(e.data))}deleteOrderProduct(e,t){return this.delete(`/internal/orders/${e}/products/${t}`,e=>new Y(e.data))}patchOrderProduct(e,t,n,r={}){return this.patch(`/internal/orders/${e}/products/${t}`,{product_id:n.product.id,product_category_id:n.configurator?n.category.id:void 0,quantity:n.quantity,height:n.height,length:n.length,width:n.width,configurator:n.configurator,marker:n.marker,is_additional_sale:n.isAdditionalSale,...n.configuratorParams},e=>new Y(e.data),r)}getDeliveryNearestDates(e,t){return this.get(`/internal/orders/delivery/${e}/nearest-dates`,{},e=>e.data,void 0,t)}getSelfDeliveryNearestDates(e,t){return this.get(`/internal/orders/self-delivery/${e}/nearest-dates`,{},e=>e.data,void 0,t)}getDeliveryCost(e,r,i,a){let o=(0,t.useBaseConfigStore)().config.dateFormats.api;return this.get(`/internal/orders/delivery/${e}/cost`,{date:(0,n.format)(r,o),warehouse_id:i},e=>e.data,void 0,a)}},Pt=Symbol(`currentOrder`),X=class{client;product;cost;costCoefficient;source;constructor(e){this.client=new O(e?.client),this.product=new x(e?.product),this.cost=e?.cost??0,this.costCoefficient=e?.costCoefficient??0,this.source=e?.source??le.Product}},Ft=e=>e?(0,r.omitBy)({cities:e.cities?.map(e=>e.id),clients:e.clients?.map(e=>e.id),managers:e.managers?.map(e=>e.id),partnerGroups:e.partnerGroups?.map(e=>e.id),salesDirections:e.salesDirections?.map(e=>e.id),hideNotActive:e.hideNotActive},e=>(0,r.isNil)(e)||((0,r.isArray)(e)||(0,r.isObject)(e))&&(0,r.isEmpty)(e)):{},It=e=>{let t={};return e.from&&(e.from.coefficient||e.from.value)&&(t.from={},e.from.coefficient&&(t.from.priceCoefficientId=e.from.coefficient.id),e.from.value&&(t.from.increasePercent=e.from.value)),e.to&&(e.to.coefficient||e.to.value)&&(t.to={},e.to.coefficient&&(t.to.priceCoefficientId=e.to.coefficient.id),e.to.value&&(t.to.increasePercent=e.to.value)),t},Lt=class extends t.HttpRequester{analyzeProductPrices(e,n,r){return this.get(`/internal/price/products/${e}/analyze`,{...It(n),filters:Ft(r)},e=>t.TypedInstanceFactory.instanceListInitializer(X,e.data))}analyzeCategoryPrices(e,n,r){return this.get(`/internal/price/categories/${e}/analyze`,{...It(n),filters:Ft(r)},e=>t.TypedInstanceFactory.instanceListInitializer(X,e.data))}analyzeCategoryPricesBySquare(e,n,r){return this.get(`/internal/price/categories/${e}/analyze/square`,{...n,filters:Ft(r)},e=>t.TypedInstanceFactory.instanceListInitializer(X,e.data))}},Rt=class{cost;isLowCost;isRetail;costDate;discountName;priceTemplateName;product;client;executor;currency;constructor(e){this.cost=e.cost??0,this.isLowCost=e.isLowCost??!1,this.isRetail=e.isRetail??!1,this.costDate=(0,r.isString)(e.costDate)?(0,n.parseISO)(e.costDate):e.costDate??new Date,this.discountName=e.discountName,this.priceTemplateName=e.priceTemplateName,this.product=e.product?new y(e.product):void 0,this.client=e.client?new h(e.client):void 0,this.executor=e.executor?new h(e.executor):void 0,this.currency=e.currency?new t.Currency(e.currency):void 0}},zt=class extends y{history;constructor(e){super(e),this.history=(0,r.map)(e.history,e=>new Rt(e))}},Bt=class extends t.HttpRequester{getProductPriceHistory(e){let i=(0,t.useBaseConfigStore)().config.dateFormats.api,a=(0,r.omitBy)((0,r.merge)(e,{costDate:{from:(0,r.isDate)(e.costDate?.from)?(0,n.format)(e.costDate.from,i):e.costDate?.from,to:(0,r.isDate)(e.costDate?.to)?(0,n.format)(e.costDate.to,i):e.costDate?.to}}),e=>(0,r.isNil)(e)||((0,r.isArray)(e)||(0,r.isObject)(e))&&(0,r.isEmpty)(e)),o=e.product?.[0]??0;return delete a.product,this.get(`/internal/price/products/${o}/history`,a).then(e=>[new zt((0,r.merge)(e[0],{history:e}))])}},Vt=class{products=[];productCategories=[];constructor(e){e?.products&&(this.products=e.products.map(e=>new y(e))),e?.productCategories&&(this.productCategories=e.productCategories.map(e=>new y(e)))}},Ht=class extends t.HttpRequester{getProductCategoryRecommendations(e){return this.get(`/internal/catalog/recommendations/categories/${e.id}`,{},e=>new Vt(e.data))}getProductRecommendations(e){return this.get(`/internal/catalog/recommendations/products/${e.id}`,{},e=>new Vt(e.data))}saveProductCategoryRecommendations(e,t){return this.post(`/internal/catalog/recommendations/categories/${e.id}`,{product_categories:t.productCategories.map(e=>e.id),products:t.products.map(e=>e.id)})}saveProductRecommendations(e,t){return this.post(`/internal/catalog/recommendations/products/${e.id}`,{product_categories:t.productCategories.map(e=>e.id),products:t.products.map(e=>e.id)})}},Ut=class{static generateUndefinedInstance(e,t=`- Не определён -`){return new e({id:0,name:t,slug:`-undefined-`})}static isUndefinedInstance(e){return e.id===0&&e.slug===`-undefined-`}},Wt=class{name;content;constructor(e){this.name=e.name,this.content=e.content}},Gt=class{resourceType;resourceId;h1;title;description;keywords;meta;tags;constructor(e){this.resourceType=new t.ResourceType(e?.resourceType),this.resourceId=e?.resourceId??``,this.h1=e?.h1,this.title=e?.title,this.description=e?.description,this.keywords=e?.keywords,this.meta=e?.meta?.map(e=>new Wt(e))??[],this.tags=e?.tags}},Kt=class extends t.HttpRequester{getResourceSeoData(e,t){return this.get(`/internal/seo/${e.slug}/${t}`,{},e=>new Gt(e.data))}saveResourceSeoData(e,t={}){return this.post(`/internal/seo/${e.resourceType.slug}/${e.resourceId}`,e,e=>new Gt(e.data),t)}deleteResourceSeoData(e,t){return this.delete(`/internal/seo/${e.slug}/${t}`)}},qt=class extends t.Identity{text;searchCount;lastSearchedAt;constructor(e){super(e),this.text=e?.text??``,this.searchCount=e?.searchCount??0,this.lastSearchedAt=t.DateHelper.parse(e?.lastSearchedAt)}},Jt=class extends t.HttpRequester{getSearchProductsStatistics(e,n){return this.getTypedList(qt,`/internal/statistics/search/products`,{date:t.DateHelper.periodToApiFormat(e)},!1,n)}removeSearchProductStatistic(e){return this.delete(`/internal/statistics/search/products/${e}`)}},Z=function(e){return e[e.Undetermined=0]=`Undetermined`,e[e.Complete=1]=`Complete`,e[e.Incomplete=2]=`Incomplete`,e}({}),Yt=class e{static isBlocked(e,t){return t&&e===Z.Incomplete}static getValidationResult(n,r){return e.isBlocked(n,r)?new t.FieldValidationResultData(`Проверьте адрес и выберите более точный вариант из подсказок`,`error`):n===Z.Incomplete||n===Z.Undetermined?new t.FieldValidationResultData(`Проверьте правильность адреса`,`warning`):void 0}},Xt=class extends t.HttpRequester{searchAddresses(e){return this.execSuggestionQuery(`/public/suggestions/address`,e)}searchBank(e){return this.execSuggestionQuery(`/public/suggestions/bank`,e)}searchOrganization(e){return this.execSuggestionQuery(`/public/suggestions/organization`,e)}execSuggestionQuery(e,t){return this.get(e,{query:t}).then(e=>{let t=[...e],n=1;return t.forEach(e=>{e.id=n++}),t})}},Zt=class extends t.HttpRequester{constructor(){super(),this.baseUrl=`${(0,t.useBaseConfigStore)().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(e=>e.accessToken)}},Q=class{user;salesDirection;constructor(e){this.user=new h(e?.user),this.salesDirection=new t.SalesDirection(e?.salesDirection)}},$=class extends t.UserRegionShortInfo{cities;users;constructor(e){super(e),this.cities=e?.cities?.map(e=>new t.CityWithRegionAndCountry(e))??[],this.users=e?.users?.map(e=>new Q(e))??[]}},Qt=class extends u{id;name;abbr;constructor(e){super(),this.id=e?.id,this.name=e?.name,this.abbr=e?.abbr}resetFilterValue(e){switch(e){case`id`:case`name`:case`abbr`:this[e]=void 0}return this}},$t=class extends p{getRegionsList(e,n,r){return this.getTypedPaginated(t.UserRegionShortInfo,`/internal/users/regions`,e,n,r)}getRegion(e){return this.get(`/internal/users/regions/${e}`,{},e=>new $(e.data))}createRegion(e,t={}){return this.post(`/internal/users/regions`,e,e=>new $(e.data),t)}updateRegion(e,t,n={}){return this.patch(`/internal/users/regions/${e}`,t,e=>new $(e.data),n)}removeRegion(e){return this.delete(`/internal/users/regions/${e}`)}getRegionEmployees(e){return this.getTypedList(Q,`/internal/users/regions/${e}/users`)}attachRegionEmployee(e,t,n){return this.post(`/internal/users/regions/${e}/users/${t}`,{salesDirectionId:n},e=>new Q(e.data))}detachRegionEmployee(e,t,n){return this.request({method:`DELETE`,url:`/internal/users/regions/${e}/users/${t}`,params:{sales_direction_id:n}})}};e.AddressQualityEnum=Z,e.AddressQualityHelper=Yt,e.BankAccount=F,e.BasePaginationProvider=p,e.BlogPost=l,e.BlogPostMediaFile=a,e.BlogPostMediaTypeEnum=i,e.BlogPostPublicationStatusEnum=o,e.BlogPostShortInfo=c,e.BlogPostsListFilters=ee,e.BlogProvider=re,e.CalculationTypeEnum=pe,e.CalendarHelper=V,e.Cart=w,e.CartProvider=fe,e.CatalogProvider=Oe,e.CatalogableItem=oe,e.Category=T,e.CategoryFilter=De,e.CategoryFilterSetting=Te,e.CategoryFilterValue=Ee,e.CategoryPricingRule=Ce,e.Client=qe,e.ClientAdditionalData=Xe,e.ClientCategory=ge,e.ClientDataProvider=Qe,e.ClientPriceCatalogableItem=xe,e.ClientPriceCategory=Se,e.ClientPriceProduct=N,e.ClientPriceProvider=ke,e.ClientPriceTemplateProvider=Ae,e.ClientProduct=S,e.ClientProductCategoryDataProvider=Ne,e.ClientProductDataProvider=Pe,e.ClientShortInfo=O,e.ClientsAdditionalDataRequestTypeEnum=Ve,e.ClientsListFilters=Je,e.CodedIdentity=y,e.ConfiguratorProvider=nt,e.ConfiguratorsEnum=tt,e.Contact=I,e.ContactPerson=L,e.ContactPersonRelated=Ze,e.ContactRelation=B,e.ContragentBase=He,e.ContragentFactory=R,e.ContragentIc=We,e.ContragentPerson=Ue,e.ContragentUlNr=Ke,e.ContragentUlR=Ge,e.CostSourceEnum=le,e.CreatableIdentity=s,e.Curator=D,e.DataSuggestionProvider=Xt,e.DateTimeProvider=lt,e.DeletableIdentity=ye,e.DeletableNamedIdentity=m,e.DeliveryAddress=z,e.Discount=W,e.DiscountClient=H,e.DiscountClientEligibility=mt,e.DiscountConditions=ft,e.DiscountProvider=gt,e.DiscountShortInfo=g,e.DiscountStateEnum=U,e.DiscountStateHelper=pt,e.DiscountsListFilters=ht,e.Faq=K,e.FaqGroup=G,e.FaqProvider=_t,e.FilterGroup=f,e.FilterItem=ne,e.FilterOpEnum=te,e.FilterSettings=we,e.HiddenCatalogableItem=se,e.Image=ce,e.ManagerDataFactory=bt,e.MetaTagItem=Wt,e.Offer=J,e.OfferActualization=xt,e.OfferActualizationStatus=q,e.OfferHelper=Ot,e.OfferShortInfo=St,e.OffersDataProvider=Dt,e.OffersListFilters=wt,e.Order=Y,e.OrderAction=kt,e.OrderEditorData=At,e.OrderInfo=Tt,e.OrderItem=Et,e.OrderItemBase=ue,e.OrderShortInfo=Ye,e.OrderStatusHistoryInfo=Mt,e.OrdersDataProvider=Nt,e.OrdersListFilters=jt,e.PaginationFiltersBase=u,e.PriceAnalyze=X,e.PriceAnalyzeProvider=Lt,e.PriceCatalogableItem=_e,e.PriceHistoryDataProvider=Bt,e.PriceHistoryItem=Rt,e.PriceTemplate=_,e.PriceTemplateCategory=E,e.PriceTemplateClient=k,e.PriceTemplateICatalogableItem=ve,e.PriceTemplateProduct=A,e.PriceTemplateProvider=Fe,e.PricingRole=P,e.PricingRoleProvider=Ie,e.PrimaryCatalogableItem=b,e.Product=x,e.ProductCategoryDataProvider=je,e.ProductDataProvider=Me,e.ProductFilterTypeEnum=me,e.ProductPriceCoefficient=v,e.ProductPriceHistory=zt,e.ProductUnit=ae,e.ProfstroyOfferItem=Ct,e.PropertiesProvider=Le,e.Property=j,e.PropertyValue=M,e.RecommendationsDataProvider=Ht,e.RecommendationsList=Vt,e.ReferenceDataFactory=Ut,e.STANDARD_PERIOD_GROUPS=ut,e.STANDARD_PERIOD_SECTIONS=dt,e.SearchProductStatistic=qt,e.Seo=Gt,e.SeoDataProvider=Kt,e.StatisticsProvider=Jt,e.StockCount=ie,e.TableDataPagination=it,e.TableDataPaginationRequestParams=rt,e.TableDataSortRequestParams=at,e.TemplateProductCategoryDataProvider=Re,e.TemplatesListFilters=be,e.UnitsHelper=yt,e.UnknownClientDataProvider=$e,e.UserAuthDataProvider=Zt,e.UserRegion=$,e.UserRegionEmployee=Q,e.UserRegionProvider=$t,e.UserRegionsListFilters=Qt,e.UserShortInfo=h,e.VersionConfig=et,e.currentOrderInjectionKey=Pt,e.daysAgoIso=ot,e.findCatalogItemByIdRecursive=ze,e.flattenCatalogItems=Be,e.formatPercentChange=vt,e.formatRelativeDate=ct,e.pluralize=st,Object.keys(t).forEach(function(n){n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})});
|