"use strict";(()=>{var e={};e.id=9689,e.ids=[9689],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},56681:e=>{e.exports=require("playwright")},62510:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>h,patchFetch:()=>f,requestAsyncStorage:()=>m,routeModule:()=>p,serverHooks:()=>g,staticGenerationAsyncStorage:()=>w});var a={};r.r(a),r.d(a,{POST:()=>c});var i=r(49303),n=r(88716),o=r(60670),l=r(87070),s=r(56681),d=r.n(s);let u=async e=>{let t;try{t=await d().chromium.launch();let r=await t.newPage();await r.route("**/*",e=>{["image","stylesheet","font"].includes(e.request().resourceType())?e.abort():e.continue()}),await r.goto(e,{waitUntil:"domcontentloaded",timeout:3e4});let a=await r.content(),i=[...new Set(Array.from(a.matchAll(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g),e=>e[0]))],n=Array.from(a.matchAll(/\+?\d{1,4}?[-.\s]?\(?\d{2,5}\)?[-.\s]?\d{3,4}[-.\s]?\d{4,9}/g),e=>e[0]),o=[...new Set(n.filter(e=>{let t=e.replace(/[^\d+]/g,"");return!(t.length<7||t.length>15||/^\d+$/.test(t)&&(t.length<10||t.length>14))&&!!/^\+?\d{1,4}[-.\s]?\(?\d{2,5}\)?[-.\s]?\d{3,4}[-.\s]?\d{4,9}$/.test(e)}))].map(e=>e.replace(/[\s()\-\+]/g,""))||[],l=[],s=await r.evaluate(()=>Array.from(document.querySelectorAll("a")).map(e=>e.href)),u=s.find(e=>e.includes("facebook.com"))||"",c=s.find(e=>e.includes("twitter.com"))||"",p=s.find(e=>e.includes("instagram.com"))||"",m=s.find(e=>e.includes("youtube.com"))||"",w=s.find(e=>e.includes("telegram.org"))||"",g=s.find(e=>e.includes("reddit.com"))||"",h=s.find(e=>e.includes("linkedin.com"))||"",f=s.find(e=>e.includes("pinterest.com"))||"";l=[{title:"facebook",url:u},{title:"twitter",url:c},{title:"instagram",url:p},{title:"youtube",url:m},{title:"telegram",url:w},{title:"reddit",url:g},{title:"linkedin",url:h},{title:"pinterest",url:f}];let y=[];return(i.length||o.length||s.length)&&y.push({emails:[...new Set(i)],phones:o,socialMediaLinks:l}),await t.close(),y}catch(e){return console.log(e),[]}finally{t&&await t.close()}};async function c(e){try{let{url:t}=await e.json();if(!t)return l.NextResponse.json({error:"URL is required"},{status:400});let r=(await s.chromium.connectOverCDP("http://localhost:9222")).contexts()[0].pages()[0];await r.goto(t,{waitUntil:"domcontentloaded",timeout:3e4}),await r.waitForTimeout(4e3);let a=await r.$('button[aria-label="Call"]');a&&a.click(),await r.waitForTimeout(4e3);let i=await r.evaluate(()=>document.querySelector(".jd_modal_body ul li")?.innerText||document.querySelector(".jd_modal_body .popbddvn__left")?.innerText?.replace(/[^\d+]/g,"")||"N/A"),n=await r.evaluate(()=>{let e=document.querySelectorAll("div.vendbox_operations .operation")[2]?.innerText||"N/A",t=document.querySelectorAll("div.vendbox_operations .operation")[1]?.innerText||"N/A",r=document.querySelector("details summary span.timebox_text")?.innerText||"N/A",a=document.querySelectorAll("ul.dtl_infolist li.dtl_infolist_item")[0]?.innerText||"N/A",i=document.querySelector("address")?.innerText||"N/A",n=Array.from(document.querySelectorAll("ul.vendorinfo_address_items a[role]")||[]).map(e=>e.href||"N/A").filter(e=>"N/A"!==e),o=document.querySelector("div.gst_address_link")?.innerText||"N/A";return{establishment:a,status:e,address:i,timestatus:t,website:n,current_status:r,gst:o}}),o=[];return n.website.length&&(o=await u(n.website[0])),l.NextResponse.json({...n,virtual_phone:i,url:t,detailed:o})}catch(e){return console.error("❌ Scraping Error:",e),l.NextResponse.json({error:"Failed to scrape website"},{status:500})}}let p=new i.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/justdial_detail_scraper/route",pathname:"/api/justdial_detail_scraper",filename:"route",bundlePath:"app/api/justdial_detail_scraper/route"},resolvedPagePath:"C:\\Users\\Design Collection\\OneDrive\\Desktop\\Jitendra Vishwakarma\\Next Dashboard\\web crawler for user dev\\Scrape Genius\\app\\api\\justdial_detail_scraper\\route.js",nextConfigOutput:"",userland:a}),{requestAsyncStorage:m,staticGenerationAsyncStorage:w,serverHooks:g}=p,h="/api/justdial_detail_scraper/route";function f(){return(0,o.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:w})}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8948,5972],()=>r(62510));module.exports=a})();