module.exports=[70406,(e,t,n)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},65729,e=>{"use strict";var t=e.i(26747),n=e.i(90406),i=e.i(44898),r=e.i(62950),a=e.i(24977);function s(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()}function o(e){return null==e?null:"function"==typeof e?.toString?e.toString():String(e)}function d(e){return{id:e.id,agency:e.agency,startdate:s(e.startdate),enddate:s(e.enddate),insured:e.insured,policyEndorsementNo:e.policyEndorsementNo,product:e.product,plate:e.plate,premium:o(e.premium),assignments:e.assignments,paymentStatus:e.paymentStatus,grossPremium:o(e.grossPremium),paidAmount:o(e.paidAmount),vGecen:o(e.vGecen),remainingAmount:o(e.remainingAmount),netPremium:o(e.netPremium),commission:o(e.commission),branch:e.branch,representative:e.representative,policyStatus:e.policyStatus,renewed:e.renewed,brand:e.brand,brandType:e.brandType,modelYear:e.modelYear,motorNo:e.motorNo,chassisNo:e.chassisNo,vehicleValue:e.vehicleValue,usageType:e.usageType,licenseSerialNo:e.licenseSerialNo,inspectionDate:s(e.inspectionDate),productCode:e.productCode,phone:e.phone,nationalId:e.nationalId,birthDate:s(e.birthDate),createdAt:s(e.createdAt),updatedAt:s(e.updatedAt)}}async function u(e,t){let n,i;if(n="TTWQW222rs#@#@!@",i=e.headers.authorization||"",n&&i===`Bearer ${n}`||(t.status(401).json({success:!1,message:"Unauthorized"}),0)){if("GET"!==e.method)return t.status(405).json({success:!1,message:"Method Not Allowed"});try{let n=String(e.query.q||"").trim(),i=String(e.query.from||"").trim(),r=String(e.query.to||"").trim(),s=Math.min(Number(e.query.take||500),2e3),o={};if(i){let e=new Date(`${i}T00:00:00.000Z`);Number.isNaN(e.getTime())||(o.startdate={...o.startdate||{},gte:e})}if(r){let e=new Date(`${r}T23:59:59.999Z`);Number.isNaN(e.getTime())||(o.startdate={...o.startdate||{},lte:e})}n&&(o.OR=[{insured:{contains:n,mode:"insensitive"}},{plate:{contains:n,mode:"insensitive"}},{policyEndorsementNo:{contains:n,mode:"insensitive"}},{agency:{contains:n,mode:"insensitive"}}]);let u=await a.default.policy.findMany({where:o,orderBy:{startdate:"desc"},take:s});return t.status(200).json({success:!0,policies:u.map(d)})}catch(e){return console.error(e),t.status(500).json({success:!1,message:"Server Error"})}}}e.s(["default",()=>u],46616);var l=e.i(46616),c=e.i(7031),p=e.i(81927),m=e.i(46432);let g=(0,r.hoist)(l,"default"),y=(0,r.hoist)(l,"config"),h=new i.PagesAPIRouteModule({definition:{kind:n.RouteKind.PAGES_API,page:"/api/Policy/index",pathname:"/api/Policy",bundlePath:"",filename:""},userland:l,distDir:".next",relativeProjectDir:""});async function v(e,n,i){h.isDev&&(0,m.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let r="/api/Policy/index";r=r.replace(/\/index$/,"")||"/";let a=await h.prepare(e,n,{srcPage:r});if(!a){n.statusCode=400,n.end("Bad Request"),null==i.waitUntil||i.waitUntil.call(i,Promise.resolve());return}let{query:s,params:o,prerenderManifest:d,routerServerContext:u}=a;try{let t=e.method||"GET",i=(0,c.getTracer)(),a=i.getActiveScopeSpan(),l=h.instrumentationOnRequestError.bind(h),m=async a=>h.render(e,n,{query:{...s,...o},params:o,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:d.preview,propagateError:!1,dev:h.isDev,page:"/api/Policy/index",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>l(e,...t)}).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":n.statusCode,"next.rsc":!1});let e=i.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=e.get("next.route");if(s){let e=`${t} ${s}`;a.setAttributes({"next.route":s,"http.route":s,"next.span_name":e}),a.updateName(e)}else a.updateName(`${t} ${r}`)});a?await m(a):await i.withPropagatedContext(e.headers,()=>i.trace(p.BaseServerSpan.handleRequest,{spanName:`${t} ${r}`,kind:c.SpanKind.SERVER,attributes:{"http.method":t,"http.target":e.url}},m))}catch(e){if(h.isDev)throw e;(0,t.sendError)(n,500,"Internal Server Error")}finally{null==i.waitUntil||i.waitUntil.call(i,Promise.resolve())}}e.s(["config",0,y,"default",0,g,"handler",()=>v],65729)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__8f161cdb._.js.map