diff --git a/minified_disklock.lua b/minified_disklock.lua new file mode 100644 index 0000000..0832bc5 --- /dev/null +++ b/minified_disklock.lua @@ -0,0 +1 @@ +local a=(function()local function b(c)if type(c)=="table"then return string.char(unpack(c))else return tostring(c)end end;local d={__tostring=b,__index={toHex=function(self)return("%02x"):rep(#self):format(unpack(self))end,isEqual=function(self,c)if type(c)~="table"then return false end;if#self~=#c then return false end;local e=0;for f=1,#self do e=bit32.bor(e,bit32.bxor(self[f],c[f]))end;return e==0 end}}local function g(h)return setmetatable({h:byte(1,-1)},d)end;local i=(function()local j=2^32;local k=bit32 and bit32.band or bit.band;local l=bit32 and bit32.bnot or bit.bnot;local m=bit32 and bit32.bxor or bit.bxor;local n=bit32 and bit32.lshift or bit.blshift;local o=unpack;local function p(q,r)local h=q/2^r;local s=h%1;return h-s+s*j end;local function t(u,v)local h=u/2^v;return h-h%1 end;local w={0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19}local x={0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2}local function y(z)local A,B=0,0;if 0xFFFFFFFF-Aa4 and a1(a3)or g(a3)local a5={}local a6={}local a7={}for f=1,a4 do a5[f]=m(0x36,a3[f]or 0)a6[f]=m(0x5C,a3[f]or 0)end;for f=1,#F do a5[a4+f]=F[f]end;a5=a1(a5)for f=1,a4 do a7[f]=a6[f]a7[a4+f]=a5[f]end;return a1(a7)end;local function a8(a9,aa,ab,ac)aa=g(b(aa))local ad=32;ab=tonumber(ab)or 1000;ac=tonumber(ac)or 32;local ae=1;local af={}while ac>0 do local ag={}local ah={o(aa)}local ai=ac>ad and ad or ac;ah[#ah+1]=k(t(ae,24),0xFF)ah[#ah+1]=k(t(ae,16),0xFF)ah[#ah+1]=k(t(ae,8),0xFF)ah[#ah+1]=k(ae,0xFF)for J=1,ab do ah=a2(ah,b(a9))for aj=1,ai do ag[aj]=m(ah[aj],ag[aj]or 0)end;if J%200==0 then os.queueEvent("PBKDF2",J)coroutine.yield("PBKDF2")end end;ac=ac-ai;ae=ae+1;for aj=1,ai do af[#af+1]=ag[aj]end end;return setmetatable(af,d)end;return{digest=a1,hmac=a2,pbkdf2=a8}end)()local ak=(function()local m=bit32.bxor;local k=bit32.band;local n=bit32.lshift;local t=bit32.arshift;local al=2^32;local am={("expand 16-byte k"):byte(1,-1)}local an={("expand 32-byte k"):byte(1,-1)}local function ao(q,r)local h=q/2^(32-r)local s=h%1;return h-s+s*al end;local function ap(h,P,r,Q,R)h[P]=(h[P]+h[r])%al;h[R]=ao(m(h[R],h[P]),16)h[Q]=(h[Q]+h[R])%al;h[r]=ao(m(h[r],h[Q]),12)h[P]=(h[P]+h[r])%al;h[R]=ao(m(h[R],h[P]),8)h[Q]=(h[Q]+h[R])%al;h[r]=ao(m(h[r],h[Q]),7)return h end;local function aq(ar,as)local h={unpack(ar)}for f=1,as do local at=f%2==1;h=at and ap(h,1,5,9,13)or ap(h,1,6,11,16)h=at and ap(h,2,6,10,14)or ap(h,2,7,12,13)h=at and ap(h,3,7,11,15)or ap(h,3,8,9,14)h=at and ap(h,4,8,12,16)or ap(h,4,5,10,15)end;for f=1,16 do h[f]=(h[f]+ar[f])%al end;return h end;local function au(D,f)return(D[f+1]or 0)+n(D[f+2]or 0,8)+n(D[f+3]or 0,16)+n(D[f+4]or 0,24)end;local function av(a3,aw,y)local ax=#a3==32;local ay=ax and an or am;local ar={}ar[1]=au(ay,0)ar[2]=au(ay,4)ar[3]=au(ay,8)ar[4]=au(ay,12)ar[5]=au(a3,0)ar[6]=au(a3,4)ar[7]=au(a3,8)ar[8]=au(a3,12)ar[9]=au(a3,ax and 16 or 0)ar[10]=au(a3,ax and 20 or 4)ar[11]=au(a3,ax and 24 or 8)ar[12]=au(a3,ax and 28 or 12)ar[13]=y;ar[14]=au(aw,0)ar[15]=au(aw,4)ar[16]=au(aw,8)return ar end;local function az(ar)local at={}for f=1,16 do at[#at+1]=k(ar[f],0xFF)at[#at+1]=k(t(ar[f],8),0xFF)at[#at+1]=k(t(ar[f],16),0xFF)at[#at+1]=k(t(ar[f],24),0xFF)end;return at end;local function aA(F,a3,aw,aB,aC)F=g(b(F))a3=g(b(a3))aw=g(b(aw))assert(#a3==16 or#a3==32,"ChaCha20: Invalid key length ("..#a3 .."), must be 16 or 32")assert(#aw==12,"ChaCha20: Invalid nonce length ("..#aw.."), must be 12")aB=tonumber(aB)or 1;aC=tonumber(aC)or 20;local af={}local ar=av(a3,aw,aB)local aD=math.floor(#F/64)for f=0,aD do local aE=az(aq(ar,aC))ar[13]=(ar[13]+1)%al;local ae={}for J=1,64 do ae[J]=F[f*64+J]end;for J=1,#ae do af[#af+1]=m(ae[J],aE[J])end;if f%1000==0 then os.queueEvent("")os.pullEvent("")end end;return setmetatable(af,d)end;return{crypt=aA}end)()local aF=(function()local aG=""local aH=""local aI="/.random"local function aJ(F)aH=aH..(F or"")end;local function a1()aG=tostring(i.digest(aG..aH))aH=""end;if fs.exists(aI)then local aK=fs.open(aI,"rb")aJ(aK.readAll())aK.close()end;aJ("init")aJ(tostring(math.random(1,2^31-1)))aJ("|")aJ(tostring(math.random(1,2^31-1)))aJ("|")aJ(tostring(math.random(1,2^4)))aJ("|")aJ(tostring(os.epoch("utc")))aJ("|")aJ(tostring({}))aJ(tostring({}))a1()aJ(tostring(os.epoch("utc")))a1()local aL={}local aM="function()return{"..("e'utc',"):rep(256).."}end"local aN=assert(load("local e=os.epoch return "..aM))()for f=1,300 do while true do local c=aN()local A=c[1]if A~=c[256]then for J=1,256 do if A~=c[J]then aL[f]=J-1;break end end;break end end end;aJ(b(aL))a1()local function aO()aJ("save")aJ(tostring(os.epoch("utc")))aJ(tostring({}))a1()local aK=fs.open(aI,"wb")aK.write(tostring(i.hmac("save",aG)))aG=tostring(i.digest(aG))aK.close()end;aO()local function aP(F)aJ("seed")aJ(tostring(os.epoch("utc")))aJ(tostring({}))aJ(b(F))a1()aO()end;local function aF()aJ("random")aJ(tostring(os.epoch("utc")))aJ(tostring({}))a1()aO()local aQ=i.hmac("out",aG)aG=tostring(i.digest(aG))return aQ end;return{seed=aP,save=aO,random=aF}end)()local aR=(function()local function aS(P,r)return P[1]==r[1]and P[2]==r[2]and P[3]==r[3]and P[4]==r[4]and P[5]==r[5]and P[6]==r[6]and P[7]==r[7]end;local function aT(P,r)for f=7,1,-1 do if P[f]>r[f]then return 1 elseif P[f]0xffffff then aW=aW+1;aV=aV-0x1000000 end;if aW>0xffffff then aX=aX+1;aW=aW-0x1000000 end;if aX>0xffffff then aY=aY+1;aX=aX-0x1000000 end;if aY>0xffffff then aZ=aZ+1;aY=aY-0x1000000 end;if aZ>0xffffff then a_=a_+1;aZ=aZ-0x1000000 end;if a_>0xffffff then b0=b0+1;a_=a_-0x1000000 end;return{aV,aW,aX,aY,aZ,a_,b0}end;local function b1(P,r)local aV=P[1]-r[1]local aW=P[2]-r[2]local aX=P[3]-r[3]local aY=P[4]-r[4]local aZ=P[5]-r[5]local a_=P[6]-r[6]local b0=P[7]-r[7]if aV<0 then aW=aW-1;aV=aV+0x1000000 end;if aW<0 then aX=aX-1;aW=aW+0x1000000 end;if aX<0 then aY=aY-1;aX=aX+0x1000000 end;if aY<0 then aZ=aZ-1;aY=aY+0x1000000 end;if aZ<0 then a_=a_-1;aZ=aZ+0x1000000 end;if a_<0 then b0=b0-1;a_=a_+0x1000000 end;return{aV,aW,aX,aY,aZ,a_,b0}end;local function b2(P)local aV=P[1]local aW=P[2]local aX=P[3]local aY=P[4]local aZ=P[5]local a_=P[6]local b0=P[7]aV=aV/2;aV=aV-aV%1;aV=aV+aW%2*0x800000;aW=aW/2;aW=aW-aW%1;aW=aW+aX%2*0x800000;aX=aX/2;aX=aX-aX%1;aX=aX+aY%2*0x800000;aY=aY/2;aY=aY-aY%1;aY=aY+aZ%2*0x800000;aZ=aZ/2;aZ=aZ-aZ%1;aZ=aZ+a_%2*0x800000;a_=a_/2;a_=a_-a_%1;a_=a_+b0%2*0x800000;b0=b0/2;b0=b0-b0%1;return{aV,aW,aX,aY,aZ,a_,b0}end;local function b3(P,r)local aV=P[1]+r[1]local aW=P[2]+r[2]local aX=P[3]+r[3]local aY=P[4]+r[4]local aZ=P[5]+r[5]local a_=P[6]+r[6]local b0=P[7]+r[7]local b4=P[8]+r[8]local b5=P[9]+r[9]local b6=P[10]+r[10]local b7=P[11]+r[11]local b8=P[12]+r[12]local b9=P[13]+r[13]local ba=P[14]+r[14]if aV>0xffffff then aW=aW+1;aV=aV-0x1000000 end;if aW>0xffffff then aX=aX+1;aW=aW-0x1000000 end;if aX>0xffffff then aY=aY+1;aX=aX-0x1000000 end;if aY>0xffffff then aZ=aZ+1;aY=aY-0x1000000 end;if aZ>0xffffff then a_=a_+1;aZ=aZ-0x1000000 end;if a_>0xffffff then b0=b0+1;a_=a_-0x1000000 end;if b0>0xffffff then b4=b4+1;b0=b0-0x1000000 end;if b4>0xffffff then b5=b5+1;b4=b4-0x1000000 end;if b5>0xffffff then b6=b6+1;b5=b5-0x1000000 end;if b6>0xffffff then b7=b7+1;b6=b6-0x1000000 end;if b7>0xffffff then b8=b8+1;b7=b7-0x1000000 end;if b8>0xffffff then b9=b9+1;b8=b8-0x1000000 end;if b9>0xffffff then ba=ba+1;b9=b9-0x1000000 end;return{aV,aW,aX,aY,aZ,a_,b0,b4,b5,b6,b7,b8,b9,ba}end;local function bb(P,r,bc)local bd,be,bf,bg,bh,bi,bj=unpack(P)local bk,bl,bm,bn,bo,bp,bq=unpack(r)local aV=bd*bk;local aW=bd*bl+be*bk;local aX=bd*bm+be*bl+bf*bk;local aY=bd*bn+be*bm+bf*bl+bg*bk;local aZ=bd*bo+be*bn+bf*bm+bg*bl+bh*bk;local a_=bd*bp+be*bo+bf*bn+bg*bm+bh*bl+bi*bk;local b0=bd*bq+be*bp+bf*bo+bg*bn+bh*bm+bi*bl+bj*bk;local b4,b5,b6,b7,b8,b9,ba;if not bc then b4=be*bq+bf*bp+bg*bo+bh*bn+bi*bm+bj*bl;b5=bf*bq+bg*bp+bh*bo+bi*bn+bj*bm;b6=bg*bq+bh*bp+bi*bo+bj*bn;b7=bh*bq+bi*bp+bj*bo;b8=bi*bq+bj*bp;b9=bj*bq;ba=0 else b4=0 end;local br;br=aV;aV=aV%0x1000000;aW=aW+(br-aV)/0x1000000;br=aW;aW=aW%0x1000000;aX=aX+(br-aW)/0x1000000;br=aX;aX=aX%0x1000000;aY=aY+(br-aX)/0x1000000;br=aY;aY=aY%0x1000000;aZ=aZ+(br-aY)/0x1000000;br=aZ;aZ=aZ%0x1000000;a_=a_+(br-aZ)/0x1000000;br=a_;a_=a_%0x1000000;b0=b0+(br-a_)/0x1000000;br=b0;b0=b0%0x1000000;if not bc then b4=b4+(br-b0)/0x1000000;br=b4;b4=b4%0x1000000;b5=b5+(br-b4)/0x1000000;br=b5;b5=b5%0x1000000;b6=b6+(br-b5)/0x1000000;br=b6;b6=b6%0x1000000;b7=b7+(br-b6)/0x1000000;br=b7;b7=b7%0x1000000;b8=b8+(br-b7)/0x1000000;br=b8;b8=b8%0x1000000;b9=b9+(br-b8)/0x1000000;br=b9;b9=b9%0x1000000;ba=ba+(br-b9)/0x1000000 end;return{aV,aW,aX,aY,aZ,a_,b0,b4,b5,b6,b7,b8,b9,ba}end;local function bs(P)local bd,be,bf,bg,bh,bi,bj=unpack(P)local aV=bd*bd;local aW=bd*be*2;local aX=bd*bf*2+be*be;local aY=bd*bg*2+be*bf*2;local aZ=bd*bh*2+be*bg*2+bf*bf;local a_=bd*bi*2+be*bh*2+bf*bg*2;local b0=bd*bj*2+be*bi*2+bf*bh*2+bg*bg;local b4=be*bj*2+bf*bi*2+bg*bh*2;local b5=bf*bj*2+bg*bi*2+bh*bh;local b6=bg*bj*2+bh*bi*2;local b7=bh*bj*2+bi*bi;local b8=bi*bj*2;local b9=bj*bj;local ba=0;local br;br=aV;aV=aV%0x1000000;aW=aW+(br-aV)/0x1000000;br=aW;aW=aW%0x1000000;aX=aX+(br-aW)/0x1000000;br=aX;aX=aX%0x1000000;aY=aY+(br-aX)/0x1000000;br=aY;aY=aY%0x1000000;aZ=aZ+(br-aY)/0x1000000;br=aZ;aZ=aZ%0x1000000;a_=a_+(br-aZ)/0x1000000;br=a_;a_=a_%0x1000000;b0=b0+(br-a_)/0x1000000;br=b0;b0=b0%0x1000000;b4=b4+(br-b0)/0x1000000;br=b4;b4=b4%0x1000000;b5=b5+(br-b4)/0x1000000;br=b5;b5=b5%0x1000000;b6=b6+(br-b5)/0x1000000;br=b6;b6=b6%0x1000000;b7=b7+(br-b6)/0x1000000;br=b7;b7=b7%0x1000000;b8=b8+(br-b7)/0x1000000;br=b8;b8=b8%0x1000000;b9=b9+(br-b8)/0x1000000;br=b9;b9=b9%0x1000000;ba=ba+(br-b9)/0x1000000;return{aV,aW,aX,aY,aZ,a_,b0,b4,b5,b6,b7,b8,b9,ba}end;local function bt(P)local bu={}for f=1,7 do local bv=P[f]for J=1,3 do bu[#bu+1]=bv%256;bv=math.floor(bv/256)end end;return bu end;local function bw(bu)local P={}local bx={}for f=1,21 do local by=bu[f]assert(type(by)=="number","integer decoding failure")assert(by>=0 and by<=255,"integer decoding failure")assert(by%1==0,"integer decoding failure")bx[f]=by end;for f=1,21,3 do local bv=0;for J=2,0,-1 do bv=bv*256;bv=bv+bx[f+J]end;P[#P+1]=bv end;return P end;local function bz(R,L)local aQ=R[1]%2^L;if aQ>=2^(L-1)then aQ=aQ-2^L end;return aQ end;local function bA(R,L)local c={}local R={unpack(R)}for bB=1,168 do if R[1]%2==1 then c[#c+1]=bz(R,L)R=b1(R,{c[#c],0,0,0,0,0,0})else c[#c+1]=0 end;R=b2(R)end;return c end;return{isEqual=aS,compare=aT,add=aU,sub=b1,addDouble=b3,mult=bb,square=bs,encodeInt=bt,decodeInt=bw,NAF=bA}end)()local bC=(function()local aU=aR.add;local b1=aR.sub;local b3=aR.addDouble;local bb=aR.mult;local bs=aR.square;local bD={3,0,0,0,0,0,15761408}local bE={5592405,5592405,5592405,5592405,5592405,5592405,14800213}local bF={13533400,837116,6278376,13533388,837116,6278376,7504076}local function bG(P)local bd,be,bf,bg,bh,bi,bj=unpack(P)local aV=bd*3;local aW=be*3;local aX=bf*3;local aY=bg*3;local aZ=bh*3;local a_=bi*3;local b0=bd*15761408;b0=b0+bj*3;local b4=be*15761408;local b5=bf*15761408;local b6=bg*15761408;local b7=bh*15761408;local b8=bi*15761408;local b9=bj*15761408;local ba=0;local br;br=aV/0x1000000;aW=aW+br-br%1;aV=aV%0x1000000;br=aW/0x1000000;aX=aX+br-br%1;aW=aW%0x1000000;br=aX/0x1000000;aY=aY+br-br%1;aX=aX%0x1000000;br=aY/0x1000000;aZ=aZ+br-br%1;aY=aY%0x1000000;br=aZ/0x1000000;a_=a_+br-br%1;aZ=aZ%0x1000000;br=a_/0x1000000;b0=b0+br-br%1;a_=a_%0x1000000;br=b0/0x1000000;b4=b4+br-br%1;b0=b0%0x1000000;br=b4/0x1000000;b5=b5+br-br%1;b4=b4%0x1000000;br=b5/0x1000000;b6=b6+br-br%1;b5=b5%0x1000000;br=b6/0x1000000;b7=b7+br-br%1;b6=b6%0x1000000;br=b7/0x1000000;b8=b8+br-br%1;b7=b7%0x1000000;br=b8/0x1000000;b9=b9+br-br%1;b8=b8%0x1000000;br=b9/0x1000000;ba=ba+br-br%1;b9=b9%0x1000000;return{aV,aW,aX,aY,aZ,a_,b0,b4,b5,b6,b7,b8,b9,ba}end;local function bH(P)if P[7]<15761408 or P[7]==15761408 and P[1]<3 then return{unpack(P)}end;local aV=P[1]local aW=P[2]local aX=P[3]local aY=P[4]local aZ=P[5]local a_=P[6]local b0=P[7]aV=aV-3;b0=b0-15761408;if aV<0 then aW=aW-1;aV=aV+0x1000000 end;if aW<0 then aX=aX-1;aW=aW+0x1000000 end;if aX<0 then aY=aY-1;aX=aX+0x1000000 end;if aY<0 then aZ=aZ-1;aY=aY+0x1000000 end;if aZ<0 then a_=a_-1;aZ=aZ+0x1000000 end;if a_<0 then b0=b0-1;a_=a_+0x1000000 end;return{aV,aW,aX,aY,aZ,a_,b0}end;local function bI(P,r)return bH(aU(P,r))end;local function bJ(P,r)local aQ=b1(P,r)if aQ[7]<0 then aQ=aU(aQ,bD)end;return aQ end;local function bK(bL)local bM=bb(bL,bE,true)local c={unpack(b3(bL,bG(bM)),8,14)}return bH(c)end;local function bN(P,r)return bK(bb(P,r))end;local function bO(P)return bK(bs(P))end;local function bP(P)return bN(P,bF)end;local function bQ(P)P={unpack(P)}for f=8,14 do P[f]=0 end;return bK(P)end;local bR=bP({1,0,0,0,0,0,0})local function bS(bT,bU)bT={unpack(bT)}local aQ={unpack(bR)}for f=1,168 do if bU[f]==1 then aQ=bN(aQ,bT)end;bT=bO(bT)end;return aQ end;return{addModP=bI,subModP=bJ,multModP=bN,squareModP=bO,montgomeryModP=bP,inverseMontgomeryModP=bQ,expModP=bS}end)()local bV=(function()local aS=aR.isEqual;local aT=aR.compare;local aU=aR.add;local b1=aR.sub;local b3=aR.addDouble;local bb=aR.mult;local bs=aR.square;local bt=aR.encodeInt;local bw=aR.decodeInt;local bW;local bX={9622359,6699217,13940450,16775734,16777215,16777215,3940351}local bY={1,0,1,0,1,0,1,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0,1,1,0,0,1,0,0,0,1,1,1,0,1,1,0,1,1,0,1,0,0,1,0,1,0,1,1,0,1,1,0,1,1,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1}local bZ={15218585,5740955,3271338,9903997,9067368,7173545,6988392}local bF={1336213,11071705,9716828,11083885,9188643,1494868,3306114}local function b_(P)local aQ={unpack(P)}if aT(aQ,bX)>=0 then aQ=b1(aQ,bX)end;return setmetatable(aQ,bW)end;local function c0(P,r)return b_(aU(P,r))end;local function c1(P,r)local aQ=b1(P,r)if aQ[7]<0 then aQ=aU(aQ,bX)end;return setmetatable(aQ,bW)end;local function bK(bL)local bM={unpack(bb({unpack(bL,1,7)},bZ,true),1,7)}local c={unpack(b3(bL,bb(bM,bX)),8,14)}return b_(c)end;local function c2(P,r)return bK(bb(P,r))end;local function c3(P)return bK(bs(P))end;local function c4(P)return c2(P,bF)end;local function c5(P)local P={unpack(P)}for f=8,14 do P[f]=0 end;return bK(P)end;local bR=c4({1,0,0,0,0,0,0})local function c6(bT,bU)local bT={unpack(bT)}local aQ={unpack(bR)}for f=1,168 do if bU[f]==1 then aQ=c2(aQ,bT)end;bT=c3(bT)end;return aQ end;local function c7(bT,c8)local bT={unpack(bT)}local aQ=setmetatable({unpack(bR)},bW)if c8<0 then bT=c6(bT,bY)c8=-c8 end;while c8>0 do if c8%2==1 then aQ=c2(aQ,bT)end;bT=c3(bT)c8=c8/2;c8=c8-c8%1 end;return aQ end;local function c9(P)local aQ=bt(P)return setmetatable(aQ,d)end;local function ca(h)local aQ=bw(g(b(h):sub(1,21)))aQ[7]=aQ[7]%bX[7]return setmetatable(aQ,bW)end;local function cb()while true do local h={unpack(aF.random(),1,21)}local aQ=bw(h)if aQ[7]0 then cY=cz(cY,cX[cW[f]])elseif cW[f]<0 then cY=cH(cY,cX[-cW[f]])end end;return setmetatable(cY,cg)end;local cZ={ck}for f=2,168 do cZ[f]=cm(cZ[f-1])end;local function c_(cV)local cW=bA(cV,2)local cY={{unpack(ch)},{unpack(bR)},{unpack(bR)}}for f=1,168 do if cW[f]==1 then cY=cz(cY,cZ[f])elseif cW[f]==-1 then cY=cH(cY,cZ[f])end end;return setmetatable(cY,cg)end;local function d0(cn)cn=cI(cn)local aQ={}local d1,d2=unpack(cn)aQ=bt(d2)aQ[22]=d1[1]%2;return setmetatable(aQ,d)end;local function d3(bu)bu=g(b(bu):sub(1,22))local d2=bw(bu)d2[7]=d2[7]%bD[7]local d4=bO(d2)local d5=bJ(d4,bR)local d6=bJ(bN(R,d4),bR)local d7=bO(d5)local d8=bN(d5,d7)local d9=bN(d8,d7)local da=bN(d6,bO(d6))local L=bN(d9,da)local d1=bN(d8,bN(d6,bS(L,cj)))if d1[1]%2~=bu[22]then d1=bJ(ch,d1)end;local cy={d1,d2,{unpack(bR)}}return setmetatable(cy,cg)end;cg={__index={isOnCurve=function(self)return cO(self)end,isInf=function(self)return self:isOnCurve()and cT(self)end,encode=function(self)return d0(self)end},__tostring=function(self)return self:encode():toHex()end,__add=function(cn,cA)assert(cn:isOnCurve(),"invalid point")assert(cA:isOnCurve(),"invalid point")return cz(cn,cA)end,__sub=function(cn,cA)assert(cn:isOnCurve(),"invalid point")assert(cA:isOnCurve(),"invalid point")return cH(cn,cA)end,__unm=function(self)assert(self:isOnCurve(),"invalid point")return cG(self)end,__eq=function(cn,cA)assert(cn:isOnCurve(),"invalid point")assert(cA:isOnCurve(),"invalid point")return cJ(cn,cA)end,__mul=function(cn,h)if type(cn)=="number"then return h*cn end;if type(h)=="number"then assert(h<2^24,"number multiplier too big")h={h,0,0,0,0,0,0}else h=c5(h)end;if cn==ck then return c_(h)else return cU(h,cn)end end}ck=setmetatable(ck,cg)cl=setmetatable(cl,cg)return{G=ck,O=cl,pointDecode=d3}end)()local function db()local aw={}local dc=os.epoch("utc")for bB=1,12 do aw[#aw+1]=dc%256;dc=dc/256;dc=dc-dc%1 end;return aw end;local function dd(F,a3)a3=b(a3)local de=i.hmac("encKey",a3)local df=i.hmac("macKey",a3)local aw=db()local dg=ak.crypt(b(F),de,aw)local aQ=aw;for f=1,#dg do aQ[#aQ+1]=dg[f]end;local dh=i.hmac(aQ,df)for f=1,#dh do aQ[#aQ+1]=dh[f]end;return setmetatable(aQ,d)end;local function di(F,a3)F=b(F)a3=b(a3)local de=i.hmac("encKey",a3)local df=i.hmac("macKey",a3)local dh=i.hmac(F:sub(1,-33),df)assert(dh:isEqual(g(F:sub(-32))),"invalid mac")local aQ=ak.crypt(F:sub(13,-33),de,F:sub(1,12))return setmetatable(aQ,d)end;local function dj(dk,dl)local d1=bV.decodeModQ(b(dk))local aj=bV.randomModQ()local dm=cf.G*aj;local S=bV.hashModQ(b(dl)..tostring(dm))local h=aj-d1*S;S=S:encode()h=h:encode()local aQ=S;for f=1,#h do aQ[#aQ+1]=h[f]end;return setmetatable(aQ,d)end;local function dn(dp,dl,dq)dq=b(dq)local dr=cf.pointDecode(b(dp))local S=bV.decodeModQ(dq:sub(1,21))local h=bV.decodeModQ(dq:sub(22))local ds=cf.G*h+dr*S;local dt=bV.hashModQ(b(dl)..tostring(ds))return dt==S end;return{chacha20=ak,sha256=i,random=aF,encrypt=dd,decrypt=di,keypair=keypair,exchange=exchange,sign=dj,verify=dn}end)()local du=(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 dv,dw=as(Z,false,nil,true,av)if not dv then error("Usage: LibDeflate:CompressDeflate(str, configs): "..dw,2)end;return df(Z,nil,av)end;function b:CompressDeflateWithDict(Z,am,av)local dv,dw=as(Z,true,am,true,av)if not dv then error("Usage: LibDeflate:CompressDeflateWithDict".."(str, dictionary, configs): "..dw,2)end;return df(Z,am,av)end;function b:CompressZlib(Z,av)local dv,dw=as(Z,false,nil,true,av)if not dv then error("Usage: LibDeflate:CompressZlib(str, configs): "..dw,2)end;return dh(Z,nil,av)end;function b:CompressZlibWithDict(Z,am,av)local dv,dw=as(Z,true,am,true,av)if not dv then error("Usage: LibDeflate:CompressZlibWithDict".."(str, dictionary, configs): "..dw,2)end;return dh(Z,am,av)end;local function dx(dy)local dz=dy;local dA=#dy;local dB=1;local aI=0;local aH=0;local function dC(U)local aN=p[U]local X;if U<=aI then X=aH%aN;aH=(aH-X)/aN;aI=aI-U else local dD=p[aI]local dr,ds,dt,dE=i(dz,dB,dB+3)aH=aH+((dr or 0)+(ds or 0)*256+(dt or 0)*65536+(dE or 0)*16777216)*dD;dB=dB+4;aI=aI+32-U;X=aH%aN;aH=(aH-X)/aN end;return X end;local function dF(dG,aK,aG)assert(aI%8==0)local dH=aI/80 then if aI<15 and dz then local dD=p[aI]local dr,ds,dt,dE=i(dz,dB,dB+3)aH=aH+((dr or 0)+(ds or 0)*256+(dt or 0)*65536+(dE or 0)*16777216)*dD;dB=dB+4;aI=aI+32 end;local aN=p[db]aI=aI-db;X=aH%aN;aH=(aH-X)/aN;X=r[db][X]bk=dK[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+dC(z[bc])or U;bc=dJ(cy,e0,e1)if bc<0 or bc>29 then return-10 end;local Y=A[bc]Y=Y>4 and Y+dC(B[bc])or Y;local e3=aG-Y+1;if e3=-257 then for Q=1,U do aG=aG+1;aK[aG]=aK[e3]e3=e3+1 end else e3=da+e3;for Q=1,U do aG=aG+1;aK[aG]=q[bX[e3]]e3=e3+1 end end end;if dP()<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;dT.buffer_size=aG;return 0 end;local function e4(dT)local aK,aG,dC,dF,dP,dQ,aL=dT.buffer,dT.buffer_size,dT.ReadBits,dT.ReadBytes,dT.ReaderBitlenLeft,dT.SkipToByteBoundary,dT.result_buffer;dQ()local dG=dC(16)if dP()<0 then return 2 end;local e5=dC(16)if dP()<0 then return 2 end;if dG%256+e5%256~=255 then return-2 end;if(dG-dG%256)/256+(e5-e5%256)/256~=255 then return-2 end;aG=dF(dG,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;dT.buffer_size=aG;return 0 end;local function e6(dT)return dY(dT,G,E,7,K,I,5)end;local function e7(dT)local dC,dJ=dT.ReadBits,dT.Decode;local e8=dC(5)+257;local e9=dC(5)+1;local ea=dC(4)+4;if e8>286 or e9>30 then return-3 end;local cC={}for L=1,ea do cC[C[L]]=dC(3)end;local eb,ec,ed,ee=dU(cC,18,7)if eb~=0 then return-4 end;local cw={}local cy={}local br=0;while bre8+e9 then return-6 end;while bc>0 do bc=bc-1;if br7 then return nil,-13 end;local dn=dC(8)if dT.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=dC(8)local ds=dC(8)local dr=dC(8)local dq=dC(8)local al=dt*16777216+ds*65536+dr*256+dq;if dT.ReaderBitlenLeft()<0 then return nil,2 end;if not ah(al,am.adler32)then return nil,-17 end end;local dg,el=ej(dT)if not dg then return nil,el end;dT.SkipToByteBoundary()local eq=dC(8)local er=dC(8)local es=dC(8)local et=dC(8)if dT.ReaderBitlenLeft()<0 then return nil,2 end;local eu=eq*16777216+er*65536+es*256+et;local ev=b:Adler32(dg)if not ah(eu,ev)then return nil,-15 end;local en=dT.ReaderBitlenLeft()local eo=(en-en%8)/8;return dg,eo end;function b:DecompressDeflate(Z)local dv,dw=as(Z)if not dv then error("Usage: LibDeflate:DecompressDeflate(str): "..dw,2)end;return em(Z)end;function b:DecompressDeflateWithDict(Z,am)local dv,dw=as(Z,true,am)if not dv then error("Usage: LibDeflate:DecompressDeflateWithDict(str, dictionary): "..dw,2)end;return em(Z,am)end;function b:DecompressZlib(Z)local dv,dw=as(Z)if not dv then error("Usage: LibDeflate:DecompressZlib(str): "..dw,2)end;return ep(Z)end;function b:DecompressZlibWithDict(Z,am)local dv,dw=as(Z,true,am)if not dv then error("Usage: LibDeflate:DecompressZlibWithDict(str, dictionary): "..dw,2)end;return ep(Z,am)end;do F={}for ew=0,143 do F[ew]=8 end;for ew=144,255 do F[ew]=9 end;for ew=256,279 do F[ew]=7 end;for ew=280,287 do F[ew]=8 end;J={}for Y=0,31 do J[Y]=5 end;local el;el,G,E=dU(F,287,9)assert(el==0)el,K,I=dU(J,31,5)assert(el==0)D=b4(G,F,287,9)H=b4(K,J,31,5)end;local ex={["\000"]="%z",["("]="%(",[")"]="%)",["."]="%.",["%"]="%%",["+"]="%+",["-"]="%-",["*"]="%*",["?"]="%?",["["]="%[",["]"]="%]",["^"]="%^",["$"]="%$"}local function ey(Z)return Z:gsub("([%z%(%)%.%%%+%-%*%?%[%]%^%$])",ex)end;function b:CreateCodec(ez,eA,eB)if type(ez)~="string"or type(eA)~="string"or type(eB)~="string"then error("Usage: LibDeflate:CreateCodec(reserved_chars,".." escape_chars, map_chars):".." All arguments must be string.",2)end;if eA==""then return nil,"No escape characters supplied."end;if#ez<#eB then return nil,"The number of reserved characters must be".." at least as many as the number of mapped chars."end;if ez==""then return nil,"No characters to encode."end;local eC=ez..eA..eB;local eD={}for L=1,#eC do local dI=i(eC,L,L)if eD[dI]then return nil,"There must be no duplicate characters in the".." concatenation of reserved_chars, escape_chars and".." map_chars."end;eD[dI]=true end;local eE={}local eF={}local eG={}local eH={}if#eB>0 then local eI={}local eJ={}for L=1,#eB do local eK=m(ez,L,L)local eL=m(eB,L,L)eH[eK]=eL;eG[#eG+1]=eK;eJ[eL]=eK;eI[#eI+1]=eL end;eE[#eE+1]="(["..ey(n(eI)).."])"eF[#eF+1]=eJ end;local eM=1;local eN=m(eA,eM,eM)local eO=0;local eI={}local eJ={}for L=1,#eC do local T=m(eC,L,L)if not eH[T]then while eO>=256 or eD[eO]do eO=eO+1;if eO>255 then eE[#eE+1]=ey(eN).."(["..ey(n(eI)).."])"eF[#eF+1]=eJ;eM=eM+1;eN=m(eA,eM,eM)eO=0;eI={}eJ={}if not eN or eN==""then return nil,"Out of escape characters."end end end;local eP=q[eO]eH[T]=eN..eP;eG[#eG+1]=T;eJ[eP]=T;eI[#eI+1]=eP;eO=eO+1 end;if L==#eC then eE[#eE+1]=ey(eN).."(["..ey(n(eI)).."])"eF[#eF+1]=eJ end end;local eQ={}local eR="(["..ey(n(eG)).."])"local eS=eH;function eQ: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,eR,eS)end;local eT=#eE;local eU="(["..ey(ez).."])"function eQ: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,eU)then return nil end;for L=1,eT do Z=l(Z,eE[L],eF[L])end;return Z end;return eQ end;local eV={[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 eW={[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 eX=_-2;local L=1;local aK={}local aG=0;while L<=eX do local a0,a1,a2=i(Z,L,L+2)L=L+3;local aH=a0+a1*256+a2*65536;local eY=aH%64;aH=(aH-eY)/64;local eZ=aH%64;aH=(aH-eZ)/64;local e_=aH%64;local f0=(aH-e_)/64;aG=aG+1;aK[aG]=eV[eY]..eV[eZ]..eV[e_]..eV[f0]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 f1=aH%64;aG=aG+1;aK[aG]=eV[f1]aH=(aH-f1)/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 f2=_-3;local L=1;local aK={}local aG=0;while L<=f2 do local a0,a1,a2,a3=i(Z,L,L+3)a0=eW[a0]a1=eW[a1]a2=eW[a2]a3=eW[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 eY=aH%256;aH=(aH-eY)/256;local eZ=aH%256;local e_=(aH-eZ)/256;aG=aG+1;aK[aG]=q[eY]..q[eZ]..q[e_]end;local aH=0;local aI=0;while L<=_ do local ag=i(Z,L,L)ag=eW[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 dI=aH%256;aG=aG+1;aK[aG]=q[dI]aH=(aH-dI)/256;aI=aI-8 end;return n(aK)end;local function f3()_chat_channel_codec=nil;_addon_channel_codec=nil end;b.internals={LoadStringToTable=bG,IsValidDictionary=aq,IsEqualAdler32=ah,_byte_to_6bit_char=eV,_6bit_to_byte=eW,InternalClearCache=f3}if io and os and debug and _G.arg then local io=io;local os=os;local debug=debug;local f4=_G.arg;local f5=debug.getinfo(1)if f5.source==f4[0]or f5.short_src==f4[0]then local dz;local f6;local L=1;local el;local f7=false;local f8=false;local bL;local d6;local am;while f4[L]do local R=f4[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 f8=true elseif R=="--dict"then L=L+1;local f9=f4[L]if not f9 then io.stderr:write("You must speicify the dict filename")os.exit(1)end;local fa,fb=io.open(f9,"rb")if not fa then io.stderr:write(("LibDeflate: Cannot read the dictionary file \'%s\': %s"):format(f9,fb))os.exit(1)end;local fc=fa:read("*all")fa:close()am=b:CreateDictionary(fc,#fc,b:Adler32(fc))elseif R=="--strategy"then L=L+1;d6=f4[L]elseif R=="--zlib"then f7=true elseif R:find("^%-")then io.stderr:write(("LibDeflate: Invalid argument: %s"):format(R))os.exit(1)else if not dz then dz,el=io.open(R,"rb")if not dz then io.stderr:write(("LibDeflate: Cannot read the file \'%s\': %s"):format(R,tostring(el)))os.exit(1)end elseif not f6 then f6,el=io.open(R,"wb")if not f6 then io.stderr:write(("LibDeflate: Cannot write the file \'%s\': %s"):format(R,tostring(el)))os.exit(1)end end end;L=L+1 end;if not dz or not f6 then io.stderr:write("LibDeflate:".." You must specify both input and output files.")os.exit(1)end;local fd=dz:read("*all")local av={level=bL,strategy=d6}local fe;if not f8 then if not f7 then if not am then fe=b:CompressDeflate(fd,av)else fe=b:CompressDeflateWithDict(fd,am,av)end else if not am then fe=b:CompressZlib(fd,av)else fe=b:CompressZlibWithDict(fd,am,av)end end else if not f7 then if not am then fe=b:DecompressDeflate(fd)else fe=b:DecompressDeflateWithDict(fd,am)end else if not am then fe=b:DecompressZlib(fd)else fe=b:DecompressZlibWithDict(fd,am)end end end;if not fe then io.stderr:write("LibDeflate: Decompress fails.")os.exit(1)end;f6:write(fe)if dz and dz~=io.stdin then dz:close()end;if f6 and f6~=io.stdout then f6:close()end;io.stderr:write(("Successfully writes %d bytes"):format(fe:len()))os.exit(0)end end;return b end)()local ff=dofile("rom/modules/main/cc/expect.lua")local ff,fg=ff.expect,ff.field;local fh=nil;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 fm=fj(fs)local function fn(fo)if not fo then fo="/rom"end;local fp={}for a0,fq in ipairs(fm.list(fo))do local fr=fm.combine(fo,fq)if fm.isDir(fr)then fp[fq]=fn(fr)else local ft=fm.open(fr,"r")fp[fq]=ft.readAll()ft.close()end end;return fp end;local function fu()if fh then fh.rom=fn()return fh end;if not fm.exists("fs")then return{rom=fn()}end;local fq=fm.open("fs","r")local fv=string.char(table.unpack(a.decrypt(fq.readAll(),fi)))fq.close()local fw=du:DecompressDeflate(fv,{level=7})local fx=textutils.unserialize(fw)or{rom=fn()}fh=fx;fx.rom=fn()return fx end;local fy=false;while not fy do term.write("password> ")fi=read("*")fy=pcall(fu)if not fy then printError("sorry wrong password")end end;local function fz(fx)fh=fx;fx.rom=nil;fx=textutils.serialize(fx)local fq=fm.open("fs","w")fq.write(string.char(table.unpack(a.encrypt(du:CompressDeflate(fx,{level=8}),fi))))fq.close()end;local function fA(fo)local fB={}for fC in string.gmatch(fo,"[^/]+")do if fC==""or fC=="."then elseif fC==".."then if#fB>0 then table.remove(fB)end else fB[#fB+1]=fC end end;return fB end;local function fD(fo)ff(1,fo,"string")local fB=fA(fo)local fE=fu()if#fB==0 then return fE end;for j=1,#fB do local fC=fB[j]if type(fE)~="table"then return nil end;fE=fE[fC]if fE==nil then return nil end end;return fE end;local function fF(fo,fx)ff(1,fo,"string")local fB=fA(fo)local fG=fu()local fE=fG;for j,fC in ipairs(fB)do if j==#fB then fE[fC]=fx elseif type(fE[fC])=="table"then fE=fE[fC]elseif type(fE[fC])=="string"then return end end;fz(fG)end;function _G.fs.list(fo)ff(1,fo,"string")local fp={}local fx=fD(fo)if fx then for l,w in pairs(fx)do table.insert(fp,l)end end;return fp end;function _G.fs.isDir(fo)ff(1,fo,"string")local fx=fD(fo)return type(fx)=="table"end;function _G.fs.isReadOnly(fo)if fo==""then return false end;ff(1,fo,"string")local fH=string.find(fo,"rom")return fH~=nil and fH<3 end;function _G.fs.exists(fo)ff(1,fo,"string")local fx=fD(fo)return fx~=nil end;function _G.fs.complete(fI,fJ,fK,fL)ff(1,fI,"string")ff(2,fJ,"string")local fM=nil;if type(fK)=="table"then fL=fg(fK,"include_dirs","boolean","nil")fM=fg(fK,"include_hidden","boolean","nil")fK=fg(fK,"include_files","boolean","nil")else ff(3,fK,"boolean","nil")ff(4,fL,"boolean","nil")end;fM=fM~=false;fK=fK~=false;fL=fL~=false;local fN=fJ;local fO=1;local fP=string.find(fI,"[/\\]",fO)if fP==1 then fN=""fO=2 end;local fQ;while not fQ do local fP=string.find(fI,"[/\\]",fO)if fP then local fR=string.sub(fI,fO,fP-1)fN=_G.fs.combine(fN,fR)fO=fP+1 else fQ=string.sub(fI,fO)end end;if _G.fs.isDir(fN)then local fS={}if fL and fI==""then table.insert(fS,".")end;if fN~=""then if fI==""then table.insert(fS,fL and".."or"../")elseif fI=="."then table.insert(fS,fL and"."or"./")end end;local fT=_G.fs.list(fN)for o=1,#fT do local fU=fT[o]if#fU>=#fQ and string.sub(fU,1,#fQ)==fQ and(fM or fU:sub(1,1)~="."or fQ:sub(1,1)==".")then local fV=_G.fs.isDir(fs.combine(fN,fU))local fW=string.sub(fU,#fQ+1)if fV then table.insert(fS,fW.."/")if fL and#fW>0 then table.insert(fS,fW)end else if fK and#fW>0 then table.insert(fS,fW)end end end end;return fS end;return{}end;local function fX(fo,fY)ff(1,fo,"string")local fx=fD(fo)local fZ=1;return{readAll=function()if fx==nil then return nil end;fZ=#fx+1;return fx end,readLine=function(f_)if fx==nil then return nil end;local g0=""if f_ then g0=fx:sub(fZ,#fx):match("^[^\n]*\n?")else g0=fx:sub(fZ,#fx):match("^[^\n]*")end;fZ=fZ+#g0+1;if g0==""then return nil end;return g0 end,read=function(g1)if type(g1)=="table"then g1=1 end;ff(1,g1,"number","nil")if fx==nil then return nil end;if not g1 then g1=1 end;if not fx then return nil end;local g2=string.sub(fx,fZ,fZ+g1-1)fZ=fZ+g1;if g2==""then g2=nil elseif fY and g1==1 then g2=string.byte(g2)end;return g2 end,seek=function(fH,g3)if fx==nil then return nil,"File is closed"end;if fH==nil then fH=0 end;if g3==nil then g3="cur"end;if g3=="set"then fZ=math.min(math.max(0,fH),#fx)+1 elseif g3=="cur"then fZ=math.min(math.max(1,fZ+fH),#fx+1)elseif g3=="end"then fZ=math.min(math.max(0,#fx+fH),#fx)+1 end;return fZ-1 end,close=function()fx=nil end}end;local function g4(fo,fY,g5)local fx=""local fZ=1;if g5 then fx=fD(fo)or""fZ=#fx+1 end;return{write=function(g6)if fx==nil then error("File is closed",2)end;if type(g6)=="number"and fY then g6=string.char(g6)elseif type(g6)~="string"then error("bad argument #1 (string or number expected, got "..type(g6).." )",2)end;fx=string.sub(fx,1,fZ-1)..g6 ..string.sub(fx,fZ+#g6)fZ=fZ+#g6 end,writeLine=function(g6)if fx==nil then error("File is closed",2)end;ff(1,g6,"string")write(g6 .."\n")end,flush=function()if fx==nil then error("File is closed",2)end;fF(fo,fx)end,close=function()if fx==nil then error("File is already closed",2)end;fF(fo,fx)fx=nil end}end;local function g7(fo,fY,g8)ff(1,fo,"string")local fx=""if not g8 then fx=fD(fo)or""end;local fZ=1;return{readAll=function()if fx==nil then return nil end;fZ=#fx+1;return fx end,readLine=function(f_)if fx==nil then return nil end;local g0=""if f_ then g0=fx:sub(fZ,#fx):match("^[^\n]*\n?")else g0=fx:sub(fZ,#fx):match("^[^\n]*")end;fZ=fZ+#g0+1;if g0==""then return nil end;return g0 end,read=function(g1)if type(g1)=="table"then g1=1 end;ff(1,g1,"number","nil")if fx==nil then error("File is closed",2)end;if not g1 then g1=1 end;if not fx then return nil end;local g2=string.sub(fx,fZ,fZ+g1-1)fZ=fZ+g1;if g2==""then g2=nil elseif fY and g1==1 then g2=string.byte(g2)end;return g2 end,seek=function(fH,g3)if fx==nil then return nil,"File is closed"end;if fH==nil then fH=0 end;if g3==nil then g3="cur"end;if g3=="set"then fZ=math.min(math.max(0,fH),#fx)+1 elseif g3=="cur"then fZ=math.min(math.max(1,fZ+fH),#fx+1)elseif g3=="end"then fZ=math.min(math.max(0,#fx+fH),#fx)+1 end;return fZ-1 end,write=function(g6)if type(g6)=="number"and fY then g6=string.char(g6)elseif type(g6)~="string"then error("bad argument #1 (string or number expected, got "..type(g6).." )",2)end;if fx==nil then error("File is closed",2)end;fx=string.sub(fx,1,fZ-1)..g6 ..string.sub(fx,fZ+#g6)fZ=fZ+#g6 end,writeLine=function(g6)ff(1,g6,"string")write(g6 .."\n")end,flush=function()fF(fo,fx)end,close=function()fF(fo,fx)fx=nil end}end;local function g9(ft)local ga=false;return{read=function(self,gb)if ga then error("File is closed",2)end;ff(2,gb,"string","nil")if not gb then gb="l"end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;if string.find(gb,"*")==1 then gb=gb:gsub("%*","")end;if gb=="l"then return ft.readLine(false)elseif gb=="L"then return ft.readLine(true)elseif gb=="a"then return ft.readAll()end end,seek=function(self,g3,fH)if ga then error("File is closed",2)end;ff(2,g3,"string","nil")ff(3,fH,"number","nil")if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;return ft.seek(fH,g3)end,write=function(self,...)if ga then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;local gc={...}for j=1,#gc do local gd=gc[j]if type(gd)~="string"and type(gd)~="number"then error("bad argument #"..j+1 .." (string or number expected, got "..type(gd).." )",2)end;if type(gd)=="number"then gd=string.char(gd)end;ft.write(gc[j])end end,close=function(self)if ga then error("File is already closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;ft.close()ga=true end,flush=function(self)if ga then error("File is closed",2)end;if type(self)~="table"then error("bad argument #1 (FILE expected, got "..type(self).." )",2)end;ft.flush()end,lines=function(self)if ga 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 ga then error("file is already closed",2)end;return ft.readLine(false)end end}end;function _G.fs.open(fo,gb)ff(1,fo,"string")ff(2,gb,"string")if gb=="r"or gb=="rb"then if _G.fs.exists(fo)then return fX(fo,gb=="rb")else error("File not found",2)end elseif gb=="w"or gb=="wb"then return g4(fo,gb=="wb",false)elseif gb=="a"or gb=="ab"then return g4(fo,gb=="ab",true)elseif gb=="r+"or gb=="rb+"or gb=="r+b"then if _G.fs.exists(fo)then return g7(fo,gb=="rb+"or gb=="r+b",false)else error("File not found",2)end elseif gb=="w+"or gb=="wb+"or gb=="w+b"then return g7(fo,gb=="wb+"or gb=="w+b",true)elseif gb=="a+"or gb=="ab+"or gb=="a+b"then return g7(fo,gb=="ab+"or gb=="a+b",true)else error("Invalid mode",2)end end;function _G.fs.move(ge,gf)ff(1,ge,"string")ff(2,gf,"string")if not _G.fs.exists(ge)then error("Source does not exist",2)end;if _G.fs.exists(gf)then error("Destination already exists",2)end;local fx=fD(ge)fF(gf,fx)fF(ge,nil)end;function _G.fs.copy(ge,gf)ff(1,ge,"string")ff(2,gf,"string")if not _G.fs.exists(ge)then error("Source does not exist",2)end;if _G.fs.exists(gf)then error("Destination already exists",2)end;local fx=fD(ge)fF(gf,fx)end;local function gg(fo,fB,j,fp)local fC=fB[j]if not fC then if _G.fs.exists(fo)then fp[#fp+1]=fo end elseif fC.exact then return gg(_G.fs.combine(fo,fC.contents),fB,j+1,fp)else if not _G.fs.isDir(fo)then return end;local gh=_G.fs.list(fo)for k=1,#gh do local fq=gh[k]if fq:find(fC.contents)then gg(_G.fs.combine(fo,fq),fB,j+1,fp)end end end end;local gi={["^"]="%^",["$"]="%$",["("]="%(",[")"]="%)",["%"]="%%",["."]="%.",["["]="%[",["]"]="%]",["+"]="%+",["-"]="%-",["*"]=".*",["?"]="."}function _G.fs.find(gj)ff(1,gj,"string")gj=_G.fs.combine(gj)if gj==".."or gj:sub(1,3)=="../"then error("/"..gj..": Invalid Path",2)end;if not gj:find("[*?]")then if _G.fs.exists(gj)then return{gj}else return{}end end;local fB={}for fC in gj:gmatch("[^/]+")do if fC:find("[*?]")then fB[#fB+1]={exact=false,contents="^"..fC:gsub(".",gi).."$"}else fB[#fB+1]={exact=true,contents=fC}end end;local fp={}gg("",fB,1,fp)return fp end;function _G.io.open(fo,gb)ff(1,fo,"string")ff(2,gb,"string","nil")if not gb then gb="r"end;local ft;if gb=="r"or gb=="rb"then if _G.fs.exists(fo)and not _G.fs.isDir(fo)then ft=fX(fo,gb=="rb")elseif _G.fs.isDir(fo)then return nil,"Attempt to open a directory"else return nil,"File not found"end elseif gb=="w"or gb=="wb"then ft=g4(fo,gb=="wb",false)elseif gb=="a"or gb=="ab"then ft=g4(fo,gb=="ab",true)elseif gb=="r+"or gb=="rb+"or gb=="r+b"then if _G.fs.exists(fo)and not _G.fs.isDir(fo)then ft=g7(fo,gb=="rb+"or gb=="r+b",false)elseif _G.fs.isDir(fo)then return nil,"Attempt to open a directory"else return nil,"File not found"end elseif gb=="w+"or gb=="wb+"or gb=="w+b"then ft=g7(fo,gb=="wb+"or gb=="w+b",true)elseif gb=="a+"or gb=="ab+"or gb=="a+b"then ft=g7(fo,gb=="ab+"or gb=="a+b",true)else return nil,"Invalid mode"end;return g9(ft)end;function _G.io.lines(fo,...)local gc={...}ff(1,fo,"string")local ft=_G.io.open(fo,table.unpack(gc))local g1=0;return function()g1=g1+1;local g0=ft:read(gc[g1%#gc+1]or"l")if g0==nil then ft:close()end;return g0 end end;function _G.fs.delete(fo)ff(1,fo,"string")if not _G.fs.exists(fo)then error("File not found",2)end;fF(fo,nil)end;function _G.fs.getSize(fo)ff(1,fo,"string")if not _G.fs.exists(fo)then error("File not found",2)end;if _G.fs.isDir(fo)then return 0 else return#fD(fo)end end;function _G.fs.makeDir(fo)ff(1,fo,"string")if _G.fs.exists(fo)then return end;fF(fo,{})end;if fs.exists("/startup.lua")and not fs.isDir("/startup.lua")or fs.exists("/startup")and not fs.isDir("/startup")then shell.run("startup")end;if fs.exists("/startup")and fs.isDir("/startup")then shell.setDir("/startup")for a0,fq in ipairs(fs.list("/startup"))do if not fs.isDir("/startup/"..fq)then shell.run("/startup/"..fq)end end end