Advertisement
AMONUWNA

Untitled

Mar 28th, 2020
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.98 KB | None | 0 0
  1.  
  2. local ____modules = {}
  3. local ____moduleCache = {}
  4. local ____originalRequire = require
  5. local function require(file)
  6. if ____moduleCache[file] then
  7. return ____moduleCache[file]
  8. end
  9. if ____modules[file] then
  10. ____moduleCache[file] = ____modules[file]()
  11. return ____moduleCache[file]
  12. else
  13. if ____originalRequire then
  14. return ____originalRequire(file)
  15. else
  16. error("module '" .. file .. "' not found")
  17. end
  18. end
  19. end
  20. ____modules = {
  21. ["main"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
  22. require("lualib_bundle");
  23. Printer = __TS__Class()
  24. Printer.name = "Printer"
  25. function Printer.prototype.____constructor(self)
  26. end
  27. function Printer.print(self, text, color)
  28. if color == nil then
  29. color = colours.white
  30. end
  31. if self.monitor == nil then
  32. self.monitor = peripheral.find("monitor")
  33. end
  34. if self.monitor ~= nil then
  35. self.monitor:setCursorPos(0, self.line)
  36. self.monitor:setTextColour(color)
  37. self.monitor:write(text)
  38. else
  39. print(text)
  40. end
  41. end
  42. Printer.line = 0
  43. Printer:____print("Work", colours.white)
  44. Printer:____print("Work", colours.red)
  45. Printer:____print("Work", colours.blue)
  46. Printer:____print("Work", colours.lightGrey)
  47. Printer:____print("Work", colours.green)
  48. Printer:____print("Work", colours.pink)
  49. end,
  50. ["lualib_bundle"] = function() function __TS__ArrayConcat(arr1, ...)
  51. local args = {...}
  52. local out = {}
  53. for ____, val in ipairs(arr1) do
  54. out[#out + 1] = val
  55. end
  56. for ____, arg in ipairs(args) do
  57. if pcall(
  58. function() return #arg end
  59. ) and (type(arg) ~= "string") then
  60. local argAsArray = arg
  61. for ____, val in ipairs(argAsArray) do
  62. out[#out + 1] = val
  63. end
  64. else
  65. out[#out + 1] = arg
  66. end
  67. end
  68. return out
  69. end
  70.  
  71. function __TS__ArrayEvery(arr, callbackfn)
  72. do
  73. local i = 0
  74. while i < #arr do
  75. if not callbackfn(_G, arr[i + 1], i, arr) then
  76. return false
  77. end
  78. i = i + 1
  79. end
  80. end
  81. return true
  82. end
  83.  
  84. function __TS__ArrayFilter(arr, callbackfn)
  85. local result = {}
  86. do
  87. local i = 0
  88. while i < #arr do
  89. if callbackfn(_G, arr[i + 1], i, arr) then
  90. result[#result + 1] = arr[i + 1]
  91. end
  92. i = i + 1
  93. end
  94. end
  95. return result
  96. end
  97.  
  98. function __TS__ArrayForEach(arr, callbackFn)
  99. do
  100. local i = 0
  101. while i < #arr do
  102. callbackFn(_G, arr[i + 1], i, arr)
  103. i = i + 1
  104. end
  105. end
  106. end
  107.  
  108. function __TS__ArrayFind(arr, predicate)
  109. local len = #arr
  110. local k = 0
  111. while k < len do
  112. local elem = arr[k + 1]
  113. if predicate(_G, elem, k, arr) then
  114. return elem
  115. end
  116. k = k + 1
  117. end
  118. return nil
  119. end
  120.  
  121. function __TS__ArrayFindIndex(arr, callbackFn)
  122. do
  123. local i = 0
  124. local len = #arr
  125. while i < len do
  126. if callbackFn(_G, arr[i + 1], i, arr) then
  127. return i
  128. end
  129. i = i + 1
  130. end
  131. end
  132. return -1
  133. end
  134.  
  135. function __TS__ArrayIncludes(self, searchElement, fromIndex)
  136. if fromIndex == nil then
  137. fromIndex = 0
  138. end
  139. local len = #self
  140. local k = fromIndex
  141. if fromIndex < 0 then
  142. k = len + fromIndex
  143. end
  144. if k < 0 then
  145. k = 0
  146. end
  147. for i = k, len do
  148. if self[i + 1] == searchElement then
  149. return true
  150. end
  151. end
  152. return false
  153. end
  154.  
  155. function __TS__ArrayIndexOf(arr, searchElement, fromIndex)
  156. local len = #arr
  157. if len == 0 then
  158. return -1
  159. end
  160. local n = 0
  161. if fromIndex then
  162. n = fromIndex
  163. end
  164. if n >= len then
  165. return -1
  166. end
  167. local k
  168. if n >= 0 then
  169. k = n
  170. else
  171. k = len + n
  172. if k < 0 then
  173. k = 0
  174. end
  175. end
  176. do
  177. local i = k
  178. while i < len do
  179. if arr[i + 1] == searchElement then
  180. return i
  181. end
  182. i = i + 1
  183. end
  184. end
  185. return -1
  186. end
  187.  
  188. function __TS__ArrayMap(arr, callbackfn)
  189. local newArray = {}
  190. do
  191. local i = 0
  192. while i < #arr do
  193. newArray[i + 1] = callbackfn(_G, arr[i + 1], i, arr)
  194. i = i + 1
  195. end
  196. end
  197. return newArray
  198. end
  199.  
  200. function __TS__ArrayPush(arr, ...)
  201. local items = {...}
  202. for ____, item in ipairs(items) do
  203. arr[#arr + 1] = item
  204. end
  205. return #arr
  206. end
  207.  
  208. function __TS__ArrayReduce(arr, callbackFn, ...)
  209. local len = #arr
  210. local k = 0
  211. local accumulator = nil
  212. if select("#", ...) ~= 0 then
  213. accumulator = select(1, ...)
  214. elseif len > 0 then
  215. accumulator = arr[1]
  216. k = 1
  217. else
  218. error("Reduce of empty array with no initial value", 0)
  219. end
  220. for i = k, len - 1 do
  221. accumulator = callbackFn(_G, accumulator, arr[i + 1], i, arr)
  222. end
  223. return accumulator
  224. end
  225.  
  226. function __TS__ArrayReduceRight(arr, callbackFn, ...)
  227. local len = #arr
  228. local k = len - 1
  229. local accumulator = nil
  230. if select("#", ...) ~= 0 then
  231. accumulator = select(1, ...)
  232. elseif len > 0 then
  233. accumulator = arr[k + 1]
  234. k = k - 1
  235. else
  236. error("Reduce of empty array with no initial value", 0)
  237. end
  238. for i = k, 0, -1 do
  239. accumulator = callbackFn(_G, accumulator, arr[i + 1], i, arr)
  240. end
  241. return accumulator
  242. end
  243.  
  244. function __TS__ArrayReverse(arr)
  245. local i = 0
  246. local j = #arr - 1
  247. while i < j do
  248. local temp = arr[j + 1]
  249. arr[j + 1] = arr[i + 1]
  250. arr[i + 1] = temp
  251. i = i + 1
  252. j = j - 1
  253. end
  254. return arr
  255. end
  256.  
  257. function __TS__ArrayShift(arr)
  258. return table.remove(arr, 1)
  259. end
  260.  
  261. function __TS__ArrayUnshift(arr, ...)
  262. local items = {...}
  263. do
  264. local i = #items - 1
  265. while i >= 0 do
  266. table.insert(arr, 1, items[i + 1])
  267. i = i - 1
  268. end
  269. end
  270. return #arr
  271. end
  272.  
  273. function __TS__ArraySort(arr, compareFn)
  274. if compareFn ~= nil then
  275. table.sort(
  276. arr,
  277. function(a, b) return compareFn(_G, a, b) < 0 end
  278. )
  279. else
  280. table.sort(arr)
  281. end
  282. return arr
  283. end
  284.  
  285. function __TS__ArraySlice(list, first, last)
  286. local len = #list
  287. local relativeStart = first or 0
  288. local k
  289. if relativeStart < 0 then
  290. k = math.max(len + relativeStart, 0)
  291. else
  292. k = math.min(relativeStart, len)
  293. end
  294. local relativeEnd = last
  295. if last == nil then
  296. relativeEnd = len
  297. end
  298. local final
  299. if relativeEnd < 0 then
  300. final = math.max(len + relativeEnd, 0)
  301. else
  302. final = math.min(relativeEnd, len)
  303. end
  304. local out = {}
  305. local n = 0
  306. while k < final do
  307. out[n + 1] = list[k + 1]
  308. k = k + 1
  309. n = n + 1
  310. end
  311. return out
  312. end
  313.  
  314. function __TS__ArraySome(arr, callbackfn)
  315. do
  316. local i = 0
  317. while i < #arr do
  318. if callbackfn(_G, arr[i + 1], i, arr) then
  319. return true
  320. end
  321. i = i + 1
  322. end
  323. end
  324. return false
  325. end
  326.  
  327. function __TS__ArraySplice(list, ...)
  328. local len = #list
  329. local actualArgumentCount = select("#", ...)
  330. local start = select(1, ...)
  331. local deleteCount = select(2, ...)
  332. local actualStart
  333. if start < 0 then
  334. actualStart = math.max(len + start, 0)
  335. else
  336. actualStart = math.min(start, len)
  337. end
  338. local itemCount = math.max(actualArgumentCount - 2, 0)
  339. local actualDeleteCount
  340. if actualArgumentCount == 0 then
  341. actualDeleteCount = 0
  342. elseif actualArgumentCount == 1 then
  343. actualDeleteCount = len - actualStart
  344. else
  345. actualDeleteCount = math.min(
  346. math.max(deleteCount or 0, 0),
  347. len - actualStart
  348. )
  349. end
  350. local out = {}
  351. do
  352. local k = 0
  353. while k < actualDeleteCount do
  354. local from = actualStart + k
  355. if list[from + 1] then
  356. out[k + 1] = list[from + 1]
  357. end
  358. k = k + 1
  359. end
  360. end
  361. if itemCount < actualDeleteCount then
  362. do
  363. local k = actualStart
  364. while k < (len - actualDeleteCount) do
  365. local from = k + actualDeleteCount
  366. local to = k + itemCount
  367. if list[from + 1] then
  368. list[to + 1] = list[from + 1]
  369. else
  370. list[to + 1] = nil
  371. end
  372. k = k + 1
  373. end
  374. end
  375. do
  376. local k = len
  377. while k > ((len - actualDeleteCount) + itemCount) do
  378. list[k] = nil
  379. k = k - 1
  380. end
  381. end
  382. elseif itemCount > actualDeleteCount then
  383. do
  384. local k = len - actualDeleteCount
  385. while k > actualStart do
  386. local from = (k + actualDeleteCount) - 1
  387. local to = (k + itemCount) - 1
  388. if list[from + 1] then
  389. list[to + 1] = list[from + 1]
  390. else
  391. list[to + 1] = nil
  392. end
  393. k = k - 1
  394. end
  395. end
  396. end
  397. local j = actualStart
  398. for i = 3, actualArgumentCount do
  399. list[j + 1] = select(i, ...)
  400. j = j + 1
  401. end
  402. do
  403. local k = #list - 1
  404. while k >= ((len - actualDeleteCount) + itemCount) do
  405. list[k + 1] = nil
  406. k = k - 1
  407. end
  408. end
  409. return out
  410. end
  411.  
  412. function __TS__ArrayToObject(array)
  413. local object = {}
  414. do
  415. local i = 0
  416. while i < #array do
  417. object[i] = array[i + 1]
  418. i = i + 1
  419. end
  420. end
  421. return object
  422. end
  423.  
  424. function __TS__ArrayFlat(array, depth)
  425. if depth == nil then
  426. depth = 1
  427. end
  428. local result = {}
  429. for ____, value in ipairs(array) do
  430. if ((depth > 0) and (type(value) == "table")) and ((value[1] ~= nil) or (next(value, nil) == nil)) then
  431. result = __TS__ArrayConcat(
  432. result,
  433. __TS__ArrayFlat(value, depth - 1)
  434. )
  435. else
  436. result[#result + 1] = value
  437. end
  438. end
  439. return result
  440. end
  441.  
  442. function __TS__ArrayFlatMap(array, callback)
  443. local result = {}
  444. do
  445. local i = 0
  446. while i < #array do
  447. local value = callback(_G, array[i + 1], i, array)
  448. if (type(value) == "table") and ((value[1] ~= nil) or (next(value, nil) == nil)) then
  449. result = __TS__ArrayConcat(result, value)
  450. else
  451. result[#result + 1] = value
  452. end
  453. i = i + 1
  454. end
  455. end
  456. return result
  457. end
  458.  
  459. function __TS__ArraySetLength(arr, length)
  460. if (((length < 0) or (length ~= length)) or (length == math.huge)) or (math.floor(length) ~= length) then
  461. error(
  462. "invalid array length: " .. tostring(length),
  463. 0
  464. )
  465. end
  466. do
  467. local i = #arr - 1
  468. while i >= length do
  469. arr[i + 1] = nil
  470. i = i - 1
  471. end
  472. end
  473. return length
  474. end
  475.  
  476. function __TS__Class(self)
  477. local c = {prototype = {}}
  478. c.prototype.__index = c.prototype
  479. c.prototype.constructor = c
  480. return c
  481. end
  482.  
  483. function __TS__ClassExtends(target, base)
  484. target.____super = base
  485. local staticMetatable = setmetatable({__index = base}, base)
  486. setmetatable(target, staticMetatable)
  487. local baseMetatable = getmetatable(base)
  488. if baseMetatable then
  489. if type(baseMetatable.__index) == "function" then
  490. staticMetatable.__index = baseMetatable.__index
  491. end
  492. if type(baseMetatable.__newindex) == "function" then
  493. staticMetatable.__newindex = baseMetatable.__newindex
  494. end
  495. end
  496. setmetatable(target.prototype, base.prototype)
  497. if type(base.prototype.__index) == "function" then
  498. target.prototype.__index = base.prototype.__index
  499. end
  500. if type(base.prototype.__newindex) == "function" then
  501. target.prototype.__newindex = base.prototype.__newindex
  502. end
  503. end
  504.  
  505. function __TS__Decorate(decorators, target, key, desc)
  506. local result = target
  507. do
  508. local i = #decorators
  509. while i >= 0 do
  510. local decorator = decorators[i + 1]
  511. if decorator then
  512. local oldResult = result
  513. if key == nil then
  514. result = decorator(_G, result)
  515. elseif desc ~= nil then
  516. result = decorator(_G, target, key, result)
  517. else
  518. result = decorator(_G, target, key)
  519. end
  520. result = result or oldResult
  521. end
  522. i = i - 1
  523. end
  524. end
  525. return result
  526. end
  527.  
  528. function ____descriptorIndex(self, key)
  529. local value = rawget(self, key)
  530. if value ~= nil then
  531. return value
  532. end
  533. local metatable = getmetatable(self)
  534. while metatable do
  535. local rawResult = rawget(metatable, key)
  536. if rawResult ~= nil then
  537. return rawResult
  538. end
  539. local descriptors = rawget(metatable, "_descriptors")
  540. if descriptors then
  541. local descriptor = descriptors[key]
  542. if descriptor then
  543. if descriptor.get then
  544. return __TS__FunctionCall(descriptor.get, self)
  545. end
  546. return
  547. end
  548. end
  549. metatable = getmetatable(metatable)
  550. end
  551. end
  552. function ____descriptorNewindex(self, key, value)
  553. local metatable = getmetatable(self)
  554. while metatable do
  555. local descriptors = rawget(metatable, "_descriptors")
  556. if descriptors then
  557. local descriptor = descriptors[key]
  558. if descriptor then
  559. if descriptor.set then
  560. __TS__FunctionCall(descriptor.set, self, value)
  561. end
  562. return
  563. end
  564. end
  565. metatable = getmetatable(metatable)
  566. end
  567. rawset(self, key, value)
  568. end
  569. function __TS__SetDescriptor(metatable, prop, descriptor)
  570. if not metatable._descriptors then
  571. metatable._descriptors = {}
  572. end
  573. metatable._descriptors[prop] = descriptor
  574. if descriptor.get then
  575. metatable.__index = ____descriptorIndex
  576. end
  577. if descriptor.set then
  578. metatable.__newindex = ____descriptorNewindex
  579. end
  580. end
  581. function __TS__ObjectDefineProperty(object, prop, descriptor)
  582. local metatable = getmetatable(object)
  583. if not metatable then
  584. metatable = {}
  585. setmetatable(object, metatable)
  586. end
  587. __TS__SetDescriptor(metatable, prop, descriptor)
  588. return object
  589. end
  590.  
  591. function __TS__New(target, ...)
  592. local instance = setmetatable({}, target.prototype)
  593. instance:____constructor(...)
  594. return instance
  595. end
  596.  
  597. function __TS__FunctionCall(fn, thisArg, ...)
  598. local args = {...}
  599. return fn(
  600. thisArg,
  601. (unpack or table.unpack)(args)
  602. )
  603. end
  604.  
  605. function __TS__GetErrorStack(self, constructor)
  606. local level = 1
  607. while true do
  608. local info = debug.getinfo(level, "f")
  609. level = level + 1
  610. if not info then
  611. level = 1
  612. break
  613. elseif info.func == constructor then
  614. break
  615. end
  616. end
  617. return debug.traceback(nil, level)
  618. end
  619. function __TS__WrapErrorToString(self, getDescription)
  620. return function(self)
  621. local description = __TS__FunctionCall(getDescription, self)
  622. local caller = debug.getinfo(3, "f")
  623. if (_VERSION == "Lua 5.1") or (caller and (caller.func ~= error)) then
  624. return description
  625. else
  626. return (tostring(description) .. "\n") .. tostring(self.stack)
  627. end
  628. end
  629. end
  630. function __TS__InitErrorClass(self, Type, name)
  631. Type.name = name
  632. return setmetatable(
  633. Type,
  634. {
  635. __call = function(____, _self, message) return __TS__New(Type, message) end
  636. }
  637. )
  638. end
  639. Error = __TS__InitErrorClass(
  640. _G,
  641. (function()
  642. local ____ = __TS__Class()
  643. ____.name = "____"
  644. function ____.prototype.____constructor(self, message)
  645. if message == nil then
  646. message = ""
  647. end
  648. self.message = message
  649. self.name = "Error"
  650. self.stack = __TS__GetErrorStack(_G, self.constructor.new)
  651. local metatable = getmetatable(self)
  652. if not metatable.__errorToStringPatched then
  653. metatable.__errorToStringPatched = true
  654. metatable.__tostring = __TS__WrapErrorToString(_G, metatable.__tostring)
  655. end
  656. end
  657. function ____.prototype.__tostring(self)
  658. return (((self.message ~= "") and (function() return (tostring(self.name) .. ": ") .. tostring(self.message) end)) or (function() return self.name end))()
  659. end
  660. return ____
  661. end)(),
  662. "Error"
  663. )
  664. for ____, errorName in ipairs({"RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError"}) do
  665. _G[errorName] = __TS__InitErrorClass(
  666. _G,
  667. (function()
  668. local ____ = __TS__Class()
  669. ____.name = "____"
  670. __TS__ClassExtends(____, Error)
  671. function ____.prototype.____constructor(self, ...)
  672. Error.prototype.____constructor(self, ...)
  673. self.name = errorName
  674. end
  675. return ____
  676. end)(),
  677. errorName
  678. )
  679. end
  680.  
  681. function __TS__FunctionApply(fn, thisArg, args)
  682. if args then
  683. return fn(
  684. thisArg,
  685. (unpack or table.unpack)(args)
  686. )
  687. else
  688. return fn(thisArg)
  689. end
  690. end
  691.  
  692. function __TS__FunctionBind(fn, thisArg, ...)
  693. local boundArgs = {...}
  694. return function(____, ...)
  695. local args = {...}
  696. do
  697. local i = 0
  698. while i < #boundArgs do
  699. table.insert(args, i + 1, boundArgs[i + 1])
  700. i = i + 1
  701. end
  702. end
  703. return fn(
  704. thisArg,
  705. (unpack or table.unpack)(args)
  706. )
  707. end
  708. end
  709.  
  710. ____symbolMetatable = {
  711. __tostring = function(self)
  712. if self.description == nil then
  713. return "Symbol()"
  714. else
  715. return ("Symbol(" .. tostring(self.description)) .. ")"
  716. end
  717. end
  718. }
  719. function __TS__Symbol(description)
  720. return setmetatable({description = description}, ____symbolMetatable)
  721. end
  722. Symbol = {
  723. iterator = __TS__Symbol("Symbol.iterator"),
  724. hasInstance = __TS__Symbol("Symbol.hasInstance"),
  725. species = __TS__Symbol("Symbol.species"),
  726. toStringTag = __TS__Symbol("Symbol.toStringTag")
  727. }
  728.  
  729. function __TS__InstanceOf(obj, classTbl)
  730. if type(classTbl) ~= "table" then
  731. error("Right-hand side of 'instanceof' is not an object", 0)
  732. end
  733. if classTbl[Symbol.hasInstance] ~= nil then
  734. return not (not classTbl[Symbol.hasInstance](classTbl, obj))
  735. end
  736. if type(obj) == "table" then
  737. local luaClass = obj.constructor
  738. while luaClass ~= nil do
  739. if luaClass == classTbl then
  740. return true
  741. end
  742. luaClass = luaClass.____super
  743. end
  744. end
  745. return false
  746. end
  747.  
  748. function __TS__InstanceOfObject(value)
  749. local valueType = type(value)
  750. return (valueType == "table") or (valueType == "function")
  751. end
  752.  
  753. function __TS__Iterator(iterable)
  754. if iterable[Symbol.iterator] then
  755. local iterator = iterable[Symbol.iterator](iterable)
  756. return function()
  757. local result = iterator:next()
  758. if not result.done then
  759. return result.value
  760. else
  761. return nil
  762. end
  763. end
  764. else
  765. local i = 0
  766. return function()
  767. i = i + 1
  768. return iterable[i]
  769. end
  770. end
  771. end
  772.  
  773. Map = (function()
  774. local Map = __TS__Class()
  775. Map.name = "Map"
  776. function Map.prototype.____constructor(self, entries)
  777. self[Symbol.toStringTag] = "Map"
  778. self.items = {}
  779. self.size = 0
  780. self.nextKey = {}
  781. self.previousKey = {}
  782. if entries == nil then
  783. return
  784. end
  785. local iterable = entries
  786. if iterable[Symbol.iterator] then
  787. local iterator = iterable[Symbol.iterator](iterable)
  788. while true do
  789. local result = iterator:next()
  790. if result.done then
  791. break
  792. end
  793. local value = result.value
  794. self:set(value[1], value[2])
  795. end
  796. else
  797. local array = entries
  798. for ____, kvp in ipairs(array) do
  799. self:set(kvp[1], kvp[2])
  800. end
  801. end
  802. end
  803. function Map.prototype.clear(self)
  804. self.items = {}
  805. self.nextKey = {}
  806. self.previousKey = {}
  807. self.firstKey = nil
  808. self.lastKey = nil
  809. self.size = 0
  810. return
  811. end
  812. function Map.prototype.delete(self, key)
  813. local contains = self:has(key)
  814. if contains then
  815. self.size = self.size - 1
  816. local next = self.nextKey[key]
  817. local previous = self.previousKey[key]
  818. if next and previous then
  819. self.nextKey[previous] = next
  820. self.previousKey[next] = previous
  821. elseif next then
  822. self.firstKey = next
  823. self.previousKey[next] = nil
  824. elseif previous then
  825. self.lastKey = previous
  826. self.nextKey[previous] = nil
  827. else
  828. self.firstKey = nil
  829. self.lastKey = nil
  830. end
  831. self.nextKey[key] = nil
  832. self.previousKey[key] = nil
  833. end
  834. self.items[key] = nil
  835. return contains
  836. end
  837. function Map.prototype.forEach(self, callback)
  838. for key in __TS__Iterator(
  839. self:keys()
  840. ) do
  841. callback(_G, self.items[key], key, self)
  842. end
  843. return
  844. end
  845. function Map.prototype.get(self, key)
  846. return self.items[key]
  847. end
  848. function Map.prototype.has(self, key)
  849. return (self.nextKey[key] ~= nil) or (self.lastKey == key)
  850. end
  851. function Map.prototype.set(self, key, value)
  852. local isNewValue = not self:has(key)
  853. if isNewValue then
  854. self.size = self.size + 1
  855. end
  856. self.items[key] = value
  857. if self.firstKey == nil then
  858. self.firstKey = key
  859. self.lastKey = key
  860. elseif isNewValue then
  861. self.nextKey[self.lastKey] = key
  862. self.previousKey[key] = self.lastKey
  863. self.lastKey = key
  864. end
  865. return self
  866. end
  867. Map.prototype[Symbol.iterator] = function(self)
  868. return self:entries()
  869. end
  870. function Map.prototype.entries(self)
  871. local items = self.items
  872. local nextKey = self.nextKey
  873. local key = self.firstKey
  874. return {
  875. [Symbol.iterator] = function(self)
  876. return self
  877. end,
  878. next = function(self)
  879. local result = {done = not key, value = {key, items[key]}}
  880. key = nextKey[key]
  881. return result
  882. end
  883. }
  884. end
  885. function Map.prototype.keys(self)
  886. local nextKey = self.nextKey
  887. local key = self.firstKey
  888. return {
  889. [Symbol.iterator] = function(self)
  890. return self
  891. end,
  892. next = function(self)
  893. local result = {done = not key, value = key}
  894. key = nextKey[key]
  895. return result
  896. end
  897. }
  898. end
  899. function Map.prototype.values(self)
  900. local items = self.items
  901. local nextKey = self.nextKey
  902. local key = self.firstKey
  903. return {
  904. [Symbol.iterator] = function(self)
  905. return self
  906. end,
  907. next = function(self)
  908. local result = {done = not key, value = items[key]}
  909. key = nextKey[key]
  910. return result
  911. end
  912. }
  913. end
  914. Map[Symbol.species] = Map
  915. return Map
  916. end)()
  917.  
  918. function __TS__Number(value)
  919. local valueType = type(value)
  920. if valueType == "number" then
  921. return value
  922. elseif valueType == "string" then
  923. local numberValue = tonumber(value)
  924. if numberValue then
  925. return numberValue
  926. end
  927. if value == "Infinity" then
  928. return math.huge
  929. end
  930. if value == "-Infinity" then
  931. return -math.huge
  932. end
  933. local stringWithoutSpaces = string.gsub(value, "%s", "")
  934. if stringWithoutSpaces == "" then
  935. return 0
  936. end
  937. return 0 / 0
  938. elseif valueType == "boolean" then
  939. return (value and 1) or 0
  940. else
  941. return 0 / 0
  942. end
  943. end
  944.  
  945. function __TS__NumberIsFinite(value)
  946. return (((type(value) == "number") and (value == value)) and (value ~= math.huge)) and (value ~= -math.huge)
  947. end
  948.  
  949. function __TS__NumberIsNaN(value)
  950. return value ~= value
  951. end
  952.  
  953. ____radixChars = "0123456789abcdefghijklmnopqrstuvwxyz"
  954. function __TS__NumberToString(self, radix)
  955. if ((((radix == nil) or (radix == 10)) or (self == math.huge)) or (self == -math.huge)) or (self ~= self) then
  956. return tostring(self)
  957. end
  958. radix = math.floor(radix)
  959. if (radix < 2) or (radix > 36) then
  960. error("toString() radix argument must be between 2 and 36", 0)
  961. end
  962. local integer, fraction = math.modf(
  963. math.abs(self)
  964. )
  965. local result = ""
  966. if radix == 8 then
  967. result = string.format("%o", integer)
  968. elseif radix == 16 then
  969. result = string.format("%x", integer)
  970. else
  971. repeat
  972. do
  973. result = tostring(
  974. string.sub(____radixChars, (integer % radix) + 1, (integer % radix) + 1)
  975. ) .. tostring(result)
  976. integer = math.floor(integer / radix)
  977. end
  978. until not (integer ~= 0)
  979. end
  980. if fraction ~= 0 then
  981. result = tostring(result) .. "."
  982. local delta = 1e-16
  983. repeat
  984. do
  985. fraction = fraction * radix
  986. delta = delta * radix
  987. local digit = math.floor(fraction)
  988. result = tostring(result) .. tostring(
  989. string.sub(____radixChars, digit + 1, digit + 1)
  990. )
  991. fraction = fraction - digit
  992. end
  993. until not (fraction >= delta)
  994. end
  995. if self < 0 then
  996. result = "-" .. tostring(result)
  997. end
  998. return result
  999. end
  1000.  
  1001. function __TS__ObjectAssign(to, ...)
  1002. local sources = {...}
  1003. if to == nil then
  1004. return to
  1005. end
  1006. for ____, source in ipairs(sources) do
  1007. for key in pairs(source) do
  1008. to[key] = source[key]
  1009. end
  1010. end
  1011. return to
  1012. end
  1013.  
  1014. function __TS__ObjectEntries(obj)
  1015. local result = {}
  1016. for key in pairs(obj) do
  1017. result[#result + 1] = {key, obj[key]}
  1018. end
  1019. return result
  1020. end
  1021.  
  1022. function __TS__ObjectFromEntries(entries)
  1023. local obj = {}
  1024. local iterable = entries
  1025. if iterable[Symbol.iterator] then
  1026. local iterator = iterable[Symbol.iterator](iterable)
  1027. while true do
  1028. local result = iterator:next()
  1029. if result.done then
  1030. break
  1031. end
  1032. local value = result.value
  1033. obj[value[1]] = value[2]
  1034. end
  1035. else
  1036. for ____, entry in ipairs(entries) do
  1037. obj[entry[1]] = entry[2]
  1038. end
  1039. end
  1040. return obj
  1041. end
  1042.  
  1043. function __TS__ObjectKeys(obj)
  1044. local result = {}
  1045. for key in pairs(obj) do
  1046. result[#result + 1] = key
  1047. end
  1048. return result
  1049. end
  1050.  
  1051. function __TS__ObjectRest(target, usedProperties)
  1052. local result = {}
  1053. for property in pairs(target) do
  1054. if not usedProperties[property] then
  1055. result[property] = target[property]
  1056. end
  1057. end
  1058. return result
  1059. end
  1060.  
  1061. function __TS__ObjectValues(obj)
  1062. local result = {}
  1063. for key in pairs(obj) do
  1064. result[#result + 1] = obj[key]
  1065. end
  1066. return result
  1067. end
  1068.  
  1069. Set = (function()
  1070. local Set = __TS__Class()
  1071. Set.name = "Set"
  1072. function Set.prototype.____constructor(self, values)
  1073. self[Symbol.toStringTag] = "Set"
  1074. self.size = 0
  1075. self.nextKey = {}
  1076. self.previousKey = {}
  1077. if values == nil then
  1078. return
  1079. end
  1080. local iterable = values
  1081. if iterable[Symbol.iterator] then
  1082. local iterator = iterable[Symbol.iterator](iterable)
  1083. while true do
  1084. local result = iterator:next()
  1085. if result.done then
  1086. break
  1087. end
  1088. self:add(result.value)
  1089. end
  1090. else
  1091. local array = values
  1092. for ____, value in ipairs(array) do
  1093. self:add(value)
  1094. end
  1095. end
  1096. end
  1097. function Set.prototype.add(self, value)
  1098. local isNewValue = not self:has(value)
  1099. if isNewValue then
  1100. self.size = self.size + 1
  1101. end
  1102. if self.firstKey == nil then
  1103. self.firstKey = value
  1104. self.lastKey = value
  1105. elseif isNewValue then
  1106. self.nextKey[self.lastKey] = value
  1107. self.previousKey[value] = self.lastKey
  1108. self.lastKey = value
  1109. end
  1110. return self
  1111. end
  1112. function Set.prototype.clear(self)
  1113. self.nextKey = {}
  1114. self.previousKey = {}
  1115. self.firstKey = nil
  1116. self.lastKey = nil
  1117. self.size = 0
  1118. return
  1119. end
  1120. function Set.prototype.delete(self, value)
  1121. local contains = self:has(value)
  1122. if contains then
  1123. self.size = self.size - 1
  1124. local next = self.nextKey[value]
  1125. local previous = self.previousKey[value]
  1126. if next and previous then
  1127. self.nextKey[previous] = next
  1128. self.previousKey[next] = previous
  1129. elseif next then
  1130. self.firstKey = next
  1131. self.previousKey[next] = nil
  1132. elseif previous then
  1133. self.lastKey = previous
  1134. self.nextKey[previous] = nil
  1135. else
  1136. self.firstKey = nil
  1137. self.lastKey = nil
  1138. end
  1139. self.nextKey[value] = nil
  1140. self.previousKey[value] = nil
  1141. end
  1142. return contains
  1143. end
  1144. function Set.prototype.forEach(self, callback)
  1145. for key in __TS__Iterator(
  1146. self:keys()
  1147. ) do
  1148. callback(_G, key, key, self)
  1149. end
  1150. end
  1151. function Set.prototype.has(self, value)
  1152. return (self.nextKey[value] ~= nil) or (self.lastKey == value)
  1153. end
  1154. Set.prototype[Symbol.iterator] = function(self)
  1155. return self:values()
  1156. end
  1157. function Set.prototype.entries(self)
  1158. local nextKey = self.nextKey
  1159. local key = self.firstKey
  1160. return {
  1161. [Symbol.iterator] = function(self)
  1162. return self
  1163. end,
  1164. next = function(self)
  1165. local result = {done = not key, value = {key, key}}
  1166. key = nextKey[key]
  1167. return result
  1168. end
  1169. }
  1170. end
  1171. function Set.prototype.keys(self)
  1172. local nextKey = self.nextKey
  1173. local key = self.firstKey
  1174. return {
  1175. [Symbol.iterator] = function(self)
  1176. return self
  1177. end,
  1178. next = function(self)
  1179. local result = {done = not key, value = key}
  1180. key = nextKey[key]
  1181. return result
  1182. end
  1183. }
  1184. end
  1185. function Set.prototype.values(self)
  1186. local nextKey = self.nextKey
  1187. local key = self.firstKey
  1188. return {
  1189. [Symbol.iterator] = function(self)
  1190. return self
  1191. end,
  1192. next = function(self)
  1193. local result = {done = not key, value = key}
  1194. key = nextKey[key]
  1195. return result
  1196. end
  1197. }
  1198. end
  1199. Set[Symbol.species] = Set
  1200. return Set
  1201. end)()
  1202.  
  1203. WeakMap = (function()
  1204. local WeakMap = __TS__Class()
  1205. WeakMap.name = "WeakMap"
  1206. function WeakMap.prototype.____constructor(self, entries)
  1207. self[Symbol.toStringTag] = "WeakMap"
  1208. self.items = {}
  1209. setmetatable(self.items, {__mode = "k"})
  1210. if entries == nil then
  1211. return
  1212. end
  1213. local iterable = entries
  1214. if iterable[Symbol.iterator] then
  1215. local iterator = iterable[Symbol.iterator](iterable)
  1216. while true do
  1217. local result = iterator:next()
  1218. if result.done then
  1219. break
  1220. end
  1221. local value = result.value
  1222. self.items[value[1]] = value[2]
  1223. end
  1224. else
  1225. for ____, kvp in ipairs(entries) do
  1226. self.items[kvp[1]] = kvp[2]
  1227. end
  1228. end
  1229. end
  1230. function WeakMap.prototype.delete(self, key)
  1231. local contains = self:has(key)
  1232. self.items[key] = nil
  1233. return contains
  1234. end
  1235. function WeakMap.prototype.get(self, key)
  1236. return self.items[key]
  1237. end
  1238. function WeakMap.prototype.has(self, key)
  1239. return self.items[key] ~= nil
  1240. end
  1241. function WeakMap.prototype.set(self, key, value)
  1242. self.items[key] = value
  1243. return self
  1244. end
  1245. WeakMap[Symbol.species] = WeakMap
  1246. return WeakMap
  1247. end)()
  1248.  
  1249. WeakSet = (function()
  1250. local WeakSet = __TS__Class()
  1251. WeakSet.name = "WeakSet"
  1252. function WeakSet.prototype.____constructor(self, values)
  1253. self[Symbol.toStringTag] = "WeakSet"
  1254. self.items = {}
  1255. setmetatable(self.items, {__mode = "k"})
  1256. if values == nil then
  1257. return
  1258. end
  1259. local iterable = values
  1260. if iterable[Symbol.iterator] then
  1261. local iterator = iterable[Symbol.iterator](iterable)
  1262. while true do
  1263. local result = iterator:next()
  1264. if result.done then
  1265. break
  1266. end
  1267. self.items[result.value] = true
  1268. end
  1269. else
  1270. for ____, value in ipairs(values) do
  1271. self.items[value] = true
  1272. end
  1273. end
  1274. end
  1275. function WeakSet.prototype.add(self, value)
  1276. self.items[value] = true
  1277. return self
  1278. end
  1279. function WeakSet.prototype.delete(self, value)
  1280. local contains = self:has(value)
  1281. self.items[value] = nil
  1282. return contains
  1283. end
  1284. function WeakSet.prototype.has(self, value)
  1285. return self.items[value] == true
  1286. end
  1287. WeakSet[Symbol.species] = WeakSet
  1288. return WeakSet
  1289. end)()
  1290.  
  1291. function __TS__SourceMapTraceBack(fileName, sourceMap)
  1292. _G.__TS__sourcemap = _G.__TS__sourcemap or ({})
  1293. _G.__TS__sourcemap[fileName] = sourceMap
  1294. if _G.__TS__originalTraceback == nil then
  1295. _G.__TS__originalTraceback = debug.traceback
  1296. debug.traceback = function(thread, message, level)
  1297. local trace
  1298. if ((thread == nil) and (message == nil)) and (level == nil) then
  1299. trace = _G.__TS__originalTraceback()
  1300. else
  1301. trace = _G.__TS__originalTraceback(thread, message, level)
  1302. end
  1303. if type(trace) ~= "string" then
  1304. return trace
  1305. end
  1306. local result = string.gsub(
  1307. trace,
  1308. "(%S+).lua:(%d+)",
  1309. function(file, line)
  1310. local fileSourceMap = _G.__TS__sourcemap[tostring(file) .. ".lua"]
  1311. if fileSourceMap and fileSourceMap[line] then
  1312. return (tostring(file) .. ".ts:") .. tostring(fileSourceMap[line])
  1313. end
  1314. return (tostring(file) .. ".lua:") .. tostring(line)
  1315. end
  1316. )
  1317. return result
  1318. end
  1319. end
  1320. end
  1321.  
  1322. function __TS__Spread(iterable)
  1323. local arr = {}
  1324. if type(iterable) == "string" then
  1325. do
  1326. local i = 0
  1327. while i < #iterable do
  1328. arr[#arr + 1] = string.sub(iterable, i + 1, i + 1)
  1329. i = i + 1
  1330. end
  1331. end
  1332. else
  1333. for item in __TS__Iterator(iterable) do
  1334. arr[#arr + 1] = item
  1335. end
  1336. end
  1337. return (table.unpack or unpack)(arr)
  1338. end
  1339.  
  1340. function __TS__StringConcat(str1, ...)
  1341. local args = {...}
  1342. local out = str1
  1343. for ____, arg in ipairs(args) do
  1344. out = tostring(out) .. tostring(arg)
  1345. end
  1346. return out
  1347. end
  1348.  
  1349. function __TS__StringEndsWith(self, searchString, endPosition)
  1350. if (endPosition == nil) or (endPosition > #self) then
  1351. endPosition = #self
  1352. end
  1353. return string.sub(self, (endPosition - #searchString) + 1, endPosition) == searchString
  1354. end
  1355.  
  1356. function __TS__StringPadEnd(self, maxLength, fillString)
  1357. if fillString == nil then
  1358. fillString = " "
  1359. end
  1360. if maxLength ~= maxLength then
  1361. maxLength = 0
  1362. end
  1363. if (maxLength == -math.huge) or (maxLength == math.huge) then
  1364. error("Invalid string length", 0)
  1365. end
  1366. if (#self >= maxLength) or (#fillString == 0) then
  1367. return self
  1368. end
  1369. maxLength = maxLength - #self
  1370. if maxLength > #fillString then
  1371. fillString = tostring(fillString) .. tostring(
  1372. string.rep(
  1373. fillString,
  1374. math.floor(maxLength / #fillString)
  1375. )
  1376. )
  1377. end
  1378. return tostring(self) .. tostring(
  1379. string.sub(
  1380. fillString,
  1381. 1,
  1382. math.floor(maxLength)
  1383. )
  1384. )
  1385. end
  1386.  
  1387. function __TS__StringPadStart(self, maxLength, fillString)
  1388. if fillString == nil then
  1389. fillString = " "
  1390. end
  1391. if maxLength ~= maxLength then
  1392. maxLength = 0
  1393. end
  1394. if (maxLength == -math.huge) or (maxLength == math.huge) then
  1395. error("Invalid string length", 0)
  1396. end
  1397. if (#self >= maxLength) or (#fillString == 0) then
  1398. return self
  1399. end
  1400. maxLength = maxLength - #self
  1401. if maxLength > #fillString then
  1402. fillString = tostring(fillString) .. tostring(
  1403. string.rep(
  1404. fillString,
  1405. math.floor(maxLength / #fillString)
  1406. )
  1407. )
  1408. end
  1409. return tostring(
  1410. string.sub(
  1411. fillString,
  1412. 1,
  1413. math.floor(maxLength)
  1414. )
  1415. ) .. tostring(self)
  1416. end
  1417.  
  1418. function __TS__StringReplace(source, searchValue, replaceValue)
  1419. searchValue = string.gsub(searchValue, "[%%%(%)%.%+%-%*%?%[%^%$]", "%%%1")
  1420. if type(replaceValue) == "string" then
  1421. replaceValue = string.gsub(replaceValue, "[%%%(%)%.%+%-%*%?%[%^%$]", "%%%1")
  1422. local result = string.gsub(source, searchValue, replaceValue, 1)
  1423. return result
  1424. else
  1425. local result = string.gsub(
  1426. source,
  1427. searchValue,
  1428. function(match) return replaceValue(_G, match) end,
  1429. 1
  1430. )
  1431. return result
  1432. end
  1433. end
  1434.  
  1435. function __TS__StringSplit(source, separator, limit)
  1436. if limit == nil then
  1437. limit = 4294967295
  1438. end
  1439. if limit == 0 then
  1440. return {}
  1441. end
  1442. local out = {}
  1443. local index = 0
  1444. local count = 0
  1445. if (separator == nil) or (separator == "") then
  1446. while (index < (#source - 1)) and (count < limit) do
  1447. out[count + 1] = string.sub(source, index + 1, index + 1)
  1448. count = count + 1
  1449. index = index + 1
  1450. end
  1451. else
  1452. local separatorLength = #separator
  1453. local nextIndex = (string.find(source, separator, nil, true) or 0) - 1
  1454. while (nextIndex >= 0) and (count < limit) do
  1455. out[count + 1] = string.sub(source, index + 1, nextIndex)
  1456. count = count + 1
  1457. index = nextIndex + separatorLength
  1458. nextIndex = (string.find(source, separator, index + 1, true) or 0) - 1
  1459. end
  1460. end
  1461. if count < limit then
  1462. out[count + 1] = string.sub(source, index + 1)
  1463. end
  1464. return out
  1465. end
  1466.  
  1467. function __TS__StringStartsWith(self, searchString, position)
  1468. if (position == nil) or (position < 0) then
  1469. position = 0
  1470. end
  1471. return string.sub(self, position + 1, #searchString + position) == searchString
  1472. end
  1473.  
  1474. function __TS__StringTrim(self)
  1475. local result = string.gsub(self, "^[%s ]*(.-)[%s ]*$", "%1")
  1476. return result
  1477. end
  1478.  
  1479. function __TS__StringTrimEnd(self)
  1480. local result = string.gsub(self, "[%s ]*$", "")
  1481. return result
  1482. end
  1483.  
  1484. function __TS__StringTrimStart(self)
  1485. local result = string.gsub(self, "^[%s ]*", "")
  1486. return result
  1487. end
  1488.  
  1489. ____symbolRegistry = {}
  1490. function __TS__SymbolRegistryFor(key)
  1491. if not ____symbolRegistry[key] then
  1492. ____symbolRegistry[key] = __TS__Symbol(key)
  1493. end
  1494. return ____symbolRegistry[key]
  1495. end
  1496. function __TS__SymbolRegistryKeyFor(sym)
  1497. for key in pairs(____symbolRegistry) do
  1498. if ____symbolRegistry[key] == sym then
  1499. return key
  1500. end
  1501. end
  1502. end
  1503.  
  1504. function __TS__TypeOf(value)
  1505. local luaType = type(value)
  1506. if luaType == "table" then
  1507. return "object"
  1508. elseif luaType == "nil" then
  1509. return "undefined"
  1510. else
  1511. return luaType
  1512. end
  1513. end
  1514.  
  1515. end,
  1516. }
  1517. return require("main")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement