1import{S as T}from"./chunk-storefront_settings_constants.DIF02Gz.js";import{L as l,t as A,g as o,R as n,b as m,i as E,a9 as p,N as _,H as S,r as R}from"./storefrontApp.CsApItsi.min.js";import{B as M}from"./chunk-base_http_api_url.H743YfZ.js";import{D as w}from"./chunk-description_mapper.LUIBH8e.js";import{g as U}from"./chunk-menu_categories_constants.DXYSDJA.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-lit.NvY0u02.js";import"./chunk-vendor-lodash.CWHFt7Z.js";import"./chunk-vendor-rxjs.Dp7kflo.js";import"./chunk-vendor-phoenix.cdKS79L.js";class b extends M{getCategoryUrl(e){return`${this.webapiUrl}/categories/${e}/`}getCategoryTreeUrl(e){return`${this.webapiUrl}/categories/${e}/tree/`}getAllCategoryTreesUrl(){return`${this.webapiUrl}/categories/tree/`}}const F={0:"default",1:"highestProrityAlphabeticallyAscending",2:"alphabeticalDescending",3:"lowestPrice",4:"highestPrice",9:"alphabeticalAscending",11:"oldestProduct",12:"newestProduct",99:"manual"};var h;h=l;const O=class y{constructor({parent_id:e,category_id:t,has_children:a,root:s,sort_type:i,url:C,translation:c}){this[h]=!0;const d=new w;this.categoryId=t,this.name=c.name,this.parentId=e!==void 0?e:null,this.descriptions=d.toModel({main:c.description,additional:c.description_bottom}),this.hasChildren=a,this.isRoot=s,this.sortType=F[i],this.url=C}static create(e){return new y(e)}};let f=O;class H{toModel(e){return f.create(e)}}var u;u=l;const I=class g{constructor({id:e,name:t,url:a,children:s}){this[u]=!0,this.id=e,this.name=t,this.url=a,this.children=s.map(i=>g.create(i))}static create(e){return new g(e)}};let P=I;class N{toModel(e){return P.create(e)}}const v=36e5;class D extends A{#e;#r;#t;#a;constructor({httpApi:e,settingsApi:t}){super(e),this.#e=new H,this.#r=new N,this.#t=new b(t),this.#a=t}getCategory(e){return this.fetch({url:this.#t.getCategoryUrl(e),method:n.get,sanitizeOptions:{disable:!0},cacheOptions:{type:o.memory,ttlInMs:3e4}},{callback:t=>({...t,data:this.#e.toModel(t.data)})})}getCategoryTree(e){return this.fetch({url:this.#t.getCategoryTreeUrl(e),method:n.get,sanitizeOptions:{disable:!0},cacheOptions:{type:o.memory,ttlInMs:3e4}},{callback:t=>({...t,data:this.#r.toModel(t.data)})})}getAllCategoryTrees(){return this.fetch({url:this.#t.getAllCategoryTreesUrl(),method:n.get,sanitizeOptions:{disable:!0},cacheOptions:{type:this.#s(),ttlInMs:v}},{callback:e=>({...e,data:e.data.map(t=>this.#r.toModel(t))})})}#s(){return this.#a.isFeatureEnabled(U.progressiveLoading)?o.session:o.local}}class Y extends m{#e;constructor({categoryHttpApi:e}){super(),this.#e=e}async getCategory(e){return await this._getResponseData(this.#e.getCategory(e))}async getCategoryTree(e){return await this._getResponseData(this.#e.getCategoryTree(e))}async getAllCategoryTrees(){return await this._getResponseData(this.#e.getAllCategoryTrees())}async _getResponseData(e){try{const t=await e.response;return t.status!==200||!t.data?null:t.data}catch(t){return console.error(t),null}}}class x extends E{constructor(e){super(),this.moduleName=p.api,this.#e=e}#e;async getCategory(e){return this.#e.getCategory(e)}async getCategoryTree(e){return this.#e.getCategoryTree(e)}async getAllCategoryTrees(){return this.#e.getAllCategoryTrees()}}class K extends _{static{this.featureName=p.feature}async init(){const e=this.getApiSync(S),t=await this.getApi(T.api),a=new D({httpApi:e,settingsApi:t}),s=new Y({categoryHttpApi:a}),i=new x(s);return{cores:[{type:R.api,instance:[i]}]}}}export{K as CategoryFetcherInitializer};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.