Advertisement
AMONUWNA

Untitled

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