(()=>{var e={};e.id=6876,e.ids=[6876],e.modules={10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},56723:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>R,routeModule:()=>E,serverHooks:()=>_,workAsyncStorage:()=>d,workUnitAsyncStorage:()=>l});var s={};t.r(s),t.d(s,{POST:()=>c});var o=t(42706),n=t(28203),a=t(45994),i=t(39187),p=t(8089);let u=process.env.OMR_API_BASE||"https://omrscan-api-692760562588.us-central1.run.app";async function c(e){try{let{auth:r}=(0,p.j)(),t=(e.headers.get("authorization")||"").replace("Bearer ","");if(!t)return i.NextResponse.json({error:"Unauthorized"},{status:401});await r.verifyIdToken(t);let s=await e.json(),o=`${u}/compose/compose/form`,n=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok){let e=await n.text();return i.NextResponse.json({error:`OMR Service Error: ${e}`},{status:n.status})}let a=await n.json();return i.NextResponse.json(a,{status:200})}catch(e){if(console.error("[API /api/tests/compose] Error:",e),"auth/id-token-expired"===e.code||"auth/argument-error"===e.code)return i.NextResponse.json({error:"Invalid authentication token"},{status:401});return i.NextResponse.json({error:"Internal Server Error"},{status:500})}}let E=new o.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/tests/compose/route",pathname:"/api/tests/compose",filename:"route",bundlePath:"app/api/tests/compose/route"},resolvedPagePath:"C:\\omrwebapp-git-roregar.cl\\src\\app\\api\\tests\\compose\\route.ts",nextConfigOutput:"standalone",userland:s}),{workAsyncStorage:d,workUnitAsyncStorage:l,serverHooks:_}=E;function R(){return(0,a.patchFetch)({workAsyncStorage:d,workUnitAsyncStorage:l})}},96487:()=>{},78335:()=>{},8089:(e,r,t)=>{"use strict";t.d(r,{j:()=>n});let s=require("firebase-admin");function o(e){return(process.env[e]||"").trim()}function n(){if(s.apps.length){let e=s.app();return{db:s.firestore(e),auth:s.auth(e),storage:s.storage(e),app:e}}let e=function(){let e=process.env.FIREBASE_CONFIG||"";if(!e)return{};try{return JSON.parse(e)||{}}catch{return{}}}(),r=o("FIREBASE_PROJECT_ID")||o("NEXT_PUBLIC_FIREBASE_PROJECT_ID")||o("GOOGLE_CLOUD_PROJECT")||o("GCLOUD_PROJECT")||String(e.projectId||"").trim(),t=o("FIREBASE_STORAGE_BUCKET")||o("NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET")||String(e.storageBucket||"").trim(),n=o("FIREBASE_CLIENT_EMAIL"),a=(process.env.FIREBASE_PRIVATE_KEY||"").replace(/\\n/g,"\n").replace(/^"|"$/g,"");if(!r)throw Error("Missing projectId env (FIREBASE_PROJECT_ID or NEXT_PUBLIC_FIREBASE_PROJECT_ID)");if(!t)throw Error("Missing storage bucket env (FIREBASE_STORAGE_BUCKET or NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET)");let i=!!(n&&a),p=s.initializeApp({credential:i?s.credential.cert({projectId:r,clientEmail:n,privateKey:a}):s.credential.applicationDefault(),projectId:r,storageBucket:t});return{db:s.firestore(p),auth:s.auth(p),storage:s.storage(p),app:p}}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[1989,5452],()=>t(56723));module.exports=s})();