local z=require("\064\108\117\110\101\047\102\115")local a=require("\064\108\117\110\101\047\112\114\111\099\101\115\115")local h=require("\109\111\100\117\108\101\115\047\066\117\105\108\100\067\111\100\101\103\101\110")local n="\100\105\115\116\047\109\097\105\110\046\108\117\097"local P="\100\105\115\116\047\116\101\109\112\046\108\117\097"local f=z.readFile("\098\117\105\108\100\047\104\101\097\100\101\114\046\108\117\097\117")local function M(h)z.writeFile(P,h)a.spawn("\100\097\114\107\108\117\097",{"\112\114\111\099\101\115\115";P;P;"--\099\111\110\102\105\103";"\098\117\105\108\100\047\100\097\114\107\108\117\097\046\106\115\111\110"})local n=z.readFile(P)z.removeFile(P)return n end local B=z.readFile("\100\105\115\116\047\109\097\105\110\046\114\098\120\109")local s=h(B,false)z.writeFile(n,f..("\n"..M(s)))
local fs = require("@lune/fs")
local process = require("@lune/process")
local BuildCodegen = require("modules/BuildCodegen")

local FilePath = "dist/main.lua"
local TempFile = "dist/temp.lua"
local Header = fs.readFile("build/header.luau")

local function minify(text)
	fs.writeFile(TempFile, text)
    process.spawn("darklua", {"process", TempFile, TempFile, "--config", "build/darklua.json"})
	local value = fs.readFile(TempFile)
	fs.removeFile(TempFile)
	return value
end

local Module = fs.readFile("dist/main.rbxm")
local ModelCodegen = BuildCodegen(Module, false)

fs.writeFile(FilePath, Header .. "\n" .. minify(ModelCodegen))