"use strict";(()=>{vare={};e.id=2927,e.ids=[2927],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},40806:(e,t,a)=>{a.r(t),a.d(t,{config:()=>h,default:()=>I,routeModule:()=>N});varr={};a.r(r),a.d(r,{default:()=>A});vars=a(89947),n=a(2706),l=a(96762),o=a(72583),d=a.n(o),i=a(48786),c=a(98e3),u=a(92652);asyncfunctionp({body:e,update:t}){leta=e.title.toLowerCase().replace(/ /g,"-").replace(/[^a-z0-9\-]/g,""),r=awaitasyncfunction(){if(t)returnnull;try{return(await(0,i.A)("SELECT page_order FROM docs_pages ORDER BY page_order DESC LIMIT 1"))[0].page_order}catch(e){returnnull}}(),s=await(0,c.A)({data:{title:e.title,slug:a,description:d()(e.description,u.A),content:d()(e.content,u.A),text_content:e.text_content,level:e.level,page_order:t?e.page_order:parseInt(r)+1,parent_id:e?.parent_id},tableName:"docs_pages",update:t,duplicateColumnName:"id",duplicateColumnValue:e.id});returns?.insertId?s:t&&s.affectedRows?s:null}asyncfunction_({body:e}){returnawait(0,i.A)("DELETE FROM docs_pages WHERE id=?",[e.id])||null}varE=a(29021),g=a.n(E);asyncfunctionf(){lete="./components/su/components/RichText/html-presets",t=[];returng().existsSync(e)&&g().readdirSync(e).forEach(a=>{if(a?.endsWith(".html")){letr={};r[a.replace(/\.html$/,"")]=g().readFileSync(`${e}/${a}`,"utf-8"),t.push({...r})}}),t}asyncfunctionS({body:e}){lett=await(0,i.A)("SELECT id, title, slug FROM docs_pages WHERE parent_id = ?",[e.pageId]);returnt[0]?t:null}asyncfunctiony({body:e}){returne?.currentPageId?await(0,i.A)("SELECT * FROM docs_pages WHERE level = ? AND id != ?",[e.pagesLevel,e.currentPageId]):await(0,i.A)("SELECT * FROM docs_pages WHERE level = ?",[e.pagesLevel])}asyncfunctionm({body:e}){let{pull:t}=e,a="./jsonData/docs.json";if(t)try{lete=JSON.parse(g().readFileSync(a,"utf-8"));for(lett=0;t<e.length;t++){leta=e[t],r=await(0,i.A)("SELECT id FROM docs_pages WHERE slug = ? AND level = ?",[a.slug,a.level]);if(r&&r[0]){lete={...a};deletee.date_created,deletee.date_created_code,deletee.date_created_timestamp,deletee.date_updated,deletee.date_updated_code,deletee.date_updated_timestamp,deletee.id,await(0,i.A)(`UPDATE docs_pages SET ? WHERE slug = '${a.slug}' AND level = '${a.level}'`,e)}else{lete={...a};deletee.date_created_timestamp,deletee.date_updated_timestamp,await(0,i.A)("INSERT INTO docs_pages SET ?",e)}}}catch(e){returnnull}else{lete=await(0,i.A)("SELECT * FROM docs_pages");g().writeFileSync(a,JSON.stringify(e,null,4),"utf-8")}return!0}varv=a(87369);asyncfunctionA(e,t){if("POST"!==e.method)returnt.json({success:!1,msg:"Wrong Method"});leta=await(0,v.A)(e);if(!a?.logged_in_status)returnt.json({success:!1,log:"Unauthorized"});let{action:r}=e.query,s=e.body;try{lete;switch(r){case"add-page":e=awaitp({body:s});break;case"update-page":e=awaitp({body:s,update:!0});break;case"delete-page":e=await_({body:s});break;case"get-snippets":e=awaitf();break;case"grab-parent-pages":e=awaity({body:s});break;case"get-child-pages":e=awaitS({body:s});break;case"persist":e=awaitm({body:s})}if(!e)throwError("Operation failed!");t.json({success:!0,result:e})}catch(e){t.json({success:!1})}}letI=(0,l.M)(r,"default"),h=(0,l.M)(r,"config"),N=news.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/admin/docs/[action]",pathname:"/api/admin/docs/[action]",bundlePath:"",filename:""},userland:r})},87369:(e,t,a)=>{a.d(t,{A:()=>n});varr=a(95969),s=a(89159);asyncfunctionn(e){let{keyCookieName:t,csrfCookieName:a}=(0,s.A)(),n=`${t}_su`;if(!e.cookies?.[n])returnconsole.log("No auth key cookie found"),null;letl=(0,r.A)({encryptedString:e.cookies[n]});if(!l)returnconsole.log("No user payload found"),null;leto=JSON.parse(l);returno.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):o.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("In