"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,providerValue:providerValue,signal:signal,providerContext:providerContext}){try{const{getBaseUrl:getBaseUrl,cheerio:cheerio}=providerContext,baseUrl=yield getBaseUrl("nfMirror"),catalog=[];if(page>1)return[];const url=`https://netmirror.8man.dev/api/net-proxy?${"primeMirror"===providerValue?"isPrime=true":"isPrime=false"}&url=${baseUrl+filter}`,res=yield fetch(url,{signal:signal,method:"GET",credentials:"omit"}),data=yield res.text(),$=cheerio.load(data);return $("a.post-data").map((i,element)=>{const id=$(element).attr("data-post"),image=$(element).find("img").attr("data-src")||"";id&&catalog.push({title:"",link:baseUrl+""+("netflixMirror"===providerValue?"/post.php?id=":"/pv/post.php?id=")+id+"&t="+Math.round((new Date).getTime()/1e3),image:image})}),catalog}catch(err){return console.error("nf error ",err),[]}})},"getPosts"),getSearchPosts=__name(function(_0){return __async(this,arguments,function*({searchQuery:searchQuery,page:page,providerValue:providerValue,signal:signal,providerContext:providerContext}){var _a;const{getBaseUrl:getBaseUrl}=providerContext;try{if(page>1)return[];const catalog=[],baseUrl=yield getBaseUrl("nfMirror"),url=`https://netmirror.8man.dev/api/net-proxy?${"primeMirror"===providerValue?"isPrime=true":"isPrime=false"}&url=${baseUrl}${"netflixMirror"===providerValue?"":"/pv"}/search.php?s=${encodeURI(searchQuery)}`,res=yield fetch(url,{signal:signal,method:"GET",credentials:"omit"}),data=yield res.json();return null==(_a=null==data?void 0:data.searchResult)||_a.forEach(result=>{const title=(null==result?void 0:result.t)||"",id=null==result?void 0:result.id,image="netflixMirror"===providerValue?`https://imgcdn.media/poster/v/${id}.jpg`:`https://imgcdn.media/pv/341/${id}.jpg`;id&&catalog.push({title:title,link:baseUrl+""+("netflixMirror"===providerValue?"/mobile/post.php?id=":"/mobile/pv/post.php?id=")+id+"&t="+Math.round((new Date).getTime()/1e3),image:image})}),catalog}catch(err){return console.error("Search error:",err),[]}})},"getSearchPosts");exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;