timetable2lua

导出轨道交通时刻表数据为Lua对象

目前为 2024-04-19 提交的版本。查看 最新版本

// ==UserScript==
// @name         timetable2lua
// @namespace    https://dvxg.de/
// @version      0.1.1
// @description  导出轨道交通时刻表数据为Lua对象
// @author       davidxuang
// @match        https://www.cqmetro.cn/smbsj.html
// @homepageURL  https://github.com/davidxuang/timetable2lua
// @icon         https://cdn.jsdelivr.net/npm/@fluentui/[email protected]/icons/vehicle_subway_clock_20_regular.svg
// @license      AGPL-3.0
// @grant        GM_setClipboard
// ==/UserScript==
(() => {
  var __webpack_modules__ = {
    447: module => {
      var clone = function() {
        "use strict";
        function clone(parent, circular, depth, prototype) {
          "object" == typeof circular && (depth = circular.depth, prototype = circular.prototype, 
          circular.filter, circular = circular.circular);
          var allParents = [], allChildren = [], useBuffer = "undefined" != typeof Buffer;
          return void 0 === circular && (circular = !0), void 0 === depth && (depth = 1 / 0), 
          function _clone(parent, depth) {
            if (null === parent) return null;
            if (0 == depth) return parent;
            var child, proto;
            if ("object" != typeof parent) return parent;
            if (clone.__isArray(parent)) child = []; else if (clone.__isRegExp(parent)) child = new RegExp(parent.source, __getRegExpFlags(parent)), 
            parent.lastIndex && (child.lastIndex = parent.lastIndex); else if (clone.__isDate(parent)) child = new Date(parent.getTime()); else {
              if (useBuffer && Buffer.isBuffer(parent)) return child = Buffer.allocUnsafe ? Buffer.allocUnsafe(parent.length) : new Buffer(parent.length), 
              parent.copy(child), child;
              void 0 === prototype ? (proto = Object.getPrototypeOf(parent), child = Object.create(proto)) : (child = Object.create(prototype), 
              proto = prototype);
            }
            if (circular) {
              var index = allParents.indexOf(parent);
              if (-1 != index) return allChildren[index];
              allParents.push(parent), allChildren.push(child);
            }
            for (var i in parent) {
              var attrs;
              proto && (attrs = Object.getOwnPropertyDescriptor(proto, i)), attrs && null == attrs.set || (child[i] = _clone(parent[i], depth - 1));
            }
            return child;
          }(parent, depth);
        }
        function __objToStr(o) {
          return Object.prototype.toString.call(o);
        }
        function __getRegExpFlags(re) {
          var flags = "";
          return re.global && (flags += "g"), re.ignoreCase && (flags += "i"), re.multiline && (flags += "m"), 
          flags;
        }
        return clone.clonePrototype = function(parent) {
          if (null === parent) return null;
          var c = function() {};
          return c.prototype = parent, new c;
        }, clone.__objToStr = __objToStr, clone.__isDate = function(o) {
          return "object" == typeof o && "[object Date]" === __objToStr(o);
        }, clone.__isArray = function(o) {
          return "object" == typeof o && "[object Array]" === __objToStr(o);
        }, clone.__isRegExp = function(o) {
          return "object" == typeof o && "[object RegExp]" === __objToStr(o);
        }, clone.__getRegExpFlags = __getRegExpFlags, clone;
      }();
      module.exports && (module.exports = clone);
    },
    106: (module, __unused_webpack_exports, __webpack_require__) => {
      var clone = __webpack_require__(447);
      module.exports = function(options, defaults) {
        return options = options || {}, Object.keys(defaults).forEach((function(key) {
          void 0 === options[key] && (options[key] = clone(defaults[key]));
        })), options;
      };
    },
    867: module => {
      module.exports = [ [ 768, 879 ], [ 1155, 1158 ], [ 1160, 1161 ], [ 1425, 1469 ], [ 1471, 1471 ], [ 1473, 1474 ], [ 1476, 1477 ], [ 1479, 1479 ], [ 1536, 1539 ], [ 1552, 1557 ], [ 1611, 1630 ], [ 1648, 1648 ], [ 1750, 1764 ], [ 1767, 1768 ], [ 1770, 1773 ], [ 1807, 1807 ], [ 1809, 1809 ], [ 1840, 1866 ], [ 1958, 1968 ], [ 2027, 2035 ], [ 2305, 2306 ], [ 2364, 2364 ], [ 2369, 2376 ], [ 2381, 2381 ], [ 2385, 2388 ], [ 2402, 2403 ], [ 2433, 2433 ], [ 2492, 2492 ], [ 2497, 2500 ], [ 2509, 2509 ], [ 2530, 2531 ], [ 2561, 2562 ], [ 2620, 2620 ], [ 2625, 2626 ], [ 2631, 2632 ], [ 2635, 2637 ], [ 2672, 2673 ], [ 2689, 2690 ], [ 2748, 2748 ], [ 2753, 2757 ], [ 2759, 2760 ], [ 2765, 2765 ], [ 2786, 2787 ], [ 2817, 2817 ], [ 2876, 2876 ], [ 2879, 2879 ], [ 2881, 2883 ], [ 2893, 2893 ], [ 2902, 2902 ], [ 2946, 2946 ], [ 3008, 3008 ], [ 3021, 3021 ], [ 3134, 3136 ], [ 3142, 3144 ], [ 3146, 3149 ], [ 3157, 3158 ], [ 3260, 3260 ], [ 3263, 3263 ], [ 3270, 3270 ], [ 3276, 3277 ], [ 3298, 3299 ], [ 3393, 3395 ], [ 3405, 3405 ], [ 3530, 3530 ], [ 3538, 3540 ], [ 3542, 3542 ], [ 3633, 3633 ], [ 3636, 3642 ], [ 3655, 3662 ], [ 3761, 3761 ], [ 3764, 3769 ], [ 3771, 3772 ], [ 3784, 3789 ], [ 3864, 3865 ], [ 3893, 3893 ], [ 3895, 3895 ], [ 3897, 3897 ], [ 3953, 3966 ], [ 3968, 3972 ], [ 3974, 3975 ], [ 3984, 3991 ], [ 3993, 4028 ], [ 4038, 4038 ], [ 4141, 4144 ], [ 4146, 4146 ], [ 4150, 4151 ], [ 4153, 4153 ], [ 4184, 4185 ], [ 4448, 4607 ], [ 4959, 4959 ], [ 5906, 5908 ], [ 5938, 5940 ], [ 5970, 5971 ], [ 6002, 6003 ], [ 6068, 6069 ], [ 6071, 6077 ], [ 6086, 6086 ], [ 6089, 6099 ], [ 6109, 6109 ], [ 6155, 6157 ], [ 6313, 6313 ], [ 6432, 6434 ], [ 6439, 6440 ], [ 6450, 6450 ], [ 6457, 6459 ], [ 6679, 6680 ], [ 6912, 6915 ], [ 6964, 6964 ], [ 6966, 6970 ], [ 6972, 6972 ], [ 6978, 6978 ], [ 7019, 7027 ], [ 7616, 7626 ], [ 7678, 7679 ], [ 8203, 8207 ], [ 8234, 8238 ], [ 8288, 8291 ], [ 8298, 8303 ], [ 8400, 8431 ], [ 12330, 12335 ], [ 12441, 12442 ], [ 43014, 43014 ], [ 43019, 43019 ], [ 43045, 43046 ], [ 64286, 64286 ], [ 65024, 65039 ], [ 65056, 65059 ], [ 65279, 65279 ], [ 65529, 65531 ], [ 68097, 68099 ], [ 68101, 68102 ], [ 68108, 68111 ], [ 68152, 68154 ], [ 68159, 68159 ], [ 119143, 119145 ], [ 119155, 119170 ], [ 119173, 119179 ], [ 119210, 119213 ], [ 119362, 119364 ], [ 917505, 917505 ], [ 917536, 917631 ], [ 917760, 917999 ] ];
    },
    613: (module, __unused_webpack_exports, __webpack_require__) => {
      "use strict";
      var defaults = __webpack_require__(106), combining = __webpack_require__(867), DEFAULTS = {
        nul: 0,
        control: 0
      };
      function wcswidth(str, opts) {
        if ("string" != typeof str) return wcwidth(str, opts);
        for (var s = 0, i = 0; i < str.length; i++) {
          var n = wcwidth(str.charCodeAt(i), opts);
          if (n < 0) return -1;
          s += n;
        }
        return s;
      }
      function wcwidth(ucs, opts) {
        return 0 === ucs ? opts.nul : ucs < 32 || ucs >= 127 && ucs < 160 ? opts.control : function(ucs) {
          var mid, min = 0, max = combining.length - 1;
          if (ucs < combining[0][0] || ucs > combining[max][1]) return !1;
          for (;max >= min; ) if (mid = Math.floor((min + max) / 2), ucs > combining[mid][1]) min = mid + 1; else {
            if (!(ucs < combining[mid][0])) return !0;
            max = mid - 1;
          }
          return !1;
        }(ucs) ? 0 : 1 + (ucs >= 4352 && (ucs <= 4447 || 9001 == ucs || 9002 == ucs || ucs >= 11904 && ucs <= 42191 && 12351 != ucs || ucs >= 44032 && ucs <= 55203 || ucs >= 63744 && ucs <= 64255 || ucs >= 65040 && ucs <= 65049 || ucs >= 65072 && ucs <= 65135 || ucs >= 65280 && ucs <= 65376 || ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141));
      }
      module.exports = function(str) {
        return wcswidth(str, DEFAULTS);
      }, module.exports.config = function(opts) {
        return opts = defaults(opts || {}, DEFAULTS), function(str) {
          return wcswidth(str, opts);
        };
      };
    }
  }, __webpack_module_cache__ = {};
  function __webpack_require__(moduleId) {
    var cachedModule = __webpack_module_cache__[moduleId];
    if (void 0 !== cachedModule) return cachedModule.exports;
    var module = __webpack_module_cache__[moduleId] = {
      exports: {}
    };
    return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), 
    module.exports;
  }
  __webpack_require__.n = module => {
    var getter = module && module.__esModule ? () => module.default : () => module;
    return __webpack_require__.d(getter, {
      a: getter
    }), getter;
  }, __webpack_require__.d = (exports, definition) => {
    for (var key in definition) __webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
      enumerable: !0,
      get: definition[key]
    });
  }, __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop), 
  (() => {
    "use strict";
    var wcwidth = __webpack_require__(613), wcwidth_default = __webpack_require__.n(wcwidth);
    function _typeof(obj) {
      return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
        return typeof obj;
      } : function(obj) {
        return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
      }, _typeof(obj);
    }
    var fn, module, _pad, clone_1 = (fn = function(module) {
      var clone = function() {
        function clone(parent, circular, depth, prototype) {
          "object" === _typeof(circular) && (depth = circular.depth, prototype = circular.prototype, 
          circular.filter, circular = circular.circular);
          var allParents = [], allChildren = [], useBuffer = "undefined" != typeof Buffer;
          return void 0 === circular && (circular = !0), void 0 === depth && (depth = 1 / 0), 
          function _clone(parent, depth) {
            if (null === parent) return null;
            if (0 == depth) return parent;
            var child, proto;
            if ("object" != _typeof(parent)) return parent;
            if (clone.__isArray(parent)) child = []; else if (clone.__isRegExp(parent)) child = new RegExp(parent.source, __getRegExpFlags(parent)), 
            parent.lastIndex && (child.lastIndex = parent.lastIndex); else if (clone.__isDate(parent)) child = new Date(parent.getTime()); else {
              if (useBuffer && Buffer.isBuffer(parent)) return child = Buffer.allocUnsafe ? Buffer.allocUnsafe(parent.length) : new Buffer(parent.length), 
              parent.copy(child), child;
              void 0 === prototype ? (proto = Object.getPrototypeOf(parent), child = Object.create(proto)) : (child = Object.create(prototype), 
              proto = prototype);
            }
            if (circular) {
              var index = allParents.indexOf(parent);
              if (-1 != index) return allChildren[index];
              allParents.push(parent), allChildren.push(child);
            }
            for (var i in parent) {
              var attrs;
              proto && (attrs = Object.getOwnPropertyDescriptor(proto, i)), attrs && null == attrs.set || (child[i] = _clone(parent[i], depth - 1));
            }
            return child;
          }(parent, depth);
        }
        function __objToStr(o) {
          return Object.prototype.toString.call(o);
        }
        function __getRegExpFlags(re) {
          var flags = "";
          return re.global && (flags += "g"), re.ignoreCase && (flags += "i"), re.multiline && (flags += "m"), 
          flags;
        }
        return clone.clonePrototype = function(parent) {
          if (null === parent) return null;
          var c = function() {};
          return c.prototype = parent, new c;
        }, clone.__objToStr = __objToStr, clone.__isDate = function(o) {
          return "object" === _typeof(o) && "[object Date]" === __objToStr(o);
        }, clone.__isArray = function(o) {
          return "object" === _typeof(o) && "[object Array]" === __objToStr(o);
        }, clone.__isRegExp = function(o) {
          return "object" === _typeof(o) && "[object RegExp]" === __objToStr(o);
        }, clone.__getRegExpFlags = __getRegExpFlags, clone;
      }();
      module.exports && (module.exports = clone);
    }, fn(module = {
      exports: {}
    }, module.exports), module.exports), combining = [ [ 768, 879 ], [ 1155, 1158 ], [ 1160, 1161 ], [ 1425, 1469 ], [ 1471, 1471 ], [ 1473, 1474 ], [ 1476, 1477 ], [ 1479, 1479 ], [ 1536, 1539 ], [ 1552, 1557 ], [ 1611, 1630 ], [ 1648, 1648 ], [ 1750, 1764 ], [ 1767, 1768 ], [ 1770, 1773 ], [ 1807, 1807 ], [ 1809, 1809 ], [ 1840, 1866 ], [ 1958, 1968 ], [ 2027, 2035 ], [ 2305, 2306 ], [ 2364, 2364 ], [ 2369, 2376 ], [ 2381, 2381 ], [ 2385, 2388 ], [ 2402, 2403 ], [ 2433, 2433 ], [ 2492, 2492 ], [ 2497, 2500 ], [ 2509, 2509 ], [ 2530, 2531 ], [ 2561, 2562 ], [ 2620, 2620 ], [ 2625, 2626 ], [ 2631, 2632 ], [ 2635, 2637 ], [ 2672, 2673 ], [ 2689, 2690 ], [ 2748, 2748 ], [ 2753, 2757 ], [ 2759, 2760 ], [ 2765, 2765 ], [ 2786, 2787 ], [ 2817, 2817 ], [ 2876, 2876 ], [ 2879, 2879 ], [ 2881, 2883 ], [ 2893, 2893 ], [ 2902, 2902 ], [ 2946, 2946 ], [ 3008, 3008 ], [ 3021, 3021 ], [ 3134, 3136 ], [ 3142, 3144 ], [ 3146, 3149 ], [ 3157, 3158 ], [ 3260, 3260 ], [ 3263, 3263 ], [ 3270, 3270 ], [ 3276, 3277 ], [ 3298, 3299 ], [ 3393, 3395 ], [ 3405, 3405 ], [ 3530, 3530 ], [ 3538, 3540 ], [ 3542, 3542 ], [ 3633, 3633 ], [ 3636, 3642 ], [ 3655, 3662 ], [ 3761, 3761 ], [ 3764, 3769 ], [ 3771, 3772 ], [ 3784, 3789 ], [ 3864, 3865 ], [ 3893, 3893 ], [ 3895, 3895 ], [ 3897, 3897 ], [ 3953, 3966 ], [ 3968, 3972 ], [ 3974, 3975 ], [ 3984, 3991 ], [ 3993, 4028 ], [ 4038, 4038 ], [ 4141, 4144 ], [ 4146, 4146 ], [ 4150, 4151 ], [ 4153, 4153 ], [ 4184, 4185 ], [ 4448, 4607 ], [ 4959, 4959 ], [ 5906, 5908 ], [ 5938, 5940 ], [ 5970, 5971 ], [ 6002, 6003 ], [ 6068, 6069 ], [ 6071, 6077 ], [ 6086, 6086 ], [ 6089, 6099 ], [ 6109, 6109 ], [ 6155, 6157 ], [ 6313, 6313 ], [ 6432, 6434 ], [ 6439, 6440 ], [ 6450, 6450 ], [ 6457, 6459 ], [ 6679, 6680 ], [ 6912, 6915 ], [ 6964, 6964 ], [ 6966, 6970 ], [ 6972, 6972 ], [ 6978, 6978 ], [ 7019, 7027 ], [ 7616, 7626 ], [ 7678, 7679 ], [ 8203, 8207 ], [ 8234, 8238 ], [ 8288, 8291 ], [ 8298, 8303 ], [ 8400, 8431 ], [ 12330, 12335 ], [ 12441, 12442 ], [ 43014, 43014 ], [ 43019, 43019 ], [ 43045, 43046 ], [ 64286, 64286 ], [ 65024, 65039 ], [ 65056, 65059 ], [ 65279, 65279 ], [ 65529, 65531 ], [ 68097, 68099 ], [ 68101, 68102 ], [ 68108, 68111 ], [ 68152, 68154 ], [ 68159, 68159 ], [ 119143, 119145 ], [ 119155, 119170 ], [ 119173, 119179 ], [ 119210, 119213 ], [ 119362, 119364 ], [ 917505, 917505 ], [ 917536, 917631 ], [ 917760, 917999 ] ], DEFAULTS = {
      nul: 0,
      control: 0
    }, config = function(opts) {
      var options, _defaults;
      return _defaults = DEFAULTS, options = (options = opts || {}) || {}, Object.keys(_defaults).forEach((function(key) {
        void 0 === options[key] && (options[key] = clone_1(_defaults[key]));
      })), opts = options, function(str) {
        return function(str, opts) {
          if ("string" != typeof str) return pad_esm_wcwidth(str, opts);
          for (var s = 0, i = 0; i < str.length; i++) {
            var n = pad_esm_wcwidth(str.charCodeAt(i), opts);
            if (n < 0) return -1;
            s += n;
          }
          return s;
        }(str, opts);
      };
    };
    function pad_esm_wcwidth(ucs, opts) {
      return 0 === ucs ? opts.nul : ucs < 32 || ucs >= 127 && ucs < 160 ? opts.control : function(ucs) {
        var mid, min = 0, max = combining.length - 1;
        if (ucs < combining[0][0] || ucs > combining[max][1]) return !1;
        for (;max >= min; ) if (mid = Math.floor((min + max) / 2), ucs > combining[mid][1]) min = mid + 1; else {
          if (!(ucs < combining[mid][0])) return !0;
          max = mid - 1;
        }
        return !1;
      }(ucs) ? 0 : 1 + (ucs >= 4352 && (ucs <= 4447 || 9001 == ucs || 9002 == ucs || ucs >= 11904 && ucs <= 42191 && 12351 != ucs || ucs >= 44032 && ucs <= 55203 || ucs >= 63744 && ucs <= 64255 || ucs >= 65040 && ucs <= 65049 || ucs >= 65072 && ucs <= 65135 || ucs >= 65280 && ucs <= 65376 || ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141));
    }
    const pad_esm = _pad = function(text, length, options) {
      var escapecolor, invert, padlength, textnocolors;
      if (null == options && (options = {}), invert = "number" == typeof text) {
        var _ref = [ text, length ];
        length = _ref[0], text = _ref[1];
      }
      return "string" == typeof options && (options = {
        char: options
      }), null == options.char && (options.char = " "), null == options.strip && (options.strip = !1), 
      "string" != typeof text && (text = text.toString()), textnocolors = null, _pad = "", 
      options.colors && (escapecolor = /\x1B\[(?:[0-9]{1,2}(?:;[0-9]{1,2})?)?[m|K]/g, 
      textnocolors = text.replace(escapecolor, "")), (padlength = options.fixed_width ? length - (textnocolors || text).length : length - config(options.wcwidth_options)(textnocolors || text)) < 0 ? options.strip ? invert ? text.substr(-1 * length) : text.substr(0, length) : text : (_pad += options.char.repeat(padlength), 
      invert ? _pad + text : text + _pad);
    };
    function assert(condition, message = null) {
      if (!condition) throw new Error(message || "Assertion failed");
    }
    function compareNestedStringArray(x, y) {
      return x instanceof Array ? x.length == y.length && 0 == x.filter(((v, i) => !compareNestedStringArray(v, y[i]))).length : x === y;
    }
    function deduplicateDays(timetable) {
      let dedup = !0;
      return timetable.forEach((days => {
        days.length > 1 && days.slice(1).forEach((day => {
          compareNestedStringArray(days[0], day) || (dedup = !1);
        }));
      })), dedup ? new Map(Array.from(timetable.entries()).map((([station, days]) => [ station, [ days[0] ] ]))) : timetable;
    }
    function luaifyNestedStringArray(array, padding = 0) {
      return array instanceof Array ? `{ ${array.map((child => luaifyNestedStringArray(child, padding))).join(", ")} }` : pad_esm(padding, "nil" == array ? "nil" : `'${array}'`);
    }
    function getItemsTextByIndex(items, terminalOffset, dayOffset, closed) {
      return terminalOffset instanceof Array ? terminalOffset.map((index => items[index + dayOffset].innerHTML.trim().replace("--", closed ? "nil" : ""))) : items[terminalOffset + dayOffset].innerHTML.trim().replace("--", closed ? "nil" : "");
    }
    const crt = {
      bootstrap: () => {
        document.querySelectorAll(".line-time-table").forEach((table => {
          let caption = table.querySelector("caption"), button = document.createElement("a");
          button.append("导出"), button.addEventListener("click", (() => {
            let [days, termini, child_termini] = [ 0, 1, 2 ].map((r => Array.from(table.tHead.rows[r].querySelectorAll(".bg-f7f7f7")).filter((th => th.innerText.trim().length > 2))));
            0 == days.length && (days.push(document.createElement("th")), days[0].colSpan = termini.map((g => g.colSpan)).reduce(((p, c) => p + c), 0)), 
            assert([ 1, 2 ].includes(days.length), "Invalid # of days."), assert(termini.length % days.length == 0 && termini.length >= 2, "Invalid # of termini."), 
            assert(child_termini.length % days.length == 0 && child_termini.length >= 2, "Invalid # of child termini.");
            let dayWidth = days[0].colSpan, dayOffsets = [];
            for (let i = 0; i < days.length; i++) assert(days[i].colSpan == dayWidth), dayOffsets.push(i * dayWidth);
            let terminalOffsets = [ 1, 2, 3, 4 ];
            if (termini.length / days.length == 2 && child_termini.length / termini.length == 2) ; else {
              if (!(termini.length / days.length >= 2)) throw termini.length;
              {
                terminalOffsets = [ [], [], [], [] ];
                let i = 0, dayWidth = days[0].colSpan;
                for (var orientation of termini) {
                  let orientationWidth = orientation.colSpan;
                  if (orientation.innerHTML.trim().startsWith("首班车")) for (let j = 0; j < orientationWidth; j++) {
                    let terminusText = child_termini[i + j].innerHTML.trim();
                    terminusText.includes("↓") || terminusText.includes("内环") ? terminalOffsets[0].push(i + j + 1) : terminalOffsets[1].push(i + j + 1);
                  } else for (let j = 0; j < orientationWidth; j++) {
                    let terminusText = child_termini[i + j].innerHTML.trim();
                    terminusText.includes("↓") || terminusText.includes("内环") ? terminalOffsets[2].push(i + j + 1) : terminalOffsets[3].push(i + j + 1);
                  }
                  if (i += orientationWidth, i >= dayWidth) break;
                }
                for (let i = 0; i < terminalOffsets.length; i++) terminalOffsets[i] = 1 == terminalOffsets[i].length ? terminalOffsets[i][0] : terminalOffsets[i];
              }
            }
            let rows = Array.from(table.tBodies[0].rows).map((row => Array.from(row.cells))), timetable = new Map;
            for (var row of rows) {
              if (0 == row.length) break;
              let name = row[0].innerHTML.trim().replace("航站楼", "");
              if (!name || "--" == name) break;
              timetable.set(name, dayOffsets.map((dayOffset => {
                let closed = 0 == row.slice(1).filter((cell => cell.innerHTML.trim().length > 2)).length;
                return [ [ getItemsTextByIndex(row, terminalOffsets[0], dayOffset, closed), getItemsTextByIndex(row, terminalOffsets[1], dayOffset, closed) ], [ getItemsTextByIndex(row, terminalOffsets[2], dayOffset, closed), getItemsTextByIndex(row, terminalOffsets[3], dayOffset, closed) ] ];
              })));
            }
            navigator.clipboard.writeText(function(timetable, padding) {
              return `\t\t{\n\t\t\tstations = ${luaifyNestedStringArray([ ...(timetable = deduplicateDays(timetable)).keys() ])},\n\t\t\tdata = {\n${Array.from(timetable).map((([key, value]) => `\t\t\t\t${pad_esm(`['${key}']`, padding)} = ${luaifyNestedStringArray(value, 7)},`)).join("\n")}\n\t\t\t}\n\t\t}`;
            }(timetable, Math.max(...[ ...timetable.keys() ].map((str => wcwidth_default()(str)))) + 4));
          }), !1), button.style.cursor = "pointer", button.style.position = "absolute", button.style["z-index"] = 1, 
          button.style.color = "white", button.style.opacity = ".75", button.style["padding-inline-start"] = ".5em", 
          caption.appendChild(button);
        }));
      }
    };
    if ("www.cqmetro.cn" === new URL(document.URL).hostname) crt.bootstrap();
  })();
})();