"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(target,value)=>__defProp(target,"name",{value:value,configurable:!0}),__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),__async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())}),posts_exports={};__export(posts_exports,{getPosts:()=>getPosts,getSearchPosts:()=>getSearchPosts});var getPosts=__name(function(_0){return __async(this,arguments,function*({filter:filter,page:page,signal:signal,providerContext:providerContext}){const{axios:axios}=providerContext,url="https://backend.animetsu.to"+filter+"&page="+page.toString();return console.log("animetsuGetPosts url",url),posts({url:url.toString(),signal:signal,axios:axios})})},"getPosts"),getSearchPosts=__name(function(_0){return __async(this,arguments,function*({searchQuery:searchQuery,page:page,signal:signal,providerContext:providerContext}){const{axios:axios}=providerContext;return posts({url:`https://backend.animetsu.to/api/anime/search?query=${encodeURIComponent(searchQuery)}&page=${page}&perPage=35&year=any&sort=favourites&season=any&format=any&status=any`,signal:signal,axios:axios})})},"getSearchPosts");function posts(_0){return __async(this,arguments,function*({url:url,signal:signal,axios:axios}){var _a;try{const data=null==(_a=(yield axios.get(url,{signal:signal,headers:{Referer:"https://animetsu.to/"}})).data)?void 0:_a.results,catalog=[];return null==data||data.map(element=>{var _a2,_b,_c,_d,_e,_f,_g;const title=(null==(_a2=element.title)?void 0:_a2.english)||(null==(_b=element.title)?void 0:_b.romaji)||(null==(_c=element.title)?void 0:_c.native),link=null==(_d=element.id)?void 0:_d.toString(),image=(null==(_e=element.coverImage)?void 0:_e.large)||(null==(_f=element.coverImage)?void 0:_f.extraLarge)||(null==(_g=element.coverImage)?void 0:_g.medium);title&&link&&image&&catalog.push({title:title,link:link,image:image})}),catalog}catch(err){return console.error("animetsu error ",err),[]}})}__name(posts,"posts"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;