diff --git a/conatiners_minified.lua b/conatiners_minified.lua index 8972fdb..72ece37 100644 --- a/conatiners_minified.lua +++ b/conatiners_minified.lua @@ -1 +1 @@ -local a=(function()local b;do local c="1.0.2-release"local d="LibDeflate"local e=3;local f="LibDeflate "..c.." Copyright (C) 2018-2021 Haoqian He.".." Licensed under the zlib License"if LibStub then local g,h=LibStub:GetLibrary(d,true)if g and h and h>=e then return g else b=LibStub:NewLibrary(d,e)end else b={}end;b._VERSION=c;b._MAJOR=d;b._MINOR=e;b._COPYRIGHT=f end;local assert=assert;local error=error;local pairs=pairs;local i=string.byte;local j=string.char;local k=string.find;local l=string.gsub;local m=string.sub;local n=table.concat;local o=table.sort;local tostring=tostring;local type=type;local p={}local q={}local r={}local s={}local t={}local u={}local v={}local w={}local x={}local y={3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258}local z={0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}local A={[0]=1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577}local B={[0]=0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}local C={16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}local D;local E;local F;local G;local H;local I;local J;local K;for L=0,255 do q[L]=j(L)end;do local M=1;for L=0,32 do p[L]=M;M=M*2 end end;for L=1,9 do r[L]={}for N=0,p[L+1]-1 do local O=0;local P=N;for Q=1,L do O=O-O%2+((O%2==1 or P%2==1)and 1 or 0)P=(P-P%2)/2;O=O*2 end;r[L][N]=(O-O%2)/2 end end;do local R=18;local S=16;local T=265;local U=1;for V=3,258 do if V<=10 then s[V]=V+254;u[V]=0 elseif V==258 then s[V]=285;u[V]=0 else if V>R then R=R+S;S=S*2;T=T+4;U=U+1 end;local W=V-R-1+S/2;s[V]=(W-W%(S/8))/(S/8)+T;u[V]=U;t[V]=W%(S/8)end end end;do v[1]=0;v[2]=1;x[1]=0;x[2]=0;local R=3;local S=4;local X=2;local U=0;for Y=3,256 do if Y>S then R=R*2;S=S*2;X=X+2;U=U+1 end;v[Y]=Y<=R and X or X+1;x[Y]=U<0 and 0 or U;if S>=8 then w[Y]=(Y-S/2-1)%(S/4)end end end;function b:Adler32(Z)if type(Z)~="string"then error(("Usage: LibDeflate:Adler32(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;local _=#Z;local L=1;local R=1;local S=0;while L<=_-15 do local a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,aa,ab,ac,ad,ae,af=i(Z,L,L+15)S=(S+16*R+16*a0+15*a1+14*a2+13*a3+12*a4+11*a5+10*a6+9*a7+8*a8+7*a9+6*aa+5*ab+4*ac+3*ad+2*ae+af)%65521;R=(R+a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+aa+ab+ac+ad+ae+af)%65521;L=L+16 end;while L<=_ do local ag=i(Z,L,L)R=(R+ag)%65521;S=(S+R)%65521;L=L+1 end;return(S*65536+R)%4294967296 end;local function ah(ai,aj)return ai%4294967296==aj%4294967296 end;function b:CreateDictionary(Z,_,ak)if type(Z)~="string"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;if type(_)~="number"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'strlen\' - number expected got \'%s\'."):format(type(_)),2)end;if type(ak)~="number"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'adler32\' - number expected got \'%s\'."):format(type(ak)),2)end;if _~=#Z then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'strlen\' does not match the actual length of \'str\'.".." \'strlen\': %u, \'#str\': %u .".." Please check if \'str\' is modified unintentionally."):format(_,#Z))end;if _==0 then error("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - Empty string is not allowed.",2)end;if _>32768 then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - string longer than 32768 bytes is not allowed.".." Got %d bytes."):format(_),2)end;local al=self:Adler32(Z)if not ah(ak,al)then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'adler32\' does not match the actual adler32 of \'str\'.".." \'adler32\': %u, \'Adler32(str)\': %u .".." Please check if \'str\' is modified unintentionally."):format(ak,al))end;local am={}am.adler32=ak;am.hash_tables={}am.string_table={}am.strlen=_;local an=am.string_table;local ao=am.hash_tables;an[1]=i(Z,1,1)an[2]=i(Z,2,2)if _>=3 then local L=1;local ap=an[1]*256+an[2]while L<=_-2-3 do local a0,a1,a2,a3=i(Z,L+2,L+5)an[L+2]=a0;an[L+3]=a1;an[L+4]=a2;an[L+5]=a3;ap=(ap*256+a0)%16777216;local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a1)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a2)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a3)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1 end;while L<=_-2 do local ag=i(Z,L+2)an[L+2]=ag;ap=(ap*256+ag)%16777216;local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1 end end;return am end;local function aq(am)if type(am)~="table"then return false,("\'dictionary\' - table expected got \'%s\'."):format(type(am))end;if type(am.adler32)~="number"or type(am.string_table)~="table"or type(am.strlen)~="number"or am.strlen<=0 or am.strlen>32768 or am.strlen~=#am.string_table or type(am.hash_tables)~="table"then return false,("\'dictionary\' - corrupted dictionary."):format(type(am))end;return true,""end;local ar={[0]={false,nil,0,0,0},[1]={false,nil,4,8,4},[2]={false,nil,5,18,8},[3]={false,nil,6,32,32},[4]={true,4,4,16,16},[5]={true,8,16,32,32},[6]={true,8,16,128,128},[7]={true,8,32,128,256},[8]={true,32,128,258,1024},[9]={true,32,258,258,4096}}local function as(Z,at,am,au,av)if type(Z)~="string"then return false,("\'str\' - string expected got \'%s\'."):format(type(Z))end;if at then local aw,ax=aq(am)if not aw then return false,ax end end;if au then local ay=type(av)if ay~="nil"and ay~="table"then return false,("\'configs\' - nil or table expected got \'%s\'."):format(type(av))end;if ay=="table"then for az,aA in pairs(av)do if az~="level"and az~="strategy"then return false,("\'configs\' - unsupported table key in the configs: \'%s\'."):format(az)elseif az=="level"and not ar[aA]then return false,("\'configs\' - unsupported \'level\': %s."):format(tostring(aA))elseif az=="strategy"and aA~="fixed"and aA~="huffman_only"and aA~="dynamic"then return false,("\'configs\' - unsupported \'strategy\': \'%s\'."):format(tostring(aA))end end end end;return true,""end;local aB=0;local aC=1;local aD=2;local aE=3;local function aF()local aG=0;local aH=0;local aI=0;local aJ=0;local aK={}local aL={}local function aM(P,U)aH=aH+P*p[aI]aI=aI+U;aJ=aJ+U;if aI>=32 then aG=aG+1;aK[aG]=q[aH%256]..q[(aH-aH%256)/256%256]..q[(aH-aH%65536)/65536%256]..q[(aH-aH%16777216)/16777216%256]local aN=p[32-aI+U]aH=(P-P%aN)/aN;aI=aI-32 end end;local function aO(Z)for Q=1,aI,8 do aG=aG+1;aK[aG]=j(aH%256)aH=(aH-aH%256)/256 end;aI=0;aG=aG+1;aK[aG]=Z;aJ=aJ+#Z*8 end;local function aP(aQ)if aQ==aE then return aJ end;if aQ==aC or aQ==aD then local aR=(8-aI%8)%8;if aI>0 then aH=aH-p[aI]+p[aI+aR]for Q=1,aI,8 do aG=aG+1;aK[aG]=q[aH%256]aH=(aH-aH%256)/256 end;aH=0;aI=0 end;if aQ==aD then aJ=aJ+aR;return aJ end end;local aS=n(aK)aK={}aG=0;aL[#aL+1]=aS;if aQ==aB then return aJ else return aJ,n(aL)end end;return aM,aO,aP end;local function aT(aU,aV,aW)aW=aW+1;aU[aW]=aV;local P=aV[1]local aX=aW;local aY=(aX-aX%2)/2;while aY>=1 and aU[aY][1]>P do local W=aU[aY]aU[aY]=aV;aU[aX]=W;aX=aY;aY=(aY-aY%2)/2 end end;local function aZ(aU,aW)local a_=aU[1]local aV=aU[aW]local P=aV[1]aU[1]=aV;aU[aW]=a_;aW=aW-1;local aX=1;local b0=aX*2;local b1=b0+1;while b0<=aW do local b2=aU[b0]if b1<=aW and aU[b1][1]1 do local bl=aZ(aU,aW)aW=aW-1;local bm=aZ(aU,aW)aW=aW-1;local bn={bl[1]+bm[1],-1,bl,bm}aT(aU,bn,aW)aW=aW+1 end;local bo=0;local bp={aU[1],0,0,0}local bq=1;local br=1;aU[1][1]=0;while br<=bq do local aV=bp[br]local U=aV[1]local bc=aV[2]local b2=aV[3]local b3=aV[4]if b2 then bq=bq+1;bp[bq]=b2;b2[1]=U+1 end;if b3 then bq=bq+1;bp[bq]=b3;b3[1]=U+1 end;br=br+1;if U>b8 then bo=bo+1;U=b8 end;if bc>=0 then b6[bc]=U;bg=bc>bg and bc or bg;b5[U]=(b5[U]or 0)+1 end end;if bo>0 then repeat local U=b8-1;while(b5[U]or 0)==0 do U=U-1 end;b5[U]=b5[U]-1;b5[U+1]=(b5[U+1]or 0)+2;b5[b8]=b5[b8]-1;bo=bo-2 until bo<=0;br=1;for U=b8,1,-1 do local bs=b5[U]or 0;while bs>0 do local bc=bh[br][2]b6[bc]=U;bs=bs-1;br=br+1 end end end;bi=b4(b5,b6,b7,b8)return b6,bi,bg end end;local function bt(bu,bv,bw,bx)local by=0;local bz={}local bA={}local bB=0;local bC={}local bD=nil;local bk=0;bx=bx<0 and 0 or bx;local bE=bv+bx+1;for X=0,bE+1 do local V=X<=bv and(bu[X]or 0)or(X<=bE and(bw[X-bv-1]or 0)or nil)if V==bD then bk=bk+1;if V~=0 and bk==6 then by=by+1;bz[by]=16;bB=bB+1;bC[bB]=3;bA[16]=(bA[16]or 0)+1;bk=0 elseif V==0 and bk==138 then by=by+1;bz[by]=18;bB=bB+1;bC[bB]=127;bA[18]=(bA[18]or 0)+1;bk=0 end else if bk==1 then by=by+1;bz[by]=bD;bA[bD]=(bA[bD]or 0)+1 elseif bk==2 then by=by+1;bz[by]=bD;by=by+1;bz[by]=bD;bA[bD]=(bA[bD]or 0)+2 elseif bk>=3 then by=by+1;local bF=bD~=0 and 16 or(bk<=10 and 17 or 18)bz[by]=bF;bA[bF]=(bA[bF]or 0)+1;bB=bB+1;bC[bB]=bk<=10 and bk-3 or bk-11 end;bD=V;if V and V~=0 then by=by+1;bz[by]=V;bA[V]=(bA[V]or 0)+1;bk=0 else bk=1 end end end;return bz,bC,bA end;local function bG(Z,W,bH,bI,bJ)local L=bH-bJ;while L<=bI-15-bJ do W[L],W[L+1],W[L+2],W[L+3],W[L+4],W[L+5],W[L+6],W[L+7],W[L+8],W[L+9],W[L+10],W[L+11],W[L+12],W[L+13],W[L+14],W[L+15]=i(Z,L+bJ,L+15+bJ)L=L+16 end;while L<=bI-bJ do W[L]=i(Z,L+bJ,L+bJ)L=L+1 end;return W end;local function bK(bL,an,ao,bM,bN,bJ,am)local bO=ar[bL]local bP,bQ,bR,bS,bT=bO[1],bO[2],bO[3],bO[4],bO[5]local bU=not bP and bR or 2147483646;local bV=bT-bT%4/4;local ap;local bW;local bX;local bY=0;if am then bW=am.hash_tables;bX=am.string_table;bY=am.strlen;assert(bM==1)if bN>=bM and bY>=2 then ap=bX[bY-1]*65536+bX[bY]*256+an[1]local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=-1 end;if bN>=bM+1 and bY>=1 then ap=bX[bY]*65536+an[1]*256+an[2]local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=0 end end;local bZ=bY+3;ap=(an[bM-bJ]or 0)*256+(an[bM+1-bJ]or 0)local b_={}local c0=0;local c1={}local c2={}local c3=0;local c4={}local c5={}local c6=0;local c7={}local c8=0;local c9=false;local ca;local cb;local cc=0;local cd=0;local br=bM;local ce=bN+(bP and 1 or 0)while br<=ce do local cf=br-bJ;local cg=bJ-3;ca=cc;cb=cd;cc=0;ap=(ap*256+(an[cf+2]or 0))%16777216;local ch;local ci;local cj=ao[ap]local ck;if not cj then ck=0;cj={}ao[ap]=cj;if bW then ci=bW[ap]ch=ci and#ci or 0 else ch=0 end else ck=#cj;ci=cj;ch=ck end;if br<=bN then cj[ck+1]=br end;if ch>0 and br+2<=bN and(not bP or ca=bQ and bV or bT;local cm=bN-br;cm=cm>=257 and 257 or cm;cm=cm+cf;local cn=cf+3;while ch>=1 and cl>0 do local bD=ci[ch]if br-bD>32768 then break end;if bD
=-257 then local cp=bD-cg;while co<=cm and an[cp]==an[co]do co=co+1;cp=cp+1 end else local cp=bZ+bD;while co<=cm and bX[cp]==an[co]do co=co+1;cp=cp+1 end end;local N=co-cf;if N>cc then cc=N;cd=br-bD end;if cc>=bS then break end end;ch=ch-1;cl=cl-1;if ch==0 and bD>0 and bW then ci=bW[ap]ch=ci and#ci or 0 end end end;if not bP then ca,cb=cc,cd end;if(not bP or c9)and(ca>3 or ca==3 and cb<4096)and cc<=ca then local X=s[ca]local cq=u[ca]local cr,cs,ct;if cb<=256 then cr=v[cb]ct=w[cb]cs=x[cb]else cr=16;cs=7;local R=384;local S=512;while true do if cb<=R then ct=(cb-S/2-1)%(S/4)break elseif cb<=S then ct=(cb-S/2-1)%(S/4)cr=cr+1;break else cr=cr+2;cs=cs+1;R=R*2;S=S*2 end end end;c0=c0+1;b_[c0]=X;c1[X]=(c1[X]or 0)+1;c3=c3+1;c2[c3]=cr;c4[cr]=(c4[cr]or 0)+1;if cq>0 then local cu=t[ca]c6=c6+1;c5[c6]=cu end;if cs>0 then c8=c8+1;c7[c8]=ct end;for L=br+1,br+ca-(bP and 2 or 1)do ap=(ap*256+(an[L-bJ+2]or 0))%16777216;if ca<=bU then cj=ao[ap]if not cj then cj={}ao[ap]=cj end;cj[#cj+1]=L end end;br=br+ca-(bP and 1 or 0)c9=false elseif not bP or c9 then local X=an[bP and cf-1 or cf]c0=c0+1;b_[c0]=X;c1[X]=(c1[X]or 0)+1;br=br+1 else c9=true;br=br+1 end end;c0=c0+1;b_[c0]=256;c1[256]=(c1[256]or 0)+1;return b_,c5,c1,c2,c7,c4 end;local function cv(c1,c4)local cw,cx,bv=be(c1,15,285)local cy,cz,bx=be(c4,15,29)local cA,bC,cB=bt(cw,bv,cy,bx)local cC,cD=be(cB,7,18)local cE=0;for L=1,19 do local bc=C[L]local cF=cC[bc]or 0;if cF~=0 then cE=L end end;cE=cE-4;local cG=bv+1-257;local cH=bx+1-1;if cH<0 then cH=0 end;return cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz end;local function cI(b_,c2,cE,cC,cA,cw,cy)local cJ=17;cJ=cJ+(cE+4)*3;for L=1,#cA do local X=cA[L]cJ=cJ+cC[X]if X>=16 then cJ=cJ+(X==16 and 2 or(X==17 and 3 or 7))end end;local cK=0;for L=1,#b_ do local X=b_[L]local cL=cw[X]cJ=cJ+cL;if X>256 then cK=cK+1;if X>264 and X<285 then local cM=z[X-256]cJ=cJ+cM end;local cr=c2[cK]local cN=cy[cr]cJ=cJ+cN;if cr>3 then local cs=(cr-cr%2)/2-1;cJ=cJ+cs end end end;return cJ end;local function cO(aM,cP,b_,c5,c2,c7,cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz)aM(cP and 1 or 0,1)aM(2,2)aM(cG,5)aM(cH,5)aM(cE,4)for L=1,cE+4 do local bc=C[L]local cF=cC[bc]or 0;aM(cF,3)end;local cQ=1;for L=1,#cA do local X=cA[L]aM(cD[X],cC[X])if X>=16 then local cR=bC[cQ]aM(cR,X==16 and 2 or(X==17 and 3 or 7))cQ=cQ+1 end end;local cK=0;local cS=0;local cT=0;for L=1,#b_ do local cU=b_[L]local b9=cx[cU]local cL=cw[cU]aM(b9,cL)if cU>256 then cK=cK+1;if cU>264 and cU<285 then cS=cS+1;local cV=c5[cS]local cM=z[cU-256]aM(cV,cM)end;local cW=c2[cK]local cX=cz[cW]local cN=cy[cW]aM(cX,cN)if cW>3 then cT=cT+1;local ct=c7[cT]local cs=(cW-cW%2)/2-1;aM(ct,cs)end end end end;local function cY(b_,c2)local cJ=3;local cK=0;for L=1,#b_ do local X=b_[L]local cL=F[X]cJ=cJ+cL;if X>256 then cK=cK+1;if X>264 and X<285 then local cM=z[X-256]cJ=cJ+cM end;local cr=c2[cK]cJ=cJ+5;if cr>3 then local cs=(cr-cr%2)/2-1;cJ=cJ+cs end end end;return cJ end;local function cZ(aM,cP,b_,c5,c2,c7)aM(cP and 1 or 0,1)aM(1,2)local cK=0;local cS=0;local cT=0;for L=1,#b_ do local c_=b_[L]local b9=D[c_]local cL=F[c_]aM(b9,cL)if c_>256 then cK=cK+1;if c_>264 and c_<285 then cS=cS+1;local cV=c5[cS]local cM=z[c_-256]aM(cV,cM)end;local cr=c2[cK]local cX=H[cr]aM(cX,5)if cr>3 then cT=cT+1;local ct=c7[cT]local cs=(cr-cr%2)/2-1;aM(ct,cs)end end end end;local function d0(bM,bN,aJ)assert(bN-bM+1<=65535)local cJ=3;aJ=aJ+3;local aR=(8-aJ%8)%8;cJ=cJ+aR;cJ=cJ+32;cJ=cJ+(bN-bM+1)*8;return cJ end;local function d1(aM,aO,cP,Z,bM,bN,aJ)assert(bN-bM+1<=65535)aM(cP and 1 or 0,1)aM(0,2)aJ=aJ+3;local aR=(8-aJ%8)%8;if aR>0 then aM(p[aR]-1,aR)end;local d2=bN-bM+1;aM(d2,16)local d3=255-d2%256+(255-(d2-d2%256)/256)*256;aM(d3,16)aO(Z:sub(bM,bN))end;local function d4(av,aM,aO,aP,Z,am)local an={}local ao={}local cP=nil;local bM;local bN;local d5;local aJ=aP(aE)local _=#Z;local bJ;local bL;local d6;if av then if av.level then bL=av.level end;if av.strategy then d6=av.strategy end end;if not bL then if _<2048 then bL=7 elseif _>65536 then bL=3 else bL=5 end end;while not cP do if not bM then bM=1;bN=64*1024-1;bJ=0 else bM=bN+1;bN=bN+32*1024;bJ=bM-32*1024-1 end;if bN>=_ then bN=_;cP=true else cP=false end;local b_,c5,c1,c2,c7,c4;local cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz;local d7;local d8;local d9;if bL~=0 then bG(Z,an,bM,bN+3,bJ)if bM==1 and am then local bX=am.string_table;local da=am.strlen;for L=0,-da+1<-257 and-257 or-da+1,-1 do an[L]=bX[da+L]end end;if d6=="huffman_only"then b_={}bG(Z,b_,bM,bN,bM-1)c5={}c1={}b_[bN-bM+2]=256;for L=1,bN-bM+2 do local X=b_[L]c1[X]=(c1[X]or 0)+1 end;c2={}c7={}c4={}else b_,c5,c1,c2,c7,c4=bK(bL,an,ao,bM,bN,bJ,am)end;cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz=cv(c1,c4)d7=cI(b_,c2,cE,cC,cA,cw,cy)d8=cY(b_,c2)end;d9=d0(bM,bN,aJ)local db=d9;db=d8 and d80 and bN+1-W[1]>32768 then if dc==1 then ao[az]=nil else local dd={}local de=0;for L=2,dc do N=W[L]if bN+1-N<=32768 then de=de+1;dd[de]=N end end;ao[az]=dd end end end end end end;local function df(Z,am,av)local aM,aO,aP=aF()d4(av,aM,aO,aP,Z,am)local aJ,dg=aP(aC)local aR=(8-aJ%8)%8;return dg,aR end;local function dh(Z,am,av)local aM,aO,aP=aF()local di=8;local dj=7;local dk=dj*16+di;aM(dk,8)local dl=am and 1 or 0;local dm=2;local dn=dm*64+dl*32;local dp=31-(dk*256+dn)%31;dn=dn+dp;aM(dn,8)if dl==1 then local ak=am.adler32;local dq=ak%256;ak=(ak-dq)/256;local dr=ak%256;ak=(ak-dr)/256;local ds=ak%256;ak=(ak-ds)/256;local dt=ak%256;aM(dt,8)aM(ds,8)aM(dr,8)aM(dq,8)end;d4(av,aM,aO,aP,Z,am)aP(aD)local ak=b:Adler32(Z)local dt=ak%256;ak=(ak-dt)/256;local ds=ak%256;ak=(ak-ds)/256;local dr=ak%256;ak=(ak-dr)/256;local dq=ak%256;aM(dq,8)aM(dr,8)aM(ds,8)aM(dt,8)local aJ,dg=aP(aC)local aR=(8-aJ%8)%8;return dg,aR end;function b:CompressDeflate(Z,av)local du,dv=as(Z,false,nil,true,av)if not du then error("Usage: LibDeflate:CompressDeflate(str, configs): "..dv,2)end;return df(Z,nil,av)end;function b:CompressDeflateWithDict(Z,am,av)local du,dv=as(Z,true,am,true,av)if not du then error("Usage: LibDeflate:CompressDeflateWithDict".."(str, dictionary, configs): "..dv,2)end;return df(Z,am,av)end;function b:CompressZlib(Z,av)local du,dv=as(Z,false,nil,true,av)if not du then error("Usage: LibDeflate:CompressZlib(str, configs): "..dv,2)end;return dh(Z,nil,av)end;function b:CompressZlibWithDict(Z,am,av)local du,dv=as(Z,true,am,true,av)if not du then error("Usage: LibDeflate:CompressZlibWithDict".."(str, dictionary, configs): "..dv,2)end;return dh(Z,am,av)end;local function dw(dx)local dy=dx;local dz=#dx;local dA=1;local aI=0;local aH=0;local function dB(U)local aN=p[U]local X;if U<=aI then X=aH%aN;aH=(aH-X)/aN;aI=aI-U else local dC=p[aI]local dr,ds,dt,dD=i(dy,dA,dA+3)aH=aH+((dr or 0)+(ds or 0)*256+(dt or 0)*65536+(dD or 0)*16777216)*dC;dA=dA+4;aI=aI+32-U;X=aH%aN;aH=(aH-X)/aN end;return X end;local function dE(dF,aK,aG)assert(aI%8==0)local dG=aI/80 then if aI<15 and dy then local dC=p[aI]local dr,ds,dt,dD=i(dy,dA,dA+3)aH=aH+((dr or 0)+(ds or 0)*256+(dt or 0)*65536+(dD or 0)*16777216)*dC;dA=dA+4;aI=aI+32 end;local aN=p[db]aI=aI-db;X=aH%aN;aH=(aH-X)/aN;X=r[db][X]bk=dJ[db]if X0 and U285 then return-10 elseif bc<256 then aG=aG+1;aK[aG]=q[bc]elseif bc>256 then bc=bc-256;local U=y[bc]U=bc>=8 and U+dB(z[bc])or U;bc=dI(cy,d_,e0)if bc<0 or bc>29 then return-10 end;local Y=A[bc]Y=Y>4 and Y+dB(B[bc])or Y;local e2=aG-Y+1;if e2=-257 then for Q=1,U do aG=aG+1;aK[aG]=aK[e2]e2=e2+1 end else e2=da+e2;for Q=1,U do aG=aG+1;aK[aG]=q[bX[e2]]e2=e2+1 end end end;if dO()<0 then return 2 end;if aG>=65536 then aL[#aL+1]=n(aK,"",1,32768)for L=32769,aG do aK[L-32768]=aK[L]end;aG=aG-32768;aK[aG+1]=nil end until bc==256;dS.buffer_size=aG;return 0 end;local function e3(dS)local aK,aG,dB,dE,dO,dP,aL=dS.buffer,dS.buffer_size,dS.ReadBits,dS.ReadBytes,dS.ReaderBitlenLeft,dS.SkipToByteBoundary,dS.result_buffer;dP()local dF=dB(16)if dO()<0 then return 2 end;local e4=dB(16)if dO()<0 then return 2 end;if dF%256+e4%256~=255 then return-2 end;if(dF-dF%256)/256+(e4-e4%256)/256~=255 then return-2 end;aG=dE(dF,aK,aG)if aG<0 then return 2 end;if aG>=65536 then aL[#aL+1]=n(aK,"",1,32768)for L=32769,aG do aK[L-32768]=aK[L]end;aG=aG-32768;aK[aG+1]=nil end;dS.buffer_size=aG;return 0 end;local function e5(dS)return dX(dS,G,E,7,K,I,5)end;local function e6(dS)local dB,dI=dS.ReadBits,dS.Decode;local e7=dB(5)+257;local e8=dB(5)+1;local e9=dB(4)+4;if e7>286 or e8>30 then return-3 end;local cC={}for L=1,e9 do cC[C[L]]=dB(3)end;local ea,eb,ec,ed=dT(cC,18,7)if ea~=0 then return-4 end;local cw={}local cy={}local br=0;while bre7+e8 then return-6 end;while bc>0 do bc=bc-1;if br7 then return nil,-13 end;local dn=dB(8)if dS.ReaderBitlenLeft()<0 then return nil,2 end;if(dk*256+dn)%31~=0 then return nil,-14 end;local dl=(dn-dn%32)/32%2;local dm=(dn-dn%64)/64%4;if dl==1 then if not am then return nil,-16 end;local dt=dB(8)local ds=dB(8)local dr=dB(8)local dq=dB(8)local al=dt*16777216+ds*65536+dr*256+dq;if dS.ReaderBitlenLeft()<0 then return nil,2 end;if not ah(al,am.adler32)then return nil,-17 end end;local dg,ek=ei(dS)if not dg then return nil,ek end;dS.SkipToByteBoundary()local ep=dB(8)local eq=dB(8)local er=dB(8)local es=dB(8)if dS.ReaderBitlenLeft()<0 then return nil,2 end;local et=ep*16777216+eq*65536+er*256+es;local eu=b:Adler32(dg)if not ah(et,eu)then return nil,-15 end;local em=dS.ReaderBitlenLeft()local en=(em-em%8)/8;return dg,en end;function b:DecompressDeflate(Z)local du,dv=as(Z)if not du then error("Usage: LibDeflate:DecompressDeflate(str): "..dv,2)end;return el(Z)end;function b:DecompressDeflateWithDict(Z,am)local du,dv=as(Z,true,am)if not du then error("Usage: LibDeflate:DecompressDeflateWithDict(str, dictionary): "..dv,2)end;return el(Z,am)end;function b:DecompressZlib(Z)local du,dv=as(Z)if not du then error("Usage: LibDeflate:DecompressZlib(str): "..dv,2)end;return eo(Z)end;function b:DecompressZlibWithDict(Z,am)local du,dv=as(Z,true,am)if not du then error("Usage: LibDeflate:DecompressZlibWithDict(str, dictionary): "..dv,2)end;return eo(Z,am)end;do F={}for ev=0,143 do F[ev]=8 end;for ev=144,255 do F[ev]=9 end;for ev=256,279 do F[ev]=7 end;for ev=280,287 do F[ev]=8 end;J={}for Y=0,31 do J[Y]=5 end;local ek;ek,G,E=dT(F,287,9)assert(ek==0)ek,K,I=dT(J,31,5)assert(ek==0)D=b4(G,F,287,9)H=b4(K,J,31,5)end;local ew={["\000"]="%z",["("]="%(",[")"]="%)",["."]="%.",["%"]="%%",["+"]="%+",["-"]="%-",["*"]="%*",["?"]="%?",["["]="%[",["]"]="%]",["^"]="%^",["$"]="%$"}local function ex(Z)return Z:gsub("([%z%(%)%.%%%+%-%*%?%[%]%^%$])",ew)end;function b:CreateCodec(ey,ez,eA)if type(ey)~="string"or type(ez)~="string"or type(eA)~="string"then error("Usage: LibDeflate:CreateCodec(reserved_chars,".." escape_chars, map_chars):".." All arguments must be string.",2)end;if ez==""then return nil,"No escape characters supplied."end;if#ey<#eA then return nil,"The number of reserved characters must be".." at least as many as the number of mapped chars."end;if ey==""then return nil,"No characters to encode."end;local eB=ey..ez..eA;local eC={}for L=1,#eB do local dH=i(eB,L,L)if eC[dH]then return nil,"There must be no duplicate characters in the".." concatenation of reserved_chars, escape_chars and".." map_chars."end;eC[dH]=true end;local eD={}local eE={}local eF={}local eG={}if#eA>0 then local eH={}local eI={}for L=1,#eA do local eJ=m(ey,L,L)local eK=m(eA,L,L)eG[eJ]=eK;eF[#eF+1]=eJ;eI[eK]=eJ;eH[#eH+1]=eK end;eD[#eD+1]="(["..ex(n(eH)).."])"eE[#eE+1]=eI end;local eL=1;local eM=m(ez,eL,eL)local eN=0;local eH={}local eI={}for L=1,#eB do local T=m(eB,L,L)if not eG[T]then while eN>=256 or eC[eN]do eN=eN+1;if eN>255 then eD[#eD+1]=ex(eM).."(["..ex(n(eH)).."])"eE[#eE+1]=eI;eL=eL+1;eM=m(ez,eL,eL)eN=0;eH={}eI={}if not eM or eM==""then return nil,"Out of escape characters."end end end;local eO=q[eN]eG[T]=eM..eO;eF[#eF+1]=T;eI[eO]=T;eH[#eH+1]=eO;eN=eN+1 end;if L==#eB then eD[#eD+1]=ex(eM).."(["..ex(n(eH)).."])"eE[#eE+1]=eI end end;local eP={}local eQ="(["..ex(n(eF)).."])"local eR=eG;function eP:Encode(Z)if type(Z)~="string"then error(("Usage: codec:Encode(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;return l(Z,eQ,eR)end;local eS=#eD;local eT="(["..ex(ey).."])"function eP:Decode(Z)if type(Z)~="string"then error(("Usage: codec:Decode(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;if k(Z,eT)then return nil end;for L=1,eS do Z=l(Z,eD[L],eE[L])end;return Z end;return eP end;local eU={[0]="a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9","(",")"}local eV={[97]=0,[98]=1,[99]=2,[100]=3,[101]=4,[102]=5,[103]=6,[104]=7,[105]=8,[106]=9,[107]=10,[108]=11,[109]=12,[110]=13,[111]=14,[112]=15,[113]=16,[114]=17,[115]=18,[116]=19,[117]=20,[118]=21,[119]=22,[120]=23,[121]=24,[122]=25,[65]=26,[66]=27,[67]=28,[68]=29,[69]=30,[70]=31,[71]=32,[72]=33,[73]=34,[74]=35,[75]=36,[76]=37,[77]=38,[78]=39,[79]=40,[80]=41,[81]=42,[82]=43,[83]=44,[84]=45,[85]=46,[86]=47,[87]=48,[88]=49,[89]=50,[90]=51,[48]=52,[49]=53,[50]=54,[51]=55,[52]=56,[53]=57,[54]=58,[55]=59,[56]=60,[57]=61,[40]=62,[41]=63}function b:EncodeForPrint(Z)if type(Z)~="string"then error(("Usage: LibDeflate:EncodeForPrint(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;local _=#Z;local eW=_-2;local L=1;local aK={}local aG=0;while L<=eW do local a0,a1,a2=i(Z,L,L+2)L=L+3;local aH=a0+a1*256+a2*65536;local eX=aH%64;aH=(aH-eX)/64;local eY=aH%64;aH=(aH-eY)/64;local eZ=aH%64;local e_=(aH-eZ)/64;aG=aG+1;aK[aG]=eU[eX]..eU[eY]..eU[eZ]..eU[e_]end;local aH=0;local aI=0;while L<=_ do local ag=i(Z,L,L)aH=aH+ag*p[aI]aI=aI+8;L=L+1 end;while aI>0 do local f0=aH%64;aG=aG+1;aK[aG]=eU[f0]aH=(aH-f0)/64;aI=aI-6 end;return n(aK)end;function b:DecodeForPrint(Z)if type(Z)~="string"then error(("Usage: LibDeflate:DecodeForPrint(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;Z=Z:gsub("^[%c ]+","")Z=Z:gsub("[%c ]+$","")local _=#Z;if _==1 then return nil end;local f1=_-3;local L=1;local aK={}local aG=0;while L<=f1 do local a0,a1,a2,a3=i(Z,L,L+3)a0=eV[a0]a1=eV[a1]a2=eV[a2]a3=eV[a3]if not(a0 and a1 and a2 and a3)then return nil end;L=L+4;local aH=a0+a1*64+a2*4096+a3*262144;local eX=aH%256;aH=(aH-eX)/256;local eY=aH%256;local eZ=(aH-eY)/256;aG=aG+1;aK[aG]=q[eX]..q[eY]..q[eZ]end;local aH=0;local aI=0;while L<=_ do local ag=i(Z,L,L)ag=eV[ag]if not ag then return nil end;aH=aH+ag*p[aI]aI=aI+6;L=L+1 end;while aI>=8 do local dH=aH%256;aG=aG+1;aK[aG]=q[dH]aH=(aH-dH)/256;aI=aI-8 end;return n(aK)end;local function f2()_chat_channel_codec=nil;_addon_channel_codec=nil end;b.internals={LoadStringToTable=bG,IsValidDictionary=aq,IsEqualAdler32=ah,_byte_to_6bit_char=eU,_6bit_to_byte=eV,InternalClearCache=f2}if io and os and debug and _G.arg then local io=io;local os=os;local debug=debug;local f3=_G.arg;local f4=debug.getinfo(1)if f4.source==f3[0]or f4.short_src==f3[0]then local dy;local f5;local L=1;local ek;local f6=false;local f7=false;local bL;local d6;local am;while f3[L]do local R=f3[L]if R=="-h"then print(b._COPYRIGHT.."\nUsage: lua LibDeflate.lua [OPTION] [INPUT] [OUTPUT]\n".." -0 store only. no compression.\n".." -1 fastest compression.\n".." -9 slowest and best compression.\n".." -d do decompression instead of compression.\n".." --dict specify the file that contains".." the entire preset dictionary.\n".." -h give this help.\n".." --strategy ".." specify a special compression strategy.\n".." -v print the version and copyright info.\n".." --zlib use zlib format instead of raw deflate.\n")os.exit(0)elseif R=="-v"then print(b._COPYRIGHT)os.exit(0)elseif R:find("^%-[0-9]$")then bL=tonumber(R:sub(2,2))elseif R=="-d"then f7=true elseif R=="--dict"then L=L+1;local f8=f3[L]if not f8 then io.stderr:write("You must speicify the dict filename")os.exit(1)end;local f9,fa=io.open(f8,"rb")if not f9 then io.stderr:write(("LibDeflate: Cannot read the dictionary file \'%s\': %s"):format(f8,fa))os.exit(1)end;local fb=f9:read("*all")f9:close()am=b:CreateDictionary(fb,#fb,b:Adler32(fb))elseif R=="--strategy"then L=L+1;d6=f3[L]elseif R=="--zlib"then f6=true elseif R:find("^%-")then io.stderr:write(("LibDeflate: Invalid argument: %s"):format(R))os.exit(1)else if not dy then dy,ek=io.open(R,"rb")if not dy then io.stderr:write(("LibDeflate: Cannot read the file \'%s\': %s"):format(R,tostring(ek)))os.exit(1)end elseif not f5 then f5,ek=io.open(R,"wb")if not f5 then io.stderr:write(("LibDeflate: Cannot write the file \'%s\': %s"):format(R,tostring(ek)))os.exit(1)end end end;L=L+1 end;if not dy or not f5 then io.stderr:write("LibDeflate:".." You must specify both input and output files.")os.exit(1)end;local fc=dy:read("*all")local av={level=bL,strategy=d6}local fd;if not f7 then if not f6 then if not am then fd=b:CompressDeflate(fc,av)else fd=b:CompressDeflateWithDict(fc,am,av)end else if not am then fd=b:CompressZlib(fc,av)else fd=b:CompressZlibWithDict(fc,am,av)end end else if not f6 then if not am then fd=b:DecompressDeflate(fc)else fd=b:DecompressDeflateWithDict(fc,am)end else if not am then fd=b:DecompressZlib(fc)else fd=b:DecompressZlibWithDict(fc,am)end end end;if not fd then io.stderr:write("LibDeflate: Decompress fails.")os.exit(1)end;f5:write(fd)if dy and dy~=io.stdin then dy:close()end;if f5 and f5~=io.stdout then f5:close()end;io.stderr:write(("Successfully writes %d bytes"):format(fd:len()))os.exit(0)end end;return b end)()local fe=dofile("rom/modules/main/cc/expect.lua")local fe,ff=fe.expect,fe.field;local fg=nil;settings.define("containers.compression_level",{description="The level of compression for the file systems on a scale of 1-8",default=4,type="number"})settings.save()local fh=settings.get("containers.compression_level")local fi={}local function fj(p,fk)fk=fk or{}if p==nil then return nil end;if fk[p]then return fk[p]end;local fl;if type(p)=='table'then fl={}fk[p]=fl;for l,w in next,p,nil do fl[fj(l,fk)]=fj(w,fk)end;setmetatable(fl,fj(getmetatable(p),fk))else fl=p end;return fl end;local function fm(fn)sleep()local fo={}for a0,fp in ipairs(fs.list(fn))do local fq=fs.combine(fn,fp)if fs.isDir(fq)then fo[fp]=fm(fq)else local fr=fs.open(fq,"r")fo[fp]=fr.readAll()fr.close()end end;return fo end;local function ft()if not _G.rom_cache then _G.rom_cache=fm("/rom")end;return _G.rom_cache end;function fi.getENV(fu,fv)local fw=fj(_G)setmetatable(fw,{__index=_G})local function fx()if fg then fg.rom=ft()return fg end;if not fs.exists(fu)then return{rom=ft()}end;local fp=fs.open(fu,"r")local fy=fp.readAll()fp.close()local fz=a:DecompressDeflate(fy,{level=fh})local fA=textutils.unserialize(fz)or{}fg=fA;fA.rom=ft()return fA end;local function fB(fA)fg=fA;fA.rom=nil;fA=textutils.serialize(fA)local fp=fs.open(fu,"w")fp.write(a:CompressDeflate(fA,{level=fh}))fp.close()end;local function fC(fn)local fD={}for fE in string.gmatch(fn,"[^/]+")do if fE==""or fE=="."then elseif fE==".."then if#fD>0 then table.remove(fD)end else fD[#fD+1]=fE end end;return fD end;local function fF(fn)fe(1,fn,"string")local fD=fC(fn)local fG=fx()if#fD==0 then return fG end;for j=1,#fD do local fE=fD[j]if type(fG)~="table"then return nil end;fG=fG[fE]if fG==nil then return nil end end;return fG end;local function fH(fn,fA)fe(1,fn,"string")local fD=fC(fn)local fI=fx()local fG=fI;for j,fE in ipairs(fD)do if j==#fD then fG[fE]=fA elseif type(fG[fE])=="table"then fG=fG[fE]elseif type(fG[fE])=="string"then return end end;fB(fI)end;function fw.fs.list(fn)fe(1,fn,"string")local fo={}local fA=fF(fn)if fA then for l,w in pairs(fA)do table.insert(fo,l)end end;return fo end;function fw.fs.isDir(fn)fe(1,fn,"string")local fA=fF(fn)return type(fA)=="table"end;function fw.fs.isReadOnly(fn)if fn==""then return false end;fe(1,fn,"string")local fJ=string.find(fn,"rom")return fJ~=nil and fJ<3 end;function fw.fs.exists(fn)fe(1,fn,"string")local fA=fF(fn)return fA~=nil end;function fw.fs.complete(fK,fL,fM,fN)fe(1,fK,"string")fe(2,fL,"string")local fO=nil;if type(fM)=="table"then fN=ff(fM,"include_dirs","boolean","nil")fO=ff(fM,"include_hidden","boolean","nil")fM=ff(fM,"include_files","boolean","nil")else fe(3,fM,"boolean","nil")fe(4,fN,"boolean","nil")end;fO=fO~=false;fM=fM~=false;fN=fN~=false;local fP=fL;local fQ=1;local fR=string.find(fK,"[/\\]",fQ)if fR==1 then fP=""fQ=2 end;local fS;while not fS do local fR=string.find(fK,"[/\\]",fQ)if fR then local fT=string.sub(fK,fQ,fR-1)fP=fw.fs.combine(fP,fT)fQ=fR+1 else fS=string.sub(fK,fQ)end end;if fw.fs.isDir(fP)then local fU={}if fN and fK==""then table.insert(fU,".")end;if fP~=""then if fK==""then table.insert(fU,fN and".."or"../")elseif fK=="."then table.insert(fU,fN and"."or"./")end end;local fV=fw.fs.list(fP)for o=1,#fV do local fW=fV[o]if#fW>=#fS and string.sub(fW,1,#fS)==fS and(fO or fW:sub(1,1)~="."or fS:sub(1,1)==".")then local fX=fw.fs.isDir(fs.combine(fP,fW))local fY=string.sub(fW,#fS+1)if fX then table.insert(fU,fY.."/")if fN and#fY>0 then table.insert(fU,fY)end else if fM and#fY>0 then table.insert(fU,fY)end end end end;return fU end;return{}end;local function fZ(fn,f_)fe(1,fn,"string")local fA=fF(fn)or""local g0=#fA;local g1=1;return{readAll=function()if fA==nil then return nil end;fA=fA:sub(g1)g1=g0+1;return fA end,readLine=function(g2)if fA==nil then return nil end;if g1>g0 then return nil end;local g3=g1;local g4=fA:find("\n",g3,true)local g5;if g4 then if g2 then g5=fA:sub(g3,g4)else g5=fA:sub(g3,g4-1)end;g1=g4+1 else g5=fA:sub(g3)g1=g0+1 end;return g5 end,read=function(g6)if type(g6)=="table"then g6=1 end;fe(1,g6,"number","nil")if fA==nil then return nil end;if not g6 then g6=1 end;if g1>g0 then return nil end;local g7=string.sub(fA,g1,g1+g6-1)g1=g1+#g7;if g7==""then return nil elseif f_ and g6==1 then return string.byte(g7)end;return g7 end,seek=function(fJ,g8)if fA==nil then return nil,"File is closed"end;fJ=fJ or 0;g8=g8 or"cur"if g8=="set"then g1=math.min(math.max(0,fJ),g0)+1 elseif g8=="cur"then g1=math.min(math.max(1,g1+fJ),g0+1)elseif g8=="end"then g1=math.min(math.max(0,g0+fJ),g0)+1 end;return g1-1 end,close=function()fA=nil end}end;local function g9(fn,f_,ga)local fA=""local g1=1;if ga then fA=fF(fn)or""g1=#fA+1 end;local fr;local function gb(gc)if fA==nil then error("File is closed",2)end;if type(gc)=="number"and f_ then gc=string.char(gc)elseif type(gc)~="string"then error("bad argument #1 (string or number expected, got "..type(gc).." )",2)end;fA=string.sub(fA,1,g1-1)..gc..string.sub(fA,g1+#gc)g1=g1+#gc end;fr={write=gb,writeLine=function(gc)if fA==nil then error("File is closed",2)end;fe(1,gc,"string")gb(gc.."\n")end,flush=function()if fA==nil then error("File is closed",2)end;fH(fn,fA)end,close=function()if fA==nil then error("File is already closed",2)end;fH(fn,fA)fA=nil end}return fr end;local function gd(fn,f_,ge)fe(1,fn,"string")local fA=ge and""or(fF(fn)or"")local g0=#fA;local g1=1;local fr={}fr.readAll=function()if fA==nil then return nil end;fA=fA:sub(g1)g1=g0+1;return fA end;fr.readLine=function(g2)if fA==nil then return nil end;if g1>g0 then return nil end;local g3=g1;local g4=fA:find("\n",g3,true)local g5;if g4 then if g2 then g5=fA:sub(g3,g4)else g5=fA:sub(g3,g4-1)end;g1=g4+1 else g5=fA:sub(g3)g1=g0+1 end;return g5 end;function fr.read(g6)if type(g6)=="table"then g6=1 end;fe(1,g6,"number","nil")if fA==nil then error("File is closed",2)end;if not g6 then g6=1 end;if g1>g0 then return nil end;local g7=fA:sub(g1,g1+g6-1)g1=g1+#g7;if g7==""then return nil elseif f_ and g6==1 then return string.byte(g7)end;return g7 end;function fr.seek(fJ,g8)if fA==nil then return nil,"File is closed"end;fJ=fJ or 0;g8=g8 or"cur"if g8=="set"then g1=math.min(math.max(0,fJ),g0)+1 elseif g8=="cur"then g1=math.min(math.max(1,g1+fJ),g0+1)elseif g8=="end"then g1=math.min(math.max(0,g0+fJ),g0)+1 else error("bad argument #2 (invalid whence)",2)end;return g1-1 end;function fr.write(gc)if type(gc)=="number"and f_ then gc=string.char(gc)elseif type(gc)~="string"then error("bad argument #1 (string or number expected, got "..type(gc).." )",2)end;if fA==nil then error("File is closed",2)end;fA=string.sub(fA,1,g1-1)..gc..string.sub(fA,g1+#gc)g1=g1+#gc;g0=#fA end;function fr.writeLine(gc)fe(1,gc,"string")fr.write(gc.."\n")end;function fr.flush()if fA==nil then error("File is closed",2)end;fH(fn,fA)end;function fr.close()if fA==nil then error("File is already closed",2)end;fH(fn,fA)fA=nil end;return fr end;local function gf(fr)local gg=false;return{read=function(self,gh)if gg then error("File is closed",2)end;fe(2,gh,"string","nil")if not gh then gh="l"end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;if string.find(gh,"%*")==1 then gh=gh:gsub("%*","")end;if gh=="l"then return fr.readLine(false)elseif gh=="L"then return fr.readLine(true)elseif gh=="a"then return fr.readAll()else error("Unsupported read mode",2)end end,seek=function(self,g8,fJ)if gg then error("File is closed",2)end;fe(2,g8,"string","nil")fe(3,fJ,"number","nil")if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;return fr.seek(fJ,g8)end,write=function(self,...)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;local gi={...}for j=1,#gi do local gj=gi[j]if type(gj)~="string"and type(gj)~="number"then error("bad argument #"..j+1 .." (string or number expected, got "..type(gj).." )",2)end;fr.write(gj)end end,close=function(self)if gg then error("File is already closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;fr.close()gg=true end,flush=function(self)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;fr.flush()end,lines=function(self)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;return function()if gg then error("file is already closed",2)end;return fr.readLine(false)end end}end;function fw.fs.open(fn,gh)fe(1,fn,"string")fe(2,gh,"string")if gh=="r"or gh=="rb"then if fw.fs.exists(fn)then return fZ(fn,gh=="rb")else error("File not found",2)end elseif gh=="w"or gh=="wb"then return g9(fn,gh=="wb",false)elseif gh=="a"or gh=="ab"then return g9(fn,gh=="ab",true)elseif gh=="r+"or gh=="rb+"or gh=="r+b"then if fw.fs.exists(fn)then return gd(fn,gh=="rb+"or gh=="r+b",false)else error("File not found",2)end elseif gh=="w+"or gh=="wb+"or gh=="w+b"then return gd(fn,gh=="wb+"or gh=="w+b",true)elseif gh=="a+"or gh=="ab+"or gh=="a+b"then return gd(fn,gh=="ab+"or gh=="a+b",true)else error("Invalid mode",2)end end;function fw.fs.move(gk,gl)fe(1,gk,"string")fe(2,gl,"string")if not fw.fs.exists(gk)then error("Source does not exist",2)end;if fw.fs.exists(gl)then error("Destination already exists",2)end;local fA=fF(gk)fH(gl,fA)fH(gk,nil)end;function fw.fs.copy(gk,gl)fe(1,gk,"string")fe(2,gl,"string")if not fw.fs.exists(gk)then error("Source does not exist",2)end;if fw.fs.exists(gl)then error("Destination already exists",2)end;local fA=fF(gk)fH(gl,fA)end;local function gm(fn,fD,j,fo)local fE=fD[j]if not fE then if fw.fs.exists(fn)then fo[#fo+1]=fn end elseif fE.exact then return gm(fw.fs.combine(fn,fE.contents),fD,j+1,fo)else if not fw.fs.isDir(fn)then return end;local gn=fw.fs.list(fn)for k=1,#gn do local fp=gn[k]if fp:find(fE.contents)then gm(fw.fs.combine(fn,fp),fD,j+1,fo)end end end end;local go={["^"]="%^",["$"]="%$",["("]="%(",[")"]="%)",["%"]="%%",["."]="%.",["["]="%[",["]"]="%]",["+"]="%+",["-"]="%-",["*"]=".*",["?"]="."}function fw.fs.find(gp)fe(1,gp,"string")gp=fw.fs.combine(gp)if gp==".."or gp:sub(1,3)=="../"then error("/"..gp..": Invalid Path",2)end;if not gp:find("[*?]")then if fw.fs.exists(gp)then return{gp}else return{}end end;local fD={}for fE in gp:gmatch("[^/]+")do if fE:find("[*?]")then fD[#fD+1]={exact=false,contents="^"..fE:gsub(".",go).."$"}else fD[#fD+1]={exact=true,contents=fE}end end;local fo={}gm("",fD,1,fo)return fo end;function fw.io.open(fn,gh)fe(1,fn,"string")fe(2,gh,"string","nil")if not gh then gh="r"end;local fr;if gh=="r"or gh=="rb"then if fw.fs.exists(fn)and not fw.fs.isDir(fn)then fr=fZ(fn,gh=="rb")elseif fw.fs.isDir(fn)then return nil,"Attempt to open a directory"else return nil,"File not found"end elseif gh=="w"or gh=="wb"then fr=g9(fn,gh=="wb",false)elseif gh=="a"or gh=="ab"then fr=g9(fn,gh=="ab",true)elseif gh=="r+"or gh=="rb+"or gh=="r+b"then if fw.fs.exists(fn)and not fw.fs.isDir(fn)then fr=gd(fn,gh=="rb+"or gh=="r+b",false)elseif fw.fs.isDir(fn)then return nil,"Attempt to open a directory"else return nil,"File not found"end elseif gh=="w+"or gh=="wb+"or gh=="w+b"then fr=gd(fn,gh=="wb+"or gh=="w+b",true)elseif gh=="a+"or gh=="ab+"or gh=="a+b"then fr=gd(fn,gh=="ab+"or gh=="a+b",true)else return nil,"Invalid mode"end;return gf(fr)end;function fw.io.lines(fn,...)local gi={...}fe(1,fn,"string")local fr=fw.io.open(fn,table.unpack(gi))local g6=0;return function()g6=g6+1;local g5=fr:read(gi[g6%#gi+1]or"l")if g5==nil then fr:close()end;return g5 end end;function fw.fs.delete(fn)fe(1,fn,"string")if not fw.fs.exists(fn)then error("File not found",2)end;fH(fn,nil)end;function fw.fs.getSize(fn)fe(1,fn,"string")if not fw.fs.exists(fn)then error("File not found",2)end;if fw.fs.isDir(fn)then return 0 else return#fF(fn)end end;function fw.fs.makeDir(fn)fe(1,fn,"string")if fw.fs.exists(fn)then return end;fH(fn,{})end;local gq={}local gr=false;function fw.loadfile(gs,gh,gt)if type(gh)=="table"and gt==nil then gh,gt=nil,gh end;fe(1,gs,"string")fe(2,gh,"string","nil")fe(3,gt,"table","nil")local fp=fw.fs.open(gs,"r")if not fp then return nil,"File not found"end;local gu,gv=load(fp.readAll(),"@/"..fs.combine(gs),gh,gt)fp.close()return gu,gv end;function fw.dofile(gw)fe(1,gw,"string")local gx,f=fw.loadfile(gw,nil,_G)if gx then return gx()else error(f,2)end end;function fw.loadAPI(gy)fe(1,gy,"string")local fS=fs.getName(gy)if fS:sub(-4)==".lua"then fS=fS:sub(1,-5)end;if fS=="term"then return true end;if gq[fS]==true then printError("API "..fS.." is already being loaded")return false end;gq[fS]=true;local gz={}setmetatable(gz,{__index=fw})local gA,gv=fw.loadfile(gy,nil,gz)if gA then local gB,gv=pcall(gA)if not gB then gq[fS]=nil;return error("Failed to load API "..fS.." due to "..gv,1)end else gq[fS]=nil;return error("Failed to load API "..fS.." due to "..gv,1)end;local gC={}for l,w in pairs(gz)do if l~="_ENV"then gC[l]=w end end;fw[fS]=gC;gq[fS]=nil;return true end;local function gD(gE)if not fw.fs.isDir(gE)then return end;for a0,fp in ipairs(fw.fs.list(gE))do if fp:sub(1,1)~="."then local fn=fs.combine(gE,fp)if not fs.isDir(fn)then if not fw.loadAPI(fn)then gr=true end end end end end;function fw.os.run(gF,gy,...)fe(1,gF,"table")fe(2,gy,"string")local gz=gF;setmetatable(gz,{__index=fw})if settings.get("bios.strict_globals",false)then gz._ENV=gz;getmetatable(gz).__newindex=function(a0,gG)error("Attempt to create global "..tostring(gG),2)end end;local gx,gv=fw.loadfile(gy,nil,gz)if gx then local gB,gv=pcall(gx,...)if not gB then if gv and gv~=""then printError(gv)end;return false end;return true end;if gv and gv~=""then printError(gv)end;return false end;fw.settings=settings;fw._ENV=fw;fw._G=fw;fw.shell=nil;fw.multishell=nil;gD("rom/apis")if http and fv then fw.http=http;gD("rom/apis/http")end;return fw end;local gH=dofile("rom/modules/main/cc/internal/tiny_require.lua")("cc.internal.exception")local function gI(...)local gJ={co=coroutine.running()}local gK=table.pack(...)local gL={}for j=1,gK.n,1 do local gM=gK[j]if type(gM)~="function"then error("bad argument #"..j.." (function expected, got "..type(gM)..")",3)end;gL[j]={co=coroutine.create(function()return gH.try_barrier(gJ,gM)end),filter=nil}end;return gL end;local function gN(gL,gO)local g6=#gL;if g6<1 then return 0 end;local gP=g6;local gQ={n=0}while true do for j=1,g6 do local gR=gL[j]if gR and(gR.filter==nil or gR.filter==gQ[1]or gQ[1]=="terminate")then local gB,gS=coroutine.resume(gR.co,table.unpack(gQ,1,gQ.n))if gB then if gS=="thread_shutdown"then return{command=true,type="shutdown"}elseif gS=="thread_reboot"then print("reboot")return{command=true,type="reboot"}else gR.filter=gS end elseif type(gS)=="string"and gH.can_wrap_errors()then printError(gH.make_exception(gS,gR.co))else printError(gS)end;if coroutine.status(gR.co)=="dead"then gL[j]=false;gP=gP-1;if gP<=gO then return j end end end end;gQ=table.pack(os.pullEventRaw())end end;function fi.start(gt)local gT=nil;gt.os.reboot=function()gT="reboot"sleep()end;gt.os.shutdown=function()gT="shutdown"sleep()end;local gu=function()gT=nil;settings.define("shell.allow_startup",{default=true,description="Run startup files when the computer turns on.",type="boolean"})settings.define("shell.allow_disk_startup",{default=commands==nil,description="Run startup files from disk drives when the computer turns on.",type="boolean"})settings.define("shell.autocomplete",{default=true,description="Autocomplete program and arguments in the shell.",type="boolean"})settings.define("edit.autocomplete",{default=true,description="Autocomplete API and function names in the editor.",type="boolean"})settings.define("lua.autocomplete",{default=true,description="Autocomplete API and function names in the Lua REPL.",type="boolean"})settings.define("edit.default_extension",{default="lua",description=[[The file extension the editor will use if none is given. Set to "" to disable.]],type="string"})settings.define("paint.default_extension",{default="nfp",description=[[The file extension the paint program will use if none is given. Set to "" to disable.]],type="string"})settings.define("list.show_hidden",{default=false,description=[[Whether the list program show hidden files (those starting with ".").]],type="boolean"})settings.define("motd.enable",{default=pocket==nil,description="Display a random message when the computer starts up.",type="boolean"})settings.define("motd.path",{default="/rom/motd.txt:/motd.txt",description=[[The path to load random messages from. Should be a colon (":") separated string of file paths.]],type="string"})settings.define("lua.warn_against_use_of_local",{default=true,description=[[Print a message when input in the Lua REPL starts with the word 'local'. Local variables defined in the Lua REPL are be inaccessible on the next input.]],type="boolean"})settings.define("lua.function_args",{default=true,description="Show function arguments when printing functions.",type="boolean"})settings.define("lua.function_source",{default=false,description="Show where a function was defined when printing functions.",type="boolean"})settings.define("bios.strict_globals",{default=false,description="Prevents assigning variables into a program's environment. Make sure you use the local keyword or assign to _G explicitly.",type="boolean"})settings.define("bios.use_multishell",{default=true,description="Allow running multiple program at once, through the use of the \"fg\" and \"bg\" programs..",type="boolean"})settings.define("shell.autocomplete_hidden",{default=false,description=[[Autocomplete hidden files and folders (those starting with ".").]],type="boolean"})print("running container!")return gN(gI(function()local gU;if term.isColour()and settings.get("bios.use_multishell")then gU="rom/programs/advanced/multishell.lua"else gU="rom/programs/shell.lua"end;os.run({},gU)os.run({},"rom/programs/shutdown.lua")end,function()while true do sleep()if gT=="shutdown"then while true do coroutine.yield("thread_shutdown")end elseif gT=="reboot"then while true do coroutine.yield("thread_reboot")end end end end),0)end;local gT="starting"while gT=="starting"or type(gT)=="table"and gT.command and gT.type=="reboot"do gT=setfenv(gu,fj(gt))()end end;return fi \ No newline at end of file +local a=(function()local b;do local c="1.0.2-release"local d="LibDeflate"local e=3;local f="LibDeflate "..c.." Copyright (C) 2018-2021 Haoqian He.".." Licensed under the zlib License"if LibStub then local g,h=LibStub:GetLibrary(d,true)if g and h and h>=e then return g else b=LibStub:NewLibrary(d,e)end else b={}end;b._VERSION=c;b._MAJOR=d;b._MINOR=e;b._COPYRIGHT=f end;local assert=assert;local error=error;local pairs=pairs;local i=string.byte;local j=string.char;local k=string.find;local l=string.gsub;local m=string.sub;local n=table.concat;local o=table.sort;local tostring=tostring;local type=type;local p={}local q={}local r={}local s={}local t={}local u={}local v={}local w={}local x={}local y={3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258}local z={0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}local A={[0]=1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577}local B={[0]=0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}local C={16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}local D;local E;local F;local G;local H;local I;local J;local K;for L=0,255 do q[L]=j(L)end;do local M=1;for L=0,32 do p[L]=M;M=M*2 end end;for L=1,9 do r[L]={}for N=0,p[L+1]-1 do local O=0;local P=N;for Q=1,L do O=O-O%2+((O%2==1 or P%2==1)and 1 or 0)P=(P-P%2)/2;O=O*2 end;r[L][N]=(O-O%2)/2 end end;do local R=18;local S=16;local T=265;local U=1;for V=3,258 do if V<=10 then s[V]=V+254;u[V]=0 elseif V==258 then s[V]=285;u[V]=0 else if V>R then R=R+S;S=S*2;T=T+4;U=U+1 end;local W=V-R-1+S/2;s[V]=(W-W%(S/8))/(S/8)+T;u[V]=U;t[V]=W%(S/8)end end end;do v[1]=0;v[2]=1;x[1]=0;x[2]=0;local R=3;local S=4;local X=2;local U=0;for Y=3,256 do if Y>S then R=R*2;S=S*2;X=X+2;U=U+1 end;v[Y]=Y<=R and X or X+1;x[Y]=U<0 and 0 or U;if S>=8 then w[Y]=(Y-S/2-1)%(S/4)end end end;function b:Adler32(Z)if type(Z)~="string"then error(("Usage: LibDeflate:Adler32(str)local a=(function()local b;do local c="1.0.2-release"local d="LibDeflate"local e=3;local f="LibDeflate "..c.." Copyright (C) 2018-2021 Haoqian He.".." Licensed under the zlib License"if LibStub then local g,h=LibStub:GetLibrary(d,true)if g and h and h>=e then return g else b=LibStub:NewLibrary(d,e)end else b={}end;b._VERSION=c;b._MAJOR=d;b._MINOR=e;b._COPYRIGHT=f end;local assert=assert;local error=error;local pairs=pairs;local i=string.byte;local j=string.char;local k=string.find;local l=string.gsub;local m=string.sub;local n=table.concat;local o=table.sort;local tostring=tostring;local type=type;local p={}local q={}local r={}local s={}local t={}local u={}local v={}local w={}local x={}local y={3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258}local z={0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}local A={[0]=1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577}local B={[0]=0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}local C={16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}local D;local E;local F;local G;local H;local I;local J;local K;for L=0,255 do q[L]=j(L)end;do local M=1;for L=0,32 do p[L]=M;M=M*2 end end;for L=1,9 do r[L]={}for N=0,p[L+1]-1 do local O=0;local P=N;for Q=1,L do O=O-O%2+((O%2==1 or P%2==1)and 1 or 0)P=(P-P%2)/2;O=O*2 end;r[L][N]=(O-O%2)/2 end end;do local R=18;local S=16;local T=265;local U=1;for V=3,258 do if V<=10 then s[V]=V+254;u[V]=0 elseif V==258 then s[V]=285;u[V]=0 else if V>R then R=R+S;S=S*2;T=T+4;U=U+1 end;local W=V-R-1+S/2;s[V]=(W-W%(S/8))/(S/8)+T;u[V]=U;t[V]=W%(S/8)end end end;do v[1]=0;v[2]=1;x[1]=0;x[2]=0;local R=3;local S=4;local X=2;local U=0;for Y=3,256 do if Y>S then R=R*2;S=S*2;X=X+2;U=U+1 end;v[Y]=Y<=R and X or X+1;x[Y]=U<0 and 0 or U;if S>=8 then w[Y]=(Y-S/2-1)%(S/4)end end end;function b:Adler32(Z)if type(Z)~="string"then error(("Usage: LibDeflate:Adler32(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;local _=#Z;local L=1;local R=1;local S=0;while L<=_-15 do local a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,aa,ab,ac,ad,ae,af=i(Z,L,L+15)S=(S+16*R+16*a0+15*a1+14*a2+13*a3+12*a4+11*a5+10*a6+9*a7+8*a8+7*a9+6*aa+5*ab+4*ac+3*ad+2*ae+af)%65521;R=(R+a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+aa+ab+ac+ad+ae+af)%65521;L=L+16 end;while L<=_ do local ag=i(Z,L,L)R=(R+ag)%65521;S=(S+R)%65521;L=L+1 end;return(S*65536+R)%4294967296 end;local function ah(ai,aj)return ai%4294967296==aj%4294967296 end;function b:CreateDictionary(Z,_,ak)if type(Z)~="string"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;if type(_)~="number"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'strlen\' - number expected got \'%s\'."):format(type(_)),2)end;if type(ak)~="number"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'adler32\' - number expected got \'%s\'."):format(type(ak)),2)end;if _~=#Z then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'strlen\' does not match the actual length of \'str\'.".." \'strlen\': %u, \'#str\': %u .".." Please check if \'str\' is modified unintentionally."):format(_,#Z))end;if _==0 then error("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - Empty string is not allowed.",2)end;if _>32768 then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - string longer than 32768 bytes is not allowed.".." Got %d bytes."):format(_),2)end;local al=self:Adler32(Z)if not ah(ak,al)then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'adler32\' does not match the actual adler32 of \'str\'.".." \'adler32\': %u, \'Adler32(str)\': %u .".." Please check if \'str\' is modified unintentionally."):format(ak,al))end;local am={}am.adler32=ak;am.hash_tables={}am.string_table={}am.strlen=_;local an=am.string_table;local ao=am.hash_tables;an[1]=i(Z,1,1)an[2]=i(Z,2,2)if _>=3 then local L=1;local ap=an[1]*256+an[2]while L<=_-2-3 do local a0,a1,a2,a3=i(Z,L+2,L+5)an[L+2]=a0;an[L+3]=a1;an[L+4]=a2;an[L+5]=a3;ap=(ap*256+a0)%16777216;local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a1)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a2)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a3)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1 end;while L<=_-2 do local ag=i(Z,L+2)an[L+2]=ag;ap=(ap*256+ag)%16777216;local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1 end end;return am end;local function aq(am)if type(am)~="table"then return false,("\'dictionary\' - table expected got \'%s\'."):format(type(am))end;if type(am.adler32)~="number"or type(am.string_table)~="table"or type(am.strlen)~="number"or am.strlen<=0 or am.strlen>32768 or am.strlen~=#am.string_table or type(am.hash_tables)~="table"then return false,("\'dictionary\' - corrupted dictionary."):format(type(am))end;return true,""end;local ar={[0]={false,nil,0,0,0},[1]={false,nil,4,8,4},[2]={false,nil,5,18,8},[3]={false,nil,6,32,32},[4]={true,4,4,16,16},[5]={true,8,16,32,32},[6]={true,8,16,128,128},[7]={true,8,32,128,256},[8]={true,32,128,258,1024},[9]={true,32,258,258,4096}}local function as(Z,at,am,au,av)if type(Z)~="string"then return false,("\'str\' - string expected got \'%s\'."):format(type(Z))end;if at then local aw,ax=aq(am)if not aw then return false,ax end end;if au then local ay=type(av)if ay~="nil"and ay~="table"then return false,("\'configs\' - nil or table expected got \'%s\'."):format(type(av))end;if ay=="table"then for az,aA in pairs(av)do if az~="level"and az~="strategy"then return false,("\'configs\' - unsupported table key in the configs: \'%s\'."):format(az)elseif az=="level"and not ar[aA]then return false,("\'configs\' - unsupported \'level\': %s."):format(tostring(aA))elseif az=="strategy"and aA~="fixed"and aA~="huffman_only"and aA~="dynamic"then return false,("\'configs\' - unsupported \'strategy\': \'%s\'."):format(tostring(aA))end end end end;return true,""end;local aB=0;local aC=1;local aD=2;local aE=3;local function aF()local aG=0;local aH=0;local aI=0;local aJ=0;local aK={}local aL={}local function aM(P,U)aH=aH+P*p[aI]aI=aI+U;aJ=aJ+U;if aI>=32 then aG=aG+1;aK[aG]=q[aH%256]..q[(aH-aH%256)/256%256]..q[(aH-aH%65536)/65536%256]..q[(aH-aH%16777216)/16777216%256]local aN=p[32-aI+U]aH=(P-P%aN)/aN;aI=aI-32 end end;local function aO(Z)for Q=1,aI,8 do aG=aG+1;aK[aG]=j(aH%256)aH=(aH-aH%256)/256 end;aI=0;aG=aG+1;aK[aG]=Z;aJ=aJ+#Z*8 end;local function aP(aQ)if aQ==aE then return aJ end;if aQ==aC or aQ==aD then local aR=(8-aI%8)%8;if aI>0 then aH=aH-p[aI]+p[aI+aR]for Q=1,aI,8 do aG=aG+1;aK[aG]=q[aH%256]aH=(aH-aH%256)/256 end;aH=0;aI=0 end;if aQ==aD then aJ=aJ+aR;return aJ end end;local aS=n(aK)aK={}aG=0;aL[#aL+1]=aS;if aQ==aB then return aJ else return aJ,n(aL)end end;return aM,aO,aP end;local function aT(aU,aV,aW)aW=aW+1;aU[aW]=aV;local P=aV[1]local aX=aW;local aY=(aX-aX%2)/2;while aY>=1 and aU[aY][1]>P do local W=aU[aY]aU[aY]=aV;aU[aX]=W;aX=aY;aY=(aY-aY%2)/2 end end;local function aZ(aU,aW)local a_=aU[1]local aV=aU[aW]local P=aV[1]aU[1]=aV;aU[aW]=a_;aW=aW-1;local aX=1;local b0=aX*2;local b1=b0+1;while b0<=aW do local b2=aU[b0]if b1<=aW and aU[b1][1]1 do local bl=aZ(aU,aW)aW=aW-1;local bm=aZ(aU,aW)aW=aW-1;local bn={bl[1]+bm[1],-1,bl,bm}aT(aU,bn,aW)aW=aW+1 end;local bo=0;local bp={aU[1],0,0,0}local bq=1;local br=1;aU[1][1]=0;while br<=bq do local aV=bp[br]local U=aV[1]local bc=aV[2]local b2=aV[3]local b3=aV[4]if b2 then bq=bq+1;bp[bq]=b2;b2[1]=U+1 end;if b3 then bq=bq+1;bp[bq]=b3;b3[1]=U+1 end;br=br+1;if U>b8 then bo=bo+1;U=b8 end;if bc>=0 then b6[bc]=U;bg=bc>bg and bc or bg;b5[U]=(b5[U]or 0)+1 end end;if bo>0 then repeat local U=b8-1;while(b5[U]or 0)==0 do U=U-1 end;b5[U]=b5[U]-1;b5[U+1]=(b5[U+1]or 0)+2;b5[b8]=b5[b8]-1;bo=bo-2 until bo<=0;br=1;for U=b8,1,-1 do local bs=b5[U]or 0;while bs>0 do local bc=bh[br][2]b6[bc]=U;bs=bs-1;br=br+1 end end end;bi=b4(b5,b6,b7,b8)return b6,bi,bg end end;local function bt(bu,bv,bw,bx)local by=0;local bz={}local bA={}local bB=0;local bC={}local bD=nil;local bk=0;bx=bx<0 and 0 or bx;local bE=bv+bx+1;for X=0,bE+1 do local V=X<=bv and(bu[X]or 0)or(X<=bE and(bw[X-bv-1]or 0)or nil)if V==bD then bk=bk+1;if V~=0 and bk==6 then by=by+1;bz[by]=16;bB=bB+1;bC[bB]=3;bA[16]=(bA[16]or 0)+1;bk=0 elseif V==0 and bk==138 then by=by+1;bz[by]=18;bB=bB+1;bC[bB]=127;bA[18]=(bA[18]or 0)+1;bk=0 end else if bk==1 then by=by+1;bz[by]=bD;bA[bD]=(bA[bD]or 0)+1 elseif bk==2 then by=by+1;bz[by]=bD;by=by+1;bz[by]=bD;bA[bD]=(bA[bD]or 0)+2 elseif bk>=3 then by=by+1;local bF=bD~=0 and 16 or(bk<=10 and 17 or 18)bz[by]=bF;bA[bF]=(bA[bF]or 0)+1;bB=bB+1;bC[bB]=bk<=10 and bk-3 or bk-11 end;bD=V;if V and V~=0 then by=by+1;bz[by]=V;bA[V]=(bA[V]or 0)+1;bk=0 else bk=1 end end end;return bz,bC,bA end;local function bG(Z,W,bH,bI,bJ)local L=bH-bJ;while L<=bI-15-bJ do W[L],W[L+1],W[L+2],W[L+3],W[L+4],W[L+5],W[L+6],W[L+7],W[L+8],W[L+9],W[L+10],W[L+11],W[L+12],W[L+13],W[L+14],W[L+15]=i(Z,L+bJ,L+15+bJ)L=L+16 end;while L<=bI-bJ do W[L]=i(Z,L+bJ,L+bJ)L=L+1 end;return W end;local function bK(bL,an,ao,bM,bN,bJ,am)local bO=ar[bL]local bP,bQ,bR,bS,bT=bO[1],bO[2],bO[3],bO[4],bO[5]local bU=not bP and bR or 2147483646;local bV=bT-bT%4/4;local ap;local bW;local bX;local bY=0;if am then bW=am.hash_tables;bX=am.string_table;bY=am.strlen;assert(bM==1)if bN>=bM and bY>=2 then ap=bX[bY-1]*65536+bX[bY]*256+an[1]local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=-1 end;if bN>=bM+1 and bY>=1 then ap=bX[bY]*65536+an[1]*256+an[2]local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=0 end end;local bZ=bY+3;ap=(an[bM-bJ]or 0)*256+(an[bM+1-bJ]or 0)local b_={}local c0=0;local c1={}local c2={}local c3=0;local c4={}local c5={}local c6=0;local c7={}local c8=0;local c9=false;local ca;local cb;local cc=0;local cd=0;local br=bM;local ce=bN+(bP and 1 or 0)while br<=ce do local cf=br-bJ;local cg=bJ-3;ca=cc;cb=cd;cc=0;ap=(ap*256+(an[cf+2]or 0))%16777216;local ch;local ci;local cj=ao[ap]local ck;if not cj then ck=0;cj={}ao[ap]=cj;if bW then ci=bW[ap]ch=ci and#ci or 0 else ch=0 end else ck=#cj;ci=cj;ch=ck end;if br<=bN then cj[ck+1]=br end;if ch>0 and br+2<=bN and(not bP or ca=bQ and bV or bT;local cm=bN-br;cm=cm>=257 and 257 or cm;cm=cm+cf;local cn=cf+3;while ch>=1 and cl>0 do local bD=ci[ch]if br-bD>32768 then break end;if bD
=-257 then local cp=bD-cg;while co<=cm and an[cp]==an[co]do co=co+1;cp=cp+1 end else local cp=bZ+bD;while co<=cm and bX[cp]==an[co]do co=co+1;cp=cp+1 end end;local N=co-cf;if N>cc then cc=N;cd=br-bD end;if cc>=bS then break end end;ch=ch-1;cl=cl-1;if ch==0 and bD>0 and bW then ci=bW[ap]ch=ci and#ci or 0 end end end;if not bP then ca,cb=cc,cd end;if(not bP or c9)and(ca>3 or ca==3 and cb<4096)and cc<=ca then local X=s[ca]local cq=u[ca]local cr,cs,ct;if cb<=256 then cr=v[cb]ct=w[cb]cs=x[cb]else cr=16;cs=7;local R=384;local S=512;while true do if cb<=R then ct=(cb-S/2-1)%(S/4)break elseif cb<=S then ct=(cb-S/2-1)%(S/4)cr=cr+1;break else cr=cr+2;cs=cs+1;R=R*2;S=S*2 end end end;c0=c0+1;b_[c0]=X;c1[X]=(c1[X]or 0)+1;c3=c3+1;c2[c3]=cr;c4[cr]=(c4[cr]or 0)+1;if cq>0 then local cu=t[ca]c6=c6+1;c5[c6]=cu end;if cs>0 then c8=c8+1;c7[c8]=ct end;for L=br+1,br+ca-(bP and 2 or 1)do ap=(ap*256+(an[L-bJ+2]or 0))%16777216;if ca<=bU then cj=ao[ap]if not cj then cj={}ao[ap]=cj end;cj[#cj+1]=L end end;br=br+ca-(bP and 1 or 0)c9=false elseif not bP or c9 then local X=an[bP and cf-1 or cf]c0=c0+1;b_[c0]=X;c1[X]=(c1[X]or 0)+1;br=br+1 else c9=true;br=br+1 end end;c0=c0+1;b_[c0]=256;c1[256]=(c1[256]or 0)+1;return b_,c5,c1,c2,c7,c4 end;local function cv(c1,c4)local cw,cx,bv=be(c1,15,285)local cy,cz,bx=be(c4,15,29)local cA,bC,cB=bt(cw,bv,cy,bx)local cC,cD=be(cB,7,18)local cE=0;for L=1,19 do local bc=C[L]local cF=cC[bc]or 0;if cF~=0 then cE=L end end;cE=cE-4;local cG=bv+1-257;local cH=bx+1-1;if cH<0 then cH=0 end;return cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz end;local function cI(b_,c2,cE,cC,cA,cw,cy)local cJ=17;cJ=cJ+(cE+4)*3;for L=1,#cA do local X=cA[L]cJ=cJ+cC[X]if X>=16 then cJ=cJ+(X==16 and 2 or(X==17 and 3 or 7))end end;local cK=0;for L=1,#b_ do local X=b_[L]local cL=cw[X]cJ=cJ+cL;if X>256 then cK=cK+1;if X>264 and X<285 then local cM=z[X-256]cJ=cJ+cM end;local cr=c2[cK]local cN=cy[cr]cJ=cJ+cN;if cr>3 then local cs=(cr-cr%2)/2-1;cJ=cJ+cs end end end;return cJ end;local function cO(aM,cP,b_,c5,c2,c7,cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz)aM(cP and 1 or 0,1)aM(2,2)aM(cG,5)aM(cH,5)aM(cE,4)for L=1,cE+4 do local bc=C[L]local cF=cC[bc]or 0;aM(cF,3)end;local cQ=1;for L=1,#cA do local X=cA[L]aM(cD[X],cC[X])if X>=16 then local cR=bC[cQ]aM(cR,X==16 and 2 or(X==17 and 3 or 7))cQ=cQ+1 end end;local cK=0;local cS=0;local cT=0;for L=1,#b_ do local cU=b_[L]local b9=cx[cU]local cL=cw[cU]aM(b9,cL)if cU>256 then cK=cK+1;if cU>264 and cU<285 then cS=cS+1;local cV=c5[cS]local cM=z[cU-256]aM(cV,cM)end;local cW=c2[cK]local cX=cz[cW]local cN=cy[cW]aM(cX,cN)if cW>3 then cT=cT+1;local ct=c7[cT]local cs=(cW-cW%2)/2-1;aM(ct,cs)end end end end;local function cY(b_,c2)local cJ=3;local cK=0;for L=1,#b_ do local X=b_[L]local cL=F[X]cJ=cJ+cL;if X>256 then cK=cK+1;if X>264 and X<285 then local cM=z[X-256]cJ=cJ+cM end;local cr=c2[cK]cJ=cJ+5;if cr>3 then local cs=(cr-cr%2)/2-1;cJ=cJ+cs end end end;return cJ end;local function cZ(aM,cP,b_,c5,c2,c7)aM(cP and 1 or 0,1)aM(1,2)local cK=0;local cS=0;local cT=0;for L=1,#b_ do local c_=b_[L]local b9=D[c_]local cL=F[c_]aM(b9,cL)if c_>256 then cK=cK+1;if c_>264 and c_<285 then cS=cS+1;local cV=c5[cS]local cM=z[c_-256]aM(cV,cM)end;local cr=c2[cK]local cX=H[cr]aM(cX,5)if cr>3 then cT=cT+1;local ct=c7[cT]local cs=(cr-cr%2)/2-1;aM(ct,cs)end end end end;local function d0(bM,bN,aJ)assert(bN-bM+1<=65535)local cJ=3;aJ=aJ+3;local aR=(8-aJ%8)%8;cJ=cJ+aR;cJ=cJ+32;cJ=cJ+(bN-bM+1)*8;return cJ end;local function d1(aM,aO,cP,Z,bM,bN,aJ)assert(bN-bM+1<=65535)aM(cP and 1 or 0,1)aM(0,2)aJ=aJ+3;local aR=(8-aJ%8)%8;if aR>0 then aM(p[aR]-1,aR)end;local d2=bN-bM+1;aM(d2,16)local d3=255-d2%256+(255-(d2-d2%256)/256)*256;aM(d3,16)aO(Z:sub(bM,bN))end;local function d4(av,aM,aO,aP,Z,am)local an={}local ao={}local cP=nil;local bM;local bN;local d5;local aJ=aP(aE)local _=#Z;local bJ;local bL;local d6;if av then if av.level then bL=av.level end;if av.strategy then d6=av.strategy end end;if not bL then if _<2048 then bL=7 elseif _>65536 then bL=3 else bL=5 end end;while not cP do if not bM then bM=1;bN=64*1024-1;bJ=0 else bM=bN+1;bN=bN+32*1024;bJ=bM-32*1024-1 end;if bN>=_ then bN=_;cP=true else cP=false end;local b_,c5,c1,c2,c7,c4;local cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz;local d7;local d8;local d9;if bL~=0 then bG(Z,an,bM,bN+3,bJ)if bM==1 and am then local bX=am.string_table;local da=am.strlen;for L=0,-da+1<-257 and-257 or-da+1,-1 do an[L]=bX[da+L]end end;if d6=="huffman_only"then b_={}bG(Z,b_,bM,bN,bM-1)c5={}c1={}b_[bN-bM+2]=256;for L=1,bN-bM+2 do local X=b_[L]c1[X]=(c1[X]or 0)+1 end;c2={}c7={}c4={}else b_,c5,c1,c2,c7,c4=bK(bL,an,ao,bM,bN,bJ,am)end;cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz=cv(c1,c4)d7=cI(b_,c2,cE,cC,cA,cw,cy)d8=cY(b_,c2)end;d9=d0(bM,bN,aJ)local db=d9;db=d8 and d80 and bN+1-W[1]>32768 then if dc==1 then ao[az]=nil else local dd={}local de=0;for L=2,dc do N=W[L]if bN+1-N<=32768 then de=de+1;dd[de]=N end end;ao[az]=dd end end end end end end;local function df(Z,am,av)local aM,aO,aP=aF()d4(av,aM,aO,aP,Z,am)local aJ,dg=aP(aC)local aR=(8-aJ%8)%8;return dg,aR end;local function dh(Z,am,av)local aM,aO,aP=aF()local di=8;local dj=7;local dk=dj*16+di;aM(dk,8)local dl=am and 1 or 0;local dm=2;local dn=dm*64+dl*32;local dp=31-(dk*256+dn)%31;dn=dn+dp;aM(dn,8)if dl==1 then local ak=am.adler32;local dq=ak%256;ak=(ak-dq)/256;local dr=ak%256;ak=(ak-dr)/256;local ds=ak%256;ak=(ak-ds)/256;local dt=ak%256;aM(dt,8)aM(ds,8)aM(dr,8)aM(dq,8)end;d4(av,aM,aO,aP,Z,am)aP(aD)local ak=b:Adler32(Z)local dt=ak%256;ak=(ak-dt)/256;local ds=ak%256;ak=(ak-ds)/256;local dr=ak%256;ak=(ak-dr)/256;local dq=ak%256;aM(dq,8)aM(dr,8)aM(ds,8)aM(dt,8)local aJ,dg=aP(aC)local aR=(8-aJ%8)%8;return dg,aR end;function b:CompressDeflate(Z,av)local du,dv=as(Z,false,nil,true,av)if not du then error("Usage: LibDeflate:CompressDeflate(str, configs): "..dv,2)end;return df(Z,nil,av)end;function b:CompressDeflateWithDict(Z,am,av)local du,dv=as(Z,true,am,true,av)if not du then error("Usage: LibDeflate:CompressDeflateWithDict".."(str, dictionary, configs): "..dv,2)end;return df(Z,am,av)end;function b:CompressZlib(Z,av)local du,dv=as(Z,false,nil,true,av)if not du then error("Usage: LibDeflate:CompressZlib(str, configs): "..dv,2)end;return dh(Z,nil,av)end;function b:CompressZlibWithDict(Z,am,av)local du,dv=as(Z,true,am,true,av)if not du then error("Usage: LibDeflate:CompressZlibWithDict".."(str, dictionary, configs): "..dv,2)end;return dh(Z,am,av)end;local function dw(dx)local dy=dx;local dz=#dx;local dA=1;local aI=0;local aH=0;local function dB(U)local aN=p[U]local X;if U<=aI then X=aH%aN;aH=(aH-X)/aN;aI=aI-U else local dC=p[aI]local dr,ds,dt,dD=i(dy,dA,dA+3)aH=aH+((dr or 0)+(ds or 0)*256+(dt or 0)*65536+(dD or 0)*16777216)*dC;dA=dA+4;aI=aI+32-U;X=aH%aN;aH=(aH-X)/aN end;return X end;local function dE(dF,aK,aG)assert(aI%8==0)local dG=aI/80 then if aI<15 and dy then local dC=p[aI]local dr,ds,dt,dD=i(dy,dA,dA+3)aH=aH+((dr or 0)+(ds or 0)*256+(dt or 0)*65536+(dD or 0)*16777216)*dC;dA=dA+4;aI=aI+32 end;local aN=p[db]aI=aI-db;X=aH%aN;aH=(aH-X)/aN;X=r[db][X]bk=dJ[db]if X0 and U285 then return-10 elseif bc<256 then aG=aG+1;aK[aG]=q[bc]elseif bc>256 then bc=bc-256;local U=y[bc]U=bc>=8 and U+dB(z[bc])or U;bc=dI(cy,d_,e0)if bc<0 or bc>29 then return-10 end;local Y=A[bc]Y=Y>4 and Y+dB(B[bc])or Y;local e2=aG-Y+1;if e2=-257 then for Q=1,U do aG=aG+1;aK[aG]=aK[e2]e2=e2+1 end else e2=da+e2;for Q=1,U do aG=aG+1;aK[aG]=q[bX[e2]]e2=e2+1 end end end;if dO()<0 then return 2 end;if aG>=65536 then aL[#aL+1]=n(aK,"",1,32768)for L=32769,aG do aK[L-32768]=aK[L]end;aG=aG-32768;aK[aG+1]=nil end until bc==256;dS.buffer_size=aG;return 0 end;local function e3(dS)local aK,aG,dB,dE,dO,dP,aL=dS.buffer,dS.buffer_size,dS.ReadBits,dS.ReadBytes,dS.ReaderBitlenLeft,dS.SkipToByteBoundary,dS.result_buffer;dP()local dF=dB(16)if dO()<0 then return 2 end;local e4=dB(16)if dO()<0 then return 2 end;if dF%256+e4%256~=255 then return-2 end;if(dF-dF%256)/256+(e4-e4%256)/256~=255 then return-2 end;aG=dE(dF,aK,aG)if aG<0 then return 2 end;if aG>=65536 then aL[#aL+1]=n(aK,"",1,32768)for L=32769,aG do aK[L-32768]=aK[L]end;aG=aG-32768;aK[aG+1]=nil end;dS.buffer_size=aG;return 0 end;local function e5(dS)return dX(dS,G,E,7,K,I,5)end;local function e6(dS)local dB,dI=dS.ReadBits,dS.Decode;local e7=dB(5)+257;local e8=dB(5)+1;local e9=dB(4)+4;if e7>286 or e8>30 then return-3 end;local cC={}for L=1,e9 do cC[C[L]]=dB(3)end;local ea,eb,ec,ed=dT(cC,18,7)if ea~=0 then return-4 end;local cw={}local cy={}local br=0;while bre7+e8 then return-6 end;while bc>0 do bc=bc-1;if br7 then return nil,-13 end;local dn=dB(8)if dS.ReaderBitlenLeft()<0 then return nil,2 end;if(dk*256+dn)%31~=0 then return nil,-14 end;local dl=(dn-dn%32)/32%2;local dm=(dn-dn%64)/64%4;if dl==1 then if not am then return nil,-16 end;local dt=dB(8)local ds=dB(8)local dr=dB(8)local dq=dB(8)local al=dt*16777216+ds*65536+dr*256+dq;if dS.ReaderBitlenLeft()<0 then return nil,2 end;if not ah(al,am.adler32)then return nil,-17 end end;local dg,ek=ei(dS)if not dg then return nil,ek end;dS.SkipToByteBoundary()local ep=dB(8)local eq=dB(8)local er=dB(8)local es=dB(8)if dS.ReaderBitlenLeft()<0 then return nil,2 end;local et=ep*16777216+eq*65536+er*256+es;local eu=b:Adler32(dg)if not ah(et,eu)then return nil,-15 end;local em=dS.ReaderBitlenLeft()local en=(em-em%8)/8;return dg,en end;function b:DecompressDeflate(Z)local du,dv=as(Z)if not du then error("Usage: LibDeflate:DecompressDeflate(str): "..dv,2)end;return el(Z)end;function b:DecompressDeflateWithDict(Z,am)local du,dv=as(Z,true,am)if not du then error("Usage: LibDeflate:DecompressDeflateWithDict(str, dictionary): "..dv,2)end;return el(Z,am)end;function b:DecompressZlib(Z)local du,dv=as(Z)if not du then error("Usage: LibDeflate:DecompressZlib(str): "..dv,2)end;return eo(Z)end;function b:DecompressZlibWithDict(Z,am)local du,dv=as(Z,true,am)if not du then error("Usage: LibDeflate:DecompressZlibWithDict(str, dictionary): "..dv,2)end;return eo(Z,am)end;do F={}for ev=0,143 do F[ev]=8 end;for ev=144,255 do F[ev]=9 end;for ev=256,279 do F[ev]=7 end;for ev=280,287 do F[ev]=8 end;J={}for Y=0,31 do J[Y]=5 end;local ek;ek,G,E=dT(F,287,9)assert(ek==0)ek,K,I=dT(J,31,5)assert(ek==0)D=b4(G,F,287,9)H=b4(K,J,31,5)end;local ew={["\000"]="%z",["("]="%(",[")"]="%)",["."]="%.",["%"]="%%",["+"]="%+",["-"]="%-",["*"]="%*",["?"]="%?",["["]="%[",["]"]="%]",["^"]="%^",["$"]="%$"}local function ex(Z)return Z:gsub("([%z%(%)%.%%%+%-%*%?%[%]%^%$])",ew)end;function b:CreateCodec(ey,ez,eA)if type(ey)~="string"or type(ez)~="string"or type(eA)~="string"then error("Usage: LibDeflate:CreateCodec(reserved_chars,".." escape_chars, map_chars):".." All arguments must be string.",2)end;if ez==""then return nil,"No escape characters supplied."end;if#ey<#eA then return nil,"The number of reserved characters must be".." at least as many as the number of mapped chars."end;if ey==""then return nil,"No characters to encode."end;local eB=ey..ez..eA;local eC={}for L=1,#eB do local dH=i(eB,L,L)if eC[dH]then return nil,"There must be no duplicate characters in the".." concatenation of reserved_chars, escape_chars and".." map_chars."end;eC[dH]=true end;local eD={}local eE={}local eF={}local eG={}if#eA>0 then local eH={}local eI={}for L=1,#eA do local eJ=m(ey,L,L)local eK=m(eA,L,L)eG[eJ]=eK;eF[#eF+1]=eJ;eI[eK]=eJ;eH[#eH+1]=eK end;eD[#eD+1]="(["..ex(n(eH)).."])"eE[#eE+1]=eI end;local eL=1;local eM=m(ez,eL,eL)local eN=0;local eH={}local eI={}for L=1,#eB do local T=m(eB,L,L)if not eG[T]then while eN>=256 or eC[eN]do eN=eN+1;if eN>255 then eD[#eD+1]=ex(eM).."(["..ex(n(eH)).."])"eE[#eE+1]=eI;eL=eL+1;eM=m(ez,eL,eL)eN=0;eH={}eI={}if not eM or eM==""then return nil,"Out of escape characters."end end end;local eO=q[eN]eG[T]=eM..eO;eF[#eF+1]=T;eI[eO]=T;eH[#eH+1]=eO;eN=eN+1 end;if L==#eB then eD[#eD+1]=ex(eM).."(["..ex(n(eH)).."])"eE[#eE+1]=eI end end;local eP={}local eQ="(["..ex(n(eF)).."])"local eR=eG;function eP:Encode(Z)if type(Z)~="string"then error(("Usage: codec:Encode(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;return l(Z,eQ,eR)end;local eS=#eD;local eT="(["..ex(ey).."])"function eP:Decode(Z)if type(Z)~="string"then error(("Usage: codec:Decode(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;if k(Z,eT)then return nil end;for L=1,eS do Z=l(Z,eD[L],eE[L])end;return Z end;return eP end;local eU={[0]="a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9","(",")"}local eV={[97]=0,[98]=1,[99]=2,[100]=3,[101]=4,[102]=5,[103]=6,[104]=7,[105]=8,[106]=9,[107]=10,[108]=11,[109]=12,[110]=13,[111]=14,[112]=15,[113]=16,[114]=17,[115]=18,[116]=19,[117]=20,[118]=21,[119]=22,[120]=23,[121]=24,[122]=25,[65]=26,[66]=27,[67]=28,[68]=29,[69]=30,[70]=31,[71]=32,[72]=33,[73]=34,[74]=35,[75]=36,[76]=37,[77]=38,[78]=39,[79]=40,[80]=41,[81]=42,[82]=43,[83]=44,[84]=45,[85]=46,[86]=47,[87]=48,[88]=49,[89]=50,[90]=51,[48]=52,[49]=53,[50]=54,[51]=55,[52]=56,[53]=57,[54]=58,[55]=59,[56]=60,[57]=61,[40]=62,[41]=63}function b:EncodeForPrint(Z)if type(Z)~="string"then error(("Usage: LibDeflate:EncodeForPrint(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;local _=#Z;local eW=_-2;local L=1;local aK={}local aG=0;while L<=eW do local a0,a1,a2=i(Z,L,L+2)L=L+3;local aH=a0+a1*256+a2*65536;local eX=aH%64;aH=(aH-eX)/64;local eY=aH%64;aH=(aH-eY)/64;local eZ=aH%64;local e_=(aH-eZ)/64;aG=aG+1;aK[aG]=eU[eX]..eU[eY]..eU[eZ]..eU[e_]end;local aH=0;local aI=0;while L<=_ do local ag=i(Z,L,L)aH=aH+ag*p[aI]aI=aI+8;L=L+1 end;while aI>0 do local f0=aH%64;aG=aG+1;aK[aG]=eU[f0]aH=(aH-f0)/64;aI=aI-6 end;return n(aK)end;function b:DecodeForPrint(Z)if type(Z)~="string"then error(("Usage: LibDeflate:DecodeForPrint(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;Z=Z:gsub("^[%c ]+","")Z=Z:gsub("[%c ]+$","")local _=#Z;if _==1 then return nil end;local f1=_-3;local L=1;local aK={}local aG=0;while L<=f1 do local a0,a1,a2,a3=i(Z,L,L+3)a0=eV[a0]a1=eV[a1]a2=eV[a2]a3=eV[a3]if not(a0 and a1 and a2 and a3)then return nil end;L=L+4;local aH=a0+a1*64+a2*4096+a3*262144;local eX=aH%256;aH=(aH-eX)/256;local eY=aH%256;local eZ=(aH-eY)/256;aG=aG+1;aK[aG]=q[eX]..q[eY]..q[eZ]end;local aH=0;local aI=0;while L<=_ do local ag=i(Z,L,L)ag=eV[ag]if not ag then return nil end;aH=aH+ag*p[aI]aI=aI+6;L=L+1 end;while aI>=8 do local dH=aH%256;aG=aG+1;aK[aG]=q[dH]aH=(aH-dH)/256;aI=aI-8 end;return n(aK)end;local function f2()_chat_channel_codec=nil;_addon_channel_codec=nil end;b.internals={LoadStringToTable=bG,IsValidDictionary=aq,IsEqualAdler32=ah,_byte_to_6bit_char=eU,_6bit_to_byte=eV,InternalClearCache=f2}if io and os and debug and _G.arg then local io=io;local os=os;local debug=debug;local f3=_G.arg;local f4=debug.getinfo(1)if f4.source==f3[0]or f4.short_src==f3[0]then local dy;local f5;local L=1;local ek;local f6=false;local f7=false;local bL;local d6;local am;while f3[L]do local R=f3[L]if R=="-h"then print(b._COPYRIGHT.."\nUsage: lua LibDeflate.lua [OPTION] [INPUT] [OUTPUT]\n".." -0 store only. no compression.\n".." -1 fastest compression.\n".." -9 slowest and best compression.\n".." -d do decompression instead of compression.\n".." --dict specify the file that contains".." the entire preset dictionary.\n".." -h give this help.\n".." --strategy ".." specify a special compression strategy.\n".." -v print the version and copyright info.\n".." --zlib use zlib format instead of raw deflate.\n")os.exit(0)elseif R=="-v"then print(b._COPYRIGHT)os.exit(0)elseif R:find("^%-[0-9]$")then bL=tonumber(R:sub(2,2))elseif R=="-d"then f7=true elseif R=="--dict"then L=L+1;local f8=f3[L]if not f8 then io.stderr:write("You must speicify the dict filename")os.exit(1)end;local f9,fa=io.open(f8,"rb")if not f9 then io.stderr:write(("LibDeflate: Cannot read the dictionary file \'%s\': %s"):format(f8,fa))os.exit(1)end;local fb=f9:read("*all")f9:close()am=b:CreateDictionary(fb,#fb,b:Adler32(fb))elseif R=="--strategy"then L=L+1;d6=f3[L]elseif R=="--zlib"then f6=true elseif R:find("^%-")then io.stderr:write(("LibDeflate: Invalid argument: %s"):format(R))os.exit(1)else if not dy then dy,ek=io.open(R,"rb")if not dy then io.stderr:write(("LibDeflate: Cannot read the file \'%s\': %s"):format(R,tostring(ek)))os.exit(1)end elseif not f5 then f5,ek=io.open(R,"wb")if not f5 then io.stderr:write(("LibDeflate: Cannot write the file \'%s\': %s"):format(R,tostring(ek)))os.exit(1)end end end;L=L+1 end;if not dy or not f5 then io.stderr:write("LibDeflate:".." You must specify both input and output files.")os.exit(1)end;local fc=dy:read("*all")local av={level=bL,strategy=d6}local fd;if not f7 then if not f6 then if not am then fd=b:CompressDeflate(fc,av)else fd=b:CompressDeflateWithDict(fc,am,av)end else if not am then fd=b:CompressZlib(fc,av)else fd=b:CompressZlibWithDict(fc,am,av)end end else if not f6 then if not am then fd=b:DecompressDeflate(fc)else fd=b:DecompressDeflateWithDict(fc,am)end else if not am then fd=b:DecompressZlib(fc)else fd=b:DecompressZlibWithDict(fc,am)end end end;if not fd then io.stderr:write("LibDeflate: Decompress fails.")os.exit(1)end;f5:write(fd)if dy and dy~=io.stdin then dy:close()end;if f5 and f5~=io.stdout then f5:close()end;io.stderr:write(("Successfully writes %d bytes"):format(fd:len()))os.exit(0)end end;return b end)()local fe=dofile("rom/modules/main/cc/expect.lua")local fe,ff=fe.expect,fe.field;local fg=nil;settings.define("containers.compression_level",{description="The level of compression for the file systems on a scale of 1-8",default=4,type="number"})settings.save()local fh=settings.get("containers.compression_level")local fi={}local function fj(p,fk)fk=fk or{}if p==nil then return nil end;if fk[p]then return fk[p]end;local fl;if type(p)=='table'then fl={}fk[p]=fl;for l,w in next,p,nil do fl[fj(l,fk)]=fj(w,fk)end;setmetatable(fl,fj(getmetatable(p),fk))else fl=p end;return fl end;local function fm(fn)sleep()local fo={}for a0,fp in ipairs(fs.list(fn))do local fq=fs.combine(fn,fp)if fs.isDir(fq)then fo[fp]=fm(fq)else local fr=fs.open(fq,"r")fo[fp]=fr.readAll()fr.close()end end;return fo end;local function ft()if not _G.rom_cache then _G.rom_cache=fm("/rom")end;return _G.rom_cache end;function fi.getENV(path,has_http)local fw=fj(_G)setmetatable(fw,{__index=_G})local function fx()if fg then fg.rom=ft()return fg end;if not fs.exists(path)then return{rom=ft()}end;local fp=fs.open(path,"r")local fy=fp.readAll()fp.close()local fz=a:DecompressDeflate(fy,{level=fh})local fA=textutils.unserialize(fz)or{}fg=fA;fA.rom=ft()return fA end;local function fB(fA)fg=fA;fA.rom=nil;fA=textutils.serialize(fA)local fp=fs.open(fu,"w")fp.write(a:CompressDeflate(fA,{level=fh}))fp.close()end;local function fC(fn)local fD={}for fE in string.gmatch(fn,"[^/]+")do if fE==""or fE=="."then elseif fE==".."then if#fD>0 then table.remove(fD)end else fD[#fD+1]=fE end end;return fD end;local function fF(fn)fe(1,fn,"string")local fD=fC(fn)local fG=fx()if#fD==0 then return fG end;for j=1,#fD do local fE=fD[j]if type(fG)~="table"then return nil end;fG=fG[fE]if fG==nil then return nil end end;return fG end;local function fH(fn,fA)fe(1,fn,"string")local fD=fC(fn)local fI=fx()local fG=fI;for j,fE in ipairs(fD)do if j==#fD then fG[fE]=fA elseif type(fG[fE])=="table"then fG=fG[fE]elseif type(fG[fE])=="string"then return end end;fB(fI)end;function fw.fs.list(fn)fe(1,fn,"string")local fo={}local fA=fF(fn)if fA then for l,w in pairs(fA)do table.insert(fo,l)end end;return fo end;function fw.fs.isDir(fn)fe(1,fn,"string")local fA=fF(fn)return type(fA)=="table"end;function fw.fs.isReadOnly(fn)if fn==""then return false end;fe(1,fn,"string")local fJ=string.find(fn,"rom")return fJ~=nil and fJ<3 end;function fw.fs.exists(fn)fe(1,fn,"string")local fA=fF(fn)return fA~=nil end;function fw.fs.complete(fK,fL,fM,fN)fe(1,fK,"string")fe(2,fL,"string")local fO=nil;if type(fM)=="table"then fN=ff(fM,"include_dirs","boolean","nil")fO=ff(fM,"include_hidden","boolean","nil")fM=ff(fM,"include_files","boolean","nil")else fe(3,fM,"boolean","nil")fe(4,fN,"boolean","nil")end;fO=fO~=false;fM=fM~=false;fN=fN~=false;local fP=fL;local fQ=1;local fR=string.find(fK,"[/\\]",fQ)if fR==1 then fP=""fQ=2 end;local fS;while not fS do local fR=string.find(fK,"[/\\]",fQ)if fR then local fT=string.sub(fK,fQ,fR-1)fP=fw.fs.combine(fP,fT)fQ=fR+1 else fS=string.sub(fK,fQ)end end;if fw.fs.isDir(fP)then local fU={}if fN and fK==""then table.insert(fU,".")end;if fP~=""then if fK==""then table.insert(fU,fN and".."or"../")elseif fK=="."then table.insert(fU,fN and"."or"./")end end;local has_http=fw.fs.list(fP)for o=1,#has_http do local fW=has_http[o]if#fW>=#fS and string.sub(fW,1,#fS)==fS and(fO or fW:sub(1,1)~="."or fS:sub(1,1)==".")then local fX=fw.fs.isDir(fs.combine(fP,fW))local fY=string.sub(fW,#fS+1)if fX then table.insert(fU,fY.."/")if fN and#fY>0 then table.insert(fU,fY)end else if fM and#fY>0 then table.insert(fU,fY)end end end end;return fU end;return{}end;local function fZ(fn,f_)fe(1,fn,"string")local fA=fF(fn)or""local g0=#fA;local g1=1;return{readAll=function()if fA==nil then return nil end;fA=fA:sub(g1)g1=g0+1;return fA end,readLine=function(g2)if fA==nil then return nil end;if g1>g0 then return nil end;local g3=g1;local g4=fA:find("\n",g3,true)local g5;if g4 then if g2 then g5=fA:sub(g3,g4)else g5=fA:sub(g3,g4-1)end;g1=g4+1 else g5=fA:sub(g3)g1=g0+1 end;return g5 end,read=function(g6)if type(g6)=="table"then g6=1 end;fe(1,g6,"number","nil")if fA==nil then return nil end;if not g6 then g6=1 end;if g1>g0 then return nil end;local g7=string.sub(fA,g1,g1+g6-1)g1=g1+#g7;if g7==""then return nil elseif f_ and g6==1 then return string.byte(g7)end;return g7 end,seek=function(fJ,g8)if fA==nil then return nil,"File is closed"end;fJ=fJ or 0;g8=g8 or"cur"if g8=="set"then g1=math.min(math.max(0,fJ),g0)+1 elseif g8=="cur"then g1=math.min(math.max(1,g1+fJ),g0+1)elseif g8=="end"then g1=math.min(math.max(0,g0+fJ),g0)+1 end;return g1-1 end,close=function()fA=nil end}end;local function g9(fn,f_,ga)local fA=""local g1=1;if ga then fA=fF(fn)or""g1=#fA+1 end;local fr;local function gb(gc)if fA==nil then error("File is closed",2)end;if type(gc)=="number"and f_ then gc=string.char(gc)elseif type(gc)~="string"then error("bad argument #1 (string or number expected, got "..type(gc).." )",2)end;fA=string.sub(fA,1,g1-1)..gc..string.sub(fA,g1+#gc)g1=g1+#gc end;fr={write=gb,writeLine=function(gc)if fA==nil then error("File is closed",2)end;fe(1,gc,"string")gb(gc.."\n")end,flush=function()if fA==nil then error("File is closed",2)end;fH(fn,fA)end,close=function()if fA==nil then error("File is already closed",2)end;fH(fn,fA)fA=nil end}return fr end;local function gd(fn,f_,ge)fe(1,fn,"string")local fA=ge and""or(fF(fn)or"")local g0=#fA;local g1=1;local fr={}fr.readAll=function()if fA==nil then return nil end;fA=fA:sub(g1)g1=g0+1;return fA end;fr.readLine=function(g2)if fA==nil then return nil end;if g1>g0 then return nil end;local g3=g1;local g4=fA:find("\n",g3,true)local g5;if g4 then if g2 then g5=fA:sub(g3,g4)else g5=fA:sub(g3,g4-1)end;g1=g4+1 else g5=fA:sub(g3)g1=g0+1 end;return g5 end;function fr.read(g6)if type(g6)=="table"then g6=1 end;fe(1,g6,"number","nil")if fA==nil then error("File is closed",2)end;if not g6 then g6=1 end;if g1>g0 then return nil end;local g7=fA:sub(g1,g1+g6-1)g1=g1+#g7;if g7==""then return nil elseif f_ and g6==1 then return string.byte(g7)end;return g7 end;function fr.seek(fJ,g8)if fA==nil then return nil,"File is closed"end;fJ=fJ or 0;g8=g8 or"cur"if g8=="set"then g1=math.min(math.max(0,fJ),g0)+1 elseif g8=="cur"then g1=math.min(math.max(1,g1+fJ),g0+1)elseif g8=="end"then g1=math.min(math.max(0,g0+fJ),g0)+1 else error("bad argument #2 (invalid whence)",2)end;return g1-1 end;function fr.write(gc)if type(gc)=="number"and f_ then gc=string.char(gc)elseif type(gc)~="string"then error("bad argument #1 (string or number expected, got "..type(gc).." )",2)end;if fA==nil then error("File is closed",2)end;fA=string.sub(fA,1,g1-1)..gc..string.sub(fA,g1+#gc)g1=g1+#gc;g0=#fA end;function fr.writeLine(gc)fe(1,gc,"string")fr.write(gc.."\n")end;function fr.flush()if fA==nil then error("File is closed",2)end;fH(fn,fA)end;function fr.close()if fA==nil then error("File is already closed",2)end;fH(fn,fA)fA=nil end;return fr end;local function gf(fr)local gg=false;return{read=function(self,gh)if gg then error("File is closed",2)end;fe(2,gh,"string","nil")if not gh then gh="l"end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;if string.find(gh,"%*")==1 then gh=gh:gsub("%*","")end;if gh=="l"then return fr.readLine(false)elseif gh=="L"then return fr.readLine(true)elseif gh=="a"then return fr.readAll()else error("Unsupported read mode",2)end end,seek=function(self,g8,fJ)if gg then error("File is closed",2)end;fe(2,g8,"string","nil")fe(3,fJ,"number","nil")if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;return fr.seek(fJ,g8)end,write=function(self,...)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;local gi={...}for j=1,#gi do local gj=gi[j]if type(gj)~="string"and type(gj)~="number"then error("bad argument #"..j+1 .." (string or number expected, got "..type(gj).." )",2)end;fr.write(gj)end end,close=function(self)if gg then error("File is already closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;fr.close()gg=true end,flush=function(self)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;fr.flush()end,lines=function(self)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;return function()if gg then error("file is already closed",2)end;return fr.readLine(false)end end}end;function fw.fs.open(fn,gh)fe(1,fn,"string")fe(2,gh,"string")if gh=="r"or gh=="rb"then if fw.fs.exists(fn)then return fZ(fn,gh=="rb")else error("File not found",2)end elseif gh=="w"or gh=="wb"then return g9(fn,gh=="wb",false)elseif gh=="a"or gh=="ab"then return g9(fn,gh=="ab",true)elseif gh=="r+"or gh=="rb+"or gh=="r+b"then if fw.fs.exists(fn)then return gd(fn,gh=="rb+"or gh=="r+b",false)else error("File not found",2)end elseif gh=="w+"or gh=="wb+"or gh=="w+b"then return gd(fn,gh=="wb+"or gh=="w+b",true)elseif gh=="a+"or gh=="ab+"or gh=="a+b"then return gd(fn,gh=="ab+"or gh=="a+b",true)else error("Invalid mode",2)end end;function fw.fs.move(gk,gl)fe(1,gk,"string")fe(2,gl,"string")if not fw.fs.exists(gk)then error("Source does not exist",2)end;if fw.fs.exists(gl)then error("Destination already exists",2)end;local fA=fF(gk)fH(gl,fA)fH(gk,nil)end;function fw.fs.copy(gk,gl)fe(1,gk,"string")fe(2,gl,"string")if not fw.fs.exists(gk)then error("Source does not exist",2)end;if fw.fs.exists(gl)then error("Destination already exists",2)end;local fA=fF(gk)fH(gl,fA)end;local function gm(fn,fD,j,fo)local fE=fD[j]if not fE then if fw.fs.exists(fn)then fo[#fo+1]=fn end elseif fE.exact then return gm(fw.fs.combine(fn,fE.contents),fD,j+1,fo)else if not fw.fs.isDir(fn)then return end;local gn=fw.fs.list(fn)for k=1,#gn do local fp=gn[k]if fp:find(fE.contents)then gm(fw.fs.combine(fn,fp),fD,j+1,fo)end end end end;local go={["^"]="%^",["$"]="%$",["("]="%(",[")"]="%)",["%"]="%%",["."]="%.",["["]="%[",["]"]="%]",["+"]="%+",["-"]="%-",["*"]=".*",["?"]="."}function fw.fs.find(gp)fe(1,gp,"string")gp=fw.fs.combine(gp)if gp==".."or gp:sub(1,3)=="../"then error("/"..gp..": Invalid Path",2)end;if not gp:find("[*?]")then if fw.fs.exists(gp)then return{gp}else return{}end end;local fD={}for fE in gp:gmatch("[^/]+")do if fE:find("[*?]")then fD[#fD+1]={exact=false,contents="^"..fE:gsub(".",go).."$"}else fD[#fD+1]={exact=true,contents=fE}end end;local fo={}gm("",fD,1,fo)return fo end;function fw.io.open(fn,gh)fe(1,fn,"string")fe(2,gh,"string","nil")if not gh then gh="r"end;local fr;if gh=="r"or gh=="rb"then if fw.fs.exists(fn)and not fw.fs.isDir(fn)then fr=fZ(fn,gh=="rb")elseif fw.fs.isDir(fn)then return nil,"Attempt to open a directory"else return nil,"File not found"end elseif gh=="w"or gh=="wb"then fr=g9(fn,gh=="wb",false)elseif gh=="a"or gh=="ab"then fr=g9(fn,gh=="ab",true)elseif gh=="r+"or gh=="rb+"or gh=="r+b"then if fw.fs.exists(fn)and not fw.fs.isDir(fn)then fr=gd(fn,gh=="rb+"or gh=="r+b",false)elseif fw.fs.isDir(fn)then return nil,"Attempt to open a directory"else return nil,"File not found"end elseif gh=="w+"or gh=="wb+"or gh=="w+b"then fr=gd(fn,gh=="wb+"or gh=="w+b",true)elseif gh=="a+"or gh=="ab+"or gh=="a+b"then fr=gd(fn,gh=="ab+"or gh=="a+b",true)else return nil,"Invalid mode"end;return gf(fr)end;function fw.io.lines(fn,...)local gi={...}fe(1,fn,"string")local fr=fw.io.open(fn,table.unpack(gi))local g6=0;return function()g6=g6+1;local g5=fr:read(gi[g6%#gi+1]or"l")if g5==nil then fr:close()end;return g5 end end;function fw.fs.delete(fn)fe(1,fn,"string")if not fw.fs.exists(fn)then error("File not found",2)end;fH(fn,nil)end;function fw.fs.getSize(fn)fe(1,fn,"string")if not fw.fs.exists(fn)then error("File not found",2)end;if fw.fs.isDir(fn)then return 0 else return#fF(fn)end end;function fw.fs.makeDir(fn)fe(1,fn,"string")if fw.fs.exists(fn)then return end;fH(fn,{})end;local gq={}local gr=false;function fw.loadfile(gs,gh,gt)if type(gh)=="table"and gt==nil then gh,gt=nil,gh end;fe(1,gs,"string")fe(2,gh,"string","nil")fe(3,gt,"table","nil")local fp=fw.fs.open(gs,"r")if not fp then return nil,"File not found"end;local gu,gv=load(fp.readAll(),"@/"..fs.combine(gs),gh,gt)fp.close()return gu,gv end;function fw.dofile(gw)fe(1,gw,"string")local gx,f=fw.loadfile(gw,nil,_G)if gx then return gx()else error(f,2)end end;function fw.loadAPI(gy)fe(1,gy,"string")local fS=fs.getName(gy)if fS:sub(-4)==".lua"then fS=fS:sub(1,-5)end;if fS=="term"then return true end;if gq[fS]==true then printError("API "..fS.." is already being loaded")return false end;gq[fS]=true;local gz={}setmetatable(gz,{__index=fw})local gA,gv=fw.loadfile(gy,nil,gz)if gA then local gB,gv=pcall(gA)if not gB then gq[fS]=nil;return error("Failed to load API "..fS.." due to "..gv,1)end else gq[fS]=nil;return error("Failed to load API "..fS.." due to "..gv,1)end;local gC={}for l,w in pairs(gz)do if l~="_ENV"then gC[l]=w end end;fw[fS]=gC;gq[fS]=nil;return true end;local function gD(gE)if not fw.fs.isDir(gE)then return end;for a0,fp in ipairs(fw.fs.list(gE))do if fp:sub(1,1)~="."then local fn=fs.combine(gE,fp)if not fs.isDir(fn)then if not fw.loadAPI(fn)then gr=true end end end end end;function fw.os.run(gF,gy,...)fe(1,gF,"table")fe(2,gy,"string")local gz=gF;setmetatable(gz,{__index=fw})if settings.get("bios.strict_globals",false)then gz._ENV=gz;getmetatable(gz).__newindex=function(a0,gG)error("Attempt to create global "..tostring(gG),2)end end;local gx,gv=fw.loadfile(gy,nil,gz)if gx then local gB,gv=pcall(gx,...)if not gB then if gv and gv~=""then printError(gv)end;return false end;return true end;if gv and gv~=""then printError(gv)end;return false end;fw.settings=settings;fw._ENV=fw;fw._G=fw;fw.shell=nil;fw.multishell=nil;gD("rom/apis")if http and has_http then fw.http=http;gD("rom/apis/http")end;return fw end;local gH=dofile("rom/modules/main/cc/internal/tiny_require.lua")("cc.internal.exception")local function gI(...)local gJ={co=coroutine.running()}local gK=table.pack(...)local gL={}for j=1,gK.n,1 do local gM=gK[j]if type(gM)~="function"then error("bad argument #"..j.." (function expected, got "..type(gM)..")",3)end;gL[j]={co=coroutine.create(function()return gH.try_barrier(gJ,gM)end),filter=nil}end;return gL end;local function gN(gL,gO)local g6=#gL;if g6<1 then return 0 end;local gP=g6;local gQ={n=0}while true do for j=1,g6 do local gR=gL[j]if gR and(gR.filter==nil or gR.filter==gQ[1]or gQ[1]=="terminate")then local gB,gS=coroutine.resume(gR.co,table.unpack(gQ,1,gQ.n))if gB then if gS=="thread_shutdown"then return{command=true,type="shutdown"}elseif gS=="thread_reboot"then print("reboot")return{command=true,type="reboot"}else gR.filter=gS end elseif type(gS)=="string"and gH.can_wrap_errors()then printError(gH.make_exception(gS,gR.co))else printError(gS)end;if coroutine.status(gR.co)=="dead"then gL[j]=false;gP=gP-1;if gP<=gO then return j end end end end;gQ=table.pack(os.pullEventRaw())end end;function fi.start(gt)local gT=nil;gt.os.reboot=function()gT="reboot"sleep()end;gt.os.shutdown=function()gT="shutdown"sleep()end;local gu=function()gT=nil;settings.define("shell.allow_startup",{default=true,description="Run startup files when the computer turns on.",type="boolean"})settings.define("shell.allow_disk_startup",{default=commands==nil,description="Run startup files from disk drives when the computer turns on.",type="boolean"})settings.define("shell.autocomplete",{default=true,description="Autocomplete program and arguments in the shell.",type="boolean"})settings.define("edit.autocomplete",{default=true,description="Autocomplete API and function names in the editor.",type="boolean"})settings.define("lua.autocomplete",{default=true,description="Autocomplete API and function names in the Lua REPL.",type="boolean"})settings.define("edit.default_extension",{default="lua",description=[[The file extension the editor will use if none is given. Set to "" to disable.]],type="string"})settings.define("paint.default_extension",{default="nfp",description=[[The file extension the paint program will use if none is given. Set to "" to disable.]],type="string"})settings.define("list.show_hidden",{default=false,description=[[Whether the list program show hidden files (those starting with ".").]],type="boolean"})settings.define("motd.enable",{default=pocket==nil,description="Display a random message when the computer starts up.",type="boolean"})settings.define("motd.path",{default="/rom/motd.txt:/motd.txt",description=[[The path to load random messages from. Should be a colon (":") separated string of file paths.]],type="string"})settings.define("lua.warn_against_use_of_local",{default=true,description=[[Print a message when input in the Lua REPL starts with the word 'local'. Local variables defined in the Lua REPL are be inaccessible on the next input.]],type="boolean"})settings.define("lua.function_args",{default=true,description="Show function arguments when printing functions.",type="boolean"})settings.define("lua.function_source",{default=false,description="Show where a function was defined when printing functions.",type="boolean"})settings.define("bios.strict_globals",{default=false,description="Prevents assigning variables into a program's environment. Make sure you use the local keyword or assign to _G explicitly.",type="boolean"})settings.define("bios.use_multishell",{default=true,description="Allow running multiple program at once, through the use of the \"fg\" and \"bg\" programs..",type="boolean"})settings.define("shell.autocomplete_hidden",{default=false,description=[[Autocomplete hidden files and folders (those starting with ".").]],type="boolean"})print("running container!")return gN(gI(function()local gU;if term.isColour()and settings.get("bios.use_multishell")then gU="rom/programs/advanced/multishell.lua"else gU="rom/programs/shell.lua"end;os.run({},gU)os.run({},"rom/programs/shutdown.lua")end,function()while true do sleep()if gT=="shutdown"then while true do coroutine.yield("thread_shutdown")end elseif gT=="reboot"then while true do coroutine.yield("thread_reboot")end end end end),0)end;local gT="starting"while gT=="starting"or type(gT)=="table"and gT.command and gT.type=="reboot"do gT=setfenv(gu,fj(gt))()end end;return fi:".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;local _=#Z;local L=1;local R=1;local S=0;while L<=_-15 do local a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,aa,ab,ac,ad,ae,af=i(Z,L,L+15)S=(S+16*R+16*a0+15*a1+14*a2+13*a3+12*a4+11*a5+10*a6+9*a7+8*a8+7*a9+6*aa+5*ab+4*ac+3*ad+2*ae+af)%65521;R=(R+a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+aa+ab+ac+ad+ae+af)%65521;L=L+16 end;while L<=_ do local ag=i(Z,L,L)R=(R+ag)%65521;S=(S+R)%65521;L=L+1 end;return(S*65536+R)%4294967296 end;local function ah(ai,aj)return ai%4294967296==aj%4294967296 end;function b:CreateDictionary(Z,_,ak)if type(Z)~="string"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;if type(_)~="number"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'strlen\' - number expected got \'%s\'."):format(type(_)),2)end;if type(ak)~="number"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'adler32\' - number expected got \'%s\'."):format(type(ak)),2)end;if _~=#Z then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'strlen\' does not match the actual length of \'str\'.".." \'strlen\': %u, \'#str\': %u .".." Please check if \'str\' is modified unintentionally."):format(_,#Z))end;if _==0 then error("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - Empty string is not allowed.",2)end;if _>32768 then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'str\' - string longer than 32768 bytes is not allowed.".." Got %d bytes."):format(_),2)end;local al=self:Adler32(Z)if not ah(ak,al)then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." \'adler32\' does not match the actual adler32 of \'str\'.".." \'adler32\': %u, \'Adler32(str)\': %u .".." Please check if \'str\' is modified unintentionally."):format(ak,al))end;local am={}am.adler32=ak;am.hash_tables={}am.string_table={}am.strlen=_;local an=am.string_table;local ao=am.hash_tables;an[1]=i(Z,1,1)an[2]=i(Z,2,2)if _>=3 then local L=1;local ap=an[1]*256+an[2]while L<=_-2-3 do local a0,a1,a2,a3=i(Z,L+2,L+5)an[L+2]=a0;an[L+3]=a1;an[L+4]=a2;an[L+5]=a3;ap=(ap*256+a0)%16777216;local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a1)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a2)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1;ap=(ap*256+a3)%16777216;W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1 end;while L<=_-2 do local ag=i(Z,L+2)an[L+2]=ag;ap=(ap*256+ag)%16777216;local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=L-_;L=L+1 end end;return am end;local function aq(am)if type(am)~="table"then return false,("\'dictionary\' - table expected got \'%s\'."):format(type(am))end;if type(am.adler32)~="number"or type(am.string_table)~="table"or type(am.strlen)~="number"or am.strlen<=0 or am.strlen>32768 or am.strlen~=#am.string_table or type(am.hash_tables)~="table"then return false,("\'dictionary\' - corrupted dictionary."):format(type(am))end;return true,""end;local ar={[0]={false,nil,0,0,0},[1]={false,nil,4,8,4},[2]={false,nil,5,18,8},[3]={false,nil,6,32,32},[4]={true,4,4,16,16},[5]={true,8,16,32,32},[6]={true,8,16,128,128},[7]={true,8,32,128,256},[8]={true,32,128,258,1024},[9]={true,32,258,258,4096}}local function as(Z,at,am,au,av)if type(Z)~="string"then return false,("\'str\' - string expected got \'%s\'."):format(type(Z))end;if at then local aw,ax=aq(am)if not aw then return false,ax end end;if au then local ay=type(av)if ay~="nil"and ay~="table"then return false,("\'configs\' - nil or table expected got \'%s\'."):format(type(av))end;if ay=="table"then for az,aA in pairs(av)do if az~="level"and az~="strategy"then return false,("\'configs\' - unsupported table key in the configs: \'%s\'."):format(az)elseif az=="level"and not ar[aA]then return false,("\'configs\' - unsupported \'level\': %s."):format(tostring(aA))elseif az=="strategy"and aA~="fixed"and aA~="huffman_only"and aA~="dynamic"then return false,("\'configs\' - unsupported \'strategy\': \'%s\'."):format(tostring(aA))end end end end;return true,""end;local aB=0;local aC=1;local aD=2;local aE=3;local function aF()local aG=0;local aH=0;local aI=0;local aJ=0;local aK={}local aL={}local function aM(P,U)aH=aH+P*p[aI]aI=aI+U;aJ=aJ+U;if aI>=32 then aG=aG+1;aK[aG]=q[aH%256]..q[(aH-aH%256)/256%256]..q[(aH-aH%65536)/65536%256]..q[(aH-aH%16777216)/16777216%256]local aN=p[32-aI+U]aH=(P-P%aN)/aN;aI=aI-32 end end;local function aO(Z)for Q=1,aI,8 do aG=aG+1;aK[aG]=j(aH%256)aH=(aH-aH%256)/256 end;aI=0;aG=aG+1;aK[aG]=Z;aJ=aJ+#Z*8 end;local function aP(aQ)if aQ==aE then return aJ end;if aQ==aC or aQ==aD then local aR=(8-aI%8)%8;if aI>0 then aH=aH-p[aI]+p[aI+aR]for Q=1,aI,8 do aG=aG+1;aK[aG]=q[aH%256]aH=(aH-aH%256)/256 end;aH=0;aI=0 end;if aQ==aD then aJ=aJ+aR;return aJ end end;local aS=n(aK)aK={}aG=0;aL[#aL+1]=aS;if aQ==aB then return aJ else return aJ,n(aL)end end;return aM,aO,aP end;local function aT(aU,aV,aW)aW=aW+1;aU[aW]=aV;local P=aV[1]local aX=aW;local aY=(aX-aX%2)/2;while aY>=1 and aU[aY][1]>P do local W=aU[aY]aU[aY]=aV;aU[aX]=W;aX=aY;aY=(aY-aY%2)/2 end end;local function aZ(aU,aW)local a_=aU[1]local aV=aU[aW]local P=aV[1]aU[1]=aV;aU[aW]=a_;aW=aW-1;local aX=1;local b0=aX*2;local b1=b0+1;while b0<=aW do local b2=aU[b0]if b1<=aW and aU[b1][1]1 do local bl=aZ(aU,aW)aW=aW-1;local bm=aZ(aU,aW)aW=aW-1;local bn={bl[1]+bm[1],-1,bl,bm}aT(aU,bn,aW)aW=aW+1 end;local bo=0;local bp={aU[1],0,0,0}local bq=1;local br=1;aU[1][1]=0;while br<=bq do local aV=bp[br]local U=aV[1]local bc=aV[2]local b2=aV[3]local b3=aV[4]if b2 then bq=bq+1;bp[bq]=b2;b2[1]=U+1 end;if b3 then bq=bq+1;bp[bq]=b3;b3[1]=U+1 end;br=br+1;if U>b8 then bo=bo+1;U=b8 end;if bc>=0 then b6[bc]=U;bg=bc>bg and bc or bg;b5[U]=(b5[U]or 0)+1 end end;if bo>0 then repeat local U=b8-1;while(b5[U]or 0)==0 do U=U-1 end;b5[U]=b5[U]-1;b5[U+1]=(b5[U+1]or 0)+2;b5[b8]=b5[b8]-1;bo=bo-2 until bo<=0;br=1;for U=b8,1,-1 do local bs=b5[U]or 0;while bs>0 do local bc=bh[br][2]b6[bc]=U;bs=bs-1;br=br+1 end end end;bi=b4(b5,b6,b7,b8)return b6,bi,bg end end;local function bt(bu,bv,bw,bx)local by=0;local bz={}local bA={}local bB=0;local bC={}local bD=nil;local bk=0;bx=bx<0 and 0 or bx;local bE=bv+bx+1;for X=0,bE+1 do local V=X<=bv and(bu[X]or 0)or(X<=bE and(bw[X-bv-1]or 0)or nil)if V==bD then bk=bk+1;if V~=0 and bk==6 then by=by+1;bz[by]=16;bB=bB+1;bC[bB]=3;bA[16]=(bA[16]or 0)+1;bk=0 elseif V==0 and bk==138 then by=by+1;bz[by]=18;bB=bB+1;bC[bB]=127;bA[18]=(bA[18]or 0)+1;bk=0 end else if bk==1 then by=by+1;bz[by]=bD;bA[bD]=(bA[bD]or 0)+1 elseif bk==2 then by=by+1;bz[by]=bD;by=by+1;bz[by]=bD;bA[bD]=(bA[bD]or 0)+2 elseif bk>=3 then by=by+1;local bF=bD~=0 and 16 or(bk<=10 and 17 or 18)bz[by]=bF;bA[bF]=(bA[bF]or 0)+1;bB=bB+1;bC[bB]=bk<=10 and bk-3 or bk-11 end;bD=V;if V and V~=0 then by=by+1;bz[by]=V;bA[V]=(bA[V]or 0)+1;bk=0 else bk=1 end end end;return bz,bC,bA end;local function bG(Z,W,bH,bI,bJ)local L=bH-bJ;while L<=bI-15-bJ do W[L],W[L+1],W[L+2],W[L+3],W[L+4],W[L+5],W[L+6],W[L+7],W[L+8],W[L+9],W[L+10],W[L+11],W[L+12],W[L+13],W[L+14],W[L+15]=i(Z,L+bJ,L+15+bJ)L=L+16 end;while L<=bI-bJ do W[L]=i(Z,L+bJ,L+bJ)L=L+1 end;return W end;local function bK(bL,an,ao,bM,bN,bJ,am)local bO=ar[bL]local bP,bQ,bR,bS,bT=bO[1],bO[2],bO[3],bO[4],bO[5]local bU=not bP and bR or 2147483646;local bV=bT-bT%4/4;local ap;local bW;local bX;local bY=0;if am then bW=am.hash_tables;bX=am.string_table;bY=am.strlen;assert(bM==1)if bN>=bM and bY>=2 then ap=bX[bY-1]*65536+bX[bY]*256+an[1]local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=-1 end;if bN>=bM+1 and bY>=1 then ap=bX[bY]*65536+an[1]*256+an[2]local W=ao[ap]if not W then W={}ao[ap]=W end;W[#W+1]=0 end end;local bZ=bY+3;ap=(an[bM-bJ]or 0)*256+(an[bM+1-bJ]or 0)local b_={}local c0=0;local c1={}local c2={}local c3=0;local c4={}local c5={}local c6=0;local c7={}local c8=0;local c9=false;local ca;local cb;local cc=0;local cd=0;local br=bM;local ce=bN+(bP and 1 or 0)while br<=ce do local cf=br-bJ;local cg=bJ-3;ca=cc;cb=cd;cc=0;ap=(ap*256+(an[cf+2]or 0))%16777216;local ch;local ci;local cj=ao[ap]local ck;if not cj then ck=0;cj={}ao[ap]=cj;if bW then ci=bW[ap]ch=ci and#ci or 0 else ch=0 end else ck=#cj;ci=cj;ch=ck end;if br<=bN then cj[ck+1]=br end;if ch>0 and br+2<=bN and(not bP or ca=bQ and bV or bT;local cm=bN-br;cm=cm>=257 and 257 or cm;cm=cm+cf;local cn=cf+3;while ch>=1 and cl>0 do local bD=ci[ch]if br-bD>32768 then break end;if bD
=-257 then local cp=bD-cg;while co<=cm and an[cp]==an[co]do co=co+1;cp=cp+1 end else local cp=bZ+bD;while co<=cm and bX[cp]==an[co]do co=co+1;cp=cp+1 end end;local N=co-cf;if N>cc then cc=N;cd=br-bD end;if cc>=bS then break end end;ch=ch-1;cl=cl-1;if ch==0 and bD>0 and bW then ci=bW[ap]ch=ci and#ci or 0 end end end;if not bP then ca,cb=cc,cd end;if(not bP or c9)and(ca>3 or ca==3 and cb<4096)and cc<=ca then local X=s[ca]local cq=u[ca]local cr,cs,ct;if cb<=256 then cr=v[cb]ct=w[cb]cs=x[cb]else cr=16;cs=7;local R=384;local S=512;while true do if cb<=R then ct=(cb-S/2-1)%(S/4)break elseif cb<=S then ct=(cb-S/2-1)%(S/4)cr=cr+1;break else cr=cr+2;cs=cs+1;R=R*2;S=S*2 end end end;c0=c0+1;b_[c0]=X;c1[X]=(c1[X]or 0)+1;c3=c3+1;c2[c3]=cr;c4[cr]=(c4[cr]or 0)+1;if cq>0 then local cu=t[ca]c6=c6+1;c5[c6]=cu end;if cs>0 then c8=c8+1;c7[c8]=ct end;for L=br+1,br+ca-(bP and 2 or 1)do ap=(ap*256+(an[L-bJ+2]or 0))%16777216;if ca<=bU then cj=ao[ap]if not cj then cj={}ao[ap]=cj end;cj[#cj+1]=L end end;br=br+ca-(bP and 1 or 0)c9=false elseif not bP or c9 then local X=an[bP and cf-1 or cf]c0=c0+1;b_[c0]=X;c1[X]=(c1[X]or 0)+1;br=br+1 else c9=true;br=br+1 end end;c0=c0+1;b_[c0]=256;c1[256]=(c1[256]or 0)+1;return b_,c5,c1,c2,c7,c4 end;local function cv(c1,c4)local cw,cx,bv=be(c1,15,285)local cy,cz,bx=be(c4,15,29)local cA,bC,cB=bt(cw,bv,cy,bx)local cC,cD=be(cB,7,18)local cE=0;for L=1,19 do local bc=C[L]local cF=cC[bc]or 0;if cF~=0 then cE=L end end;cE=cE-4;local cG=bv+1-257;local cH=bx+1-1;if cH<0 then cH=0 end;return cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz end;local function cI(b_,c2,cE,cC,cA,cw,cy)local cJ=17;cJ=cJ+(cE+4)*3;for L=1,#cA do local X=cA[L]cJ=cJ+cC[X]if X>=16 then cJ=cJ+(X==16 and 2 or(X==17 and 3 or 7))end end;local cK=0;for L=1,#b_ do local X=b_[L]local cL=cw[X]cJ=cJ+cL;if X>256 then cK=cK+1;if X>264 and X<285 then local cM=z[X-256]cJ=cJ+cM end;local cr=c2[cK]local cN=cy[cr]cJ=cJ+cN;if cr>3 then local cs=(cr-cr%2)/2-1;cJ=cJ+cs end end end;return cJ end;local function cO(aM,cP,b_,c5,c2,c7,cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz)aM(cP and 1 or 0,1)aM(2,2)aM(cG,5)aM(cH,5)aM(cE,4)for L=1,cE+4 do local bc=C[L]local cF=cC[bc]or 0;aM(cF,3)end;local cQ=1;for L=1,#cA do local X=cA[L]aM(cD[X],cC[X])if X>=16 then local cR=bC[cQ]aM(cR,X==16 and 2 or(X==17 and 3 or 7))cQ=cQ+1 end end;local cK=0;local cS=0;local cT=0;for L=1,#b_ do local cU=b_[L]local b9=cx[cU]local cL=cw[cU]aM(b9,cL)if cU>256 then cK=cK+1;if cU>264 and cU<285 then cS=cS+1;local cV=c5[cS]local cM=z[cU-256]aM(cV,cM)end;local cW=c2[cK]local cX=cz[cW]local cN=cy[cW]aM(cX,cN)if cW>3 then cT=cT+1;local ct=c7[cT]local cs=(cW-cW%2)/2-1;aM(ct,cs)end end end end;local function cY(b_,c2)local cJ=3;local cK=0;for L=1,#b_ do local X=b_[L]local cL=F[X]cJ=cJ+cL;if X>256 then cK=cK+1;if X>264 and X<285 then local cM=z[X-256]cJ=cJ+cM end;local cr=c2[cK]cJ=cJ+5;if cr>3 then local cs=(cr-cr%2)/2-1;cJ=cJ+cs end end end;return cJ end;local function cZ(aM,cP,b_,c5,c2,c7)aM(cP and 1 or 0,1)aM(1,2)local cK=0;local cS=0;local cT=0;for L=1,#b_ do local c_=b_[L]local b9=D[c_]local cL=F[c_]aM(b9,cL)if c_>256 then cK=cK+1;if c_>264 and c_<285 then cS=cS+1;local cV=c5[cS]local cM=z[c_-256]aM(cV,cM)end;local cr=c2[cK]local cX=H[cr]aM(cX,5)if cr>3 then cT=cT+1;local ct=c7[cT]local cs=(cr-cr%2)/2-1;aM(ct,cs)end end end end;local function d0(bM,bN,aJ)assert(bN-bM+1<=65535)local cJ=3;aJ=aJ+3;local aR=(8-aJ%8)%8;cJ=cJ+aR;cJ=cJ+32;cJ=cJ+(bN-bM+1)*8;return cJ end;local function d1(aM,aO,cP,Z,bM,bN,aJ)assert(bN-bM+1<=65535)aM(cP and 1 or 0,1)aM(0,2)aJ=aJ+3;local aR=(8-aJ%8)%8;if aR>0 then aM(p[aR]-1,aR)end;local d2=bN-bM+1;aM(d2,16)local d3=255-d2%256+(255-(d2-d2%256)/256)*256;aM(d3,16)aO(Z:sub(bM,bN))end;local function d4(av,aM,aO,aP,Z,am)local an={}local ao={}local cP=nil;local bM;local bN;local d5;local aJ=aP(aE)local _=#Z;local bJ;local bL;local d6;if av then if av.level then bL=av.level end;if av.strategy then d6=av.strategy end end;if not bL then if _<2048 then bL=7 elseif _>65536 then bL=3 else bL=5 end end;while not cP do if not bM then bM=1;bN=64*1024-1;bJ=0 else bM=bN+1;bN=bN+32*1024;bJ=bM-32*1024-1 end;if bN>=_ then bN=_;cP=true else cP=false end;local b_,c5,c1,c2,c7,c4;local cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz;local d7;local d8;local d9;if bL~=0 then bG(Z,an,bM,bN+3,bJ)if bM==1 and am then local bX=am.string_table;local da=am.strlen;for L=0,-da+1<-257 and-257 or-da+1,-1 do an[L]=bX[da+L]end end;if d6=="huffman_only"then b_={}bG(Z,b_,bM,bN,bM-1)c5={}c1={}b_[bN-bM+2]=256;for L=1,bN-bM+2 do local X=b_[L]c1[X]=(c1[X]or 0)+1 end;c2={}c7={}c4={}else b_,c5,c1,c2,c7,c4=bK(bL,an,ao,bM,bN,bJ,am)end;cG,cH,cE,cC,cD,cA,bC,cw,cx,cy,cz=cv(c1,c4)d7=cI(b_,c2,cE,cC,cA,cw,cy)d8=cY(b_,c2)end;d9=d0(bM,bN,aJ)local db=d9;db=d8 and d80 and bN+1-W[1]>32768 then if dc==1 then ao[az]=nil else local dd={}local de=0;for L=2,dc do N=W[L]if bN+1-N<=32768 then de=de+1;dd[de]=N end end;ao[az]=dd end end end end end end;local function df(Z,am,av)local aM,aO,aP=aF()d4(av,aM,aO,aP,Z,am)local aJ,dg=aP(aC)local aR=(8-aJ%8)%8;return dg,aR end;local function dh(Z,am,av)local aM,aO,aP=aF()local di=8;local dj=7;local dk=dj*16+di;aM(dk,8)local dl=am and 1 or 0;local dm=2;local dn=dm*64+dl*32;local dp=31-(dk*256+dn)%31;dn=dn+dp;aM(dn,8)if dl==1 then local ak=am.adler32;local dq=ak%256;ak=(ak-dq)/256;local dr=ak%256;ak=(ak-dr)/256;local ds=ak%256;ak=(ak-ds)/256;local dt=ak%256;aM(dt,8)aM(ds,8)aM(dr,8)aM(dq,8)end;d4(av,aM,aO,aP,Z,am)aP(aD)local ak=b:Adler32(Z)local dt=ak%256;ak=(ak-dt)/256;local ds=ak%256;ak=(ak-ds)/256;local dr=ak%256;ak=(ak-dr)/256;local dq=ak%256;aM(dq,8)aM(dr,8)aM(ds,8)aM(dt,8)local aJ,dg=aP(aC)local aR=(8-aJ%8)%8;return dg,aR end;function b:CompressDeflate(Z,av)local du,dv=as(Z,false,nil,true,av)if not du then error("Usage: LibDeflate:CompressDeflate(str, configs): "..dv,2)end;return df(Z,nil,av)end;function b:CompressDeflateWithDict(Z,am,av)local du,dv=as(Z,true,am,true,av)if not du then error("Usage: LibDeflate:CompressDeflateWithDict".."(str, dictionary, configs): "..dv,2)end;return df(Z,am,av)end;function b:CompressZlib(Z,av)local du,dv=as(Z,false,nil,true,av)if not du then error("Usage: LibDeflate:CompressZlib(str, configs): "..dv,2)end;return dh(Z,nil,av)end;function b:CompressZlibWithDict(Z,am,av)local du,dv=as(Z,true,am,true,av)if not du then error("Usage: LibDeflate:CompressZlibWithDict".."(str, dictionary, configs): "..dv,2)end;return dh(Z,am,av)end;local function dw(dx)local dy=dx;local dz=#dx;local dA=1;local aI=0;local aH=0;local function dB(U)local aN=p[U]local X;if U<=aI then X=aH%aN;aH=(aH-X)/aN;aI=aI-U else local dC=p[aI]local dr,ds,dt,dD=i(dy,dA,dA+3)aH=aH+((dr or 0)+(ds or 0)*256+(dt or 0)*65536+(dD or 0)*16777216)*dC;dA=dA+4;aI=aI+32-U;X=aH%aN;aH=(aH-X)/aN end;return X end;local function dE(dF,aK,aG)assert(aI%8==0)local dG=aI/80 then if aI<15 and dy then local dC=p[aI]local dr,ds,dt,dD=i(dy,dA,dA+3)aH=aH+((dr or 0)+(ds or 0)*256+(dt or 0)*65536+(dD or 0)*16777216)*dC;dA=dA+4;aI=aI+32 end;local aN=p[db]aI=aI-db;X=aH%aN;aH=(aH-X)/aN;X=r[db][X]bk=dJ[db]if X0 and U285 then return-10 elseif bc<256 then aG=aG+1;aK[aG]=q[bc]elseif bc>256 then bc=bc-256;local U=y[bc]U=bc>=8 and U+dB(z[bc])or U;bc=dI(cy,d_,e0)if bc<0 or bc>29 then return-10 end;local Y=A[bc]Y=Y>4 and Y+dB(B[bc])or Y;local e2=aG-Y+1;if e2=-257 then for Q=1,U do aG=aG+1;aK[aG]=aK[e2]e2=e2+1 end else e2=da+e2;for Q=1,U do aG=aG+1;aK[aG]=q[bX[e2]]e2=e2+1 end end end;if dO()<0 then return 2 end;if aG>=65536 then aL[#aL+1]=n(aK,"",1,32768)for L=32769,aG do aK[L-32768]=aK[L]end;aG=aG-32768;aK[aG+1]=nil end until bc==256;dS.buffer_size=aG;return 0 end;local function e3(dS)local aK,aG,dB,dE,dO,dP,aL=dS.buffer,dS.buffer_size,dS.ReadBits,dS.ReadBytes,dS.ReaderBitlenLeft,dS.SkipToByteBoundary,dS.result_buffer;dP()local dF=dB(16)if dO()<0 then return 2 end;local e4=dB(16)if dO()<0 then return 2 end;if dF%256+e4%256~=255 then return-2 end;if(dF-dF%256)/256+(e4-e4%256)/256~=255 then return-2 end;aG=dE(dF,aK,aG)if aG<0 then return 2 end;if aG>=65536 then aL[#aL+1]=n(aK,"",1,32768)for L=32769,aG do aK[L-32768]=aK[L]end;aG=aG-32768;aK[aG+1]=nil end;dS.buffer_size=aG;return 0 end;local function e5(dS)return dX(dS,G,E,7,K,I,5)end;local function e6(dS)local dB,dI=dS.ReadBits,dS.Decode;local e7=dB(5)+257;local e8=dB(5)+1;local e9=dB(4)+4;if e7>286 or e8>30 then return-3 end;local cC={}for L=1,e9 do cC[C[L]]=dB(3)end;local ea,eb,ec,ed=dT(cC,18,7)if ea~=0 then return-4 end;local cw={}local cy={}local br=0;while bre7+e8 then return-6 end;while bc>0 do bc=bc-1;if br7 then return nil,-13 end;local dn=dB(8)if dS.ReaderBitlenLeft()<0 then return nil,2 end;if(dk*256+dn)%31~=0 then return nil,-14 end;local dl=(dn-dn%32)/32%2;local dm=(dn-dn%64)/64%4;if dl==1 then if not am then return nil,-16 end;local dt=dB(8)local ds=dB(8)local dr=dB(8)local dq=dB(8)local al=dt*16777216+ds*65536+dr*256+dq;if dS.ReaderBitlenLeft()<0 then return nil,2 end;if not ah(al,am.adler32)then return nil,-17 end end;local dg,ek=ei(dS)if not dg then return nil,ek end;dS.SkipToByteBoundary()local ep=dB(8)local eq=dB(8)local er=dB(8)local es=dB(8)if dS.ReaderBitlenLeft()<0 then return nil,2 end;local et=ep*16777216+eq*65536+er*256+es;local eu=b:Adler32(dg)if not ah(et,eu)then return nil,-15 end;local em=dS.ReaderBitlenLeft()local en=(em-em%8)/8;return dg,en end;function b:DecompressDeflate(Z)local du,dv=as(Z)if not du then error("Usage: LibDeflate:DecompressDeflate(str): "..dv,2)end;return el(Z)end;function b:DecompressDeflateWithDict(Z,am)local du,dv=as(Z,true,am)if not du then error("Usage: LibDeflate:DecompressDeflateWithDict(str, dictionary): "..dv,2)end;return el(Z,am)end;function b:DecompressZlib(Z)local du,dv=as(Z)if not du then error("Usage: LibDeflate:DecompressZlib(str): "..dv,2)end;return eo(Z)end;function b:DecompressZlibWithDict(Z,am)local du,dv=as(Z,true,am)if not du then error("Usage: LibDeflate:DecompressZlibWithDict(str, dictionary): "..dv,2)end;return eo(Z,am)end;do F={}for ev=0,143 do F[ev]=8 end;for ev=144,255 do F[ev]=9 end;for ev=256,279 do F[ev]=7 end;for ev=280,287 do F[ev]=8 end;J={}for Y=0,31 do J[Y]=5 end;local ek;ek,G,E=dT(F,287,9)assert(ek==0)ek,K,I=dT(J,31,5)assert(ek==0)D=b4(G,F,287,9)H=b4(K,J,31,5)end;local ew={["\000"]="%z",["("]="%(",[")"]="%)",["."]="%.",["%"]="%%",["+"]="%+",["-"]="%-",["*"]="%*",["?"]="%?",["["]="%[",["]"]="%]",["^"]="%^",["$"]="%$"}local function ex(Z)return Z:gsub("([%z%(%)%.%%%+%-%*%?%[%]%^%$])",ew)end;function b:CreateCodec(ey,ez,eA)if type(ey)~="string"or type(ez)~="string"or type(eA)~="string"then error("Usage: LibDeflate:CreateCodec(reserved_chars,".." escape_chars, map_chars):".." All arguments must be string.",2)end;if ez==""then return nil,"No escape characters supplied."end;if#ey<#eA then return nil,"The number of reserved characters must be".." at least as many as the number of mapped chars."end;if ey==""then return nil,"No characters to encode."end;local eB=ey..ez..eA;local eC={}for L=1,#eB do local dH=i(eB,L,L)if eC[dH]then return nil,"There must be no duplicate characters in the".." concatenation of reserved_chars, escape_chars and".." map_chars."end;eC[dH]=true end;local eD={}local eE={}local eF={}local eG={}if#eA>0 then local eH={}local eI={}for L=1,#eA do local eJ=m(ey,L,L)local eK=m(eA,L,L)eG[eJ]=eK;eF[#eF+1]=eJ;eI[eK]=eJ;eH[#eH+1]=eK end;eD[#eD+1]="(["..ex(n(eH)).."])"eE[#eE+1]=eI end;local eL=1;local eM=m(ez,eL,eL)local eN=0;local eH={}local eI={}for L=1,#eB do local T=m(eB,L,L)if not eG[T]then while eN>=256 or eC[eN]do eN=eN+1;if eN>255 then eD[#eD+1]=ex(eM).."(["..ex(n(eH)).."])"eE[#eE+1]=eI;eL=eL+1;eM=m(ez,eL,eL)eN=0;eH={}eI={}if not eM or eM==""then return nil,"Out of escape characters."end end end;local eO=q[eN]eG[T]=eM..eO;eF[#eF+1]=T;eI[eO]=T;eH[#eH+1]=eO;eN=eN+1 end;if L==#eB then eD[#eD+1]=ex(eM).."(["..ex(n(eH)).."])"eE[#eE+1]=eI end end;local eP={}local eQ="(["..ex(n(eF)).."])"local eR=eG;function eP:Encode(Z)if type(Z)~="string"then error(("Usage: codec:Encode(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;return l(Z,eQ,eR)end;local eS=#eD;local eT="(["..ex(ey).."])"function eP:Decode(Z)if type(Z)~="string"then error(("Usage: codec:Decode(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;if k(Z,eT)then return nil end;for L=1,eS do Z=l(Z,eD[L],eE[L])end;return Z end;return eP end;local eU={[0]="a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9","(",")"}local eV={[97]=0,[98]=1,[99]=2,[100]=3,[101]=4,[102]=5,[103]=6,[104]=7,[105]=8,[106]=9,[107]=10,[108]=11,[109]=12,[110]=13,[111]=14,[112]=15,[113]=16,[114]=17,[115]=18,[116]=19,[117]=20,[118]=21,[119]=22,[120]=23,[121]=24,[122]=25,[65]=26,[66]=27,[67]=28,[68]=29,[69]=30,[70]=31,[71]=32,[72]=33,[73]=34,[74]=35,[75]=36,[76]=37,[77]=38,[78]=39,[79]=40,[80]=41,[81]=42,[82]=43,[83]=44,[84]=45,[85]=46,[86]=47,[87]=48,[88]=49,[89]=50,[90]=51,[48]=52,[49]=53,[50]=54,[51]=55,[52]=56,[53]=57,[54]=58,[55]=59,[56]=60,[57]=61,[40]=62,[41]=63}function b:EncodeForPrint(Z)if type(Z)~="string"then error(("Usage: LibDeflate:EncodeForPrint(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;local _=#Z;local eW=_-2;local L=1;local aK={}local aG=0;while L<=eW do local a0,a1,a2=i(Z,L,L+2)L=L+3;local aH=a0+a1*256+a2*65536;local eX=aH%64;aH=(aH-eX)/64;local eY=aH%64;aH=(aH-eY)/64;local eZ=aH%64;local e_=(aH-eZ)/64;aG=aG+1;aK[aG]=eU[eX]..eU[eY]..eU[eZ]..eU[e_]end;local aH=0;local aI=0;while L<=_ do local ag=i(Z,L,L)aH=aH+ag*p[aI]aI=aI+8;L=L+1 end;while aI>0 do local f0=aH%64;aG=aG+1;aK[aG]=eU[f0]aH=(aH-f0)/64;aI=aI-6 end;return n(aK)end;function b:DecodeForPrint(Z)if type(Z)~="string"then error(("Usage: LibDeflate:DecodeForPrint(str):".." \'str\' - string expected got \'%s\'."):format(type(Z)),2)end;Z=Z:gsub("^[%c ]+","")Z=Z:gsub("[%c ]+$","")local _=#Z;if _==1 then return nil end;local f1=_-3;local L=1;local aK={}local aG=0;while L<=f1 do local a0,a1,a2,a3=i(Z,L,L+3)a0=eV[a0]a1=eV[a1]a2=eV[a2]a3=eV[a3]if not(a0 and a1 and a2 and a3)then return nil end;L=L+4;local aH=a0+a1*64+a2*4096+a3*262144;local eX=aH%256;aH=(aH-eX)/256;local eY=aH%256;local eZ=(aH-eY)/256;aG=aG+1;aK[aG]=q[eX]..q[eY]..q[eZ]end;local aH=0;local aI=0;while L<=_ do local ag=i(Z,L,L)ag=eV[ag]if not ag then return nil end;aH=aH+ag*p[aI]aI=aI+6;L=L+1 end;while aI>=8 do local dH=aH%256;aG=aG+1;aK[aG]=q[dH]aH=(aH-dH)/256;aI=aI-8 end;return n(aK)end;local function f2()_chat_channel_codec=nil;_addon_channel_codec=nil end;b.internals={LoadStringToTable=bG,IsValidDictionary=aq,IsEqualAdler32=ah,_byte_to_6bit_char=eU,_6bit_to_byte=eV,InternalClearCache=f2}if io and os and debug and _G.arg then local io=io;local os=os;local debug=debug;local f3=_G.arg;local f4=debug.getinfo(1)if f4.source==f3[0]or f4.short_src==f3[0]then local dy;local f5;local L=1;local ek;local f6=false;local f7=false;local bL;local d6;local am;while f3[L]do local R=f3[L]if R=="-h"then print(b._COPYRIGHT.."\nUsage: lua LibDeflate.lua [OPTION] [INPUT] [OUTPUT]\n".." -0 store only. no compression.\n".." -1 fastest compression.\n".." -9 slowest and best compression.\n".." -d do decompression instead of compression.\n".." --dict specify the file that contains".." the entire preset dictionary.\n".." -h give this help.\n".." --strategy ".." specify a special compression strategy.\n".." -v print the version and copyright info.\n".." --zlib use zlib format instead of raw deflate.\n")os.exit(0)elseif R=="-v"then print(b._COPYRIGHT)os.exit(0)elseif R:find("^%-[0-9]$")then bL=tonumber(R:sub(2,2))elseif R=="-d"then f7=true elseif R=="--dict"then L=L+1;local f8=f3[L]if not f8 then io.stderr:write("You must speicify the dict filename")os.exit(1)end;local f9,fa=io.open(f8,"rb")if not f9 then io.stderr:write(("LibDeflate: Cannot read the dictionary file \'%s\': %s"):format(f8,fa))os.exit(1)end;local fb=f9:read("*all")f9:close()am=b:CreateDictionary(fb,#fb,b:Adler32(fb))elseif R=="--strategy"then L=L+1;d6=f3[L]elseif R=="--zlib"then f6=true elseif R:find("^%-")then io.stderr:write(("LibDeflate: Invalid argument: %s"):format(R))os.exit(1)else if not dy then dy,ek=io.open(R,"rb")if not dy then io.stderr:write(("LibDeflate: Cannot read the file \'%s\': %s"):format(R,tostring(ek)))os.exit(1)end elseif not f5 then f5,ek=io.open(R,"wb")if not f5 then io.stderr:write(("LibDeflate: Cannot write the file \'%s\': %s"):format(R,tostring(ek)))os.exit(1)end end end;L=L+1 end;if not dy or not f5 then io.stderr:write("LibDeflate:".." You must specify both input and output files.")os.exit(1)end;local fc=dy:read("*all")local av={level=bL,strategy=d6}local fd;if not f7 then if not f6 then if not am then fd=b:CompressDeflate(fc,av)else fd=b:CompressDeflateWithDict(fc,am,av)end else if not am then fd=b:CompressZlib(fc,av)else fd=b:CompressZlibWithDict(fc,am,av)end end else if not f6 then if not am then fd=b:DecompressDeflate(fc)else fd=b:DecompressDeflateWithDict(fc,am)end else if not am then fd=b:DecompressZlib(fc)else fd=b:DecompressZlibWithDict(fc,am)end end end;if not fd then io.stderr:write("LibDeflate: Decompress fails.")os.exit(1)end;f5:write(fd)if dy and dy~=io.stdin then dy:close()end;if f5 and f5~=io.stdout then f5:close()end;io.stderr:write(("Successfully writes %d bytes"):format(fd:len()))os.exit(0)end end;return b end)()local fe=dofile("rom/modules/main/cc/expect.lua")local fe,ff=fe.expect,fe.field;local fg=nil;settings.define("containers.compression_level",{description="The level of compression for the file systems on a scale of 1-8",default=4,type="number"})settings.save()local fh=settings.get("containers.compression_level")local fi={}local function fj(p,fk)fk=fk or{}if p==nil then return nil end;if fk[p]then return fk[p]end;local fl;if type(p)=='table'then fl={}fk[p]=fl;for l,w in next,p,nil do fl[fj(l,fk)]=fj(w,fk)end;setmetatable(fl,fj(getmetatable(p),fk))else fl=p end;return fl end;local function fm(fn)sleep()local fo={}for a0,fp in ipairs(fs.list(fn))do local fq=fs.combine(fn,fp)if fs.isDir(fq)then fo[fp]=fm(fq)else local fr=fs.open(fq,"r")fo[fp]=fr.readAll()fr.close()end end;return fo end;local function ft()if not _G.rom_cache then _G.rom_cache=fm("/rom")end;return _G.rom_cache end;function fi.getENV(fu,fv)local fw=fj(_G)setmetatable(fw,{__index=_G})local function fx()if fg then fg.rom=ft()return fg end;if not fs.exists(fu)then return{rom=ft()}end;local fp=fs.open(fu,"r")local fy=fp.readAll()fp.close()local fz=a:DecompressDeflate(fy,{level=fh})local fA=textutils.unserialize(fz)or{}fg=fA;fA.rom=ft()return fA end;local function fB(fA)fg=fA;fA.rom=nil;fA=textutils.serialize(fA)local fp=fs.open(fu,"w")fp.write(a:CompressDeflate(fA,{level=fh}))fp.close()end;local function fC(fn)local fD={}for fE in string.gmatch(fn,"[^/]+")do if fE==""or fE=="."then elseif fE==".."then if#fD>0 then table.remove(fD)end else fD[#fD+1]=fE end end;return fD end;local function fF(fn)fe(1,fn,"string")local fD=fC(fn)local fG=fx()if#fD==0 then return fG end;for j=1,#fD do local fE=fD[j]if type(fG)~="table"then return nil end;fG=fG[fE]if fG==nil then return nil end end;return fG end;local function fH(fn,fA)fe(1,fn,"string")local fD=fC(fn)local fI=fx()local fG=fI;for j,fE in ipairs(fD)do if j==#fD then fG[fE]=fA elseif type(fG[fE])=="table"then fG=fG[fE]elseif type(fG[fE])=="string"then return end end;fB(fI)end;function fw.fs.list(fn)fe(1,fn,"string")local fo={}local fA=fF(fn)if fA then for l,w in pairs(fA)do table.insert(fo,l)end end;return fo end;function fw.fs.isDir(fn)fe(1,fn,"string")local fA=fF(fn)return type(fA)=="table"end;function fw.fs.isReadOnly(fn)if fn==""then return false end;fe(1,fn,"string")local fJ=string.find(fn,"rom")return fJ~=nil and fJ<3 end;function fw.fs.exists(fn)fe(1,fn,"string")local fA=fF(fn)return fA~=nil end;function fw.fs.complete(fK,fL,fM,fN)fe(1,fK,"string")fe(2,fL,"string")local fO=nil;if type(fM)=="table"then fN=ff(fM,"include_dirs","boolean","nil")fO=ff(fM,"include_hidden","boolean","nil")fM=ff(fM,"include_files","boolean","nil")else fe(3,fM,"boolean","nil")fe(4,fN,"boolean","nil")end;fO=fO~=false;fM=fM~=false;fN=fN~=false;local fP=fL;local fQ=1;local fR=string.find(fK,"[/\\]",fQ)if fR==1 then fP=""fQ=2 end;local fS;while not fS do local fR=string.find(fK,"[/\\]",fQ)if fR then local fT=string.sub(fK,fQ,fR-1)fP=fw.fs.combine(fP,fT)fQ=fR+1 else fS=string.sub(fK,fQ)end end;if fw.fs.isDir(fP)then local fU={}if fN and fK==""then table.insert(fU,".")end;if fP~=""then if fK==""then table.insert(fU,fN and".."or"../")elseif fK=="."then table.insert(fU,fN and"."or"./")end end;local fV=fw.fs.list(fP)for o=1,#fV do local fW=fV[o]if#fW>=#fS and string.sub(fW,1,#fS)==fS and(fO or fW:sub(1,1)~="."or fS:sub(1,1)==".")then local fX=fw.fs.isDir(fs.combine(fP,fW))local fY=string.sub(fW,#fS+1)if fX then table.insert(fU,fY.."/")if fN and#fY>0 then table.insert(fU,fY)end else if fM and#fY>0 then table.insert(fU,fY)end end end end;return fU end;return{}end;local function fZ(fn,f_)fe(1,fn,"string")local fA=fF(fn)or""local g0=#fA;local g1=1;return{readAll=function()if fA==nil then return nil end;fA=fA:sub(g1)g1=g0+1;return fA end,readLine=function(g2)if fA==nil then return nil end;if g1>g0 then return nil end;local g3=g1;local g4=fA:find("\n",g3,true)local g5;if g4 then if g2 then g5=fA:sub(g3,g4)else g5=fA:sub(g3,g4-1)end;g1=g4+1 else g5=fA:sub(g3)g1=g0+1 end;return g5 end,read=function(g6)if type(g6)=="table"then g6=1 end;fe(1,g6,"number","nil")if fA==nil then return nil end;if not g6 then g6=1 end;if g1>g0 then return nil end;local g7=string.sub(fA,g1,g1+g6-1)g1=g1+#g7;if g7==""then return nil elseif f_ and g6==1 then return string.byte(g7)end;return g7 end,seek=function(fJ,g8)if fA==nil then return nil,"File is closed"end;fJ=fJ or 0;g8=g8 or"cur"if g8=="set"then g1=math.min(math.max(0,fJ),g0)+1 elseif g8=="cur"then g1=math.min(math.max(1,g1+fJ),g0+1)elseif g8=="end"then g1=math.min(math.max(0,g0+fJ),g0)+1 end;return g1-1 end,close=function()fA=nil end}end;local function g9(fn,f_,ga)local fA=""local g1=1;if ga then fA=fF(fn)or""g1=#fA+1 end;local fr;local function gb(gc)if fA==nil then error("File is closed",2)end;if type(gc)=="number"and f_ then gc=string.char(gc)elseif type(gc)~="string"then error("bad argument #1 (string or number expected, got "..type(gc).." )",2)end;fA=string.sub(fA,1,g1-1)..gc..string.sub(fA,g1+#gc)g1=g1+#gc end;fr={write=gb,writeLine=function(gc)if fA==nil then error("File is closed",2)end;fe(1,gc,"string")gb(gc.."\n")end,flush=function()if fA==nil then error("File is closed",2)end;fH(fn,fA)end,close=function()if fA==nil then error("File is already closed",2)end;fH(fn,fA)fA=nil end}return fr end;local function gd(fn,f_,ge)fe(1,fn,"string")local fA=ge and""or(fF(fn)or"")local g0=#fA;local g1=1;local fr={}fr.readAll=function()if fA==nil then return nil end;fA=fA:sub(g1)g1=g0+1;return fA end;fr.readLine=function(g2)if fA==nil then return nil end;if g1>g0 then return nil end;local g3=g1;local g4=fA:find("\n",g3,true)local g5;if g4 then if g2 then g5=fA:sub(g3,g4)else g5=fA:sub(g3,g4-1)end;g1=g4+1 else g5=fA:sub(g3)g1=g0+1 end;return g5 end;function fr.read(g6)if type(g6)=="table"then g6=1 end;fe(1,g6,"number","nil")if fA==nil then error("File is closed",2)end;if not g6 then g6=1 end;if g1>g0 then return nil end;local g7=fA:sub(g1,g1+g6-1)g1=g1+#g7;if g7==""then return nil elseif f_ and g6==1 then return string.byte(g7)end;return g7 end;function fr.seek(fJ,g8)if fA==nil then return nil,"File is closed"end;fJ=fJ or 0;g8=g8 or"cur"if g8=="set"then g1=math.min(math.max(0,fJ),g0)+1 elseif g8=="cur"then g1=math.min(math.max(1,g1+fJ),g0+1)elseif g8=="end"then g1=math.min(math.max(0,g0+fJ),g0)+1 else error("bad argument #2 (invalid whence)",2)end;return g1-1 end;function fr.write(gc)if type(gc)=="number"and f_ then gc=string.char(gc)elseif type(gc)~="string"then error("bad argument #1 (string or number expected, got "..type(gc).." )",2)end;if fA==nil then error("File is closed",2)end;fA=string.sub(fA,1,g1-1)..gc..string.sub(fA,g1+#gc)g1=g1+#gc;g0=#fA end;function fr.writeLine(gc)fe(1,gc,"string")fr.write(gc.."\n")end;function fr.flush()if fA==nil then error("File is closed",2)end;fH(fn,fA)end;function fr.close()if fA==nil then error("File is already closed",2)end;fH(fn,fA)fA=nil end;return fr end;local function gf(fr)local gg=false;return{read=function(self,gh)if gg then error("File is closed",2)end;fe(2,gh,"string","nil")if not gh then gh="l"end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;if string.find(gh,"%*")==1 then gh=gh:gsub("%*","")end;if gh=="l"then return fr.readLine(false)elseif gh=="L"then return fr.readLine(true)elseif gh=="a"then return fr.readAll()else error("Unsupported read mode",2)end end,seek=function(self,g8,fJ)if gg then error("File is closed",2)end;fe(2,g8,"string","nil")fe(3,fJ,"number","nil")if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;return fr.seek(fJ,g8)end,write=function(self,...)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;local gi={...}for j=1,#gi do local gj=gi[j]if type(gj)~="string"and type(gj)~="number"then error("bad argument #"..j+1 .." (string or number expected, got "..type(gj).." )",2)end;fr.write(gj)end end,close=function(self)if gg then error("File is already closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;fr.close()gg=true end,flush=function(self)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;fr.flush()end,lines=function(self)if gg then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;return function()if gg then error("file is already closed",2)end;return fr.readLine(false)end end}end;function fw.fs.open(fn,gh)fe(1,fn,"string")fe(2,gh,"string")if gh=="r"or gh=="rb"then if fw.fs.exists(fn)then return fZ(fn,gh=="rb")else error("File not found",2)end elseif gh=="w"or gh=="wb"then return g9(fn,gh=="wb",false)elseif gh=="a"or gh=="ab"then return g9(fn,gh=="ab",true)elseif gh=="r+"or gh=="rb+"or gh=="r+b"then if fw.fs.exists(fn)then return gd(fn,gh=="rb+"or gh=="r+b",false)else error("File not found",2)end elseif gh=="w+"or gh=="wb+"or gh=="w+b"then return gd(fn,gh=="wb+"or gh=="w+b",true)elseif gh=="a+"or gh=="ab+"or gh=="a+b"then return gd(fn,gh=="ab+"or gh=="a+b",true)else error("Invalid mode",2)end end;function fw.fs.move(gk,gl)fe(1,gk,"string")fe(2,gl,"string")if not fw.fs.exists(gk)then error("Source does not exist",2)end;if fw.fs.exists(gl)then error("Destination already exists",2)end;local fA=fF(gk)fH(gl,fA)fH(gk,nil)end;function fw.fs.copy(gk,gl)fe(1,gk,"string")fe(2,gl,"string")if not fw.fs.exists(gk)then error("Source does not exist",2)end;if fw.fs.exists(gl)then error("Destination already exists",2)end;local fA=fF(gk)fH(gl,fA)end;local function gm(fn,fD,j,fo)local fE=fD[j]if not fE then if fw.fs.exists(fn)then fo[#fo+1]=fn end elseif fE.exact then return gm(fw.fs.combine(fn,fE.contents),fD,j+1,fo)else if not fw.fs.isDir(fn)then return end;local gn=fw.fs.list(fn)for k=1,#gn do local fp=gn[k]if fp:find(fE.contents)then gm(fw.fs.combine(fn,fp),fD,j+1,fo)end end end end;local go={["^"]="%^",["$"]="%$",["("]="%(",[")"]="%)",["%"]="%%",["."]="%.",["["]="%[",["]"]="%]",["+"]="%+",["-"]="%-",["*"]=".*",["?"]="."}function fw.fs.find(gp)fe(1,gp,"string")gp=fw.fs.combine(gp)if gp==".."or gp:sub(1,3)=="../"then error("/"..gp..": Invalid Path",2)end;if not gp:find("[*?]")then if fw.fs.exists(gp)then return{gp}else return{}end end;local fD={}for fE in gp:gmatch("[^/]+")do if fE:find("[*?]")then fD[#fD+1]={exact=false,contents="^"..fE:gsub(".",go).."$"}else fD[#fD+1]={exact=true,contents=fE}end end;local fo={}gm("",fD,1,fo)return fo end;function fw.io.open(fn,gh)fe(1,fn,"string")fe(2,gh,"string","nil")if not gh then gh="r"end;local fr;if gh=="r"or gh=="rb"then if fw.fs.exists(fn)and not fw.fs.isDir(fn)then fr=fZ(fn,gh=="rb")elseif fw.fs.isDir(fn)then return nil,"Attempt to open a directory"else return nil,"File not found"end elseif gh=="w"or gh=="wb"then fr=g9(fn,gh=="wb",false)elseif gh=="a"or gh=="ab"then fr=g9(fn,gh=="ab",true)elseif gh=="r+"or gh=="rb+"or gh=="r+b"then if fw.fs.exists(fn)and not fw.fs.isDir(fn)then fr=gd(fn,gh=="rb+"or gh=="r+b",false)elseif fw.fs.isDir(fn)then return nil,"Attempt to open a directory"else return nil,"File not found"end elseif gh=="w+"or gh=="wb+"or gh=="w+b"then fr=gd(fn,gh=="wb+"or gh=="w+b",true)elseif gh=="a+"or gh=="ab+"or gh=="a+b"then fr=gd(fn,gh=="ab+"or gh=="a+b",true)else return nil,"Invalid mode"end;return gf(fr)end;function fw.io.lines(fn,...)local gi={...}fe(1,fn,"string")local fr=fw.io.open(fn,table.unpack(gi))local g6=0;return function()g6=g6+1;local g5=fr:read(gi[g6%#gi+1]or"l")if g5==nil then fr:close()end;return g5 end end;function fw.fs.delete(fn)fe(1,fn,"string")if not fw.fs.exists(fn)then error("File not found",2)end;fH(fn,nil)end;function fw.fs.getSize(fn)fe(1,fn,"string")if not fw.fs.exists(fn)then error("File not found",2)end;if fw.fs.isDir(fn)then return 0 else return#fF(fn)end end;function fw.fs.makeDir(fn)fe(1,fn,"string")if fw.fs.exists(fn)then return end;fH(fn,{})end;local gq={}local gr=false;function fw.loadfile(gs,gh,gt)if type(gh)=="table"and gt==nil then gh,gt=nil,gh end;fe(1,gs,"string")fe(2,gh,"string","nil")fe(3,gt,"table","nil")local fp=fw.fs.open(gs,"r")if not fp then return nil,"File not found"end;local gu,gv=load(fp.readAll(),"@/"..fs.combine(gs),gh,gt)fp.close()return gu,gv end;function fw.dofile(gw)fe(1,gw,"string")local gx,f=fw.loadfile(gw,nil,_G)if gx then return gx()else error(f,2)end end;function fw.loadAPI(gy)fe(1,gy,"string")local fS=fs.getName(gy)if fS:sub(-4)==".lua"then fS=fS:sub(1,-5)end;if fS=="term"then return true end;if gq[fS]==true then printError("API "..fS.." is already being loaded")return false end;gq[fS]=true;local gz={}setmetatable(gz,{__index=fw})local gA,gv=fw.loadfile(gy,nil,gz)if gA then local gB,gv=pcall(gA)if not gB then gq[fS]=nil;return error("Failed to load API "..fS.." due to "..gv,1)end else gq[fS]=nil;return error("Failed to load API "..fS.." due to "..gv,1)end;local gC={}for l,w in pairs(gz)do if l~="_ENV"then gC[l]=w end end;fw[fS]=gC;gq[fS]=nil;return true end;local function gD(gE)if not fw.fs.isDir(gE)then return end;for a0,fp in ipairs(fw.fs.list(gE))do if fp:sub(1,1)~="."then local fn=fs.combine(gE,fp)if not fs.isDir(fn)then if not fw.loadAPI(fn)then gr=true end end end end end;function fw.os.run(gF,gy,...)fe(1,gF,"table")fe(2,gy,"string")local gz=gF;setmetatable(gz,{__index=fw})if settings.get("bios.strict_globals",false)then gz._ENV=gz;getmetatable(gz).__newindex=function(a0,gG)error("Attempt to create global "..tostring(gG),2)end end;local gx,gv=fw.loadfile(gy,nil,gz)if gx then local gB,gv=pcall(gx,...)if not gB then if gv and gv~=""then printError(gv)end;return false end;return true end;if gv and gv~=""then printError(gv)end;return false end;fw.settings=settings;fw._ENV=fw;fw._G=fw;fw.shell=nil;fw.multishell=nil;gD("rom/apis")if http and fv then fw.http=http;gD("rom/apis/http")end;return fw end;local gH=dofile("rom/modules/main/cc/internal/tiny_require.lua")("cc.internal.exception")local function gI(...)local gJ={co=coroutine.running()}local gK=table.pack(...)local gL={}for j=1,gK.n,1 do local gM=gK[j]if type(gM)~="function"then error("bad argument #"..j.." (function expected, got "..type(gM)..")",3)end;gL[j]={co=coroutine.create(function()return gH.try_barrier(gJ,gM)end),filter=nil}end;return gL end;local function gN(gL,gO)local g6=#gL;if g6<1 then return 0 end;local gP=g6;local gQ={n=0}while true do for j=1,g6 do local gR=gL[j]if gR and(gR.filter==nil or gR.filter==gQ[1]or gQ[1]=="terminate")then local gB,gS=coroutine.resume(gR.co,table.unpack(gQ,1,gQ.n))if gB then if gS=="thread_shutdown"then return{command=true,type="shutdown"}elseif gS=="thread_reboot"then print("reboot")return{command=true,type="reboot"}else gR.filter=gS end elseif type(gS)=="string"and gH.can_wrap_errors()then printError(gH.make_exception(gS,gR.co))else printError(gS)end;if coroutine.status(gR.co)=="dead"then gL[j]=false;gP=gP-1;if gP<=gO then return j end end end end;gQ=table.pack(os.pullEventRaw())end end;function fi.start(gt)local gT=nil;gt.os.reboot=function()gT="reboot"sleep()end;gt.os.shutdown=function()gT="shutdown"sleep()end;local gu=function()gT=nil;settings.define("shell.allow_startup",{default=true,description="Run startup files when the computer turns on.",type="boolean"})settings.define("shell.allow_disk_startup",{default=commands==nil,description="Run startup files from disk drives when the computer turns on.",type="boolean"})settings.define("shell.autocomplete",{default=true,description="Autocomplete program and arguments in the shell.",type="boolean"})settings.define("edit.autocomplete",{default=true,description="Autocomplete API and function names in the editor.",type="boolean"})settings.define("lua.autocomplete",{default=true,description="Autocomplete API and function names in the Lua REPL.",type="boolean"})settings.define("edit.default_extension",{default="lua",description=[[The file extension the editor will use if none is given. Set to "" to disable.]],type="string"})settings.define("paint.default_extension",{default="nfp",description=[[The file extension the paint program will use if none is given. Set to "" to disable.]],type="string"})settings.define("list.show_hidden",{default=false,description=[[Whether the list program show hidden files (those starting with ".").]],type="boolean"})settings.define("motd.enable",{default=pocket==nil,description="Display a random message when the computer starts up.",type="boolean"})settings.define("motd.path",{default="/rom/motd.txt:/motd.txt",description=[[The path to load random messages from. Should be a colon (":") separated string of file paths.]],type="string"})settings.define("lua.warn_against_use_of_local",{default=true,description=[[Print a message when input in the Lua REPL starts with the word 'local'. Local variables defined in the Lua REPL are be inaccessible on the next input.]],type="boolean"})settings.define("lua.function_args",{default=true,description="Show function arguments when printing functions.",type="boolean"})settings.define("lua.function_source",{default=false,description="Show where a function was defined when printing functions.",type="boolean"})settings.define("bios.strict_globals",{default=false,description="Prevents assigning variables into a program's environment. Make sure you use the local keyword or assign to _G explicitly.",type="boolean"})settings.define("bios.use_multishell",{default=true,description="Allow running multiple program at once, through the use of the \"fg\" and \"bg\" programs..",type="boolean"})settings.define("shell.autocomplete_hidden",{default=false,description=[[Autocomplete hidden files and folders (those starting with ".").]],type="boolean"})print("running container!")return gN(gI(function()local gU;if term.isColour()and settings.get("bios.use_multishell")then gU="rom/programs/advanced/multishell.lua"else gU="rom/programs/shell.lua"end;os.run({},gU)os.run({},"rom/programs/shutdown.lua")end,function()while true do sleep()if gT=="shutdown"then while true do coroutine.yield("thread_shutdown")end elseif gT=="reboot"then while true do coroutine.yield("thread_reboot")end end end end),0)end;local gT="starting"while gT=="starting"or type(gT)=="table"and gT.command and gT.type=="reboot"do gT=setfenv(gu,fj(gt))()end end;return fi \ No newline at end of file