"use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__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 hdbHeaders={Cookie:"xla=s4t",Referer:"https://google.com","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"},getPosts=__name(function(_0){return __async(this,arguments,function*({filter:filter,page:page,signal:signal,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext;return posts({url:`${(yield getBaseUrl("hdhub"))+filter}/page/${page}/`,signal:signal,providerContext:providerContext})})},"getPosts"),getSearchPosts=__name(function(_0){return __async(this,arguments,function*({searchQuery:searchQuery,page:page,signal:signal,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext,baseUrl=yield getBaseUrl("hdhub");try{const today=(new Date).toISOString().slice(0,10),searchUrl=`https://search.pingora.fyi/collections/post/documents/search?${new URLSearchParams({q:searchQuery,query_by:"post_title,category,stars,director,imdb_id",query_by_weights:"4,2,2,2,4",sort_by:"sort_by_date:desc",limit:"15",highlight_fields:"none",use_cache:"true",page:String(page),analytics_tag:today}).toString()}`,res=yield fetch(searchUrl,{headers:__spreadProps(__spreadValues({},hdbHeaders),{Referer:baseUrl+"/",Accept:"application/json, text/plain, */*"}),signal:signal}),json=yield res.json(),hits=Array.isArray(null==json?void 0:json.hits)?json.hits:[],catalog=[];for(const hit of hits){const doc=(null==hit?void 0:hit.document)||{},title=String(doc.post_title||"").replace(/Download/gi,"").trim(),permalink=String(doc.permalink||""),image=String(doc.post_thumbnail||"");if(!title||!permalink)continue;const link=permalink.startsWith("http")?permalink:`${baseUrl}${permalink.startsWith("/")?"":"/"}${permalink}`;catalog.push({title:title,link:link,image:image})}return catalog}catch(err){return console.error("hdhubGetSearchPosts error ",err),[]}})},"getSearchPosts");function posts(_0){return __async(this,arguments,function*({url:url,signal:signal,providerContext:providerContext}){const{cheerio:cheerio}=providerContext;try{const res=yield fetch(url,{headers:hdbHeaders,signal:signal}),data=yield res.text(),$=cheerio.load(data),catalog=[];return $(".recent-movies").children().map((i,element)=>{const title=$(element).find("figure").find("img").attr("alt"),link=$(element).find("a").attr("href"),image=$(element).find("figure").find("img").attr("src");title&&link&&image&&catalog.push({title:title.replace("Download","").trim(),link:link,image:image})}),catalog}catch(err){return console.error("hdhubGetPosts error ",err),[]}})}__name(posts,"posts"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;