"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())}),meta_exports={};__export(meta_exports,{getMeta:()=>getMeta});var getMeta=__name(function(_0){return __async(this,arguments,function*({link:link,providerContext:providerContext}){var _a,_b,_c,_d,_e,_f,_g,_h,_i;const axios=providerContext.axios;try{console.log("all",link);const data=(yield axios.get(link)).data,meta={title:(null==(_a=null==data?void 0:data.meta)?void 0:_a.name)||"",synopsis:(null==(_b=null==data?void 0:data.meta)?void 0:_b.description)||"",image:(null==(_c=null==data?void 0:data.meta)?void 0:_c.background)||"",imdbId:(null==(_d=null==data?void 0:data.meta)?void 0:_d.imdb_id)||"",type:(null==(_e=null==data?void 0:data.meta)?void 0:_e.type)||"movie"},links=[];let directLinks=[],season=new Map;if("series"===meta.type){null==(_g=null==(_f=null==data?void 0:data.meta)?void 0:_f.videos)||_g.map(video=>{var _a2,_b2,_c2;(null==video?void 0:video.season)<=0||(season.has(null==video?void 0:video.season)||season.set(null==video?void 0:video.season,[]),season.get(null==video?void 0:video.season).push({title:"Episode "+(null==video?void 0:video.episode),type:"series",link:`${null==(_a2=null==data?void 0:data.meta)?void 0:_a2.imdb_id}-${null==(_b2=null==video?void 0:video.id)?void 0:_b2.split(":")[1]}-${null==(_c2=null==video?void 0:video.id)?void 0:_c2.split(":")[2]}`}))});const keys=Array.from(season.keys());keys.sort(),keys.map(key=>{directLinks=season.get(key),links.push({title:`Season ${key}`,directLinks:directLinks})})}else links.push({title:null==(_h=null==data?void 0:data.meta)?void 0:_h.name,directLinks:[{title:"Movie",type:"movie",link:`${null==(_i=null==data?void 0:data.meta)?void 0:_i.imdb_id}-`}]});return __spreadProps(__spreadValues({},meta),{linkList:links})}catch(err){return console.error(err),{title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]}}})},"getMeta");exports.getMeta=getMeta;