"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,cheerio:cheerio}=providerContext;if(page>1)return[];const url=`https://a.111477.xyz${filter}`;return(yield posts({baseUrl:"https://a.111477.xyz",url:url,signal:signal,axios:axios,cheerio:cheerio})).slice(0,50)})},"getPosts"),getSearchPosts=__name(function(_0){return __async(this,arguments,function*({searchQuery:searchQuery,page:page,signal:signal,providerContext:providerContext}){const{axios:axios,cheerio:cheerio}=providerContext,baseUrl="https://a.111477.xyz";return page>1?[]:[...yield posts({baseUrl:baseUrl,url:`${baseUrl}/movies/`,signal:signal,axios:axios,cheerio:cheerio}),...yield posts({baseUrl:baseUrl,url:`${baseUrl}/tvs/`,signal:signal,axios:axios,cheerio:cheerio})].filter(post=>{const title=post.title.toLowerCase(),query=searchQuery.toLowerCase();if(title.includes(query))return!0;const queryWords=query.split(/\s+/).filter(word=>word.length>0),titleWords=title.split(/[\s\-\.\(\)\[\]]+/).filter(word=>word.length>0);if(queryWords.every(queryWord=>titleWords.some(titleWord=>titleWord.includes(queryWord))))return!0;if(1===queryWords.length){const queryWord=queryWords[0];if(queryWord.length>=3){if(titleWords.some(titleWord=>titleWord.startsWith(queryWord)))return!0;if(titleWords.some(titleWord=>!(Math.abs(titleWord.length-queryWord.length)>2)&&levenshteinDistance(titleWord,queryWord)<=Math.max(1,Math.floor(.2*queryWord.length))))return!0}}return!1})})},"getSearchPosts");function posts(_0){return __async(this,arguments,function*({baseUrl:baseUrl,url:url,signal:signal,axios:axios,cheerio:cheerio}){try{const data=(yield axios.get(url,{signal:signal})).data,$=cheerio.load(data),catalog=[];return $("table tbody tr").each((i,element)=>{const linkElement=$(element).find("td:first-child a"),title=linkElement.text().trim(),link=linkElement.attr("href");if(title&&link&&"../"!==title&&"Parent Directory"!==title&&title.endsWith("/")){const cleanTitle=title.replace(/\/$/,""),fullLink=url+link,imageTitle=cleanTitle.length>30?cleanTitle.slice(0,30).replace(/\./g," "):cleanTitle.replace(/\./g," "),image=`https://placehold.jp/23/000000/ffffff/200x400.png?text=${encodeURIComponent(imageTitle)}&css=%7B%22background%22%3A%22%20-webkit-gradient(linear%2C%20left%20bottom%2C%20left%20top%2C%20from(%233f3b3b)%2C%20to(%23000000))%22%2C%22text-transform%22%3A%22%20capitalize%22%7D`;catalog.push({title:cleanTitle,link:fullLink,image:image})}}),catalog}catch(err){return console.error("111477 directory listing error:",err),[]}})}function levenshteinDistance(str1,str2){const matrix=Array(str2.length+1).fill(null).map(()=>Array(str1.length+1).fill(null));for(let i=0;i<=str1.length;i++)matrix[0][i]=i;for(let j=0;j<=str2.length;j++)matrix[j][0]=j;for(let j=1;j<=str2.length;j++)for(let i=1;i<=str1.length;i++){const indicator=str1[i-1]===str2[j-1]?0:1;matrix[j][i]=Math.min(matrix[j][i-1]+1,matrix[j-1][i]+1,matrix[j-1][i-1]+indicator)}return matrix[str2.length][str1.length]}__name(posts,"posts"),__name(levenshteinDistance,"levenshteinDistance"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;