"use strict";(()=>{var e={};e.id=266,e.ids=[266],e.modules={399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7561:e=>{e.exports=require("node:fs")},9411:e=>{e.exports=require("node:path")},1671:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>j,patchFetch:()=>S,requestAsyncStorage:()=>h,routeModule:()=>m,serverHooks:()=>y,staticGenerationAsyncStorage:()=>x});var n={};r.r(n),r.d(n,{GET:()=>f});var i=r(3277),o=r(5265),a=r(5356),u=r(7076),s=r(7561),c=r.n(s),l=r(9411),d=r.n(l),p=r(1760);async function f(e){let t=e.nextUrl.searchParams.get("file");if(!t||!/^[\w.-]+\.mmd$/.test(t))return u.NextResponse.json({error:"Invalid filename"},{status:400});let r=(0,p.ZN)(),n=d().join(r,"diagrams",t);try{let e=c().readFileSync(n,"utf-8");return u.NextResponse.json({syntax:e})}catch{return u.NextResponse.json({error:`File not found: ${t}`},{status:404})}}let m=new i.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/mermaid/route",pathname:"/api/mermaid",filename:"route",bundlePath:"app/api/mermaid/route"},resolvedPagePath:"/home/dx/Work/hex/dashboard/app/api/mermaid/route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:h,staticGenerationAsyncStorage:x,serverHooks:y}=m,j="/api/mermaid/route";function S(){return(0,a.patchFetch)({serverHooks:y,staticGenerationAsyncStorage:x})}},1760:(e,t,r)=>{r.d(t,{J1:()=>f,V9:()=>m,ZN:()=>p,au:()=>l,gn:()=>s,ki:()=>d,ws:()=>c});var n=r(7561),i=r.n(n),o=r(9411),a=r.n(o);function u(){let e=process.env.HEX_PROJECT_DIR??process.env.SOLAUDIT_PROJECT_DIR??process.cwd();try{let t=a().join(e,".hex","config.json");if(i().existsSync(t))return a().join(e,".hex");let r=a().join(e,".solaudit","config.json");if(i().existsSync(r))return a().join(e,".solaudit")}catch{}return a().join(e,".hex")}function s(e){try{let t=a().join(u(),e),r=i().readFileSync(t,"utf-8");return JSON.parse(r)}catch{return null}}function c(e){try{let t=a().join(u(),e);return i().readFileSync(t,"utf-8")}catch{return null}}function l(e,t){let r=a().join(u(),e);i().writeFileSync(r,JSON.stringify(t,null,2),"utf-8")}function d(e){try{let t=a().join(u(),e);return i().existsSync(t)}catch{return!1}}function p(){return u()}function f(e){try{let t=a().join(u(),e);if(!i().existsSync(t))return[];return i().readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)}catch{return[]}}function m(e){try{let t=a().join(u(),e),r=i().readFileSync(t,"utf-8");return JSON.parse(r)}catch{return null}}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[916,786],()=>r(1671));module.exports=n})();