Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 81.14 KB | None | 0 0
  1.  
  2. local JD=load([===[
  3. local rA5U=20160728.17
  4. local Uc06="-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20160728.17 ]-"local lcBL={VERSION=rA5U,AUTHOR_NOTE=Uc06}local DHPxI=" "
  5. local dx={pretty=true,align_keys=false,indent=DHPxI}
  6. local RRuSHnxf={__tostring=function()return"JSON array"end}RRuSHnxf.__index=RRuSHnxf
  7. local mcYOuT={__tostring=function()return"JSON object"end}mcYOuT.__index=mcYOuT;function lcBL:newArray(iXxD6s)
  8. return setmetatable(iXxD6s or{},RRuSHnxf)end;function lcBL:newObject(oiY)return
  9. setmetatable(oiY or{},mcYOuT)end;local function Rr(FsYIVlkf)
  10. return
  11. type(FsYIVlkf)=='number'and FsYIVlkf or FsYIVlkf.N end
  12. local scRP0={__index=isNumber,__tostring=function(HLXS0Q_)return HLXS0Q_.S end,__unm=function(Kw)return
  13. Rr(Kw)end,__concat=function(nvaIsNv7,vDnoL55)
  14. return tostring(nvaIsNv7)..tostring(vDnoL55)end,__add=function(xlAK,zr1y)return Rr(xlAK)+Rr(zr1y)end,__sub=function(Hs,jk)return
  15. Rr(Hs)-Rr(jk)end,__mul=function(qzSFyIO,Z65)
  16. return Rr(qzSFyIO)*Rr(Z65)end,__div=function(umyCNfj,FT)return Rr(umyCNfj)/Rr(FT)end,__mod=function(YVLXYq,bJfct)return
  17. Rr(YVLXYq)%Rr(bJfct)end,__pow=function(OhuFpq_N,Dzg)return
  18. Rr(OhuFpq_N)^Rr(Dzg)end,__lt=function(_4O,C)return Rr(_4O)<Rr(C)end,__eq=function(fLI2zRe,_Fr2YU)return
  19. Rr(fLI2zRe)==Rr(_Fr2YU)end,__le=function(Xfn,U)return
  20. Rr(Xfn)<=Rr(U)end}
  21. function lcBL:asNumber(Ebsw)
  22. if getmetatable(Ebsw)==scRP0 then return Ebsw elseif
  23. type(Ebsw)=='table'and
  24. type(Ebsw.S)=='string'and type(Ebsw.N)=='number'then return setmetatable(Ebsw,scRP0)else
  25. local UlikV={S=tostring(Ebsw),N=tonumber(Ebsw)}return setmetatable(UlikV,scRP0)end end
  26. local function AI0R2TQ6(JtAjijkG)
  27. if JtAjijkG<=127 then return string.char(JtAjijkG)elseif JtAjijkG<=2047 then
  28. local s=math.floor(JtAjijkG/0x40)local YAtG_LV3=JtAjijkG- (0x40*s)return
  29. string.char(0xC0+s,0x80+YAtG_LV3)elseif JtAjijkG<=65535 then
  30. local LfEJbh_=math.floor(JtAjijkG/0x1000)local JD=JtAjijkG-0x1000*LfEJbh_
  31. local u=math.floor(JD/0x40)local pzDMZwG=JD-0x40*u;LfEJbh_=0xE0+LfEJbh_;u=0x80+u
  32. pzDMZwG=0x80+pzDMZwG
  33. if
  34.  
  35. (LfEJbh_==0xE0 and u<0xA0)or
  36. (LfEJbh_==0xED and u>0x9F)or(LfEJbh_==0xF0 and u<0x90)or(LfEJbh_==0xF4 and u>0x8F)then return"?"else return string.char(LfEJbh_,u,pzDMZwG)end else local XPoQB=math.floor(JtAjijkG/0x40000)
  37. local XxJ=JtAjijkG-0x40000*XPoQB;local o5sms=math.floor(XxJ/0x1000)
  38. XxJ=XxJ-0x1000*o5sms;local JQi1jg=math.floor(XxJ/0x40)local wVzn=XxJ-0x40*JQi1jg
  39. return string.char(
  40. 0xF0+XPoQB,0x80+o5sms,0x80+JQi1jg,0x80+wVzn)end end
  41. function lcBL:onDecodeError(pE,RSjapQ,QJf,zC)if RSjapQ then
  42. if QJf then
  43. pE=string.format("%s at char %d of: %s",pE,QJf,RSjapQ)else pE=string.format("%s: %s",pE,RSjapQ)end end
  44. if zC~=nil then pE=pE.." ("..
  45. lcBL:encode(zC)..")"end
  46. if self.assert then self.assert(false,pE)else assert(false,pE)end end;lcBL.onDecodeOfNilError=lcBL.onDecodeError
  47. lcBL.onDecodeOfHTMLError=lcBL.onDecodeError
  48. function lcBL:onEncodeError(pfZ3SPy_,pDNa2ox6)
  49. if pDNa2ox6 ~=nil then pfZ3SPy_=pfZ3SPy_..
  50. " ("..lcBL:encode(pDNa2ox6)..")"end;if self.assert then self.assert(false,pfZ3SPy_)else
  51. assert(false,pfZ3SPy_)end end
  52. local function yA(Do6yo7nm,y06X3k,ivnJjrA,d3fMjkg)
  53. local el=y06X3k:match('^-?[1-9]%d*',ivnJjrA)or y06X3k:match("^-?0",ivnJjrA)if not el then
  54. Do6yo7nm:onDecodeError("expected number",y06X3k,ivnJjrA,d3fMjkg.etc)end
  55. local Wu_uIt=ivnJjrA+el:len()local w=y06X3k:match('^%.%d+',Wu_uIt)or""Wu_uIt=Wu_uIt+
  56. w:len()
  57. local sgeP=y06X3k:match('^[eE][-+]?%d+',Wu_uIt)or""Wu_uIt=Wu_uIt+sgeP:len()local CM=el..w..sgeP;if
  58. d3fMjkg.decodeNumbersAsObjects then return lcBL:asNumber(CM),Wu_uIt end
  59. if
  60.  
  61. (
  62. d3fMjkg.decodeIntegerStringificationLength and(el:len()>=d3fMjkg.decodeIntegerStringificationLength or
  63. sgeP:len()>0))or
  64. (d3fMjkg.decodeDecimalStringificationLength and
  65. (
  66. w:len()>=d3fMjkg.decodeDecimalStringificationLength or sgeP:len()>0))then return CM,Wu_uIt end;local Qlmlet=tonumber(CM)if not Qlmlet then
  67. Do6yo7nm:onDecodeError("bad number",y06X3k,ivnJjrA,d3fMjkg.etc)end;return Qlmlet,Wu_uIt end
  68. local function XmVolesU(_,RkGFh6,hw18,nvCiFt7r)if RkGFh6:sub(hw18,hw18)~='"'then
  69. _:onDecodeError("expected string's opening quote",RkGFh6,hw18,nvCiFt7r.etc)end;local xSebv5Jc=hw18+1
  70. local mMp=RkGFh6:len()local rDtVf=""
  71. while xSebv5Jc<=mMp do local vj=RkGFh6:sub(xSebv5Jc,xSebv5Jc)if
  72. vj=='"'then return rDtVf,xSebv5Jc+1 end
  73. if vj~='\\'then rDtVf=rDtVf..vj;xSebv5Jc=
  74. xSebv5Jc+1 elseif RkGFh6:match('^\\b',xSebv5Jc)then rDtVf=rDtVf.."\b"xSebv5Jc=
  75. xSebv5Jc+2 elseif RkGFh6:match('^\\f',xSebv5Jc)then rDtVf=rDtVf.."\f"xSebv5Jc=
  76. xSebv5Jc+2 elseif RkGFh6:match('^\\n',xSebv5Jc)then rDtVf=rDtVf.."\n"xSebv5Jc=
  77. xSebv5Jc+2 elseif RkGFh6:match('^\\r',xSebv5Jc)then rDtVf=rDtVf.."\r"xSebv5Jc=
  78. xSebv5Jc+2 elseif RkGFh6:match('^\\t',xSebv5Jc)then rDtVf=rDtVf.."\t"xSebv5Jc=
  79. xSebv5Jc+2 else
  80. local z=RkGFh6:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])',xSebv5Jc)
  81. if z then xSebv5Jc=xSebv5Jc+6;local Zg=tonumber(z,16)
  82. if
  83. Zg>=0xD800 and Zg<=0xDBFF then
  84. local ykRppH=RkGFh6:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])',xSebv5Jc)
  85. if ykRppH then xSebv5Jc=xSebv5Jc+6;Zg=0x2400+ (Zg-0xD800)*0x400+
  86. tonumber(ykRppH,16)else end end;rDtVf=rDtVf..AI0R2TQ6(Zg)else rDtVf=rDtVf..
  87. RkGFh6:match('^\\(.)',xSebv5Jc)xSebv5Jc=xSebv5Jc+2 end end end
  88. _:onDecodeError("unclosed string",RkGFh6,hw18,nvCiFt7r.etc)end
  89. local function eZ0l3ch(WQ6,y36Aetn)local iPL3B4cr,GI2hz6SK=WQ6:find("^[ \n\r\t]+",y36Aetn)if GI2hz6SK then
  90. return GI2hz6SK+1 else return y36Aetn end end;local W_63_9
  91. local function h9dyA_4T(Oh,PG,n,O)if PG:sub(n,n)~='{'then
  92. Oh:onDecodeError("expected '{'",PG,n,O.etc)end;local N5UjTN=eZ0l3ch(PG,n+1)local qLH5=Oh.strictTypes and
  93. Oh:newObject{}or{}if
  94. PG:sub(N5UjTN,N5UjTN)=='}'then return qLH5,N5UjTN+1 end
  95. local tE=PG:len()
  96. while N5UjTN<=tE do local VcV0EuD,pX4gCR=XmVolesU(Oh,PG,N5UjTN,O)
  97. N5UjTN=eZ0l3ch(PG,pX4gCR)if PG:sub(N5UjTN,N5UjTN)~=':'then
  98. Oh:onDecodeError("expected colon",PG,N5UjTN,O.etc)end
  99. N5UjTN=eZ0l3ch(PG,N5UjTN+1)local gad4ZcL,pX4gCR=W_63_9(Oh,PG,N5UjTN,O)qLH5[VcV0EuD]=gad4ZcL
  100. N5UjTN=eZ0l3ch(PG,pX4gCR)local dk=PG:sub(N5UjTN,N5UjTN)
  101. if dk=='}'then return qLH5,N5UjTN+1 end;if PG:sub(N5UjTN,N5UjTN)~=','then
  102. Oh:onDecodeError("expected comma or '}'",PG,N5UjTN,O.etc)end
  103. N5UjTN=eZ0l3ch(PG,N5UjTN+1)end;Oh:onDecodeError("unclosed '{'",PG,n,O.etc)end
  104. local function oh(E,OO,y,cR6rJlAl)if OO:sub(y,y)~='['then
  105. E:onDecodeError("expected '['",OO,y,cR6rJlAl.etc)end;local M6ilzGJ=eZ0l3ch(OO,y+1)local iW6CD=E.strictTypes and
  106. E:newArray{}or{}if
  107. OO:sub(M6ilzGJ,M6ilzGJ)==']'then return iW6CD,M6ilzGJ+1 end
  108. local wZdg=1;local BaX=OO:len()
  109. while M6ilzGJ<=BaX do
  110. local SJsW11k,Ki1HJT=W_63_9(E,OO,M6ilzGJ,cR6rJlAl)iW6CD[wZdg]=SJsW11k;wZdg=wZdg+1;M6ilzGJ=eZ0l3ch(OO,Ki1HJT)
  111. local wjim8xCV=OO:sub(M6ilzGJ,M6ilzGJ)if wjim8xCV==']'then return iW6CD,M6ilzGJ+1 end;if
  112. OO:sub(M6ilzGJ,M6ilzGJ)~=','then
  113. E:onDecodeError("expected comma or '['",OO,M6ilzGJ,cR6rJlAl.etc)end
  114. M6ilzGJ=eZ0l3ch(OO,M6ilzGJ+1)end
  115. E:onDecodeError("unclosed '['",OO,y,cR6rJlAl.etc)end
  116. W_63_9=function(E,QLam,qTDt,v)qTDt=eZ0l3ch(QLam,qTDt)
  117. if qTDt>QLam:len()then E:onDecodeError("unexpected end of string",QLam,
  118. nil,v.etc)end
  119. if QLam:find('^"',qTDt)then return XmVolesU(E,QLam,qTDt,v.etc)elseif
  120. QLam:find('^[-0123456789 ]',qTDt)then return yA(E,QLam,qTDt,v)elseif QLam:find('^%{',qTDt)then
  121. return h9dyA_4T(E,QLam,qTDt,v)elseif QLam:find('^%[',qTDt)then return oh(E,QLam,qTDt,v)elseif QLam:find('^true',qTDt)then return true,
  122. qTDt+4 elseif QLam:find('^false',qTDt)then return false,qTDt+5 elseif
  123. QLam:find('^null',qTDt)then return nil,qTDt+4 else
  124. E:onDecodeError("can't parse JSON",QLam,qTDt,v.etc)end end
  125. function lcBL:decode(Ta,u,nArcvQl)if type(nArcvQl)~='table'then nArcvQl={}end;if u~=nil then
  126. nArcvQl.etc=u end;if
  127. type(self)~='table'or self.__index~=lcBL then
  128. lcBL:onDecodeError("JSON:decode must be called in method format",nil,nil,nArcvQl.etc)end
  129. if Ta==nil then
  130. self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"),
  131. nil,nil,nArcvQl.etc)elseif type(Ta)~='string'then
  132. self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s",type(Ta)),
  133. nil,nil,nArcvQl.etc)end;if Ta:match('^%s*$')then return nil end;if Ta:match('^%s*<')then
  134. self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"),Ta,
  135. nil,nArcvQl.etc)end
  136. if
  137. Ta:sub(1,1):byte()==0 or
  138. (Ta:len()>=2 and Ta:sub(2,2):byte()==0)then
  139. self:onDecodeError("JSON package groks only UTF-8, sorry",Ta,nil,nArcvQl.etc)end;if nArcvQl.decodeNumbersAsObjects==nil then
  140. nArcvQl.decodeNumbersAsObjects=self.decodeNumbersAsObjects end;if
  141. nArcvQl.decodeIntegerStringificationLength==nil then
  142. nArcvQl.decodeIntegerStringificationLength=self.decodeIntegerStringificationLength end;if
  143. nArcvQl.decodeDecimalStringificationLength==nil then
  144. nArcvQl.decodeDecimalStringificationLength=self.decodeDecimalStringificationLength end
  145. local h6Ub7U,Gm=pcall(W_63_9,self,Ta,1,nArcvQl)if h6Ub7U then return Gm else
  146. if self.assert then self.assert(false,Gm)else assert(false,Gm)end;return nil,Gm end end
  147. local function DZXGTh(YKA7cU)
  148. if YKA7cU=="\n"then return"\\n"elseif YKA7cU=="\r"then return"\\r"elseif YKA7cU=="\t"then return"\\t"elseif YKA7cU=="\b"then
  149. return"\\b"elseif YKA7cU=="\f"then return"\\f"elseif YKA7cU=='"'then return'\\"'elseif YKA7cU=='\\'then return'\\\\'else return
  150. string.format("\\u%04x",YKA7cU:byte())end end
  151. local Su9Koz='['..'"'..
  152. '%\\'..'%z'..'\001'..'-'..'\031'..']'local Uk7e=AI0R2TQ6(0x2028)local KwQCk_G=AI0R2TQ6(0x2029)
  153. local function ptZa(mCsewfX,yY)
  154. local Xf=mCsewfX:gsub(Su9Koz,DZXGTh)if yY.stringsAreUtf8 then
  155. Xf=Xf:gsub(Uk7e,'\\u2028'):gsub(KwQCk_G,'\\u2029')end;return'"'..Xf..'"'end
  156. local function PEqsd(UlFdiZ7v,U,wFeA)local JQgI={}local N={}local fs52REi=false;local PUNkgaiM
  157. for X in pairs(U)do
  158. if type(X)=='string'then
  159. table.insert(JQgI,X)elseif type(X)=='number'then table.insert(N,X)
  160. if X<=0 or X>=math.huge then
  161. fs52REi=true elseif not PUNkgaiM or X>PUNkgaiM then PUNkgaiM=X end else
  162. UlFdiZ7v:onEncodeError("can't encode table with a key of type "..type(X),wFeA)end end
  163. if#JQgI==0 and not fs52REi then
  164. if#N>0 then return nil,PUNkgaiM elseif
  165. tostring(U)=="JSON array"then return nil elseif tostring(U)=="JSON object"then return{}else return nil end end;table.sort(JQgI)local s6FbB
  166. if#N>0 then if UlFdiZ7v.noKeyConversion then
  167. UlFdiZ7v:onEncodeError("a table with both numeric and string keys could be an object or array; aborting",wFeA)end
  168. s6FbB={}for dc61,aguhyl in pairs(U)do s6FbB[dc61]=aguhyl end
  169. table.sort(N)
  170. for p,gOPDv in ipairs(N)do local aSdZU3=tostring(gOPDv)
  171. if s6FbB[aSdZU3]==nil then
  172. table.insert(JQgI,aSdZU3)s6FbB[aSdZU3]=U[gOPDv]else
  173. UlFdiZ7v:onEncodeError(
  174. "conflict converting table with mixed-type keys into a JSON object: key "..gOPDv.." exists both as a string and a number.",wFeA)end end end;return JQgI,nil,s6FbB end;local iSj
  175. function iSj(YKDL,oFyb6OLp,oGdh_mv,WjvvK,TASVwBgU,KjUncMB,XkT)
  176. if oFyb6OLp==nil or
  177. (not XkT and TASVwBgU and TASVwBgU.null and oFyb6OLp==
  178. TASVwBgU.null)then return'null'elseif
  179. type(oFyb6OLp)=='string'then return ptZa(oFyb6OLp,TASVwBgU)elseif type(oFyb6OLp)=='number'then
  180. if
  181. oFyb6OLp~=oFyb6OLp then return"null"elseif oFyb6OLp>=math.huge then return"1e+9999"elseif oFyb6OLp<=-math.huge then
  182. return"-1e+9999"else return tostring(oFyb6OLp)end elseif type(oFyb6OLp)=='boolean'then return tostring(oFyb6OLp)elseif type(oFyb6OLp)~=
  183. 'table'then
  184. YKDL:onEncodeError("can't convert "..type(oFyb6OLp).." to JSON",WjvvK)elseif getmetatable(oFyb6OLp)==scRP0 then return tostring(oFyb6OLp)else
  185. local c3dr=oFyb6OLp;if type(TASVwBgU)~='table'then TASVwBgU={}end;if type(KjUncMB)~=
  186. 'string'then KjUncMB=""end
  187. if oGdh_mv[c3dr]then
  188. YKDL:onEncodeError("table "..
  189. tostring(c3dr).." is a child of itself",WjvvK)else oGdh_mv[c3dr]=true end;local NGH;local tIc,MD2O,HQ=PEqsd(YKDL,c3dr,WjvvK)
  190. if MD2O then local cng={}for lE=1,MD2O do
  191. table.insert(cng,iSj(YKDL,c3dr[lE],oGdh_mv,WjvvK,TASVwBgU,KjUncMB))end
  192. if TASVwBgU.pretty then NGH="[ "..
  193. table.concat(cng,", ").." ]"else NGH="["..
  194. table.concat(cng,",").."]"end elseif tIc then local nI2F0id=HQ or c3dr
  195. if TASVwBgU.pretty then local N4aMD_P={}local pCi=0
  196. for lNOqUk8,YAnZNei in ipairs(tIc)do
  197. local h8YWR44E=iSj(YKDL,tostring(YAnZNei),oGdh_mv,WjvvK,TASVwBgU,KjUncMB,true)
  198. if TASVwBgU.align_keys then pCi=math.max(pCi,#h8YWR44E)end;table.insert(N4aMD_P,h8YWR44E)end
  199. local NzeoQJ=KjUncMB..tostring(TASVwBgU.indent or"")
  200. local AwGfFV=NzeoQJ..string.rep(" ",pCi)..
  201. (TASVwBgU.align_keys and" "or"")
  202. local wCRY="%s%"..string.format("%d",pCi).."s: %s"local d0uKSVw1={}
  203. for VF,fTrMe in ipairs(tIc)do
  204. local ypDndT8=iSj(YKDL,nI2F0id[fTrMe],oGdh_mv,WjvvK,TASVwBgU,AwGfFV)
  205. table.insert(d0uKSVw1,string.format(wCRY,NzeoQJ,N4aMD_P[VF],ypDndT8))end;NGH="{\n"..
  206. table.concat(d0uKSVw1,",\n").."\n"..KjUncMB.."}"else local MV65={}
  207. for Y3D66Ym9,q in
  208. ipairs(tIc)do
  209. local PhJ=iSj(YKDL,nI2F0id[q],oGdh_mv,WjvvK,TASVwBgU,KjUncMB)
  210. local h=iSj(YKDL,tostring(q),oGdh_mv,WjvvK,TASVwBgU,KjUncMB,true)
  211. table.insert(MV65,string.format("%s:%s",h,PhJ))end;NGH="{"..table.concat(MV65,",").."}"end else NGH="[]"end;oGdh_mv[c3dr]=false;return NGH end end
  212. function lcBL:encode(j2K,r8hgwQ,_6U)if type(self)~='table'or self.__index~=lcBL then
  213. lcBL:onEncodeError("JSON:encode must be called in method format",r8hgwQ)end;if
  214. type(_6U)~='table'then _6U={}end;return iSj(self,j2K,{},r8hgwQ,_6U)end
  215. function lcBL:encode_pretty(GLSzBQs,c,xg)if type(self)~='table'or self.__index~=lcBL then
  216. lcBL:onEncodeError("JSON:encode_pretty must be called in method format",c)end;if
  217. type(xg)~='table'then xg=dx end;return iSj(self,GLSzBQs,{},c,xg)end;function lcBL.__tostring()return"JSON encode/decode package"end
  218. lcBL.__index=lcBL
  219. function lcBL:new(Id2KoP_G)local Y2or={}if Id2KoP_G then
  220. for zN8ASHV5,iju in pairs(Id2KoP_G)do Y2or[zN8ASHV5]=iju end end
  221. return setmetatable(Y2or,lcBL)end;return lcBL:new()
  222. ]===])()
  223. local u=(function()
  224. local N=[[ Copyright (c) The python-semanticversion project
  225. All rights reserved.
  226.  
  227. Redistribution and use in source and binary forms, with or without
  228. modification, are permitted provided that the following conditions are met:
  229.  
  230. 1. Redistributions of source code must retain the above copyright notice, this
  231. list of conditions and the following disclaimer.
  232. 2. Redistributions in binary form must reproduce the above copyright notice,
  233. this list of conditions and the following disclaimer in the documentation
  234. and/or other materials provided with the distribution.
  235.  
  236. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  237. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  238. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  239. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  240. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  241. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  242. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  243. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  244. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  245. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  246. ]]
  247. N=[[ The use of the library is similar to the original one,
  248. check the documentation here: https://python-semanticversion.readthedocs.io/en/latest/
  249. ]]local fs52REi,PUNkgaiM,s6FbB;do local KjUncMB=table
  250. fs52REi,PUNkgaiM,s6FbB=KjUncMB.concat,KjUncMB.insert,KjUncMB.unpack end;local X
  251. X=function(XkT)
  252. do local c3dr=tonumber(XkT)if
  253. c3dr then return c3dr,true else return XkT,false end end end;local dc61
  254. dc61=function(NGH)return
  255. NGH and NGH[1]=='0'and tonumber(NGH and NGH~='0')end;local aguhyl
  256. aguhyl=function(tIc,MD2O)if tIc==MD2O then return 0 end;if tIc>MD2O then return 1 end;if tIc<MD2O then
  257. return-1 end end;local p
  258. p=function(HQ,cng)local lE,nI2F0id=X(HQ)local N4aMD_P,pCi=X(cng)
  259. if nI2F0id and pCi then
  260. return aguhyl(lE,N4aMD_P)elseif nI2F0id then return-1 elseif pCi then return 1 else return aguhyl(lE,N4aMD_P)end end;local gOPDv
  261. gOPDv=function(NzeoQJ,AwGfFV)local wCRY
  262. do local d0uKSVw1={}
  263. for lNOqUk8=1,#NzeoQJ do if AwGfFV[lNOqUk8]then
  264. d0uKSVw1[NzeoQJ[lNOqUk8]]=AwGfFV[lNOqUk8]end end;wCRY=d0uKSVw1 end
  265. for YAnZNei,h8YWR44E in pairs(wCRY)do local VF=p(YAnZNei,h8YWR44E)if VF~=0 then return VF end end;return aguhyl(#NzeoQJ,#AwGfFV)end;local aSdZU3
  266. do local fTrMe
  267. local ypDndT8={_coerce=function(Y3D66Ym9,q,PhJ)if PhJ==nil then PhJ=false end
  268. if q==nil and PhJ then return q end;return tonumber(q)end,next_major=function(h)
  269. if
  270. h.prerelease and h.minor==0 and h.patch==0 then
  271. return
  272. aSdZU3(fs52REi((function()local j2K={}
  273. local r8hgwQ=1;local _6U={h.major,h.minor,h.patch}for GLSzBQs=1,#_6U do local c=_6U[GLSzBQs]
  274. j2K[r8hgwQ]=tostring(c)r8hgwQ=r8hgwQ+1 end;return j2K end)(),'.'))else
  275. return
  276. aSdZU3(fs52REi((function()local xg={}local Id2KoP_G=1;local Y2or={h.major+1,0,0}
  277. for zN8ASHV5=1,#Y2or do
  278. local iju=Y2or[zN8ASHV5]xg[Id2KoP_G]=tostring(iju)Id2KoP_G=Id2KoP_G+1 end;return xg end)(),'.'))end end,next_minor=function(XsWgh)if
  279. not(XsWgh.minor)then
  280. error("Partial version doesn't contain the minor component!")end
  281. if
  282. XsWgh.prerelease and XsWgh.patch==0 then
  283. return
  284. aSdZU3(fs52REi((function()local l4Hdz={}local NSXCgSH=1
  285. local Wq={XsWgh.major,XsWgh.minor,XsWgh.patch}for SbOQ=1,#Wq do local IiuHGo=Wq[SbOQ]l4Hdz[NSXCgSH]=tostring(IiuHGo)
  286. NSXCgSH=NSXCgSH+1 end;return l4Hdz end)(),'.'))else
  287. return
  288. aSdZU3(fs52REi((function()local cGqxtYr={}local bgJFKeeZ=1
  289. local yu9fg0nN={XsWgh.major,XsWgh.minor+1,0}
  290. for wgx=1,#yu9fg0nN do local zlU7X=yu9fg0nN[wgx]
  291. cGqxtYr[bgJFKeeZ]=tostring(zlU7X)bgJFKeeZ=bgJFKeeZ+1 end;return cGqxtYr end)(),'.'))end end,next_patch=function(t)if
  292. not(t.patch)then
  293. error("Partial version doesn't contain the patch component!")end
  294. if t.prerelease then
  295. return
  296. aSdZU3(fs52REi((function()local f6qbO={}local kk=1
  297. local QrubIAv={t.major,t.minor,t.patch}for bLHDW=1,#QrubIAv do local YjFd7b=QrubIAv[bLHDW]f6qbO[kk]=tostring(YjFd7b)
  298. kk=kk+1 end;return f6qbO end)(),'.'))else
  299. return
  300. aSdZU3(fs52REi((function()local jZgPYb={}local zN2=1;local IN69pa5={t.major,t.minor,t.patch+1}for UOWJ=1,#
  301. IN69pa5 do local WtalJw=IN69pa5[UOWJ]jZgPYb[zN2]=tostring(WtalJw)
  302. zN2=zN2+1 end;return jZgPYb end)(),'.'))end end,coerce=function(JYrf2,KHDOUlRY,I0JvPpn)if
  303. I0JvPpn==nil then I0JvPpn=false end;local Ce4ZE
  304. Ce4ZE=function(kxeBp)
  305. local a,kQ=kxeBp:match('^(%d+)(.*)$')if not(a)then return nil end;local EE9LAE=a
  306. local iVx,eg=kQ:match('^%.(%d+)(.*)$')if iVx then kQ=eg;EE9LAE=EE9LAE.. ('.'..iVx)end
  307. local AQviNt;AQviNt,eg=kQ:match('^%.(%d+)(.*)$')if AQviNt then kQ=eg;EE9LAE=EE9LAE..
  308. ('.'..AQviNt)end;return kxeBp,EE9LAE end;local OVx_mN,lB=Ce4ZE(KHDOUlRY)if not(OVx_mN)then
  309. error("Version string lacks a numerical component: "..
  310. tostring(KHDOUlRY))end
  311. local byE=KHDOUlRY:sub(1,#lB)if not I0JvPpn then while({byE:gsub('.','')})[2]<2 do
  312. byE=byE..'.0'end end;if
  313. #lB==#KHDOUlRY then return aSdZU3(byE,I0JvPpn)end
  314. local bITCI=KHDOUlRY:sub(#lB+1)bITCI=bITCI:gsub('[^a-zA-Z0-9+.-]','-')local K,F5dtVpnN=nil,nil
  315. if
  316. bITCI:sub(1,1)=='+'then K=''F5dtVpnN=bITCI:sub(2)elseif bITCI:sub(1,1)=='.'then K=''
  317. F5dtVpnN=bITCI:sub(2)elseif bITCI:sub(1,1)=='-'then bITCI=bITCI:sub(2)
  318. do
  319. local T6=bITCI:find('+')if T6 then K,F5dtVpnN=bITCI:sub(1,T6-1),bITCI:sub(T6+1,-1)else
  320. K,F5dtVpnN=bITCI,''end end else do local NviN0i=bITCI:find('+')
  321. if NviN0i then K,F5dtVpnN=bITCI:sub(1,NviN0i-1),bITCI:sub(NviN0i+1,
  322. -1)else K,F5dtVpnN=bITCI,''end end end;F5dtVpnN=F5dtVpnN:gsub('+','.')if K and K~=''then
  323. byE=byE.. ('-'..K)end;if F5dtVpnN and F5dtVpnN~=''then
  324. byE=byE.. ('+'..F5dtVpnN)end;return JYrf2.__class(byE,I0JvPpn)end,parse=function(BlMQce,o,dpRE,fEiXwWq)if
  325. dpRE==nil then dpRE=false end;if fEiXwWq==nil then fEiXwWq=false end;if
  326. not o or type(o)~='string'or o==''then
  327. error("Invalid empty version string: "..
  328. tostring(tostring(o)))end;local r3JzMga6
  329. if dpRE then
  330. r3JzMga6=BlMQce.__class.partialVersionRe else r3JzMga6=BlMQce.__class.versionRe end;local Tuyw,FYLcr2nu,ioS69,AiP,S2jwpoi=r3JzMga6(BlMQce.__class,o)if not Tuyw then
  331. error(
  332. "Invalid version string: "..tostring(o))end;if dc61(Tuyw)then
  333. error("Invalid leading zero in major: "..tostring(o))end;if dc61(FYLcr2nu)then
  334. error("Invalid leading zero in minor: "..
  335. tostring(o))end;if dc61(ioS69)then
  336. error("Invalid leading zero in patch: "..
  337. tostring(o))end;Tuyw=tonumber(Tuyw)
  338. FYLcr2nu=BlMQce:_coerce(FYLcr2nu,dpRE)ioS69=BlMQce:_coerce(ioS69,dpRE)
  339. if AiP==nil then
  340. if
  341. dpRE and S2jwpoi==nil then return{Tuyw,FYLcr2nu,ioS69,nil,nil}else AiP={}end elseif AiP==''then AiP={}else
  342. do local _WX9u={}local u0riyU=1;for UH in AiP:gmatch('[^.]+')do _WX9u[u0riyU]=UH
  343. u0riyU=u0riyU+1 end;AiP=_WX9u end;BlMQce:_validateIdentifiers(AiP,false)end
  344. if S2jwpoi==nil then if dpRE then S2jwpoi=nil else S2jwpoi={}end elseif S2jwpoi==''then S2jwpoi={}else do
  345. local WNph={}local ytF=1
  346. for d in S2jwpoi:gmatch('[^.]+')do WNph[ytF]=d;ytF=ytF+1 end;S2jwpoi=WNph end
  347. BlMQce:_validateIdentifiers(S2jwpoi,true)end;return{Tuyw,FYLcr2nu,ioS69,AiP,S2jwpoi}end,_validateIdentifiers=function(gRm,LPX0,g)if
  348. g==nil then g=false end
  349. for _l=1,#LPX0 do local qao=LPX0[_l]if not qao then
  350. error("Invalid empty identifier "..
  351.  
  352. tostring(qao).." in "..tostring(fs52REi(LPX0,'.')))end;if
  353.  
  354. qao:sub(1,1)=='0'and tonumber(qao)and qao~='0'and not g then
  355. error("Invalid leading zero in identifier "..tostring(qao))end end end,__pairs=function(ipUPIzc)return
  356. pairs({ipUPIzc.major,ipUPIzc.minor,ipUPIzc.patch,ipUPIzc.prerelease,ipUPIzc.build})end,__ipairs=function(N8)return
  357. ipairs({N8.major,N8.minor,N8.patch,N8.prerelease,N8.build})end,__tostring=function(Gzk)
  358. local J7nsK=tostring(Gzk.major)
  359. if Gzk.minor~=nil then J7nsK=J7nsK.. ('.'..Gzk.minor)end
  360. if Gzk.patch~=nil then J7nsK=J7nsK.. ('.'..Gzk.patch)end
  361. if Gzk.prerelease and#Gzk.prerelease>0 or
  362.  
  363. Gzk.partial and Gzk.prerelease and#Gzk.prerelease==0 and Gzk.build==nil then
  364. J7nsK=J7nsK.. ('-'..
  365. fs52REi(Gzk.prerelease,'.'))end
  366. if Gzk.build and#Gzk.build>0 or Gzk.partial and Gzk.build and
  367. #Gzk.build==0 then J7nsK=J7nsK.. ('+'..
  368. fs52REi(Gzk.build,'.'))end;return J7nsK end,_comparsionFunctions=function(dXbd,vQj)if
  369. vQj==nil then vQj=false end;local sVBxyy
  370. sVBxyy=function(bJtvRSR,aBhZK5)
  371. if bJtvRSR and aBhZK5 then
  372. return gOPDv(bJtvRSR,aBhZK5)elseif bJtvRSR then return-1 elseif aBhZK5 then return 1 else return 0 end end;local N9d
  373. N9d=function(Jz8JUscj,OtGmbAgE)
  374. if Jz8JUscj==OtGmbAgE then return 0 else return'not implemented'end end;local S7
  375. S7=function(oU_r)local n_lv
  376. n_lv=function(UYQF,WXx)
  377. if UYQF==nil or WXx==nil then return 0 else return oU_r(UYQF,WXx)end end;return n_lv end
  378. if vQj then
  379. return{aguhyl,S7(aguhyl),S7(aguhyl),S7(sVBxyy),S7(N9d)}else return{aguhyl,aguhyl,aguhyl,sVBxyy,N9d}end end,__compare=function(W4EuxJXi,BlYNd61h)
  380. local XDPndG=W4EuxJXi:_comparsionFunctions(
  381. W4EuxJXi.partial or BlYNd61h.partial)
  382. local sJYFQIP4={{XDPndG[1],W4EuxJXi.major,BlYNd61h.major},{XDPndG[2],W4EuxJXi.minor,BlYNd61h.minor},{XDPndG[3],W4EuxJXi.patch,BlYNd61h.patch},{XDPndG[4],W4EuxJXi.prerelease,BlYNd61h.prerelease},{XDPndG[5],W4EuxJXi.build,BlYNd61h.build}}
  383. for Ogq0S2=1,#sJYFQIP4 do local n8Cw3SR=sJYFQIP4[Ogq0S2]local GJqd7gt,slE5aDm2,aL_g=s6FbB(n8Cw3SR)
  384. local IMUI10L=GJqd7gt(slE5aDm2,aL_g)if IMUI10L~=0 then return IMUI10L end end;return 0 end,__compareHelper=function(vPA,pUXZ6G4,mk,OeQex1U4)
  385. local i0cV9=vPA:__compare(pUXZ6G4)if i0cV9 =='not implemented'then return OeQex1U4 end
  386. return mk(i0cV9)end,__eq=function(EGD,VWiGCreH)
  387. local B_kkL;B_kkL=function(uEO6Y)return uEO6Y==0 end;return
  388. EGD:__compareHelper(VWiGCreH,B_kkL,false)end,__lt=function(i_053JPY,l)
  389. local UK;UK=function(NzaICo)return NzaICo<0 end;return
  390. i_053JPY:__compareHelper(l,UK,false)end,__le=function(k1X83nYm,xxzxfj)
  391. local _ad1m4I;_ad1m4I=function(H1QsS)return H1QsS<=0 end;return
  392. k1X83nYm:__compareHelper(xxzxfj,_ad1m4I,false)end}ypDndT8.__index=ypDndT8
  393. fTrMe=setmetatable({__init=function(rIMx,TiA,Y51P)if Y51P==nil then Y51P=false end
  394. local ichL,NOK,Alv,YeLO2,CkrmO=s6FbB(rIMx:parse(TiA,Y51P))
  395. rIMx.major,rIMx.minor,rIMx.patch,rIMx.prerelease,rIMx.build,rIMx.partial=ichL,NOK,Alv,YeLO2,CkrmO,Y51P end,__base=ypDndT8,__name="Version"},{__index=ypDndT8,__call=function(ooovsSJe,...)
  396. local s5IsD=setmetatable({},ypDndT8)ooovsSJe.__init(s5IsD,...)return s5IsD end})ypDndT8.__class=fTrMe;local MV65=fTrMe
  397. MV65.versionRe=function(MV65,KvYEVoXt)
  398. local VWWD_P,zsMuNkv,aXxi,Q18a7QTy=KvYEVoXt:match('^(%d+)%.(%d+)%.(%d+)(.*)$')if not(VWWD_P)then return nil end
  399. local K5Rp6,GTIA=Q18a7QTy:match('^%-([0-9a-zA-z.-]+)(.*)$')if K5Rp6 then Q18a7QTy=GTIA end;local gdPUe
  400. gdPUe,GTIA=Q18a7QTy:match('^%+([0-9a-zA-Z.-]+)(.*)$')if gdPUe then Q18a7QTy=GTIA end;if#Q18a7QTy>0 then return nil end;return VWWD_P,zsMuNkv,
  401. aXxi,K5Rp6,gdPUe end
  402. MV65.partialVersionRe=function(MV65,_bxEn)local pcN_ceXY,_P=_bxEn:match('^(%d+)(.*)$')if
  403. not(pcN_ceXY)then return nil end;local rq,mo=_P:match('^%.(%d+)(.*)$')
  404. if rq then _P=mo end;local I;I,mo=_P:match('^%.(%d+)(.*)$')if I then _P=mo end;local RAAJAsR
  405. RAAJAsR,mo=_P:match('^%-([0-9a-zA-Z.-]*)(.*)$')if RAAJAsR then _P=mo end;local c1pjj7
  406. c1pjj7,mo=_P:match('^%+([0-9a-zA-Z.-]*)(.*)$')if c1pjj7 then _P=mo end;if#_P>0 then return nil end;return pcN_ceXY,rq,I,RAAJAsR,c1pjj7 end;aSdZU3=fTrMe end;local YKDL
  407. do local BMv
  408. local NQh8={parse=function(bkTe,ohmPbyDd)if not ohmPbyDd or type(ohmPbyDd)~='string'or
  409. ohmPbyDd==''then
  410. error("Invalid empty requirement specification: "..
  411. tostring(tostring(ohmPbyDd)))end
  412. if
  413. ohmPbyDd=='*'then return{bkTe.__class.KIND_ANY,''}end;local D,DfDLWkT=bkTe.__class:reSpec(ohmPbyDd)if not D then
  414. error(
  415. "Invalid requirement specification: "..tostring(ohmPbyDd))end;D=
  416. bkTe.__class.KIND_ALIASES[D]or D;local MTU8HP4d=aSdZU3(DfDLWkT,true)
  417. if
  418. MTU8HP4d.build~=nil and D~=bkTe.__class.KIND_EQUAL and D~=
  419. bkTe.__class.KIND_NEQ then
  420. error("Invalid requirement specification "..
  421. tostring(ohmPbyDd)..": build numbers have no ordering")end;return{D,MTU8HP4d}end,match=function(hIM_cG0i,jD)
  422. local me=hIM_cG0i.kind
  423. if hIM_cG0i.__class.KIND_ANY==me then return true elseif
  424. hIM_cG0i.__class.KIND_LT==me then return jD<hIM_cG0i.spec elseif hIM_cG0i.__class.KIND_LTE==me then return jD<=
  425. hIM_cG0i.spec elseif hIM_cG0i.__class.KIND_EQUAL==me then return
  426. jD==hIM_cG0i.spec elseif hIM_cG0i.__class.KIND_GTE==me then
  427. return jD>=hIM_cG0i.spec elseif hIM_cG0i.__class.KIND_GT==me then return jD>hIM_cG0i.spec elseif
  428. hIM_cG0i.__class.KIND_NEQ==me then return jD~=hIM_cG0i.spec elseif
  429. hIM_cG0i.__class.KIND_CARET==me then return
  430. hIM_cG0i.spec<=jD and jD<hIM_cG0i.spec:next_major()elseif hIM_cG0i.__class.KIND_TILDE==me then return
  431.  
  432. hIM_cG0i.spec<=jD and jD<hIM_cG0i.spec:next_minor()else return
  433. error("Unexpected match kind: "..tostring(hIM_cG0i.kind))end end,__tostring=function(sgU5HAMG)
  434. return
  435. tostring(sgU5HAMG.kind)..tostring(sgU5HAMG.spec)end,__eq=function(FDydY,PEZ_)return FDydY.kind==PEZ_.kind and FDydY.spec==
  436. PEZ_.spec end}NQh8.__index=NQh8
  437. BMv=setmetatable({__init=function(c,ElbTbcZG)
  438. c.kind,c.spec=s6FbB(c:parse(ElbTbcZG))end,__base=NQh8,__name="SpecItem"},{__index=NQh8,__call=function(r3,...)
  439. local pUiVYRok=setmetatable({},NQh8)r3.__init(pUiVYRok,...)return pUiVYRok end})NQh8.__class=BMv;local P=BMv;P.KIND_ANY='*'P.KIND_LT='<'P.KIND_LTE='<='
  440. P.KIND_EQUAL='=='P.KIND_SHORTEQ='='P.KIND_EMPTY=''P.KIND_GTE='>='P.KIND_GT='>'
  441. P.KIND_NEQ='!='P.KIND_CARET='^'P.KIND_TILDE='~'
  442. P.KIND_ALIASES={[P.__class.KIND_SHORTEQ]=P.__class.KIND_EQUAL,[P.__class.KIND_EMPTY]=P.__class.KIND_EQUAL}
  443. P.reSpec=function(P,jvPsY9)local tEBmuypm,hW=jvPsY9:match('^(.-)(%d.*)$')
  444. if
  445. not
  446. (
  447.  
  448. tEBmuypm=='<'or tEBmuypm==
  449. '<='or tEBmuypm==''or tEBmuypm=='='or tEBmuypm=='=='or tEBmuypm=='>='or tEBmuypm=='>'or
  450. tEBmuypm=='!='or
  451. tEBmuypm=='^'or
  452. tEBmuypm=='~')then return nil else return tEBmuypm,hW end end;YKDL=BMv end;local oFyb6OLp
  453. do local iOcgdUx
  454. local kCwLIk={parse=function(_l,rjQ)local Euo0={}local LIV=1;for vydlAbZ3 in rjQ:gmatch('[^,]+')do
  455. Euo0[LIV]=YKDL(vydlAbZ3)LIV=LIV+1 end;return Euo0 end,match=function(BXxv5z,mKLU)
  456. local Him=BXxv5z.specs;for cPDhu=1,#Him do local UQnOS=Him[cPDhu]
  457. if not UQnOS:match(mKLU)then return false end end;return true end,filter=function(tRWU,X2Zy_nb)
  458. local ITtw3N7E=0
  459. return
  460. function()
  461. while true do ITtw3N7E=ITtw3N7E+1;local yozOp=X2Zy_nb[ITtw3N7E]
  462. if not(yozOp)then return nil end;if tRWU:match(yozOp)then return yozOp end end end end,select=function(wxU,kOmS5sy)
  463. local CLSdD;do local Fh={}local IlAPA=1
  464. for jLKMpQuK in wxU:filter(kOmS5sy)do Fh[IlAPA]=jLKMpQuK;IlAPA=IlAPA+1 end;CLSdD=Fh end
  465. if#CLSdD>0 then
  466. local sUQpby=CLSdD[1]for mbA=1,#CLSdD do local _qPhpaFx=CLSdD[mbA]
  467. if sUQpby<_qPhpaFx then sUQpby=_qPhpaFx end end;return sUQpby else return nil end end,__index=function(zex,pPGcdu)if
  468. zex:match(pPGcdu)then return true else return nil end end,__pairs=function(rjp)return
  469. pairs(rjp.specs)end,__ipairs=function(cT2z)return ipairs(cT2z.specs)end,__tostring=function(zke1tWps)
  470. return
  471. fs52REi((function()
  472. local gRFA={}local jX9a0tJX=1;local YFy4TGc=zke1tWps.specs
  473. for YjpbYkCb=1,#YFy4TGc do local L1p7luJ=YFy4TGc[YjpbYkCb]
  474. gRFA[jX9a0tJX]=tostring(L1p7luJ)jX9a0tJX=jX9a0tJX+1 end;return gRFA end)(),',')end,__eq=function(eH,WpOZ)
  475. local fD2289=eH.specs
  476. for folfO=1,#fD2289 do local vtsK=fD2289[folfO]local E1p4Mv=false;local IHap=WpOZ.specs
  477. for rDvV=1,#IHap do
  478. local RX1L2q=IHap[rDvV]if vtsK==RX1L2q then E1p4Mv=true;break end end;if not E1p4Mv then return false end end;return true end}kCwLIk.__index=kCwLIk
  479. iOcgdUx=setmetatable({__init=function(bCBtWguf,q)if type(q)=='string'then q={q}end
  480. local e1sXUN4f
  481. do local x={}local VP=1;for IQwqq=1,#q do local Xcc4=q[IQwqq]x[VP]=bCBtWguf:parse(Xcc4)
  482. VP=VP+1 end;e1sXUN4f=x end;bCBtWguf.specs={}for fqw5=1,#e1sXUN4f do local qnVfOeRE=e1sXUN4f[fqw5]
  483. for YIiSKsxK=1,#qnVfOeRE do
  484. local Ua=qnVfOeRE[YIiSKsxK]PUNkgaiM(bCBtWguf.specs,Ua)end end end,__base=kCwLIk,__name="Spec"},{__index=kCwLIk,__call=function(qeJtG,...)
  485. local pdpNgBcZ=setmetatable({},kCwLIk)qeJtG.__init(pdpNgBcZ,...)return pdpNgBcZ end})kCwLIk.__class=iOcgdUx;oFyb6OLp=iOcgdUx end;local oGdh_mv
  486. oGdh_mv=function(wV,rLd)return aguhyl(aSdZU3(wV,aSdZU3(rLd)))end;local WjvvK;WjvvK=function(z8oF,DB6A7N)
  487. return oFyb6OLp(z8oF):match(aSdZU3(DB6A7N))end
  488. local TASVwBgU
  489. TASVwBgU=function(VhYX)return({aSdZU3:parse(VhYX)})[1]end
  490. return{Spec=oFyb6OLp,SpecItem=YKDL,Version=aSdZU3,compare=oGdh_mv,match=WjvvK,validate=TASVwBgU}end)()local pzDMZwG;pzDMZwG=require("component").isAvailable;local XPoQB,XxJ
  491. do
  492. local Ha7ErH=require("shell")XPoQB,XxJ=Ha7ErH.parse,Ha7ErH.getWorkingDirectory end;local o5sms=require("shell")local JQi1jg,wVzn,pE,RSjapQ,QJf,zC
  493. do
  494. local rjU95v=require("filesystem")
  495. JQi1jg,wVzn,pE,RSjapQ,QJf,zC=rjU95v.isDirectory,rjU95v.exists,rjU95v.makeDirectory,rjU95v.concat,rjU95v.copy,rjU95v.lastModified end;local pfZ3SPy_=require("filesystem")local pDNa2ox6,Do6yo7nm
  496. do
  497. local sxBl=require("serialization")pDNa2ox6,Do6yo7nm=sxBl.serialize,sxBl.unserialize end;local y06X3k;y06X3k=require("event").pull;local ivnJjrA,d3fMjkg,el
  498. do
  499. local m=require("term")ivnJjrA,d3fMjkg,el=m.clearLine,m.getCursor,m.clear end;local Wu_uIt;Wu_uIt=os.exit;local w,sgeP;do local nD4LhX6z=io
  500. w,sgeP=nD4LhX6z.write,nD4LhX6z.stderr end;local CM,Qlmlet;do local iN=table
  501. CM,Qlmlet=iN.insert,iN.unpack end;local _=pfZ3SPy_.list;local RkGFh6,hw18={},{}local nvCiFt7r=nil
  502. local xSebv5Jc={}local mMp={}local rDtVf={}local vj="/etc/hpm/module/"local z="/var/lib/hpm/dist/"local Zg=0
  503. local ykRppH="/etc/hpm/hpm.cfg"local WQ6=[[Usage: hpm OPTIONS COMMAND
  504. See `man hpm` for more info.]]
  505. local y36Aetn=[[-- << Global settings >> -------------------------------------------------------
  506. -- A directory where package manifests will be placed.
  507. -- It will be created if it doesn't exist.
  508. dist = "/var/lib/hpm/dist"
  509.  
  510. -- A place where to search for custom hpm modules.
  511. -- It will be created if it doesn't exist.
  512. modules = "/etc/hpm/module"
  513.  
  514. -- << Settings related to the hel module >> ------------------------------------
  515. hel = {}
  516.  
  517. -- If set to `false`, hpm will *only* remove a package that hpm is told to
  518. -- remove. Otherwise, all of its dependants will be also removed.
  519. hel.remove_dependants = true
  520.  
  521. -- << Settings related to the oppm module >> -----------------------------------
  522. oppm = {}
  523.  
  524. -- A cache file where package manifests will be stored for faster access.
  525. oppm.cache_file = "/var/cache/hpm/oppm"
  526.  
  527. -- See hel.remove_dependants above.
  528. oppm.remove_dependants = true
  529.  
  530. -- Connect additional GitHub repositories not present in OpenPrograms' list.
  531. -- The format is the same as in the oppm.cfg file at OpenPrograms:
  532. -- https://github.com/OpenPrograms/openprograms.github.io/blob/master/repos.cfg
  533. oppm.custom_repos = {
  534. -- ["My-Super-Repository"] = {
  535. -- repo="My-GitHub-Username/my-programs"
  536. -- }
  537. }
  538. ]]
  539. local iPL3B4cr={info=function(...)
  540. if RkGFh6.v then
  541. return
  542. print(table.concat((function(...)local Lq={}local s9tW=1;local R61K={...}for Jf4os=1,#R61K do local a4xc=R61K[Jf4os]
  543. Lq[s9tW]=tostring(a4xc)s9tW=s9tW+1 end;return Lq end)(...),"\t"))end end,print=function(...)
  544. if
  545. not(RkGFh6.q)then
  546. return
  547. print(table.concat((function(...)local e={}local la5=1;local i={...}for R=1,#i do local xWVu=i[R]
  548. e[la5]=tostring(xWVu)la5=la5+1 end;return e end)(...),"\t"))end end,error=function(...)
  549. if
  550. not(RkGFh6.q)then
  551. return
  552. sgeP:write(
  553. table.concat((function(...)local Yw8Yxix={}local i=1;local VoXG={...}
  554. for JL0I04c=1,#VoXG do
  555. local En6r_K97=VoXG[JL0I04c]Yw8Yxix[i]=tostring(En6r_K97)i=i+1 end;return Yw8Yxix end)(...),"\t")..'\n')end end,fatal=function(...)
  556. if
  557. not(RkGFh6.q)then
  558. sgeP:write(
  559. table.concat((function(...)local T4AA={}local VnuCKTdu=1;local XnNgn={...}
  560. for H1JD=1,#XnNgn do
  561. local gEEa9I=XnNgn[H1JD]T4AA[VnuCKTdu]=tostring(gEEa9I)VnuCKTdu=VnuCKTdu+1 end;return T4AA end)(...),"\t")..'\n')end;return Wu_uIt(1)end}local GI2hz6SK
  562. GI2hz6SK=function(ULLLDUm,e4F3)
  563. if not(ULLLDUm)then return iPL3B4cr.fatal(e4F3)end end;local Oh
  564. Oh=function(GsfNt7)return
  565. iPL3B4cr.fatal((tostring(GsfNt7))..": Not implemented yet!")end;local PG;PG=function()w(WQ6)return Wu_uIt(0)end;local n
  566. n=function(fF0,YWPfQKb2)if
  567. not(fF0)then iPL3B4cr.fatal(YWPfQKb2)end;return fF0 end;local O
  568. O=function(r,OS0Zp3i,BK)
  569. if not(type(r==OS0Zp3i))then
  570. iPL3B4cr.fatal("Value '"..
  571. tostring(r).."' is "..
  572.  
  573. tostring(type(BK))..", however, a "..tostring(OS0Zp3i).." is expected.")end;return BK end;local N5UjTN
  574. N5UjTN=function(Idjbe70)return O(Idjbe70,"number",tonumber(Idjbe70))end;local qLH5
  575. qLH5=function(B)return O(B,"string",tostring(B))end;local tE
  576. tE=function(nDjt,NVWt)
  577. for efuUGMh,p4nNp in pairs(NVWt)do if p4nNp==nDjt then return true,efuUGMh end end;return false end;local VcV0EuD
  578. VcV0EuD=function(VW)local Zt=0;for V,mzeTI in pairs(VW)do Zt=Zt+1 end;return Zt end;local pX4gCR
  579. pX4gCR=function(s)
  580. if type(s)=="nil"then return true elseif type(s)=="string"then return not s or#s<1 elseif
  581. type(s)=="table"then return not s or VcV0EuD(s)<1 else return true end end;local gad4ZcL
  582. gad4ZcL=function(y4J)
  583. for ztJhP_u8=1,#y4J do local D=y4J[ztJhP_u8]if not D then return false end end;return true end;local dk
  584. dk=function(XIcl)return wVzn(XIcl)and JQi1jg(XIcl)end;local E
  585. E=function(ys)return wVzn(ys)and not JQi1jg(ys)end;local OO
  586. OO=function(rMQ1um8)return rMQ1um8 ==1 and""or"s"end;local y
  587. y=function(U2)return U2 ~=1 and""or"s"end;local cR6rJlAl
  588. cR6rJlAl=function(X)return X==1 and"is"or"are"end;local M6ilzGJ
  589. M6ilzGJ=function(zLtWO09,Z)
  590. for ZDICnKE,L in pairs(Z)do if type(L)~="table"or
  591. type(zLtWO09[ZDICnKE])~="table"then zLtWO09[ZDICnKE]=L else
  592. M6ilzGJ(zLtWO09[ZDICnKE],L)end end end;local iW6CD
  593. iW6CD=function(B58)if type(B58)~="table"then return B58 end;local PYVzrNl={}for KTVmRC,Pa in pairs(B58)do
  594. PYVzrNl[KTVmRC]=iW6CD(Pa)end;return PYVzrNl end;local wZdg
  595. wZdg=function()do local OJPc3R=io.open("/tmp/hpm-time","w")
  596. OJPc3R:write("")OJPc3R:close()end
  597. local bmK=zC("/tmp/hpm-time")pfZ3SPy_.remove("/tmp/hpm-time")return bmK end;local BaX
  598. BaX=function(j)
  599. if
  600. pfZ3SPy_.get(o5sms.resolve(j)).isReadOnly()then return false,"the path is readonly!"elseif not wVzn(j)then
  601. return false,"the filesystem node doesn't exist."else
  602. if
  603. not(JQi1jg(j)or pfZ3SPy_.isLink(j))then return pfZ3SPy_.remove(j)else for vMgKnGj in n(_(j))do
  604. BaX(RSjapQ(j,vMgKnGj))end;return pfZ3SPy_.remove(j)end end end;local SJsW11k
  605. SJsW11k=function()
  606. local M9K=RkGFh6.c or RkGFh6.config or ykRppH
  607. if not E(M9K)then local W0iTcMIt=pfZ3SPy_.path(M9K)
  608. if not dk(W0iTcMIt)then
  609. local Dq,y3Ur=pE(W0iTcMIt)
  610. if not Dq then return false,
  611. "Failed to create '"..tostring(W0iTcMIt)..
  612. "' directory for the config file: "..tostring(y3Ur)end end;local N,Hald6SO=io.open(M9K,"w")if N then N:write(y36Aetn)N:close()else
  613. return false,
  614. "Failed to open config file for writing: "..tostring(Hald6SO)end end;local Zeu,Q2_d=io.open(M9K,"r")
  615. if Zeu then local GL70F7uL=Zeu:read("*all")
  616. Zeu:close()local lqANrrJA={}
  617. (load(GL70F7uL,"config","t",lqANrrJA))()local WUFTXBy6
  618. WUFTXBy6=function(aEZf)if aEZf==nil then aEZf={}end
  619. return
  620. setmetatable(aEZf,{__index={get=function(QjQ_o,wDiq_,QYA5WJOY)
  621. if
  622. type(aEZf[QjQ_o])~="nil"then if type(aEZf[QjQ_o])=="table"then
  623. return WUFTXBy6(aEZf[QjQ_o])end;return aEZf[QjQ_o]end
  624. iPL3B4cr.error("Attempt to access undeclared config field '"..tostring(QjQ_o).."'!")
  625. if not QYA5WJOY then return wDiq_ else return WUFTXBy6(wDiq_)end end}})end;mMp=WUFTXBy6(lqANrrJA)vj=mMp.get("modules",vj)
  626. z=mMp.get("dist",z)return mMp else
  627. return false,"Failed to open config file for reading: "..tostring(Q2_d)end end;local Ki1HJT
  628. Ki1HJT=function()if not(pzDMZwG("internet"))then
  629. iPL3B4cr.fatal("This command requires an internet card to run!")end;nvCiFt7r=nvCiFt7r or
  630. require("internet").request end;local wjim8xCV
  631. wjim8xCV=function(yliV8)Ki1HJT()return pcall(nvCiFt7r,yliV8)end;local EQLam
  632. EQLam=function()
  633. if not dk(vj)then local YUGQovw,XZt7GyF=pE(vj)if not YUGQovw then
  634. return false,"Failed to create '"..
  635. tostring(vj)..
  636. "' directory for custom modules: "..tostring(XZt7GyF)end end;local rjpKFl=n(_(vj))
  637. for Zn3SC in rjpKFl do rDtVf.name=Zn3SC:match("^(.+)%..+$")
  638. local D4=n(loadfile(RSjapQ(vj,Zn3SC),"t",rDtVf))D4()rDtVf.name=nil end;return true end;local qTDt
  639. qTDt=function(crA9EKx)local IcsJ=crA9EKx;local A
  640. do local Wp9xT=crA9EKx:find(':')if Wp9xT then
  641. IcsJ=crA9EKx:sub(Wp9xT+1)A=crA9EKx:sub(1,Wp9xT-1)end end
  642. if not A then local P={}
  643. for o0_XG8FI,A in pairs(xSebv5Jc)do
  644. if A[IcsJ]then if type(A[IcsJ])=="table"and
  645. A[IcsJ].__public==true then
  646. CM(P,{class=A,module=o0_XG8FI,method=A[IcsJ]})end end end
  647. if#P>1 then local jLsxpw=nil
  648. for x,A in pairs(P)do if A.module=="hel"then jLsxpw=x;break end end;if jLsxpw then P={P[jLsxpw]}end end
  649. if#P>1 then
  650. iPL3B4cr.print("Ambiguous choice: method "..
  651. tostring(IcsJ).." is implemented in the following modules:")for AXNfV=1,#P do local A=P[AXNfV]
  652. iPL3B4cr.print(" * "..tostring(A.module))end
  653. iPL3B4cr.print(
  654. "Choose a specific module by prepending its name with a colon, e.g., "..
  655. tostring(P[1].module)..":"..tostring(IcsJ)..".")return false elseif#P==0 then
  656. iPL3B4cr.error("Unknown command: "..tostring(IcsJ))return false else A=P[1].module
  657. iPL3B4cr.info("Note, using "..tostring(A)..":"..
  658. tostring(IcsJ)..".")
  659. return function(...)return P[1].method(P[1].class,...)end end else
  660. if xSebv5Jc[A]and pX4gCR(IcsJ)then local cX={}
  661. for iyx,bxvn in pairs(xSebv5Jc[A])do if
  662. type(bxvn)=="table"and bxvn.__public==true then
  663. CM(cX,tostring(iyx))end end
  664. iPL3B4cr.print("Available module-specific commands: "..tostring(table.concat(cX,", ")))return false end
  665. if
  666. not xSebv5Jc[A]or not xSebv5Jc[A][IcsJ]or
  667. xSebv5Jc[A][IcsJ]and
  668. (type(xSebv5Jc[A][IcsJ])~="table"or
  669. xSebv5Jc[A][IcsJ].__public~=true)then
  670. iPL3B4cr.error("Unknown command: "..tostring(A)..":"..tostring(IcsJ))return false else return function(...)
  671. return xSebv5Jc[A][IcsJ](xSebv5Jc[A],...)end end end end;local v
  672. v=function(mWYrzB)
  673. if not mWYrzB or mWYrzB==""then mWYrzB="hel"else mWYrzB=mWYrzB end;return xSebv5Jc[mWYrzB]or xSebv5Jc.default end;local Ta
  674. Ta=function(O7kX,Q4XSpdY,...)if O7kX==nil then O7kX=xSebv5Jc.default end
  675. if O7kX[Q4XSpdY]then return
  676. O7kX[Q4XSpdY](O7kX,...)else return
  677. xSebv5Jc.default[Q4XSpdY](xSebv5Jc.default,...)end end;local unArcvQl
  678. unArcvQl=function(fzTyrQ9F,fAumJ0i,i0,tZliF4)if fAumJ0i==nil then fAumJ0i="hel"end;if i0 ==nil then
  679. i0=RSjapQ(z,fAumJ0i)end
  680. if tZliF4 ==nil then tZliF4=fzTyrQ9F.name end;if not fzTyrQ9F then return false,"'nil' given"end
  681. if not dk(i0)then
  682. local uS_N6,o5SLRA=pE(i0)
  683. if not uS_N6 then return false,
  684. "Failed to create '"..tostring(RSjapQ(i0,fAumJ0i)).."' directory for manifest files: "..
  685. tostring(o5SLRA)end end;local jlmopoj,R=io.open(RSjapQ(i0,tZliF4),"w")
  686. if jlmopoj then
  687. jlmopoj:write(pDNa2ox6(fzTyrQ9F))jlmopoj:close()return true else return false,
  688. "Failed to open file for writing: "..tostring(R)end end;local h6Ub7U
  689. h6Ub7U=function(ztwXaCR,M2WtMgiq,FgfME)if FgfME==nil then FgfME="hel"end
  690. M2WtMgiq=M2WtMgiq or RSjapQ(z,FgfME,ztwXaCR)
  691. if E(M2WtMgiq)then local ylH9o,CC4Kfjh=io.open(M2WtMgiq,"rb")
  692. if ylH9o then
  693. local k=n(Do6yo7nm(ylH9o:read("*all")))ylH9o:close()return k else return false,
  694. "Failed to open manifest for '"..tostring(ztwXaCR).."' package: "..
  695. tostring(CC4Kfjh)end else return false,
  696. "No manifest found for '"..tostring(ztwXaCR).."' package"end end;local Gm
  697. Gm=function(eUQ0x,r0OR)if r0OR==nil then r0OR="hel"end;local pYHkv=RSjapQ(z,r0OR,eUQ0x)
  698. if
  699. E(pYHkv)then return BaX(pYHkv)else return false,
  700. "No manifest found for '"..tostring(eUQ0x).."' package"end end;local YKA7cU
  701. YKA7cU=function(hxZHlgP)return
  702. setmetatable({__public=true},{__call=function(zct,...)return hxZHlgP(...)end})end;local mCsewfX
  703. mCsewfX=function(WQk6Wkd,t)return
  704. function()local pRCHPl,sCffg4HK=pcall(WQk6Wkd)if not(pRCHPl)then
  705. return false,tostring(sCffg4HK)else return sCffg4HK end end end;local yY
  706. yY=function(EyljhkFp,uGDn542,DQ)
  707. if uGDn542 ==nil then uGDn542="Could not download '%s': %s"end;if DQ==nil then DQ="Could not download '%s': %s"end
  708. local s6Ahlni_,T6dNu,H=wjim8xCV(EyljhkFp)if not(s6Ahlni_ and T6dNu)then
  709. return false,uGDn542:format(EyljhkFp,H)end;local YlzZm=""for vj9879b5,H in mCsewfX(T6dNu)do
  710. if vj9879b5 then
  711. YlzZm=YlzZm..vj9879b5 else return false,DQ:format(EyljhkFp,H)end end;return YlzZm end;local Xf
  712. Xf=function()
  713. if not(RkGFh6.y)then
  714. io.write("Press [ENTER] to continue...")local cotcYZ1f=select(3,y06X3k("key_down"))
  715. if cotcYZ1f==13 then
  716. ivnJjrA()return true else io.write("\n")return false end else return true end end;local UlFdiZ7v
  717. UlFdiZ7v=function(FRcmT)local zfl=0;local itxD={}
  718. if not(pX4gCR(FRcmT.install))then
  719. local JPHs7A={"Packages to INSTALL:",table.concat(FRcmT.install," ")}CM(itxD,JPHs7A)zfl=zfl+#FRcmT.install else
  720. FRcmT.install={}end
  721. if not(pX4gCR(FRcmT.reinstall))then
  722. local yzYgnMtr={"Packages to REINSTALL:",table.concat(FRcmT.reinstall," ")}CM(itxD,yzYgnMtr)zfl=zfl+#FRcmT.reinstall else
  723. FRcmT.reinstall={}end
  724. if not(pX4gCR(FRcmT.upgrade))then
  725. local o={"Packages to UPGRADE:",table.concat(FRcmT.upgrade," ")}CM(itxD,o)zfl=zfl+#FRcmT.upgrade else FRcmT.upgrade={}end
  726. if not(pX4gCR(FRcmT.remove))then
  727. local wmkJ={"Packages to REMOVE:",table.concat(FRcmT.remove," ")}CM(itxD,wmkJ)zfl=zfl+#FRcmT.remove else FRcmT.remove={}end
  728. do
  729. local I1={tostring(#FRcmT.install).." to INSTALL, "..
  730. tostring(#FRcmT.reinstall)..
  731. " to REINSTALL, "..
  732. tostring(#FRcmT.upgrade).." to UPGRADE, "..tostring(#FRcmT.remove)..
  733. " to REMOVE."}CM(itxD,I1)end
  734. for gXu5hG,R60Ru4bj in pairs(itxD)do for gXu5hG,eQWRf in pairs(R60Ru4bj)do
  735. if gXu5hG==1 then iPL3B4cr.print(eQWRf)else iPL3B4cr.print(
  736. " "..tostring(eQWRf))end end;if
  737. gXu5hG~=#itxD then iPL3B4cr.print("")end end
  738. if zfl>0 then if not(Xf())then return Wu_uIt(7)end end end
  739. do local WT2AX;local _AvO={}_AvO.__index=_AvO
  740. WT2AX=setmetatable({__init=function()end,__base=_AvO,__name="default"},{__index=_AvO,__call=function(q,...)
  741. local WUY7=setmetatable({},_AvO)q.__init(WUY7,...)return WUY7 end})_AvO.__class=WT2AX;local qEO=WT2AX
  742. qEO.install=function()return
  743. iPL3B4cr.fatal("Incorrect source is provided! No default 'install' implementation.")end
  744. qEO.remove=function(qEO,_puepou,DYLeJ)if DYLeJ==nil then DYLeJ="hel"end
  745. if _puepou then
  746. if _puepou.files then
  747. for udbF,dt1 in
  748. pairs(_puepou.files)do
  749. if dt1.path then local V7eMEiVW,Co1tUVas=BaX(dt1.path)if not(V7eMEiVW)then
  750. iPL3B4cr:error("Failed to remove '"..
  751. tostring(dt1.path).."': "..tostring(Co1tUVas))end else
  752. local B,UjlBMb=BaX(RSjapQ(dt1.dir,dt1.name))if not(B)then
  753. iPL3B4cr:error("Failed to remove '"..tostring(RSjapQ(dt1.dir,dt1.name)).."': "..
  754. tostring(UjlBMb))end end end end;return Gm(_puepou.name,DYLeJ)else
  755. return false,"Package can't be removed: the manifest is empty."end end;xSebv5Jc.default=WT2AX end
  756. do local PKWIJ9;local rQYWEt=xSebv5Jc.default;local nCwsa={}nCwsa.__index=nCwsa
  757. setmetatable(nCwsa,rQYWEt.__base)
  758. PKWIJ9=setmetatable({__init=function(zYGA2q2,...)return PKWIJ9.__parent.__init(zYGA2q2,...)end,__base=nCwsa,__name="hel",__parent=rQYWEt},{__index=function(I9Mw,e)
  759. local BUtIET=rawget(nCwsa,e)if BUtIET==nil then local NvAj=rawget(I9Mw,"__parent")
  760. if NvAj then return NvAj[e]end else return BUtIET end end,__call=function(Icg,...)
  761. local PzMsk=setmetatable({},nCwsa)Icg.__init(PzMsk,...)return PzMsk end})nCwsa.__class=PKWIJ9;local IPPy=PKWIJ9;IPPy.URL="https://api.fomalhaut.me/"
  762. IPPy.parsePackageJSON=function(IPPy,axLuO,j)if
  763. j==nil then j=u.Spec("*")end;local As=nil;local JmCzKm={}
  764. for PXrrrSid,L9 in
  765. pairs(axLuO.versions)do local _KZPScl=u.Version(PXrrrSid)if not(_KZPScl)then
  766. iPL3B4cr.fatal(
  767. "Could not parse the version in package: "..tostring(_KZPScl))end;JmCzKm[_KZPScl]=L9 end
  768. local Mwhc,A6z=pcall(function()
  769. return
  770. j:select((function()local dbTwy={}local R4f819q=1;for Kj1I,nTUMgqomA in pairs(JmCzKm)do dbTwy[R4f819q]=Kj1I
  771. R4f819q=R4f819q+1 end;return dbTwy end)())end)if not(Mwhc)then
  772. iPL3B4cr.fatal("Could not select the best version: "..tostring(A6z))end;As=tostring(A6z)if not(A6z)then
  773. iPL3B4cr.fatal(
  774. "No candidate for version specification '"..tostring(j).."' found!")end
  775. local _Mk={name=axLuO.name,version=As,files={},dependencies={}}for Id5sIM,gZM2ANLt in pairs(JmCzKm[A6z].files)do local aC72qEnu=gZM2ANLt.path
  776. CM(_Mk.files,{url=Id5sIM,path=aC72qEnu})end;for B60J,Y4 in
  777. pairs(JmCzKm[A6z].depends)do local f=Y4.version;local yeCnvcd6=Y4.type
  778. CM(_Mk.dependencies,{name=B60J,version=f,type=yeCnvcd6})end
  779. return _Mk end
  780. IPPy.getPackageSpec=function(IPPy,Iq93c6cA)
  781. iPL3B4cr.info("Downloading package data for "..tostring(Iq93c6cA).." ...")
  782. local nsM0h,Czi=wjim8xCV(IPPy.URL.."packages/"..Iq93c6cA)if not(nsM0h)then
  783. iPL3B4cr.fatal("HTTP request error: "..Czi)end;local IlxN=""
  784. local EA_3x01A,m54tY2=xpcall(function()
  785. for AhbP in Czi do IlxN=IlxN..AhbP end end,debug.traceback)
  786. if not(EA_3x01A)then
  787. local QHFgYUN={"HTTP request error.","Perhaps the package "..tostring(Iq93c6cA)..
  788. " doesn't exist, or the Hel Repository went down.","Rerun with -v to see traceback.",
  789. "\nError details:\n"..tostring(m54tY2)}if RkGFh6.v then table.remove(QHFgYUN,3)else
  790. table.remove(QHFgYUN,4)end
  791. iPL3B4cr.fatal(table.concat(QHFgYUN,"\n"))end;local WJWMdKI=JD:decode(IlxN)if not(WJWMdKI)then
  792. iPL3B4cr.fatal("Incorrect JSON format!\n"..
  793. tostring(IlxN))end;return WJWMdKI.data end
  794. IPPy.rawInstall=function(IPPy,RoEsr7So,dX,Rz)if dX==nil then dX=false end;if Rz==nil then Rz=false end;local j177r;if Rz then
  795. j177r=RSjapQ(XxJ(),RoEsr7So.name)else j177r="/"end
  796. if Rz and not dk(j177r)then
  797. local j,qCaFw=pE(j177r)
  798. if not(j)then
  799. iPL3B4cr.fatal("Failed creating '"..tostring(j177r)..
  800. "' directory for package '"..
  801. tostring(RoEsr7So.name).."'! \n"..tostring(qCaFw))end elseif not Rz then local syvPi=h6Ub7U(RoEsr7So.name,nil,"hel")
  802. if syvPi then
  803. if syvPi.version==
  804. tostring(RoEsr7So.version)then
  805. iPL3B4cr.print("'"..tostring(RoEsr7So.name)..
  806. "@"..
  807. tostring(syvPi.version).."' is already installed, skipping...")return syvPi else
  808. iPL3B4cr.fatal("'"..
  809. tostring(RoEsr7So.name)..
  810. "@"..
  811.  
  812. tostring(RoEsr7So.version)..
  813. "' was attempted to install, however, another version of the same package is already installed: '"..
  814. tostring(RoEsr7So.name)..
  815. "@"..tostring(syvPi.version).."'")end end end
  816. for NrgSK2,wIH in pairs(RoEsr7So.files)do
  817. iPL3B4cr.info("Fetching '"..
  818. tostring(pfZ3SPy_.name(wIH.path)).."' ...")local TYWkpc=n(yY(wIH.url))
  819. local k=RSjapQ(j177r,pfZ3SPy_.path(wIH.path))
  820. if not dk(k)then local J,gtlO9=pE(k)if not(J)then
  821. iPL3B4cr.fatal("Failed to create '"..tostring(k)..
  822. "' directory for '"..
  823. tostring(pfZ3SPy_.name(wIH.path)).."'! \n"..tostring(gtlO9))end end
  824. do local Lun
  825. wIH,Lun=io.open(RSjapQ(k,pfZ3SPy_.name(wIH.path)),"w")if not(wIH)then
  826. iPL3B4cr.fatal("Could not open '"..
  827.  
  828. tostring(RSjapQ(k,pfZ3SPy_.name(wIH.path))).."' for writing: "..tostring(Lun))end
  829. wIH:write(TYWkpc)wIH:close()end end;return
  830. {name=RoEsr7So.name,version=tostring(RoEsr7So.version),files=RoEsr7So.files,dependencies=RoEsr7So.dependencies,manual=dX}end
  831. IPPy.resolveDependencies=function(IPPy,beUJXhjw,zY7adu,Nlvw,K55,BJcMTdMi)if Nlvw==nil then Nlvw={}end;if K55 ==nil then K55={}end;if
  832. BJcMTdMi==nil then BJcMTdMi={}end
  833. for f1MKKJ=1,#beUJXhjw do local nFf=beUJXhjw[f1MKKJ]local EIqL41,iv
  834. EIqL41,iv=nFf.name,nFf.version;local rfmMR4=false;for Tq2I=1,#Nlvw do local GNo=Nlvw[Tq2I]
  835. if GNo.pkg.name==EIqL41 then rfmMR4=true;break end end
  836. if not(rfmMR4)then
  837. CM(K55,{name=EIqL41,version=""})local e5x=h6Ub7U(EIqL41,nil,"hel")
  838. if not e5x or not
  839. iv:match(u.Version(e5x.version))then
  840. local QrONvWGq=IPPy:getPackageSpec(EIqL41)local D94fnZaa=IPPy:parsePackageJSON(QrONvWGq,iv)
  841. K55[#K55].version=D94fnZaa.version;local XI=D94fnZaa.dependencies
  842. for FNi=1,#XI do local pRW2nEmK=XI[FNi]rfmMR4=false;for OR=1,#Nlvw do
  843. local Arww=Nlvw[OR]
  844. if Arww.pkg.name==pRW2nEmK.name then rfmMR4=true;break end end
  845. if not rfmMR4 then local BYH=nil
  846. for o7E8TLH,N5N27Jd in pairs(K55)do if
  847. N5N27Jd.name==pRW2nEmK.name then BYH=o7E8TLH;break end end
  848. if BYH then
  849. if K55[BYH].version==pRW2nEmK.version then
  850. iPL3B4cr.fatal("Circular dependencies detected: '"..
  851.  
  852. tostring(EIqL41)..
  853. "@"..
  854. tostring(D94fnZaa.version)..
  855. "' depends on '"..
  856. tostring(pRW2nEmK.name)..
  857. "@"..
  858.  
  859. tostring(pRW2nEmK.version).."', and '"..
  860. tostring(K55[BYH].name).."@"..
  861. tostring(K55[BYH].version)..
  862. "' depends on '"..tostring(EIqL41)..
  863. "@"..tostring(D94fnZaa.version).."'.")else
  864. iPL3B4cr.fatal("Attempted to install two versions of the same package: '"..
  865. tostring(pRW2nEmK.name)..
  866. "@"..
  867.  
  868. tostring(pRW2nEmK.version)..
  869. "' and '"..
  870. tostring(K55[BYH].name)..
  871. "@"..tostring(K55[BYH].version)..
  872.  
  873. "' when resolving dependencies for '"..tostring(EIqL41)..
  874. "@"..tostring(D94fnZaa.version).."'.")end end
  875. IPPy:resolveDependencies({{name=pRW2nEmK.name,version=u.Spec(pRW2nEmK.version)}},false,Nlvw,K55,BJcMTdMi)end end;CM(Nlvw,{pkg=D94fnZaa})
  876. CM(BJcMTdMi,{pkg=D94fnZaa})else CM(Nlvw,{pkg=e5x})
  877. if zY7adu then CM(BJcMTdMi,{pkg=e5x})end end;K55[#K55]=nil end end;return BJcMTdMi end
  878. IPPy.getPackageDependants=function(IPPy,m,nK,_zr)if nK==nil then nK={}end;if _zr==nil then _zr={}end
  879. for f5=1,#m do
  880. local UAc=m[f5]local Ef=false
  881. for P=1,#nK do local F4AWvI=nK[P]if F4AWvI.name==UAc then Ef=true;break end end
  882. if not(Ef)then CM(_zr,{name=UAc})local GYVN=h6Ub7U(UAc,nil,"hel")
  883. if GYVN then
  884. CM(nK,{name=UAc,manifest=GYVN})local DNlB1V=n(_(RSjapQ(z,"hel")))
  885. for erb6G_E in DNlB1V do
  886. GYVN=n(h6Ub7U(erb6G_E,nil,"hel"))local QFUU10K=GYVN.dependencies
  887. for xNPDtul=1,#QFUU10K do local k8=QFUU10K[xNPDtul]
  888. if k8.name==UAc then
  889. Ef=false;for HmgRk=1,#nK do local UuCdpVi=nK[HmgRk]
  890. if UuCdpVi.name==erb6G_E then Ef=true;break end end
  891. if not Ef then
  892. for fghe=1,#_zr do local vFXf=_zr[fghe]if
  893. vFXf.name==erb6G_E then
  894. iPL3B4cr.fatal("Circular dependencies detected: "..tostring(erb6G_E))end end;IPPy:getPackageDependants({erb6G_E},nK,_zr)end end end end else
  895. iPL3B4cr.fatal("Package "..
  896. tostring(UAc).." is referenced as a dependant of another package, however, this package isn't installed.")end;_zr[#_zr]=nil end end;return nK end
  897. IPPy.fileConflicts=function(IPPy,CA0uX7n)if RkGFh6.f or RkGFh6.force then
  898. iPL3B4cr.info("File conflict checking skipped: --force option given.")return true end
  899. iPL3B4cr.info("Checking for file conflicts...")local ze5Vpc3=false
  900. for vwK8=1,#CA0uX7n do local Sk_SiC=CA0uX7n[vwK8]local X0bgPvA=Sk_SiC.files
  901. for M9CyqH=1,#X0bgPvA do
  902. local z0x4qSAN=X0bgPvA[M9CyqH]
  903. if wVzn(z0x4qSAN.path)then
  904. iPL3B4cr.error("'"..
  905. tostring(Sk_SiC.name).."' wants to override node at '"..
  906. tostring(z0x4qSAN.path).."'")ze5Vpc3=true end end end;if ze5Vpc3 then
  907. iPL3B4cr.fatal("File conflicts detected; terminating.")end;return true end
  908. IPPy.install=YKA7cU(function(IPPy,...)
  909. if RkGFh6.l or RkGFh6["local"]then
  910. local S=o5sms.resolve(...)
  911. local NKetZhs=n(h6Ub7U(S,RSjapQ(S,"manifest")))
  912. local EFLZ0N1=IPPy:resolveDependencies((function()local rNOL8G={}local q=1;local lKO=NKetZhs.dependencies
  913. for hcwgu=1,#lKO do
  914. local omgCdqp8=lKO[hcwgu]local X17eHTx,SGF;X17eHTx,SGF=omgCdqp8.name,omgCdqp8.version
  915. rNOL8G[q]={name=X17eHTx,version=u.Spec(SGF)}q=q+1 end;return rNOL8G end)())local gL=RkGFh6.d or RkGFh6.onlyDeps;local m4={}for myIHU=1,#EFLZ0N1 do
  916. local xxNCdF=EFLZ0N1[myIHU]
  917. CM(m4,tostring(xxNCdF.pkg.name)..
  918. "@"..tostring(xxNCdF.pkg.version))end;if not(gL)then
  919. CM(m4,
  920. tostring(NKetZhs.name).."@"..tostring(NKetZhs.version))end;UlFdiZ7v({install=m4})
  921. IPPy:fileConflicts((function()
  922. local _cl1b={}local Xz18nk=1;for P=1,#EFLZ0N1 do local sTX4=EFLZ0N1[P]_cl1b[Xz18nk]=sTX4.pkg
  923. Xz18nk=Xz18nk+1 end;return _cl1b end)())
  924. for A0TJx=1,#EFLZ0N1,1 do local Nqdkw=EFLZ0N1[A0TJx]
  925. iPL3B4cr.print("Installing '"..
  926.  
  927. tostring(Nqdkw.pkg.name).."@"..tostring(Nqdkw.pkg.version).."'...")local t=IPPy:rawInstall(Nqdkw.pkg,false,false)
  928. local QbMO,wYZ=unArcvQl(t,"hel")
  929. if QbMO then
  930. iPL3B4cr.info("Saved the manifest of '"..tostring(t.name).."'.")else
  931. iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(t.name)..
  932. "': "..tostring(wYZ)..".")end end
  933. if not gL then
  934. iPL3B4cr.print("Installing '"..tostring(NKetZhs.name).."@"..
  935. tostring(NKetZhs.version).."'...")
  936. for tx1LD,N3ROeR in pairs(NKetZhs.files)do
  937. local I1oQVnUd=N3ROeR.path or RSjapQ(N3ROeR.dir,N3ROeR.name)if not dk(pfZ3SPy_.path(I1oQVnUd))then
  938. pE(pfZ3SPy_.path(I1oQVnUd))end
  939. local oTX,WZlF4=QJf(RSjapQ(S,N3ROeR.url),I1oQVnUd)if not(oTX)then
  940. iPL3B4cr.fatal("Cannot copy file '"..tostring(N3ROeR.name)..
  941. "': "..tostring(WZlF4))end end;NKetZhs["local"]=true;local aMd,o0pf=unArcvQl(NKetZhs,"hel")
  942. if aMd then
  943. iPL3B4cr.info(
  944. "Saved the manifest of '"..tostring(NKetZhs.name).."'.")else
  945. iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(NKetZhs.name).."': "..
  946. tostring(o0pf)..".")end end;iPL3B4cr.print("Done.")return true end;local X0GTupeV={}local rQ={...}
  947. for IxqPDOWH=1,#rQ do local GZqV=rQ[IxqPDOWH]
  948. local OVubrDw_,G2_TeR8=GZqV:match("^(.+)@(.+)$")or GZqV;if pX4gCR(G2_TeR8)then G2_TeR8="*"end
  949. iPL3B4cr.info("Creating version specification for "..
  950. tostring(G2_TeR8).." ...")
  951. local yk,OPSPMfr_=pcall(function()return u.Spec(G2_TeR8)end)if not(yk)then
  952. iPL3B4cr.fatal("Could not parse the version specification: "..tostring(OPSPMfr_).."!")end
  953. CM(X0GTupeV,{name=OVubrDw_,version=OPSPMfr_})end;local k=RkGFh6.r or RkGFh6.reinstall
  954. local Oc=RkGFh6.s or RkGFh6.save;local IHovU=IPPy:resolveDependencies(X0GTupeV,k)local e_wDQjk={}
  955. local ClglY={}
  956. for QnNOl=1,#IHovU do local aQs=false
  957. repeat local uow_0tb=IHovU[QnNOl]
  958. if k then local tykg=false;for C_pPyW=1,#X0GTupeV do
  959. local mgb4b=X0GTupeV[C_pPyW]
  960. if mgb4b.name==uow_0tb.pkg.name then tykg=true;break end end;if tykg then
  961. CM(e_wDQjk,
  962. tostring(uow_0tb.pkg.name).."@"..tostring(uow_0tb.pkg.version))aQs=true;break end end
  963. CM(ClglY,tostring(uow_0tb.pkg.name).."@"..
  964. tostring(uow_0tb.pkg.version))aQs=true until true;if not aQs then break end end;UlFdiZ7v({install=ClglY,reinstall=e_wDQjk})
  965. IPPy:fileConflicts((function()
  966. local LOBqxO={}local m8=1
  967. for mcoAHO=1,#IHovU do local d3gFWO=IHovU[mcoAHO]
  968. if not
  969. tE(tostring(d3gFWO.pkg.name).."@"..
  970. tostring(d3gFWO.pkg.version),e_wDQjk)then LOBqxO[m8]=d3gFWO.pkg;m8=m8+1 end end;return LOBqxO end)())
  971. if k then local D
  972. do local obodPKnu={}local kgdzk=1
  973. for oVSp=1,#X0GTupeV do local uBJ=X0GTupeV[oVSp]obodPKnu[kgdzk]=n(h6Ub7U(uBJ.name,
  974. nil,"hel"))kgdzk=kgdzk+1 end;D=obodPKnu end;IPPy:_remove(D,true,false)end
  975. for A=1,#IHovU do local MP=IHovU[A]
  976. iPL3B4cr.print("Installing '"..tostring(MP.pkg.name).."@"..
  977. tostring(MP.pkg.version).."'...")local jb=false
  978. for PPNahh=1,#X0GTupeV do local z2g=X0GTupeV[PPNahh]if z2g.name==MP.pkg.name then
  979. jb=true;break end end;local uKSj=IPPy:rawInstall(MP.pkg,jb,Oc)
  980. local YXgXQB,bvL1X4=unArcvQl(uKSj,"hel")
  981. if YXgXQB then
  982. iPL3B4cr.info("Saved the manifest of '"..tostring(uKSj.name).."'.")else
  983. iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(uKSj.name).."': "..
  984. tostring(bvL1X4)..".")end end;return iPL3B4cr.print("Done.")end)
  985. IPPy.remove=YKA7cU(function(IPPy,...)local m9JTkVv6={...}local Q={}for bWkP=1,#m9JTkVv6 do local JtFj=m9JTkVv6[bWkP]
  986. local PQ3=n(h6Ub7U(JtFj,nil,"hel"))CM(Q,PQ3)end
  987. IPPy:_remove(Q,false)return iPL3B4cr.print("Done.")end)
  988. IPPy._remove=function(IPPy,_xCtN,JVpe,nG36XmZC)if JVpe==nil then JVpe=false end
  989. if nG36XmZC==nil then nG36XmZC=true end;local Vf26
  990. if not
  991. mMp.get("hel",{},true).get("remove_dependants",true)or not nG36XmZC then
  992. do
  993. local xUGt={}local _U=1;for hkI39=1,#_xCtN do local MwwN=_xCtN[hkI39]
  994. xUGt[_U]={name=MwwN.name,manifest=MwwN}_U=_U+1 end;Vf26=xUGt end else
  995. Vf26=IPPy:getPackageDependants((function()local oZ9={}local OXlT0=1;for V=1,#_xCtN do local zIYNIXy1=_xCtN[V]
  996. oZ9[OXlT0]=zIYNIXy1.name;OXlT0=OXlT0+1 end;return oZ9 end)())end
  997. if not(JVpe)then
  998. UlFdiZ7v({remove=(function()local c={}local mReHt4h=1
  999. for I7=1,#Vf26 do local Upw=Vf26[I7]
  1000. c[mReHt4h]="hel:"..
  1001.  
  1002. tostring(Upw.manifest.name).."@"..tostring(Upw.manifest.version)mReHt4h=mReHt4h+1 end;return c end)()})end
  1003. for nqBfKL=1,#Vf26 do local gs3a=Vf26[nqBfKL]
  1004. iPL3B4cr.print("Removing '"..
  1005. tostring(gs3a.manifest.name)..
  1006. "@"..tostring(gs3a.manifest.version).."' ...")
  1007. n(PKWIJ9.__parent.remove(IPPy,gs3a.manifest,"hel"))end;return true end
  1008. IPPy.upgrade=YKA7cU(function(IPPy)local AkKaBC={}
  1009. for mZPe4w in n(_(RSjapQ(z,"hel")))do
  1010. if not
  1011. (JQi1jg(RSjapQ(z,"hel",mZPe4w)))then local OvZ=n(h6Ub7U(mZPe4w,nil,"hel"))if not
  1012. (OvZ["local"])then CM(AkKaBC,OvZ)end end end;local OmRH8={}
  1013. for cBOpf=1,#AkKaBC do local KZYA5y=AkKaBC[cBOpf]
  1014. local YoCAN7OU,FoP=pcall(IPPy.getPackageSpec,IPPy,KZYA5y.name)
  1015. if YoCAN7OU then local jqtWXY=IPPy:parsePackageJSON(FoP)
  1016. KZYA5y.latest={spec=FoP,data=jqtWXY}
  1017. if u.Version(KZYA5y.latest.data.version)>
  1018. u.Version(KZYA5y.version)then CM(OmRH8,KZYA5y)end end end
  1019. local GY=IPPy:resolveDependencies((function()local XgRb={}local G3e=1;for GoP6=1,#OmRH8 do local cZ_=OmRH8[GoP6]
  1020. XgRb[G3e]={name=cZ_.name,version=u.Spec(cZ_.latest.data.version)}G3e=G3e+1 end
  1021. return XgRb end)())local oukM79R
  1022. do local NYc8={}local Dff8=1
  1023. for lEYwsOG9=1,#OmRH8 do local M=OmRH8[lEYwsOG9]
  1024. NYc8[Dff8]=
  1025. tostring(M.name)..
  1026. "@{"..tostring(M.version).." => "..
  1027. tostring(M.latest.data.version).."}"Dff8=Dff8+1 end;oukM79R=NYc8 end;local D_j={}
  1028. for Vt95q2G=1,#GY do local jsPbwU=GY[Vt95q2G]local Wvs3rd6o=true
  1029. for UdVlP=1,#OmRH8 do local N=OmRH8[UdVlP]if N.name==
  1030. jsPbwU.pkg.name then Wvs3rd6o=false;break end end;if Wvs3rd6o then
  1031. CM(D_j,tostring(jsPbwU.pkg.name)..
  1032. "@"..tostring(jsPbwU.pkg.version))end end;UlFdiZ7v({upgrade=oukM79R,install=D_j})
  1033. for v9mB_RUi=1,#GY do
  1034. local hX=GY[v9mB_RUi]local AVU=false;local I=false
  1035. for l6xUetCb=1,#OmRH8 do local lOb_Sv=OmRH8[l6xUetCb]if
  1036. lOb_Sv.name==hX.pkg.name then AVU=lOb_Sv;I=lOb_Sv.manual;break end end;if AVU then IPPy:_remove({AVU},true,false)end
  1037. iPL3B4cr.print(
  1038. "Installing '"..tostring(hX.pkg.name)..
  1039. "@"..tostring(hX.pkg.version).."'...")local _x5O1=IPPy:rawInstall(hX.pkg,I,false)
  1040. local eFI8dI3,i=unArcvQl(_x5O1,"hel")
  1041. if eFI8dI3 then
  1042. iPL3B4cr.info("Saved the manifest of '"..tostring(_x5O1.name).."'.")else
  1043. iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(_x5O1.name)..
  1044. "': "..tostring(i)..".")end end;return iPL3B4cr.print("Done.")end)
  1045. IPPy.info=YKA7cU(function(IPPy,VspvGB9V,LrFLp5)if LrFLp5 ==nil then LrFLp5="*"end;if pX4gCR(VspvGB9V)then
  1046. iPL3B4cr.fatal("Usage: hpm hel:info <package name> [<version specification>]")end
  1047. if pX4gCR(LrFLp5)then LrFLp5="*"end
  1048. iPL3B4cr.print("Creating version specification for "..tostring(LrFLp5).." ...")
  1049. local GfB7,Iz_w1j=pcall(function()return u.Spec(LrFLp5)end)if not(GfB7)then
  1050. iPL3B4cr.fatal("Could not parse the version specification: "..tostring(Iz_w1j).."!")end
  1051. local G=IPPy:getPackageSpec(VspvGB9V)local X7YKzX=IPPy:parsePackageJSON(G,Iz_w1j)local od0VOF={}
  1052. CM(od0VOF,
  1053. "- Package name: "..tostring(G.name))
  1054. CM(od0VOF,"- Description:\n"..tostring(G.description))
  1055. CM(od0VOF,"- Package owners: "..tostring(table.concat(G.owners,", ")))
  1056. CM(od0VOF,"- Authors:\n"..
  1057. tostring(table.concat((function()local oO6SbZ={}local UE_vrsNx=1;local kef2zBS=G.authors;for Z=1,#kef2zBS do
  1058. local ze0=kef2zBS[Z]oO6SbZ[UE_vrsNx]=" - "..tostring(ze0)
  1059. UE_vrsNx=UE_vrsNx+1 end;return oO6SbZ end)(),"\n")))
  1060. CM(od0VOF,"- License: "..tostring(G.license))
  1061. CM(od0VOF,"- Versions: "..tostring(VcV0EuD(G.versions))..", latest: "..
  1062. tostring(X7YKzX.version))
  1063. CM(od0VOF," - Files: "..tostring(#X7YKzX.files))
  1064. CM(od0VOF," - Depends: "..
  1065. tostring(table.concat((function()local ylW3uC0={}local N_G1=1;local wkGNE=X7YKzX.dependencies
  1066. for ccK=1,#wkGNE
  1067. do local BV=wkGNE[ccK]ylW3uC0[N_G1]=tostring(BV.name)..
  1068. "@"..tostring(BV.version)N_G1=N_G1+1 end;return ylW3uC0 end)()," ")))
  1069. CM(od0VOF," - Changes:\n"..
  1070. tostring(G.versions[X7YKzX.version].changes))CM(od0VOF,"- Stats:")
  1071. CM(od0VOF," - Views: "..tostring(G.stats.views))
  1072. CM(od0VOF,"- Creation date: "..tostring(G.stats.date.created).." UTC")
  1073. CM(od0VOF,"- Last updated: "..
  1074. tostring(G.stats.date["last-updated"]).." UTC")
  1075. return iPL3B4cr.print(table.concat(od0VOF,"\n"))end)
  1076. IPPy.search=YKA7cU(function(IPPy,...)local HnLY=0
  1077. while true do local cm51CH1n={}local iWrSgT=IPPy.URL.."packages"iWrSgT=iWrSgT..
  1078. "?offset="..tostring(HnLY)
  1079. if...then
  1080. iWrSgT=iWrSgT..
  1081. ("&q="..
  1082. table.concat((function(...)
  1083. local Ub9iqg={}local r_S8HFRo=1;local qIF4RFBv={...}
  1084. for wNbC65Ta=1,#qIF4RFBv do local xOiPW=qIF4RFBv[wNbC65Ta]Ub9iqg[r_S8HFRo]=
  1085. '"'..xOiPW:gsub("\"","")..'"'r_S8HFRo=
  1086. r_S8HFRo+1 end;return Ub9iqg end)(...)," "):gsub("&",""))end;local C,YK1=wjim8xCV(iWrSgT)if not(C)then
  1087. iPL3B4cr.fatal("HTTP request error: "..YK1)end;local t96Qtz=""
  1088. for Z9j in YK1 do t96Qtz=t96Qtz..Z9j end;local HjKNi=JD:decode(t96Qtz)if not(HjKNi)then
  1089. iPL3B4cr.fatal("Incorrect JSON format!\n"..
  1090. tostring(t96Qtz))end;cm51CH1n=HjKNi.data.list;for r=1,#
  1091. cm51CH1n do local OnJ1=cm51CH1n[r]
  1092. iPL3B4cr.print(tostring(OnJ1.name)..": "..
  1093. tostring(OnJ1.short_description))end;if
  1094. #cm51CH1n==0 and HnLY==0 then
  1095. iPL3B4cr.print("No packages found.")break end
  1096. if
  1097. HjKNi.data.truncated and HjKNi.data.sent+
  1098. HjKNi.data.offset<HjKNi.data.total then HnLY=HjKNi.data.offset+HjKNi.data.sent else break end end end)
  1099. if rQYWEt.__inherited then rQYWEt.__inherited(rQYWEt,PKWIJ9)end;xSebv5Jc.hel=PKWIJ9 end
  1100. do local KFU0;local Pvuq=xSebv5Jc.default;local lOpDJ={}lOpDJ.__index=lOpDJ
  1101. setmetatable(lOpDJ,Pvuq.__base)
  1102. KFU0=setmetatable({__init=function(lTH,...)return KFU0.__parent.__init(lTH,...)end,__base=lOpDJ,__name="oppm",__parent=Pvuq},{__index=function(JL,FpU_E)
  1103. local JWtwnQ2t=rawget(lOpDJ,FpU_E)
  1104. if JWtwnQ2t==nil then local uEKPPpj_=rawget(JL,"__parent")if uEKPPpj_ then
  1105. return uEKPPpj_[FpU_E]end else return JWtwnQ2t end end,__call=function(aYO4NN,...)
  1106. local CtG9nSQL=setmetatable({},lOpDJ)aYO4NN.__init(CtG9nSQL,...)return CtG9nSQL end})lOpDJ.__class=KFU0;local YLe=KFU0
  1107. YLe.REPOS="https://raw.githubusercontent.com/OpenPrograms/openprograms.github.io/master/repos.cfg"YLe.PACKAGES="https://raw.githubusercontent.com/%s/master/programs.cfg"
  1108. YLe.FILES="https://raw.githubusercontent.com/%s/%s"YLe.DIRECTORY="https://api.github.com/repos/%s/contents/%s?ref=%s"
  1109. YLe.DEFAULT_CACHE_FILE="/var/cache/hpm/oppm"
  1110. YLe.cacheFile=function(YLe)
  1111. local uZtK5yX=mMp.get("oppm",{},true).get("cache_file",YLe.DEFAULT_CACHE_FILE)
  1112. if not(dk(pfZ3SPy_.path(uZtK5yX)))then
  1113. local kr2CYaS,hXgSzEI=pE(pfZ3SPy_.path(uZtK5yX))if not(kr2CYaS)then
  1114. iPL3B4cr.fatal("Could not create the cache directory at "..
  1115. tostring(pfZ3SPy_.path(uZtK5yX))..": "..tostring(hXgSzEI))end end
  1116. if not(E(uZtK5yX))then local AUQ,B=io.open(uZtK5yX,"w")if not(AUQ)then
  1117. iPL3B4cr.fatal(
  1118. "Could not open '"..tostring(uZtK5yX).."' for writing: "..tostring(B))end
  1119. AUQ:write("{}")AUQ:close()end;return uZtK5yX end
  1120. YLe.notifyCacheUpdate=function(YLe,J)local coSiE=wZdg()local wm=coSiE-J
  1121. if wm>24*60*60*1000 then
  1122. iPL3B4cr.print("Cache was last updated more than a day ago.")
  1123. return iPL3B4cr.print("Consider running hpm oppm:cache update to update it.")end end
  1124. YLe.listCache=function(YLe)local _O;local smj=YLe:cacheFile()
  1125. do local obBu,cbQlG=io.open(smj,"r")if not
  1126. (obBu)then
  1127. return false,"Could not open '"..
  1128. tostring(smj).."' for reading: "..tostring(cbQlG)end
  1129. gad4ZcL=obBu:read("*all")_O,cbQlG=Do6yo7nm(gad4ZcL)if not(_O)then return false,
  1130. "Cache is malformed: "..tostring(cbQlG)end
  1131. obBu:close()end
  1132. if not _O.updated or not _O.cache then _O={updated=0,cache=_O}end;return _O end
  1133. YLe.resolveDirectory=function(YLe,YZQu1DR4,kza,CvGDk_2)
  1134. local EGpun=n(yY(YLe.DIRECTORY:format(YZQu1DR4,CvGDk_2,kza)))EGpun=JD:decode(EGpun)
  1135. if EGpun.message then return false,
  1136. "Could not fetch "..tostring(YZQu1DR4)..
  1137. ":"..
  1138. tostring(kza).."/"..
  1139. tostring(CvGDk_2)..": "..tostring(EGpun.message)end;local LNlhK={}local cnx_1g=1
  1140. for eV=1,#EGpun do local DGQnw=EGpun[eV]
  1141. if DGQnw.type=="file"then
  1142. LNlhK[cnx_1g]={name=DGQnw.name,url=DGQnw.download_url,path=DGQnw.path}cnx_1g=cnx_1g+1 end end;return LNlhK end
  1143. YLe.updateCache=function(YLe)local yLgHuF=YLe:cacheFile()local fpL,k6=YLe:listCache()if
  1144. not(fpL)then
  1145. iPL3B4cr.error("Old cache is malformed: "..tostring(fpL))fpL={}else fpL=fpL.cache end;local m
  1146. m,k6=yY(YLe.REPOS)
  1147. if not(m)then return false,"Could not fetch "..
  1148. tostring(YLe.REPOS)..": "..tostring(k6)end;m=Do6yo7nm(m)local rvNhq6v={}
  1149. for WV,yUho4MXRx in
  1150. pairs(iW6CD(mMp.get("oppm",{},true).get("custom_repos",{})))do rvNhq6v["local/"..tostring(WV)]=yUho4MXRx end;M6ilzGJ(m,rvNhq6v)local gC={}
  1151. for J2,hgrBfz0w in pairs(m)do local Gi=false
  1152. repeat
  1153. if hgrBfz0w.repo then
  1154. iPL3B4cr.info(
  1155. "Fetching '"..tostring(J2)..
  1156. "' at '"..tostring(hgrBfz0w.repo).."' ...")local wpv1,I9IMuWm
  1157. wpv1,I9IMuWm,k6=wjim8xCV(YLe.PACKAGES:format(hgrBfz0w.repo))
  1158. if not(wpv1 and I9IMuWm)then
  1159. iPL3B4cr.error("Could not fetch '"..
  1160. tostring(J2).."' at '"..
  1161. tostring(hgrBfz0w.repo).."': "..tostring(k6))Gi=true;break end;local a=""
  1162. for wpv1,VKTNfzUf in function()return pcall(I9IMuWm)end do
  1163. if not wpv1 then
  1164. iPL3B4cr.error("Could not fetch '"..
  1165. tostring(J2).."' at '"..
  1166. tostring(hgrBfz0w.repo).."': "..tostring(VKTNfzUf))a=false;break else if not VKTNfzUf then break end;a=a..VKTNfzUf end end;if a==false then Gi=true;break end;if pX4gCR(a)then
  1167. iPL3B4cr.error("Could not fetch '"..
  1168. tostring(J2)..
  1169. "' at '"..tostring(hgrBfz0w.repo).."'")Gi=true;break end
  1170. local rZ;rZ,k6=Do6yo7nm(a)
  1171. if not rZ then
  1172. iPL3B4cr.error("Manifest '"..tostring(J2)..
  1173. "' at '"..
  1174. tostring(hgrBfz0w.repo).."' is malformed: "..tostring(k6))Gi=true;break end
  1175. for Oms4,JfA in pairs(rZ)do local CPu1=false
  1176. repeat
  1177. if Oms4:match("[^A-Za-z0-9._-]")then
  1178. iPL3B4cr.error(
  1179. "Package name contains illegal characters: "..tostring(J2)..":"..tostring(Oms4).."!")CPu1=true;break end
  1180. CM(gC,{repo=hgrBfz0w.repo,name=Oms4,data=JfA})CPu1=true until true;if not CPu1 then break end end end;Gi=true until true;if not Gi then break end end;local QO={}local VvzMQHj={}
  1181. for pfyhF=1,#gC do local pglFz82w=gC[pfyhF]local RkeCL,LoW_7e,mLgQ
  1182. RkeCL,LoW_7e,mLgQ=pglFz82w.name,pglFz82w.repo,pglFz82w.data;if tE(RSjapQ(LoW_7e,RkeCL),QO)then
  1183. iPL3B4cr.error("There're multiple packages under the same name: "..
  1184. tostring(RkeCL).."!")end
  1185. CM(VvzMQHj,{pkg=RkeCL,repo=LoW_7e,data={name=RkeCL,repo=LoW_7e,data=mLgQ}})local ng;do
  1186. for Pp_NboV,owAp3u2G in pairs(fpL)do if
  1187. owAp3u2G.repo==LoW_7e and owAp3u2G.pkg==RkeCL then ng=Pp_NboV;break end end end
  1188. if ng then
  1189. table.remove(fpL,ng)else CM(QO,RSjapQ(LoW_7e,RkeCL))end end;local fSYJX;fSYJX,k6=io.open(yLgHuF,"w")
  1190. if not(fSYJX)then return false,
  1191. "Could not open '"..
  1192. tostring(yLgHuF).."' for writing: "..tostring(k6)end;do
  1193. fSYJX:write(pDNa2ox6({updated=wZdg(),cache=VvzMQHj}))fSYJX:close()end
  1194. iPL3B4cr.print("- "..
  1195.  
  1196. tostring(#gC).." program"..tostring(OO(#gC)).." cached.")
  1197. iPL3B4cr.print("- "..tostring(#QO)..
  1198. " package"..tostring(OO(#QO)).." "..
  1199. tostring(cR6rJlAl(#QO)).." new.")
  1200. iPL3B4cr.print("- "..tostring(#fpL)..
  1201. " package"..tostring(OO(#fpL)).." no longer exist"..
  1202. tostring(y(#fpL))..".")return true end
  1203. YLe.parseLocalPath=function(YLe,OH0C,kmQkm9cr)
  1204. if kmQkm9cr:sub(1,2)=="//"then return
  1205. RSjapQ(OH0C,kmQkm9cr:sub(3))else return RSjapQ(OH0C,"usr",kmQkm9cr)end end
  1206. YLe.rawInstall=function(YLe,IE97m,wey,hThO6,zXU)if wey==nil then wey="/"end;if hThO6 ==nil then hThO6=false end;if zXU==
  1207. nil then zXU=false end;local HmJym2=n(YLe:listCache())
  1208. HmJym2=HmJym2.cache;local Jjb7Am5={filesInstalled=0,packagesInstalled=0}
  1209. if zXU and not dk(wey)then
  1210. local gA,r=pE(wey)if not(gA)then
  1211. iPL3B4cr.fatal("Failed to create '"..
  1212. tostring(wey).."' directory for package '"..tostring(IE97m).."'! \n"..
  1213. tostring(r))end elseif not zXU then local LWe=h6Ub7U(IE97m,
  1214. nil,"oppm")if LWe then
  1215. iPL3B4cr.print("'"..tostring(IE97m)..
  1216. "' is already installed, skipping...")return LWe,Jjb7Am5 end end;local UwqY7A
  1217. for _3Tq=1,#HmJym2 do local Rq1hByv=HmJym2[_3Tq]local iFk,sEFtmNgB,qxiez0Cn
  1218. iFk,sEFtmNgB,qxiez0Cn=Rq1hByv.pkg,Rq1hByv.repo,Rq1hByv.data;if iFk==IE97m then UwqY7A=Rq1hByv;break end end;if not(UwqY7A)then
  1219. iPL3B4cr.fatal("No such package: "..tostring(IE97m))end;local k={}local d7gPKcw=UwqY7A.repo
  1220. for Ck_H,Sc in
  1221. pairs(UwqY7A.data.data.files)do local _QFw_It={}
  1222. if Ck_H:sub(1,1)==":"then
  1223. _QFw_It=YLe:resolveDirectory(d7gPKcw,Ck_H:sub(2,Ck_H:find("/")-1,
  1224. nil),Ck_H:sub(Ck_H:find("/")+1))elseif Ck_H:sub(1,1)=="?"then
  1225. if
  1226. wVzn(RSjapQ(YLe:parseLocalPath(wey,Sc),pfZ3SPy_.name(Ck_H)))then _QFw_It={}else local WLqHf=Ck_H:sub(2,-1)
  1227. _QFw_It={{name=pfZ3SPy_.name(WLqHf),path=WLqHf,url=YLe.FILES:format(d7gPKcw,WLqHf)}}end else
  1228. _QFw_It={{name=pfZ3SPy_.name(Ck_H),path=Ck_H,url=YLe.FILES:format(d7gPKcw,Ck_H)}}end;local IE97m
  1229. for vN=1,#_QFw_It do local BIwW6_=_QFw_It[vN]local Vdfc3,CzM7PG
  1230. IE97m,Vdfc3,CzM7PG=BIwW6_.name,BIwW6_.path,BIwW6_.url;local RKf6s5=n(yY(CzM7PG))local tP9E_=YLe:parseLocalPath(wey,Sc)if not
  1231. (dk(tP9E_))then pE(tP9E_)end
  1232. do
  1233. local Y1WX,G06Z2=io.open(RSjapQ(tP9E_,IE97m),"w")if not Y1WX then
  1234. iPL3B4cr.fatal("Could not open file for writing: "..tostring(G06Z2))end;Y1WX:write(RKf6s5)
  1235. Y1WX:close()end;Jjb7Am5.filesInstalled=Jjb7Am5.filesInstalled+1
  1236. CM(k,{name=IE97m,url=CzM7PG,dir=tP9E_})end end;local naeNp={}
  1237. if UwqY7A.data.data.dependencies then for K in
  1238. pairs(UwqY7A.data.data.dependencies)do CM(naeNp,{name=K})end end;Jjb7Am5.packagesInstalled=Jjb7Am5.packagesInstalled+1;return
  1239. {name=IE97m,files=k,dependencies=naeNp,manual=hThO6},Jjb7Am5 end
  1240. YLe.resolveDependencies=function(YLe,tQx9TV,FL7g2o,dkh7Tt9,XiNd_H,Q_c4px86)if dkh7Tt9 ==nil then dkh7Tt9={}end
  1241. if XiNd_H==nil then XiNd_H={}end;if Q_c4px86 ==nil then Q_c4px86={}end
  1242. local _F6VYt=n(YLe:listCache())_F6VYt=_F6VYt.cache
  1243. for ITv3PH1i=1,#tQx9TV do local _5fF=tQx9TV[ITv3PH1i]local OUQqQp=false
  1244. for OyOfzTWn=1,#dkh7Tt9
  1245. do local rx=dkh7Tt9[OyOfzTWn]if rx==_5fF then OUQqQp=true;break end end
  1246. if not(OUQqQp)then XiNd_H[_5fF]=true;local ijvSrZA1=h6Ub7U(_5fF,nil,"oppm")
  1247. if not
  1248. ijvSrZA1 then local STNuSN6
  1249. for PYOeGnAZ=1,#_F6VYt do local s10ar5XH=_F6VYt[PYOeGnAZ]local YoKhvIs
  1250. YoKhvIs=s10ar5XH.pkg;if YoKhvIs==_5fF then STNuSN6=s10ar5XH;break end end;if not(STNuSN6)then
  1251. return false,"Unknown package: "..tostring(_5fF)end
  1252. if STNuSN6.data.data.dependencies then
  1253. for I2ipE in
  1254. pairs(STNuSN6.data.data.dependencies)do OUQqQp=false;for qS730I=1,#dkh7Tt9 do local PYEbnua=dkh7Tt9[qS730I]
  1255. if PYEbnua==I2ipE then OUQqQp=true;break end end
  1256. if not(OUQqQp)then
  1257. if
  1258. XiNd_H[I2ipE]then
  1259. iPL3B4cr.fatal("Circular dependencies detected: '"..
  1260. tostring(_5fF).."' depends on '"..
  1261. tostring(I2ipE).."', and '"..
  1262.  
  1263. tostring(I2ipE).."' depends on '"..tostring(_5fF).."'.")end
  1264. YLe:resolveDependencies({I2ipE},false,dkh7Tt9,XiNd_H,Q_c4px86)end end end;CM(Q_c4px86,_5fF)else if FL7g2o then CM(Q_c4px86,_5fF)end end;CM(dkh7Tt9,_5fF)XiNd_H[_5fF]=nil end end;return Q_c4px86 end
  1265. YLe.getPackageDependants=function(YLe,Um4ZYiT,AF,s)if AF==nil then AF={}end;if s==nil then s={}end
  1266. for hIHW=1,#Um4ZYiT do
  1267. local H5=Um4ZYiT[hIHW]local HYY=false;for C3=1,#AF do local SkCMMH=AF[C3]
  1268. if SkCMMH.name==H5 then HYY=true;break end end
  1269. if not(HYY)then CM(s,{name=H5})
  1270. local kvvs=h6Ub7U(H5,nil,"oppm")
  1271. if kvvs then CM(AF,{name=H5,manifest=kvvs})
  1272. local _yTx3S94=n(_(RSjapQ(z,"oppm")))
  1273. for Mm in _yTx3S94 do kvvs=n(h6Ub7U(Mm,nil,"oppm"))
  1274. local g524=kvvs.dependencies
  1275. for WUdVeYc=1,#g524 do local lHep6wo=g524[WUdVeYc]
  1276. if lHep6wo.name==H5 then HYY=false
  1277. for BKZsJ=1,#AF do
  1278. local Sw=AF[BKZsJ]if Sw.name==Mm then HYY=true;break end end
  1279. if not HYY then
  1280. for W67mm9p6=1,#s do local oBxdTi6u=s[W67mm9p6]if oBxdTi6u.name==Mm then
  1281. iPL3B4cr.fatal(
  1282. "Circular dependencies detected: "..tostring(Mm))end end;YLe:getPackageDependants({Mm},AF,s)end end end end else
  1283. iPL3B4cr.fatal("Package "..
  1284. tostring(H5).." is referenced as a dependant of another package, however, this package isn't installed.")end;s[#s]=nil end end;return AF end
  1285. YLe.whatDependsOn=function(YLe,T7hLe5j)local I_=n(h6Ub7U(T7hLe5j,nil,"oppm"))
  1286. local J2Jin={}local Rvg=n(_(RSjapQ(z,"oppm")))
  1287. for HpdA in Rvg do
  1288. I_=n(h6Ub7U(HpdA,nil,"oppm"))local DsAJbW=I_.dependencies
  1289. for AXfX=1,#DsAJbW do local btcUUhB=DsAJbW[AXfX]if
  1290. btcUUhB.name==T7hLe5j then CM(J2Jin,HpdA)end end end;return J2Jin end
  1291. YLe.install=YKA7cU(function(YLe,...)local iw0S=n(YLe:listCache())
  1292. YLe:notifyCacheUpdate(iw0S.updated)local Tjg={...}local n2srE7H=RkGFh6.r or RkGFh6.reinstall;local Rf=RkGFh6.s or
  1293. RkGFh6.save
  1294. local X9ZjrTz=n(YLe:resolveDependencies(Tjg,n2srE7H))
  1295. UlFdiZ7v({install=(function()local Ht5Ge={}local l=1
  1296. for IO=1,#X9ZjrTz do local YDJY=X9ZjrTz[IO]if
  1297. not n2srE7H or not tE(YDJY,Tjg)then Ht5Ge[l]=YDJY;l=l+1 end end;return Ht5Ge end)(),reinstall=
  1298.  
  1299. n2srE7H and
  1300. (function()local t={}local Rdi8NIft=1
  1301. for J0uTkQ9=1,#X9ZjrTz do local sd6k=X9ZjrTz[J0uTkQ9]if tE(sd6k,Tjg)then
  1302. t[Rdi8NIft]=sd6k;Rdi8NIft=Rdi8NIft+1 end end;return t end)()or nil})local tYFIuD={filesInstalled=0,packagesInstalled=0}
  1303. if n2srE7H then local a
  1304. do local lK7={}local KWMxs7a=1;for T=1,#Tjg do
  1305. local LBIp4=Tjg[T]lK7[KWMxs7a]=n(h6Ub7U(LBIp4,nil,"oppm"))
  1306. KWMxs7a=KWMxs7a+1 end;a=lK7 end;YLe:_remove(a,true,false)end
  1307. for A5=1,#X9ZjrTz do local PV168s0f=X9ZjrTz[A5]
  1308. iPL3B4cr.print("Installing '"..
  1309. tostring(PV168s0f).."'...")local bjK;if Rf then bjK="./"..tostring(PV168s0f).."/"else
  1310. bjK="/"end
  1311. local Us1Xh,rs59=YLe:rawInstall(PV168s0f,bjK,tE(PV168s0f,Tjg),Rf)
  1312. tYFIuD.filesInstalled=tYFIuD.filesInstalled+rs59.filesInstalled
  1313. tYFIuD.packagesInstalled=tYFIuD.packagesInstalled+rs59.packagesInstalled
  1314. if tYFIuD.packagesInstalled~=0 then local R,rGa2MaGH=unArcvQl(Us1Xh,"oppm")
  1315. if R then
  1316. iPL3B4cr.info(
  1317. "Saved the manifest of '"..tostring(Us1Xh.name).."'.")else
  1318. iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(Us1Xh.name).."': "..
  1319. tostring(rGa2MaGH)..".")end end end
  1320. iPL3B4cr.print("- "..
  1321. tostring(tYFIuD.packagesInstalled).." package"..
  1322. tostring(OO(tYFIuD.packagesInstalled)).." installed.")
  1323. iPL3B4cr.print("- "..
  1324. tostring(tYFIuD.filesInstalled).." file"..
  1325. tostring(OO(tYFIuD.filesInstalled)).." installed.")return iPL3B4cr.print("Done.")end)
  1326. YLe.remove=YKA7cU(function(YLe,...)local i6={...}local u33wPQT={}for aNrMnPZ=1,#i6 do local fC=i6[aNrMnPZ]
  1327. local Kl=n(h6Ub7U(fC,nil,"oppm"))CM(u33wPQT,Kl)end
  1328. YLe:_remove(u33wPQT,false)return iPL3B4cr.print("Done.")end)
  1329. YLe._remove=function(YLe,EmJGBwA,_E3,j3)if _E3 ==nil then _E3=false end;if j3 ==nil then j3=true end;local f
  1330. if not
  1331. mMp.get("oppm",{},true).get("remove_dependants",true)or not j3 then
  1332. do local jy={}
  1333. local Ifev2bUE=1
  1334. for ZY=1,#EmJGBwA do local KCpJbzHT=EmJGBwA[ZY]
  1335. jy[Ifev2bUE]={name=KCpJbzHT.name,manifest=KCpJbzHT}Ifev2bUE=Ifev2bUE+1 end;f=jy end else
  1336. f=YLe:getPackageDependants((function()local g={}local dQl0xvy2=1;for hX=1,#EmJGBwA do local wYTrvPn=EmJGBwA[hX]
  1337. g[dQl0xvy2]=wYTrvPn.name;dQl0xvy2=dQl0xvy2+1 end;return g end)())end
  1338. if not(_E3)then
  1339. UlFdiZ7v({remove=(function()local pB6K={}local YV=1;for zPm=1,#f do local JmEyZ5=f[zPm]
  1340. pB6K[YV]=tostring(JmEyZ5.name)YV=YV+1 end;return pB6K end)()})end
  1341. for FGvy=1,#f do local KpnA=f[FGvy]
  1342. iPL3B4cr.print("Removing '"..
  1343. tostring(KpnA.manifest.name).."' ...")
  1344. n(KFU0.__parent.remove(YLe,KpnA.manifest,"oppm"))end;return true end
  1345. YLe.cache=YKA7cU(function(YLe,j_F9c,...)local q=j_F9c
  1346. if"update"==q then
  1347. iPL3B4cr.print("Updating OpenPrograms program cache ...")n(YLe:updateCache())
  1348. return iPL3B4cr.print("Done.")else iPL3B4cr.error("Unknown command.")return
  1349. iPL3B4cr.print("Usage: hpm oppm:cache update")end end)
  1350. YLe.autoremove=YKA7cU(function(YLe)local b7G0ciz={}local rF2te={}
  1351. local KG_EjN=n(_(RSjapQ(z,"oppm")))
  1352. for aIrjXeB in KG_EjN do local sZdri=n(h6Ub7U(aIrjXeB,nil,"oppm"))
  1353. if not
  1354. (sZdri.manual)then local pT=YLe:getPackageDependants(aIrjXeB)if#pT==1 then
  1355. CM(b7G0ciz,aIrjXeB)CM(rF2te,aIrjXeB)end end end
  1356. while true do local XgkgIR9=false;KG_EjN=n(_(RSjapQ(z,"oppm")))
  1357. for sm2 in KG_EjN do
  1358. if not
  1359. (tE(sm2,b7G0ciz))then local cz=n(h6Ub7U(sm2,nil,"oppm"))
  1360. if
  1361. not(cz.manual)then local pSL=YLe:getPackageDependants(sm2)
  1362. table.remove(pSL,1)
  1363. if
  1364. gad4ZcL((function()local ifrP9={}local Iynmp=1;for PFvHX=1,#pSL do local sP=pSL[PFvHX]
  1365. ifrP9[Iynmp]=tE(sP.name,b7G0ciz)Iynmp=Iynmp+1 end;return ifrP9 end)())then
  1366. for Y=1,#pSL do local QHxdp58D=pSL[Y]local efdknL,YUdva=tE(QHxdp58D.name,rF2te)if YUdva then
  1367. table.remove(rF2te,YUdva)end end;CM(b7G0ciz,sm2)CM(rF2te,sm2)XgkgIR9=true end end end end;if not(XgkgIR9)then break end end
  1368. UlFdiZ7v({remove=(function()
  1369. if#b7G0ciz>0 then local x8FBS={}local LGBr=1
  1370. for M=1,#b7G0ciz do local I=b7G0ciz[M]x8FBS[LGBr]="oppm:"..
  1371. tostring(I)LGBr=LGBr+1 end;return x8FBS else return nil end end)()})for W=1,#rF2te do local Dx5GC=rF2te[W]
  1372. YLe:_remove({n(h6Ub7U(Dx5GC,nil,"oppm"))},false)end
  1373. iPL3B4cr.print("Done.")return true end)
  1374. YLe.search=YKA7cU(function(YLe,...)local kwZhI=n(YLe:listCache())
  1375. YLe:notifyCacheUpdate(kwZhI.updated)local T0h=n(kwZhI.cache)local H0={}
  1376. if...then
  1377. for Mrz66=1,#T0h do local A=T0h[Mrz66]local RR;RR=A.data
  1378. local Oj4B=RR.data;local aT={...}
  1379. for ZN0brC=#aT,1,-1 do local g=aT[ZN0brC]if RR.name:find(g)then
  1380. table.remove(aT,ZN0brC)break end;if Oj4B.name and Oj4B.name:find(g)then
  1381. table.remove(aT,ZN0brC)break end
  1382. if Oj4B.description and
  1383. Oj4B.description:find(g)then table.remove(aT,ZN0brC)break end;if Oj4B.note and Oj4B.note:find(g)then
  1384. table.remove(aT,ZN0brC)break end end;if#aT==0 then CM(H0,RR)end end else
  1385. do local iYIip_rt={}local WoJla=1;for jk=1,#T0h do local Y=T0h[jk]iYIip_rt[WoJla]=Y.data
  1386. WoJla=WoJla+1 end;H0=iYIip_rt end end
  1387. for sM=1,#H0 do local MMJEx=H0[sM]
  1388. iPL3B4cr.print(tostring(MMJEx.name)..
  1389. " - "..tostring(MMJEx.data.name or
  1390. MMJEx.name)..
  1391. ": "..tostring(MMJEx.data.description))end end)
  1392. YLe.info=YKA7cU(function(YLe,EB)if pX4gCR(EB)then
  1393. iPL3B4cr.fatal("Usage: hpm oppm:info <package name>")end
  1394. local Qy=n(YLe:listCache())Qy=Qy.cache;local rCWKBim=nil;for i=1,#Qy do local wLI=Qy[i]
  1395. if wLI.pkg==EB then rCWKBim=wLI;break end end;if not(rCWKBim)then
  1396. iPL3B4cr.fatal("No such package.")end
  1397. iPL3B4cr.print("- Package name: "..tostring(rCWKBim.pkg))if rCWKBim.data.data.name then
  1398. iPL3B4cr.print(" "..
  1399. tostring(rCWKBim.data.data.name))end;if
  1400. rCWKBim.data.data.description then
  1401. iPL3B4cr.print("- Description:\n"..
  1402. tostring(rCWKBim.data.data.description))end;if
  1403. rCWKBim.data.data.authors then
  1404. iPL3B4cr.print("- Authors:\n"..tostring(rCWKBim.data.data.authors))end;if
  1405. rCWKBim.data.data.files then
  1406. iPL3B4cr.print("- Files: "..
  1407. tostring(VcV0EuD(rCWKBim.data.data.files)))end
  1408. if
  1409. rCWKBim.data.data.dependencies then
  1410. iPL3B4cr.print("- Depends: "..
  1411. tostring(table.concat((function()local N7h={}local jDOa=1
  1412. for DcVHvlcZ in
  1413. pairs(rCWKBim.data.data.dependencies)do N7h[jDOa]=DcVHvlcZ;jDOa=jDOa+1 end;return N7h end)()," ")))end;if rCWKBim.data.data.note then
  1414. iPL3B4cr.print("- Note:\n"..
  1415. tostring(rCWKBim.data.data.note))end;return
  1416. iPL3B4cr.print(
  1417. "- Repository: https://github.com/"..tostring(rCWKBim.repo))end)
  1418. if Pvuq.__inherited then Pvuq.__inherited(Pvuq,KFU0)end;xSebv5Jc.oppm=KFU0 end;local U
  1419. U=function()local Z=n(_(z))pX4gCR=true
  1420. for Ke2eY9 in Z do local mJU4=pfZ3SPy_.name(Ke2eY9)
  1421. if
  1422. JQi1jg(RSjapQ(z,mJU4))then local ywtz=n(_(RSjapQ(z,mJU4)))
  1423. for N7 in ywtz do
  1424. if not
  1425. (JQi1jg(RSjapQ(z,mJU4,N7)))then local LLka3VWH=n(h6Ub7U(N7,nil,mJU4))
  1426. iPL3B4cr.print(
  1427. mJU4 ..":"..N7 ..
  1428. (LLka3VWH.version and" @ "..LLka3VWH.version or""))pX4gCR=false end end end end
  1429. if pX4gCR then return iPL3B4cr.print("No packages installed.")end end;local wFeA
  1430. wFeA=function(...)hw18,RkGFh6=XPoQB(...)if#hw18 <1 then return PG()end end;local JQgI
  1431. JQgI=function()local B34=hw18[1]
  1432. if"list"==B34 then return U()elseif"help"==B34 then return PG()else
  1433. do
  1434. local S9D=qTDt(hw18[1])
  1435. if S9D then
  1436. return
  1437. S9D(Qlmlet((function()local JeqL={}local RmN8=1;for ePtDYbn=2,#hw18 do local dPm5lS=hw18[ePtDYbn]JeqL[RmN8]=dPm5lS
  1438. RmN8=RmN8+1 end;return JeqL end)()))end end end end
  1439. rDtVf.semver={Version=u.Version,Spec=u.Spec,SpecItem=u.SpecItem,compare=u.compare,match=u.match,validate=u.validate}rDtVf.json=JD;rDtVf.CONFIG_PATH=ykRppH;rDtVf.USAGE=WQ6
  1440. rDtVf.DEFAULT_CONFIG=y36Aetn;rDtVf.options=RkGFh6;rDtVf.args=hw18;rDtVf.request=nvCiFt7r
  1441. rDtVf.modules=xSebv5Jc;rDtVf.config=mMp;rDtVf.modulePath=vj;rDtVf.distPath=z
  1442. rDtVf.exitCode=Zg;rDtVf.log=iPL3B4cr;rDtVf.assert=GI2hz6SK;rDtVf.unimplemented=Oh
  1443. rDtVf.printUsage=PG;rDtVf.try=n;rDtVf.checkType=O;rDtVf.argNumber=N5UjTN
  1444. rDtVf.argString=qLH5;rDtVf.isin=tE;rDtVf.tableLen=VcV0EuD;rDtVf.empty=pX4gCR
  1445. rDtVf.all=gad4ZcL;rDtVf.existsDir=dk;rDtVf.existsFile=E;rDtVf.plural=OO;rDtVf.singular=y
  1446. rDtVf.linkingVerb=cR6rJlAl;rDtVf.remove=BaX;rDtVf.loadConfig=SJsW11k;rDtVf.checkInternet=Ki1HJT
  1447. rDtVf.download=wjim8xCV;rDtVf.findCustomCommand=qTDt;rDtVf.getModuleBy=v
  1448. rDtVf.callModuleMethod=Ta;rDtVf.saveManifest=unArcvQl;rDtVf.loadManifest=h6Ub7U
  1449. rDtVf.removeManifest=Gm;rDtVf.public=YKA7cU;rDtVf.wrapResponse=mCsewfX;rDtVf.recv=yY
  1450. rDtVf.confirm=Xf;rDtVf.pkgPlan=UlFdiZ7v;rDtVf.printPackageList=U
  1451. rDtVf.parseArguments=wFeA;rDtVf.process=JQgI;for fNIe,y2R1 in pairs(_G)do rDtVf[fNIe]=y2R1 end
  1452. wFeA(...)n(SJsW11k())EQLam()JQgI()return Zg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement