From 58d40cf1cf78151501ea5ad87e385d663f8b7d76 Mon Sep 17 00:00:00 2001 From: Cruyu Date: Thu, 27 Aug 2020 22:53:14 +0800 Subject: [PATCH] =?UTF-8?q?2.5.4(=E9=83=A8=E5=88=86=E6=B1=89=E5=8C=96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新变动略大.... --- OnekeyUIApp/OnekeyUIApp/Resources/main.js | 13478 +- OnekeyUIApp/OnekeyUIApp/Resources/renderer.js | 118963 +++++++-------- main.js | 13478 +- renderer.js | 118963 +++++++-------- 4 files changed, 124756 insertions(+), 140126 deletions(-) diff --git a/OnekeyUIApp/OnekeyUIApp/Resources/main.js b/OnekeyUIApp/OnekeyUIApp/Resources/main.js index 79087d2..d68a46e 100644 --- a/OnekeyUIApp/OnekeyUIApp/Resources/main.js +++ b/OnekeyUIApp/OnekeyUIApp/Resources/main.js @@ -1,6904 +1,6806 @@ module.exports = function (e) { - function n(r) { - if (t[r]) return t[r].exports; - var o = t[r] = { - i: r, - l: !1, - exports: {} - }; - return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports - } - var t = {}; - return n.m = e, n.c = t, n.d = function (e, t, r) { - n.o(e, t) || Object.defineProperty(e, t, { - configurable: !1, - enumerable: !0, - get: r - }) - }, n.r = function (e) { - Object.defineProperty(e, '__esModule', { - value: !0 - }) - }, n.n = function (e) { - var t = e && e.__esModule ? function () { - return e['default'] - } : function () { - return e - }; - return n.d(t, 'a', t), t - }, n.o = function (e, n) { - return Object.prototype.hasOwnProperty.call(e, n) - }, n.p = '', n(n.s = 135) -}([function (e) { - e.exports = require('path') -}, function (e, n, t) { - function r(e) { - function n(n) { - return m.apply(e, n) - } + var t = {}; - function t() { - return this instanceof t ? (f.apply(this, arguments), this) : t.apply(Object.create(t.prototype), arguments) + function n(r) { + if (t[r]) return t[r].exports; + var i = t[r] = { + i: r, + l: !1, + exports: {} + }; + return e[r].call(i.exports, i, i.exports, n), i.l = !0, i.exports } - - function a() { - return this instanceof a ? (h.apply(this, arguments), this) : a.apply(Object.create(a.prototype), arguments) + return n.m = e, n.c = t, n.d = function (e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { + enumerable: !0, + get: r + }) + }, n.r = function (e) { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { + value: "Module" + }), Object.defineProperty(e, "__esModule", { + value: !0 + }) + }, n.t = function (e, t) { + if (1 & t && (e = n(e)), 8 & t) return e; + if (4 & t && "object" == typeof e && e && e.__esModule) return e; + var r = Object.create(null); + if (n.r(r), Object.defineProperty(r, "default", { + enumerable: !0, + value: e + }), 2 & t && "string" != typeof e) + for (var i in e) n.d(r, i, function (t) { + return e[t] + }.bind(null, i)); + return r + }, n.n = function (e) { + var t = e && e.__esModule ? function () { + return e.default + } : function () { + return e + }; + return n.d(t, "a", t), t + }, n.o = function (e, t) { + return Object.prototype.hasOwnProperty.call(e, t) + }, n.p = "", n(n.s = 121) +}([function (e, t) { + e.exports = require("electron") +}, function (e, t) { + e.exports = require("path") +}, function (e, t, n) { + var r, i, o = n(3), + s = n(83), + a = n(84), + c = n(85), + l = n(7); + "function" == typeof Symbol && "function" == typeof Symbol.for ? (r = Symbol.for("graceful-fs.queue"), i = Symbol.for("graceful-fs.previous")) : (r = "___graceful-fs.queue", i = "___graceful-fs.previous"); + var u = function () {}; + if (l.debuglog ? u = l.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (u = function () { + var e = l.format.apply(l, arguments); + e = "GFS4: " + e.split(/\n/).join("\nGFS4: "), console.error(e) + }), !global[r]) { + var f = []; + Object.defineProperty(global, r, { + get: function () { + return f + } + }), o.close = function (e) { + function t(t, n) { + return e.call(o, t, (function (e) { + e || d(), "function" == typeof n && n.apply(this, arguments) + })) + } + return Object.defineProperty(t, i, { + value: e + }), t + }(o.close), o.closeSync = function (e) { + function t(t) { + e.apply(o, arguments), d() + } + return Object.defineProperty(t, i, { + value: e + }), t + }(o.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", (function () { + u(global[r]), n(27).equal(global[r].length, 0) + })) } - function l(e, n, t, r) { - function a(e, n, t, r) { - return b(e, n, t, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? o([a, [e, n, t, r]]) : ('function' == typeof r && r.apply(this, arguments), i()) - }) - } - return 'function' == typeof t && (r = t, t = null), a(e, n, t, r) + function h(e) { + s(e), e.gracefulify = h, e.createReadStream = function (t, n) { + return new e.ReadStream(t, n) + }, e.createWriteStream = function (t, n) { + return new e.WriteStream(t, n) + }; + var t = e.readFile; + e.readFile = function (e, n, r) { + "function" == typeof n && (r = n, n = null); + return function e(n, r, i) { + return t(n, r, (function (t) { + !t || "EMFILE" !== t.code && "ENFILE" !== t.code ? ("function" == typeof i && i.apply(this, arguments), d()) : p([e, [n, r, i]]) + })) + }(e, n, r) + }; + var n = e.writeFile; + e.writeFile = function (e, t, r, i) { + "function" == typeof r && (i = r, r = null); + return function e(t, r, i, o) { + return n(t, r, i, (function (n) { + !n || "EMFILE" !== n.code && "ENFILE" !== n.code ? ("function" == typeof o && o.apply(this, arguments), d()) : p([e, [t, r, i, o]]) + })) + }(e, t, r, i) + }; + var r = e.appendFile; + r && (e.appendFile = function (e, t, n, i) { + "function" == typeof n && (i = n, n = null); + return function e(t, n, i, o) { + return r(t, n, i, (function (r) { + !r || "EMFILE" !== r.code && "ENFILE" !== r.code ? ("function" == typeof o && o.apply(this, arguments), d()) : p([e, [t, n, i, o]]) + })) + }(e, t, n, i) + }); + var i = e.readdir; + + function o(t) { + return i.apply(e, t) + } + if (e.readdir = function (e, t, n) { + var r = [e]; + "function" != typeof t ? r.push(t) : n = t; + return r.push((function (e, t) { + t && t.sort && t.sort(); + !e || "EMFILE" !== e.code && "ENFILE" !== e.code ? ("function" == typeof n && n.apply(this, arguments), d()) : p([o, [r]]) + })), o(r) + }, "v0.8" === process.version.substr(0, 4)) { + var c = a(e); + g = c.ReadStream, y = c.WriteStream + } + var l = e.ReadStream; + l && (g.prototype = Object.create(l.prototype), g.prototype.open = function () { + var e = this; + w(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.autoClose && e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n), e.read()) + })) + }); + var u = e.WriteStream; + u && (y.prototype = Object.create(u.prototype), y.prototype.open = function () { + var e = this; + w(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n)) + })) + }), Object.defineProperty(e, "ReadStream", { + get: function () { + return g + }, + set: function (e) { + g = e + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(e, "WriteStream", { + get: function () { + return y + }, + set: function (e) { + y = e + }, + enumerable: !0, + configurable: !0 + }); + var f = g; + Object.defineProperty(e, "FileReadStream", { + get: function () { + return f + }, + set: function (e) { + f = e + }, + enumerable: !0, + configurable: !0 + }); + var m = y; + + function g(e, t) { + return this instanceof g ? (l.apply(this, arguments), this) : g.apply(Object.create(g.prototype), arguments) + } + + function y(e, t) { + return this instanceof y ? (u.apply(this, arguments), this) : y.apply(Object.create(y.prototype), arguments) + } + Object.defineProperty(e, "FileWriteStream", { + get: function () { + return m + }, + set: function (e) { + m = e + }, + enumerable: !0, + configurable: !0 + }); + var v = e.open; + + function w(e, t, n, r) { + return "function" == typeof n && (r = n, n = null), + function e(t, n, r, i) { + return v(t, n, r, (function (o, s) { + !o || "EMFILE" !== o.code && "ENFILE" !== o.code ? ("function" == typeof i && i.apply(this, arguments), d()) : p([e, [t, n, r, i]]) + })) + }(e, t, n, r) + } + return e.open = w, e } - s(e), e.gracefulify = r, e.createReadStream = function (n, t) { - return new e.ReadStream(n, t) - }, e.createWriteStream = function (n, t) { - return new e.WriteStream(n, t) - }; - var c = e.readFile; - e.readFile = function (e, n, t) { - function r(e, n, t) { - return c(e, n, function (a) { - a && ('EMFILE' === a.code || 'ENFILE' === a.code) ? o([r, [e, n, t]]) : ('function' == typeof t && t.apply(this, arguments), i()) - }) - } - return 'function' == typeof n && (t = n, n = null), r(e, n, t) - }; - var p = e.writeFile; - e.writeFile = function (e, n, t, r) { - function a(e, n, t, r) { - return p(e, n, t, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? o([a, [e, n, t, r]]) : ('function' == typeof r && r.apply(this, arguments), i()) + + function p(e) { + u("ENQUEUE", e[0].name, e[1]), global[r].push(e) + } + + function d() { + var e = global[r].shift(); + e && (u("RETRY", e[0].name, e[1]), e[0].apply(null, e[1])) + } + e.exports = h(c(o)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !o.__patched && (e.exports = h(o), o.__patched = !0) +}, function (e, t) { + e.exports = require("fs") +}, function (e, t, n) { + "use strict"; + e.exports = Object.assign({}, n(33), n(35), n(39), n(90), n(92), n(98), n(6), n(104), n(105), n(106), n(8), n(21)); + const r = n(3); + Object.getOwnPropertyDescriptor(r, "promises") && Object.defineProperty(e.exports, "promises", { + get: () => r.promises + }) +}, function (e, t, n) { + "use strict"; + t.fromCallback = function (e) { + return Object.defineProperty((function () { + if ("function" != typeof arguments[arguments.length - 1]) return new Promise((t, n) => { + arguments[arguments.length] = (e, r) => { + if (e) return n(e); + t(r) + }, arguments.length++, e.apply(this, arguments) + }); + e.apply(this, arguments) + }), "name", { + value: e.name }) - } - return 'function' == typeof t && (r = t, t = null), a(e, n, t, r) - }; - var u = e.appendFile; - u && (e.appendFile = function (e, n, t, r) { - function a(e, n, t, r) { - return u(e, n, t, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? o([a, [e, n, t, r]]) : ('function' == typeof r && r.apply(this, arguments), i()) + }, t.fromPromise = function (e) { + return Object.defineProperty((function () { + const t = arguments[arguments.length - 1]; + if ("function" != typeof t) return e.apply(this, arguments); + e.apply(this, arguments).then(e => t(null, e), t) + }), "name", { + value: e.name }) - } - return 'function' == typeof t && (r = t, t = null), a(e, n, t, r) - }); - var m = e.readdir; - if (e.readdir = function (e, t, r) { - function a(e, t) { - t && t.sort && t.sort(), e && ('EMFILE' === e.code || 'ENFILE' === e.code) ? o([n, [s]]) : ('function' == typeof r && r.apply(this, arguments), i()) - } - var s = [e]; - return 'function' == typeof t ? r = t : s.push(t), s.push(a), n(s) - }, 'v0.8' === process.version.substr(0, 4)) { - var g = d(e); - t = g.ReadStream, a = g.WriteStream - } - var f = e.ReadStream; - f && (t.prototype = Object.create(f.prototype), t.prototype.open = function () { - var e = this; - l(e.path, e.flags, e.mode, function (n, t) { - n ? (e.autoClose && e.destroy(), e.emit('error', n)) : (e.fd = t, e.emit('open', t), e.read()) - }) - }); - var h = e.WriteStream; - h && (a.prototype = Object.create(h.prototype), a.prototype.open = function () { - var e = this; - l(e.path, e.flags, e.mode, function (n, t) { - n ? (e.destroy(), e.emit('error', n)) : (e.fd = t, e.emit('open', t)) - }) - }), Object.defineProperty(e, 'ReadStream', { - get: function () { - return t - }, - set: function (e) { - t = e - }, - enumerable: !0, - configurable: !0 - }), Object.defineProperty(e, 'WriteStream', { - get: function () { - return a - }, - set: function (e) { - a = e - }, - enumerable: !0, - configurable: !0 - }); - var y = t; - Object.defineProperty(e, 'FileReadStream', { - get: function () { - return y - }, - set: function (e) { - y = e - }, - enumerable: !0, - configurable: !0 - }); - var _ = a; - Object.defineProperty(e, 'FileWriteStream', { - get: function () { - return _ - }, - set: function (e) { - _ = e - }, - enumerable: !0, - configurable: !0 + } +}, function (e, t, n) { + "use strict"; + const r = (0, n(5).fromCallback)(n(87)), + i = n(88); + e.exports = { + mkdirs: r, + mkdirsSync: i, + mkdirp: r, + mkdirpSync: i, + ensureDir: r, + ensureDirSync: i + } +}, function (e, t) { + e.exports = require("util") +}, function (e, t, n) { + "use strict"; + const r = n(5).fromPromise, + i = n(33); + e.exports = { + pathExists: r((function (e) { + return i.access(e).then(() => !0).catch(() => !1) + })), + pathExistsSync: i.existsSync + } +}, function (e, t) { + e.exports = require("os") +}, function (e, t, n) { + var r = t; + r.version = n(55).version, r.transports = n(56); + var i = n(12); + r.hash = i.hash, r.clone = i.clone, r.longestElement = i.longestElement, r.exception = n(32), r.config = n(26), r.addColors = r.config.addColors, r.Container = n(81).Container, r.Logger = n(82).Logger, r.Transport = n(16).Transport, r.loggers = new r.Container; + var o = new r.Logger({ + transports: [new r.transports.Console] }); - var b = e.open; - return e.open = l, e - } - - function o(e) { - m('ENQUEUE', e[0].name, e[1]), global[p].push(e) - } - - function i() { - var e = global[p].shift(); - e && (m('RETRY', e[0].name, e[1]), e[0].apply(null, e[1])) - } - var a = t(5), - s = t(105), - d = t(103), - l = t(102), - c = t(6), - p, u; - 'function' == typeof Symbol && 'function' == typeof Symbol.for ? (p = Symbol.for('graceful-fs.queue'), u = Symbol.for('graceful-fs.previous')) : (p = '___graceful-fs.queue', u = '___graceful-fs.previous'); - var m = function () {}; - if (c.debuglog ? m = c.debuglog('gfs4') : /\bgfs4\b/i.test(process.env.NODE_DEBUG || '') && (m = function () { - var e = c.format.apply(c, arguments); - e = 'GFS4: ' + e.split(/\n/).join('\nGFS4: '), console.error(e) - }), !global[p]) { - var g = []; - Object.defineProperty(global, p, { - get: function () { - return g - } - }), a.close = function (e) { - function n(n, t) { - return e.call(a, n, function (e) { - e || i(), 'function' == typeof t && t.apply(this, arguments) + i.setLevels(r, null, o.levels), ["log", "query", "stream", "add", "remove", "clear", "profile", "startTimer", "extend", "cli", "handleExceptions", "unhandleExceptions", "configure"].forEach((function (e) { + r[e] = function () { + return o[e].apply(o, arguments) + } + })), r.cli = function () { + return r.padLevels = !0, i.setLevels(r, o.levels, r.config.cli.levels), o.setLevels(r.config.cli.levels), r.config.addColors(r.config.cli.colors), o.transports.console && (o.transports.console.colorize = !0, o.transports.console.timestamp = !1), r + }, r.setLevels = function (e) { + i.setLevels(r, o.levels, e), o.setLevels(e) + }, Object.defineProperty(r, "level", { + get: function () { + return o.level + }, + set: function (e) { + o.level = e, Object.keys(o.transports).forEach((function (t) { + o.transports[t].level = e + })) + } + }), ["emitErrs", "exitOnError", "padLevels", "levelLength", "stripColors"].forEach((function (e) { + Object.defineProperty(r, e, { + get: function () { + return o[e] + }, + set: function (t) { + o[e] = t + } }) - } - return Object.defineProperty(n, u, { - value: e - }), n - }(a.close), a.closeSync = function (e) { - function n() { - e.apply(a, arguments), i() - } - return Object.defineProperty(n, u, { - value: e - }), n - }(a.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || '') && process.on('exit', function () { - m(global[p]), t(42).equal(global[p].length, 0) - }) - } - e.exports = r(l(a)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !a.__patched && (e.exports = r(a), a.__patched = !0) -}, function (e, n) { - 'use strict'; - n.fromCallback = function (e) { - return Object.defineProperty(function () { - return 'function' == typeof arguments[arguments.length - 1] ? void e.apply(this, arguments) : new Promise((n, t) => { - arguments[arguments.length] = (e, r) => e ? t(e) : void n(r), arguments.length++, e.apply(this, arguments) - }) - }, 'name', { - value: e.name - }) - }, n.fromPromise = function (e) { - return Object.defineProperty(function () { - const n = arguments[arguments.length - 1]; - return 'function' == typeof n ? void e.apply(this, arguments).then((e) => n(null, e), n) : e.apply(this, arguments) - }, 'name', { - value: e.name + })), Object.defineProperty(r, "default", { + get: function () { + return { + transports: o.transports, + exceptionHandlers: o.exceptionHandlers + } + } }) - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = r(t(100)), - i = t(99); - e.exports = { - mkdirs: o, - mkdirsSync: i, - mkdirp: o, - mkdirpSync: i, - ensureDir: o, - ensureDirSync: i - } -}, function (e) { - e.exports = require('electron') -}, function (e) { - e.exports = require('fs') -}, function (e) { - e.exports = require('util') -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromPromise, - o = t(43); - e.exports = { - pathExists: r(function (e) { - return o.access(e).then(() => !0).catch(() => !1) - }), - pathExistsSync: o.existsSync - } -}, function (e) { - e.exports = require('stream') -}, function (e, n, t) { - var r = t(6), - o = t(130), - i = t(129), - a = t(5), - s = t(128).StringDecoder, - d = t(8).Stream, - l = t(21); - n.setLevels = function (e, t, r) { - this; - return t && Object.keys(t).forEach(function (n) { - delete e[n] - }), e.levels = r || l.npm.levels, e.padLevels && (e.levelLength = n.longestElement(Object.keys(e.levels))), Object.keys(e.levels).forEach(function (n) { - return 'log' === n ? void console.warn('Log level named "log" will clash with the method "log". Consider using a different name.') : void(e[n] = function () { - var t = [n].concat(Array.prototype.slice.call(arguments)); - e.log.apply(e, t) - }) - }), e - }, n.longestElement = function (e) { - return Math.max.apply(null, e.map(function (e) { - return e.length +}, function (e, t) { + e.exports = require("stream") +}, function (e, t, n) { + var r = n(7), + i = n(58), + o = n(59), + s = n(3), + a = n(60).StringDecoder, + c = n(11).Stream, + l = n(26); + t.setLevels = function (e, n, r, i) { + return n && Object.keys(n).forEach((function (t) { + delete e[t] + })), e.levels = r || l.npm.levels, e.padLevels && (e.levelLength = t.longestElement(Object.keys(e.levels))), Object.keys(e.levels).forEach((function (t) { + "log" !== t ? e[t] = function (n) { + var r = [t].concat(Array.prototype.slice.call(arguments)); + e.log.apply(e, r) + } : console.warn('Log level named "log" will clash with the method "log". Consider using a different name.') + })), e + }, t.longestElement = function (e) { + return Math.max.apply(null, e.map((function (e) { + return e.length + }))) + }, t.clone = function (e) { + var n = {}; + if (e instanceof Error) return n = { + message: e.message + }, Object.getOwnPropertyNames(e).forEach((function (t) { + n[t] = e[t] + })), n; + if (!(e instanceof Object)) return e; + if (e instanceof Date) return new Date(e.getTime()); + for (var r in e) Array.isArray(e[r]) || e[r] instanceof Buffer ? n[r] = e[r].slice(0) : "function" != typeof e[r] ? n[r] = e[r] instanceof Object ? t.clone(e[r]) : e[r] : "function" == typeof e[r] && (n[r] = e[r]); + return n + }, t.log = function (e) { + var n, i = "function" == typeof e.timestamp ? e.timestamp : t.timestamp, + s = e.timestamp ? i() : null, + a = void 0 === e.showLevel || e.showLevel, + c = null === e.meta || void 0 === e.meta || e.meta instanceof Error ? e.meta || null : t.clone(o.decycle(e.meta)); + if (e.raw) return "object" != typeof c && null != c && (c = { + meta: c + }), (n = t.clone(c) || {}).level = e.level, n.message = e.message.stripColors ? e.message.stripColors : e.message, JSON.stringify(n); + if (e.json || !0 === e.logstash) { + if ("object" != typeof c && null != c && (c = { + meta: c + }), (n = t.clone(c) || {}).level = e.level, n.message = n.message || "", e.label && (n.label = e.label), e.message && (n.message = e.message), s && (n.timestamp = s), !0 === e.logstash) { + var u = {}; + void 0 !== n.message && (u["@message"] = n.message, delete n.message), void 0 !== n.timestamp && (u["@timestamp"] = n.timestamp, delete n.timestamp), u["@fields"] = t.clone(n), n = u + } + return "function" == typeof e.stringify ? e.stringify(n) : JSON.stringify(n, (function (e, t) { + return t instanceof Buffer ? t.toString("base64") : t + })) + } + if ("function" == typeof e.formatter) return e.meta = c, String(e.formatter(t.clone(e))); + if (n = s ? s + " - " : "", a && (n += "all" === e.colorize || "level" === e.colorize || !0 === e.colorize ? l.colorize(e.level) : e.level), n += e.align ? "\t" : "", n += s || a ? ": " : "", n += e.label ? "[" + e.label + "] " : "", n += "all" === e.colorize || "message" === e.colorize ? l.colorize(e.level, e.message) : e.message, null != c) + if (c && c instanceof Error && c.stack && (c = c.stack), "object" != typeof c) n += " " + c; + else if (Object.keys(c).length > 0) + if ("function" == typeof e.prettyPrint) n += " " + e.prettyPrint(c); + else if (e.prettyPrint) n += " \n" + r.inspect(c, !1, e.depth || null, e.colorize); + else if (e.humanReadableUnhandledException && 5 === Object.keys(c).length && c.hasOwnProperty("date") && c.hasOwnProperty("process") && c.hasOwnProperty("os") && c.hasOwnProperty("trace") && c.hasOwnProperty("stack")) { + var f = c.stack; + delete c.stack, delete c.trace, n += " " + t.serialize(c), f && (n += "\n" + f.join("\n")) + } else n += " " + t.serialize(c); + return n + }, t.capitalize = function (e) { + return e && e[0].toUpperCase() + e.slice(1) + }, t.hash = function (e) { + return i.createHash("sha1").update(e).digest("hex") + }, t.pad = function (e) { + return e < 10 ? "0" + e.toString(10) : e.toString(10) + }, t.timestamp = function () { + return (new Date).toISOString() + }, t.serialize = function (e, n) { + if ("symbol" == typeof n && (n = n.toString()), "symbol" == typeof e && (e = e.toString()), null === e ? e = "null" : void 0 === e ? e = "undefined" : !1 === e && (e = "false"), "object" != typeof e) return n ? n + "=" + e : e; + if (e instanceof Buffer) return n ? n + "=" + e.toString("base64") : e.toString("base64"); + for (var r = "", i = Object.keys(e), o = i.length, s = 0; s < o; s++) { + if (Array.isArray(e[i[s]])) { + r += i[s] + "=["; + for (var a = 0, c = e[i[s]].length; a < c; a++) r += t.serialize(e[i[s]][a]), a < c - 1 && (r += ", "); + r += "]" + } else e[i[s]] instanceof Date ? r += i[s] + "=" + e[i[s]] : r += t.serialize(e[i[s]], i[s]); + s < o - 1 && (r += ", ") + } + return r + }, t.tailFile = function (e, t) { + var n = new Buffer(65536), + r = new a("utf8"), + i = new c, + o = "", + l = 0, + u = 0; + return -1 === e.start && delete e.start, i.readable = !0, i.destroy = function () { + i.destroyed = !0, i.emit("end"), i.emit("close") + }, s.open(e.file, "a+", "0644", (function (a, c) { + if (a) return t ? t(a) : i.emit("error", a), void i.destroy(); + ! function a() { + if (!i.destroyed) return s.read(c, n, 0, n.length, l, (function (s, c) { + if (s) return t ? t(s) : i.emit("error", s), void i.destroy(); + if (!c) return o && ((null == e.start || u > e.start) && (t ? t(null, o) : i.emit("line", o)), u++, o = ""), setTimeout(a, 1e3); + var f = r.write(n.slice(0, c)); + t || i.emit("data", f); + for (var h = (f = (o + f).split(/\n+/)).length - 1, p = 0; p < h; p++)(null == e.start || u > e.start) && (t ? t(null, f[p]) : i.emit("line", f[p])), u++; + return o = f[h], l += c, a() + })); + s.close(c) + }() + })), t ? i.destroy : i + }, t.stringArrayToSet = function (e, t) { + return void 0 === t && (t = "Cannot make set from Array with non-string elements"), e.reduce((function (e, n) { + if (!("string" == typeof n || n instanceof String)) throw new Error(t); + return e[n] = !0, e + }), Object.create(null)) + } +}, function (e, t, n) { + "use strict"; + var r = n(49); + n.d(t, "buildDefaultMenu", (function () { + return r.a + })); + n(22); + var i = n(46); + n.o(i, "getAllMenuItems") && n.d(t, "getAllMenuItems", (function () { + return i.getAllMenuItems + })), n.o(i, "setCrashMenu") && n.d(t, "setCrashMenu", (function () { + return i.setCrashMenu + })); + var o = n(47); + n.d(t, "setCrashMenu", (function () { + return o.a + })); + var s = n(48); + n.d(t, "getAllMenuItems", (function () { + return s.a })) - }, n.clone = function (e) { - var t = {}; - if (e instanceof Error) return t = { - message: e.message - }, Object.getOwnPropertyNames(e).forEach(function (n) { - t[n] = e[n] - }), t; - if (!(e instanceof Object)) return e; - if (e instanceof Date) return new Date(e.getTime()); - for (var r in e) Array.isArray(e[r]) ? t[r] = e[r].slice(0) : e[r] instanceof Buffer ? t[r] = e[r].slice(0) : 'function' == typeof e[r] ? 'function' == typeof e[r] && (t[r] = e[r]) : t[r] = e[r] instanceof Object ? n.clone(e[r]) : e[r]; - return t - }, n.log = function (e) { - var t = 'function' == typeof e.timestamp ? e.timestamp : n.timestamp, - o = e.timestamp ? t() : null, - a = void 0 === e.showLevel || e.showLevel, - s = null === e.meta || void 0 === e.meta || e.meta instanceof Error ? e.meta || null : n.clone(i.decycle(e.meta)), - d; - if (e.raw) return 'object' != typeof s && null != s && (s = { - meta: s - }), d = n.clone(s) || {}, d.level = e.level, d.message = e.message.stripColors ? e.message.stripColors : e.message, JSON.stringify(d); - if (e.json || !0 === e.logstash) { - if ('object' != typeof s && null != s && (s = { - meta: s - }), d = n.clone(s) || {}, d.level = e.level, d.message = d.message || '', e.label && (d.label = e.label), e.message && (d.message = e.message), o && (d.timestamp = o), !0 === e.logstash) { - var c = {}; - void 0 !== d.message && (c['@message'] = d.message, delete d.message), void 0 !== d.timestamp && (c['@timestamp'] = d.timestamp, delete d.timestamp), c['@fields'] = n.clone(d), d = c - } - return 'function' == typeof e.stringify ? e.stringify(d) : JSON.stringify(d, function (e, n) { - return n instanceof Buffer ? n.toString('base64') : n - }) - } - if ('function' == typeof e.formatter) return e.meta = s, e.formatter(n.clone(e)) + ''; - if (d = o ? o + ' - ' : '', a && (d += 'all' === e.colorize || 'level' === e.colorize || !0 === e.colorize ? l.colorize(e.level) : e.level), d += e.align ? '\t' : '', d += o || a ? ': ' : '', d += e.label ? '[' + e.label + '] ' : '', d += 'all' === e.colorize || 'message' === e.colorize ? l.colorize(e.level, e.message) : e.message, null !== s && void 0 !== s) - if (s && s instanceof Error && s.stack && (s = s.stack), 'object' != typeof s) d += ' ' + s; - else if (0 < Object.keys(s).length) - if ('function' == typeof e.prettyPrint) d += ' ' + e.prettyPrint(s); - else if (e.prettyPrint) d += ' \n' + r.inspect(s, !1, e.depth || null, e.colorize); - else if (e.humanReadableUnhandledException && 5 === Object.keys(s).length && s.hasOwnProperty('date') && s.hasOwnProperty('process') && s.hasOwnProperty('os') && s.hasOwnProperty('trace') && s.hasOwnProperty('stack')) { - var p = s.stack; - delete s.stack, delete s.trace, d += ' ' + n.serialize(s), p && (d += '\n' + p.join('\n')) - } else d += ' ' + n.serialize(s); - return d - }, n.capitalize = function (e) { - return e && e[0].toUpperCase() + e.slice(1) - }, n.hash = function (e) { - return o.createHash('sha1').update(e).digest('hex') - }, n.pad = function (e) { - return 10 > e ? '0' + e.toString(10) : e.toString(10) - }, n.timestamp = function () { - return new Date().toISOString() - }, n.serialize = function (e, t) { - if ('symbol' == typeof t && (t = t.toString()), 'symbol' == typeof e && (e = e.toString()), null === e ? e = 'null' : void 0 === e ? e = 'undefined' : !1 === e && (e = 'false'), 'object' != typeof e) return t ? t + '=' + e : e; - if (e instanceof Buffer) return t ? t + '=' + e.toString('base64') : e.toString('base64'); - for (var r = '', o = Object.keys(e), a = o.length, s = 0; s < a; s++) { - if (Array.isArray(e[o[s]])) { - r += o[s] + '=['; - for (var i = 0, d = e[o[s]].length; i < d; i++) r += n.serialize(e[o[s]][i]), i < d - 1 && (r += ', '); - r += ']' - } else r += e[o[s]] instanceof Date ? o[s] + '=' + e[o[s]] : n.serialize(e[o[s]], o[s]); - s < a - 1 && (r += ', ') - } - return r - }, n.tailFile = function (e, n) { - var t = new Buffer(65536), - r = new s('utf8'), - o = new d, - c = '', - p = 0, - u = 0; - return -1 === e.start && delete e.start, o.readable = !0, o.destroy = function () { - o.destroyed = !0, o.emit('end'), o.emit('close') - }, a.open(e.file, 'a+', '0644', function (i, s) { - return i ? (n ? n(i) : o.emit('error', i), void o.destroy()) : void - function d() { - return o.destroyed ? void a.close(s) : a.read(s, t, 0, t.length, p, function (a, s) { - if (a) return n ? n(a) : o.emit('error', a), void o.destroy(); - if (!s) return c && ((null == e.start || u > e.start) && (n ? n(null, c) : o.emit('line', c)), u++, c = ''), setTimeout(d, 1e3); - var m = r.write(t.slice(0, s)); - n || o.emit('data', m); - for (var m = (c + m).split(/\n+/), g = m.length - 1, l = 0; l < g; l++)(null == e.start || u > e.start) && (n ? n(null, m[l]) : o.emit('line', m[l])), u++; - return c = m[g], p += s, d() - }) - }() - }), n ? o.destroy : o - }, n.stringArrayToSet = function (e, n) { - return 'undefined' == typeof n && (n = 'Cannot make set from Array with non-string elements'), e.reduce(function (e, t) { - if (!('string' == typeof t || t instanceof String)) throw new Error(n); - return e[t] = !0, e - }, Object.create(null)) - } -}, function (e) { - e.exports = require('os') -}, function (e, n) { - function t(e, n, t) { - if (n in e) return e[n]; - if (3 === arguments.length) return t; - throw new Error('"' + n + '" is a required argument.') - } - - function r(e) { - var n = e.match(l); - return n ? { - scheme: n[1], - auth: n[2], - host: n[3], - port: n[4], - path: n[5] - } : null - } - - function o(e) { - var n = ''; - return e.scheme && (n += e.scheme + ':'), n += '//', e.auth && (n += e.auth + '@'), e.host && (n += e.host), e.port && (n += ':' + e.port), e.path && (n += e.path), n - } - - function i(e) { - var t = e, - a = r(e); - if (a) { - if (!a.path) return e; - t = a.path - } - for (var s = n.isAbsolute(t), d = t.split(/\/+/), l = 0, c = d.length - 1, i; 0 <= c; c--) i = d[c], '.' === i ? d.splice(c, 1) : '..' === i ? l++ : 0 < l && ('' === i ? (d.splice(c + 1, l), l = 0) : (d.splice(c, 2), l--)); - return t = d.join('/'), '' === t && (t = s ? '/' : '.'), a ? (a.path = t, o(a)) : t - } - - function a(e) { - return e - } - - function s(e) { - if (!e) return !1; - var n = e.length; - if (9 > n) return !1; - if (95 !== e.charCodeAt(n - 1) || 95 !== e.charCodeAt(n - 2) || 111 !== e.charCodeAt(n - 3) || 116 !== e.charCodeAt(n - 4) || 111 !== e.charCodeAt(n - 5) || 114 !== e.charCodeAt(n - 6) || 112 !== e.charCodeAt(n - 7) || 95 !== e.charCodeAt(n - 8) || 95 !== e.charCodeAt(n - 9)) return !1; - for (var t = n - 10; 0 <= t; t--) - if (36 !== e.charCodeAt(t)) return !1; - return !0 - } - - function d(e, n) { - return e === n ? 0 : e > n ? 1 : -1 - } - n.getArg = t; - var l = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/, - c = /^data:.+\,.+$/; - n.urlParse = r, n.urlGenerate = o, n.normalize = i, n.join = function (e, n) { - '' === e && (e = '.'), '' === n && (n = '.'); - var t = r(n), - a = r(e); - if (a && (e = a.path || '/'), t && !t.scheme) return a && (t.scheme = a.scheme), o(t); - if (t || n.match(c)) return n; - if (a && !a.host && !a.path) return a.host = n, o(a); - var s = '/' === n.charAt(0) ? n : i(e.replace(/\/+$/, '') + '/' + n); - return a ? (a.path = s, o(a)) : s - }, n.isAbsolute = function (e) { - return '/' === e.charAt(0) || !!e.match(l) - }, n.relative = function (e, n) { - '' === e && (e = '.'), e = e.replace(/\/$/, ''); - for (var t = 0, r; 0 !== n.indexOf(e + '/');) { - if (r = e.lastIndexOf('/'), 0 > r) return n; - if (e = e.slice(0, r), e.match(/^([^\/]+:\/)?\/*$/)) return n; - ++t - } - return Array(t + 1).join('../') + n.substr(e.length + 1) - }; - var p = function () { - var e = Object.create(null); - return !('__proto__' in e) - }(); - n.toSetString = p ? a : function (e) { - return s(e) ? '$' + e : e - }, n.fromSetString = p ? a : function (e) { - return s(e) ? e.slice(1) : e - }, n.compareByOriginalPositions = function (e, n, t) { - var r = e.source - n.source; - return 0 == r ? (r = e.originalLine - n.originalLine, 0 != r) ? r : (r = e.originalColumn - n.originalColumn, 0 != r || t) ? r : (r = e.generatedColumn - n.generatedColumn, 0 != r) ? r : (r = e.generatedLine - n.generatedLine, 0 == r ? e.name - n.name : r) : r - }, n.compareByGeneratedPositionsDeflated = function (e, n, t) { - var r = e.generatedLine - n.generatedLine; - return 0 == r ? (r = e.generatedColumn - n.generatedColumn, 0 != r || t) ? r : (r = e.source - n.source, 0 != r) ? r : (r = e.originalLine - n.originalLine, 0 != r) ? r : (r = e.originalColumn - n.originalColumn, 0 == r ? e.name - n.name : r) : r - }, n.compareByGeneratedPositionsInflated = function (e, n) { - var t = e.generatedLine - n.generatedLine; - return 0 === t ? (t = e.generatedColumn - n.generatedColumn, 0 !== t) ? t : (t = d(e.source, n.source), 0 !== t) ? t : (t = e.originalLine - n.originalLine, 0 !== t) ? t : (t = e.originalColumn - n.originalColumn, 0 === t ? d(e.name, n.name) : t) : t - } -}, function (e, n, t) { - var r = t(14), - o = t(6), - i = n.Transport = function (e) { - r.EventEmitter.call(this), e = e || {}, this.silent = e.silent || !1, this.raw = e.raw || !1, this.name = e.name || this.name, this.formatter = e.formatter, this.level = e.level, this.handleExceptions = e.handleExceptions || !1, this.exceptionsLevel = e.exceptionsLevel || 'error', this.humanReadableUnhandledException = e.humanReadableUnhandledException || !1 +}, function (e, t) { + e.exports = require("events") +}, function (e, t, n) { + var r = {}; + e.exports = r, r.themes = {}; + var i = r.styles = n(62), + o = Object.defineProperties; + r.supportsColor = n(63), void 0 === r.enabled && (r.enabled = r.supportsColor), r.stripColors = r.strip = function (e) { + return ("" + e).replace(/\x1B\[\d+m/g, "") }; - o.inherits(i, r.EventEmitter), i.prototype.formatQuery = function (e) { - return e - }, i.prototype.normalizeQuery = function (e) { - return e = e || {}, e.rows = e.rows || e.limit || 10, e.start = e.start || 0, e.until = e.until || new Date, 'object' != typeof e.until && (e.until = new Date(e.until)), e.from = e.from || e.until - 86400000, 'object' != typeof e.from && (e.from = new Date(e.from)), e.order = e.order || 'desc', e.fields = e.fields, e - }, i.prototype.formatResults = function (e) { - return e - }, i.prototype.logException = function (e, n, t) { - function r() { - i || (i = !0, o.removeListener('logged', r), o.removeListener('error', r), t()) - } - var o = this, - i; - return this.silent ? t() : void(this.once('logged', r), this.once('error', r), this.log(o.exceptionsLevel, e, n, function () {})) - } -}, function (e, n, t) { - function r(e) { - var n = function e() { - return o.apply(e, arguments) + r.stylize = function (e, t) { + return i[t].open + e + i[t].close }; - return n._styles = e, n.__proto__ = m, n - } - - function o() { - var e = arguments, - n = e.length, - t = 0 !== n && arguments[0] + ''; - if (1 < n) - for (var r = 1; r < n; r++) t += ' ' + e[r]; - if (!s.enabled || !t) return t; - for (var o = this._styles, d = o.length, i; d--;) i = a[o[d]], t = i.open + t.replace(i.closeRe, i.open) + i.close; - return t - } - - function i(e) { - for (var n in e)(function (n) { - s[n] = function (t) { - return s[e[n]](t) - } - })(n) - } - var s = {}; - e.exports = s, s.themes = {}; - var a = s.styles = t(126), - d = Object.defineProperties; - s.supportsColor = t(125), 'undefined' == typeof s.enabled && (s.enabled = s.supportsColor), s.stripColors = s.strip = function (e) { - return ('' + e).replace(/\x1B\[\d+m/g, '') - }; - var l = s.stylize = function (e, n) { - return a[n].open + e + a[n].close - }, - c = /[|\\{}()[\]^$+*?.]/g, - p = function (e) { - if ('string' != typeof e) throw new TypeError('Expected a string'); - return e.replace(c, '\\$&') - }, - u = function () { - var e = {}; - return a.grey = a.gray, Object.keys(a).forEach(function (n) { - a[n].closeRe = new RegExp(p(a[n].close), 'g'), e[n] = { - get: function () { - return r(this._styles.concat(n)) - } - } - }), e - }(), - m = d(function () {}, u); - s.setTheme = function (e) { - if ('string' == typeof e) try { - return s.themes[e] = t(124)(e), i(s.themes[e]), s.themes[e] - } catch (e) { - return console.log(e), e - } else i(e) - }; - var g = function (e, n) { - var t = n.split(''); - return t = t.map(e), t.join('') - }; - for (var f in s.trap = t(123), s.zalgo = t(122), s.maps = {}, s.maps.america = t(121), s.maps.zebra = t(120), s.maps.rainbow = t(119), s.maps.random = t(118), s.maps)(function (e) { - s[e] = function (n) { - return g(s.maps[e], n) - } - })(f); - d(s, function () { - var e = {}; - return Object.keys(u).forEach(function (n) { - e[n] = { - get: function () { - return r([n]) + var s = /[|\\{}()[\]^$+*?.]/g; + + function a(e) { + var t = function e() { + return f.apply(e, arguments) + }; + return t._styles = e, t.__proto__ = u, t + } + var c, l = (c = {}, i.grey = i.gray, Object.keys(i).forEach((function (e) { + i[e].closeRe = new RegExp(function (e) { + if ("string" != typeof e) throw new TypeError("Expected a string"); + return e.replace(s, "\\$&") + }(i[e].close), "g"), c[e] = { + get: function () { + return a(this._styles.concat(e)) + } + } + })), c), + u = o((function () {}), l); + + function f() { + var e = arguments, + t = e.length, + n = 0 !== t && String(arguments[0]); + if (t > 1) + for (var o = 1; o < t; o++) n += " " + e[o]; + if (!r.enabled || !n) return n; + for (var s = this._styles, a = s.length; a--;) { + var c = i[s[a]]; + n = c.open + n.replace(c.closeRe, c.open) + c.close } - } - }), e - }()) -}, function (e) { - e.exports = require('events') -}, function (e, n, t) { - var r = n; - r.version = t(133).version, r.transports = t(132); - var o = t(9); - r.hash = o.hash, r.clone = o.clone, r.longestElement = o.longestElement, r.exception = t(45), r.config = t(21), r.addColors = r.config.addColors, r.Container = t(107).Container, r.Logger = t(106).Logger, r.Transport = t(12).Transport, r.loggers = new r.Container; - var i = new r.Logger({ - transports: [new r.transports.Console] - }); - o.setLevels(r, null, i.levels), ['log', 'query', 'stream', 'add', 'remove', 'clear', 'profile', 'startTimer', 'extend', 'cli', 'handleExceptions', 'unhandleExceptions', 'configure'].forEach(function (e) { - r[e] = function () { - return i[e].apply(i, arguments) - } - }), r.cli = function () { - return r.padLevels = !0, o.setLevels(r, i.levels, r.config.cli.levels), i.setLevels(r.config.cli.levels), r.config.addColors(r.config.cli.colors), i.transports.console && (i.transports.console.colorize = !0, i.transports.console.timestamp = !1), r - }, r.setLevels = function (e) { - o.setLevels(r, i.levels, e), i.setLevels(e) - }, Object.defineProperty(r, 'level', { - get: function () { - return i.level - }, - set: function (e) { - i.level = e, Object.keys(i.transports).forEach(function (n) { - i.transports[n].level = e - }) - } - }), ['emitErrs', 'exitOnError', 'padLevels', 'levelLength', 'stripColors'].forEach(function (e) { - Object.defineProperty(r, e, { - get: function () { - return i[e] - }, - set: function (n) { - i[e] = n - } - }) - }), Object.defineProperty(r, 'default', { - get: function () { - return { - transports: i.transports, - exceptionHandlers: i.exceptionHandlers - } - } - }) -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(96); - e.exports = { - remove: r(o), - removeSync: o.sync - } -}, function (e) { - (function () { - var n; - e.exports = n = function () { - function e(e) { - this.disposalAction = e - } - return e.prototype.disposed = !1, e.isDisposable = function (e) { - return 'function' == typeof (null == e ? void 0 : e.dispose) - }, e.prototype.dispose = function () { - this.disposed || (this.disposed = !0, 'function' == typeof this.disposalAction && this.disposalAction(), this.disposalAction = null) - }, e - }() - }).call(this) -}, function (e) { - e.exports = require('url') -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(36); - e.exports = { - readJson: r(o.readFile), - readJsonSync: o.readFileSync, - writeJson: r(o.writeFile), - writeJsonSync: o.writeFileSync - } -}, function (e, n, t) { - 'use strict'; - e.exports = Object.assign({}, t(43), t(41), t(37), t(97), t(95), t(89), t(3), t(86), t(85), t(84), t(7), t(16)); - const r = t(5); - Object.getOwnPropertyDescriptor(r, 'promises') && Object.defineProperty(e.exports, 'promises', { - get() { - return r.promises - } - }) -}, function (e, n, t) { - function r(e) { - var n = Array.prototype.slice.call(arguments, 1); - return n.forEach(function (n) { - for (var t = Object.keys(n), r = 0; r < t.length; r++) e[t[r]] = n[t[r]] - }), e - } - var o = t(127); - o.enabled = !0; - var i = n, - a = n.allColors = {}; - i.addColors = function (e) { - r(a, e) - }, i.colorize = function (e, n) { - 'undefined' == typeof n && (n = e); - var t = n; - if (a[e] instanceof Array) - for (var r = 0, i = a[e].length; r < i; ++r) t = o[a[e][r]](t); - else if (a[e].match(/\s/)) { - for (var s = a[e].split(/\s+/), r = 0; r < s.length; ++r) t = o[s[r]](t); - a[e] = s - } else t = o[a[e]](t); - return t - }, i.cli = t(117), i.npm = t(116), i.syslog = t(115), i.addColors(i.cli.colors), i.addColors(i.npm.colors), i.addColors(i.syslog.colors) -}, function (e) { - e.exports = require('child_process') -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(18), - o = t(4); - n.openDirectorySafe = function (e) { - o.shell.openItem(e) - } -}, function (e, n) { - 'use strict'; - - function t(e) { - return e.id || e.label || e.role || 'unknown' - } - - function r(e, n = '@', o = new Set) { - for (const i of e) { - let e = 0, - a = i.id; - if (!a) - do a = `${n}.${t(i)}${e++||''}`; while (o.has(a)); - if (i.id = a, o.add(a), i.submenu) { - const e = i.submenu; - r(e, i.id, o) - } - } - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.ensureItemIds = r -}, function (e, n, t) { - 'use strict'; - - function r(e) { - for (var t in e) n.hasOwnProperty(t) || (n[t] = e[t]) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), r(t(64)), r(t(24)), r(t(60)), r(t(59)) -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.now = function () { - const e = process.hrtime(); - return 1e3 * e[0] + e[1] / 1e6 - } -}, function (e, n) { - 'use strict'; - - function t(e) { - throw new Error(e) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.fatalError = t, n.assertNever = function (e, n) { - throw new Error(n) - }, n.forceUnwrap = function (e, n) { - return null == n ? t(e) : n - } -}, function (e, n) { - 'use strict'; - - function t(e) { - return e.isFullScreen() ? 'full-screen' : e.isMaximized() ? 'maximized' : e.isMinimized() ? 'minimized' : e.isVisible() ? 'normal' : 'hidden' - } - - function r(e, t) { - e.webContents.send(n.windowStateChannelName, t) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.windowStateChannelName = 'window-state-changed', n.getWindowState = t, n.registerWindowStateChangedEvents = function (e) { - e.on('enter-full-screen', () => r(e, 'full-screen')), e.on('leave-full-screen', () => r(e, 'normal')), e.on('maximize', () => r(e, 'maximized')), e.on('minimize', () => r(e, 'minimized')), e.on('unmaximize', () => r(e, 'normal')), e.on('restore', () => r(e, 'normal')), e.on('hide', () => r(e, 'hidden')), e.on('show', () => { - r(e, t(e)) - }) - } -}, function (e, n, t) { - (function () { - n.Emitter = t(70), n.Disposable = t(17), n.CompositeDisposable = t(69) - }).call(this) -}, function (e, n, t) { - function r() { - this._array = [], this._set = a ? new Map : Object.create(null) - } - var o = t(11), - i = Object.prototype.hasOwnProperty, - a = 'undefined' != typeof Map; - r.fromArray = function (e, n) { - for (var t = new r, o = 0, i = e.length; o < i; o++) t.add(e[o], n); - return t - }, r.prototype.size = function () { - return a ? this._set.size : Object.getOwnPropertyNames(this._set).length - }, r.prototype.add = function (e, n) { - var t = a ? e : o.toSetString(e), - r = a ? this.has(e) : i.call(this._set, t), - s = this._array.length; - (!r || n) && this._array.push(e), r || (a ? this._set.set(e, s) : this._set[t] = s) - }, r.prototype.has = function (e) { - if (a) return this._set.has(e); - var n = o.toSetString(e); - return i.call(this._set, n) - }, r.prototype.indexOf = function (e) { - if (a) { - var n = this._set.get(e); - if (0 <= n) return n - } else { - var t = o.toSetString(e); - if (i.call(this._set, t)) return this._set[t] - } - throw new Error('"' + e + '" is not in the set.') - }, r.prototype.at = function (e) { - if (0 <= e && e < this._array.length) return this._array[e]; - throw new Error('No element indexed by ' + e) - }, r.prototype.toArray = function () { - return this._array.slice() - }, n.ArraySet = r -}, function (e, n, t) { - function r(e) { - return 0 > e ? (-e << 1) + 1 : (e << 1) + 0 - } - - function o(e) { - var n = e >> 1; - return 1 == (1 & e) ? -n : n - } - var i = t(78), - a = 5, - s = 1 << a, - d = s - 1, - l = s; - n.encode = function (e) { - var n = '', - t = r(e), - o; - do o = t & d, t >>>= a, 0 < t && (o |= l), n += i.encode(o); while (0 < t); - return n - }, n.decode = function (e, n, t) { - var r = e.length, - s = 0, - c = 0, - p, u; - do { - if (n >= r) throw new Error('Expected more digits in base 64 VLQ value.'); - if (u = i.decode(e.charCodeAt(n++)), -1 === u) throw new Error('Invalid base64 digit: ' + e.charAt(n - 1)); - p = !!(u & l), u &= d, s += u << c, c += a - } while (p); - t.value = o(s), t.rest = n - } -}, function (e, n, t) { - function r(e) { - e || (e = {}), this._file = a.getArg(e, 'file', null), this._sourceRoot = a.getArg(e, 'sourceRoot', null), this._skipValidation = a.getArg(e, 'skipValidation', !1), this._sources = new i, this._names = new i, this._mappings = new s, this._sourcesContents = null - } - var o = t(31), - a = t(11), - i = t(30).ArraySet, - s = t(77).MappingList; - r.prototype._version = 3, r.fromSourceMap = function (e) { - var n = e.sourceRoot, - t = new r({ - file: e.file, - sourceRoot: n - }); - return e.eachMapping(function (e) { - var r = { - generated: { - line: e.generatedLine, - column: e.generatedColumn - } - }; - null != e.source && (r.source = e.source, null != n && (r.source = a.relative(n, r.source)), r.original = { - line: e.originalLine, - column: e.originalColumn - }, null != e.name && (r.name = e.name)), t.addMapping(r) - }), e.sources.forEach(function (n) { - var r = e.sourceContentFor(n); - null != r && t.setSourceContent(n, r) - }), t - }, r.prototype.addMapping = function (e) { - var n = a.getArg(e, 'generated'), - t = a.getArg(e, 'original', null), - r = a.getArg(e, 'source', null), - o = a.getArg(e, 'name', null); - this._skipValidation || this._validateMapping(n, t, r, o), null != r && (r = r + '', !this._sources.has(r) && this._sources.add(r)), null != o && (o = o + '', !this._names.has(o) && this._names.add(o)), this._mappings.add({ - generatedLine: n.line, - generatedColumn: n.column, - originalLine: null != t && t.line, - originalColumn: null != t && t.column, - source: r, - name: o - }) - }, r.prototype.setSourceContent = function (e, n) { - var t = e; - null != this._sourceRoot && (t = a.relative(this._sourceRoot, t)), null == n ? this._sourcesContents && (delete this._sourcesContents[a.toSetString(t)], 0 === Object.keys(this._sourcesContents).length && (this._sourcesContents = null)) : (!this._sourcesContents && (this._sourcesContents = Object.create(null)), this._sourcesContents[a.toSetString(t)] = n) - }, r.prototype.applySourceMap = function (e, n, t) { - var r = n; - if (null == n) { - if (null == e.file) throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.'); - r = e.file - } - var o = this._sourceRoot; - null != o && (r = a.relative(o, r)); - var s = new i, - d = new i; - this._mappings.unsortedForEach(function (n) { - if (n.source === r && null != n.originalLine) { - var i = e.originalPositionFor({ - line: n.originalLine, - column: n.originalColumn - }); - null != i.source && (n.source = i.source, null != t && (n.source = a.join(t, n.source)), null != o && (n.source = a.relative(o, n.source)), n.originalLine = i.line, n.originalColumn = i.column, null != i.name && (n.name = i.name)) - } - var l = n.source; - null == l || s.has(l) || s.add(l); - var c = n.name; - null == c || d.has(c) || d.add(c) - }, this), this._sources = s, this._names = d, e.sources.forEach(function (n) { - var r = e.sourceContentFor(n); - null != r && (null != t && (n = a.join(t, n)), null != o && (n = a.relative(o, n)), this.setSourceContent(n, r)) - }, this) - }, r.prototype._validateMapping = function (e, n, t, r) { - if (n && 'number' != typeof n.line && 'number' != typeof n.column) throw new Error('original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.'); - if (!(e && 'line' in e && 'column' in e && 0 < e.line && 0 <= e.column && !n && !t && !r) && !(e && 'line' in e && 'column' in e && n && 'line' in n && 'column' in n && 0 < e.line && 0 <= e.column && 0 < n.line && 0 <= n.column && t)) throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: e, - source: t, - original: n, - name: r - })) - }, r.prototype._serializeMappings = function () { - for (var e = 0, n = 1, t = 0, r = 0, s = 0, d = 0, l = '', c = this._mappings.toArray(), p = 0, i = c.length, u, m, g, f; p < i; p++) { - if (m = c[p], u = '', m.generatedLine !== n) - for (e = 0; m.generatedLine !== n;) u += ';', n++; - else if (0 < p) { - if (!a.compareByGeneratedPositionsInflated(m, c[p - 1])) continue; - u += ',' - } - u += o.encode(m.generatedColumn - e), e = m.generatedColumn, null != m.source && (f = this._sources.indexOf(m.source), u += o.encode(f - d), d = f, u += o.encode(m.originalLine - 1 - r), r = m.originalLine - 1, u += o.encode(m.originalColumn - t), t = m.originalColumn, null != m.name && (g = this._names.indexOf(m.name), u += o.encode(g - s), s = g)), l += u - } - return l - }, r.prototype._generateSourcesContent = function (e, n) { - return e.map(function (e) { - if (!this._sourcesContents) return null; - null != n && (e = a.relative(n, e)); - var t = a.toSetString(e); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, t) ? this._sourcesContents[t] : null - }, this) - }, r.prototype.toJSON = function () { - var e = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() + return n + } + + function h(e) { + for (var t in e) ! function (t) { + r[t] = function (n) { + return r[e[t]](n) + } + }(t) + } + r.setTheme = function (e) { + if ("string" == typeof e) try { + return r.themes[e] = n(64)(e), h(r.themes[e]), r.themes[e] + } catch (e) { + return console.log(e), e + } else h(e) }; - return null != this._file && (e.file = this._file), null != this._sourceRoot && (e.sourceRoot = this._sourceRoot), this._sourcesContents && (e.sourcesContent = this._generateSourcesContent(e.sources, e.sourceRoot)), e - }, r.prototype.toString = function () { - return JSON.stringify(this.toJSON()) - }, n.SourceMapGenerator = r -}, function (e, n, t) { - 'use strict'; - - function r(e) { - if (!c.some((n) => e.endsWith(n))) return null; - e.startsWith('file://') && (e = d(e)); - const n = `${e}.map`; - if (!1, !!s.existsSync(n)) try { - const e = s.readFileSync(n, 'utf8'); - return { - url: a.basename(n), - map: e - } - } catch (e) {} - } - - function o(e, n) { - return p.set(e, n), e + n.map((e) => `\n at ${e}`).join('') - } - - function i(e) { - let n = p.get(e); - return n || ((e.stack || '').toString(), n = p.get(e)), n ? u(e, n) : e.stack - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const a = t(0), - s = t(5), - d = t(81), - l = t(80), - c = ['renderer.js', 'main.js'], - p = new WeakMap; - let u; - n.enableSourceMaps = function () { - l.install({ - environment: 'node', - handleUncaughtExceptions: !1, - retrieveSourceMap: r - }); - const e = Error; - u = e.prepareStackTrace, e.prepareStackTrace = o - }, n.withSourceMappedStack = function (e) { - return { - name: e.name, - message: e.message, - stack: i(e) - } - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(33); - n.formatError = function (e, n) { - return e = r.withSourceMappedStack(e), e.stack ? n ? `${n}\n${e.stack}` : e.stack.trim() : n ? `${n}\n${e.name}: ${e.message}` : `${e.name}: ${e.message}` - } -}, function (e, n, t) { - function r(e, n, t, s) { - 'function' == typeof n ? (t = n, n = {}) : (!n || 'object' != typeof n) && (n = { - mode: n - }); - var d = n.mode, - l = n.fs || i; - d === void 0 && (d = a & ~process.umask()), s || (s = null); - var c = t || function () {}; - e = o.resolve(e), l.mkdir(e, d, function (t) { - if (!t) return s = s || e, c(null, s); - switch (t.code) { - case 'ENOENT': - r(o.dirname(e), n, function (t, o) { - t ? c(t, o) : r(e, n, c, o) - }); - break; - default: - l.stat(e, function (e, n) { - e || !n.isDirectory() ? c(t, s) : c(null, s) - }); - } - }) - } - var o = t(0), - i = t(5), - a = parseInt('0777', 8); - e.exports = r.mkdirp = r.mkdirP = r, r.sync = function e(n, t, r) { - t && 'object' == typeof t || (t = { - mode: t - }); - var s = t.mode, - d = t.fs || i; - s === void 0 && (s = a & ~process.umask()), r || (r = null), n = o.resolve(n); - try { - d.mkdirSync(n, s), r = r || n - } catch (i) { - switch (i.code) { - case 'ENOENT': - r = e(o.dirname(n), t, r), e(n, t, r); - break; - default: - var l; - try { - l = d.statSync(n) - } catch (e) { - throw i - } - if (!l.isDirectory()) throw i; - } - } - return r - } -}, function (e, n, t) { - function r(e, n, t) { - null == t && (t = n, n = {}), 'string' == typeof n && (n = { - encoding: n - }), n = n || {}; - var r = n.fs || l, - o = !0; - 'throws' in n && (o = n.throws), r.readFile(e, n, function (r, i) { - if (r) return t(r); - i = d(i); - var a; - try { - a = JSON.parse(i, n ? n.reviver : null) - } catch (n) { - return o ? (n.message = e + ': ' + n.message, t(n)) : t(null, null) - } - t(null, a) - }) - } + var p = function (e, t) { + var n = t.split(""); + return (n = n.map(e)).join("") + }; + for (var d in r.trap = n(65), r.zalgo = n(66), r.maps = {}, r.maps.america = n(67), r.maps.zebra = n(68), r.maps.rainbow = n(69), r.maps.random = n(70), r.maps) ! function (e) { + r[e] = function (t) { + return p(r.maps[e], t) + } + }(d); + o(r, function () { + var e = {}; + return Object.keys(l).forEach((function (t) { + e[t] = { + get: function () { + return a([t]) + } + } + })), e + }()) +}, function (e, t, n) { + var r = n(14), + i = n(7), + o = t.Transport = function (e) { + r.EventEmitter.call(this), e = e || {}, this.silent = e.silent || !1, this.raw = e.raw || !1, this.name = e.name || this.name, this.formatter = e.formatter, this.level = e.level, this.handleExceptions = e.handleExceptions || !1, this.exceptionsLevel = e.exceptionsLevel || "error", this.humanReadableUnhandledException = e.humanReadableUnhandledException || !1 + }; + i.inherits(o, r.EventEmitter), o.prototype.formatQuery = function (e) { + return e + }, o.prototype.normalizeQuery = function (e) { + return (e = e || {}).rows = e.rows || e.limit || 10, e.start = e.start || 0, e.until = e.until || new Date, "object" != typeof e.until && (e.until = new Date(e.until)), e.from = e.from || e.until - 864e5, "object" != typeof e.from && (e.from = new Date(e.from)), e.order = e.order || "desc", e.fields = e.fields, e + }, o.prototype.formatResults = function (e, t) { + return e + }, o.prototype.logException = function (e, t, n) { + var r, i = this; + if (this.silent) return n(); + + function o() { + r || (r = !0, i.removeListener("logged", o), i.removeListener("error", o), n()) + } + this.once("logged", o), this.once("error", o), this.log(i.exceptionsLevel, e, t, (function () {})) + } +}, function (e, t) { + t.getArg = function (e, t, n) { + if (t in e) return e[t]; + if (3 === arguments.length) return n; + throw new Error('"' + t + '" is a required argument.') + }; + var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/, + r = /^data:.+\,.+$/; + + function i(e) { + var t = e.match(n); + return t ? { + scheme: t[1], + auth: t[2], + host: t[3], + port: t[4], + path: t[5] + } : null + } - function o(e, n) { - n = n || {}, 'string' == typeof n && (n = { - encoding: n - }); - var t = n.fs || l, - r = !0; - 'throws' in n && (r = n.throws); - try { - var o = t.readFileSync(e, n); - return o = d(o), JSON.parse(o, n.reviver) - } catch (n) { - if (r) throw n.message = e + ': ' + n.message, n; - else return null - } - } - - function i(e, n) { - var t = '\n', - r; - 'object' == typeof n && null !== n && (n.spaces && (r = n.spaces), n.EOL && (t = n.EOL)); - var o = JSON.stringify(e, n ? n.replacer : null, r); - return o.replace(/\n/g, t) + t - } - - function a(e, n, t, r) { - null == r && (r = t, t = {}), t = t || {}; - var o = t.fs || l, - a = ''; - try { - a = i(n, t) - } catch (e) { - return void(r && r(e, null)) - } - o.writeFile(e, a, t, r) - } - - function s(e, n, t) { - t = t || {}; - var r = t.fs || l, - o = i(n, t); - return r.writeFileSync(e, o, t) - } - - function d(e) { - return Buffer.isBuffer(e) && (e = e.toString('utf8')), e = e.replace(/^\uFEFF/, ''), e - } - var l; - try { - l = t(1) - } catch (e) { - l = t(5) - } - e.exports = { - readFile: r, - readFileSync: o, - writeFile: a, - writeFileSync: s - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback; - e.exports = { - copy: r(t(98)) - } -}, function (e) { - 'use strict'; - e.exports = function (e) { - if ('function' == typeof Buffer.allocUnsafe) try { - return Buffer.allocUnsafe(e) - } catch (n) { - return new Buffer(e) - } - return new Buffer(e) - } -}, function (e, n, t) { - 'use strict'; - var r = Math.floor; - const o = t(1), - i = t(10), - a = t(0); - e.exports = { - hasMillisRes: function (e) { - let n = a.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)); - n = a.join(i.tmpdir(), n); - const t = new Date(1435410243862); - o.writeFile(n, 'https://github.com/jprichardson/node-fs-extra/pull/141', (r) => r ? e(r) : void o.open(n, 'r+', (r, i) => r ? e(r) : void o.futimes(i, t, t, (t) => t ? e(t) : void o.close(i, (t) => t ? e(t) : void o.stat(n, (n, t) => n ? e(n) : void e(null, 1435410243e3 < t.mtime)))))) - }, - hasMillisResSync: function () { - let e = a.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)); - e = a.join(i.tmpdir(), e); - const n = new Date(1435410243862); - o.writeFileSync(e, 'https://github.com/jprichardson/node-fs-extra/pull/141'); - const t = o.openSync(e, 'r+'); - return o.futimesSync(t, n, n), o.closeSync(t), 1435410243e3 < o.statSync(e).mtime - }, - timeRemoveMillis: function (e) { - if ('number' == typeof e) return 1e3 * r(e / 1e3); - if (e instanceof Date) return new Date(1e3 * r(e.getTime() / 1e3)); - throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') - }, - utimesMillis: function (e, n, t, r) { - o.open(e, 'r+', (e, i) => e ? r(e) : void o.futimes(i, n, t, (e) => { - o.close(i, (n) => { - r && r(e || n) - }) - })) - }, - utimesMillisSync: function (e, n, t) { - const r = o.openSync(e, 'r+'); - return o.futimesSync(r, n, t), o.closeSync(r) - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e) { - return e = o.normalize(o.resolve(e)).split(o.sep), 0 < e.length ? e[0] : null - } - const o = t(0), - i = /[<>:"|?*]/; - e.exports = { - getRootPath: r, - invalidWin32Path: function (e) { - const n = r(e); - return e = e.replace(n, ''), i.test(e) - } - } -}, function (e, n, t) { - 'use strict'; - e.exports = { - copySync: t(101) - } -}, function (e) { - e.exports = require('assert') -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(1), - i = ['access', 'appendFile', 'chmod', 'chown', 'close', 'copyFile', 'fchmod', 'fchown', 'fdatasync', 'fstat', 'fsync', 'ftruncate', 'futimes', 'lchown', 'lchmod', 'link', 'lstat', 'mkdir', 'mkdtemp', 'open', 'readFile', 'readdir', 'readlink', 'realpath', 'rename', 'rmdir', 'stat', 'symlink', 'truncate', 'unlink', 'utimes', 'writeFile'].filter((e) => 'function' == typeof o[e]); - Object.keys(o).forEach((e) => { - 'promises' === e || (n[e] = o[e]) - }), i.forEach((e) => { - n[e] = r(o[e]) - }), n.exists = function (e, n) { - return 'function' == typeof n ? o.exists(e, n) : new Promise((n) => o.exists(e, n)) - }, n.read = function (e, n, t, r, i, a) { - return 'function' == typeof a ? o.read(e, n, t, r, i, a) : new Promise((a, s) => { - o.read(e, n, t, r, i, (e, n, t) => e ? s(e) : void a({ - bytesRead: n, - buffer: t - })) - }) - }, n.write = function (e, n, ...t) { - return 'function' == typeof t[t.length - 1] ? o.write(e, n, ...t) : new Promise((r, i) => { - o.write(e, n, ...t, (e, n, t) => e ? i(e) : void r({ - bytesWritten: n, - buffer: t - })) - }) - } -}, function (e, n, t) { - 'use strict'; - - function r() { - if (!a) { - const e = i.app.getPath('userData'); - a = o.join(e, 'logs') - } - return a - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(0), - i = t(4); - let a = null; - n.getLogDirectoryPath = r -}, function (e, n, t) { - var r = t(10), - o = t(108), - i = n; - i.getAllInfo = function (e) { - return { - date: new Date().toString(), - process: i.getProcessInfo(), - os: i.getOsInfo(), - trace: i.getTrace(e), - stack: e.stack && e.stack.split('\n') - } - }, i.getProcessInfo = function () { - return { - pid: process.pid, - uid: process.getuid ? process.getuid() : null, - gid: process.getgid ? process.getgid() : null, - cwd: process.cwd(), - execPath: process.execPath, - version: process.version, - argv: process.argv, - memoryUsage: process.memoryUsage() - } - }, i.getOsInfo = function () { - return { - loadavg: r.loadavg(), - uptime: r.uptime() - } - }, i.getTrace = function (e) { - var n = e ? o.parse(e) : o.get(); - return n.map(function (e) { - return { - column: e.getColumnNumber(), - file: e.getFileName(), - function: e.getFunctionName(), - line: e.getLineNumber(), - method: e.getMethodName(), - native: e.isNative() - } - }) - } -}, function (e) { - e.exports = require('zlib') -}, function (e, n) { - var t, r; - /*! - * async - * https://github.com/caolan/async - * - * Copyright 2010-2014 Caolan McMahon - * Released under the MIT license - */ - (function () { function o(e) { - var n = !1; - return function () { - if (n) throw new Error('Callback was already called.'); - n = !0, e.apply(s, arguments) - } - } - var a = {}, - i = function () {}, - s, d; - s = 'object' == typeof window && this === window ? window : 'object' == typeof global && this === global ? global : this, null != s && (d = s.async), a.noConflict = function () { - return s.async = d, a + var t = ""; + return e.scheme && (t += e.scheme + ":"), t += "//", e.auth && (t += e.auth + "@"), e.host && (t += e.host), e.port && (t += ":" + e.port), e.path && (t += e.path), t + } + + function s(e) { + var n = e, + r = i(e); + if (r) { + if (!r.path) return e; + n = r.path + } + for (var s, a = t.isAbsolute(n), c = n.split(/\/+/), l = 0, u = c.length - 1; u >= 0; u--) "." === (s = c[u]) ? c.splice(u, 1) : ".." === s ? l++ : l > 0 && ("" === s ? (c.splice(u + 1, l), l = 0) : (c.splice(u, 2), l--)); + return "" === (n = c.join("/")) && (n = a ? "/" : "."), r ? (r.path = n, o(r)) : n + } + t.urlParse = i, t.urlGenerate = o, t.normalize = s, t.join = function (e, t) { + "" === e && (e = "."), "" === t && (t = "."); + var n = i(t), + a = i(e); + if (a && (e = a.path || "/"), n && !n.scheme) return a && (n.scheme = a.scheme), o(n); + if (n || t.match(r)) return t; + if (a && !a.host && !a.path) return a.host = t, o(a); + var c = "/" === t.charAt(0) ? t : s(e.replace(/\/+$/, "") + "/" + t); + return a ? (a.path = c, o(a)) : c + }, t.isAbsolute = function (e) { + return "/" === e.charAt(0) || !!e.match(n) + }, t.relative = function (e, t) { + "" === e && (e = "."), e = e.replace(/\/$/, ""); + for (var n = 0; 0 !== t.indexOf(e + "/");) { + var r = e.lastIndexOf("/"); + if (r < 0) return t; + if ((e = e.slice(0, r)).match(/^([^\/]+:\/)?\/*$/)) return t; + ++n + } + return Array(n + 1).join("../") + t.substr(e.length + 1) }; - var l = Object.prototype.toString, - c = Array.isArray || function (e) { - return '[object Array]' === l.call(e) - }, - p = function (e, n) { - for (var t = -1, r = e.length; ++t < r;) n(e[t], t, e) - }, - u = function (e, n) { - for (var t = -1, r = e.length, o = Array(r); ++t < r;) o[t] = n(e[t], t, e); + var a = !("__proto__" in Object.create(null)); + + function c(e) { + return e + } + + function l(e) { + if (!e) return !1; + var t = e.length; + if (t < 9) return !1; + if (95 !== e.charCodeAt(t - 1) || 95 !== e.charCodeAt(t - 2) || 111 !== e.charCodeAt(t - 3) || 116 !== e.charCodeAt(t - 4) || 111 !== e.charCodeAt(t - 5) || 114 !== e.charCodeAt(t - 6) || 112 !== e.charCodeAt(t - 7) || 95 !== e.charCodeAt(t - 8) || 95 !== e.charCodeAt(t - 9)) return !1; + for (var n = t - 10; n >= 0; n--) + if (36 !== e.charCodeAt(n)) return !1; + return !0 + } + + function u(e, t) { + return e === t ? 0 : e > t ? 1 : -1 + } + t.toSetString = a ? c : function (e) { + return l(e) ? "$" + e : e + }, t.fromSetString = a ? c : function (e) { + return l(e) ? e.slice(1) : e + }, t.compareByOriginalPositions = function (e, t, n) { + var r = e.source - t.source; + return 0 !== r || 0 !== (r = e.originalLine - t.originalLine) || 0 !== (r = e.originalColumn - t.originalColumn) || n || 0 !== (r = e.generatedColumn - t.generatedColumn) || 0 !== (r = e.generatedLine - t.generatedLine) ? r : e.name - t.name + }, t.compareByGeneratedPositionsDeflated = function (e, t, n) { + var r = e.generatedLine - t.generatedLine; + return 0 !== r || 0 !== (r = e.generatedColumn - t.generatedColumn) || n || 0 !== (r = e.source - t.source) || 0 !== (r = e.originalLine - t.originalLine) || 0 !== (r = e.originalColumn - t.originalColumn) ? r : e.name - t.name + }, t.compareByGeneratedPositionsInflated = function (e, t) { + var n = e.generatedLine - t.generatedLine; + return 0 !== n || 0 !== (n = e.generatedColumn - t.generatedColumn) || 0 !== (n = u(e.source, t.source)) || 0 !== (n = e.originalLine - t.originalLine) || 0 !== (n = e.originalColumn - t.originalColumn) ? n : u(e.name, t.name) + } +}, function (e, t) { + e.exports = require("url") +}, function (e, t, n) { + "use strict"; + n.d(t, "a", (function () { + return i + })); + n(18); + var r = n(0); + + function i(e) { + { + const t = e.endsWith("\\") ? e : e + "\\"; + r.shell.openPath(t).then(t => { + "" !== t && log.error(`Failed to open directory (${e}): ${t}`) + }) + } + } +}, function (e, t, n) { + "use strict"; + Object.defineProperty(t, "__esModule", { + value: !0 + }), + function (e) { + for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) + }(n(118)) +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(91); + e.exports = { + remove: r(i), + removeSync: i.sync + } +}, function (e, t, n) { + "use strict"; + + function r(e) { + return e.id || e.label || e.role || "unknown" + } + + function i(e, t = "@", n = new Set) { + for (const o of e) { + let e = 0, + s = o.id; + if (!s) + do { + s = `${t}.${r(o)}${e++||""}` + } while (n.has(s)); + if (o.id = s, n.add(s), o.submenu) { + i(o.submenu, o.id, n) + } + } + } + n.d(t, "a", (function () { + return i + })) +}, function (e, t, n) { + "use strict"; + n.d(t, "a", (function () { + return s + })); + var r = n(1), + i = n(0); + let o = null; + + function s() { + if (!o) { + const e = i.app.getPath("userData"); + o = r.join(e, "logs") + } return o - }, - m = function (e, n, t) { - return p(e, function (e, r, o) { - t = n(t, e, r, o) - }), t - }, - g = function (e, n) { - p(f(e), function (t) { - n(e[t], t) - }) - }, - f = Object.keys || function (e) { - var n = []; - for (var t in e) e.hasOwnProperty(t) && n.push(t); + } +}, function (e, t, n) { + (function () { + t.Emitter = n(116), t.Disposable = n(29), t.CompositeDisposable = n(117) + }).call(this) +}, function (e, t) { + e.exports = require("child_process") +}, function (e, t, n) { + var r = n(61); + r.enabled = !0; + var i = t, + o = t.allColors = {}; + i.addColors = function (e) { + ! function (e) { + var t = Array.prototype.slice.call(arguments, 1); + t.forEach((function (t) { + for (var n = Object.keys(t), r = 0; r < n.length; r++) e[n[r]] = t[n[r]] + })) + }(o, e) + }, i.colorize = function (e, t) { + void 0 === t && (t = e); + var n = t; + if (o[e] instanceof Array) + for (var i = 0, s = o[e].length; i < s; ++i) n = r[o[e][i]](n); + else if (o[e].match(/\s/)) { + var a = o[e].split(/\s+/); + for (i = 0; i < a.length; ++i) n = r[a[i]](n); + o[e] = a + } else n = r[o[e]](n); return n - }, - h = function (e, n) { - n = n || 0; - var t = -1, - r = e.length; - n && (r -= n, r = 0 > r ? 0 : r); - for (var o = Array(r); ++t < r;) o[t] = e[t + n]; - return o - }, - y; - 'function' == typeof setImmediate && (y = setImmediate), 'undefined' != typeof process && process.nextTick ? (a.nextTick = process.nextTick, a.setImmediate = y ? function (e) { - y(e) - } : a.nextTick) : y ? (a.nextTick = function (e) { - y(e) - }, a.setImmediate = a.nextTick) : (a.nextTick = function (e) { - setTimeout(e, 0) - }, a.setImmediate = a.nextTick), a.each = function (e, n, t) { - function r(n) { - n ? (t(n), t = i) : (a += 1, a >= e.length && t()) - } - if (t = t || i, !e.length) return t(); - var a = 0; - p(e, function (e) { - n(e, o(r)) - }) - }, a.forEach = a.each, a.eachSeries = function (e, n, t) { - if (t = t || i, !e.length) return t(); - var r = 0, - o = function () { - n(e[r], function (n) { - n ? (t(n), t = i) : (r += 1, r >= e.length ? t() : o()) - }) + }, i.cli = n(71), i.npm = n(72), i.syslog = n(73), i.addColors(i.cli.colors), i.addColors(i.npm.colors), i.addColors(i.syslog.colors) +}, function (e, t) { + e.exports = require("assert") +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(40); + e.exports = { + readJson: r(i.readFile), + readJsonSync: i.readFileSync, + writeJson: r(i.writeFile), + writeJsonSync: i.writeFileSync + } +}, function (e, t) { + (function () { + e.exports = function () { + function e(e) { + this.disposalAction = e + } + return e.prototype.disposed = !1, e.isDisposable = function (e) { + return "function" == typeof (null != e ? e.dispose : void 0) + }, e.prototype.dispose = function () { + this.disposed || (this.disposed = !0, "function" == typeof this.disposalAction && this.disposalAction(), this.disposalAction = null) + }, e + }() + }).call(this) +}, function (e, t, n) { + var r; + /*! + * async + * https://github.com/caolan/async + * + * Copyright 2010-2014 Caolan McMahon + * Released under the MIT license + */ + ! function () { + var n, i, o = {}, + s = function () {}; + + function a(e) { + var t = !1; + return function () { + if (t) throw new Error("Callback was already called."); + t = !0, e.apply(n, arguments) + } + } + null != (n = "object" == typeof window && this === window ? window : "object" == typeof global && this === global ? global : this) && (i = n.async), o.noConflict = function () { + return n.async = i, o }; - o() - }, a.forEachSeries = a.eachSeries, a.eachLimit = function (e, n, t, r) { - var o = _(n); - o.apply(null, [e, t, r]) - }, a.forEachLimit = a.eachLimit; - var _ = function (e) { - return function (n, t, r) { - if (r = r || i, !n.length || 0 >= e) return r(); - var o = 0, - a = 0, - s = 0; - (function d() { - if (o >= n.length) return r(); - for (; s < e && a < n.length;) a += 1, s += 1, t(n[a - 1], function (e) { - e ? (r(e), r = i) : (o += 1, s -= 1, o >= n.length ? r() : d()) - }) - })() - } - }; - a.forEachOf = a.eachOf = function (e, n, t) { - t = t || function () {}; - var r = e.length || f(e).length, - o = 0; - return r ? void g(e, function (i, a) { - n(e[a], a, function (e) { - e ? (t(e), t = function () {}) : (o += 1, o === r && t(null)) - }) - }) : t() - }, a.forEachOfSeries = a.eachOfSeries = function (e, n, t) { - t = t || function () {}; - var r = f(e), - o = r.length; - if (!o) return t(); - var i = 0, - s = function () { - var d = !0, - l = r[i]; - n(e[l], l, function (e) { - e ? (t(e), t = function () {}) : (i += 1, i >= o ? t(null) : d ? a.nextTick(s) : s()) - }), d = !1 + var c, l = Object.prototype.toString, + u = Array.isArray || function (e) { + return "[object Array]" === l.call(e) + }, + f = function (e, t) { + for (var n = -1, r = e.length; ++n < r;) t(e[n], n, e) + }, + h = function (e, t) { + for (var n = -1, r = e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e); + return i + }, + p = Object.keys || function (e) { + var t = []; + for (var n in e) e.hasOwnProperty(n) && t.push(n); + return t + }, + d = function (e, t) { + t = t || 0; + var n = -1, + r = e.length; + t && (r = (r -= t) < 0 ? 0 : r); + for (var i = Array(r); ++n < r;) i[n] = e[n + t]; + return i + }; + "function" == typeof setImmediate && (c = setImmediate), "undefined" != typeof process && process.nextTick ? (o.nextTick = process.nextTick, o.setImmediate = c ? function (e) { + c(e) + } : o.nextTick) : c ? (o.nextTick = function (e) { + c(e) + }, o.setImmediate = o.nextTick) : (o.nextTick = function (e) { + setTimeout(e, 0) + }, o.setImmediate = o.nextTick), o.each = function (e, t, n) { + if (n = n || s, !e.length) return n(); + var r = 0; + + function i(t) { + t ? (n(t), n = s) : (r += 1) >= e.length && n() + } + f(e, (function (e) { + t(e, a(i)) + })) + }, o.forEach = o.each, o.eachSeries = function (e, t, n) { + if (n = n || s, !e.length) return n(); + var r = 0, + i = function () { + t(e[r], (function (t) { + t ? (n(t), n = s) : (r += 1) >= e.length ? n() : i() + })) + }; + i() + }, o.forEachSeries = o.eachSeries, o.eachLimit = function (e, t, n, r) { + m(t).apply(null, [e, n, r]) + }, o.forEachLimit = o.eachLimit; + var m = function (e) { + return function (t, n, r) { + if (r = r || s, !t.length || e <= 0) return r(); + var i = 0, + o = 0, + a = 0; + ! function c() { + if (i >= t.length) return r(); + for (; a < e && o < t.length;) a += 1, n(t[(o += 1) - 1], (function (e) { + e ? (r(e), r = s) : (a -= 1, (i += 1) >= t.length ? r() : c()) + })) + }() + } }; - s() - }, a.forEachOfLimit = a.eachOfLimit = function (e, n, t, r) { - b(n)(e, t, r) - }; - var b = function (e) { - return function (n, t, r) { - r = r || function () {}; - var o = f(n), - i = o.length; - if (!i || 0 >= e) return r(); - var a = 0, - s = 0, - d = 0; - (function l() { - if (a >= i) return r(); - for (; d < e && s < i;) { - s += 1, d += 1; - var c = o[s - 1]; - t(n[c], c, function (e) { - e ? (r(e), r = function () {}) : (a += 1, d -= 1, a >= i ? r() : l()) - }) + o.forEachOf = o.eachOf = function (e, t, n) { + n = n || function () {}; + var r = e.length || p(e).length, + i = 0; + if (!r) return n(); + ! function (e, t) { + f(p(e), (function (n) { + t(e[n], n) + })) + }(e, (function (o, s) { + t(e[s], s, (function (e) { + e ? (n(e), n = function () {}) : (i += 1) === r && n(null) + })) + })) + }, o.forEachOfSeries = o.eachOfSeries = function (e, t, n) { + n = n || function () {}; + var r = p(e), + i = r.length; + if (!i) return n(); + var s = 0, + a = function () { + var c = !0, + l = r[s]; + t(e[l], l, (function (e) { + e ? (n(e), n = function () {}) : (s += 1) >= i ? n(null) : c ? o.nextTick(a) : a() + })), c = !1 + }; + a() + }, o.forEachOfLimit = o.eachOfLimit = function (e, t, n, r) { + g(t)(e, n, r) + }; + var g = function (e) { + return function (t, n, r) { + r = r || function () {}; + var i = p(t), + o = i.length; + if (!o || e <= 0) return r(); + var s = 0, + a = 0, + c = 0; + ! function l() { + if (s >= o) return r(); + for (; c < e && a < o;) { + c += 1; + var u = i[(a += 1) - 1]; + n(t[u], u, (function (e) { + e ? (r(e), r = function () {}) : (c -= 1, (s += 1) >= o ? r() : l()) + })) + } + }() + } + }, + y = function (e) { + return function () { + var t = d(arguments); + return e.apply(null, [o.each].concat(t)) + } + }, + v = function (e) { + return function () { + var t = d(arguments); + return e.apply(null, [o.eachSeries].concat(t)) + } + }, + w = function (e, t, n, r) { + if (t = h(t, (function (e, t) { + return { + index: t, + value: e + } + })), r) { + var i = []; + e(t, (function (e, t) { + n(e.value, (function (n, r) { + i[e.index] = r, t(n) + })) + }), (function (e) { + r(e, i) + })) + } else e(t, (function (e, t) { + n(e.value, (function (e) { + t(e) + })) + })) + }; + o.map = y(w), o.mapSeries = v(w), o.mapLimit = function (e, t, n, r) { + return b(t)(e, n, r) + }; + var b = function (e) { + return function (e, t) { + return function () { + var n = d(arguments); + return t.apply(null, [m(e)].concat(n)) + } + }(e, w) + }; + o.reduce = function (e, t, n, r) { + o.eachSeries(e, (function (e, r) { + n(t, e, (function (e, n) { + t = n, r(e) + })) + }), (function (e) { + r(e, t) + })) + }, o.inject = o.reduce, o.foldl = o.reduce, o.reduceRight = function (e, t, n, r) { + var i = h(e, (function (e) { + return e + })).reverse(); + o.reduce(i, t, n, r) + }, o.foldr = o.reduceRight; + var _ = function (e, t, n, r) { + var i = []; + e(t = h(t, (function (e, t) { + return { + index: t, + value: e + } + })), (function (e, t) { + n(e.value, (function (n) { + n && i.push(e), t() + })) + }), (function (e) { + r(h(i.sort((function (e, t) { + return e.index - t.index + })), (function (e) { + return e.value + }))) + })) + }; + o.filter = y(_), o.filterSeries = v(_), o.select = o.filter, o.selectSeries = o.filterSeries; + var E = function (e, t, n, r) { + var i = []; + e(t = h(t, (function (e, t) { + return { + index: t, + value: e + } + })), (function (e, t) { + n(e.value, (function (n) { + n || i.push(e), t() + })) + }), (function (e) { + r(h(i.sort((function (e, t) { + return e.index - t.index + })), (function (e) { + return e.value + }))) + })) + }; + o.reject = y(E), o.rejectSeries = v(E); + var S = function (e, t, n, r) { + e(t, (function (e, t) { + n(e, (function (n) { + n ? (r(e), r = s) : t() + })) + }), (function (e) { + r() + })) + }; + o.detect = y(S), o.detectSeries = v(S), o.some = function (e, t, n) { + o.each(e, (function (e, r) { + t(e, (function (e) { + e && (n(!0), n = s), r() + })) + }), (function (e) { + n(!1) + })) + }, o.any = o.some, o.every = function (e, t, n) { + o.each(e, (function (e, r) { + t(e, (function (e) { + e || (n(!1), n = s), r() + })) + }), (function (e) { + n(!0) + })) + }, o.all = o.every, o.sortBy = function (e, t, n) { + o.map(e, (function (e, n) { + t(e, (function (t, r) { + t ? n(t) : n(null, { + value: e, + criteria: r + }) + })) + }), (function (e, t) { + if (e) return n(e); + n(null, h(t.sort((function (e, t) { + var n = e.criteria, + r = t.criteria; + return n < r ? -1 : n > r ? 1 : 0 + })), (function (e) { + return e.value + }))) + })) + }, o.auto = function (e, t) { + t = t || s; + var n = p(e), + r = n.length; + if (!r) return t(); + var i = {}, + a = [], + c = function (e) { + a.unshift(e) + }, + l = function () { + r--, f(a.slice(0), (function (e) { + e() + })) + }; + c((function () { + if (!r) { + var e = t; + t = s, e(null, i) + } + })), f(n, (function (n) { + for (var r, h = u(e[n]) ? e[n] : [e[n]], m = function (e) { + var r = d(arguments, 1); + if (r.length <= 1 && (r = r[0]), e) { + var a = {}; + f(p(i), (function (e) { + a[e] = i[e] + })), a[n] = r, t(e, a), t = s + } else i[n] = r, o.setImmediate(l) + }, g = h.slice(0, Math.abs(h.length - 1)) || [], y = g.length; y--;) { + if (!(r = e[g[y]])) throw new Error("Has inexistant dependency"); + if (u(r) && ~r.indexOf(n)) throw new Error("Has cyclic dependencies") + } + var v = function () { + return e = function (e, t) { + return e && i.hasOwnProperty(t) + }, t = !0, f(g, (function (n, r, i) { + t = e(t, n, r, i) + })), t && !i.hasOwnProperty(n); + var e, t + }; + if (v()) h[h.length - 1](m, i); + else { + var w = function () { + v() && (! function (e) { + for (var t = 0; t < a.length; t += 1) + if (a[t] === e) return void a.splice(t, 1) + }(w), h[h.length - 1](m, i)) + }; + c(w) + } + })) + }, o.retry = function (e, t, n) { + var r = []; + "function" == typeof e && (n = t, t = e, e = 5), e = parseInt(e, 10) || 5; + var i = function (i, s) { + for (var a = function (e, t) { + return function (n) { + e((function (e, r) { + n(!e || t, { + err: e, + result: r + }) + }), s) + } + }; e;) r.push(a(t, !(e -= 1))); + o.series(r, (function (e, t) { + t = t[t.length - 1], (i || n)(t.err, t.result) + })) + }; + return n ? i() : i + }, o.waterfall = function (e, t) { + if (t = t || s, !u(e)) { + var n = new Error("First argument to waterfall must be an array of functions"); + return t(n) } - })() - } - }, - S = function (e) { - return function () { - var n = h(arguments); - return e.apply(null, [a.each].concat(n)) - } - }, - w = function (e, n) { - return function () { - var t = h(arguments); - return n.apply(null, [_(e)].concat(t)) - } - }, - v = function (e) { - return function () { - var n = h(arguments); - return e.apply(null, [a.eachSeries].concat(n)) - } - }, - x = function (e, n, t, r) { - if (n = u(n, function (e, n) { - return { - index: n, - value: e + if (!e.length) return t(); + var r = function (e) { + return function (n) { + if (n) t.apply(null, arguments), t = s; + else { + var i = d(arguments, 1), + a = e.next(); + a ? i.push(r(a)) : i.push(t), o.setImmediate((function () { + e.apply(null, i) + })) + } + } + }; + r(o.iterator(e))() + }; + var x = function (e, t, n) { + if (n = n || s, u(t)) e.map(t, (function (e, t) { + e && e((function (e) { + var n = d(arguments, 1); + n.length <= 1 && (n = n[0]), t.call(null, e, n) + })) + }), n); + else { + var r = {}; + e.each(p(t), (function (e, n) { + t[e]((function (t) { + var i = d(arguments, 1); + i.length <= 1 && (i = i[0]), r[e] = i, n(t) + })) + }), (function (e) { + n(e, r) + })) } - }), !r) e(n, function (e, n) { - t(e.value, function (e) { - n(e) - }) - }); - else { - var o = []; - e(n, function (e, n) { - t(e.value, function (t, r) { - o[e.index] = r, n(t) - }) - }, function (e) { - r(e, o) - }) + }; + o.parallel = function (e, t) { + x({ + map: o.map, + each: o.each + }, e, t) + }, o.parallelLimit = function (e, t, n) { + x({ + map: b(t), + each: m(t) + }, e, n) + }, o.series = function (e, t) { + if (t = t || s, u(e)) o.mapSeries(e, (function (e, t) { + e && e((function (e) { + var n = d(arguments, 1); + n.length <= 1 && (n = n[0]), t.call(null, e, n) + })) + }), t); + else { + var n = {}; + o.eachSeries(p(e), (function (t, r) { + e[t]((function (e) { + var i = d(arguments, 1); + i.length <= 1 && (i = i[0]), n[t] = i, r(e) + })) + }), (function (e) { + t(e, n) + })) + } + }, o.iterator = function (e) { + var t = function (n) { + var r = function () { + return e.length && e[n].apply(null, arguments), r.next() + }; + return r.next = function () { + return n < e.length - 1 ? t(n + 1) : null + }, r + }; + return t(0) + }, o.apply = function (e) { + var t = d(arguments, 1); + return function () { + return e.apply(null, t.concat(d(arguments))) + } + }; + var C = function (e, t, n, r) { + var i = []; + e(t, (function (e, t) { + n(e, (function (e, n) { + i = i.concat(n || []), t(e) + })) + }), (function (e) { + r(e, i) + })) + }; + o.concat = y(C), o.concatSeries = v(C), o.whilst = function (e, t, n) { + e() ? t((function (r) { + if (r) return n(r); + o.whilst(e, t, n) + })) : n() + }, o.doWhilst = function (e, t, n) { + e((function (r) { + if (r) return n(r); + var i = d(arguments, 1); + t.apply(null, i) ? o.doWhilst(e, t, n) : n() + })) + }, o.until = function (e, t, n) { + e() ? n() : t((function (r) { + if (r) return n(r); + o.until(e, t, n) + })) + }, o.doUntil = function (e, t, n) { + e((function (r) { + if (r) return n(r); + var i = d(arguments, 1); + t.apply(null, i) ? n() : o.doUntil(e, t, n) + })) + }, o.queue = function (e, t) { + if (void 0 === t) t = 1; + else if (0 === t) throw new Error("Concurrency must not be zero"); + + function n(e, t, n, r) { + if (e.started || (e.started = !0), u(t) || (t = [t]), 0 === t.length) return o.setImmediate((function () { + e.drain && e.drain() + })); + f(t, (function (t) { + var i = { + data: t, + callback: "function" == typeof r ? r : null + }; + n ? e.tasks.unshift(i) : e.tasks.push(i), e.saturated && e.tasks.length === e.concurrency && e.saturated(), o.setImmediate(e.process) + })) + } + var r = 0, + i = { + tasks: [], + concurrency: t, + saturated: null, + empty: null, + drain: null, + started: !1, + paused: !1, + push: function (e, t) { + n(i, e, !1, t) + }, + kill: function () { + i.drain = null, i.tasks = [] + }, + unshift: function (e, t) { + n(i, e, !0, t) + }, + process: function () { + if (!i.paused && r < i.concurrency && i.tasks.length) { + var t = i.tasks.shift(); + i.empty && 0 === i.tasks.length && i.empty(), r += 1; + var n = a((function () { + r -= 1, t.callback && t.callback.apply(t, arguments), i.drain && i.tasks.length + r === 0 && i.drain(), i.process() + })); + e(t.data, n) + } + }, + length: function () { + return i.tasks.length + }, + running: function () { + return r + }, + idle: function () { + return i.tasks.length + r === 0 + }, + pause: function () { + !0 !== i.paused && (i.paused = !0) + }, + resume: function () { + if (!1 !== i.paused) { + i.paused = !1; + for (var e = Math.min(i.concurrency, i.tasks.length), t = 1; t <= e; t++) o.setImmediate(i.process) + } + } + }; + return i + }, o.priorityQueue = function (e, t) { + function n(e, t) { + return e.priority - t.priority + } + var r = o.queue(e, t); + return r.push = function (e, t, i) { + ! function (e, t, r, i) { + if (e.started || (e.started = !0), u(t) || (t = [t]), 0 === t.length) return o.setImmediate((function () { + e.drain && e.drain() + })); + f(t, (function (t) { + var s = { + data: t, + priority: r, + callback: "function" == typeof i ? i : null + }; + e.tasks.splice(function (e, t, n) { + for (var r = -1, i = e.length - 1; r < i;) { + var o = r + (i - r + 1 >>> 1); + n(t, e[o]) >= 0 ? r = o : i = o - 1 + } + return r + }(e.tasks, s, n) + 1, 0, s), e.saturated && e.tasks.length === e.concurrency && e.saturated(), o.setImmediate(e.process) + })) + }(r, e, t, i) + }, delete r.unshift, r + }, o.cargo = function (e, t) { + var n = !1, + r = [], + i = { + tasks: r, + payload: t, + saturated: null, + empty: null, + drain: null, + drained: !0, + push: function (e, n) { + u(e) || (e = [e]), f(e, (function (e) { + r.push({ + data: e, + callback: "function" == typeof n ? n : null + }), i.drained = !1, i.saturated && r.length === t && i.saturated() + })), o.setImmediate(i.process) + }, + process: function o() { + if (!n) { + if (0 === r.length) return i.drain && !i.drained && i.drain(), void(i.drained = !0); + var s = "number" == typeof t ? r.splice(0, t) : r.splice(0, r.length), + a = h(s, (function (e) { + return e.data + })); + i.empty && i.empty(), n = !0, e(a, (function () { + n = !1; + var e = arguments; + f(s, (function (t) { + t.callback && t.callback.apply(null, e) + })), o() + })) + } + }, + length: function () { + return r.length + }, + running: function () { + return n + } + }; + return i + }; + var O = function (e) { + return function (t) { + var n = d(arguments, 1); + t.apply(null, n.concat([function (t) { + var n = d(arguments, 1); + "undefined" != typeof console && (t ? console.error && console.error(t) : console[e] && f(n, (function (t) { + console[e](t) + }))) + }])) + } + }; + o.log = O("log"), o.dir = O("dir"), o.memoize = function (e, t) { + var n = {}, + r = {}; + t = t || function (e) { + return e + }; + var i = function () { + var i = d(arguments), + s = i.pop(), + a = t.apply(null, i); + a in n ? o.nextTick((function () { + s.apply(null, n[a]) + })) : a in r ? r[a].push(s) : (r[a] = [s], e.apply(null, i.concat([function () { + n[a] = d(arguments); + var e = r[a]; + delete r[a]; + for (var t = 0, i = e.length; t < i; t++) e[t].apply(null, arguments) + }]))) + }; + return i.memo = n, i.unmemoized = e, i + }, o.unmemoize = function (e) { + return function () { + return (e.unmemoized || e).apply(null, arguments) + } + }, o.times = function (e, t, n) { + for (var r = [], i = 0; i < e; i++) r.push(i); + return o.map(r, t, n) + }, o.timesSeries = function (e, t, n) { + for (var r = [], i = 0; i < e; i++) r.push(i); + return o.mapSeries(r, t, n) + }, o.seq = function () { + var e = arguments; + return function () { + var t = this, + n = d(arguments), + r = n.pop(); + o.reduce(e, n, (function (e, n, r) { + n.apply(t, e.concat([function () { + var e = arguments[0], + t = d(arguments, 1); + r(e, t) + }])) + }), (function (e, n) { + r.apply(t, [e].concat(n)) + })) + } + }, o.compose = function () { + return o.seq.apply(null, Array.prototype.reverse.call(arguments)) + }; + var k = function (e, t) { + var n = function () { + var n = this, + r = d(arguments), + i = r.pop(); + return e(t, (function (e, t) { + e.apply(n, r.concat([t])) + }), i) + }; + if (arguments.length > 2) { + var r = d(arguments, 2); + return n.apply(this, r) + } + return n + }; + o.applyEach = y(k), o.applyEachSeries = v(k), o.forever = function (e, t) { + ! function n(r) { + if (r) { + if (t) return t(r); + throw r + } + e(n) + }() + }, e.exports ? e.exports = o : void 0 === (r = function () { + return o + }.apply(t, [])) || (e.exports = r) + }() +}, function (e, t) { + e.exports = require("zlib") +}, function (e, t, n) { + var r = n(9), + i = n(80), + o = t; + o.getAllInfo = function (e) { + return { + date: (new Date).toString(), + process: o.getProcessInfo(), + os: o.getOsInfo(), + trace: o.getTrace(e), + stack: e.stack && e.stack.split("\n") } - }; - a.map = S(x), a.mapSeries = v(x), a.mapLimit = function (e, n, t, r) { - return E(n)(e, t, r) - }; - var E = function (e) { - return w(e, x) - }; - a.reduce = function (e, n, t, r) { - a.eachSeries(e, function (e, r) { - t(n, e, function (e, t) { - n = t, r(e) - }) - }, function (e) { - r(e, n) - }) - }, a.inject = a.reduce, a.foldl = a.reduce, a.reduceRight = function (e, n, t, r) { - var o = u(e, function (e) { - return e - }).reverse(); - a.reduce(o, n, t, r) - }, a.foldr = a.reduceRight; - var C = function (e, n, t, r) { - var o = []; - n = u(n, function (e, n) { + }, o.getProcessInfo = function () { return { - index: n, - value: e + pid: process.pid, + uid: process.getuid ? process.getuid() : null, + gid: process.getgid ? process.getgid() : null, + cwd: process.cwd(), + execPath: process.execPath, + version: process.version, + argv: process.argv, + memoryUsage: process.memoryUsage() } - }), e(n, function (e, n) { - t(e.value, function (t) { - t && o.push(e), n() - }) - }, function () { - r(u(o.sort(function (e, n) { - return e.index - n.index - }), function (e) { - return e.value - })) - }) - }; - a.filter = S(C), a.filterSeries = v(C), a.select = a.filter, a.selectSeries = a.filterSeries; - var k = function (e, n, t, r) { - var o = []; - n = u(n, function (e, n) { + }, o.getOsInfo = function () { return { - index: n, - value: e + loadavg: r.loadavg(), + uptime: r.uptime() } - }), e(n, function (e, n) { - t(e.value, function (t) { - t || o.push(e), n() - }) - }, function () { - r(u(o.sort(function (e, n) { - return e.index - n.index - }), function (e) { - return e.value + }, o.getTrace = function (e) { + return (e ? i.parse(e) : i.get()).map((function (e) { + return { + column: e.getColumnNumber(), + file: e.getFileName(), + function: e.getFunctionName(), + line: e.getLineNumber(), + method: e.getMethodName(), + native: e.isNative() + } })) - }) - }; - a.reject = S(k), a.rejectSeries = v(k); - var M = function (e, n, t, r) { - e(n, function (e, n) { - t(e, function (t) { - t ? (r(e), r = i) : n() - }) - }, function () { - r() - }) - }; - a.detect = S(M), a.detectSeries = v(M), a.some = function (e, n, t) { - a.each(e, function (e, r) { - n(e, function (e) { - e && (t(!0), t = i), r() - }) - }, function () { - t(!1) - }) - }, a.any = a.some, a.every = function (e, n, t) { - a.each(e, function (e, r) { - n(e, function (e) { - e || (t(!1), t = i), r() + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(2), + o = ["access", "appendFile", "chmod", "chown", "close", "copyFile", "fchmod", "fchown", "fdatasync", "fstat", "fsync", "ftruncate", "futimes", "lchown", "lchmod", "link", "lstat", "mkdir", "mkdtemp", "open", "readFile", "readdir", "readlink", "realpath", "rename", "rmdir", "stat", "symlink", "truncate", "unlink", "utimes", "writeFile"].filter(e => "function" == typeof i[e]); + Object.keys(i).forEach(e => { + "promises" !== e && (t[e] = i[e]) + }), o.forEach(e => { + t[e] = r(i[e]) + }), t.exists = function (e, t) { + return "function" == typeof t ? i.exists(e, t) : new Promise(t => i.exists(e, t)) + }, t.read = function (e, t, n, r, o, s) { + return "function" == typeof s ? i.read(e, t, n, r, o, s) : new Promise((s, a) => { + i.read(e, t, n, r, o, (e, t, n) => { + if (e) return a(e); + s({ + bytesRead: t, + buffer: n + }) + }) }) - }, function () { - t(!0) - }) - }, a.all = a.every, a.sortBy = function (e, n, t) { - a.map(e, function (e, t) { - n(e, function (n, r) { - n ? t(n) : t(null, { - value: e, - criteria: r - }) + }, t.write = function (e, t, ...n) { + return "function" == typeof n[n.length - 1] ? i.write(e, t, ...n) : new Promise((r, o) => { + i.write(e, t, ...n, (e, t, n) => { + if (e) return o(e); + r({ + bytesWritten: t, + buffer: n + }) + }) }) - }, function (e, n) { - if (e) return t(e); - t(null, u(n.sort(function (e, n) { - var t = e.criteria, - r = n.criteria; - return t < r ? -1 : t > r ? 1 : 0 - }), function (e) { - return e.value - })) - }) - }, a.auto = function (e, n) { - n = n || i; - var t = f(e), - r = t.length; - if (!r) return n(); - var o = {}, - s = [], - d = function (e) { - s.unshift(e) + } +}, function (e, t) { + e.exports = require("constants") +}, function (e, t, n) { + "use strict"; + e.exports = { + copySync: n(86) + } +}, function (e, t, n) { + "use strict"; + const r = n(1); + + function i(e) { + return (e = r.normalize(r.resolve(e)).split(r.sep)).length > 0 ? e[0] : null + } + const o = /[<>:"|?*]/; + e.exports = { + getRootPath: i, + invalidWin32Path: function (e) { + const t = i(e); + return e = e.replace(t, ""), o.test(e) + } + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(9), + o = n(1); + e.exports = { + hasMillisRes: function (e) { + let t = o.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2)); + t = o.join(i.tmpdir(), t); + const n = new Date(1435410243862); + r.writeFile(t, "https://github.com/jprichardson/node-fs-extra/pull/141", i => { + if (i) return e(i); + r.open(t, "r+", (i, o) => { + if (i) return e(i); + r.futimes(o, n, n, n => { + if (n) return e(n); + r.close(o, n => { + if (n) return e(n); + r.stat(t, (t, n) => { + if (t) return e(t); + e(null, n.mtime > 1435410243e3) + }) + }) + }) + }) + }) }, - l = function (e) { - for (var n = 0; n < s.length; n += 1) - if (s[n] === e) return void s.splice(n, 1) + hasMillisResSync: function () { + let e = o.join("millis-test-sync" + Date.now().toString() + Math.random().toString().slice(2)); + e = o.join(i.tmpdir(), e); + const t = new Date(1435410243862); + r.writeFileSync(e, "https://github.com/jprichardson/node-fs-extra/pull/141"); + const n = r.openSync(e, "r+"); + return r.futimesSync(n, t, t), r.closeSync(n), r.statSync(e).mtime > 1435410243e3 }, - u = function () { - r--, p(s.slice(0), function (e) { - e() - }) - }; - d(function () { - if (!r) { - var e = n; - n = i, e(null, o) - } - }), p(t, function (t) { - for (var r = c(e[t]) ? e[t] : [e[t]], s = function (e) { - var r = h(arguments, 1); - if (1 >= r.length && (r = r[0]), e) { - var s = {}; - p(f(o), function (e) { - s[e] = o[e] - }), s[t] = r, n(e, s), n = i - } else o[t] = r, a.setImmediate(u) - }, g = r.slice(0, Math.abs(r.length - 1)) || [], y = g.length, _; y--;) { - if (!(_ = e[g[y]])) throw new Error('Has inexistant dependency'); - if (c(_) && !!~_.indexOf(t)) throw new Error('Has cyclic dependencies') - } - var b = function () { - return m(g, function (e, n) { - return e && o.hasOwnProperty(n) - }, !0) && !o.hasOwnProperty(t) - }; - if (b()) r[r.length - 1](s, o); - else { - var S = function () { - b() && (l(S), r[r.length - 1](s, o)) - }; - d(S) - } - }) - }, a.retry = function (e, n, t) { - var r = 5, - o = []; - 'function' == typeof e && (t = n, n = e, e = r), e = parseInt(e, 10) || r; - var i = function (r, i) { - for (var s = function (e, n) { - return function (t) { - e(function (e, r) { - t(!e || n, { - err: e, - result: r + timeRemoveMillis: function (e) { + if ("number" == typeof e) return 1e3 * Math.floor(e / 1e3); + if (e instanceof Date) return new Date(1e3 * Math.floor(e.getTime() / 1e3)); + throw new Error("fs-extra: timeRemoveMillis() unknown parameter type") + }, + utimesMillis: function (e, t, n, i) { + r.open(e, "r+", (e, o) => { + if (e) return i(e); + r.futimes(o, t, n, e => { + r.close(o, t => { + i && i(e || t) + }) }) - }, i) - } - }; e;) o.push(s(n, !(e -= 1))); - a.series(o, function (e, n) { - n = n[n.length - 1], (r || t)(n.err, n.result) - }) - }; - return t ? i() : i - }, a.waterfall = function (e, n) { - if (n = n || i, !c(e)) { - var t = new Error('First argument to waterfall must be an array of functions'); - return n(t) - } - if (!e.length) return n(); - var r = function (e) { - return function (t) { - if (t) n.apply(null, arguments), n = i; - else { - var o = h(arguments, 1), - s = e.next(); - s ? o.push(r(s)) : o.push(n), a.setImmediate(function () { - e.apply(null, o) }) - } + }, + utimesMillisSync: function (e, t, n) { + const i = r.openSync(e, "r+"); + return r.futimesSync(i, t, n), r.closeSync(i) + } + } +}, function (e, t, n) { + "use strict"; + e.exports = function (e) { + if ("function" == typeof Buffer.allocUnsafe) try { + return Buffer.allocUnsafe(e) + } catch (t) { + return new Buffer(e) + } + return new Buffer(e) + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback; + e.exports = { + copy: r(n(89)) + } +}, function (e, t, n) { + var r; + try { + r = n(99) + } catch (e) { + r = n(3) + } + + function i(e, t) { + var n, r = "\n"; + return "object" == typeof t && null !== t && (t.spaces && (n = t.spaces), t.EOL && (r = t.EOL)), JSON.stringify(e, t ? t.replacer : null, n).replace(/\n/g, r) + r + } + + function o(e) { + return Buffer.isBuffer(e) && (e = e.toString("utf8")), e = e.replace(/^\uFEFF/, "") + } + var s = { + readFile: function (e, t, n) { + null == n && (n = t, t = {}), "string" == typeof t && (t = { + encoding: t + }); + var i = (t = t || {}).fs || r, + s = !0; + "throws" in t && (s = t.throws), i.readFile(e, t, (function (r, i) { + if (r) return n(r); + var a; + i = o(i); + try { + a = JSON.parse(i, t ? t.reviver : null) + } catch (t) { + return s ? (t.message = e + ": " + t.message, n(t)) : n(null, null) + } + n(null, a) + })) + }, + readFileSync: function (e, t) { + "string" == typeof (t = t || {}) && (t = { + encoding: t + }); + var n = t.fs || r, + i = !0; + "throws" in t && (i = t.throws); + try { + var s = n.readFileSync(e, t); + return s = o(s), JSON.parse(s, t.reviver) + } catch (t) { + if (i) throw t.message = e + ": " + t.message, t; + return null + } + }, + writeFile: function (e, t, n, o) { + null == o && (o = n, n = {}); + var s = (n = n || {}).fs || r, + a = ""; + try { + a = i(t, n) + } catch (e) { + return void(o && o(e, null)) + } + s.writeFile(e, a, n, o) + }, + writeFileSync: function (e, t, n) { + var o = (n = n || {}).fs || r, + s = i(t, n); + return o.writeFileSync(e, s, n) } - }; - r(a.iterator(e))() }; - var L = function (e, n, t) { - if (t = t || i, c(n)) e.map(n, function (e, n) { - e && e(function (e) { - var t = h(arguments, 1); - 1 >= t.length && (t = t[0]), n.call(null, e, t) - }) - }, t); - else { - var r = {}; - e.each(f(n), function (e, t) { - n[e](function (n) { - var o = h(arguments, 1); - 1 >= o.length && (o = o[0]), r[e] = o, t(n) - }) - }, function (e) { - t(e, r) - }) - } - }; - a.parallel = function (e, n) { - L({ - map: a.map, - each: a.each - }, e, n) - }, a.parallelLimit = function (e, n, t) { - L({ - map: E(n), - each: _(n) - }, e, t) - }, a.series = function (e, n) { - if (n = n || i, c(e)) a.mapSeries(e, function (e, n) { - e && e(function (e) { - var t = h(arguments, 1); - 1 >= t.length && (t = t[0]), n.call(null, e, t) - }) - }, n); - else { - var t = {}; - a.eachSeries(f(e), function (n, r) { - e[n](function (e) { - var o = h(arguments, 1); - 1 >= o.length && (o = o[0]), t[n] = o, r(e) - }) - }, function (e) { - n(e, t) - }) - } - }, a.iterator = function (e) { - var n = function (t) { - var r = function () { - return e.length && e[t].apply(null, arguments), r.next() + e.exports = s +}, function (e, t, n) { + "use strict"; + var r = n(3); + e.exports = function (e) { + if (null === e || "object" != typeof e) return e; + if (e instanceof Object) var t = { + __proto__: e.__proto__ }; - return r.next = function () { - return t < e.length - 1 ? n(t + 1) : null - }, r - }; - return n(0) - }, a.apply = function (e) { - var n = h(arguments, 1); - return function () { - return e.apply(null, n.concat(h(arguments))) - } - }; - var O = function (e, n, t, o) { - var i = []; - e(n, function (e, n) { - t(e, function (e, t) { - i = i.concat(t || []), n(e) - }) - }, function (e) { - o(e, i) - }) - }; - a.concat = S(O), a.concatSeries = v(O), a.whilst = function (e, n, t) { - e() ? n(function (r) { - return r ? t(r) : void a.whilst(e, n, t) - }) : t() - }, a.doWhilst = function (e, n, t) { - e(function (r) { - if (r) return t(r); - var o = h(arguments, 1); - n.apply(null, o) ? a.doWhilst(e, n, t) : t() - }) - }, a.until = function (e, n, t) { - e() ? t() : n(function (r) { - return r ? t(r) : void a.until(e, n, t) - }) - }, a.doUntil = function (e, n, t) { - e(function (r) { - if (r) return t(r); - var o = h(arguments, 1); - n.apply(null, o) ? t() : a.doUntil(e, n, t) - }) - }, a.queue = function (e, n) { - function t(e, n, t, r) { - return e.started || (e.started = !0), c(n) || (n = [n]), 0 === n.length ? a.setImmediate(function () { - e.drain && e.drain() - }) : void p(n, function (n) { - var o = { - data: n, - callback: 'function' == typeof r ? r : null - }; - t ? e.tasks.unshift(o) : e.tasks.push(o), e.saturated && e.tasks.length === e.concurrency && e.saturated(), a.setImmediate(e.process) - }) - } - if (n === void 0) n = 1; - else if (0 === n) throw new Error('Concurrency must not be zero'); - var r = 0, - i = { - tasks: [], - concurrency: n, - saturated: null, - empty: null, - drain: null, - started: !1, - paused: !1, - push: function (e, n) { - t(i, e, !1, n) - }, - kill: function () { - i.drain = null, i.tasks = [] - }, - unshift: function (e, n) { - t(i, e, !0, n) - }, - process: function () { - if (!i.paused && r < i.concurrency && i.tasks.length) { - var n = i.tasks.shift(); - i.empty && 0 === i.tasks.length && i.empty(), r += 1; - var t = function () { - r -= 1, n.callback && n.callback.apply(n, arguments), i.drain && 0 === i.tasks.length + r && i.drain(), i.process() - }, - a = o(t); - e(n.data, a) + else t = Object.create(null); + return Object.getOwnPropertyNames(e).forEach((function (n) { + Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n)) + })), t + }(r) +}, function (e, t, n) { + var r = n(1), + i = n(3), + o = parseInt("0777", 8); + + function s(e, t, n, a) { + "function" == typeof t ? (n = t, t = {}) : t && "object" == typeof t || (t = { + mode: t + }); + var c = t.mode, + l = t.fs || i; + void 0 === c && (c = o & ~process.umask()), a || (a = null); + var u = n || function () {}; + e = r.resolve(e), l.mkdir(e, c, (function (n) { + if (!n) return u(null, a = a || e); + switch (n.code) { + case "ENOENT": + s(r.dirname(e), t, (function (n, r) { + n ? u(n, r) : s(e, t, u, r) + })); + break; + default: + l.stat(e, (function (e, t) { + e || !t.isDirectory() ? u(n, a) : u(null, a) + })) } - }, - length: function () { - return i.tasks.length - }, - running: function () { - return r - }, - idle: function () { - return 0 === i.tasks.length + r - }, - pause: function () { - !0 === i.paused || (i.paused = !0) - }, - resume: function () { - if (!1 !== i.paused) { - i.paused = !1; - for (var e = Math.min(i.concurrency, i.tasks.length), n = 1; n <= e; n++) a.setImmediate(i.process) + })) + } + e.exports = s.mkdirp = s.mkdirP = s, s.sync = function e(t, n, s) { + n && "object" == typeof n || (n = { + mode: n + }); + var a = n.mode, + c = n.fs || i; + void 0 === a && (a = o & ~process.umask()), s || (s = null), t = r.resolve(t); + try { + c.mkdirSync(t, a), s = s || t + } catch (i) { + switch (i.code) { + case "ENOENT": + s = e(r.dirname(t), n, s), e(t, n, s); + break; + default: + var l; + try { + l = c.statSync(t) + } catch (e) { + throw i + } + if (!l.isDirectory()) throw i } - } - }; - return i - }, a.priorityQueue = function (e, n) { - function t(e, n) { - return e.priority - n.priority - } - - function r(e, n, t) { - for (var r = -1, o = e.length - 1, i; r < o;) i = r + (o - r + 1 >>> 1), 0 <= t(n, e[i]) ? r = i : o = i - 1; - return r - } - - function o(e, n, o, i) { - return e.started || (e.started = !0), c(n) || (n = [n]), 0 === n.length ? a.setImmediate(function () { - e.drain && e.drain() - }) : void p(n, function (n) { - var s = { - data: n, - priority: o, - callback: 'function' == typeof i ? i : null - }; - e.tasks.splice(r(e.tasks, s, t) + 1, 0, s), e.saturated && e.tasks.length === e.concurrency && e.saturated(), a.setImmediate(e.process) + } + return s + } +}, function (e, t, n) { + var r = n(44), + i = n(17), + o = n(45).ArraySet, + s = n(110).MappingList; + + function a(e) { + e || (e = {}), this._file = i.getArg(e, "file", null), this._sourceRoot = i.getArg(e, "sourceRoot", null), this._skipValidation = i.getArg(e, "skipValidation", !1), this._sources = new o, this._names = new o, this._mappings = new s, this._sourcesContents = null + } + a.prototype._version = 3, a.fromSourceMap = function (e) { + var t = e.sourceRoot, + n = new a({ + file: e.file, + sourceRoot: t + }); + return e.eachMapping((function (e) { + var r = { + generated: { + line: e.generatedLine, + column: e.generatedColumn + } + }; + null != e.source && (r.source = e.source, null != t && (r.source = i.relative(t, r.source)), r.original = { + line: e.originalLine, + column: e.originalColumn + }, null != e.name && (r.name = e.name)), n.addMapping(r) + })), e.sources.forEach((function (t) { + var r = e.sourceContentFor(t); + null != r && n.setSourceContent(t, r) + })), n + }, a.prototype.addMapping = function (e) { + var t = i.getArg(e, "generated"), + n = i.getArg(e, "original", null), + r = i.getArg(e, "source", null), + o = i.getArg(e, "name", null); + this._skipValidation || this._validateMapping(t, n, r, o), null != r && (r = String(r), this._sources.has(r) || this._sources.add(r)), null != o && (o = String(o), this._names.has(o) || this._names.add(o)), this._mappings.add({ + generatedLine: t.line, + generatedColumn: t.column, + originalLine: null != n && n.line, + originalColumn: null != n && n.column, + source: r, + name: o }) - } - var i = a.queue(e, n); - return i.push = function (e, n, t) { - o(i, e, n, t) - }, delete i.unshift, i - }, a.cargo = function (e, n) { - var t = !1, - r = [], - o = { - tasks: r, - payload: n, - saturated: null, - empty: null, - drain: null, - drained: !0, - push: function (e, t) { - c(e) || (e = [e]), p(e, function (e) { - r.push({ - data: e, - callback: 'function' == typeof t ? t : null - }), o.drained = !1, o.saturated && r.length === n && o.saturated() - }), a.setImmediate(o.process) - }, - process: function i() { - if (!t) { - if (0 === r.length) return o.drain && !o.drained && o.drain(), void(o.drained = !0); - var a = 'number' == typeof n ? r.splice(0, n) : r.splice(0, r.length), - s = u(a, function (e) { - return e.data + }, a.prototype.setSourceContent = function (e, t) { + var n = e; + null != this._sourceRoot && (n = i.relative(this._sourceRoot, n)), null != t ? (this._sourcesContents || (this._sourcesContents = Object.create(null)), this._sourcesContents[i.toSetString(n)] = t) : this._sourcesContents && (delete this._sourcesContents[i.toSetString(n)], 0 === Object.keys(this._sourcesContents).length && (this._sourcesContents = null)) + }, a.prototype.applySourceMap = function (e, t, n) { + var r = t; + if (null == t) { + if (null == e.file) throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.'); + r = e.file + } + var s = this._sourceRoot; + null != s && (r = i.relative(s, r)); + var a = new o, + c = new o; + this._mappings.unsortedForEach((function (t) { + if (t.source === r && null != t.originalLine) { + var o = e.originalPositionFor({ + line: t.originalLine, + column: t.originalColumn }); - o.empty && o.empty(), t = !0, e(s, function () { - t = !1; - var e = arguments; - p(a, function (n) { - n.callback && n.callback.apply(null, e) - }), i() - }) + null != o.source && (t.source = o.source, null != n && (t.source = i.join(n, t.source)), null != s && (t.source = i.relative(s, t.source)), t.originalLine = o.line, t.originalColumn = o.column, null != o.name && (t.name = o.name)) } - }, - length: function () { - return r.length - }, - running: function () { - return t - } + var l = t.source; + null == l || a.has(l) || a.add(l); + var u = t.name; + null == u || c.has(u) || c.add(u) + }), this), this._sources = a, this._names = c, e.sources.forEach((function (t) { + var r = e.sourceContentFor(t); + null != r && (null != n && (t = i.join(n, t)), null != s && (t = i.relative(s, t)), this.setSourceContent(t, r)) + }), this) + }, a.prototype._validateMapping = function (e, t, n, r) { + if (t && "number" != typeof t.line && "number" != typeof t.column) throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."); + if ((!(e && "line" in e && "column" in e && e.line > 0 && e.column >= 0) || t || n || r) && !(e && "line" in e && "column" in e && t && "line" in t && "column" in t && e.line > 0 && e.column >= 0 && t.line > 0 && t.column >= 0 && n)) throw new Error("Invalid mapping: " + JSON.stringify({ + generated: e, + source: n, + original: t, + name: r + })) + }, a.prototype._serializeMappings = function () { + for (var e, t, n, o, s = 0, a = 1, c = 0, l = 0, u = 0, f = 0, h = "", p = this._mappings.toArray(), d = 0, m = p.length; d < m; d++) { + if (e = "", (t = p[d]).generatedLine !== a) + for (s = 0; t.generatedLine !== a;) e += ";", a++; + else if (d > 0) { + if (!i.compareByGeneratedPositionsInflated(t, p[d - 1])) continue; + e += "," + } + e += r.encode(t.generatedColumn - s), s = t.generatedColumn, null != t.source && (o = this._sources.indexOf(t.source), e += r.encode(o - f), f = o, e += r.encode(t.originalLine - 1 - l), l = t.originalLine - 1, e += r.encode(t.originalColumn - c), c = t.originalColumn, null != t.name && (n = this._names.indexOf(t.name), e += r.encode(n - u), u = n)), h += e + } + return h + }, a.prototype._generateSourcesContent = function (e, t) { + return e.map((function (e) { + if (!this._sourcesContents) return null; + null != t && (e = i.relative(t, e)); + var n = i.toSetString(e); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, n) ? this._sourcesContents[n] : null + }), this) + }, a.prototype.toJSON = function () { + var e = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() }; - return o - }; - var P = function (e) { - return function (n) { - var t = h(arguments, 1); - n.apply(null, t.concat([function (n) { - var t = h(arguments, 1); - 'undefined' != typeof console && (n ? console.error && console.error(n) : console[e] && p(t, function (n) { - console[e](n) - })) - }])) - } - }; - a.log = P('log'), a.dir = P('dir'), a.memoize = function (e, n) { - var t = {}, - r = {}; - n = n || function (e) { + return null != this._file && (e.file = this._file), null != this._sourceRoot && (e.sourceRoot = this._sourceRoot), this._sourcesContents && (e.sourcesContent = this._generateSourcesContent(e.sources, e.sourceRoot)), e + }, a.prototype.toString = function () { + return JSON.stringify(this.toJSON()) + }, t.SourceMapGenerator = a +}, function (e, t, n) { + var r = n(109); + t.encode = function (e) { + var t, n = "", + i = function (e) { + return e < 0 ? 1 + (-e << 1) : 0 + (e << 1) + }(e); + do { + t = 31 & i, (i >>>= 5) > 0 && (t |= 32), n += r.encode(t) + } while (i > 0); + return n + }, t.decode = function (e, t, n) { + var i, o, s, a, c = e.length, + l = 0, + u = 0; + do { + if (t >= c) throw new Error("Expected more digits in base 64 VLQ value."); + if (-1 === (o = r.decode(e.charCodeAt(t++)))) throw new Error("Invalid base64 digit: " + e.charAt(t - 1)); + i = !!(32 & o), l += (o &= 31) << u, u += 5 + } while (i); + n.value = (a = (s = l) >> 1, 1 == (1 & s) ? -a : a), n.rest = t + } +}, function (e, t, n) { + var r = n(17), + i = Object.prototype.hasOwnProperty, + o = "undefined" != typeof Map; + + function s() { + this._array = [], this._set = o ? new Map : Object.create(null) + } + s.fromArray = function (e, t) { + for (var n = new s, r = 0, i = e.length; r < i; r++) n.add(e[r], t); + return n + }, s.prototype.size = function () { + return o ? this._set.size : Object.getOwnPropertyNames(this._set).length + }, s.prototype.add = function (e, t) { + var n = o ? e : r.toSetString(e), + s = o ? this.has(e) : i.call(this._set, n), + a = this._array.length; + s && !t || this._array.push(e), s || (o ? this._set.set(e, a) : this._set[n] = a) + }, s.prototype.has = function (e) { + if (o) return this._set.has(e); + var t = r.toSetString(e); + return i.call(this._set, t) + }, s.prototype.indexOf = function (e) { + if (o) { + var t = this._set.get(e); + if (t >= 0) return t + } else { + var n = r.toSetString(e); + if (i.call(this._set, n)) return this._set[n] + } + throw new Error('"' + e + '" is not in the set.') + }, s.prototype.at = function (e) { + if (e >= 0 && e < this._array.length) return this._array[e]; + throw new Error("No element indexed by " + e) + }, s.prototype.toArray = function () { + return this._array.slice() + }, t.ArraySet = s +}, function (e, t) {}, function (e, t, n) { + "use strict"; + n.d(t, "a", (function () { + return i + })); + var r = n(0); + + function i() { + const e = r.Menu.getApplicationMenu(); + if (e) + for (const t of e.items) o(t) + } + + function o(e) { + let t = !1; + if (e.submenu instanceof r.Menu) + for (const n of e.submenu.items) o(n) && (t = !0); + if (t || e.role) return !0; + const n = e.id; + return "show-devtools" === n || "reload-window" === n || (e.enabled = !1, !1) + } +}, function (e, t, n) { + "use strict"; + + function* r(e) { + for (const t of e.items) yield t, "submenu" === t.type && void 0 !== t.submenu && (yield* r(t.submenu)) + } + n.d(t, "a", (function () { + return r + })) +}, function (e, t, n) { + "use strict"; + n.d(t, "a", (function () { + return l + })); + var r = n(0), + i = n(22); + var o = n(23), + s = n(4), + a = n(19); + var c; + + function l({ + selectedExternalEditor: e, + selectedShell: t, + askForConfirmationOnForcePush: n, + askForConfirmationOnRepositoryRemoval: l, + hasCurrentPullRequest: h = !1, + defaultBranchName: p = "default branch", + isForcePushForCurrentRepository: m = !1, + isStashedChangesVisible: g = !1, + askForConfirmationWhenStashingAllChanges: y = !0 + }) { + p = function (e, t) { + if (e.length <= t) return e; + const n = [...e]; + if (n.length <= t) return e; + const r = n.reduce((e, t) => (t >= "︀" && t <= "️" ? e.length && e.push(`${e.pop()}${t}`) : e.push(t), e), []); + return r.length <= t ? e : r.slice(0, t).join("") + "…" + }(p, 25); + const v = l ? "&删除…" : "&删除", + w = h ? "显示拉取请求" : "创建拉取请求", + b = null === t ? "用CMD打开" : "用" + t+"打开", + _ = null === e ? "用external editor打开" : "用" + e+"打开", + E = new Array, + S = { + type: "separator" + }; + const x = { + label: "文件(&F)", + submenu: [{ + label: "新建 存储库…", + id: "new-repository", + click: f("create-repository"), + accelerator: "CmdOrCtrl+N" + }, S, { + label: "添加 本地存储库…", + id: "add-local-repository", + accelerator: "CmdOrCtrl+O", + click: f("add-local-repository") + }, { + label: "克隆 存储库…", + id: "clone-repository", + accelerator: "CmdOrCtrl+Shift+O", + click: f("clone-repository") + }] + }; + x.submenu.push(S, { + label: "&选项…", + id: "preferences", + accelerator: "CmdOrCtrl+,", + click: f("show-preferences") + }, S, { + role: "quit", + label: "退出", + accelerator: "Alt+F4" + }); + E.push(x), E.push({ + label: "编辑(&E)", + submenu: [{ + role: "undo", + label: "&撤消" + }, { + role: "redo", + label: "&恢复" + }, S, { + role: "cut", + label: "剪切" + }, { + role: "copy", + label: "&复制" + }, { + role: "paste", + label: "&粘贴" + }, { + label: "全选", + accelerator: "CmdOrCtrl+A", + click: f("select-all") + }, S, { + id: "find", + label: "&查找", + accelerator: "CmdOrCtrl+F", + click: f("find-text") + }] + }), E.push({ + label: "视图(&V)", + submenu: [{ + label: "&更改", + id: "show-changes", + accelerator: "CmdOrCtrl+1", + click: f("show-changes") + }, { + label: "&历史", + id: "show-history", + accelerator: "CmdOrCtrl+2", + click: f("show-history") + }, { + label: "存储库列表", + id: "show-repository-list", + accelerator: "CmdOrCtrl+T", + click: f("choose-repository") + }, { + label: "分支列表", + id: "show-branches-list", + accelerator: "CmdOrCtrl+B", + click: f("show-branches") + }, S, { + label: "转到摘要", + id: "go-to-commit-message", + accelerator: "CmdOrCtrl+G", + click: f("go-to-commit-message") + }, { + label: u(g), + id: "toggle-stashed-changes", + accelerator: "Ctrl+H", + click: f(g ? "hide-stashed-changes" : "show-stashed-changes") + }, { + label: "全屏切换", + role: "togglefullscreen" + }, S, { + label: "重置缩放", + accelerator: "CmdOrCtrl+0", + click: d(c.Reset) + }, { + label: "放大", + accelerator: "CmdOrCtrl+=", + click: d(c.In) + }, { + label: "缩小", + accelerator: "CmdOrCtrl+-", + click: d(c.Out) + }, S, { + label: "&重载", + id: "reload-window", + accelerator: "CmdOrCtrl+Alt+R", + click(e, t) { + t && t.reload() + }, + visible: !1 + }, { + id: "show-devtools", + label: "&开发工具", + accelerator: "Ctrl+Shift+I", + click(e, t) { + t && t.webContents.toggleDevTools() + } + }] + }); + const C = function (e, t) { + if (!e) return "推送"; + if (t) return "强制推送…"; + return "强制推送" + }(m, n), + O = m ? "force-push" : "push"; + E.push({ + label: "存储库(&R)", + id: "repository", + submenu: [{ + id: "push", + label: C, + accelerator: "CmdOrCtrl+P", + click: f(O) + }, { + id: "pull", + label: "拉取", + accelerator: "CmdOrCtrl+Shift+P", + click: f("pull") + }, { + label: v, + id: "remove-repository", + accelerator: "CmdOrCtrl+Backspace", + click: f("remove-repository") + }, S, { + id: "view-repository-on-github", + label: "在Github上查看", + accelerator: "CmdOrCtrl+Shift+G", + click: f("view-repository-on-github") + }, { + label: b, + id: "open-in-shell", + accelerator: "Ctrl+`", + click: f("open-in-shell") + }, { + label: "资源管理器", + id: "open-working-directory", + accelerator: "CmdOrCtrl+Shift+F", + click: f("open-working-directory") + }, { + label: _, + id: "open-external-editor", + accelerator: "CmdOrCtrl+Shift+A", + click: f("open-external-editor") + }, S, { + id: "create-issue-in-repository-on-github", + label: "在 GitHub 上新建问题", + accelerator: "CmdOrCtrl+I", + click: f("create-issue-in-repository-on-github"), + visible: !0 + }, S, { + label: "存储库设置…", + id: "show-repository-settings", + click: f("show-repository-settings") + }] + }), E.push({ + label: "分支(&B)", + id: "branch", + submenu: [{ + label: "新建分支…", + id: "create-branch", + accelerator: "CmdOrCtrl+Shift+N", + click: f("create-branch") + }, { + label: "&重命名…", + id: "rename-branch", + accelerator: "CmdOrCtrl+Shift+R", + click: f("rename-branch") + }, { + label: "&删除…", + id: "delete-branch", + accelerator: "CmdOrCtrl+Shift+D", + click: f("delete-branch") + }, S, { + label: "放弃所有更改…", + id: "discard-all-changes", + accelerator: "CmdOrCtrl+Shift+Backspace", + click: f("discard-all-changes") + }, { + label: y ? "保存所有更改…" : "保存所有更改", + id: "stash-all-changes", + accelerator: "CmdOrCtrl+Shift+S", + click: f("stash-all-changes") + }, S, { + label: "&更新自 " + p, + id: "update-branch", + accelerator: "CmdOrCtrl+Shift+U", + click: f("update-branch") + }, { + label: "&与分支比较", + id: "compare-to-branch", + accelerator: "CmdOrCtrl+Shift+B", + click: f("compare-to-branch") + }, { + label: "&合并到当前分支…", + id: "merge-branch", + accelerator: "CmdOrCtrl+Shift+M", + click: f("merge-branch") + }, { + label: "恢复当前分支…", + id: "rebase-branch", + accelerator: "CmdOrCtrl+Shift+E", + click: f("rebase-branch") + }, S, { + label: "前往GitHub比较", + id: "compare-on-github", + accelerator: "CmdOrCtrl+Shift+C", + click: f("compare-on-github") + }, { + label: w, + id: "create-pull-request", + accelerator: "CmdOrCtrl+R", + click: f("open-pull-request") + }] + }); + const k = [{ + label: "反馈问题…", + click() { + r.shell.openExternal("https://github.com/desktop/desktop/issues/new/choose").catch(e => log.error("Failed opening issue creation page", e)) + } + }, { + label: "联系Github支持…", + click() { + r.shell.openExternal("https://github.com/contact?from_desktop_app=1&app_version=" + r.app.getVersion()).catch(e => log.error("Failed opening contact support page", e)) + } + }, { + label: "用户指南", + click() { + r.shell.openExternal("https://help.github.com/desktop/guides/").catch(e => log.error("Failed opening user guides page", e)) + } + }, { + label: "键盘快捷键", + click() { + r.shell.openExternal("https://help.github.com/en/desktop/getting-started-with-github-desktop/keyboard-shortcuts-in-github-desktop").catch(e => log.error("Failed opening keyboard shortcuts page", e)) + } + }, { + label: "打开日志文件夹", + click() { + const e = Object(o.a)(); + Object(s.ensureDir)(e).then(() => { + Object(a.a)(e) + }).catch(e => { + log.error("Failed opening logs directory", e) + }) + } + }]; + return E.push({ + label: "帮助(&H)", + submenu: [...k, S, { + label: "关于 Github 桌面", + click: f("show-about"), + id: "about" + }] + }), Object(i.a)(E), r.Menu.buildFromTemplate(E) + } + + function u(e) { + return e ? "隐藏贮藏的变更" : "显示贮藏的变更" + } + + function f(e) { + return (t, n) => { + n ? n.webContents.send("menu-event", { + name: e + }) : r.ipcMain.emit("menu-event", { + name: e + }) + } + }! function (e) { + e[e.Reset = 0] = "Reset", e[e.In = 1] = "In", e[e.Out = 2] = "Out" + }(c || (c = {})); + const h = [1, 1.1, 1.25, 1.5, 1.75, 2], + p = h.slice().reverse(); + + function d(e) { + return (t, n) => { + if (!n) return; + const { + webContents: r + } = n; + if (e === c.Reset) r.zoomFactor = 1, r.send("zoom-factor-changed", 1); + else { + const t = r.zoomFactor, + n = e === c.In ? h : p, + o = (i = t, n.reduce((e, t) => Math.abs(t - i) < Math.abs(e - i) ? t : e)), + s = n.find(t => e === c.In ? t > o : t < o), + a = void 0 === s ? o : s; + r.zoomFactor = a, r.send("zoom-factor-changed", a) + } + var i + } + } +}, function (e, t, n) { + "use strict"; + const r = n(1); + e.exports = function (e) { + if ("string" != typeof e || e.length <= 7 || "file://" !== e.substring(0, 7)) throw new TypeError("must pass in a file:// URI to convert to a file path"); + const t = decodeURI(e.substring(7)), + n = t.indexOf("/"); + let i = t.substring(0, n), + o = t.substring(n + 1); + return "localhost" === i && (i = ""), i && (i = r.sep + r.sep + i), o = o.replace(/^(.+)\|/, "$1:"), "\\" === r.sep && (o = o.replace(/\//g, "\\")), /^.+:/.test(o) || (o = r.sep + o), i + o + } +}, function (e, t, n) { + var r, i = n(108).SourceMapConsumer, + o = n(1); + try { + (r = n(3)).existsSync && r.readFileSync || (r = null) + } catch (e) {} + var s = !1, + a = !1, + c = !1, + l = "auto", + u = {}, + f = {}, + h = /^data:application\/json[^,]+base64,/, + p = [], + d = []; + + function m() { + return "browser" === l || "node" !== l && ("undefined" != typeof window && "function" == typeof XMLHttpRequest && !(window.require && window.module && window.process && "renderer" === window.process.type)) + } + + function g(e) { + return function (t) { + for (var n = 0; n < e.length; n++) { + var r = e[n](t); + if (r) return r + } + return null + } + } + var y = g(p); + + function v(e, t) { + if (!e) return t; + var n = o.dirname(e), + r = /^\w+:\/\/[^\/]*/.exec(n), + i = r ? r[0] : ""; + return i + o.resolve(n.slice(i.length), t) + } + p.push((function (e) { + if ((e = e.trim()) in u) return u[e]; + var t = null; + if (r) { + if (r.existsSync(e)) try { + t = r.readFileSync(e, "utf8") + } catch (e) { + t = "" + } + } else { + var n = new XMLHttpRequest; + n.open("GET", e, !1), n.send(null); + t = null; + 4 === n.readyState && 200 === n.status && (t = n.responseText) + } + return u[e] = t + })); + var w = g(d); + + function b(e) { + var t = f[e.source]; + if (!t) { + var n = w(e.source); + n ? (t = f[e.source] = { + url: n.url, + map: new i(n.map) + }).map.sourcesContent && t.map.sources.forEach((function (e, n) { + var r = t.map.sourcesContent[n]; + if (r) { + var i = v(t.url, e); + u[i] = r + } + })) : t = f[e.source] = { + url: null, + map: null + } + } + if (t && t.map) { + var r = t.map.originalPositionFor(e); + if (null !== r.source) return r.source = v(t.url, r.source), r + } return e - }; - var o = function () { - var o = h(arguments), - i = o.pop(), - s = n.apply(null, o); - s in t ? a.nextTick(function () { - i.apply(null, t[s]) - }) : s in r ? r[s].push(i) : (r[s] = [i], e.apply(null, o.concat([function () { - t[s] = h(arguments); - var e = r[s]; - delete r[s]; - for (var n = 0, o = e.length; n < o; n++) e[n].apply(null, arguments) - }]))) - }; - return o.memo = t, o.unmemoized = e, o - }, a.unmemoize = function (e) { - return function () { - return (e.unmemoized || e).apply(null, arguments) - } - }, a.times = function (e, n, t) { - for (var r = [], o = 0; o < e; o++) r.push(o); - return a.map(r, n, t) - }, a.timesSeries = function (e, n, t) { - for (var r = [], o = 0; o < e; o++) r.push(o); - return a.mapSeries(r, n, t) - }, a.seq = function () { - var e = arguments; - return function () { - var n = this, - t = h(arguments), - r = t.pop(); - a.reduce(e, t, function (e, t, r) { - t.apply(n, e.concat([function () { - var e = arguments[0], - n = h(arguments, 1); - r(e, n) - }])) - }, function (e, t) { - r.apply(n, [e].concat(t)) + } + + function _() { + var e, t = ""; + if (this.isNative()) t = "native"; + else { + !(e = this.getScriptNameOrSourceURL()) && this.isEval() && (t = this.getEvalOrigin(), t += ", "), t += e || ""; + var n = this.getLineNumber(); + if (null != n) { + t += ":" + n; + var r = this.getColumnNumber(); + r && (t += ":" + r) + } + } + var i = "", + o = this.getFunctionName(), + s = !0, + a = this.isConstructor(); + if (!(this.isToplevel() || a)) { + var c = this.getTypeName(); + "[object Object]" === c && (c = "null"); + var l = this.getMethodName(); + o ? (c && 0 != o.indexOf(c) && (i += c + "."), i += o, l && o.indexOf("." + l) != o.length - l.length - 1 && (i += " [as " + l + "]")) : i += c + "." + (l || "") + } else a ? i += "new " + (o || "") : o ? i += o : (i += t, s = !1); + return s && (i += " (" + t + ")"), i + } + + function E(e) { + var t = {}; + return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function (n) { + t[n] = /^(?:is|get)/.test(n) ? function () { + return e[n].call(e) + } : e[n] + })), t.toString = _, t + } + + function S(e) { + if (e.isNative()) return e; + var t = e.getFileName() || e.getScriptNameOrSourceURL(); + if (t) { + var n = e.getLineNumber(), + r = e.getColumnNumber() - 1; + 1 === n && r > 62 && !m() && !e.isEval() && (r -= 62); + var i = b({ + source: t, + line: n, + column: r + }); + return (e = E(e)).getFileName = function () { + return i.source + }, e.getLineNumber = function () { + return i.line + }, e.getColumnNumber = function () { + return i.column + 1 + }, e.getScriptNameOrSourceURL = function () { + return i.source + }, e + } + var o = e.isEval() && e.getEvalOrigin(); + return o ? (o = function e(t) { + var n = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t); + if (n) { + var r = b({ + source: n[2], + line: +n[3], + column: n[4] - 1 + }); + return "eval at " + n[1] + " (" + r.source + ":" + r.line + ":" + (r.column + 1) + ")" + } + return (n = /^eval at ([^(]+) \((.+)\)$/.exec(t)) ? "eval at " + n[1] + " (" + e(n[2]) + ")" : t + }(o), (e = E(e)).getEvalOrigin = function () { + return o + }, e) : e + } + + function x(e, t) { + return c && (u = {}, f = {}), e + t.map((function (e) { + return "\n at " + S(e) + })).join("") + } + + function C(e) { + var t = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack); + if (t) { + var n = t[1], + i = +t[2], + o = +t[3], + s = u[n]; + if (!s && r && r.existsSync(n)) try { + s = r.readFileSync(n, "utf8") + } catch (e) { + s = "" + } + if (s) { + var a = s.split(/(?:\r\n|\r|\n)/)[i - 1]; + if (a) return n + ":" + i + "\n" + a + "\n" + new Array(o).join(" ") + "^" + } + } + return null + } + + function O(e) { + var t = C(e); + t && (console.error(), console.error(t)), console.error(e.stack), process.exit(1) + } + d.push((function (e) { + var t, n = function (e) { + var t; + if (m()) try { + var n = new XMLHttpRequest; + n.open("GET", e, !1), n.send(null), t = 4 === n.readyState ? n.responseText : null; + var r = n.getResponseHeader("SourceMap") || n.getResponseHeader("X-SourceMap"); + if (r) return r + } catch (e) {} + t = y(e); + for (var i, o, s = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm; o = s.exec(t);) i = o; + return i ? i[1] : null + }(e); + if (!n) return null; + if (h.test(n)) { + var r = n.slice(n.indexOf(",") + 1); + t = new Buffer(r, "base64").toString(), n = e + } else n = v(e, n), t = y(n); + return t ? { + url: n, + map: t + } : null + })), t.wrapCallSite = S, t.getErrorSource = C, t.mapSourcePosition = b, t.retrieveSourceMap = w, t.install = function (e) { + if ((e = e || {}).environment && (l = e.environment, -1 === ["node", "browser", "auto"].indexOf(l))) throw new Error("environment " + l + " was unknown. Available options are {auto, browser, node}"); + if (e.retrieveFile && (e.overrideRetrieveFile && (p.length = 0), p.unshift(e.retrieveFile)), e.retrieveSourceMap && (e.overrideRetrieveSourceMap && (d.length = 0), d.unshift(e.retrieveSourceMap)), e.hookRequire && !m()) { + var t; + try { + t = n(115) + } catch (e) {} + var r = t.prototype._compile; + r.__sourceMapSupport || (t.prototype._compile = function (e, t) { + return u[t] = e, f[t] = void 0, r.call(this, e, t) + }, t.prototype._compile.__sourceMapSupport = !0) + } + var i; + (c || (c = "emptyCacheBetweenOperations" in e && e.emptyCacheBetweenOperations), s || (s = !0, Error.prepareStackTrace = x), a) || (!("handleUncaughtExceptions" in e) || e.handleUncaughtExceptions) && "object" == typeof process && null !== process && "function" == typeof process.on && (a = !0, i = process.emit, process.emit = function (e) { + if ("uncaughtException" === e) { + var t = arguments[1] && arguments[1].stack, + n = this.listeners(e).length > 0; + if (t && !n) return O(arguments[1]) + } + return i.apply(this, arguments) }) - } - }, a.compose = function () { - return a.seq.apply(null, Array.prototype.reverse.call(arguments)) - }; - var F = function (e, n) { - var t = function () { - var t = this, - r = h(arguments), - o = r.pop(); - return e(n, function (e, n) { - e.apply(t, r.concat([n])) - }, o) - }; - if (2 < arguments.length) { - var r = h(arguments, 2); - return t.apply(this, r) - } - return t - }; - a.applyEach = S(F), a.applyEachSeries = v(F), a.forever = function (e, n) { - function t(r) { - if (r) { - if (n) return n(r); - throw r - } - e(t) - } - t() - }, 'undefined' != typeof e && e.exports ? e.exports = a : (t = [], r = function () { - return a - }.apply(n, t), !(r !== void 0 && (e.exports = r))) - })() -}, function (e, n, t) { - 'use strict'; - - function r(e) { - const n = `desktop.${'production'}.log`; - return a.join(e, n) - } - - function o(e) { - const n = new s.transports.DailyRotateFile({ - filename: e, - handleExceptions: !1, - json: !1, - datePattern: 'yyyy-MM-dd.', - prepend: !0, - level: 'info', - maxFiles: c - }); - n.on('error', () => {}); - const t = new s.transports.Console({ - level: 'error' - }); - return s.configure({ - transports: [t, n] - }), s.log - } - - function i() { - return p ? p : (p = new Promise((e, n) => { - const t = d.getLogDirectoryPath(); - l.ensureDir(t).then(() => { + } +}, function (e, t, n) { + "use strict"; + const r = n(1); + e.exports = (e, t) => { + if ("string" != typeof e) throw new TypeError("Expected a string, got " + typeof e); + let n = e; + return (t = Object.assign({ + resolve: !0 + }, t)).resolve && (n = r.resolve(e)), n = n.replace(/\\/g, "/"), "/" !== n[0] && (n = "/" + n), encodeURI("file://" + n).replace(/[?#]/g, encodeURIComponent) + } +}, function (e, t, n) { + "use strict"; + const r = n(1), + i = n(0), + o = n(40), + s = n(42); + e.exports = function (e) { + const t = i.app || i.remote.app, + n = i.screen || i.remote.screen; + let a, c, l; + const u = Object.assign({ + file: "window-state.json", + path: t.getPath("userData"), + maximize: !0, + fullScreen: !0 + }, e), + f = r.join(u.path, u.file); + + function h() { + return a && Number.isInteger(a.x) && Number.isInteger(a.y) && Number.isInteger(a.width) && a.width > 0 && Number.isInteger(a.height) && a.height > 0 + } + + function p() { + const e = n.getPrimaryDisplay().bounds; + a = { + width: u.defaultWidth || 800, + height: u.defaultHeight || 600, + x: 0, + y: 0, + displayBounds: e + } + } + + function d() { + if (!n.getAllDisplays().some(e => { + return t = e.bounds, a.x >= t.x && a.y >= t.y && a.x + a.width <= t.x + t.width && a.y + a.height <= t.y + t.height; + var t + })) return p() + } + + function m(e) { + if (e = e || c) try { + const t = e.getBounds(); + (function (e) { + return !e.isMaximized() && !e.isMinimized() && !e.isFullScreen() + })(e) && (a.x = t.x, a.y = t.y, a.width = t.width, a.height = t.height), a.isMaximized = e.isMaximized(), a.isFullScreen = e.isFullScreen(), a.displayBounds = n.getDisplayMatching(t).bounds + } catch (e) {} + } + + function g(e) { + e && m(e); + try { + s.sync(r.dirname(f)), o.writeFileSync(f, a) + } catch (e) {} + } + + function y() { + clearTimeout(l), l = setTimeout(m, 100) + } + + function v() { + m() + } + + function w() { + b(), g() + } + + function b() { + c && (c.removeListener("resize", y), c.removeListener("move", y), clearTimeout(l), c.removeListener("close", v), c.removeListener("closed", w), c = null) + } try { - const n = o(r(t)); - e(n) - } catch (e) { - n(e) - } - }).catch((e) => { - n(e) - }) - }), p) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const a = t(0), - s = t(15), - d = t(44), - l = t(20); - t(83); - const c = 14; - let p = null; - n.log = async function (e, n) { - try { - const t = await i(); - await new Promise((r, o) => { - t(e, n, (e) => { - e ? o(e) : r() - }) - }) - } catch (e) {} - } -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.sendNonFatalException = function (e, n) { - process.emit('send-non-fatal-exception', n, { - kind: e + a = o.readFileSync(f) + } catch (e) {} + return a && (h() || a.isMaximized || a.isFullScreen) ? h() && a.displayBounds && d() : a = null, a = Object.assign({ + width: u.defaultWidth || 800, + height: u.defaultHeight || 600 + }, a), { + get x() { + return a.x + }, + get y() { + return a.y + }, + get width() { + return a.width + }, + get height() { + return a.height + }, + get displayBounds() { + return a.displayBounds + }, + get isMaximized() { + return a.isMaximized + }, + get isFullScreen() { + return a.isFullScreen + }, + saveState: g, + unmanage: b, + manage: function (e) { + u.maximize && a.isMaximized && e.maximize(), u.fullScreen && a.isFullScreen && e.setFullScreen(!0), e.on("resize", y), e.on("move", y), e.on("close", v), e.on("closed", w), c = e + }, + resetStateToDefault: p + } + } +}, function (e, t) { + e.exports = () => Promise.resolve({}) +}, function (e) { + e.exports = JSON.parse('{"name":"winston","description":"A multi-transport async logging library for Node.js","version":"2.3.1","author":"Charlie Robbins ","maintainers":["Jarrett Cruger ","Alberto Pose "],"repository":{"type":"git","url":"https://github.com/winstonjs/winston.git"},"keywords":["winston","logging","sysadmin","tools"],"dependencies":{"async":"~1.0.0","colors":"1.0.x","cycle":"1.0.x","eyes":"0.1.x","isstream":"0.1.x","stack-trace":"0.0.x"},"devDependencies":{"cross-spawn-async":"^2.0.0","hock":"1.x.x","std-mocks":"~1.0.0","vows":"0.7.x"},"main":"./lib/winston","scripts":{"test":"vows --spec --isolate"},"engines":{"node":">= 0.10.0"},"license":"MIT"}') +}, function (e, t, n) { + Object.defineProperty(t, "Console", { + configurable: !0, + enumerable: !0, + get: function () { + return n(57).Console + } + }), Object.defineProperty(t, "File", { + configurable: !0, + enumerable: !0, + get: function () { + return n(74).File + } + }), Object.defineProperty(t, "Http", { + configurable: !0, + enumerable: !0, + get: function () { + return n(76).Http + } + }), Object.defineProperty(t, "Memory", { + configurable: !0, + enumerable: !0, + get: function () { + return n(79).Memory + } }) - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n) { - return (e ? e.toLowerCase() : e) === (n ? n.toLowerCase() : n) - } - - function o() { - const e = a.Menu.buildFromTemplate([{ - role: 'editMenu' - }]).items[0], - n = e && e.submenu ? e.submenu.items : []; - return n.filter((e) => !r(e.role, 'pasteandmatchstyle')) - } - - function i(e, n, t = []) { - const s = new a.Menu; - for (const [d, l] of e.entries()) - if (r(l.role, 'editmenu')) - for (const e of o()) s.append(e); - else { - const e = [...t, d]; - s.append(new a.MenuItem({ - label: l.label, - type: l.type, - enabled: l.enabled, - role: l.role, - click: () => n(e), - submenu: l.submenu ? i(l.submenu, n, e) : void 0 - })) - } return s - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const a = t(4); - n.buildContextMenu = function (e, n) { - return i(e, n) - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(4), - o = t(29), - i = t(28), - a = 600, - s = 500; - n.CrashWindow = class { - constructor(e, n) { - this.emitter = new o.Emitter, this.hasFinishedLoading = !1, this.hasSentReadyEvent = !1; - const t = { - width: a, - height: s, - minWidth: a, - minHeight: s, - show: !1, - backgroundColor: '#fff', - webPreferences: { - disableBlinkFeatures: 'Auxclick', - experimentalFeatures: !1, - nodeIntegration: !0 - } - }; - t.frame = !1, this.window = new r.BrowserWindow(t), this.error = n, this.errorType = e - } - load() { - log.debug('Starting crash process'), this.window.webContents.once('did-start-loading', () => { - log.debug('Crash process in startup') - }), this.window.webContents.once('did-finish-load', () => { - log.debug('Crash process started'), !1, this.hasFinishedLoading = !0, this.maybeEmitDidLoad() - }), this.window.webContents.on('did-finish-load', () => { - this.window.webContents.setVisualZoomLevelLimits(1, 1) - }), this.window.webContents.on('did-fail-load', () => { - log.error('Crash process failed to load'), this.emitter.emit('did-fail-load', null) - }), r.ipcMain.on('crash-ready', () => { - log.debug(`Crash process is ready`), this.hasSentReadyEvent = !0, this.sendError(), this.maybeEmitDidLoad() - }), r.ipcMain.on('crash-quit', () => { - log.debug('Got quit signal from crash process'), this.window.close() - }), i.registerWindowStateChangedEvents(this.window), this.window.loadURL(`file://${__dirname}/crash.html`) - } - maybeEmitDidLoad() { - this.hasFinishedLoading && this.hasSentReadyEvent && this.emitter.emit('did-load', null) - } - onClose(e) { - this.window.on('closed', e) - } - onFailedToLoad(e) { - this.emitter.on('did-fail-load', e) - } - onDidLoad(e) { - return this.emitter.on('did-load', e) - } - focus() { - this.window.focus() - } - show() { - log.debug('Showing crash process window'), this.window.show() - } - sendError() { - const e = { - stack: this.error.stack, - message: this.error.message, - name: this.error.name - }, - n = { - type: this.errorType, - error: e +}, function (e, t, n) { + n(14); + var r = n(9), + i = n(7), + o = n(12), + s = n(16).Transport, + a = t.Console = function (e) { + s.call(this, e), e = e || {}, this.json = e.json || !1, this.colorize = e.colorize || !1, this.prettyPrint = e.prettyPrint || !1, this.timestamp = void 0 !== e.timestamp && e.timestamp, this.showLevel = void 0 === e.showLevel || e.showLevel, this.label = e.label || null, this.logstash = e.logstash || !1, this.depth = e.depth || null, this.align = e.align || !1, this.stderrLevels = function (e, t) { + var n = "Cannot have non-string elements in stderrLevels Array"; + if (t) { + if (e) throw new Error("Cannot set debugStdout and stderrLevels together"); + return o.stringArrayToSet(["error"], n) + } + if (!e) return o.stringArrayToSet(["error", "debug"], n); + if (!Array.isArray(e)) throw new Error("Cannot set stderrLevels to type other than Array"); + return o.stringArrayToSet(e, n) + }(e.stderrLevels, e.debugStdout), this.eol = e.eol || r.EOL, this.json && (this.stringify = e.stringify || function (e) { + return JSON.stringify(e, null, 2) + }) }; - this.window.webContents.send('error', n) - } - destroy() { - this.window.destroy() - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n) { - if (log.error(a.formatError(n)), d) return; - d = !0, i.setCrashMenu(); - const t = new s.CrashWindow(e ? 'launch' : 'generic', n); - t.onDidLoad(() => { - t.show() - }), t.onFailedToLoad(async () => { - await o.dialog.showMessageBox({ - type: 'error', - title: '无法恢复的错误', - message: `GitHub Desktop遇到了一个无法恢复的错误,需要重新启动。${n.stack||n.message}` - }), o.app.relaunch(), o.app.quit() - }), t.onClose(() => { - o.app.relaunch(), o.app.quit() - }), t.load() - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(4), - i = t(25), - a = t(34), - s = t(51); - let d = !1; - n.showUncaughtException = r -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(4); - n.reportError = async function (e, n, t) { - const o = new Map; - if (o.set('name', e.name), o.set('message', e.message), e.stack && o.set('stack', e.stack), o.set('platform', 'win32'), o.set('sha', '41e70ee49004936e5e1058d406996961bd475cf2'), o.set('version', r.app.getVersion()), n) - for (const e of Object.keys(n)) o.set(e, n[e]); - const i = { - method: 'POST', - url: t ? 'https://central.github.com/api/desktop-non-fatal/exception' : 'https://central.github.com/api/desktop/exception', - headers: { - "Content-Type": 'application/x-www-form-urlencoded' - } - }, - a = [...o.entries()].map(([e, n]) => `${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join('&'); - try { - await new Promise((e, n) => { - const t = r.net.request(i); - t.on('response', (t) => { - 200 === t.statusCode ? e() : n(`Got ${t.statusCode} - ${t.statusMessage} from central`) - }), t.on('error', n), t.end(a) - }), log.info('Error report submitted') - } catch (n) { - log.error('Failed submitting error report', e) - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n) { - try { - const t = o.spawn(e, n); - return new Promise((r, o) => { - let i = ''; - t.stdout && t.stdout.on('data', (e) => { - i += e - }), t.on('close', (t) => { - 0 === t ? r(i) : o(new Error(`Command "${e} ${n}" failed: "${i}"`)) - }), t.on('error', (e) => { - o(e) - }), t.stdin && t.stdin.end() - }) - } catch (e) { - return Promise.reject(e) - } - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(22), - i = t(0); - n.getPathSegments = async function () { - let e; - const n = process.env.SystemRoot; - if (null != n) { - const t = i.join(n, 'System32'); - e = i.join(t, 'WindowsPowerShell', 'v1.0', 'powershell.exe') - } else e = 'powershell.exe'; - const t = ['-noprofile', '-ExecutionPolicy', 'RemoteSigned', '-command', ` - [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 - $output=[environment]::GetEnvironmentVariable('Path', 'User') - [Console]::WriteLine($output) - `], - o = await r(e, t), - a = o.replace(/^\s+|\s+$/g, ''); - return a.split(/;+/).filter((e) => e.length) - }, n.setPathSegments = async function (e) { - let n; - const t = process.env.SystemRoot; - if (t) { - const e = i.join(t, 'System32'); - n = i.join(e, 'setx.exe') - } else n = 'setx.exe'; - await r(n, ['Path', e.join(';')]) - }, n.spawn = r -}, function (e, n, t) { - 'use strict'; - async function r() { - await p(['StartMenu', 'Desktop']), await i() - } - async function o() { - await g(), await i() - } - async function i() { - const e = a(); - await y.ensureDir(e), await d(e), await l(e); - const n = await _.getPathSegments(); - 0 > n.indexOf(e) && (await _.setPathSegments([...n, e])) - } - - function a() { - return f.resolve(process.execPath, '../../bin') - } - - function s(e, n) { - const t = f.resolve(process.execPath, '..'); - return f.relative(e, f.join(t, n)) - } - - function d(e) { - const n = s(e, 'resources/app/static/github.bat'), - t = `@echo off\n"%~dp0\\${n}" %*`, - r = f.join(e, 'github.bat'); - return y.writeFile(r, t) - } - - function l(e) { - const n = s(e, 'resources/app/static/github.sh').replace(/\\/g, '/'), - t = `#!/usr/bin/env bash - DIR="$( cd "$( dirname "\$\{BASH_SOURCE[0]\}" )" && pwd )" - sh "$DIR/${n}" "$@"`, - r = f.join(e, 'github'); - return y.writeFile(r, t, { - encoding: 'utf8', - mode: 755 + i.inherits(a, s), a.prototype.name = "console", a.prototype.log = function (e, t, n, r) { + if (this.silent) return r(null, !0); + var i; + i = o.log({ + colorize: this.colorize, + json: this.json, + level: e, + message: t, + meta: n, + stringify: this.stringify, + timestamp: this.timestamp, + showLevel: this.showLevel, + prettyPrint: this.prettyPrint, + raw: this.raw, + label: this.label, + logstash: this.logstash, + depth: this.depth, + formatter: this.formatter, + align: this.align, + humanReadableUnhandledException: this.humanReadableUnhandledException + }), this.stderrLevels[e] ? process.stderr.write(i + this.eol) : process.stdout.write(i + this.eol), this.emit("logged"), r(null, !0) + } +}, function (e, t) { + e.exports = require("crypto") +}, function (module, exports) { + var cycle = exports; + cycle.decycle = function (e) { + "use strict"; + var t = [], + n = []; + return function e(r, i) { + var o, s, a; + if (!("object" != typeof r || null === r || r instanceof Boolean || r instanceof Date || r instanceof Number || r instanceof RegExp || r instanceof String)) { + for (o = 0; o < t.length; o += 1) + if (t[o] === r) return { + $ref: n[o] + }; + if (t.push(r), n.push(i), "[object Array]" === Object.prototype.toString.apply(r)) + for (a = [], o = 0; o < r.length; o += 1) a[o] = e(r[o], i + "[" + o + "]"); + else + for (s in a = {}, r) Object.prototype.hasOwnProperty.call(r, s) && (a[s] = e(r[s], i + "[" + JSON.stringify(s) + "]")); + return a + } + return r + }(e, "$") + }, cycle.retrocycle = function retrocycle($) { + "use strict"; + var px = /^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/; + return function rez(value) { + var i, item, name, path; + if (value && "object" == typeof value) + if ("[object Array]" === Object.prototype.toString.apply(value)) + for (i = 0; i < value.length; i += 1) item = value[i], item && "object" == typeof item && (path = item.$ref, "string" == typeof path && px.test(path) ? value[i] = eval(path) : rez(item)); + else + for (name in value) "object" == typeof value[name] && (item = value[name], item && (path = item.$ref, "string" == typeof path && px.test(path) ? value[name] = eval(path) : rez(item))) + }($), $ + } +}, function (e, t) { + e.exports = require("string_decoder") +}, function (e, t, n) { + var r = n(15); + e.exports = r +}, function (e, t) { + var n = {}; + e.exports = n; + var r = { + reset: [0, 0], + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + grey: [90, 39], + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + blackBG: [40, 49], + redBG: [41, 49], + greenBG: [42, 49], + yellowBG: [43, 49], + blueBG: [44, 49], + magentaBG: [45, 49], + cyanBG: [46, 49], + whiteBG: [47, 49] + }; + Object.keys(r).forEach((function (e) { + var t = r[e], + i = n[e] = []; + i.open = "[" + t[0] + "m", i.close = "[" + t[1] + "m" + })) +}, function (e, t, n) { + var r = process.argv; + e.exports = -1 === r.indexOf("--no-color") && -1 === r.indexOf("--color=false") && (-1 !== r.indexOf("--color") || -1 !== r.indexOf("--color=true") || -1 !== r.indexOf("--color=always") || !(process.stdout && !process.stdout.isTTY)) +}, function (e, t) { + function n(e) { + var t = new Error("Cannot find module '" + e + "'"); + throw t.code = "MODULE_NOT_FOUND", t + } + n.keys = function () { + return [] + }, n.resolve = n, e.exports = n, n.id = 64 +}, function (e, t) { + e.exports = function (e, t) { + var n = ""; + e = (e = e || "Run the trap, drop the bass").split(""); + var r = { + a: ["@", "Ą", "Ⱥ", "Ʌ", "Δ", "Λ", "Д"], + b: ["ß", "Ɓ", "Ƀ", "ɮ", "β", "฿"], + c: ["©", "Ȼ", "Ͼ"], + d: ["Ð", "Ɗ", "Ԁ", "ԁ", "Ԃ", "ԃ"], + e: ["Ë", "ĕ", "Ǝ", "ɘ", "Σ", "ξ", "Ҽ", "੬"], + f: ["Ӻ"], + g: ["ɢ"], + h: ["Ħ", "ƕ", "Ң", "Һ", "Ӈ", "Ԋ"], + i: ["༏"], + j: ["Ĵ"], + k: ["ĸ", "Ҡ", "Ӄ", "Ԟ"], + l: ["Ĺ"], + m: ["ʍ", "Ӎ", "ӎ", "Ԡ", "ԡ", "൩"], + n: ["Ñ", "ŋ", "Ɲ", "Ͷ", "Π", "Ҋ"], + o: ["Ø", "õ", "ø", "Ǿ", "ʘ", "Ѻ", "ם", "۝", "๏"], + p: ["Ƿ", "Ҏ"], + q: ["্"], + r: ["®", "Ʀ", "Ȑ", "Ɍ", "ʀ", "Я"], + s: ["§", "Ϟ", "ϟ", "Ϩ"], + t: ["Ł", "Ŧ", "ͳ"], + u: ["Ʊ", "Ս"], + v: ["ט"], + w: ["Ш", "Ѡ", "Ѽ", "൰"], + x: ["Ҳ", "Ӿ", "Ӽ", "ӽ"], + y: ["¥", "Ұ", "Ӌ"], + z: ["Ƶ", "ɀ"] + }; + return e.forEach((function (e) { + e = e.toLowerCase(); + var t = r[e] || [" "], + i = Math.floor(Math.random() * t.length); + n += void 0 !== r[e] ? r[e][i] : e + })), n + } +}, function (e, t) { + e.exports = function (e, t) { + e = e || " he is here "; + var n = { + up: ["̍", "̎", "̄", "̅", "̿", "̑", "̆", "̐", "͒", "͗", "͑", "̇", "̈", "̊", "͂", "̓", "̈", "͊", "͋", "͌", "̃", "̂", "̌", "͐", "̀", "́", "̋", "̏", "̒", "̓", "̔", "̽", "̉", "ͣ", "ͤ", "ͥ", "ͦ", "ͧ", "ͨ", "ͩ", "ͪ", "ͫ", "ͬ", "ͭ", "ͮ", "ͯ", "̾", "͛", "͆", "̚"], + down: ["̖", "̗", "̘", "̙", "̜", "̝", "̞", "̟", "̠", "̤", "̥", "̦", "̩", "̪", "̫", "̬", "̭", "̮", "̯", "̰", "̱", "̲", "̳", "̹", "̺", "̻", "̼", "ͅ", "͇", "͈", "͉", "͍", "͎", "͓", "͔", "͕", "͖", "͙", "͚", "̣"], + mid: ["̕", "̛", "̀", "́", "͘", "̡", "̢", "̧", "̨", "̴", "̵", "̶", "͜", "͝", "͞", "͟", "͠", "͢", "̸", "̷", "͡", " ҉"] + }, + r = [].concat(n.up, n.down, n.mid); + + function i(e) { + return Math.floor(Math.random() * e) + } + + function o(e) { + var t = !1; + return r.filter((function (n) { + t = n === e + })), t + } + return function (e, t) { + var r, s, a = ""; + for (s in (t = t || {}).up = t.up || !0, t.mid = t.mid || !0, t.down = t.down || !0, t.size = t.size || "maxi", e = e.split("")) + if (!o(s)) { + switch (a += e[s], r = { + up: 0, + down: 0, + mid: 0 + }, t.size) { + case "mini": + r.up = i(8), r.min = i(2), r.down = i(8); + break; + case "maxi": + r.up = i(16) + 3, r.min = i(4) + 1, r.down = i(64) + 3; + break; + default: + r.up = i(8) + 1, r.mid = i(6) / 2, r.down = i(8) + 1 + } + var c = ["up", "mid", "down"]; + for (var l in c) + for (var u = c[l], f = 0; f <= r[u]; f++) t[u] && (a += n[u][i(n[u].length)]) + } return a + }(e) + } +}, function (e, t, n) { + var r = n(15); + e.exports = function (e, t, n) { + if (" " === e) return e; + switch (t % 3) { + case 0: + return r.red(e); + case 1: + return r.white(e); + case 2: + return r.blue(e) + } + } +}, function (e, t, n) { + var r = n(15); + e.exports = function (e, t, n) { + return t % 2 == 0 ? e : r.inverse(e) + } +}, function (e, t, n) { + var r, i = n(15); + e.exports = (r = ["red", "yellow", "green", "blue", "magenta"], function (e, t, n) { + return " " === e ? e : i[r[t++ % r.length]](e) + }) +}, function (e, t, n) { + var r, i = n(15); + e.exports = (r = ["underline", "inverse", "grey", "yellow", "red", "green", "blue", "white", "cyan", "magenta"], function (e, t, n) { + return " " === e ? e : i[r[Math.round(Math.random() * (r.length - 1))]](e) }) - } - async function c(e) { - await _.spawn(w, e) - } - - function p(e) { - return c(['--createShortcut', v, '-l', e.join(',')]) - } - async function u() { - await m(); - const e = await _.getPathSegments(), - n = a(), - t = e.filter((e) => e !== n); - return _.setPathSegments(t) - } - - function m() { - return c(['--removeShortcut', v]) - } - async function g() { - const e = h.homedir(); - if (e) { - const n = f.join(e, 'Desktop', 'GitHub Desktop.lnk'), - t = await y.pathExists(n), - r = t ? ['StartMenu', 'Desktop'] : ['StartMenu']; - return p(r) - } - return p(['StartMenu', 'Desktop']) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const f = t(0), - h = t(10), - y = t(20), - _ = t(54), - b = f.resolve(process.execPath, '..'), - S = f.resolve(b, '..'), - w = f.resolve(f.join(S, 'Update.exe')), - v = f.basename(process.execPath); - n.handleSquirrelEvent = function (e) { - return '--squirrel-install' === e ? r() : '--squirrel-updated' === e ? o() : '--squirrel-uninstall' === e ? u() : '--squirrel-obsolete' === e ? Promise.resolve() : null - } -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const t = /[\x00-\x20\x7F~^:?*\[\\|""<>]+|@{|\.\.+|^\.|\.$|\.lock$|\/$/g; - n.sanitizedRefName = function (e) { - return e.replace(t, '-').replace(/^[-\+]*/g, '') - }, n.testForInvalidChars = function (e) { - return t.test(e) - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n) { - const t = e[n]; - return null == t ? null : Array.isArray(t) ? t[0] : t - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(18), - i = t(56); - n.parseAppURL = function (e) { - const n = o.parse(e, !0), - t = n.hostname, - a = { - name: 'unknown', - url: e - }; - if (!t) return a; - const s = n.query, - d = t.toLowerCase(); - if ('oauth' === d) { - const e = r(s, 'code'), - n = r(s, 'state'); - return null != e && null != n ? { - name: 'oauth', - code: e, - state: n - } : a - } - const l = n.pathname; - if (!l || 1 >= l.length) return a; - const c = l.substr(1); - if ('openrepo' === d) { - const e = r(s, 'pr'), - n = r(s, 'branch'), - t = r(s, 'filepath'); - if (null != e) { - if (!/^\d+$/.test(e)) return a; - if (null != n && !/^pr\/\d+$/.test(n)) return a - } - return null != n && i.testForInvalidChars(n) ? a : { - name: 'open-repository-from-url', - url: c, - branch: n, - pr: e, - filepath: t - } - } - return 'openlocalrepo' === d ? { - name: 'open-repository-from-path', - path: decodeURIComponent(c) - } : a - } -}, function (e, n, t) { - 'use strict'; - async function r() { - const e = o(), - n = new Promise((n) => { - let t = null, - r = null, - o = '', - i = !1; - const a = () => { - !i && t && (t.kill(), i = !0) +}, function (e, t) { + var n = t; + n.levels = { + error: 0, + warn: 1, + help: 2, + data: 3, + info: 4, + debug: 5, + prompt: 6, + verbose: 7, + input: 8, + silly: 9 + }, n.colors = { + error: "red", + warn: "yellow", + help: "cyan", + data: "grey", + info: "green", + debug: "blue", + prompt: "grey", + verbose: "cyan", + input: "grey", + silly: "magenta" + } +}, function (e, t) { + var n = t; + n.levels = { + error: 0, + warn: 1, + info: 2, + verbose: 3, + debug: 4, + silly: 5 + }, n.colors = { + error: "red", + warn: "yellow", + info: "green", + verbose: "cyan", + debug: "blue", + silly: "magenta" + } +}, function (e, t) { + var n = t; + n.levels = { + emerg: 0, + alert: 1, + crit: 2, + error: 3, + warning: 4, + notice: 5, + info: 6, + debug: 7 + }, n.colors = { + emerg: "red", + alert: "yellow", + crit: "red", + error: "red", + warning: "red", + notice: "yellow", + info: "green", + debug: "blue" + } +}, function (e, t, n) { + n(14); + var r = n(3), + i = n(1), + o = n(7), + s = n(30), + a = n(31), + c = n(12), + l = n(16).Transport, + u = n(75).isWritable, + f = n(11).Stream, + h = n(9), + p = t.File = function (e) { + var t = this; + + function n(t) { + Array.prototype.slice.call(arguments, 1).forEach((function (n) { + if (e[n]) throw new Error("Cannot set " + n + " and " + t + "together") + })) + } + if (l.call(this, e), e.filename || e.dirname) n("filename or dirname", "stream"), this._basename = this.filename = e.filename ? i.basename(e.filename) : "winston.log", this.dirname = e.dirname || i.dirname(e.filename), this.options = e.options || { + flags: "a" + }, this.options.highWaterMark = this.options.highWaterMark || 24; + else { + if (!e.stream) throw new Error("Cannot log to file without filename or stream."); + n("stream", "filename", "maxsize"), this._stream = e.stream, this._isStreams2 = u(this._stream), this._stream.on("error", (function (e) { + t.emit("error", e) + })), this._stream.setMaxListeners(1 / 0) + } + this.json = !1 !== e.json, this.logstash = e.logstash || !1, this.colorize = e.colorize || !1, this.maxsize = e.maxsize || null, this.rotationFormat = e.rotationFormat || !1, this.zippedArchive = e.zippedArchive || !1, this.maxFiles = e.maxFiles || null, this.prettyPrint = e.prettyPrint || !1, this.label = e.label || null, this.timestamp = null == e.timestamp || e.timestamp, this.eol = e.eol || h.EOL, this.tailable = e.tailable || !1, this.depth = e.depth || null, this.showLevel = void 0 === e.showLevel || e.showLevel, this.maxRetries = e.maxRetries || 2, this.json && (this.stringify = e.stringify), this._size = 0, this._created = 0, this._buffer = [], this._draining = !1, this._opening = !1, this._failures = 0, this._archive = null }; - process.once('exit', a), setTimeout(() => { - a() - }, 5e3), t = s.spawn(e, ['-ilc', 'command env'], { - detached: !0, - stdio: ['ignore', 'pipe', process.stderr] + o.inherits(p, l), p.prototype.name = "file", p.prototype.log = function (e, t, n, r) { + if (this.silent) return r(null, !0); + if (this._failures >= this.maxRetries) return r(new Error("Transport is in a failed state.")); + var i = this; + "string" != typeof t && (t = "" + t); + var o = c.log({ + level: e, + message: t, + meta: n, + json: this.json, + logstash: this.logstash, + colorize: this.colorize, + prettyPrint: this.prettyPrint, + timestamp: this.timestamp, + showLevel: this.showLevel, + stringify: this.stringify, + label: this.label, + depth: this.depth, + formatter: this.formatter, + humanReadableUnhandledException: this.humanReadableUnhandledException }); - const d = []; - t.on('error', (n) => { - i = !0, r = n - }), t.stdout && t.stdout.on('data', (e) => { - d.push(e) - }), t.on('close', () => { - i = !0, process.removeListener('exit', a), d.length && (o = Buffer.concat(d).toString('utf8')), n({ - stdout: o, - error: r - }) - }) - }), - { - stdout: t, - error: r - } = await n; - return r ? null : t - } - - function o() { - return process.env.SHELL ? process.env.SHELL : '/bin/bash' - } - async function i(e) {} - - function a(e) { - for (const n in e) l.has(n) || (process.env[n] = e[n]) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const s = t(22), - d = t(10), - l = new Set(['LOCAL_GIT_DIRECTORY']); - n.shellNeedsPatching = function () { - return !1 - }, n.updateEnvironmentForProcess = function () { - return i(a) - } -}, function (e, n) { - 'use strict'; - - function* t(e) { - for (const n of e.items) yield n, 'submenu' === n.type && void 0 !== n.submenu && (yield* t(n.submenu)) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.getAllMenuItems = t -}, function (e, n, t) { - 'use strict'; - - function r(e) { - let n = !1; - if (e.submenu instanceof o.Menu) - for (const t of e.submenu.items) r(t) && (n = !0); - if (n || e.role) return !0; - const t = e.id; - return !('show-devtools' !== t && 'reload-window' !== t) || (e.enabled = !1, !1) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(4); - n.setCrashMenu = function () { - const e = o.Menu.getApplicationMenu(); - if (e) - for (const n of e.items) r(n) - } -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const t = ['.cmd', '.exe', '.bat', '.sh']; - n.CopyFilePathLabel = '复制文件路径', n.DefaultEditorLabel = '用外部编辑器打开', n.RevealInFileManagerLabel = '在资源管理器中显示', n.TrashNameLabel = '回收站', n.OpenWithDefaultProgramLabel = '用默认程序打开', n.isSafeFileExtension = function (e) { - return -1 === t.indexOf(e.toLowerCase()) - } -}, function (e, n) { - 'use strict'; - - function t() { - return !1, '1' === process.env.GITHUB_DESKTOP_PREVIEW_FEATURES - } - - function r() { - return t() || !1 - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - n.enableProgressBarOnIcon = function () { - return r() - }, n.enableRecurseSubmodulesFlag = function () { - return r() - }, n.enableReadmeOverwriteWarning = function () { - return r() - }, n.enableWSLDetection = function () { - return r() - }, n.enableCreateForkFlow = function () { - return !0 - }, n.enableSchannelCheckRevokeOptOut = function () { - return !0 - }, n.enableAutomaticGitProxyConfiguration = function () { - return !0 - }, n.enableCreateGitHubIssueFromMenu = function () { - return !0 - }, n.enableUpdateRemoteUrl = function () { - return !0 - }, n.enableForkyCreateBranchUI = function () { - return !0 - }, n.enableNDDBBanner = function () { - return !1 - }, n.enableGitTagsDisplay = function () { - return !0 - }, n.enableGitTagsCreation = function () { - return !0 - }, n.enableForkSettings = function () { - return !0 - }, n.enableDiscardLines = function () { - return !0 - } -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.truncateWithEllipsis = function (e, n) { - if (e.length <= n) return e; - const t = [...e]; - if (t.length <= n) return e; - const r = t.reduce((e, n) => ('\uFE00' <= n && '\uFE0F' >= n ? e.length && e.push(`${e.pop()}${n}`) : e.push(n), e), []); - if (r.length <= n) return e; - const o = r.slice(0, n).join(''); - return `${o}…` - } -}, function (e, n, t) { - 'use strict'; - - function r({ - selectedExternalEditor: e, - selectedShell: n, - askForConfirmationOnForcePush: t, - askForConfirmationOnRepositoryRemoval: r, - hasCurrentPullRequest: s = !1, - defaultBranchName: l = w, - isForcePushForCurrentRepository: M = !1, - isStashedChangesVisible: L = !1, - askForConfirmationWhenStashingAllChanges: O = !0 - }) { - l = u.truncateWithEllipsis(l, 25); - const P = r ? v : x, - F = s ? S : b, - T = null === n ? _ : `用${n}打开`, - N = null === e ? y.DefaultEditorLabel : `用${e}打开`, - A = [], - R = { - type: 'separator' - }; - const I = { - label: '文件(&F)', - submenu: [{ - label: '新建 存储库\u2026', - id: 'new-repository', - click: a('create-repository'), - accelerator: 'CmdOrCtrl+N' - }, R, { - label: '添加 本地存储库\u2026', - id: 'add-local-repository', - accelerator: 'CmdOrCtrl+O', - click: a('add-local-repository') - }, { - label: '克隆 存储库\u2026', - id: 'clone-repository', - accelerator: 'CmdOrCtrl+Shift+O', - click: a('clone-repository') - }] - }; { - const e = I.submenu; - e.push(R, { - label: '&选项\u2026', - id: 'preferences', - accelerator: 'CmdOrCtrl+,', - click: a('show-preferences') - }, R, { - role: 'quit', - label: '退出', - accelerator: 'Alt+F4' - }) - } - A.push(I), A.push({ - label: '编辑(&E)', - submenu: [{ - role: 'undo', - label: '&撤消' - }, { - role: 'redo', - label: '&恢复' - }, R, { - role: 'cut', - label: '剪切' - }, { - role: 'copy', - label: '&复制' - }, { - role: 'paste', - label: '&粘贴' - }, { - label: '全选', - accelerator: 'CmdOrCtrl+A', - click: a('select-all') - }, R, { - id: 'find', - label: '&查找', - accelerator: 'CmdOrCtrl+F', - click: a('find-text') - }] - }), A.push({ - label: '视图(&V)', - submenu: [{ - label: '&更改', - id: 'show-changes', - accelerator: 'CmdOrCtrl+1', - click: a('show-changes') - }, { - label: '&历史', - id: 'show-history', - accelerator: 'CmdOrCtrl+2', - click: a('show-history') - }, { - label: '存储库列表', - id: 'show-repository-list', - accelerator: 'CmdOrCtrl+T', - click: a('choose-repository') - }, { - label: '分支列表', - id: 'show-branches-list', - accelerator: 'CmdOrCtrl+B', - click: a('show-branches') - }, R, { - label: '转到摘要', - id: 'go-to-commit-message', - accelerator: 'CmdOrCtrl+G', - click: a('go-to-commit-message') - }, { - label: i(L), - id: 'toggle-stashed-changes', - accelerator: 'Ctrl+H', - click: L ? a('hide-stashed-changes') : a('show-stashed-changes') - }, { - label: '全屏切换', - role: 'togglefullscreen' - }, R, { - label: '重置缩放', - accelerator: 'CmdOrCtrl+0', - click: d(k.Reset) - }, { - label: '放大', - accelerator: 'CmdOrCtrl+=', - click: d(k.In) - }, { - label: '缩小', - accelerator: 'CmdOrCtrl+-', - click: d(k.Out) - }, R, { - label: '&重载', - id: 'reload-window', - accelerator: 'CmdOrCtrl+Alt+R', - click(e, n) { - n && n.reload() - }, - visible: !1 - }, { - id: 'show-devtools', - label: '&开发工具', - accelerator: (() => 'Ctrl+Shift+I')(), - click(e, n) { - n && n.webContents.toggleDevTools() - } - }] - }); - const D = o(M, t), - z = M ? 'force-push' : 'push'; - A.push({ - label: '存储库(&R)', - id: 'repository', - submenu: [{ - id: 'push', - label: D, - accelerator: 'CmdOrCtrl+P', - click: a(z) - }, { - id: 'pull', - label: '拉取', - accelerator: 'CmdOrCtrl+Shift+P', - click: a('pull') - }, { - label: P, - id: 'remove-repository', - accelerator: 'CmdOrCtrl+Backspace', - click: a('remove-repository') - }, R, { - id: 'view-repository-on-github', - label: '在Github上查看', - accelerator: 'CmdOrCtrl+Shift+G', - click: a('view-repository-on-github') - }, { - label: T, - id: 'open-in-shell', - accelerator: 'Ctrl+`', - click: a('open-in-shell') - }, { - label: '资源管理器', - id: 'open-working-directory', - accelerator: 'CmdOrCtrl+Shift+F', - click: a('open-working-directory') - }, { - label: N, - id: 'open-external-editor', - accelerator: 'CmdOrCtrl+Shift+A', - click: a('open-external-editor') - }, R, { - id: 'create-issue-in-repository-on-github', - label: '在 GitHub 上新建问题', - accelerator: 'CmdOrCtrl+I', - click: a('create-issue-in-repository-on-github'), - visible: h.enableCreateGitHubIssueFromMenu() - }, R, { - label: '存储库设置\u2026', - id: 'show-repository-settings', - click: a('show-repository-settings') - }] - }), A.push({ - label: '分支(&B)', - id: 'branch', - submenu: [{ - label: '新建分支\u2026', - id: 'create-branch', - accelerator: 'CmdOrCtrl+Shift+N', - click: a('create-branch') - }, { - label: '重命名\u2026', - id: 'rename-branch', - accelerator: 'CmdOrCtrl+Shift+R', - click: a('rename-branch') - }, { - label: '删除\u2026', - id: 'delete-branch', - accelerator: 'CmdOrCtrl+Shift+D', - click: a('delete-branch') - }, R, { - label: '放弃所有更改\u2026', - id: 'discard-all-changes', - accelerator: 'CmdOrCtrl+Shift+Backspace', - click: a('discard-all-changes') - }, { - label: O ? E : C, - id: 'stash-all-changes', - accelerator: 'CmdOrCtrl+Shift+S', - click: a('stash-all-changes') - }, R, { - label: `更新自${l}`, - id: 'update-branch', - accelerator: 'CmdOrCtrl+Shift+U', - click: a('update-branch') - }, { - label: '与分支比较', - id: 'compare-to-branch', - accelerator: 'CmdOrCtrl+Shift+B', - click: a('compare-to-branch') - }, { - label: '合并到当前分支\u2026', - id: 'merge-branch', - accelerator: 'CmdOrCtrl+Shift+M', - click: a('merge-branch') - }, { - label: '恢复当前分支\u2026', - id: 'rebase-branch', - accelerator: 'CmdOrCtrl+Shift+E', - click: a('rebase-branch') - }, R, { - label: '前往GitHub比较', - id: 'compare-on-github', - accelerator: 'CmdOrCtrl+Shift+C', - click: a('compare-on-github') - }, { - label: F, - id: 'create-pull-request', - accelerator: 'CmdOrCtrl+R', - click: a('open-pull-request') - }] - }), !1; - const j = { - label: '反馈问题\u2026', - click() { - c.shell.openExternal('https://github.com/desktop/desktop/issues/new/choose').catch((e) => log.error('Failed opening issue creation page', e)) - } - }, - B = { - label: '联系Github支持\u2026', - click() { - c.shell.openExternal(`https://github.com/contact?from_desktop_app=1&app_version=${c.app.getVersion()}`).catch((e) => log.error('Failed opening contact support page', e)) - } - }, - U = { - label: '用户指南', - click() { - c.shell.openExternal('https://help.github.com/desktop/guides/').catch((e) => log.error('Failed opening user guides page', e)) - } - }, - W = { - label: '键盘快捷键', - click() { - c.shell.openExternal('https://help.github.com/en/desktop/getting-started-with-github-desktop/keyboard-shortcuts-in-github-desktop').catch((e) => log.error('Failed opening keyboard shortcuts page', e)) - } - }, - G = '打开日志文件夹', - H = { - label: G, - click() { - const e = m.getLogDirectoryPath(); - g.ensureDir(e).then(() => { - f.openDirectorySafe(e) - }).catch((e) => { - log.error('Failed opening logs directory', e) - }) - } - }; - return !1, A.push({ - label: '帮助(&H)', - submenu: [...[j, B, U, W, H], R, { - label: '关于 Github 桌面', - click: a('show-about'), - id: 'about' - }] - }), p.ensureItemIds(A), c.Menu.buildFromTemplate(A) - } - - function o(e, n) { - return e ? n ? '强制推送\u2026' : '强制推送' : '推送' - } - - function i(e) { - return e ? '隐藏贮藏的变更' : '显示贮藏的变更' - } - - function a(e) { - return (n, t) => { - t ? t.webContents.send('menu-event', { - name: e - }) : c.ipcMain.emit('menu-event', { - name: e - }) - } - } - - function s(e, n) { - return e.reduce((e, t) => l(t - n) < l(e - n) ? t : e) - } - - function d(e) { - return (n, t) => { - if (t) { - const { - webContents: n - } = t; - if (e === k.Reset) n.zoomFactor = 1, n.send('zoom-factor-changed', 1); - else { - const t = n.zoomFactor, - r = e === k.In ? M : L, - o = s(r, t), - i = r.find((n) => e === k.In ? n > o : n < o), - a = void 0 === i ? o : i; - n.zoomFactor = a, n.send('zoom-factor-changed', a) - } - } - } - } - var l = Math.abs; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const c = t(4), - p = t(24), - u = t(63), - m = t(44), - g = t(20), - f = t(23), - h = t(62), - y = t(61), - _ = '在命令提示符下打开', - b = '创建拉取请求', - S = '显示拉取请求', - w = '默认分支', - v = '删除\u2026', - x = '删除', - E = '保存所有更改\u2026', - C = '保存所有更改'; - var k; - (function (e) { - e[e.Reset = 0] = 'Reset', e[e.In = 1] = 'In', e[e.Out = 2] = 'Out' - })(k || (k = {})), n.buildDefaultMenu = r; - const M = [1, 1.1, 1.25, 1.5, 1.75, 2], - L = M.slice().reverse() -}, function (e, n, t) { - 'use strict'; - const r = t(0), - o = t(4), - i = t(36), - a = t(35); - e.exports = function (e) { - function n(e) { - return !e.isMaximized() && !e.isMinimized() && !e.isFullScreen() - } + "string" == typeof o && (o += this.eol), this.filename ? this.open((function (e) { + if (e) return i._buffer.push([o, r]); + i._write(o, r), i._size += o.length, i._lazyDrain() + })) : (this._write(o, r), this._size += o.length, this._lazyDrain()) + }, p.prototype._write = function (e, t) { + if (this._isStreams2) return this._stream.write(e), t && process.nextTick((function () { + t(null, !0) + })); + var n = this._stream.write(e); + return t ? !1 === n ? this._stream.once("drain", (function () { + t(null, !0) + })) : void process.nextTick((function () { + t(null, !0) + })) : void 0 + }, p.prototype.query = function (e, t) { + "function" == typeof e && (t = e, e = {}); + var n = i.join(this.dirname, this.filename), + o = (e = this.normalizeQuery(e), ""), + s = [], + a = 0, + c = r.createReadStream(n, { + encoding: "utf8" + }); - function t() { - var e = Number.isInteger; - return S && e(S.x) && e(S.y) && e(S.width) && 0 < S.width && e(S.height) && 0 < S.height + function l(t, n) { + try { + var r = JSON.parse(t); + (function (t) { + if (!t) return; + if ("object" != typeof t) return; + var n = new Date(t.timestamp); + if (e.from && n < e.from || e.until && n > e.until) return; + return !0 + })(r) && function (t) { + if (e.rows && s.length >= e.rows && "desc" != e.order) return void(c.readable && c.destroy()); + if (e.fields) { + var n = {}; + e.fields.forEach((function (e) { + n[e] = t[e] + })), t = n + } + "desc" === e.order && s.length >= e.rows && s.shift(); + s.push(t) + }(r) + } catch (e) { + n || c.emit("error", e) + } + } + c.on("error", (function (e) { + if (c.readable && c.destroy(), t) return "ENOENT" !== e.code ? t(e) : t(null, s) + })), c.on("data", (function (t) { + for (var n = (t = (o + t).split(/\n+/)).length - 1, r = 0; r < n; r++)(!e.start || a >= e.start) && l(t[r]), a++; + o = t[n] + })), c.on("close", (function () { + o && l(o, !0), "desc" === e.order && (s = s.reverse()), t && t(null, s) + })) + }, p.prototype.stream = function (e) { + var t = i.join(this.dirname, this.filename), + n = (e = e || {}, new f), + r = { + file: t, + start: e.start + }; + return n.destroy = c.tailFile(r, (function (e, t) { + if (e) return n.emit("error", e); + try { + n.emit("data", t), t = JSON.parse(t), n.emit("log", t) + } catch (e) { + n.emit("error", e) + } + })), n + }, p.prototype.open = function (e) { + return this.opening ? e(!0) : !this._stream || this.maxsize && this._size >= this.maxsize ? (e(!0), this._createStream()) : (this._archive = this.zippedArchive ? this._stream.path : null, void e()) + }, p.prototype.close = function () { + var e = this; + this._stream && (this._stream.end(), this._stream.destroySoon(), this._stream.once("finish", (function () { + e.emit("flush"), e.emit("closed") + }))) + }, p.prototype.flush = function () { + var e = this; + if (!this._buffer.length) return e.emit("flush"); + this._buffer.forEach((function (t) { + var n = t[0], + r = t[1]; + process.nextTick((function () { + e._write(n, r), e._size += n.length + })) + })), e._buffer.length = 0, e._stream.once("drain", (function () { + e.emit("flush"), e.emit("logged") + })) + }, p.prototype._createStream = function () { + var e = this; + this.opening = !0, + function t(n) { + var o = i.join(e.dirname, n); + + function s(t) { + e._stream && (e._stream.end(), e._stream.destroySoon()), e._size = t, e.filename = n, e._stream = r.createWriteStream(o, e.options), e._isStreams2 = u(e._stream), e._stream.on("error", (function (t) { + e._failures < e.maxRetries ? (e._createStream(), e._failures++) : e.emit("error", t) + })), e._stream.setMaxListeners(1 / 0), e.once("flush", (function () { + e.flush(), e.opening = !1, e.emit("open", o) + })), e.flush(), + function () { + if (e._archive) { + var t = a.createGzip(), + n = r.createReadStream(String(e._archive)), + i = r.createWriteStream(e._archive + ".gz"); + n.pipe(t).pipe(i), r.unlink(String(e._archive)), e._archive = "" + } + }() + } + r.stat(o, (function (n, r) { + return n ? "ENOENT" !== n.code ? e.emit("error", n) : s(0) : !r || e.maxsize && r.size >= e.maxsize ? e._incFile((function () { + t(e._getFile()) + })) : void s(r.size) + })) + }(this._getFile()) + }, p.prototype._incFile = function (e) { + var t = i.extname(this._basename), + n = i.basename(this._basename, t); + this.tailable ? this._checkMaxFilesTailable(t, n, e) : (this._created += 1, this._checkMaxFilesIncrementing(t, n, e)) + }, p.prototype._getFile = function () { + var e = i.extname(this._basename), + t = i.basename(this._basename, e); + return !this.tailable && this._created ? t + (this.rotationFormat ? this.rotationFormat() : this._created) + e : t + e + }, p.prototype._checkMaxFilesIncrementing = function (e, t, n) { + var o, s; + if (this.zippedArchive && (this._archive = i.join(this.dirname, t + (1 === this._created ? "" : this._created - 1) + e)), !this.maxFiles || this._created < this.maxFiles) return n(); + o = this._created - this.maxFiles, s = i.join(this.dirname, t + (0 !== o ? o : "") + e + (this.zippedArchive ? ".gz" : "")), r.unlink(s, n) + }, p.prototype._checkMaxFilesTailable = function (e, t, n) { + var o = [], + a = this; + if (this.maxFiles) { + for (var c = this.maxFiles - 1; c > 0; c--) o.push(function (n) { + return function (o) { + var s = i.join(a.dirname, t + (n - 1) + e + (a.zippedArchive ? ".gz" : "")); + r.exists(s, (function (c) { + if (!c) return o(null); + r.rename(s, i.join(a.dirname, t + n + e + (a.zippedArchive ? ".gz" : "")), o) + })) + } + }(c)); + a.zippedArchive && (a._archive = i.join(a.dirname, t + 1 + e)), s.series(o, (function (o) { + r.rename(i.join(a.dirname, t + e), i.join(a.dirname, t + 1 + e), n) + })) + } + }, p.prototype._lazyDrain = function () { + var e = this; + !this._draining && this._stream && (this._draining = !0, this._stream.once("drain", (function () { + this._draining = !1, e.emit("logged") + }))) } +}, function (e, t, n) { + var r = n(11); - function s() { - const e = b.getPrimaryDisplay().bounds; - S = { - width: E.defaultWidth || 800, - height: E.defaultHeight || 600, - x: 0, - y: 0, - displayBounds: e - } + function i(e) { + return e instanceof r.Stream } - function d(e) { - return S.x >= e.x && S.y >= e.y && S.x + S.width <= e.x + e.width && S.y + S.height <= e.y + e.height + function o(e) { + return i(e) && "function" == typeof e._read && "object" == typeof e._readableState } - function l() { - const e = b.getAllDisplays().some((e) => d(e.bounds)); - if (!e) return s() + function s(e) { + return i(e) && "function" == typeof e._write && "object" == typeof e._writableState } + e.exports = i, e.exports.isReadable = o, e.exports.isWritable = s, e.exports.isDuplex = function (e) { + return o(e) && s(e) + } +}, function (e, t, n) { + var r = n(7), + i = n(10), + o = n(77), + s = n(78), + a = n(11).Stream, + c = n(16).Transport, + l = t.Http = function (e) { + c.call(this, e), e = e || {}, this.name = "http", this.ssl = !!e.ssl, this.host = e.host || "localhost", this.port = e.port, this.auth = e.auth, this.path = e.path || "", this.agent = e.agent, this.port || (this.port = this.ssl ? 443 : 80) + }; + r.inherits(l, i.Transport), l.prototype.name = "http", l.prototype._request = function (e, t) { + var n, r = (e = e || {}).auth || this.auth, + i = e.path || this.path || ""; + delete e.auth, delete e.path, (n = (this.ssl ? s : o).request({ + host: this.host, + port: this.port, + path: "/" + i.replace(/^\//, ""), + method: "POST", + headers: { + "Content-Type": "application/json" + }, + agent: this.agent, + auth: r ? r.username + ":" + r.password : "" + })).on("error", t), n.on("response", (function (e) { + var n = ""; + e.on("data", (function (e) { + n += e + })), e.on("end", (function () { + t(null, e, n) + })), e.resume() + })), n.end(new Buffer(JSON.stringify(e), "utf8")) + }, l.prototype.log = function (e, t, n, r) { + var i = this; + "function" == typeof n && (r = n, n = {}); + var o = { + method: "collect", + params: { + level: e, + message: t, + meta: n + } + }; + n && (n.path && (o.path = n.path, delete n.path), n.auth && (o.auth = n.auth, delete n.auth)), this._request(o, (function (e, t) { + if (t && 200 !== t.statusCode && (e = new Error("HTTP Status Code: " + t.statusCode)), e) return r(e); + i.emit("logged"), r && r(null, !0) + })) + }, l.prototype.query = function (e, t) { + "function" == typeof e && (t = e, e = {}); + (e = { + method: "query", + params: e = this.normalizeQuery(e) + }).params.path && (e.path = e.params.path, delete e.params.path), e.params.auth && (e.auth = e.params.auth, delete e.params.auth), this._request(e, (function (e, n, r) { + if (n && 200 !== n.statusCode && (e = new Error("HTTP Status Code: " + n.statusCode)), e) return t(e); + if ("string" == typeof r) try { + r = JSON.parse(r) + } catch (e) { + return t(e) + } + t(null, r) + })) + }, l.prototype.stream = function (e) { + e = e || {}; + var t, n, r = new a; + return r.destroy = function () { + t.destroy() + }, (e = { + method: "stream", + params: e + }).params.path && (e.path = e.params.path, delete e.params.path), e.params.auth && (e.auth = e.params.auth, delete e.params.auth), t = this._request(e), n = "", t.on("data", (function (e) { + for (var t = (e = (n + e).split(/\n+/)).length - 1, i = 0; i < t; i++) try { + r.emit("log", JSON.parse(e[i])) + } catch (e) { + r.emit("error", e) + } + n = e[t] + })), t.on("error", (function (e) { + r.emit("error", e) + })), r + } +}, function (e, t) { + e.exports = require("http") +}, function (e, t) { + e.exports = require("https") +}, function (e, t, n) { + n(14); + var r = n(7), + i = n(12), + o = n(16).Transport, + s = t.Memory = function (e) { + o.call(this, e), e = e || {}, this.errorOutput = [], this.writeOutput = [], this.json = e.json || !1, this.colorize = e.colorize || !1, this.prettyPrint = e.prettyPrint || !1, this.timestamp = void 0 !== e.timestamp && e.timestamp, this.showLevel = void 0 === e.showLevel || e.showLevel, this.label = e.label || null, this.depth = e.depth || null, this.json && (this.stringify = e.stringify || function (e) { + return JSON.stringify(e, null, 2) + }) + }; + r.inherits(s, o), s.prototype.name = "memory", s.prototype.log = function (e, t, n, r) { + if (this.silent) return r(null, !0); + var o; + o = i.log({ + colorize: this.colorize, + json: this.json, + level: e, + message: t, + meta: n, + stringify: this.stringify, + timestamp: this.timestamp, + prettyPrint: this.prettyPrint, + raw: this.raw, + label: this.label, + depth: this.depth, + formatter: this.formatter, + humanReadableUnhandledException: this.humanReadableUnhandledException + }), "error" === e || "debug" === e ? this.errorOutput.push(o) : this.writeOutput.push(o), this.emit("logged"), r(null, !0) + }, s.prototype.clearLogs = function () { + this.errorOutput = [], this.writeOutput = [] + } +}, function (e, t) { + function n(e) { + for (var t in e) this[t] = e[t] + } + t.get = function (e) { + var n = Error.stackTraceLimit; + Error.stackTraceLimit = 1 / 0; + var r = {}, + i = Error.prepareStackTrace; + Error.prepareStackTrace = function (e, t) { + return t + }, Error.captureStackTrace(r, e || t.get); + var o = r.stack; + return Error.prepareStackTrace = i, Error.stackTraceLimit = n, o + }, t.parse = function (e) { + if (!e.stack) return []; + var t = this; + return e.stack.split("\n").slice(1).map((function (e) { + if (e.match(/^\s*[-]{4,}$/)) return t._createParsedCallSite({ + fileName: e, + lineNumber: null, + functionName: null, + typeName: null, + methodName: null, + columnNumber: null, + native: null + }); + var n = e.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/); + if (n) { + var r = null, + i = null, + o = null, + s = null, + a = null, + c = "native" === n[5]; + if (n[1]) { + var l = (o = n[1]).lastIndexOf("."); + if ("." == o[l - 1] && l--, l > 0) { + r = o.substr(0, l), i = o.substr(l + 1); + var u = r.indexOf(".Module"); + u > 0 && (o = o.substr(u + 1), r = r.substr(0, u)) + } + s = null + } + i && (s = r, a = i), "" === i && (a = null, o = null); + var f = { + fileName: n[2] || null, + lineNumber: parseInt(n[3], 10) || null, + functionName: o, + typeName: s, + methodName: a, + columnNumber: parseInt(n[4], 10) || null, + native: c + }; + return t._createParsedCallSite(f) + } + })).filter((function (e) { + return !!e + })) + }; + ["this", "typeName", "functionName", "methodName", "fileName", "lineNumber", "columnNumber", "function", "evalOrigin"].forEach((function (e) { + n.prototype[e] = null, n.prototype["get" + e[0].toUpperCase() + e.substr(1)] = function () { + return this[e] + } + })), ["topLevel", "eval", "native", "constructor"].forEach((function (e) { + n.prototype[e] = !1, n.prototype["is" + e[0].toUpperCase() + e.substr(1)] = function () { + return this[e] + } + })), t._createParsedCallSite = function (e) { + return new n(e) + } +}, function (e, t, n) { + var r = n(12), + i = n(10), + o = n(7)._extend, + s = t.Container = function (e) { + this.loggers = {}, this.options = e || {}, this.default = { + transports: [new i.transports.Console({ + level: "silly", + colorize: !1 + })] + } + }; + s.prototype.get = s.prototype.add = function (e, t) { + var n, s = this; + return this.loggers[e] || (n = (t = o({}, t || this.options || this.default)).transports || this.options.transports, t.transports = n ? n.slice() : [], 0 !== t.transports.length || t && t.console || t.transports.push(this.default.transports[0]), Object.keys(t).forEach((function (n) { + if ("transports" !== n) { + var o = r.capitalize(n); + if (!i.transports[o]) throw new Error("Cannot add unknown transport: " + o); + var s = t[n]; + s.id = e, t.transports.push(new i.transports[o](s)) + } + })), t.id = e, this.loggers[e] = new i.Logger(t), this.loggers[e].on("close", (function () { + s._delete(e) + }))), this.loggers[e] + }, s.prototype.has = function (e) { + return !!this.loggers[e] + }, s.prototype.close = function (e) { + var t = this; - function c() { - const e = S && (t() || S.isMaximized || S.isFullScreen); - return e ? void(t() && S.displayBounds && l()) : void(S = null) + function n(e) { + t.loggers[e] && (t.loggers[e].close(), t._delete(e)) + } + return e ? n(e) : Object.keys(this.loggers).forEach((function (e) { + n(e) + })) + }, s.prototype._delete = function (e) { + delete this.loggers[e] + } +}, function (e, t, n) { + var r = n(14), + i = n(7), + o = n(30), + s = n(26), + a = n(12), + c = n(32), + l = n(11).Stream, + u = /%[sdj%]/g, + f = t.Logger = function (e) { + r.EventEmitter.call(this), this.configure(e) + }; + + function h(e) { + this.logger = e, this.start = Date.now() } + i.inherits(f, r.EventEmitter), f.prototype.configure = function (e) { + var t = this; + Array.isArray(this._names) && this._names.length && this.clear(), e = e || {}, this.transports = {}, this._names = [], e.transports && e.transports.forEach((function (e) { + t.add(e, null, !0) + })), this.padLevels = e.padLevels || !1, this.setLevels(e.levels), e.colors && s.addColors(e.colors), this.id = e.id || null, this.level = e.level || "info", this.emitErrs = e.emitErrs || !1, this.stripColors = e.stripColors || !1, this.exitOnError = void 0 === e.exitOnError || e.exitOnError, this.exceptionHandlers = {}, this.profilers = {}, ["rewriters", "filters"].forEach((function (n) { + t[n] = Array.isArray(e[n]) ? e[n] : [] + })), e.exceptionHandlers && this.handleExceptions(e.exceptionHandlers) + }, f.prototype.log = function (e) { + for (var t = Array.prototype.slice.call(arguments, 1), n = this; null === t[t.length - 1];) t.pop(); + var r = "function" == typeof t[t.length - 1] ? t.pop() : null; + + function s(e) { + r ? r(e) : n.emitErrs && n.emit("error", e) + } + if (0 === this._names.length) return s(new Error("Cannot log with no transports.")); + if (void 0 === n.levels[e]) return s(new Error("Unknown log level: " + e)); + var a = this._names.filter((function (t) { + var r = n.transports[t]; + return r.level && n.levels[r.level] >= n.levels[e] || !r.level && n.levels[n.level] >= n.levels[e] + })); + if (a.length) { + var c, l = {}, + f = t && t[0] && t[0].match && null !== t[0].match(u), + h = f ? t[0].match(u) : [], + p = h.filter((function (e) { + return "%%" === e + })); + if (t.length - 1 - (h.length - p.length) > 0 || 1 === t.length) { + l = t[t.length - 1] || t; + var d = Object.prototype.toString.call(l); + l = "[object Object]" === d || "[object Error]" === d || "[object Array]" === d ? t.pop() : {} + } + if (c = i.format.apply(null, t), this.padLevels && (c = new Array(this.levelLength - e.length + 1).join(" ") + c), this.rewriters.forEach((function (t) { + l = t(e, c, l, n) + })), this.filters.forEach((function (t) { + var r = t(e, c, l, n); + "string" == typeof r ? c = r : (c = r.msg, l = r.meta) + })), this.stripColors) { + var m = /\u001b\[(\d+(;\d+)*)?m/g; + c = ("" + c).replace(m, "") + } + return o.forEach(a, y, g), this + } - function p(e) { - if (e = e || w, !!e) try { - const t = e.getBounds(); - n(e) && (S.x = t.x, S.y = t.y, S.width = t.width, S.height = t.height), S.isMaximized = e.isMaximized(), S.isFullScreen = e.isFullScreen(), S.displayBounds = b.getDisplayMatching(t).bounds - } catch (e) {} + function g(t) { + if (r) { + if (t) return r(t); + r(null, e, c, l) + } + r = null, t || n.emit("logged", e, c, l) + } + + function y(t, r) { + var i = n.transports[t]; + i.log(e, c, l, (function (t) { + if (t) return t.transport = i, g(t), r(); + n.emit("logging", i, e, c, l), r() + })) + } + r && r() + }, f.prototype.query = function (e, t) { + "function" == typeof e && (t = e, e = {}); + var n, r = this, + i = (e = e || {}, {}), + s = a.clone(e.query) || {}; + + function c(t, n) { + e.query && (e.query = t.formatQuery(s)), t.query(e, (function (r, i) { + if (r) return n(r); + n(null, t.formatResults(i, e.format)) + })) + } + if (e.transport) return e.transport = e.transport.toLowerCase(), c(this.transports[e.transport], t); + n = this._names.map((function (e) { + return r.transports[e] + })).filter((function (e) { + return !!e.query + })), o.forEach(n, (function (e, t) { + c(e, (function (n, r) { + t && ((r = n || r) && (i[e.name] = r), t()), t = null + })) + }), (function () { + t(null, i) + })) + }, f.prototype.stream = function (e) { + var t = this, + n = (e = e || {}, new l), + r = []; + if (e.transport) { + var i = this.transports[e.transport]; + if (delete e.transport, i && i.stream) return i.stream(e) + } + return n._streams = r, n.destroy = function () { + for (var e = r.length; e--;) r[e].destroy() + }, this._names.map((function (e) { + return t.transports[e] + })).filter((function (e) { + return !!e.stream + })).forEach((function (t) { + var i = t.stream(e); + i && (r.push(i), i.on("log", (function (e) { + e.transport = e.transport || [], e.transport.push(t.name), n.emit("log", e) + })), i.on("error", (function (e) { + e.transport = e.transport || [], e.transport.push(t.name), n.emit("error", e) + }))) + })), n + }, f.prototype.close = function () { + var e = this; + this._names.forEach((function (t) { + var n = e.transports[t]; + n && n.close && n.close() + })), this.emit("close") + }, f.prototype.handleExceptions = function () { + var e = Array.prototype.slice.call(arguments), + t = [], + n = this; + e.forEach((function (e) { + Array.isArray(e) ? t = t.concat(e) : t.push(e) + })), this.exceptionHandlers = this.exceptionHandlers || {}, t.forEach((function (e) { + n.exceptionHandlers[e.name] = e + })), this._hnames = Object.keys(n.exceptionHandlers), this.catchExceptions || (this.catchExceptions = this._uncaughtException.bind(this), process.on("uncaughtException", this.catchExceptions)) + }, f.prototype.unhandleExceptions = function () { + var e = this; + this.catchExceptions && (Object.keys(this.exceptionHandlers).forEach((function (t) { + var n = e.exceptionHandlers[t]; + n.close && n.close() + })), this.exceptionHandlers = {}, Object.keys(this.transports).forEach((function (t) { + var n = e.transports[t]; + n.handleExceptions && (n.handleExceptions = !1) + })), process.removeListener("uncaughtException", this.catchExceptions), this.catchExceptions = !1) + }, f.prototype.add = function (e, t, n) { + var r = n ? e : new e(t); + if (!r.name && !r.log) throw new Error("Unknown transport with no log() method"); + if (this.transports[r.name]) throw new Error("Transport already attached: " + r.name + ", assign a different name"); + return this.transports[r.name] = r, this._names = Object.keys(this.transports), r._onError = this._onError.bind(this, r), n || r.on("error", r._onError), r.handleExceptions && !this.catchExceptions && this.handleExceptions(), this + }, f.prototype.clear = function () { + Object.keys(this.transports).forEach((function (e) { + this.remove({ + name: e + }) + }), this) + }, f.prototype.remove = function (e) { + var t = "string" != typeof e ? e.name || e.prototype.name : e; + if (!this.transports[t]) throw new Error("Transport " + t + " not attached to this instance"); + var n = this.transports[t]; + return delete this.transports[t], this._names = Object.keys(this.transports), n.close && n.close(), n._onError && n.removeListener("error", n._onError), this + }, f.prototype.startTimer = function () { + return new h(this) + }, f.prototype.profile = function (e) { + var t, n, r, i, o, s = Date.now(); + return this.profilers[e] ? (t = this.profilers[e], delete this.profilers[e], o = "function" == typeof (n = Array.prototype.slice.call(arguments))[n.length - 1] ? n.pop() : null, i = "object" == typeof n[n.length - 1] ? n.pop() : {}, r = 2 === n.length ? n[1] : e, i.durationMs = s - t, this.info(r, i, o)) : (this.profilers[e] = s, this) + }, f.prototype.setLevels = function (e) { + return a.setLevels(this, this.levels, e) + }, f.prototype.cli = function () { + return this.padLevels = !0, this.setLevels(s.cli.levels), s.addColors(s.cli.colors), this.transports.console && (this.transports.console.colorize = this.transports.console.colorize || !0, this.transports.console.timestamp = this.transports.console.timestamp || !1), this + }, f.prototype._uncaughtException = function (e) { + var t, n, r = !1, + i = c.getAllInfo(e), + s = this._getExceptionHandlers(); + + function a() { + n && !r && (clearTimeout(t), r = !0, process.exit(1)) + } + if (n = "function" == typeof this.exitOnError ? this.exitOnError(e) : this.exitOnError, !s || 0 === s.length) return a(); + o.forEach(s, (function (t, n) { + t.logException("uncaughtException: " + (e.message || e), i, n, e) + }), a), n && (t = setTimeout(a, 3e3)) + }, f.prototype._getExceptionHandlers = function () { + var e = this; + return this._hnames.map((function (t) { + return e.exceptionHandlers[t] + })).concat(this._names.map((function (t) { + return e.transports[t].handleExceptions && e.transports[t] + }))).filter(Boolean) + }, f.prototype._onError = function (e, t) { + this.emitErrs && this.emit("error", t, e) + }, h.prototype.done = function (e) { + var t = Array.prototype.slice.call(arguments), + n = "function" == typeof t[t.length - 1] ? t.pop() : null, + r = "object" == typeof t[t.length - 1] ? t.pop() : {}; + return r.duration = Date.now() - this.start + "ms", this.logger.info(e, r, n) + } +}, function (e, t, n) { + var r = n(34), + i = process.cwd, + o = null, + s = process.env.GRACEFUL_FS_PLATFORM || "win32"; + process.cwd = function () { + return o || (o = i.call(process)), o + }; + try { + process.cwd() + } catch (e) {} + var a = process.chdir; + process.chdir = function (e) { + o = null, a.call(process, e) + }, e.exports = function (e) { + r.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && function (e) { + e.lchmod = function (t, n, i) { + e.open(t, r.O_WRONLY | r.O_SYMLINK, n, (function (t, r) { + t ? i && i(t) : e.fchmod(r, n, (function (t) { + e.close(r, (function (e) { + i && i(t || e) + })) + })) + })) + }, e.lchmodSync = function (t, n) { + var i, o = e.openSync(t, r.O_WRONLY | r.O_SYMLINK, n), + s = !0; + try { + i = e.fchmodSync(o, n), s = !1 + } finally { + if (s) try { + e.closeSync(o) + } catch (e) {} else e.closeSync(o) + } + return i + } + }(e); + e.lutimes || function (e) { + r.hasOwnProperty("O_SYMLINK") ? (e.lutimes = function (t, n, i, o) { + e.open(t, r.O_SYMLINK, (function (t, r) { + t ? o && o(t) : e.futimes(r, n, i, (function (t) { + e.close(r, (function (e) { + o && o(t || e) + })) + })) + })) + }, e.lutimesSync = function (t, n, i) { + var o, s = e.openSync(t, r.O_SYMLINK), + a = !0; + try { + o = e.futimesSync(s, n, i), a = !1 + } finally { + if (a) try { + e.closeSync(s) + } catch (e) {} else e.closeSync(s) + } + return o + }) : (e.lutimes = function (e, t, n, r) { + r && process.nextTick(r) + }, e.lutimesSync = function () {}) + }(e); + e.chown = o(e.chown), e.fchown = o(e.fchown), e.lchown = o(e.lchown), e.chmod = n(e.chmod), e.fchmod = n(e.fchmod), e.lchmod = n(e.lchmod), e.chownSync = a(e.chownSync), e.fchownSync = a(e.fchownSync), e.lchownSync = a(e.lchownSync), e.chmodSync = i(e.chmodSync), e.fchmodSync = i(e.fchmodSync), e.lchmodSync = i(e.lchmodSync), e.stat = c(e.stat), e.fstat = c(e.fstat), e.lstat = c(e.lstat), e.statSync = l(e.statSync), e.fstatSync = l(e.fstatSync), e.lstatSync = l(e.lstatSync), e.lchmod || (e.lchmod = function (e, t, n) { + n && process.nextTick(n) + }, e.lchmodSync = function () {}); + e.lchown || (e.lchown = function (e, t, n, r) { + r && process.nextTick(r) + }, e.lchownSync = function () {}); + "win32" === s && (e.rename = (t = e.rename, function (n, r, i) { + var o = Date.now(), + s = 0; + t(n, r, (function a(c) { + if (c && ("EACCES" === c.code || "EPERM" === c.code) && Date.now() - o < 6e4) return setTimeout((function () { + e.stat(r, (function (e, o) { + e && "ENOENT" === e.code ? t(n, r, a) : i(c) + })) + }), s), void(s < 100 && (s += 10)); + i && i(c) + })) + })); + var t; + + function n(t) { + return t ? function (n, r, i) { + return t.call(e, n, r, (function (e) { + u(e) && (e = null), i && i.apply(this, arguments) + })) + } : t + } + + function i(t) { + return t ? function (n, r) { + try { + return t.call(e, n, r) + } catch (e) { + if (!u(e)) throw e + } + } : t + } + + function o(t) { + return t ? function (n, r, i, o) { + return t.call(e, n, r, i, (function (e) { + u(e) && (e = null), o && o.apply(this, arguments) + })) + } : t + } + + function a(t) { + return t ? function (n, r, i) { + try { + return t.call(e, n, r, i) + } catch (e) { + if (!u(e)) throw e + } + } : t + } + + function c(t) { + return t ? function (n, r, i) { + function o(e, t) { + t && (t.uid < 0 && (t.uid += 4294967296), t.gid < 0 && (t.gid += 4294967296)), i && i.apply(this, arguments) + } + return "function" == typeof r && (i = r, r = null), r ? t.call(e, n, r, o) : t.call(e, n, o) + } : t + } + + function l(t) { + return t ? function (n, r) { + var i = r ? t.call(e, n, r) : t.call(e, n); + return i.uid < 0 && (i.uid += 4294967296), i.gid < 0 && (i.gid += 4294967296), i + } : t + } + + function u(e) { + return !e || ("ENOSYS" === e.code || !(process.getuid && 0 === process.getuid() || "EINVAL" !== e.code && "EPERM" !== e.code)) + } + e.read = function (t) { + function n(n, r, i, o, s, a) { + var c; + if (a && "function" == typeof a) { + var l = 0; + c = function (u, f, h) { + if (u && "EAGAIN" === u.code && l < 10) return l++, t.call(e, n, r, i, o, s, c); + a.apply(this, arguments) + } + } + return t.call(e, n, r, i, o, s, c) + } + return n.__proto__ = t, n + }(e.read), e.readSync = (f = e.readSync, function (t, n, r, i, o) { + for (var s = 0;;) try { + return f.call(e, t, n, r, i, o) + } catch (e) { + if ("EAGAIN" === e.code && s < 10) { + s++; + continue + } + throw e + } + }); + var f + } +}, function (e, t, n) { + var r = n(11).Stream; + e.exports = function (e) { + return { + ReadStream: function t(n, i) { + if (!(this instanceof t)) return new t(n, i); + r.call(this); + var o = this; + this.path = n, this.fd = null, this.readable = !0, this.paused = !1, this.flags = "r", this.mode = 438, this.bufferSize = 65536, i = i || {}; + for (var s = Object.keys(i), a = 0, c = s.length; a < c; a++) { + var l = s[a]; + this[l] = i[l] + } + this.encoding && this.setEncoding(this.encoding); + if (void 0 !== this.start) { + if ("number" != typeof this.start) throw TypeError("start must be a Number"); + if (void 0 === this.end) this.end = 1 / 0; + else if ("number" != typeof this.end) throw TypeError("end must be a Number"); + if (this.start > this.end) throw new Error("start must be <= end"); + this.pos = this.start + } + if (null !== this.fd) return void process.nextTick((function () { + o._read() + })); + e.open(this.path, this.flags, this.mode, (function (e, t) { + if (e) return o.emit("error", e), void(o.readable = !1); + o.fd = t, o.emit("open", t), o._read() + })) + }, + WriteStream: function t(n, i) { + if (!(this instanceof t)) return new t(n, i); + r.call(this), this.path = n, this.fd = null, this.writable = !0, this.flags = "w", this.encoding = "binary", this.mode = 438, this.bytesWritten = 0, i = i || {}; + for (var o = Object.keys(i), s = 0, a = o.length; s < a; s++) { + var c = o[s]; + this[c] = i[c] + } + if (void 0 !== this.start) { + if ("number" != typeof this.start) throw TypeError("start must be a Number"); + if (this.start < 0) throw new Error("start must be >= zero"); + this.pos = this.start + } + this.busy = !1, this._queue = [], null === this.fd && (this._open = e.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush()) + } + } + } +}, function (e, t, n) { + "use strict"; + e.exports = function (e) { + if (null === e || "object" != typeof e) return e; + if (e instanceof Object) var t = { + __proto__: e.__proto__ + }; + else t = Object.create(null); + return Object.getOwnPropertyNames(e).forEach((function (n) { + Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n)) + })), t + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(6).mkdirsSync, + s = n(37).utimesMillisSync, + a = Symbol("notExist"); + + function c(e, t, n, o) { + if (!o.filter || o.filter(t, n)) return function (e, t, n, o) { + const s = (o.dereference ? r.statSync : r.lstatSync)(t); + if (s.isDirectory()) return function (e, t, n, i, o) { + if (t === a) return function (e, t, n, i) { + return r.mkdirSync(n), u(t, n, i), r.chmodSync(n, e.mode) + }(e, n, i, o); + if (t && !t.isDirectory()) throw new Error(`Cannot overwrite non-directory '${i}' with directory '${n}'.`); + return u(n, i, o) + }(s, e, t, n, o); + if (s.isFile() || s.isCharacterDevice() || s.isBlockDevice()) return function (e, t, n, i, o) { + return t === a ? l(e, n, i, o) : function (e, t, n, i) { + if (i.overwrite) return r.unlinkSync(n), l(e, t, n, i); + if (i.errorOnExist) throw new Error(`'${n}' already exists`) + }(e, n, i, o) + }(s, e, t, n, o); + if (s.isSymbolicLink()) return function (e, t, n, o) { + let s = r.readlinkSync(t); + o.dereference && (s = i.resolve(process.cwd(), s)); + if (e === a) return r.symlinkSync(s, n); { + let e; + try { + e = r.readlinkSync(n) + } catch (e) { + if ("EINVAL" === e.code || "UNKNOWN" === e.code) return r.symlinkSync(s, n); + throw e + } + if (o.dereference && (e = i.resolve(process.cwd(), e)), f(s, e)) throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${e}'.`); + if (r.statSync(n).isDirectory() && f(e, s)) throw new Error(`Cannot overwrite '${e}' with '${s}'.`); + return function (e, t) { + return r.unlinkSync(t), r.symlinkSync(e, t) + }(s, n) + } + }(e, t, n, o) + }(e, t, n, o) + } + + function l(e, t, i, o) { + return "function" == typeof r.copyFileSync ? (r.copyFileSync(t, i), r.chmodSync(i, e.mode), o.preserveTimestamps ? s(i, e.atime, e.mtime) : void 0) : function (e, t, i, o) { + const s = n(38)(65536), + a = r.openSync(t, "r"), + c = r.openSync(i, "w", e.mode); + let l = 0; + for (; l < e.size;) { + const e = r.readSync(a, s, 0, 65536, l); + r.writeSync(c, s, 0, e), l += e + } + o.preserveTimestamps && r.futimesSync(c, e.atime, e.mtime); + r.closeSync(a), r.closeSync(c) + }(e, t, i, o) + } + + function u(e, t, n) { + r.readdirSync(e).forEach(r => function (e, t, n, r) { + const o = i.join(t, e), + s = i.join(n, e); + return c(h(o, s), o, s, r) + }(r, e, t, n)) + } + + function f(e, t) { + const n = i.resolve(e).split(i.sep), + r = i.resolve(t).split(i.sep); + return n.reduce((e, t, n) => e && r[n] === t, !0) + } + + function h(e, t) { + const { + srcStat: n, + destStat: i + } = function (e, t) { + const n = r.statSync(e); + let i; + try { + i = r.statSync(t) + } catch (e) { + if ("ENOENT" === e.code) return { + srcStat: n, + destStat: a + }; + throw e + } + return { + srcStat: n, + destStat: i + } + }(e, t); + if (i.ino && i.ino === n.ino) throw new Error("Source and destination must not be the same."); + if (n.isDirectory() && f(e, t)) throw new Error(`Cannot copy '${e}' to a subdirectory of itself, '${t}'.`); + return i + } + e.exports = function (e, t, n) { + "function" == typeof n && (n = { + filter: n + }), (n = n || {}).clobber = !("clobber" in n) || !!n.clobber, n.overwrite = "overwrite" in n ? !!n.overwrite : n.clobber, n.preserveTimestamps && "ia32" === process.arch && console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"); + const s = h(e, t); + if (n.filter && !n.filter(e, t)) return; + const a = i.dirname(t); + return r.existsSync(a) || o(a), c(s, e, t, n) + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(36).invalidWin32Path, + s = parseInt("0777", 8); + e.exports = function e(t, n, a, c) { + if ("function" == typeof n ? (a = n, n = {}) : n && "object" == typeof n || (n = { + mode: n + }), o(t)) { + const e = new Error(t + " contains invalid WIN32 path characters."); + return e.code = "EINVAL", a(e) + } + let l = n.mode; + const u = n.fs || r; + void 0 === l && (l = s & ~process.umask()), c || (c = null), a = a || function () {}, t = i.resolve(t), u.mkdir(t, l, r => { + if (!r) return a(null, c = c || t); + switch (r.code) { + case "ENOENT": + if (i.dirname(t) === t) return a(r); + e(i.dirname(t), n, (r, i) => { + r ? a(r, i) : e(t, n, a, i) + }); + break; + default: + u.stat(t, (e, t) => { + e || !t.isDirectory() ? a(r, c) : a(null, c) + }) + } + }) + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(36).invalidWin32Path, + s = parseInt("0777", 8); + e.exports = function e(t, n, a) { + n && "object" == typeof n || (n = { + mode: n + }); + let c = n.mode; + const l = n.fs || r; + if (o(t)) { + const e = new Error(t + " contains invalid WIN32 path characters."); + throw e.code = "EINVAL", e + } + void 0 === c && (c = s & ~process.umask()), a || (a = null), t = i.resolve(t); + try { + l.mkdirSync(t, c), a = a || t + } catch (r) { + if ("ENOENT" === r.code) { + if (i.dirname(t) === t) throw r; + a = e(i.dirname(t), n, a), e(t, n, a) + } else { + let e; + try { + e = l.statSync(t) + } catch (e) { + throw r + } + if (!e.isDirectory()) throw r + } + } + return a + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(6).mkdirs, + s = n(8).pathExists, + a = n(37).utimesMillis, + c = Symbol("notExist"); + + function l(e, t, n, r, a) { + const c = i.dirname(n); + s(c, (i, s) => i ? a(i) : s ? f(e, t, n, r, a) : void o(c, i => i ? a(i) : f(e, t, n, r, a))) + } + + function u(e, t, n, r, i, o) { + Promise.resolve(i.filter(n, r)).then(s => s ? t ? e(t, n, r, i, o) : e(n, r, i, o) : o(), e => o(e)) + } + + function f(e, t, n, r, i) { + return r.filter ? u(h, e, t, n, r, i) : h(e, t, n, r, i) + } + + function h(e, t, n, o, s) { + (o.dereference ? r.stat : r.lstat)(t, (a, l) => a ? s(a) : l.isDirectory() ? function (e, t, n, i, o, s) { + if (t === c) return function (e, t, n, i, o) { + r.mkdir(n, s => { + if (s) return o(s); + m(t, n, i, t => t ? o(t) : r.chmod(n, e.mode, o)) + }) + }(e, n, i, o, s); + if (t && !t.isDirectory()) return s(new Error(`Cannot overwrite non-directory '${i}' with directory '${n}'.`)); + return m(n, i, o, s) + }(l, e, t, n, o, s) : l.isFile() || l.isCharacterDevice() || l.isBlockDevice() ? function (e, t, n, i, o, s) { + return t === c ? p(e, n, i, o, s) : function (e, t, n, i, o) { + if (!i.overwrite) return i.errorOnExist ? o(new Error(`'${n}' already exists`)) : o(); + r.unlink(n, r => r ? o(r) : p(e, t, n, i, o)) + }(e, n, i, o, s) + }(l, e, t, n, o, s) : l.isSymbolicLink() ? function (e, t, n, o, s) { + r.readlink(t, (t, a) => t ? s(t) : (o.dereference && (a = i.resolve(process.cwd(), a)), e === c ? r.symlink(a, n, s) : void r.readlink(n, (t, c) => t ? "EINVAL" === t.code || "UNKNOWN" === t.code ? r.symlink(a, n, s) : s(t) : (o.dereference && (c = i.resolve(process.cwd(), c)), y(a, c) ? s(new Error(`Cannot copy '${a}' to a subdirectory of itself, '${c}'.`)) : e.isDirectory() && y(c, a) ? s(new Error(`Cannot overwrite '${c}' with '${a}'.`)) : function (e, t, n) { + r.unlink(t, i => i ? n(i) : r.symlink(e, t, n)) + }(a, n, s))))) + }(e, t, n, o, s) : void 0) + } + + function p(e, t, n, i, o) { + return "function" == typeof r.copyFile ? r.copyFile(t, n, t => t ? o(t) : d(e, n, i, o)) : function (e, t, n, i, o) { + const s = r.createReadStream(t); + s.on("error", e => o(e)).once("open", () => { + const t = r.createWriteStream(n, { + mode: e.mode + }); + t.on("error", e => o(e)).on("open", () => s.pipe(t)).once("close", () => d(e, n, i, o)) + }) + }(e, t, n, i, o) + } + + function d(e, t, n, i) { + r.chmod(t, e.mode, r => r ? i(r) : n.preserveTimestamps ? a(t, e.atime, e.mtime, i) : i()) + } + + function m(e, t, n, i) { + r.readdir(e, (r, o) => r ? i(r) : g(o, e, t, n, i)) + } + + function g(e, t, n, r, o) { + const s = e.pop(); + return s ? function (e, t, n, r, o, s) { + const a = i.join(n, t), + c = i.join(r, t); + v(a, c, (t, i) => { + if (t) return s(t); + f(i, a, c, o, t => t ? s(t) : g(e, n, r, o, s)) + }) + }(e, s, t, n, r, o) : o() + } + + function y(e, t) { + const n = i.resolve(e).split(i.sep), + r = i.resolve(t).split(i.sep); + return n.reduce((e, t, n) => e && r[n] === t, !0) + } + + function v(e, t, n) { + ! function (e, t, n) { + r.stat(e, (e, i) => { + if (e) return n(e); + r.stat(t, (e, t) => e ? "ENOENT" === e.code ? n(null, { + srcStat: i, + destStat: c + }) : n(e) : n(null, { + srcStat: i, + destStat: t + })) + }) + }(e, t, (r, i) => { + if (r) return n(r); + const { + srcStat: o, + destStat: s + } = i; + return s.ino && s.ino === o.ino ? n(new Error("Source and destination must not be the same.")) : o.isDirectory() && y(e, t) ? n(new Error(`Cannot copy '${e}' to a subdirectory of itself, '${t}'.`)) : n(null, s) + }) + } + e.exports = function (e, t, n, r) { + "function" != typeof n || r ? "function" == typeof n && (n = { + filter: n + }) : (r = n, n = {}), r = r || function () {}, (n = n || {}).clobber = !("clobber" in n) || !!n.clobber, n.overwrite = "overwrite" in n ? !!n.overwrite : n.clobber, n.preserveTimestamps && "ia32" === process.arch && console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"), v(e, t, (i, o) => i ? r(i) : n.filter ? u(l, o, e, t, n, r) : l(o, e, t, n, r)) + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(3), + o = n(1), + s = n(6), + a = n(21), + c = r((function (e, t) { + t = t || function () {}, i.readdir(e, (n, r) => { + if (n) return s.mkdirs(e, t); + r = r.map(t => o.join(e, t)), + function e() { + const n = r.pop(); + if (!n) return t(); + a.remove(n, n => { + if (n) return t(n); + e() + }) + }() + }) + })); + + function l(e) { + let t; + try { + t = i.readdirSync(e) + } catch (t) { + return s.mkdirsSync(e) + } + t.forEach(t => { + t = o.join(e, t), a.removeSync(t) + }) + } + e.exports = { + emptyDirSync: l, + emptydirSync: l, + emptyDir: c, + emptydir: c + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(27); + + function s(e) { + ["unlink", "chmod", "stat", "lstat", "rmdir", "readdir"].forEach(t => { + e[t] = e[t] || r[t], e[t += "Sync"] = e[t] || r[t] + }), e.maxBusyTries = e.maxBusyTries || 3 + } + + function a(e, t, n) { + let r = 0; + "function" == typeof t && (n = t, t = {}), o(e, "rimraf: missing path"), o.strictEqual(typeof e, "string", "rimraf: path should be a string"), o.strictEqual(typeof n, "function", "rimraf: callback function required"), o(t, "rimraf: invalid options argument provided"), o.strictEqual(typeof t, "object", "rimraf: options should be object"), s(t), c(e, t, (function i(o) { + if (o) { + if (("EBUSY" === o.code || "ENOTEMPTY" === o.code || "EPERM" === o.code) && r < t.maxBusyTries) { + r++; + return setTimeout(() => c(e, t, i), 100 * r) + } + "ENOENT" === o.code && (o = null) + } + n(o) + })) + } + + function c(e, t, n) { + o(e), o(t), o("function" == typeof n), t.lstat(e, (r, i) => r && "ENOENT" === r.code ? n(null) : r && "EPERM" === r.code ? l(e, t, r, n) : i && i.isDirectory() ? f(e, t, r, n) : void t.unlink(e, r => { + if (r) { + if ("ENOENT" === r.code) return n(null); + if ("EPERM" === r.code) return l(e, t, r, n); + if ("EISDIR" === r.code) return f(e, t, r, n) + } + return n(r) + })) + } + + function l(e, t, n, r) { + o(e), o(t), o("function" == typeof r), n && o(n instanceof Error), t.chmod(e, 438, i => { + i ? r("ENOENT" === i.code ? null : n) : t.stat(e, (i, o) => { + i ? r("ENOENT" === i.code ? null : n) : o.isDirectory() ? f(e, t, n, r) : t.unlink(e, r) + }) + }) + } + + function u(e, t, n) { + let r; + o(e), o(t), n && o(n instanceof Error); + try { + t.chmodSync(e, 438) + } catch (e) { + if ("ENOENT" === e.code) return; + throw n + } + try { + r = t.statSync(e) + } catch (e) { + if ("ENOENT" === e.code) return; + throw n + } + r.isDirectory() ? p(e, t, n) : t.unlinkSync(e) + } + + function f(e, t, n, r) { + o(e), o(t), n && o(n instanceof Error), o("function" == typeof r), t.rmdir(e, s => { + !s || "ENOTEMPTY" !== s.code && "EEXIST" !== s.code && "EPERM" !== s.code ? s && "ENOTDIR" === s.code ? r(n) : r(s) : function (e, t, n) { + o(e), o(t), o("function" == typeof n), t.readdir(e, (r, o) => { + if (r) return n(r); + let s, c = o.length; + if (0 === c) return t.rmdir(e, n); + o.forEach(r => { + a(i.join(e, r), t, r => { + if (!s) return r ? n(s = r) : void(0 == --c && t.rmdir(e, n)) + }) + }) + }) + }(e, t, r) + }) + } + + function h(e, t) { + let n; + s(t = t || {}), o(e, "rimraf: missing path"), o.strictEqual(typeof e, "string", "rimraf: path should be a string"), o(t, "rimraf: missing options"), o.strictEqual(typeof t, "object", "rimraf: options should be object"); + try { + n = t.lstatSync(e) + } catch (n) { + if ("ENOENT" === n.code) return; + "EPERM" === n.code && u(e, t, n) + } + try { + n && n.isDirectory() ? p(e, t, null) : t.unlinkSync(e) + } catch (n) { + if ("ENOENT" === n.code) return; + if ("EPERM" === n.code) return u(e, t, n); + if ("EISDIR" !== n.code) throw n; + p(e, t, n) + } + } + + function p(e, t, n) { + o(e), o(t), n && o(n instanceof Error); + try { + t.rmdirSync(e) + } catch (r) { + if ("ENOTDIR" === r.code) throw n; + if ("ENOTEMPTY" === r.code || "EEXIST" === r.code || "EPERM" === r.code) ! function (e, t) { + o(e), o(t), t.readdirSync(e).forEach(n => h(i.join(e, n), t)); { + const n = Date.now(); + do { + try { + return t.rmdirSync(e, t) + } catch (e) {} + } while (Date.now() - n < 500) + } + }(e, t); + else if ("ENOENT" !== r.code) throw r + } + } + e.exports = a, a.sync = h +}, function (e, t, n) { + "use strict"; + const r = n(93), + i = n(94), + o = n(95); + e.exports = { + createFile: r.createFile, + createFileSync: r.createFileSync, + ensureFile: r.createFile, + ensureFileSync: r.createFileSync, + createLink: i.createLink, + createLinkSync: i.createLinkSync, + ensureLink: i.createLink, + ensureLinkSync: i.createLinkSync, + createSymlink: o.createSymlink, + createSymlinkSync: o.createSymlinkSync, + ensureSymlink: o.createSymlink, + ensureSymlinkSync: o.createSymlinkSync + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(1), + o = n(2), + s = n(6), + a = n(8).pathExists; + e.exports = { + createFile: r((function (e, t) { + function n() { + o.writeFile(e, "", e => { + if (e) return t(e); + t() + }) + } + o.stat(e, (r, o) => { + if (!r && o.isFile()) return t(); + const c = i.dirname(e); + a(c, (e, r) => e ? t(e) : r ? n() : void s.mkdirs(c, e => { + if (e) return t(e); + n() + })) + }) + })), + createFileSync: function (e) { + let t; + try { + t = o.statSync(e) + } catch (e) {} + if (t && t.isFile()) return; + const n = i.dirname(e); + o.existsSync(n) || s.mkdirsSync(n), o.writeFileSync(e, "") + } + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(1), + o = n(2), + s = n(6), + a = n(8).pathExists; + e.exports = { + createLink: r((function (e, t, n) { + function r(e, t) { + o.link(e, t, e => { + if (e) return n(e); + n(null) + }) + } + a(t, (c, l) => c ? n(c) : l ? n(null) : void o.lstat(e, o => { + if (o) return o.message = o.message.replace("lstat", "ensureLink"), n(o); + const c = i.dirname(t); + a(c, (i, o) => i ? n(i) : o ? r(e, t) : void s.mkdirs(c, i => { + if (i) return n(i); + r(e, t) + })) + })) + })), + createLinkSync: function (e, t) { + if (o.existsSync(t)) return; + try { + o.lstatSync(e) + } catch (e) { + throw e.message = e.message.replace("lstat", "ensureLink"), e + } + const n = i.dirname(t); + return o.existsSync(n) || s.mkdirsSync(n), o.linkSync(e, t) + } + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(1), + o = n(2), + s = n(6), + a = s.mkdirs, + c = s.mkdirsSync, + l = n(96), + u = l.symlinkPaths, + f = l.symlinkPathsSync, + h = n(97), + p = h.symlinkType, + d = h.symlinkTypeSync, + m = n(8).pathExists; + e.exports = { + createSymlink: r((function (e, t, n, r) { + r = "function" == typeof n ? n : r, n = "function" != typeof n && n, m(t, (s, c) => s ? r(s) : c ? r(null) : void u(e, t, (s, c) => { + if (s) return r(s); + e = c.toDst, p(c.toCwd, n, (n, s) => { + if (n) return r(n); + const c = i.dirname(t); + m(c, (n, i) => n ? r(n) : i ? o.symlink(e, t, s, r) : void a(c, n => { + if (n) return r(n); + o.symlink(e, t, s, r) + })) + }) + })) + })), + createSymlinkSync: function (e, t, n) { + if (o.existsSync(t)) return; + const r = f(e, t); + e = r.toDst, n = d(r.toCwd, n); + const s = i.dirname(t); + return o.existsSync(s) || c(s), o.symlinkSync(e, t, n) + } + } +}, function (e, t, n) { + "use strict"; + const r = n(1), + i = n(2), + o = n(8).pathExists; + e.exports = { + symlinkPaths: function (e, t, n) { + if (r.isAbsolute(e)) return i.lstat(e, t => t ? (t.message = t.message.replace("lstat", "ensureSymlink"), n(t)) : n(null, { + toCwd: e, + toDst: e + })); { + const s = r.dirname(t), + a = r.join(s, e); + return o(a, (t, o) => t ? n(t) : o ? n(null, { + toCwd: a, + toDst: e + }) : i.lstat(e, t => t ? (t.message = t.message.replace("lstat", "ensureSymlink"), n(t)) : n(null, { + toCwd: e, + toDst: r.relative(s, e) + }))) + } + }, + symlinkPathsSync: function (e, t) { + let n; + if (r.isAbsolute(e)) { + if (n = i.existsSync(e), !n) throw new Error("absolute srcpath does not exist"); + return { + toCwd: e, + toDst: e + } + } { + const o = r.dirname(t), + s = r.join(o, e); + if (n = i.existsSync(s), n) return { + toCwd: s, + toDst: e + }; + if (n = i.existsSync(e), !n) throw new Error("relative srcpath does not exist"); + return { + toCwd: e, + toDst: r.relative(o, e) + } + } + } + } +}, function (e, t, n) { + "use strict"; + const r = n(2); + e.exports = { + symlinkType: function (e, t, n) { + if (n = "function" == typeof t ? t : n, t = "function" != typeof t && t) return n(null, t); + r.lstat(e, (e, r) => { + if (e) return n(null, "file"); + t = r && r.isDirectory() ? "dir" : "file", n(null, t) + }) + }, + symlinkTypeSync: function (e, t) { + let n; + if (t) return t; + try { + n = r.lstatSync(e) + } catch (e) { + return "file" + } + return n && n.isDirectory() ? "dir" : "file" + } + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(28); + i.outputJson = r(n(102)), i.outputJsonSync = n(103), i.outputJSON = i.outputJson, i.outputJSONSync = i.outputJsonSync, i.writeJSON = i.writeJson, i.writeJSONSync = i.writeJsonSync, i.readJSON = i.readJson, i.readJSONSync = i.readJsonSync, e.exports = i +}, function (e, t, n) { + var r = n(3), + i = n(100), + o = n(101), + s = [], + a = n(7); + var c, l, u = function () {}; + + function f(e) { + i(e), e.gracefulify = f, e.FileReadStream = d, e.FileWriteStream = m, e.createReadStream = function (e, t) { + return new d(e, t) + }, e.createWriteStream = function (e, t) { + return new m(e, t) + }; + var t = e.readFile; + e.readFile = function (e, n, r) { + "function" == typeof n && (r = n, n = null); + return function e(n, r, i) { + return t(n, r, (function (t) { + !t || "EMFILE" !== t.code && "ENFILE" !== t.code ? ("function" == typeof i && i.apply(this, arguments), p()) : h([e, [n, r, i]]) + })) + }(e, n, r) + }; + var n = e.writeFile; + e.writeFile = function (e, t, r, i) { + "function" == typeof r && (i = r, r = null); + return function e(t, r, i, o) { + return n(t, r, i, (function (n) { + !n || "EMFILE" !== n.code && "ENFILE" !== n.code ? ("function" == typeof o && o.apply(this, arguments), p()) : h([e, [t, r, i, o]]) + })) + }(e, t, r, i) + }; + var r = e.appendFile; + r && (e.appendFile = function (e, t, n, i) { + "function" == typeof n && (i = n, n = null); + return function e(t, n, i, o) { + return r(t, n, i, (function (r) { + !r || "EMFILE" !== r.code && "ENFILE" !== r.code ? ("function" == typeof o && o.apply(this, arguments), p()) : h([e, [t, n, i, o]]) + })) + }(e, t, n, i) + }); + var s = e.readdir; + + function a(t) { + return s.apply(e, t) + } + if (e.readdir = function (e, t, n) { + var r = [e]; + "function" != typeof t ? r.push(t) : n = t; + return r.push((function (e, t) { + t && t.sort && t.sort(); + !e || "EMFILE" !== e.code && "ENFILE" !== e.code ? ("function" == typeof n && n.apply(this, arguments), p()) : h([a, [r]]) + })), a(r) + }, "v0.8" === process.version.substr(0, 4)) { + var c = o(e); + d = c.ReadStream, m = c.WriteStream + } + var l = e.ReadStream; + d.prototype = Object.create(l.prototype), d.prototype.open = function () { + var e = this; + y(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.autoClose && e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n), e.read()) + })) + }; + var u = e.WriteStream; + + function d(e, t) { + return this instanceof d ? (l.apply(this, arguments), this) : d.apply(Object.create(d.prototype), arguments) + } + + function m(e, t) { + return this instanceof m ? (u.apply(this, arguments), this) : m.apply(Object.create(m.prototype), arguments) + } + m.prototype = Object.create(u.prototype), m.prototype.open = function () { + var e = this; + y(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n)) + })) + }, e.ReadStream = d, e.WriteStream = m; + var g = e.open; + + function y(e, t, n, r) { + return "function" == typeof n && (r = n, n = null), + function e(t, n, r, i) { + return g(t, n, r, (function (o, s) { + !o || "EMFILE" !== o.code && "ENFILE" !== o.code ? ("function" == typeof i && i.apply(this, arguments), p()) : h([e, [t, n, r, i]]) + })) + }(e, t, n, r) + } + return e.open = y, e + } + + function h(e) { + u("ENQUEUE", e[0].name, e[1]), s.push(e) + } + + function p() { + var e = s.shift(); + e && (u("RETRY", e[0].name, e[1]), e[0].apply(null, e[1])) + } + a.debuglog ? u = a.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (u = function () { + var e = a.format.apply(a, arguments); + e = "GFS4: " + e.split(/\n/).join("\nGFS4: "), console.error(e) + }), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", (function () { + u(s), n(27).equal(s.length, 0) + })), e.exports = f(n(41)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && (e.exports = f(r)), e.exports.close = r.close = (c = r.close, function (e, t) { + return c.call(r, e, (function (e) { + e || p(), "function" == typeof t && t.apply(this, arguments) + })) + }), e.exports.closeSync = r.closeSync = (l = r.closeSync, function (e) { + var t = l.apply(r, arguments); + return p(), t + }) +}, function (e, t, n) { + var r = n(41), + i = n(34), + o = process.cwd, + s = null, + a = process.env.GRACEFUL_FS_PLATFORM || "win32"; + process.cwd = function () { + return s || (s = o.call(process)), s + }; + try { + process.cwd() + } catch (e) {} + var c = process.chdir; + + function l(e) { + return e ? function (t, n, i) { + return e.call(r, t, n, (function (e) { + m(e) && (e = null), i && i.apply(this, arguments) + })) + } : e + } + + function u(e) { + return e ? function (t, n) { + try { + return e.call(r, t, n) + } catch (e) { + if (!m(e)) throw e + } + } : e + } + + function f(e) { + return e ? function (t, n, i, o) { + return e.call(r, t, n, i, (function (e) { + m(e) && (e = null), o && o.apply(this, arguments) + })) + } : e + } + + function h(e) { + return e ? function (t, n, i) { + try { + return e.call(r, t, n, i) + } catch (e) { + if (!m(e)) throw e + } + } : e + } + + function p(e) { + return e ? function (t, n) { + return e.call(r, t, (function (e, t) { + if (!t) return n.apply(this, arguments); + t.uid < 0 && (t.uid += 4294967296), t.gid < 0 && (t.gid += 4294967296), n && n.apply(this, arguments) + })) + } : e + } + + function d(e) { + return e ? function (t) { + var n = e.call(r, t); + return n.uid < 0 && (n.uid += 4294967296), n.gid < 0 && (n.gid += 4294967296), n + } : e + } + + function m(e) { + return !e || ("ENOSYS" === e.code || !(process.getuid && 0 === process.getuid() || "EINVAL" !== e.code && "EPERM" !== e.code)) + } + process.chdir = function (e) { + s = null, c.call(process, e) + }, e.exports = function (e) { + i.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && function (e) { + e.lchmod = function (t, n, r) { + e.open(t, i.O_WRONLY | i.O_SYMLINK, n, (function (t, i) { + t ? r && r(t) : e.fchmod(i, n, (function (t) { + e.close(i, (function (e) { + r && r(t || e) + })) + })) + })) + }, e.lchmodSync = function (t, n) { + var r, o = e.openSync(t, i.O_WRONLY | i.O_SYMLINK, n), + s = !0; + try { + r = e.fchmodSync(o, n), s = !1 + } finally { + if (s) try { + e.closeSync(o) + } catch (e) {} else e.closeSync(o) + } + return r + } + }(e); + e.lutimes || function (e) { + i.hasOwnProperty("O_SYMLINK") ? (e.lutimes = function (t, n, r, o) { + e.open(t, i.O_SYMLINK, (function (t, i) { + t ? o && o(t) : e.futimes(i, n, r, (function (t) { + e.close(i, (function (e) { + o && o(t || e) + })) + })) + })) + }, e.lutimesSync = function (t, n, r) { + var o, s = e.openSync(t, i.O_SYMLINK), + a = !0; + try { + o = e.futimesSync(s, n, r), a = !1 + } finally { + if (a) try { + e.closeSync(s) + } catch (e) {} else e.closeSync(s) + } + return o + }) : (e.lutimes = function (e, t, n, r) { + r && process.nextTick(r) + }, e.lutimesSync = function () {}) + }(e); + e.chown = f(e.chown), e.fchown = f(e.fchown), e.lchown = f(e.lchown), e.chmod = l(e.chmod), e.fchmod = l(e.fchmod), e.lchmod = l(e.lchmod), e.chownSync = h(e.chownSync), e.fchownSync = h(e.fchownSync), e.lchownSync = h(e.lchownSync), e.chmodSync = u(e.chmodSync), e.fchmodSync = u(e.fchmodSync), e.lchmodSync = u(e.lchmodSync), e.stat = p(e.stat), e.fstat = p(e.fstat), e.lstat = p(e.lstat), e.statSync = d(e.statSync), e.fstatSync = d(e.fstatSync), e.lstatSync = d(e.lstatSync), e.lchmod || (e.lchmod = function (e, t, n) { + n && process.nextTick(n) + }, e.lchmodSync = function () {}); + e.lchown || (e.lchown = function (e, t, n, r) { + r && process.nextTick(r) + }, e.lchownSync = function () {}); + "win32" === a && (e.rename = (t = e.rename, function (n, r, i) { + var o = Date.now(), + s = 0; + t(n, r, (function a(c) { + if (c && ("EACCES" === c.code || "EPERM" === c.code) && Date.now() - o < 6e4) return setTimeout((function () { + e.stat(r, (function (e, o) { + e && "ENOENT" === e.code ? t(n, r, a) : i(c) + })) + }), s), void(s < 100 && (s += 10)); + i && i(c) + })) + })); + var t; + e.read = (r = e.read, function (t, n, i, o, s, a) { + var c; + if (a && "function" == typeof a) { + var l = 0; + c = function (u, f, h) { + if (u && "EAGAIN" === u.code && l < 10) return l++, r.call(e, t, n, i, o, s, c); + a.apply(this, arguments) + } + } + return r.call(e, t, n, i, o, s, c) + }), e.readSync = (n = e.readSync, function (t, r, i, o, s) { + for (var a = 0;;) try { + return n.call(e, t, r, i, o, s) + } catch (e) { + if ("EAGAIN" === e.code && a < 10) { + a++; + continue + } + throw e + } + }); + var n; + var r + } +}, function (e, t, n) { + var r = n(11).Stream; + e.exports = function (e) { + return { + ReadStream: function t(n, i) { + if (!(this instanceof t)) return new t(n, i); + r.call(this); + var o = this; + this.path = n, this.fd = null, this.readable = !0, this.paused = !1, this.flags = "r", this.mode = 438, this.bufferSize = 65536, i = i || {}; + for (var s = Object.keys(i), a = 0, c = s.length; a < c; a++) { + var l = s[a]; + this[l] = i[l] + } + this.encoding && this.setEncoding(this.encoding); + if (void 0 !== this.start) { + if ("number" != typeof this.start) throw TypeError("start must be a Number"); + if (void 0 === this.end) this.end = 1 / 0; + else if ("number" != typeof this.end) throw TypeError("end must be a Number"); + if (this.start > this.end) throw new Error("start must be <= end"); + this.pos = this.start + } + if (null !== this.fd) return void process.nextTick((function () { + o._read() + })); + e.open(this.path, this.flags, this.mode, (function (e, t) { + if (e) return o.emit("error", e), void(o.readable = !1); + o.fd = t, o.emit("open", t), o._read() + })) + }, + WriteStream: function t(n, i) { + if (!(this instanceof t)) return new t(n, i); + r.call(this), this.path = n, this.fd = null, this.writable = !0, this.flags = "w", this.encoding = "binary", this.mode = 438, this.bytesWritten = 0, i = i || {}; + for (var o = Object.keys(i), s = 0, a = o.length; s < a; s++) { + var c = o[s]; + this[c] = i[c] + } + if (void 0 !== this.start) { + if ("number" != typeof this.start) throw TypeError("start must be a Number"); + if (this.start < 0) throw new Error("start must be >= zero"); + this.pos = this.start + } + this.busy = !1, this._queue = [], null === this.fd && (this._open = e.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush()) + } + } + } +}, function (e, t, n) { + "use strict"; + const r = n(1), + i = n(6), + o = n(8).pathExists, + s = n(28); + e.exports = function (e, t, n, a) { + "function" == typeof n && (a = n, n = {}); + const c = r.dirname(e); + o(c, (r, o) => r ? a(r) : o ? s.writeJson(e, t, n, a) : void i.mkdirs(c, r => { + if (r) return a(r); + s.writeJson(e, t, n, a) + })) + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(6), + s = n(28); + e.exports = function (e, t, n) { + const a = i.dirname(e); + r.existsSync(a) || o.mkdirsSync(a), s.writeJsonSync(e, t, n) + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(35).copySync, + s = n(21).removeSync, + a = n(6).mkdirsSync, + c = n(38); + + function l(e, t, n) { + return r.statSync(e).isDirectory() ? function (e, t, n) { + const r = { + overwrite: !1 + }; + n ? (s(t), i()) : i(); + + function i() { + return o(e, t, r), s(e) + } + }(e, t, n) : function (e, t, n) { + const i = c(65536), + o = n ? "w" : "wx", + s = r.openSync(e, "r"), + a = r.fstatSync(s), + l = r.openSync(t, o, a.mode); + let u = 0; + for (; u < a.size;) { + const e = r.readSync(s, i, 0, 65536, u); + r.writeSync(l, i, 0, e), u += e + } + return r.closeSync(s), r.closeSync(l), r.unlinkSync(e) + }(e, t, n) + } + e.exports = { + moveSync: function e(t, n, o) { + const c = (o = o || {}).overwrite || o.clobber || !1; + if (t = i.resolve(t), n = i.resolve(n), t === n) return r.accessSync(t); + if (function (e, t) { + try { + return r.statSync(e).isDirectory() && e !== t && t.indexOf(e) > -1 && t.split(i.dirname(e) + i.sep)[1].split(i.sep)[0] === i.basename(e) + } catch (e) { + return !1 + } + }(t, n)) throw new Error(`Cannot move '${t}' into itself '${n}'.`); + a(i.dirname(n)), + function () { + if (c) try { + r.renameSync(t, n) + } catch (r) { + if ("ENOTEMPTY" === r.code || "EEXIST" === r.code || "EPERM" === r.code) return s(n), o.overwrite = !1, e(t, n, o); + if ("EXDEV" !== r.code) throw r; + return l(t, n, c) + } else try { + r.linkSync(t, n), r.unlinkSync(t) + } catch (e) { + if ("EXDEV" === e.code || "EISDIR" === e.code || "EPERM" === e.code || "ENOTSUP" === e.code) return l(t, n, c); + throw e + } + }() + } + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(2), + o = n(1), + s = n(39).copy, + a = n(21).remove, + c = n(6).mkdirp, + l = n(8).pathExists; + + function u(e, t, n, r) { + i.rename(e, t, i => i ? "EXDEV" !== i.code ? r(i) : function (e, t, n, r) { + s(e, t, { + overwrite: n, + errorOnExist: !0 + }, t => t ? r(t) : a(e, r)) + }(e, t, n, r) : r()) + } + e.exports = { + move: r((function (e, t, n, r) { + "function" == typeof n && (r = n, n = {}); + const s = n.overwrite || n.clobber || !1; + if (e = o.resolve(e), t = o.resolve(t), e === t) return i.access(e, r); + i.stat(e, (n, i) => n ? r(n) : i.isDirectory() && function (e, t) { + const n = e.split(o.sep), + r = t.split(o.sep); + return n.reduce((e, t, n) => e && r[n] === t, !0) + }(e, t) ? r(new Error(`Cannot move '${e}' to a subdirectory of itself, '${t}'.`)) : void c(o.dirname(t), n => n ? r(n) : function (e, t, n, r) { + if (n) return a(t, i => i ? r(i) : u(e, t, n, r)); + l(t, (i, o) => i ? r(i) : o ? r(new Error("dest already exists.")) : u(e, t, n, r)) + }(e, t, s, r))) + })) + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(2), + o = n(1), + s = n(6), + a = n(8).pathExists; + e.exports = { + outputFile: r((function (e, t, n, r) { + "function" == typeof n && (r = n, n = "utf8"); + const c = o.dirname(e); + a(c, (o, a) => o ? r(o) : a ? i.writeFile(e, t, n, r) : void s.mkdirs(c, o => { + if (o) return r(o); + i.writeFile(e, t, n, r) + })) + })), + outputFileSync: function (e, ...t) { + const n = o.dirname(e); + if (i.existsSync(n)) return i.writeFileSync(e, ...t); + s.mkdirsSync(n), i.writeFileSync(e, ...t) + } + } +}, function (e, t, n) { + "use strict"; + var r = n(3), + i = n(1), + o = n(7), + s = n(12), + a = n(10).Transport, + c = n(11).Stream, + l = n(9), + u = n(10), + f = n(42), + h = n(31), + p = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + d = e.exports = function (e) { + function t(t) { + Array.prototype.slice.call(arguments, 1).forEach((function (n) { + if (e[n]) throw new Error("Cannot set " + n + " and " + t + "together") + })) + } + if (a.call(this, e), e.filename || e.dirname) t("filename or dirname", "stream"), this._basename = this.filename = e.filename ? i.basename(e.filename) : "winston.log", this.dirname = e.dirname || i.dirname(e.filename), this.options = e.options || { + flags: "a" + }, this.options.highWaterMark = this.options.highWaterMark || 24; + else { + if (!e.stream) throw new Error("Cannot log to file without filename or stream."); + t("stream", "filename", "maxsize"), this._stream = e.stream; + var n = this; + this._stream.on("error", (function (e) { + n.emit("error", e) + })), this._stream.setMaxListeners(1 / 0) + } + this.json = !1 !== e.json, this.colorize = e.colorize || !1, this.maxsize = e.maxsize || null, this.logstash = e.logstash || null, this.maxFiles = e.maxFiles || null, this.label = e.label || null, this.prettyPrint = e.prettyPrint || !1, this.showLevel = void 0 === e.showLevel || e.showLevel, this.timestamp = void 0 === e.timestamp || e.timestamp, this.datePattern = e.datePattern ? e.datePattern : ".yyyy-MM-dd", this.depth = e.depth || null, this.eol = e.eol || l.EOL, this.maxRetries = e.maxRetries || 2, this.prepend = e.prepend || !1, this.createTree = e.createTree || !1, this.localTime = e.localTime || !1, this.zippedArchive = e.zippedArchive || !1, this.maxDays = e.maxDays || 0, this.json && (this.stringify = e.stringify), this._size = 0, this._created = 0, this._buffer = [], this._draining = !1, this._failures = 0, this._archive = !1, this._currentFiles = function () { + if (!this.maxsize) try { + return r.readdirSync(this.dirname).filter(function (e) { + return e.includes(this._basename) + }.bind(this)).map(function (e) { + return { + name: e, + time: r.statSync(i.join(this.dirname, e)).mtime.getTime() + } + }.bind(this)).sort((function (e, t) { + return e.time - t.time + })).map((function (e) { + return e.name + })) + } catch (e) {} + return [] + }.bind(this)(), this._year = this._getTime("year"), this._month = this._getTime("month"), this._date = this._getTime("date"), this._hour = this._getTime("hour"), this._minute = this._getTime("minute"), this._weekday = p[this._getTime("day")]; + var o = /d{1,4}|m{1,4}|yy(?:yy)?|([HhM])\1?/g, + s = function (e, t) { + for (e = String(e), t = t || 2; e.length < t;) e = "0" + e; + return e + }; + this.getFormattedDate = function () { + this._year = this._getTime("year"), this._month = this._getTime("month"), this._date = this._getTime("date"), this._hour = this._getTime("hour"), this._minute = this._getTime("minute"), this._weekday = p[this._getTime("day")]; + var e = { + yy: String(this._year).slice(2), + yyyy: this._year, + M: this._month + 1, + MM: s(this._month + 1), + d: this._date, + dd: s(this._date), + H: this._hour, + HH: s(this._hour), + m: this._minute, + mm: s(this._minute), + ddd: this._weekday + }; + return this.datePattern.replace(o, (function (t) { + return t in e ? e[t] : t.slice(1, t.length - 1) + })) + } + }; + o.inherits(d, a), u.transports.DailyRotateFile = d, d.prototype.name = "dailyRotateFile", d.prototype.log = function (e, t, n, r) { + if (this.silent) return r(null, !0); + if (this._failures >= this.maxRetries) return r(new Error("Transport is in a failed state.")); + var i = this, + o = s.log({ + level: e, + message: t, + meta: n, + json: this.json, + colorize: this.colorize, + logstash: this.logstash, + prettyPrint: this.prettyPrint, + timestamp: this.timestamp, + label: this.label, + stringify: this.stringify, + showLevel: this.showLevel, + depth: this.depth, + formatter: this.formatter, + humanReadableUnhandledException: this.humanReadableUnhandledException + }) + this.eol; + this._size += o.length, this.filename ? this.open((function (e) { + if (e) return i._buffer.push([o, r]); + i._write(o, r), i._lazyDrain() + })) : (this._write(o, r), this._lazyDrain()) + }, d.prototype._write = function (e, t) { + var n = this._stream.write(e); + if (t) return !1 === n ? this._stream.once("drain", (function () { + t(null, !0) + })) : void t(null, !0) + }, d.prototype.query = function (e, t) { + "function" == typeof e && (t = e, e = {}); + var n = this, + o = n._currentFiles.slice(0), + s = [], + a = 0; + e = n.normalizeQuery(e), 0 === o.length && t && t(null, s), + function c(l) { + if (l) { + var u = i.join(n.dirname, l), + f = "", + h = r.createReadStream(u, { + encoding: "utf8" + }); + h.on("error", (function (e) { + if (h.readable && h.destroy(), t) return "ENOENT" === e.code ? t(null, s) : t(e) + })), h.on("data", (function (t) { + for (var n = (t = (f + t).split(/\n+/)).length - 1, r = 0; r < n; r++)(!e.start || a >= e.start) && p(t[r]), a++; + f = t[n] + })), h.on("close", (function () { + f && p(f, !0), "desc" === e.order && (s = s.reverse()), o.length ? c(o.shift()) : t && t(null, s) + })) + } + + function p(t, n) { + try { + var r = JSON.parse(t); + (function (t) { + if (!t) return; + if ("object" != typeof t) return; + var n = new Date(t.timestamp); + if (e.from && n < e.from || e.until && n > e.until) return; + return !0 + })(r) && function (t) { + if (e.rows && s.length >= e.rows && "desc" !== e.order) return void(h.readable && h.destroy()); + if (e.fields) { + var n = {}; + e.fields.forEach((function (e) { + n[e] = t[e] + })), t = n + } + "desc" === e.order && s.length >= e.rows && s.shift(); + s.push(t) + }(r) + } catch (e) { + n || h.emit("error", e) + } + } + }(o.shift()) + }, d.prototype.stream = function (e) { + var t = i.join(this.dirname, this._getFilename()); + e = e || {}; + var n = new c, + r = { + file: t, + start: e.start + }; + return n.destroy = s.tailFile(r, (function (e, t) { + if (e) return n.emit("error", e); + try { + n.emit("data", t), t = JSON.parse(t), n.emit("log", t) + } catch (e) { + n.emit("error", e) + } + })), n.resume && n.resume(), n + }, d.prototype.open = function (e) { + return this.opening ? e(!0) : !this._stream || this.maxsize && this._size >= this.maxsize || this._filenameHasExpired() ? (this._cleanOldFiles(), e(!0), this._createStream()) : void e() + }, d.prototype.close = function () { + var e = this; + this._stream && (this._stream.end(), this._stream.destroySoon(), this._stream.once("drain", (function () { + e.emit("flush"), e.emit("closed") + }))) + }, d.prototype.flush = function () { + var e = this; + this._buffer.forEach((function (t) { + var n = t[0], + r = t[1]; + process.nextTick((function () { + e._write(n, r), e._size += n.length + })) + })), e._buffer.length = 0, e._stream.once("drain", (function () { + e.emit("flush"), e.emit("logged") + })) + }, d.prototype._createStream = function () { + var e = this; + this.opening = !0, + function t(n) { + var o = i.join(e.dirname, n); + + function s(t) { + e._stream && (e._archive = !!e.zippedArchive && e._stream.path, e._stream.end(), e._stream.destroySoon()), e.createTree && f.sync(i.dirname(o)), e._size = t, e.filename = n, e._stream = r.createWriteStream(o, e.options), e._stream.on("error", (function (t) { + e._failures < e.maxRetries ? (e._createStream(), e._failures++) : e.emit("error", t) + })), e._stream.setMaxListeners(1 / 0), e.once("flush", (function () { + e.flush(), e.opening = !1, e.emit("open", o) + })), e.flush(), + function () { + var t = e._archive; + if (e._archive = !1, t && r.existsSync(String(t))) { + var n = h.createGzip(), + i = r.createReadStream(String(t)), + o = r.createWriteStream(t + ".gz"); + i.pipe(n).pipe(o), r.unlinkSync(String(t)) + } + }() + } + r.stat(o, (function (n, r) { + return n ? "ENOENT" !== n.code ? e.emit("error", n) : s(0) : !r || e.maxsize && r.size >= e.maxsize ? t(e._getFile(!0)) : e._filenameHasExpired() ? (e._year = e._getTime("year"), e._month = e._getTime("month"), e._date = e._getTime("date"), e._hour = e._getTime("hour"), e._minute = e._getTime("minute"), e._weekday = p[e._getTime("day")], e._created = 0, t(e._getFile())) : void s(r.size) + })) + }(this._getFile()) + }, d.prototype._getFile = function (e) { + var t, n = this._getFilename(); + if (e) { + if (this.maxFiles && this._created >= this.maxFiles - 1) + if (0 === (t = this._created - (this.maxFiles - 1))) try { + r.unlinkSync(i.join(this.dirname, n)) + } catch (e) {} else try { + r.unlinkSync(i.join(this.dirname, n + "." + t)) + } catch (e) {} + this._created += 1 + } else if (!this.maxsize) + for (-1 === this._currentFiles.indexOf(n) && this._currentFiles.push(n); this.maxFiles && this._currentFiles.length > this.maxFiles;) { + try { + r.unlinkSync(i.join(this.dirname, this._currentFiles[0])) + } catch (e) {} + this._currentFiles = this._currentFiles.slice(1) + } + return this._created ? n + "." + this._created : n + }, d.prototype._getFilename = function () { + var e = this.getFormattedDate(); + return this.prepend ? (".yyyy-MM-dd" === this.datePattern && (this.datePattern = "yyyy-MM-dd.", e = this.getFormattedDate()), e + this._basename) : this._basename + e + }, d.prototype._lazyDrain = function () { + var e = this; + !this._draining && this._stream && (this._draining = !0, this._stream.once("drain", (function () { + this._draining = !1, e.emit("logged") + }))) + }, d.prototype._filenameHasExpired = function () { + return this.datePattern.match(/m/) ? this._year < this._getTime("year") || this._month < this._getTime("month") || this._date < this._getTime("date") || this._hour < this._getTime("hour") || this._minute < this._getTime("minute") : this.datePattern.match(/H/) ? this._year < this._getTime("year") || this._month < this._getTime("month") || this._date < this._getTime("date") || this._hour < this._getTime("hour") : this.datePattern.match(/d/) ? this._year < this._getTime("year") || this._month < this._getTime("month") || this._date < this._getTime("date") : this.datePattern.match(/M/) ? this._year < this._getTime("year") || this._month < this._getTime("month") : !!this.datePattern.match(/yy/) && this._year < this._getTime("year") + }, d.prototype._getTime = function (e) { + var t = new Date; + if (this.localTime) { + if ("year" === e) return t.getFullYear(); + if ("month" === e) return t.getMonth(); + if ("date" === e) return t.getDate(); + if ("hour" === e) return t.getHours(); + if ("minute" === e) return t.getMinutes(); + if ("day" === e) return t.getDay() + } + return "year" === e ? t.getUTCFullYear() : "month" === e ? t.getUTCMonth() : "date" === e ? t.getUTCDate() : "hour" === e ? t.getUTCHours() : "minute" === e ? t.getUTCMinutes() : "day" === e ? t.getUTCDay() : void 0 + }, d.prototype._cleanOldFiles = function () { + var e = this, + t = Date.now(); + + function n(n) { + var o = e.dirname + i.sep + n; + r.stat(o, (function (o, s) { + if (o) console.error("Error stats file ", n, o); + else { + var a = s.mtime && s.mtime.getTime() || 0, + c = t - a; + s.isFile() && c > 864e5 * e.maxDays && function (t) { + r.unlink(e.dirname + i.sep + t, (function (e) { + e && console.error("Error removing file ", t) + })) + }(n) + } + })) + } + e.maxDays && r.readdir(e.dirname, (function (t, r) { + if (t) console.error("Error reading directory ", e.dirname, t); + else { + var i = new RegExp(e._basename, "g"); + r.forEach((function (e) { + /.log/.test(e) && i.test(e) && n(e) + })) + } + })) + } +}, function (e, t, n) { + t.SourceMapGenerator = n(43).SourceMapGenerator, t.SourceMapConsumer = n(111).SourceMapConsumer, t.SourceNode = n(114).SourceNode +}, function (e, t) { + var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); + t.encode = function (e) { + if (0 <= e && e < n.length) return n[e]; + throw new TypeError("Must be between 0 and 63: " + e) + }, t.decode = function (e) { + return 65 <= e && e <= 90 ? e - 65 : 97 <= e && e <= 122 ? e - 97 + 26 : 48 <= e && e <= 57 ? e - 48 + 52 : 43 == e ? 62 : 47 == e ? 63 : -1 + } +}, function (e, t, n) { + var r = n(17); + + function i() { + this._array = [], this._sorted = !0, this._last = { + generatedLine: -1, + generatedColumn: 0 + } + } + i.prototype.unsortedForEach = function (e, t) { + this._array.forEach(e, t) + }, i.prototype.add = function (e) { + var t, n, i, o, s, a; + t = this._last, n = e, i = t.generatedLine, o = n.generatedLine, s = t.generatedColumn, a = n.generatedColumn, o > i || o == i && a >= s || r.compareByGeneratedPositionsInflated(t, n) <= 0 ? (this._last = e, this._array.push(e)) : (this._sorted = !1, this._array.push(e)) + }, i.prototype.toArray = function () { + return this._sorted || (this._array.sort(r.compareByGeneratedPositionsInflated), this._sorted = !0), this._array + }, t.MappingList = i +}, function (e, t, n) { + var r = n(17), + i = n(112), + o = n(45).ArraySet, + s = n(44), + a = n(113).quickSort; + + function c(e) { + var t = e; + return "string" == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ""))), null != t.sections ? new f(t) : new l(t) + } + + function l(e) { + var t = e; + "string" == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ""))); + var n = r.getArg(t, "version"), + i = r.getArg(t, "sources"), + s = r.getArg(t, "names", []), + a = r.getArg(t, "sourceRoot", null), + c = r.getArg(t, "sourcesContent", null), + l = r.getArg(t, "mappings"), + u = r.getArg(t, "file", null); + if (n != this._version) throw new Error("Unsupported version: " + n); + i = i.map(String).map(r.normalize).map((function (e) { + return a && r.isAbsolute(a) && r.isAbsolute(e) ? r.relative(a, e) : e + })), this._names = o.fromArray(s.map(String), !0), this._sources = o.fromArray(i, !0), this.sourceRoot = a, this.sourcesContent = c, this._mappings = l, this.file = u + } + + function u() { + this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null + } + + function f(e) { + var t = e; + "string" == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ""))); + var n = r.getArg(t, "version"), + i = r.getArg(t, "sections"); + if (n != this._version) throw new Error("Unsupported version: " + n); + this._sources = new o, this._names = new o; + var s = { + line: -1, + column: 0 + }; + this._sections = i.map((function (e) { + if (e.url) throw new Error("Support for url field in sections not implemented."); + var t = r.getArg(e, "offset"), + n = r.getArg(t, "line"), + i = r.getArg(t, "column"); + if (n < s.line || n === s.line && i < s.column) throw new Error("Section offsets must be ordered and non-overlapping."); + return s = t, { + generatedOffset: { + generatedLine: n + 1, + generatedColumn: i + 1 + }, + consumer: new c(r.getArg(e, "map")) + } + })) + } + c.fromSourceMap = function (e) { + return l.fromSourceMap(e) + }, c.prototype._version = 3, c.prototype.__generatedMappings = null, Object.defineProperty(c.prototype, "_generatedMappings", { + get: function () { + return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings + } + }), c.prototype.__originalMappings = null, Object.defineProperty(c.prototype, "_originalMappings", { + get: function () { + return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings + } + }), c.prototype._charIsMappingSeparator = function (e, t) { + var n = e.charAt(t); + return ";" === n || "," === n + }, c.prototype._parseMappings = function (e, t) { + throw new Error("Subclasses must implement _parseMappings") + }, c.GENERATED_ORDER = 1, c.ORIGINAL_ORDER = 2, c.GREATEST_LOWER_BOUND = 1, c.LEAST_UPPER_BOUND = 2, c.prototype.eachMapping = function (e, t, n) { + var i, o = t || null; + switch (n || c.GENERATED_ORDER) { + case c.GENERATED_ORDER: + i = this._generatedMappings; + break; + case c.ORIGINAL_ORDER: + i = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration.") + } + var s = this.sourceRoot; + i.map((function (e) { + var t = null === e.source ? null : this._sources.at(e.source); + return null != t && null != s && (t = r.join(s, t)), { + source: t, + generatedLine: e.generatedLine, + generatedColumn: e.generatedColumn, + originalLine: e.originalLine, + originalColumn: e.originalColumn, + name: null === e.name ? null : this._names.at(e.name) + } + }), this).forEach(e, o) + }, c.prototype.allGeneratedPositionsFor = function (e) { + var t = r.getArg(e, "line"), + n = { + source: r.getArg(e, "source"), + originalLine: t, + originalColumn: r.getArg(e, "column", 0) + }; + if (null != this.sourceRoot && (n.source = r.relative(this.sourceRoot, n.source)), !this._sources.has(n.source)) return []; + n.source = this._sources.indexOf(n.source); + var o = [], + s = this._findMapping(n, this._originalMappings, "originalLine", "originalColumn", r.compareByOriginalPositions, i.LEAST_UPPER_BOUND); + if (s >= 0) { + var a = this._originalMappings[s]; + if (void 0 === e.column) + for (var c = a.originalLine; a && a.originalLine === c;) o.push({ + line: r.getArg(a, "generatedLine", null), + column: r.getArg(a, "generatedColumn", null), + lastColumn: r.getArg(a, "lastGeneratedColumn", null) + }), a = this._originalMappings[++s]; + else + for (var l = a.originalColumn; a && a.originalLine === t && a.originalColumn == l;) o.push({ + line: r.getArg(a, "generatedLine", null), + column: r.getArg(a, "generatedColumn", null), + lastColumn: r.getArg(a, "lastGeneratedColumn", null) + }), a = this._originalMappings[++s] + } + return o + }, t.SourceMapConsumer = c, l.prototype = Object.create(c.prototype), l.prototype.consumer = c, l.fromSourceMap = function (e) { + var t = Object.create(l.prototype), + n = t._names = o.fromArray(e._names.toArray(), !0), + i = t._sources = o.fromArray(e._sources.toArray(), !0); + t.sourceRoot = e._sourceRoot, t.sourcesContent = e._generateSourcesContent(t._sources.toArray(), t.sourceRoot), t.file = e._file; + for (var s = e._mappings.toArray().slice(), c = t.__generatedMappings = [], f = t.__originalMappings = [], h = 0, p = s.length; h < p; h++) { + var d = s[h], + m = new u; + m.generatedLine = d.generatedLine, m.generatedColumn = d.generatedColumn, d.source && (m.source = i.indexOf(d.source), m.originalLine = d.originalLine, m.originalColumn = d.originalColumn, d.name && (m.name = n.indexOf(d.name)), f.push(m)), c.push(m) + } + return a(t.__originalMappings, r.compareByOriginalPositions), t + }, l.prototype._version = 3, Object.defineProperty(l.prototype, "sources", { + get: function () { + return this._sources.toArray().map((function (e) { + return null != this.sourceRoot ? r.join(this.sourceRoot, e) : e + }), this) + } + }), l.prototype._parseMappings = function (e, t) { + for (var n, i, o, c, l, f = 1, h = 0, p = 0, d = 0, m = 0, g = 0, y = e.length, v = 0, w = {}, b = {}, _ = [], E = []; v < y;) + if (";" === e.charAt(v)) f++, v++, h = 0; + else if ("," === e.charAt(v)) v++; + else { + for ((n = new u).generatedLine = f, c = v; c < y && !this._charIsMappingSeparator(e, c); c++); + if (o = w[i = e.slice(v, c)]) v += i.length; + else { + for (o = []; v < c;) s.decode(e, v, b), l = b.value, v = b.rest, o.push(l); + if (2 === o.length) throw new Error("Found a source, but no line and column"); + if (3 === o.length) throw new Error("Found a source and line, but no column"); + w[i] = o + } + n.generatedColumn = h + o[0], h = n.generatedColumn, o.length > 1 && (n.source = m + o[1], m += o[1], n.originalLine = p + o[2], p = n.originalLine, n.originalLine += 1, n.originalColumn = d + o[3], d = n.originalColumn, o.length > 4 && (n.name = g + o[4], g += o[4])), E.push(n), "number" == typeof n.originalLine && _.push(n) + } + a(E, r.compareByGeneratedPositionsDeflated), this.__generatedMappings = E, a(_, r.compareByOriginalPositions), this.__originalMappings = _ + }, l.prototype._findMapping = function (e, t, n, r, o, s) { + if (e[n] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + e[n]); + if (e[r] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + e[r]); + return i.search(e, t, o, s) + }, l.prototype.computeColumnSpans = function () { + for (var e = 0; e < this._generatedMappings.length; ++e) { + var t = this._generatedMappings[e]; + if (e + 1 < this._generatedMappings.length) { + var n = this._generatedMappings[e + 1]; + if (t.generatedLine === n.generatedLine) { + t.lastGeneratedColumn = n.generatedColumn - 1; + continue + } + } + t.lastGeneratedColumn = 1 / 0 + } + }, l.prototype.originalPositionFor = function (e) { + var t = { + generatedLine: r.getArg(e, "line"), + generatedColumn: r.getArg(e, "column") + }, + n = this._findMapping(t, this._generatedMappings, "generatedLine", "generatedColumn", r.compareByGeneratedPositionsDeflated, r.getArg(e, "bias", c.GREATEST_LOWER_BOUND)); + if (n >= 0) { + var i = this._generatedMappings[n]; + if (i.generatedLine === t.generatedLine) { + var o = r.getArg(i, "source", null); + null !== o && (o = this._sources.at(o), null != this.sourceRoot && (o = r.join(this.sourceRoot, o))); + var s = r.getArg(i, "name", null); + return null !== s && (s = this._names.at(s)), { + source: o, + line: r.getArg(i, "originalLine", null), + column: r.getArg(i, "originalColumn", null), + name: s + } + } + } + return { + source: null, + line: null, + column: null, + name: null + } + }, l.prototype.hasContentsOfAllSources = function () { + return !!this.sourcesContent && (this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some((function (e) { + return null == e + }))) + }, l.prototype.sourceContentFor = function (e, t) { + if (!this.sourcesContent) return null; + if (null != this.sourceRoot && (e = r.relative(this.sourceRoot, e)), this._sources.has(e)) return this.sourcesContent[this._sources.indexOf(e)]; + var n; + if (null != this.sourceRoot && (n = r.urlParse(this.sourceRoot))) { + var i = e.replace(/^file:\/\//, ""); + if ("file" == n.scheme && this._sources.has(i)) return this.sourcesContent[this._sources.indexOf(i)]; + if ((!n.path || "/" == n.path) && this._sources.has("/" + e)) return this.sourcesContent[this._sources.indexOf("/" + e)] + } + if (t) return null; + throw new Error('"' + e + '" is not in the SourceMap.') + }, l.prototype.generatedPositionFor = function (e) { + var t = r.getArg(e, "source"); + if (null != this.sourceRoot && (t = r.relative(this.sourceRoot, t)), !this._sources.has(t)) return { + line: null, + column: null, + lastColumn: null + }; + var n = { + source: t = this._sources.indexOf(t), + originalLine: r.getArg(e, "line"), + originalColumn: r.getArg(e, "column") + }, + i = this._findMapping(n, this._originalMappings, "originalLine", "originalColumn", r.compareByOriginalPositions, r.getArg(e, "bias", c.GREATEST_LOWER_BOUND)); + if (i >= 0) { + var o = this._originalMappings[i]; + if (o.source === n.source) return { + line: r.getArg(o, "generatedLine", null), + column: r.getArg(o, "generatedColumn", null), + lastColumn: r.getArg(o, "lastGeneratedColumn", null) + } + } + return { + line: null, + column: null, + lastColumn: null + } + }, t.BasicSourceMapConsumer = l, f.prototype = Object.create(c.prototype), f.prototype.constructor = c, f.prototype._version = 3, Object.defineProperty(f.prototype, "sources", { + get: function () { + for (var e = [], t = 0; t < this._sections.length; t++) + for (var n = 0; n < this._sections[t].consumer.sources.length; n++) e.push(this._sections[t].consumer.sources[n]); + return e + } + }), f.prototype.originalPositionFor = function (e) { + var t = { + generatedLine: r.getArg(e, "line"), + generatedColumn: r.getArg(e, "column") + }, + n = i.search(t, this._sections, (function (e, t) { + var n = e.generatedLine - t.generatedOffset.generatedLine; + return n || e.generatedColumn - t.generatedOffset.generatedColumn + })), + o = this._sections[n]; + return o ? o.consumer.originalPositionFor({ + line: t.generatedLine - (o.generatedOffset.generatedLine - 1), + column: t.generatedColumn - (o.generatedOffset.generatedLine === t.generatedLine ? o.generatedOffset.generatedColumn - 1 : 0), + bias: e.bias + }) : { + source: null, + line: null, + column: null, + name: null + } + }, f.prototype.hasContentsOfAllSources = function () { + return this._sections.every((function (e) { + return e.consumer.hasContentsOfAllSources() + })) + }, f.prototype.sourceContentFor = function (e, t) { + for (var n = 0; n < this._sections.length; n++) { + var r = this._sections[n].consumer.sourceContentFor(e, !0); + if (r) return r + } + if (t) return null; + throw new Error('"' + e + '" is not in the SourceMap.') + }, f.prototype.generatedPositionFor = function (e) { + for (var t = 0; t < this._sections.length; t++) { + var n = this._sections[t]; + if (-1 !== n.consumer.sources.indexOf(r.getArg(e, "source"))) { + var i = n.consumer.generatedPositionFor(e); + if (i) return { + line: i.line + (n.generatedOffset.generatedLine - 1), + column: i.column + (n.generatedOffset.generatedLine === i.line ? n.generatedOffset.generatedColumn - 1 : 0) + } + } + } + return { + line: null, + column: null + } + }, f.prototype._parseMappings = function (e, t) { + this.__generatedMappings = [], this.__originalMappings = []; + for (var n = 0; n < this._sections.length; n++) + for (var i = this._sections[n], o = i.consumer._generatedMappings, s = 0; s < o.length; s++) { + var c = o[s], + l = i.consumer._sources.at(c.source); + null !== i.consumer.sourceRoot && (l = r.join(i.consumer.sourceRoot, l)), this._sources.add(l), l = this._sources.indexOf(l); + var u = i.consumer._names.at(c.name); + this._names.add(u), u = this._names.indexOf(u); + var f = { + source: l, + generatedLine: c.generatedLine + (i.generatedOffset.generatedLine - 1), + generatedColumn: c.generatedColumn + (i.generatedOffset.generatedLine === c.generatedLine ? i.generatedOffset.generatedColumn - 1 : 0), + originalLine: c.originalLine, + originalColumn: c.originalColumn, + name: u + }; + this.__generatedMappings.push(f), "number" == typeof f.originalLine && this.__originalMappings.push(f) + } + a(this.__generatedMappings, r.compareByGeneratedPositionsDeflated), a(this.__originalMappings, r.compareByOriginalPositions) + }, t.IndexedSourceMapConsumer = f +}, function (e, t) { + t.GREATEST_LOWER_BOUND = 1, t.LEAST_UPPER_BOUND = 2, t.search = function (e, n, r, i) { + if (0 === n.length) return -1; + var o = function e(n, r, i, o, s, a) { + var c = Math.floor((r - n) / 2) + n, + l = s(i, o[c], !0); + return 0 === l ? c : l > 0 ? r - c > 1 ? e(c, r, i, o, s, a) : a == t.LEAST_UPPER_BOUND ? r < o.length ? r : -1 : c : c - n > 1 ? e(n, c, i, o, s, a) : a == t.LEAST_UPPER_BOUND ? c : n < 0 ? -1 : n + }(-1, n.length, e, n, r, i || t.GREATEST_LOWER_BOUND); + if (o < 0) return -1; + for (; o - 1 >= 0 && 0 === r(n[o], n[o - 1], !0);) --o; + return o + } +}, function (e, t) { + function n(e, t, n) { + var r = e[t]; + e[t] = e[n], e[n] = r + } + + function r(e, t, i, o) { + if (i < o) { + var s = i - 1; + n(e, (u = i, f = o, Math.round(u + Math.random() * (f - u))), o); + for (var a = e[o], c = i; c < o; c++) t(e[c], a) <= 0 && n(e, s += 1, c); + n(e, s + 1, c); + var l = s + 1; + r(e, t, i, l - 1), r(e, t, l + 1, o) + } + var u, f + } + t.quickSort = function (e, t) { + r(e, t, 0, e.length - 1) + } +}, function (e, t, n) { + var r = n(43).SourceMapGenerator, + i = n(17), + o = /(\r?\n)/, + s = "$$$isSourceNode$$$"; + + function a(e, t, n, r, i) { + this.children = [], this.sourceContents = {}, this.line = null == e ? null : e, this.column = null == t ? null : t, this.source = null == n ? null : n, this.name = null == i ? null : i, this[s] = !0, null != r && this.add(r) + } + a.fromStringWithSourceMap = function (e, t, n) { + var r = new a, + s = e.split(o), + c = 0, + l = function () { + return e() + (e() || ""); + + function e() { + return c < s.length ? s[c++] : void 0 + } + }, + u = 1, + f = 0, + h = null; + return t.eachMapping((function (e) { + if (null !== h) { + if (!(u < e.generatedLine)) { + var t = (n = s[c]).substr(0, e.generatedColumn - f); + return s[c] = n.substr(e.generatedColumn - f), f = e.generatedColumn, p(h, t), void(h = e) + } + p(h, l()), u++, f = 0 + } + for (; u < e.generatedLine;) r.add(l()), u++; + if (f < e.generatedColumn) { + var n = s[c]; + r.add(n.substr(0, e.generatedColumn)), s[c] = n.substr(e.generatedColumn), f = e.generatedColumn + } + h = e + }), this), c < s.length && (h && p(h, l()), r.add(s.splice(c).join(""))), t.sources.forEach((function (e) { + var o = t.sourceContentFor(e); + null != o && (null != n && (e = i.join(n, e)), r.setSourceContent(e, o)) + })), r; + + function p(e, t) { + if (null === e || void 0 === e.source) r.add(t); + else { + var o = n ? i.join(n, e.source) : e.source; + r.add(new a(e.originalLine, e.originalColumn, o, t, e.name)) + } + } + }, a.prototype.add = function (e) { + if (Array.isArray(e)) e.forEach((function (e) { + this.add(e) + }), this); + else { + if (!e[s] && "string" != typeof e) throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + e); + e && this.children.push(e) + } + return this + }, a.prototype.prepend = function (e) { + if (Array.isArray(e)) + for (var t = e.length - 1; t >= 0; t--) this.prepend(e[t]); + else { + if (!e[s] && "string" != typeof e) throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + e); + this.children.unshift(e) + } + return this + }, a.prototype.walk = function (e) { + for (var t, n = 0, r = this.children.length; n < r; n++)(t = this.children[n])[s] ? t.walk(e) : "" !== t && e(t, { + source: this.source, + line: this.line, + column: this.column, + name: this.name + }) + }, a.prototype.join = function (e) { + var t, n, r = this.children.length; + if (r > 0) { + for (t = [], n = 0; n < r - 1; n++) t.push(this.children[n]), t.push(e); + t.push(this.children[n]), this.children = t + } + return this + }, a.prototype.replaceRight = function (e, t) { + var n = this.children[this.children.length - 1]; + return n[s] ? n.replaceRight(e, t) : "string" == typeof n ? this.children[this.children.length - 1] = n.replace(e, t) : this.children.push("".replace(e, t)), this + }, a.prototype.setSourceContent = function (e, t) { + this.sourceContents[i.toSetString(e)] = t + }, a.prototype.walkSourceContents = function (e) { + for (var t = 0, n = this.children.length; t < n; t++) this.children[t][s] && this.children[t].walkSourceContents(e); + var r = Object.keys(this.sourceContents); + for (t = 0, n = r.length; t < n; t++) e(i.fromSetString(r[t]), this.sourceContents[r[t]]) + }, a.prototype.toString = function () { + var e = ""; + return this.walk((function (t) { + e += t + })), e + }, a.prototype.toStringWithSourceMap = function (e) { + var t = { + code: "", + line: 1, + column: 0 + }, + n = new r(e), + i = !1, + o = null, + s = null, + a = null, + c = null; + return this.walk((function (e, r) { + t.code += e, null !== r.source && null !== r.line && null !== r.column ? (o === r.source && s === r.line && a === r.column && c === r.name || n.addMapping({ + source: r.source, + original: { + line: r.line, + column: r.column + }, + generated: { + line: t.line, + column: t.column + }, + name: r.name + }), o = r.source, s = r.line, a = r.column, c = r.name, i = !0) : i && (n.addMapping({ + generated: { + line: t.line, + column: t.column + } + }), o = null, i = !1); + for (var l = 0, u = e.length; l < u; l++) 10 === e.charCodeAt(l) ? (t.line++, t.column = 0, l + 1 === u ? (o = null, i = !1) : i && n.addMapping({ + source: r.source, + original: { + line: r.line, + column: r.column + }, + generated: { + line: t.line, + column: t.column + }, + name: r.name + })) : t.column++ + })), this.walkSourceContents((function (e, t) { + n.setSourceContent(e, t) + })), { + code: t.code, + map: n + } + }, t.SourceNode = a +}, function (e, t) { + e.exports = require("module") +}, function (e, t, n) { + (function () { + var t; + t = n(29), e.exports = function () { + function e() { + this.clear() + } + return e.exceptionHandlers = [], e.onEventHandlerException = function (e) { + return 0 === this.exceptionHandlers.length && (this.dispatch = this.exceptionHandlingDispatch), this.exceptionHandlers.push(e), new t((n = this, function () { + if (n.exceptionHandlers.splice(n.exceptionHandlers.indexOf(e), 1), 0 === n.exceptionHandlers.length) return n.dispatch = n.simpleDispatch + })); + var n + }, e.simpleDispatch = function (e, t) { + return e(t) + }, e.exceptionHandlingDispatch = function (e, t) { + var n, r, i, o, s, a; + try { + return e(t) + } catch (e) { + for (n = e, a = [], i = 0, o = (s = this.exceptionHandlers).length; i < o; i++) r = s[i], a.push(r(n)); + return a + } + }, e.dispatch = e.simpleDispatch, e.prototype.disposed = !1, e.prototype.clear = function () { + return this.handlersByEventName = {} + }, e.prototype.dispose = function () { + return this.handlersByEventName = null, this.disposed = !0 + }, e.prototype.on = function (e, n, r) { + var i; + if (null == r && (r = !1), this.disposed) throw new Error("Emitter has been disposed"); + if ("function" != typeof n) throw new Error("Handler must be a function"); + return (i = this.handlersByEventName[e]) ? this.handlersByEventName[e] = r ? [n].concat(i) : i.concat(n) : this.handlersByEventName[e] = [n], new t(this.off.bind(this, e, n)) + }, e.prototype.once = function (e, t, n) { + var r, i; + return null == n && (n = !1), i = function (e) { + return r.dispose(), t(e) + }, r = this.on(e, i, n) + }, e.prototype.preempt = function (e, t) { + return this.on(e, t, !0) + }, e.prototype.off = function (e, t) { + var n, r, i, o, s; + if (!this.disposed && (i = this.handlersByEventName[e])) { + for (r = [], o = 0, s = i.length; o < s; o++)(n = i[o]) !== t && r.push(n); + r.length > 0 ? this.handlersByEventName[e] = r : delete this.handlersByEventName[e] + } + }, e.prototype.emit = function (e, t) { + var n, r, i, o, s; + if (r = null != (s = this.handlersByEventName) ? s[e] : void 0) + for (i = 0, o = r.length; i < o; i++) n = r[i], this.constructor.dispatch(n, t) + }, e.prototype.emitAsync = function (e, t) { + var n, r, i, o; + return (r = null != (o = this.handlersByEventName) ? o[e] : void 0) ? (i = function () { + var e, i, o; + for (o = [], e = 0, i = r.length; e < i; e++) n = r[e], o.push(this.constructor.dispatch(n, t)); + return o + }.call(this), Promise.all(i).then((function () {}))) : Promise.resolve() + }, e.prototype.getEventNames = function () { + return Object.keys(this.handlersByEventName) + }, e.prototype.listenerCountForEventName = function (e) { + var t, n; + return null != (t = null != (n = this.handlersByEventName[e]) ? n.length : void 0) ? t : 0 + }, e.prototype.getTotalListenerCount = function () { + var e, t, n, r, i; + for (t = 0, n = 0, r = (i = Object.keys(this.handlersByEventName)).length; n < r; n++) e = i[n], t += this.handlersByEventName[e].length; + return t + }, e + }() + }).call(this) +}, function (e, t, n) { + (function () { + var t, r; + t = null, e.exports = function () { + function e() { + var e, t, n; + for (this.disposables = new Set, t = 0, n = arguments.length; t < n; t++) e = arguments[t], this.add(e) + } + return e.prototype.disposed = !1, e.prototype.dispose = function () { + this.disposed || (this.disposed = !0, this.disposables.forEach((function (e) { + return e.dispose() + })), this.disposables = null) + }, e.prototype.add = function () { + var e, t, n; + if (!this.disposed) + for (t = 0, n = arguments.length; t < n; t += 1) r(e = arguments[t]), this.disposables.add(e) + }, e.prototype.remove = function (e) { + this.disposed || this.disposables.delete(e) + }, e.prototype.delete = function (e) { + this.remove(e) + }, e.prototype.clear = function () { + this.disposed || this.disposables.clear() + }, e + }(), r = function (e) { + if (null == t && (t = n(29)), !t.isDisposable(e)) throw new TypeError("Arguments to CompositeDisposable.add must have a .dispose() method") + } + }).call(this) +}, function (e, t, n) { + "use strict"; + Object.defineProperty(t, "__esModule", { + value: !0 + }); + const r = n(119); + var i; + + function o(e) { + return e === i.HKEY_CLASSES_ROOT ? 2147483648 : e === i.HKEY_CURRENT_USER ? 2147483649 : e === i.HKEY_LOCAL_MACHINE ? 2147483650 : e === i.HKEY_USERS ? 2147483651 : e === i.HKEY_PERFORMANCE_DATA ? 2147483652 : e === i.HKEY_CURRENT_CONFIG ? 2147483653 : e === i.HKEY_DYN_DATA ? 2147483654 : e === i.HKEY_CURRENT_USER_LOCAL_SETTINGS ? 2147483655 : e === i.HKEY_PERFORMANCE_TEXT ? 2147483728 : e === i.HKEY_PERFORMANCE_NLSTEXT ? 2147483744 : function (e, t) { + throw new Error(t) + }(0, "The key does not map to an expected number value") + } + + function s(e, t) { + if (!r) return []; + const n = o(e); + return r.readValues(n, t) + } + + function a(e, t) { + if (!r) return []; + const n = o(e); + return r.enumKeys(n, t) + }! function (e) { + e.REG_BINARY = "REG_BINARY", e.REG_DWORD = "REG_DWORD", e.REG_DWORD_LITTLE_ENDIAN = "REG_DWORD_LITTLE_ENDIAN", e.REG_DWORD_BIG_ENDIAN = "REG_DWORD_BIG_ENDIAN", e.REG_EXPAND_SZ = "REG_EXPAND_SZ", e.REG_LINK = "REG_LINK", e.REG_MULTI_SZ = "REG_MULTI_SZ", e.REG_NONE = "REG_NONE", e.REG_QWORD = "REG_QWORD", e.REG_QWORD_LITTLE_ENDIAN = "REG_QWORD_LITTLE_ENDIAN", e.REG_SZ = "REG_SZ" + }(t.RegistryValueType || (t.RegistryValueType = {})), + function (e) { + e.HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT", e.HKEY_CURRENT_CONFIG = "HKEY_CURRENT_CONFIG", e.HKEY_DYN_DATA = "HKEY_DYN_DATA", e.HKEY_CURRENT_USER_LOCAL_SETTINGS = "HKEY_CURRENT_USER_LOCAL_SETTINGS", e.HKEY_CURRENT_USER = "HKEY_CURRENT_USER", e.HKEY_LOCAL_MACHINE = "HKEY_LOCAL_MACHINE", e.HKEY_PERFORMANCE_DATA = "HKEY_PERFORMANCE_DATA", e.HKEY_PERFORMANCE_TEXT = "HKEY_PERFORMANCE_TEXT", e.HKEY_PERFORMANCE_NLSTEXT = "HKEY_PERFORMANCE_NLSTEXT", e.HKEY_USERS = "HKEY_USERS" + }(i = t.HKEY || (t.HKEY = {})), t.enumerateValues = s, t.enumerateValuesSafe = function (e, t) { + try { + return s(e, t) + } catch (e) { + return [] + } + }, t.enumerateKeys = a, t.enumerateKeysSafe = function (e, t) { + try { + return a(e, t) + } catch (e) { + return [] + } + } +}, function (e, t, n) { + (function (e) { + const t = n(1).join(__dirname, "registry.node"); + try { + global.process.dlopen(e, t) + } catch (e) { + throw new Error("Cannot open " + t + ": " + e) + } + }).call(this, n(120)(e)) +}, function (e, t) { + e.exports = function (e) { + return e.webpackPolyfill || (e.deprecate = function () {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", { + enumerable: !0, + get: function () { + return e.l + } + }), Object.defineProperty(e, "id", { + enumerable: !0, + get: function () { + return e.i + } + }), e.webpackPolyfill = 1), e + } +}, function (e, t, n) { + "use strict"; + n.r(t); + var r = n(1), + i = n(10), + o = n(23), + s = n(4); + n(107); + let a = null; + + function c() { + return a || (a = new Promise((e, t) => { + const n = Object(o.a)(); + Object(s.ensureDir)(n).then(() => { + try { + const t = function (e) { + const t = new i.transports.DailyRotateFile({ + filename: e, + handleExceptions: !1, + json: !1, + datePattern: "yyyy-MM-dd.", + prepend: !0, + level: "info", + maxFiles: 14 + }); + t.on("error", () => {}); + const n = new i.transports.Console({ + level: "error" + }); + return i.configure({ + transports: [n, t] + }), i.log + }((o = n, r.join(o, "desktop.production.log"))); + e(t) + } catch (e) { + t(e) + } + var o + }).catch(e => { + t(e) + }) + }), a) + } + async function l(e, t) { + try { + const n = await c(); + await new Promise((r, i) => { + n(e, t, e => { + e ? i(e) : r() + }) + }) + } catch (e) {} + } + var u = n(3), + f = n(50), + h = n.n(f), + p = n(51), + d = n.n(p); + const m = ["renderer.js", "main.js"]; + + function g(e) { + if (!m.some(t => e.endsWith(t))) return null; + e.startsWith("file://") && (e = h()(e)); + const t = e + ".map"; + if (!u.existsSync(t)) return null; + try { + const e = u.readFileSync(t, "utf8"); + return { + url: r.basename(t), + map: e + } + } catch (e) { + return null + } } + const y = new WeakMap; + let v; - function u(e) { - e && p(e); - try { - a.sync(r.dirname(C)), i.writeFileSync(C, S) - } catch (e) {} + function w(e, t) { + return y.set(e, t), e + t.map(e => "\n at " + e).join("") } - function m() { - clearTimeout(v), v = setTimeout(p, x) + function b(e) { + return { + name: e.name, + message: e.message, + stack: _(e) + } } - function g() { - p() + function _(e) { + let t = y.get(e); + return t || ((e.stack || "").toString(), t = y.get(e)), t ? v(e, t) : e.stack } - function f() { - y(), u() + function E(e, t) { + return (e = b(e)).stack ? t ? `${t}\n${e.stack}` : e.stack.trim() : t ? `${t}\n${e.name}: ${e.message}` : `${e.name}: ${e.message}` } - function h(e) { - E.maximize && S.isMaximized && e.maximize(), E.fullScreen && S.isFullScreen && e.setFullScreen(!0), e.on('resize', m), e.on('move', m), e.on('close', g), e.on('closed', f), w = e - } - - function y() { - w && (w.removeListener('resize', m), w.removeListener('move', m), clearTimeout(v), w.removeListener('close', g), w.removeListener('closed', f), w = null) - } - const _ = o.app || o.remote.app, - b = o.screen || o.remote.screen; - let S, w, v; - const x = 100, - E = Object.assign({ - file: 'window-state.json', - path: _.getPath('userData'), - maximize: !0, - fullScreen: !0 - }, e), - C = r.join(E.path, E.file); - try { - S = i.readFileSync(C) - } catch (e) {} - return c(), S = Object.assign({ - width: E.defaultWidth || 800, - height: E.defaultHeight || 600 - }, S), { - get x() { - return S.x - }, - get y() { - return S.y - }, - get width() { - return S.width - }, - get height() { - return S.height - }, - get displayBounds() { - return S.displayBounds - }, - get isMaximized() { - return S.isMaximized - }, - get isFullScreen() { - return S.isFullScreen - }, - saveState: u, - unmanage: y, - manage: h, - resetStateToDefault: s - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e) { - if (e.accelerator) return e.accelerator; - if (e.role) { - const n = e.getDefaultRoleAccelerator; - if ('function' == typeof n) try { - const t = n.call(e); - if ('string' == typeof t) return t - } catch (e) { - console.error('Could not retrieve default accelerator', e) - } - } - return null - } - - function o(e) { - const n = e.match(/&([^&])/); - return n ? n[1] : null - } - - function i(e) { - switch (e) { - case 'normal': - case 'separator': - case 'submenu': - case 'checkbox': - case 'radio': - return e; - default: - throw new Error(`Unable to parse string ${e} to a valid menu item type`); - } - } - - function a(e) { - const n = e.id; - if (!n) throw new Error(`menuItem must specify id: ${e.label}`); - const t = e.enabled, - a = e.visible, - d = e.label, - l = e.checked, - c = r(e), - u = o(e.label), - m = i(e.type); - switch (m) { - case 'normal': - return { - id: n, type: 'menuItem', label: d, enabled: t, visible: a, accelerator: c, accessKey: u - }; - case 'separator': - return { - id: n, type: 'separator', visible: a - }; - case 'submenu': - const r = s(e.submenu, n); - return { - id: n, type: 'submenuItem', label: d, enabled: t, visible: a, menu: r, accessKey: u - }; - case 'checkbox': - return { - id: n, type: 'checkbox', label: d, enabled: t, visible: a, accelerator: c, checked: l, accessKey: u - }; - case 'radio': - return { - id: n, type: 'radio', label: d, enabled: t, visible: a, accelerator: c, checked: l, accessKey: u - }; - default: - return p.assertNever(m, `Unknown menu item type ${m}`); - } - } - - function s(e, n) { - const t = e.items.map(a); - return !1, { - id: n, - type: 'menu', - items: t - } - } - - function d(e, n = new Map) { - for (const t of e.items) n.set(t.id, t), 'submenuItem' === t.type && d(t.menu, n); - return n - } - - function l(e) { - return 'menuItem' === e.type || 'submenuItem' === e.type || 'checkbox' === e.type || 'radio' === e.type - } - - function c(e) { - return 'separator' !== e.type && e.enabled && e.visible - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const p = t(27); - n.menuFromElectronMenu = s, n.itemMayHaveAccessKey = l, n.itemIsSelectable = c, n.findItemByAccessKey = function (e, n) { - const t = e.toLowerCase(); - for (const r of n) - if (l(r) && r.accessKey && r.accessKey.toLowerCase() === t) return r; - return null - }; - class u { - constructor(e, n, t) { - this.menu = e, this.openMenus = n, this.menuItemById = t - } - static fromMenu(e) { - const n = d(e); - return new u(e, [e], n) - } - getItemById(e) { - return this.menuItemById.get(e) - } - withMenu(e) { - const n = d(e), - t = []; - for (const r of this.openMenus) { - let o; - if (!r.id) o = e; - else { - const e = n.get(r.id); - if (e && 'submenuItem' === e.type) o = e.menu; - else break - } - let i; - r.selectedItem && (i = n.get(r.selectedItem.id)), t.push({ - id: o.id, - type: 'menu', - items: o.items, - selectedItem: i - }) - } - return new u(e, t, n) - } - withOpenedMenu(e, n = !1) { - const t = this.menuItemById.get(e.id); - if (!t) return this; - if ('submenuItem' !== t.type) throw new Error(`Attempt to open a submenu from an item of wrong type: ${t.type}`); - const r = this.openMenus.findIndex((e) => -1 !== e.items.indexOf(t)); - if (-1 === r) return this; - const o = this.openMenus.slice(0, r + 1); - if (n) { - const e = t.menu.items.find(c); - o.push(Object.assign({}, t.menu, { - selectedItem: e - })) - } else o.push(t.menu); - return new u(this.menu, o, this.menuItemById) - } - withClosedMenu(e) { - if (!e.id) return this; - const n = this.openMenus.findIndex((n) => n.id === e.id); - if (-1 === n) return this; - const t = this.openMenus.slice(0, n); - return new u(this.menu, t, this.menuItemById) - } - withLastMenu(e) { - const n = this.openMenus.findIndex((n) => n.id === e.id); - if (-1 === n) return this; - const t = this.openMenus.slice(0, n + 1); - return new u(this.menu, t, this.menuItemById) - } - withSelectedItem(e) { - const n = this.menuItemById.get(e.id); - if (!n) return this; - const t = this.openMenus.findIndex((e) => -1 !== e.items.indexOf(n)); - if (-1 === t) return this; - const r = this.openMenus.slice(), - o = r[t]; - r[t] = Object.assign({}, o, { - selectedItem: n - }); - for (let n = t + 1; n < r.length; n++) r[n] = Object.assign({}, r[n], { - selectedItem: void 0 - }); - for (let n = t - 1; 0 <= n; n--) { - const e = r[n], - t = r[n + 1], - o = e.items.find((e) => 'submenuItem' === e.type && e.id === t.id); - r[n] = Object.assign({}, e, { - selectedItem: o - }) - } - return new u(this.menu, r, this.menuItemById) - } - withDeselectedMenu(e) { - const n = this.openMenus.findIndex((n) => n.id === e.id); - if (-1 === n) return this; - const t = this.openMenus[n], - r = this.openMenus.slice(); - r[n] = Object.assign({}, t, { - selectedItem: void 0 - }); - for (let t = n - 1; 0 <= t; t--) { - const e = r[t], - n = r[t + 1], - o = e.items.find((e) => 'submenuItem' === e.type && e.id === n.id); - r[t] = Object.assign({}, e, { - selectedItem: o - }) - } - return new u(this.menu, r, this.menuItemById) - } - withReset() { - return new u(this.menu, [this.menu], this.menuItemById) - } - } - n.AppMenu = u -}, function (e, n, t) { - 'use strict'; - const r = t(0); - e.exports = (e, n) => { - if ('string' != typeof e) throw new TypeError(`Expected a string, got ${typeof e}`); - n = Object.assign({ - resolve: !0 - }, n); - let t = e; - return n.resolve && (t = r.resolve(e)), t = t.replace(/\\/g, '/'), '/' !== t[0] && (t = `/${t}`), encodeURI(`file://${t}`).replace(/[?#]/g, encodeURIComponent) - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(0), - o = t(67); - n.encodePathAsUrl = function (...e) { - const n = r.resolve(...e); - return o(n) - } -}, function (e, n, t) { - (function () { - var n, r, o; - r = null, e.exports = n = function () { - function e() { - var e, n, t; - for (this.disposables = new Set, n = 0, t = arguments.length; n < t; n++) e = arguments[n], this.add(e) - } - return e.prototype.disposed = !1, e.prototype.dispose = function () { - this.disposed || (this.disposed = !0, this.disposables.forEach(function (e) { - return e.dispose() - }), this.disposables = null) - }, e.prototype.add = function () { - var e, n, t; - if (!this.disposed) - for (n = 0, t = arguments.length; n < t; n += 1) e = arguments[n], o(e), this.disposables.add(e) - }, e.prototype.remove = function (e) { - this.disposed || this.disposables['delete'](e) - }, e.prototype['delete'] = function (e) { - this.remove(e) - }, e.prototype.clear = function () { - this.disposed || this.disposables.clear() - }, e - }(), o = function (e) { - if (null == r && (r = t(17)), !r.isDisposable(e)) throw new TypeError('Arguments to CompositeDisposable.add must have a .dispose() method') - } - }).call(this) -}, function (e, n, t) { - (function () { - var n, r; - n = t(17), e.exports = r = function () { - function e() { - this.clear() - } - return e.exceptionHandlers = [], e.onEventHandlerException = function (e) { - return 0 === this.exceptionHandlers.length && (this.dispatch = this.exceptionHandlingDispatch), this.exceptionHandlers.push(e), new n(function (n) { - return function () { - if (n.exceptionHandlers.splice(n.exceptionHandlers.indexOf(e), 1), 0 === n.exceptionHandlers.length) return n.dispatch = n.simpleDispatch - } - }(this)) - }, e.simpleDispatch = function (e, n) { - return e(n) - }, e.exceptionHandlingDispatch = function (e, n) { - var t, r, o, i, a, s; - try { - return e(n) - } catch (e) { - for (t = e, a = this.exceptionHandlers, s = [], (o = 0, i = a.length); o < i; o++) r = a[o], s.push(r(t)); - return s - } - }, e.dispatch = e.simpleDispatch, e.prototype.disposed = !1, e.prototype.clear = function () { - return this.handlersByEventName = {} - }, e.prototype.dispose = function () { - return this.handlersByEventName = null, this.disposed = !0 - }, e.prototype.on = function (e, t, r) { - var o; - if (null == r && (r = !1), this.disposed) throw new Error('Emitter has been disposed'); - if ('function' != typeof t) throw new Error('Handler must be a function'); - return this.handlersByEventName[e] = (o = this.handlersByEventName[e]) ? r ? [t].concat(o) : o.concat(t) : [t], new n(this.off.bind(this, e, t)) - }, e.prototype.once = function (e, n, t) { - var r, o; - return null == t && (t = !1), o = function (e) { - return r.dispose(), n(e) - }, r = this.on(e, o, t) - }, e.prototype.preempt = function (e, n) { - return this.on(e, n, !0) - }, e.prototype.off = function (e, n) { - var t, r, o, i, a; - if (!this.disposed && (o = this.handlersByEventName[e])) { - for (r = [], i = 0, a = o.length; i < a; i++) t = o[i], t !== n && r.push(t); - 0 < r.length ? this.handlersByEventName[e] = r : delete this.handlersByEventName[e] - } - }, e.prototype.emit = function (e, n) { - var t, r, o, i, a; - if (r = null == (a = this.handlersByEventName) ? void 0 : a[e]) - for (o = 0, i = r.length; o < i; o++) t = r[o], this.constructor.dispatch(t, n) - }, e.prototype.emitAsync = function (e, n) { - var t, r, o, i; - return (r = null == (i = this.handlersByEventName) ? void 0 : i[e]) ? (o = function () { - var e, o, i; - for (i = [], e = 0, o = r.length; e < o; e++) t = r[e], i.push(this.constructor.dispatch(t, n)); - return i - }.call(this), Promise.all(o).then(function () {})) : Promise.resolve() - }, e.prototype.getEventNames = function () { - return Object.keys(this.handlersByEventName) - }, e.prototype.listenerCountForEventName = function (e) { - var n, t; - return null == (n = null == (t = this.handlersByEventName[e]) ? void 0 : t.length) ? 0 : n - }, e.prototype.getTotalListenerCount = function () { - var e, n, t, r, o; - for (n = 0, o = Object.keys(this.handlersByEventName), (t = 0, r = o.length); t < r; t++) e = o[t], n += this.handlersByEventName[e].length; - return n - }, e - }() - }).call(this) -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(4), - o = t(29), - i = t(68), - a = t(28), - s = t(66), - d = t(26), - l = t(0), - c = t(65); - class p { - constructor() { - this.emitter = new o.Emitter, this._loadTime = null, this._rendererReadyTime = null, this.minWidth = 960, this.minHeight = 660; - const e = c({ - defaultWidth: this.minWidth, - defaultHeight: this.minHeight - }), - n = { - x: e.x, - y: e.y, - width: e.width, - height: e.height, - minWidth: this.minWidth, - minHeight: this.minHeight, - show: !1, - backgroundColor: '#fff', - webPreferences: { - disableBlinkFeatures: 'Auxclick', - experimentalFeatures: !0, - nodeIntegration: !0 - }, - acceptFirstMouse: !0 - }; - n.frame = !1, this.window = new r.BrowserWindow(n), e.manage(this.window); - let t = !1; - r.app.on('before-quit', () => { - t = !0 - }), r.ipcMain.on('will-quit', (e) => { - t = !0, e.returnValue = !0 - }), !1, this.window.once('ready-to-show', () => { - this.window.on('unmaximize', () => { - setTimeout(() => { - const e = this.window.getBounds(); - e.width += 1, this.window.setBounds(e), e.width -= 1, this.window.setBounds(e) - }, 5) - }) - }) - } - load() { - let e = 0; - this.window.webContents.once('did-start-loading', () => { - this._rendererReadyTime = null, this._loadTime = null, e = d.now() - }), this.window.webContents.once('did-finish-load', () => { - !1, this._loadTime = d.now() - e, this.maybeEmitDidLoad() - }), this.window.webContents.on('did-finish-load', () => { - this.window.webContents.setVisualZoomLevelLimits(1, 1) - }), this.window.webContents.on('did-fail-load', () => { - this.window.webContents.openDevTools(), this.window.show() - }), r.ipcMain.once('renderer-ready', (e, n) => { - this._rendererReadyTime = n, this.maybeEmitDidLoad() - }), this.window.on('focus', () => this.window.webContents.send('focus')), this.window.on('blur', () => this.window.webContents.send('blur')), a.registerWindowStateChangedEvents(this.window), this.window.loadURL(i.encodePathAsUrl(__dirname, 'index.html')) - } - maybeEmitDidLoad() { - this.rendererLoaded && this.emitter.emit('did-load', null) - } - get rendererLoaded() { - return !!this.loadTime && !!this.rendererReadyTime - } - onClose(e) { - this.window.on('closed', e) - } - onDidLoad(e) { - return this.emitter.on('did-load', e) - } - isMinimized() { - return this.window.isMinimized() - } - isVisible() { - return this.window.isVisible() - } - restore() { - this.window.restore() - } - focus() { - this.window.focus() - } - show() { - this.window.show() - } - sendMenuEvent(e) { - this.show(), this.window.webContents.send('menu-event', { - name: e - }) - } - sendURLAction(e) { - this.show(), this.window.webContents.send('url-action', { - action: e - }) - } - sendLaunchTimingStats(e) { - this.window.webContents.send('launch-timing-stats', { - stats: e - }) - } - sendAppMenu() { - const e = r.Menu.getApplicationMenu(); - if (e) { - const n = s.menuFromElectronMenu(e); - this.window.webContents.send('app-menu', { - menu: n - }) - } - } - sendCertificateError(e, n, t) { - this.window.webContents.send('certificate-error', { - certificate: e, - error: n, - url: t - }) - } - showCertificateTrustDialog(e, n) { - const t = r.dialog; - t.showCertificateTrustDialog(this.window, { - certificate: e, - message: n - }, () => {}) - } - sendException(e) { - const n = { - stack: e.stack, - message: e.message, - name: e.name - }; - this.window.webContents.send('main-process-exception', n) - } - get loadTime() { - return this._loadTime - } - get rendererReadyTime() { - return this._rendererReadyTime - } - destroy() { - this.window.destroy() - } - } - n.AppWindow = p -}, function (e) { - e.exports = require('module') -}, function (e, n, t) { - function r(e, n, t, r, o) { - this.children = [], this.sourceContents = {}, this.line = null == e ? null : e, this.column = null == n ? null : n, this.source = null == t ? null : t, this.name = null == o ? null : o, this[s] = !0, null != r && this.add(r) - } - var o = t(32).SourceMapGenerator, - a = t(11), - i = /(\r?\n)/, - s = '$$$isSourceNode$$$'; - r.fromStringWithSourceMap = function (e, n, t) { - function o(e, n) { - if (null === e || void 0 === e.source) s.add(n); - else { - var o = t ? a.join(t, e.source) : e.source; - s.add(new r(e.originalLine, e.originalColumn, o, n, e.name)) - } - } - var s = new r, - d = e.split(i), - l = 0, - c = function () { - function e() { - return l < d.length ? d[l++] : void 0 - } - var n = e(), - t = e() || ''; - return n + t - }, - p = 1, - u = 0, - m = null; - return n.eachMapping(function (e) { - if (null !== m) - if (p < e.generatedLine) o(m, c()), p++, u = 0; - else { - var n = d[l], - t = n.substr(0, e.generatedColumn - u); - return d[l] = n.substr(e.generatedColumn - u), u = e.generatedColumn, o(m, t), void(m = e) - } for (; p < e.generatedLine;) s.add(c()), p++; - if (u < e.generatedColumn) { - var n = d[l]; - s.add(n.substr(0, e.generatedColumn)), d[l] = n.substr(e.generatedColumn), u = e.generatedColumn - } - m = e - }, this), l < d.length && (m && o(m, c()), s.add(d.splice(l).join(''))), n.sources.forEach(function (e) { - var r = n.sourceContentFor(e); - null != r && (null != t && (e = a.join(t, e)), s.setSourceContent(e, r)) - }), s - }, r.prototype.add = function (e) { - if (Array.isArray(e)) e.forEach(function (e) { - this.add(e) - }, this); - else if (e[s] || 'string' == typeof e) e && this.children.push(e); - else throw new TypeError('Expected a SourceNode, string, or an array of SourceNodes and strings. Got ' + e); - return this - }, r.prototype.prepend = function (e) { - if (Array.isArray(e)) - for (var n = e.length - 1; 0 <= n; n--) this.prepend(e[n]); - else if (e[s] || 'string' == typeof e) this.children.unshift(e); - else throw new TypeError('Expected a SourceNode, string, or an array of SourceNodes and strings. Got ' + e); - return this - }, r.prototype.walk = function (e) { - for (var n = 0, t = this.children.length, r; n < t; n++) r = this.children[n], r[s] ? r.walk(e) : '' !== r && e(r, { - source: this.source, - line: this.line, - column: this.column, - name: this.name - }) - }, r.prototype.join = function (e) { - var n = this.children.length, - t, r; - if (0 < n) { - for (t = [], r = 0; r < n - 1; r++) t.push(this.children[r]), t.push(e); - t.push(this.children[r]), this.children = t - } - return this - }, r.prototype.replaceRight = function (e, n) { - var t = this.children[this.children.length - 1]; - return t[s] ? t.replaceRight(e, n) : 'string' == typeof t ? this.children[this.children.length - 1] = t.replace(e, n) : this.children.push(''.replace(e, n)), this - }, r.prototype.setSourceContent = function (e, n) { - this.sourceContents[a.toSetString(e)] = n - }, r.prototype.walkSourceContents = function (e) { - for (var n = 0, t = this.children.length; n < t; n++) this.children[n][s] && this.children[n].walkSourceContents(e); - for (var r = Object.keys(this.sourceContents), n = 0, t = r.length; n < t; n++) e(a.fromSetString(r[n]), this.sourceContents[r[n]]) - }, r.prototype.toString = function () { - var e = ''; - return this.walk(function (n) { - e += n - }), e - }, r.prototype.toStringWithSourceMap = function (e) { - var n = { - code: '', - line: 1, - column: 0 - }, - t = new o(e), - r = !1, - i = null, - a = null, - s = null, - d = null; - return this.walk(function (e, o) { - n.code += e, null !== o.source && null !== o.line && null !== o.column ? ((i !== o.source || a !== o.line || s !== o.column || d !== o.name) && t.addMapping({ - source: o.source, - original: { - line: o.line, - column: o.column - }, - generated: { - line: n.line, - column: n.column - }, - name: o.name - }), i = o.source, a = o.line, s = o.column, d = o.name, r = !0) : r && (t.addMapping({ - generated: { - line: n.line, - column: n.column - } - }), i = null, r = !1); - for (var l = 0, c = e.length; l < c; l++) e.charCodeAt(l) === 10 ? (n.line++, n.column = 0, l + 1 === c ? (i = null, r = !1) : r && t.addMapping({ - source: o.source, - original: { - line: o.line, - column: o.column + function S(e, t) { + return t ? E(t, e) : e + } + global.log = { + error(e, t) { + l("error", "[main] " + S(e, t)) }, - generated: { - line: n.line, - column: n.column + warn(e, t) { + l("warn", "[main] " + S(e, t)) }, - name: o.name - })) : n.column++ - }), this.walkSourceContents(function (e, n) { - t.setSourceContent(e, n) - }), { - code: n.code, - map: t - } - }, n.SourceNode = r -}, function (e, n) { - function t(e, n, t) { - var r = e[n]; - e[n] = e[t], e[t] = r - } - - function o(e, n) { - return Math.round(e + Math.random() * (n - e)) - } - - function a(e, n, s, d) { - if (s < d) { - var r = o(s, d), - l = s - 1; - t(e, r, d); - for (var i = e[d], c = s; c < d; c++) 0 >= n(e[c], i) && (l += 1, t(e, l, c)); - t(e, l + 1, c); - var p = l + 1; - a(e, n, s, p - 1), a(e, n, p + 1, d) - } - } - n.quickSort = function (e, n) { - a(e, n, 0, e.length - 1) - } -}, function (e, n) { - function t(e, r, o, i, a, s) { - var d = Math.floor((r - e) / 2) + e, - l = a(o, i[d], !0); - return 0 === l ? d : 0 < l ? 1 < r - d ? t(d, r, o, i, a, s) : s == n.LEAST_UPPER_BOUND ? r < i.length ? r : -1 : d : 1 < d - e ? t(e, d, o, i, a, s) : s == n.LEAST_UPPER_BOUND ? d : 0 > e ? -1 : e - } - n.GREATEST_LOWER_BOUND = 1, n.LEAST_UPPER_BOUND = 2, n.search = function (e, r, o, i) { - if (0 === r.length) return -1; - var a = t(-1, r.length, e, r, o, i || n.GREATEST_LOWER_BOUND); - if (0 > a) return -1; - for (; 0 <= a - 1 && !(0 !== o(r[a], r[a - 1], !0));) --a; - return a - } -}, function (e, n, t) { - function r(e) { - var n = e; - return 'string' == typeof e && (n = JSON.parse(e.replace(/^\)\]\}'/, ''))), null == n.sections ? new o(n) : new i(n) - } - - function o(e) { - var n = e; - 'string' == typeof e && (n = JSON.parse(e.replace(/^\)\]\}'/, ''))); - var t = d.getArg(n, 'version'), - r = d.getArg(n, 'sources'), - o = d.getArg(n, 'names', []), - i = d.getArg(n, 'sourceRoot', null), - a = d.getArg(n, 'sourcesContent', null), - s = d.getArg(n, 'mappings'), - c = d.getArg(n, 'file', null); - if (t != this._version) throw new Error('Unsupported version: ' + t); - r = r.map(String).map(d.normalize).map(function (e) { - return i && d.isAbsolute(i) && d.isAbsolute(e) ? d.relative(i, e) : e - }), this._names = l.fromArray(o.map(String), !0), this._sources = l.fromArray(r, !0), this.sourceRoot = i, this.sourcesContent = a, this._mappings = s, this.file = c - } - - function a() { - this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null - } - - function i(e) { - var n = e; - 'string' == typeof e && (n = JSON.parse(e.replace(/^\)\]\}'/, ''))); - var t = d.getArg(n, 'version'), - o = d.getArg(n, 'sections'); - if (t != this._version) throw new Error('Unsupported version: ' + t); - this._sources = new l, this._names = new l; - var i = { - line: -1, - column: 0 - }; - this._sections = o.map(function (e) { - if (e.url) throw new Error('Support for url field in sections not implemented.'); - var n = d.getArg(e, 'offset'), - t = d.getArg(n, 'line'), - o = d.getArg(n, 'column'); - if (t < i.line || t === i.line && o < i.column) throw new Error('Section offsets must be ordered and non-overlapping.'); - return i = n, { - generatedOffset: { - generatedLine: t + 1, - generatedColumn: o + 1 + info(e, t) { + l("info", "[main] " + S(e, t)) }, - consumer: new r(d.getArg(e, 'map')) - } - }) - } - var d = t(11), - s = t(75), - l = t(30).ArraySet, - c = t(31), - p = t(74).quickSort; - r.fromSourceMap = function (e) { - return o.fromSourceMap(e) - }, r.prototype._version = 3, r.prototype.__generatedMappings = null, Object.defineProperty(r.prototype, '_generatedMappings', { - get: function () { - return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings - } - }), r.prototype.__originalMappings = null, Object.defineProperty(r.prototype, '_originalMappings', { - get: function () { - return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings - } - }), r.prototype._charIsMappingSeparator = function (e, n) { - var t = e.charAt(n); - return ';' === t || ',' === t - }, r.prototype._parseMappings = function () { - throw new Error('Subclasses must implement _parseMappings') - }, r.GENERATED_ORDER = 1, r.ORIGINAL_ORDER = 2, r.GREATEST_LOWER_BOUND = 1, r.LEAST_UPPER_BOUND = 2, r.prototype.eachMapping = function (e, n, t) { - var o = t || r.GENERATED_ORDER, - i; - switch (o) { - case r.GENERATED_ORDER: - i = this._generatedMappings; - break; - case r.ORIGINAL_ORDER: - i = this._originalMappings; - break; - default: - throw new Error('Unknown order of iteration.'); - } - var a = this.sourceRoot; - i.map(function (e) { - var n = null === e.source ? null : this._sources.at(e.source); - return null != n && null != a && (n = d.join(a, n)), { - source: n, - generatedLine: e.generatedLine, - generatedColumn: e.generatedColumn, - originalLine: e.originalLine, - originalColumn: e.originalColumn, - name: null === e.name ? null : this._names.at(e.name) - } - }, this).forEach(e, n || null) - }, r.prototype.allGeneratedPositionsFor = function (e) { - var n = d.getArg(e, 'line'), - t = { - source: d.getArg(e, 'source'), - originalLine: n, - originalColumn: d.getArg(e, 'column', 0) - }; - if (null != this.sourceRoot && (t.source = d.relative(this.sourceRoot, t.source)), !this._sources.has(t.source)) return []; - t.source = this._sources.indexOf(t.source); - var r = [], - o = this._findMapping(t, this._originalMappings, 'originalLine', 'originalColumn', d.compareByOriginalPositions, s.LEAST_UPPER_BOUND); - if (0 <= o) { - var i = this._originalMappings[o]; - if (void 0 === e.column) - for (var a = i.originalLine; i && i.originalLine === a;) r.push({ - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - }), i = this._originalMappings[++o]; - else - for (var l = i.originalColumn; i && i.originalLine === n && i.originalColumn == l;) r.push({ - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - }), i = this._originalMappings[++o] - } - return r - }, n.SourceMapConsumer = r, o.prototype = Object.create(r.prototype), o.prototype.consumer = r, o.fromSourceMap = function (e) { - var n = Object.create(o.prototype), - t = n._names = l.fromArray(e._names.toArray(), !0), - r = n._sources = l.fromArray(e._sources.toArray(), !0); - n.sourceRoot = e._sourceRoot, n.sourcesContent = e._generateSourcesContent(n._sources.toArray(), n.sourceRoot), n.file = e._file; - for (var s = e._mappings.toArray().slice(), c = n.__generatedMappings = [], u = n.__originalMappings = [], m = 0, i = s.length; m < i; m++) { - var g = s[m], - f = new a; - f.generatedLine = g.generatedLine, f.generatedColumn = g.generatedColumn, g.source && (f.source = r.indexOf(g.source), f.originalLine = g.originalLine, f.originalColumn = g.originalColumn, g.name && (f.name = t.indexOf(g.name)), u.push(f)), c.push(f) - } - return p(n.__originalMappings, d.compareByOriginalPositions), n - }, o.prototype._version = 3, Object.defineProperty(o.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (e) { - return null == this.sourceRoot ? e : d.join(this.sourceRoot, e) - }, this) - } - }), o.prototype._parseMappings = function (e) { - for (var n = 1, t = 0, r = 0, o = 0, i = 0, s = 0, l = e.length, u = 0, m = {}, g = {}, f = [], h = [], y, _, b, S, w; u < l;) - if (';' === e.charAt(u)) n++, u++, t = 0; - else if (',' === e.charAt(u)) u++; - else { - for (y = new a, y.generatedLine = n, S = u; S < l && !this._charIsMappingSeparator(e, S); S++); - if (_ = e.slice(u, S), b = m[_], b) u += _.length; - else { - for (b = []; u < S;) c.decode(e, u, g), w = g.value, u = g.rest, b.push(w); - if (2 === b.length) throw new Error('Found a source, but no line and column'); - if (3 === b.length) throw new Error('Found a source and line, but no column'); - m[_] = b - } - y.generatedColumn = t + b[0], t = y.generatedColumn, 1 < b.length && (y.source = i + b[1], i += b[1], y.originalLine = r + b[2], r = y.originalLine, y.originalLine += 1, y.originalColumn = o + b[3], o = y.originalColumn, 4 < b.length && (y.name = s + b[4], s += b[4])), h.push(y), 'number' == typeof y.originalLine && f.push(y) - } - p(h, d.compareByGeneratedPositionsDeflated), this.__generatedMappings = h, p(f, d.compareByOriginalPositions), this.__originalMappings = f - }, o.prototype._findMapping = function (e, n, t, r, o, i) { - if (0 >= e[t]) throw new TypeError('Line must be greater than or equal to 1, got ' + e[t]); - if (0 > e[r]) throw new TypeError('Column must be greater than or equal to 0, got ' + e[r]); - return s.search(e, n, o, i) - }, o.prototype.computeColumnSpans = function () { - for (var e = 0, n; e < this._generatedMappings.length; ++e) { - if (n = this._generatedMappings[e], e + 1 < this._generatedMappings.length) { - var t = this._generatedMappings[e + 1]; - if (n.generatedLine === t.generatedLine) { - n.lastGeneratedColumn = t.generatedColumn - 1; - continue - } - } - n.lastGeneratedColumn = Infinity - } - }, o.prototype.originalPositionFor = function (e) { - var n = { - generatedLine: d.getArg(e, 'line'), - generatedColumn: d.getArg(e, 'column') - }, - t = this._findMapping(n, this._generatedMappings, 'generatedLine', 'generatedColumn', d.compareByGeneratedPositionsDeflated, d.getArg(e, 'bias', r.GREATEST_LOWER_BOUND)); - if (0 <= t) { - var o = this._generatedMappings[t]; - if (o.generatedLine === n.generatedLine) { - var i = d.getArg(o, 'source', null); - null !== i && (i = this._sources.at(i), null != this.sourceRoot && (i = d.join(this.sourceRoot, i))); - var a = d.getArg(o, 'name', null); - return null !== a && (a = this._names.at(a)), { - source: i, - line: d.getArg(o, 'originalLine', null), - column: d.getArg(o, 'originalColumn', null), - name: a - } - } - } - return { - source: null, - line: null, - column: null, - name: null - } - }, o.prototype.hasContentsOfAllSources = function () { - return !!this.sourcesContent && this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (e) { - return null == e - }) - }, o.prototype.sourceContentFor = function (e, n) { - if (!this.sourcesContent) return null; - if (null != this.sourceRoot && (e = d.relative(this.sourceRoot, e)), this._sources.has(e)) return this.sourcesContent[this._sources.indexOf(e)]; - var t; - if (null != this.sourceRoot && (t = d.urlParse(this.sourceRoot))) { - var r = e.replace(/^file:\/\//, ''); - if ('file' == t.scheme && this._sources.has(r)) return this.sourcesContent[this._sources.indexOf(r)]; - if ((!t.path || '/' == t.path) && this._sources.has('/' + e)) return this.sourcesContent[this._sources.indexOf('/' + e)] - } - if (n) return null; - throw new Error('"' + e + '" is not in the SourceMap.') - }, o.prototype.generatedPositionFor = function (e) { - var n = d.getArg(e, 'source'); - if (null != this.sourceRoot && (n = d.relative(this.sourceRoot, n)), !this._sources.has(n)) return { - line: null, - column: null, - lastColumn: null - }; - n = this._sources.indexOf(n); - var t = { - source: n, - originalLine: d.getArg(e, 'line'), - originalColumn: d.getArg(e, 'column') - }, - o = this._findMapping(t, this._originalMappings, 'originalLine', 'originalColumn', d.compareByOriginalPositions, d.getArg(e, 'bias', r.GREATEST_LOWER_BOUND)); - if (0 <= o) { - var i = this._originalMappings[o]; - if (i.source === t.source) return { - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - } - } - return { - line: null, - column: null, - lastColumn: null - } - }, n.BasicSourceMapConsumer = o, i.prototype = Object.create(r.prototype), i.prototype.constructor = r, i.prototype._version = 3, Object.defineProperty(i.prototype, 'sources', { - get: function () { - for (var e = [], n = 0; n < this._sections.length; n++) - for (var t = 0; t < this._sections[n].consumer.sources.length; t++) e.push(this._sections[n].consumer.sources[t]); - return e - } - }), i.prototype.originalPositionFor = function (e) { - var n = { - generatedLine: d.getArg(e, 'line'), - generatedColumn: d.getArg(e, 'column') - }, - t = s.search(n, this._sections, function (e, n) { - var t = e.generatedLine - n.generatedOffset.generatedLine; - return t ? t : e.generatedColumn - n.generatedOffset.generatedColumn - }), - r = this._sections[t]; - return r ? r.consumer.originalPositionFor({ - line: n.generatedLine - (r.generatedOffset.generatedLine - 1), - column: n.generatedColumn - (r.generatedOffset.generatedLine === n.generatedLine ? r.generatedOffset.generatedColumn - 1 : 0), - bias: e.bias - }) : { - source: null, - line: null, - column: null, - name: null - } - }, i.prototype.hasContentsOfAllSources = function () { - return this._sections.every(function (e) { - return e.consumer.hasContentsOfAllSources() - }) - }, i.prototype.sourceContentFor = function (e, n) { - for (var t = 0; t < this._sections.length; t++) { - var r = this._sections[t], - o = r.consumer.sourceContentFor(e, !0); - if (o) return o - } - if (n) return null; - throw new Error('"' + e + '" is not in the SourceMap.') - }, i.prototype.generatedPositionFor = function (e) { - for (var n = 0, t; n < this._sections.length; n++) - if (t = this._sections[n], -1 !== t.consumer.sources.indexOf(d.getArg(e, 'source'))) { - var r = t.consumer.generatedPositionFor(e); - if (r) { - var o = { - line: r.line + (t.generatedOffset.generatedLine - 1), - column: r.column + (t.generatedOffset.generatedLine === r.line ? t.generatedOffset.generatedColumn - 1 : 0) - }; - return o - } - } return { - line: null, - column: null - } - }, i.prototype._parseMappings = function () { - this.__generatedMappings = [], this.__originalMappings = []; - for (var e = 0; e < this._sections.length; e++) - for (var n = this._sections[e], t = n.consumer._generatedMappings, r = 0; r < t.length; r++) { - var o = t[r], - i = n.consumer._sources.at(o.source); - null !== n.consumer.sourceRoot && (i = d.join(n.consumer.sourceRoot, i)), this._sources.add(i), i = this._sources.indexOf(i); - var a = n.consumer._names.at(o.name); - this._names.add(a), a = this._names.indexOf(a); - var s = { - source: i, - generatedLine: o.generatedLine + (n.generatedOffset.generatedLine - 1), - generatedColumn: o.generatedColumn + (n.generatedOffset.generatedLine === o.generatedLine ? n.generatedOffset.generatedColumn - 1 : 0), - originalLine: o.originalLine, - originalColumn: o.originalColumn, - name: a - }; - this.__generatedMappings.push(s), 'number' == typeof s.originalLine && this.__originalMappings.push(s) - } - p(this.__generatedMappings, d.compareByGeneratedPositionsDeflated), p(this.__originalMappings, d.compareByOriginalPositions) - }, n.IndexedSourceMapConsumer = i -}, function (e, n, t) { - function r(e, n) { - var t = e.generatedLine, - r = n.generatedLine, - o = e.generatedColumn, - a = n.generatedColumn; - return r > t || r == t && a >= o || 0 >= i.compareByGeneratedPositionsInflated(e, n) - } - - function o() { - this._array = [], this._sorted = !0, this._last = { - generatedLine: -1, - generatedColumn: 0 - } - } - var i = t(11); - o.prototype.unsortedForEach = function (e, n) { - this._array.forEach(e, n) - }, o.prototype.add = function (e) { - r(this._last, e) ? (this._last = e, this._array.push(e)) : (this._sorted = !1, this._array.push(e)) - }, o.prototype.toArray = function () { - return this._sorted || (this._array.sort(i.compareByGeneratedPositionsInflated), this._sorted = !0), this._array - }, n.MappingList = o -}, function (e, n) { - var t = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/']; - n.encode = function (e) { - if (0 <= e && e < t.length) return t[e]; - throw new TypeError('Must be between 0 and 63: ' + e) - }, n.decode = function (e) { - var n = 65, - t = 97, - r = 48; - return n <= e && e <= 90 ? e - n : t <= e && e <= 122 ? e - t + 26 : r <= e && e <= 57 ? e - r + 52 : e == 43 ? 62 : e == 47 ? 63 : -1 - } -}, function (e, n, t) { - n.SourceMapGenerator = t(32).SourceMapGenerator, n.SourceMapConsumer = t(76).SourceMapConsumer, n.SourceNode = t(73).SourceNode -}, function (e, n, t) { - function r() { - return !('browser' !== x) || 'node' !== x && 'undefined' != typeof window && 'function' == typeof XMLHttpRequest && !(window.require && window.module && window.process && 'renderer' === window.process.type) - } - - function o() { - return 'object' == typeof process && null !== process && 'function' == typeof process.on - } - - function i(e) { - return function (n) { - for (var t = 0, r; t < e.length; t++) - if (r = e[t](n), r) return r; - return null - } - } - - function a(e, n) { - if (!e) return n; - var t = _.dirname(e), - r = /^\w+:\/\/[^\/]*/.exec(t), - o = r ? r[0] : ''; - return o + _.resolve(t.slice(o.length), n) - } - - function s(e) { - var n; - if (r()) try { - var t = new XMLHttpRequest; - t.open('GET', e, !1), t.send(null), n = 4 === t.readyState ? t.responseText : null; - var o = t.getResponseHeader('SourceMap') || t.getResponseHeader('X-SourceMap'); - if (o) return o - } catch (n) {} - n = O(e); - for (var i = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg, a, s; s = i.exec(n);) a = s; - return a ? a[1] : null - } - - function d(e) { - var n = C[e.source]; - if (!n) { - var t = P(e.source); - t ? (n = C[e.source] = { - url: t.url, - map: new y(t.map) - }, n.map.sourcesContent && n.map.sources.forEach(function (e, t) { - var r = n.map.sourcesContent[t]; - if (r) { - var o = a(n.url, e); - E[o] = r - } - })) : n = C[e.source] = { - url: null, - map: null - } - } - if (n && n.map) { - var r = n.map.originalPositionFor(e); - if (null !== r.source) return r.source = a(n.url, r.source), r - } - return e - } - - function l(e) { - var n = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e); - if (n) { - var t = d({ - source: n[2], - line: +n[3], - column: n[4] - 1 - }); - return 'eval at ' + n[1] + ' (' + t.source + ':' + t.line + ':' + (t.column + 1) + ')' - } - return n = /^eval at ([^(]+) \((.+)\)$/.exec(e), n ? 'eval at ' + n[1] + ' (' + l(n[2]) + ')' : e - } - - function c() { - var e = '', - n; - if (this.isNative()) e = 'native'; - else { - n = this.getScriptNameOrSourceURL(), !n && this.isEval() && (e = this.getEvalOrigin(), e += ', '), e += n ? n : ''; - var t = this.getLineNumber(); - if (null != t) { - e += ':' + t; - var r = this.getColumnNumber(); - r && (e += ':' + r) - } - } - var o = '', - i = this.getFunctionName(), - a = !0, - s = this.isConstructor(), - d = !(this.isToplevel() || s); - if (d) { - var l = this.getTypeName(); - '[object Object]' === l && (l = 'null'); - var c = this.getMethodName(); - i ? (l && 0 != i.indexOf(l) && (o += l + '.'), o += i, c && i.indexOf('.' + c) != i.length - c.length - 1 && (o += ' [as ' + c + ']')) : o += l + '.' + (c || '') - } else s ? o += 'new ' + (i || '') : i ? o += i : (o += e, a = !1); - return a && (o += ' (' + e + ')'), o - } - - function p(e) { - var n = {}; - return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(function (t) { - n[t] = /^(?:is|get)/.test(t) ? function () { - return e[t].call(e) - } : e[t] - }), n.toString = c, n - } - - function u(e) { - if (e.isNative()) return e; - var n = e.getFileName() || e.getScriptNameOrSourceURL(); - if (n) { - var t = e.getLineNumber(), - o = e.getColumnNumber() - 1, - i = 62; - 1 !== t || !(o > i) || r() || e.isEval() || (o -= i); - var a = d({ - source: n, - line: t, - column: o - }); - return e = p(e), e.getFileName = function () { - return a.source - }, e.getLineNumber = function () { - return a.line - }, e.getColumnNumber = function () { - return a.column + 1 - }, e.getScriptNameOrSourceURL = function () { - return a.source - }, e - } - var s = e.isEval() && e.getEvalOrigin(); - return s ? (s = l(s), e = p(e), e.getEvalOrigin = function () { - return s - }, e) : e - } - - function m(e, n) { - return v && (E = {}, C = {}), e + n.map(function (e) { - return '\n at ' + u(e) - }).join('') - } - - function g(e) { - var n = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack); - if (n) { - var t = n[1], - r = +n[2], - o = +n[3], - i = E[t]; - if (!i && b && b.existsSync(t)) try { - i = b.readFileSync(t, 'utf8') - } catch (e) { - i = '' - } - if (i) { - var a = i.split(/(?:\r\n|\r|\n)/)[r - 1]; - if (a) return t + ':' + r + '\n' + a + '\n' + Array(o).join(' ') + '^' - } - } - return null - } - - function f(e) { - var n = g(e); - n && (console.error(), console.error(n)), console.error(e.stack), process.exit(1) - } - - function h() { - var e = process.emit; - process.emit = function (n) { - if ('uncaughtException' === n) { - var t = arguments[1] && arguments[1].stack, - r = 0 < this.listeners(n).length; - if (t && !r) return f(arguments[1]) - } - return e.apply(this, arguments) - } - } - var y = t(79).SourceMapConsumer, - _ = t(0), - b; - try { - b = t(5), b.existsSync && b.readFileSync || (b = null) - } catch (e) {} - var S = !1, - w = !1, - v = !1, - x = 'auto', - E = {}, - C = {}, - k = /^data:application\/json[^,]+base64,/, - M = [], - L = [], - O = i(M); - M.push(function (e) { - if (e = e.trim(), e in E) return E[e]; - var n = null; - if (!b) { - var t = new XMLHttpRequest; - t.open('GET', e, !1), t.send(null); - var n = null; - 4 === t.readyState && 200 === t.status && (n = t.responseText) - } else if (b.existsSync(e)) try { - n = b.readFileSync(e, 'utf8') - } catch (e) { - n = '' - } - return E[e] = n - }); - var P = i(L); - L.push(function (e) { - var n = s(e); - if (!n) return null; - var t; - if (k.test(n)) { - var r = n.slice(n.indexOf(',') + 1); - t = new Buffer(r, 'base64').toString(), n = e - } else n = a(e, n), t = O(n); - return t ? { - url: n, - map: t - } : null - }), n.wrapCallSite = u, n.getErrorSource = g, n.mapSourcePosition = d, n.retrieveSourceMap = P, n.install = function (e) { - if (e = e || {}, e.environment && (x = e.environment, -1 === ['node', 'browser', 'auto'].indexOf(x))) throw new Error('environment ' + x + ' was unknown. Available options are {auto, browser, node}'); - if (e.retrieveFile && (e.overrideRetrieveFile && (M.length = 0), M.unshift(e.retrieveFile)), e.retrieveSourceMap && (e.overrideRetrieveSourceMap && (L.length = 0), L.unshift(e.retrieveSourceMap)), e.hookRequire && !r()) { - var n; - try { - n = t(72) - } catch (e) {} - var i = n.prototype._compile; - i.__sourceMapSupport || (n.prototype._compile = function (e, n) { - return E[n] = e, C[n] = void 0, i.call(this, e, n) - }, n.prototype._compile.__sourceMapSupport = !0) - } - if (v || (v = !!('emptyCacheBetweenOperations' in e) && e.emptyCacheBetweenOperations), S || (S = !0, Error.prepareStackTrace = m), !w) { - var a = !('handleUncaughtExceptions' in e) || e.handleUncaughtExceptions; - a && o() && (w = !0, h()) - } - } -}, function (e, n, t) { - var r = t(0).sep || '/'; - e.exports = function (e) { - if ('string' != typeof e || 7 >= e.length || 'file://' != e.substring(0, 7)) throw new TypeError('must pass in a file:// URI to convert to a file path'); - var n = unescape(e.substring(7)), - t = n.indexOf('/'), - o = n.substring(0, t), - i = n.substring(t + 1); - return 'localhost' == o && (o = ''), o && (o = r + r + o), i = i.replace(/^(.+)\|/, '$1:'), '\\' == r && (i = i.replace(/\//g, '\\')), /^.+\:/.test(i) || (i = r + i), o + i - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(34); - n.formatLogMessage = function (e, n) { - return n ? r.formatError(n, e) : e - } -}, function (e, n, t) { - 'use strict'; - var r = t(5), - o = t(0), - i = t(6), - a = t(9), - s = t(15).Transport, - d = t(8).Stream, - l = t(10), - c = t(15), - p = t(35), - u = t(46), - m = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - g = e.exports = function (e) { - function n(n) { - Array.prototype.slice.call(arguments, 1).forEach(function (t) { - if (e[t]) throw new Error('Cannot set ' + t + ' and ' + n + 'together') - }) - } - if (s.call(this, e), e.filename || e.dirname) n('filename or dirname', 'stream'), this._basename = this.filename = e.filename ? o.basename(e.filename) : 'winston.log', this.dirname = e.dirname || o.dirname(e.filename), this.options = e.options || { - flags: 'a' - }, this.options.highWaterMark = this.options.highWaterMark || 24; - else if (e.stream) { - n('stream', 'filename', 'maxsize'), this._stream = e.stream; - var t = this; - this._stream.on('error', function (e) { - t.emit('error', e) - }), this._stream.setMaxListeners(Infinity) - } else throw new Error('Cannot log to file without filename or stream.'); - this.json = !1 !== e.json, this.colorize = e.colorize || !1, this.maxsize = e.maxsize || null, this.logstash = e.logstash || null, this.maxFiles = e.maxFiles || null, this.label = e.label || null, this.prettyPrint = e.prettyPrint || !1, this.showLevel = void 0 === e.showLevel || e.showLevel, this.timestamp = void 0 === e.timestamp || e.timestamp, this.datePattern = e.datePattern ? e.datePattern : '.yyyy-MM-dd', this.depth = e.depth || null, this.eol = e.eol || l.EOL, this.maxRetries = e.maxRetries || 2, this.prepend = e.prepend || !1, this.createTree = e.createTree || !1, this.localTime = e.localTime || !1, this.zippedArchive = e.zippedArchive || !1, this.maxDays = e.maxDays || 0, this.json && (this.stringify = e.stringify), this._size = 0, this._created = 0, this._buffer = [], this._draining = !1, this._failures = 0, this._archive = !1, this._currentFiles = function () { - if (!this.maxsize) try { - return r.readdirSync(this.dirname).filter(function (e) { - return e.includes(this._basename) - }.bind(this)).map(function (e) { - return { - name: e, - time: r.statSync(o.join(this.dirname, e)).mtime.getTime() - } - }.bind(this)).sort(function (e, n) { - return e.time - n.time - }).map(function (e) { - return e.name - }) - } catch (n) {} - return [] - }.bind(this)(), this._year = this._getTime('year'), this._month = this._getTime('month'), this._date = this._getTime('date'), this._hour = this._getTime('hour'), this._minute = this._getTime('minute'), this._weekday = m[this._getTime('day')]; - var i = /d{1,4}|m{1,4}|yy(?:yy)?|([HhM])\1?/g, - a = function (e, n) { - for (e += '', n = n || 2; e.length < n;) e = '0' + e; - return e - }; - this.getFormattedDate = function () { - this._year = this._getTime('year'), this._month = this._getTime('month'), this._date = this._getTime('date'), this._hour = this._getTime('hour'), this._minute = this._getTime('minute'), this._weekday = m[this._getTime('day')]; - var e = { - yy: (this._year + '').slice(2), - yyyy: this._year, - M: this._month + 1, - MM: a(this._month + 1), - d: this._date, - dd: a(this._date), - H: this._hour, - HH: a(this._hour), - m: this._minute, - mm: a(this._minute), - ddd: this._weekday - }; - return this.datePattern.replace(i, function (n) { - return n in e ? e[n] : n.slice(1, n.length - 1) - }) - } - }; - i.inherits(g, s), c.transports.DailyRotateFile = g, g.prototype.name = 'dailyRotateFile', g.prototype.log = function (e, n, t, r) { - if (this.silent) return r(null, !0); - if (this._failures >= this.maxRetries) return r(new Error('Transport is in a failed state.')); - var o = this, - i = a.log({ - level: e, - message: n, - meta: t, - json: this.json, - colorize: this.colorize, - logstash: this.logstash, - prettyPrint: this.prettyPrint, - timestamp: this.timestamp, - label: this.label, - stringify: this.stringify, - showLevel: this.showLevel, - depth: this.depth, - formatter: this.formatter, - humanReadableUnhandledException: this.humanReadableUnhandledException - }) + this.eol; - this._size += i.length, this.filename ? this.open(function (e) { - return e ? o._buffer.push([i, r]) : void(o._write(i, r), o._lazyDrain()) - }) : (this._write(i, r), this._lazyDrain()) - }, g.prototype._write = function (e, n) { - var t = this._stream.write(e); - return n ? !1 === t ? this._stream.once('drain', function () { - n(null, !0) - }) : void n(null, !0) : void 0 - }, g.prototype.query = function (e, n) { - 'function' == typeof e && (n = e, e = {}); - var t = this, - i = t._currentFiles.slice(0), - a = [], - s = 0; - e = t.normalizeQuery(e), 0 === i.length && n && n(null, a), - function d(l) { - function c(e, n) { - try { - var t = JSON.parse(e); - u(t) && p(t) - } catch (t) { - n || f.emit('error', t) - } - } - - function p(n) { - if (e.rows && a.length >= e.rows && 'desc' !== e.order) return void(f.readable && f.destroy()); - if (e.fields) { - var t = {}; - e.fields.forEach(function (e) { - t[e] = n[e] - }), n = t - } - 'desc' === e.order && a.length >= e.rows && a.shift(), a.push(n) - } - - function u(n) { - if (n && 'object' == typeof n) { - var t = new Date(n.timestamp); - return !(e.from && t < e.from || e.until && t > e.until) || void 0 - } - } - if (l) { - var m = o.join(t.dirname, l), - g = '', - f = r.createReadStream(m, { - encoding: 'utf8' - }); - f.on('error', function (e) { - return f.readable && f.destroy(), n ? 'ENOENT' === e.code ? n(null, a) : n(e) : void 0 - }), f.on('data', function (n) { - n = (g + n).split(/\n+/); - for (var t = n.length - 1, r = 0; r < t; r++)(!e.start || s >= e.start) && c(n[r]), s++; - g = n[t] - }), f.on('close', function () { - g && c(g, !0), 'desc' === e.order && (a = a.reverse()), i.length ? d(i.shift()) : n && n(null, a) - }) - } - }(i.shift()) - }, g.prototype.stream = function (e) { - var n = o.join(this.dirname, this._getFilename()); - e = e || {}; - var t = new d, - r = { - file: n, - start: e.start - }; - return t.destroy = a.tailFile(r, function (e, n) { - if (e) return t.emit('error', e); - try { - t.emit('data', n), n = JSON.parse(n), t.emit('log', n) - } catch (n) { - t.emit('error', n) - } - }), t.resume && t.resume(), t - }, g.prototype.open = function (e) { - if (this.opening) return e(!0); - return !this._stream || this.maxsize && this._size >= this.maxsize || this._filenameHasExpired() ? (this._cleanOldFiles(), e(!0), this._createStream()) : void e() - }, g.prototype.close = function () { - var e = this; - this._stream && (this._stream.end(), this._stream.destroySoon(), this._stream.once('drain', function () { - e.emit('flush'), e.emit('closed') - })) - }, g.prototype.flush = function () { - var e = this; - this._buffer.forEach(function (n) { - var t = n[0], - r = n[1]; - process.nextTick(function () { - e._write(t, r), e._size += t.length - }) - }), e._buffer.length = 0, e._stream.once('drain', function () { - e.emit('flush'), e.emit('logged') - }) - }, g.prototype._createStream = function () { - var e = this; - this.opening = !0, - function n(t) { - function i(n) { - e._stream && (e._archive = !!e.zippedArchive && e._stream.path, e._stream.end(), e._stream.destroySoon()), e.createTree && p.sync(o.dirname(s)), e._size = n, e.filename = t, e._stream = r.createWriteStream(s, e.options), e._stream.on('error', function (n) { - e._failures < e.maxRetries ? (e._createStream(), e._failures++) : e.emit('error', n) - }), e._stream.setMaxListeners(Infinity), e.once('flush', function () { - e.flush(), e.opening = !1, e.emit('open', s) - }), e.flush(), a() + debug(e, t) { + l("debug", "[main] " + S(e, t)) } - - function a() { - var n = e._archive; - if (e._archive = !1, n && r.existsSync(n + '')) { - var t = u.createGzip(), - o = r.createReadStream(n + ''), - i = r.createWriteStream(n + '.gz'); - o.pipe(t).pipe(i), r.unlinkSync(n + '') - } - } - var s = o.join(e.dirname, t); - r.stat(s, function (t, r) { - return t ? 'ENOENT' === t.code ? i(0) : e.emit('error', t) : !r || e.maxsize && r.size >= e.maxsize ? n(e._getFile(!0)) : e._filenameHasExpired() ? (e._year = e._getTime('year'), e._month = e._getTime('month'), e._date = e._getTime('date'), e._hour = e._getTime('hour'), e._minute = e._getTime('minute'), e._weekday = m[e._getTime('day')], e._created = 0, n(e._getFile())) : void i(r.size) + }; + var x = n(0), + C = n(18), + O = n(24), + k = n(52), + L = n.n(k); + + function T(e) { + e.on("enter-full-screen", () => R(e, "full-screen")), e.on("leave-full-screen", () => R(e, "normal")), e.on("maximize", () => R(e, "maximized")), e.on("minimize", () => R(e, "minimized")), e.on("unmaximize", () => R(e, "normal")), e.on("restore", () => R(e, "normal")), e.on("hide", () => R(e, "hidden")), e.on("show", () => { + R(e, function (e) { + return e.isFullScreen() ? "full-screen" : e.isMaximized() ? "maximized" : e.isMinimized() ? "minimized" : e.isVisible() ? "normal" : "hidden" + }(e)) }) - }(this._getFile()) - }, g.prototype._getFile = function (e) { - var n = this._getFilename(), - t; - if (e) { - if (this.maxFiles && this._created >= this.maxFiles - 1) - if (t = this._created - (this.maxFiles - 1), 0 === t) try { - r.unlinkSync(o.join(this.dirname, n)) - } catch (n) {} else try { - r.unlinkSync(o.join(this.dirname, n + '.' + t)) - } catch (n) {} - this._created += 1 - } else if (!this.maxsize) - for (-1 === this._currentFiles.indexOf(n) && this._currentFiles.push(n); this.maxFiles && this._currentFiles.length > this.maxFiles;) { - try { - r.unlinkSync(o.join(this.dirname, this._currentFiles[0])) - } catch (n) {} - this._currentFiles = this._currentFiles.slice(1) - } - return this._created ? n + '.' + this._created : n - }, g.prototype._getFilename = function () { - var e = this.getFormattedDate(); - return this.prepend ? ('.yyyy-MM-dd' === this.datePattern && (this.datePattern = 'yyyy-MM-dd.', e = this.getFormattedDate()), e + this._basename) : this._basename + e - }, g.prototype._lazyDrain = function () { - var e = this; - !this._draining && this._stream && (this._draining = !0, this._stream.once('drain', function () { - this._draining = !1, e.emit('logged') - })) - }, g.prototype._filenameHasExpired = function () { - if (this.datePattern.match(/m/)) return this._year < this._getTime('year') || this._month < this._getTime('month') || this._date < this._getTime('date') || this._hour < this._getTime('hour') || this._minute < this._getTime('minute'); - return this.datePattern.match(/H/) ? this._year < this._getTime('year') || this._month < this._getTime('month') || this._date < this._getTime('date') || this._hour < this._getTime('hour') : this.datePattern.match(/d/) ? this._year < this._getTime('year') || this._month < this._getTime('month') || this._date < this._getTime('date') : this.datePattern.match(/M/) ? this._year < this._getTime('year') || this._month < this._getTime('month') : !!this.datePattern.match(/yy/) && this._year < this._getTime('year') - }, g.prototype._getTime = function (e) { - var n = new Date; - if (this.localTime) { - if ('year' === e) return n.getFullYear(); - if ('month' === e) return n.getMonth(); - if ('date' === e) return n.getDate(); - if ('hour' === e) return n.getHours(); - if ('minute' === e) return n.getMinutes(); - if ('day' === e) return n.getDay() - } - return 'year' === e ? n.getUTCFullYear() : 'month' === e ? n.getUTCMonth() : 'date' === e ? n.getUTCDate() : 'hour' === e ? n.getUTCHours() : 'minute' === e ? n.getUTCMinutes() : 'day' === e ? n.getUTCDay() : void 0 - }, g.prototype._cleanOldFiles = function () { - function e(e) { - r.unlink(t.dirname + o.sep + e, function (n) { - n && console.error('Error removing file ', e) - }) - } - - function n(n) { - var s = t.dirname + o.sep + n; - r.stat(s, function (r, o) { - if (r) return void console.error('Error stats file ', n, r); - var s = o.mtime && o.mtime.getTime() || 0; - o.isFile() && a - s > i * t.maxDays && e(n) - }) - } - var t = this, - i = 864e5, - a = Date.now(); - t.maxDays && r.readdir(t.dirname, function (e, r) { - if (e) return void console.error('Error reading directory ', t.dirname, e); - var o = new RegExp(t._basename, 'g'); - r.forEach(function (e) { - /.log/.test(e) && o.test(e) && n(e) - }) - }) - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(1), - i = t(0), - a = t(3), - s = t(7).pathExists; - e.exports = { - outputFile: r(function (e, n, t, r) { - 'function' == typeof t && (r = t, t = 'utf8'); - const d = i.dirname(e); - s(d, (i, s) => i ? r(i) : s ? o.writeFile(e, n, t, r) : void a.mkdirs(d, (i) => i ? r(i) : void o.writeFile(e, n, t, r))) - }), - outputFileSync: function (e, ...n) { - const t = i.dirname(e); - return o.existsSync(t) ? o.writeFileSync(e, ...n) : void(a.mkdirsSync(t), o.writeFileSync(e, ...n)) - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t, r) { - return t ? p(n, (i) => i ? r(i) : o(e, n, t, r)) : void m(n, (i, a) => i ? r(i) : a ? r(new Error('dest already exists.')) : o(e, n, t, r)) - } - - function o(e, n, t, r) { - d.rename(e, n, (o) => o ? 'EXDEV' === o.code ? i(e, n, t, r) : r(o) : r()) - } - - function i(e, n, t, r) { - c(e, n, { - overwrite: t, - errorOnExist: !0 - }, (n) => n ? r(n) : p(e, r)) - } - - function a(e, n) { - const t = e.split(l.sep), - r = n.split(l.sep); - return t.reduce((e, n, t) => e && r[t] === n, !0) - } - const s = t(2).fromCallback, - d = t(1), - l = t(0), - c = t(37).copy, - p = t(16).remove, - u = t(3).mkdirp, - m = t(7).pathExists; - e.exports = { - move: s(function (e, n, t, o) { - 'function' == typeof t && (o = t, t = {}); - const i = t.overwrite || t.clobber || !1; - return e = l.resolve(e), n = l.resolve(n), e === n ? d.access(e, o) : void d.stat(e, (t, s) => t ? o(t) : s.isDirectory() && a(e, n) ? o(new Error(`Cannot move '${e}' to a subdirectory of itself, '${n}'.`)) : void u(l.dirname(n), (t) => t ? o(t) : r(e, n, i, o))) - }) - } -}, function (e, n, t) { - 'use strict'; + } - function r(e, n, t) { - function i() { - if (a) try { - return d.renameSync(e, n) - } catch (i) { - if ('ENOTEMPTY' === i.code || 'EEXIST' === i.code || 'EPERM' === i.code) return p(n), t.overwrite = !1, r(e, n, t); - if ('EXDEV' !== i.code) throw i; - return o(e, n, a) - } else try { - return d.linkSync(e, n), d.unlinkSync(e) - } catch (t) { - if ('EXDEV' === t.code || 'EISDIR' === t.code || 'EPERM' === t.code || 'ENOTSUP' === t.code) return o(e, n, a); - throw t - } - } - t = t || {}; - const a = t.overwrite || t.clobber || !1; - if (e = l.resolve(e), n = l.resolve(n), e === n) return d.accessSync(e); - if (s(e, n)) throw new Error(`Cannot move '${e}' into itself '${n}'.`); - u(l.dirname(n)), i() - } - - function o(e, n, t) { - const r = d.statSync(e); - return r.isDirectory() ? a(e, n, t) : i(e, n, t) - } - - function i(e, n, t) { - const r = 65536, - o = m(r), - i = t ? 'w' : 'wx', - a = d.openSync(e, 'r'), - s = d.fstatSync(a), - l = d.openSync(n, i, s.mode); - for (let i = 0; i < s.size;) { - const e = d.readSync(a, o, 0, r, i); - d.writeSync(l, o, 0, e), i += e - } - return d.closeSync(a), d.closeSync(l), d.unlinkSync(e) - } - - function a(e, n, t) { - function r() { - return c(e, n, o), p(e) - } - const o = { - overwrite: !1 - }; - t ? (p(n), r()) : r() - } + function R(e, t) { + e.webContents.send("window-state-changed", t) + } + + function M(e) { + throw new Error(e) + } + + function A(e) { + const t = e.id; + if (!t) throw new Error("menuItem must specify id: " + e.label); + const n = e.enabled, + r = e.visible, + i = e.label, + o = e.checked, + s = function (e) { + if (e.accelerator) return e.accelerator; + if (e.role) { + const t = e.getDefaultRoleAccelerator; + if ("function" == typeof t) try { + const n = t.call(e); + if ("string" == typeof n) return n + } catch (e) { + console.error("Could not retrieve default accelerator", e) + } + } + return null + }(e), + a = function (e) { + const t = e.match(/&([^&])/); + return t ? t[1] : null + }(e.label), + c = function (e) { + switch (e) { + case "normal": + case "separator": + case "submenu": + case "checkbox": + case "radio": + return e; + default: + throw new Error(`Unable to parse string ${e} to a valid menu item type`) + } + }(e.type); + switch (c) { + case "normal": + return { + id: t, type: "menuItem", label: i, enabled: n, visible: r, accelerator: s, accessKey: a + }; + case "separator": + return { + id: t, type: "separator", visible: r + }; + case "submenu": + return { + id: t, type: "submenuItem", label: i, enabled: n, visible: r, menu: N(e.submenu, t), accessKey: a + }; + case "checkbox": + return { + id: t, type: "checkbox", label: i, enabled: n, visible: r, accelerator: s, checked: o, accessKey: a + }; + case "radio": + return { + id: t, type: "radio", label: i, enabled: n, visible: r, accelerator: s, checked: o, accessKey: a + }; + default: + return function (e, t) { + throw new Error(t) + }(0, "Unknown menu item type " + c) + } + } - function s(e, n) { - try { - return d.statSync(e).isDirectory() && e !== n && -1 < n.indexOf(e) && n.split(l.dirname(e) + l.sep)[1].split(l.sep)[0] === l.basename(e) - } catch (n) { - return !1 - } - } - const d = t(1), - l = t(0), - c = t(41).copySync, - p = t(16).removeSync, - u = t(3).mkdirsSync, - m = t(38); - e.exports = { - moveSync: r - } -}, function (e, n, t) { - 'use strict'; - const r = t(1), - o = t(0), - i = t(3), - a = t(19); - e.exports = function (e, n, t) { - const s = o.dirname(e); - r.existsSync(s) || i.mkdirsSync(s), a.writeJsonSync(e, n, t) - } -}, function (e, n, t) { - 'use strict'; - const r = t(0), - o = t(3), - i = t(7).pathExists, - a = t(19); - e.exports = function (e, n, t, s) { - 'function' == typeof t && (s = t, t = {}); - const d = r.dirname(e); - i(d, (r, i) => r ? s(r) : i ? a.writeJson(e, n, t, s) : void o.mkdirs(d, (r) => r ? s(r) : void a.writeJson(e, n, t, s))) - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(19); - o.outputJson = r(t(88)), o.outputJsonSync = t(87), o.outputJSON = o.outputJson, o.outputJSONSync = o.outputJsonSync, o.writeJSON = o.writeJson, o.writeJSONSync = o.writeJsonSync, o.readJSON = o.readJson, o.readJSONSync = o.readJsonSync, e.exports = o -}, function (e, n, t) { - 'use strict'; - const r = t(1); - e.exports = { - symlinkType: function (e, n, t) { - return t = 'function' == typeof n ? n : t, n = 'function' != typeof n && n, n ? t(null, n) : void r.lstat(e, (e, r) => e ? t(null, 'file') : void(n = r && r.isDirectory() ? 'dir' : 'file', t(null, n))) - }, - symlinkTypeSync: function (e, n) { - let t; - if (n) return n; - try { - t = r.lstatSync(e) - } catch (n) { - return 'file' - } - return t && t.isDirectory() ? 'dir' : 'file' - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(0), - o = t(1), - i = t(7).pathExists; - e.exports = { - symlinkPaths: function (e, n, t) { - if (r.isAbsolute(e)) return o.lstat(e, (n) => n ? (n.message = n.message.replace('lstat', 'ensureSymlink'), t(n)) : t(null, { - toCwd: e, - toDst: e - })); - else { - const a = r.dirname(n), - s = r.join(a, e); - return i(s, (n, i) => n ? t(n) : i ? t(null, { - toCwd: s, - toDst: e - }) : o.lstat(e, (n) => n ? (n.message = n.message.replace('lstat', 'ensureSymlink'), t(n)) : t(null, { - toCwd: e, - toDst: r.relative(a, e) - }))) - } - }, - symlinkPathsSync: function (e, n) { - let t; - if (r.isAbsolute(e)) { - if (t = o.existsSync(e), !t) throw new Error('absolute srcpath does not exist'); - return { - toCwd: e, - toDst: e - } - } else { - const i = r.dirname(n), - a = r.join(i, e); - if (t = o.existsSync(a), t) return { - toCwd: a, - toDst: e - }; - if (t = o.existsSync(e), !t) throw new Error('relative srcpath does not exist'); + function N(e, t) { return { - toCwd: e, - toDst: r.relative(i, e) - } - } - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(0), - i = t(1), - a = t(3), - s = a.mkdirs, - d = a.mkdirsSync, - l = t(91), - c = l.symlinkPaths, - p = l.symlinkPathsSync, - u = t(90), - m = u.symlinkType, - g = u.symlinkTypeSync, - f = t(7).pathExists; - e.exports = { - createSymlink: r(function (e, n, t, r) { - r = 'function' == typeof t ? t : r, t = 'function' != typeof t && t, f(n, (a, d) => a ? r(a) : d ? r(null) : void c(e, n, (a, d) => a ? r(a) : void(e = d.toDst, m(d.toCwd, t, (t, a) => { - if (t) return r(t); - const d = o.dirname(n); - f(d, (t, o) => t ? r(t) : o ? i.symlink(e, n, a, r) : void s(d, (t) => t ? r(t) : void i.symlink(e, n, a, r))) - })))) - }), - createSymlinkSync: function (e, n, t) { - const r = i.existsSync(n); - if (!r) { - const r = p(e, n); - e = r.toDst, t = g(r.toCwd, t); - const a = o.dirname(n), - s = i.existsSync(a); - return s ? i.symlinkSync(e, n, t) : (d(a), i.symlinkSync(e, n, t)) - } - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(0), - i = t(1), - a = t(3), - s = t(7).pathExists; - e.exports = { - createLink: r(function (e, n, t) { - function r(e, n) { - i.link(e, n, (e) => e ? t(e) : void t(null)) - } - s(n, (d, l) => d ? t(d) : l ? t(null) : void i.lstat(e, (i) => { - if (i) return i.message = i.message.replace('lstat', 'ensureLink'), t(i); - const d = o.dirname(n); - s(d, (o, i) => o ? t(o) : i ? r(e, n) : void a.mkdirs(d, (o) => o ? t(o) : void r(e, n))) - })) - }), - createLinkSync: function (e, n) { - const t = i.existsSync(n); - if (!t) { - try { - i.lstatSync(e) - } catch (e) { - throw e.message = e.message.replace('lstat', 'ensureLink'), e - } - const t = o.dirname(n), - r = i.existsSync(t); - return r ? i.linkSync(e, n) : (a.mkdirsSync(t), i.linkSync(e, n)) - } - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(0), - i = t(1), - a = t(3), - s = t(7).pathExists; - e.exports = { - createFile: r(function (e, n) { - function t() { - i.writeFile(e, '', (e) => e ? n(e) : void n()) - } - i.stat(e, (r, i) => { - if (!r && i.isFile()) return n(); - const d = o.dirname(e); - s(d, (e, r) => e ? n(e) : r ? t() : void a.mkdirs(d, (e) => e ? n(e) : void t())) - }) - }), - createFileSync: function (e) { - let n; - try { - n = i.statSync(e) - } catch (n) {} - if (!(n && n.isFile())) { - const n = o.dirname(e); - i.existsSync(n) || a.mkdirsSync(n), i.writeFileSync(e, '') - } - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(94), - o = t(93), - i = t(92); - e.exports = { - createFile: r.createFile, - createFileSync: r.createFileSync, - ensureFile: r.createFile, - ensureFileSync: r.createFileSync, - createLink: o.createLink, - createLinkSync: o.createLinkSync, - ensureLink: o.createLink, - ensureLinkSync: o.createLinkSync, - createSymlink: i.createSymlink, - createSymlinkSync: i.createSymlinkSync, - ensureSymlink: i.createSymlink, - ensureSymlinkSync: i.createSymlinkSync - } -}, function (e, n, t) { - 'use strict'; - - function r(e) { - ['unlink', 'chmod', 'stat', 'lstat', 'rmdir', 'readdir'].forEach((n) => { - e[n] = e[n] || p[n], n += 'Sync', e[n] = e[n] || p[n] - }), e.maxBusyTries = e.maxBusyTries || 3 - } - - function o(e, n, t) { - let o = 0; - 'function' == typeof n && (t = n, n = {}), f(e, 'rimraf: missing path'), f.strictEqual(typeof e, 'string', 'rimraf: path should be a string'), f.strictEqual(typeof t, 'function', 'rimraf: callback function required'), f(n, 'rimraf: invalid options argument provided'), f.strictEqual(typeof n, 'object', 'rimraf: options should be object'), r(n), i(e, n, function r(a) { - if (a) { - if (('EBUSY' === a.code || 'ENOTEMPTY' === a.code || 'EPERM' === a.code) && o < n.maxBusyTries) { - o++; - const t = 100 * o; - return setTimeout(() => i(e, n, r), t) - } - 'ENOENT' === a.code && (a = null) - } - t(a) - }) - } - - function i(e, n, t) { - f(e), f(n), f('function' == typeof t), n.lstat(e, (r, o) => r && 'ENOENT' === r.code ? t(null) : r && 'EPERM' === r.code && h ? a(e, n, r, t) : o && o.isDirectory() ? d(e, n, r, t) : void n.unlink(e, (r) => { - if (r) { - if ('ENOENT' === r.code) return t(null); - if ('EPERM' === r.code) return a(e, n, r, t); - if ('EISDIR' === r.code) return d(e, n, r, t) - } - return t(r) - })) - } - - function a(e, n, t, r) { - f(e), f(n), f('function' == typeof r), t && f(t instanceof Error), n.chmod(e, 438, (o) => { - o ? r('ENOENT' === o.code ? null : t) : n.stat(e, (o, i) => { - o ? r('ENOENT' === o.code ? null : t) : i.isDirectory() ? d(e, n, t, r) : n.unlink(e, r) - }) - }) - } - - function s(e, n, t) { - let r; - f(e), f(n), t && f(t instanceof Error); - try { - n.chmodSync(e, 438) - } catch (e) { - if ('ENOENT' === e.code) return; - throw t - } - try { - r = n.statSync(e) - } catch (e) { - if ('ENOENT' === e.code) return; - throw t + id: t, + type: "menu", + items: e.items.map(A) + } } - r.isDirectory() ? u(e, n, t) : n.unlinkSync(e) - } - function d(e, n, t, r) { - f(e), f(n), t && f(t instanceof Error), f('function' == typeof r), n.rmdir(e, (o) => { - o && ('ENOTEMPTY' === o.code || 'EEXIST' === o.code || 'EPERM' === o.code) ? l(e, n, r) : o && 'ENOTDIR' === o.code ? r(t) : r(o) - }) - } - - function l(e, t, r) { - f(e), f(t), f('function' == typeof r), t.readdir(e, (i, a) => { - if (i) return r(i); - let s = a.length, - n; - return 0 === s ? t.rmdir(e, r) : void a.forEach((i) => { - o(g.join(e, i), t, (o) => n ? void 0 : o ? r(n = o) : void(0 == --s && t.rmdir(e, r))) - }) - }) - } - - function c(e, n) { - let t; - n = n || {}, r(n), f(e, 'rimraf: missing path'), f.strictEqual(typeof e, 'string', 'rimraf: path should be a string'), f(n, 'rimraf: missing options'), f.strictEqual(typeof n, 'object', 'rimraf: options should be object'); - try { - t = n.lstatSync(e) - } catch (t) { - if ('ENOENT' === t.code) return; - 'EPERM' === t.code && h && s(e, n, t) - } - try { - t && t.isDirectory() ? u(e, n, null) : n.unlinkSync(e) - } catch (t) { - if ('ENOENT' === t.code) return; - if ('EPERM' === t.code) return s(e, n, t); - if ('EISDIR' !== t.code) throw t; - u(e, n, t) + function j() { + const e = process.hrtime(); + return 1e3 * e[0] + e[1] / 1e6 + } + var F = n(53), + P = n.n(F); + class D { + constructor() { + this.emitter = new O.Emitter, this._loadTime = null, this._rendererReadyTime = null, this.minWidth = 960, this.minHeight = 660; + const e = P()({ + defaultWidth: this.minWidth, + defaultHeight: this.minHeight + }), + t = { + x: e.x, + y: e.y, + width: e.width, + height: e.height, + minWidth: this.minWidth, + minHeight: this.minHeight, + show: !1, + backgroundColor: "#fff", + webPreferences: { + disableBlinkFeatures: "Auxclick", + nodeIntegration: !0, + enableRemoteModule: !0, + spellcheck: !1 + }, + acceptFirstMouse: !0, + frame: !1 + }; + this.window = new x.BrowserWindow(t), e.manage(this.window); + let n = !1; + x.app.on("before-quit", () => { + n = !0 + }), x.ipcMain.on("will-quit", e => { + n = !0, e.returnValue = !0 + }), this.window.once("ready-to-show", () => { + this.window.on("unmaximize", () => { + setTimeout(() => { + const e = this.window.getBounds(); + e.width += 1, this.window.setBounds(e), e.width -= 1, this.window.setBounds(e) + }, 5) + }) + }) + } + load() { + let e = 0; + this.window.webContents.once("did-start-loading", () => { + this._rendererReadyTime = null, this._loadTime = null, e = j() + }), this.window.webContents.once("did-finish-load", () => { + this._loadTime = j() - e, this.maybeEmitDidLoad() + }), this.window.webContents.on("did-finish-load", () => { + this.window.webContents.setVisualZoomLevelLimits(1, 1) + }), this.window.webContents.on("did-fail-load", () => { + this.window.webContents.openDevTools(), this.window.show() + }), x.ipcMain.once("renderer-ready", (e, t) => { + this._rendererReadyTime = t, this.maybeEmitDidLoad() + }), this.window.on("focus", () => this.window.webContents.send("focus")), this.window.on("blur", () => this.window.webContents.send("blur")), T(this.window), this.window.loadURL(function (...e) { + const t = r.resolve(...e); + return L()(t) + }(__dirname, "index.html")) + } + maybeEmitDidLoad() { + this.rendererLoaded && this.emitter.emit("did-load", null) + } + get rendererLoaded() { + return !!this.loadTime && !!this.rendererReadyTime + } + onClose(e) { + this.window.on("closed", e) + } + onDidLoad(e) { + return this.emitter.on("did-load", e) + } + isMinimized() { + return this.window.isMinimized() + } + isVisible() { + return this.window.isVisible() + } + restore() { + this.window.restore() + } + focus() { + this.window.focus() + } + show() { + this.window.show() + } + sendMenuEvent(e) { + this.show(), this.window.webContents.send("menu-event", { + name: e + }) + } + sendURLAction(e) { + this.show(), this.window.webContents.send("url-action", { + action: e + }) + } + sendLaunchTimingStats(e) { + this.window.webContents.send("launch-timing-stats", { + stats: e + }) + } + sendAppMenu() { + const e = x.Menu.getApplicationMenu(); + if (e) { + const t = N(e); + this.window.webContents.send("app-menu", { + menu: t + }) + } + } + sendCertificateError(e, t, n) { + this.window.webContents.send("certificate-error", { + certificate: e, + error: t, + url: n + }) + } + showCertificateTrustDialog(e, t) { + x.dialog.showCertificateTrustDialog(this.window, { + certificate: e, + message: t + }, () => {}) + } + sendException(e) { + const t = { + stack: e.stack, + message: e.message, + name: e.name + }; + this.window.webContents.send("main-process-exception", t) + } + get loadTime() { + return this._loadTime + } + get rendererReadyTime() { + return this._rendererReadyTime + } + destroy() { + this.window.destroy() + } } - } + var I = n(13), + z = n(25), + U = n(9); + new Set(["LOCAL_GIT_DIRECTORY"]); + const H = /[\x00-\x20\x7F~^:?*\[\\|""<>]+|@{|\.\.+|^\.|\.$|\.lock$|\/$/g; - function u(e, n, t) { - f(e), f(n), t && f(t instanceof Error); - try { - n.rmdirSync(e) - } catch (r) { - if ('ENOTDIR' === r.code) throw t; - else if ('ENOTEMPTY' === r.code || 'EEXIST' === r.code || 'EPERM' === r.code) m(e, n); - else if ('ENOENT' !== r.code) throw r - } - } - - function m(e, n) { - f(e), f(n), n.readdirSync(e).forEach((t) => c(g.join(e, t), n)); { - const t = Date.now(); - do try { - const t = n.rmdirSync(e, n); - return t - } catch (e) {} - while (500 > Date.now() - t) - } - } - const p = t(1), - g = t(0), - f = t(42), - h = !0; - e.exports = o, o.sync = c -}, function (e, n, t) { - 'use strict'; - - function r(e) { - let n; - try { - n = i.readdirSync(e) - } catch (n) { - return s.mkdirsSync(e) + function B(e, t) { + const n = e[t]; + return null == n ? null : Array.isArray(n) ? n[0] : n } - n.forEach((n) => { - n = a.join(e, n), d.removeSync(n) - }) - } - const o = t(2).fromCallback, - i = t(5), - a = t(0), - s = t(3), - d = t(16), - l = o(function (e, n) { - n = n || function () {}, i.readdir(e, (t, r) => { - function o() { - const e = r.pop(); - return e ? void d.remove(e, (e) => e ? n(e) : void o()) : n() + + function G(e) { + const t = C.parse(e, !0), + n = t.hostname, + r = { + name: "unknown", + url: e + }; + if (!n) return r; + const i = t.query, + o = n.toLowerCase(); + if ("oauth" === o) { + const e = B(i, "code"), + t = B(i, "state"); + return null != e && null != t ? { + name: "oauth", + code: e, + state: t + } : r } - return t ? s.mkdirs(e, n) : void(r = r.map((n) => a.join(e, n)), o()) - }) - }); - e.exports = { - emptyDirSync: r, - emptydirSync: r, - emptyDir: l, - emptydir: l - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t, r) { - 'function' != typeof t || r ? 'function' == typeof t && (t = { - filter: t - }) : (r = t, t = {}), r = r || function () {}, t = t || {}, t.clobber = !('clobber' in t) || !!t.clobber, t.overwrite = 'overwrite' in t ? !!t.overwrite : t.clobber, t.preserveTimestamps && 'ia32' === process.arch && console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`), v(e, n, (a, s) => a ? r(a) : t.filter ? i(o, s, e, n, t, r) : o(s, e, n, t, r)) - } - - function o(e, n, t, r, o) { - const i = E.dirname(t); - k(i, (s, d) => s ? o(s) : d ? a(e, n, t, r, o) : void C(i, (i) => i ? o(i) : a(e, n, t, r, o))) - } - - function i(e, n, t, r, o, i) { - Promise.resolve(o.filter(t, r)).then((a) => a ? n ? e(n, t, r, o, i) : e(t, r, o, i) : i(), (e) => i(e)) - } - - function a(e, n, t, r, o) { - return r.filter ? i(s, e, n, t, r, o) : s(e, n, t, r, o) - } - - function s(e, n, t, r, o) { - const i = r.dereference ? x.stat : x.lstat; - i(n, (i, a) => { - if (i) return o(i); - return a.isDirectory() ? m(a, e, n, t, r, o) : a.isFile() || a.isCharacterDevice() || a.isBlockDevice() ? d(a, e, n, t, r, o) : a.isSymbolicLink() ? _(e, n, t, r, o) : void 0 - }) - } - - function d(e, n, t, r, o, i) { - return n === L ? c(e, t, r, o, i) : l(e, t, r, o, i) - } - - function l(e, n, t, r, o) { - return r.overwrite ? void x.unlink(t, (i) => i ? o(i) : c(e, n, t, r, o)) : r.errorOnExist ? o(new Error(`'${t}' already exists`)) : o() - } - - function c(e, n, t, r, o) { - return 'function' == typeof x.copyFile ? x.copyFile(n, t, (n) => n ? o(n) : u(e, t, r, o)) : p(e, n, t, r, o) - } - - function p(e, n, t, r, o) { - const i = x.createReadStream(n); - i.on('error', (e) => o(e)).once('open', () => { - const n = x.createWriteStream(t, { - mode: e.mode - }); - n.on('error', (e) => o(e)).on('open', () => i.pipe(n)).once('close', () => u(e, t, r, o)) - }) - } - - function u(e, n, t, r) { - x.chmod(n, e.mode, (o) => o ? r(o) : t.preserveTimestamps ? M(n, e.atime, e.mtime, r) : r()) - } - - function m(e, n, t, r, o, i) { - return n === L ? g(e, t, r, o, i) : n && !n.isDirectory() ? i(new Error(`Cannot overwrite non-directory '${r}' with directory '${t}'.`)) : f(t, r, o, i) - } - - function g(e, n, t, r, o) { - x.mkdir(t, (i) => i ? o(i) : void f(n, t, r, (n) => n ? o(n) : x.chmod(t, e.mode, o))) - } - - function f(e, n, t, r) { - x.readdir(e, (o, i) => o ? r(o) : h(i, e, n, t, r)) - } - - function h(e, n, t, r, o) { - const i = e.pop(); - return i ? y(e, i, n, t, r, o) : o() - } - - function y(e, n, t, r, o, i) { - const s = E.join(t, n), - d = E.join(r, n); - v(s, d, (n, l) => n ? i(n) : void a(l, s, d, o, (n) => n ? i(n) : h(e, t, r, o, i))) - } - - function _(e, n, t, r, o) { - x.readlink(n, (n, i) => n ? o(n) : (r.dereference && (i = E.resolve(process.cwd(), i)), e === L ? x.symlink(i, t, o) : void x.readlink(t, (n, a) => n ? 'EINVAL' === n.code || 'UNKNOWN' === n.code ? x.symlink(i, t, o) : o(n) : (r.dereference && (a = E.resolve(process.cwd(), a)), S(i, a) ? o(new Error(`Cannot copy '${i}' to a subdirectory of itself, '${a}'.`)) : e.isDirectory() && S(a, i) ? o(new Error(`Cannot overwrite '${a}' with '${i}'.`)) : b(i, t, o))))) - } - - function b(e, n, t) { - x.unlink(n, (r) => r ? t(r) : x.symlink(e, n, t)) - } - - function S(e, n) { - const t = E.resolve(e).split(E.sep), - r = E.resolve(n).split(E.sep); - return t.reduce((e, n, t) => e && r[t] === n, !0) - } - - function w(e, n, t) { - x.stat(e, (e, r) => e ? t(e) : void x.stat(n, (e, n) => e ? 'ENOENT' === e.code ? t(null, { - srcStat: r, - destStat: L - }) : t(e) : t(null, { - srcStat: r, - destStat: n - }))) - } - - function v(e, n, t) { - w(e, n, (r, o) => { - if (r) return t(r); - const { - srcStat: i, - destStat: a - } = o; - return a.ino && a.ino === i.ino ? t(new Error('Source and destination must not be the same.')) : i.isDirectory() && S(e, n) ? t(new Error(`Cannot copy '${e}' to a subdirectory of itself, '${n}'.`)) : t(null, a) - }) - } - const x = t(1), - E = t(0), - C = t(3).mkdirs, - k = t(7).pathExists, - M = t(39).utimesMillis, - L = Symbol('notExist'); - e.exports = r -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t) { - n && 'object' == typeof n || (n = { - mode: n - }); - let d = n.mode; - const l = n.fs || o; - if (a(e)) { - const n = new Error(e + ' contains invalid WIN32 path characters.'); - throw n.code = 'EINVAL', n + const s = t.pathname; + if (!s || s.length <= 1) return r; + const a = s.substr(1); + if ("openrepo" === o) { + const e = B(i, "pr"), + t = B(i, "branch"), + n = B(i, "filepath"); + if (null != e) { + if (!/^\d+$/.test(e)) return r; + if (null != t && !/^pr\/\d+$/.test(t)) return r + } + return null != t && (c = t, H.test(c)) ? r : { + name: "open-repository-from-url", + url: a, + branch: t, + pr: e, + filepath: n + } + } + var c; + return "openlocalrepo" === o ? { + name: "open-repository-from-path", + path: decodeURIComponent(a) + } : r + } + var $ = n(20); + + function q() { + for (const t of Object($.enumerateValues)($.HKEY.HKEY_CURRENT_USER, "Environment")) + if ("Path" === t.name && ((e = t).type === $.RegistryValueType.REG_SZ || e.type === $.RegistryValueType.REG_EXPAND_SZ)) return t.data.split(";").filter(e => e.length > 0); + var e; + throw new Error("Could not find PATH environment variable") + } + async function W(e) { + let t; + const n = process.env.SystemRoot; + if (n) { + const e = r.join(n, "System32"); + t = r.join(e, "setx.exe") + } else t = "setx.exe"; + await Y(t, ["Path", e.join(";")]) } - d === void 0 && (d = s & ~process.umask()), t || (t = null), e = i.resolve(e); - try { - l.mkdirSync(e, d), t = t || e - } catch (o) { - if ('ENOENT' === o.code) { - if (i.dirname(e) === e) throw o; - t = r(i.dirname(e), n, t), r(e, n, t) - } else { - let n; + + function Y(e, t) { try { - n = l.statSync(e) + const n = Object(z.spawn)(e, t); + return new Promise((r, i) => { + let o = ""; + n.stdout && n.stdout.on("data", e => { + o += e + }), n.on("close", n => { + 0 === n ? r(o) : i(new Error(`Command "${e} ${t}" failed: "${o}"`)) + }), n.on("error", e => { + i(e) + }), n.stdin && n.stdin.end() + }) } catch (e) { - throw o - } - if (!n.isDirectory()) throw o - } - } - return t - } - const o = t(1), - i = t(0), - a = t(40).invalidWin32Path, - s = parseInt('0777', 8); - e.exports = r -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t, d) { - if ('function' == typeof n ? (t = n, n = {}) : (!n || 'object' != typeof n) && (n = { - mode: n - }), a(e)) { - const n = new Error(e + ' contains invalid WIN32 path characters.'); - return n.code = 'EINVAL', t(n) - } - let l = n.mode; - const c = n.fs || o; - void 0 === l && (l = s & ~process.umask()), d || (d = null), t = t || function () {}, e = i.resolve(e), c.mkdir(e, l, (o) => { - if (!o) return d = d || e, t(null, d); - switch (o.code) { - case 'ENOENT': - if (i.dirname(e) === e) return t(o); - r(i.dirname(e), n, (o, i) => { - o ? t(o, i) : r(e, n, t, i) - }); - break; - default: - c.stat(e, (e, n) => { - e || !n.isDirectory() ? t(o, d) : t(null, d) - }); - } - }) - } - const o = t(1), - i = t(0), - a = t(40).invalidWin32Path, - s = parseInt('0777', 8); - e.exports = r -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t) { - 'function' == typeof t && (t = { - filter: t - }), t = t || {}, t.clobber = !('clobber' in t) || !!t.clobber, t.overwrite = 'overwrite' in t ? !!t.overwrite : t.clobber, t.preserveTimestamps && 'ia32' === process.arch && console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`); - const r = _(e, n); - if (!t.filter || t.filter(e, n)) { - const i = S.dirname(n); - return b.existsSync(i) || w(i), o(r, e, n, t) - } - } - - function o(e, n, t, r) { - return r.filter && !r.filter(n, t) ? void 0 : i(e, n, t, r) - } - - function i(e, n, t, r) { - const o = r.dereference ? b.statSync : b.lstatSync, - i = o(n); - if (i.isDirectory()) return c(i, e, n, t, r); - return i.isFile() || i.isCharacterDevice() || i.isBlockDevice() ? a(i, e, n, t, r) : i.isSymbolicLink() ? g(e, n, t, r) : void 0 - } - - function a(e, n, t, r, o) { - return n === x ? d(e, t, r, o) : s(e, t, r, o) - } - - function s(e, n, t, r) { - if (r.overwrite) return b.unlinkSync(t), d(e, n, t, r); - if (r.errorOnExist) throw new Error(`'${t}' already exists`) - } - - function d(e, n, t, r) { - return 'function' == typeof b.copyFileSync ? (b.copyFileSync(n, t), b.chmodSync(t, e.mode), r.preserveTimestamps ? v(t, e.atime, e.mtime) : void 0) : l(e, n, t, r) - } - - function l(e, n, r, o) { - const i = 65536, - a = t(38)(i), - s = b.openSync(n, 'r'), - d = b.openSync(r, 'w', e.mode); - for (let t = 0; t < e.size;) { - const e = b.readSync(s, a, 0, i, t); - b.writeSync(d, a, 0, e), t += e - } - o.preserveTimestamps && b.futimesSync(d, e.atime, e.mtime), b.closeSync(s), b.closeSync(d) - } - - function c(e, n, t, r, o) { - if (n === x) return p(e, t, r, o); - if (n && !n.isDirectory()) throw new Error(`Cannot overwrite non-directory '${r}' with directory '${t}'.`); - return u(t, r, o) - } - - function p(e, n, t, r) { - return b.mkdirSync(t), u(n, t, r), b.chmodSync(t, e.mode) - } - - function u(e, n, t) { - b.readdirSync(e).forEach((r) => m(r, e, n, t)) - } - - function m(e, n, t, r) { - const i = S.join(n, e), - a = S.join(t, e), - s = _(i, a); - return o(s, i, a, r) - } - - function g(e, n, t, r) { - let o = b.readlinkSync(n); - if (r.dereference && (o = S.resolve(process.cwd(), o)), e === x) return b.symlinkSync(o, t); - else { - let e; - try { - e = b.readlinkSync(t) - } catch (e) { - if ('EINVAL' === e.code || 'UNKNOWN' === e.code) return b.symlinkSync(o, t); - throw e - } - if (r.dereference && (e = S.resolve(process.cwd(), e)), h(o, e)) throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${e}'.`); - if (b.statSync(t).isDirectory() && h(e, o)) throw new Error(`Cannot overwrite '${e}' with '${o}'.`); - return f(o, t) - } - } - - function f(e, n) { - return b.unlinkSync(n), b.symlinkSync(e, n) - } - - function h(e, n) { - const t = S.resolve(e).split(S.sep), - r = S.resolve(n).split(S.sep); - return t.reduce((e, n, t) => e && r[t] === n, !0) - } - - function y(e, n) { - const t = b.statSync(e); - let r; - try { - r = b.statSync(n) - } catch (e) { - if ('ENOENT' === e.code) return { - srcStat: t, - destStat: x - }; - throw e - } - return { - srcStat: t, - destStat: r - } - } - - function _(e, n) { - const { - srcStat: t, - destStat: r - } = y(e, n); - if (r.ino && r.ino === t.ino) throw new Error('Source and destination must not be the same.'); - if (t.isDirectory() && h(e, n)) throw new Error(`Cannot copy '${e}' to a subdirectory of itself, '${n}'.`); - return r - } - const b = t(1), - S = t(0), - w = t(3).mkdirsSync, - v = t(39).utimesMillisSync, - x = Symbol('notExist'); - e.exports = r -}, function (e) { - 'use strict'; - e.exports = function (e) { - if (null === e || 'object' != typeof e) return e; - if (e instanceof Object) var n = { - __proto__: e.__proto__ - }; - else var n = Object.create(null); - return Object.getOwnPropertyNames(e).forEach(function (t) { - Object.defineProperty(n, t, Object.getOwnPropertyDescriptor(e, t)) - }), n - } -}, function (e, n, t) { - var r = t(8).Stream; - e.exports = function (e) { - function n(t, o) { - if (!(this instanceof n)) return new n(t, o); - r.call(this); - var i = this; - this.path = t, this.fd = null, this.readable = !0, this.paused = !1, this.flags = 'r', this.mode = 438, this.bufferSize = 65536, o = o || {}; - for (var a = Object.keys(o), s = 0, d = a.length, l; s < d; s++) l = a[s], this[l] = o[l]; - if (this.encoding && this.setEncoding(this.encoding), void 0 !== this.start) { - if ('number' != typeof this.start) throw TypeError('start must be a Number'); - if (void 0 === this.end) this.end = Infinity; - else if ('number' != typeof this.end) throw TypeError('end must be a Number'); - if (this.start > this.end) throw new Error('start must be <= end'); - this.pos = this.start - } - return null === this.fd ? void e.open(this.path, this.flags, this.mode, function (e, n) { - return e ? (i.emit('error', e), void(i.readable = !1)) : void(i.fd = n, i.emit('open', n), i._read()) - }) : void process.nextTick(function () { - i._read() - }) - } - - function t(n, o) { - if (!(this instanceof t)) return new t(n, o); - r.call(this), this.path = n, this.fd = null, this.writable = !0, this.flags = 'w', this.encoding = 'binary', this.mode = 438, this.bytesWritten = 0, o = o || {}; - for (var i = Object.keys(o), a = 0, s = i.length, d; a < s; a++) d = i[a], this[d] = o[d]; - if (this.start !== void 0) { - if ('number' != typeof this.start) throw TypeError('start must be a Number'); - if (0 > this.start) throw new Error('start must be >= zero'); - this.pos = this.start - } - this.busy = !1, this._queue = [], null === this.fd && (this._open = e.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush()) - } - return { - ReadStream: n, - WriteStream: t - } - } -}, function (e) { - e.exports = require('constants') -}, function (e, n, t) { - var r = t(104), - o = process.cwd, - i = null, - a = process.env.GRACEFUL_FS_PLATFORM || 'win32'; - process.cwd = function () { - return i || (i = o.call(process)), i - }; - try { - process.cwd() - } catch (e) {} - var s = process.chdir; - process.chdir = function (e) { - i = null, s.call(process, e) - }, e.exports = function (e) { - function n(n) { - return n ? function (t, r, o) { - return n.call(e, t, r, function (e) { - l(e) && (e = null), o && o.apply(this, arguments) - }) - } : n + return Promise.reject(e) + } } - - function t(n) { - return n ? function (t, r) { + const K = r.resolve(process.execPath, ".."), + J = r.resolve(K, ".."), + V = r.resolve(r.join(J, "Update.exe")), + X = r.basename(process.execPath); + async function Q() { + const e = Z(); + await Object(s.ensureDir)(e), await + function (e) { + const t = `@echo off\n"%~dp0\\${ee(e,"resources/app/static/github.bat")}" %*`, + n = r.join(e, "github.bat"); + return Object(s.writeFile)(n, t) + }(e), await + function (e) { + const t = `#!/usr/bin/env bash\n DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"\n sh "$DIR/${ee(e,"resources/app/static/github.sh").replace(/\\/g,"/")}" "$@"`, + n = r.join(e, "github"); + return Object(s.writeFile)(n, t, { + encoding: "utf8", + mode: 755 + }) + }(e); try { - return n.call(e, t, r) + const t = q(); + t.indexOf(e) < 0 && await W([...t, e]) } catch (e) { - if (!l(e)) throw e + log.error("Failed inserting bin path into PATH environment variable", e) } - } : n } - function o(n) { - return n ? function (t, r, o, i) { - return n.call(e, t, r, o, function (e) { - l(e) && (e = null), i && i.apply(this, arguments) - }) - } : n + function Z() { + return r.resolve(process.execPath, "../../bin") } - function i(n) { - return n ? function (t, r, o) { - try { - return n.call(e, t, r, o) - } catch (e) { - if (!l(e)) throw e - } - } : n + function ee(e, t) { + const n = r.resolve(process.execPath, ".."); + return r.relative(e, r.join(n, t)) + } + async function te(e) { + await Y(V, e) } - function s(n) { - return n ? function (t, r, o) { - function i(e, n) { - n && (0 > n.uid && (n.uid += 4294967296), 0 > n.gid && (n.gid += 4294967296)), o && o.apply(this, arguments) + function ne(e) { + return te(["--createShortcut", X, "-l", e.join(",")]) + } + var re = n(19); + async function ie(e, t, n) { + const r = new Map; + if (r.set("name", e.name), r.set("message", e.message), e.stack && r.set("stack", e.stack), r.set("platform", "win32"), r.set("sha", "ebf4606179c52ba2c755126f6a100e8240969b94"), r.set("version", x.app.getVersion()), t) + for (const e of Object.keys(t)) r.set(e, t[e]); + const i = { + method: "POST", + url: n ? "https://central.github.com/api/desktop-non-fatal/exception" : "https://central.github.com/api/desktop/exception", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + } + }, + o = [...r.entries()].map(([e, t]) => `${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"); + try { + await new Promise((e, t) => { + const n = x.net.request(i); + n.on("response", n => { + 200 === n.statusCode ? e() : t(`Got ${n.statusCode} - ${n.statusMessage} from central`) + }), n.on("error", t), n.end(o) + }), log.info("Error report submitted") + } catch (t) { + log.error("Failed submitting error report", e) } - return 'function' == typeof r && (o = r, r = null), r ? n.call(e, t, r, i) : n.call(e, t, i) - } : n } - - function d(n) { - return n ? function (t, r) { - var o = r ? n.call(e, t, r) : n.call(e, t); - return 0 > o.uid && (o.uid += 4294967296), 0 > o.gid && (o.gid += 4294967296), o - } : n + class oe { + constructor(e, t) { + this.emitter = new O.Emitter, this.hasFinishedLoading = !1, this.hasSentReadyEvent = !1; + const n = { + width: 600, + height: 500, + minWidth: 600, + minHeight: 500, + show: !1, + backgroundColor: "#fff", + webPreferences: { + disableBlinkFeatures: "Auxclick", + nodeIntegration: !0, + spellcheck: !1 + }, + frame: !1 + }; + this.window = new x.BrowserWindow(n), this.error = t, this.errorType = e + } + load() { + log.debug("Starting crash process"), this.window.webContents.once("did-start-loading", () => { + log.debug("Crash process in startup") + }), this.window.webContents.once("did-finish-load", () => { + log.debug("Crash process started"), this.hasFinishedLoading = !0, this.maybeEmitDidLoad() + }), this.window.webContents.on("did-finish-load", () => { + this.window.webContents.setVisualZoomLevelLimits(1, 1) + }), this.window.webContents.on("did-fail-load", () => { + log.error("Crash process failed to load"), this.emitter.emit("did-fail-load", null) + }), x.ipcMain.on("crash-ready", e => { + log.debug("Crash process is ready"), this.hasSentReadyEvent = !0, this.sendError(), this.maybeEmitDidLoad() + }), x.ipcMain.on("crash-quit", e => { + log.debug("Got quit signal from crash process"), this.window.close() + }), T(this.window), this.window.loadURL(`file://${__dirname}/crash.html`) + } + maybeEmitDidLoad() { + this.hasFinishedLoading && this.hasSentReadyEvent && this.emitter.emit("did-load", null) + } + onClose(e) { + this.window.on("closed", e) + } + onFailedToLoad(e) { + this.emitter.on("did-fail-load", e) + } + onDidLoad(e) { + return this.emitter.on("did-load", e) + } + focus() { + this.window.focus() + } + show() { + log.debug("Showing crash process window"), this.window.show() + } + sendError() { + const e = { + stack: this.error.stack, + message: this.error.message, + name: this.error.name + }, + t = { + type: this.errorType, + error: e + }; + this.window.webContents.send("error", t) + } + destroy() { + this.window.destroy() + } } - - function l(e) { - if (!e) return !0; - if ('ENOSYS' === e.code) return !0; - var n = !process.getuid || 0 !== process.getuid(); - return !!(n && ('EINVAL' === e.code || 'EPERM' === e.code)) - } - r.hasOwnProperty('O_SYMLINK') && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && function (e) { - e.lchmod = function (n, t, o) { - e.open(n, r.O_WRONLY | r.O_SYMLINK, t, function (n, r) { - return n ? void(o && o(n)) : void e.fchmod(r, t, function (n) { - e.close(r, function (e) { - o && o(n || e) - }) - }) + let se = !1; + + function ae(e, t) { + return (e ? e.toLowerCase() : e) === (t ? t.toLowerCase() : t) + } + + function ce() { + const e = x.Menu.buildFromTemplate([{ + role: "editMenu" + }]).items[0]; + return (e && e.submenu ? e.submenu.items : []).filter(e => !ae(e.role, "pasteandmatchstyle")) + } + + function le(e, t) { + return function e(t, n, r = []) { + const i = new x.Menu; + for (const [o, s] of t.entries()) + if (ae(s.role, "editmenu")) + for (const e of ce()) i.append(e); + else { + const t = [...r, o]; + i.append(new x.MenuItem({ + label: s.label, + type: s.type, + enabled: s.enabled, + role: s.role, + click: () => n(t), + submenu: s.submenu ? e(s.submenu, n, t) : void 0 + })) + } return i + }(e, t) + } + + function ue(e, t) { + process.emit("send-non-fatal-exception", t, { + kind: e }) - }, e.lchmodSync = function (n, t) { - var o = e.openSync(n, r.O_WRONLY | r.O_SYMLINK, t), - i = !0, - a; - try { - a = e.fchmodSync(o, t), i = !1 - } finally { - if (i) try { - e.closeSync(o) - } catch (e) {} else e.closeSync(o) + } + n(54); + x.app.setAppLogsPath(), x.app.allowRendererProcessReuse = !1, + function () { + d.a.install({ + environment: "node", + handleUncaughtExceptions: !1, + retrieveSourceMap: g + }); + const e = Error; + v = e.prepareStackTrace, e.prepareStackTrace = w + }(); + let fe = null; + const he = j(); + let pe = !1, + de = null, + me = []; + + function ge(e) { + pe = !0; + const t = null === fe; + fe && (fe.destroy(), fe = null), + function (e, t) { + if (log.error(E(t)), se) return; + se = !0, Object(I.setCrashMenu)(); + const n = new oe(e ? "launch" : "generic", t); + n.onDidLoad(() => { + n.show() + }), n.onFailedToLoad(async () => { + await x.dialog.showMessageBox({ + type: "error", + title: "无法恢复的错误", + message: "GitHub Desktop遇到不可恢复的错误,需要重新启动。\n\n已将此问题报告给团队,但如果您反复遇到此问题,请将此问题报告给GitHub桌面问题跟踪程序。\n\n" + (t.stack || t.message) + }), x.app.relaunch(), x.app.quit() + }), n.onClose(() => { + x.app.relaunch(), x.app.quit() + }), n.load() + }(t, e) + } + + function ye() { + return { + uptime: ((j() - he) / 1e3).toFixed(3), + time: (new Date).toString() } - return a - } - }(e), e.lutimes || function (e) { - r.hasOwnProperty('O_SYMLINK') ? (e.lutimes = function (n, t, o, i) { - e.open(n, r.O_SYMLINK, function (n, r) { - return n ? void(i && i(n)) : void e.futimes(r, t, o, function (n) { - e.close(r, function (e) { - i && i(n || e) - }) - }) + } + const ve = new Set(["x-github-client"]); + ve.add("x-github-desktop-auth"), ve.add("github-windows"), x.app.on("window-all-closed", () => {}), process.on("uncaughtException", e => { + ie(e = b(e), ye()), ge(e) + }); + let we = !1; + if (process.argv.length > 1) { + const e = process.argv[1], + t = function (e) { + switch (e) { + case "--squirrel-install": + return async function () { + await ne(["StartMenu", "Desktop"]), await Q() + }(); + case "--squirrel-updated": + return async function () { + await async function () { + const e = U.homedir(); + if (e) { + const t = r.join(e, "Desktop", "GitHub Desktop.lnk"), + n = await Object(s.pathExists)(t); + return ne(n ? ["StartMenu", "Desktop"] : ["StartMenu"]) + } + return ne(["StartMenu", "Desktop"]) + }(), await Q() + }(); + case "--squirrel-uninstall": + return async function () { + await te(["--removeShortcut", X]); + try { + const e = q(), + t = Z(); + return W(e.filter(e => e !== t)) + } catch (e) { + log.error("Failed removing bin path from PATH environment variable", e) + } + }(); + case "--squirrel-obsolete": + return Promise.resolve() + } + return null + }(e); + t ? (we = !0, t.catch(t => { + log.error("Failed handling Squirrel event: " + e, t) + }).then(() => { + x.app.quit() + })) : Ee(process.argv) + } + + function be(e) { + log.info("Processing protocol url"); + const t = G(e); + Se(e => { + e.focus(), e.sendURLAction(t) }) - }, e.lutimesSync = function (n, t, o) { - var i = e.openSync(n, r.O_SYMLINK), - a = !0, - s; - try { - s = e.futimesSync(i, t, o), a = !1 - } finally { - if (a) try { - e.closeSync(i) - } catch (e) {} else e.closeSync(i) + } + let _e = !1; + if (!we) { + const e = x.app.requestSingleInstanceLock(); + _e = !e, x.app.on("second-instance", (e, t, n) => { + fe && (fe.isMinimized() && fe.restore(), fe.isVisible() || fe.show(), fe.focus()), Ee(t) + }), _e && x.app.quit() + } + + function Ee(e) { + log.info("Received possible protocol arguments: " + e.length); { + const t = e.filter(e => { + try { + const t = C.parse(e); + return t.protocol && ve.has(t.protocol.slice(0, -1)) + } catch (t) { + return log.error("Unable to parse argument as URL: " + e), !1 + } + }); + e.includes("--protocol-launcher") && 1 === t.length ? be(t[0]) : log.error("Malformed launch arguments received: " + e) } - return s - }) : (e.lutimes = function (e, n, t, r) { - r && process.nextTick(r) - }, e.lutimesSync = function () {}) - }(e), e.chown = o(e.chown), e.fchown = o(e.fchown), e.lchown = o(e.lchown), e.chmod = n(e.chmod), e.fchmod = n(e.fchmod), e.lchmod = n(e.lchmod), e.chownSync = i(e.chownSync), e.fchownSync = i(e.fchownSync), e.lchownSync = i(e.lchownSync), e.chmodSync = t(e.chmodSync), e.fchmodSync = t(e.fchmodSync), e.lchmodSync = t(e.lchmodSync), e.stat = s(e.stat), e.fstat = s(e.fstat), e.lstat = s(e.lstat), e.statSync = d(e.statSync), e.fstatSync = d(e.fstatSync), e.lstatSync = d(e.lstatSync), e.lchmod || (e.lchmod = function (e, n, t) { - t && process.nextTick(t) - }, e.lchmodSync = function () {}), e.lchown || (e.lchown = function (e, n, t, r) { - r && process.nextTick(r) - }, e.lchownSync = function () {}), 'win32' === a && (e.rename = function (n) { - return function (t, r, o) { - var i = Date.now(), - a = 0; - n(t, r, function s(d) { - return d && ('EACCES' === d.code || 'EPERM' === d.code) && 6e4 > Date.now() - i ? (setTimeout(function () { - e.stat(r, function (e) { - e && 'ENOENT' === e.code ? n(t, r, s) : o(d) + } + + function Se(e) { + me ? me.push(e) : fe && e(fe) + } + process, x.app.on("will-finish-launching", () => { + x.app.on("open-url", (e, t) => { + e.preventDefault(), be(t) + }) + }), process.env.GITHUB_DESKTOP_DISABLE_HARDWARE_ACCELERATION && (log.info("GITHUB_DESKTOP_DISABLE_HARDWARE_ACCELERATION environment variable set, disabling hardware acceleration"), x.app.disableHardwareAcceleration()), x.app.on("ready", () => { + _e || we || (de = j() - he, ve.forEach(e => function (e) { + x.app.setAsDefaultProtocolClient(e, process.execPath, ["--protocol-launcher"]) + }(e)), function () { + const e = new D; + 0; + e.onClose(() => { + fe = null, pe || x.app.quit() + }), e.onDidLoad(() => { + e.show(), e.sendLaunchTimingStats({ + mainReadyTime: de, + loadTime: e.loadTime, + rendererReadyTime: e.rendererReadyTime + }); + const t = me; + me = null; + for (const n of t) n(e) + }), e.load(), fe = e + }(), x.Menu.setApplicationMenu(Object(I.buildDefaultMenu)({ + selectedShell: null, + selectedExternalEditor: null, + askForConfirmationOnRepositoryRemoval: !1, + askForConfirmationOnForcePush: !1 + })), x.ipcMain.on("update-preferred-app-menu-item-labels", (e, t) => { + const n = Object(I.buildDefaultMenu)(t), + r = x.Menu.getApplicationMenu(); + if (null === r) return x.Menu.setApplicationMenu(n), void(null !== fe && fe.sendAppMenu()); + let i = !1; + for (const e of Object(I.getAllMenuItems)(n)) { + const t = e.id; + if (!t) continue; + const n = r.getMenuItemById(t); + n ? (n.label !== e.label && (i = !0), n.enabled !== e.enabled && (e.enabled = n.enabled, i = !0)) : i = !0 + } + i && fe && (x.Menu.setApplicationMenu(n), fe.sendAppMenu()) + }), x.ipcMain.on("menu-event", (e, t) => { + const { + name: n + } = e; + fe && fe.sendMenuEvent(n) + }), x.ipcMain.on("execute-menu-item", (e, { + id: t + }) => { + const n = x.Menu.getApplicationMenu(); + if (null === n) return; + const r = n.getMenuItemById(t); + if (r) { + const t = x.BrowserWindow.fromWebContents(e.sender) || void 0, + n = { + preventDefault: () => {}, + sender: e.sender + }; + r.click(n, t, e.sender) + } + }), x.ipcMain.on("update-menu-state", (e, t) => { + let n = !1; + const r = x.Menu.getApplicationMenu(); + if (null !== r) { + for (const e of t) { + const { + id: t, + state: i + } = e, o = r.getMenuItemById(t); + o ? void 0 !== i.enabled && o.enabled !== i.enabled && (o.enabled = i.enabled, n = !0) : M("Unknown menu id: " + t) + } + n && fe && (x.Menu.setApplicationMenu(r), fe.sendAppMenu()) + } else log.debug("unable to get current menu, bailing out...") + }), x.ipcMain.handle("show-contextual-menu", (e, t) => new Promise(n => { + const r = le(t, e => n(e)), + i = x.BrowserWindow.fromWebContents(e.sender) || void 0; + r.popup({ + window: i, + callback: () => n(null) }) - }, a), void(100 > a && (a += 10))) : void(o && o(d)) + })), x.ipcMain.on("get-app-menu", () => { + fe && fe.sendAppMenu() + }), x.ipcMain.on("show-certificate-trust-dialog", (e, { + certificate: t, + message: n + }) => { + Se(e => { + e.showCertificateTrustDialog(t, n) + }) + }), x.ipcMain.on("log", (e, t, n) => { + l(t, n) + }), x.ipcMain.on("uncaught-exception", (e, t) => { + ge(t) + }), x.ipcMain.on("send-error-report", (e, { + error: t, + extra: n, + nonFatal: r + }) => { + ie(t, Object.assign(Object.assign({}, ye()), n), r) + }), x.ipcMain.on("open-external", async (e, { + path: t + }) => { + const n = t.toLowerCase(); + let r; + (n.startsWith("http://") || n.startsWith("https://")) && log.info("opening in browser: " + t); + try { + await x.shell.openExternal(t), r = !0 + } catch (e) { + log.error(`Call to openExternal failed: '${e}'`), r = !1 + } + e.sender.send("open-external-result", { + result: r + }) + }), x.ipcMain.on("show-item-in-folder", (e, { + path: t + }) => { + u.stat(t, e => { + e ? log.error(`Unable to find file at '${t}'`, e) : x.shell.showItemInFolder(t) + }) + }), x.ipcMain.on("show-folder-contents", async (e, { + path: t + }) => { + const n = await Object(s.stat)(t).catch(e => (log.error("Unable to retrieve file information for " + t, e), null)); + if (n) return n.isDirectory() ? void Object(re.a)(t) : (log.error(`Trying to get the folder contents of a non-folder at '${t}'`), void x.shell.showItemInFolder(t)) + })) + }), x.app.on("activate", () => { + Se(e => { + e.show() }) - } - }(e.rename)), e.read = function (n) { - function t(t, r, o, i, a, s) { - var d; - if (s && 'function' == typeof s) { - var l = 0; - d = function (c) { - return c && 'EAGAIN' === c.code && 10 > l ? (l++, n.call(e, t, r, o, i, a, d)) : void s.apply(this, arguments) - } - } - return n.call(e, t, r, o, i, a, d) - } - return t.__proto__ = n, t - }(e.read), e.readSync = function (n) { - return function (t, r, o, i, a) { - for (var s = 0;;) try { - return n.call(e, t, r, o, i, a) - } catch (e) { - if ('EAGAIN' === e.code && 10 > s) { - s++; - continue - } - throw e - } - } - }(e.readSync) - } -}, function (e, n, t) { - function r(e) { - this.logger = e, this.start = Date.now() - } - var o = t(14), - i = t(6), - a = t(47), - s = t(21), - d = t(9), - l = t(45), - c = t(8).Stream, - p = /%[sdj%]/g, - u = n.Logger = function (e) { - o.EventEmitter.call(this), this.configure(e) - }; - i.inherits(u, o.EventEmitter), u.prototype.configure = function (e) { - var n = this; - Array.isArray(this._names) && this._names.length && this.clear(), e = e || {}, this.transports = {}, this._names = [], e.transports && e.transports.forEach(function (e) { - n.add(e, null, !0) - }), this.padLevels = e.padLevels || !1, this.setLevels(e.levels), e.colors && s.addColors(e.colors), this.id = e.id || null, this.level = e.level || 'info', this.emitErrs = e.emitErrs || !1, this.stripColors = e.stripColors || !1, this.exitOnError = !('undefined' != typeof e.exitOnError) || e.exitOnError, this.exceptionHandlers = {}, this.profilers = {}, ['rewriters', 'filters'].forEach(function (t) { - n[t] = Array.isArray(e[t]) ? e[t] : [] - }), e.exceptionHandlers && this.handleExceptions(e.exceptionHandlers) - }, u.prototype.log = function (e) { - function n(e) { - d ? d(e) : s.emitErrs && s.emit('error', e) - } - - function t(n) { - if (d) { - if (n) return d(n); - d(null, e, h, c) - } - d = null, n || s.emit('logged', e, h, c) - } - - function r(n, r) { - var o = s.transports[n]; - o.log(e, h, c, function (n) { - return n ? (n.transport = o, t(n), r()) : void(s.emit('logging', o, e, h, c), r()) - }) - } - for (var o = Array.prototype.slice.call(arguments, 1), s = this; null === o[o.length - 1];) o.pop(); - var d = 'function' == typeof o[o.length - 1] ? o.pop() : null; - if (0 === this._names.length) return n(new Error('Cannot log with no transports.')); - if ('undefined' == typeof s.levels[e]) return n(new Error('Unknown log level: ' + e)); - var l = this._names.filter(function (n) { - var t = s.transports[n]; - return t.level && s.levels[t.level] >= s.levels[e] || !t.level && s.levels[s.level] >= s.levels[e] - }); - if (!l.length) return void(d && d()); - var c = {}, - u = !1, - m = o && o[0] && o[0].match && null !== o[0].match(p), - g = m ? o[0].match(p) : [], - f = g.filter(function (e) { - return '%%' === e - }), - h; - if (0 < o.length - 1 - (g.length - f.length) || 1 === o.length) { - c = o[o.length - 1] || o; - var y = Object.prototype.toString.call(c); - u = '[object Object]' === y || '[object Error]' === y || '[object Array]' === y, c = u ? o.pop() : {} - } - if (h = i.format.apply(null, o), this.padLevels && (h = Array(this.levelLength - e.length + 1).join(' ') + h), this.rewriters.forEach(function (n) { - c = n(e, h, c, s) - }), this.filters.forEach(function (n) { - var t = n(e, h, c, s); - 'string' == typeof t ? h = t : (h = t.msg, c = t.meta) - }), this.stripColors) { - var _ = /\u001b\[(\d+(;\d+)*)?m/g; - h = ('' + h).replace(_, '') - } - return a.forEach(l, r, t), this - }, u.prototype.query = function (e, n) { - function t(n, t) { - e.query && (e.query = n.formatQuery(i)), n.query(e, function (r, o) { - return r ? t(r) : void t(null, n.formatResults(o, e.format)) - }) - } - 'function' == typeof e && (n = e, e = {}); - var r = this, - e = e || {}, - o = {}, - i = d.clone(e.query) || {}, - s; - return e.transport ? (e.transport = e.transport.toLowerCase(), t(this.transports[e.transport], n)) : void(s = this._names.map(function (e) { - return r.transports[e] - }).filter(function (e) { - return !!e.query - }), a.forEach(s, function (e, n) { - t(e, function (t, r) { - n && (r = t || r, r && (o[e.name] = r), n()), n = null - }) - }, function () { - n(null, o) - })) - }, u.prototype.stream = function (e) { - var n = this, - e = e || {}, - t = new c, - r = [], - o; - if (e.transport) { - var i = this.transports[e.transport]; - if (delete e.transport, i && i.stream) return i.stream(e) - } - return t._streams = r, t.destroy = function () { - for (var e = r.length; e--;) r[e].destroy() - }, o = this._names.map(function (e) { - return n.transports[e] - }).filter(function (e) { - return !!e.stream - }), o.forEach(function (n) { - var o = n.stream(e); - o && (r.push(o), o.on('log', function (e) { - e.transport = e.transport || [], e.transport.push(n.name), t.emit('log', e) - }), o.on('error', function (e) { - e.transport = e.transport || [], e.transport.push(n.name), t.emit('error', e) - })) - }), t - }, u.prototype.close = function () { - var e = this; - this._names.forEach(function (n) { - var t = e.transports[n]; - t && t.close && t.close() - }), this.emit('close') - }, u.prototype.handleExceptions = function () { - var e = Array.prototype.slice.call(arguments), - n = [], - t = this; - e.forEach(function (e) { - Array.isArray(e) ? n = n.concat(e) : n.push(e) - }), this.exceptionHandlers = this.exceptionHandlers || {}, n.forEach(function (e) { - t.exceptionHandlers[e.name] = e - }), this._hnames = Object.keys(t.exceptionHandlers), this.catchExceptions || (this.catchExceptions = this._uncaughtException.bind(this), process.on('uncaughtException', this.catchExceptions)) - }, u.prototype.unhandleExceptions = function () { - var e = this; - this.catchExceptions && (Object.keys(this.exceptionHandlers).forEach(function (n) { - var t = e.exceptionHandlers[n]; - t.close && t.close() - }), this.exceptionHandlers = {}, Object.keys(this.transports).forEach(function (n) { - var t = e.transports[n]; - t.handleExceptions && (t.handleExceptions = !1) - }), process.removeListener('uncaughtException', this.catchExceptions), this.catchExceptions = !1) - }, u.prototype.add = function (e, n, t) { - var r = t ? e : new e(n); - if (!r.name && !r.log) throw new Error('Unknown transport with no log() method'); - else if (this.transports[r.name]) throw new Error('Transport already attached: ' + r.name + ', assign a different name'); - return this.transports[r.name] = r, this._names = Object.keys(this.transports), r._onError = this._onError.bind(this, r), t || r.on('error', r._onError), r.handleExceptions && !this.catchExceptions && this.handleExceptions(), this - }, u.prototype.clear = function () { - Object.keys(this.transports).forEach(function (e) { - this.remove({ - name: e - }) - }, this) - }, u.prototype.remove = function (e) { - var n = 'string' == typeof e ? e : e.name || e.prototype.name; - if (!this.transports[n]) throw new Error('Transport ' + n + ' not attached to this instance'); - var t = this.transports[n]; - return delete this.transports[n], this._names = Object.keys(this.transports), t.close && t.close(), t._onError && t.removeListener('error', t._onError), this - }, u.prototype.startTimer = function () { - return new r(this) - }, u.prototype.profile = function (e) { - var n = Date.now(), - t, r, o, i, a; - return this.profilers[e] ? (t = this.profilers[e], delete this.profilers[e], r = Array.prototype.slice.call(arguments), a = 'function' == typeof r[r.length - 1] ? r.pop() : null, i = 'object' == typeof r[r.length - 1] ? r.pop() : {}, o = 2 === r.length ? r[1] : e, i.durationMs = n - t, this.info(o, i, a)) : (this.profilers[e] = n, this) - }, u.prototype.setLevels = function (e) { - return d.setLevels(this, this.levels, e) - }, u.prototype.cli = function () { - return this.padLevels = !0, this.setLevels(s.cli.levels), s.addColors(s.cli.colors), this.transports.console && (this.transports.console.colorize = this.transports.console.colorize || !0, this.transports.console.timestamp = this.transports.console.timestamp || !1), this - }, u.prototype._uncaughtException = function (e) { - function n() { - d && !r && (clearTimeout(s), r = !0, process.exit(1)) - } - var t = this, - r = !1, - o = l.getAllInfo(e), - i = this._getExceptionHandlers(), - s, d; - return d = 'function' == typeof this.exitOnError ? this.exitOnError(e) : this.exitOnError, i && 0 !== i.length ? void(a.forEach(i, function (n, t) { - n.logException('uncaughtException: ' + (e.message || e), o, t, e) - }, n), d && (s = setTimeout(n, 3e3))) : n() - }, u.prototype._getExceptionHandlers = function () { - var e = this; - return this._hnames.map(function (n) { - return e.exceptionHandlers[n] - }).concat(this._names.map(function (n) { - return e.transports[n].handleExceptions && e.transports[n] - })).filter(Boolean) - }, u.prototype._onError = function (e, n) { - this.emitErrs && this.emit('error', n, e) - }, r.prototype.done = function (e) { - var n = Array.prototype.slice.call(arguments), - t = 'function' == typeof n[n.length - 1] ? n.pop() : null, - r = 'object' == typeof n[n.length - 1] ? n.pop() : {}; - return r.duration = Date.now() - this.start + 'ms', this.logger.info(e, r, t) - } -}, function (e, n, t) { - var r = t(9), - o = t(15), - i = t(6)._extend, - a = n.Container = function (e) { - this.loggers = {}, this.options = e || {}, this.default = { - transports: [new o.transports.Console({ - level: 'silly', - colorize: !1 - })] - } - }; - a.prototype.get = a.prototype.add = function (e, n) { - var t = this, - a; - return this.loggers[e] || (n = i({}, n || this.options || this.default), a = n.transports || this.options.transports, n.transports = a ? a.slice() : [], 0 === n.transports.length && (!n || !n.console) && n.transports.push(this.default.transports[0]), Object.keys(n).forEach(function (t) { - if ('transports' !== t) { - var i = r.capitalize(t); - if (!o.transports[i]) throw new Error('Cannot add unknown transport: ' + i); - var a = n[t]; - a.id = e, n.transports.push(new o.transports[i](a)) - } - }), n.id = e, this.loggers[e] = new o.Logger(n), this.loggers[e].on('close', function () { - t._delete(e) - })), this.loggers[e] - }, a.prototype.has = function (e) { - return !!this.loggers[e] - }, a.prototype.close = function (e) { - function n(e) { - t.loggers[e] && (t.loggers[e].close(), t._delete(e)) - } - var t = this; - return e ? n(e) : Object.keys(this.loggers).forEach(function (e) { - n(e) - }) - }, a.prototype._delete = function (e) { - delete this.loggers[e] - } -}, function (e, n) { - function t(e) { - for (var n in e) this[n] = e[n] - } - n.get = function (e) { - var t = Error.stackTraceLimit; - Error.stackTraceLimit = Infinity; - var r = {}, - o = Error.prepareStackTrace; - Error.prepareStackTrace = function (e, n) { - return n - }, Error.captureStackTrace(r, e || n.get); - var i = r.stack; - return Error.prepareStackTrace = o, Error.stackTraceLimit = t, i - }, n.parse = function (e) { - if (!e.stack) return []; - var n = this, - t = e.stack.split('\n').slice(1); - return t.map(function (e) { - if (e.match(/^\s*[-]{4,}$/)) return n._createParsedCallSite({ - fileName: e, - lineNumber: null, - functionName: null, - typeName: null, - methodName: null, - columnNumber: null, - native: null - }); - var t = e.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/); - if (t) { - var r = null, - o = null, - i = null, - a = null, - s = null, - d = 'native' === t[5]; - if (t[1]) { - i = t[1]; - var l = i.lastIndexOf('.'); - if ('.' == i[l - 1] && l--, 0 < l) { - r = i.substr(0, l), o = i.substr(l + 1); - var c = r.indexOf('.Module'); - 0 < c && (i = i.substr(c + 1), r = r.substr(0, c)) - } - a = null - } - o && (a = r, s = o), '' === o && (s = null, i = null); - var p = { - fileName: t[2] || null, - lineNumber: parseInt(t[3], 10) || null, - functionName: i, - typeName: a, - methodName: s, - columnNumber: parseInt(t[4], 10) || null, - native: d - }; - return n._createParsedCallSite(p) - } - }).filter(function (e) { - return !!e - }) - }; - ['this', 'typeName', 'functionName', 'methodName', 'fileName', 'lineNumber', 'columnNumber', 'function', 'evalOrigin'].forEach(function (e) { - t.prototype[e] = null, t.prototype['get' + e[0].toUpperCase() + e.substr(1)] = function () { - return this[e] - } - }), ['topLevel', 'eval', 'native', 'constructor'].forEach(function (e) { - t.prototype[e] = !1, t.prototype['is' + e[0].toUpperCase() + e.substr(1)] = function () { - return this[e] - } - }), n._createParsedCallSite = function (e) { - return new t(e) - } -}, function (e, n, t) { - var r = t(14), - o = t(6), - i = t(9), - a = t(12).Transport, - s = n.Memory = function (e) { - a.call(this, e), e = e || {}, this.errorOutput = [], this.writeOutput = [], this.json = e.json || !1, this.colorize = e.colorize || !1, this.prettyPrint = e.prettyPrint || !1, this.timestamp = 'undefined' != typeof e.timestamp && e.timestamp, this.showLevel = !(e.showLevel !== void 0) || e.showLevel, this.label = e.label || null, this.depth = e.depth || null, this.json && (this.stringify = e.stringify || function (e) { - return JSON.stringify(e, null, 2) - }) - }; - o.inherits(s, a), s.prototype.name = 'memory', s.prototype.log = function (e, n, t, r) { - if (this.silent) return r(null, !0); - var o = this, - a; - a = i.log({ - colorize: this.colorize, - json: this.json, - level: e, - message: n, - meta: t, - stringify: this.stringify, - timestamp: this.timestamp, - prettyPrint: this.prettyPrint, - raw: this.raw, - label: this.label, - depth: this.depth, - formatter: this.formatter, - humanReadableUnhandledException: this.humanReadableUnhandledException - }), 'error' === e || 'debug' === e ? this.errorOutput.push(a) : this.writeOutput.push(a), o.emit('logged'), r(null, !0) - }, s.prototype.clearLogs = function () { - this.errorOutput = [], this.writeOutput = [] - } -}, function (e) { - e.exports = require('https') -}, function (e) { - e.exports = require('http') -}, function (e, n, t) { - var r = t(6), - o = t(15), - i = t(111), - a = t(110), - s = t(8).Stream, - d = t(12).Transport, - l = n.Http = function (e) { - d.call(this, e), e = e || {}, this.name = 'http', this.ssl = !!e.ssl, this.host = e.host || 'localhost', this.port = e.port, this.auth = e.auth, this.path = e.path || '', this.agent = e.agent, this.port || (this.port = this.ssl ? 443 : 80) - }; - r.inherits(l, o.Transport), l.prototype.name = 'http', l.prototype._request = function (e, n) { - e = e || {}; - var t = e.auth || this.auth, - r = e.path || this.path || '', - o; - delete e.auth, delete e.path, o = (this.ssl ? a : i).request({ - host: this.host, - port: this.port, - path: '/' + r.replace(/^\//, ''), - method: 'POST', - headers: { - "Content-Type": 'application/json' - }, - agent: this.agent, - auth: t ? t.username + ':' + t.password : '' - }), o.on('error', n), o.on('response', function (e) { - var t = ''; - e.on('data', function (e) { - t += e - }), e.on('end', function () { - n(null, e, t) - }), e.resume() - }), o.end(new Buffer(JSON.stringify(e), 'utf8')) - }, l.prototype.log = function (e, n, t, r) { - var o = this; - 'function' == typeof t && (r = t, t = {}); - var i = { - method: 'collect', - params: { - level: e, - message: n, - meta: t - } - }; - t && (t.path && (i.path = t.path, delete t.path), t.auth && (i.auth = t.auth, delete t.auth)), this._request(i, function (e, n) { - return n && 200 !== n.statusCode && (e = new Error('HTTP Status Code: ' + n.statusCode)), e ? r(e) : void(o.emit('logged'), r && r(null, !0)) - }) - }, l.prototype.query = function (e, n) { - 'function' == typeof e && (n = e, e = {}); - var t = this, - e = this.normalizeQuery(e); - e = { - method: 'query', - params: e - }, e.params.path && (e.path = e.params.path, delete e.params.path), e.params.auth && (e.auth = e.params.auth, delete e.params.auth), this._request(e, function (e, t, r) { - if (t && 200 !== t.statusCode && (e = new Error('HTTP Status Code: ' + t.statusCode)), e) return n(e); - if ('string' == typeof r) try { - r = JSON.parse(r) - } catch (t) { - return n(t) - } - n(null, r) - }) - }, l.prototype.stream = function (e) { - e = e || {}; - var n = this, - t = new s, - r, o; - return t.destroy = function () { - r.destroy() - }, e = { - method: 'stream', - params: e - }, e.params.path && (e.path = e.params.path, delete e.params.path), e.params.auth && (e.auth = e.params.auth, delete e.params.auth), r = this._request(e), o = '', r.on('data', function (e) { - for (var e = (o + e).split(/\n+/), n = e.length - 1, r = 0; r < n; r++) try { - t.emit('log', JSON.parse(e[r])) - } catch (n) { - t.emit('error', n) - } - o = e[n] - }), r.on('error', function (e) { - t.emit('error', e) - }), t - } -}, function (e, n, t) { - function r(e) { - return e instanceof a.Stream - } - - function o(e) { - return r(e) && 'function' == typeof e._read && 'object' == typeof e._readableState - } - - function i(e) { - return r(e) && 'function' == typeof e._write && 'object' == typeof e._writableState - } - var a = t(8); - e.exports = r, e.exports.isReadable = o, e.exports.isWritable = i, e.exports.isDuplex = function (e) { - return o(e) && i(e) - } -}, function (e, n, t) { - var r = t(14), - o = t(5), - a = t(0), - i = t(6), - s = t(47), - d = t(46), - l = t(9), - c = t(12).Transport, - p = t(113).isWritable, - u = t(8).Stream, - m = t(10), - g = n.File = function (e) { - function n(n) { - Array.prototype.slice.call(arguments, 1).forEach(function (t) { - if (e[t]) throw new Error('Cannot set ' + t + ' and ' + n + 'together') + }), x.app.on("web-contents-created", (e, t) => { + t.on("new-window", (e, t) => { + e.preventDefault(); + const n = "Prevented new window to: " + t; + log.warn(n), ue("newWindowPrevented", Error(n)) + }), t.on("will-navigate", (e, t) => { + e.preventDefault(); + const n = "Prevented navigation to: " + t; + log.warn(n), ue("willNavigatePrevented", Error(n)) }) - } - var t = this; - if (c.call(this, e), e.filename || e.dirname) n('filename or dirname', 'stream'), this._basename = this.filename = e.filename ? a.basename(e.filename) : 'winston.log', this.dirname = e.dirname || a.dirname(e.filename), this.options = e.options || { - flags: 'a' - }, this.options.highWaterMark = this.options.highWaterMark || 24; - else if (e.stream) n('stream', 'filename', 'maxsize'), this._stream = e.stream, this._isStreams2 = p(this._stream), this._stream.on('error', function (e) { - t.emit('error', e) - }), this._stream.setMaxListeners(Infinity); - else throw new Error('Cannot log to file without filename or stream.'); - this.json = !1 !== e.json, this.logstash = e.logstash || !1, this.colorize = e.colorize || !1, this.maxsize = e.maxsize || null, this.rotationFormat = e.rotationFormat || !1, this.zippedArchive = e.zippedArchive || !1, this.maxFiles = e.maxFiles || null, this.prettyPrint = e.prettyPrint || !1, this.label = e.label || null, this.timestamp = null == e.timestamp || e.timestamp, this.eol = e.eol || m.EOL, this.tailable = e.tailable || !1, this.depth = e.depth || null, this.showLevel = void 0 === e.showLevel || e.showLevel, this.maxRetries = e.maxRetries || 2, this.json && (this.stringify = e.stringify), this._size = 0, this._created = 0, this._buffer = [], this._draining = !1, this._opening = !1, this._failures = 0, this._archive = null - }; - i.inherits(g, c), g.prototype.name = 'file', g.prototype.log = function (e, n, t, r) { - if (this.silent) return r(null, !0); - if (this._failures >= this.maxRetries) return r(new Error('Transport is in a failed state.')); - var o = this; - 'string' != typeof n && (n = '' + n); - var i = l.log({ - level: e, - message: n, - meta: t, - json: this.json, - logstash: this.logstash, - colorize: this.colorize, - prettyPrint: this.prettyPrint, - timestamp: this.timestamp, - showLevel: this.showLevel, - stringify: this.stringify, - label: this.label, - depth: this.depth, - formatter: this.formatter, - humanReadableUnhandledException: this.humanReadableUnhandledException - }); - 'string' == typeof i && (i += this.eol), this.filename ? this.open(function (e) { - return e ? o._buffer.push([i, r]) : void(o._write(i, r), o._size += i.length, o._lazyDrain()) - }) : (this._write(i, r), this._size += i.length, this._lazyDrain()) - }, g.prototype._write = function (e, n) { - if (this._isStreams2) return this._stream.write(e), n && process.nextTick(function () { - n(null, !0) - }); - var t = this._stream.write(e); - return n ? !1 === t ? this._stream.once('drain', function () { - n(null, !0) - }) : void process.nextTick(function () { - n(null, !0) - }) : void 0 - }, g.prototype.query = function (e, n) { - function t(e, n) { - try { - var t = JSON.parse(e); - i(t) && r(t) - } catch (t) { - n || p.emit('error', t) - } - } - - function r(n) { - if (e.rows && l.length >= e.rows && 'desc' != e.order) return void(p.readable && p.destroy()); - if (e.fields) { - var t = {}; - e.fields.forEach(function (e) { - t[e] = n[e] - }), n = t - } - 'desc' === e.order && l.length >= e.rows && l.shift(), l.push(n) - } - - function i(n) { - if (n && 'object' == typeof n) { - var t = new Date(n.timestamp); - return !(e.from && t < e.from || e.until && t > e.until) || void 0 - } - } - 'function' == typeof e && (n = e, e = {}); - var s = a.join(this.dirname, this.filename), - e = this.normalizeQuery(e), - d = '', - l = [], - c = 0, - p = o.createReadStream(s, { - encoding: 'utf8' - }); - p.on('error', function (e) { - return p.readable && p.destroy(), n ? 'ENOENT' === e.code ? n(null, l) : n(e) : void 0 - }), p.on('data', function (n) { - for (var n = (d + n).split(/\n+/), r = n.length - 1, o = 0; o < r; o++)(!e.start || c >= e.start) && t(n[o]), c++; - d = n[r] - }), p.on('close', function () { - d && t(d, !0), 'desc' === e.order && (l = l.reverse()), n && n(null, l) - }) - }, g.prototype.stream = function (e) { - var n = a.join(this.dirname, this.filename), - e = e || {}, - t = new u, - r = { - file: n, - start: e.start - }; - return t.destroy = l.tailFile(r, function (e, n) { - if (e) return t.emit('error', e); - try { - t.emit('data', n), n = JSON.parse(n), t.emit('log', n) - } catch (n) { - t.emit('error', n) - } - }), t - }, g.prototype.open = function (e) { - if (this.opening) return e(!0); - return !this._stream || this.maxsize && this._size >= this.maxsize ? (e(!0), this._createStream()) : void(this._archive = this.zippedArchive ? this._stream.path : null, e()) - }, g.prototype.close = function () { - var e = this; - this._stream && (this._stream.end(), this._stream.destroySoon(), this._stream.once('finish', function () { - e.emit('flush'), e.emit('closed') - })) - }, g.prototype.flush = function () { - var e = this; - return this._buffer.length ? void(this._buffer.forEach(function (n) { - var t = n[0], - r = n[1]; - process.nextTick(function () { - e._write(t, r), e._size += t.length - }) - }), e._buffer.length = 0, e._stream.once('drain', function () { - e.emit('flush'), e.emit('logged') - })) : e.emit('flush') - }, g.prototype._createStream = function () { - var e = this; - this.opening = !0, - function n(t) { - function r(n) { - e._stream && (e._stream.end(), e._stream.destroySoon()), e._size = n, e.filename = t, e._stream = o.createWriteStream(s, e.options), e._isStreams2 = p(e._stream), e._stream.on('error', function (n) { - e._failures < e.maxRetries ? (e._createStream(), e._failures++) : e.emit('error', n) - }), e._stream.setMaxListeners(Infinity), e.once('flush', function () { - e.flush(), e.opening = !1, e.emit('open', s) - }), e.flush(), i() - } - - function i() { - if (e._archive) { - var n = d.createGzip(), - t = o.createReadStream(e._archive + ''), - r = o.createWriteStream(e._archive + '.gz'); - t.pipe(n).pipe(r), o.unlink(e._archive + ''), e._archive = '' - } - } - var s = a.join(e.dirname, t); - o.stat(s, function (t, o) { - return t ? 'ENOENT' === t.code ? r(0) : e.emit('error', t) : !o || e.maxsize && o.size >= e.maxsize ? e._incFile(function () { - n(e._getFile()) - }) : void r(o.size) + }), x.app.on("certificate-error", (e, t, n, r, i, o) => { + o(!1), Se(e => { + e.sendCertificateError(i, r, n) }) - }(this._getFile()) - }, g.prototype._incFile = function (e) { - var n = a.extname(this._basename), - t = a.basename(this._basename, n); - this.tailable ? this._checkMaxFilesTailable(n, t, e) : (this._created += 1, this._checkMaxFilesIncrementing(n, t, e)) - }, g.prototype._getFile = function () { - var e = a.extname(this._basename), - n = a.basename(this._basename, e); - return !this.tailable && this._created ? n + (this.rotationFormat ? this.rotationFormat() : this._created) + e : n + e - }, g.prototype._checkMaxFilesIncrementing = function (e, n, t) { - var r = this, - i, s; - return r.zippedArchive && (r._archive = a.join(r.dirname, n + (1 === r._created ? '' : r._created - 1) + e)), !r.maxFiles || r._created < r.maxFiles ? t() : void(i = r._created - r.maxFiles, s = a.join(r.dirname, n + (0 === i ? '' : i) + e + (r.zippedArchive ? '.gz' : '')), o.unlink(s, t)) - }, g.prototype._checkMaxFilesTailable = function (e, n, t) { - var r = [], - d = this; - if (this.maxFiles) { - for (var i = this.maxFiles - 1; 0 < i; i--) r.push(function (t) { - return function (r) { - var i = a.join(d.dirname, n + (t - 1) + e + (d.zippedArchive ? '.gz' : '')); - o.exists(i, function (s) { - return s ? void o.rename(i, a.join(d.dirname, n + t + e + (d.zippedArchive ? '.gz' : '')), r) : r(null) - }) - } - }(i)); - d.zippedArchive && (d._archive = a.join(d.dirname, n + 1 + e)), s.series(r, function () { - o.rename(a.join(d.dirname, n + e), a.join(d.dirname, n + 1 + e), t) - }) - } - }, g.prototype._lazyDrain = function () { - var e = this; - !this._draining && this._stream && (this._draining = !0, this._stream.once('drain', function () { - this._draining = !1, e.emit('logged') - })) - } -}, function (e, n) { - var t = n; - t.levels = { - emerg: 0, - alert: 1, - crit: 2, - error: 3, - warning: 4, - notice: 5, - info: 6, - debug: 7 - }, t.colors = { - emerg: 'red', - alert: 'yellow', - crit: 'red', - error: 'red', - warning: 'red', - notice: 'yellow', - info: 'green', - debug: 'blue' - } -}, function (e, n) { - var t = n; - t.levels = { - error: 0, - warn: 1, - info: 2, - verbose: 3, - debug: 4, - silly: 5 - }, t.colors = { - error: 'red', - warn: 'yellow', - info: 'green', - verbose: 'cyan', - debug: 'blue', - silly: 'magenta' - } -}, function (e, n) { - var t = n; - t.levels = { - error: 0, - warn: 1, - help: 2, - data: 3, - info: 4, - debug: 5, - prompt: 6, - verbose: 7, - input: 8, - silly: 9 - }, t.colors = { - error: 'red', - warn: 'yellow', - help: 'cyan', - data: 'grey', - info: 'green', - debug: 'blue', - prompt: 'grey', - verbose: 'cyan', - input: 'grey', - silly: 'magenta' - } -}, function (e, n, t) { - var r = t(13); - e.exports = function () { - var e = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; - return function (n) { - return ' ' === n ? n : r[e[Math.round(Math.random() * (e.length - 1))]](n) - } - }() -}, function (e, n, t) { - var r = t(13); - e.exports = function () { - var e = ['red', 'yellow', 'green', 'blue', 'magenta']; - return function (n, t) { - return ' ' === n ? n : r[e[t++ % e.length]](n) - } - }() -}, function (e, n, t) { - var r = t(13); - e.exports = function (e, n) { - return 0 == n % 2 ? e : r.inverse(e) - } -}, function (e, n, t) { - var r = t(13); - e.exports = function () { - return function (e, n) { - if (' ' === e) return e; - switch (n % 3) { - case 0: - return r.red(e); - case 1: - return r.white(e); - case 2: - return r.blue(e); - } - } - }() -}, function (e) { - e.exports = function (e) { - function n(e) { - var n = Math.floor(Math.random() * e); - return n - } - - function t(e) { - var n = !1; - return i.filter(function (t) { - n = t === e - }), n - } - - function r(e, r) { - var a = '', - s, c; - for (c in r = r || {}, r.up = r.up || !0, r.mid = r.mid || !0, r.down = r.down || !0, r.size = r.size || 'maxi', e = e.split(''), e) - if (!t(c)) { - switch (a += e[c], s = { - up: 0, - down: 0, - mid: 0 - }, r.size) { - case 'mini': - s.up = n(8), s.min = n(2), s.down = n(8); - break; - case 'maxi': - s.up = n(16) + 3, s.min = n(4) + 1, s.down = n(64) + 3; - break; - default: - s.up = n(8) + 1, s.mid = n(6) / 2, s.down = n(8) + 1; - } - var l = ['up', 'mid', 'down']; - for (var p in l) - for (var d = l[p], u = 0; u <= s[d]; u++) r[d] && (a += o[d][n(o[d].length)]) - } return a - } - e = e || ' he is here '; - var o = { - up: ['\u030D', '\u030E', '\u0304', '\u0305', '\u033F', '\u0311', '\u0306', '\u0310', '\u0352', '\u0357', '\u0351', '\u0307', '\u0308', '\u030A', '\u0342', '\u0313', '\u0308', '\u034A', '\u034B', '\u034C', '\u0303', '\u0302', '\u030C', '\u0350', '\u0300', '\u0301', '\u030B', '\u030F', '\u0312', '\u0313', '\u0314', '\u033D', '\u0309', '\u0363', '\u0364', '\u0365', '\u0366', '\u0367', '\u0368', '\u0369', '\u036A', '\u036B', '\u036C', '\u036D', '\u036E', '\u036F', '\u033E', '\u035B', '\u0346', '\u031A'], - down: ['\u0316', '\u0317', '\u0318', '\u0319', '\u031C', '\u031D', '\u031E', '\u031F', '\u0320', '\u0324', '\u0325', '\u0326', '\u0329', '\u032A', '\u032B', '\u032C', '\u032D', '\u032E', '\u032F', '\u0330', '\u0331', '\u0332', '\u0333', '\u0339', '\u033A', '\u033B', '\u033C', '\u0345', '\u0347', '\u0348', '\u0349', '\u034D', '\u034E', '\u0353', '\u0354', '\u0355', '\u0356', '\u0359', '\u035A', '\u0323'], - mid: ['\u0315', '\u031B', '\u0300', '\u0301', '\u0358', '\u0321', '\u0322', '\u0327', '\u0328', '\u0334', '\u0335', '\u0336', '\u035C', '\u035D', '\u035E', '\u035F', '\u0360', '\u0362', '\u0338', '\u0337', '\u0361', ' \u0489'] - }, - i = [].concat(o.up, o.down, o.mid), - a = {}; - return r(e) - } -}, function (e) { - e.exports = function (e) { - var n = ''; - e = e || 'Run the trap, drop the bass', e = e.split(''); - var t = { - a: ['@', '\u0104', '\u023A', '\u0245', '\u0394', '\u039B', '\u0414'], - b: ['\xDF', '\u0181', '\u0243', '\u026E', '\u03B2', '\u0E3F'], - c: ['\xA9', '\u023B', '\u03FE'], - d: ['\xD0', '\u018A', '\u0500', '\u0501', '\u0502', '\u0503'], - e: ['\xCB', '\u0115', '\u018E', '\u0258', '\u03A3', '\u03BE', '\u04BC', '\u0A6C'], - f: ['\u04FA'], - g: ['\u0262'], - h: ['\u0126', '\u0195', '\u04A2', '\u04BA', '\u04C7', '\u050A'], - i: ['\u0F0F'], - j: ['\u0134'], - k: ['\u0138', '\u04A0', '\u04C3', '\u051E'], - l: ['\u0139'], - m: ['\u028D', '\u04CD', '\u04CE', '\u0520', '\u0521', '\u0D69'], - n: ['\xD1', '\u014B', '\u019D', '\u0376', '\u03A0', '\u048A'], - o: ['\xD8', '\xF5', '\xF8', '\u01FE', '\u0298', '\u047A', '\u05DD', '\u06DD', '\u0E4F'], - p: ['\u01F7', '\u048E'], - q: ['\u09CD'], - r: ['\xAE', '\u01A6', '\u0210', '\u024C', '\u0280', '\u042F'], - s: ['\xA7', '\u03DE', '\u03DF', '\u03E8'], - t: ['\u0141', '\u0166', '\u0373'], - u: ['\u01B1', '\u054D'], - v: ['\u05D8'], - w: ['\u0428', '\u0460', '\u047C', '\u0D70'], - x: ['\u04B2', '\u04FE', '\u04FC', '\u04FD'], - y: ['\xA5', '\u04B0', '\u04CB'], - z: ['\u01B5', '\u0240'] - }; - return e.forEach(function (e) { - e = e.toLowerCase(); - var r = t[e] || [' '], - o = Math.floor(Math.random() * r.length); - n += 'undefined' == typeof t[e] ? e : t[e][o] - }), n - } -}, function (e) { - function n(n) { - var t = new Error('Cannot find module "' + n + '".'); - throw t.code = 'MODULE_NOT_FOUND', t - } - n.keys = function () { - return [] - }, n.resolve = n, e.exports = n, n.id = 124 -}, function (e) { - var n = process.argv; - e.exports = function () { - return -1 === n.indexOf('--no-color') && -1 === n.indexOf('--color=false') && (!(-1 === n.indexOf('--color') && -1 === n.indexOf('--color=true') && -1 === n.indexOf('--color=always')) || !process.stdout || process.stdout.isTTY) - }() -}, function (e) { - var n = {}; - e.exports = n; - var t = { - reset: [0, 0], - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29], - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], - grey: [90, 39], - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - blackBG: [40, 49], - redBG: [41, 49], - greenBG: [42, 49], - yellowBG: [43, 49], - blueBG: [44, 49], - magentaBG: [45, 49], - cyanBG: [46, 49], - whiteBG: [47, 49] - }; - Object.keys(t).forEach(function (e) { - var r = t[e], - o = n[e] = []; - o.open = '\x1B[' + r[0] + 'm', o.close = '\x1B[' + r[1] + 'm' - }) -}, function (e, n, t) { - var r = t(13); - e.exports = r -}, function (e) { - e.exports = require('string_decoder') -}, function (module, exports) { - var cycle = exports; - cycle.decycle = function (e) { - 'use strict'; - var n = [], - t = []; - return function e(r, o) { - var a, i, s; - if ('object' == typeof r && null !== r && !(r instanceof Boolean) && !(r instanceof Date) && !(r instanceof Number) && !(r instanceof RegExp) && !(r instanceof String)) { - for (a = 0; a < n.length; a += 1) - if (n[a] === r) return { - $ref: t[a] - }; - if (n.push(r), t.push(o), '[object Array]' === Object.prototype.toString.apply(r)) - for (s = [], a = 0; a < r.length; a += 1) s[a] = e(r[a], o + '[' + a + ']'); - else - for (i in s = {}, r) Object.prototype.hasOwnProperty.call(r, i) && (s[i] = e(r[i], o + '[' + JSON.stringify(i) + ']')); - return s - } - return r - }(e, '$') - }, cycle.retrocycle = function ($) { - 'use strict'; - var px = /^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/; - return function rez(value) { - var i, item, name, path; - if (value && 'object' == typeof value) - if ('[object Array]' === Object.prototype.toString.apply(value)) - for (i = 0; i < value.length; i += 1) item = value[i], item && 'object' == typeof item && (path = item.$ref, 'string' == typeof path && px.test(path) ? value[i] = eval(path) : rez(item)); - else - for (name in value) 'object' == typeof value[name] && (item = value[name], item && (path = item.$ref, 'string' == typeof path && px.test(path) ? value[name] = eval(path) : rez(item))) - }($), $ - } -}, function (e) { - e.exports = require('crypto') -}, function (e, n, t) { - var r = t(14), - o = t(10), - i = t(6), - a = t(9), - s = t(12).Transport, - d = n.Console = function (e) { - s.call(this, e), e = e || {}, this.json = e.json || !1, this.colorize = e.colorize || !1, this.prettyPrint = e.prettyPrint || !1, this.timestamp = 'undefined' != typeof e.timestamp && e.timestamp, this.showLevel = !(e.showLevel !== void 0) || e.showLevel, this.label = e.label || null, this.logstash = e.logstash || !1, this.depth = e.depth || null, this.align = e.align || !1, this.stderrLevels = function (e, n) { - var t = 'Cannot have non-string elements in stderrLevels Array'; - if (n) { - if (e) throw new Error('Cannot set debugStdout and stderrLevels together'); - return a.stringArrayToSet(['error'], t) - } - if (!e) return a.stringArrayToSet(['error', 'debug'], t); - if (!Array.isArray(e)) throw new Error('Cannot set stderrLevels to type other than Array'); - return a.stringArrayToSet(e, t) - }(e.stderrLevels, e.debugStdout), this.eol = e.eol || o.EOL, this.json && (this.stringify = e.stringify || function (e) { - return JSON.stringify(e, null, 2) - }) - }; - i.inherits(d, s), d.prototype.name = 'console', d.prototype.log = function (e, n, t, r) { - if (this.silent) return r(null, !0); - var o = this, - i; - i = a.log({ - colorize: this.colorize, - json: this.json, - level: e, - message: n, - meta: t, - stringify: this.stringify, - timestamp: this.timestamp, - showLevel: this.showLevel, - prettyPrint: this.prettyPrint, - raw: this.raw, - label: this.label, - logstash: this.logstash, - depth: this.depth, - formatter: this.formatter, - align: this.align, - humanReadableUnhandledException: this.humanReadableUnhandledException - }), this.stderrLevels[e] ? process.stderr.write(i + this.eol) : process.stdout.write(i + this.eol), o.emit('logged'), r(null, !0) - } -}, function (e, n, t) { - Object.defineProperty(n, 'Console', { - configurable: !0, - enumerable: !0, - get: function () { - return t(131).Console - } - }), Object.defineProperty(n, 'File', { - configurable: !0, - enumerable: !0, - get: function () { - return t(114).File - } - }), Object.defineProperty(n, 'Http', { - configurable: !0, - enumerable: !0, - get: function () { - return t(112).Http - } - }), Object.defineProperty(n, 'Memory', { - configurable: !0, - enumerable: !0, - get: function () { - return t(109).Memory - } - }) -}, function (e) { - e.exports = { - name: 'winston', - description: 'A multi-transport async logging library for Node.js', - version: '2.3.1', - author: 'Charlie Robbins ', - maintainers: ['Jarrett Cruger ', 'Alberto Pose '], - repository: { - type: 'git', - url: 'https://github.com/winstonjs/winston.git' - }, - keywords: ['winston', 'logging', 'sysadmin', 'tools'], - dependencies: { - async: '~1.0.0', - colors: '1.0.x', - cycle: '1.0.x', - eyes: '0.1.x', - isstream: '0.1.x', - "stack-trace": '0.0.x' - }, - devDependencies: { - "cross-spawn-async": '^2.0.0', - hock: '1.x.x', - "std-mocks": '~1.0.0', - vows: '0.7.x' - }, - main: './lib/winston', - scripts: { - test: 'vows --spec --isolate' - }, - engines: { - node: '>= 0.10.0' - }, - license: 'MIT' - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(48), - o = t(82), - i = global; - i.log = { - error(e, n) { - r.log('error', '[main] ' + o.formatLogMessage(e, n)) - }, - warn(e, n) { - r.log('warn', '[main] ' + o.formatLogMessage(e, n)) - }, - info(e, n) { - r.log('info', '[main] ' + o.formatLogMessage(e, n)) - }, - debug(e, n) { - r.log('debug', '[main] ' + o.formatLogMessage(e, n)) - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e) { - P = !0; - const n = null === L; - L && (L.destroy(), L = null), C.showUncaughtException(n, e) - } - - function o() { - return (E.now() - O) / 1e3 - } - - function i() { - return { - uptime: o().toFixed(3), - time: new Date().toString() - } - } - - function a(e) { - log.info('Processing protocol url'); - const n = y.parseAppURL(e); - c((e) => { - e.focus(), e.sendURLAction(n) - }) - } - - function s(e) { - log.info(`Received possible protocol arguments: ${e.length}`); { - const n = e.filter((e) => { - try { - const n = m.parse(e); - return n.protocol && A.has(n.protocol.slice(0, -1)) - } catch (n) { - return log.error(`Unable to parse argument as URL: ${e}`), !1 - } - }); - e.includes(N) && 1 === n.length ? a(n[0]) : log.error(`Malformed launch arguments received: ${e}`) - } - } - - function d(e) { - p.app.setAsDefaultProtocolClient(e, process.execPath, [N]) - } - - function l() { - const e = new g.AppWindow; - !1, e.onClose(() => { - L = null, P || p.app.quit() - }), e.onDidLoad(() => { - e.show(), e.sendLaunchTimingStats({ - mainReadyTime: F, - loadTime: e.loadTime, - rendererReadyTime: e.rendererReadyTime - }); - const n = T; - T = null; - for (const t of n) t(e) - }), e.load(), L = e - } - - function c(e) { - T ? T.push(e) : L && e(L) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), t(134); - const p = t(4), - u = t(5), - m = t(18), - g = t(71), - f = t(25), - h = t(58), - y = t(57), - _ = t(55), - b = t(27), - S = t(48), - w = t(23), - v = t(53), - x = t(33), - E = t(26), - C = t(52), - k = t(50), - M = t(49); - p.app.setAppLogsPath(), x.enableSourceMaps(); - let L = null; - const O = E.now(); - let P = !1, - F = null, - T = []; - const N = '--protocol-launcher', - A = new Set(['x-github-client']); - A.add('x-github-desktop-auth'), A.add('github-windows'), p.app.on('window-all-closed', () => {}), process.on('uncaughtException', (e) => { - e = x.withSourceMappedStack(e), v.reportError(e, i()), r(e) - }); - let R = !1; - if (1 < process.argv.length) { - const n = process.argv[1], - e = _.handleSquirrelEvent(n); - e ? (R = !0, e.catch((t) => { - log.error(`Failed handling Squirrel event: ${n}`, t) - }).then(() => { - p.app.quit() - })) : s(process.argv) - } - let I = !1; - if (!R) { - const e = p.app.requestSingleInstanceLock(); - I = !e, p.app.on('second-instance', (e, n) => { - L && (L.isMinimized() && L.restore(), !L.isVisible() && L.show(), L.focus()), s(n) - }), I && p.app.quit() - } - h.shellNeedsPatching(process) && h.updateEnvironmentForProcess(), p.app.on('will-finish-launching', () => { - p.app.on('open-url', (e, n) => { - e.preventDefault(), a(n) - }) - }), !1, process.env.GITHUB_DESKTOP_DISABLE_HARDWARE_ACCELERATION && (log.info(`GITHUB_DESKTOP_DISABLE_HARDWARE_ACCELERATION environment variable set, disabling hardware acceleration`), p.app.disableHardwareAcceleration()), p.app.on('ready', () => { - I || R || (F = E.now() - O, A.forEach((e) => d(e)), l(), p.Menu.setApplicationMenu(f.buildDefaultMenu({ - selectedShell: null, - selectedExternalEditor: null, - askForConfirmationOnRepositoryRemoval: !1, - askForConfirmationOnForcePush: !1 - })), p.ipcMain.on('update-preferred-app-menu-item-labels', (e, n) => { - const t = f.buildDefaultMenu(n), - r = p.Menu.getApplicationMenu(); - if (null === r) return p.Menu.setApplicationMenu(t), void(null !== L && L.sendAppMenu()); - let o = !1; - for (const i of f.getAllMenuItems(t)) { - const e = i.id; - if (!e) continue; - const n = r.getMenuItemById(e); - n ? (n.label !== i.label && (o = !0), n.enabled !== i.enabled && (i.enabled = n.enabled, o = !0)) : o = !0 - } - o && L && (p.Menu.setApplicationMenu(t), L.sendAppMenu()) - }), p.ipcMain.on('menu-event', (e) => { - const { - name: n - } = e; - L && L.sendMenuEvent(n) - }), p.ipcMain.on('execute-menu-item', (e, { - id: n - }) => { - const t = p.Menu.getApplicationMenu(); - if (null !== t) { - const r = t.getMenuItemById(n); - if (r) { - const n = p.BrowserWindow.fromWebContents(e.sender), - t = { - preventDefault: () => {}, - sender: e.sender - }; - r.click(t, n, e.sender) - } - } - }), p.ipcMain.on('update-menu-state', (e, n) => { - let t = !1; - const r = p.Menu.getApplicationMenu(); - if (null === r) return void log.debug(`unable to get current menu, bailing out...`); - for (const o of n) { - const { - id: e, - state: n - } = o, i = r.getMenuItemById(e); - i ? n.enabled !== void 0 && i.enabled !== n.enabled && (i.enabled = n.enabled, t = !0) : b.fatalError(`Unknown menu id: ${e}`) - } - t && L && (p.Menu.setApplicationMenu(r), L.sendAppMenu()) - }), p.ipcMain.on('show-contextual-menu', (e, n) => { - const t = k.buildContextMenu(n, (n) => e.sender.send('contextual-menu-action', n)), - r = p.BrowserWindow.fromWebContents(e.sender); - t.popup({ - window: r - }) - }), p.ipcMain.on('get-app-menu', () => { - L && L.sendAppMenu() - }), p.ipcMain.on('show-certificate-trust-dialog', (e, { - certificate: n, - message: t - }) => { - c((e) => { - e.showCertificateTrustDialog(n, t) - }) - }), p.ipcMain.on('log', (e, n, t) => { - S.log(n, t) - }), p.ipcMain.on('uncaught-exception', (e, n) => { - r(n) - }), p.ipcMain.on('send-error-report', (e, { - error: n, - extra: t, - nonFatal: r - }) => { - v.reportError(n, Object.assign({}, i(), t), r) - }), p.ipcMain.on('open-external', async (e, { - path: n - }) => { - const t = n.toLowerCase(); - (t.startsWith('http://') || t.startsWith('https://')) && log.info(`opening in browser: ${n}`); - let r; - try { - await p.shell.openExternal(n), r = !0 - } catch (n) { - log.error(`Call to openExternal failed: '${n}'`), r = !1 - } - e.sender.send('open-external-result', { - result: r - }) - }), p.ipcMain.on('show-item-in-folder', (e, { - path: n - }) => { - u.stat(n, (e, t) => e ? void log.error(`Unable to find file at '${n}'`, e) : void(t.isDirectory() ? w.openDirectorySafe(n) : p.shell.showItemInFolder(n))) - })) - }), p.app.on('activate', () => { - c((e) => { - e.show() - }) - }), p.app.on('web-contents-created', (e, n) => { - n.on('new-window', (e, n) => { - e.preventDefault(); - const t = `Prevented new window to: ${n}`; - log.warn(t), M.sendNonFatalException('newWindowPrevented', Error(t)) - }), n.on('will-navigate', (e, n) => { - e.preventDefault(); - const t = `Prevented navigation to: ${n}`; - log.warn(t), M.sendNonFatalException('willNavigatePrevented', Error(t)) - }) - }), p.app.on('certificate-error', (e, n, t, r, o, i) => { - i(!1), c((e) => { - e.sendCertificateError(o, r, t) }) - }) }]); //# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/OnekeyUIApp/OnekeyUIApp/Resources/renderer.js b/OnekeyUIApp/OnekeyUIApp/Resources/renderer.js index 3da2796..a52f61d 100644 --- a/OnekeyUIApp/OnekeyUIApp/Resources/renderer.js +++ b/OnekeyUIApp/OnekeyUIApp/Resources/renderer.js @@ -1,3746 +1,4098 @@ module.exports = function (e) { - function t(o) { - if (n[o]) return n[o].exports; - var r = n[o] = { - i: o, + var t = {}; + + function n(r) { + if (t[r]) return t[r].exports; + var i = t[r] = { + i: r, l: !1, exports: {} }; - return e[o].call(r.exports, r, r.exports, t), r.l = !0, r.exports + return e[r].call(i.exports, i, i.exports, n), i.l = !0, i.exports } - var n = {}; - return t.m = e, t.c = n, t.d = function (e, n, o) { - t.o(e, n) || Object.defineProperty(e, n, { - configurable: !1, + return n.m = e, n.c = t, n.d = function (e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, - get: o + get: r }) - }, t.r = function (e) { - Object.defineProperty(e, '__esModule', { + }, n.r = function (e) { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { + value: "Module" + }), Object.defineProperty(e, "__esModule", { value: !0 }) - }, t.n = function (e) { - var n = e && e.__esModule ? function () { - return e['default'] + }, n.t = function (e, t) { + if (1 & t && (e = n(e)), 8 & t) return e; + if (4 & t && "object" == typeof e && e && e.__esModule) return e; + var r = Object.create(null); + if (n.r(r), Object.defineProperty(r, "default", { + enumerable: !0, + value: e + }), 2 & t && "string" != typeof e) + for (var i in e) n.d(r, i, function (t) { + return e[t] + }.bind(null, i)); + return r + }, n.n = function (e) { + var t = e && e.__esModule ? function () { + return e.default } : function () { return e }; - return t.d(n, 'a', n), n - }, t.o = function (e, t) { + return n.d(t, "a", t), t + }, n.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) - }, t.p = '', t(t.s = 804) + }, n.p = "", n(n.s = 308) }([function (e, t, n) { - 'use strict'; - e.exports = n(790) -}, function (e) { - e.exports = require('path') + "use strict"; + e.exports = n(148) }, function (e, t) { - 'use strict'; - - function n(e) { - throw new Error(e) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), t.fatalError = n, t.assertNever = function (e, t) { - throw new Error(t) - }, t.forceUnwrap = function (e, t) { - return null == t ? n(e) : t - } -}, function (e, t, n) { - 'use strict'; - - function o(e) { - for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), o(n(510)), o(n(509)), o(n(507)), o(n(207)), o(n(7)), o(n(506)) + e.exports = require("path") }, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); - var o = n(627); - t.Octicon = o.Octicon; - var r = n(233); - t.OcticonSymbol = r.OcticonSymbol; - var i = n(626); - t.iconForRepository = i.iconForRepository; - var a = n(625); - t.iconForStatus = a.iconForStatus + var r = n(220); + t.GitProcess = r.GitProcess; + var i = n(104); + t.GitError = i.GitError, t.RepositoryDoesNotExistErrorCode = i.RepositoryDoesNotExistErrorCode, t.GitNotFoundErrorCode = i.GitNotFoundErrorCode +}, function (e, t, n) { + "use strict"; + e.exports = Object.assign({}, n(95), n(97), n(101), n(175), n(177), n(183), n(17), n(190), n(191), n(192), n(21), n(45)); + const r = n(7); + Object.getOwnPropertyDescriptor(r, "promises") && Object.defineProperty(e.exports, "promises", { + get: () => r.promises + }) }, function (e, t) { - var n, o; + e.exports = require("electron") +}, function (e, t, n) { + var r; /*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ - (function () { - 'use strict'; + ! function () { + "use strict"; + var n = {}.hasOwnProperty; - function r() { - for (var e = [], t = 0, n; t < arguments.length; t++) - if (n = arguments[t], n) { - var o = typeof n; - if ('string' === o || 'number' === o) e.push(n); - else if (Array.isArray(n)) e.push(r.apply(null, n)); - else if ('object' === o) - for (var a in n) i.call(n, a) && n[a] && e.push(a) - } return e.join(' ') - } - var i = {}.hasOwnProperty; - 'undefined' != typeof e && e.exports ? e.exports = r : (n = [], o = function () { - return r - }.apply(t, n), !(o !== void 0 && (e.exports = o))) - })() -}, function (e, t, n) { - 'use strict'; - t.__esModule = !0; - var o = n(139), - r = function (e) { - return e && e.__esModule ? e : { - default: e - } - }(o); - t.default = r.default || function (e) { - for (var t = 1, n; t < arguments.length; t++) - for (var o in n = arguments[t], n) Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]); - return e - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5), - i = n(12); - class a extends o.Component { - constructor() { - super(...arguments), this.onOkButtonClick = (e) => { - this.props.onOkButtonClick !== void 0 && this.props.onOkButtonClick(e); - e.defaultPrevented || !0 === this.props.destructive && (e.preventDefault(), e.currentTarget.form && e.currentTarget.form.dispatchEvent(new Event('submit'))) - }, this.onCancelButtonClick = (e) => { - this.props.onCancelButtonClick !== void 0 && this.props.onCancelButtonClick(e); - e.defaultPrevented || !0 === this.props.destructive && (e.preventDefault(), e.currentTarget.form && e.currentTarget.form.dispatchEvent(new Event('reset'))) - } - } - renderOkButton() { - return o.createElement(i.Button, { - onClick: this.onOkButtonClick, - disabled: this.props.okButtonDisabled, - tooltip: this.props.okButtonTitle, - type: !0 === this.props.destructive ? 'button' : 'submit' - }, this.props.okButtonText || '确定') - } - renderCancelButton() { - return !1 === this.props.cancelButtonVisible ? null : o.createElement(i.Button, { - onClick: this.onCancelButtonClick, - disabled: this.props.cancelButtonDisabled, - tooltip: this.props.cancelButtonTitle, - type: !0 === this.props.destructive ? 'submit' : 'reset' - }, this.props.cancelButtonText || '取消') - } - renderButtons() { - return o.createElement(o.Fragment, null, this.renderOkButton(), this.renderCancelButton()) - } - render() { - const e = r('button-group', this.props.className, { - destructive: !0 === this.props.destructive - }); - return o.createElement('div', { - className: e - }, this.renderButtons(), this.props.children) - } - } - t.OkCancelButtonGroup = a -}, function (e, t) { - 'use strict'; - t.__esModule = !0, t.default = function (e, t) { - if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function') - } -}, function (e, t, n) { - 'use strict'; - t.__esModule = !0; - var o = n(231), - r = function (e) { - return e && e.__esModule ? e : { - default: e + function i() { + for (var e = [], t = 0; t < arguments.length; t++) { + var r = arguments[t]; + if (r) { + var o = typeof r; + if ("string" === o || "number" === o) e.push(r); + else if (Array.isArray(r)) e.push(i.apply(null, r)); + else if ("object" === o) + for (var s in r) n.call(r, s) && r[s] && e.push(s) + } } - }(o); - t.default = function () { - function e(e, t) { - for (var n = 0, o; n < t.length; n++) o = t[n], o.enumerable = o.enumerable || !1, o.configurable = !0, 'value' in o && (o.writable = !0), (0, r.default)(e, o.key, o) - } - return function (t, n, o) { - return n && e(t.prototype, n), o && e(t, o), t + return e.join(" ") } + e.exports ? e.exports = i : void 0 === (r = function () { + return i + }.apply(t, [])) || (e.exports = r) }() }, function (e, t, n) { - 'use strict'; + "use strict"; + Object.defineProperty(t, "__esModule", { + value: !0 + }), + function (e) { + for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) + }(n(218)) +}, function (e, t) { + e.exports = require("fs") +}, function (e, t) { + e.exports = require("child_process") +}, function (e, t) { + e.exports = require("url") +}, , function (e, t, n) { + (function () { + t.Emitter = n(152), t.Disposable = n(60), t.CompositeDisposable = n(153) + }).call(this) +}, function (e, t, n) { + (function (e) { + e.exports = function () { + "use strict"; + var t, n; - function o(e) { - const t = e.headers.get('Link'); - if (!t) return null; - for (const n of t.split(',')) { - const e = n.match(/<([^>]+)>; rel="([^"]+)"/); - if (e && 'next' === e[2]) { - const t = u.parse(e[1]); - return t.path || null + function r() { + return t.apply(null, arguments) } - } - return null - } - function r(e) { - const t = o(e); - if (!t) return null; - const { - pathname: n, - query: r - } = u.parse(t, !0), { - per_page: i, - page: a - } = r, s = 'string' == typeof i ? parseInt(i, 10) : NaN, d = 'string' == typeof a ? parseInt(a, 10) : NaN; - if (!s || !d) return t; - const l = (d - 1) * s, - c = Math.min(100, 2 * s); - return s !== c && 0 == l % c ? (r.per_page = `${c}`, r.page = `${l/c+1}`, u.format({ - pathname: n, - query: r - })) : t - } + function i(e) { + return e instanceof Array || "[object Array]" === Object.prototype.toString.call(e) + } - function i(e) { - return e.toISOString().replace(/\.\d{3}Z$/, 'Z') - } - async function a(e, t, n, o) { - const r = Buffer.from(`${t}:${n}`, 'utf8').toString('base64'), - i = `Basic ${r}`, - a = o ? { - "X-GitHub-OTP": o - } : {}, - d = await s(), - l = await h.request(e, null, 'POST', 'authorizations', { - scopes: c(e), - client_id: v, - client_secret: E, - note: d, - note_url: _, - fingerprint: g.uuid() - }, Object.assign({ - Authorization: i - }, a)); - try { - const e = await h.parsedResponse(l); - if (e) { - const t = e.token; - if (t && 'string' == typeof t && t.length) return { - kind: P.Authorized, - token: t - } + function o(e) { + return null != e && "[object Object]" === Object.prototype.toString.call(e) } - } catch (t) { - if (401 === l.status) { - const e = l.headers.get('x-github-otp'); - if (e) { - const t = e.split(';'); - if (2 === t.length) { - const e = t[1].trim(); - return 'app' === e ? { - kind: P.TwoFactorAuthenticationRequired, - type: f.AuthenticationMode.App - } : 'sms' === e ? { - kind: P.TwoFactorAuthenticationRequired, - type: f.AuthenticationMode.Sms - } : { - kind: P.Failed, - response: l - } - } - } - return { - kind: P.Failed, - response: l - } + + function s(e) { + return void 0 === e } - const e = t instanceof h.APIError && t.apiError; - if (e) { - if (403 === l.status && 'This API can only be accessed with username and password Basic Auth' === e.message) return { - kind: P.PersonalAccessTokenBlocked - }; - if (410 === l.status) return { - kind: P.WebFlowRequired - }; - if (422 === l.status) - if (e.errors) - for (const t of e.errors) { - const e = 'oauthaccess' === t.resource.toLowerCase(), - n = 'user' === t.field.toLowerCase(); - if (n && e) return { - kind: P.UserRequiresVerification - } - } else if ('Invalid OAuth application client_id or secret.' === e.message) return { - kind: P.EnterpriseTooOld - } + + function a(e) { + return "number" == typeof e || "[object Number]" === Object.prototype.toString.call(e) } - } - return { - kind: P.Error, - response: l - } - } - async function s() { - let t = 'unknown'; - try { - t = await b() - } catch (n) { - log.error(`getNote: unable to resolve machine username, using '${t}' as a fallback`, n) - } - return `GitHub Desktop on ${t}@${p.hostname()}` - } - function d(e) { - if (e === l() && !C) return 'https://github.com'; - else { - const t = u.parse(e); - return `${t.protocol}//${t.hostname}` - } - } + function l(e) { + return e instanceof Date || "[object Date]" === Object.prototype.toString.call(e) + } - function l() { - return C && 0 < C.length ? C : 'https://api.github.com' - } + function c(e, t) { + var n, r = []; + for (n = 0; n < e.length; ++n) r.push(t(e[n], n)); + return r + } - function c(e) { - return e === l() ? w : k - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const p = n(63), - u = n(42), - m = n(136), - h = n(179), - f = n(178), - g = n(106), - y = n(105), - S = n(135), - C = process.env.DESKTOP_GITHUB_DOTCOM_API_ENDPOINT, - b = n(773), - v = 'de0e3c7e9973e1c4dd77', - E = '1273305a5fc2737c2ca2911948ba24a9d961e2a3'; - v.length && E && E.length || log.warn(`DESKTOP_OAUTH_CLIENT_ID and/or DESKTOP_OAUTH_CLIENT_SECRET is undefined. You won't be able to authenticate new users.`); - const w = ['repo', 'user', 'workflow'], - k = ['repo', 'user']; - var T; - (function (e) { - e[e.NotModified = 304] = 'NotModified', e[e.NotFound = 404] = 'NotFound' - })(T || (T = {})); - const _ = 'https://desktop.github.com/'; - class R extends Error {} - t.MaxResultsError = R, t.getNextPagePathWithIncreasingPageSize = r; - class x { - static fromAccount(e) { - return new x(e.endpoint, e.token) - } - constructor(e, t) { - this.endpoint = e, this.token = t - } - async fetchRepository(t, n) { - try { - const e = await this.request('GET', `repos/${t}/${n}`); - return e.status === T.NotFound ? (log.warn(`fetchRepository: '${t}/${n}' returned a 404`), null) : await h.parsedResponse(e) - } catch (o) { - return log.warn(`fetchRepository: an error occurred for '${t}/${n}'`, o), null + function u(e, t) { + return Object.prototype.hasOwnProperty.call(e, t) } - } - async fetchRepositories() { - try { - const e = await this.fetchAll('user/repos'); - return e.filter((e) => null !== e.owner) - } catch (e) { - return log.warn(`fetchRepositories: ${e}`), null + + function h(e, t) { + for (var n in t) u(t, n) && (e[n] = t[n]); + return u(t, "toString") && (e.toString = t.toString), u(t, "valueOf") && (e.valueOf = t.valueOf), e } - } - async fetchAccount() { - try { - const e = await this.request('GET', 'user'), - t = await h.parsedResponse(e); - return t - } catch (t) { - throw log.warn(`fetchAccount: failed with endpoint ${this.endpoint}`, t), t + + function p(e, t, n, r) { + return Et(e, t, n, r, !0).utc() } - } - async fetchEmails() { - try { - const e = await this.request('GET', 'user/emails'), - t = await h.parsedResponse(e); - return Array.isArray(t) ? t : [] - } catch (t) { - return log.warn(`fetchEmails: failed with endpoint ${this.endpoint}`, t), [] + + function d(e) { + return null == e._pf && (e._pf = { + empty: !1, + unusedTokens: [], + unusedInput: [], + overflow: -2, + charsLeftOver: 0, + nullInput: !1, + invalidMonth: null, + invalidFormat: !1, + userInvalidated: !1, + iso: !1, + parsedDateParts: [], + meridiem: null, + rfc2822: !1, + weekdayMismatch: !1 + }), e._pf } - } - async fetchCommit(t, n, o) { - try { - const e = `repos/${t}/${n}/commits/${o}`, - r = await this.request('GET', e); - return r.status === T.NotFound ? (log.warn(`fetchCommit: '${e}' returned a 404`), null) : await h.parsedResponse(r) - } catch (r) { - return log.warn(`fetchCommit: returned an error '${t}/${n}@${o}'`, r), null + + function f(e) { + if (null == e._isValid) { + var t = d(e), + r = n.call(t.parsedDateParts, (function (e) { + return null != e + })), + i = !isNaN(e._d.getTime()) && t.overflow < 0 && !t.empty && !t.invalidMonth && !t.invalidWeekday && !t.weekdayMismatch && !t.nullInput && !t.invalidFormat && !t.userInvalidated && (!t.meridiem || t.meridiem && r); + if (e._strict && (i = i && 0 === t.charsLeftOver && 0 === t.unusedTokens.length && void 0 === t.bigHour), null != Object.isFrozen && Object.isFrozen(e)) return i; + e._isValid = i + } + return e._isValid } - } - async searchForUserWithEmail(t) { - if (0 === t.length) return null; - try { - const e = { - q: `${t} in:email type:user` - }, - n = h.urlWithQueryString('search/users', e), - o = await this.request('GET', n), - r = await h.parsedResponse(o), - i = r.items; - return i.length ? i[0] : null - } catch (n) { - return log.warn(`searchForUserWithEmail: not found '${t}'`, n), null + + function m(e) { + var t = p(NaN); + return null != e ? h(d(t), e) : d(t).userInvalidated = !0, t } - } - async fetchOrgs() { - try { - return await this.fetchAll('user/orgs') - } catch (t) { - return log.warn(`fetchOrgs: failed with endpoint ${this.endpoint}`, t), [] + n = Array.prototype.some ? Array.prototype.some : function (e) { + for (var t = Object(this), n = t.length >>> 0, r = 0; r < n; r++) + if (r in t && e.call(this, t[r], r, t)) return !0; + return !1 + }; + var g = r.momentProperties = []; + + function y(e, t) { + var n, r, i; + if (s(t._isAMomentObject) || (e._isAMomentObject = t._isAMomentObject), s(t._i) || (e._i = t._i), s(t._f) || (e._f = t._f), s(t._l) || (e._l = t._l), s(t._strict) || (e._strict = t._strict), s(t._tzm) || (e._tzm = t._tzm), s(t._isUTC) || (e._isUTC = t._isUTC), s(t._offset) || (e._offset = t._offset), s(t._pf) || (e._pf = d(t)), s(t._locale) || (e._locale = t._locale), g.length > 0) + for (n = 0; n < g.length; n++) s(i = t[r = g[n]]) || (e[r] = i); + return e } - } - async createRepository(t, e, n, o) { - try { - const r = t ? `orgs/${t.login}/repos` : 'user/repos', - i = await this.request('POST', r, { - name: e, - description: n, - private: o - }); - return await h.parsedResponse(i) - } catch (n) { - if (n instanceof h.APIError) { - if (null !== t) throw new Error(`Unable to create repository for organization '${t.login}'. Verify that the repository does not already exist and that you have permission to create a repository there.`); - throw n - } - throw log.error(`createRepository: failed with endpoint ${this.endpoint}`, n), new Error(`Unable to publish repository. Please check if you have an internet connection and try again.`) + var v = !1; + + function w(e) { + y(this, e), this._d = new Date(null != e._d ? e._d.getTime() : NaN), this.isValid() || (this._d = new Date(NaN)), !1 === v && (v = !0, r.updateOffset(this), v = !1) } - } - async forkRepository(t, n) { - try { - const e = `/repos/${t}/${n}/forks`, - o = await this.request('POST', e); - return await h.parsedResponse(o) - } catch (o) { - throw log.error(`forkRepository: failed to fork ${t}/${n} at endpoint: ${this.endpoint}`, o), o + + function b(e) { + return e instanceof w || null != e && null != e._isAMomentObject } - } - async fetchIssues(t, n, e, o) { - const r = { - state: e - }; - o && !isNaN(o.getTime()) && (r.since = i(o)); - const a = h.urlWithQueryString(`repos/${t}/${n}/issues`, r); - try { - const e = await this.fetchAll(a); - return e.filter((e) => !e.pullRequest) - } catch (o) { - throw log.warn(`fetchIssues: failed for repository ${t}/${n}`, o), o + + function S(e) { + return e < 0 ? Math.ceil(e) || 0 : Math.floor(e) } - } - async fetchAllOpenPullRequests(t, n) { - const e = h.urlWithQueryString(`repos/${t}/${n}/pulls`, { - state: 'open' - }); - try { - return await this.fetchAll(e) - } catch (o) { - throw log.warn(`failed fetching open PRs for repository ${t}/${n}`, o), o + + function C(e) { + var t = +e, + n = 0; + return 0 !== t && isFinite(t) && (n = S(t)), n } - } - async fetchUpdatedPullRequests(t, n, e, o = 320) { - const i = e.getTime(), - a = h.urlWithQueryString(`repos/${t}/${n}/pulls`, { - state: 'all', - sort: 'updated', - direction: 'desc' - }); - try { - const e = await this.fetchAll(a, { - perPage: 10, - getNextPagePath: r, - continue (e) { - if (e.length >= o) throw new R('got max pull requests, aborting'); - const t = e[e.length - 1]; - return t !== void 0 && Date.parse(t.updated_at) > i - }, - suppressErrors: !1 - }); - return e.filter((e) => Date.parse(e.updated_at) >= i) - } catch (o) { - throw log.warn(`failed fetching updated PRs for repository ${t}/${n}`, o), o + + function E(e, t, n) { + var r, i = Math.min(e.length, t.length), + o = Math.abs(e.length - t.length), + s = 0; + for (r = 0; r < i; r++)(n && e[r] !== t[r] || !n && C(e[r]) !== C(t[r])) && s++; + return s + o } - } - async fetchPullRequest(t, n, o) { - try { - const e = `/repos/${t}/${n}/pulls/${o}`, - r = await this.request('GET', e); - return await h.parsedResponse(r) - } catch (r) { - throw log.warn(`failed fetching PR for ${t}/${n}/pulls/${o}`, r), r + + function k(e) { + !1 === r.suppressDeprecationWarnings && "undefined" != typeof console && console.warn && console.warn("Deprecation warning: " + e) } - } - async fetchCombinedRefStatus(e, t, n) { - const o = `repos/${e}/${t}/commits/${n}/status`, - r = await this.request('GET', o); - return await h.parsedResponse(r) - } - async fetchPushControl(e, t, n) { - const o = `repos/${e}/${t}/branches/${encodeURIComponent(n)}/push_control`; - try { - const e = await this.request('GET', o, void 0, { - Accept: 'application/vnd.github.phandalin-preview' - }); - return await h.parsedResponse(e) - } catch (e) { - return log.info(`[fetchPushControl] unable to check if branch is potentially pushable`, e), { - pattern: null, - required_signatures: !1, - required_status_checks: [], - required_approving_review_count: 0, - required_linear_history: !1, - allow_actor: !0, - allow_deletions: !0, - allow_force_pushes: !0 - } + + function x(e, t) { + var n = !0; + return h((function () { + if (null != r.deprecationHandler && r.deprecationHandler(null, e), n) { + for (var i, o = [], s = 0; s < arguments.length; s++) { + if (i = "", "object" == typeof arguments[s]) { + for (var a in i += "\n[" + s + "] ", arguments[0]) i += a + ": " + arguments[0][a] + ", "; + i = i.slice(0, -2) + } else i = arguments[s]; + o.push(i) + } + k(e + "\nArguments: " + Array.prototype.slice.call(o).join("") + "\n" + (new Error).stack), n = !1 + } + return t.apply(this, arguments) + }), t) } - } - async fetchProtectedBranches(e, t) { - const n = `repos/${e}/${t}/branches?protected=true`; - try { - const e = await this.request('GET', n); - return await h.parsedResponse(e) - } catch (e) { - return log.info(`[fetchProtectedBranches] unable to list protected branches`, e), [] + var T, R = {}; + + function D(e, t) { + null != r.deprecationHandler && r.deprecationHandler(e, t), R[e] || (k(t), R[e] = !0) } - } - async fetchAll(e, t) { - const n = [], - r = Object.assign({ - perPage: 100 - }, t), - i = { - per_page: `${r.perPage}` - }; - let a = h.urlWithQueryString(e, i); - do { - const t = await this.request('GET', a); - if (!1 !== r.suppressErrors && !t.ok) return log.warn(`fetchAll: '${e}' returned a ${t.status}`), n; - const i = await h.parsedResponse(t); - i && n.push(...i), a = r.getNextPagePath ? r.getNextPagePath(t) : o(t) - } while (a && (!r.continue || r.continue(n))); - return n - } - request(e, t, n, o) { - return h.request(this.endpoint, this.token, e, t, n, o) - } - async getFetchPollInterval(t, n) { - const e = `repos/${t}/${n}/git`; - try { - const t = await this.request('HEAD', e), - n = t.headers.get('x-poll-interval'); - if (n) { - const e = parseInt(n, 10); - return isNaN(e) ? null : e - } - return null - } catch (o) { - return log.warn(`getFetchPollInterval: failed for ${t}/${n}`, o), null + + function _(e) { + return e instanceof Function || "[object Function]" === Object.prototype.toString.call(e) } - } - async fetchMentionables(t, n, e) { - const o = { - Accept: 'application/vnd.github.jerry-maguire-preview' + + function A(e, t) { + var n, r = h({}, e); + for (n in t) u(t, n) && (o(e[n]) && o(t[n]) ? (r[n] = {}, h(r[n], e[n]), h(r[n], t[n])) : null != t[n] ? r[n] = t[n] : delete r[n]); + for (n in e) u(e, n) && !u(t, n) && o(e[n]) && (r[n] = h({}, r[n])); + return r + } + + function M(e) { + null != e && this.set(e) + } + r.suppressDeprecationWarnings = !1, r.deprecationHandler = null, T = Object.keys ? Object.keys : function (e) { + var t, n = []; + for (t in e) u(e, t) && n.push(t); + return n }; - e && (o['If-None-Match'] = e); - try { - const e = `repos/${t}/${n}/mentionables/users`, - r = await this.request('GET', e, void 0, o); - if (r.status === T.NotFound) return log.warn(`fetchMentionables: '${e}' returned a 404`), null; - if (r.status === T.NotModified) return null; - const i = await h.parsedResponse(r), - a = r.headers.get('etag'); - return { - users: i, - etag: a + var P = {}; + + function I(e, t) { + var n = e.toLowerCase(); + P[n] = P[n + "s"] = P[t] = e + } + + function O(e) { + return "string" == typeof e ? P[e] || P[e.toLowerCase()] : void 0 + } + + function L(e) { + var t, n, r = {}; + for (n in e) u(e, n) && (t = O(n)) && (r[t] = e[n]); + return r + } + var N = {}; + + function F(e, t) { + N[e] = t + } + + function B(e, t, n) { + var r = "" + Math.abs(e), + i = t - r.length; + return (e >= 0 ? n ? "+" : "" : "-") + Math.pow(10, Math.max(0, i)).toString().substr(1) + r + } + var H = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, + z = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, + U = {}, + W = {}; + + function V(e, t, n, r) { + var i = r; + "string" == typeof r && (i = function () { + return this[r]() + }), e && (W[e] = i), t && (W[t[0]] = function () { + return B(i.apply(this, arguments), t[1], t[2]) + }), n && (W[n] = function () { + return this.localeData().ordinal(i.apply(this, arguments), e) + }) + } + + function j(e, t) { + return e.isValid() ? (t = G(t, e.localeData()), U[t] = U[t] || function (e) { + var t, n, r, i = e.match(H); + for (t = 0, n = i.length; t < n; t++) W[i[t]] ? i[t] = W[i[t]] : i[t] = (r = i[t]).match(/\[[\s\S]/) ? r.replace(/^\[|\]$/g, "") : r.replace(/\\/g, ""); + return function (t) { + var r, o = ""; + for (r = 0; r < n; r++) o += _(i[r]) ? i[r].call(t, e) : i[r]; + return o + } + }(t), U[t](e)) : e.localeData().invalidDate() + } + + function G(e, t) { + var n = 5; + + function r(e) { + return t.longDateFormat(e) || e } - } catch (o) { - return log.warn(`fetchMentionables: failed for ${t}/${n}`, o), null + for (z.lastIndex = 0; n >= 0 && z.test(e);) e = e.replace(z, r), z.lastIndex = 0, n -= 1; + return e } - } - async fetchUser(e) { - try { - const t = await this.request('GET', `users/${encodeURIComponent(e)}`); - return 404 === t.status ? null : await h.parsedResponse(t) - } catch (t) { - throw log.warn(`fetchUser: failed with endpoint ${this.endpoint}`, t), t + var $ = /\d/, + q = /\d\d/, + K = /\d{3}/, + Y = /\d{4}/, + Q = /[+-]?\d{6}/, + Z = /\d\d?/, + X = /\d\d\d\d?/, + J = /\d\d\d\d\d\d?/, + ee = /\d{1,3}/, + te = /\d{1,4}/, + ne = /[+-]?\d{1,6}/, + re = /\d+/, + ie = /[+-]?\d+/, + oe = /Z|[+-]\d\d:?\d\d/gi, + se = /Z|[+-]\d\d(?::?\d\d)?/gi, + ae = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, + le = {}; + + function ce(e, t, n) { + le[e] = _(t) ? t : function (e, r) { + return e && n ? n : t + } } - } - } - t.API = x; - var P; - (function (e) { - e[e.Authorized = 0] = 'Authorized', e[e.Failed = 1] = 'Failed', e[e.TwoFactorAuthenticationRequired = 2] = 'TwoFactorAuthenticationRequired', e[e.UserRequiresVerification = 3] = 'UserRequiresVerification', e[e.PersonalAccessTokenBlocked = 4] = 'PersonalAccessTokenBlocked', e[e.Error = 5] = 'Error', e[e.EnterpriseTooOld = 6] = 'EnterpriseTooOld', e[e.WebFlowRequired = 7] = 'WebFlowRequired' - })(P = t.AuthorizationResponseKind || (t.AuthorizationResponseKind = {})), t.createAuthorization = a, t.fetchUser = async function (t, e) { - const n = new x(t, e); - try { - const o = await n.fetchAccount(), - r = await n.fetchEmails(), - i = S.getDefaultEmail(r), - a = y.getAvatarWithEnterpriseFallback(o.avatar_url, i, t); - return new m.Account(o.login, t, e, r, a, o.id, o.name || o.login) - } catch (n) { - throw log.warn(`fetchUser: failed with endpoint ${t}`, n), n - } - }, t.fetchMetadata = async function (e) { - const t = `${e}/meta`; - try { - const t = await h.request(e, null, 'GET', 'meta', void 0, { - "Content-Type": 'application/json' - }), - n = await h.parsedResponse(t); - return n && void 0 !== n.verifiable_password_authentication ? n : null - } catch (n) { - return log.error(`fetchMetadata: unable to load metadata from '${t}' as a fallback`, n), null - } - }, t.getEndpointForRepository = function (e) { - const t = u.parse(e); - return 'github.com' === t.hostname ? l() : `${t.protocol}//${t.hostname}/api` - }, t.getHTMLURL = d, t.getEnterpriseAPIURL = function (e) { - const t = u.parse(e); - return `${t.protocol}//${t.hostname}/api/v3` - }, t.getDotComAPIEndpoint = l, t.getAccountForEndpoint = function (e, t) { - return e.find((e) => e.endpoint === t) || null - }, t.getOAuthAuthorizationURL = function (e, t) { - const n = d(e), - o = c(e), - r = encodeURIComponent(o.join(' ')); - return `${n}/login/oauth/authorize?client_id=${v}&scope=${r}&state=${t}` - }, t.requestOAuthToken = async function (t, e) { - try { - const n = d(t), - o = await h.request(n, null, 'POST', 'login/oauth/access_token', { - client_id: v, - client_secret: E, - code: e - }), - r = await h.parsedResponse(o); - return r.access_token - } catch (n) { - return log.warn(`requestOAuthToken: failed with endpoint ${t}`, n), null - } - } -}, function (e, t, n) { - 'use strict'; - function o(e) { - const t = e.gitErrorDescription; - return t ? t : e.stderr.length ? e.stderr : e.stdout.length ? e.stdout : 'Unknown error' - } + function ue(e, t) { + return u(le, e) ? le[e](t._strict, t._locale) : new RegExp(he(e.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, (function (e, t, n, r, i) { + return t || n || r || i + })))) + } - function r(e) { - return !(e !== a.GitError.SSHAuthenticationFailed && e !== a.GitError.SSHPermissionDenied && e !== a.GitError.HTTPSAuthenticationFailed) - } + function he(e) { + return e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") + } + var pe = {}; - function i(e) { - if (r(e)) { - const e = 'File > Options.'; - return `Authentication failed. Some common reasons include: + function de(e, t) { + var n, r = t; + for ("string" == typeof e && (e = [e]), a(t) && (r = function (e, n) { + n[t] = C(e) + }), n = 0; n < e.length; n++) pe[e[n]] = r + } -- You are not logged in to your account: see ${e} -- You may need to log out and log back in to refresh your token. -- You do not have permission to access this repository. -- The repository is archived on GitHub. Check the repository settings to confirm you are still permitted to push commits. -- If you use SSH authentication, check that your key is added to the ssh-agent and associated with your account.` - } - return e === a.GitError.SSHKeyAuditUnverified ? 'The SSH key is unverified.' : e === a.GitError.RemoteDisconnection ? 'The remote disconnected. Check your Internet connection and try again.' : e === a.GitError.HostDown ? 'The host is down. Check your Internet connection and try again.' : e === a.GitError.RebaseConflicts ? 'We found some conflicts while trying to rebase. Please resolve the conflicts before continuing.' : e === a.GitError.MergeConflicts ? 'We found some conflicts while trying to merge. Please resolve the conflicts and commit the changes.' : e === a.GitError.HTTPSRepositoryNotFound || e === a.GitError.SSHRepositoryNotFound ? 'The repository does not seem to exist anymore. You may not have access, or it may have been deleted or renamed.' : e === a.GitError.PushNotFastForward ? 'The repository has been updated since you last pulled. Try pulling before pushing.' : e === a.GitError.BranchDeletionFailed ? 'Could not delete the branch. It was probably already deleted.' : e === a.GitError.DefaultBranchDeletionFailed ? `The branch is the repository's default branch and cannot be deleted.` : e === a.GitError.RevertConflicts ? 'To finish reverting, please merge and commit the changes.' : e === a.GitError.EmptyRebasePatch ? 'There aren\u2019t any changes left to apply.' : e === a.GitError.NoMatchingRemoteBranch ? 'There aren\u2019t any remote branches that match the current branch.' : e === a.GitError.NothingToCommit ? 'There are no changes to commit.' : e === a.GitError.NoSubmoduleMapping ? 'A submodule was removed from .gitmodules, but the folder still exists in the repository. Delete the folder, commit the change, then try again.' : e === a.GitError.SubmoduleRepositoryDoesNotExist ? 'A submodule points to a location which does not exist.' : e === a.GitError.InvalidSubmoduleSHA ? 'A submodule points to a commit which does not exist.' : e === a.GitError.LocalPermissionDenied ? 'Permission denied.' : e === a.GitError.InvalidMerge ? 'This is not something we can merge.' : e === a.GitError.InvalidRebase ? 'This is not something we can rebase.' : e === a.GitError.NonFastForwardMergeIntoEmptyHead ? 'The merge you attempted is not a fast-forward, so it cannot be performed on an empty branch.' : e === a.GitError.PatchDoesNotApply ? 'The requested changes conflict with one or more files in the repository.' : e === a.GitError.BranchAlreadyExists ? 'A branch with that name already exists.' : e === a.GitError.BadRevision ? 'Bad revision.' : e === a.GitError.NotAGitRepository ? 'This is not a git repository.' : e === a.GitError.ProtectedBranchForcePush ? 'This branch is protected from force-push operations.' : e === a.GitError.ProtectedBranchRequiresReview ? 'This branch is protected and any changes requires an approved review. Open a pull request with changes targeting this branch instead.' : e === a.GitError.PushWithFileSizeExceedingLimit ? 'The push operation includes a file which exceeds GitHub\'s file size restriction of 100MB. Please remove the file from history and try again.' : e === a.GitError.HexBranchNameRejected ? 'The branch name cannot be a 40-character string of hexadecimal characters, as this is the format that Git uses for representing objects.' : e === a.GitError.ForcePushRejected ? 'The force push has been rejected for the current branch.' : e === a.GitError.InvalidRefLength ? 'A ref cannot be longer than 255 characters.' : e === a.GitError.CannotMergeUnrelatedHistories ? 'Unable to merge unrelated histories in this repository.' : e === a.GitError.PushWithPrivateEmail ? 'Cannot push these commits as they contain an email address marked as private on GitHub.' : e === a.GitError.LFSAttributeDoesNotMatch ? 'Git LFS attribute found in global Git configuration does not match expected value.' : e === a.GitError.ProtectedBranchDeleteRejected ? 'This branch cannot be deleted from the remote repository because it is marked as protected.' : e === a.GitError.ProtectedBranchRequiredStatus ? 'The push was rejected by the remote server because a required status check has not been satisfied.' : e === a.GitError.BranchRenameFailed ? 'The branch could not be renamed.' : e === a.GitError.PathDoesNotExist ? 'The path does not exist on disk.' : e === a.GitError.InvalidObjectName ? 'The object was not found in the Git repository.' : e === a.GitError.OutsideRepository ? 'This path is not a valid path inside the repository.' : e === a.GitError.LockFileAlreadyExists ? 'A lock file already exists in the repository, which blocks this operation from completing.' : e === a.GitError.NoMergeToAbort ? 'There is no merge in progress, so there is nothing to abort.' : e === a.GitError.NoExistingRemoteBranch ? 'The remote branch does not exist.' : e === a.GitError.LocalChangesOverwritten ? 'Unable to switch branches as there are working directory changes which would be overwritten. Please commit or stash your changes.' : e === a.GitError.UnresolvedConflicts ? 'There are unresolved conflicts in the working directory.' : e === a.GitError.ConfigLockFileAlreadyExists ? null : e === a.GitError.RemoteAlreadyExists ? null : e === a.GitError.TagAlreadyExists ? 'A tag with that name already exists' : s.assertNever(e, `Unknown error: ${e}`) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const a = n(35), - s = n(2), - d = n(10), - l = n(172), - c = n(1), - p = n(84), - u = n(270); - class m extends Error { - constructor(e, t) { - super(o(e)), this.name = 'GitError', this.result = e, this.args = t - } - } - t.GitError = m, t.git = async function (e, t, n, o) { - const r = { - successExitCodes: new Set([0]), - expectedErrors: new Set - }, - s = Object.assign({}, r, o); - s.env = Object.assign({ - TERM: 'dumb' - }, s.env); - const d = `${n}: git ${e.join(' ')}`, - c = await l.measure(d, () => a.GitProcess.exec(e, t, s)).catch((e) => { - if (u.isErrnoException(e)) throw new Error(`Failed to execute ${n}: ${e.code}`); - throw e - }), - p = c.exitCode; - let h = null; - const f = !!s.successExitCodes && s.successExitCodes.has(p); - f || (h = a.GitProcess.parseError(c.stderr), !h && (h = a.GitProcess.parseError(c.stdout))); - const g = h ? i(h) : null, - y = Object.assign({}, c, { - gitError: h, - gitErrorDescription: g, - path: t - }); - let S = !0; - if (h && s.expectedErrors && (S = s.expectedErrors.has(h)), h && S || f) return y; - const C = []; - throw C.push(`\`git ${e.join(' ')}\` exited with an unexpected code: ${p}.`), c.stdout && (C.push('stdout:'), C.push(c.stdout)), c.stderr && (C.push('stderr:'), C.push(c.stderr)), h && C.push(`(The error was parsed as ${h}: ${g})`), log.error(C.join('\n')), new m(y, e) - }, t.isAuthFailureError = r, t.isConfigFileLockError = function (e) { - return e instanceof m && e.result.gitError === a.GitError.ConfigLockFileAlreadyExists - }; - const h = /^error: could not lock config file (.+?): File exists$/m; - t.parseConfigLockFilePathFromError = function (e) { - const t = h.exec(e.stderr); - if (null === t) return null; - const n = t[1].replace('/', '\\'); - return c.resolve(e.path, `${n}.lock`) - }, t.gitNetworkArguments = async function (e, t) { - const n = ['-c', 'credential.helper=']; - if (null === t) return n; - const o = t.endpoint === d.getDotComAPIEndpoint(); - if (!o) return n; - const r = 'protocol.version', - i = null == e ? await p.getGlobalConfigValue(r) : await p.getConfigValue(e, r); - return null === i ? [...n, '-c', 'protocol.version=2'] : n - }, t.parseCommitSHA = function (e) { - return e.stdout.split(']')[0].split(' ')[1] - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5); - class i extends o.Component { - constructor() { - super(...arguments), this.innerButton = null, this.onButtonRef = (e) => { - this.innerButton = e, this.props.onButtonRef && this.props.onButtonRef(e) - }, this.focus = () => { - this.innerButton && this.innerButton.focus() - }, this.getBoundingClientRect = () => this.innerButton ? this.innerButton.getBoundingClientRect() : void 0, this.onClick = (e) => { - this.props.onClick && this.props.onClick(e), this.props.type === void 0 && e.preventDefault() + function fe(e, t) { + de(e, (function (e, n, r, i) { + r._w = r._w || {}, t(e, r._w, r, i) + })) } - } - blur() { - this.innerButton && this.innerButton.blur() - } - render() { - const e = r('button-component', { - "small-button": 'small' === this.props.size - }, this.props.className); - return o.createElement('button', { - className: e, - disabled: this.props.disabled, - onClick: this.onClick, - type: this.props.type || 'button', - ref: this.onButtonRef, - tabIndex: this.props.tabIndex, - onMouseEnter: this.props.onMouseEnter, - title: this.props.tooltip, - role: this.props.role, - "aria-expanded": this.props.ariaExpanded, - "aria-haspopup": this.props.ariaHasPopup - }, this.props.children) - } - } - t.Button = i -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(40), - i = n(5); - class a extends o.Component { - constructor() { - super(...arguments), this.onClick = (e) => { - if (e.preventDefault(), !this.props.disabled) { - const e = this.props.uri; - e && r.shell.openExternal(e); - const t = this.props.onClick; - t && t() + + function me(e, t, n) { + null != t && u(pe, e) && pe[e](t, n._a, n, e) + } + + function ge(e) { + return ye(e) ? 366 : 365 + } + + function ye(e) { + return e % 4 == 0 && e % 100 != 0 || e % 400 == 0 + } + V("Y", 0, 0, (function () { + var e = this.year(); + return e <= 9999 ? "" + e : "+" + e + })), V(0, ["YY", 2], 0, (function () { + return this.year() % 100 + })), V(0, ["YYYY", 4], 0, "year"), V(0, ["YYYYY", 5], 0, "year"), V(0, ["YYYYYY", 6, !0], 0, "year"), I("year", "y"), F("year", 1), ce("Y", ie), ce("YY", Z, q), ce("YYYY", te, Y), ce("YYYYY", ne, Q), ce("YYYYYY", ne, Q), de(["YYYYY", "YYYYYY"], 0), de("YYYY", (function (e, t) { + t[0] = 2 === e.length ? r.parseTwoDigitYear(e) : C(e) + })), de("YY", (function (e, t) { + t[0] = r.parseTwoDigitYear(e) + })), de("Y", (function (e, t) { + t[0] = parseInt(e, 10) + })), r.parseTwoDigitYear = function (e) { + return C(e) + (C(e) > 68 ? 1900 : 2e3) + }; + var ve, we = be("FullYear", !0); + + function be(e, t) { + return function (n) { + return null != n ? (Ce(this, e, n), r.updateOffset(this, t), this) : Se(this, e) } } - } - render() { - const e = this.props.uri || '', - t = i('link-button-component', this.props.className); - return o.createElement('a', { - className: t, - href: e, - onClick: this.onClick, - title: this.props.title, - tabIndex: this.props.tabIndex - }, this.props.children) - } - } - t.LinkButton = a -}, function (e, t, n) { - 'use strict'; - t.__esModule = !0; - var o = n(230), - r = function (e) { - return e && e.__esModule ? e : { - default: e + + function Se(e, t) { + return e.isValid() ? e._d["get" + (e._isUTC ? "UTC" : "") + t]() : NaN } - }(o); - t.default = function (e, t) { - if (!e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); - return t && ('object' === ('undefined' == typeof t ? 'undefined' : (0, r.default)(t)) || 'function' == typeof t) ? t : e - } -}, function (e, t, n) { - e.exports = n(785)() -}, function (e, t, n) { - 'use strict'; - function o(e) { - return e && e.__esModule ? e : { - default: e - } - } - t.__esModule = !0; - var r = n(597), - i = o(r), - a = n(593), - s = o(a), - d = n(230), - l = o(d); - t.default = function (e, t) { - if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function, not ' + ('undefined' == typeof t ? 'undefined' : (0, l.default)(t))); - e.prototype = (0, s.default)(t && t.prototype, { - constructor: { - value: e, - enumerable: !1, - writable: !0, - configurable: !0 + function Ce(e, t, n) { + e.isValid() && !isNaN(n) && ("FullYear" === t && ye(e.year()) && 1 === e.month() && 29 === e.date() ? e._d["set" + (e._isUTC ? "UTC" : "") + t](n, e.month(), Ee(n, e.month())) : e._d["set" + (e._isUTC ? "UTC" : "") + t](n)) } - }), t && (i.default ? (0, i.default)(e, t) : e.__proto__ = t) - } -}, function (e, t, n) { - e.exports = { - default: n(617), - __esModule: !0 - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5); - class i extends o.Component { - render() { - const e = r('row-component', this.props.className); - return o.createElement('div', { - className: e - }, this.props.children) - } - } - t.Row = i -}, function (e, t, n) { - 'use strict'; - e.exports = Object.assign({}, n(290), n(287), n(283), n(740), n(738), n(732), n(41), n(728), n(727), n(726), n(53), n(133)); - const o = n(33); - Object.getOwnPropertyDescriptor(o, 'promises') && Object.defineProperty(e.exports, 'promises', { - get() { - return o.promises - } - }) -}, function (e, t, n) { - 'use strict'; - function o(e) { - for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), o(n(266)), o(n(706)), o(n(702)), o(n(695)), o(n(694)), o(n(84)), o(n(11)), o(n(255)), o(n(171)), o(n(693)), o(n(263)), o(n(20)), o(n(692)), o(n(254)), o(n(691)), o(n(690)), o(n(689)), o(n(262)), o(n(260)), o(n(258)), o(n(168)), o(n(688)), o(n(251)), o(n(261)), o(n(683)), o(n(250)), o(n(682)), o(n(681)), o(n(680)), o(n(678)), o(n(677)), o(n(128)), o(n(675)), o(n(249)), o(n(674)), o(n(673)), o(n(670)) -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0); - class r extends o.Component { - render() { - return o.createElement('em', { - className: 'ref-component' - }, this.props.children) - } - } - t.Ref = r -}, function (e) { - e.exports = require('electron') -}, function (e, t, n) { - 'use strict'; + function Ee(e, t) { + if (isNaN(e) || isNaN(t)) return NaN; + var n, r = (t % (n = 12) + n) % n; + return e += (t - r) / 12, 1 === r ? ye(e) ? 29 : 28 : 31 - r % 7 % 2 + } + ve = Array.prototype.indexOf ? Array.prototype.indexOf : function (e) { + var t; + for (t = 0; t < this.length; ++t) + if (this[t] === e) return t; + return -1 + }, V("M", ["MM", 2], "Mo", (function () { + return this.month() + 1 + })), V("MMM", 0, 0, (function (e) { + return this.localeData().monthsShort(this, e) + })), V("MMMM", 0, 0, (function (e) { + return this.localeData().months(this, e) + })), I("month", "M"), F("month", 8), ce("M", Z), ce("MM", Z, q), ce("MMM", (function (e, t) { + return t.monthsShortRegex(e) + })), ce("MMMM", (function (e, t) { + return t.monthsRegex(e) + })), de(["M", "MM"], (function (e, t) { + t[1] = C(e) - 1 + })), de(["MMM", "MMMM"], (function (e, t, n, r) { + var i = n._locale.monthsParse(e, r, n._strict); + null != i ? t[1] = i : d(n).invalidMonth = e + })); + var ke = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, + xe = "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), + Te = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"); - function o(e) { - return e.kind === s.Conflicted - } + function Re(e, t, n) { + var r, i, o, s = e.toLocaleLowerCase(); + if (!this._monthsParse) + for (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = [], r = 0; r < 12; ++r) o = p([2e3, r]), this._shortMonthsParse[r] = this.monthsShort(o, "").toLocaleLowerCase(), this._longMonthsParse[r] = this.months(o, "").toLocaleLowerCase(); + return n ? "MMM" === t ? -1 !== (i = ve.call(this._shortMonthsParse, s)) ? i : null : -1 !== (i = ve.call(this._longMonthsParse, s)) ? i : null : "MMM" === t ? -1 !== (i = ve.call(this._shortMonthsParse, s)) || -1 !== (i = ve.call(this._longMonthsParse, s)) ? i : null : -1 !== (i = ve.call(this._longMonthsParse, s)) || -1 !== (i = ve.call(this._shortMonthsParse, s)) ? i : null + } - function r(e) { - if (!e.length) return !0; - const t = e.every((e) => e.selection.getSelectionType() === i.DiffSelectionType.All), - n = e.every((e) => e.selection.getSelectionType() === i.DiffSelectionType.None); - let o = null; - return t ? o = !0 : n && (o = !1), o - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const i = n(30); - var a; - (function (e) { - e.Modified = 'M', e.Added = 'A', e.Deleted = 'D', e.Renamed = 'R', e.Copied = 'C', e.Unchanged = '.', e.Untracked = '?', e.Ignored = '!', e.UpdatedButUnmerged = 'U' - })(a = t.GitStatusEntry || (t.GitStatusEntry = {})); - var s; - (function (e) { - e.New = 'New', e.Modified = 'Modified', e.Deleted = 'Deleted', e.Copied = 'Copied', e.Renamed = 'Renamed', e.Conflicted = 'Conflicted', e.Untracked = 'Untracked' - })(s = t.AppFileStatusKind || (t.AppFileStatusKind = {})), t.isConflictedFileStatus = o, t.isConflictWithMarkers = function (e) { - return e.hasOwnProperty('conflictMarkerCount') - }, t.isManualConflict = function (e) { - return !e.hasOwnProperty('conflictMarkerCount') - }; - var d; - (function (e) { - e.AddedByUs = 'added-by-us', e.DeletedByUs = 'deleted-by-us', e.AddedByThem = 'added-by-them', e.DeletedByThem = 'deleted-by-them', e.BothDeleted = 'both-deleted', e.BothAdded = 'both-added', e.BothModified = 'both-modified' - })(d = t.UnmergedEntrySummary || (t.UnmergedEntrySummary = {})); - class l { - constructor(e, t) { - this.path = e, this.status = t, this.id = t.kind === s.Renamed || t.kind === s.Copied ? `${t.kind}+${e}+${t.oldPath}` : `${t.kind}+${e}` - } - } - t.FileChange = l; - class c extends l { - constructor(e, t, n) { - super(e, t), this.selection = n - } - withIncludeAll(e) { - const t = e ? this.selection.withSelectAll() : this.selection.withSelectNone(); - return this.withSelection(t) - } - withSelection(e) { - return new c(this.path, this.status, e) - } - } - t.WorkingDirectoryFileChange = c; - t.CommittedFileChange = class extends l { - constructor(e, t, n) { - super(e, t), this.commitish = n, this.commitish = n - } - }; - class p { - constructor(e, t = !0) { - this.files = e, this.includeAll = t, this.fileIxById = new Map, e.forEach((e, t) => this.fileIxById.set(e.id, t)) - } - static fromFiles(e) { - return new p(e, r(e)) - } - withIncludeAllFiles(e) { - const t = this.files.map((t) => t.withIncludeAll(e)); - return new p(t, e) - } - findFileWithID(e) { - const t = this.fileIxById.get(e); - return t === void 0 ? null : this.files[t] || null - } - findFileIndexByID(e) { - const t = this.fileIxById.get(e); - return t === void 0 ? -1 : t - } - } - t.WorkingDirectoryStatus = p -}, function (e, t) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - var n; - (function (e) { - e[e.RenameBranch = 1] = 'RenameBranch', e[e.DeleteBranch = 2] = 'DeleteBranch', e[e.ConfirmDiscardChanges = 3] = 'ConfirmDiscardChanges', e[e.Preferences = 4] = 'Preferences', e[e.MergeBranch = 5] = 'MergeBranch', e[e.RepositorySettings = 6] = 'RepositorySettings', e[e.AddRepository = 7] = 'AddRepository', e[e.CreateRepository = 8] = 'CreateRepository', e[e.CloneRepository = 9] = 'CloneRepository', e[e.CreateBranch = 10] = 'CreateBranch', e[e.SignIn = 11] = 'SignIn', e[e.About = 12] = 'About', e[e.InstallGit = 13] = 'InstallGit', e[e.PublishRepository = 14] = 'PublishRepository', e[e.Acknowledgements = 15] = 'Acknowledgements', e[e.UntrustedCertificate = 16] = 'UntrustedCertificate', e[e.RemoveRepository = 17] = 'RemoveRepository', e[e.TermsAndConditions = 18] = 'TermsAndConditions', e[e.PushBranchCommits = 19] = 'PushBranchCommits', e[e.CLIInstalled = 20] = 'CLIInstalled', e[e.GenericGitAuthentication = 21] = 'GenericGitAuthentication', e[e.ExternalEditorFailed = 22] = 'ExternalEditorFailed', e[e.OpenShellFailed = 23] = 'OpenShellFailed', e[e.InitializeLFS = 24] = 'InitializeLFS', e[e.LFSAttributeMismatch = 25] = 'LFSAttributeMismatch', e[e.UpstreamAlreadyExists = 26] = 'UpstreamAlreadyExists', e[e.ReleaseNotes = 27] = 'ReleaseNotes', e[e.DeletePullRequest = 28] = 'DeletePullRequest', e[e.MergeConflicts = 29] = 'MergeConflicts', e[e.AbortMerge = 30] = 'AbortMerge', e[e.OversizedFiles = 31] = 'OversizedFiles', e[e.UsageReportingChanges = 32] = 'UsageReportingChanges', e[e.CommitConflictsWarning = 33] = 'CommitConflictsWarning', e[e.PushNeedsPull = 34] = 'PushNeedsPull', e[e.RebaseFlow = 35] = 'RebaseFlow', e[e.ConfirmForcePush = 36] = 'ConfirmForcePush', e[e.StashAndSwitchBranch = 37] = 'StashAndSwitchBranch', e[e.ConfirmOverwriteStash = 38] = 'ConfirmOverwriteStash', e[e.ConfirmDiscardStash = 39] = 'ConfirmDiscardStash', e[e.CreateTutorialRepository = 40] = 'CreateTutorialRepository', e[e.ConfirmExitTutorial = 41] = 'ConfirmExitTutorial', e[e.PushRejectedDueToMissingWorkflowScope = 42] = 'PushRejectedDueToMissingWorkflowScope', e[e.SAMLReauthRequired = 43] = 'SAMLReauthRequired', e[e.CreateFork = 44] = 'CreateFork', e[e.SChannelNoRevocationCheck = 45] = 'SChannelNoRevocationCheck', e[e.CreateTag = 46] = 'CreateTag', e[e.DeleteTag = 47] = 'DeleteTag', e[e.LocalChangesOverwritten = 48] = 'LocalChangesOverwritten', e[e.RebaseConflicts = 49] = 'RebaseConflicts', e[e.ChooseForkSettings = 50] = 'ChooseForkSettings', e[e.ConfirmDiscardSelection = 51] = 'ConfirmDiscardSelection' - })(n = t.PopupType || (t.PopupType = {})) -}, function (e, t) { - 'use strict'; - - function n() { - return !1, '1' === process.env.GITHUB_DESKTOP_PREVIEW_FEATURES - } - - function o() { - return n() || !1 - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - t.enableProgressBarOnIcon = function () { - return o() - }, t.enableRecurseSubmodulesFlag = function () { - return o() - }, t.enableReadmeOverwriteWarning = function () { - return o() - }, t.enableWSLDetection = function () { - return o() - }, t.enableCreateForkFlow = function () { - return !0 - }, t.enableSchannelCheckRevokeOptOut = function () { - return !0 - }, t.enableAutomaticGitProxyConfiguration = function () { - return !0 - }, t.enableCreateGitHubIssueFromMenu = function () { - return !0 - }, t.enableUpdateRemoteUrl = function () { - return !0 - }, t.enableForkyCreateBranchUI = function () { - return !0 - }, t.enableNDDBBanner = function () { - return !1 - }, t.enableGitTagsDisplay = function () { - return !0 - }, t.enableGitTagsCreation = function () { - return !0 - }, t.enableForkSettings = function () { - return !0 - }, t.enableDiscardLines = function () { - return !0 - } -}, function (e, t, n) { - 'use strict'; - - function o(e) { - const t = d.basename(e); - return 0 === t.length ? e : t - } + function De(e, t) { + var n; + if (!e.isValid()) return e; + if ("string" == typeof t) + if (/^\d+$/.test(t)) t = C(t); + else if (!a(t = e.localeData().monthsParse(t))) return e; + return n = Math.min(e.date(), Ee(e.year(), t)), e._d["set" + (e._isUTC ? "UTC" : "") + "Month"](t, n), e + } - function r(e) { - return e.gitHubRepository instanceof l.GitHubRepository - } + function _e(e) { + return null != e ? (De(this, e), r.updateOffset(this, !0), this) : Se(this, "Month") + } + var Ae = ae, + Me = ae; - function i(e) { - return r(e) && null !== e.gitHubRepository.parent - } + function Pe() { + function e(e, t) { + return t.length - e.length + } + var t, n, r = [], + i = [], + o = []; + for (t = 0; t < 12; t++) n = p([2e3, t]), r.push(this.monthsShort(n, "")), i.push(this.months(n, "")), o.push(this.months(n, "")), o.push(this.monthsShort(n, "")); + for (r.sort(e), i.sort(e), o.sort(e), t = 0; t < 12; t++) r[t] = he(r[t]), i[t] = he(i[t]); + for (t = 0; t < 24; t++) o[t] = he(o[t]); + this._monthsRegex = new RegExp("^(" + o.join("|") + ")", "i"), this._monthsShortRegex = this._monthsRegex, this._monthsStrictRegex = new RegExp("^(" + i.join("|") + ")", "i"), this._monthsShortStrictRegex = new RegExp("^(" + r.join("|") + ")", "i") + } - function a(e) { - if (!i(e)) return e.gitHubRepository; - const t = s(e); - return t === c.ForkContributionTarget.Self ? e.gitHubRepository : t === c.ForkContributionTarget.Parent ? e.gitHubRepository.parent : p.assertNever(t, 'Invalid fork contribution target') - } + function Ie(e, t, n, r, i, o, s) { + var a; + return e < 100 && e >= 0 ? (a = new Date(e + 400, t, n, r, i, o, s), isFinite(a.getFullYear()) && a.setFullYear(e)) : a = new Date(e, t, n, r, i, o, s), a + } - function s(e) { - return e.workflowPreferences.forkContributionTarget === void 0 ? c.ForkContributionTarget.Parent : e.workflowPreferences.forkContributionTarget - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const d = n(1), - l = n(102), - c = n(129), - p = n(2); - class u { - constructor(e, t, n, r, i = {}, a) { - this.id = t, this.gitHubRepository = n, this.missing = r, this.workflowPreferences = i, this._isTutorialRepository = a, this.mainWorkTree = { - path: e - }, this.name = n && n.name || o(e) - } - get path() { - return this.mainWorkTree.path - } - get hash() { - return `${this.id}+${this.gitHubRepository&&this.gitHubRepository.hash}+${this.path}+${this.missing}+${this.name}+${this.isTutorialRepository}+${this.workflowPreferences.forkContributionTarget}` - } - get isTutorialRepository() { - return !0 === this._isTutorialRepository - } - } - t.Repository = u, t.isRepositoryWithGitHubRepository = r, t.isRepositoryWithForkedGitHubRepository = i, t.nameOf = function (e) { - const { - gitHubRepository: t - } = e; - return null === t ? e.name : t.fullName - }, t.getGitHubHtmlUrl = function (e) { - return r(e) ? a(e).htmlURL : null - }, t.getNonForkGitHubRepository = a, t.getForkContributionTarget = s -}, function (e, t, n) { - 'use strict'; + function Oe(e) { + var t; + if (e < 100 && e >= 0) { + var n = Array.prototype.slice.call(arguments); + n[0] = e + 400, t = new Date(Date.UTC.apply(null, n)), isFinite(t.getUTCFullYear()) && t.setUTCFullYear(e) + } else t = new Date(Date.UTC.apply(null, arguments)); + return t + } - function o(e, t) { - let n = { - submenu: e - }; - for (const o of t) { - if (n === void 0 || n.submenu === void 0) return; - n = n.submenu[o] - } - return n - } + function Le(e, t, n) { + var r = 7 + t - n; + return -(7 + Oe(e, 0, r).getUTCDay() - t) % 7 + r - 1 + } - function r(e) { - return { - message: e.message || `${e}`, - name: e.name || `${e.name}`, - stack: e.stack || void 0 - } - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const i = n(22); - t.updateMenuState = function (e) { - i.ipcRenderer.send('update-menu-state', e) - }, t.sendReady = function (e) { - i.ipcRenderer.send('renderer-ready', e) - }, t.executeMenuItem = function (e) { - i.ipcRenderer.send('execute-menu-item', { - id: e.id - }) - }, t.executeMenuItemById = function (e) { - i.ipcRenderer.send('execute-menu-item', { - id: e - }) - }, t.showCertificateTrustDialog = function (e, t) { - i.ipcRenderer.send('show-certificate-trust-dialog', { - certificate: e, - message: t - }) - }, t.sendWillQuitSync = function () { - i.ipcRenderer.sendSync('will-quit') - }, t.getAppMenu = function () { - i.ipcRenderer.send('get-app-menu') - }; - let a = null; - t.registerContextualMenuActionDispatcher = function () { - i.ipcRenderer.on('contextual-menu-action', (e, t) => { - if (null !== a) { - const e = o(a, t); - void 0 !== e && void 0 !== e.action && (e.action(), a = null) + function Ne(e, t, n, r, i) { + var o, s, a = 1 + 7 * (t - 1) + (7 + n - r) % 7 + Le(e, r, i); + return a <= 0 ? s = ge(o = e - 1) + a : a > ge(e) ? (o = e + 1, s = a - ge(e)) : (o = e, s = a), { + year: o, + dayOfYear: s + } } - }) - }, t.showContextualMenu = function (e) { - a = e, i.ipcRenderer.send('show-contextual-menu', e) - }, t.updatePreferredAppMenuItemLabels = function (e) { - i.ipcRenderer.send('update-preferred-app-menu-item-labels', e) - }, t.reportUncaughtException = function (e) { - i.ipcRenderer.send('uncaught-exception', r(e)) - }, t.sendErrorReport = function (e, t = {}, n) { - i.ipcRenderer.send('send-error-report', { - error: r(e), - extra: t, - nonFatal: n - }) - } -}, function (e, t) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - var n; - (function (e) { - e[e.Repository = 0] = 'Repository', e[e.CloningRepository = 1] = 'CloningRepository', e[e.MissingRepository = 2] = 'MissingRepository' - })(n = t.SelectionType || (t.SelectionType = {})); - var o; - (function (e) { - e[e.Repository = 0] = 'Repository', e[e.Branch = 1] = 'Branch', e[e.AppMenu = 2] = 'AppMenu', e[e.AddMenu = 3] = 'AddMenu' - })(o = t.FoldoutType || (t.FoldoutType = {})); - var r; - (function (e) { - e[e.Changes = 0] = 'Changes', e[e.History = 1] = 'History' - })(r = t.RepositorySectionTab || (t.RepositorySectionTab = {})), t.isMergeConflictState = function (e) { - return 'merge' === e.kind - }, t.isRebaseConflictState = function (e) { - return 'rebase' === e.kind - }; - var i; - (function (e) { - e.WorkingDirectory = 'WorkingDirectory', e.Stash = 'Stash' - })(i = t.ChangesSelectionKind || (t.ChangesSelectionKind = {})); - var a; - (function (e) { - e.History = 'History', e.Compare = 'Compare' - })(a = t.HistoryTabMode || (t.HistoryTabMode = {})); - var s; - (function (e) { - e.Ahead = 'Ahead', e.Behind = 'Behind' - })(s = t.ComparisonMode || (t.ComparisonMode = {})) -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5), - i = n(68), - a = n(13), - s = n(27); - class d extends o.Component { - constructor() { - super(...arguments), this.inputElement = null, this.onChange = (e) => { - const t = e.currentTarget.value; - this.setState({ - value: t - }, () => { - this.props.onValueChanged && this.props.onValueChanged(t) - }) - }, this.onSearchTextCleared = () => { - null != this.props.onSearchCleared && this.props.onSearchCleared() - }, this.onInputRef = (e) => { - null != this.inputElement && 'search' === this.props.type && this.inputElement.removeEventListener('search', this.onSearchTextCleared), this.inputElement = e, null != this.inputElement && 'search' === this.props.type && this.inputElement.addEventListener('search', this.onSearchTextCleared) - }, this.onContextMenu = (e) => { - e.preventDefault(), s.showContextualMenu([{ - role: 'editMenu' - }]) - }, this.onKeyDown = (e) => { - const t = this.state.value; - if ('' !== t && 'search' === this.props.type && 'Escape' === e.key) { - const t = ''; - e.preventDefault(), this.setState({ - value: t - }), this.props.onValueChanged && this.props.onValueChanged(t) - } else 'search' === this.props.type && 'Escape' === e.key && '' === t && this.props.onBlur && (this.props.onBlur(), null !== this.inputElement && this.inputElement.blur()); - this.props.onKeyDown !== void 0 && this.props.onKeyDown(e) - }, this.onFocus = () => { - this.props.autoFocus || this.props.onFocus === void 0 || this.props.onFocus() - }, this.onBlur = () => { - this.props.onBlur !== void 0 && this.props.onBlur() + + function Fe(e, t, n) { + var r, i, o = Le(e.year(), t, n), + s = Math.floor((e.dayOfYear() - o - 1) / 7) + 1; + return s < 1 ? r = s + Be(i = e.year() - 1, t, n) : s > Be(e.year(), t, n) ? (r = s - Be(e.year(), t, n), i = e.year() + 1) : (i = e.year(), r = s), { + week: r, + year: i + } } - } - componentWillMount() { - const e = this.props.label || this.props.placeholder, - t = i.createUniqueId(`TextBox_${e}`); - this.setState({ - inputId: t, - value: this.props.value - }) - } - componentWillUnmount() { - this.state.inputId && i.releaseUniqueId(this.state.inputId) - } - componentWillReceiveProps(e) { - this.state.value !== e.value && this.setState({ - value: e.value - }) - } - selectAll() { - null !== this.inputElement && this.inputElement.select() - } - focus() { - null !== this.inputElement && this.inputElement.focus() - } - blur() { - null !== this.inputElement && this.inputElement.blur() - } - renderLabelLink() { - return this.props.labelLinkText ? o.createElement(a.LinkButton, { - uri: this.props.labelLinkUri, - onClick: this.props.onLabelLinkClick, - className: 'link-label' - }, this.props.labelLinkText) : null - } - renderLabel() { - return this.props.label ? o.createElement('div', { - className: 'label-container' - }, o.createElement('label', { - htmlFor: this.state.inputId - }, this.props.label), this.renderLabelLink()) : null - } - render() { - const e = r('text-box-component', this.props.className), - t = this.props.label ? this.state.inputId : void 0; - return o.createElement('div', { - className: e - }, this.renderLabel(), o.createElement('input', { - id: t, - ref: this.onInputRef, - onFocus: this.onFocus, - onBlur: this.onBlur, - autoFocus: this.props.autoFocus, - disabled: this.props.disabled, - type: this.props.type, - placeholder: this.props.placeholder, - value: this.state.value, - onChange: this.onChange, - onKeyDown: this.onKeyDown, - tabIndex: this.props.tabIndex, - onContextMenu: this.onContextMenu - })) - } - } - t.TextBox = d -}, function (e, t, n) { - 'use strict'; - function o(e) { - for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), o(n(724)), o(n(723)), o(n(722)), o(n(721)), o(n(720)), o(n(719)) -}, function (e, t, n) { - 'use strict'; + function Be(e, t, n) { + var r = Le(e, t, n), + i = Le(e + 1, t, n); + return (ge(e) - r + i) / 7 + } - function o(e, t) { - if (e === t) return !0; - const n = e.kind; - switch (e.kind) { - case a.Unknown: - return e.kind === t.kind; - case a.Unborn: - return e.kind === t.kind && e.ref === t.ref; - case a.Detached: - return e.kind === t.kind && e.currentSha === t.currentSha; - case a.Valid: - return e.kind === t.kind && r(e.branch, t.branch); - default: - return i.assertNever(e, `Unknown tip state ${n}`); - } - } + function He(e, t) { + return e.slice(t, 7).concat(e.slice(0, t)) + } + V("w", ["ww", 2], "wo", "week"), V("W", ["WW", 2], "Wo", "isoWeek"), I("week", "w"), I("isoWeek", "W"), F("week", 5), F("isoWeek", 5), ce("w", Z), ce("ww", Z, q), ce("W", Z), ce("WW", Z, q), fe(["w", "ww", "W", "WW"], (function (e, t, n, r) { + t[r.substr(0, 1)] = C(e) + })), V("d", 0, "do", "day"), V("dd", 0, 0, (function (e) { + return this.localeData().weekdaysMin(this, e) + })), V("ddd", 0, 0, (function (e) { + return this.localeData().weekdaysShort(this, e) + })), V("dddd", 0, 0, (function (e) { + return this.localeData().weekdays(this, e) + })), V("e", 0, 0, "weekday"), V("E", 0, 0, "isoWeekday"), I("day", "d"), I("weekday", "e"), I("isoWeekday", "E"), F("day", 11), F("weekday", 11), F("isoWeekday", 11), ce("d", Z), ce("e", Z), ce("E", Z), ce("dd", (function (e, t) { + return t.weekdaysMinRegex(e) + })), ce("ddd", (function (e, t) { + return t.weekdaysShortRegex(e) + })), ce("dddd", (function (e, t) { + return t.weekdaysRegex(e) + })), fe(["dd", "ddd", "dddd"], (function (e, t, n, r) { + var i = n._locale.weekdaysParse(e, r, n._strict); + null != i ? t.d = i : d(n).invalidWeekday = e + })), fe(["d", "e", "E"], (function (e, t, n, r) { + t[r] = C(e) + })); + var ze = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), + Ue = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), + We = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"); - function r(e, t) { - return e.type === t.type && e.tip.sha === t.tip.sha && e.remote === t.remote && e.upstream === t.upstream - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const i = n(2); - var a; - (function (e) { - e.Unknown = 'Unknown', e.Unborn = 'Unborn', e.Detached = 'Detached', e.Valid = 'Valid' - })(a = t.TipState || (t.TipState = {})), t.tipEquals = o -}, function (e, t, n) { - function o(e) { - function t(t) { - return m.apply(e, t) - } + function Ve(e, t, n) { + var r, i, o, s = e.toLocaleLowerCase(); + if (!this._weekdaysParse) + for (this._weekdaysParse = [], this._shortWeekdaysParse = [], this._minWeekdaysParse = [], r = 0; r < 7; ++r) o = p([2e3, 1]).day(r), this._minWeekdaysParse[r] = this.weekdaysMin(o, "").toLocaleLowerCase(), this._shortWeekdaysParse[r] = this.weekdaysShort(o, "").toLocaleLowerCase(), this._weekdaysParse[r] = this.weekdays(o, "").toLocaleLowerCase(); + return n ? "dddd" === t ? -1 !== (i = ve.call(this._weekdaysParse, s)) ? i : null : "ddd" === t ? -1 !== (i = ve.call(this._shortWeekdaysParse, s)) ? i : null : -1 !== (i = ve.call(this._minWeekdaysParse, s)) ? i : null : "dddd" === t ? -1 !== (i = ve.call(this._weekdaysParse, s)) || -1 !== (i = ve.call(this._shortWeekdaysParse, s)) || -1 !== (i = ve.call(this._minWeekdaysParse, s)) ? i : null : "ddd" === t ? -1 !== (i = ve.call(this._shortWeekdaysParse, s)) || -1 !== (i = ve.call(this._weekdaysParse, s)) || -1 !== (i = ve.call(this._minWeekdaysParse, s)) ? i : null : -1 !== (i = ve.call(this._minWeekdaysParse, s)) || -1 !== (i = ve.call(this._weekdaysParse, s)) || -1 !== (i = ve.call(this._shortWeekdaysParse, s)) ? i : null + } + var je = ae, + Ge = ae, + $e = ae; - function n() { - return this instanceof n ? (f.apply(this, arguments), this) : n.apply(Object.create(n.prototype), arguments) - } + function qe() { + function e(e, t) { + return t.length - e.length + } + var t, n, r, i, o, s = [], + a = [], + l = [], + c = []; + for (t = 0; t < 7; t++) n = p([2e3, 1]).day(t), r = this.weekdaysMin(n, ""), i = this.weekdaysShort(n, ""), o = this.weekdays(n, ""), s.push(r), a.push(i), l.push(o), c.push(r), c.push(i), c.push(o); + for (s.sort(e), a.sort(e), l.sort(e), c.sort(e), t = 0; t < 7; t++) a[t] = he(a[t]), l[t] = he(l[t]), c[t] = he(c[t]); + this._weekdaysRegex = new RegExp("^(" + c.join("|") + ")", "i"), this._weekdaysShortRegex = this._weekdaysRegex, this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = new RegExp("^(" + l.join("|") + ")", "i"), this._weekdaysShortStrictRegex = new RegExp("^(" + a.join("|") + ")", "i"), this._weekdaysMinStrictRegex = new RegExp("^(" + s.join("|") + ")", "i") + } - function a() { - return this instanceof a ? (g.apply(this, arguments), this) : a.apply(Object.create(a.prototype), arguments) - } + function Ke() { + return this.hours() % 12 || 12 + } - function l(e, t, n, o) { - function a(e, t, n, o) { - return C(e, t, n, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? r([a, [e, t, n, o]]) : ('function' == typeof o && o.apply(this, arguments), i()) - }) + function Ye(e, t) { + V(e, 0, 0, (function () { + return this.localeData().meridiem(this.hours(), this.minutes(), t) + })) } - return 'function' == typeof n && (o = n, n = null), a(e, t, n, o) - } - s(e), e.gracefulify = o, e.createReadStream = function (t, n) { - return new e.ReadStream(t, n) - }, e.createWriteStream = function (t, n) { - return new e.WriteStream(t, n) - }; - var c = e.readFile; - e.readFile = function (e, t, n) { - function o(e, t, n) { - return c(e, t, function (a) { - a && ('EMFILE' === a.code || 'ENFILE' === a.code) ? r([o, [e, t, n]]) : ('function' == typeof n && n.apply(this, arguments), i()) - }) + + function Qe(e, t) { + return t._meridiemParse } - return 'function' == typeof t && (n = t, t = null), o(e, t, n) - }; - var p = e.writeFile; - e.writeFile = function (e, t, n, o) { - function a(e, t, n, o) { - return p(e, t, n, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? r([a, [e, t, n, o]]) : ('function' == typeof o && o.apply(this, arguments), i()) - }) + V("H", ["HH", 2], 0, "hour"), V("h", ["hh", 2], 0, Ke), V("k", ["kk", 2], 0, (function () { + return this.hours() || 24 + })), V("hmm", 0, 0, (function () { + return "" + Ke.apply(this) + B(this.minutes(), 2) + })), V("hmmss", 0, 0, (function () { + return "" + Ke.apply(this) + B(this.minutes(), 2) + B(this.seconds(), 2) + })), V("Hmm", 0, 0, (function () { + return "" + this.hours() + B(this.minutes(), 2) + })), V("Hmmss", 0, 0, (function () { + return "" + this.hours() + B(this.minutes(), 2) + B(this.seconds(), 2) + })), Ye("a", !0), Ye("A", !1), I("hour", "h"), F("hour", 13), ce("a", Qe), ce("A", Qe), ce("H", Z), ce("h", Z), ce("k", Z), ce("HH", Z, q), ce("hh", Z, q), ce("kk", Z, q), ce("hmm", X), ce("hmmss", J), ce("Hmm", X), ce("Hmmss", J), de(["H", "HH"], 3), de(["k", "kk"], (function (e, t, n) { + var r = C(e); + t[3] = 24 === r ? 0 : r + })), de(["a", "A"], (function (e, t, n) { + n._isPm = n._locale.isPM(e), n._meridiem = e + })), de(["h", "hh"], (function (e, t, n) { + t[3] = C(e), d(n).bigHour = !0 + })), de("hmm", (function (e, t, n) { + var r = e.length - 2; + t[3] = C(e.substr(0, r)), t[4] = C(e.substr(r)), d(n).bigHour = !0 + })), de("hmmss", (function (e, t, n) { + var r = e.length - 4, + i = e.length - 2; + t[3] = C(e.substr(0, r)), t[4] = C(e.substr(r, 2)), t[5] = C(e.substr(i)), d(n).bigHour = !0 + })), de("Hmm", (function (e, t, n) { + var r = e.length - 2; + t[3] = C(e.substr(0, r)), t[4] = C(e.substr(r)) + })), de("Hmmss", (function (e, t, n) { + var r = e.length - 4, + i = e.length - 2; + t[3] = C(e.substr(0, r)), t[4] = C(e.substr(r, 2)), t[5] = C(e.substr(i)) + })); + var Ze, Xe = be("Hours", !0), + Je = { + calendar: { + sameDay: "[Today at] LT", + nextDay: "[Tomorrow at] LT", + nextWeek: "dddd [at] LT", + lastDay: "[Yesterday at] LT", + lastWeek: "[Last] dddd [at] LT", + sameElse: "L" + }, + longDateFormat: { + LTS: "h:mm:ss A", + LT: "h:mm A", + L: "MM/DD/YYYY", + LL: "MMMM D, YYYY", + LLL: "MMMM D, YYYY h:mm A", + LLLL: "dddd, MMMM D, YYYY h:mm A" + }, + invalidDate: "Invalid date", + ordinal: "%d", + dayOfMonthOrdinalParse: /\d{1,2}/, + relativeTime: { + future: "in %s", + past: "%s ago", + s: "a few seconds", + ss: "%d seconds", + m: "a minute", + mm: "%d minutes", + h: "an hour", + hh: "%d hours", + d: "a day", + dd: "%d days", + M: "a month", + MM: "%d months", + y: "a year", + yy: "%d years" + }, + months: xe, + monthsShort: Te, + week: { + dow: 0, + doy: 6 + }, + weekdays: ze, + weekdaysMin: We, + weekdaysShort: Ue, + meridiemParse: /[ap]\.?m?\.?/i + }, + et = {}, + tt = {}; + + function nt(e) { + return e ? e.toLowerCase().replace("_", "-") : e } - return 'function' == typeof n && (o = n, n = null), a(e, t, n, o) - }; - var u = e.appendFile; - u && (e.appendFile = function (e, t, n, o) { - function a(e, t, n, o) { - return u(e, t, n, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? r([a, [e, t, n, o]]) : ('function' == typeof o && o.apply(this, arguments), i()) - }) + + function rt(t) { + var n = null; + if (!et[t] && void 0 !== e && e && e.exports) try { + n = Ze._abbr, ! function () { + var e = new Error("Cannot find module 'undefined'"); + throw e.code = "MODULE_NOT_FOUND", e + }(), it(n) + } catch (e) {} + return et[t] } - return 'function' == typeof n && (o = n, n = null), a(e, t, n, o) - }); - var m = e.readdir; - if (e.readdir = function (e, n, o) { - function a(e, n) { - n && n.sort && n.sort(), e && ('EMFILE' === e.code || 'ENFILE' === e.code) ? r([t, [s]]) : ('function' == typeof o && o.apply(this, arguments), i()) - } - var s = [e]; - return 'function' == typeof n ? o = n : s.push(n), s.push(a), t(s) - }, 'v0.8' === process.version.substr(0, 4)) { - var h = d(e); - n = h.ReadStream, a = h.WriteStream - } - var f = e.ReadStream; - f && (n.prototype = Object.create(f.prototype), n.prototype.open = function () { - var e = this; - l(e.path, e.flags, e.mode, function (t, n) { - t ? (e.autoClose && e.destroy(), e.emit('error', t)) : (e.fd = n, e.emit('open', n), e.read()) - }) - }); - var g = e.WriteStream; - g && (a.prototype = Object.create(g.prototype), a.prototype.open = function () { - var e = this; - l(e.path, e.flags, e.mode, function (t, n) { - t ? (e.destroy(), e.emit('error', t)) : (e.fd = n, e.emit('open', n)) - }) - }), Object.defineProperty(e, 'ReadStream', { - get: function () { - return n - }, - set: function (e) { - n = e - }, - enumerable: !0, - configurable: !0 - }), Object.defineProperty(e, 'WriteStream', { - get: function () { - return a - }, - set: function (e) { - a = e - }, - enumerable: !0, - configurable: !0 - }); - var y = n; - Object.defineProperty(e, 'FileReadStream', { - get: function () { - return y - }, - set: function (e) { - y = e - }, - enumerable: !0, - configurable: !0 - }); - var S = a; - Object.defineProperty(e, 'FileWriteStream', { - get: function () { - return S - }, - set: function (e) { - S = e - }, - enumerable: !0, - configurable: !0 - }); - var C = e.open; - return e.open = l, e - } - function r(e) { - m('ENQUEUE', e[0].name, e[1]), global[p].push(e) - } + function it(e, t) { + var n; + return e && ((n = s(t) ? st(e) : ot(e, t)) ? Ze = n : "undefined" != typeof console && console.warn && console.warn("Locale " + e + " not found. Did you forget to load it?")), Ze._abbr + } - function i() { - var e = global[p].shift(); - e && (m('RETRY', e[0].name, e[1]), e[0].apply(null, e[1])) - } - var a = n(33), - s = n(748), - d = n(746), - l = n(745), - c = n(176), - p, u; - 'function' == typeof Symbol && 'function' == typeof Symbol.for ? (p = Symbol.for('graceful-fs.queue'), u = Symbol.for('graceful-fs.previous')) : (p = '___graceful-fs.queue', u = '___graceful-fs.previous'); - var m = function () {}; - if (c.debuglog ? m = c.debuglog('gfs4') : /\bgfs4\b/i.test(process.env.NODE_DEBUG || '') && (m = function () { - var e = c.format.apply(c, arguments); - e = 'GFS4: ' + e.split(/\n/).join('\nGFS4: '), console.error(e) - }), !global[p]) { - var h = []; - Object.defineProperty(global, p, { - get: function () { - return h + function ot(e, t) { + if (null !== t) { + var n, r = Je; + if (t.abbr = e, null != et[e]) D("defineLocaleOverride", "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."), r = et[e]._config; + else if (null != t.parentLocale) + if (null != et[t.parentLocale]) r = et[t.parentLocale]._config; + else { + if (null == (n = rt(t.parentLocale))) return tt[t.parentLocale] || (tt[t.parentLocale] = []), tt[t.parentLocale].push({ + name: e, + config: t + }), null; + r = n._config + } return et[e] = new M(A(r, t)), tt[e] && tt[e].forEach((function (e) { + ot(e.name, e.config) + })), it(e), et[e] + } + return delete et[e], null } - }), a.close = function (e) { - function t(t, n) { - return e.call(a, t, function (e) { - e || i(), 'function' == typeof n && n.apply(this, arguments) - }) + + function st(e) { + var t; + if (e && e._locale && e._locale._abbr && (e = e._locale._abbr), !e) return Ze; + if (!i(e)) { + if (t = rt(e)) return t; + e = [e] + } + return function (e) { + for (var t, n, r, i, o = 0; o < e.length;) { + for (t = (i = nt(e[o]).split("-")).length, n = (n = nt(e[o + 1])) ? n.split("-") : null; t > 0;) { + if (r = rt(i.slice(0, t).join("-"))) return r; + if (n && n.length >= t && E(i, n, !0) >= t - 1) break; + t-- + } + o++ + } + return Ze + }(e) } - return Object.defineProperty(t, u, { - value: e - }), t - }(a.close), a.closeSync = function (e) { - function t() { - e.apply(a, arguments), i() + + function at(e) { + var t, n = e._a; + return n && -2 === d(e).overflow && (t = n[1] < 0 || n[1] > 11 ? 1 : n[2] < 1 || n[2] > Ee(n[0], n[1]) ? 2 : n[3] < 0 || n[3] > 24 || 24 === n[3] && (0 !== n[4] || 0 !== n[5] || 0 !== n[6]) ? 3 : n[4] < 0 || n[4] > 59 ? 4 : n[5] < 0 || n[5] > 59 ? 5 : n[6] < 0 || n[6] > 999 ? 6 : -1, d(e)._overflowDayOfYear && (t < 0 || t > 2) && (t = 2), d(e)._overflowWeeks && -1 === t && (t = 7), d(e)._overflowWeekday && -1 === t && (t = 8), d(e).overflow = t), e } - return Object.defineProperty(t, u, { - value: e - }), t - }(a.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || '') && process.on('exit', function () { - m(global[p]), n(288).equal(global[p].length, 0) - }) - } - e.exports = o(l(a)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !a.__patched && (e.exports = o(a), a.__patched = !0) -}, function (e) { - e.exports = require('fs') -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(1), - r = n(657); - t.encodePathAsUrl = function (...e) { - const t = o.resolve(...e); - return r(t) - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - var o = n(714); - t.GitProcess = o.GitProcess; - var r = n(271); - t.GitError = r.GitError, t.RepositoryDoesNotExistErrorCode = r.RepositoryDoesNotExistErrorCode, t.GitNotFoundErrorCode = r.GitNotFoundErrorCode -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(68); - var i; - (function (e) { - e[e.On = 0] = 'On', e[e.Off = 1] = 'Off', e[e.Mixed = 2] = 'Mixed' - })(i = t.CheckboxValue || (t.CheckboxValue = {})); - class a extends o.Component { - constructor() { - super(...arguments), this.input = null, this.onChange = (e) => { - this.props.onChange && this.props.onChange(e) - }, this.onInputRef = (e) => { - this.input = e, this.updateInputState() + + function lt(e, t, n) { + return null != e ? e : null != t ? t : n } - } - componentDidUpdate() { - this.updateInputState() - } - componentWillMount() { - const e = this.props.label || 'unknown', - t = r.createUniqueId(`Checkbox_${e}`); - this.setState({ - inputId: t - }) - } - componentWillUnmount() { - this.state.inputId && r.releaseUniqueId(this.state.inputId) - } - updateInputState() { - const e = this.input; - if (e) { - const t = this.props.value; - e.indeterminate = t === i.Mixed, e.checked = t !== i.Off + + function ct(e) { + var t, n, i, o, s, a = []; + if (!e._d) { + for (i = function (e) { + var t = new Date(r.now()); + return e._useUTC ? [t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()] : [t.getFullYear(), t.getMonth(), t.getDate()] + }(e), e._w && null == e._a[2] && null == e._a[1] && function (e) { + var t, n, r, i, o, s, a, l; + if (null != (t = e._w).GG || null != t.W || null != t.E) o = 1, s = 4, n = lt(t.GG, e._a[0], Fe(kt(), 1, 4).year), r = lt(t.W, 1), ((i = lt(t.E, 1)) < 1 || i > 7) && (l = !0); + else { + o = e._locale._week.dow, s = e._locale._week.doy; + var c = Fe(kt(), o, s); + n = lt(t.gg, e._a[0], c.year), r = lt(t.w, c.week), null != t.d ? ((i = t.d) < 0 || i > 6) && (l = !0) : null != t.e ? (i = t.e + o, (t.e < 0 || t.e > 6) && (l = !0)) : i = o + } + r < 1 || r > Be(n, o, s) ? d(e)._overflowWeeks = !0 : null != l ? d(e)._overflowWeekday = !0 : (a = Ne(n, r, i, o, s), e._a[0] = a.year, e._dayOfYear = a.dayOfYear) + }(e), null != e._dayOfYear && (s = lt(e._a[0], i[0]), (e._dayOfYear > ge(s) || 0 === e._dayOfYear) && (d(e)._overflowDayOfYear = !0), n = Oe(s, 0, e._dayOfYear), e._a[1] = n.getUTCMonth(), e._a[2] = n.getUTCDate()), t = 0; t < 3 && null == e._a[t]; ++t) e._a[t] = a[t] = i[t]; + for (; t < 7; t++) e._a[t] = a[t] = null == e._a[t] ? 2 === t ? 1 : 0 : e._a[t]; + 24 === e._a[3] && 0 === e._a[4] && 0 === e._a[5] && 0 === e._a[6] && (e._nextDay = !0, e._a[3] = 0), e._d = (e._useUTC ? Oe : Ie).apply(null, a), o = e._useUTC ? e._d.getUTCDay() : e._d.getDay(), null != e._tzm && e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm), e._nextDay && (e._a[3] = 24), e._w && void 0 !== e._w.d && e._w.d !== o && (d(e).weekdayMismatch = !0) + } + } + var ut = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + ht = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + pt = /Z|[+-]\d\d(?::?\d\d)?/, + dt = [ + ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/], + ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/], + ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/], + ["GGGG-[W]WW", /\d{4}-W\d\d/, !1], + ["YYYY-DDD", /\d{4}-\d{3}/], + ["YYYY-MM", /\d{4}-\d\d/, !1], + ["YYYYYYMMDD", /[+-]\d{10}/], + ["YYYYMMDD", /\d{8}/], + ["GGGG[W]WWE", /\d{4}W\d{3}/], + ["GGGG[W]WW", /\d{4}W\d{2}/, !1], + ["YYYYDDD", /\d{7}/] + ], + ft = [ + ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/], + ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/], + ["HH:mm:ss", /\d\d:\d\d:\d\d/], + ["HH:mm", /\d\d:\d\d/], + ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/], + ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/], + ["HHmmss", /\d\d\d\d\d\d/], + ["HHmm", /\d\d\d\d/], + ["HH", /\d\d/] + ], + mt = /^\/?Date\((\-?\d+)/i; + + function gt(e) { + var t, n, r, i, o, s, a = e._i, + l = ut.exec(a) || ht.exec(a); + if (l) { + for (d(e).iso = !0, t = 0, n = dt.length; t < n; t++) + if (dt[t][1].exec(l[1])) { + i = dt[t][0], r = !1 !== dt[t][2]; + break + } if (null == i) return void(e._isValid = !1); + if (l[3]) { + for (t = 0, n = ft.length; t < n; t++) + if (ft[t][1].exec(l[3])) { + o = (l[2] || " ") + ft[t][0]; + break + } if (null == o) return void(e._isValid = !1) + } + if (!r && null != o) return void(e._isValid = !1); + if (l[4]) { + if (!pt.exec(l[4])) return void(e._isValid = !1); + s = "Z" + } + e._f = i + (o || "") + (s || ""), St(e) + } else e._isValid = !1 } - } - renderLabel() { - const e = this.props.label, - t = this.state.inputId; - return e ? o.createElement('label', { - htmlFor: t - }, e) : null - } - render() { - return o.createElement('div', { - className: 'checkbox-component' - }, o.createElement('input', { - id: this.state.inputId, - tabIndex: this.props.tabIndex, - type: 'checkbox', - onChange: this.onChange, - ref: this.onInputRef, - disabled: this.props.disabled - }), this.renderLabel()) - } - } - t.Checkbox = a -}, function (e) { - var t = Object; - e.exports = { - create: t.create, - getProto: t.getPrototypeOf, - isEnum: {}.propertyIsEnumerable, - getDesc: t.getOwnPropertyDescriptor, - setDesc: t.defineProperty, - setDescs: t.defineProperties, - getKeys: t.keys, - getNames: t.getOwnPropertyNames, - getSymbols: t.getOwnPropertySymbols, - each: [].forEach - } -}, function (e, t, n) { - 'use strict'; + var yt = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; - function o(e) { - return e.kind === i.AppFileStatusKind.Conflicted - } + function vt(e) { + var t = parseInt(e, 10); + return t <= 49 ? 2e3 + t : t <= 999 ? 1900 + t : t + } + var wt = { + UT: 0, + GMT: 0, + EDT: -240, + EST: -300, + CDT: -300, + CST: -360, + MDT: -360, + MST: -420, + PDT: -420, + PST: -480 + }; - function r(e, t) { - return !(void 0 !== t) && (!i.isConflictWithMarkers(e) || 0 < e.conflictMarkerCount) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const i = n(23), - a = n(2); - t.mapStatus = function (e) { - switch (e.kind) { - case i.AppFileStatusKind.New: - case i.AppFileStatusKind.Untracked: - return 'New'; - case i.AppFileStatusKind.Modified: - return 'Modified'; - case i.AppFileStatusKind.Deleted: - return 'Deleted'; - case i.AppFileStatusKind.Renamed: - return 'Renamed'; - case i.AppFileStatusKind.Conflicted: - if (i.isConflictWithMarkers(e)) { - const t = e.conflictMarkerCount; - return 0 < t ? 'Conflicted' : 'Resolved' - } - return 'Conflicted'; - case i.AppFileStatusKind.Copied: - return 'Copied'; - } - return a.assertNever(e, `Unknown file status ${e}`) - }, t.isConflictedFile = o, t.hasConflictedFiles = function (e) { - return e.files.some((e) => o(e.status)) - }, t.hasUnresolvedConflicts = r, t.getUnmergedStatusEntryDescription = function (e, t) { - const n = t ? ` from ${t}` : ''; - return e === i.GitStatusEntry.Added ? `Using the added file${n}` : e === i.GitStatusEntry.UpdatedButUnmerged ? `Using the modified file${n}` : e === i.GitStatusEntry.Deleted ? `Using the deleted file${n}` : a.assertNever(e, 'Unknown status entry to format') - }, t.getLabelForManualResolutionOption = function (e, t) { - const n = t ? ` from ${t}` : ''; - return e === i.GitStatusEntry.Added ? `Use the added file${n}` : e === i.GitStatusEntry.UpdatedButUnmerged ? `Use the modified file${n}` : e === i.GitStatusEntry.Deleted ? `Use the deleted file${n}` : a.assertNever(e, 'Unknown status entry to format') - }, t.getUnmergedFiles = function (e) { - return e.files.filter((e) => o(e.status)) - }, t.getUntrackedFiles = function (e) { - return e.files.filter((e) => e.status.kind === i.AppFileStatusKind.Untracked) - }, t.getResolvedFiles = function (e, t) { - return e.files.filter((e) => i.isConflictedFileStatus(e.status) && !r(e.status, t.get(e.path))) - }, t.getConflictedFiles = function (e, t) { - return e.files.filter((e) => i.isConflictedFileStatus(e.status) && r(e.status, t.get(e.path))) - } -}, function (e, t) { - 'use strict'; - t.fromCallback = function (e) { - return Object.defineProperty(function () { - return 'function' == typeof arguments[arguments.length - 1] ? void e.apply(this, arguments) : new Promise((t, n) => { - arguments[arguments.length] = (e, o) => e ? n(e) : void t(o), arguments.length++, e.apply(this, arguments) - }) - }, 'name', { - value: e.name - }) - }, t.fromPromise = function (e) { - return Object.defineProperty(function () { - const t = arguments[arguments.length - 1]; - return 'function' == typeof t ? void e.apply(this, arguments).then((e) => t(null, e), t) : e.apply(this, arguments) - }, 'name', { - value: e.name - }) - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(22), - r = n(1); - t.shell = { - moveItemToTrash: o.shell.moveItemToTrash, - beep: o.shell.beep, - openExternal: (e) => new Promise((t) => { - o.ipcRenderer.once('open-external-result', (e, { - result: n - }) => { - t(n) - }), o.ipcRenderer.send('open-external', { - path: e - }) - }), - showItemInFolder: (e) => { - o.ipcRenderer.send('show-item-in-folder', { - path: e - }) - }, - openItem: o.shell.openItem - }, t.revealInFileManager = function (e, n) { - const o = r.join(e.path, n); - return t.shell.showItemInFolder(o) - } -}, function (e, t, n) { - 'use strict'; - const o = n(39).fromCallback, - r = o(n(743)), - i = n(742); - e.exports = { - mkdirs: r, - mkdirsSync: i, - mkdirp: r, - mkdirpSync: i, - ensureDir: r, - ensureDirSync: i - } -}, function (e) { - e.exports = require('url') -}, function (e, t, n) { - 'use strict'; + function bt(e) { + var t, n, r, i, o, s, a, l = yt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "")); + if (l) { + var c = (t = l[4], n = l[3], r = l[2], i = l[5], o = l[6], s = l[7], a = [vt(t), Te.indexOf(n), parseInt(r, 10), parseInt(i, 10), parseInt(o, 10)], s && a.push(parseInt(s, 10)), a); + if (! function (e, t, n) { + return !e || Ue.indexOf(e) === new Date(t[0], t[1], t[2]).getDay() || (d(n).weekdayMismatch = !0, n._isValid = !1, !1) + }(l[1], c, e)) return; + e._a = c, e._tzm = function (e, t, n) { + if (e) return wt[e]; + if (t) return 0; + var r = parseInt(n, 10), + i = r % 100; + return (r - i) / 100 * 60 + i + }(l[8], l[9], l[10]), e._d = Oe.apply(null, e._a), e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm), d(e).rfc2822 = !0 + } else e._isValid = !1 + } - function o() { - if ('undefined' != typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && 'function' == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) { - try { - __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o) - } catch (e) { - console.error(e) + function St(e) { + if (e._f !== r.ISO_8601) + if (e._f !== r.RFC_2822) { + e._a = [], d(e).empty = !0; + var t, n, i, o, s, a = "" + e._i, + l = a.length, + c = 0; + for (i = G(e._f, e._locale).match(H) || [], t = 0; t < i.length; t++) o = i[t], (n = (a.match(ue(o, e)) || [])[0]) && ((s = a.substr(0, a.indexOf(n))).length > 0 && d(e).unusedInput.push(s), a = a.slice(a.indexOf(n) + n.length), c += n.length), W[o] ? (n ? d(e).empty = !1 : d(e).unusedTokens.push(o), me(o, n, e)) : e._strict && !n && d(e).unusedTokens.push(o); + d(e).charsLeftOver = l - c, a.length > 0 && d(e).unusedInput.push(a), e._a[3] <= 12 && !0 === d(e).bigHour && e._a[3] > 0 && (d(e).bigHour = void 0), d(e).parsedDateParts = e._a.slice(0), d(e).meridiem = e._meridiem, e._a[3] = function (e, t, n) { + var r; + return null == n ? t : null != e.meridiemHour ? e.meridiemHour(t, n) : null != e.isPM ? ((r = e.isPM(n)) && t < 12 && (t += 12), r || 12 !== t || (t = 0), t) : t + }(e._locale, e._a[3], e._meridiem), ct(e), at(e) + } else bt(e); + else gt(e) } - } - } - o(), e.exports = n(789) -}, function (e) { - var t = String.fromCharCode, - n = Math.round, - o = Math.abs, - r = Math.max, - a = Math.floor, - s = Math.ceil, - d = Math.min; - (function (t, n) { - e.exports = n() - })(this, function () { - 'use strict'; - function e(e) { - return new RegExp('(^|\\s)' + e + '(?:$|\\s)\\s*') - } + function Ct(e) { + var t = e._i, + n = e._f; + return e._locale = e._locale || st(e._l), null === t || void 0 === n && "" === t ? m({ + nullInput: !0 + }) : ("string" == typeof t && (e._i = t = e._locale.preparse(t)), b(t) ? new w(at(t)) : (l(t) ? e._d = t : i(n) ? function (e) { + var t, n, r, i, o; + if (0 === e._f.length) return d(e).invalidFormat = !0, void(e._d = new Date(NaN)); + for (i = 0; i < e._f.length; i++) o = 0, t = y({}, e), null != e._useUTC && (t._useUTC = e._useUTC), t._f = e._f[i], St(t), f(t) && (o += d(t).charsLeftOver, o += 10 * d(t).unusedTokens.length, d(t).score = o, (null == r || o < r) && (r = o, n = t)); + h(e, n || t) + }(e) : n ? St(e) : function (e) { + var t = e._i; + s(t) ? e._d = new Date(r.now()) : l(t) ? e._d = new Date(t.valueOf()) : "string" == typeof t ? function (e) { + var t = mt.exec(e._i); + null === t ? (gt(e), !1 === e._isValid && (delete e._isValid, bt(e), !1 === e._isValid && (delete e._isValid, r.createFromInputFallback(e)))) : e._d = new Date(+t[1]) + }(e) : i(t) ? (e._a = c(t.slice(0), (function (e) { + return parseInt(e, 10) + })), ct(e)) : o(t) ? function (e) { + if (!e._d) { + var t = L(e._i); + e._a = c([t.year, t.month, t.day || t.date, t.hour, t.minute, t.second, t.millisecond], (function (e) { + return e && parseInt(e, 10) + })), ct(e) + } + }(e) : a(t) ? e._d = new Date(t) : r.createFromInputFallback(e) + }(e), f(e) || (e._d = null), e)) + } - function l(t) { - for (var e = t.childNodes.length; 0 < e; --e) t.removeChild(t.firstChild); - return t - } + function Et(e, t, n, r, s) { + var a, l = {}; + return !0 !== n && !1 !== n || (r = n, n = void 0), (o(e) && function (e) { + if (Object.getOwnPropertyNames) return 0 === Object.getOwnPropertyNames(e).length; + var t; + for (t in e) + if (e.hasOwnProperty(t)) return !1; + return !0 + }(e) || i(e) && 0 === e.length) && (e = void 0), l._isAMomentObject = !0, l._useUTC = l._isUTC = s, l._l = n, l._i = e, l._f = t, l._strict = r, (a = new w(at(Ct(l))))._nextDay && (a.add(1, "d"), a._nextDay = void 0), a + } - function c(t, n) { - return l(t).appendChild(n) - } + function kt(e, t, n, r) { + return Et(e, t, n, r, !1) + } + r.createFromInputFallback = x("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", (function (e) { + e._d = new Date(e._i + (e._useUTC ? " UTC" : "")) + })), r.ISO_8601 = function () {}, r.RFC_2822 = function () {}; + var xt = x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", (function () { + var e = kt.apply(null, arguments); + return this.isValid() && e.isValid() ? e < this ? this : e : m() + })), + Tt = x("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", (function () { + var e = kt.apply(null, arguments); + return this.isValid() && e.isValid() ? e > this ? this : e : m() + })); - function p(t, n, o, r) { - var a = document.createElement(t); - if (o && (a.className = o), r && (a.style.cssText = r), 'string' == typeof n) a.appendChild(document.createTextNode(n)); - else if (n) - for (var e = 0; e < n.length; ++e) a.appendChild(n[e]); - return a - } + function Rt(e, t) { + var n, r; + if (1 === t.length && i(t[0]) && (t = t[0]), !t.length) return kt(); + for (n = t[0], r = 1; r < t.length; ++r) t[r].isValid() && !t[r][e](n) || (n = t[r]); + return n + } + var Dt = ["year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond"]; - function u(t, n, o, r) { - var i = p(t, n, o, r); - return i.setAttribute('role', 'presentation'), i - } + function _t(e) { + var t = L(e), + n = t.year || 0, + r = t.quarter || 0, + i = t.month || 0, + o = t.week || t.isoWeek || 0, + s = t.day || 0, + a = t.hour || 0, + l = t.minute || 0, + c = t.second || 0, + u = t.millisecond || 0; + this._isValid = function (e) { + for (var t in e) + if (-1 === ve.call(Dt, t) || null != e[t] && isNaN(e[t])) return !1; + for (var n = !1, r = 0; r < Dt.length; ++r) + if (e[Dt[r]]) { + if (n) return !1; + parseFloat(e[Dt[r]]) !== C(e[Dt[r]]) && (n = !0) + } return !0 + }(t), this._milliseconds = +u + 1e3 * c + 6e4 * l + 1e3 * a * 60 * 60, this._days = +s + 7 * o, this._months = +i + 3 * r + 12 * n, this._data = {}, this._locale = st(), this._bubble() + } - function m(e, t) { - if (3 == t.nodeType && (t = t.parentNode), e.contains) return e.contains(t); - do - if (11 == t.nodeType && (t = t.host), t == e) return !0; while (t = t.parentNode) - } + function At(e) { + return e instanceof _t + } - function h() { - var e; - try { - e = document.activeElement - } catch (t) { - e = document.body || null + function Mt(e) { + return e < 0 ? -1 * Math.round(-1 * e) : Math.round(e) } - for (; e && e.shadowRoot && e.shadowRoot.activeElement;) e = e.shadowRoot.activeElement; - return e - } - function f(t, n) { - var o = t.className; - e(n).test(o) || (t.className += (o ? ' ' : '') + n) - } + function Pt(e, t) { + V(e, 0, 0, (function () { + var e = this.utcOffset(), + n = "+"; + return e < 0 && (e = -e, n = "-"), n + B(~~(e / 60), 2) + t + B(~~e % 60, 2) + })) + } + Pt("Z", ":"), Pt("ZZ", ""), ce("Z", se), ce("ZZ", se), de(["Z", "ZZ"], (function (e, t, n) { + n._useUTC = !0, n._tzm = Ot(se, e) + })); + var It = /([\+\-]|\d\d)/gi; - function g(t, n) { - for (var o = t.split(' '), r = 0; r < o.length; r++) o[r] && !e(o[r]).test(n) && (n += ' ' + o[r]); - return n - } + function Ot(e, t) { + var n = (t || "").match(e); + if (null === n) return null; + var r = ((n[n.length - 1] || []) + "").match(It) || ["-", 0, 0], + i = 60 * r[1] + C(r[2]); + return 0 === i ? 0 : "+" === r[0] ? i : -i + } - function y(e) { - var t = Array.prototype.slice.call(arguments, 1); - return function () { - return e.apply(null, t) + function Lt(e, t) { + var n, i; + return t._isUTC ? (n = t.clone(), i = (b(e) || l(e) ? e.valueOf() : kt(e).valueOf()) - n.valueOf(), n._d.setTime(n._d.valueOf() + i), r.updateOffset(n, !1), n) : kt(e).local() } - } - - function S(e, t, n) { - for (var o in t || (t = {}), e) e.hasOwnProperty(o) && (!1 !== n || !t.hasOwnProperty(o)) && (t[o] = e[o]); - return t - } - function C(e, t, o, r, a) { - null == t && (t = e.search(/[^\s\u00a0]/), -1 == t && (t = e.length)); - for (var s = r || 0, i = a || 0, n;;) { - if (n = e.indexOf('\t', s), 0 > n || n >= t) return i + (t - s); - i += n - s, i += o - i % o, s = n + 1 + function Nt(e) { + return 15 * -Math.round(e._d.getTimezoneOffset() / 15) } - } - - function b(e, t) { - for (var n = 0; n < e.length; ++n) - if (e[n] == t) return n; - return -1 - } - function v(e, t, n) { - for (var o = 0, r = 0, i;;) { - i = e.indexOf('\t', o), -1 == i && (i = e.length); - var a = i - o; - if (i == e.length || r + a >= t) return o + d(a, t - r); - if (r += i - o, r += n - r % n, o = i + 1, r >= t) return o + function Ft() { + return !!this.isValid() && this._isUTC && 0 === this._offset } - } - - function E(e) { - for (; es.length <= e;) es.push(w(es) + ' '); - return es[e] - } - - function w(e) { - return e[e.length - 1] - } - - function k(e, t) { - for (var n = [], o = 0; o < e.length; o++) n[o] = t(e[o], o); - return n - } - - function T(e, t, n) { - for (var o = 0, r = n(t); o < e.length && n(e[o]) <= r;) o++; - e.splice(o, 0, t) - } - - function _() {} - - function R(e, t) { - var n; - return Object.create ? n = Object.create(e) : (_.prototype = e, n = new _), t && S(t, n), n - } - - function x(e) { - return /\w/.test(e) || '\x80' < e && (e.toUpperCase() != e.toLowerCase() || ts.test(e)) - } + r.updateOffset = function () {}; + var Bt = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/, + Ht = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; - function P(e, t) { - return t ? !!(-1 < t.source.indexOf('\\w') && x(e)) || t.test(e) : x(e) - } - - function D(e) { - for (var t in e) - if (e.hasOwnProperty(t) && e[t]) return !1; - return !0 - } - - function M(e) { - return 768 <= e.charCodeAt(0) && ns.test(e) - } - - function A(e, t, n) { - for (; - (0 > n ? 0 < t : t < e.length) && M(e.charAt(t));) t += n; - return t - } - - function I(e, t, n) { - for (var o = t > n ? -1 : 1;;) { - if (t == n) return t; - var r = (t + n) / 2, - i = 0 > o ? s(r) : a(r); - if (i == t) return e(i) ? t : n; - e(i) ? n = i : t = i + o + function zt(e, t) { + var n, r, i, o, s, l, c = e, + h = null; + return At(e) ? c = { + ms: e._milliseconds, + d: e._days, + M: e._months + } : a(e) ? (c = {}, t ? c[t] = e : c.milliseconds = e) : (h = Bt.exec(e)) ? (n = "-" === h[1] ? -1 : 1, c = { + y: 0, + d: C(h[2]) * n, + h: C(h[3]) * n, + m: C(h[4]) * n, + s: C(h[5]) * n, + ms: C(Mt(1e3 * h[6])) * n + }) : (h = Ht.exec(e)) ? (n = "-" === h[1] ? -1 : 1, c = { + y: Ut(h[2], n), + M: Ut(h[3], n), + w: Ut(h[4], n), + d: Ut(h[5], n), + h: Ut(h[6], n), + m: Ut(h[7], n), + s: Ut(h[8], n) + }) : null == c ? c = {} : "object" == typeof c && ("from" in c || "to" in c) && (o = kt(c.from), s = kt(c.to), i = o.isValid() && s.isValid() ? (s = Lt(s, o), o.isBefore(s) ? l = Wt(o, s) : ((l = Wt(s, o)).milliseconds = -l.milliseconds, l.months = -l.months), l) : { + milliseconds: 0, + months: 0 + }, (c = {}).ms = i.milliseconds, c.M = i.months), r = new _t(c), At(e) && u(e, "_locale") && (r._locale = e._locale), r } - } - - function L(e, t, n, o) { - if (!e) return o(t, n, 'ltr', 0); - for (var a = !1, s = 0, i; s < e.length; ++s) i = e[s], (i.from < n && i.to > t || t == n && i.to == t) && (o(r(i.from, t), d(i.to, n), 1 == i.level ? 'rtl' : 'ltr', s), a = !0); - a || o(t, n, 'ltr') - } - function F(e, t, n) { - var o; - os = null; - for (var r = 0, i; r < e.length; ++r) { - if (i = e[r], i.from < t && i.to > t) return r; - i.to == t && (i.from != i.to && 'before' == n ? o = r : os = r), i.from == t && (i.from != i.to && 'before' != n ? o = r : os = r) + function Ut(e, t) { + var n = e && parseFloat(e.replace(",", ".")); + return (isNaN(n) ? 0 : n) * t } - return null == o ? os : o - } - - function B(e, t) { - var n = e.order; - return null == n && (n = e.order = rs(e.text, t)), n - } - function N(e, t) { - return e._handlers && e._handlers[t] || is - } + function Wt(e, t) { + var n = {}; + return n.months = t.month() - e.month() + 12 * (t.year() - e.year()), e.clone().add(n.months, "M").isAfter(t) && --n.months, n.milliseconds = +t - +e.clone().add(n.months, "M"), n + } - function O(e, t, n) { - if (e.removeEventListener) e.removeEventListener(t, n, !1); - else if (e.detachEvent) e.detachEvent('on' + t, n); - else { - var o = e._handlers, - r = o && o[t]; - if (r) { - var i = b(r, n); - 1 < i && (o[t] = r.slice(0, i).concat(r.slice(i + 1))) + function Vt(e, t) { + return function (n, r) { + var i; + return null === r || isNaN(+r) || (D(t, "moment()." + t + "(period, number) is deprecated. Please use moment()." + t + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."), i = n, n = r, r = i), jt(this, zt(n = "string" == typeof n ? +n : n, r), e), this } } - } - function H(e, t) { - var n = N(e, t); - if (n.length) - for (var o = Array.prototype.slice.call(arguments, 2), r = 0; r < n.length; ++r) n[r].apply(null, o) - } + function jt(e, t, n, i) { + var o = t._milliseconds, + s = Mt(t._days), + a = Mt(t._months); + e.isValid() && (i = null == i || i, a && De(e, Se(e, "Month") + a * n), s && Ce(e, "Date", Se(e, "Date") + s * n), o && e._d.setTime(e._d.valueOf() + o * n), i && r.updateOffset(e, s || a)) + } + zt.fn = _t.prototype, zt.invalid = function () { + return zt(NaN) + }; + var Gt = Vt(1, "add"), + $t = Vt(-1, "subtract"); - function z(t, n, o) { - return 'string' == typeof n && (n = { - type: n, - preventDefault: function () { - this.defaultPrevented = !0 - } - }), H(t, o || n.type, t, n), j(n) || n.codemirrorIgnore - } + function qt(e, t) { + var n = 12 * (t.year() - e.year()) + (t.month() - e.month()), + r = e.clone().add(n, "months"); + return -(n + (t - r < 0 ? (t - r) / (r - e.clone().add(n - 1, "months")) : (t - r) / (e.clone().add(n + 1, "months") - r))) || 0 + } - function U(e) { - var t = e._handlers && e._handlers.cursorActivity; - if (t) - for (var n = e.curOp.cursorActivityHandlers || (e.curOp.cursorActivityHandlers = []), o = 0; o < t.length; ++o) - 1 == b(n, t[o]) && n.push(t[o]) - } + function Kt(e) { + var t; + return void 0 === e ? this._locale._abbr : (null != (t = st(e)) && (this._locale = t), this) + } + r.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ", r.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]"; + var Yt = x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", (function (e) { + return void 0 === e ? this.localeData() : this.locale(e) + })); - function W(e, t) { - return 0 < N(e, t).length - } + function Qt() { + return this._locale + } - function V(e) { - e.prototype.on = function (e, t) { - as(this, e, t) - }, e.prototype.off = function (e, t) { - O(this, e, t) + function Zt(e, t) { + return (e % t + t) % t } - } - function G(t) { - t.preventDefault ? t.preventDefault() : t.returnValue = !1 - } + function Xt(e, t, n) { + return e < 100 && e >= 0 ? new Date(e + 400, t, n) - 126227808e5 : new Date(e, t, n).valueOf() + } - function K(t) { - t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0 - } + function Jt(e, t, n) { + return e < 100 && e >= 0 ? Date.UTC(e + 400, t, n) - 126227808e5 : Date.UTC(e, t, n) + } - function j(t) { - return null == t.defaultPrevented ? !1 == t.returnValue : t.defaultPrevented - } + function en(e, t) { + V(0, [e, e.length], 0, t) + } - function q(t) { - G(t), K(t) - } + function tn(e, t, n, r, i) { + var o; + return null == e ? Fe(this, r, i).year : (t > (o = Be(e, r, i)) && (t = o), nn.call(this, e, t, n, r, i)) + } - function Y(t) { - return t.target || t.srcElement - } + function nn(e, t, n, r, i) { + var o = Ne(e, t, n, r, i), + s = Oe(o.year, 0, o.dayOfYear); + return this.year(s.getUTCFullYear()), this.month(s.getUTCMonth()), this.date(s.getUTCDate()), this + } + V(0, ["gg", 2], 0, (function () { + return this.weekYear() % 100 + })), V(0, ["GG", 2], 0, (function () { + return this.isoWeekYear() % 100 + })), en("gggg", "weekYear"), en("ggggg", "weekYear"), en("GGGG", "isoWeekYear"), en("GGGGG", "isoWeekYear"), I("weekYear", "gg"), I("isoWeekYear", "GG"), F("weekYear", 1), F("isoWeekYear", 1), ce("G", ie), ce("g", ie), ce("GG", Z, q), ce("gg", Z, q), ce("GGGG", te, Y), ce("gggg", te, Y), ce("GGGGG", ne, Q), ce("ggggg", ne, Q), fe(["gggg", "ggggg", "GGGG", "GGGGG"], (function (e, t, n, r) { + t[r.substr(0, 2)] = C(e) + })), fe(["gg", "GG"], (function (e, t, n, i) { + t[i] = r.parseTwoDigitYear(e) + })), V("Q", 0, "Qo", "quarter"), I("quarter", "Q"), F("quarter", 7), ce("Q", $), de("Q", (function (e, t) { + t[1] = 3 * (C(e) - 1) + })), V("D", ["DD", 2], "Do", "date"), I("date", "D"), F("date", 9), ce("D", Z), ce("DD", Z, q), ce("Do", (function (e, t) { + return e ? t._dayOfMonthOrdinalParse || t._ordinalParse : t._dayOfMonthOrdinalParseLenient + })), de(["D", "DD"], 2), de("Do", (function (e, t) { + t[2] = C(e.match(Z)[0]) + })); + var rn = be("Date", !0); + V("DDD", ["DDDD", 3], "DDDo", "dayOfYear"), I("dayOfYear", "DDD"), F("dayOfYear", 4), ce("DDD", ee), ce("DDDD", K), de(["DDD", "DDDD"], (function (e, t, n) { + n._dayOfYear = C(e) + })), V("m", ["mm", 2], 0, "minute"), I("minute", "m"), F("minute", 14), ce("m", Z), ce("mm", Z, q), de(["m", "mm"], 4); + var on = be("Minutes", !1); + V("s", ["ss", 2], 0, "second"), I("second", "s"), F("second", 15), ce("s", Z), ce("ss", Z, q), de(["s", "ss"], 5); + var sn, an = be("Seconds", !1); + for (V("S", 0, 0, (function () { + return ~~(this.millisecond() / 100) + })), V(0, ["SS", 2], 0, (function () { + return ~~(this.millisecond() / 10) + })), V(0, ["SSS", 3], 0, "millisecond"), V(0, ["SSSS", 4], 0, (function () { + return 10 * this.millisecond() + })), V(0, ["SSSSS", 5], 0, (function () { + return 100 * this.millisecond() + })), V(0, ["SSSSSS", 6], 0, (function () { + return 1e3 * this.millisecond() + })), V(0, ["SSSSSSS", 7], 0, (function () { + return 1e4 * this.millisecond() + })), V(0, ["SSSSSSSS", 8], 0, (function () { + return 1e5 * this.millisecond() + })), V(0, ["SSSSSSSSS", 9], 0, (function () { + return 1e6 * this.millisecond() + })), I("millisecond", "ms"), F("millisecond", 16), ce("S", ee, $), ce("SS", ee, q), ce("SSS", ee, K), sn = "SSSS"; sn.length <= 9; sn += "S") ce(sn, re); + + function ln(e, t) { + t[6] = C(1e3 * ("0." + e)) + } + for (sn = "S"; sn.length <= 9; sn += "S") de(sn, ln); + var cn = be("Milliseconds", !1); + V("z", 0, 0, "zoneAbbr"), V("zz", 0, 0, "zoneName"); + var un = w.prototype; + + function hn(e) { + return e + } + un.add = Gt, un.calendar = function (e, t) { + var n = e || kt(), + i = Lt(n, this).startOf("day"), + o = r.calendarFormat(this, i) || "sameElse", + s = t && (_(t[o]) ? t[o].call(this, n) : t[o]); + return this.format(s || this.localeData().calendar(o, this, kt(n))) + }, un.clone = function () { + return new w(this) + }, un.diff = function (e, t, n) { + var r, i, o; + if (!this.isValid()) return NaN; + if (!(r = Lt(e, this)).isValid()) return NaN; + switch (i = 6e4 * (r.utcOffset() - this.utcOffset()), t = O(t)) { + case "year": + o = qt(this, r) / 12; + break; + case "month": + o = qt(this, r); + break; + case "quarter": + o = qt(this, r) / 3; + break; + case "second": + o = (this - r) / 1e3; + break; + case "minute": + o = (this - r) / 6e4; + break; + case "hour": + o = (this - r) / 36e5; + break; + case "day": + o = (this - r - i) / 864e5; + break; + case "week": + o = (this - r - i) / 6048e5; + break; + default: + o = this - r + } + return n ? o : S(o) + }, un.endOf = function (e) { + var t; + if (void 0 === (e = O(e)) || "millisecond" === e || !this.isValid()) return this; + var n = this._isUTC ? Jt : Xt; + switch (e) { + case "year": + t = n(this.year() + 1, 0, 1) - 1; + break; + case "quarter": + t = n(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; + break; + case "month": + t = n(this.year(), this.month() + 1, 1) - 1; + break; + case "week": + t = n(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; + break; + case "isoWeek": + t = n(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; + break; + case "day": + case "date": + t = n(this.year(), this.month(), this.date() + 1) - 1; + break; + case "hour": + t = this._d.valueOf(), t += 36e5 - Zt(t + (this._isUTC ? 0 : 6e4 * this.utcOffset()), 36e5) - 1; + break; + case "minute": + t = this._d.valueOf(), t += 6e4 - Zt(t, 6e4) - 1; + break; + case "second": + t = this._d.valueOf(), t += 1e3 - Zt(t, 1e3) - 1 + } + return this._d.setTime(t), r.updateOffset(this, !0), this + }, un.format = function (e) { + e || (e = this.isUtc() ? r.defaultFormatUtc : r.defaultFormat); + var t = j(this, e); + return this.localeData().postformat(t) + }, un.from = function (e, t) { + return this.isValid() && (b(e) && e.isValid() || kt(e).isValid()) ? zt({ + to: this, + from: e + }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate() + }, un.fromNow = function (e) { + return this.from(kt(), e) + }, un.to = function (e, t) { + return this.isValid() && (b(e) && e.isValid() || kt(e).isValid()) ? zt({ + from: this, + to: e + }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate() + }, un.toNow = function (e) { + return this.to(kt(), e) + }, un.get = function (e) { + return _(this[e = O(e)]) ? this[e]() : this + }, un.invalidAt = function () { + return d(this).overflow + }, un.isAfter = function (e, t) { + var n = b(e) ? e : kt(e); + return !(!this.isValid() || !n.isValid()) && ("millisecond" === (t = O(t) || "millisecond") ? this.valueOf() > n.valueOf() : n.valueOf() < this.clone().startOf(t).valueOf()) + }, un.isBefore = function (e, t) { + var n = b(e) ? e : kt(e); + return !(!this.isValid() || !n.isValid()) && ("millisecond" === (t = O(t) || "millisecond") ? this.valueOf() < n.valueOf() : this.clone().endOf(t).valueOf() < n.valueOf()) + }, un.isBetween = function (e, t, n, r) { + var i = b(e) ? e : kt(e), + o = b(t) ? t : kt(t); + return !!(this.isValid() && i.isValid() && o.isValid()) && ("(" === (r = r || "()")[0] ? this.isAfter(i, n) : !this.isBefore(i, n)) && (")" === r[1] ? this.isBefore(o, n) : !this.isAfter(o, n)) + }, un.isSame = function (e, t) { + var n, r = b(e) ? e : kt(e); + return !(!this.isValid() || !r.isValid()) && ("millisecond" === (t = O(t) || "millisecond") ? this.valueOf() === r.valueOf() : (n = r.valueOf(), this.clone().startOf(t).valueOf() <= n && n <= this.clone().endOf(t).valueOf())) + }, un.isSameOrAfter = function (e, t) { + return this.isSame(e, t) || this.isAfter(e, t) + }, un.isSameOrBefore = function (e, t) { + return this.isSame(e, t) || this.isBefore(e, t) + }, un.isValid = function () { + return f(this) + }, un.lang = Yt, un.locale = Kt, un.localeData = Qt, un.max = Tt, un.min = xt, un.parsingFlags = function () { + return h({}, d(this)) + }, un.set = function (e, t) { + if ("object" == typeof e) + for (var n = function (e) { + var t = []; + for (var n in e) t.push({ + unit: n, + priority: N[n] + }); + return t.sort((function (e, t) { + return e.priority - t.priority + })), t + }(e = L(e)), r = 0; r < n.length; r++) this[n[r].unit](e[n[r].unit]); + else if (_(this[e = O(e)])) return this[e](t); + return this + }, un.startOf = function (e) { + var t; + if (void 0 === (e = O(e)) || "millisecond" === e || !this.isValid()) return this; + var n = this._isUTC ? Jt : Xt; + switch (e) { + case "year": + t = n(this.year(), 0, 1); + break; + case "quarter": + t = n(this.year(), this.month() - this.month() % 3, 1); + break; + case "month": + t = n(this.year(), this.month(), 1); + break; + case "week": + t = n(this.year(), this.month(), this.date() - this.weekday()); + break; + case "isoWeek": + t = n(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); + break; + case "day": + case "date": + t = n(this.year(), this.month(), this.date()); + break; + case "hour": + t = this._d.valueOf(), t -= Zt(t + (this._isUTC ? 0 : 6e4 * this.utcOffset()), 36e5); + break; + case "minute": + t = this._d.valueOf(), t -= Zt(t, 6e4); + break; + case "second": + t = this._d.valueOf(), t -= Zt(t, 1e3) + } + return this._d.setTime(t), r.updateOffset(this, !0), this + }, un.subtract = $t, un.toArray = function () { + var e = this; + return [e.year(), e.month(), e.date(), e.hour(), e.minute(), e.second(), e.millisecond()] + }, un.toObject = function () { + var e = this; + return { + years: e.year(), + months: e.month(), + date: e.date(), + hours: e.hours(), + minutes: e.minutes(), + seconds: e.seconds(), + milliseconds: e.milliseconds() + } + }, un.toDate = function () { + return new Date(this.valueOf()) + }, un.toISOString = function (e) { + if (!this.isValid()) return null; + var t = !0 !== e, + n = t ? this.clone().utc() : this; + return n.year() < 0 || n.year() > 9999 ? j(n, t ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ") : _(Date.prototype.toISOString) ? t ? this.toDate().toISOString() : new Date(this.valueOf() + 60 * this.utcOffset() * 1e3).toISOString().replace("Z", j(n, "Z")) : j(n, t ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ") + }, un.inspect = function () { + if (!this.isValid()) return "moment.invalid(/* " + this._i + " */)"; + var e = "moment", + t = ""; + this.isLocal() || (e = 0 === this.utcOffset() ? "moment.utc" : "moment.parseZone", t = "Z"); + var n = "[" + e + '("]', + r = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY", + i = t + '[")]'; + return this.format(n + r + "-MM-DD[T]HH:mm:ss.SSS" + i) + }, un.toJSON = function () { + return this.isValid() ? this.toISOString() : null + }, un.toString = function () { + return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ") + }, un.unix = function () { + return Math.floor(this.valueOf() / 1e3) + }, un.valueOf = function () { + return this._d.valueOf() - 6e4 * (this._offset || 0) + }, un.creationData = function () { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict + } + }, un.year = we, un.isLeapYear = function () { + return ye(this.year()) + }, un.weekYear = function (e) { + return tn.call(this, e, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy) + }, un.isoWeekYear = function (e) { + return tn.call(this, e, this.isoWeek(), this.isoWeekday(), 1, 4) + }, un.quarter = un.quarters = function (e) { + return null == e ? Math.ceil((this.month() + 1) / 3) : this.month(3 * (e - 1) + this.month() % 3) + }, un.month = _e, un.daysInMonth = function () { + return Ee(this.year(), this.month()) + }, un.week = un.weeks = function (e) { + var t = this.localeData().week(this); + return null == e ? t : this.add(7 * (e - t), "d") + }, un.isoWeek = un.isoWeeks = function (e) { + var t = Fe(this, 1, 4).week; + return null == e ? t : this.add(7 * (e - t), "d") + }, un.weeksInYear = function () { + var e = this.localeData()._week; + return Be(this.year(), e.dow, e.doy) + }, un.isoWeeksInYear = function () { + return Be(this.year(), 1, 4) + }, un.date = rn, un.day = un.days = function (e) { + if (!this.isValid()) return null != e ? this : NaN; + var t = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + return null != e ? (e = function (e, t) { + return "string" != typeof e ? e : isNaN(e) ? "number" == typeof (e = t.weekdaysParse(e)) ? e : null : parseInt(e, 10) + }(e, this.localeData()), this.add(e - t, "d")) : t + }, un.weekday = function (e) { + if (!this.isValid()) return null != e ? this : NaN; + var t = (this.day() + 7 - this.localeData()._week.dow) % 7; + return null == e ? t : this.add(e - t, "d") + }, un.isoWeekday = function (e) { + if (!this.isValid()) return null != e ? this : NaN; + if (null != e) { + var t = function (e, t) { + return "string" == typeof e ? t.weekdaysParse(e) % 7 || 7 : isNaN(e) ? null : e + }(e, this.localeData()); + return this.day(this.day() % 7 ? t : t - 7) + } + return this.day() || 7 + }, un.dayOfYear = function (e) { + var t = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1; + return null == e ? t : this.add(e - t, "d") + }, un.hour = un.hours = Xe, un.minute = un.minutes = on, un.second = un.seconds = an, un.millisecond = un.milliseconds = cn, un.utcOffset = function (e, t, n) { + var i, o = this._offset || 0; + if (!this.isValid()) return null != e ? this : NaN; + if (null != e) { + if ("string" == typeof e) { + if (null === (e = Ot(se, e))) return this + } else Math.abs(e) < 16 && !n && (e *= 60); + return !this._isUTC && t && (i = Nt(this)), this._offset = e, this._isUTC = !0, null != i && this.add(i, "m"), o !== e && (!t || this._changeInProgress ? jt(this, zt(e - o, "m"), 1, !1) : this._changeInProgress || (this._changeInProgress = !0, r.updateOffset(this, !0), this._changeInProgress = null)), this + } + return this._isUTC ? o : Nt(this) + }, un.utc = function (e) { + return this.utcOffset(0, e) + }, un.local = function (e) { + return this._isUTC && (this.utcOffset(0, e), this._isUTC = !1, e && this.subtract(Nt(this), "m")), this + }, un.parseZone = function () { + if (null != this._tzm) this.utcOffset(this._tzm, !1, !0); + else if ("string" == typeof this._i) { + var e = Ot(oe, this._i); + null != e ? this.utcOffset(e) : this.utcOffset(0, !0) + } + return this + }, un.hasAlignedHourOffset = function (e) { + return !!this.isValid() && (e = e ? kt(e).utcOffset() : 0, (this.utcOffset() - e) % 60 == 0) + }, un.isDST = function () { + return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() + }, un.isLocal = function () { + return !!this.isValid() && !this._isUTC + }, un.isUtcOffset = function () { + return !!this.isValid() && this._isUTC + }, un.isUtc = Ft, un.isUTC = Ft, un.zoneAbbr = function () { + return this._isUTC ? "UTC" : "" + }, un.zoneName = function () { + return this._isUTC ? "Coordinated Universal Time" : "" + }, un.dates = x("dates accessor is deprecated. Use date instead.", rn), un.months = x("months accessor is deprecated. Use month instead", _e), un.years = x("years accessor is deprecated. Use year instead", we), un.zone = x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", (function (e, t) { + return null != e ? ("string" != typeof e && (e = -e), this.utcOffset(e, t), this) : -this.utcOffset() + })), un.isDSTShifted = x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", (function () { + if (!s(this._isDSTShifted)) return this._isDSTShifted; + var e = {}; + if (y(e, this), (e = Ct(e))._a) { + var t = e._isUTC ? p(e._a) : kt(e._a); + this._isDSTShifted = this.isValid() && E(e._a, t.toArray()) > 0 + } else this._isDSTShifted = !1; + return this._isDSTShifted + })); + var pn = M.prototype; - function X(t) { - var e = t.which; - return null == e && (1 & t.button ? e = 1 : 2 & t.button ? e = 3 : 4 & t.button && (e = 2)), Ha && t.ctrlKey && 1 == e && (e = 3), e - } + function dn(e, t, n, r) { + var i = st(), + o = p().set(r, t); + return i[n](o, e) + } - function Q(e) { - if (null == fs) { - var t = p('span', '\u200B'); - c(e, p('span', [t, document.createTextNode('x')])), 0 != e.firstChild.offsetHeight && (fs = 1 >= t.offsetWidth && 2 < t.offsetHeight && !(Ra && 8 > xa)) + function fn(e, t, n) { + if (a(e) && (t = e, e = void 0), e = e || "", null != t) return dn(e, t, n, "month"); + var r, i = []; + for (r = 0; r < 12; r++) i[r] = dn(e, r, n, "month"); + return i } - var n = fs ? p('span', '\u200B') : p('span', '\xA0', null, 'display: inline-block; width: 1px; margin-right: -1px'); - return n.setAttribute('cm-text', ''), n - } - function $(e) { - if (null != gs) return gs; - var t = c(e, document.createTextNode('A\u062EA')), - n = ja(t, 0, 1).getBoundingClientRect(), - o = ja(t, 1, 2).getBoundingClientRect(); - return l(e), !!(n && n.left != n.right) && (gs = 3 > o.right - n.right) - } + function mn(e, t, n, r) { + "boolean" == typeof e ? (a(t) && (n = t, t = void 0), t = t || "") : (n = t = e, e = !1, a(t) && (n = t, t = void 0), t = t || ""); + var i, o = st(), + s = e ? o._week.dow : 0; + if (null != n) return dn(t, (n + s) % 7, r, "day"); + var l = []; + for (i = 0; i < 7; i++) l[i] = dn(t, (i + s) % 7, r, "day"); + return l + } + pn.calendar = function (e, t, n) { + var r = this._calendar[e] || this._calendar.sameElse; + return _(r) ? r.call(t, n) : r + }, pn.longDateFormat = function (e) { + var t = this._longDateFormat[e], + n = this._longDateFormat[e.toUpperCase()]; + return t || !n ? t : (this._longDateFormat[e] = n.replace(/MMMM|MM|DD|dddd/g, (function (e) { + return e.slice(1) + })), this._longDateFormat[e]) + }, pn.invalidDate = function () { + return this._invalidDate + }, pn.ordinal = function (e) { + return this._ordinal.replace("%d", e) + }, pn.preparse = hn, pn.postformat = hn, pn.relativeTime = function (e, t, n, r) { + var i = this._relativeTime[n]; + return _(i) ? i(e, t, n, r) : i.replace(/%d/i, e) + }, pn.pastFuture = function (e, t) { + var n = this._relativeTime[e > 0 ? "future" : "past"]; + return _(n) ? n(t) : n.replace(/%s/i, t) + }, pn.set = function (e) { + var t, n; + for (n in e) _(t = e[n]) ? this[n] = t : this["_" + n] = t; + this._config = e, this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source) + }, pn.months = function (e, t) { + return e ? i(this._months) ? this._months[e.month()] : this._months[(this._months.isFormat || ke).test(t) ? "format" : "standalone"][e.month()] : i(this._months) ? this._months : this._months.standalone + }, pn.monthsShort = function (e, t) { + return e ? i(this._monthsShort) ? this._monthsShort[e.month()] : this._monthsShort[ke.test(t) ? "format" : "standalone"][e.month()] : i(this._monthsShort) ? this._monthsShort : this._monthsShort.standalone + }, pn.monthsParse = function (e, t, n) { + var r, i, o; + if (this._monthsParseExact) return Re.call(this, e, t, n); + for (this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), r = 0; r < 12; r++) { + if (i = p([2e3, r]), n && !this._longMonthsParse[r] && (this._longMonthsParse[r] = new RegExp("^" + this.months(i, "").replace(".", "") + "$", "i"), this._shortMonthsParse[r] = new RegExp("^" + this.monthsShort(i, "").replace(".", "") + "$", "i")), n || this._monthsParse[r] || (o = "^" + this.months(i, "") + "|^" + this.monthsShort(i, ""), this._monthsParse[r] = new RegExp(o.replace(".", ""), "i")), n && "MMMM" === t && this._longMonthsParse[r].test(e)) return r; + if (n && "MMM" === t && this._shortMonthsParse[r].test(e)) return r; + if (!n && this._monthsParse[r].test(e)) return r + } + }, pn.monthsRegex = function (e) { + return this._monthsParseExact ? (u(this, "_monthsRegex") || Pe.call(this), e ? this._monthsStrictRegex : this._monthsRegex) : (u(this, "_monthsRegex") || (this._monthsRegex = Me), this._monthsStrictRegex && e ? this._monthsStrictRegex : this._monthsRegex) + }, pn.monthsShortRegex = function (e) { + return this._monthsParseExact ? (u(this, "_monthsRegex") || Pe.call(this), e ? this._monthsShortStrictRegex : this._monthsShortRegex) : (u(this, "_monthsShortRegex") || (this._monthsShortRegex = Ae), this._monthsShortStrictRegex && e ? this._monthsShortStrictRegex : this._monthsShortRegex) + }, pn.week = function (e) { + return Fe(e, this._week.dow, this._week.doy).week + }, pn.firstDayOfYear = function () { + return this._week.doy + }, pn.firstDayOfWeek = function () { + return this._week.dow + }, pn.weekdays = function (e, t) { + var n = i(this._weekdays) ? this._weekdays : this._weekdays[e && !0 !== e && this._weekdays.isFormat.test(t) ? "format" : "standalone"]; + return !0 === e ? He(n, this._week.dow) : e ? n[e.day()] : n + }, pn.weekdaysMin = function (e) { + return !0 === e ? He(this._weekdaysMin, this._week.dow) : e ? this._weekdaysMin[e.day()] : this._weekdaysMin + }, pn.weekdaysShort = function (e) { + return !0 === e ? He(this._weekdaysShort, this._week.dow) : e ? this._weekdaysShort[e.day()] : this._weekdaysShort + }, pn.weekdaysParse = function (e, t, n) { + var r, i, o; + if (this._weekdaysParseExact) return Ve.call(this, e, t, n); + for (this._weekdaysParse || (this._weekdaysParse = [], this._minWeekdaysParse = [], this._shortWeekdaysParse = [], this._fullWeekdaysParse = []), r = 0; r < 7; r++) { + if (i = p([2e3, 1]).day(r), n && !this._fullWeekdaysParse[r] && (this._fullWeekdaysParse[r] = new RegExp("^" + this.weekdays(i, "").replace(".", "\\.?") + "$", "i"), this._shortWeekdaysParse[r] = new RegExp("^" + this.weekdaysShort(i, "").replace(".", "\\.?") + "$", "i"), this._minWeekdaysParse[r] = new RegExp("^" + this.weekdaysMin(i, "").replace(".", "\\.?") + "$", "i")), this._weekdaysParse[r] || (o = "^" + this.weekdays(i, "") + "|^" + this.weekdaysShort(i, "") + "|^" + this.weekdaysMin(i, ""), this._weekdaysParse[r] = new RegExp(o.replace(".", ""), "i")), n && "dddd" === t && this._fullWeekdaysParse[r].test(e)) return r; + if (n && "ddd" === t && this._shortWeekdaysParse[r].test(e)) return r; + if (n && "dd" === t && this._minWeekdaysParse[r].test(e)) return r; + if (!n && this._weekdaysParse[r].test(e)) return r + } + }, pn.weekdaysRegex = function (e) { + return this._weekdaysParseExact ? (u(this, "_weekdaysRegex") || qe.call(this), e ? this._weekdaysStrictRegex : this._weekdaysRegex) : (u(this, "_weekdaysRegex") || (this._weekdaysRegex = je), this._weekdaysStrictRegex && e ? this._weekdaysStrictRegex : this._weekdaysRegex) + }, pn.weekdaysShortRegex = function (e) { + return this._weekdaysParseExact ? (u(this, "_weekdaysRegex") || qe.call(this), e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex) : (u(this, "_weekdaysShortRegex") || (this._weekdaysShortRegex = Ge), this._weekdaysShortStrictRegex && e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex) + }, pn.weekdaysMinRegex = function (e) { + return this._weekdaysParseExact ? (u(this, "_weekdaysRegex") || qe.call(this), e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex) : (u(this, "_weekdaysMinRegex") || (this._weekdaysMinRegex = $e), this._weekdaysMinStrictRegex && e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex) + }, pn.isPM = function (e) { + return "p" === (e + "").toLowerCase().charAt(0) + }, pn.meridiem = function (e, t, n) { + return e > 11 ? n ? "pm" : "PM" : n ? "am" : "AM" + }, it("en", { + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function (e) { + var t = e % 10; + return e + (1 === C(e % 100 / 10) ? "th" : 1 === t ? "st" : 2 === t ? "nd" : 3 === t ? "rd" : "th") + } + }), r.lang = x("moment.lang is deprecated. Use moment.locale instead.", it), r.langData = x("moment.langData is deprecated. Use moment.localeData instead.", st); + var gn = Math.abs; - function Z(e) { - if (null != cs) return cs; - var t = c(e, p('span', 'x')), - n = t.getBoundingClientRect(), - r = ja(t, 0, 1).getBoundingClientRect(); - return cs = 1 < o(n.left - r.left) - } + function yn(e, t, n, r) { + var i = zt(t, n); + return e._milliseconds += r * i._milliseconds, e._days += r * i._days, e._months += r * i._months, e._bubble() + } - function J(e, t) { - 2 < arguments.length && (t.dependencies = Array.prototype.slice.call(arguments, 2)), ps[e] = t - } + function vn(e) { + return e < 0 ? Math.floor(e) : Math.ceil(e) + } - function ee(e) { - if ('string' == typeof e && us.hasOwnProperty(e)) e = us[e]; - else if (e && 'string' == typeof e.name && us.hasOwnProperty(e.name)) { - var t = us[e.name]; - 'string' == typeof t && (t = { - name: t - }), e = R(t, e), e.name = t.name - } else { - if ('string' == typeof e && /^[\w\-]+\/[\w\-]+\+xml$/.test(e)) return ee('application/xml'); - if ('string' == typeof e && /^[\w\-]+\/[\w\-]+\+json$/.test(e)) return ee('application/json') + function wn(e) { + return 4800 * e / 146097 } - return 'string' == typeof e ? { - name: e - } : e || { - name: 'null' + + function bn(e) { + return 146097 * e / 4800 } - } - function te(e, t) { - t = ee(t); - var n = ps[t.name]; - if (!n) return te(e, 'text/plain'); - var o = n(e, t); - if (ms.hasOwnProperty(t.name)) { - var r = ms[t.name]; - for (var i in r) r.hasOwnProperty(i) && (o.hasOwnProperty(i) && (o['_' + i] = o[i]), o[i] = r[i]) + function Sn(e) { + return function () { + return this.as(e) + } } - if (o.name = t.name, t.helperType && (o.helperType = t.helperType), t.modeProps) - for (var a in t.modeProps) o[a] = t.modeProps[a]; - return o - } + var Cn = Sn("ms"), + En = Sn("s"), + kn = Sn("m"), + xn = Sn("h"), + Tn = Sn("d"), + Rn = Sn("w"), + Dn = Sn("M"), + _n = Sn("Q"), + An = Sn("y"); - function ne(e, t) { - var n = ms.hasOwnProperty(e) ? ms[e] : ms[e] = {}; - S(t, n) - } + function Mn(e) { + return function () { + return this.isValid() ? this._data[e] : NaN + } + } + var Pn = Mn("milliseconds"), + In = Mn("seconds"), + On = Mn("minutes"), + Ln = Mn("hours"), + Nn = Mn("days"), + Fn = Mn("months"), + Bn = Mn("years"), + Hn = Math.round, + zn = { + ss: 44, + s: 45, + m: 45, + h: 22, + d: 26, + M: 11 + }; - function oe(e, t) { - if (!0 === t) return t; - if (e.copyState) return e.copyState(t); - var o = {}; - for (var r in t) { - var n = t[r]; - n instanceof Array && (n = n.concat([])), o[r] = n + function Un(e, t, n, r, i) { + return i.relativeTime(t || 1, !!n, e, r) } - return o - } + var Wn = Math.abs; - function re(e, t) { - for (var n; e.innerMode && (n = e.innerMode(t), n && n.mode != e);) t = n.state, e = n.mode; - return n || { - mode: e, - state: t + function Vn(e) { + return (e > 0) - (e < 0) || +e } + + function jn() { + if (!this.isValid()) return this.localeData().invalidDate(); + var e, t, n = Wn(this._milliseconds) / 1e3, + r = Wn(this._days), + i = Wn(this._months); + e = S(n / 60), t = S(e / 60), n %= 60, e %= 60; + var o = S(i / 12), + s = i %= 12, + a = r, + l = t, + c = e, + u = n ? n.toFixed(3).replace(/\.?0+$/, "") : "", + h = this.asSeconds(); + if (!h) return "P0D"; + var p = h < 0 ? "-" : "", + d = Vn(this._months) !== Vn(h) ? "-" : "", + f = Vn(this._days) !== Vn(h) ? "-" : "", + m = Vn(this._milliseconds) !== Vn(h) ? "-" : ""; + return p + "P" + (o ? d + o + "Y" : "") + (s ? d + s + "M" : "") + (a ? f + a + "D" : "") + (l || c || u ? "T" : "") + (l ? m + l + "H" : "") + (c ? m + c + "M" : "") + (u ? m + u + "S" : "") + } + var Gn = _t.prototype; + return Gn.isValid = function () { + return this._isValid + }, Gn.abs = function () { + var e = this._data; + return this._milliseconds = gn(this._milliseconds), this._days = gn(this._days), this._months = gn(this._months), e.milliseconds = gn(e.milliseconds), e.seconds = gn(e.seconds), e.minutes = gn(e.minutes), e.hours = gn(e.hours), e.months = gn(e.months), e.years = gn(e.years), this + }, Gn.add = function (e, t) { + return yn(this, e, t, 1) + }, Gn.subtract = function (e, t) { + return yn(this, e, t, -1) + }, Gn.as = function (e) { + if (!this.isValid()) return NaN; + var t, n, r = this._milliseconds; + if ("month" === (e = O(e)) || "quarter" === e || "year" === e) switch (t = this._days + r / 864e5, n = this._months + wn(t), e) { + case "month": + return n; + case "quarter": + return n / 3; + case "year": + return n / 12 + } else switch (t = this._days + Math.round(bn(this._months)), e) { + case "week": + return t / 7 + r / 6048e5; + case "day": + return t + r / 864e5; + case "hour": + return 24 * t + r / 36e5; + case "minute": + return 1440 * t + r / 6e4; + case "second": + return 86400 * t + r / 1e3; + case "millisecond": + return Math.floor(864e5 * t) + r; + default: + throw new Error("Unknown unit " + e) + } + }, Gn.asMilliseconds = Cn, Gn.asSeconds = En, Gn.asMinutes = kn, Gn.asHours = xn, Gn.asDays = Tn, Gn.asWeeks = Rn, Gn.asMonths = Dn, Gn.asQuarters = _n, Gn.asYears = An, Gn.valueOf = function () { + return this.isValid() ? this._milliseconds + 864e5 * this._days + this._months % 12 * 2592e6 + 31536e6 * C(this._months / 12) : NaN + }, Gn._bubble = function () { + var e, t, n, r, i, o = this._milliseconds, + s = this._days, + a = this._months, + l = this._data; + return o >= 0 && s >= 0 && a >= 0 || o <= 0 && s <= 0 && a <= 0 || (o += 864e5 * vn(bn(a) + s), s = 0, a = 0), l.milliseconds = o % 1e3, e = S(o / 1e3), l.seconds = e % 60, t = S(e / 60), l.minutes = t % 60, n = S(t / 60), l.hours = n % 24, s += S(n / 24), i = S(wn(s)), a += i, s -= vn(bn(i)), r = S(a / 12), a %= 12, l.days = s, l.months = a, l.years = r, this + }, Gn.clone = function () { + return zt(this) + }, Gn.get = function (e) { + return e = O(e), this.isValid() ? this[e + "s"]() : NaN + }, Gn.milliseconds = Pn, Gn.seconds = In, Gn.minutes = On, Gn.hours = Ln, Gn.days = Nn, Gn.weeks = function () { + return S(this.days() / 7) + }, Gn.months = Fn, Gn.years = Bn, Gn.humanize = function (e) { + if (!this.isValid()) return this.localeData().invalidDate(); + var t = this.localeData(), + n = function (e, t, n) { + var r = zt(e).abs(), + i = Hn(r.as("s")), + o = Hn(r.as("m")), + s = Hn(r.as("h")), + a = Hn(r.as("d")), + l = Hn(r.as("M")), + c = Hn(r.as("y")), + u = i <= zn.ss && ["s", i] || i < zn.s && ["ss", i] || o <= 1 && ["m"] || o < zn.m && ["mm", o] || s <= 1 && ["h"] || s < zn.h && ["hh", s] || a <= 1 && ["d"] || a < zn.d && ["dd", a] || l <= 1 && ["M"] || l < zn.M && ["MM", l] || c <= 1 && ["y"] || ["yy", c]; + return u[2] = t, u[3] = +e > 0, u[4] = n, Un.apply(null, u) + }(this, !e, t); + return e && (n = t.pastFuture(+this, n)), t.postformat(n) + }, Gn.toISOString = jn, Gn.toString = jn, Gn.toJSON = jn, Gn.locale = Kt, Gn.localeData = Qt, Gn.toIsoString = x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", jn), Gn.lang = Yt, V("X", 0, 0, "unix"), V("x", 0, 0, "valueOf"), ce("x", ie), ce("X", /[+-]?\d+(\.\d{1,3})?/), de("X", (function (e, t, n) { + n._d = new Date(1e3 * parseFloat(e, 10)) + })), de("x", (function (e, t, n) { + n._d = new Date(C(e)) + })), r.version = "2.24.0", t = kt, r.fn = un, r.min = function () { + var e = [].slice.call(arguments, 0); + return Rt("isBefore", e) + }, r.max = function () { + var e = [].slice.call(arguments, 0); + return Rt("isAfter", e) + }, r.now = function () { + return Date.now ? Date.now() : +new Date + }, r.utc = p, r.unix = function (e) { + return kt(1e3 * e) + }, r.months = function (e, t) { + return fn(e, t, "months") + }, r.isDate = l, r.locale = it, r.invalid = m, r.duration = zt, r.isMoment = b, r.weekdays = function (e, t, n) { + return mn(e, t, n, "weekdays") + }, r.parseZone = function () { + return kt.apply(null, arguments).parseZone() + }, r.localeData = st, r.isDuration = At, r.monthsShort = function (e, t) { + return fn(e, t, "monthsShort") + }, r.weekdaysMin = function (e, t, n) { + return mn(e, t, n, "weekdaysMin") + }, r.defineLocale = ot, r.updateLocale = function (e, t) { + if (null != t) { + var n, r, i = Je; + null != (r = rt(e)) && (i = r._config), t = A(i, t), (n = new M(t)).parentLocale = et[e], et[e] = n, it(e) + } else null != et[e] && (null != et[e].parentLocale ? et[e] = et[e].parentLocale : null != et[e] && delete et[e]); + return et[e] + }, r.locales = function () { + return T(et) + }, r.weekdaysShort = function (e, t, n) { + return mn(e, t, n, "weekdaysShort") + }, r.normalizeUnits = O, r.relativeTimeRounding = function (e) { + return void 0 === e ? Hn : "function" == typeof e && (Hn = e, !0) + }, r.relativeTimeThreshold = function (e, t) { + return void 0 !== zn[e] && (void 0 === t ? zn[e] : (zn[e] = t, "s" === e && (zn.ss = t - 1), !0)) + }, r.calendarFormat = function (e, t) { + var n = e.diff(t, "days", !0); + return n < -6 ? "sameElse" : n < -1 ? "lastWeek" : n < 0 ? "lastDay" : n < 1 ? "sameDay" : n < 2 ? "nextDay" : n < 7 ? "nextWeek" : "sameElse" + }, r.prototype = un, r.HTML5_FMT = { + DATETIME_LOCAL: "YYYY-MM-DDTHH:mm", + DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss", + DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS", + DATE: "YYYY-MM-DD", + TIME: "HH:mm", + TIME_SECONDS: "HH:mm:ss", + TIME_MS: "HH:mm:ss.SSS", + WEEK: "GGGG-[W]WW", + MONTH: "YYYY-MM" + }, r + }() + }).call(this, n(42)(e)) +}, function (e, t, n) { + var r, i, o = n(7), + s = n(168), + a = n(169), + l = n(170), + c = n(36); + "function" == typeof Symbol && "function" == typeof Symbol.for ? (r = Symbol.for("graceful-fs.queue"), i = Symbol.for("graceful-fs.previous")) : (r = "___graceful-fs.queue", i = "___graceful-fs.previous"); + var u = function () {}; + if (c.debuglog ? u = c.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (u = function () { + var e = c.format.apply(c, arguments); + e = "GFS4: " + e.split(/\n/).join("\nGFS4: "), console.error(e) + }), !global[r]) { + var h = []; + Object.defineProperty(global, r, { + get: function () { + return h + } + }), o.close = function (e) { + function t(t, n) { + return e.call(o, t, (function (e) { + e || f(), "function" == typeof n && n.apply(this, arguments) + })) + } + return Object.defineProperty(t, i, { + value: e + }), t + }(o.close), o.closeSync = function (e) { + function t(t) { + e.apply(o, arguments), f() + } + return Object.defineProperty(t, i, { + value: e + }), t + }(o.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", (function () { + u(global[r]), n(44).equal(global[r].length, 0) + })) + } + + function p(e) { + s(e), e.gracefulify = p, e.createReadStream = function (t, n) { + return new e.ReadStream(t, n) + }, e.createWriteStream = function (t, n) { + return new e.WriteStream(t, n) + }; + var t = e.readFile; + e.readFile = function (e, n, r) { + "function" == typeof n && (r = n, n = null); + return function e(n, r, i) { + return t(n, r, (function (t) { + !t || "EMFILE" !== t.code && "ENFILE" !== t.code ? ("function" == typeof i && i.apply(this, arguments), f()) : d([e, [n, r, i]]) + })) + }(e, n, r) + }; + var n = e.writeFile; + e.writeFile = function (e, t, r, i) { + "function" == typeof r && (i = r, r = null); + return function e(t, r, i, o) { + return n(t, r, i, (function (n) { + !n || "EMFILE" !== n.code && "ENFILE" !== n.code ? ("function" == typeof o && o.apply(this, arguments), f()) : d([e, [t, r, i, o]]) + })) + }(e, t, r, i) + }; + var r = e.appendFile; + r && (e.appendFile = function (e, t, n, i) { + "function" == typeof n && (i = n, n = null); + return function e(t, n, i, o) { + return r(t, n, i, (function (r) { + !r || "EMFILE" !== r.code && "ENFILE" !== r.code ? ("function" == typeof o && o.apply(this, arguments), f()) : d([e, [t, n, i, o]]) + })) + }(e, t, n, i) + }); + var i = e.readdir; + + function o(t) { + return i.apply(e, t) + } + if (e.readdir = function (e, t, n) { + var r = [e]; + "function" != typeof t ? r.push(t) : n = t; + return r.push((function (e, t) { + t && t.sort && t.sort(); + !e || "EMFILE" !== e.code && "ENFILE" !== e.code ? ("function" == typeof n && n.apply(this, arguments), f()) : d([o, [r]]) + })), o(r) + }, "v0.8" === process.version.substr(0, 4)) { + var l = a(e); + g = l.ReadStream, y = l.WriteStream + } + var c = e.ReadStream; + c && (g.prototype = Object.create(c.prototype), g.prototype.open = function () { + var e = this; + w(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.autoClose && e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n), e.read()) + })) + }); + var u = e.WriteStream; + u && (y.prototype = Object.create(u.prototype), y.prototype.open = function () { + var e = this; + w(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n)) + })) + }), Object.defineProperty(e, "ReadStream", { + get: function () { + return g + }, + set: function (e) { + g = e + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(e, "WriteStream", { + get: function () { + return y + }, + set: function (e) { + y = e + }, + enumerable: !0, + configurable: !0 + }); + var h = g; + Object.defineProperty(e, "FileReadStream", { + get: function () { + return h + }, + set: function (e) { + h = e + }, + enumerable: !0, + configurable: !0 + }); + var m = y; + + function g(e, t) { + return this instanceof g ? (c.apply(this, arguments), this) : g.apply(Object.create(g.prototype), arguments) } - function ae(e, t, n) { - return !e.startState || e.startState(t, n) + function y(e, t) { + return this instanceof y ? (u.apply(this, arguments), this) : y.apply(Object.create(y.prototype), arguments) } + Object.defineProperty(e, "FileWriteStream", { + get: function () { + return m + }, + set: function (e) { + m = e + }, + enumerable: !0, + configurable: !0 + }); + var v = e.open; - function se(e, t) { - if (t -= e.first, 0 > t || t >= e.size) throw new Error('There is no line ' + (t + e.first) + ' in the document.'); - for (var n = e; !n.lines;) - for (var o = 0;; ++o) { - var r = n.children[o], - i = r.chunkSize(); - if (t < i) { - n = r; - break - } - t -= i - } - return n.lines[t] + function w(e, t, n, r) { + return "function" == typeof n && (r = n, n = null), + function e(t, n, r, i) { + return v(t, n, r, (function (o, s) { + !o || "EMFILE" !== o.code && "ENFILE" !== o.code ? ("function" == typeof i && i.apply(this, arguments), f()) : d([e, [t, n, r, i]]) + })) + }(e, t, n, r) } + return e.open = w, e + } - function de(e, t, o) { - var r = [], - i = t.line; - return e.iter(t.line, o.line + 1, function (e) { - var n = e.text; - i == o.line && (n = n.slice(0, o.ch)), i == t.line && (n = n.slice(t.ch)), r.push(n), ++i - }), r + function d(e) { + u("ENQUEUE", e[0].name, e[1]), global[r].push(e) + } + + function f() { + var e = global[r].shift(); + e && (u("RETRY", e[0].name, e[1]), e[0].apply(null, e[1])) + } + e.exports = p(l(o)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !o.__patched && (e.exports = p(o), o.__patched = !0) +}, function (e, t, n) { + e.exports = function () { + "use strict"; + var e = navigator.userAgent, + t = navigator.platform, + n = /gecko\/\d/i.test(e), + r = /MSIE \d/.test(e), + i = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e), + o = /Edge\/(\d+)/.exec(e), + s = r || i || o, + a = s && (r ? document.documentMode || 6 : +(o || i)[1]), + l = !o && /WebKit\//.test(e), + c = l && /Qt\/\d+\.\d+/.test(e), + u = !o && /Chrome\//.test(e), + h = /Opera\//.test(e), + p = /Apple Computer/.test(navigator.vendor), + d = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e), + f = /PhantomJS/.test(e), + m = !o && /AppleWebKit/.test(e) && /Mobile\/\w+/.test(e), + g = /Android/.test(e), + y = m || g || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e), + v = m || /Mac/.test(t), + w = /\bCrOS\b/.test(e), + b = /win/i.test(t), + S = h && e.match(/Version\/(\d*\.\d*)/); + S && (S = Number(S[1])), S && S >= 15 && (h = !1, l = !0); + var C = v && (c || h && (null == S || S < 12.11)), + E = n || s && a >= 9; + + function k(e) { + return new RegExp("(^|\\s)" + e + "(?:$|\\s)\\s*") } + var x, T = function (e, t) { + var n = e.className, + r = k(t).exec(n); + if (r) { + var i = n.slice(r.index + r[0].length); + e.className = n.slice(0, r.index) + (i ? r[1] + i : "") + } + }; - function le(e, t, n) { - var o = []; - return e.iter(t, n, function (e) { - o.push(e.text) - }), o + function R(e) { + for (var t = e.childNodes.length; t > 0; --t) e.removeChild(e.firstChild); + return e } - function ce(e, t) { - var o = t - e.height; - if (o) - for (var r = e; r; r = r.parent) r.height += o + function D(e, t) { + return R(e).appendChild(t) } - function pe(e) { - if (null == e.parent) return null; - for (var t = e.parent, n = b(t.lines, e), o = t.parent; o; t = o, o = o.parent) - for (var r = 0;; ++r) { - if (o.children[r] == t) break; - n += o.children[r].chunkSize() - } - return n + t.first + function _(e, t, n, r) { + var i = document.createElement(e); + if (n && (i.className = n), r && (i.style.cssText = r), "string" == typeof t) i.appendChild(document.createTextNode(t)); + else if (t) + for (var o = 0; o < t.length; ++o) i.appendChild(t[o]); + return i } - function ue(e, t) { - var o = e.first; - outer: do { - for (var n = 0; n < e.children.length; ++n) { - var r = e.children[n], - a = r.height; - if (t < a) { - e = r; - continue outer - } - t -= a, o += r.chunkSize() - } - return o - } while (!e.lines); - for (var s = 0; s < e.lines.length; ++s) { - var i = e.lines[s], - d = i.height; - if (t < d) break; - t -= d - } - return o + s + function A(e, t, n, r) { + var i = _(e, t, n, r); + return i.setAttribute("role", "presentation"), i } - function me(e, t) { - return t >= e.first && t < e.first + e.size + function M(e, t) { + if (3 == t.nodeType && (t = t.parentNode), e.contains) return e.contains(t); + do { + if (11 == t.nodeType && (t = t.host), t == e) return !0 + } while (t = t.parentNode) } - function he(e, t) { - return e.lineNumberFormatter(t + e.firstLineNumber) + '' + function P() { + var e; + try { + e = document.activeElement + } catch (t) { + e = document.body || null + } + for (; e && e.shadowRoot && e.shadowRoot.activeElement;) e = e.shadowRoot.activeElement; + return e } - function fe(e, t, n) { - return void 0 === n && (n = null), this instanceof fe ? void(this.line = e, this.ch = t, this.sticky = n) : new fe(e, t, n) + function I(e, t) { + var n = e.className; + k(t).test(n) || (e.className += (n ? " " : "") + t) } - function ge(e, t) { - return e.line - t.line || e.ch - t.ch + function O(e, t) { + for (var n = e.split(" "), r = 0; r < n.length; r++) n[r] && !k(n[r]).test(t) && (t += " " + n[r]); + return t } + x = document.createRange ? function (e, t, n, r) { + var i = document.createRange(); + return i.setEnd(r || e, n), i.setStart(e, t), i + } : function (e, t, n) { + var r = document.body.createTextRange(); + try { + r.moveToElementText(e.parentNode) + } catch (e) { + return r + } + return r.collapse(!0), r.moveEnd("character", n), r.moveStart("character", t), r + }; + var L = function (e) { + e.select() + }; - function ye(e, t) { - return e.sticky == t.sticky && 0 == ge(e, t) + function N(e) { + var t = Array.prototype.slice.call(arguments, 1); + return function () { + return e.apply(null, t) + } } - function Se(e) { - return fe(e.line, e.ch) + function F(e, t, n) { + for (var r in t || (t = {}), e) !e.hasOwnProperty(r) || !1 === n && t.hasOwnProperty(r) || (t[r] = e[r]); + return t } - function Ce(e, t) { - return 0 > ge(e, t) ? t : e + function B(e, t, n, r, i) { + null == t && -1 == (t = e.search(/[^\s\u00a0]/)) && (t = e.length); + for (var o = r || 0, s = i || 0;;) { + var a = e.indexOf("\t", o); + if (a < 0 || a >= t) return s + (t - o); + s += a - o, s += n - s % n, o = a + 1 + } } + m ? L = function (e) { + e.selectionStart = 0, e.selectionEnd = e.value.length + } : s && (L = function (e) { + try { + e.select() + } catch (e) {} + }); + var H = function () { + this.id = null, this.f = null, this.time = 0, this.handler = N(this.onTimeout, this) + }; - function be(e, t) { - return 0 > ge(e, t) ? e : t + function z(e, t) { + for (var n = 0; n < e.length; ++n) + if (e[n] == t) return n; + return -1 } + H.prototype.onTimeout = function (e) { + e.id = 0, e.time <= +new Date ? e.f() : setTimeout(e.handler, e.time - +new Date) + }, H.prototype.set = function (e, t) { + this.f = t; + var n = +new Date + e; + (!this.id || n < this.time) && (clearTimeout(this.id), this.id = setTimeout(this.handler, e), this.time = n) + }; + var U = { + toString: function () { + return "CodeMirror.Pass" + } + }, + W = { + scroll: !1 + }, + V = { + origin: "*mouse" + }, + j = { + origin: "+move" + }; - function ve(e, t) { - return r(e.first, d(t, e.first + e.size - 1)) + function G(e, t, n) { + for (var r = 0, i = 0;;) { + var o = e.indexOf("\t", r); - 1 == o && (o = e.length); + var s = o - r; + if (o == e.length || i + s >= t) return r + Math.min(s, t - i); + if (i += o - r, r = o + 1, (i += n - i % n) >= t) return r + } } + var $ = [""]; - function Ee(e, t) { - if (t.line < e.first) return fe(e.first, 0); - var n = e.first + e.size - 1; - return t.line > n ? fe(n, se(e, n).text.length) : we(t, se(e, t.line).text.length) + function q(e) { + for (; $.length <= e;) $.push(K($) + " "); + return $[e] } - function we(e, t) { - var n = e.ch; - return null == n || n > t ? fe(e.line, t) : 0 > n ? fe(e.line, 0) : e + function K(e) { + return e[e.length - 1] } - function ke(e, t) { - for (var n = [], o = 0; o < t.length; o++) n[o] = Ee(e, t[o]); + function Y(e, t) { + for (var n = [], r = 0; r < e.length; r++) n[r] = t(e[r], r); return n } - function Te(e, t, n, r) { - var a = [e.state.modeGen], - s = {}; - Ie(e, t.text, e.doc.mode, n, function (e, t) { - return a.push(e, t) - }, s, r); - for (var l = n.state, i = function (r) { - n.baseTokens = a; - var o = e.state.overlays[r], - c = 1, - i = 0; - n.state = !0, Ie(e, t.text, o.mode, n, function (e, t) { - for (var n = c, r; i < e;) r = a[c], r > e && a.splice(c, 1, e, a[c + 1], r), c += 2, i = d(e, r); - if (t) - if (o.opaque) a.splice(n, c - n, e, 'overlay ' + t), c = n + 2; - else - for (; n < c; n += 2) { - var s = a[n + 1]; - a[n + 1] = (s ? s + ' ' : '') + 'overlay ' + t - } - }, s), n.state = l, n.baseTokens = null, n.baseTokenPos = 1 - }, c = 0; c < e.state.overlays.length; ++c) i(c); - return { - styles: a, - classes: s.bgClass || s.textClass ? s : null - } + function Q() {} + + function Z(e, t) { + var n; + return Object.create ? n = Object.create(e) : (Q.prototype = e, n = new Q), t && F(t, n), n } + var X = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; - function _e(e, t, n) { - if (!t.styles || t.styles[0] != e.state.modeGen) { - var o = Re(e, pe(t)), - i = t.text.length > e.options.maxHighlightLength && oe(e.doc.mode, o.state), - a = Te(e, t, o); - i && (o.state = i), t.stateAfter = o.save(!i), t.styles = a.styles, a.classes ? t.styleClasses = a.classes : t.styleClasses && (t.styleClasses = null), n === e.doc.highlightFrontier && (e.doc.modeFrontier = r(e.doc.modeFrontier, ++e.doc.highlightFrontier)) - } - return t.styles + function J(e) { + return /\w/.test(e) || e > "€" && (e.toUpperCase() != e.toLowerCase() || X.test(e)) } - function Re(e, t, n) { - var o = e.doc, - r = e.display; - if (!o.mode.startState) return new Ss(o, !0, t); - var i = Le(e, t, n), - a = i > o.first && se(o, i - 1).stateAfter, - s = a ? Ss.fromSaved(o, a, i) : new Ss(o, ae(o.mode), i); - return o.iter(i, t, function (n) { - xe(e, n.text, s); - var o = s.line; - n.stateAfter = o == t - 1 || 0 == o % 5 || o >= r.viewFrom && o < r.viewTo ? s.save() : null, s.nextLine() - }), n && (o.modeFrontier = s.line), s + function ee(e, t) { + return t ? !!(t.source.indexOf("\\w") > -1 && J(e)) || t.test(e) : J(e) } - function xe(e, t, n, o) { - var r = e.doc.mode, - i = new hs(t, e.options.tabSize, n); - for (i.start = i.pos = o || 0, '' == t && Pe(r, n.state); !i.eol();) De(r, i, n.state), i.start = i.pos + function te(e) { + for (var t in e) + if (e.hasOwnProperty(t) && e[t]) return !1; + return !0 } + var ne = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/; - function Pe(e, t) { - if (e.blankLine) return e.blankLine(t); - if (e.innerMode) { - var n = re(e, t); - if (n.mode.blankLine) return n.mode.blankLine(n.state) + function re(e) { + return e.charCodeAt(0) >= 768 && ne.test(e) + } + + function ie(e, t, n) { + for (; + (n < 0 ? t > 0 : t < e.length) && re(e.charAt(t));) t += n; + return t + } + + function oe(e, t, n) { + for (var r = t > n ? -1 : 1;;) { + if (t == n) return t; + var i = (t + n) / 2, + o = r < 0 ? Math.ceil(i) : Math.floor(i); + if (o == t) return e(o) ? t : n; + e(o) ? n = o : t = o + r } } + var se = null; - function De(e, t, n, o) { - for (var r = 0; 10 > r; r++) { - o && (o[0] = re(e, n).mode); - var i = e.token(t, n); - if (t.pos > t.start) return i + function ae(e, t, n) { + var r; + se = null; + for (var i = 0; i < e.length; ++i) { + var o = e[i]; + if (o.from < t && o.to > t) return i; + o.to == t && (o.from != o.to && "before" == n ? r = i : se = i), o.from == t && (o.from != o.to && "before" != n ? r = i : se = i) } - throw new Error('Mode ' + e.name + ' failed to advance stream.') + return null != r ? r : se } + var le = function () { + var e = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/, + t = /[stwN]/, + n = /[LRr]/, + r = /[Lb1n]/, + i = /[1n]/; - function Me(e, t, n, o) { - var r = e.doc, - i = r.mode, - a; - t = Ee(r, t); - var s = se(r, t.line), - d = Re(e, t.line, n), - l = new hs(s.text, e.options.tabSize, d), - c; - for (o && (c = []); - (o || l.pos < t.ch) && !l.eol();) l.start = l.pos, a = De(i, l, d.state), o && c.push(new Cs(l, a, oe(r.mode, d.state))); - return o ? c : new Cs(l, a, d.state) - } - - function Ae(e, t) { - if (e) - for (;;) { - var n = e.match(/(?:^|\s+)line-(background-)?(\S+)/); - if (!n) break; - e = e.slice(0, n.index) + e.slice(n.index + n[0].length); - var o = n[1] ? 'bgClass' : 'textClass'; - null == t[o] ? t[o] = n[2] : !new RegExp('(?:^|s)' + n[2] + '(?:$|s)').test(t[o]) && (t[o] += ' ' + n[2]) + function o(e, t, n) { + this.level = e, this.from = t, this.to = n + } + return function (s, a) { + var l = "ltr" == a ? "L" : "R"; + if (0 == s.length || "ltr" == a && !e.test(s)) return !1; + for (var c, u = s.length, h = [], p = 0; p < u; ++p) h.push((c = s.charCodeAt(p)) <= 247 ? "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(c) : 1424 <= c && c <= 1524 ? "R" : 1536 <= c && c <= 1785 ? "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(c - 1536) : 1774 <= c && c <= 2220 ? "r" : 8192 <= c && c <= 8203 ? "w" : 8204 == c ? "b" : "L"); + for (var d = 0, f = l; d < u; ++d) { + var m = h[d]; + "m" == m ? h[d] = f : f = m + } + for (var g = 0, y = l; g < u; ++g) { + var v = h[g]; + "1" == v && "r" == y ? h[g] = "n" : n.test(v) && (y = v, "r" == v && (h[g] = "R")) + } + for (var w = 1, b = h[0]; w < u - 1; ++w) { + var S = h[w]; + "+" == S && "1" == b && "1" == h[w + 1] ? h[w] = "1" : "," != S || b != h[w + 1] || "1" != b && "n" != b || (h[w] = b), b = S + } + for (var C = 0; C < u; ++C) { + var E = h[C]; + if ("," == E) h[C] = "N"; + else if ("%" == E) { + var k = void 0; + for (k = C + 1; k < u && "%" == h[k]; ++k); + for (var x = C && "!" == h[C - 1] || k < u && "1" == h[k] ? "1" : "N", T = C; T < k; ++T) h[T] = x; + C = k - 1 + } } - return e - } + for (var R = 0, D = l; R < u; ++R) { + var _ = h[R]; + "L" == D && "1" == _ ? h[R] = "L" : n.test(_) && (D = _) + } + for (var A = 0; A < u; ++A) + if (t.test(h[A])) { + var M = void 0; + for (M = A + 1; M < u && t.test(h[M]); ++M); + for (var P = "L" == (A ? h[A - 1] : l), I = P == ("L" == (M < u ? h[M] : l)) ? P ? "L" : "R" : l, O = A; O < M; ++O) h[O] = I; + A = M - 1 + } for (var L, N = [], F = 0; F < u;) + if (r.test(h[F])) { + var B = F; + for (++F; F < u && r.test(h[F]); ++F); + N.push(new o(0, B, F)) + } else { + var H = F, + z = N.length; + for (++F; F < u && "L" != h[F]; ++F); + for (var U = H; U < F;) + if (i.test(h[U])) { + H < U && N.splice(z, 0, new o(1, H, U)); + var W = U; + for (++U; U < F && i.test(h[U]); ++U); + N.splice(z, 0, new o(2, W, U)), H = U + } else ++U; + H < F && N.splice(z, 0, new o(1, H, F)) + } return "ltr" == a && (1 == N[0].level && (L = s.match(/^\s+/)) && (N[0].from = L[0].length, N.unshift(new o(0, 0, L[0].length))), 1 == K(N).level && (L = s.match(/\s+$/)) && (K(N).to -= L[0].length, N.push(new o(0, u - L[0].length, u)))), "rtl" == a ? N.reverse() : N + } + }(); - function Ie(e, t, n, o, r, i, a) { - var s = n.flattenSpans; - null == s && (s = e.options.flattenSpans); - var l = 0, - c = null, - p = new hs(t, e.options.tabSize, o), - u = e.options.addModeClass && [null], - m; - for ('' == t && Ae(Pe(n, o.state), i); !p.eol();) { - if (p.pos > e.options.maxHighlightLength ? (s = !1, a && xe(e, t, o, p.pos), p.pos = t.length, m = null) : m = Ae(De(n, p, o.state, u), i), u) { - var h = u[0].name; - h && (m = 'm-' + (m ? h + ' ' + m : h)) + function ce(e, t) { + var n = e.order; + return null == n && (n = e.order = le(e.text, t)), n + } + var ue = [], + he = function (e, t, n) { + if (e.addEventListener) e.addEventListener(t, n, !1); + else if (e.attachEvent) e.attachEvent("on" + t, n); + else { + var r = e._handlers || (e._handlers = {}); + r[t] = (r[t] || ue).concat(n) } - if (!s || c != m) { - for (; l < p.start;) l = d(p.start, l + 5e3), r(l, c); - c = m + }; + + function pe(e, t) { + return e._handlers && e._handlers[t] || ue + } + + function de(e, t, n) { + if (e.removeEventListener) e.removeEventListener(t, n, !1); + else if (e.detachEvent) e.detachEvent("on" + t, n); + else { + var r = e._handlers, + i = r && r[t]; + if (i) { + var o = z(i, n); + o > -1 && (r[t] = i.slice(0, o).concat(i.slice(o + 1))) } - p.start = p.pos - } - for (; l < p.pos;) { - var f = d(p.pos, l + 5e3); - r(f, c), l = f } } - function Le(e, t, n) { - for (var o = e.doc, r = n ? -1 : t - (e.doc.mode.innerMode ? 1e3 : 100), i = t, a, s; i > r; --i) { - if (i <= o.first) return o.first; - var d = se(o, i - 1), - l = d.stateAfter; - if (l && (!n || i + (l instanceof ys ? l.lookAhead : 0) <= o.modeFrontier)) return i; - var c = C(d.text, null, e.options.tabSize); - (null == s || a > c) && (s = i - 1, a = c) - } - return s + function fe(e, t) { + var n = pe(e, t); + if (n.length) + for (var r = Array.prototype.slice.call(arguments, 2), i = 0; i < n.length; ++i) n[i].apply(null, r) } - function Fe(e, t) { - if (e.modeFrontier = d(e.modeFrontier, t), !(e.highlightFrontier < t - 10)) { - for (var n = e.first, o = t - 1, r; o > n; o--) - if (r = se(e, o).stateAfter, r && (!(r instanceof ys) || o + r.lookAhead < t)) { - n = o + 1; - break - } e.highlightFrontier = d(e.highlightFrontier, n) - } + function me(e, t, n) { + return "string" == typeof t && (t = { + type: t, + preventDefault: function () { + this.defaultPrevented = !0 + } + }), fe(e, n || t.type, e, t), Se(t) || t.codemirrorIgnore } - function Be() { - bs = !0 + function ge(e) { + var t = e._handlers && e._handlers.cursorActivity; + if (t) + for (var n = e.curOp.cursorActivityHandlers || (e.curOp.cursorActivityHandlers = []), r = 0; r < t.length; ++r) - 1 == z(n, t[r]) && n.push(t[r]) } - function Ne() { - vs = !0 + function ye(e, t) { + return pe(e, t).length > 0 } - function Oe(e, t, n) { - this.marker = e, this.from = t, this.to = n + function ve(e) { + e.prototype.on = function (e, t) { + he(this, e, t) + }, e.prototype.off = function (e, t) { + de(this, e, t) + } } - function He(e, t) { - if (e) - for (var n = 0, o; n < e.length; ++n) - if (o = e[n], o.marker == t) return o + function we(e) { + e.preventDefault ? e.preventDefault() : e.returnValue = !1 } - function ze(e, t) { - for (var n = 0, o; n < e.length; ++n) e[n] != t && (o || (o = [])).push(e[n]); - return o + function be(e) { + e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0 } - function Ue(e, t) { - e.markedSpans = e.markedSpans ? e.markedSpans.concat([t]) : [t], t.marker.attachLine(e) + function Se(e) { + return null != e.defaultPrevented ? e.defaultPrevented : 0 == e.returnValue } - function We(e, t, n) { - var o; - if (e) - for (var r = 0; r < e.length; ++r) { - var i = e[r], - a = i.marker, - s = null == i.from || (a.inclusiveLeft ? i.from <= t : i.from < t); - if (s || i.from == t && 'bookmark' == a.type && (!n || !i.marker.insertLeft)) { - var d = null == i.to || (a.inclusiveRight ? i.to >= t : i.to > t); - (o || (o = [])).push(new Oe(a, i.from, d ? null : i.to)) - } - } - return o + function Ce(e) { + we(e), be(e) } - function Ve(e, t, n) { - var o; - if (e) - for (var r = 0; r < e.length; ++r) { - var i = e[r], - a = i.marker, - s = null == i.to || (a.inclusiveRight ? i.to >= t : i.to > t); - if (s || i.from == t && 'bookmark' == a.type && (!n || i.marker.insertLeft)) { - var d = null == i.from || (a.inclusiveLeft ? i.from <= t : i.from < t); - (o || (o = [])).push(new Oe(a, d ? null : i.from - t, null == i.to ? null : i.to - t)) - } - } - return o + function Ee(e) { + return e.target || e.srcElement } - function Ge(e, t) { - if (t.full) return null; - var n = me(e, t.from.line) && se(e, t.from.line).markedSpans, - o = me(e, t.to.line) && se(e, t.to.line).markedSpans; - if (!n && !o) return null; - var r = t.from.ch, - a = t.to.ch, - s = 0 == ge(t.from, t.to), - d = We(n, r, s), - l = Ve(o, a, s), - c = 1 == t.text.length, - p = w(t.text).length + (c ? r : 0); - if (d) - for (var u = 0, i; u < d.length; ++u) - if (i = d[u], null == i.to) { - var m = He(l, i.marker); - m ? c && (i.to = null == m.to ? null : m.to + p) : i.to = r - } if (l) - for (var h = 0, f; h < l.length; ++h) - if (f = l[h], null != f.to && (f.to += p), null == f.from) { - var g = He(d, f.marker); - g || (f.from = p, c && (d || (d = [])).push(f)) - } else f.from += p, c && (d || (d = [])).push(f); - d && (d = Ke(d)), l && l != d && (l = Ke(l)); - var y = [d]; - if (!c) { - var S = t.text.length - 2, - C; - if (0 < S && d) - for (var b = 0; b < d.length; ++b) null == d[b].to && (C || (C = [])).push(new Oe(d[b].marker, null, null)); - for (var v = 0; v < S; ++v) y.push(C); - y.push(l) - } - return y + function ke(e) { + var t = e.which; + return null == t && (1 & e.button ? t = 1 : 2 & e.button ? t = 3 : 4 & e.button && (t = 2)), v && e.ctrlKey && 1 == t && (t = 3), t } + var xe, Te, Re = function () { + if (s && a < 9) return !1; + var e = _("div"); + return "draggable" in e || "dragDrop" in e + }(); - function Ke(e) { - for (var t = 0, n; t < e.length; ++t) n = e[t], null != n.from && n.from == n.to && !1 !== n.marker.clearWhenEmpty && e.splice(t--, 1); - return e.length ? e : null + function De(e) { + if (null == xe) { + var t = _("span", "​"); + D(e, _("span", [t, document.createTextNode("x")])), 0 != e.firstChild.offsetHeight && (xe = t.offsetWidth <= 1 && t.offsetHeight > 2 && !(s && a < 8)) + } + var n = xe ? _("span", "​") : _("span", " ", null, "display: inline-block; width: 1px; margin-right: -1px"); + return n.setAttribute("cm-text", ""), n } - function je(e, t, n) { - var o = null; - if (e.iter(t.line, n.line + 1, function (e) { - if (e.markedSpans) - for (var t = 0, n; t < e.markedSpans.length; ++t) n = e.markedSpans[t].marker, n.readOnly && (!o || -1 == b(o, n)) && (o || (o = [])).push(n) - }), !o) return null; - for (var r = [{ - from: t, - to: n - }], a = 0; a < o.length; ++a) - for (var i = o[a], s = i.find(0), d = 0, l; d < r.length; ++d) - if (l = r[d], !(0 > ge(l.to, s.from) || 0 < ge(l.from, s.to))) { - var c = [d, 1], - p = ge(l.from, s.from), - u = ge(l.to, s.to); - !(0 > p) && (i.inclusiveLeft || p) || c.push({ - from: l.from, - to: s.from - }), !(0 < u) && (i.inclusiveRight || u) || c.push({ - from: s.to, - to: l.to - }), r.splice.apply(r, c), d += c.length - 3 - } return r - } - - function qe(e) { - var t = e.markedSpans; - if (t) { - for (var n = 0; n < t.length; ++n) t[n].marker.detachLine(e); - e.markedSpans = null + function _e(e) { + if (null != Te) return Te; + var t = D(e, document.createTextNode("AخA")), + n = x(t, 0, 1).getBoundingClientRect(), + r = x(t, 1, 2).getBoundingClientRect(); + return R(e), !(!n || n.left == n.right) && (Te = r.right - n.right < 3) + } + var Ae, Me = 3 != "\n\nb".split(/\n/).length ? function (e) { + for (var t = 0, n = [], r = e.length; t <= r;) { + var i = e.indexOf("\n", t); - 1 == i && (i = e.length); + var o = e.slice(t, "\r" == e.charAt(i - 1) ? i - 1 : i), + s = o.indexOf("\r"); - 1 != s ? (n.push(o.slice(0, s)), t += s + 1) : (n.push(o), t = i + 1) + } + return n + } : function (e) { + return e.split(/\r\n?|\n/) + }, + Pe = window.getSelection ? function (e) { + try { + return e.selectionStart != e.selectionEnd + } catch (e) { + return !1 + } + } : function (e) { + var t; + try { + t = e.ownerDocument.selection.createRange() + } catch (e) {} + return !(!t || t.parentElement() != e) && 0 != t.compareEndPoints("StartToEnd", t) + }, + Ie = "oncopy" in (Ae = _("div")) || (Ae.setAttribute("oncopy", "return;"), "function" == typeof Ae.oncopy), + Oe = null, + Le = {}, + Ne = {}; + + function Fe(e, t) { + arguments.length > 2 && (t.dependencies = Array.prototype.slice.call(arguments, 2)), Le[e] = t + } + + function Be(e) { + if ("string" == typeof e && Ne.hasOwnProperty(e)) e = Ne[e]; + else if (e && "string" == typeof e.name && Ne.hasOwnProperty(e.name)) { + var t = Ne[e.name]; + "string" == typeof t && (t = { + name: t + }), (e = Z(t, e)).name = t.name + } else { + if ("string" == typeof e && /^[\w\-]+\/[\w\-]+\+xml$/.test(e)) return Be("application/xml"); + if ("string" == typeof e && /^[\w\-]+\/[\w\-]+\+json$/.test(e)) return Be("application/json") + } + return "string" == typeof e ? { + name: e + } : e || { + name: "null" } } - function Ye(e, t) { - if (t) { - for (var n = 0; n < t.length; ++n) t[n].marker.attachLine(e); - e.markedSpans = t + function He(e, t) { + t = Be(t); + var n = Le[t.name]; + if (!n) return He(e, "text/plain"); + var r = n(e, t); + if (ze.hasOwnProperty(t.name)) { + var i = ze[t.name]; + for (var o in i) i.hasOwnProperty(o) && (r.hasOwnProperty(o) && (r["_" + o] = r[o]), r[o] = i[o]) + } + if (r.name = t.name, t.helperType && (r.helperType = t.helperType), t.modeProps) + for (var s in t.modeProps) r[s] = t.modeProps[s]; + return r + } + var ze = {}; + + function Ue(e, t) { + F(t, ze.hasOwnProperty(e) ? ze[e] : ze[e] = {}) + } + + function We(e, t) { + if (!0 === t) return t; + if (e.copyState) return e.copyState(t); + var n = {}; + for (var r in t) { + var i = t[r]; + i instanceof Array && (i = i.concat([])), n[r] = i } + return n } - function Xe(e) { - return e.inclusiveLeft ? -1 : 0 + function Ve(e, t) { + for (var n; e.innerMode && (n = e.innerMode(t)) && n.mode != e;) t = n.state, e = n.mode; + return n || { + mode: e, + state: t + } } - function Qe(e) { - return e.inclusiveRight ? 1 : 0 + function je(e, t, n) { + return !e.startState || e.startState(t, n) } + var Ge = function (e, t, n) { + this.pos = this.start = 0, this.string = e, this.tabSize = t || 8, this.lastColumnPos = this.lastColumnValue = 0, this.lineStart = 0, this.lineOracle = n + }; function $e(e, t) { - var n = e.lines.length - t.lines.length; - if (0 != n) return n; - var o = e.find(), - r = t.find(), - i = ge(o.from, r.from) || Xe(e) - Xe(t); - if (i) return -i; - var a = ge(o.to, r.to) || Qe(e) - Qe(t); - return a ? a : t.id - e.id + if ((t -= e.first) < 0 || t >= e.size) throw new Error("There is no line " + (t + e.first) + " in the document."); + for (var n = e; !n.lines;) + for (var r = 0;; ++r) { + var i = n.children[r], + o = i.chunkSize(); + if (t < o) { + n = i; + break + } + t -= o + } + return n.lines[t] } - function Ze(e, t) { - var n = vs && e.markedSpans, - o; - if (n) - for (var r = void 0, a = 0; a < n.length; ++a) r = n[a], r.marker.collapsed && null == (t ? r.from : r.to) && (!o || 0 > $e(o, r.marker)) && (o = r.marker); - return o + function qe(e, t, n) { + var r = [], + i = t.line; + return e.iter(t.line, n.line + 1, (function (e) { + var o = e.text; + i == n.line && (o = o.slice(0, n.ch)), i == t.line && (o = o.slice(t.ch)), r.push(o), ++i + })), r } - function Je(e) { - return Ze(e, !0) + function Ke(e, t, n) { + var r = []; + return e.iter(t, n, (function (e) { + r.push(e.text) + })), r } - function et(e) { - return Ze(e, !1) + function Ye(e, t) { + var n = t - e.height; + if (n) + for (var r = e; r; r = r.parent) r.height += n } - function tt(e, t) { - var n = vs && e.markedSpans, - o; - if (n) - for (var r = 0, i; r < n.length; ++r) i = n[r], i.marker.collapsed && (null == i.from || i.from < t) && (null == i.to || i.to > t) && (!o || 0 > $e(o, i.marker)) && (o = i.marker); - return o + function Qe(e) { + if (null == e.parent) return null; + for (var t = e.parent, n = z(t.lines, e), r = t.parent; r; t = r, r = r.parent) + for (var i = 0; r.children[i] != t; ++i) n += r.children[i].chunkSize(); + return n + t.first } - function nt(e, t, n, o, r) { - var a = se(e, t), - s = vs && a.markedSpans; - if (s) - for (var d = 0, i; d < s.length; ++d) - if (i = s[d], !!i.marker.collapsed) { - var l = i.marker.find(0), - c = ge(l.from, n) || Xe(i.marker) - Xe(r), - p = ge(l.to, o) || Qe(i.marker) - Qe(r); - if (!(0 <= c && 0 >= p || 0 >= c && 0 <= p) && (0 >= c && (i.marker.inclusiveRight && r.inclusiveLeft ? 0 <= ge(l.to, n) : 0 < ge(l.to, n)) || 0 <= c && (i.marker.inclusiveRight && r.inclusiveLeft ? 0 >= ge(l.from, o) : 0 > ge(l.from, o)))) return !0 + function Ze(e, t) { + var n = e.first; + e: do { + for (var r = 0; r < e.children.length; ++r) { + var i = e.children[r], + o = i.height; + if (t < o) { + e = i; + continue e } + t -= o, n += i.chunkSize() + } + return n + } while (!e.lines); + for (var s = 0; s < e.lines.length; ++s) { + var a = e.lines[s].height; + if (t < a) break; + t -= a + } + return n + s } - function ot(e) { - for (var t; t = Je(e);) e = t.find(-1, !0).line; - return e + function Xe(e, t) { + return t >= e.first && t < e.first + e.size } - function rt(e) { - for (var t; t = et(e);) e = t.find(1, !0).line; - return e + function Je(e, t) { + return String(e.lineNumberFormatter(t + e.firstLineNumber)) } - function it(e) { - for (var t, n; t = et(e);) e = t.find(1, !0).line, (n || (n = [])).push(e); - return n + function et(e, t, n) { + if (void 0 === n && (n = null), !(this instanceof et)) return new et(e, t, n); + this.line = e, this.ch = t, this.sticky = n } - function at(e, t) { - var n = se(e, t), - o = ot(n); - return n == o ? t : pe(o) + function tt(e, t) { + return e.line - t.line || e.ch - t.ch } - function st(e, t) { - if (t > e.lastLine()) return t; - var n = se(e, t), - o; - if (!dt(e, n)) return t; - for (; o = et(n);) n = o.find(1, !0).line; - return pe(n) + 1 + function nt(e, t) { + return e.sticky == t.sticky && 0 == tt(e, t) } - function dt(e, t) { - var n = vs && t.markedSpans; - if (n) - for (var o = void 0, r = 0; r < n.length; ++r) - if (o = n[r], !!o.marker.collapsed) { - if (null == o.from) return !0; - if (!o.marker.widgetNode && 0 == o.from && o.marker.inclusiveLeft && lt(e, t, o)) return !0 - } + function rt(e) { + return et(e.line, e.ch) } - function lt(e, t, n) { - if (null == n.to) { - var o = n.marker.find(1, !0); - return lt(e, o.line, He(o.line.markedSpans, n.marker)) - } - if (n.marker.inclusiveRight && n.to == t.text.length) return !0; - for (var r = void 0, a = 0; a < t.markedSpans.length; ++a) - if (r = t.markedSpans[a], r.marker.collapsed && !r.marker.widgetNode && r.from == n.to && (null == r.to || r.to != n.from) && (r.marker.inclusiveLeft || n.marker.inclusiveRight) && lt(e, t, r)) return !0 + function it(e, t) { + return tt(e, t) < 0 ? t : e } - function ct(e) { - e = ot(e); - for (var t = 0, n = e.parent, o = 0, r; o < n.lines.length && (r = n.lines[o], r != e); ++o) t += r.height; - for (var i = n.parent; i; n = i, i = n.parent) - for (var a = 0, s; a < i.children.length && (s = i.children[a], s != n); ++a) t += s.height; - return t + function ot(e, t) { + return tt(e, t) < 0 ? e : t } - function pt(e) { - if (0 == e.height) return 0; - for (var t = e.text.length, n = e, o, r; o = Je(n);) r = o.find(0, !0), n = r.from.line, t += r.from.ch - r.to.ch; - for (n = e; o = et(n);) { - var i = o.find(0, !0); - t -= n.text.length - i.from.ch, n = i.to.line, t += n.text.length - i.to.ch + function st(e, t) { + return Math.max(e.first, Math.min(t, e.first + e.size - 1)) + } + + function at(e, t) { + if (t.line < e.first) return et(e.first, 0); + var n = e.first + e.size - 1; + return t.line > n ? et(n, $e(e, n).text.length) : function (e, t) { + var n = e.ch; + return null == n || n > t ? et(e.line, t) : n < 0 ? et(e.line, 0) : e + }(t, $e(e, t.line).text.length) + } + + function lt(e, t) { + for (var n = [], r = 0; r < t.length; r++) n[r] = at(e, t[r]); + return n + } + Ge.prototype.eol = function () { + return this.pos >= this.string.length + }, Ge.prototype.sol = function () { + return this.pos == this.lineStart + }, Ge.prototype.peek = function () { + return this.string.charAt(this.pos) || void 0 + }, Ge.prototype.next = function () { + if (this.pos < this.string.length) return this.string.charAt(this.pos++) + }, Ge.prototype.eat = function (e) { + var t = this.string.charAt(this.pos); + if ("string" == typeof e ? t == e : t && (e.test ? e.test(t) : e(t))) return ++this.pos, t + }, Ge.prototype.eatWhile = function (e) { + for (var t = this.pos; this.eat(e);); + return this.pos > t + }, Ge.prototype.eatSpace = function () { + for (var e = this.pos; + /[\s\u00a0]/.test(this.string.charAt(this.pos));) ++this.pos; + return this.pos > e + }, Ge.prototype.skipToEnd = function () { + this.pos = this.string.length + }, Ge.prototype.skipTo = function (e) { + var t = this.string.indexOf(e, this.pos); + if (t > -1) return this.pos = t, !0 + }, Ge.prototype.backUp = function (e) { + this.pos -= e + }, Ge.prototype.column = function () { + return this.lastColumnPos < this.start && (this.lastColumnValue = B(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue), this.lastColumnPos = this.start), this.lastColumnValue - (this.lineStart ? B(this.string, this.lineStart, this.tabSize) : 0) + }, Ge.prototype.indentation = function () { + return B(this.string, null, this.tabSize) - (this.lineStart ? B(this.string, this.lineStart, this.tabSize) : 0) + }, Ge.prototype.match = function (e, t, n) { + if ("string" != typeof e) { + var r = this.string.slice(this.pos).match(e); + return r && r.index > 0 ? null : (r && !1 !== t && (this.pos += r[0].length), r) + } + var i = function (e) { + return n ? e.toLowerCase() : e + }; + if (i(this.string.substr(this.pos, e.length)) == i(e)) return !1 !== t && (this.pos += e.length), !0 + }, Ge.prototype.current = function () { + return this.string.slice(this.start, this.pos) + }, Ge.prototype.hideFirstChars = function (e, t) { + this.lineStart += e; + try { + return t() + } finally { + this.lineStart -= e + } + }, Ge.prototype.lookAhead = function (e) { + var t = this.lineOracle; + return t && t.lookAhead(e) + }, Ge.prototype.baseToken = function () { + var e = this.lineOracle; + return e && e.baseToken(this.pos) + }; + var ct = function (e, t) { + this.state = e, this.lookAhead = t + }, + ut = function (e, t, n, r) { + this.state = t, this.doc = e, this.line = n, this.maxLookAhead = r || 0, this.baseTokens = null, this.baseTokenPos = 1 + }; + + function ht(e, t, n, r) { + var i = [e.state.modeGen], + o = {}; + bt(e, t.text, e.doc.mode, n, (function (e, t) { + return i.push(e, t) + }), o, r); + for (var s = n.state, a = function (r) { + n.baseTokens = i; + var a = e.state.overlays[r], + l = 1, + c = 0; + n.state = !0, bt(e, t.text, a.mode, n, (function (e, t) { + for (var n = l; c < e;) { + var r = i[l]; + r > e && i.splice(l, 1, e, i[l + 1], r), l += 2, c = Math.min(e, r) + } + if (t) + if (a.opaque) i.splice(n, l - n, e, "overlay " + t), l = n + 2; + else + for (; n < l; n += 2) { + var o = i[n + 1]; + i[n + 1] = (o ? o + " " : "") + "overlay " + t + } + }), o), n.state = s, n.baseTokens = null, n.baseTokenPos = 1 + }, l = 0; l < e.state.overlays.length; ++l) a(l); + return { + styles: i, + classes: o.bgClass || o.textClass ? o : null } - return t } - function ut(e) { - var t = e.display, - n = e.doc; - t.maxLine = se(n, n.first), t.maxLineLength = pt(t.maxLine), t.maxLineChanged = !0, n.iter(function (e) { - var n = pt(e); - n > t.maxLineLength && (t.maxLineLength = n, t.maxLine = e) - }) + function pt(e, t, n) { + if (!t.styles || t.styles[0] != e.state.modeGen) { + var r = dt(e, Qe(t)), + i = t.text.length > e.options.maxHighlightLength && We(e.doc.mode, r.state), + o = ht(e, t, r); + i && (r.state = i), t.stateAfter = r.save(!i), t.styles = o.styles, o.classes ? t.styleClasses = o.classes : t.styleClasses && (t.styleClasses = null), n === e.doc.highlightFrontier && (e.doc.modeFrontier = Math.max(e.doc.modeFrontier, ++e.doc.highlightFrontier)) + } + return t.styles } - function mt(e, t, n, o) { - e.text = t, e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null), null != e.order && (e.order = null), qe(e), Ye(e, n); - var r = o ? o(e) : 1; - r != e.height && ce(e, r) + function dt(e, t, n) { + var r = e.doc, + i = e.display; + if (!r.mode.startState) return new ut(r, !0, t); + var o = function (e, t, n) { + for (var r, i, o = e.doc, s = n ? -1 : t - (e.doc.mode.innerMode ? 1e3 : 100), a = t; a > s; --a) { + if (a <= o.first) return o.first; + var l = $e(o, a - 1), + c = l.stateAfter; + if (c && (!n || a + (c instanceof ct ? c.lookAhead : 0) <= o.modeFrontier)) return a; + var u = B(l.text, null, e.options.tabSize); + (null == i || r > u) && (i = a - 1, r = u) + } + return i + }(e, t, n), + s = o > r.first && $e(r, o - 1).stateAfter, + a = s ? ut.fromSaved(r, s, o) : new ut(r, je(r.mode), o); + return r.iter(o, t, (function (n) { + ft(e, n.text, a); + var r = a.line; + n.stateAfter = r == t - 1 || r % 5 == 0 || r >= i.viewFrom && r < i.viewTo ? a.save() : null, a.nextLine() + })), n && (r.modeFrontier = a.line), a } - function ht(e) { - e.parent = null, qe(e) + function ft(e, t, n, r) { + var i = e.doc.mode, + o = new Ge(t, e.options.tabSize, n); + for (o.start = o.pos = r || 0, "" == t && mt(i, n.state); !o.eol();) gt(i, o, n.state), o.start = o.pos } - function ft(e, t) { - if (!e || /^\s*$/.test(e)) return null; - var n = t.addModeClass ? ks : ws; - return n[e] || (n[e] = e.replace(/\S+/g, 'cm-$&')) + function mt(e, t) { + if (e.blankLine) return e.blankLine(t); + if (e.innerMode) { + var n = Ve(e, t); + return n.mode.blankLine ? n.mode.blankLine(n.state) : void 0 + } } - function gt(e, t) { - var n = u('span', null, null, Pa ? 'padding-right: .1px' : null), - o = { - pre: u('pre', [n], 'CodeMirror-line'), - content: n, - col: 0, - pos: 0, - cm: e, - trailingSpace: !1, - splitSpaces: e.getOption('lineWrapping') - }; - t.measure = {}; - for (var r = 0; r <= (t.rest ? t.rest.length : 0); r++) { - var i = r ? t.rest[r - 1] : t.line, - a = void 0; - o.pos = 0, o.addToken = St, $(e.display.measure) && (a = B(i, e.doc.direction)) && (o.addToken = bt(o.addToken, a)), o.map = []; - var s = t != e.display.externalMeasured && pe(i); - Et(i, o, _e(e, i, s)), i.styleClasses && (i.styleClasses.bgClass && (o.bgClass = g(i.styleClasses.bgClass, o.bgClass || '')), i.styleClasses.textClass && (o.textClass = g(i.styleClasses.textClass, o.textClass || ''))), 0 == o.map.length && o.map.push(0, 0, o.content.appendChild(Q(e.display.measure))), 0 == r ? (t.measure.map = o.map, t.measure.cache = {}) : ((t.measure.maps || (t.measure.maps = [])).push(o.map), (t.measure.caches || (t.measure.caches = [])).push({})) + function gt(e, t, n, r) { + for (var i = 0; i < 10; i++) { + r && (r[0] = Ve(e, n).mode); + var o = e.token(t, n); + if (t.pos > t.start) return o } - if (Pa) { - var d = o.content.lastChild; - (/\bcm-tab\b/.test(d.className) || d.querySelector && d.querySelector('.cm-tab')) && (o.content.className = 'cm-tab-wrap-hack') + throw new Error("Mode " + e.name + " failed to advance stream.") + } + ut.prototype.lookAhead = function (e) { + var t = this.doc.getLine(this.line + e); + return null != t && e > this.maxLookAhead && (this.maxLookAhead = e), t + }, ut.prototype.baseToken = function (e) { + if (!this.baseTokens) return null; + for (; this.baseTokens[this.baseTokenPos] <= e;) this.baseTokenPos += 2; + var t = this.baseTokens[this.baseTokenPos + 1]; + return { + type: t && t.replace(/( |^)overlay .*/, ""), + size: this.baseTokens[this.baseTokenPos] - e } - return H(e, 'renderLine', e, t.line, o.pre), o.pre.className && (o.textClass = g(o.pre.className, o.textClass || '')), o + }, ut.prototype.nextLine = function () { + this.line++, this.maxLookAhead > 0 && this.maxLookAhead-- + }, ut.fromSaved = function (e, t, n) { + return t instanceof ct ? new ut(e, We(e.mode, t.state), n, t.lookAhead) : new ut(e, We(e.mode, t), n) + }, ut.prototype.save = function (e) { + var t = !1 !== e ? We(this.doc.mode, this.state) : this.state; + return this.maxLookAhead > 0 ? new ct(t, this.maxLookAhead) : t + }; + var yt = function (e, t, n) { + this.start = e.start, this.end = e.pos, this.string = e.current(), this.type = t || null, this.state = n + }; + + function vt(e, t, n, r) { + var i, o, s = e.doc, + a = s.mode, + l = $e(s, (t = at(s, t)).line), + c = dt(e, t.line, n), + u = new Ge(l.text, e.options.tabSize, c); + for (r && (o = []); + (r || u.pos < t.ch) && !u.eol();) u.start = u.pos, i = gt(a, u, c.state), r && o.push(new yt(u, i, We(s.mode, c.state))); + return r ? o : new yt(u, i, c.state) } - function yt(e) { - var t = p('span', '\u2022', 'cm-invalidchar'); - return t.title = '\\u' + e.charCodeAt(0).toString(16), t.setAttribute('aria-label', t.title), t + function wt(e, t) { + if (e) + for (;;) { + var n = e.match(/(?:^|\s+)line-(background-)?(\S+)/); + if (!n) break; + e = e.slice(0, n.index) + e.slice(n.index + n[0].length); + var r = n[1] ? "bgClass" : "textClass"; + null == t[r] ? t[r] = n[2] : new RegExp("(?:^|s)" + n[2] + "(?:$|s)").test(t[r]) || (t[r] += " " + n[2]) + } + return e } - function St(e, t, n, o, r, i, a) { - if (t) { - var s = e.splitSpaces ? Ct(t, e.trailingSpace) : t, - d = e.cm.state.specialChars, - l = !1, - c; - if (!d.test(t)) e.col += t.length, c = document.createTextNode(s), e.map.push(e.pos, e.pos + t.length, c), Ra && 9 > xa && (l = !0), e.pos += t.length; - else { - c = document.createDocumentFragment(); - for (var u = 0;;) { - d.lastIndex = u; - var h = d.exec(t), - f = h ? h.index - u : t.length - u; - if (f) { - var g = document.createTextNode(s.slice(u, u + f)); - Ra && 9 > xa ? c.appendChild(p('span', [g])) : c.appendChild(g), e.map.push(e.pos, e.pos + f, g), e.col += f, e.pos += f - } - if (!h) break; - u += f + 1; - var y = void 0; - if ('\t' == h[0]) { - var S = e.cm.options.tabSize, - C = S - e.col % S; - y = c.appendChild(p('span', E(C), 'cm-tab')), y.setAttribute('role', 'presentation'), y.setAttribute('cm-text', '\t'), e.col += C - } else '\r' == h[0] || '\n' == h[0] ? (y = c.appendChild(p('span', '\r' == h[0] ? '\u240D' : '\u2424', 'cm-invalidchar')), y.setAttribute('cm-text', h[0]), e.col += 1) : (y = e.cm.options.specialCharPlaceholder(h[0]), y.setAttribute('cm-text', h[0]), Ra && 9 > xa ? c.appendChild(p('span', [y])) : c.appendChild(y), e.col += 1); - e.map.push(e.pos, e.pos + 1, y), e.pos++ - } + function bt(e, t, n, r, i, o, s) { + var a = n.flattenSpans; + null == a && (a = e.options.flattenSpans); + var l, c = 0, + u = null, + h = new Ge(t, e.options.tabSize, r), + p = e.options.addModeClass && [null]; + for ("" == t && wt(mt(n, r.state), o); !h.eol();) { + if (h.pos > e.options.maxHighlightLength ? (a = !1, s && ft(e, t, r, h.pos), h.pos = t.length, l = null) : l = wt(gt(n, h, r.state, p), o), p) { + var d = p[0].name; + d && (l = "m-" + (l ? d + " " + l : d)) } - if (e.trailingSpace = 32 == s.charCodeAt(t.length - 1), n || o || r || l || i) { - var b = n || ''; - o && (b += o), r && (b += r); - var v = p('span', [c], b, i); - if (a) - for (var w in a) a.hasOwnProperty(w) && 'style' != w && 'class' != w && v.setAttribute(w, a[w]); - return e.content.appendChild(v) + if (!a || u != l) { + for (; c < h.start;) i(c = Math.min(h.start, c + 5e3), u); + u = l } - e.content.appendChild(c) + h.start = h.pos + } + for (; c < h.pos;) { + var f = Math.min(h.pos, c + 5e3); + i(f, u), c = f } } + var St = !1, + Ct = !1; - function Ct(e, t) { - if (1 < e.length && !/ /.test(e)) return e; - for (var n = t, o = '', r = 0, i; r < e.length; r++) i = e.charAt(r), ' ' == i && n && (r == e.length - 1 || 32 == e.charCodeAt(r + 1)) && (i = '\xA0'), o += i, n = ' ' == i; - return o + function Et(e, t, n) { + this.marker = e, this.from = t, this.to = n } - function bt(e, t) { - return function (n, o, r, a, s, d, l) { - r = r ? r + ' cm-force-border' : 'cm-force-border'; - for (var c = n.pos, p = c + o.length;;) { - for (var u = void 0, m = 0; m < t.length && (u = t[m], !(u.to > c && u.from <= c)); m++); - if (u.to >= p) return e(n, o, r, a, s, d, l); - e(n, o.slice(0, u.to - c), r, a, null, d, l), a = null, o = o.slice(u.to - c), c = u.to + function kt(e, t) { + if (e) + for (var n = 0; n < e.length; ++n) { + var r = e[n]; + if (r.marker == t) return r } - } } - function vt(e, t, n, o) { - var r = !o && n.widgetNode; - r && e.map.push(e.pos, e.pos + t, r), !o && e.cm.display.input.needsContentAttribute && (!r && (r = e.content.appendChild(document.createElement('span'))), r.setAttribute('cm-marker', n.id)), r && (e.cm.display.input.setUneditable(r), e.content.appendChild(r)), e.pos += t, e.trailingSpace = !1 + function xt(e, t) { + for (var n, r = 0; r < e.length; ++r) e[r] != t && (n || (n = [])).push(e[r]); + return n } - function Et(e, t, n) { - var o = e.markedSpans, - r = e.text, - a = 0; - if (!o) { - for (var s = 1; s < n.length; s += 2) t.addToken(t, r.slice(a, a = n[s]), ft(n[s + 1], t.cm.options)); - return - } - for (var l = r.length, c = 0, p = 1, i = '', u = 0, h, f, g, y, S, C, b;;) { - if (u == c) { - g = y = S = f = '', b = null, C = null, u = Infinity; - for (var v = [], E = void 0, w = 0; w < o.length; ++w) { - var k = o[w], - T = k.marker; - if ('bookmark' == T.type && k.from == c && T.widgetNode) v.push(T); - else if (k.from <= c && (null == k.to || k.to > c || T.collapsed && k.to == c && k.from == c)) { - if (null != k.to && k.to != c && u > k.to && (u = k.to, y = ''), T.className && (g += ' ' + T.className), T.css && (f = (f ? f + ';' : '') + T.css), T.startStyle && k.from == c && (S += ' ' + T.startStyle), T.endStyle && k.to == u && (E || (E = [])).push(T.endStyle, k.to), T.title && ((b || (b = {})).title = T.title), T.attributes) - for (var m in T.attributes)(b || (b = {}))[m] = T.attributes[m]; - T.collapsed && (!C || 0 > $e(C.marker, T)) && (C = k) - } else k.from > c && u > k.from && (u = k.from) - } - if (E) - for (var _ = 0; _ < E.length; _ += 2) E[_ + 1] == u && (y += ' ' + E[_]); - if (!C || C.from == c) - for (var R = 0; R < v.length; ++R) vt(t, 0, v[R]); - if (C && (C.from || 0) == c) { - if (vt(t, (null == C.to ? l + 1 : C.to) - c, C.marker, null == C.from), null == C.to) return; - C.to == c && (C = !1) - } - } - if (c >= l) break; - for (var x = d(l, u);;) { - if (i) { - var P = c + i.length; - if (!C) { - var D = P > x ? i.slice(0, x - c) : i; - t.addToken(t, D, h ? h + g : g, S, c + D.length == u ? y : '', f, b) + function Tt(e, t) { + if (t.full) return null; + var n = Xe(e, t.from.line) && $e(e, t.from.line).markedSpans, + r = Xe(e, t.to.line) && $e(e, t.to.line).markedSpans; + if (!n && !r) return null; + var i = t.from.ch, + o = t.to.ch, + s = 0 == tt(t.from, t.to), + a = function (e, t, n) { + var r; + if (e) + for (var i = 0; i < e.length; ++i) { + var o = e[i], + s = o.marker; + if (null == o.from || (s.inclusiveLeft ? o.from <= t : o.from < t) || o.from == t && "bookmark" == s.type && (!n || !o.marker.insertLeft)) { + var a = null == o.to || (s.inclusiveRight ? o.to >= t : o.to > t); + (r || (r = [])).push(new Et(s, o.from, a ? null : o.to)) + } } - if (P >= x) { - i = i.slice(x - c), c = x; - break + return r + }(n, i, s), + l = function (e, t, n) { + var r; + if (e) + for (var i = 0; i < e.length; ++i) { + var o = e[i], + s = o.marker; + if (null == o.to || (s.inclusiveRight ? o.to >= t : o.to > t) || o.from == t && "bookmark" == s.type && (!n || o.marker.insertLeft)) { + var a = null == o.from || (s.inclusiveLeft ? o.from <= t : o.from < t); + (r || (r = [])).push(new Et(s, a ? null : o.from - t, null == o.to ? null : o.to - t)) + } } - c = P, S = '' + return r + }(r, o, s), + c = 1 == t.text.length, + u = K(t.text).length + (c ? i : 0); + if (a) + for (var h = 0; h < a.length; ++h) { + var p = a[h]; + if (null == p.to) { + var d = kt(l, p.marker); + d ? c && (p.to = null == d.to ? null : d.to + u) : p.to = i } - i = r.slice(a, a = n[p++]), h = ft(n[p++], t.cm.options) } + if (l) + for (var f = 0; f < l.length; ++f) { + var m = l[f]; + null != m.to && (m.to += u), null == m.from ? kt(a, m.marker) || (m.from = u, c && (a || (a = [])).push(m)) : (m.from += u, c && (a || (a = [])).push(m)) + } + a && (a = Rt(a)), l && l != a && (l = Rt(l)); + var g = [a]; + if (!c) { + var y, v = t.text.length - 2; + if (v > 0 && a) + for (var w = 0; w < a.length; ++w) null == a[w].to && (y || (y = [])).push(new Et(a[w].marker, null, null)); + for (var b = 0; b < v; ++b) g.push(y); + g.push(l) } + return g } - function wt(e, t, n) { - this.line = t, this.rest = it(t), this.size = this.rest ? pe(w(this.rest)) - n + 1 : 1, this.node = this.text = null, this.hidden = dt(e, t) + function Rt(e) { + for (var t = 0; t < e.length; ++t) { + var n = e[t]; + null != n.from && n.from == n.to && !1 !== n.marker.clearWhenEmpty && e.splice(t--, 1) + } + return e.length ? e : null } - function kt(e, t, n) { - for (var o = [], r = t, i, a; r < n; r = i) a = new wt(e.doc, se(e.doc, r), r), i = r + a.size, o.push(a); - return o + function Dt(e) { + var t = e.markedSpans; + if (t) { + for (var n = 0; n < t.length; ++n) t[n].marker.detachLine(e); + e.markedSpans = null + } } - function Tt(e) { - Ts ? Ts.ops.push(e) : e.ownsGroup = Ts = { - ops: [e], - delayedCallbacks: [] + function _t(e, t) { + if (t) { + for (var n = 0; n < t.length; ++n) t[n].marker.attachLine(e); + e.markedSpans = t } } - function _t(e) { - var t = e.delayedCallbacks, - n = 0; - do { - for (; n < t.length; n++) t[n].call(null); - for (var o = 0, r; o < e.ops.length; o++) - if (r = e.ops[o], r.cursorActivityHandlers) - for (; r.cursorActivityCalled < r.cursorActivityHandlers.length;) r.cursorActivityHandlers[r.cursorActivityCalled++].call(null, r.cm) - } while (n < t.length) + function At(e) { + return e.inclusiveLeft ? -1 : 0 } - function Rt(e, t) { - var n = e.ownsGroup; - if (n) try { - _t(n) - } finally { - Ts = null, t(n) - } + function Mt(e) { + return e.inclusiveRight ? 1 : 0 } - function xt(e, t) { - var n = N(e, t); - if (n.length) { - var o = Array.prototype.slice.call(arguments, 2), - r; - Ts ? r = Ts.delayedCallbacks : _s ? r = _s : (r = _s = [], setTimeout(Pt, 0)); - for (var a = function (e) { - r.push(function () { - return n[e].apply(null, o) - }) - }, s = 0; s < n.length; ++s) a(s) - } + function Pt(e, t) { + var n = e.lines.length - t.lines.length; + if (0 != n) return n; + var r = e.find(), + i = t.find(), + o = tt(r.from, i.from) || At(e) - At(t); + if (o) return -o; + var s = tt(r.to, i.to) || Mt(e) - Mt(t); + return s || t.id - e.id } - function Pt() { - var e = _s; - _s = null; - for (var t = 0; t < e.length; ++t) e[t]() + function It(e, t) { + var n, r = Ct && e.markedSpans; + if (r) + for (var i = void 0, o = 0; o < r.length; ++o)(i = r[o]).marker.collapsed && null == (t ? i.from : i.to) && (!n || Pt(n, i.marker) < 0) && (n = i.marker); + return n } - function Dt(e, t, n, o) { - for (var r = 0, i; r < t.changes.length; r++) i = t.changes[r], 'text' == i ? Lt(e, t) : 'gutter' == i ? Bt(e, t, n, o) : 'class' == i ? Ft(e, t) : 'widget' == i && Nt(e, t, o); - t.changes = null + function Ot(e) { + return It(e, !0) } - function Mt(e) { - return e.node == e.text && (e.node = p('div', null, null, 'position: relative'), e.text.parentNode && e.text.parentNode.replaceChild(e.node, e.text), e.node.appendChild(e.text), Ra && 8 > xa && (e.node.style.zIndex = 2)), e.node + function Lt(e) { + return It(e, !1) } - function At(e, t) { - var n = t.bgClass ? t.bgClass + ' ' + (t.line.bgClass || '') : t.line.bgClass; - if (n && (n += ' CodeMirror-linebackground'), t.background) n ? t.background.className = n : (t.background.parentNode.removeChild(t.background), t.background = null); - else if (n) { - var o = Mt(t); - t.background = o.insertBefore(p('div', null, n), o.firstChild), e.display.input.setUneditable(t.background) - } + function Nt(e, t) { + var n, r = Ct && e.markedSpans; + if (r) + for (var i = 0; i < r.length; ++i) { + var o = r[i]; + o.marker.collapsed && (null == o.from || o.from < t) && (null == o.to || o.to > t) && (!n || Pt(n, o.marker) < 0) && (n = o.marker) + } + return n } - function It(e, t) { - var n = e.display.externalMeasured; - return n && n.line == t.line ? (e.display.externalMeasured = null, t.measure = n.measure, n.built) : gt(e, t) + function Ft(e, t, n, r, i) { + var o = $e(e, t), + s = Ct && o.markedSpans; + if (s) + for (var a = 0; a < s.length; ++a) { + var l = s[a]; + if (l.marker.collapsed) { + var c = l.marker.find(0), + u = tt(c.from, n) || At(l.marker) - At(i), + h = tt(c.to, r) || Mt(l.marker) - Mt(i); + if (!(u >= 0 && h <= 0 || u <= 0 && h >= 0) && (u <= 0 && (l.marker.inclusiveRight && i.inclusiveLeft ? tt(c.to, n) >= 0 : tt(c.to, n) > 0) || u >= 0 && (l.marker.inclusiveRight && i.inclusiveLeft ? tt(c.from, r) <= 0 : tt(c.from, r) < 0))) return !0 + } + } } - function Lt(e, t) { - var n = t.text.className, - o = It(e, t); - t.text == t.node && (t.node = o.pre), t.text.parentNode.replaceChild(o.pre, t.text), t.text = o.pre, o.bgClass != t.bgClass || o.textClass != t.textClass ? (t.bgClass = o.bgClass, t.textClass = o.textClass, Ft(e, t)) : n && (t.text.className = n) + function Bt(e) { + for (var t; t = Ot(e);) e = t.find(-1, !0).line; + return e } - function Ft(e, t) { - At(e, t), t.line.wrapClass ? Mt(t).className = t.line.wrapClass : t.node != t.text && (t.node.className = ''); - var n = t.textClass ? t.textClass + ' ' + (t.line.textClass || '') : t.line.textClass; - t.text.className = n || '' + function Ht(e, t) { + var n = $e(e, t), + r = Bt(n); + return n == r ? t : Qe(r) } - function Bt(e, t, n, o) { - if (t.gutter && (t.node.removeChild(t.gutter), t.gutter = null), t.gutterBackground && (t.node.removeChild(t.gutterBackground), t.gutterBackground = null), t.line.gutterClass) { - var r = Mt(t); - t.gutterBackground = p('div', null, 'CodeMirror-gutter-background ' + t.line.gutterClass, 'left: ' + (e.options.fixedGutter ? o.fixedPos : -o.gutterTotalWidth) + 'px; width: ' + o.gutterTotalWidth + 'px'), e.display.input.setUneditable(t.gutterBackground), r.insertBefore(t.gutterBackground, t.text) - } - var i = t.line.gutterMarkers; - if (e.options.lineNumbers || i) { - var a = Mt(t), - s = t.gutter = p('div', null, 'CodeMirror-gutter-wrapper', 'left: ' + (e.options.fixedGutter ? o.fixedPos : -o.gutterTotalWidth) + 'px'); - if (e.display.input.setUneditable(s), a.insertBefore(s, t.text), t.line.gutterClass && (s.className += ' ' + t.line.gutterClass), !e.options.lineNumbers || i && i['CodeMirror-linenumbers'] || (t.lineNumber = s.appendChild(p('div', he(e.options, n), 'CodeMirror-linenumber CodeMirror-gutter-elt', 'left: ' + o.gutterLeft['CodeMirror-linenumbers'] + 'px; width: ' + e.display.lineNumInnerWidth + 'px'))), i) - for (var d = 0; d < e.display.gutterSpecs.length; ++d) { - var l = e.display.gutterSpecs[d].className, - c = i.hasOwnProperty(l) && i[l]; - c && s.appendChild(p('div', [c], 'CodeMirror-gutter-elt', 'left: ' + o.gutterLeft[l] + 'px; width: ' + o.gutterWidth[l] + 'px')) - } + function zt(e, t) { + if (t > e.lastLine()) return t; + var n, r = $e(e, t); + if (!Ut(e, r)) return t; + for (; n = Lt(r);) r = n.find(1, !0).line; + return Qe(r) + 1 + } + + function Ut(e, t) { + var n = Ct && t.markedSpans; + if (n) + for (var r = void 0, i = 0; i < n.length; ++i) + if ((r = n[i]).marker.collapsed) { + if (null == r.from) return !0; + if (!r.marker.widgetNode && 0 == r.from && r.marker.inclusiveLeft && Wt(e, t, r)) return !0 + } + } + + function Wt(e, t, n) { + if (null == n.to) { + var r = n.marker.find(1, !0); + return Wt(e, r.line, kt(r.line.markedSpans, n.marker)) + } + if (n.marker.inclusiveRight && n.to == t.text.length) return !0; + for (var i = void 0, o = 0; o < t.markedSpans.length; ++o) + if ((i = t.markedSpans[o]).marker.collapsed && !i.marker.widgetNode && i.from == n.to && (null == i.to || i.to != n.from) && (i.marker.inclusiveLeft || n.marker.inclusiveRight) && Wt(e, t, i)) return !0 + } + + function Vt(e) { + for (var t = 0, n = (e = Bt(e)).parent, r = 0; r < n.lines.length; ++r) { + var i = n.lines[r]; + if (i == e) break; + t += i.height + } + for (var o = n.parent; o; o = (n = o).parent) + for (var s = 0; s < o.children.length; ++s) { + var a = o.children[s]; + if (a == n) break; + t += a.height + } + return t + } + + function jt(e) { + if (0 == e.height) return 0; + for (var t, n = e.text.length, r = e; t = Ot(r);) { + var i = t.find(0, !0); + r = i.from.line, n += i.from.ch - i.to.ch + } + for (r = e; t = Lt(r);) { + var o = t.find(0, !0); + n -= r.text.length - o.from.ch, n += (r = o.to.line).text.length - o.to.ch + } + return n + } + + function Gt(e) { + var t = e.display, + n = e.doc; + t.maxLine = $e(n, n.first), t.maxLineLength = jt(t.maxLine), t.maxLineChanged = !0, n.iter((function (e) { + var n = jt(e); + n > t.maxLineLength && (t.maxLineLength = n, t.maxLine = e) + })) + } + var $t = function (e, t, n) { + this.text = e, _t(this, t), this.height = n ? n(this) : 1 + }; + + function qt(e) { + e.parent = null, Dt(e) + } + $t.prototype.lineNo = function () { + return Qe(this) + }, ve($t); + var Kt = {}, + Yt = {}; + + function Qt(e, t) { + if (!e || /^\s*$/.test(e)) return null; + var n = t.addModeClass ? Yt : Kt; + return n[e] || (n[e] = e.replace(/\S+/g, "cm-$&")) + } + + function Zt(e, t) { + var n = A("span", null, null, l ? "padding-right: .1px" : null), + r = { + pre: A("pre", [n], "CodeMirror-line"), + content: n, + col: 0, + pos: 0, + cm: e, + trailingSpace: !1, + splitSpaces: e.getOption("lineWrapping") + }; + t.measure = {}; + for (var i = 0; i <= (t.rest ? t.rest.length : 0); i++) { + var o = i ? t.rest[i - 1] : t.line, + s = void 0; + r.pos = 0, r.addToken = Jt, _e(e.display.measure) && (s = ce(o, e.doc.direction)) && (r.addToken = en(r.addToken, s)), r.map = [], nn(o, r, pt(e, o, t != e.display.externalMeasured && Qe(o))), o.styleClasses && (o.styleClasses.bgClass && (r.bgClass = O(o.styleClasses.bgClass, r.bgClass || "")), o.styleClasses.textClass && (r.textClass = O(o.styleClasses.textClass, r.textClass || ""))), 0 == r.map.length && r.map.push(0, 0, r.content.appendChild(De(e.display.measure))), 0 == i ? (t.measure.map = r.map, t.measure.cache = {}) : ((t.measure.maps || (t.measure.maps = [])).push(r.map), (t.measure.caches || (t.measure.caches = [])).push({})) + } + if (l) { + var a = r.content.lastChild; + (/\bcm-tab\b/.test(a.className) || a.querySelector && a.querySelector(".cm-tab")) && (r.content.className = "cm-tab-wrap-hack") + } + return fe(e, "renderLine", e, t.line, r.pre), r.pre.className && (r.textClass = O(r.pre.className, r.textClass || "")), r + } + + function Xt(e) { + var t = _("span", "•", "cm-invalidchar"); + return t.title = "\\u" + e.charCodeAt(0).toString(16), t.setAttribute("aria-label", t.title), t + } + + function Jt(e, t, n, r, i, o, l) { + if (t) { + var c, u = e.splitSpaces ? function (e, t) { + if (e.length > 1 && !/ /.test(e)) return e; + for (var n = t, r = "", i = 0; i < e.length; i++) { + var o = e.charAt(i); + " " != o || !n || i != e.length - 1 && 32 != e.charCodeAt(i + 1) || (o = " "), r += o, n = " " == o + } + return r + }(t, e.trailingSpace) : t, + h = e.cm.state.specialChars, + p = !1; + if (h.test(t)) { + c = document.createDocumentFragment(); + for (var d = 0;;) { + h.lastIndex = d; + var f = h.exec(t), + m = f ? f.index - d : t.length - d; + if (m) { + var g = document.createTextNode(u.slice(d, d + m)); + s && a < 9 ? c.appendChild(_("span", [g])) : c.appendChild(g), e.map.push(e.pos, e.pos + m, g), e.col += m, e.pos += m + } + if (!f) break; + d += m + 1; + var y = void 0; + if ("\t" == f[0]) { + var v = e.cm.options.tabSize, + w = v - e.col % v; + (y = c.appendChild(_("span", q(w), "cm-tab"))).setAttribute("role", "presentation"), y.setAttribute("cm-text", "\t"), e.col += w + } else "\r" == f[0] || "\n" == f[0] ? ((y = c.appendChild(_("span", "\r" == f[0] ? "␍" : "␤", "cm-invalidchar"))).setAttribute("cm-text", f[0]), e.col += 1) : ((y = e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text", f[0]), s && a < 9 ? c.appendChild(_("span", [y])) : c.appendChild(y), e.col += 1); + e.map.push(e.pos, e.pos + 1, y), e.pos++ + } + } else e.col += t.length, c = document.createTextNode(u), e.map.push(e.pos, e.pos + t.length, c), s && a < 9 && (p = !0), e.pos += t.length; + if (e.trailingSpace = 32 == u.charCodeAt(t.length - 1), n || r || i || p || o) { + var b = n || ""; + r && (b += r), i && (b += i); + var S = _("span", [c], b, o); + if (l) + for (var C in l) l.hasOwnProperty(C) && "style" != C && "class" != C && S.setAttribute(C, l[C]); + return e.content.appendChild(S) + } + e.content.appendChild(c) } } - function Nt(e, t, n) { + function en(e, t) { + return function (n, r, i, o, s, a, l) { + i = i ? i + " cm-force-border" : "cm-force-border"; + for (var c = n.pos, u = c + r.length;;) { + for (var h = void 0, p = 0; p < t.length && !((h = t[p]).to > c && h.from <= c); p++); + if (h.to >= u) return e(n, r, i, o, s, a, l); + e(n, r.slice(0, h.to - c), i, o, null, a, l), o = null, r = r.slice(h.to - c), c = h.to + } + } + } + + function tn(e, t, n, r) { + var i = !r && n.widgetNode; + i && e.map.push(e.pos, e.pos + t, i), !r && e.cm.display.input.needsContentAttribute && (i || (i = e.content.appendChild(document.createElement("span"))), i.setAttribute("cm-marker", n.id)), i && (e.cm.display.input.setUneditable(i), e.content.appendChild(i)), e.pos += t, e.trailingSpace = !1 + } + + function nn(e, t, n) { + var r = e.markedSpans, + i = e.text, + o = 0; + if (r) + for (var s, a, l, c, u, h, p, d = i.length, f = 0, m = 1, g = "", y = 0;;) { + if (y == f) { + l = c = u = a = "", p = null, h = null, y = 1 / 0; + for (var v = [], w = void 0, b = 0; b < r.length; ++b) { + var S = r[b], + C = S.marker; + if ("bookmark" == C.type && S.from == f && C.widgetNode) v.push(C); + else if (S.from <= f && (null == S.to || S.to > f || C.collapsed && S.to == f && S.from == f)) { + if (null != S.to && S.to != f && y > S.to && (y = S.to, c = ""), C.className && (l += " " + C.className), C.css && (a = (a ? a + ";" : "") + C.css), C.startStyle && S.from == f && (u += " " + C.startStyle), C.endStyle && S.to == y && (w || (w = [])).push(C.endStyle, S.to), C.title && ((p || (p = {})).title = C.title), C.attributes) + for (var E in C.attributes)(p || (p = {}))[E] = C.attributes[E]; + C.collapsed && (!h || Pt(h.marker, C) < 0) && (h = S) + } else S.from > f && y > S.from && (y = S.from) + } + if (w) + for (var k = 0; k < w.length; k += 2) w[k + 1] == y && (c += " " + w[k]); + if (!h || h.from == f) + for (var x = 0; x < v.length; ++x) tn(t, 0, v[x]); + if (h && (h.from || 0) == f) { + if (tn(t, (null == h.to ? d + 1 : h.to) - f, h.marker, null == h.from), null == h.to) return; + h.to == f && (h = !1) + } + } + if (f >= d) break; + for (var T = Math.min(d, y);;) { + if (g) { + var R = f + g.length; + if (!h) { + var D = R > T ? g.slice(0, T - f) : g; + t.addToken(t, D, s ? s + l : l, u, f + D.length == y ? c : "", a, p) + } + if (R >= T) { + g = g.slice(T - f), f = T; + break + } + f = R, u = "" + } + g = i.slice(o, o = n[m++]), s = Qt(n[m++], t.cm.options) + } + } else + for (var _ = 1; _ < n.length; _ += 2) t.addToken(t, i.slice(o, o = n[_]), Qt(n[_ + 1], t.cm.options)) + } + + function rn(e, t, n) { + this.line = t, this.rest = function (e) { + for (var t, n; t = Lt(e);) e = t.find(1, !0).line, (n || (n = [])).push(e); + return n + }(t), this.size = this.rest ? Qe(K(this.rest)) - n + 1 : 1, this.node = this.text = null, this.hidden = Ut(e, t) + } + + function on(e, t, n) { + for (var r, i = [], o = t; o < n; o = r) { + var s = new rn(e.doc, $e(e.doc, o), o); + r = o + s.size, i.push(s) + } + return i + } + var sn = null, + an = null; + + function ln(e, t) { + var n = pe(e, t); + if (n.length) { + var r, i = Array.prototype.slice.call(arguments, 2); + sn ? r = sn.delayedCallbacks : an ? r = an : (r = an = [], setTimeout(cn, 0)); + for (var o = function (e) { + r.push((function () { + return n[e].apply(null, i) + })) + }, s = 0; s < n.length; ++s) o(s) + } + } + + function cn() { + var e = an; + an = null; + for (var t = 0; t < e.length; ++t) e[t]() + } + + function un(e, t, n, r) { + for (var i = 0; i < t.changes.length; i++) { + var o = t.changes[i]; + "text" == o ? dn(e, t) : "gutter" == o ? mn(e, t, n, r) : "class" == o ? fn(e, t) : "widget" == o && gn(e, t, r) + } + t.changes = null + } + + function hn(e) { + return e.node == e.text && (e.node = _("div", null, null, "position: relative"), e.text.parentNode && e.text.parentNode.replaceChild(e.node, e.text), e.node.appendChild(e.text), s && a < 8 && (e.node.style.zIndex = 2)), e.node + } + + function pn(e, t) { + var n = e.display.externalMeasured; + return n && n.line == t.line ? (e.display.externalMeasured = null, t.measure = n.measure, n.built) : Zt(e, t) + } + + function dn(e, t) { + var n = t.text.className, + r = pn(e, t); + t.text == t.node && (t.node = r.pre), t.text.parentNode.replaceChild(r.pre, t.text), t.text = r.pre, r.bgClass != t.bgClass || r.textClass != t.textClass ? (t.bgClass = r.bgClass, t.textClass = r.textClass, fn(e, t)) : n && (t.text.className = n) + } + + function fn(e, t) { + ! function (e, t) { + var n = t.bgClass ? t.bgClass + " " + (t.line.bgClass || "") : t.line.bgClass; + if (n && (n += " CodeMirror-linebackground"), t.background) n ? t.background.className = n : (t.background.parentNode.removeChild(t.background), t.background = null); + else if (n) { + var r = hn(t); + t.background = r.insertBefore(_("div", null, n), r.firstChild), e.display.input.setUneditable(t.background) + } + }(e, t), t.line.wrapClass ? hn(t).className = t.line.wrapClass : t.node != t.text && (t.node.className = ""); + var n = t.textClass ? t.textClass + " " + (t.line.textClass || "") : t.line.textClass; + t.text.className = n || "" + } + + function mn(e, t, n, r) { + if (t.gutter && (t.node.removeChild(t.gutter), t.gutter = null), t.gutterBackground && (t.node.removeChild(t.gutterBackground), t.gutterBackground = null), t.line.gutterClass) { + var i = hn(t); + t.gutterBackground = _("div", null, "CodeMirror-gutter-background " + t.line.gutterClass, "left: " + (e.options.fixedGutter ? r.fixedPos : -r.gutterTotalWidth) + "px; width: " + r.gutterTotalWidth + "px"), e.display.input.setUneditable(t.gutterBackground), i.insertBefore(t.gutterBackground, t.text) + } + var o = t.line.gutterMarkers; + if (e.options.lineNumbers || o) { + var s = hn(t), + a = t.gutter = _("div", null, "CodeMirror-gutter-wrapper", "left: " + (e.options.fixedGutter ? r.fixedPos : -r.gutterTotalWidth) + "px"); + if (e.display.input.setUneditable(a), s.insertBefore(a, t.text), t.line.gutterClass && (a.className += " " + t.line.gutterClass), !e.options.lineNumbers || o && o["CodeMirror-linenumbers"] || (t.lineNumber = a.appendChild(_("div", Je(e.options, n), "CodeMirror-linenumber CodeMirror-gutter-elt", "left: " + r.gutterLeft["CodeMirror-linenumbers"] + "px; width: " + e.display.lineNumInnerWidth + "px"))), o) + for (var l = 0; l < e.display.gutterSpecs.length; ++l) { + var c = e.display.gutterSpecs[l].className, + u = o.hasOwnProperty(c) && o[c]; + u && a.appendChild(_("div", [u], "CodeMirror-gutter-elt", "left: " + r.gutterLeft[c] + "px; width: " + r.gutterWidth[c] + "px")) + } + } + } + + function gn(e, t, n) { t.alignable && (t.alignable = null); - for (var o = t.node.firstChild, r = void 0; o; o = r) r = o.nextSibling, 'CodeMirror-linewidget' == o.className && t.node.removeChild(o); - Ht(e, t, n) + for (var r = t.node.firstChild, i = void 0; r; r = i) i = r.nextSibling, "CodeMirror-linewidget" == r.className && t.node.removeChild(r); + vn(e, t, n) } - function Ot(e, t, n, o) { - var r = It(e, t); - return t.text = t.node = r.pre, r.bgClass && (t.bgClass = r.bgClass), r.textClass && (t.textClass = r.textClass), Ft(e, t), Bt(e, t, n, o), Ht(e, t, o), t.node + function yn(e, t, n, r) { + var i = pn(e, t); + return t.text = t.node = i.pre, i.bgClass && (t.bgClass = i.bgClass), i.textClass && (t.textClass = i.textClass), fn(e, t), mn(e, t, n, r), vn(e, t, r), t.node } - function Ht(e, t, n) { - if (zt(e, t.line, t, n, !0), t.rest) - for (var o = 0; o < t.rest.length; o++) zt(e, t.rest[o], t, n, !1) + function vn(e, t, n) { + if (wn(e, t.line, t, n, !0), t.rest) + for (var r = 0; r < t.rest.length; r++) wn(e, t.rest[r], t, n, !1) } - function zt(e, t, n, o, r) { + function wn(e, t, n, r, i) { if (t.widgets) - for (var a = Mt(n), s = 0, i = t.widgets; s < i.length; ++s) { - var d = i[s], - l = p('div', [d.node], 'CodeMirror-linewidget'); - d.handleMouseEvents || l.setAttribute('cm-ignore-events', 'true'), Ut(d, l, n, o), e.display.input.setUneditable(l), r && d.above ? a.insertBefore(l, n.gutter || n.text) : a.appendChild(l), xt(d, 'redraw') + for (var o = hn(n), s = 0, a = t.widgets; s < a.length; ++s) { + var l = a[s], + c = _("div", [l.node], "CodeMirror-linewidget"); + l.handleMouseEvents || c.setAttribute("cm-ignore-events", "true"), bn(l, c, n, r), e.display.input.setUneditable(c), i && l.above ? o.insertBefore(c, n.gutter || n.text) : o.appendChild(c), ln(l, "redraw") } } - function Ut(e, t, n, o) { + function bn(e, t, n, r) { if (e.noHScroll) { (n.alignable || (n.alignable = [])).push(t); - var r = o.wrapperWidth; - t.style.left = o.fixedPos + 'px', e.coverGutter || (r -= o.gutterTotalWidth, t.style.paddingLeft = o.gutterTotalWidth + 'px'), t.style.width = r + 'px' + var i = r.wrapperWidth; + t.style.left = r.fixedPos + "px", e.coverGutter || (i -= r.gutterTotalWidth, t.style.paddingLeft = r.gutterTotalWidth + "px"), t.style.width = i + "px" } - e.coverGutter && (t.style.zIndex = 5, t.style.position = 'relative', !e.noHScroll && (t.style.marginLeft = -o.gutterTotalWidth + 'px')) + e.coverGutter && (t.style.zIndex = 5, t.style.position = "relative", e.noHScroll || (t.style.marginLeft = -r.gutterTotalWidth + "px")) } - function Wt(e) { + function Sn(e) { if (null != e.height) return e.height; var t = e.doc.cm; if (!t) return 0; - if (!m(document.body, e.node)) { - var n = 'position: relative;'; - e.coverGutter && (n += 'margin-left: -' + t.display.gutters.offsetWidth + 'px;'), e.noHScroll && (n += 'width: ' + t.display.wrapper.clientWidth + 'px;'), c(t.display.measure, p('div', [e.node], null, n)) + if (!M(document.body, e.node)) { + var n = "position: relative;"; + e.coverGutter && (n += "margin-left: -" + t.display.gutters.offsetWidth + "px;"), e.noHScroll && (n += "width: " + t.display.wrapper.clientWidth + "px;"), D(t.display.measure, _("div", [e.node], null, n)) } return e.height = e.node.parentNode.offsetHeight } - function Vt(t, o) { - for (var e = Y(o); e != t.wrapper; e = e.parentNode) - if (!e || 1 == e.nodeType && 'true' == e.getAttribute('cm-ignore-events') || e.parentNode == t.sizer && e != t.mover) return !0 + function Cn(e, t) { + for (var n = Ee(t); n != e.wrapper; n = n.parentNode) + if (!n || 1 == n.nodeType && "true" == n.getAttribute("cm-ignore-events") || n.parentNode == e.sizer && n != e.mover) return !0 } - function Gt(e) { + function En(e) { return e.lineSpace.offsetTop } - function Kt(e) { + function kn(e) { return e.mover.offsetHeight - e.lineSpace.offsetHeight } - function jt(t) { - if (t.cachedPaddingH) return t.cachedPaddingH; - var n = c(t.measure, p('pre', 'x', 'CodeMirror-line-like')), - e = window.getComputedStyle ? window.getComputedStyle(n) : n.currentStyle, - o = { - left: parseInt(e.paddingLeft), - right: parseInt(e.paddingRight) + function xn(e) { + if (e.cachedPaddingH) return e.cachedPaddingH; + var t = D(e.measure, _("pre", "x", "CodeMirror-line-like")), + n = window.getComputedStyle ? window.getComputedStyle(t) : t.currentStyle, + r = { + left: parseInt(n.paddingLeft), + right: parseInt(n.paddingRight) }; - return isNaN(o.left) || isNaN(o.right) || (t.cachedPaddingH = o), o - } - - function qt(e) { - return Xa - e.display.nativeBarWidth + return isNaN(r.left) || isNaN(r.right) || (e.cachedPaddingH = r), r } - function Yt(e) { - return e.display.scroller.clientWidth - qt(e) - e.display.barWidth + function Tn(e) { + return 30 - e.display.nativeBarWidth } - function Xt(e) { - return e.display.scroller.clientHeight - qt(e) - e.display.barHeight + function Rn(e) { + return e.display.scroller.clientWidth - Tn(e) - e.display.barWidth } - function Qt(e, t, n) { - var r = e.options.lineWrapping, - a = r && Yt(e); - if (!t.measure.heights || r && t.measure.width != a) { - var s = t.measure.heights = []; - if (r) { - t.measure.width = a; - for (var d = t.text.firstChild.getClientRects(), l = 0; l < d.length - 1; l++) { - var i = d[l], - c = d[l + 1]; - 2 < o(i.bottom - c.bottom) && s.push((i.bottom + c.top) / 2 - n.top) - } - } - s.push(n.bottom - n.top) - } + function Dn(e) { + return e.display.scroller.clientHeight - Tn(e) - e.display.barHeight } - function $t(e, t, n) { + function _n(e, t, n) { if (e.line == t) return { map: e.measure.map, cache: e.measure.cache }; - for (var o = 0; o < e.rest.length; o++) - if (e.rest[o] == t) return { - map: e.measure.maps[o], - cache: e.measure.caches[o] - }; for (var r = 0; r < e.rest.length; r++) - if (pe(e.rest[r]) > n) return { + if (e.rest[r] == t) return { map: e.measure.maps[r], - cache: e.measure.caches[r], + cache: e.measure.caches[r] + }; + for (var i = 0; i < e.rest.length; i++) + if (Qe(e.rest[i]) > n) return { + map: e.measure.maps[i], + cache: e.measure.caches[i], before: !0 } } - function Zt(e, t) { - t = ot(t); - var n = pe(t), - o = e.display.externalMeasured = new wt(e.doc, t, n); - o.lineN = n; - var r = o.built = gt(e, o); - return o.text = r.pre, c(e.display.lineMeasure, r.pre), o - } - - function Jt(e, t, n, o) { - return nn(e, tn(e, t), n, o) + function An(e, t, n, r) { + return In(e, Pn(e, t), n, r) } - function en(e, t) { - if (t >= e.display.viewFrom && t < e.display.viewTo) return e.display.view[Fn(e, t)]; + function Mn(e, t) { + if (t >= e.display.viewFrom && t < e.display.viewTo) return e.display.view[ur(e, t)]; var n = e.display.externalMeasured; - if (n && t >= n.lineN && t < n.lineN + n.size) return n - } - - function tn(e, t) { - var n = pe(t), - o = en(e, n); - o && !o.text ? o = null : o && o.changes && (Dt(e, o, n, Dn(e)), e.curOp.forceUpdate = !0), o || (o = Zt(e, t)); - var r = $t(o, t, n); + return n && t >= n.lineN && t < n.lineN + n.size ? n : void 0 + } + + function Pn(e, t) { + var n = Qe(t), + r = Mn(e, n); + r && !r.text ? r = null : r && r.changes && (un(e, r, n, or(e)), e.curOp.forceUpdate = !0), r || (r = function (e, t) { + var n = Qe(t = Bt(t)), + r = e.display.externalMeasured = new rn(e.doc, t, n); + r.lineN = n; + var i = r.built = Zt(e, r); + return r.text = i.pre, D(e.display.lineMeasure, i.pre), r + }(e, t)); + var i = _n(r, t, n); return { line: t, - view: o, + view: r, rect: null, - map: r.map, - cache: r.cache, - before: r.before, + map: i.map, + cache: i.cache, + before: i.before, hasHeights: !1 } } - function nn(e, t, n, o, r) { + function In(e, t, n, r, i) { t.before && (n = -1); - var i = n + (o || ''), - a; - return t.cache.hasOwnProperty(i) ? a = t.cache[i] : (!t.rect && (t.rect = t.view.text.getBoundingClientRect()), !t.hasHeights && (Qt(e, t.view, t.rect), t.hasHeights = !0), a = sn(e, t, n, o), !a.bogus && (t.cache[i] = a)), { - left: a.left, - right: a.right, - top: r ? a.rtop : a.top, - bottom: r ? a.rbottom : a.bottom - } - } + var o, l = n + (r || ""); + return t.cache.hasOwnProperty(l) ? o = t.cache[l] : (t.rect || (t.rect = t.view.text.getBoundingClientRect()), t.hasHeights || (function (e, t, n) { + var r = e.options.lineWrapping, + i = r && Rn(e); + if (!t.measure.heights || r && t.measure.width != i) { + var o = t.measure.heights = []; + if (r) { + t.measure.width = i; + for (var s = t.text.firstChild.getClientRects(), a = 0; a < s.length - 1; a++) { + var l = s[a], + c = s[a + 1]; + Math.abs(l.bottom - c.bottom) > 2 && o.push((l.bottom + c.top) / 2 - n.top) + } + } + o.push(n.bottom - n.top) + } + }(e, t.view, t.rect), t.hasHeights = !0), (o = function (e, t, n, r) { + var i, o = Nn(t.map, n, r), + l = o.node, + c = o.start, + u = o.end, + h = o.collapse; + if (3 == l.nodeType) { + for (var p = 0; p < 4; p++) { + for (; c && re(t.line.text.charAt(o.coverStart + c));) --c; + for (; o.coverStart + u < o.coverEnd && re(t.line.text.charAt(o.coverStart + u));) ++u; + if ((i = s && a < 9 && 0 == c && u == o.coverEnd - o.coverStart ? l.parentNode.getBoundingClientRect() : Fn(x(l, c, u).getClientRects(), r)).left || i.right || 0 == c) break; + u = c, c -= 1, h = "right" + } + s && a < 11 && (i = function (e, t) { + if (!window.screen || null == screen.logicalXDPI || screen.logicalXDPI == screen.deviceXDPI || ! function (e) { + if (null != Oe) return Oe; + var t = D(e, _("span", "x")), + n = t.getBoundingClientRect(), + r = x(t, 0, 1).getBoundingClientRect(); + return Oe = Math.abs(n.left - r.left) > 1 + }(e)) return t; + var n = screen.logicalXDPI / screen.deviceXDPI, + r = screen.logicalYDPI / screen.deviceYDPI; + return { + left: t.left * n, + right: t.right * n, + top: t.top * r, + bottom: t.bottom * r + } + }(e.display.measure, i)) + } else { + var d; + c > 0 && (h = r = "right"), i = e.options.lineWrapping && (d = l.getClientRects()).length > 1 ? d["right" == r ? d.length - 1 : 0] : l.getBoundingClientRect() + } + if (s && a < 9 && !c && (!i || !i.left && !i.right)) { + var f = l.parentNode.getClientRects()[0]; + i = f ? { + left: f.left, + right: f.left + ir(e.display), + top: f.top, + bottom: f.bottom + } : Ln + } + for (var m = i.top - t.rect.top, g = i.bottom - t.rect.top, y = (m + g) / 2, v = t.view.measure.heights, w = 0; w < v.length - 1 && !(y < v[w]); w++); + var b = w ? v[w - 1] : 0, + S = v[w], + C = { + left: ("right" == h ? i.right : i.left) - t.rect.left, + right: ("left" == h ? i.left : i.right) - t.rect.left, + top: b, + bottom: S + }; + return i.left || i.right || (C.bogus = !0), e.options.singleCursorHeightPerLine || (C.rtop = m, C.rbottom = g), C + }(e, t, n, r)).bogus || (t.cache[l] = o)), { + left: o.left, + right: o.right, + top: i ? o.rtop : o.top, + bottom: i ? o.rbottom : o.bottom + } + } + var On, Ln = { + left: 0, + right: 0, + top: 0, + bottom: 0 + }; - function rn(e, t, n) { - for (var o = 0, r, i, a, s, d, l; o < e.length; o += 3) - if (d = e[o], l = e[o + 1], t < d ? (i = 0, a = 1, s = 'left') : t < l ? (i = t - d, a = i + 1) : (o == e.length - 3 || t == l && e[o + 3] > t) && (a = l - d, i = a - 1, t >= l && (s = 'right')), null != i) { - if (r = e[o + 2], d == l && n == (r.insertLeft ? 'left' : 'right') && (s = n), 'left' == n && 0 == i) - for (; o && e[o - 2] == e[o - 3] && e[o - 1].insertLeft;) r = e[(o -= 3) + 2], s = 'left'; - if ('right' == n && i == l - d) - for (; o < e.length - 3 && e[o + 3] == e[o + 4] && !e[o + 5].insertLeft;) r = e[(o += 3) + 2], s = 'right'; + function Nn(e, t, n) { + for (var r, i, o, s, a, l, c = 0; c < e.length; c += 3) + if (a = e[c], l = e[c + 1], t < a ? (i = 0, o = 1, s = "left") : t < l ? o = 1 + (i = t - a) : (c == e.length - 3 || t == l && e[c + 3] > t) && (i = (o = l - a) - 1, t >= l && (s = "right")), null != i) { + if (r = e[c + 2], a == l && n == (r.insertLeft ? "left" : "right") && (s = n), "left" == n && 0 == i) + for (; c && e[c - 2] == e[c - 3] && e[c - 1].insertLeft;) r = e[2 + (c -= 3)], s = "left"; + if ("right" == n && i == l - a) + for (; c < e.length - 3 && e[c + 3] == e[c + 4] && !e[c + 5].insertLeft;) r = e[(c += 3) + 2], s = "right"; break } return { node: r, start: i, - end: a, + end: o, collapse: s, - coverStart: d, + coverStart: a, coverEnd: l } } - function an(e, t) { - var n = Rs; - if ('left' == t) - for (var o = 0; o < e.length && (n = e[o]).left == n.right; o++); + function Fn(e, t) { + var n = Ln; + if ("left" == t) + for (var r = 0; r < e.length && (n = e[r]).left == n.right; r++); else - for (var r = e.length - 1; 0 <= r && (n = e[r]).left == n.right; r--); + for (var i = e.length - 1; i >= 0 && (n = e[i]).left == n.right; i--); return n } - function sn(e, t, n, o) { - var r = rn(t.map, n, o), - a = r.node, - s = r.start, - d = r.end, - l = r.collapse, - c; - if (3 == a.nodeType) { - for (var p = 0; 4 > p; p++) { - for (; s && M(t.line.text.charAt(r.coverStart + s));) --s; - for (; r.coverStart + d < r.coverEnd && M(t.line.text.charAt(r.coverStart + d));) ++d; - if (c = Ra && 9 > xa && 0 == s && d == r.coverEnd - r.coverStart ? a.parentNode.getBoundingClientRect() : an(ja(a, s, d).getClientRects(), o), c.left || c.right || 0 == s) break; - d = s, --s, l = 'right' - } - Ra && 11 > xa && (c = dn(e.display.measure, c)) - } else { - 0 < s && (l = o = 'right'); - var u; - c = e.options.lineWrapping && 1 < (u = a.getClientRects()).length ? u['right' == o ? u.length - 1 : 0] : a.getBoundingClientRect() - } - if (Ra && 9 > xa && !s && (!c || !c.left && !c.right)) { - var m = a.parentNode.getClientRects()[0]; - c = m ? { - left: m.left, - right: m.left + Pn(e.display), - top: m.top, - bottom: m.bottom - } : Rs - } - for (var h = c.top - t.rect.top, f = c.bottom - t.rect.top, g = t.view.measure.heights, y = 0; y < g.length - 1 && !((h + f) / 2 < g[y]); y++); - var i = y ? g[y - 1] : 0, - S = g[y], - C = { - left: ('right' == l ? c.right : c.left) - t.rect.left, - right: ('left' == l ? c.left : c.right) - t.rect.left, - top: i, - bottom: S - }; - return c.left || c.right || (C.bogus = !0), e.options.singleCursorHeightPerLine || (C.rtop = h, C.rbottom = f), C - } - - function dn(e, t) { - if (!window.screen || null == screen.logicalXDPI || screen.logicalXDPI == screen.deviceXDPI || !Z(e)) return t; - var n = screen.logicalXDPI / screen.deviceXDPI, - o = screen.logicalYDPI / screen.deviceYDPI; - return { - left: t.left * n, - right: t.right * n, - top: t.top * o, - bottom: t.bottom * o - } - } - - function ln(e) { + function Bn(e) { if (e.measure && (e.measure.cache = {}, e.measure.heights = null, e.rest)) for (var t = 0; t < e.rest.length; t++) e.measure.caches[t] = {} } - function cn(e) { - e.display.externalMeasure = null, l(e.display.lineMeasure); - for (var t = 0; t < e.display.view.length; t++) ln(e.display.view[t]) + function Hn(e) { + e.display.externalMeasure = null, R(e.display.lineMeasure); + for (var t = 0; t < e.display.view.length; t++) Bn(e.display.view[t]) } - function pn(e) { - cn(e), e.display.cachedCharWidth = e.display.cachedTextHeight = e.display.cachedPaddingH = null, e.options.lineWrapping || (e.display.maxLineChanged = !0), e.display.lineNumChars = null + function zn(e) { + Hn(e), e.display.cachedCharWidth = e.display.cachedTextHeight = e.display.cachedPaddingH = null, e.options.lineWrapping || (e.display.maxLineChanged = !0), e.display.lineNumChars = null } - function un() { - return Ma && Na ? -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) : window.pageXOffset || (document.documentElement || document.body).scrollLeft + function Un() { + return u && g ? -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) : window.pageXOffset || (document.documentElement || document.body).scrollLeft } - function mn() { - return Ma && Na ? -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) : window.pageYOffset || (document.documentElement || document.body).scrollTop + function Wn() { + return u && g ? -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) : window.pageYOffset || (document.documentElement || document.body).scrollTop } - function hn(e) { + function Vn(e) { var t = 0; if (e.widgets) - for (var n = 0; n < e.widgets.length; ++n) e.widgets[n].above && (t += Wt(e.widgets[n])); + for (var n = 0; n < e.widgets.length; ++n) e.widgets[n].above && (t += Sn(e.widgets[n])); return t } - function fn(e, t, n, o, r) { - if (!r) { - var i = hn(t); - n.top += i, n.bottom += i + function jn(e, t, n, r, i) { + if (!i) { + var o = Vn(t); + n.top += o, n.bottom += o } - if ('line' == o) return n; - o || (o = 'local'); - var a = ct(t); - if ('local' == o ? a += Gt(e.display) : a -= e.display.viewOffset, 'page' == o || 'window' == o) { - var s = e.display.lineSpace.getBoundingClientRect(); - a += s.top + ('window' == o ? 0 : mn()); - var d = s.left + ('window' == o ? 0 : un()); - n.left += d, n.right += d + if ("line" == r) return n; + r || (r = "local"); + var s = Vt(t); + if ("local" == r ? s += En(e.display) : s -= e.display.viewOffset, "page" == r || "window" == r) { + var a = e.display.lineSpace.getBoundingClientRect(); + s += a.top + ("window" == r ? 0 : Wn()); + var l = a.left + ("window" == r ? 0 : Un()); + n.left += l, n.right += l } - return n.top += a, n.bottom += a, n + return n.top += s, n.bottom += s, n } - function gn(e, t, n) { - if ('div' == n) return t; - var o = t.left, - r = t.top; - if ('page' == n) o -= un(), r -= mn(); - else if ('local' == n || !n) { - var i = e.display.sizer.getBoundingClientRect(); - o += i.left, r += i.top - } - var a = e.display.lineSpace.getBoundingClientRect(); + function Gn(e, t, n) { + if ("div" == n) return t; + var r = t.left, + i = t.top; + if ("page" == n) r -= Un(), i -= Wn(); + else if ("local" == n || !n) { + var o = e.display.sizer.getBoundingClientRect(); + r += o.left, i += o.top + } + var s = e.display.lineSpace.getBoundingClientRect(); return { - left: o - a.left, - top: r - a.top + left: r - s.left, + top: i - s.top } } - function yn(e, t, n, o, r) { - return o || (o = se(e.doc, t.line)), fn(e, o, Jt(e, o, t.ch, r), n) + function $n(e, t, n, r, i) { + return r || (r = $e(e.doc, t.line)), jn(e, r, An(e, r, t.ch, i), n) } - function Sn(e, t, n, o, r, i) { - function a(t, a) { - var s = nn(e, r, t, a ? 'right' : 'left', i); - return a ? s.left = s.right : s.right = s.left, fn(e, o, s, n) + function qn(e, t, n, r, i, o) { + function s(t, s) { + var a = In(e, i, t, s ? "right" : "left", o); + return s ? a.left = a.right : a.right = a.left, jn(e, r, a, n) } - - function s(e, t, n) { - var o = d[t], - r = 1 == o.level; - return a(n ? e - 1 : e, r != n) - } - o = o || se(e.doc, t.line), r || (r = tn(e, o)); - var d = B(o, e.doc.direction), + r = r || $e(e.doc, t.line), i || (i = Pn(e, r)); + var a = ce(r, e.doc.direction), l = t.ch, c = t.sticky; - if (l >= o.text.length ? (l = o.text.length, c = 'before') : 0 >= l && (l = 0, c = 'after'), !d) return a('before' == c ? l - 1 : l, 'before' == c); - var p = F(d, l, c), - u = os, - m = s(l, p, 'before' == c); - return null != u && (m.other = s(l, u, 'before' != c)), m + if (l >= r.text.length ? (l = r.text.length, c = "before") : l <= 0 && (l = 0, c = "after"), !a) return s("before" == c ? l - 1 : l, "before" == c); + + function u(e, t, n) { + return s(n ? e - 1 : e, 1 == a[t].level != n) + } + var h = ae(a, l, c), + p = se, + d = u(l, h, "before" == c); + return null != p && (d.other = u(l, p, "before" != c)), d } - function Cn(e, t) { + function Kn(e, t) { var n = 0; - t = Ee(e.doc, t), e.options.lineWrapping || (n = Pn(e.display) * t.ch); - var o = se(e.doc, t.line), - r = ct(o) + Gt(e.display); + t = at(e.doc, t), e.options.lineWrapping || (n = ir(e.display) * t.ch); + var r = $e(e.doc, t.line), + i = Vt(r) + En(e.display); return { left: n, right: n, - top: r, - bottom: r + o.height + top: i, + bottom: i + r.height } } - function bn(e, t, n, o, r) { - var i = fe(e, t, n); - return i.xRel = r, o && (i.outside = o), i + function Yn(e, t, n, r, i) { + var o = et(e, t, n); + return o.xRel = i, r && (o.outside = r), o } - function vn(e, t, n) { - var o = e.doc; - if (n += e.display.viewOffset, 0 > n) return bn(o.first, 0, null, -1, -1); - var r = ue(o, n), - i = o.first + o.size - 1; - if (r > i) return bn(o.first + o.size - 1, se(o, i).text.length, null, 1, 1); - 0 > t && (t = 0); - for (var a = se(o, r);;) { - var s = Tn(e, a, r, t, n), - d = tt(a, s.ch + (0 < s.xRel || 0 < s.outside ? 1 : 0)); - if (!d) return s; - var l = d.find(1); - if (l.line == r) return l; - a = se(o, r = l.line) - } - } - - function En(e, t, n, o) { - o -= hn(t); - var r = t.text.length, - i = I(function (t) { - return nn(e, n, t - 1).bottom <= o - }, r, 0); - return r = I(function (t) { - return nn(e, n, t).top > o - }, i, r), { - begin: i, - end: r - } - } - - function wn(e, t, n, o) { - n || (n = tn(e, t)); - var r = fn(e, t, nn(e, n, o), 'line').top; - return En(e, t, n, r) - } - - function kn(e, t, n, o) { - return !(e.bottom <= n) && (!!(e.top > n) || (o ? e.left : e.right) > t) - } - - function Tn(e, t, n, o, r) { - r -= ct(t); - var i = tn(e, t), - a = hn(t), - s = 0, - d = t.text.length, - l = !0, - c = B(t, e.doc.direction); - if (c) { - var p = (e.options.lineWrapping ? Rn : _n)(e, t, n, i, c, o, r); - l = 1 != p.level, s = l ? p.from : p.to - 1, d = l ? p.to : p.from - 1 - } - var u = null, + function Qn(e, t, n) { + var r = e.doc; + if ((n += e.display.viewOffset) < 0) return Yn(r.first, 0, null, -1, -1); + var i = Ze(r, n), + o = r.first + r.size - 1; + if (i > o) return Yn(r.first + r.size - 1, $e(r, o).text.length, null, 1, 1); + t < 0 && (t = 0); + for (var s = $e(r, i);;) { + var a = er(e, s, i, t, n), + l = Nt(s, a.ch + (a.xRel > 0 || a.outside > 0 ? 1 : 0)); + if (!l) return a; + var c = l.find(1); + if (c.line == i) return c; + s = $e(r, i = c.line) + } + } + + function Zn(e, t, n, r) { + r -= Vn(t); + var i = t.text.length, + o = oe((function (t) { + return In(e, n, t - 1).bottom <= r + }), i, 0); + return { + begin: o, + end: i = oe((function (t) { + return In(e, n, t).top > r + }), o, i) + } + } + + function Xn(e, t, n, r) { + return n || (n = Pn(e, t)), Zn(e, t, n, jn(e, t, In(e, n, r), "line").top) + } + + function Jn(e, t, n, r) { + return !(e.bottom <= n) && (e.top > n || (r ? e.left : e.right) > t) + } + + function er(e, t, n, r, i) { + i -= Vt(t); + var o = Pn(e, t), + s = Vn(t), + a = 0, + l = t.text.length, + c = !0, + u = ce(t, e.doc.direction); + if (u) { + var h = (e.options.lineWrapping ? nr : tr)(e, t, n, o, u, r, i); + a = (c = 1 != h.level) ? h.from : h.to - 1, l = c ? h.to : h.from - 1 + } + var p, d, f = null, m = null, - h = I(function (t) { - var n = nn(e, i, t); - return (n.top += a, n.bottom += a, !!kn(n, o, r, !1)) && (n.top <= r && n.left <= o && (u = t, m = n), !0) - }, s, d), - f = !1, - g, y; + g = oe((function (t) { + var n = In(e, o, t); + return n.top += s, n.bottom += s, !!Jn(n, r, i, !1) && (n.top <= i && n.left <= r && (f = t, m = n), !0) + }), a, l), + y = !1; if (m) { - var S = o - m.left < m.right - o, - C = S == l; - h = u + (C ? 0 : 1), y = C ? 'after' : 'before', g = S ? m.left : m.right + var v = r - m.left < m.right - r, + w = v == c; + g = f + (w ? 0 : 1), d = w ? "after" : "before", p = v ? m.left : m.right } else { - l || h != d && h != s || h++, y = 0 == h ? 'after' : h == t.text.length ? 'before' : nn(e, i, h - (l ? 1 : 0)).bottom + a <= r == l ? 'after' : 'before'; - var b = Sn(e, fe(n, h, y), 'line', t, i); - g = b.left, f = r < b.top ? -1 : r >= b.bottom ? 1 : 0 - } - return h = A(t.text, h, 1), bn(n, h, y, f, o - g) - } - - function _n(e, t, n, o, r, a, s) { - var i = I(function (d) { - var i = r[d], - l = 1 != i.level; - return kn(Sn(e, fe(n, l ? i.to : i.from, l ? 'before' : 'after'), 'line', t, o), a, s, !0) - }, 0, r.length - 1), - d = r[i]; - if (0 < i) { - var l = 1 != d.level, - c = Sn(e, fe(n, l ? d.from : d.to, l ? 'after' : 'before'), 'line', t, o); - kn(c, a, s, !0) && c.top > s && (d = r[i - 1]) - } - return d - } - - function Rn(e, t, n, o, a, s, l) { - var c = En(e, t, o, l), - u = c.begin, - m = c.end; - /\s/.test(t.text.charAt(m - 1)) && m--; - for (var h = null, f = null, g = 0, i; g < a.length; g++) - if (i = a[g], !(i.from >= m || i.to <= u)) { - var p = 1 != i.level, - y = nn(e, o, p ? d(m, i.to) - 1 : r(u, i.from)).right, - S = y < s ? s - y + 1e9 : y - s; - (!h || f > S) && (h = i, f = S) - } return h || (h = a[a.length - 1]), h.from < u && (h = { - from: u, - to: h.to, - level: h.level - }), h.to > m && (h = { - from: h.from, - to: m, - level: h.level - }), h + c || g != l && g != a || g++, d = 0 == g ? "after" : g == t.text.length ? "before" : In(e, o, g - (c ? 1 : 0)).bottom + s <= i == c ? "after" : "before"; + var b = qn(e, et(n, g, d), "line", t, o); + p = b.left, y = i < b.top ? -1 : i >= b.bottom ? 1 : 0 + } + return Yn(n, g = ie(t.text, g, 1), d, y, r - p) } - function xn(e) { + function tr(e, t, n, r, i, o, s) { + var a = oe((function (a) { + var l = i[a], + c = 1 != l.level; + return Jn(qn(e, et(n, c ? l.to : l.from, c ? "before" : "after"), "line", t, r), o, s, !0) + }), 0, i.length - 1), + l = i[a]; + if (a > 0) { + var c = 1 != l.level, + u = qn(e, et(n, c ? l.from : l.to, c ? "after" : "before"), "line", t, r); + Jn(u, o, s, !0) && u.top > s && (l = i[a - 1]) + } + return l + } + + function nr(e, t, n, r, i, o, s) { + var a = Zn(e, t, r, s), + l = a.begin, + c = a.end; + /\s/.test(t.text.charAt(c - 1)) && c--; + for (var u = null, h = null, p = 0; p < i.length; p++) { + var d = i[p]; + if (!(d.from >= c || d.to <= l)) { + var f = In(e, r, 1 != d.level ? Math.min(c, d.to) - 1 : Math.max(l, d.from)).right, + m = f < o ? o - f + 1e9 : f - o; + (!u || h > m) && (u = d, h = m) + } + } + return u || (u = i[i.length - 1]), u.from < l && (u = { + from: l, + to: u.to, + level: u.level + }), u.to > c && (u = { + from: u.from, + to: c, + level: u.level + }), u + } + + function rr(e) { if (null != e.cachedTextHeight) return e.cachedTextHeight; - if (null == Ps) { - Ps = p('pre', null, 'CodeMirror-line-like'); - for (var t = 0; 49 > t; ++t) Ps.appendChild(document.createTextNode('x')), Ps.appendChild(p('br')); - Ps.appendChild(document.createTextNode('x')) + if (null == On) { + On = _("pre", null, "CodeMirror-line-like"); + for (var t = 0; t < 49; ++t) On.appendChild(document.createTextNode("x")), On.appendChild(_("br")); + On.appendChild(document.createTextNode("x")) } - c(e.measure, Ps); - var n = Ps.offsetHeight / 50; - return 3 < n && (e.cachedTextHeight = n), l(e.measure), n || 1 + D(e.measure, On); + var n = On.offsetHeight / 50; + return n > 3 && (e.cachedTextHeight = n), R(e.measure), n || 1 } - function Pn(e) { + function ir(e) { if (null != e.cachedCharWidth) return e.cachedCharWidth; - var t = p('span', 'xxxxxxxxxx'), - n = p('pre', [t], 'CodeMirror-line-like'); - c(e.measure, n); - var o = t.getBoundingClientRect(), - r = (o.right - o.left) / 10; - return 2 < r && (e.cachedCharWidth = r), r || 10 + var t = _("span", "xxxxxxxxxx"), + n = _("pre", [t], "CodeMirror-line-like"); + D(e.measure, n); + var r = t.getBoundingClientRect(), + i = (r.right - r.left) / 10; + return i > 2 && (e.cachedCharWidth = i), i || 10 } - function Dn(e) { - for (var t = e.display, o = {}, r = {}, a = t.gutters.clientLeft, s = t.gutters.firstChild, n = 0, i; s; s = s.nextSibling, ++n) i = e.display.gutterSpecs[n].className, o[i] = s.offsetLeft + s.clientLeft + a, r[i] = s.clientWidth; + function or(e) { + for (var t = e.display, n = {}, r = {}, i = t.gutters.clientLeft, o = t.gutters.firstChild, s = 0; o; o = o.nextSibling, ++s) { + var a = e.display.gutterSpecs[s].className; + n[a] = o.offsetLeft + o.clientLeft + i, r[a] = o.clientWidth + } return { - fixedPos: Mn(t), + fixedPos: sr(t), gutterTotalWidth: t.gutters.offsetWidth, - gutterLeft: o, + gutterLeft: n, gutterWidth: r, wrapperWidth: t.wrapper.clientWidth } } - function Mn(e) { + function sr(e) { return e.scroller.getBoundingClientRect().left - e.sizer.getBoundingClientRect().left } - function An(e) { - var t = xn(e.display), + function ar(e) { + var t = rr(e.display), n = e.options.lineWrapping, - o = n && r(5, e.display.scroller.clientWidth / Pn(e.display) - 3); - return function (r) { - if (dt(e.doc, r)) return 0; - var a = 0; - if (r.widgets) - for (var d = 0; d < r.widgets.length; d++) r.widgets[d].height && (a += r.widgets[d].height); - return n ? a + (s(r.text.length / o) || 1) * t : a + t + r = n && Math.max(5, e.display.scroller.clientWidth / ir(e.display) - 3); + return function (i) { + if (Ut(e.doc, i)) return 0; + var o = 0; + if (i.widgets) + for (var s = 0; s < i.widgets.length; s++) i.widgets[s].height && (o += i.widgets[s].height); + return n ? o + (Math.ceil(i.text.length / r) || 1) * t : o + t } } - function In(e) { + function lr(e) { var t = e.doc, - n = An(e); - t.iter(function (e) { + n = ar(e); + t.iter((function (e) { var t = n(e); - t != e.height && ce(e, t) - }) + t != e.height && Ye(e, t) + })) } - function Ln(t, o, e, i) { - var a = t.display; - if (!e && 'true' == Y(o).getAttribute('cm-not-content')) return null; - var s = a.lineSpace.getBoundingClientRect(), - d, l; + function cr(e, t, n, r) { + var i = e.display; + if (!n && "true" == Ee(t).getAttribute("cm-not-content")) return null; + var o, s, a = i.lineSpace.getBoundingClientRect(); try { - d = o.clientX - s.left, l = o.clientY - s.top + o = t.clientX - a.left, s = t.clientY - a.top } catch (t) { return null } - var c = vn(t, d, l), - p; - if (i && 1 == c.xRel && (p = se(t.doc, c.line).text).length == c.ch) { - var u = C(p, p.length, t.options.tabSize) - p.length; - c = fe(c.line, r(0, n((d - jt(t.display).left) / Pn(t.display)) - u)) + var l, c = Qn(e, o, s); + if (r && 1 == c.xRel && (l = $e(e.doc, c.line).text).length == c.ch) { + var u = B(l, l.length, e.options.tabSize) - l.length; + c = et(c.line, Math.max(0, Math.round((o - xn(e.display).left) / ir(e.display)) - u)) } return c } - function Fn(e, t) { + function ur(e, t) { if (t >= e.display.viewTo) return null; - if (t -= e.display.viewFrom, 0 > t) return null; - for (var n = e.display.view, o = 0; o < n.length; o++) - if (t -= n[o].size, 0 > t) return o - } - - function Bn(e, t, n, o) { - null == t && (t = e.doc.first), null == n && (n = e.doc.first + e.doc.size), o || (o = 0); - var r = e.display; - if (o && n < r.viewTo && (null == r.updateLineNumbers || r.updateLineNumbers > t) && (r.updateLineNumbers = t), e.curOp.viewChanged = !0, t >= r.viewTo) vs && at(e.doc, t) < r.viewTo && On(e); - else if (n <= r.viewFrom) vs && st(e.doc, n + o) > r.viewFrom ? On(e) : (r.viewFrom += o, r.viewTo += o); - else if (t <= r.viewFrom && n >= r.viewTo) On(e); - else if (t <= r.viewFrom) { - var i = Hn(e, n, n + o, 1); - i ? (r.view = r.view.slice(i.index), r.viewFrom = i.lineN, r.viewTo += o) : On(e) - } else if (n >= r.viewTo) { - var a = Hn(e, t, t, -1); - a ? (r.view = r.view.slice(0, a.index), r.viewTo = a.lineN) : On(e) + if ((t -= e.display.viewFrom) < 0) return null; + for (var n = e.display.view, r = 0; r < n.length; r++) + if ((t -= n[r].size) < 0) return r + } + + function hr(e, t, n, r) { + null == t && (t = e.doc.first), null == n && (n = e.doc.first + e.doc.size), r || (r = 0); + var i = e.display; + if (r && n < i.viewTo && (null == i.updateLineNumbers || i.updateLineNumbers > t) && (i.updateLineNumbers = t), e.curOp.viewChanged = !0, t >= i.viewTo) Ct && Ht(e.doc, t) < i.viewTo && dr(e); + else if (n <= i.viewFrom) Ct && zt(e.doc, n + r) > i.viewFrom ? dr(e) : (i.viewFrom += r, i.viewTo += r); + else if (t <= i.viewFrom && n >= i.viewTo) dr(e); + else if (t <= i.viewFrom) { + var o = fr(e, n, n + r, 1); + o ? (i.view = i.view.slice(o.index), i.viewFrom = o.lineN, i.viewTo += r) : dr(e) + } else if (n >= i.viewTo) { + var s = fr(e, t, t, -1); + s ? (i.view = i.view.slice(0, s.index), i.viewTo = s.lineN) : dr(e) } else { - var s = Hn(e, t, t, -1), - d = Hn(e, n, n + o, 1); - s && d ? (r.view = r.view.slice(0, s.index).concat(kt(e, s.lineN, d.lineN)).concat(r.view.slice(d.index)), r.viewTo += o) : On(e) + var a = fr(e, t, t, -1), + l = fr(e, n, n + r, 1); + a && l ? (i.view = i.view.slice(0, a.index).concat(on(e, a.lineN, l.lineN)).concat(i.view.slice(l.index)), i.viewTo += r) : dr(e) } - var l = r.externalMeasured; - l && (n < l.lineN ? l.lineN += o : t < l.lineN + l.size && (r.externalMeasured = null)) + var c = i.externalMeasured; + c && (n < c.lineN ? c.lineN += r : t < c.lineN + c.size && (i.externalMeasured = null)) } - function Nn(e, t, n) { + function pr(e, t, n) { e.curOp.viewChanged = !0; - var o = e.display, - r = e.display.externalMeasured; - if (r && t >= r.lineN && t < r.lineN + r.size && (o.externalMeasured = null), !(t < o.viewFrom || t >= o.viewTo)) { - var i = o.view[Fn(e, t)]; - if (null != i.node) { - var a = i.changes || (i.changes = []); - 1 == b(a, n) && a.push(n) + var r = e.display, + i = e.display.externalMeasured; + if (i && t >= i.lineN && t < i.lineN + i.size && (r.externalMeasured = null), !(t < r.viewFrom || t >= r.viewTo)) { + var o = r.view[ur(e, t)]; + if (null != o.node) { + var s = o.changes || (o.changes = []); - 1 == z(s, n) && s.push(n) } } } - function On(e) { + function dr(e) { e.display.viewFrom = e.display.viewTo = e.doc.first, e.display.view = [], e.display.viewOffset = 0 } - function Hn(e, t, o, r) { - var a = Fn(e, t), - s = e.display.view, - d; - if (!vs || o == e.doc.first + e.doc.size) return { - index: a, - lineN: o + function fr(e, t, n, r) { + var i, o = ur(e, t), + s = e.display.view; + if (!Ct || n == e.doc.first + e.doc.size) return { + index: o, + lineN: n }; - for (var l = e.display.viewFrom, n = 0; n < a; n++) l += s[n].size; - if (l != t) { - if (0 < r) { - if (a == s.length - 1) return null; - d = l + s[a].size - t, a++ - } else d = l - t; - t += d, o += d - } - for (; at(e.doc, o) != o;) { - if (a == (0 > r ? 0 : s.length - 1)) return null; - o += r * s[a - (0 > r ? 1 : 0)].size, a += r + for (var a = e.display.viewFrom, l = 0; l < o; l++) a += s[l].size; + if (a != t) { + if (r > 0) { + if (o == s.length - 1) return null; + i = a + s[o].size - t, o++ + } else i = a - t; + t += i, n += i + } + for (; Ht(e.doc, n) != n;) { + if (o == (r < 0 ? 0 : s.length - 1)) return null; + n += r * s[o - (r < 0 ? 1 : 0)].size, o += r } return { - index: a, - lineN: o + index: o, + lineN: n } } - function zn(e, t, n) { - var o = e.display, - r = o.view; - 0 == r.length || t >= o.viewTo || n <= o.viewFrom ? (o.view = kt(e, t, n), o.viewFrom = t) : (o.viewFrom > t ? o.view = kt(e, t, o.viewFrom).concat(o.view) : o.viewFrom < t && (o.view = o.view.slice(Fn(e, t))), o.viewFrom = t, o.viewTo < n ? o.view = o.view.concat(kt(e, o.viewTo, n)) : o.viewTo > n && (o.view = o.view.slice(0, Fn(e, n)))), o.viewTo = n - } - - function Un(e) { - for (var t = e.display.view, n = 0, o = 0, r; o < t.length; o++) r = t[o], r.hidden || r.node && !r.changes || ++n; + function mr(e) { + for (var t = e.display.view, n = 0, r = 0; r < t.length; r++) { + var i = t[r]; + i.hidden || i.node && !i.changes || ++n + } return n } - function Wn(e) { + function gr(e) { e.display.input.showSelection(e.display.input.prepareSelection()) } - function Vn(e, t) { + function yr(e, t) { void 0 === t && (t = !0); - for (var n = e.doc, o = {}, r = o.cursors = document.createDocumentFragment(), a = o.selection = document.createDocumentFragment(), s = 0; s < n.sel.ranges.length; s++) + for (var n = e.doc, r = {}, i = r.cursors = document.createDocumentFragment(), o = r.selection = document.createDocumentFragment(), s = 0; s < n.sel.ranges.length; s++) if (t || s != n.sel.primIndex) { - var i = n.sel.ranges[s]; - if (!(i.from().line >= e.display.viewTo || i.to().line < e.display.viewFrom)) { - var d = i.empty(); - (d || e.options.showCursorWhenSelecting) && Gn(e, i.head, r), d || jn(e, i, a) + var a = n.sel.ranges[s]; + if (!(a.from().line >= e.display.viewTo || a.to().line < e.display.viewFrom)) { + var l = a.empty(); + (l || e.options.showCursorWhenSelecting) && vr(e, a.head, i), l || br(e, a, o) } - } return o + } return r } - function Gn(e, t, n) { - var o = Sn(e, t, 'div', null, null, !e.options.singleCursorHeightPerLine), - i = n.appendChild(p('div', '\xA0', 'CodeMirror-cursor')); - if (i.style.left = o.left + 'px', i.style.top = o.top + 'px', i.style.height = r(0, o.bottom - o.top) * e.options.cursorHeight + 'px', o.other) { - var a = n.appendChild(p('div', '\xA0', 'CodeMirror-cursor CodeMirror-secondarycursor')); - a.style.display = '', a.style.left = o.other.left + 'px', a.style.top = o.other.top + 'px', a.style.height = .85 * (o.other.bottom - o.other.top) + 'px' + function vr(e, t, n) { + var r = qn(e, t, "div", null, null, !e.options.singleCursorHeightPerLine), + i = n.appendChild(_("div", " ", "CodeMirror-cursor")); + if (i.style.left = r.left + "px", i.style.top = r.top + "px", i.style.height = Math.max(0, r.bottom - r.top) * e.options.cursorHeight + "px", r.other) { + var o = n.appendChild(_("div", " ", "CodeMirror-cursor CodeMirror-secondarycursor")); + o.style.display = "", o.style.left = r.other.left + "px", o.style.top = r.other.top + "px", o.style.height = .85 * (r.other.bottom - r.other.top) + "px" } } - function Kn(e, t) { + function wr(e, t) { return e.top - t.top || e.left - t.left } - function jn(e, t, o) { - function i(e, t, o, r) { - 0 > t && (t = 0), t = n(t), r = n(r), l.appendChild(p('div', null, 'CodeMirror-selected', 'position: absolute; left: ' + e + 'px;\n top: ' + t + 'px; width: ' + (null == o ? m - e : o) + 'px;\n height: ' + (r - t) + 'px')) - } - - function a(t, n, o) { - function r(n, o) { - return yn(e, fe(t, n), 'div', s, o) - } - - function a(t, n, o) { - var i = wn(e, s, null, t), - a = 'ltr' == n == ('after' == o) ? 'left' : 'right', - d = 'after' == o ? i.begin : i.end - (/\s/.test(s.text.charAt(i.end - 1)) ? 2 : 1); - return r(d, a)[a] - } - var s = se(d, t), - l = s.text.length, - c = B(s, d.direction), - p, f; - return L(c, n || 0, null == o ? l : o, function (e, t, s, d) { - var g = 'ltr' == s, - y = r(e, g ? 'left' : 'right'), - S = r(t - 1, g ? 'right' : 'left'), - C = null == n && 0 == e, - b = null == o && t == l, - v = 0 == d, - E = !c || d == c.length - 1; - if (3 >= S.top - y.top) { - var w = (h ? C : b) && v, - k = (h ? b : C) && E, - T = w ? u : (g ? y : S).left, - _ = k ? m : (g ? S : y).right; - i(T, y.top, _ - T, y.bottom) + function br(e, t, n) { + var r = e.display, + i = e.doc, + o = document.createDocumentFragment(), + s = xn(e.display), + a = s.left, + l = Math.max(r.sizerWidth, Rn(e) - r.sizer.offsetLeft) - s.right, + c = "ltr" == i.direction; + + function u(e, t, n, r) { + t < 0 && (t = 0), t = Math.round(t), r = Math.round(r), o.appendChild(_("div", null, "CodeMirror-selected", "position: absolute; left: " + e + "px;\n top: " + t + "px; width: " + (null == n ? l - e : n) + "px;\n height: " + (r - t) + "px")) + } + + function h(t, n, r) { + var o, s, h = $e(i, t), + p = h.text.length; + + function d(n, r) { + return $n(e, et(t, n), "div", h, r) + } + + function f(t, n, r) { + var i = Xn(e, h, null, t), + o = "ltr" == n == ("after" == r) ? "left" : "right"; + return d("after" == r ? i.begin : i.end - (/\s/.test(h.text.charAt(i.end - 1)) ? 2 : 1), o)[o] + } + var m = ce(h, i.direction); + return function (e, t, n, r) { + if (!e) return r(t, n, "ltr", 0); + for (var i = !1, o = 0; o < e.length; ++o) { + var s = e[o]; + (s.from < n && s.to > t || t == n && s.to == t) && (r(Math.max(s.from, t), Math.min(s.to, n), 1 == s.level ? "rtl" : "ltr", o), i = !0) + } + i || r(t, n, "ltr") + }(m, n || 0, null == r ? p : r, (function (e, t, i, h) { + var g = "ltr" == i, + y = d(e, g ? "left" : "right"), + v = d(t - 1, g ? "right" : "left"), + w = null == n && 0 == e, + b = null == r && t == p, + S = 0 == h, + C = !m || h == m.length - 1; + if (v.top - y.top <= 3) { + var E = (c ? b : w) && C, + k = (c ? w : b) && S ? a : (g ? y : v).left, + x = E ? l : (g ? v : y).right; + u(k, y.top, x - k, y.bottom) } else { - var R, x, P, D; - g ? (R = h && C && v ? u : y.left, x = h ? m : a(e, s, 'before'), P = h ? u : a(t, s, 'after'), D = h && b && E ? m : S.right) : (R = h ? a(e, s, 'before') : u, x = !h && C && v ? m : y.right, P = !h && b && E ? u : S.left, D = h ? a(t, s, 'after') : m), i(R, y.top, x - R, y.bottom), y.bottom < S.top && i(u, y.bottom, null, S.top), i(P, S.top, D - P, S.bottom) - }(!p || 0 > Kn(y, p)) && (p = y), 0 > Kn(S, p) && (p = S), (!f || 0 > Kn(y, f)) && (f = y), 0 > Kn(S, f) && (f = S) - }), { - start: p, - end: f + var T, R, D, _; + g ? (T = c && w && S ? a : y.left, R = c ? l : f(e, i, "before"), D = c ? a : f(t, i, "after"), _ = c && b && C ? l : v.right) : (T = c ? f(e, i, "before") : a, R = !c && w && S ? l : y.right, D = !c && b && C ? a : v.left, _ = c ? f(t, i, "after") : l), u(T, y.top, R - T, y.bottom), y.bottom < v.top && u(a, y.bottom, null, v.top), u(D, v.top, _ - D, v.bottom) + }(!o || wr(y, o) < 0) && (o = y), wr(v, o) < 0 && (o = v), (!s || wr(y, s) < 0) && (s = y), wr(v, s) < 0 && (s = v) + })), { + start: o, + end: s } } - var s = e.display, - d = e.doc, - l = document.createDocumentFragment(), - c = jt(e.display), - u = c.left, - m = r(s.sizerWidth, Yt(e) - s.sizer.offsetLeft) - c.right, - h = 'ltr' == d.direction, - f = t.from(), - g = t.to(); - if (f.line == g.line) a(f.line, f.ch, g.ch); + var p = t.from(), + d = t.to(); + if (p.line == d.line) h(p.line, p.ch, d.ch); else { - var y = se(d, f.line), - S = se(d, g.line), - C = ot(y) == ot(S), - b = a(f.line, f.ch, C ? y.text.length + 1 : null).end, - v = a(g.line, C ? 0 : null, g.ch).start; - C && (b.top < v.top - 2 ? (i(b.right, b.top, null, b.bottom), i(u, v.top, v.left, v.bottom)) : i(b.right, b.top, v.left - b.right, b.bottom)), b.bottom < v.top && i(u, b.bottom, null, v.top) + var f = $e(i, p.line), + m = $e(i, d.line), + g = Bt(f) == Bt(m), + y = h(p.line, p.ch, g ? f.text.length + 1 : null).end, + v = h(d.line, g ? 0 : null, d.ch).start; + g && (y.top < v.top - 2 ? (u(y.right, y.top, null, y.bottom), u(a, v.top, v.left, v.bottom)) : u(y.right, y.top, v.left - y.right, y.bottom)), y.bottom < v.top && u(a, y.bottom, null, v.top) } - o.appendChild(l) + n.appendChild(o) } - function qn(e) { + function Sr(e) { if (e.state.focused) { var t = e.display; clearInterval(t.blinker); var n = !0; - t.cursorDiv.style.visibility = '', 0 < e.options.cursorBlinkRate ? t.blinker = setInterval(function () { - return t.cursorDiv.style.visibility = (n = !n) ? '' : 'hidden' - }, e.options.cursorBlinkRate) : 0 > e.options.cursorBlinkRate && (t.cursorDiv.style.visibility = 'hidden') + t.cursorDiv.style.visibility = "", e.options.cursorBlinkRate > 0 ? t.blinker = setInterval((function () { + return t.cursorDiv.style.visibility = (n = !n) ? "" : "hidden" + }), e.options.cursorBlinkRate) : e.options.cursorBlinkRate < 0 && (t.cursorDiv.style.visibility = "hidden") } } - function Yn(e) { - e.state.focused || (e.display.input.focus(), Qn(e)) + function Cr(e) { + e.state.focused || (e.display.input.focus(), kr(e)) } - function Xn(e) { - e.state.delayingBlurEvent = !0, setTimeout(function () { - e.state.delayingBlurEvent && (e.state.delayingBlurEvent = !1, $n(e)) - }, 100) + function Er(e) { + e.state.delayingBlurEvent = !0, setTimeout((function () { + e.state.delayingBlurEvent && (e.state.delayingBlurEvent = !1, xr(e)) + }), 100) } - function Qn(t, n) { - t.state.delayingBlurEvent && (t.state.delayingBlurEvent = !1), 'nocursor' == t.options.readOnly || (!t.state.focused && (H(t, 'focus', t, n), t.state.focused = !0, f(t.display.wrapper, 'CodeMirror-focused'), !t.curOp && t.display.selForContextMenu != t.doc.sel && (t.display.input.reset(), Pa && setTimeout(function () { - return t.display.input.reset(!0) - }, 20)), t.display.input.receivedFocus()), qn(t)) + function kr(e, t) { + e.state.delayingBlurEvent && (e.state.delayingBlurEvent = !1), "nocursor" != e.options.readOnly && (e.state.focused || (fe(e, "focus", e, t), e.state.focused = !0, I(e.display.wrapper, "CodeMirror-focused"), e.curOp || e.display.selForContextMenu == e.doc.sel || (e.display.input.reset(), l && setTimeout((function () { + return e.display.input.reset(!0) + }), 20)), e.display.input.receivedFocus()), Sr(e)) } - function $n(t, n) { - t.state.delayingBlurEvent || (t.state.focused && (H(t, 'blur', t, n), t.state.focused = !1, Ka(t.display.wrapper, 'CodeMirror-focused')), clearInterval(t.display.blinker), setTimeout(function () { - t.state.focused || (t.display.shift = !1) - }, 150)) + function xr(e, t) { + e.state.delayingBlurEvent || (e.state.focused && (fe(e, "blur", e, t), e.state.focused = !1, T(e.display.wrapper, "CodeMirror-focused")), clearInterval(e.display.blinker), setTimeout((function () { + e.state.focused || (e.display.shift = !1) + }), 150)) } - function Zn(e) { - for (var t = e.display, n = t.lineDiv.offsetTop, o = 0; o < t.view.length; o++) { - var r = t.view[o], - i = e.options.lineWrapping, - a = void 0, - d = 0; - if (!r.hidden) { - if (Ra && 8 > xa) { - var l = r.node.offsetTop + r.node.offsetHeight; - a = l - n, n = l + function Tr(e) { + for (var t = e.display, n = t.lineDiv.offsetTop, r = 0; r < t.view.length; r++) { + var i = t.view[r], + o = e.options.lineWrapping, + l = void 0, + c = 0; + if (!i.hidden) { + if (s && a < 8) { + var u = i.node.offsetTop + i.node.offsetHeight; + l = u - n, n = u } else { - var c = r.node.getBoundingClientRect(); - a = c.bottom - c.top, !i && r.text.firstChild && (d = r.text.firstChild.getBoundingClientRect().right - c.left - 1) + var h = i.node.getBoundingClientRect(); + l = h.bottom - h.top, !o && i.text.firstChild && (c = i.text.firstChild.getBoundingClientRect().right - h.left - 1) } - var p = r.line.height - a; - if ((.005 < p || -.005 > p) && (ce(r.line, a), Jn(r.line), r.rest)) - for (var u = 0; u < r.rest.length; u++) Jn(r.rest[u]); - if (d > e.display.sizerWidth) { - var m = s(d / Pn(e.display)); - m > e.display.maxLineLength && (e.display.maxLineLength = m, e.display.maxLine = r.line, e.display.maxLineChanged = !0) + var p = i.line.height - l; + if ((p > .005 || p < -.005) && (Ye(i.line, l), Rr(i.line), i.rest)) + for (var d = 0; d < i.rest.length; d++) Rr(i.rest[d]); + if (c > e.display.sizerWidth) { + var f = Math.ceil(c / ir(e.display)); + f > e.display.maxLineLength && (e.display.maxLineLength = f, e.display.maxLine = i.line, e.display.maxLineChanged = !0) } } } } - function Jn(e) { + function Rr(e) { if (e.widgets) for (var t = 0; t < e.widgets.length; ++t) { var n = e.widgets[t], - o = n.node.parentNode; - o && (n.height = o.offsetHeight) + r = n.node.parentNode; + r && (n.height = r.offsetHeight) } } - function eo(e, t, n) { - var o = n && null != n.top ? r(0, n.top) : e.scroller.scrollTop; - o = a(o - Gt(e)); - var i = n && null != n.bottom ? n.bottom : o + e.wrapper.clientHeight, - s = ue(t, o), - l = ue(t, i); + function Dr(e, t, n) { + var r = n && null != n.top ? Math.max(0, n.top) : e.scroller.scrollTop; + r = Math.floor(r - En(e)); + var i = n && null != n.bottom ? n.bottom : r + e.wrapper.clientHeight, + o = Ze(t, r), + s = Ze(t, i); if (n && n.ensure) { - var c = n.ensure.from.line, - p = n.ensure.to.line; - c < s ? (s = c, l = ue(t, ct(se(t, c)) + e.wrapper.clientHeight)) : d(p, t.lastLine()) >= l && (s = ue(t, ct(se(t, p)) - e.wrapper.clientHeight), l = p) + var a = n.ensure.from.line, + l = n.ensure.to.line; + a < o ? (o = a, s = Ze(t, Vt($e(t, a)) + e.wrapper.clientHeight)) : Math.min(l, t.lastLine()) >= s && (o = Ze(t, Vt($e(t, l)) - e.wrapper.clientHeight), s = l) } return { - from: s, - to: r(l, s + 1) - } - } - - function to(e, t) { - if (!z(e, 'scrollCursorIntoView')) { - var n = e.display, - o = n.sizer.getBoundingClientRect(), - i = null; - if (0 > t.top + o.top ? i = !0 : t.bottom + o.top > (window.innerHeight || document.documentElement.clientHeight) && (i = !1), null != i && !Fa) { - var a = p('div', '\u200B', null, 'position: absolute;\n top: ' + (t.top - n.viewOffset - Gt(e.display)) + 'px;\n height: ' + (t.bottom - t.top + qt(e) + n.barHeight) + 'px;\n left: ' + t.left + 'px; width: ' + r(2, t.right - t.left) + 'px;'); - e.display.lineSpace.appendChild(a), a.scrollIntoView(i), e.display.lineSpace.removeChild(a) - } - } - } - - function no(e, t, n, i) { - null == i && (i = 0); - var a; - e.options.lineWrapping || t != n || (t = t.ch ? fe(t.line, 'before' == t.sticky ? t.ch - 1 : t.ch, 'after') : t, n = 'before' == t.sticky ? fe(t.line, t.ch + 1, 'before') : t); - for (var s = 0; 5 > s; s++) { - var l = !1, - c = Sn(e, t), - p = n && n != t ? Sn(e, n) : c; - a = { - left: d(c.left, p.left), - top: d(c.top, p.top) - i, - right: r(c.left, p.left), - bottom: r(c.bottom, p.bottom) + i - }; - var u = ro(e, a), - m = e.doc.scrollTop, - h = e.doc.scrollLeft; - if (null != u.scrollTop && (uo(e, u.scrollTop), 1 < o(e.doc.scrollTop - m) && (l = !0)), null != u.scrollLeft && (ho(e, u.scrollLeft), 1 < o(e.doc.scrollLeft - h) && (l = !0)), !l) break + from: o, + to: Math.max(s, o + 1) } - return a - } - - function oo(e, t) { - var n = ro(e, t); - null != n.scrollTop && uo(e, n.scrollTop), null != n.scrollLeft && ho(e, n.scrollLeft) } - function ro(e, t) { + function _r(e, t) { var n = e.display, - o = xn(e.display); - 0 > t.top && (t.top = 0); + r = rr(e.display); + t.top < 0 && (t.top = 0); var i = e.curOp && null != e.curOp.scrollTop ? e.curOp.scrollTop : n.scroller.scrollTop, - a = Xt(e), + o = Dn(e), s = {}; - t.bottom - t.top > a && (t.bottom = t.top + a); - var l = e.doc.height + Kt(n), - c = t.top < o, - p = t.bottom > l - o; - if (t.top < i) s.scrollTop = c ? 0 : t.top; - else if (t.bottom > i + a) { - var u = d(t.top, (p ? l : t.bottom) - a); + t.bottom - t.top > o && (t.bottom = t.top + o); + var a = e.doc.height + kn(n), + l = t.top < r, + c = t.bottom > a - r; + if (t.top < i) s.scrollTop = l ? 0 : t.top; + else if (t.bottom > i + o) { + var u = Math.min(t.top, (c ? a : t.bottom) - o); u != i && (s.scrollTop = u) } - var m = e.curOp && null != e.curOp.scrollLeft ? e.curOp.scrollLeft : n.scroller.scrollLeft, - h = Yt(e) - (e.options.fixedGutter ? n.gutters.offsetWidth : 0), - f = t.right - t.left > h; - return f && (t.right = t.left + h), 10 > t.left ? s.scrollLeft = 0 : t.left < m ? s.scrollLeft = r(0, t.left - (f ? 0 : 10)) : t.right > h + m - 3 && (s.scrollLeft = t.right + (f ? 0 : 10) - h), s + var h = e.curOp && null != e.curOp.scrollLeft ? e.curOp.scrollLeft : n.scroller.scrollLeft, + p = Rn(e) - (e.options.fixedGutter ? n.gutters.offsetWidth : 0), + d = t.right - t.left > p; + return d && (t.right = t.left + p), t.left < 10 ? s.scrollLeft = 0 : t.left < h ? s.scrollLeft = Math.max(0, t.left - (d ? 0 : 10)) : t.right > p + h - 3 && (s.scrollLeft = t.right + (d ? 0 : 10) - p), s } - function io(e, t) { - null == t || (co(e), e.curOp.scrollTop = (null == e.curOp.scrollTop ? e.doc.scrollTop : e.curOp.scrollTop) + t) + function Ar(e, t) { + null != t && (Ir(e), e.curOp.scrollTop = (null == e.curOp.scrollTop ? e.doc.scrollTop : e.curOp.scrollTop) + t) } - function ao(e) { - co(e); + function Mr(e) { + Ir(e); var t = e.getCursor(); e.curOp.scrollToPos = { from: t, @@ -3749,93 +4101,141 @@ module.exports = function (e) { } } - function so(e, t, n) { - (null != t || null != n) && co(e), null != t && (e.curOp.scrollLeft = t), null != n && (e.curOp.scrollTop = n) - } - - function lo(e, t) { - co(e), e.curOp.scrollToPos = t + function Pr(e, t, n) { + null == t && null == n || Ir(e), null != t && (e.curOp.scrollLeft = t), null != n && (e.curOp.scrollTop = n) } - function co(e) { + function Ir(e) { var t = e.curOp.scrollToPos; - if (t) { - e.curOp.scrollToPos = null; - var n = Cn(e, t.from), - o = Cn(e, t.to); - po(e, n, o, t.margin) - } + t && (e.curOp.scrollToPos = null, Or(e, Kn(e, t.from), Kn(e, t.to), t.margin)) } - function po(e, t, n, o) { - var i = ro(e, { - left: d(t.left, n.left), - top: d(t.top, n.top) - o, - right: r(t.right, n.right), - bottom: r(t.bottom, n.bottom) + o + function Or(e, t, n, r) { + var i = _r(e, { + left: Math.min(t.left, n.left), + top: Math.min(t.top, n.top) - r, + right: Math.max(t.right, n.right), + bottom: Math.max(t.bottom, n.bottom) + r }); - so(e, i.scrollLeft, i.scrollTop) + Pr(e, i.scrollLeft, i.scrollTop) } - function uo(e, t) { - 2 > o(e.doc.scrollTop - t) || (!wa && Oo(e, { + function Lr(e, t) { + Math.abs(e.doc.scrollTop - t) < 2 || (n || li(e, { top: t - }), mo(e, t, !0), wa && Oo(e), Mo(e, 100)) + }), Nr(e, t, !0), n && li(e), ri(e, 100)) } - function mo(e, t, n) { - t = d(e.display.scroller.scrollHeight - e.display.scroller.clientHeight, t), (e.display.scroller.scrollTop != t || n) && (e.doc.scrollTop = t, e.display.scrollbars.setScrollTop(t), e.display.scroller.scrollTop != t && (e.display.scroller.scrollTop = t)) + function Nr(e, t, n) { + t = Math.min(e.display.scroller.scrollHeight - e.display.scroller.clientHeight, t), (e.display.scroller.scrollTop != t || n) && (e.doc.scrollTop = t, e.display.scrollbars.setScrollTop(t), e.display.scroller.scrollTop != t && (e.display.scroller.scrollTop = t)) } - function ho(e, t, n, r) { - t = d(t, e.display.scroller.scrollWidth - e.display.scroller.clientWidth), (n ? t == e.doc.scrollLeft : 2 > o(e.doc.scrollLeft - t)) && !r || (e.doc.scrollLeft = t, Wo(e), e.display.scroller.scrollLeft != t && (e.display.scroller.scrollLeft = t), e.display.scrollbars.setScrollLeft(t)) + function Fr(e, t, n, r) { + t = Math.min(t, e.display.scroller.scrollWidth - e.display.scroller.clientWidth), (n ? t == e.doc.scrollLeft : Math.abs(e.doc.scrollLeft - t) < 2) && !r || (e.doc.scrollLeft = t, hi(e), e.display.scroller.scrollLeft != t && (e.display.scroller.scrollLeft = t), e.display.scrollbars.setScrollLeft(t)) } - function fo(e) { + function Br(e) { var t = e.display, - o = t.gutters.offsetWidth, - r = n(e.doc.height + Kt(e.display)); + n = t.gutters.offsetWidth, + r = Math.round(e.doc.height + kn(e.display)); return { clientHeight: t.scroller.clientHeight, viewHeight: t.wrapper.clientHeight, scrollWidth: t.scroller.scrollWidth, clientWidth: t.scroller.clientWidth, viewWidth: t.wrapper.clientWidth, - barLeft: e.options.fixedGutter ? o : 0, + barLeft: e.options.fixedGutter ? n : 0, docHeight: r, - scrollHeight: r + qt(e) + t.barHeight, + scrollHeight: r + Tn(e) + t.barHeight, nativeBarWidth: t.nativeBarWidth, - gutterWidth: o - } - } - - function go(e, t) { - t || (t = fo(e)); - var n = e.display.barWidth, - o = e.display.barHeight; - yo(e, t); - for (var r = 0; 4 > r && n != e.display.barWidth || o != e.display.barHeight; r++) n != e.display.barWidth && e.options.lineWrapping && Zn(e), yo(e, fo(e)), n = e.display.barWidth, o = e.display.barHeight - } - - function yo(e, t) { - var n = e.display, - o = n.scrollbars.update(t); - n.sizer.style.paddingRight = (n.barWidth = o.right) + 'px', n.sizer.style.paddingBottom = (n.barHeight = o.bottom) + 'px', n.heightForcer.style.borderBottom = o.bottom + 'px solid transparent', o.right && o.bottom ? (n.scrollbarFiller.style.display = 'block', n.scrollbarFiller.style.height = o.bottom + 'px', n.scrollbarFiller.style.width = o.right + 'px') : n.scrollbarFiller.style.display = '', o.bottom && e.options.coverGutterNextToScrollbar && e.options.fixedGutter ? (n.gutterFiller.style.display = 'block', n.gutterFiller.style.height = o.bottom + 'px', n.gutterFiller.style.width = t.gutterWidth + 'px') : n.gutterFiller.style.display = '' - } - - function So(e) { - e.display.scrollbars && (e.display.scrollbars.clear(), e.display.scrollbars.addClass && Ka(e.display.wrapper, e.display.scrollbars.addClass)), e.display.scrollbars = new Ms[e.options.scrollbarStyle](function (t) { - e.display.wrapper.insertBefore(t, e.display.scrollbarFiller), as(t, 'mousedown', function () { - e.state.focused && setTimeout(function () { + gutterWidth: n + } + } + var Hr = function (e, t, n) { + this.cm = n; + var r = this.vert = _("div", [_("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar"), + i = this.horiz = _("div", [_("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar"); + r.tabIndex = i.tabIndex = -1, e(r), e(i), he(r, "scroll", (function () { + r.clientHeight && t(r.scrollTop, "vertical") + })), he(i, "scroll", (function () { + i.clientWidth && t(i.scrollLeft, "horizontal") + })), this.checkedZeroWidth = !1, s && a < 8 && (this.horiz.style.minHeight = this.vert.style.minWidth = "18px") + }; + Hr.prototype.update = function (e) { + var t = e.scrollWidth > e.clientWidth + 1, + n = e.scrollHeight > e.clientHeight + 1, + r = e.nativeBarWidth; + if (n) { + this.vert.style.display = "block", this.vert.style.bottom = t ? r + "px" : "0"; + var i = e.viewHeight - (t ? r : 0); + this.vert.firstChild.style.height = Math.max(0, e.scrollHeight - e.clientHeight + i) + "px" + } else this.vert.style.display = "", this.vert.firstChild.style.height = "0"; + if (t) { + this.horiz.style.display = "block", this.horiz.style.right = n ? r + "px" : "0", this.horiz.style.left = e.barLeft + "px"; + var o = e.viewWidth - e.barLeft - (n ? r : 0); + this.horiz.firstChild.style.width = Math.max(0, e.scrollWidth - e.clientWidth + o) + "px" + } else this.horiz.style.display = "", this.horiz.firstChild.style.width = "0"; + return !this.checkedZeroWidth && e.clientHeight > 0 && (0 == r && this.zeroWidthHack(), this.checkedZeroWidth = !0), { + right: n ? r : 0, + bottom: t ? r : 0 + } + }, Hr.prototype.setScrollLeft = function (e) { + this.horiz.scrollLeft != e && (this.horiz.scrollLeft = e), this.disableHoriz && this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz") + }, Hr.prototype.setScrollTop = function (e) { + this.vert.scrollTop != e && (this.vert.scrollTop = e), this.disableVert && this.enableZeroWidthBar(this.vert, this.disableVert, "vert") + }, Hr.prototype.zeroWidthHack = function () { + var e = v && !d ? "12px" : "18px"; + this.horiz.style.height = this.vert.style.width = e, this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none", this.disableHoriz = new H, this.disableVert = new H + }, Hr.prototype.enableZeroWidthBar = function (e, t, n) { + e.style.pointerEvents = "auto", t.set(1e3, (function r() { + var i = e.getBoundingClientRect(); + ("vert" == n ? document.elementFromPoint(i.right - 1, (i.top + i.bottom) / 2) : document.elementFromPoint((i.right + i.left) / 2, i.bottom - 1)) != e ? e.style.pointerEvents = "none" : t.set(1e3, r) + })) + }, Hr.prototype.clear = function () { + var e = this.horiz.parentNode; + e.removeChild(this.horiz), e.removeChild(this.vert) + }; + var zr = function () {}; + + function Ur(e, t) { + t || (t = Br(e)); + var n = e.display.barWidth, + r = e.display.barHeight; + Wr(e, t); + for (var i = 0; i < 4 && n != e.display.barWidth || r != e.display.barHeight; i++) n != e.display.barWidth && e.options.lineWrapping && Tr(e), Wr(e, Br(e)), n = e.display.barWidth, r = e.display.barHeight + } + + function Wr(e, t) { + var n = e.display, + r = n.scrollbars.update(t); + n.sizer.style.paddingRight = (n.barWidth = r.right) + "px", n.sizer.style.paddingBottom = (n.barHeight = r.bottom) + "px", n.heightForcer.style.borderBottom = r.bottom + "px solid transparent", r.right && r.bottom ? (n.scrollbarFiller.style.display = "block", n.scrollbarFiller.style.height = r.bottom + "px", n.scrollbarFiller.style.width = r.right + "px") : n.scrollbarFiller.style.display = "", r.bottom && e.options.coverGutterNextToScrollbar && e.options.fixedGutter ? (n.gutterFiller.style.display = "block", n.gutterFiller.style.height = r.bottom + "px", n.gutterFiller.style.width = t.gutterWidth + "px") : n.gutterFiller.style.display = "" + } + zr.prototype.update = function () { + return { + bottom: 0, + right: 0 + } + }, zr.prototype.setScrollLeft = function () {}, zr.prototype.setScrollTop = function () {}, zr.prototype.clear = function () {}; + var Vr = { + native: Hr, + null: zr + }; + + function jr(e) { + e.display.scrollbars && (e.display.scrollbars.clear(), e.display.scrollbars.addClass && T(e.display.wrapper, e.display.scrollbars.addClass)), e.display.scrollbars = new Vr[e.options.scrollbarStyle]((function (t) { + e.display.wrapper.insertBefore(t, e.display.scrollbarFiller), he(t, "mousedown", (function () { + e.state.focused && setTimeout((function () { return e.display.input.focus() - }, 0) - }), t.setAttribute('cm-not-content', 'true') - }, function (t, n) { - 'horizontal' == n ? ho(e, t) : uo(e, t) - }, e), e.display.scrollbars.addClass && f(e.display.wrapper, e.display.scrollbars.addClass) + }), 0) + })), t.setAttribute("cm-not-content", "true") + }), (function (t, n) { + "horizontal" == n ? Fr(e, t) : Lr(e, t) + }), e), e.display.scrollbars.addClass && I(e.display.wrapper, e.display.scrollbars.addClass) } + var Gr = 0; - function Co(e) { + function $r(e) { + var t; e.curOp = { cm: e, viewChanged: !1, @@ -3852,3877 +4252,3565 @@ module.exports = function (e) { scrollTop: null, scrollToPos: null, focus: !1, - id: ++As - }, Tt(e.curOp) + id: ++Gr + }, t = e.curOp, sn ? sn.ops.push(t) : t.ownsGroup = sn = { + ops: [t], + delayedCallbacks: [] + } } - function bo(e) { + function qr(e) { var t = e.curOp; - t && Rt(t, function (e) { + t && function (e, t) { + var n = e.ownsGroup; + if (n) try { + ! function (e) { + var t = e.delayedCallbacks, + n = 0; + do { + for (; n < t.length; n++) t[n].call(null); + for (var r = 0; r < e.ops.length; r++) { + var i = e.ops[r]; + if (i.cursorActivityHandlers) + for (; i.cursorActivityCalled < i.cursorActivityHandlers.length;) i.cursorActivityHandlers[i.cursorActivityCalled++].call(null, i.cm) + } + } while (n < t.length) + }(n) + } finally { + sn = null, t(n) + } + }(t, (function (e) { for (var t = 0; t < e.ops.length; t++) e.ops[t].cm.curOp = null; - vo(e) - }) - } - - function vo(e) { - for (var t = e.ops, n = 0; n < t.length; n++) Eo(t[n]); - for (var o = 0; o < t.length; o++) wo(t[o]); - for (var r = 0; r < t.length; r++) ko(t[r]); - for (var i = 0; i < t.length; i++) To(t[i]); - for (var a = 0; a < t.length; a++) _o(t[a]) + ! function (e) { + for (var t = e.ops, n = 0; n < t.length; n++) Kr(t[n]); + for (var r = 0; r < t.length; r++) Yr(t[r]); + for (var i = 0; i < t.length; i++) Qr(t[i]); + for (var o = 0; o < t.length; o++) Zr(t[o]); + for (var s = 0; s < t.length; s++) Xr(t[s]) + }(e) + })) } - function Eo(e) { + function Kr(e) { var t = e.cm, n = t.display; - Io(t), e.updateMaxLine && ut(t), e.mustUpdate = e.viewChanged || e.forceUpdate || null != e.scrollTop || e.scrollToPos && (e.scrollToPos.from.line < n.viewFrom || e.scrollToPos.to.line >= n.viewTo) || n.maxLineChanged && t.options.lineWrapping, e.update = e.mustUpdate && new Is(t, e.mustUpdate && { + ! function (e) { + var t = e.display; + !t.scrollbarsClipped && t.scroller.offsetWidth && (t.nativeBarWidth = t.scroller.offsetWidth - t.scroller.clientWidth, t.heightForcer.style.height = Tn(e) + "px", t.sizer.style.marginBottom = -t.nativeBarWidth + "px", t.sizer.style.borderRightWidth = Tn(e) + "px", t.scrollbarsClipped = !0) + }(t), e.updateMaxLine && Gt(t), e.mustUpdate = e.viewChanged || e.forceUpdate || null != e.scrollTop || e.scrollToPos && (e.scrollToPos.from.line < n.viewFrom || e.scrollToPos.to.line >= n.viewTo) || n.maxLineChanged && t.options.lineWrapping, e.update = e.mustUpdate && new oi(t, e.mustUpdate && { top: e.scrollTop, ensure: e.scrollToPos }, e.forceUpdate) } - function wo(e) { - e.updatedDisplay = e.mustUpdate && Bo(e.cm, e.update) + function Yr(e) { + e.updatedDisplay = e.mustUpdate && si(e.cm, e.update) } - function ko(e) { + function Qr(e) { var t = e.cm, n = t.display; - e.updatedDisplay && Zn(t), e.barMeasure = fo(t), n.maxLineChanged && !t.options.lineWrapping && (e.adjustWidthTo = Jt(t, n.maxLine, n.maxLine.text.length).left + 3, t.display.sizerWidth = e.adjustWidthTo, e.barMeasure.scrollWidth = r(n.scroller.clientWidth, n.sizer.offsetLeft + e.adjustWidthTo + qt(t) + t.display.barWidth), e.maxScrollLeft = r(0, n.sizer.offsetLeft + e.adjustWidthTo - Yt(t))), (e.updatedDisplay || e.selectionChanged) && (e.preparedSelection = n.input.prepareSelection()) + e.updatedDisplay && Tr(t), e.barMeasure = Br(t), n.maxLineChanged && !t.options.lineWrapping && (e.adjustWidthTo = An(t, n.maxLine, n.maxLine.text.length).left + 3, t.display.sizerWidth = e.adjustWidthTo, e.barMeasure.scrollWidth = Math.max(n.scroller.clientWidth, n.sizer.offsetLeft + e.adjustWidthTo + Tn(t) + t.display.barWidth), e.maxScrollLeft = Math.max(0, n.sizer.offsetLeft + e.adjustWidthTo - Rn(t))), (e.updatedDisplay || e.selectionChanged) && (e.preparedSelection = n.input.prepareSelection()) } - function To(e) { + function Zr(e) { var t = e.cm; - null != e.adjustWidthTo && (t.display.sizer.style.minWidth = e.adjustWidthTo + 'px', e.maxScrollLeft < t.doc.scrollLeft && ho(t, d(t.display.scroller.scrollLeft, e.maxScrollLeft), !0), t.display.maxLineChanged = !1); - var n = e.focus && e.focus == h(); - e.preparedSelection && t.display.input.showSelection(e.preparedSelection, n), (e.updatedDisplay || e.startHeight != t.doc.height) && go(t, e.barMeasure), e.updatedDisplay && Uo(t, e.barMeasure), e.selectionChanged && qn(t), t.state.focused && e.updateInput && t.display.input.reset(e.typing), n && Yn(e.cm) + null != e.adjustWidthTo && (t.display.sizer.style.minWidth = e.adjustWidthTo + "px", e.maxScrollLeft < t.doc.scrollLeft && Fr(t, Math.min(t.display.scroller.scrollLeft, e.maxScrollLeft), !0), t.display.maxLineChanged = !1); + var n = e.focus && e.focus == P(); + e.preparedSelection && t.display.input.showSelection(e.preparedSelection, n), (e.updatedDisplay || e.startHeight != t.doc.height) && Ur(t, e.barMeasure), e.updatedDisplay && ui(t, e.barMeasure), e.selectionChanged && Sr(t), t.state.focused && e.updateInput && t.display.input.reset(e.typing), n && Cr(e.cm) } - function _o(e) { + function Xr(e) { var t = e.cm, n = t.display, - o = t.doc; - if (e.updatedDisplay && No(t, e.update), null != n.wheelStartX && (null != e.scrollTop || null != e.scrollLeft || e.scrollToPos) && (n.wheelStartX = n.wheelStartY = null), null != e.scrollTop && mo(t, e.scrollTop, e.forceScroll), null != e.scrollLeft && ho(t, e.scrollLeft, !0, !0), e.scrollToPos) { - var r = no(t, Ee(o, e.scrollToPos.from), Ee(o, e.scrollToPos.to), e.scrollToPos.margin); - to(t, r) - } - var a = e.maybeHiddenMarkers, - s = e.maybeUnhiddenMarkers; - if (a) - for (var d = 0; d < a.length; ++d) a[d].lines.length || H(a[d], 'hide'); - if (s) - for (var i = 0; i < s.length; ++i) s[i].lines.length && H(s[i], 'unhide'); - n.wrapper.offsetHeight && (o.scrollTop = t.display.scroller.scrollTop), e.changeObjs && H(t, 'changes', t, e.changeObjs), e.update && e.update.finish() + r = t.doc; + e.updatedDisplay && ai(t, e.update), null == n.wheelStartX || null == e.scrollTop && null == e.scrollLeft && !e.scrollToPos || (n.wheelStartX = n.wheelStartY = null), null != e.scrollTop && Nr(t, e.scrollTop, e.forceScroll), null != e.scrollLeft && Fr(t, e.scrollLeft, !0, !0), e.scrollToPos && function (e, t) { + if (!me(e, "scrollCursorIntoView")) { + var n = e.display, + r = n.sizer.getBoundingClientRect(), + i = null; + if (t.top + r.top < 0 ? i = !0 : t.bottom + r.top > (window.innerHeight || document.documentElement.clientHeight) && (i = !1), null != i && !f) { + var o = _("div", "​", null, "position: absolute;\n top: " + (t.top - n.viewOffset - En(e.display)) + "px;\n height: " + (t.bottom - t.top + Tn(e) + n.barHeight) + "px;\n left: " + t.left + "px; width: " + Math.max(2, t.right - t.left) + "px;"); + e.display.lineSpace.appendChild(o), o.scrollIntoView(i), e.display.lineSpace.removeChild(o) + } + } + }(t, function (e, t, n, r) { + var i; + null == r && (r = 0), e.options.lineWrapping || t != n || (n = "before" == (t = t.ch ? et(t.line, "before" == t.sticky ? t.ch - 1 : t.ch, "after") : t).sticky ? et(t.line, t.ch + 1, "before") : t); + for (var o = 0; o < 5; o++) { + var s = !1, + a = qn(e, t), + l = n && n != t ? qn(e, n) : a, + c = _r(e, i = { + left: Math.min(a.left, l.left), + top: Math.min(a.top, l.top) - r, + right: Math.max(a.left, l.left), + bottom: Math.max(a.bottom, l.bottom) + r + }), + u = e.doc.scrollTop, + h = e.doc.scrollLeft; + if (null != c.scrollTop && (Lr(e, c.scrollTop), Math.abs(e.doc.scrollTop - u) > 1 && (s = !0)), null != c.scrollLeft && (Fr(e, c.scrollLeft), Math.abs(e.doc.scrollLeft - h) > 1 && (s = !0)), !s) break + } + return i + }(t, at(r, e.scrollToPos.from), at(r, e.scrollToPos.to), e.scrollToPos.margin)); + var i = e.maybeHiddenMarkers, + o = e.maybeUnhiddenMarkers; + if (i) + for (var s = 0; s < i.length; ++s) i[s].lines.length || fe(i[s], "hide"); + if (o) + for (var a = 0; a < o.length; ++a) o[a].lines.length && fe(o[a], "unhide"); + n.wrapper.offsetHeight && (r.scrollTop = t.display.scroller.scrollTop), e.changeObjs && fe(t, "changes", t, e.changeObjs), e.update && e.update.finish() } - function Ro(e, t) { + function Jr(e, t) { if (e.curOp) return t(); - Co(e); + $r(e); try { return t() } finally { - bo(e) + qr(e) } } - function xo(e, t) { + function ei(e, t) { return function () { if (e.curOp) return t.apply(e, arguments); - Co(e); + $r(e); try { return t.apply(e, arguments) } finally { - bo(e) + qr(e) } } } - function Po(e) { + function ti(e) { return function () { if (this.curOp) return e.apply(this, arguments); - Co(this); + $r(this); try { return e.apply(this, arguments) } finally { - bo(this) + qr(this) } } } - function Do(e) { + function ni(e) { return function () { var t = this.cm; if (!t || t.curOp) return e.apply(this, arguments); - Co(t); + $r(t); try { return e.apply(this, arguments) } finally { - bo(t) + qr(t) } } } - function Mo(e, t) { - e.doc.highlightFrontier < e.display.viewTo && e.state.highlight.set(t, y(Ao, e)) + function ri(e, t) { + e.doc.highlightFrontier < e.display.viewTo && e.state.highlight.set(t, N(ii, e)) } - function Ao(e) { + function ii(e) { var t = e.doc; if (!(t.highlightFrontier >= e.display.viewTo)) { var n = +new Date + e.options.workTime, - o = Re(e, t.highlightFrontier), - a = []; - t.iter(o.line, d(t.first + t.size, e.display.viewTo + 500), function (r) { - if (o.line >= e.display.viewFrom) { - var s = r.styles, - d = r.text.length > e.options.maxHighlightLength ? oe(t.mode, o.state) : null, - l = Te(e, r, o, !0); - d && (o.state = d), r.styles = l.styles; - var c = r.styleClasses, - p = l.classes; - p ? r.styleClasses = p : c && (r.styleClasses = null); - for (var u = !s || s.length != r.styles.length || c != p && (!c || !p || c.bgClass != p.bgClass || c.textClass != p.textClass), m = 0; !u && m < s.length; ++m) u = s[m] != r.styles[m]; - u && a.push(o.line), r.stateAfter = o.save(), o.nextLine() - } else r.text.length <= e.options.maxHighlightLength && xe(e, r.text, o), r.stateAfter = 0 == o.line % 5 ? o.save() : null, o.nextLine(); - return +new Date > n ? (Mo(e, e.options.workDelay), !0) : void 0 - }), t.highlightFrontier = o.line, t.modeFrontier = r(t.modeFrontier, o.line), a.length && Ro(e, function () { - for (var t = 0; t < a.length; t++) Nn(e, a[t], 'text') - }) + r = dt(e, t.highlightFrontier), + i = []; + t.iter(r.line, Math.min(t.first + t.size, e.display.viewTo + 500), (function (o) { + if (r.line >= e.display.viewFrom) { + var s = o.styles, + a = o.text.length > e.options.maxHighlightLength ? We(t.mode, r.state) : null, + l = ht(e, o, r, !0); + a && (r.state = a), o.styles = l.styles; + var c = o.styleClasses, + u = l.classes; + u ? o.styleClasses = u : c && (o.styleClasses = null); + for (var h = !s || s.length != o.styles.length || c != u && (!c || !u || c.bgClass != u.bgClass || c.textClass != u.textClass), p = 0; !h && p < s.length; ++p) h = s[p] != o.styles[p]; + h && i.push(r.line), o.stateAfter = r.save(), r.nextLine() + } else o.text.length <= e.options.maxHighlightLength && ft(e, o.text, r), o.stateAfter = r.line % 5 == 0 ? r.save() : null, r.nextLine(); + if (+new Date > n) return ri(e, e.options.workDelay), !0 + })), t.highlightFrontier = r.line, t.modeFrontier = Math.max(t.modeFrontier, r.line), i.length && Jr(e, (function () { + for (var t = 0; t < i.length; t++) pr(e, i[t], "text") + })) } } + var oi = function (e, t, n) { + var r = e.display; + this.viewport = t, this.visible = Dr(r, e.doc, t), this.editorIsHidden = !r.wrapper.offsetWidth, this.wrapperHeight = r.wrapper.clientHeight, this.wrapperWidth = r.wrapper.clientWidth, this.oldDisplayWidth = Rn(e), this.force = n, this.dims = or(e), this.events = [] + }; - function Io(e) { - var t = e.display; - !t.scrollbarsClipped && t.scroller.offsetWidth && (t.nativeBarWidth = t.scroller.offsetWidth - t.scroller.clientWidth, t.heightForcer.style.height = qt(e) + 'px', t.sizer.style.marginBottom = -t.nativeBarWidth + 'px', t.sizer.style.borderRightWidth = qt(e) + 'px', t.scrollbarsClipped = !0) - } - - function Lo(e) { - if (e.hasFocus()) return null; - var t = h(); - if (!t || !m(e.display.lineDiv, t)) return null; - var n = { - activeElt: t - }; - if (window.getSelection) { - var o = window.getSelection(); - o.anchorNode && o.extend && m(e.display.lineDiv, o.anchorNode) && (n.anchorNode = o.anchorNode, n.anchorOffset = o.anchorOffset, n.focusNode = o.focusNode, n.focusOffset = o.focusOffset) - } - return n + function si(e, t) { + var n = e.display, + r = e.doc; + if (t.editorIsHidden) return dr(e), !1; + if (!t.force && t.visible.from >= n.viewFrom && t.visible.to <= n.viewTo && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo) && n.renderedView == n.view && 0 == mr(e)) return !1; + pi(e) && (dr(e), t.dims = or(e)); + var i = r.first + r.size, + o = Math.max(t.visible.from - e.options.viewportMargin, r.first), + s = Math.min(i, t.visible.to + e.options.viewportMargin); + n.viewFrom < o && o - n.viewFrom < 20 && (o = Math.max(r.first, n.viewFrom)), n.viewTo > s && n.viewTo - s < 20 && (s = Math.min(i, n.viewTo)), Ct && (o = Ht(e.doc, o), s = zt(e.doc, s)); + var a = o != n.viewFrom || s != n.viewTo || n.lastWrapHeight != t.wrapperHeight || n.lastWrapWidth != t.wrapperWidth; + ! function (e, t, n) { + var r = e.display; + 0 == r.view.length || t >= r.viewTo || n <= r.viewFrom ? (r.view = on(e, t, n), r.viewFrom = t) : (r.viewFrom > t ? r.view = on(e, t, r.viewFrom).concat(r.view) : r.viewFrom < t && (r.view = r.view.slice(ur(e, t))), r.viewFrom = t, r.viewTo < n ? r.view = r.view.concat(on(e, r.viewTo, n)) : r.viewTo > n && (r.view = r.view.slice(0, ur(e, n)))), r.viewTo = n + }(e, o, s), n.viewOffset = Vt($e(e.doc, n.viewFrom)), e.display.mover.style.top = n.viewOffset + "px"; + var c = mr(e); + if (!a && 0 == c && !t.force && n.renderedView == n.view && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo)) return !1; + var u = function (e) { + if (e.hasFocus()) return null; + var t = P(); + if (!t || !M(e.display.lineDiv, t)) return null; + var n = { + activeElt: t + }; + if (window.getSelection) { + var r = window.getSelection(); + r.anchorNode && r.extend && M(e.display.lineDiv, r.anchorNode) && (n.anchorNode = r.anchorNode, n.anchorOffset = r.anchorOffset, n.focusNode = r.focusNode, n.focusOffset = r.focusOffset) + } + return n + }(e); + return c > 4 && (n.lineDiv.style.display = "none"), + function (e, t, n) { + var r = e.display, + i = e.options.lineNumbers, + o = r.lineDiv, + s = o.firstChild; + + function a(t) { + var n = t.nextSibling; + return l && v && e.display.currentWheelTarget == t ? t.style.display = "none" : t.parentNode.removeChild(t), n + } + for (var c = r.view, u = r.viewFrom, h = 0; h < c.length; h++) { + var p = c[h]; + if (p.hidden); + else if (p.node && p.node.parentNode == o) { + for (; s != p.node;) s = a(s); + var d = i && null != t && t <= u && p.lineNumber; + p.changes && (z(p.changes, "gutter") > -1 && (d = !1), un(e, p, u, n)), d && (R(p.lineNumber), p.lineNumber.appendChild(document.createTextNode(Je(e.options, u)))), s = p.node.nextSibling + } else { + var f = yn(e, p, u, n); + o.insertBefore(f, s) + } + u += p.size + } + for (; s;) s = a(s) + }(e, n.updateLineNumbers, t.dims), c > 4 && (n.lineDiv.style.display = ""), n.renderedView = n.view, + function (e) { + if (e && e.activeElt && e.activeElt != P() && (e.activeElt.focus(), e.anchorNode && M(document.body, e.anchorNode) && M(document.body, e.focusNode))) { + var t = window.getSelection(), + n = document.createRange(); + n.setEnd(e.anchorNode, e.anchorOffset), n.collapse(!1), t.removeAllRanges(), t.addRange(n), t.extend(e.focusNode, e.focusOffset) + } + }(u), R(n.cursorDiv), R(n.selectionDiv), n.gutters.style.height = n.sizer.style.minHeight = 0, a && (n.lastWrapHeight = t.wrapperHeight, n.lastWrapWidth = t.wrapperWidth, ri(e, 400)), n.updateLineNumbers = null, !0 } - function Fo(e) { - if (e && e.activeElt && e.activeElt != h() && (e.activeElt.focus(), e.anchorNode && m(document.body, e.anchorNode) && m(document.body, e.focusNode))) { - var t = window.getSelection(), - n = document.createRange(); - n.setEnd(e.anchorNode, e.anchorOffset), n.collapse(!1), t.removeAllRanges(), t.addRange(n), t.extend(e.focusNode, e.focusOffset) + function ai(e, t) { + for (var n = t.viewport, r = !0; + (r && e.options.lineWrapping && t.oldDisplayWidth != Rn(e) || (n && null != n.top && (n = { + top: Math.min(e.doc.height + kn(e.display) - Dn(e), n.top) + }), t.visible = Dr(e.display, e.doc, n), !(t.visible.from >= e.display.viewFrom && t.visible.to <= e.display.viewTo))) && si(e, t); r = !1) { + Tr(e); + var i = Br(e); + gr(e), Ur(e, i), ui(e, i), t.force = !1 } + t.signal(e, "update", e), e.display.viewFrom == e.display.reportedViewFrom && e.display.viewTo == e.display.reportedViewTo || (t.signal(e, "viewportChange", e, e.display.viewFrom, e.display.viewTo), e.display.reportedViewFrom = e.display.viewFrom, e.display.reportedViewTo = e.display.viewTo) } - function Bo(e, t) { - var n = e.display, - o = e.doc; - if (t.editorIsHidden) return On(e), !1; - if (!t.force && t.visible.from >= n.viewFrom && t.visible.to <= n.viewTo && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo) && n.renderedView == n.view && 0 == Un(e)) return !1; - Vo(e) && (On(e), t.dims = Dn(e)); - var i = o.first + o.size, - a = r(t.visible.from - e.options.viewportMargin, o.first), - s = d(i, t.visible.to + e.options.viewportMargin); - n.viewFrom < a && 20 > a - n.viewFrom && (a = r(o.first, n.viewFrom)), n.viewTo > s && 20 > n.viewTo - s && (s = d(i, n.viewTo)), vs && (a = at(e.doc, a), s = st(e.doc, s)); - var c = a != n.viewFrom || s != n.viewTo || n.lastWrapHeight != t.wrapperHeight || n.lastWrapWidth != t.wrapperWidth; - zn(e, a, s), n.viewOffset = ct(se(e.doc, n.viewFrom)), e.display.mover.style.top = n.viewOffset + 'px'; - var p = Un(e); - if (!c && 0 == p && !t.force && n.renderedView == n.view && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo)) return !1; - var u = Lo(e); - return 4 < p && (n.lineDiv.style.display = 'none'), Ho(e, n.updateLineNumbers, t.dims), 4 < p && (n.lineDiv.style.display = ''), n.renderedView = n.view, Fo(u), l(n.cursorDiv), l(n.selectionDiv), n.gutters.style.height = n.sizer.style.minHeight = 0, c && (n.lastWrapHeight = t.wrapperHeight, n.lastWrapWidth = t.wrapperWidth, Mo(e, 400)), n.updateLineNumbers = null, !0 - } - - function No(e, t) { - for (var n = t.viewport, o = !0;; o = !1) { - if ((!o || !e.options.lineWrapping || t.oldDisplayWidth == Yt(e)) && (n && null != n.top && (n = { - top: d(e.doc.height + Kt(e.display) - Xt(e), n.top) - }), t.visible = eo(e.display, e.doc, n), t.visible.from >= e.display.viewFrom && t.visible.to <= e.display.viewTo)) break; - if (!Bo(e, t)) break; - Zn(e); - var r = fo(e); - Wn(e), go(e, r), Uo(e, r), t.force = !1 - } - t.signal(e, 'update', e), (e.display.viewFrom != e.display.reportedViewFrom || e.display.viewTo != e.display.reportedViewTo) && (t.signal(e, 'viewportChange', e, e.display.viewFrom, e.display.viewTo), e.display.reportedViewFrom = e.display.viewFrom, e.display.reportedViewTo = e.display.viewTo) - } - - function Oo(e, t) { - var n = new Is(e, t); - if (Bo(e, n)) { - Zn(e), No(e, n); - var o = fo(e); - Wn(e), go(e, o), Uo(e, o), n.finish() - } - } - - function Ho(e, t, n) { - function o(t) { - var n = t.nextSibling; - return Pa && Ha && e.display.currentWheelTarget == t ? t.style.display = 'none' : t.parentNode.removeChild(t), n - } - for (var r = e.display, a = e.options.lineNumbers, s = r.lineDiv, d = s.firstChild, c = r.view, p = r.viewFrom, u = 0, i; u < c.length; u++) { - if (i = c[u], i.hidden); - else if (!i.node || i.node.parentNode != s) { - var m = Ot(e, i, p, n); - s.insertBefore(m, d) - } else { - for (; d != i.node;) d = o(d); - var h = a && null != t && t <= p && i.lineNumber; - i.changes && (-1 < b(i.changes, 'gutter') && (h = !1), Dt(e, i, p, n)), h && (l(i.lineNumber), i.lineNumber.appendChild(document.createTextNode(he(e.options, p)))), d = i.node.nextSibling - } - p += i.size + function li(e, t) { + var n = new oi(e, t); + if (si(e, n)) { + Tr(e), ai(e, n); + var r = Br(e); + gr(e), Ur(e, r), ui(e, r), n.finish() } - for (; d;) d = o(d) } - function zo(e) { + function ci(e) { var t = e.gutters.offsetWidth; - e.sizer.style.marginLeft = t + 'px' + e.sizer.style.marginLeft = t + "px" } - function Uo(e, t) { - e.display.sizer.style.minHeight = t.docHeight + 'px', e.display.heightForcer.style.top = t.docHeight + 'px', e.display.gutters.style.height = t.docHeight + e.display.barHeight + qt(e) + 'px' + function ui(e, t) { + e.display.sizer.style.minHeight = t.docHeight + "px", e.display.heightForcer.style.top = t.docHeight + "px", e.display.gutters.style.height = t.docHeight + e.display.barHeight + Tn(e) + "px" } - function Wo(e) { + function hi(e) { var t = e.display, n = t.view; if (t.alignWidgets || t.gutters.firstChild && e.options.fixedGutter) { - for (var o = Mn(t) - t.scroller.scrollLeft + e.doc.scrollLeft, r = t.gutters.offsetWidth, a = o + 'px', s = 0; s < n.length; s++) + for (var r = sr(t) - t.scroller.scrollLeft + e.doc.scrollLeft, i = t.gutters.offsetWidth, o = r + "px", s = 0; s < n.length; s++) if (!n[s].hidden) { - e.options.fixedGutter && (n[s].gutter && (n[s].gutter.style.left = a), n[s].gutterBackground && (n[s].gutterBackground.style.left = a)); - var i = n[s].alignable; - if (i) - for (var d = 0; d < i.length; d++) i[d].style.left = a - } e.options.fixedGutter && (t.gutters.style.left = o + r + 'px') + e.options.fixedGutter && (n[s].gutter && (n[s].gutter.style.left = o), n[s].gutterBackground && (n[s].gutterBackground.style.left = o)); + var a = n[s].alignable; + if (a) + for (var l = 0; l < a.length; l++) a[l].style.left = o + } e.options.fixedGutter && (t.gutters.style.left = r + i + "px") } } - function Vo(e) { + function pi(e) { if (!e.options.lineNumbers) return !1; var t = e.doc, - n = he(e.options, t.first + t.size - 1), - o = e.display; - if (n.length != o.lineNumChars) { - var i = o.measure.appendChild(p('div', [p('div', n)], 'CodeMirror-linenumber CodeMirror-gutter-elt')), - a = i.firstChild.offsetWidth, - s = i.offsetWidth - a; - return o.lineGutter.style.width = '', o.lineNumInnerWidth = r(a, o.lineGutter.offsetWidth - s) + 1, o.lineNumWidth = o.lineNumInnerWidth + s, o.lineNumChars = o.lineNumInnerWidth ? n.length : -1, o.lineGutter.style.width = o.lineNumWidth + 'px', zo(e.display), !0 + n = Je(e.options, t.first + t.size - 1), + r = e.display; + if (n.length != r.lineNumChars) { + var i = r.measure.appendChild(_("div", [_("div", n)], "CodeMirror-linenumber CodeMirror-gutter-elt")), + o = i.firstChild.offsetWidth, + s = i.offsetWidth - o; + return r.lineGutter.style.width = "", r.lineNumInnerWidth = Math.max(o, r.lineGutter.offsetWidth - s) + 1, r.lineNumWidth = r.lineNumInnerWidth + s, r.lineNumChars = r.lineNumInnerWidth ? n.length : -1, r.lineGutter.style.width = r.lineNumWidth + "px", ci(e.display), !0 } return !1 } - function Go(e, t) { - for (var n = [], o = !1, r = 0; r < e.length; r++) { - var i = e[r], - a = null; - if ('string' != typeof i && (a = i.style, i = i.className), 'CodeMirror-linenumbers' == i) + function di(e, t) { + for (var n = [], r = !1, i = 0; i < e.length; i++) { + var o = e[i], + s = null; + if ("string" != typeof o && (s = o.style, o = o.className), "CodeMirror-linenumbers" == o) { if (!t) continue; - else o = !0; + r = !0 + } n.push({ - className: i, - style: a + className: o, + style: s }) } - return t && !o && n.push({ - className: 'CodeMirror-linenumbers', + return t && !r && n.push({ + className: "CodeMirror-linenumbers", style: null }), n } - function Ko(e) { + function fi(e) { var t = e.gutters, n = e.gutterSpecs; - l(t), e.lineGutter = null; - for (var o = 0; o < n.length; ++o) { - var r = n[o], - i = r.className, - a = r.style, - s = t.appendChild(p('div', null, 'CodeMirror-gutter ' + i)); - a && (s.style.cssText = a), 'CodeMirror-linenumbers' == i && (e.lineGutter = s, s.style.width = (e.lineNumWidth || 1) + 'px') + R(t), e.lineGutter = null; + for (var r = 0; r < n.length; ++r) { + var i = n[r], + o = i.className, + s = i.style, + a = t.appendChild(_("div", null, "CodeMirror-gutter " + o)); + s && (a.style.cssText = s), "CodeMirror-linenumbers" == o && (e.lineGutter = a, a.style.width = (e.lineNumWidth || 1) + "px") } - t.style.display = n.length ? '' : 'none', zo(e) - } - - function jo(e) { - Ko(e.display), Bn(e), Wo(e) + t.style.display = n.length ? "" : "none", ci(e) } - function qo(e, t, n, o) { - var r = this; - this.input = n, r.scrollbarFiller = p('div', null, 'CodeMirror-scrollbar-filler'), r.scrollbarFiller.setAttribute('cm-not-content', 'true'), r.gutterFiller = p('div', null, 'CodeMirror-gutter-filler'), r.gutterFiller.setAttribute('cm-not-content', 'true'), r.lineDiv = u('div', null, 'CodeMirror-code'), r.selectionDiv = p('div', null, null, 'position: relative; z-index: 1'), r.cursorDiv = p('div', null, 'CodeMirror-cursors'), r.measure = p('div', null, 'CodeMirror-measure'), r.lineMeasure = p('div', null, 'CodeMirror-measure'), r.lineSpace = u('div', [r.measure, r.lineMeasure, r.selectionDiv, r.cursorDiv, r.lineDiv], null, 'position: relative; outline: none'); - var i = u('div', [r.lineSpace], 'CodeMirror-lines'); - r.mover = p('div', [i], null, 'position: relative'), r.sizer = p('div', [r.mover], 'CodeMirror-sizer'), r.sizerWidth = null, r.heightForcer = p('div', null, null, 'position: absolute; height: ' + Xa + 'px; width: 1px;'), r.gutters = p('div', null, 'CodeMirror-gutters'), r.lineGutter = null, r.scroller = p('div', [r.sizer, r.heightForcer, r.gutters], 'CodeMirror-scroll'), r.scroller.setAttribute('tabIndex', '-1'), r.wrapper = p('div', [r.scrollbarFiller, r.gutterFiller, r.scroller], 'CodeMirror'), Ra && 8 > xa && (r.gutters.style.zIndex = -1, r.scroller.style.paddingRight = 0), Pa || wa && Oa || (r.scroller.draggable = !0), e && (e.appendChild ? e.appendChild(r.wrapper) : e(r.wrapper)), r.viewFrom = r.viewTo = t.first, r.reportedViewFrom = r.reportedViewTo = t.first, r.view = [], r.renderedView = null, r.externalMeasured = null, r.viewOffset = 0, r.lastWrapHeight = r.lastWrapWidth = 0, r.updateLineNumbers = null, r.nativeBarWidth = r.barHeight = r.barWidth = 0, r.scrollbarsClipped = !1, r.lineNumWidth = r.lineNumInnerWidth = r.lineNumChars = null, r.alignWidgets = !1, r.cachedCharWidth = r.cachedTextHeight = r.cachedPaddingH = null, r.maxLine = null, r.maxLineLength = 0, r.maxLineChanged = !1, r.wheelDX = r.wheelDY = r.wheelStartX = r.wheelStartY = null, r.shift = !1, r.selForContextMenu = null, r.activeTouch = null, r.gutterSpecs = Go(o.gutters, o.lineNumbers), Ko(r), n.init(r) + function mi(e) { + fi(e.display), hr(e), hi(e) } - function Yo(t) { - var e = t.wheelDeltaX, - n = t.wheelDeltaY; - return null == e && t.detail && t.axis == t.HORIZONTAL_AXIS && (e = t.detail), null == n && t.detail && t.axis == t.VERTICAL_AXIS ? n = t.detail : null == n && (n = t.wheelDelta), { - x: e, + function gi(e, t, r, i) { + var o = this; + this.input = r, o.scrollbarFiller = _("div", null, "CodeMirror-scrollbar-filler"), o.scrollbarFiller.setAttribute("cm-not-content", "true"), o.gutterFiller = _("div", null, "CodeMirror-gutter-filler"), o.gutterFiller.setAttribute("cm-not-content", "true"), o.lineDiv = A("div", null, "CodeMirror-code"), o.selectionDiv = _("div", null, null, "position: relative; z-index: 1"), o.cursorDiv = _("div", null, "CodeMirror-cursors"), o.measure = _("div", null, "CodeMirror-measure"), o.lineMeasure = _("div", null, "CodeMirror-measure"), o.lineSpace = A("div", [o.measure, o.lineMeasure, o.selectionDiv, o.cursorDiv, o.lineDiv], null, "position: relative; outline: none"); + var c = A("div", [o.lineSpace], "CodeMirror-lines"); + o.mover = _("div", [c], null, "position: relative"), o.sizer = _("div", [o.mover], "CodeMirror-sizer"), o.sizerWidth = null, o.heightForcer = _("div", null, null, "position: absolute; height: 30px; width: 1px;"), o.gutters = _("div", null, "CodeMirror-gutters"), o.lineGutter = null, o.scroller = _("div", [o.sizer, o.heightForcer, o.gutters], "CodeMirror-scroll"), o.scroller.setAttribute("tabIndex", "-1"), o.wrapper = _("div", [o.scrollbarFiller, o.gutterFiller, o.scroller], "CodeMirror"), s && a < 8 && (o.gutters.style.zIndex = -1, o.scroller.style.paddingRight = 0), l || n && y || (o.scroller.draggable = !0), e && (e.appendChild ? e.appendChild(o.wrapper) : e(o.wrapper)), o.viewFrom = o.viewTo = t.first, o.reportedViewFrom = o.reportedViewTo = t.first, o.view = [], o.renderedView = null, o.externalMeasured = null, o.viewOffset = 0, o.lastWrapHeight = o.lastWrapWidth = 0, o.updateLineNumbers = null, o.nativeBarWidth = o.barHeight = o.barWidth = 0, o.scrollbarsClipped = !1, o.lineNumWidth = o.lineNumInnerWidth = o.lineNumChars = null, o.alignWidgets = !1, o.cachedCharWidth = o.cachedTextHeight = o.cachedPaddingH = null, o.maxLine = null, o.maxLineLength = 0, o.maxLineChanged = !1, o.wheelDX = o.wheelDY = o.wheelStartX = o.wheelStartY = null, o.shift = !1, o.selForContextMenu = null, o.activeTouch = null, o.gutterSpecs = di(i.gutters, i.lineNumbers), fi(o), r.init(o) + } + oi.prototype.signal = function (e, t) { + ye(e, t) && this.events.push(arguments) + }, oi.prototype.finish = function () { + for (var e = 0; e < this.events.length; e++) fe.apply(null, this.events[e]) + }; + var yi = 0, + vi = null; + + function wi(e) { + var t = e.wheelDeltaX, + n = e.wheelDeltaY; + return null == t && e.detail && e.axis == e.HORIZONTAL_AXIS && (t = e.detail), null == n && e.detail && e.axis == e.VERTICAL_AXIS ? n = e.detail : null == n && (n = e.wheelDelta), { + x: t, y: n } } - function Xo(t) { - var e = Yo(t); - return e.x *= Fs, e.y *= Fs, e - } - - function Qo(t, n) { - var e = Yo(n), - o = e.x, - a = e.y, - s = t.display, - l = s.scroller, - c = l.scrollWidth > l.clientWidth, - p = l.scrollHeight > l.clientHeight; - if (o && c || a && p) { - if (a && Ha && Pa) outer: for (var u = n.target, m = s.view; u != l; u = u.parentNode) - for (var h = 0; h < m.length; h++) - if (m[h].node == u) { - t.display.currentWheelTarget = u; - break outer - } if (o && !wa && !Aa && null != Fs) return a && p && uo(t, r(0, l.scrollTop + a * Fs)), ho(t, r(0, l.scrollLeft + o * Fs)), (!a || a && p) && G(n), void(s.wheelStartX = null); - if (a && null != Fs) { - var i = a * Fs, - f = t.doc.scrollTop, - g = f + s.wrapper.clientHeight; - 0 > i ? f = r(0, f + i - 50) : g = d(t.doc.height, g + i + 50), Oo(t, { - top: f, - bottom: g + function bi(e) { + var t = wi(e); + return t.x *= vi, t.y *= vi, t + } + + function Si(e, t) { + var r = wi(t), + i = r.x, + o = r.y, + s = e.display, + a = s.scroller, + c = a.scrollWidth > a.clientWidth, + u = a.scrollHeight > a.clientHeight; + if (i && c || o && u) { + if (o && v && l) e: for (var p = t.target, d = s.view; p != a; p = p.parentNode) + for (var f = 0; f < d.length; f++) + if (d[f].node == p) { + e.display.currentWheelTarget = p; + break e + } if (i && !n && !h && null != vi) return o && u && Lr(e, Math.max(0, a.scrollTop + o * vi)), Fr(e, Math.max(0, a.scrollLeft + i * vi)), (!o || o && u) && we(t), void(s.wheelStartX = null); + if (o && null != vi) { + var m = o * vi, + g = e.doc.scrollTop, + y = g + s.wrapper.clientHeight; + m < 0 ? g = Math.max(0, g + m - 50) : y = Math.min(e.doc.height, y + m + 50), li(e, { + top: g, + bottom: y }) } - 20 > Ls && (null == s.wheelStartX ? (s.wheelStartX = l.scrollLeft, s.wheelStartY = l.scrollTop, s.wheelDX = o, s.wheelDY = a, setTimeout(function () { + yi < 20 && (null == s.wheelStartX ? (s.wheelStartX = a.scrollLeft, s.wheelStartY = a.scrollTop, s.wheelDX = i, s.wheelDY = o, setTimeout((function () { if (null != s.wheelStartX) { - var e = l.scrollLeft - s.wheelStartX, - t = l.scrollTop - s.wheelStartY, + var e = a.scrollLeft - s.wheelStartX, + t = a.scrollTop - s.wheelStartY, n = t && s.wheelDY && t / s.wheelDY || e && s.wheelDX && e / s.wheelDX; - s.wheelStartX = s.wheelStartY = null, n && (Fs = (Fs * Ls + n) / (Ls + 1), ++Ls) + s.wheelStartX = s.wheelStartY = null, n && (vi = (vi * yi + n) / (yi + 1), ++yi) } - }, 200)) : (s.wheelDX += o, s.wheelDY += a)) + }), 200)) : (s.wheelDX += i, s.wheelDY += o)) } } + s ? vi = -.53 : n ? vi = 15 : u ? vi = -.7 : p && (vi = -1 / 3); + var Ci = function (e, t) { + this.ranges = e, this.primIndex = t + }; + Ci.prototype.primary = function () { + return this.ranges[this.primIndex] + }, Ci.prototype.equals = function (e) { + if (e == this) return !0; + if (e.primIndex != this.primIndex || e.ranges.length != this.ranges.length) return !1; + for (var t = 0; t < this.ranges.length; t++) { + var n = this.ranges[t], + r = e.ranges[t]; + if (!nt(n.anchor, r.anchor) || !nt(n.head, r.head)) return !1 + } + return !0 + }, Ci.prototype.deepCopy = function () { + for (var e = [], t = 0; t < this.ranges.length; t++) e[t] = new Ei(rt(this.ranges[t].anchor), rt(this.ranges[t].head)); + return new Ci(e, this.primIndex) + }, Ci.prototype.somethingSelected = function () { + for (var e = 0; e < this.ranges.length; e++) + if (!this.ranges[e].empty()) return !0; + return !1 + }, Ci.prototype.contains = function (e, t) { + t || (t = e); + for (var n = 0; n < this.ranges.length; n++) { + var r = this.ranges[n]; + if (tt(t, r.from()) >= 0 && tt(e, r.to()) <= 0) return n + } + return -1 + }; + var Ei = function (e, t) { + this.anchor = e, this.head = t + }; - function $o(e, t, n) { - var o = e && e.options.selectionsMayTouch, - r = t[n]; - t.sort(function (e, t) { - return ge(e.from(), t.from()) - }), n = b(t, r); - for (var a = 1; a < t.length; a++) { - var i = t[a], - s = t[a - 1], - d = ge(s.to(), i.from()); - if (o && !i.empty() ? 0 < d : 0 <= d) { - var l = be(s.from(), i.from()), - c = Ce(s.to(), i.to()), - p = s.empty() ? i.from() == i.head : s.from() == s.head; - a <= n && --n, t.splice(--a, 2, new Ns(p ? c : l, p ? l : c)) + function ki(e, t, n) { + var r = e && e.options.selectionsMayTouch, + i = t[n]; + t.sort((function (e, t) { + return tt(e.from(), t.from()) + })), n = z(t, i); + for (var o = 1; o < t.length; o++) { + var s = t[o], + a = t[o - 1], + l = tt(a.to(), s.from()); + if (r && !s.empty() ? l > 0 : l >= 0) { + var c = ot(a.from(), s.from()), + u = it(a.to(), s.to()), + h = a.empty() ? s.from() == s.head : a.from() == a.head; + o <= n && --n, t.splice(--o, 2, new Ei(h ? u : c, h ? c : u)) } } - return new Bs(t, n) + return new Ci(t, n) } - function Zo(e, t) { - return new Bs([new Ns(e, t || e)], 0) + function xi(e, t) { + return new Ci([new Ei(e, t || e)], 0) } - function Jo(e) { - return e.text ? fe(e.from.line + e.text.length - 1, w(e.text).length + (1 == e.text.length ? e.from.ch : 0)) : e.to + function Ti(e) { + return e.text ? et(e.from.line + e.text.length - 1, K(e.text).length + (1 == e.text.length ? e.from.ch : 0)) : e.to } - function er(e, t) { - if (0 > ge(e, t.from)) return e; - if (0 >= ge(e, t.to)) return Jo(t); + function Ri(e, t) { + if (tt(e, t.from) < 0) return e; + if (tt(e, t.to) <= 0) return Ti(t); var n = e.line + t.text.length - (t.to.line - t.from.line) - 1, - o = e.ch; - return e.line == t.to.line && (o += Jo(t).ch - t.to.ch), fe(n, o) - } - - function tr(e, t) { - for (var n = [], o = 0, r; o < e.sel.ranges.length; o++) r = e.sel.ranges[o], n.push(new Ns(er(r.anchor, t), er(r.head, t))); - return $o(e.cm, n, e.sel.primIndex) + r = e.ch; + return e.line == t.to.line && (r += Ti(t).ch - t.to.ch), et(n, r) } - function nr(e, t, n) { - return e.line == t.line ? fe(n.line, e.ch - t.ch + n.ch) : fe(n.line + (e.line - t.line), e.ch) + function Di(e, t) { + for (var n = [], r = 0; r < e.sel.ranges.length; r++) { + var i = e.sel.ranges[r]; + n.push(new Ei(Ri(i.anchor, t), Ri(i.head, t))) + } + return ki(e.cm, n, e.sel.primIndex) } - function or(e, t, n) { - for (var o = [], r = fe(e.first, 0), a = r, s = 0; s < t.length; s++) { - var i = t[s], - d = nr(i.from, r, a), - l = nr(Jo(i), r, a); - if (r = i.to, a = l, 'around' == n) { - var c = e.sel.ranges[s], - p = 0 > ge(c.head, c.anchor); - o[s] = new Ns(p ? l : d, p ? d : l) - } else o[s] = new Ns(d, d) - } - return new Bs(o, e.sel.primIndex) + function _i(e, t, n) { + return e.line == t.line ? et(n.line, e.ch - t.ch + n.ch) : et(n.line + (e.line - t.line), e.ch) } - function rr(e) { - e.doc.mode = te(e.options, e.doc.modeOption), ir(e) + function Ai(e) { + e.doc.mode = He(e.options, e.doc.modeOption), Mi(e) } - function ir(e) { - e.doc.iter(function (e) { + function Mi(e) { + e.doc.iter((function (e) { e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null) - }), e.doc.modeFrontier = e.doc.highlightFrontier = e.doc.first, Mo(e, 100), e.state.modeGen++, e.curOp && Bn(e) + })), e.doc.modeFrontier = e.doc.highlightFrontier = e.doc.first, ri(e, 100), e.state.modeGen++, e.curOp && hr(e) } - function ar(e, t) { - return 0 == t.from.ch && 0 == t.to.ch && '' == w(t.text) && (!e.cm || e.cm.options.wholeLineUpdateBefore) + function Pi(e, t) { + return 0 == t.from.ch && 0 == t.to.ch && "" == K(t.text) && (!e.cm || e.cm.options.wholeLineUpdateBefore) } - function sr(e, t, o, n) { - function r(e) { - return o ? o[e] : null + function Ii(e, t, n, r) { + function i(e) { + return n ? n[e] : null } - function i(e, o, r) { - mt(e, o, r, n), xt(e, 'change', e, t) + function o(e, n, i) { + ! function (e, t, n, r) { + e.text = t, e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null), null != e.order && (e.order = null), Dt(e), _t(e, n); + var i = r ? r(e) : 1; + i != e.height && Ye(e, i) + }(e, n, i, r), ln(e, "change", e, t) } - function a(e, t) { - for (var o = [], a = e; a < t; ++a) o.push(new Es(l[a], r(a), n)); - return o + function s(e, t) { + for (var n = [], o = e; o < t; ++o) n.push(new $t(c[o], i(o), r)); + return n } - var s = t.from, - d = t.to, - l = t.text, - c = se(e, s.line), - p = se(e, d.line), - u = w(l), - m = r(l.length - 1), - h = d.line - s.line; - if (t.full) e.insert(0, a(0, l.length)), e.remove(l.length, e.size - l.length); - else if (ar(e, t)) { - var f = a(0, l.length - 1); - i(p, p.text, m), h && e.remove(s.line, h), f.length && e.insert(s.line, f) - } else if (c == p) { - if (1 == l.length) i(c, c.text.slice(0, s.ch) + u + c.text.slice(d.ch), m); + var a = t.from, + l = t.to, + c = t.text, + u = $e(e, a.line), + h = $e(e, l.line), + p = K(c), + d = i(c.length - 1), + f = l.line - a.line; + if (t.full) e.insert(0, s(0, c.length)), e.remove(c.length, e.size - c.length); + else if (Pi(e, t)) { + var m = s(0, c.length - 1); + o(h, h.text, d), f && e.remove(a.line, f), m.length && e.insert(a.line, m) + } else if (u == h) + if (1 == c.length) o(u, u.text.slice(0, a.ch) + p + u.text.slice(l.ch), d); else { - var g = a(1, l.length - 1); - g.push(new Es(u + c.text.slice(d.ch), m, n)), i(c, c.text.slice(0, s.ch) + l[0], r(0)), e.insert(s.line + 1, g) + var g = s(1, c.length - 1); + g.push(new $t(p + u.text.slice(l.ch), d, r)), o(u, u.text.slice(0, a.ch) + c[0], i(0)), e.insert(a.line + 1, g) } - } else if (1 == l.length) i(c, c.text.slice(0, s.ch) + l[0] + p.text.slice(d.ch), r(0)), e.remove(s.line + 1, h); + else if (1 == c.length) o(u, u.text.slice(0, a.ch) + c[0] + h.text.slice(l.ch), i(0)), e.remove(a.line + 1, f); else { - i(c, c.text.slice(0, s.ch) + l[0], r(0)), i(p, u + p.text.slice(d.ch), m); - var y = a(1, l.length - 1); - 1 < h && e.remove(s.line + 1, h - 1), e.insert(s.line + 1, y) + o(u, u.text.slice(0, a.ch) + c[0], i(0)), o(h, p + h.text.slice(l.ch), d); + var y = s(1, c.length - 1); + f > 1 && e.remove(a.line + 1, f - 1), e.insert(a.line + 1, y) } - xt(e, 'change', e, t) + ln(e, "change", e, t) } - function dr(e, t, n) { - function o(e, r, a) { - if (e.linked) - for (var s = 0, i; s < e.linked.length; ++s) - if (i = e.linked[s], i.doc != r) { - var d = a && i.sharedHist; - (!n || d) && (t(i.doc, d), o(i.doc, e, d)) + function Oi(e, t, n) { + ! function e(r, i, o) { + if (r.linked) + for (var s = 0; s < r.linked.length; ++s) { + var a = r.linked[s]; + if (a.doc != i) { + var l = o && a.sharedHist; + n && !l || (t(a.doc, l), e(a.doc, r, l)) } - } - o(e, null, !0) - } - - function lr(e, t) { - if (t.cm) throw new Error('This document is already in use.'); - e.doc = t, t.cm = e, In(e), rr(e), cr(e), e.options.lineWrapping || ut(e), e.options.mode = t.modeOption, Bn(e) + } + }(e, null, !0) } - function cr(e) { - ('rtl' == e.doc.direction ? f : Ka)(e.display.lineDiv, 'CodeMirror-rtl') + function Li(e, t) { + if (t.cm) throw new Error("This document is already in use."); + e.doc = t, t.cm = e, lr(e), Ai(e), Ni(e), e.options.lineWrapping || Gt(e), e.options.mode = t.modeOption, hr(e) } - function pr(e) { - Ro(e, function () { - cr(e), Bn(e) - }) + function Ni(e) { + ("rtl" == e.doc.direction ? I : T)(e.display.lineDiv, "CodeMirror-rtl") } - function ur(e) { - this.done = [], this.undone = [], this.undoDepth = Infinity, this.lastModTime = this.lastSelTime = 0, this.lastOp = this.lastSelOp = null, this.lastOrigin = this.lastSelOrigin = null, this.generation = this.maxGeneration = e || 1 + function Fi(e) { + this.done = [], this.undone = [], this.undoDepth = 1 / 0, this.lastModTime = this.lastSelTime = 0, this.lastOp = this.lastSelOp = null, this.lastOrigin = this.lastSelOrigin = null, this.generation = this.maxGeneration = e || 1 } - function mr(e, t) { + function Bi(e, t) { var n = { - from: Se(t.from), - to: Jo(t), - text: de(e, t.from, t.to) + from: rt(t.from), + to: Ti(t), + text: qe(e, t.from, t.to) }; - return br(e, n, t.from.line, t.to.line + 1), dr(e, function (e) { - return br(e, n, t.from.line, t.to.line + 1) - }, !0), n - } - - function hr(e) { - for (; e.length;) { - var t = w(e); - if (t.ranges) e.pop(); - else break - } + return Vi(e, n, t.from.line, t.to.line + 1), Oi(e, (function (e) { + return Vi(e, n, t.from.line, t.to.line + 1) + }), !0), n } - function fr(e, t) { - return t ? (hr(e.done), w(e.done)) : e.done.length && !w(e.done).ranges ? w(e.done) : 1 < e.done.length && !e.done[e.done.length - 2].ranges ? (e.done.pop(), w(e.done)) : void 0 + function Hi(e) { + for (; e.length && K(e).ranges;) e.pop() } - function gr(e, t, n, o) { - var r = e.history; - r.undone.length = 0; - var i = +new Date, - a, s; - if ((r.lastOp == o || r.lastOrigin == t.origin && t.origin && ('+' == t.origin.charAt(0) && r.lastModTime > i - (e.cm ? e.cm.options.historyEventDelay : 500) || '*' == t.origin.charAt(0))) && (a = fr(r, r.lastOp == o))) s = w(a.changes), 0 == ge(t.from, t.to) && 0 == ge(t.from, s.to) ? s.to = Jo(t) : a.changes.push(mr(e, t)); + function zi(e, t, n, r) { + var i = e.history; + i.undone.length = 0; + var o, s, a = +new Date; + if ((i.lastOp == r || i.lastOrigin == t.origin && t.origin && ("+" == t.origin.charAt(0) && i.lastModTime > a - (e.cm ? e.cm.options.historyEventDelay : 500) || "*" == t.origin.charAt(0))) && (o = function (e, t) { + return t ? (Hi(e.done), K(e.done)) : e.done.length && !K(e.done).ranges ? K(e.done) : e.done.length > 1 && !e.done[e.done.length - 2].ranges ? (e.done.pop(), K(e.done)) : void 0 + }(i, i.lastOp == r))) s = K(o.changes), 0 == tt(t.from, t.to) && 0 == tt(t.from, s.to) ? s.to = Ti(t) : o.changes.push(Bi(e, t)); else { - var d = w(r.done); - for (d && d.ranges || Cr(e.sel, r.done), a = { - changes: [mr(e, t)], - generation: r.generation - }, r.done.push(a); r.done.length > r.undoDepth;) r.done.shift(), r.done[0].ranges || r.done.shift() + var l = K(i.done); + for (l && l.ranges || Wi(e.sel, i.done), o = { + changes: [Bi(e, t)], + generation: i.generation + }, i.done.push(o); i.done.length > i.undoDepth;) i.done.shift(), i.done[0].ranges || i.done.shift() } - r.done.push(n), r.generation = ++r.maxGeneration, r.lastModTime = r.lastSelTime = i, r.lastOp = r.lastSelOp = o, r.lastOrigin = r.lastSelOrigin = t.origin, s || H(e, 'historyAdded') - } - - function yr(e, t, n, o) { - var r = t.charAt(0); - return '*' == r || '+' == r && n.ranges.length == o.ranges.length && n.somethingSelected() == o.somethingSelected() && new Date - e.history.lastSelTime <= (e.cm ? e.cm.options.historyEventDelay : 500) + i.done.push(n), i.generation = ++i.maxGeneration, i.lastModTime = i.lastSelTime = a, i.lastOp = i.lastSelOp = r, i.lastOrigin = i.lastSelOrigin = t.origin, s || fe(e, "historyAdded") } - function Sr(e, t, n, o) { - var r = e.history, - i = o && o.origin; - n == r.lastSelOp || i && r.lastSelOrigin == i && (r.lastModTime == r.lastSelTime && r.lastOrigin == i || yr(e, i, w(r.done), t)) ? r.done[r.done.length - 1] = t : Cr(t, r.done), r.lastSelTime = +new Date, r.lastSelOrigin = i, r.lastSelOp = n, o && !1 !== o.clearRedo && hr(r.undone) + function Ui(e, t, n, r) { + var i = e.history, + o = r && r.origin; + n == i.lastSelOp || o && i.lastSelOrigin == o && (i.lastModTime == i.lastSelTime && i.lastOrigin == o || function (e, t, n, r) { + var i = t.charAt(0); + return "*" == i || "+" == i && n.ranges.length == r.ranges.length && n.somethingSelected() == r.somethingSelected() && new Date - e.history.lastSelTime <= (e.cm ? e.cm.options.historyEventDelay : 500) + }(e, o, K(i.done), t)) ? i.done[i.done.length - 1] = t : Wi(t, i.done), i.lastSelTime = +new Date, i.lastSelOrigin = o, i.lastSelOp = n, r && !1 !== r.clearRedo && Hi(i.undone) } - function Cr(e, t) { - var n = w(t); + function Wi(e, t) { + var n = K(t); n && n.ranges && n.equals(e) || t.push(e) } - function br(e, t, o, i) { - var a = t['spans_' + e.id], - s = 0; - e.iter(r(e.first, o), d(e.first + e.size, i), function (n) { - n.markedSpans && ((a || (a = t['spans_' + e.id] = {}))[s] = n.markedSpans), ++s - }) + function Vi(e, t, n, r) { + var i = t["spans_" + e.id], + o = 0; + e.iter(Math.max(e.first, n), Math.min(e.first + e.size, r), (function (n) { + n.markedSpans && ((i || (i = t["spans_" + e.id] = {}))[o] = n.markedSpans), ++o + })) } - function vr(e) { + function ji(e) { if (!e) return null; - for (var t = 0, n; t < e.length; ++t) e[t].marker.explicitlyCleared ? n || (n = e.slice(0, t)) : n && n.push(e[t]); - return n ? n.length ? n : null : e - } - - function Er(e, t) { - var n = t['spans_' + e.id]; - if (!n) return null; - for (var o = [], r = 0; r < t.text.length; ++r) o.push(vr(n[r])); - return o + for (var t, n = 0; n < e.length; ++n) e[n].marker.explicitlyCleared ? t || (t = e.slice(0, n)) : t && t.push(e[n]); + return t ? t.length ? t : null : e } - function wr(e, t) { - var n = Er(e, t), - o = Ge(e, t); - if (!n) return o; - if (!o) return n; - for (var r = 0; r < n.length; ++r) { - var i = n[r], - a = o[r]; - if (i && a) spans: for (var s = 0, d; s < a.length; ++s) { - d = a[s]; - for (var l = 0; l < i.length; ++l) - if (i[l].marker == d.marker) continue spans; - i.push(d) - } else a && (n[r] = a) + function Gi(e, t) { + var n = function (e, t) { + var n = t["spans_" + e.id]; + if (!n) return null; + for (var r = [], i = 0; i < t.text.length; ++i) r.push(ji(n[i])); + return r + }(e, t), + r = Tt(e, t); + if (!n) return r; + if (!r) return n; + for (var i = 0; i < n.length; ++i) { + var o = n[i], + s = r[i]; + if (o && s) e: for (var a = 0; a < s.length; ++a) { + for (var l = s[a], c = 0; c < o.length; ++c) + if (o[c].marker == l.marker) continue e; + o.push(l) + } else s && (n[i] = s) } return n } - function kr(e, t, n) { - for (var o = [], r = 0, i; r < e.length; ++r) { - if (i = e[r], i.ranges) { - o.push(n ? Bs.prototype.deepCopy.call(i) : i); - continue - } - var a = i.changes, - s = []; - o.push({ - changes: s - }); - for (var d = 0; d < a.length; ++d) { - var l = a[d], - c = void 0; - if (s.push({ - from: l.from, - to: l.to, - text: l.text - }), t) - for (var p in l)(c = p.match(/^spans_(\d+)$/)) && -1 < b(t, +c[1]) && (w(s)[p] = l[p], delete l[p]) + function $i(e, t, n) { + for (var r = [], i = 0; i < e.length; ++i) { + var o = e[i]; + if (o.ranges) r.push(n ? Ci.prototype.deepCopy.call(o) : o); + else { + var s = o.changes, + a = []; + r.push({ + changes: a + }); + for (var l = 0; l < s.length; ++l) { + var c = s[l], + u = void 0; + if (a.push({ + from: c.from, + to: c.to, + text: c.text + }), t) + for (var h in c)(u = h.match(/^spans_(\d+)$/)) && z(t, Number(u[1])) > -1 && (K(a)[h] = c[h], delete c[h]) + } } } - return o + return r } - function Tr(e, t, n, o) { - if (o) { - var r = e.anchor; + function qi(e, t, n, r) { + if (r) { + var i = e.anchor; if (n) { - var i = 0 > ge(t, r); - i == 0 > ge(n, r) ? i != 0 > ge(t, n) && (t = n) : (r = t, t = n) + var o = tt(t, i) < 0; + o != tt(n, i) < 0 ? (i = t, t = n) : o != tt(t, n) < 0 && (t = n) } - return new Ns(r, t) + return new Ei(i, t) } - return new Ns(n || t, t) - } - - function _r(e, t, n, o, r) { - null == r && (r = e.cm && (e.cm.display.shift || e.extend)), Ar(e, new Bs([Tr(e.sel.primary(), t, n, r)], 0), o) + return new Ei(n || t, t) } - function Rr(e, t, n) { - for (var o = [], r = e.cm && (e.cm.display.shift || e.extend), a = 0; a < e.sel.ranges.length; a++) o[a] = Tr(e.sel.ranges[a], t[a], null, r); - var i = $o(e.cm, o, e.sel.primIndex); - Ar(e, i, n) + function Ki(e, t, n, r, i) { + null == i && (i = e.cm && (e.cm.display.shift || e.extend)), Ji(e, new Ci([qi(e.sel.primary(), t, n, i)], 0), r) } - function xr(e, t, n, o) { - var r = e.sel.ranges.slice(0); - r[t] = n, Ar(e, $o(e.cm, r, e.sel.primIndex), o) + function Yi(e, t, n) { + for (var r = [], i = e.cm && (e.cm.display.shift || e.extend), o = 0; o < e.sel.ranges.length; o++) r[o] = qi(e.sel.ranges[o], t[o], null, i); + Ji(e, ki(e.cm, r, e.sel.primIndex), n) } - function Pr(e, t, n, o) { - Ar(e, Zo(t, n), o) + function Qi(e, t, n, r) { + var i = e.sel.ranges.slice(0); + i[t] = n, Ji(e, ki(e.cm, i, e.sel.primIndex), r) } - function Dr(e, t, n) { - var o = { - ranges: t.ranges, - update: function (t) { - var n = this; - this.ranges = []; - for (var o = 0; o < t.length; o++) n.ranges[o] = new Ns(Ee(e, t[o].anchor), Ee(e, t[o].head)) - }, - origin: n && n.origin - }; - return H(e, 'beforeSelectionChange', e, o), e.cm && H(e.cm, 'beforeSelectionChange', e.cm, o), o.ranges == t.ranges ? t : $o(e.cm, o.ranges, o.ranges.length - 1) + function Zi(e, t, n, r) { + Ji(e, xi(t, n), r) } - function Mr(e, t, n) { - var o = e.history.done, - r = w(o); - r && r.ranges ? (o[o.length - 1] = t, Ir(e, t, n)) : Ar(e, t, n) + function Xi(e, t, n) { + var r = e.history.done, + i = K(r); + i && i.ranges ? (r[r.length - 1] = t, eo(e, t, n)) : Ji(e, t, n) } - function Ar(e, t, n) { - Ir(e, t, n), Sr(e, e.sel, e.cm ? e.cm.curOp.id : NaN, n) + function Ji(e, t, n) { + eo(e, t, n), Ui(e, e.sel, e.cm ? e.cm.curOp.id : NaN, n) } - function Ir(e, t, n) { - (W(e, 'beforeSelectionChange') || e.cm && W(e.cm, 'beforeSelectionChange')) && (t = Dr(e, t, n)); - var o = n && n.bias || (0 > ge(t.primary().head, e.sel.primary().head) ? -1 : 1); - Lr(e, Br(e, t, o, !0)), !(n && !1 === n.scroll) && e.cm && ao(e.cm) + function eo(e, t, n) { + (ye(e, "beforeSelectionChange") || e.cm && ye(e.cm, "beforeSelectionChange")) && (t = function (e, t, n) { + var r = { + ranges: t.ranges, + update: function (t) { + this.ranges = []; + for (var n = 0; n < t.length; n++) this.ranges[n] = new Ei(at(e, t[n].anchor), at(e, t[n].head)) + }, + origin: n && n.origin + }; + return fe(e, "beforeSelectionChange", e, r), e.cm && fe(e.cm, "beforeSelectionChange", e.cm, r), r.ranges != t.ranges ? ki(e.cm, r.ranges, r.ranges.length - 1) : t + }(e, t, n)); + var r = n && n.bias || (tt(t.primary().head, e.sel.primary().head) < 0 ? -1 : 1); + to(e, ro(e, t, r, !0)), n && !1 === n.scroll || !e.cm || Mr(e.cm) } - function Lr(e, t) { - t.equals(e.sel) || (e.sel = t, e.cm && (e.cm.curOp.updateInput = 1, e.cm.curOp.selectionChanged = !0, U(e.cm)), xt(e, 'cursorActivity', e)) + function to(e, t) { + t.equals(e.sel) || (e.sel = t, e.cm && (e.cm.curOp.updateInput = 1, e.cm.curOp.selectionChanged = !0, ge(e.cm)), ln(e, "cursorActivity", e)) } - function Fr(e) { - Lr(e, Br(e, e.sel, null, !1)) + function no(e) { + to(e, ro(e, e.sel, null, !1)) } - function Br(e, t, n, o) { - for (var r = 0, i; r < t.ranges.length; r++) { - var a = t.ranges[r], - s = t.ranges.length == e.sel.ranges.length && e.sel.ranges[r], - d = Or(e, a.anchor, s && s.anchor, n, o), - l = Or(e, a.head, s && s.head, n, o); - (i || d != a.anchor || l != a.head) && (!i && (i = t.ranges.slice(0, r)), i[r] = new Ns(d, l)) + function ro(e, t, n, r) { + for (var i, o = 0; o < t.ranges.length; o++) { + var s = t.ranges[o], + a = t.ranges.length == e.sel.ranges.length && e.sel.ranges[o], + l = oo(e, s.anchor, a && a.anchor, n, r), + c = oo(e, s.head, a && a.head, n, r); + (i || l != s.anchor || c != s.head) && (i || (i = t.ranges.slice(0, o)), i[o] = new Ei(l, c)) } - return i ? $o(e.cm, i, t.primIndex) : t + return i ? ki(e.cm, i, t.primIndex) : t } - function Nr(e, t, n, o, r) { - var a = se(e, t.line); - if (a.markedSpans) - for (var s = 0; s < a.markedSpans.length; ++s) { - var i = a.markedSpans[s], - d = i.marker, - l = 'selectLeft' in d ? !d.selectLeft : d.inclusiveLeft, - c = 'selectRight' in d ? !d.selectRight : d.inclusiveRight; - if ((null == i.from || (l ? i.from <= t.ch : i.from < t.ch)) && (null == i.to || (c ? i.to >= t.ch : i.to > t.ch))) { - if (r && (H(d, 'beforeCursorEnter'), d.explicitlyCleared)) - if (!a.markedSpans) break; - else { + function io(e, t, n, r, i) { + var o = $e(e, t.line); + if (o.markedSpans) + for (var s = 0; s < o.markedSpans.length; ++s) { + var a = o.markedSpans[s], + l = a.marker, + c = "selectLeft" in l ? !l.selectLeft : l.inclusiveLeft, + u = "selectRight" in l ? !l.selectRight : l.inclusiveRight; + if ((null == a.from || (c ? a.from <= t.ch : a.from < t.ch)) && (null == a.to || (u ? a.to >= t.ch : a.to > t.ch))) { + if (i && (fe(l, "beforeCursorEnter"), l.explicitlyCleared)) { + if (o.markedSpans) { --s; continue - } if (!d.atomic) continue; + } + break + } + if (!l.atomic) continue; if (n) { - var p = d.find(0 > o ? 1 : -1), - u = void 0; - if ((0 > o ? c : l) && (p = Hr(e, p, -o, p && p.line == t.line ? a : null)), p && p.line == t.line && (u = ge(p, n)) && (0 > o ? 0 > u : 0 < u)) return Nr(e, p, t, o, r) + var h = l.find(r < 0 ? 1 : -1), + p = void 0; + if ((r < 0 ? u : c) && (h = so(e, h, -r, h && h.line == t.line ? o : null)), h && h.line == t.line && (p = tt(h, n)) && (r < 0 ? p < 0 : p > 0)) return io(e, h, t, r, i) } - var m = d.find(0 > o ? -1 : 1); - return (0 > o ? l : c) && (m = Hr(e, m, o, m.line == t.line ? a : null)), m ? Nr(e, m, t, o, r) : null + var d = l.find(r < 0 ? -1 : 1); + return (r < 0 ? c : u) && (d = so(e, d, r, d.line == t.line ? o : null)), d ? io(e, d, t, r, i) : null } } return t } - function Or(e, t, n, o, r) { - var i = o || 1, - a = Nr(e, t, n, i, r) || !r && Nr(e, t, n, i, !0) || Nr(e, t, n, -i, r) || !r && Nr(e, t, n, -i, !0); - return a ? a : (e.cantEdit = !0, fe(e.first, 0)) + function oo(e, t, n, r, i) { + var o = r || 1, + s = io(e, t, n, o, i) || !i && io(e, t, n, o, !0) || io(e, t, n, -o, i) || !i && io(e, t, n, -o, !0); + return s || (e.cantEdit = !0, et(e.first, 0)) } - function Hr(e, t, n, o) { - return 0 > n && 0 == t.ch ? t.line > e.first ? Ee(e, fe(t.line - 1)) : null : 0 < n && t.ch == (o || se(e, t.line)).text.length ? t.line < e.first + e.size - 1 ? fe(t.line + 1, 0) : null : new fe(t.line, t.ch + n) + function so(e, t, n, r) { + return n < 0 && 0 == t.ch ? t.line > e.first ? at(e, et(t.line - 1)) : null : n > 0 && t.ch == (r || $e(e, t.line)).text.length ? t.line < e.first + e.size - 1 ? et(t.line + 1, 0) : null : new et(t.line, t.ch + n) } - function zr(e) { - e.setSelection(fe(e.firstLine(), 0), fe(e.lastLine()), $a) + function ao(e) { + e.setSelection(et(e.firstLine(), 0), et(e.lastLine()), W) } - function Ur(e, t, n) { - var o = { + function lo(e, t, n) { + var r = { canceled: !1, from: t.from, to: t.to, text: t.text, origin: t.origin, cancel: function () { - return o.canceled = !0 + return r.canceled = !0 } }; - return n && (o.update = function (t, n, r, i) { - t && (o.from = Ee(e, t)), n && (o.to = Ee(e, n)), r && (o.text = r), void 0 !== i && (o.origin = i) - }), H(e, 'beforeChange', e, o), e.cm && H(e.cm, 'beforeChange', e.cm, o), o.canceled ? (e.cm && (e.cm.curOp.updateInput = 2), null) : { - from: o.from, - to: o.to, - text: o.text, - origin: o.origin + return n && (r.update = function (t, n, i, o) { + t && (r.from = at(e, t)), n && (r.to = at(e, n)), i && (r.text = i), void 0 !== o && (r.origin = o) + }), fe(e, "beforeChange", e, r), e.cm && fe(e.cm, "beforeChange", e.cm, r), r.canceled ? (e.cm && (e.cm.curOp.updateInput = 2), null) : { + from: r.from, + to: r.to, + text: r.text, + origin: r.origin } } - function Wr(e, t, n) { + function co(e, t, n) { if (e.cm) { - if (!e.cm.curOp) return xo(e.cm, Wr)(e, t, n); + if (!e.cm.curOp) return ei(e.cm, co)(e, t, n); if (e.cm.state.suppressEdits) return } - if (!((W(e, 'beforeChange') || e.cm && W(e.cm, 'beforeChange')) && (t = Ur(e, t, !0), !t))) { - var o = bs && !n && je(e, t.from, t.to); - if (o) - for (var r = o.length - 1; 0 <= r; --r) Vr(e, { - from: o[r].from, - to: o[r].to, - text: r ? [''] : t.text, + if (!(ye(e, "beforeChange") || e.cm && ye(e.cm, "beforeChange")) || (t = lo(e, t, !0))) { + var r = St && !n && function (e, t, n) { + var r = null; + if (e.iter(t.line, n.line + 1, (function (e) { + if (e.markedSpans) + for (var t = 0; t < e.markedSpans.length; ++t) { + var n = e.markedSpans[t].marker; + !n.readOnly || r && -1 != z(r, n) || (r || (r = [])).push(n) + } + })), !r) return null; + for (var i = [{ + from: t, + to: n + }], o = 0; o < r.length; ++o) + for (var s = r[o], a = s.find(0), l = 0; l < i.length; ++l) { + var c = i[l]; + if (!(tt(c.to, a.from) < 0 || tt(c.from, a.to) > 0)) { + var u = [l, 1], + h = tt(c.from, a.from), + p = tt(c.to, a.to); + (h < 0 || !s.inclusiveLeft && !h) && u.push({ + from: c.from, + to: a.from + }), (p > 0 || !s.inclusiveRight && !p) && u.push({ + from: a.to, + to: c.to + }), i.splice.apply(i, u), l += u.length - 3 + } + } + return i + }(e, t.from, t.to); + if (r) + for (var i = r.length - 1; i >= 0; --i) uo(e, { + from: r[i].from, + to: r[i].to, + text: i ? [""] : t.text, origin: t.origin }); - else Vr(e, t) + else uo(e, t) } } - function Vr(e, t) { - if (1 != t.text.length || '' != t.text[0] || 0 != ge(t.from, t.to)) { - var n = tr(e, t); - gr(e, t, n, e.cm ? e.cm.curOp.id : NaN), jr(e, t, n, Ge(e, t)); - var o = []; - dr(e, function (e, n) { - n || -1 != b(o, e.history) || ($r(e.history, t), o.push(e.history)), jr(e, t, null, Ge(e, t)) - }) + function uo(e, t) { + if (1 != t.text.length || "" != t.text[0] || 0 != tt(t.from, t.to)) { + var n = Di(e, t); + zi(e, t, n, e.cm ? e.cm.curOp.id : NaN), fo(e, t, n, Tt(e, t)); + var r = []; + Oi(e, (function (e, n) { + n || -1 != z(r, e.history) || (vo(e.history, t), r.push(e.history)), fo(e, t, null, Tt(e, t)) + })) } } - function Gr(e, t, n) { - var o = e.cm && e.cm.state.suppressEdits; - if (!o || n) { - for (var r = e.history, a = e.sel, s = 'undo' == t ? r.done : r.undone, d = 'undo' == t ? r.undone : r.done, l = 0, c; l < s.length && (c = s[l], n ? !c.ranges || c.equals(e.sel) : !!c.ranges); l++); - if (l != s.length) { - for (r.lastOrigin = r.lastSelOrigin = null;;) - if (c = s.pop(), c.ranges) { - if (Cr(c, d), n && !c.equals(e.sel)) return void Ar(e, c, { - clearRedo: !1 - }); - a = c - } else { - if (o) return void s.push(c); + function ho(e, t, n) { + var r = e.cm && e.cm.state.suppressEdits; + if (!r || n) { + for (var i, o = e.history, s = e.sel, a = "undo" == t ? o.done : o.undone, l = "undo" == t ? o.undone : o.done, c = 0; c < a.length && (i = a[c], n ? !i.ranges || i.equals(e.sel) : i.ranges); c++); + if (c != a.length) { + for (o.lastOrigin = o.lastSelOrigin = null;;) { + if (!(i = a.pop()).ranges) { + if (r) return void a.push(i); break - } var p = []; - Cr(a, d), d.push({ - changes: p, - generation: r.generation - }), r.generation = c.generation || ++r.maxGeneration; - for (var u = W(e, 'beforeChange') || e.cm && W(e.cm, 'beforeChange'), i = function (n) { - var o = c.changes[n]; - if (o.origin = t, u && !Ur(e, o, !1)) return s.length = 0, {}; - p.push(mr(e, o)); - var r = n ? tr(e, o) : w(s); - jr(e, o, r, wr(e, o)), !n && e.cm && e.cm.scrollIntoView({ - from: o.from, - to: Jo(o) + } + if (Wi(i, l), n && !i.equals(e.sel)) return void Ji(e, i, { + clearRedo: !1 + }); + s = i + } + var u = []; + Wi(s, l), l.push({ + changes: u, + generation: o.generation + }), o.generation = i.generation || ++o.maxGeneration; + for (var h = ye(e, "beforeChange") || e.cm && ye(e.cm, "beforeChange"), p = function (n) { + var r = i.changes[n]; + if (r.origin = t, h && !lo(e, r, !1)) return a.length = 0, {}; + u.push(Bi(e, r)); + var o = n ? Di(e, r) : K(a); + fo(e, r, o, Gi(e, r)), !n && e.cm && e.cm.scrollIntoView({ + from: r.from, + to: Ti(r) }); - var a = []; - dr(e, function (e, t) { - t || -1 != b(a, e.history) || ($r(e.history, o), a.push(e.history)), jr(e, o, null, wr(e, o)) - }) - }, m = c.changes.length - 1, h; 0 <= m; --m) - if (h = i(m), h) return h.v + var s = []; + Oi(e, (function (e, t) { + t || -1 != z(s, e.history) || (vo(e.history, r), s.push(e.history)), fo(e, r, null, Gi(e, r)) + })) + }, d = i.changes.length - 1; d >= 0; --d) { + var f = p(d); + if (f) return f.v + } } } } - function Kr(e, t) { - if (0 != t && (e.first += t, e.sel = new Bs(k(e.sel.ranges, function (e) { - return new Ns(fe(e.anchor.line + t, e.anchor.ch), fe(e.head.line + t, e.head.ch)) - }), e.sel.primIndex), e.cm)) { - Bn(e.cm, e.first, e.first - t, t); - for (var n = e.cm.display, o = n.viewFrom; o < n.viewTo; o++) Nn(e.cm, o, 'gutter') + function po(e, t) { + if (0 != t && (e.first += t, e.sel = new Ci(Y(e.sel.ranges, (function (e) { + return new Ei(et(e.anchor.line + t, e.anchor.ch), et(e.head.line + t, e.head.ch)) + })), e.sel.primIndex), e.cm)) { + hr(e.cm, e.first, e.first - t, t); + for (var n = e.cm.display, r = n.viewFrom; r < n.viewTo; r++) pr(e.cm, r, "gutter") } } - function jr(e, t, n, o) { - if (e.cm && !e.cm.curOp) return xo(e.cm, jr)(e, t, n, o); - if (t.to.line < e.first) return void Kr(e, t.text.length - 1 - (t.to.line - t.from.line)); - if (!(t.from.line > e.lastLine())) { + function fo(e, t, n, r) { + if (e.cm && !e.cm.curOp) return ei(e.cm, fo)(e, t, n, r); + if (t.to.line < e.first) po(e, t.text.length - 1 - (t.to.line - t.from.line)); + else if (!(t.from.line > e.lastLine())) { if (t.from.line < e.first) { - var r = t.text.length - 1 - (e.first - t.from.line); - Kr(e, r), t = { - from: fe(e.first, 0), - to: fe(t.to.line + r, t.to.ch), - text: [w(t.text)], + var i = t.text.length - 1 - (e.first - t.from.line); + po(e, i), t = { + from: et(e.first, 0), + to: et(t.to.line + i, t.to.ch), + text: [K(t.text)], origin: t.origin } } - var i = e.lastLine(); - t.to.line > i && (t = { + var o = e.lastLine(); + t.to.line > o && (t = { from: t.from, - to: fe(i, se(e, i).text.length), + to: et(o, $e(e, o).text.length), text: [t.text[0]], origin: t.origin - }), t.removed = de(e, t.from, t.to), n || (n = tr(e, t)), e.cm ? qr(e.cm, t, o) : sr(e, t, o), Ir(e, n, $a), e.cantEdit && Or(e, fe(e.firstLine(), 0)) && (e.cantEdit = !1) - } - } - - function qr(e, t, n) { - var o = e.doc, - r = e.display, - i = t.from, - a = t.to, - s = !1, - d = i.line; - e.options.lineWrapping || (d = pe(ot(se(o, i.line))), o.iter(d, a.line + 1, function (e) { - if (e == r.maxLine) return s = !0, !0 - })), -1 < o.sel.contains(t.from, t.to) && U(e), sr(o, t, n, An(e)), e.options.lineWrapping || (o.iter(d, i.line + t.text.length, function (e) { - var t = pt(e); - t > r.maxLineLength && (r.maxLine = e, r.maxLineLength = t, r.maxLineChanged = !0, s = !1) - }), s && (e.curOp.updateMaxLine = !0)), Fe(o, i.line), Mo(e, 400); - var l = t.text.length - (a.line - i.line) - 1; - t.full ? Bn(e) : i.line != a.line || 1 != t.text.length || ar(e.doc, t) ? Bn(e, i.line, a.line + 1, l) : Nn(e, i.line, 'text'); - var c = W(e, 'changes'), - p = W(e, 'change'); - if (p || c) { - var u = { - from: i, - to: a, - text: t.text, - removed: t.removed, - origin: t.origin - }; - p && xt(e, 'change', e, u), c && (e.curOp.changeObjs || (e.curOp.changeObjs = [])).push(u) + }), t.removed = qe(e, t.from, t.to), n || (n = Di(e, t)), e.cm ? function (e, t, n) { + var r = e.doc, + i = e.display, + o = t.from, + s = t.to, + a = !1, + l = o.line; + e.options.lineWrapping || (l = Qe(Bt($e(r, o.line))), r.iter(l, s.line + 1, (function (e) { + if (e == i.maxLine) return a = !0, !0 + }))), r.sel.contains(t.from, t.to) > -1 && ge(e), Ii(r, t, n, ar(e)), e.options.lineWrapping || (r.iter(l, o.line + t.text.length, (function (e) { + var t = jt(e); + t > i.maxLineLength && (i.maxLine = e, i.maxLineLength = t, i.maxLineChanged = !0, a = !1) + })), a && (e.curOp.updateMaxLine = !0)), + function (e, t) { + if (e.modeFrontier = Math.min(e.modeFrontier, t), !(e.highlightFrontier < t - 10)) { + for (var n = e.first, r = t - 1; r > n; r--) { + var i = $e(e, r).stateAfter; + if (i && (!(i instanceof ct) || r + i.lookAhead < t)) { + n = r + 1; + break + } + } + e.highlightFrontier = Math.min(e.highlightFrontier, n) + } + }(r, o.line), ri(e, 400); + var c = t.text.length - (s.line - o.line) - 1; + t.full ? hr(e) : o.line != s.line || 1 != t.text.length || Pi(e.doc, t) ? hr(e, o.line, s.line + 1, c) : pr(e, o.line, "text"); + var u = ye(e, "changes"), + h = ye(e, "change"); + if (h || u) { + var p = { + from: o, + to: s, + text: t.text, + removed: t.removed, + origin: t.origin + }; + h && ln(e, "change", e, p), u && (e.curOp.changeObjs || (e.curOp.changeObjs = [])).push(p) + } + e.display.selForContextMenu = null + }(e.cm, t, r) : Ii(e, t, r), eo(e, n, W), e.cantEdit && oo(e, et(e.firstLine(), 0)) && (e.cantEdit = !1) } - e.display.selForContextMenu = null } - function Yr(e, t, n, o, r) { - var i; - o || (o = n), 0 > ge(o, n) && (i = [o, n], n = i[0], o = i[1]), 'string' == typeof t && (t = e.splitLines(t)), Wr(e, { + function mo(e, t, n, r, i) { + var o; + r || (r = n), tt(r, n) < 0 && (n = (o = [r, n])[0], r = o[1]), "string" == typeof t && (t = e.splitLines(t)), co(e, { from: n, - to: o, + to: r, text: t, - origin: r + origin: i }) } - function Xr(e, t, n, o) { - n < e.line ? e.line += o : t < e.line && (e.line = t, e.ch = 0) + function go(e, t, n, r) { + n < e.line ? e.line += r : t < e.line && (e.line = t, e.ch = 0) } - function Qr(e, t, n, o) { - for (var r = 0; r < e.length; ++r) { - var i = e[r], - a = !0; - if (i.ranges) { - i.copied || (i = e[r] = i.deepCopy(), i.copied = !0); - for (var s = 0; s < i.ranges.length; s++) Xr(i.ranges[s].anchor, t, n, o), Xr(i.ranges[s].head, t, n, o); - continue - } - for (var d = 0, l; d < i.changes.length; ++d) - if (l = i.changes[d], n < l.from.line) l.from = fe(l.from.line + o, l.from.ch), l.to = fe(l.to.line + o, l.to.ch); - else if (t <= l.to.line) { - a = !1; - break + function yo(e, t, n, r) { + for (var i = 0; i < e.length; ++i) { + var o = e[i], + s = !0; + if (o.ranges) { + o.copied || ((o = e[i] = o.deepCopy()).copied = !0); + for (var a = 0; a < o.ranges.length; a++) go(o.ranges[a].anchor, t, n, r), go(o.ranges[a].head, t, n, r) + } else { + for (var l = 0; l < o.changes.length; ++l) { + var c = o.changes[l]; + if (n < c.from.line) c.from = et(c.from.line + r, c.from.ch), c.to = et(c.to.line + r, c.to.ch); + else if (t <= c.to.line) { + s = !1; + break + } + } + s || (e.splice(0, i + 1), i = 0) } - a || (e.splice(0, r + 1), r = 0) } } - function $r(e, t) { + function vo(e, t) { var n = t.from.line, - o = t.to.line, - r = t.text.length - (o - n) - 1; - Qr(e.done, n, o, r), Qr(e.undone, n, o, r) + r = t.to.line, + i = t.text.length - (r - n) - 1; + yo(e.done, n, r, i), yo(e.undone, n, r, i) } - function Zr(e, t, n, o) { - var r = t, - i = t; - return ('number' == typeof t ? i = se(e, ve(e, t)) : r = pe(t), null == r) ? null : (o(i, r) && e.cm && Nn(e.cm, r, n), i) + function wo(e, t, n, r) { + var i = t, + o = t; + return "number" == typeof t ? o = $e(e, st(e, t)) : i = Qe(t), null == i ? null : (r(o, i) && e.cm && pr(e.cm, i, n), o) } - function Jr(e) { - var t = this; + function bo(e) { this.lines = e, this.parent = null; - for (var n = 0, o = 0; o < e.length; ++o) e[o].parent = t, n += e[o].height; - this.height = n + for (var t = 0, n = 0; n < e.length; ++n) e[n].parent = this, t += e[n].height; + this.height = t } - function ei(e) { - var t = this; + function So(e) { this.children = e; - for (var n = 0, o = 0, r = 0, i; r < e.length; ++r) i = e[r], n += i.chunkSize(), o += i.height, i.parent = t; - this.size = n, this.height = o, this.parent = null - } - - function ti(e, t, n) { - ct(t) < (e.curOp && e.curOp.scrollTop || e.doc.scrollTop) && io(e, n) - } - - function ni(e, t, n, o) { - var i = new Os(e, n, o), - a = e.cm; - return a && i.noHScroll && (a.display.alignWidgets = !0), Zr(e, t, 'widget', function (t) { - var n = t.widgets || (t.widgets = []); - if (null == i.insertAt ? n.push(i) : n.splice(d(n.length - 1, r(0, i.insertAt)), 0, i), i.line = t, a && !dt(e, t)) { - var o = ct(t) < e.scrollTop; - ce(t, t.height + Wt(i)), o && io(a, i.height), a.curOp.forceUpdate = !0 - } - return !0 - }), a && xt(a, 'lineWidgetAdded', a, i, 'number' == typeof t ? t : pe(t)), i - } - - function oi(e, t, n, o, r) { - if (o && o.shared) return ri(e, t, n, o, r); - if (e.cm && !e.cm.curOp) return xo(e.cm, oi)(e, t, n, o, r); - var a = new zs(e, r), - s = ge(t, n); - if (o && S(o, a, !1), 0 < s || 0 == s && !1 !== a.clearWhenEmpty) return a; - if (a.replacedWith && (a.collapsed = !0, a.widgetNode = u('span', [a.replacedWith], 'CodeMirror-widget'), !o.handleMouseEvents && a.widgetNode.setAttribute('cm-ignore-events', 'true'), o.insertLeft && (a.widgetNode.insertLeft = !0)), a.collapsed) { - if (nt(e, t.line, t, n, a) || t.line != n.line && nt(e, n.line, t, n, a)) throw new Error('Inserting collapsed marker partially overlapping an existing one'); - Ne() + for (var t = 0, n = 0, r = 0; r < e.length; ++r) { + var i = e[r]; + t += i.chunkSize(), n += i.height, i.parent = this } - a.addToHistory && gr(e, { - from: t, - to: n, - origin: 'markText' - }, e.sel, NaN); - var d = t.line, - l = e.cm, - c; - if (e.iter(d, n.line + 1, function (e) { - l && a.collapsed && !l.options.lineWrapping && ot(e) == l.display.maxLine && (c = !0), a.collapsed && d != t.line && ce(e, 0), Ue(e, new Oe(a, d == t.line ? t.ch : null, d == n.line ? n.ch : null)), ++d - }), a.collapsed && e.iter(t.line, n.line + 1, function (t) { - dt(e, t) && ce(t, 0) - }), a.clearOnEnter && as(a, 'beforeCursorEnter', function () { - return a.clear() - }), a.readOnly && (Be(), (e.history.done.length || e.history.undone.length) && e.clearHistory()), a.collapsed && (a.id = ++Hs, a.atomic = !0), l) { - if (c && (l.curOp.updateMaxLine = !0), a.collapsed) Bn(l, t.line, n.line + 1); - else if (a.className || a.startStyle || a.endStyle || a.css || a.attributes || a.title) - for (var p = t.line; p <= n.line; p++) Nn(l, p, 'text'); - a.atomic && Fr(l.doc), xt(l, 'markerAdded', l, a) - } - return a - } - - function ri(e, t, n, o, r) { - o = S(o), o.shared = !1; - var a = [oi(e, t, n, o, r)], - s = a[0], - d = o.widgetNode; - return dr(e, function (e) { - d && (o.widgetNode = d.cloneNode(!0)), a.push(oi(e, Ee(e, t), Ee(e, n), o, r)); - for (var l = 0; l < e.linked.length; ++l) - if (e.linked[l].isParent) return; - s = w(a) - }), new Us(a, s) - } - - function ii(e) { - return e.findMarks(fe(e.first, 0), e.clipPos(fe(e.lastLine())), function (e) { - return e.parent - }) + this.size = t, this.height = n, this.parent = null } - - function ai(e, t) { - for (var n = 0; n < t.length; n++) { - var o = t[n], - r = o.find(), - i = e.clipPos(r.from), - a = e.clipPos(r.to); - if (ge(i, a)) { - var s = oi(e, i, a, o.primary, o.primary.type); - o.markers.push(s), s.parent = o + Ei.prototype.from = function () { + return ot(this.anchor, this.head) + }, Ei.prototype.to = function () { + return it(this.anchor, this.head) + }, Ei.prototype.empty = function () { + return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch + }, bo.prototype = { + chunkSize: function () { + return this.lines.length + }, + removeInner: function (e, t) { + for (var n = e, r = e + t; n < r; ++n) { + var i = this.lines[n]; + this.height -= i.height, qt(i), ln(i, "delete") } + this.lines.splice(e, t) + }, + collapse: function (e) { + e.push.apply(e, this.lines) + }, + insertInner: function (e, t, n) { + this.height += n, this.lines = this.lines.slice(0, e).concat(t).concat(this.lines.slice(e)); + for (var r = 0; r < t.length; ++r) t[r].parent = this + }, + iterN: function (e, t, n) { + for (var r = e + t; e < r; ++e) + if (n(this.lines[e])) return !0 } - } - - function si(e) { - for (var t = function (t) { - var n = e[t], - o = [n.primary.doc]; - dr(n.primary.doc, function (e) { - return o.push(e) - }); - for (var r = 0, i; r < n.markers.length; r++) i = n.markers[r], -1 == b(o, i.doc) && (i.parent = null, n.markers.splice(r--, 1)) - }, n = 0; n < e.length; n++) t(n) - } - - function di(t) { - var e = this; - if (pi(e), !(z(e, t) || Vt(e.display, t))) { - G(t), Ra && (Gs = +new Date); - var o = Ln(e, t, !0), - r = t.dataTransfer.files; - if (o && !e.isReadOnly()) - if (r && r.length && window.FileReader && window.File) - for (var a = r.length, n = Array(a), s = 0, d = function (t, r) { - if (!(e.options.allowDropFileTypes && -1 == b(e.options.allowDropFileTypes, t.type))) { - var i = new FileReader; - i.onload = xo(e, function () { - var t = i.result; - if (/[\x00-\x08\x0e-\x1f]{2}/.test(t) && (t = ''), n[r] = t, ++s == a) { - o = Ee(e.doc, o); - var d = { - from: o, - to: o, - text: e.doc.splitLines(n.join(e.doc.lineSeparator())), - origin: 'paste' - }; - Wr(e.doc, d), Mr(e.doc, Zo(o, Jo(d))) - } - }), i.readAsText(t) - } - }, l = 0; l < a; ++l) d(r[l], l); - else { - if (e.state.draggingText && -1 < e.doc.sel.contains(o)) return e.state.draggingText(t), void setTimeout(function () { - return e.display.input.focus() - }, 20); - try { - var i = t.dataTransfer.getData('Text'); - if (i) { - var c; - if (e.state.draggingText && !e.state.draggingText.copy && (c = e.listSelections()), Ir(e.doc, Zo(o, o)), c) - for (var p = 0; p < c.length; ++p) Yr(e.doc, '', c[p].anchor, c[p].head, 'drag'); - e.replaceSelection(i, 'around', 'paste'), e.display.input.focus() + }, So.prototype = { + chunkSize: function () { + return this.size + }, + removeInner: function (e, t) { + this.size -= t; + for (var n = 0; n < this.children.length; ++n) { + var r = this.children[n], + i = r.chunkSize(); + if (e < i) { + var o = Math.min(t, i - e), + s = r.height; + if (r.removeInner(e, o), this.height -= s - r.height, i == o && (this.children.splice(n--, 1), r.parent = null), 0 == (t -= o)) break; + e = 0 + } else e -= i + } + if (this.size - t < 25 && (this.children.length > 1 || !(this.children[0] instanceof bo))) { + var a = []; + this.collapse(a), this.children = [new bo(a)], this.children[0].parent = this + } + }, + collapse: function (e) { + for (var t = 0; t < this.children.length; ++t) this.children[t].collapse(e) + }, + insertInner: function (e, t, n) { + this.size += t.length, this.height += n; + for (var r = 0; r < this.children.length; ++r) { + var i = this.children[r], + o = i.chunkSize(); + if (e <= o) { + if (i.insertInner(e, t, n), i.lines && i.lines.length > 50) { + for (var s = i.lines.length % 25 + 25, a = s; a < i.lines.length;) { + var l = new bo(i.lines.slice(a, a += 25)); + i.height -= l.height, this.children.splice(++r, 0, l), l.parent = this } - } catch (t) {} - } - } - } - - function li(t, n) { - if (Ra && (!t.state.draggingText || 100 > +new Date - Gs)) return void q(n); - if (!(z(t, n) || Vt(t.display, n)) && (n.dataTransfer.setData('Text', t.getSelection()), n.dataTransfer.effectAllowed = 'copyMove', n.dataTransfer.setDragImage && !Ia)) { - var e = p('img', null, null, 'position: fixed; left: 0; top: 0;'); - e.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==', Aa && (e.width = e.height = 1, t.display.wrapper.appendChild(e), e._top = e.offsetTop), n.dataTransfer.setDragImage(e, 0, 0), Aa && e.parentNode.removeChild(e) - } - } - - function ci(t, n) { - var e = Ln(t, n); - if (e) { - var o = document.createDocumentFragment(); - Gn(t, e, o), t.display.dragCursor || (t.display.dragCursor = p('div', null, 'CodeMirror-cursors CodeMirror-dragcursors'), t.display.lineSpace.insertBefore(t.display.dragCursor, t.display.cursorDiv)), c(t.display.dragCursor, o) - } - } - - function pi(e) { - e.display.dragCursor && (e.display.lineSpace.removeChild(e.display.dragCursor), e.display.dragCursor = null) - } - - function ui(e) { - if (document.getElementsByClassName) { - for (var t = document.getElementsByClassName('CodeMirror'), n = [], o = 0, r; o < t.length; o++) r = t[o].CodeMirror, r && n.push(r); - n.length && n[0].operation(function () { - for (var t = 0; t < n.length; t++) e(n[t]) - }) - } - } - - function mi() { - Ks || (hi(), Ks = !0) - } - - function hi() { - var e; - as(window, 'resize', function () { - null == e && (e = setTimeout(function () { - e = null, ui(fi) - }, 100)) - }), as(window, 'blur', function () { - return ui($n) - }) - } - - function fi(e) { - var t = e.display; - t.cachedCharWidth = t.cachedTextHeight = t.cachedPaddingH = null, t.scrollbarsClipped = !1, e.setSize() - } - - function gi(e) { - var t = e.split(/-(?!$)/); - e = t[t.length - 1]; - for (var n = 0, o, r, i, a, s; n < t.length - 1; n++) - if (s = t[n], /^(cmd|meta|m)$/i.test(s)) a = !0; - else if (/^a(lt)?$/i.test(s)) o = !0; - else if (/^(c|ctrl|control)$/i.test(s)) r = !0; - else if (/^s(hift)?$/i.test(s)) i = !0; - else throw new Error('Unrecognized modifier name: ' + s); - return o && (e = 'Alt-' + e), r && (e = 'Ctrl-' + e), a && (e = 'Cmd-' + e), i && (e = 'Shift-' + e), e - } - - function yi(e) { - var t = {}; - for (var n in e) - if (e.hasOwnProperty(n)) { - var o = e[n]; - if (/^(name|fallthrough|(de|at)tach)$/.test(n)) continue; - if ('...' == o) { - delete e[n]; - continue - } - for (var r = k(n.split(' '), gi), a = 0; a < r.length; a++) { - var i = void 0, - s = void 0; - a == r.length - 1 ? (s = r.join(' '), i = o) : (s = r.slice(0, a + 1).join(' '), i = '...'); - var d = t[s]; - if (!d) t[s] = i; - else if (d != i) throw new Error('Inconsistent bindings for ' + s) - } - delete e[n] - } for (var l in t) e[l] = t[l]; - return e - } - - function Si(e, t, n, o) { - t = Ei(t); - var r = t.call ? t.call(e, o) : t[e]; - if (!1 === r) return 'nothing'; - if ('...' === r) return 'multi'; - if (null != r && n(r)) return 'handled'; - if (t.fallthrough) { - if ('[object Array]' != Object.prototype.toString.call(t.fallthrough)) return Si(e, t.fallthrough, n, o); - for (var a = 0, i; a < t.fallthrough.length; a++) - if (i = Si(e, t.fallthrough[a], n, o), i) return i - } - } - - function Ci(e) { - var t = 'string' == typeof e ? e : js[e.keyCode]; - return 'Ctrl' == t || 'Alt' == t || 'Shift' == t || 'Mod' == t - } - - function bi(e, t, n) { - var o = e; - return t.altKey && 'Alt' != o && (e = 'Alt-' + e), (Va ? t.metaKey : t.ctrlKey) && 'Ctrl' != o && (e = 'Ctrl-' + e), (Va ? t.ctrlKey : t.metaKey) && 'Cmd' != o && (e = 'Cmd-' + e), !n && t.shiftKey && 'Shift' != o && (e = 'Shift-' + e), e - } - - function vi(e, t) { - if (Aa && 34 == e.keyCode && e.char) return !1; - var n = js[e.keyCode]; - return !(null == n || e.altGraphKey) && (3 == e.keyCode && e.code && (n = e.code), bi(n, e, t)) - } - - function Ei(e) { - return 'string' == typeof e ? Xs[e] : e - } - - function wi(e, t) { - for (var n = e.doc.sel.ranges, o = [], r = 0, i; r < n.length; r++) { - for (i = t(n[r]); o.length && 0 >= ge(i.from, w(o).to);) { - var a = o.pop(); - if (0 > ge(a.from, i.from)) { - i.from = a.from; + i.lines = i.lines.slice(0, s), this.maybeSpill() + } break } + e -= o } - o.push(i) - } - Ro(e, function () { - for (var t = o.length - 1; 0 <= t; t--) Yr(e.doc, '', o[t].from, o[t].to, '+delete'); - ao(e) - }) - } - - function ki(e, t, n) { - var o = A(e.text, t + n, n); - return 0 > o || o > e.text.length ? null : o - } - - function Ti(e, t, n) { - var o = ki(e, t.ch, n); - return null == o ? null : new fe(t.line, o, 0 > n ? 'after' : 'before') - } - - function _i(e, t, n, o, r) { - if (e) { - var i = B(n, t.doc.direction); - if (i) { - var a = 0 > r ? w(i) : i[0], - s = 0 > r == (1 == a.level), - d = s ? 'after' : 'before', - l; - if (0 < a.level || 'rtl' == t.doc.direction) { - var c = tn(t, n); - l = 0 > r ? n.text.length - 1 : 0; - var p = nn(t, c, l).top; - l = I(function (e) { - return nn(t, c, e).top == p - }, 0 > r == (1 == a.level) ? a.from : a.to - 1, l), 'before' == d && (l = ki(n, l, 1)) - } else l = 0 > r ? a.to : a.from; - return new fe(o, l, d) - } - } - return new fe(o, 0 > r ? n.text.length : 0, 0 > r ? 'before' : 'after') - } - - function Ri(e, t, n, o) { - var r = B(t, e.doc.direction); - if (!r) return Ti(t, n, o); - n.ch >= t.text.length ? (n.ch = t.text.length, n.sticky = 'before') : 0 >= n.ch && (n.ch = 0, n.sticky = 'after'); - var i = F(r, n.ch, n.sticky), - a = r[i]; - if ('ltr' == e.doc.direction && 0 == a.level % 2 && (0 < o ? a.to > n.ch : a.from < n.ch)) return Ti(t, n, o); - var s = function (e, n) { - return ki(t, e instanceof fe ? e.ch : e, n) - }, - d = function (n) { - return e.options.lineWrapping ? (c = c || tn(e, t), wn(e, t, c, n)) : { - begin: 0, - end: t.text.length - } - }, - l = d('before' == n.sticky ? s(n, -1) : n.ch), - c; - if ('rtl' == e.doc.direction || 1 == a.level) { - var p = 1 == a.level == 0 > o, - u = s(n, p ? 1 : -1); - if (null != u && (p ? u <= a.to && u <= l.end : u >= a.from && u >= l.begin)) { - var m = p ? 'before' : 'after'; - return new fe(n.line, u, m) - } - } - var h = function (e, t, o) { - for (var i = function (e, t) { - return t ? new fe(n.line, s(e, 1), 'before') : new fe(n.line, e, 'after') - }; 0 <= e && e < r.length; e += t) { - var a = r[e], - d = 0 < t == (1 != a.level), - l = d ? o.begin : s(o.end, -1); - if (a.from <= l && l < a.to) return i(l, d); - if (l = d ? a.from : s(a.to, -1), o.begin <= l && l < o.end) return i(l, d) - } - }, - f = h(i + o, o, l); - if (f) return f; - var g = 0 < o ? l.end : s(l.begin, -1); - return null != g && !(0 < o && g == t.text.length) && (f = h(0 < o ? 0 : r.length - 1, o, d(g)), f) ? f : null - } - - function xi(e, t) { - var n = se(e.doc, t), - o = ot(n); - return o != n && (t = pe(o)), _i(!0, e, o, t, 1) - } - - function Pi(e, t) { - var n = se(e.doc, t), - o = rt(n); - return o != n && (t = pe(o)), _i(!0, e, n, t, -1) - } - - function Di(e, t) { - var n = xi(e, t.line), - o = se(e.doc, n.line), - i = B(o, e.doc.direction); - if (!i || 0 == i[0].level) { - var a = r(0, o.text.search(/\S/)), - s = t.line == n.line && t.ch <= a && t.ch; - return fe(n.line, s ? 0 : a, n.sticky) - } - return n - } - - function Mi(e, t, n) { - if ('string' == typeof t && (t = Qs[t], !t)) return !1; - e.display.input.ensurePolled(); - var o = e.display.shift, - r = !1; - try { - e.isReadOnly() && (e.state.suppressEdits = !0), n && (e.display.shift = !1), r = t(e) != Qa - } finally { - e.display.shift = o, e.state.suppressEdits = !1 - } - return r - } - - function Ai(e, t, n) { - for (var o = 0, r; o < e.state.keyMaps.length; o++) - if (r = Si(t, e.state.keyMaps[o], n, e), r) return r; - return e.options.extraKeys && Si(t, e.options.extraKeys, n, e) || Si(t, e.options.keyMap, n, e) - } - - function Ii(t, n, o, e) { - var r = t.state.keySeq; - if (r) { - if (Ci(n)) return 'handled'; - if (/\'$/.test(n) ? t.state.keySeq = null : $s.set(50, function () { - t.state.keySeq == r && (t.state.keySeq = null, t.display.input.reset()) - }), Li(t, r + ' ' + n, o, e)) return !0 - } - return Li(t, n, o, e) - } - - function Li(t, n, o, e) { - var r = Ai(t, n, e); - return 'multi' == r && (t.state.keySeq = n), 'handled' == r && xt(t, 'keyHandled', t, n, o), ('handled' == r || 'multi' == r) && (G(o), qn(t)), !!r - } - - function Fi(t, n) { - var e = vi(n, !0); - return !!e && (n.shiftKey && !t.state.keySeq ? Ii(t, 'Shift-' + e, n, function (e) { - return Mi(t, e, !0) - }) || Ii(t, e, n, function (e) { - if ('string' == typeof e ? /^go[A-Z]/.test(e) : e.motion) return Mi(t, e) - }) : Ii(t, e, n, function (e) { - return Mi(t, e) - })) - } - - function Bi(t, n, e) { - return Ii(t, '\'' + e + '\'', n, function (e) { - return Mi(t, e, !0) - }) - } - - function Ni(t) { - var e = this; - if (e.curOp.focus = h(), !z(e, t)) { - Ra && 11 > xa && 27 == t.keyCode && (t.returnValue = !1); - var n = t.keyCode; - e.display.shift = 16 == n || t.shiftKey; - var o = Fi(e, t); - Aa && (Zs = o ? n : null, !o && 88 == n && !ls && (Ha ? t.metaKey : t.ctrlKey) && e.replaceSelection('', null, 'cut')), 18 != n || /\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className) || Oi(e) - } - } - - function Oi(e) { - function t(o) { - 18 != o.keyCode && o.altKey || (Ka(n, 'CodeMirror-crosshair'), O(document, 'keyup', t), O(document, 'mouseover', t)) - } - var n = e.display.lineDiv; - f(n, 'CodeMirror-crosshair'), as(document, 'keyup', t), as(document, 'mouseover', t) - } - - function Hi(t) { - 16 == t.keyCode && (this.doc.sel.shift = !1), z(this, t) - } - - function zi(n) { - var e = this; - if (!(Vt(e.display, n) || z(e, n) || n.ctrlKey && !n.altKey || Ha && n.metaKey)) { - var o = n.keyCode, - r = n.charCode; - if (Aa && o == Zs) return Zs = null, void G(n); - if (!(Aa && (!n.which || 10 > n.which) && Fi(e, n))) { - var i = t(null == r ? o : r); - '\b' == i || Bi(e, n, i) || e.display.input.onKeyPress(n) + }, + maybeSpill: function () { + if (!(this.children.length <= 10)) { + var e = this; + do { + var t = new So(e.children.splice(e.children.length - 5, 5)); + if (e.parent) { + e.size -= t.size, e.height -= t.height; + var n = z(e.parent.children, e); + e.parent.children.splice(n + 1, 0, t) + } else { + var r = new So(e.children); + r.parent = e, e.children = [r, t], e = r + } + t.parent = e.parent + } while (e.children.length > 10); + e.parent.maybeSpill() } - } - } - - function Ui(e, t) { - var n = +new Date; - return rd && rd.compare(n, e, t) ? (od = rd = null, 'triple') : od && od.compare(n, e, t) ? (rd = new Js(n, e, t), od = null, 'double') : (od = new Js(n, e, t), rd = null, 'single') - } - - function Wi(t) { - var e = this, - n = e.display; - if (!(z(e, t) || n.activeTouch && n.input.supportsTouch())) { - if (n.input.ensurePolled(), n.shift = t.shiftKey, Vt(n, t)) return void(Pa || (n.scroller.draggable = !1, setTimeout(function () { - return n.scroller.draggable = !0 - }, 100))); - if (!$i(e, t)) { - var o = Ln(e, t), - r = X(t), - i = o ? Ui(o, r) : 'single'; - window.focus(), 1 == r && e.state.selectingText && e.state.selectingText(t), o && Vi(e, r, o, i, t) || (1 == r ? o ? Ki(e, o, i, t) : Y(t) == n.scroller && G(t) : 2 == r ? (o && _r(e.doc, o), setTimeout(function () { - return n.input.focus() - }, 20)) : 3 == r && (Ga ? e.display.input.onContextMenu(t) : Xn(e))) + }, + iterN: function (e, t, n) { + for (var r = 0; r < this.children.length; ++r) { + var i = this.children[r], + o = i.chunkSize(); + if (e < o) { + var s = Math.min(t, o - e); + if (i.iterN(e, s, n)) return !0; + if (0 == (t -= s)) break; + e = 0 + } else e -= o } } - } + }; + var Co = function (e, t, n) { + if (n) + for (var r in n) n.hasOwnProperty(r) && (this[r] = n[r]); + this.doc = e, this.node = t + }; - function Vi(e, t, n, o, r) { - var i = 'Click'; - return 'double' == o ? i = 'Double' + i : 'triple' == o && (i = 'Triple' + i), i = (1 == t ? 'Left' : 2 == t ? 'Middle' : 'Right') + i, Ii(e, bi(i, r), r, function (t) { - if ('string' == typeof t && (t = Qs[t]), !t) return !1; - var o = !1; - try { - e.isReadOnly() && (e.state.suppressEdits = !0), o = t(e, n) != Qa - } finally { - e.state.suppressEdits = !1 - } - return o - }) - } + function Eo(e, t, n) { + Vt(t) < (e.curOp && e.curOp.scrollTop || e.doc.scrollTop) && Ar(e, n) + } + Co.prototype.clear = function () { + var e = this.doc.cm, + t = this.line.widgets, + n = this.line, + r = Qe(n); + if (null != r && t) { + for (var i = 0; i < t.length; ++i) t[i] == this && t.splice(i--, 1); + t.length || (n.widgets = null); + var o = Sn(this); + Ye(n, Math.max(0, n.height - o)), e && (Jr(e, (function () { + Eo(e, n, -o), pr(e, r, "widget") + })), ln(e, "lineWidgetCleared", e, this, r)) + } + }, Co.prototype.changed = function () { + var e = this, + t = this.height, + n = this.doc.cm, + r = this.line; + this.height = null; + var i = Sn(this) - t; + i && (Ut(this.doc, r) || Ye(r, r.height + i), n && Jr(n, (function () { + n.curOp.forceUpdate = !0, Eo(n, r, i), ln(n, "lineWidgetChanged", n, e, Qe(r)) + }))) + }, ve(Co); + var ko = 0, + xo = function (e, t) { + this.lines = [], this.type = t, this.doc = e, this.id = ++ko + }; - function Gi(e, t, n) { - var o = e.getOption('configureMouse'), - r = o ? o(e, t, n) : {}; - if (null == r.unit) { - var i = za ? n.shiftKey && n.metaKey : n.altKey; - r.unit = i ? 'rectangle' : 'single' == t ? 'char' : 'double' == t ? 'word' : 'line' + function To(e, t, n, r, i) { + if (r && r.shared) return function (e, t, n, r, i) { + (r = F(r)).shared = !1; + var o = [To(e, t, n, r, i)], + s = o[0], + a = r.widgetNode; + return Oi(e, (function (e) { + a && (r.widgetNode = a.cloneNode(!0)), o.push(To(e, at(e, t), at(e, n), r, i)); + for (var l = 0; l < e.linked.length; ++l) + if (e.linked[l].isParent) return; + s = K(o) + })), new Ro(o, s) + }(e, t, n, r, i); + if (e.cm && !e.cm.curOp) return ei(e.cm, To)(e, t, n, r, i); + var o = new xo(e, i), + s = tt(t, n); + if (r && F(r, o, !1), s > 0 || 0 == s && !1 !== o.clearWhenEmpty) return o; + if (o.replacedWith && (o.collapsed = !0, o.widgetNode = A("span", [o.replacedWith], "CodeMirror-widget"), r.handleMouseEvents || o.widgetNode.setAttribute("cm-ignore-events", "true"), r.insertLeft && (o.widgetNode.insertLeft = !0)), o.collapsed) { + if (Ft(e, t.line, t, n, o) || t.line != n.line && Ft(e, n.line, t, n, o)) throw new Error("Inserting collapsed marker partially overlapping an existing one"); + Ct = !0 + } + o.addToHistory && zi(e, { + from: t, + to: n, + origin: "markText" + }, e.sel, NaN); + var a, l = t.line, + c = e.cm; + if (e.iter(l, n.line + 1, (function (e) { + c && o.collapsed && !c.options.lineWrapping && Bt(e) == c.display.maxLine && (a = !0), o.collapsed && l != t.line && Ye(e, 0), + function (e, t) { + e.markedSpans = e.markedSpans ? e.markedSpans.concat([t]) : [t], t.marker.attachLine(e) + }(e, new Et(o, l == t.line ? t.ch : null, l == n.line ? n.ch : null)), ++l + })), o.collapsed && e.iter(t.line, n.line + 1, (function (t) { + Ut(e, t) && Ye(t, 0) + })), o.clearOnEnter && he(o, "beforeCursorEnter", (function () { + return o.clear() + })), o.readOnly && (St = !0, (e.history.done.length || e.history.undone.length) && e.clearHistory()), o.collapsed && (o.id = ++ko, o.atomic = !0), c) { + if (a && (c.curOp.updateMaxLine = !0), o.collapsed) hr(c, t.line, n.line + 1); + else if (o.className || o.startStyle || o.endStyle || o.css || o.attributes || o.title) + for (var u = t.line; u <= n.line; u++) pr(c, u, "text"); + o.atomic && no(c.doc), ln(c, "markerAdded", c, o) } - return (null == r.extend || e.doc.extend) && (r.extend = e.doc.extend || n.shiftKey), null == r.addNew && (r.addNew = Ha ? n.metaKey : n.ctrlKey), null == r.moveOnDrag && (r.moveOnDrag = Ha ? !n.altKey : !n.ctrlKey), r - } - - function Ki(e, t, n, o) { - Ra ? setTimeout(y(Yn, e), 0) : e.curOp.focus = h(); - var r = Gi(e, n, o), - i = e.doc.sel, - a; - e.options.dragDrop && on && !e.isReadOnly() && 'single' == n && -1 < (a = i.contains(t)) && (0 > ge((a = i.ranges[a]).from(), t) || 0 < t.xRel) && (0 < ge(a.to(), t) || 0 > t.xRel) ? ji(e, o, t, r) : Yi(e, o, t, r) - } - - function ji(t, e, n, r) { - var i = t.display, - a = !1, - s = xo(t, function (o) { - Pa && (i.scroller.draggable = !1), t.state.draggingText = !1, O(i.wrapper.ownerDocument, 'mouseup', s), O(i.wrapper.ownerDocument, 'mousemove', d), O(i.scroller, 'dragstart', l), O(i.scroller, 'drop', s), a || (G(o), !r.addNew && _r(t.doc, n, null, null, r.extend), Pa || Ra && 9 == xa ? setTimeout(function () { - i.wrapper.ownerDocument.body.focus(), i.input.focus() - }, 20) : i.input.focus()) - }), - d = function (t) { - a = a || 10 <= o(e.clientX - t.clientX) + o(e.clientY - t.clientY) - }, - l = function () { - return a = !0 - }; - Pa && (i.scroller.draggable = !0), t.state.draggingText = s, s.copy = !r.moveOnDrag, i.scroller.dragDrop && i.scroller.dragDrop(), as(i.wrapper.ownerDocument, 'mouseup', s), as(i.wrapper.ownerDocument, 'mousemove', d), as(i.scroller, 'dragstart', l), as(i.scroller, 'drop', s), Xn(t), setTimeout(function () { - return i.input.focus() - }, 20) - } - - function qi(e, t, n) { - if ('char' == n) return new Ns(t, t); - if ('word' == n) return e.findWordAt(t); - if ('line' == n) return new Ns(fe(t.line, 0), Ee(e.doc, fe(t.line + 1, 0))); - var o = n(e, t); - return new Ns(o.from, o.to) + return o } - - function Yi(t, e, n, o) { - function i(e) { - if (0 != ge(y, e)) - if (y = e, 'rectangle' == o.unit) { - for (var i = [], a = t.options.tabSize, s = C(se(c, n.line).text, n.ch, a), l = C(se(c, e.line).text, e.ch, a), u = d(s, l), h = r(s, l), g = d(n.line, e.line), S = d(t.lastLine(), r(n.line, e.line)); g <= S; g++) { - var b = se(c, g).text, - E = v(b, u, a); - u == h ? i.push(new Ns(fe(g, E), fe(g, E))) : b.length > E && i.push(new Ns(fe(g, E), fe(g, v(b, h, a)))) - } - i.length || i.push(new Ns(n, n)), Ar(c, $o(t, p.ranges.slice(0, f).concat(i), f), { - origin: '*mouse', - scroll: !1 - }), t.scrollIntoView(e) - } else { - var w = m, - k = qi(t, e, o.unit), - T = w.anchor, - _; - 0 < ge(k.anchor, T) ? (_ = k.head, T = be(w.from(), k.anchor)) : (_ = k.anchor, T = Ce(w.to(), k.head)); - var R = p.ranges.slice(0); - R[f] = Xi(t, new Ns(Ee(c, T), _)), Ar(c, $o(t, R, f), Za) - } - } - - function a(n) { - var e = ++b, - r = Ln(t, n, !0, 'rectangle' == o.unit); - if (r) - if (0 != ge(r, y)) { - t.curOp.focus = h(), i(r); - var s = eo(l, c); - (r.line >= s.to || r.line < s.from) && setTimeout(xo(t, function () { - b == e && a(n) - }), 150) - } else { - var d = n.clientY < S.top ? -20 : n.clientY > S.bottom ? 20 : 0; - d && setTimeout(xo(t, function () { - b != e || (l.scroller.scrollTop += d, a(n)) - }), 50) + xo.prototype.clear = function () { + if (!this.explicitlyCleared) { + var e = this.doc.cm, + t = e && !e.curOp; + if (t && $r(e), ye(this, "clear")) { + var n = this.find(); + n && ln(this, "clear", n.from, n.to) + } + for (var r = null, i = null, o = 0; o < this.lines.length; ++o) { + var s = this.lines[o], + a = kt(s.markedSpans, this); + e && !this.collapsed ? pr(e, Qe(s), "text") : e && (null != a.to && (i = Qe(s)), null != a.from && (r = Qe(s))), s.markedSpans = xt(s.markedSpans, a), null == a.from && this.collapsed && !Ut(this.doc, s) && e && Ye(s, rr(e.display)) + } + if (e && this.collapsed && !e.options.lineWrapping) + for (var l = 0; l < this.lines.length; ++l) { + var c = Bt(this.lines[l]), + u = jt(c); + u > e.display.maxLineLength && (e.display.maxLine = c, e.display.maxLineLength = u, e.display.maxLineChanged = !0) } + null != r && e && this.collapsed && hr(e, r, i + 1), this.lines.length = 0, this.explicitlyCleared = !0, this.atomic && this.doc.cantEdit && (this.doc.cantEdit = !1, e && no(e.doc)), e && ln(e, "markerCleared", e, this, r, i), t && qr(e), this.parent && this.parent.clear() + } + }, xo.prototype.find = function (e, t) { + var n, r; + null == e && "bookmark" == this.type && (e = 1); + for (var i = 0; i < this.lines.length; ++i) { + var o = this.lines[i], + s = kt(o.markedSpans, this); + if (null != s.from && (n = et(t ? o : Qe(o), s.from), -1 == e)) return n; + if (null != s.to && (r = et(t ? o : Qe(o), s.to), 1 == e)) return r + } + return n && { + from: n, + to: r } - - function s(n) { - t.state.selectingText = !1, b = Infinity, n && (G(n), l.input.focus()), O(l.wrapper.ownerDocument, 'mousemove', E), O(l.wrapper.ownerDocument, 'mouseup', w), c.history.lastSelOrigin = null - } - var l = t.display, - c = t.doc; - G(e); - var p = c.sel, - u = p.ranges, - m, f; - if (o.addNew && !o.extend ? (f = c.sel.contains(n), m = -1 < f ? u[f] : new Ns(n, n)) : (m = c.sel.primary(), f = c.sel.primIndex), 'rectangle' == o.unit) o.addNew || (m = new Ns(n, n)), n = Ln(t, e, !0, !0), f = -1; - else { - var g = qi(t, n, o.unit); - m = o.extend ? Tr(m, g.anchor, g.head, o.extend) : g - } - o.addNew ? -1 == f ? (f = u.length, Ar(c, $o(t, u.concat([m]), f), { - scroll: !1, - origin: '*mouse' - })) : 1 < u.length && u[f].empty() && 'char' == o.unit && !o.extend ? (Ar(c, $o(t, u.slice(0, f).concat(u.slice(f + 1)), 0), { - scroll: !1, - origin: '*mouse' - }), p = c.sel) : xr(c, f, m, Za) : (f = 0, Ar(c, new Bs([m], 0), Za), p = c.sel); - var y = n, - S = l.wrapper.getBoundingClientRect(), - b = 0, - E = xo(t, function (t) { - 0 !== t.buttons && X(t) ? a(t) : s(t) - }), - w = xo(t, s); - t.state.selectingText = w, as(l.wrapper.ownerDocument, 'mousemove', E), as(l.wrapper.ownerDocument, 'mouseup', w) - } - - function Xi(e, t) { - var n = t.anchor, - o = t.head, - r = se(e.doc, n.line); - if (0 == ge(n, o) && n.sticky == o.sticky) return t; - var i = B(r); - if (!i) return t; - var a = F(i, n.ch, n.sticky), - s = i[a]; - if (s.from != n.ch && s.to != n.ch) return t; - var d = a + (s.from == n.ch == (1 != s.level) ? 0 : 1); - if (0 == d || d == i.length) return t; - var l; - if (o.line != n.line) l = 0 < (o.line - n.line) * ('ltr' == e.doc.direction ? 1 : -1); - else { - var c = F(i, o.ch, o.sticky), - p = c - a || (o.ch - n.ch) * (1 == s.level ? -1 : 1); - l = c == d - 1 || c == d ? 0 > p : 0 < p + }, xo.prototype.changed = function () { + var e = this, + t = this.find(-1, !0), + n = this, + r = this.doc.cm; + t && r && Jr(r, (function () { + var i = t.line, + o = Qe(t.line), + s = Mn(r, o); + if (s && (Bn(s), r.curOp.selectionChanged = r.curOp.forceUpdate = !0), r.curOp.updateMaxLine = !0, !Ut(n.doc, i) && null != n.height) { + var a = n.height; + n.height = null; + var l = Sn(n) - a; + l && Ye(i, i.height + l) + } + ln(r, "markerChanged", r, e) + })) + }, xo.prototype.attachLine = function (e) { + if (!this.lines.length && this.doc.cm) { + var t = this.doc.cm.curOp; + t.maybeHiddenMarkers && -1 != z(t.maybeHiddenMarkers, this) || (t.maybeUnhiddenMarkers || (t.maybeUnhiddenMarkers = [])).push(this) } - var u = i[d + (l ? -1 : 0)], - m = l == (1 == u.level), - h = m ? u.from : u.to, - f = m ? 'after' : 'before'; - return n.ch == h && n.sticky == f ? t : new Ns(new fe(n.line, h, f), o) - } - - function Qi(t, n, e, o) { - var r, s; - if (n.touches) r = n.touches[0].clientX, s = n.touches[0].clientY; - else try { - r = n.clientX, s = n.clientY - } catch (t) { - return !1 + this.lines.push(e) + }, xo.prototype.detachLine = function (e) { + if (this.lines.splice(z(this.lines, e), 1), !this.lines.length && this.doc.cm) { + var t = this.doc.cm.curOp; + (t.maybeHiddenMarkers || (t.maybeHiddenMarkers = [])).push(this) } - if (r >= a(t.display.gutters.getBoundingClientRect().right)) return !1; - o && G(n); - var d = t.display, - l = d.lineDiv.getBoundingClientRect(); - if (s > l.bottom || !W(t, e)) return j(n); - s -= l.top - d.viewOffset; - for (var c = 0, i; c < t.display.gutterSpecs.length; ++c) - if (i = d.gutters.childNodes[c], i && i.getBoundingClientRect().right >= r) { - var p = ue(t.doc, s), - u = t.display.gutterSpecs[c]; - return H(t, e, t, p, u.className, n), j(n) - } - } - - function $i(t, n) { - return Qi(t, n, 'gutterClick', !0) - } - - function Zi(t, n) { - Vt(t.display, n) || Ji(t, n) || z(t, n, 'contextmenu') || !Ga && t.display.input.onContextMenu(n) - } - - function Ji(t, n) { - return !!W(t, 'gutterContextMenu') && Qi(t, n, 'gutterContextMenu', !1) - } - - function ea(e) { - e.display.wrapper.className = e.display.wrapper.className.replace(/\s*cm-s-\S+/g, '') + e.options.theme.replace(/(^|\s)\s*/g, ' cm-s-'), pn(e) - } + }, ve(xo); + var Ro = function (e, t) { + this.markers = e, this.primary = t; + for (var n = 0; n < e.length; ++n) e[n].parent = this + }; - function ta(e, t, n) { - if (!t != !(n && n != ed)) { - var o = e.display.dragFunctions, - r = t ? as : O; - r(e.display.scroller, 'dragstart', o.start), r(e.display.scroller, 'dragenter', o.enter), r(e.display.scroller, 'dragover', o.over), r(e.display.scroller, 'dragleave', o.leave), r(e.display.scroller, 'drop', o.drop) - } + function Do(e) { + return e.findMarks(et(e.first, 0), e.clipPos(et(e.lastLine())), (function (e) { + return e.parent + })) } - function na(e) { - e.options.lineWrapping ? (f(e.display.wrapper, 'CodeMirror-wrap'), e.display.sizer.style.minWidth = '', e.display.sizerWidth = null) : (Ka(e.display.wrapper, 'CodeMirror-wrap'), ut(e)), In(e), Bn(e), pn(e), setTimeout(function () { - return go(e) - }, 100) + function _o(e) { + for (var t = function (t) { + var n = e[t], + r = [n.primary.doc]; + Oi(n.primary.doc, (function (e) { + return r.push(e) + })); + for (var i = 0; i < n.markers.length; i++) { + var o = n.markers[i]; - 1 == z(r, o.doc) && (o.parent = null, n.markers.splice(i--, 1)) + } + }, n = 0; n < e.length; n++) t(n) } - - function oa(e, t) { - var n = this; - if (!(this instanceof oa)) return new oa(e, t); - this.options = t = t ? S(t) : {}, S(td, t, !1); - var o = t.value; - 'string' == typeof o ? o = new Vs(o, t.mode, null, t.lineSeparator, t.direction) : t.mode && (o.modeOption = t.mode), this.doc = o; - var r = new oa.inputStyles[t.inputStyle](this), - a = this.display = new qo(e, o, r, t); - for (var s in a.wrapper.CodeMirror = this, ea(this), t.lineWrapping && (this.display.wrapper.className += ' CodeMirror-wrap'), So(this), this.state = { - keyMaps: [], - overlays: [], - modeGen: 0, - overwrite: !1, - delayingBlurEvent: !1, - focused: !1, - suppressEdits: !1, - pasteIncoming: -1, - cutIncoming: -1, - selectingText: !1, - draggingText: !1, - highlight: new Ya, - keySeq: null, - specialChars: null - }, t.autofocus && !Oa && a.input.focus(), Ra && 11 > xa && setTimeout(function () { - return n.display.input.reset(!0) - }, 20), ra(this), mi(), Co(this), this.curOp.forceUpdate = !0, lr(this, o), t.autofocus && !Oa || this.hasFocus() ? setTimeout(y(Qn, this), 20) : $n(this), nd) nd.hasOwnProperty(s) && nd[s](n, t[s], ed); - Vo(this), t.finishInit && t.finishInit(this); - for (var d = 0; d < id.length; ++d) id[d](n); - bo(this), Pa && t.lineWrapping && 'optimizelegibility' == getComputedStyle(a.lineDiv).textRendering && (a.lineDiv.style.textRendering = 'auto') - } - - function ra(t) { - function n() { - i.activeTouch && (s = setTimeout(function () { - return i.activeTouch = null - }, 1e3), a = i.activeTouch, a.end = +new Date) + Ro.prototype.clear = function () { + if (!this.explicitlyCleared) { + this.explicitlyCleared = !0; + for (var e = 0; e < this.markers.length; ++e) this.markers[e].clear(); + ln(this, "clear") } - - function o(t) { - if (1 != t.touches.length) return !1; - var e = t.touches[0]; - return 1 >= e.radiusX && 1 >= e.radiusY - } - - function r(e, t) { - if (null == t.left) return !0; - var n = t.left - e.left, - o = t.top - e.top; - return 400 < n * n + o * o - } - var i = t.display; - as(i.scroller, 'mousedown', xo(t, Wi)), Ra && 11 > xa ? as(i.scroller, 'dblclick', xo(t, function (n) { - if (!z(t, n)) { - var e = Ln(t, n); - if (!(!e || $i(t, n) || Vt(t.display, n))) { - G(n); - var o = t.findWordAt(e); - _r(t.doc, o.anchor, o.head) + }, Ro.prototype.find = function (e, t) { + return this.primary.find(e, t) + }, ve(Ro); + var Ao = 0, + Mo = function (e, t, n, r, i) { + if (!(this instanceof Mo)) return new Mo(e, t, n, r, i); + null == n && (n = 0), So.call(this, [new bo([new $t("", null)])]), this.first = n, this.scrollTop = this.scrollLeft = 0, this.cantEdit = !1, this.cleanGeneration = 1, this.modeFrontier = this.highlightFrontier = n; + var o = et(n, 0); + this.sel = xi(o), this.history = new Fi(null), this.id = ++Ao, this.modeOption = t, this.lineSep = r, this.direction = "rtl" == i ? "rtl" : "ltr", this.extend = !1, "string" == typeof e && (e = this.splitLines(e)), Ii(this, { + from: o, + to: o, + text: e + }), Ji(this, xi(o), W) + }; + Mo.prototype = Z(So.prototype, { + constructor: Mo, + iter: function (e, t, n) { + n ? this.iterN(e - this.first, t - e, n) : this.iterN(this.first, this.first + this.size, e) + }, + insert: function (e, t) { + for (var n = 0, r = 0; r < t.length; ++r) n += t[r].height; + this.insertInner(e - this.first, t, n) + }, + remove: function (e, t) { + this.removeInner(e - this.first, t) + }, + getValue: function (e) { + var t = Ke(this, this.first, this.first + this.size); + return !1 === e ? t : t.join(e || this.lineSeparator()) + }, + setValue: ni((function (e) { + var t = et(this.first, 0), + n = this.first + this.size - 1; + co(this, { + from: t, + to: et(n, $e(this, n).text.length), + text: this.splitLines(e), + origin: "setValue", + full: !0 + }, !0), this.cm && Pr(this.cm, 0, 0), Ji(this, xi(t), W) + })), + replaceRange: function (e, t, n, r) { + mo(this, e, t = at(this, t), n = n ? at(this, n) : t, r) + }, + getRange: function (e, t, n) { + var r = qe(this, at(this, e), at(this, t)); + return !1 === n ? r : r.join(n || this.lineSeparator()) + }, + getLine: function (e) { + var t = this.getLineHandle(e); + return t && t.text + }, + getLineHandle: function (e) { + if (Xe(this, e)) return $e(this, e) + }, + getLineNumber: function (e) { + return Qe(e) + }, + getLineHandleVisualStart: function (e) { + return "number" == typeof e && (e = $e(this, e)), Bt(e) + }, + lineCount: function () { + return this.size + }, + firstLine: function () { + return this.first + }, + lastLine: function () { + return this.first + this.size - 1 + }, + clipPos: function (e) { + return at(this, e) + }, + getCursor: function (e) { + var t = this.sel.primary(); + return null == e || "head" == e ? t.head : "anchor" == e ? t.anchor : "end" == e || "to" == e || !1 === e ? t.to() : t.from() + }, + listSelections: function () { + return this.sel.ranges + }, + somethingSelected: function () { + return this.sel.somethingSelected() + }, + setCursor: ni((function (e, t, n) { + Zi(this, at(this, "number" == typeof e ? et(e, t || 0) : e), null, n) + })), + setSelection: ni((function (e, t, n) { + Zi(this, at(this, e), at(this, t || e), n) + })), + extendSelection: ni((function (e, t, n) { + Ki(this, at(this, e), t && at(this, t), n) + })), + extendSelections: ni((function (e, t) { + Yi(this, lt(this, e), t) + })), + extendSelectionsBy: ni((function (e, t) { + Yi(this, lt(this, Y(this.sel.ranges, e)), t) + })), + setSelections: ni((function (e, t, n) { + if (e.length) { + for (var r = [], i = 0; i < e.length; i++) r[i] = new Ei(at(this, e[i].anchor), at(this, e[i].head)); + null == t && (t = Math.min(e.length - 1, this.sel.primIndex)), Ji(this, ki(this.cm, r, t), n) + } + })), + addSelection: ni((function (e, t, n) { + var r = this.sel.ranges.slice(0); + r.push(new Ei(at(this, e), at(this, t || e))), Ji(this, ki(this.cm, r, r.length - 1), n) + })), + getSelection: function (e) { + for (var t, n = this.sel.ranges, r = 0; r < n.length; r++) { + var i = qe(this, n[r].from(), n[r].to()); + t = t ? t.concat(i) : i + } + return !1 === e ? t : t.join(e || this.lineSeparator()) + }, + getSelections: function (e) { + for (var t = [], n = this.sel.ranges, r = 0; r < n.length; r++) { + var i = qe(this, n[r].from(), n[r].to()); + !1 !== e && (i = i.join(e || this.lineSeparator())), t[r] = i + } + return t + }, + replaceSelection: function (e, t, n) { + for (var r = [], i = 0; i < this.sel.ranges.length; i++) r[i] = e; + this.replaceSelections(r, t, n || "+input") + }, + replaceSelections: ni((function (e, t, n) { + for (var r = [], i = this.sel, o = 0; o < i.ranges.length; o++) { + var s = i.ranges[o]; + r[o] = { + from: s.from(), + to: s.to(), + text: this.splitLines(e[o]), + origin: n } } - })) : as(i.scroller, 'dblclick', function (n) { - return z(t, n) || G(n) - }), as(i.scroller, 'contextmenu', function (n) { - return Zi(t, n) - }); - var a = { - end: 0 - }, - s; - as(i.scroller, 'touchstart', function (n) { - if (!z(t, n) && !o(n) && !$i(t, n)) { - i.input.ensurePolled(), clearTimeout(s); - var e = +new Date; - i.activeTouch = { - start: e, - moved: !1, - prev: 300 >= e - a.end ? a : null - }, 1 == n.touches.length && (i.activeTouch.left = n.touches[0].pageX, i.activeTouch.top = n.touches[0].pageY) - } - }), as(i.scroller, 'touchmove', function () { - i.activeTouch && (i.activeTouch.moved = !0) - }), as(i.scroller, 'touchend', function (o) { - var e = i.activeTouch; - if (e && !Vt(i, o) && null != e.left && !e.moved && 300 > new Date - e.start) { - var a = t.coordsChar(i.activeTouch, 'page'), - s; - s = !e.prev || r(e, e.prev) ? new Ns(a, a) : !e.prev.prev || r(e, e.prev.prev) ? t.findWordAt(a) : new Ns(fe(a.line, 0), Ee(t.doc, fe(a.line + 1, 0))), t.setSelection(s.anchor, s.head), t.focus(), G(o) - } - n() - }), as(i.scroller, 'touchcancel', n), as(i.scroller, 'scroll', function () { - i.scroller.clientHeight && (uo(t, i.scroller.scrollTop), ho(t, i.scroller.scrollLeft, !0), H(t, 'scroll', t)) - }), as(i.scroller, 'mousewheel', function (n) { - return Qo(t, n) - }), as(i.scroller, 'DOMMouseScroll', function (n) { - return Qo(t, n) - }), as(i.wrapper, 'scroll', function () { - return i.wrapper.scrollTop = i.wrapper.scrollLeft = 0 - }), i.dragFunctions = { - enter: function (n) { - z(t, n) || q(n) - }, - over: function (n) { - z(t, n) || (ci(t, n), q(n)) - }, - start: function (n) { - return li(t, n) - }, - drop: xo(t, di), - leave: function (n) { - z(t, n) || pi(t) + for (var a = t && "end" != t && function (e, t, n) { + for (var r = [], i = et(e.first, 0), o = i, s = 0; s < t.length; s++) { + var a = t[s], + l = _i(a.from, i, o), + c = _i(Ti(a), i, o); + if (i = a.to, o = c, "around" == n) { + var u = e.sel.ranges[s], + h = tt(u.head, u.anchor) < 0; + r[s] = new Ei(h ? c : l, h ? l : c) + } else r[s] = new Ei(l, l) + } + return new Ci(r, e.sel.primIndex) + }(this, r, t), l = r.length - 1; l >= 0; l--) co(this, r[l]); + a ? Xi(this, a) : this.cm && Mr(this.cm) + })), + undo: ni((function () { + ho(this, "undo") + })), + redo: ni((function () { + ho(this, "redo") + })), + undoSelection: ni((function () { + ho(this, "undo", !0) + })), + redoSelection: ni((function () { + ho(this, "redo", !0) + })), + setExtending: function (e) { + this.extend = e + }, + getExtending: function () { + return this.extend + }, + historySize: function () { + for (var e = this.history, t = 0, n = 0, r = 0; r < e.done.length; r++) e.done[r].ranges || ++t; + for (var i = 0; i < e.undone.length; i++) e.undone[i].ranges || ++n; + return { + undo: t, + redo: n } - }; - var e = i.input.getField(); - as(e, 'keyup', function (n) { - return Hi.call(t, n) - }), as(e, 'keydown', xo(t, Ni)), as(e, 'keypress', xo(t, zi)), as(e, 'focus', function (n) { - return Qn(t, n) - }), as(e, 'blur', function (n) { - return $n(t, n) - }) - } + }, + clearHistory: function () { + this.history = new Fi(this.history.maxGeneration) + }, + markClean: function () { + this.cleanGeneration = this.changeGeneration(!0) + }, + changeGeneration: function (e) { + return e && (this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null), this.history.generation + }, + isClean: function (e) { + return this.history.generation == (e || this.cleanGeneration) + }, + getHistory: function () { + return { + done: $i(this.history.done), + undone: $i(this.history.undone) + } + }, + setHistory: function (e) { + var t = this.history = new Fi(this.history.maxGeneration); + t.done = $i(e.done.slice(0), null, !0), t.undone = $i(e.undone.slice(0), null, !0) + }, + setGutterMarker: ni((function (e, t, n) { + return wo(this, e, "gutter", (function (e) { + var r = e.gutterMarkers || (e.gutterMarkers = {}); + return r[t] = n, !n && te(r) && (e.gutterMarkers = null), !0 + })) + })), + clearGutter: ni((function (e) { + var t = this; + this.iter((function (n) { + n.gutterMarkers && n.gutterMarkers[e] && wo(t, n, "gutter", (function () { + return n.gutterMarkers[e] = null, te(n.gutterMarkers) && (n.gutterMarkers = null), !0 + })) + })) + })), + lineInfo: function (e) { + var t; + if ("number" == typeof e) { + if (!Xe(this, e)) return null; + if (t = e, !(e = $e(this, e))) return null + } else if (null == (t = Qe(e))) return null; + return { + line: t, + handle: e, + text: e.text, + gutterMarkers: e.gutterMarkers, + textClass: e.textClass, + bgClass: e.bgClass, + wrapClass: e.wrapClass, + widgets: e.widgets + } + }, + addLineClass: ni((function (e, t, n) { + return wo(this, e, "gutter" == t ? "gutter" : "class", (function (e) { + var r = "text" == t ? "textClass" : "background" == t ? "bgClass" : "gutter" == t ? "gutterClass" : "wrapClass"; + if (e[r]) { + if (k(n).test(e[r])) return !1; + e[r] += " " + n + } else e[r] = n; + return !0 + })) + })), + removeLineClass: ni((function (e, t, n) { + return wo(this, e, "gutter" == t ? "gutter" : "class", (function (e) { + var r = "text" == t ? "textClass" : "background" == t ? "bgClass" : "gutter" == t ? "gutterClass" : "wrapClass", + i = e[r]; + if (!i) return !1; + if (null == n) e[r] = null; + else { + var o = i.match(k(n)); + if (!o) return !1; + var s = o.index + o[0].length; + e[r] = i.slice(0, o.index) + (o.index && s != i.length ? " " : "") + i.slice(s) || null + } + return !0 + })) + })), + addLineWidget: ni((function (e, t, n) { + return function (e, t, n, r) { + var i = new Co(e, n, r), + o = e.cm; + return o && i.noHScroll && (o.display.alignWidgets = !0), wo(e, t, "widget", (function (t) { + var n = t.widgets || (t.widgets = []); + if (null == i.insertAt ? n.push(i) : n.splice(Math.min(n.length - 1, Math.max(0, i.insertAt)), 0, i), i.line = t, o && !Ut(e, t)) { + var r = Vt(t) < e.scrollTop; + Ye(t, t.height + Sn(i)), r && Ar(o, i.height), o.curOp.forceUpdate = !0 + } + return !0 + })), o && ln(o, "lineWidgetAdded", o, i, "number" == typeof t ? t : Qe(t)), i + }(this, e, t, n) + })), + removeLineWidget: function (e) { + e.clear() + }, + markText: function (e, t, n) { + return To(this, at(this, e), at(this, t), n, n && n.type || "range") + }, + setBookmark: function (e, t) { + var n = { + replacedWith: t && (null == t.nodeType ? t.widget : t), + insertLeft: t && t.insertLeft, + clearWhenEmpty: !1, + shared: t && t.shared, + handleMouseEvents: t && t.handleMouseEvents + }; + return To(this, e = at(this, e), e, n, "bookmark") + }, + findMarksAt: function (e) { + var t = [], + n = $e(this, (e = at(this, e)).line).markedSpans; + if (n) + for (var r = 0; r < n.length; ++r) { + var i = n[r]; + (null == i.from || i.from <= e.ch) && (null == i.to || i.to >= e.ch) && t.push(i.marker.parent || i.marker) + } + return t + }, + findMarks: function (e, t, n) { + e = at(this, e), t = at(this, t); + var r = [], + i = e.line; + return this.iter(e.line, t.line + 1, (function (o) { + var s = o.markedSpans; + if (s) + for (var a = 0; a < s.length; a++) { + var l = s[a]; + null != l.to && i == e.line && e.ch >= l.to || null == l.from && i != e.line || null != l.from && i == t.line && l.from >= t.ch || n && !n(l.marker) || r.push(l.marker.parent || l.marker) + }++i + })), r + }, + getAllMarks: function () { + var e = []; + return this.iter((function (t) { + var n = t.markedSpans; + if (n) + for (var r = 0; r < n.length; ++r) null != n[r].from && e.push(n[r].marker) + })), e + }, + posFromIndex: function (e) { + var t, n = this.first, + r = this.lineSeparator().length; + return this.iter((function (i) { + var o = i.text.length + r; + if (o > e) return t = e, !0; + e -= o, ++n + })), at(this, et(n, t)) + }, + indexFromPos: function (e) { + var t = (e = at(this, e)).ch; + if (e.line < this.first || e.ch < 0) return 0; + var n = this.lineSeparator().length; + return this.iter(this.first, e.line, (function (e) { + t += e.text.length + n + })), t + }, + copy: function (e) { + var t = new Mo(Ke(this, this.first, this.first + this.size), this.modeOption, this.first, this.lineSep, this.direction); + return t.scrollTop = this.scrollTop, t.scrollLeft = this.scrollLeft, t.sel = this.sel, t.extend = !1, e && (t.history.undoDepth = this.history.undoDepth, t.setHistory(this.getHistory())), t + }, + linkedDoc: function (e) { + e || (e = {}); + var t = this.first, + n = this.first + this.size; + null != e.from && e.from > t && (t = e.from), null != e.to && e.to < n && (n = e.to); + var r = new Mo(Ke(this, t, n), e.mode || this.modeOption, t, this.lineSep, this.direction); + return e.sharedHist && (r.history = this.history), (this.linked || (this.linked = [])).push({ + doc: r, + sharedHist: e.sharedHist + }), r.linked = [{ + doc: this, + isParent: !0, + sharedHist: e.sharedHist + }], + function (e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n], + i = r.find(), + o = e.clipPos(i.from), + s = e.clipPos(i.to); + if (tt(o, s)) { + var a = To(e, o, s, r.primary, r.primary.type); + r.markers.push(a), a.parent = r + } + } + }(r, Do(this)), r + }, + unlinkDoc: function (e) { + if (e instanceof Rs && (e = e.doc), this.linked) + for (var t = 0; t < this.linked.length; ++t) + if (this.linked[t].doc == e) { + this.linked.splice(t, 1), e.unlinkDoc(this), _o(Do(this)); + break + } if (e.history == this.history) { + var n = [e.id]; + Oi(e, (function (e) { + return n.push(e.id) + }), !0), e.history = new Fi(null), e.history.done = $i(this.history.done, n), e.history.undone = $i(this.history.undone, n) + } + }, + iterLinkedDocs: function (e) { + Oi(this, e) + }, + getMode: function () { + return this.mode + }, + getEditor: function () { + return this.cm + }, + splitLines: function (e) { + return this.lineSep ? e.split(this.lineSep) : Me(e) + }, + lineSeparator: function () { + return this.lineSep || "\n" + }, + setDirection: ni((function (e) { + var t; + "rtl" != e && (e = "ltr"), e != this.direction && (this.direction = e, this.iter((function (e) { + return e.order = null + })), this.cm && Jr(t = this.cm, (function () { + Ni(t), hr(t) + }))) + })) + }), Mo.prototype.eachLine = Mo.prototype.iter; + var Po = 0; - function ia(e, t, n, o) { - var s = e.doc, - d; - null == n && (n = 'add'), 'smart' == n && (s.mode.indent ? d = Re(e, t).state : n = 'prev'); - var l = e.options.tabSize, - c = se(s, t), - p = C(c.text, null, l); - c.stateAfter && (c.stateAfter = null); - var u = c.text.match(/^\s*/)[0], - m; - if (!o && !/\S/.test(c.text)) m = 0, n = 'not'; - else if ('smart' == n && (m = s.mode.indent(d, c.text.slice(u.length), c.text), m == Qa || 150 < m)) { - if (!o) return; - n = 'prev' + function Io(e) { + var t = this; + if (Oo(t), !me(t, e) && !Cn(t.display, e)) { + we(e), s && (Po = +new Date); + var n = cr(t, e, !0), + r = e.dataTransfer.files; + if (n && !t.isReadOnly()) + if (r && r.length && window.FileReader && window.File) + for (var i = r.length, o = Array(i), a = 0, l = function (e, r) { + if (!t.options.allowDropFileTypes || -1 != z(t.options.allowDropFileTypes, e.type)) { + var s = new FileReader; + s.onload = ei(t, (function () { + var e = s.result; + if (/[\x00-\x08\x0e-\x1f]{2}/.test(e) && (e = ""), o[r] = e, ++a == i) { + var l = { + from: n = at(t.doc, n), + to: n, + text: t.doc.splitLines(o.join(t.doc.lineSeparator())), + origin: "paste" + }; + co(t.doc, l), Xi(t.doc, xi(n, Ti(l))) + } + })), s.readAsText(e) + } + }, c = 0; c < i; ++c) l(r[c], c); + else { + if (t.state.draggingText && t.doc.sel.contains(n) > -1) return t.state.draggingText(e), void setTimeout((function () { + return t.display.input.focus() + }), 20); + try { + var u = e.dataTransfer.getData("Text"); + if (u) { + var h; + if (t.state.draggingText && !t.state.draggingText.copy && (h = t.listSelections()), eo(t.doc, xi(n, n)), h) + for (var p = 0; p < h.length; ++p) mo(t.doc, "", h[p].anchor, h[p].head, "drag"); + t.replaceSelection(u, "around", "paste"), t.display.input.focus() + } + } catch (e) {} + } } - 'prev' == n ? t > s.first ? m = C(se(s, t - 1).text, null, l) : m = 0 : 'add' == n ? m = p + e.options.indentUnit : 'subtract' == n ? m = p - e.options.indentUnit : 'number' == typeof n && (m = p + n), m = r(0, m); - var h = '', - f = 0; - if (e.options.indentWithTabs) - for (var g = a(m / l); g; --g) f += l, h += '\t'; - if (f < m && (h += E(m - f)), h != u) return Yr(s, h, fe(t, 0), fe(t, u.length), '+input'), c.stateAfter = null, !0; - for (var i = 0, y; i < s.sel.ranges.length; i++) - if (y = s.sel.ranges[i], y.head.line == t && y.head.ch < u.length) { - var S = fe(t, u.length); - xr(s, i, new Ns(S, S)); - break - } } - function aa(e) { - ad = e + function Oo(e) { + e.display.dragCursor && (e.display.lineSpace.removeChild(e.display.dragCursor), e.display.dragCursor = null) } - function sa(e, t, n, o, r) { - var a = e.doc; - e.display.shift = !1, o || (o = a.sel); - var s = +new Date - 200, - l = 'paste' == r || e.state.pasteIncoming > s, - c = ss(t), - p = null; - if (l && 1 < o.ranges.length) - if (!(ad && ad.text.join('\n') == t)) c.length == o.ranges.length && e.options.pasteLinesPerSelection && (p = k(c, function (e) { - return [e] - })); - else if (0 == o.ranges.length % ad.text.length) { - p = []; - for (var u = 0; u < ad.text.length; u++) p.push(a.splitLines(ad.text[u])) - } - for (var i = e.curOp.updateInput, m = o.ranges.length - 1; 0 <= m; m--) { - var h = o.ranges[m], - f = h.from(), - g = h.to(); - h.empty() && (n && 0 < n ? f = fe(f.line, f.ch - n) : e.state.overwrite && !l ? g = fe(g.line, d(se(a, g.line).text.length, g.ch + w(c).length)) : l && ad && ad.lineWise && ad.text.join('\n') == t && (f = g = fe(f.line, 0))); - var y = { - from: f, - to: g, - text: p ? p[m % p.length] : c, - origin: r || (l ? 'paste' : e.state.cutIncoming > s ? 'cut' : '+input') - }; - Wr(e.doc, y), xt(e, 'inputRead', e, y) + function Lo(e) { + if (document.getElementsByClassName) { + for (var t = document.getElementsByClassName("CodeMirror"), n = [], r = 0; r < t.length; r++) { + var i = t[r].CodeMirror; + i && n.push(i) + } + n.length && n[0].operation((function () { + for (var t = 0; t < n.length; t++) e(n[t]) + })) } - t && !l && la(e, t), ao(e), 2 > e.curOp.updateInput && (e.curOp.updateInput = i), e.curOp.typing = !0, e.state.pasteIncoming = e.state.cutIncoming = -1 } + var No = !1; - function da(t, e) { - var n = t.clipboardData && t.clipboardData.getData('Text'); - if (n) return t.preventDefault(), e.isReadOnly() || e.options.disableInput || Ro(e, function () { - return sa(e, n, 0, null, 'paste') - }), !0 + function Fo() { + var e; + No || (he(window, "resize", (function () { + null == e && (e = setTimeout((function () { + e = null, Lo(Bo) + }), 100)) + })), he(window, "blur", (function () { + return Lo(xr) + })), No = !0) } - function la(e, t) { - if (e.options.electricChars && e.options.smartIndent) - for (var n = e.doc.sel, o = n.ranges.length - 1, r; 0 <= o; o--) - if (r = n.ranges[o], !(100 < r.head.ch || o && n.ranges[o - 1].head.line == r.head.line)) { - var i = e.getModeAt(r.head), - a = !1; - if (i.electricChars) { - for (var s = 0; s < i.electricChars.length; s++) - if (-1 < t.indexOf(i.electricChars.charAt(s))) { - a = ia(e, r.head.line, 'smart'); - break - } - } else i.electricInput && i.electricInput.test(se(e.doc, r.head.line).text.slice(0, r.head.ch)) && (a = ia(e, r.head.line, 'smart')); - a && xt(e, 'electricInput', e, r.head.line) - } + function Bo(e) { + var t = e.display; + t.cachedCharWidth = t.cachedTextHeight = t.cachedPaddingH = null, t.scrollbarsClipped = !1, e.setSize() } + for (var Ho = { + 3: "Pause", + 8: "Backspace", + 9: "Tab", + 13: "Enter", + 16: "Shift", + 17: "Ctrl", + 18: "Alt", + 19: "Pause", + 20: "CapsLock", + 27: "Esc", + 32: "Space", + 33: "PageUp", + 34: "PageDown", + 35: "End", + 36: "Home", + 37: "Left", + 38: "Up", + 39: "Right", + 40: "Down", + 44: "PrintScrn", + 45: "Insert", + 46: "Delete", + 59: ";", + 61: "=", + 91: "Mod", + 92: "Mod", + 93: "Mod", + 106: "*", + 107: "=", + 109: "-", + 110: ".", + 111: "/", + 145: "ScrollLock", + 173: "-", + 186: ";", + 187: "=", + 188: ",", + 189: "-", + 190: ".", + 191: "/", + 192: "`", + 219: "[", + 220: "\\", + 221: "]", + 222: "'", + 63232: "Up", + 63233: "Down", + 63234: "Left", + 63235: "Right", + 63272: "Delete", + 63273: "Home", + 63275: "End", + 63276: "PageUp", + 63277: "PageDown", + 63302: "Insert" + }, zo = 0; zo < 10; zo++) Ho[zo + 48] = Ho[zo + 96] = String(zo); + for (var Uo = 65; Uo <= 90; Uo++) Ho[Uo] = String.fromCharCode(Uo); + for (var Wo = 1; Wo <= 12; Wo++) Ho[Wo + 111] = Ho[Wo + 63235] = "F" + Wo; + var Vo = {}; - function ca(e) { - for (var t = [], n = [], o = 0; o < e.doc.sel.ranges.length; o++) { - var r = e.doc.sel.ranges[o].head.line, - i = { - anchor: fe(r, 0), - head: fe(r + 1, 0) - }; - n.push(i), t.push(e.getRange(i.anchor, i.head)) + function jo(e) { + var t, n, r, i, o = e.split(/-(?!$)/); + e = o[o.length - 1]; + for (var s = 0; s < o.length - 1; s++) { + var a = o[s]; + if (/^(cmd|meta|m)$/i.test(a)) i = !0; + else if (/^a(lt)?$/i.test(a)) t = !0; + else if (/^(c|ctrl|control)$/i.test(a)) n = !0; + else { + if (!/^s(hift)?$/i.test(a)) throw new Error("Unrecognized modifier name: " + a); + r = !0 + } } - return { - text: t, - ranges: n + return t && (e = "Alt-" + e), n && (e = "Ctrl-" + e), i && (e = "Cmd-" + e), r && (e = "Shift-" + e), e + } + + function Go(e) { + var t = {}; + for (var n in e) + if (e.hasOwnProperty(n)) { + var r = e[n]; + if (/^(name|fallthrough|(de|at)tach)$/.test(n)) continue; + if ("..." == r) { + delete e[n]; + continue + } + for (var i = Y(n.split(" "), jo), o = 0; o < i.length; o++) { + var s = void 0, + a = void 0; + o == i.length - 1 ? (a = i.join(" "), s = r) : (a = i.slice(0, o + 1).join(" "), s = "..."); + var l = t[a]; + if (l) { + if (l != s) throw new Error("Inconsistent bindings for " + a) + } else t[a] = s + } + delete e[n] + } for (var c in t) e[c] = t[c]; + return e + } + + function $o(e, t, n, r) { + var i = (t = Qo(t)).call ? t.call(e, r) : t[e]; + if (!1 === i) return "nothing"; + if ("..." === i) return "multi"; + if (null != i && n(i)) return "handled"; + if (t.fallthrough) { + if ("[object Array]" != Object.prototype.toString.call(t.fallthrough)) return $o(e, t.fallthrough, n, r); + for (var o = 0; o < t.fallthrough.length; o++) { + var s = $o(e, t.fallthrough[o], n, r); + if (s) return s + } } } - function pa(e, t, n, o) { - e.setAttribute('autocorrect', n ? '' : 'off'), e.setAttribute('autocapitalize', o ? '' : 'off'), e.setAttribute('spellcheck', !!t) + function qo(e) { + var t = "string" == typeof e ? e : Ho[e.keyCode]; + return "Ctrl" == t || "Alt" == t || "Shift" == t || "Mod" == t } - function ua() { - var e = p('textarea', null, null, 'position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none'), - t = p('div', [e], null, 'overflow: hidden; position: relative; width: 3px; height: 0px;'); - return Pa ? e.style.width = '1000px' : e.setAttribute('wrap', 'off'), Ba && (e.style.border = '1px solid black'), pa(e), t + function Ko(e, t, n) { + var r = e; + return t.altKey && "Alt" != r && (e = "Alt-" + e), (C ? t.metaKey : t.ctrlKey) && "Ctrl" != r && (e = "Ctrl-" + e), (C ? t.ctrlKey : t.metaKey) && "Cmd" != r && (e = "Cmd-" + e), !n && t.shiftKey && "Shift" != r && (e = "Shift-" + e), e } - function ma(e, t, n, o, r) { - function i() { - var o = t.line + n; - return !(o < e.first || o >= e.first + e.size) && (t = new fe(o, t.ch, t.sticky), c = se(e, o)) - } + function Yo(e, t) { + if (h && 34 == e.keyCode && e.char) return !1; + var n = Ho[e.keyCode]; + return null != n && !e.altGraphKey && (3 == e.keyCode && e.code && (n = e.code), Ko(n, e, t)) + } - function a(o) { - var a; - if (a = r ? Ri(e.cm, c, t, n) : Ti(c, t, n), null != a) t = a; - else if (!o && i()) t = _i(r, e.cm, c, t.line, n); - else return !1; - return !0 - } - var s = t, - d = n, - c = se(e, t.line); - if ('char' == o) a(); - else if ('column' == o) a(!0); - else if ('word' == o || 'group' == o) - for (var l = null, p = 'group' == o, u = e.cm && e.cm.getHelper(t, 'wordChars'), m = !0;; m = !1) { - if (0 > n && !a(!m)) break; - var h = c.text.charAt(t.ch) || '\n', - f = P(h, u) ? 'w' : p && '\n' == h ? 'n' : !p || /\s/.test(h) ? null : 'p'; - if (!p || m || f || (f = 's'), l && l != f) { - 0 > n && (n = 1, a(), t.sticky = 'after'); + function Qo(e) { + return "string" == typeof e ? Vo[e] : e + } + + function Zo(e, t) { + for (var n = e.doc.sel.ranges, r = [], i = 0; i < n.length; i++) { + for (var o = t(n[i]); r.length && tt(o.from, K(r).to) <= 0;) { + var s = r.pop(); + if (tt(s.from, o.from) < 0) { + o.from = s.from; break } - if (f && (l = f), 0 < n && !a(!m)) break - } - var g = Or(e, t, s, d, !0); - return ye(s, g) && (g.hitSide = !0), g - } - - function ha(e, t, n, o) { - var i = e.doc, - a = t.left, - s; - if ('page' == o) { - var l = d(e.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight), - c = r(l - .5 * xn(e.display), 3); - s = (0 < n ? t.bottom : t.top) + n * c - } else 'line' == o && (s = 0 < n ? t.bottom + 3 : t.top - 3); - for (var p;;) { - if (p = vn(e, a, s), !p.outside) break; - if (0 > n ? 0 >= s : s >= i.height) { - p.hitSide = !0; - break } - s += 5 * n - } - return p - } - - function fa(e, t) { - var n = en(e, t.line); - if (!n || n.hidden) return null; - var o = se(e.doc, t.line), - r = $t(n, o, t.line), - i = B(o, e.doc.direction), - a = 'left'; - if (i) { - var s = F(i, t.ch); - a = s % 2 ? 'right' : 'left' + r.push(o) } - var d = rn(r.map, t.ch, a); - return d.offset = 'right' == d.collapse ? d.end : d.start, d - } - - function ga(e) { - for (var t = e; t; t = t.parentNode) - if (/CodeMirror-gutter-wrapper/.test(t.className)) return !0; - return !1 + Jr(e, (function () { + for (var t = r.length - 1; t >= 0; t--) mo(e.doc, "", r[t].from, r[t].to, "+delete"); + Mr(e) + })) } - function ya(e, t) { - return t && (e.bad = !0), e + function Xo(e, t, n) { + var r = ie(e.text, t + n, n); + return r < 0 || r > e.text.length ? null : r } - function Sa(e, t, n, o, r) { - function i(e) { - return function (t) { - return t.id == e - } - } - - function a() { - c && (l += p, u && (l += p), c = u = !1) - } - - function s(e) { - e && (a(), l += e) - } - - function d(t) { - if (1 == t.nodeType) { - var n = t.getAttribute('cm-text'); - if (n) return void s(n); - var l = t.getAttribute('cm-marker'), - m; - if (l) { - var h = e.findMarks(fe(o, 0), fe(r + 1, 0), i(+l)); - return void(h.length && (m = h[0].find(0)) && s(de(e.doc, m.from, m.to).join(p))) - } - if ('false' == t.getAttribute('contenteditable')) return; - var f = /^(pre|div|p|li|table|br)$/i.test(t.nodeName); - if (!/^br$/i.test(t.nodeName) && 0 == t.textContent.length) return; - f && a(); - for (var g = 0; g < t.childNodes.length; g++) d(t.childNodes[g]); - /^(pre|p)$/i.test(t.nodeName) && (u = !0), f && (c = !0) - } else 3 == t.nodeType && s(t.nodeValue.replace(/\u200b/g, '').replace(/\u00a0/g, ' ')) - } - for (var l = '', c = !1, p = e.doc.lineSeparator(), u = !1;;) { - if (d(t), t == n) break; - t = t.nextSibling, u = !1 - } - return l + function Jo(e, t, n) { + var r = Xo(e, t.ch, n); + return null == r ? null : new et(t.line, r, n < 0 ? "after" : "before") } - function Ca(e, t, n) { - var o; - if (t == e.display.lineDiv) { - if (o = e.display.lineDiv.childNodes[n], !o) return ya(e.clipPos(fe(e.display.viewTo - 1)), !0); - t = null, n = 0 - } else - for (o = t;; o = o.parentNode) { - if (!o || o == e.display.lineDiv) return null; - if (o.parentNode && o.parentNode == e.display.lineDiv) break - } - for (var r = 0, i; r < e.display.view.length; r++) - if (i = e.display.view[r], i.node == o) return ba(i, t, n) - } - - function ba(e, t, n) { - function o(t, n, o) { - for (var r = -1, i; r < (c ? c.length : 0); r++) { - i = 0 > r ? l.map : c[r]; - for (var a = 0, s; a < i.length; a += 3) - if (s = i[a + 2], s == t || s == n) { - var d = pe(0 > r ? e.line : e.rest[r]), - p = i[a] + o; - return (0 > o || s != t) && (p = i[a + (o ? 1 : 0)]), fe(d, p) - } - } - } - var r = e.text.firstChild, - i = !1; - if (!t || !m(r, t)) return ya(fe(pe(e.line), 0), !0); - if (t == r && (i = !0, t = r.childNodes[n], n = 0, !t)) { - var a = e.rest ? w(e.rest) : e.line; - return ya(fe(pe(a), a.text.length), i) - } - var s = 3 == t.nodeType ? t : null, - d = t; - for (s || 1 != t.childNodes.length || 3 != t.firstChild.nodeType || (s = t.firstChild, n && (n = s.nodeValue.length)); d.parentNode != r;) d = d.parentNode; - var l = e.measure, - c = l.maps, - p = o(s, d, n); - if (p) return ya(p, i); - for (var u = d.nextSibling, h = s ? s.nodeValue.length - n : 0; u; u = u.nextSibling) { - if (p = o(u, u.firstChild, 0), p) return ya(fe(p.line, p.ch - h), i); - h += u.textContent.length - } - for (var f = d.previousSibling, g = n; f; f = f.previousSibling) { - if (p = o(f, f.firstChild, -1), p) return ya(fe(p.line, p.ch + g), i); - g += f.textContent.length - } - } - var va = navigator.userAgent, - Ea = navigator.platform, - wa = /gecko\/\d/i.test(va), - ka = /MSIE \d/.test(va), - Ta = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(va), - _a = /Edge\/(\d+)/.exec(va), - Ra = ka || Ta || _a, - xa = Ra && (ka ? document.documentMode || 6 : +(_a || Ta)[1]), - Pa = !_a && /WebKit\//.test(va), - Da = Pa && /Qt\/\d+\.\d+/.test(va), - Ma = !_a && /Chrome\//.test(va), - Aa = /Opera\//.test(va), - Ia = /Apple Computer/.test(navigator.vendor), - La = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(va), - Fa = /PhantomJS/.test(va), - Ba = !_a && /AppleWebKit/.test(va) && /Mobile\/\w+/.test(va), - Na = /Android/.test(va), - Oa = Ba || Na || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(va), - Ha = Ba || /Mac/.test(Ea), - za = /\bCrOS\b/.test(va), - Ua = /win/i.test(Ea), - Wa = Aa && va.match(/Version\/(\d*\.\d*)/); - Wa && (Wa = +Wa[1]), Wa && 15 <= Wa && (Aa = !1, Pa = !0); - var Va = Ha && (Da || Aa && (null == Wa || 12.11 > Wa)), - Ga = wa || Ra && 9 <= xa, - Ka = function (t, n) { - var o = t.className, - r = e(n).exec(o); - if (r) { - var i = o.slice(r.index + r[0].length); - t.className = o.slice(0, r.index) + (i ? r[1] + i : '') - } + function es(e, t, n, r, i) { + if (e) { + var o = ce(n, t.doc.direction); + if (o) { + var s, a = i < 0 ? K(o) : o[0], + l = i < 0 == (1 == a.level) ? "after" : "before"; + if (a.level > 0 || "rtl" == t.doc.direction) { + var c = Pn(t, n); + s = i < 0 ? n.text.length - 1 : 0; + var u = In(t, c, s).top; + s = oe((function (e) { + return In(t, c, e).top == u + }), i < 0 == (1 == a.level) ? a.from : a.to - 1, s), "before" == l && (s = Xo(n, s, 1)) + } else s = i < 0 ? a.to : a.from; + return new et(r, s, l) + } + } + return new et(r, i < 0 ? n.text.length : 0, i < 0 ? "before" : "after") + } + Vo.basic = { + Left: "goCharLeft", + Right: "goCharRight", + Up: "goLineUp", + Down: "goLineDown", + End: "goLineEnd", + Home: "goLineStartSmart", + PageUp: "goPageUp", + PageDown: "goPageDown", + Delete: "delCharAfter", + Backspace: "delCharBefore", + "Shift-Backspace": "delCharBefore", + Tab: "defaultTab", + "Shift-Tab": "indentAuto", + Enter: "newlineAndIndent", + Insert: "toggleOverwrite", + Esc: "singleSelection" + }, Vo.pcDefault = { + "Ctrl-A": "selectAll", + "Ctrl-D": "deleteLine", + "Ctrl-Z": "undo", + "Shift-Ctrl-Z": "redo", + "Ctrl-Y": "redo", + "Ctrl-Home": "goDocStart", + "Ctrl-End": "goDocEnd", + "Ctrl-Up": "goLineUp", + "Ctrl-Down": "goLineDown", + "Ctrl-Left": "goGroupLeft", + "Ctrl-Right": "goGroupRight", + "Alt-Left": "goLineStart", + "Alt-Right": "goLineEnd", + "Ctrl-Backspace": "delGroupBefore", + "Ctrl-Delete": "delGroupAfter", + "Ctrl-S": "save", + "Ctrl-F": "find", + "Ctrl-G": "findNext", + "Shift-Ctrl-G": "findPrev", + "Shift-Ctrl-F": "replace", + "Shift-Ctrl-R": "replaceAll", + "Ctrl-[": "indentLess", + "Ctrl-]": "indentMore", + "Ctrl-U": "undoSelection", + "Shift-Ctrl-U": "redoSelection", + "Alt-U": "redoSelection", + fallthrough: "basic" + }, Vo.emacsy = { + "Ctrl-F": "goCharRight", + "Ctrl-B": "goCharLeft", + "Ctrl-P": "goLineUp", + "Ctrl-N": "goLineDown", + "Alt-F": "goWordRight", + "Alt-B": "goWordLeft", + "Ctrl-A": "goLineStart", + "Ctrl-E": "goLineEnd", + "Ctrl-V": "goPageDown", + "Shift-Ctrl-V": "goPageUp", + "Ctrl-D": "delCharAfter", + "Ctrl-H": "delCharBefore", + "Alt-D": "delWordAfter", + "Alt-Backspace": "delWordBefore", + "Ctrl-K": "killLine", + "Ctrl-T": "transposeChars", + "Ctrl-O": "openLine" + }, Vo.macDefault = { + "Cmd-A": "selectAll", + "Cmd-D": "deleteLine", + "Cmd-Z": "undo", + "Shift-Cmd-Z": "redo", + "Cmd-Y": "redo", + "Cmd-Home": "goDocStart", + "Cmd-Up": "goDocStart", + "Cmd-End": "goDocEnd", + "Cmd-Down": "goDocEnd", + "Alt-Left": "goGroupLeft", + "Alt-Right": "goGroupRight", + "Cmd-Left": "goLineLeft", + "Cmd-Right": "goLineRight", + "Alt-Backspace": "delGroupBefore", + "Ctrl-Alt-Backspace": "delGroupAfter", + "Alt-Delete": "delGroupAfter", + "Cmd-S": "save", + "Cmd-F": "find", + "Cmd-G": "findNext", + "Shift-Cmd-G": "findPrev", + "Cmd-Alt-F": "replace", + "Shift-Cmd-Alt-F": "replaceAll", + "Cmd-[": "indentLess", + "Cmd-]": "indentMore", + "Cmd-Backspace": "delWrappedLineLeft", + "Cmd-Delete": "delWrappedLineRight", + "Cmd-U": "undoSelection", + "Shift-Cmd-U": "redoSelection", + "Ctrl-Up": "goDocStart", + "Ctrl-Down": "goDocEnd", + fallthrough: ["basic", "emacsy"] + }, Vo.default = v ? Vo.macDefault : Vo.pcDefault; + var ts = { + selectAll: ao, + singleSelection: function (e) { + return e.setSelection(e.getCursor("anchor"), e.getCursor("head"), W) }, - ja; - ja = document.createRange ? function (e, t, n, o) { - var i = document.createRange(); - return i.setEnd(o || e, n), i.setStart(e, t), i - } : function (e, t, n) { - var o = document.body.createTextRange(); - try { - o.moveToElementText(e.parentNode) - } catch (t) { - return o - } - return o.collapse(!0), o.moveEnd('character', n), o.moveStart('character', t), o - }; - var qa = function (e) { - e.select() - }; - Ba ? qa = function (e) { - e.selectionStart = 0, e.selectionEnd = e.value.length - } : Ra && (qa = function (e) { - try { - e.select() - } catch (e) {} - }); - var Ya = function () { - this.id = null, this.f = null, this.time = 0, this.handler = y(this.onTimeout, this) - }; - Ya.prototype.onTimeout = function (e) { - e.id = 0, e.time <= +new Date ? e.f() : setTimeout(e.handler, e.time - +new Date) - }, Ya.prototype.set = function (e, t) { - this.f = t; - var n = +new Date + e; - (!this.id || n < this.time) && (clearTimeout(this.id), this.id = setTimeout(this.handler, e), this.time = n) - }; - var Xa = 30, - Qa = { - toString: function () { - return 'CodeMirror.Pass' - } + killLine: function (e) { + return Zo(e, (function (t) { + if (t.empty()) { + var n = $e(e.doc, t.head.line).text.length; + return t.head.ch == n && t.head.line < e.lastLine() ? { + from: t.head, + to: et(t.head.line + 1, 0) + } : { + from: t.head, + to: et(t.head.line, n) + } + } + return { + from: t.from(), + to: t.to() + } + })) }, - $a = { - scroll: !1 + deleteLine: function (e) { + return Zo(e, (function (t) { + return { + from: et(t.from().line, 0), + to: at(e.doc, et(t.to().line + 1, 0)) + } + })) }, - Za = { - origin: '*mouse' + delLineLeft: function (e) { + return Zo(e, (function (e) { + return { + from: et(e.from().line, 0), + to: e.from() + } + })) }, - Ja = { - origin: '+move' + delWrappedLineLeft: function (e) { + return Zo(e, (function (t) { + var n = e.charCoords(t.head, "div").top + 5; + return { + from: e.coordsChar({ + left: 0, + top: n + }, "div"), + to: t.from() + } + })) }, - es = [''], - ts = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/, - ns = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/, - os = null, - rs = function () { - function e(e) { - return 247 >= e ? n.charAt(e) : 1424 <= e && 1524 >= e ? 'R' : 1536 <= e && 1785 >= e ? o.charAt(e - 1536) : 1774 <= e && 2220 >= e ? 'r' : 8192 <= e && 8203 >= e ? 'w' : 8204 == e ? 'b' : 'L' - } - - function t(e, t, n) { - this.level = e, this.from = t, this.to = n - } - var n = 'bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN', - o = 'nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111', - r = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/, - i = /[stwN]/, - a = /[LRr]/, - s = /[Lb1n]/, - d = /[1n]/; - return function (n, o) { - var l = 'ltr' == o ? 'L' : 'R'; - if (0 == n.length || 'ltr' == o && !r.test(n)) return !1; - for (var c = n.length, p = [], u = 0; u < c; ++u) p.push(e(n.charCodeAt(u))); - for (var h = 0, f = l, g; h < c; ++h) g = p[h], 'm' == g ? p[h] = f : f = g; - for (var y = 0, S = l, C; y < c; ++y) C = p[y], '1' == C && 'r' == S ? p[y] = 'n' : a.test(C) && (S = C, 'r' == C && (p[y] = 'R')); - for (var b = 1, v = p[0], E; b < c - 1; ++b) E = p[b], '+' == E && '1' == v && '1' == p[b + 1] ? p[b] = '1' : ',' == E && v == p[b + 1] && ('1' == v || 'n' == v) && (p[b] = v), v = E; - for (var k = 0, T; k < c; ++k) - if (T = p[k], ',' == T) p[k] = 'N'; - else if ('%' == T) { - var _ = void 0; - for (_ = k + 1; _ < c && '%' == p[_]; ++_); - for (var R = k && '!' == p[k - 1] || _ < c && '1' == p[_] ? '1' : 'N', x = k; x < _; ++x) p[x] = R; - k = _ - 1 + delWrappedLineRight: function (e) { + return Zo(e, (function (t) { + var n = e.charCoords(t.head, "div").top + 5, + r = e.coordsChar({ + left: e.display.lineDiv.offsetWidth + 100, + top: n + }, "div"); + return { + from: t.from(), + to: r } - for (var P = 0, D = l, M; P < c; ++P) M = p[P], 'L' == D && '1' == M ? p[P] = 'L' : a.test(M) && (D = M); - for (var A = 0; A < c; ++A) - if (i.test(p[A])) { - var I = void 0; - for (I = A + 1; I < c && i.test(p[I]); ++I); - for (var L = 'L' == (A ? p[A - 1] : l), F = 'L' == (I < c ? p[I] : l), B = L == F ? L ? 'L' : 'R' : l, N = A; N < I; ++N) p[N] = B; - A = I - 1 - } for (var O = [], H = 0, z; H < c;) - if (s.test(p[H])) { - var m = H; - for (++H; H < c && s.test(p[H]); ++H); - O.push(new t(0, m, H)) - } else { - var U = H, - W = O.length; - for (++H; H < c && 'L' != p[H]; ++H); - for (var V = U; V < H;) - if (d.test(p[V])) { - U < V && O.splice(W, 0, new t(1, U, V)); - var G = V; - for (++V; V < H && d.test(p[V]); ++V); - O.splice(W, 0, new t(2, G, V)), U = V - } else ++V; - U < H && O.splice(W, 0, new t(1, U, H)) - } return 'ltr' == o && (1 == O[0].level && (z = n.match(/^\s+/)) && (O[0].from = z[0].length, O.unshift(new t(0, 0, z[0].length))), 1 == w(O).level && (z = n.match(/\s+$/)) && (w(O).to -= z[0].length, O.push(new t(0, c - z[0].length, c)))), 'rtl' == o ? O.reverse() : O - } - }(), - is = [], - as = function (e, t, n) { - if (e.addEventListener) e.addEventListener(t, n, !1); - else if (e.attachEvent) e.attachEvent('on' + t, n); - else { - var o = e._handlers || (e._handlers = {}); - o[t] = (o[t] || is).concat(n) - } + })) }, - on = function () { - if (Ra && 9 > xa) return !1; - var e = p('div'); - return 'draggable' in e || 'dragDrop' in e - }(), - ss = 3 == '\n\nb'.split(/\n/).length ? function (e) { - return e.split(/\r\n?|\n/) - } : function (e) { - for (var t = 0, n = [], o = e.length, r; t <= o;) { - r = e.indexOf('\n', t), -1 == r && (r = e.length); - var i = e.slice(t, '\r' == e.charAt(r - 1) ? r - 1 : r), - a = i.indexOf('\r'); - 1 == a ? (n.push(i), t = r + 1) : (n.push(i.slice(0, a)), t += a + 1) - } - return n + undo: function (e) { + return e.undo() }, - ds = window.getSelection ? function (e) { - try { - return e.selectionStart != e.selectionEnd - } catch (t) { - return !1 - } - } : function (e) { - var t; - try { - t = e.ownerDocument.selection.createRange() - } catch (t) {} - return !!(t && t.parentElement() == e) && 0 != t.compareEndPoints('StartToEnd', t) + redo: function (e) { + return e.redo() }, - ls = function () { - var t = p('div'); - return !!('oncopy' in t) || (t.setAttribute('oncopy', 'return;'), 'function' == typeof t.oncopy) - }(), - cs = null, - ps = {}, - us = {}, - ms = {}, - hs = function (e, t, n) { - this.pos = this.start = 0, this.string = e, this.tabSize = t || 8, this.lastColumnPos = this.lastColumnValue = 0, this.lineStart = 0, this.lineOracle = n + undoSelection: function (e) { + return e.undoSelection() }, - fs, gs; - hs.prototype.eol = function () { - return this.pos >= this.string.length - }, hs.prototype.sol = function () { - return this.pos == this.lineStart - }, hs.prototype.peek = function () { - return this.string.charAt(this.pos) || void 0 - }, hs.prototype.next = function () { - if (this.pos < this.string.length) return this.string.charAt(this.pos++) - }, hs.prototype.eat = function (e) { - var t = this.string.charAt(this.pos), - n; - if (n = 'string' == typeof e ? t == e : t && (e.test ? e.test(t) : e(t)), n) return ++this.pos, t - }, hs.prototype.eatWhile = function (e) { - for (var t = this.pos; this.eat(e);); - return this.pos > t - }, hs.prototype.eatSpace = function () { - for (var e = this, t = this.pos; - /[\s\u00a0]/.test(this.string.charAt(this.pos));) ++e.pos; - return this.pos > t - }, hs.prototype.skipToEnd = function () { - this.pos = this.string.length - }, hs.prototype.skipTo = function (e) { - var t = this.string.indexOf(e, this.pos); - if (-1 < t) return this.pos = t, !0 - }, hs.prototype.backUp = function (e) { - this.pos -= e - }, hs.prototype.column = function () { - return this.lastColumnPos < this.start && (this.lastColumnValue = C(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue), this.lastColumnPos = this.start), this.lastColumnValue - (this.lineStart ? C(this.string, this.lineStart, this.tabSize) : 0) - }, hs.prototype.indentation = function () { - return C(this.string, null, this.tabSize) - (this.lineStart ? C(this.string, this.lineStart, this.tabSize) : 0) - }, hs.prototype.match = function (e, t, n) { - if ('string' == typeof e) { - var o = function (e) { - return n ? e.toLowerCase() : e - }, - r = this.string.substr(this.pos, e.length); - if (o(r) == o(e)) return !1 !== t && (this.pos += e.length), !0 - } else { - var i = this.string.slice(this.pos).match(e); - return i && 0 < i.index ? null : (i && !1 !== t && (this.pos += i[0].length), i) - } - }, hs.prototype.current = function () { - return this.string.slice(this.start, this.pos) - }, hs.prototype.hideFirstChars = function (e, t) { - this.lineStart += e; - try { - return t() - } finally { - this.lineStart -= e - } - }, hs.prototype.lookAhead = function (e) { - var t = this.lineOracle; - return t && t.lookAhead(e) - }, hs.prototype.baseToken = function () { - var e = this.lineOracle; - return e && e.baseToken(this.pos) - }; - var ys = function (e, t) { - this.state = e, this.lookAhead = t + redoSelection: function (e) { + return e.redoSelection() }, - Ss = function (e, t, n, o) { - this.state = t, this.doc = e, this.line = n, this.maxLookAhead = o || 0, this.baseTokens = null, this.baseTokenPos = 1 - }; - Ss.prototype.lookAhead = function (e) { - var t = this.doc.getLine(this.line + e); - return null != t && e > this.maxLookAhead && (this.maxLookAhead = e), t - }, Ss.prototype.baseToken = function (e) { - var t = this; - if (!this.baseTokens) return null; - for (; this.baseTokens[this.baseTokenPos] <= e;) t.baseTokenPos += 2; - var n = this.baseTokens[this.baseTokenPos + 1]; - return { - type: n && n.replace(/( |^)overlay .*/, ''), - size: this.baseTokens[this.baseTokenPos] - e - } - }, Ss.prototype.nextLine = function () { - this.line++, 0 < this.maxLookAhead && this.maxLookAhead-- - }, Ss.fromSaved = function (e, t, n) { - return t instanceof ys ? new Ss(e, oe(e.mode, t.state), n, t.lookAhead) : new Ss(e, oe(e.mode, t), n) - }, Ss.prototype.save = function (e) { - var t = !1 === e ? this.state : oe(this.doc.mode, this.state); - return 0 < this.maxLookAhead ? new ys(t, this.maxLookAhead) : t - }; - var Cs = function (e, t, n) { - this.start = e.start, this.end = e.pos, this.string = e.current(), this.type = t || null, this.state = n + goDocStart: function (e) { + return e.extendSelection(et(e.firstLine(), 0)) }, - bs = !1, - vs = !1, - Es = function (e, t, n) { - this.text = e, Ye(this, t), this.height = n ? n(this) : 1 - }; - Es.prototype.lineNo = function () { - return pe(this) - }, V(Es); - var ws = {}, - ks = {}, - Ts = null, - _s = null, - Rs = { - left: 0, - right: 0, - top: 0, - bottom: 0 + goDocEnd: function (e) { + return e.extendSelection(et(e.lastLine())) }, - xs = function (e, t, n) { - this.cm = n; - var o = this.vert = p('div', [p('div', null, null, 'min-width: 1px')], 'CodeMirror-vscrollbar'), - r = this.horiz = p('div', [p('div', null, null, 'height: 100%; min-height: 1px')], 'CodeMirror-hscrollbar'); - o.tabIndex = r.tabIndex = -1, e(o), e(r), as(o, 'scroll', function () { - o.clientHeight && t(o.scrollTop, 'vertical') - }), as(r, 'scroll', function () { - r.clientWidth && t(r.scrollLeft, 'horizontal') - }), this.checkedZeroWidth = !1, Ra && 8 > xa && (this.horiz.style.minHeight = this.vert.style.minWidth = '18px') + goLineStart: function (e) { + return e.extendSelectionsBy((function (t) { + return ns(e, t.head.line) + }), { + origin: "+move", + bias: 1 + }) }, - Ps; - xs.prototype.update = function (e) { - var t = e.scrollWidth > e.clientWidth + 1, - n = e.scrollHeight > e.clientHeight + 1, - o = e.nativeBarWidth; - if (n) { - this.vert.style.display = 'block', this.vert.style.bottom = t ? o + 'px' : '0'; - var i = e.viewHeight - (t ? o : 0); - this.vert.firstChild.style.height = r(0, e.scrollHeight - e.clientHeight + i) + 'px' - } else this.vert.style.display = '', this.vert.firstChild.style.height = '0'; - if (t) { - this.horiz.style.display = 'block', this.horiz.style.right = n ? o + 'px' : '0', this.horiz.style.left = e.barLeft + 'px'; - var a = e.viewWidth - e.barLeft - (n ? o : 0); - this.horiz.firstChild.style.width = r(0, e.scrollWidth - e.clientWidth + a) + 'px' - } else this.horiz.style.display = '', this.horiz.firstChild.style.width = '0'; - return !this.checkedZeroWidth && 0 < e.clientHeight && (0 == o && this.zeroWidthHack(), this.checkedZeroWidth = !0), { - right: n ? o : 0, - bottom: t ? o : 0 - } - }, xs.prototype.setScrollLeft = function (e) { - this.horiz.scrollLeft != e && (this.horiz.scrollLeft = e), this.disableHoriz && this.enableZeroWidthBar(this.horiz, this.disableHoriz, 'horiz') - }, xs.prototype.setScrollTop = function (e) { - this.vert.scrollTop != e && (this.vert.scrollTop = e), this.disableVert && this.enableZeroWidthBar(this.vert, this.disableVert, 'vert') - }, xs.prototype.zeroWidthHack = function () { - var e = Ha && !La ? '12px' : '18px'; - this.horiz.style.height = this.vert.style.width = e, this.horiz.style.pointerEvents = this.vert.style.pointerEvents = 'none', this.disableHoriz = new Ya, this.disableVert = new Ya - }, xs.prototype.enableZeroWidthBar = function (e, t, n) { - function o() { - var r = e.getBoundingClientRect(), - i = 'vert' == n ? document.elementFromPoint(r.right - 1, (r.top + r.bottom) / 2) : document.elementFromPoint((r.right + r.left) / 2, r.bottom - 1); - i == e ? t.set(1e3, o) : e.style.pointerEvents = 'none' - } - e.style.pointerEvents = 'auto', t.set(1e3, o) - }, xs.prototype.clear = function () { - var e = this.horiz.parentNode; - e.removeChild(this.horiz), e.removeChild(this.vert) - }; - var Ds = function () {}; - Ds.prototype.update = function () { - return { - bottom: 0, - right: 0 - } - }, Ds.prototype.setScrollLeft = function () {}, Ds.prototype.setScrollTop = function () {}, Ds.prototype.clear = function () {}; - var Ms = { - native: xs, - null: Ds + goLineStartSmart: function (e) { + return e.extendSelectionsBy((function (t) { + return rs(e, t.head) + }), { + origin: "+move", + bias: 1 + }) }, - As = 0, - Is = function (e, t, n) { - var o = e.display; - this.viewport = t, this.visible = eo(o, e.doc, t), this.editorIsHidden = !o.wrapper.offsetWidth, this.wrapperHeight = o.wrapper.clientHeight, this.wrapperWidth = o.wrapper.clientWidth, this.oldDisplayWidth = Yt(e), this.force = n, this.dims = Dn(e), this.events = [] - }; - Is.prototype.signal = function (e, t) { - W(e, t) && this.events.push(arguments) - }, Is.prototype.finish = function () { - for (var e = this, t = 0; t < this.events.length; t++) H.apply(null, e.events[t]) - }; - var Ls = 0, - Fs = null; - Ra ? Fs = -.53 : wa ? Fs = 15 : Ma ? Fs = -.7 : Ia && (Fs = -1 / 3); - var Bs = function (e, t) { - this.ranges = e, this.primIndex = t - }; - Bs.prototype.primary = function () { - return this.ranges[this.primIndex] - }, Bs.prototype.equals = function (e) { - var t = this; - if (e == this) return !0; - if (e.primIndex != this.primIndex || e.ranges.length != this.ranges.length) return !1; - for (var n = 0; n < this.ranges.length; n++) { - var o = t.ranges[n], - r = e.ranges[n]; - if (!ye(o.anchor, r.anchor) || !ye(o.head, r.head)) return !1 - } - return !0 - }, Bs.prototype.deepCopy = function () { - for (var e = this, t = [], n = 0; n < this.ranges.length; n++) t[n] = new Ns(Se(e.ranges[n].anchor), Se(e.ranges[n].head)); - return new Bs(t, this.primIndex) - }, Bs.prototype.somethingSelected = function () { - for (var e = this, t = 0; t < this.ranges.length; t++) - if (!e.ranges[t].empty()) return !0; - return !1 - }, Bs.prototype.contains = function (e, t) { - var n = this; - t || (t = e); - for (var o = 0, r; o < this.ranges.length; o++) - if (r = n.ranges[o], 0 <= ge(t, r.from()) && 0 >= ge(e, r.to())) return o; - return -1 - }; - var Ns = function (e, t) { - this.anchor = e, this.head = t - }; - Ns.prototype.from = function () { - return be(this.anchor, this.head) - }, Ns.prototype.to = function () { - return Ce(this.anchor, this.head) - }, Ns.prototype.empty = function () { - return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch - }, Jr.prototype = { - chunkSize: function () { - return this.lines.length + goLineEnd: function (e) { + return e.extendSelectionsBy((function (t) { + return function (e, t) { + var n = $e(e.doc, t), + r = function (e) { + for (var t; t = Lt(e);) e = t.find(1, !0).line; + return e + }(n); + return r != n && (t = Qe(r)), es(!0, e, n, t, -1) + }(e, t.head.line) + }), { + origin: "+move", + bias: -1 + }) }, - removeInner: function (e, t) { - for (var n = this, o = e, r; o < e + t; ++o) r = n.lines[o], n.height -= r.height, ht(r), xt(r, 'delete'); - this.lines.splice(e, t) + goLineRight: function (e) { + return e.extendSelectionsBy((function (t) { + var n = e.cursorCoords(t.head, "div").top + 5; + return e.coordsChar({ + left: e.display.lineDiv.offsetWidth + 100, + top: n + }, "div") + }), j) }, - collapse: function (e) { - e.push.apply(e, this.lines) + goLineLeft: function (e) { + return e.extendSelectionsBy((function (t) { + var n = e.cursorCoords(t.head, "div").top + 5; + return e.coordsChar({ + left: 0, + top: n + }, "div") + }), j) }, - insertInner: function (e, t, n) { - var o = this; - this.height += n, this.lines = this.lines.slice(0, e).concat(t).concat(this.lines.slice(e)); - for (var r = 0; r < t.length; ++r) t[r].parent = o + goLineLeftSmart: function (e) { + return e.extendSelectionsBy((function (t) { + var n = e.cursorCoords(t.head, "div").top + 5, + r = e.coordsChar({ + left: 0, + top: n + }, "div"); + return r.ch < e.getLine(r.line).search(/\S/) ? rs(e, t.head) : r + }), j) }, - iterN: function (t, o, n) { - for (var r = this, i = t + o; t < i; ++t) - if (n(r.lines[t])) return !0 - } - }, ei.prototype = { - chunkSize: function () { - return this.size + goLineUp: function (e) { + return e.moveV(-1, "line") }, - removeInner: function (e, t) { - var n = this; - this.size -= t; - for (var o = 0; o < this.children.length; ++o) { - var r = n.children[o], - i = r.chunkSize(); - if (e < i) { - var a = d(t, i - e), - s = r.height; - if (r.removeInner(e, a), n.height -= s - r.height, i == a && (n.children.splice(o--, 1), r.parent = null), 0 == (t -= a)) break; - e = 0 - } else e -= i - } - if (25 > this.size - t && (1 < this.children.length || !(this.children[0] instanceof Jr))) { - var l = []; - this.collapse(l), this.children = [new Jr(l)], this.children[0].parent = this - } + goLineDown: function (e) { + return e.moveV(1, "line") }, - collapse: function (e) { - for (var t = this, n = 0; n < this.children.length; ++n) t.children[n].collapse(e) + goPageUp: function (e) { + return e.moveV(-1, "page") }, - insertInner: function (e, t, n) { - var o = this; - this.size += t.length, this.height += n; - for (var r = 0; r < this.children.length; ++r) { - var i = o.children[r], - a = i.chunkSize(); - if (e <= a) { - if (i.insertInner(e, t, n), i.lines && 50 < i.lines.length) { - for (var s = i.lines.length % 25 + 25, d = s, l; d < i.lines.length;) l = new Jr(i.lines.slice(d, d += 25)), i.height -= l.height, o.children.splice(++r, 0, l), l.parent = o; - i.lines = i.lines.slice(0, s), o.maybeSpill() - } - break - } - e -= a - } + goPageDown: function (e) { + return e.moveV(1, "page") }, - maybeSpill: function () { - if (!(10 >= this.children.length)) { - var e = this; - do { - var t = e.children.splice(e.children.length - 5, 5), - n = new ei(t); - if (!e.parent) { - var o = new ei(e.children); - o.parent = e, e.children = [o, n], e = o - } else { - e.size -= n.size, e.height -= n.height; - var r = b(e.parent.children, e); - e.parent.children.splice(r + 1, 0, n) - } - n.parent = e.parent - } while (10 < e.children.length); - e.parent.maybeSpill() - } + goCharLeft: function (e) { + return e.moveH(-1, "char") }, - iterN: function (e, t, n) { - for (var o = this, r = 0; r < this.children.length; ++r) { - var i = o.children[r], - a = i.chunkSize(); - if (e < a) { - var s = d(t, a - e); - if (i.iterN(e, s, n)) return !0; - if (0 == (t -= s)) break; - e = 0 - } else e -= a + goCharRight: function (e) { + return e.moveH(1, "char") + }, + goColumnLeft: function (e) { + return e.moveH(-1, "column") + }, + goColumnRight: function (e) { + return e.moveH(1, "column") + }, + goWordLeft: function (e) { + return e.moveH(-1, "word") + }, + goGroupRight: function (e) { + return e.moveH(1, "group") + }, + goGroupLeft: function (e) { + return e.moveH(-1, "group") + }, + goWordRight: function (e) { + return e.moveH(1, "word") + }, + delCharBefore: function (e) { + return e.deleteH(-1, "char") + }, + delCharAfter: function (e) { + return e.deleteH(1, "char") + }, + delWordBefore: function (e) { + return e.deleteH(-1, "word") + }, + delWordAfter: function (e) { + return e.deleteH(1, "word") + }, + delGroupBefore: function (e) { + return e.deleteH(-1, "group") + }, + delGroupAfter: function (e) { + return e.deleteH(1, "group") + }, + indentAuto: function (e) { + return e.indentSelection("smart") + }, + indentMore: function (e) { + return e.indentSelection("add") + }, + indentLess: function (e) { + return e.indentSelection("subtract") + }, + insertTab: function (e) { + return e.replaceSelection("\t") + }, + insertSoftTab: function (e) { + for (var t = [], n = e.listSelections(), r = e.options.tabSize, i = 0; i < n.length; i++) { + var o = n[i].from(), + s = B(e.getLine(o.line), o.ch, r); + t.push(q(r - s % r)) } + e.replaceSelections(t) + }, + defaultTab: function (e) { + e.somethingSelected() ? e.indentSelection("add") : e.execCommand("insertTab") + }, + transposeChars: function (e) { + return Jr(e, (function () { + for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) + if (t[r].empty()) { + var i = t[r].head, + o = $e(e.doc, i.line).text; + if (o) + if (i.ch == o.length && (i = new et(i.line, i.ch - 1)), i.ch > 0) i = new et(i.line, i.ch + 1), e.replaceRange(o.charAt(i.ch - 1) + o.charAt(i.ch - 2), et(i.line, i.ch - 2), i, "+transpose"); + else if (i.line > e.doc.first) { + var s = $e(e.doc, i.line - 1).text; + s && (i = new et(i.line, 1), e.replaceRange(o.charAt(0) + e.doc.lineSeparator() + s.charAt(s.length - 1), et(i.line - 1, s.length - 1), i, "+transpose")) + } + n.push(new Ei(i, i)) + } e.setSelections(n) + })) + }, + newlineAndIndent: function (e) { + return Jr(e, (function () { + for (var t = e.listSelections(), n = t.length - 1; n >= 0; n--) e.replaceRange(e.doc.lineSeparator(), t[n].anchor, t[n].head, "+input"); + t = e.listSelections(); + for (var r = 0; r < t.length; r++) e.indentLine(t[r].from().line, null, !0); + Mr(e) + })) + }, + openLine: function (e) { + return e.replaceSelection("\n", "start") + }, + toggleOverwrite: function (e) { + return e.toggleOverwrite() } }; - var Os = function (e, t, n) { - var o = this; - if (n) - for (var r in n) n.hasOwnProperty(r) && (o[r] = n[r]); - this.doc = e, this.node = t - }; - Os.prototype.clear = function () { - var e = this, - t = this.doc.cm, - n = this.line.widgets, - o = this.line, - a = pe(o); - if (null != a && n) { - for (var s = 0; s < n.length; ++s) n[s] == e && n.splice(s--, 1); - n.length || (o.widgets = null); - var i = Wt(this); - ce(o, r(0, o.height - i)), t && (Ro(t, function () { - ti(t, o, -i), Nn(t, a, 'widget') - }), xt(t, 'lineWidgetCleared', t, this, a)) - } - }, Os.prototype.changed = function () { - var e = this, - t = this.height, - n = this.doc.cm, - o = this.line; - this.height = null; - var r = Wt(this) - t; - r && (!dt(this.doc, o) && ce(o, o.height + r), n && Ro(n, function () { - n.curOp.forceUpdate = !0, ti(n, o, r), xt(n, 'lineWidgetChanged', n, e, pe(o)) - })) - }, V(Os); - var Hs = 0, - zs = function (e, t) { - this.lines = [], this.type = t, this.doc = e, this.id = ++Hs - }; - zs.prototype.clear = function () { - var e = this; - if (!this.explicitlyCleared) { - var t = this.doc.cm, - n = t && !t.curOp; - if (n && Co(t), W(this, 'clear')) { - var o = this.find(); - o && xt(this, 'clear', o.from, o.to) - } - for (var r = null, a = null, s = 0; s < this.lines.length; ++s) { - var i = e.lines[s], - d = He(i.markedSpans, e); - t && !e.collapsed ? Nn(t, pe(i), 'text') : t && (null != d.to && (a = pe(i)), null != d.from && (r = pe(i))), i.markedSpans = ze(i.markedSpans, d), null == d.from && e.collapsed && !dt(e.doc, i) && t && ce(i, xn(t.display)) - } - if (t && this.collapsed && !t.options.lineWrapping) - for (var l = 0; l < this.lines.length; ++l) { - var c = ot(e.lines[l]), - p = pt(c); - p > t.display.maxLineLength && (t.display.maxLine = c, t.display.maxLineLength = p, t.display.maxLineChanged = !0) - } - null != r && t && this.collapsed && Bn(t, r, a + 1), this.lines.length = 0, this.explicitlyCleared = !0, this.atomic && this.doc.cantEdit && (this.doc.cantEdit = !1, t && Fr(t.doc)), t && xt(t, 'markerCleared', t, this, r, a), n && bo(t), this.parent && this.parent.clear() + + function ns(e, t) { + var n = $e(e.doc, t), + r = Bt(n); + return r != n && (t = Qe(r)), es(!0, e, r, t, 1) + } + + function rs(e, t) { + var n = ns(e, t.line), + r = $e(e.doc, n.line), + i = ce(r, e.doc.direction); + if (!i || 0 == i[0].level) { + var o = Math.max(0, r.text.search(/\S/)), + s = t.line == n.line && t.ch <= o && t.ch; + return et(n.line, s ? 0 : o, n.sticky) } - }, zs.prototype.find = function (e, t) { - var n = this; - null == e && 'bookmark' == this.type && (e = 1); - for (var o = 0, r, i; o < this.lines.length; ++o) { - var a = n.lines[o], - s = He(a.markedSpans, n); - if (null != s.from && (r = fe(t ? a : pe(a), s.from), -1 == e)) return r; - if (null != s.to && (i = fe(t ? a : pe(a), s.to), 1 == e)) return i - } - return r && { - from: r, - to: i - } - }, zs.prototype.changed = function () { - var e = this, - t = this.find(-1, !0), - n = this, - o = this.doc.cm; - t && o && Ro(o, function () { - var r = t.line, - i = pe(t.line), - a = en(o, i); - if (a && (ln(a), o.curOp.selectionChanged = o.curOp.forceUpdate = !0), o.curOp.updateMaxLine = !0, !dt(n.doc, r) && null != n.height) { - var s = n.height; - n.height = null; - var d = Wt(n) - s; - d && ce(r, r.height + d) + return n + } + + function is(e, t, n) { + if ("string" == typeof t && !(t = ts[t])) return !1; + e.display.input.ensurePolled(); + var r = e.display.shift, + i = !1; + try { + e.isReadOnly() && (e.state.suppressEdits = !0), n && (e.display.shift = !1), i = t(e) != U + } finally { + e.display.shift = r, e.state.suppressEdits = !1 + } + return i + } + var os = new H; + + function ss(e, t, n, r) { + var i = e.state.keySeq; + if (i) { + if (qo(t)) return "handled"; + if (/\'$/.test(t) ? e.state.keySeq = null : os.set(50, (function () { + e.state.keySeq == i && (e.state.keySeq = null, e.display.input.reset()) + })), as(e, i + " " + t, n, r)) return !0 + } + return as(e, t, n, r) + } + + function as(e, t, n, r) { + var i = function (e, t, n) { + for (var r = 0; r < e.state.keyMaps.length; r++) { + var i = $o(t, e.state.keyMaps[r], n, e); + if (i) return i } - xt(o, 'markerChanged', o, e) - }) - }, zs.prototype.attachLine = function (e) { - if (!this.lines.length && this.doc.cm) { - var t = this.doc.cm.curOp; - t.maybeHiddenMarkers && -1 != b(t.maybeHiddenMarkers, this) || (t.maybeUnhiddenMarkers || (t.maybeUnhiddenMarkers = [])).push(this) + return e.options.extraKeys && $o(t, e.options.extraKeys, n, e) || $o(t, e.options.keyMap, n, e) + }(e, t, r); + return "multi" == i && (e.state.keySeq = t), "handled" == i && ln(e, "keyHandled", e, t, n), "handled" != i && "multi" != i || (we(n), Sr(e)), !!i + } + + function ls(e, t) { + var n = Yo(t, !0); + return !!n && (t.shiftKey && !e.state.keySeq ? ss(e, "Shift-" + n, t, (function (t) { + return is(e, t, !0) + })) || ss(e, n, t, (function (t) { + if ("string" == typeof t ? /^go[A-Z]/.test(t) : t.motion) return is(e, t) + })) : ss(e, n, t, (function (t) { + return is(e, t) + }))) + } + var cs = null; + + function us(e) { + var t = this; + if (t.curOp.focus = P(), !me(t, e)) { + s && a < 11 && 27 == e.keyCode && (e.returnValue = !1); + var n = e.keyCode; + t.display.shift = 16 == n || e.shiftKey; + var r = ls(t, e); + h && (cs = r ? n : null, r || 88 != n || Ie || !(v ? e.metaKey : e.ctrlKey) || t.replaceSelection("", null, "cut")), 18 != n || /\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className) || function (e) { + var t = e.display.lineDiv; + + function n(e) { + 18 != e.keyCode && e.altKey || (T(t, "CodeMirror-crosshair"), de(document, "keyup", n), de(document, "mouseover", n)) + } + I(t, "CodeMirror-crosshair"), he(document, "keyup", n), he(document, "mouseover", n) + }(t) } - this.lines.push(e) - }, zs.prototype.detachLine = function (e) { - if (this.lines.splice(b(this.lines, e), 1), !this.lines.length && this.doc.cm) { - var t = this.doc.cm.curOp; - (t.maybeHiddenMarkers || (t.maybeHiddenMarkers = [])).push(this) + } + + function hs(e) { + 16 == e.keyCode && (this.doc.sel.shift = !1), me(this, e) + } + + function ps(e) { + var t = this; + if (!(Cn(t.display, e) || me(t, e) || e.ctrlKey && !e.altKey || v && e.metaKey)) { + var n = e.keyCode, + r = e.charCode; + if (h && n == cs) return cs = null, void we(e); + if (!h || e.which && !(e.which < 10) || !ls(t, e)) { + var i = String.fromCharCode(null == r ? n : r); + "\b" != i && (function (e, t, n) { + return ss(e, "'" + n + "'", t, (function (t) { + return is(e, t, !0) + })) + }(t, e, i) || t.display.input.onKeyPress(e)) + } } - }, V(zs); - var Us = function (e, t) { - var n = this; - this.markers = e, this.primary = t; - for (var o = 0; o < e.length; ++o) e[o].parent = n + } + var ds, fs, ms = function (e, t, n) { + this.time = e, this.pos = t, this.button = n }; - Us.prototype.clear = function () { - var e = this; - if (!this.explicitlyCleared) { - this.explicitlyCleared = !0; - for (var t = 0; t < this.markers.length; ++t) e.markers[t].clear(); - xt(this, 'clear') + + function gs(e) { + var t = this, + n = t.display; + if (!(me(t, e) || n.activeTouch && n.input.supportsTouch())) + if (n.input.ensurePolled(), n.shift = e.shiftKey, Cn(n, e)) l || (n.scroller.draggable = !1, setTimeout((function () { + return n.scroller.draggable = !0 + }), 100)); + else if (!ws(t, e)) { + var r = cr(t, e), + i = ke(e), + o = r ? function (e, t) { + var n = +new Date; + return fs && fs.compare(n, e, t) ? (ds = fs = null, "triple") : ds && ds.compare(n, e, t) ? (fs = new ms(n, e, t), ds = null, "double") : (ds = new ms(n, e, t), fs = null, "single") + }(r, i) : "single"; + window.focus(), 1 == i && t.state.selectingText && t.state.selectingText(e), r && function (e, t, n, r, i) { + var o = "Click"; + return "double" == r ? o = "Double" + o : "triple" == r && (o = "Triple" + o), ss(e, Ko(o = (1 == t ? "Left" : 2 == t ? "Middle" : "Right") + o, i), i, (function (t) { + if ("string" == typeof t && (t = ts[t]), !t) return !1; + var r = !1; + try { + e.isReadOnly() && (e.state.suppressEdits = !0), r = t(e, n) != U + } finally { + e.state.suppressEdits = !1 + } + return r + })) + }(t, i, r, o, e) || (1 == i ? r ? function (e, t, n, r) { + s ? setTimeout(N(Cr, e), 0) : e.curOp.focus = P(); + var i, o = function (e, t, n) { + var r = e.getOption("configureMouse"), + i = r ? r(e, t, n) : {}; + if (null == i.unit) { + var o = w ? n.shiftKey && n.metaKey : n.altKey; + i.unit = o ? "rectangle" : "single" == t ? "char" : "double" == t ? "word" : "line" + } + return (null == i.extend || e.doc.extend) && (i.extend = e.doc.extend || n.shiftKey), null == i.addNew && (i.addNew = v ? n.metaKey : n.ctrlKey), null == i.moveOnDrag && (i.moveOnDrag = !(v ? n.altKey : n.ctrlKey)), i + }(e, n, r), + c = e.doc.sel; + e.options.dragDrop && Re && !e.isReadOnly() && "single" == n && (i = c.contains(t)) > -1 && (tt((i = c.ranges[i]).from(), t) < 0 || t.xRel > 0) && (tt(i.to(), t) > 0 || t.xRel < 0) ? function (e, t, n, r) { + var i = e.display, + o = !1, + c = ei(e, (function (t) { + l && (i.scroller.draggable = !1), e.state.draggingText = !1, de(i.wrapper.ownerDocument, "mouseup", c), de(i.wrapper.ownerDocument, "mousemove", u), de(i.scroller, "dragstart", h), de(i.scroller, "drop", c), o || (we(t), r.addNew || Ki(e.doc, n, null, null, r.extend), l || s && 9 == a ? setTimeout((function () { + i.wrapper.ownerDocument.body.focus(), i.input.focus() + }), 20) : i.input.focus()) + })), + u = function (e) { + o = o || Math.abs(t.clientX - e.clientX) + Math.abs(t.clientY - e.clientY) >= 10 + }, + h = function () { + return o = !0 + }; + l && (i.scroller.draggable = !0), e.state.draggingText = c, c.copy = !r.moveOnDrag, i.scroller.dragDrop && i.scroller.dragDrop(), he(i.wrapper.ownerDocument, "mouseup", c), he(i.wrapper.ownerDocument, "mousemove", u), he(i.scroller, "dragstart", h), he(i.scroller, "drop", c), Er(e), setTimeout((function () { + return i.input.focus() + }), 20) + }(e, r, t, o) : function (e, t, n, r) { + var i = e.display, + o = e.doc; + we(t); + var s, a, l = o.sel, + c = l.ranges; + if (r.addNew && !r.extend ? (a = o.sel.contains(n), s = a > -1 ? c[a] : new Ei(n, n)) : (s = o.sel.primary(), a = o.sel.primIndex), "rectangle" == r.unit) r.addNew || (s = new Ei(n, n)), n = cr(e, t, !0, !0), a = -1; + else { + var u = ys(e, n, r.unit); + s = r.extend ? qi(s, u.anchor, u.head, r.extend) : u + } + r.addNew ? -1 == a ? (a = c.length, Ji(o, ki(e, c.concat([s]), a), { + scroll: !1, + origin: "*mouse" + })) : c.length > 1 && c[a].empty() && "char" == r.unit && !r.extend ? (Ji(o, ki(e, c.slice(0, a).concat(c.slice(a + 1)), 0), { + scroll: !1, + origin: "*mouse" + }), l = o.sel) : Qi(o, a, s, V) : (a = 0, Ji(o, new Ci([s], 0), V), l = o.sel); + var h = n; + + function p(t) { + if (0 != tt(h, t)) + if (h = t, "rectangle" == r.unit) { + for (var i = [], c = e.options.tabSize, u = B($e(o, n.line).text, n.ch, c), p = B($e(o, t.line).text, t.ch, c), d = Math.min(u, p), f = Math.max(u, p), m = Math.min(n.line, t.line), g = Math.min(e.lastLine(), Math.max(n.line, t.line)); m <= g; m++) { + var y = $e(o, m).text, + v = G(y, d, c); + d == f ? i.push(new Ei(et(m, v), et(m, v))) : y.length > v && i.push(new Ei(et(m, v), et(m, G(y, f, c)))) + } + i.length || i.push(new Ei(n, n)), Ji(o, ki(e, l.ranges.slice(0, a).concat(i), a), { + origin: "*mouse", + scroll: !1 + }), e.scrollIntoView(t) + } else { + var w, b = s, + S = ys(e, t, r.unit), + C = b.anchor; + tt(S.anchor, C) > 0 ? (w = S.head, C = ot(b.from(), S.anchor)) : (w = S.anchor, C = it(b.to(), S.head)); + var E = l.ranges.slice(0); + E[a] = function (e, t) { + var n = t.anchor, + r = t.head, + i = $e(e.doc, n.line); + if (0 == tt(n, r) && n.sticky == r.sticky) return t; + var o = ce(i); + if (!o) return t; + var s = ae(o, n.ch, n.sticky), + a = o[s]; + if (a.from != n.ch && a.to != n.ch) return t; + var l, c = s + (a.from == n.ch == (1 != a.level) ? 0 : 1); + if (0 == c || c == o.length) return t; + if (r.line != n.line) l = (r.line - n.line) * ("ltr" == e.doc.direction ? 1 : -1) > 0; + else { + var u = ae(o, r.ch, r.sticky), + h = u - s || (r.ch - n.ch) * (1 == a.level ? -1 : 1); + l = u == c - 1 || u == c ? h < 0 : h > 0 + } + var p = o[c + (l ? -1 : 0)], + d = l == (1 == p.level), + f = d ? p.from : p.to, + m = d ? "after" : "before"; + return n.ch == f && n.sticky == m ? t : new Ei(new et(n.line, f, m), r) + }(e, new Ei(at(o, C), w)), Ji(o, ki(e, E, a), V) + } + } + var d = i.wrapper.getBoundingClientRect(), + f = 0; + + function m(t) { + e.state.selectingText = !1, f = 1 / 0, t && (we(t), i.input.focus()), de(i.wrapper.ownerDocument, "mousemove", g), de(i.wrapper.ownerDocument, "mouseup", y), o.history.lastSelOrigin = null + } + var g = ei(e, (function (t) { + 0 !== t.buttons && ke(t) ? function t(n) { + var s = ++f, + a = cr(e, n, !0, "rectangle" == r.unit); + if (a) + if (0 != tt(a, h)) { + e.curOp.focus = P(), p(a); + var l = Dr(i, o); + (a.line >= l.to || a.line < l.from) && setTimeout(ei(e, (function () { + f == s && t(n) + })), 150) + } else { + var c = n.clientY < d.top ? -20 : n.clientY > d.bottom ? 20 : 0; + c && setTimeout(ei(e, (function () { + f == s && (i.scroller.scrollTop += c, t(n)) + })), 50) + } + }(t) : m(t) + })), + y = ei(e, m); + e.state.selectingText = y, he(i.wrapper.ownerDocument, "mousemove", g), he(i.wrapper.ownerDocument, "mouseup", y) + }(e, r, t, o) + }(t, r, o, e) : Ee(e) == n.scroller && we(e) : 2 == i ? (r && Ki(t.doc, r), setTimeout((function () { + return n.input.focus() + }), 20)) : 3 == i && (E ? t.display.input.onContextMenu(e) : Er(t))) } - }, Us.prototype.find = function (e, t) { - return this.primary.find(e, t) - }, V(Us); - var Ws = 0, - Vs = function (e, t, n, o, r) { - if (!(this instanceof Vs)) return new Vs(e, t, n, o, r); - null == n && (n = 0), ei.call(this, [new Jr([new Es('', null)])]), this.first = n, this.scrollTop = this.scrollLeft = 0, this.cantEdit = !1, this.cleanGeneration = 1, this.modeFrontier = this.highlightFrontier = n; - var i = fe(n, 0); - this.sel = Zo(i), this.history = new ur(null), this.id = ++Ws, this.modeOption = t, this.lineSep = o, this.direction = 'rtl' == r ? 'rtl' : 'ltr', this.extend = !1, 'string' == typeof e && (e = this.splitLines(e)), sr(this, { - from: i, - to: i, - text: e - }), Ar(this, Zo(i), $a) - }; - Vs.prototype = R(ei.prototype, { - constructor: Vs, - iter: function (e, t, n) { - n ? this.iterN(e - this.first, t - e, n) : this.iterN(this.first, this.first + this.size, e) - }, - insert: function (e, t) { - for (var n = 0, o = 0; o < t.length; ++o) n += t[o].height; - this.insertInner(e - this.first, t, n) - }, - remove: function (e, t) { - this.removeInner(e - this.first, t) - }, - getValue: function (e) { - var t = le(this, this.first, this.first + this.size); - return !1 === e ? t : t.join(e || this.lineSeparator()) - }, - setValue: Do(function (e) { - var t = fe(this.first, 0), - n = this.first + this.size - 1; - Wr(this, { - from: t, - to: fe(n, se(this, n).text.length), - text: this.splitLines(e), - origin: 'setValue', - full: !0 - }, !0), this.cm && so(this.cm, 0, 0), Ar(this, Zo(t), $a) - }), - replaceRange: function (e, t, n, o) { - t = Ee(this, t), n = n ? Ee(this, n) : t, Yr(this, e, t, n, o) - }, - getRange: function (e, t, n) { - var o = de(this, Ee(this, e), Ee(this, t)); - return !1 === n ? o : o.join(n || this.lineSeparator()) - }, - getLine: function (e) { - var t = this.getLineHandle(e); - return t && t.text - }, - getLineHandle: function (e) { - if (me(this, e)) return se(this, e) - }, - getLineNumber: function (e) { - return pe(e) - }, - getLineHandleVisualStart: function (e) { - return 'number' == typeof e && (e = se(this, e)), ot(e) - }, - lineCount: function () { - return this.size - }, - firstLine: function () { - return this.first - }, - lastLine: function () { - return this.first + this.size - 1 - }, - clipPos: function (e) { - return Ee(this, e) - }, - getCursor: function (e) { - var t = this.sel.primary(), - n; - return n = null == e || 'head' == e ? t.head : 'anchor' == e ? t.anchor : 'end' == e || 'to' == e || !1 === e ? t.to() : t.from(), n - }, - listSelections: function () { - return this.sel.ranges - }, - somethingSelected: function () { - return this.sel.somethingSelected() - }, - setCursor: Do(function (e, t, n) { - Pr(this, Ee(this, 'number' == typeof e ? fe(e, t || 0) : e), null, n) - }), - setSelection: Do(function (e, t, n) { - Pr(this, Ee(this, e), Ee(this, t || e), n) - }), - extendSelection: Do(function (e, t, n) { - _r(this, Ee(this, e), t && Ee(this, t), n) - }), - extendSelections: Do(function (e, t) { - Rr(this, ke(this, e), t) - }), - extendSelectionsBy: Do(function (e, t) { - var n = k(this.sel.ranges, e); - Rr(this, ke(this, n), t) - }), - setSelections: Do(function (e, t, n) { - var o = this; - if (e.length) { - for (var r = [], a = 0; a < e.length; a++) r[a] = new Ns(Ee(o, e[a].anchor), Ee(o, e[a].head)); - null == t && (t = d(e.length - 1, this.sel.primIndex)), Ar(this, $o(this.cm, r, t), n) + } + + function ys(e, t, n) { + if ("char" == n) return new Ei(t, t); + if ("word" == n) return e.findWordAt(t); + if ("line" == n) return new Ei(et(t.line, 0), at(e.doc, et(t.line + 1, 0))); + var r = n(e, t); + return new Ei(r.from, r.to) + } + + function vs(e, t, n, r) { + var i, o; + if (t.touches) i = t.touches[0].clientX, o = t.touches[0].clientY; + else try { + i = t.clientX, o = t.clientY + } catch (t) { + return !1 + } + if (i >= Math.floor(e.display.gutters.getBoundingClientRect().right)) return !1; + r && we(t); + var s = e.display, + a = s.lineDiv.getBoundingClientRect(); + if (o > a.bottom || !ye(e, n)) return Se(t); + o -= a.top - s.viewOffset; + for (var l = 0; l < e.display.gutterSpecs.length; ++l) { + var c = s.gutters.childNodes[l]; + if (c && c.getBoundingClientRect().right >= i) return fe(e, n, e, Ze(e.doc, o), e.display.gutterSpecs[l].className, t), Se(t) + } + } + + function ws(e, t) { + return vs(e, t, "gutterClick", !0) + } + + function bs(e, t) { + Cn(e.display, t) || function (e, t) { + return !!ye(e, "gutterContextMenu") && vs(e, t, "gutterContextMenu", !1) + }(e, t) || me(e, t, "contextmenu") || E || e.display.input.onContextMenu(t) + } + + function Ss(e) { + e.display.wrapper.className = e.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + e.options.theme.replace(/(^|\s)\s*/g, " cm-s-"), zn(e) + } + ms.prototype.compare = function (e, t, n) { + return this.time + 400 > e && 0 == tt(t, this.pos) && n == this.button + }; + var Cs = { + toString: function () { + return "CodeMirror.Init" } - }), - addSelection: Do(function (e, t, n) { - var o = this.sel.ranges.slice(0); - o.push(new Ns(Ee(this, e), Ee(this, t || e))), Ar(this, $o(this.cm, o, o.length - 1), n) - }), - getSelection: function (e) { - for (var t = this, n = this.sel.ranges, o = 0, r, i; o < n.length; o++) i = de(t, n[o].from(), n[o].to()), r = r ? r.concat(i) : i; - return !1 === e ? r : r.join(e || this.lineSeparator()) - }, - getSelections: function (e) { - for (var t = this, n = [], o = this.sel.ranges, r = 0, i; r < o.length; r++) i = de(t, o[r].from(), o[r].to()), !1 !== e && (i = i.join(e || t.lineSeparator())), n[r] = i; - return n - }, - replaceSelection: function (e, t, n) { - for (var o = [], r = 0; r < this.sel.ranges.length; r++) o[r] = e; - this.replaceSelections(o, t, n || '+input') - }, - replaceSelections: Do(function (e, t, n) { - for (var o = this, r = [], a = this.sel, s = 0, i; s < a.ranges.length; s++) i = a.ranges[s], r[s] = { - from: i.from(), - to: i.to(), - text: o.splitLines(e[s]), - origin: n - }; - for (var d = t && 'end' != t && or(this, r, t), l = r.length - 1; 0 <= l; l--) Wr(o, r[l]); - d ? Mr(this, d) : this.cm && ao(this.cm) - }), - undo: Do(function () { - Gr(this, 'undo') - }), - redo: Do(function () { - Gr(this, 'redo') - }), - undoSelection: Do(function () { - Gr(this, 'undo', !0) - }), - redoSelection: Do(function () { - Gr(this, 'redo', !0) - }), - setExtending: function (e) { - this.extend = e }, - getExtending: function () { - return this.extend - }, - historySize: function () { - for (var e = this.history, t = 0, n = 0, o = 0; o < e.done.length; o++) e.done[o].ranges || ++t; - for (var r = 0; r < e.undone.length; r++) e.undone[r].ranges || ++n; - return { - undo: t, - redo: n + Es = {}, + ks = {}; + + function xs(e, t, n) { + if (!t != !(n && n != Cs)) { + var r = e.display.dragFunctions, + i = t ? he : de; + i(e.display.scroller, "dragstart", r.start), i(e.display.scroller, "dragenter", r.enter), i(e.display.scroller, "dragover", r.over), i(e.display.scroller, "dragleave", r.leave), i(e.display.scroller, "drop", r.drop) + } + } + + function Ts(e) { + e.options.lineWrapping ? (I(e.display.wrapper, "CodeMirror-wrap"), e.display.sizer.style.minWidth = "", e.display.sizerWidth = null) : (T(e.display.wrapper, "CodeMirror-wrap"), Gt(e)), lr(e), hr(e), zn(e), setTimeout((function () { + return Ur(e) + }), 100) + } + + function Rs(e, t) { + var n = this; + if (!(this instanceof Rs)) return new Rs(e, t); + this.options = t = t ? F(t) : {}, F(Es, t, !1); + var r = t.value; + "string" == typeof r ? r = new Mo(r, t.mode, null, t.lineSeparator, t.direction) : t.mode && (r.modeOption = t.mode), this.doc = r; + var i = new Rs.inputStyles[t.inputStyle](this), + o = this.display = new gi(e, r, i, t); + for (var c in o.wrapper.CodeMirror = this, Ss(this), t.lineWrapping && (this.display.wrapper.className += " CodeMirror-wrap"), jr(this), this.state = { + keyMaps: [], + overlays: [], + modeGen: 0, + overwrite: !1, + delayingBlurEvent: !1, + focused: !1, + suppressEdits: !1, + pasteIncoming: -1, + cutIncoming: -1, + selectingText: !1, + draggingText: !1, + highlight: new H, + keySeq: null, + specialChars: null + }, t.autofocus && !y && o.input.focus(), s && a < 11 && setTimeout((function () { + return n.display.input.reset(!0) + }), 20), + function (e) { + var t = e.display; + he(t.scroller, "mousedown", ei(e, gs)), he(t.scroller, "dblclick", s && a < 11 ? ei(e, (function (t) { + if (!me(e, t)) { + var n = cr(e, t); + if (n && !ws(e, t) && !Cn(e.display, t)) { + we(t); + var r = e.findWordAt(n); + Ki(e.doc, r.anchor, r.head) + } + } + })) : function (t) { + return me(e, t) || we(t) + }), he(t.scroller, "contextmenu", (function (t) { + return bs(e, t) + })); + var n, r = { + end: 0 + }; + + function i() { + t.activeTouch && (n = setTimeout((function () { + return t.activeTouch = null + }), 1e3), (r = t.activeTouch).end = +new Date) + } + + function o(e, t) { + if (null == t.left) return !0; + var n = t.left - e.left, + r = t.top - e.top; + return n * n + r * r > 400 + } + he(t.scroller, "touchstart", (function (i) { + if (!me(e, i) && ! function (e) { + if (1 != e.touches.length) return !1; + var t = e.touches[0]; + return t.radiusX <= 1 && t.radiusY <= 1 + }(i) && !ws(e, i)) { + t.input.ensurePolled(), clearTimeout(n); + var o = +new Date; + t.activeTouch = { + start: o, + moved: !1, + prev: o - r.end <= 300 ? r : null + }, 1 == i.touches.length && (t.activeTouch.left = i.touches[0].pageX, t.activeTouch.top = i.touches[0].pageY) + } + })), he(t.scroller, "touchmove", (function () { + t.activeTouch && (t.activeTouch.moved = !0) + })), he(t.scroller, "touchend", (function (n) { + var r = t.activeTouch; + if (r && !Cn(t, n) && null != r.left && !r.moved && new Date - r.start < 300) { + var s, a = e.coordsChar(t.activeTouch, "page"); + s = !r.prev || o(r, r.prev) ? new Ei(a, a) : !r.prev.prev || o(r, r.prev.prev) ? e.findWordAt(a) : new Ei(et(a.line, 0), at(e.doc, et(a.line + 1, 0))), e.setSelection(s.anchor, s.head), e.focus(), we(n) + } + i() + })), he(t.scroller, "touchcancel", i), he(t.scroller, "scroll", (function () { + t.scroller.clientHeight && (Lr(e, t.scroller.scrollTop), Fr(e, t.scroller.scrollLeft, !0), fe(e, "scroll", e)) + })), he(t.scroller, "mousewheel", (function (t) { + return Si(e, t) + })), he(t.scroller, "DOMMouseScroll", (function (t) { + return Si(e, t) + })), he(t.wrapper, "scroll", (function () { + return t.wrapper.scrollTop = t.wrapper.scrollLeft = 0 + })), t.dragFunctions = { + enter: function (t) { + me(e, t) || Ce(t) + }, + over: function (t) { + me(e, t) || (function (e, t) { + var n = cr(e, t); + if (n) { + var r = document.createDocumentFragment(); + vr(e, n, r), e.display.dragCursor || (e.display.dragCursor = _("div", null, "CodeMirror-cursors CodeMirror-dragcursors"), e.display.lineSpace.insertBefore(e.display.dragCursor, e.display.cursorDiv)), D(e.display.dragCursor, r) + } + }(e, t), Ce(t)) + }, + start: function (t) { + return function (e, t) { + if (s && (!e.state.draggingText || +new Date - Po < 100)) Ce(t); + else if (!me(e, t) && !Cn(e.display, t) && (t.dataTransfer.setData("Text", e.getSelection()), t.dataTransfer.effectAllowed = "copyMove", t.dataTransfer.setDragImage && !p)) { + var n = _("img", null, null, "position: fixed; left: 0; top: 0;"); + n.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", h && (n.width = n.height = 1, e.display.wrapper.appendChild(n), n._top = n.offsetTop), t.dataTransfer.setDragImage(n, 0, 0), h && n.parentNode.removeChild(n) + } + }(e, t) + }, + drop: ei(e, Io), + leave: function (t) { + me(e, t) || Oo(e) + } + }; + var l = t.input.getField(); + he(l, "keyup", (function (t) { + return hs.call(e, t) + })), he(l, "keydown", ei(e, us)), he(l, "keypress", ei(e, ps)), he(l, "focus", (function (t) { + return kr(e, t) + })), he(l, "blur", (function (t) { + return xr(e, t) + })) + }(this), Fo(), $r(this), this.curOp.forceUpdate = !0, Li(this, r), t.autofocus && !y || this.hasFocus() ? setTimeout(N(kr, this), 20) : xr(this), ks) ks.hasOwnProperty(c) && ks[c](n, t[c], Cs); + pi(this), t.finishInit && t.finishInit(this); + for (var u = 0; u < Ds.length; ++u) Ds[u](n); + qr(this), l && t.lineWrapping && "optimizelegibility" == getComputedStyle(o.lineDiv).textRendering && (o.lineDiv.style.textRendering = "auto") + } + Rs.defaults = Es, Rs.optionHandlers = ks; + var Ds = []; + + function _s(e, t, n, r) { + var i, o = e.doc; + null == n && (n = "add"), "smart" == n && (o.mode.indent ? i = dt(e, t).state : n = "prev"); + var s = e.options.tabSize, + a = $e(o, t), + l = B(a.text, null, s); + a.stateAfter && (a.stateAfter = null); + var c, u = a.text.match(/^\s*/)[0]; + if (r || /\S/.test(a.text)) { + if ("smart" == n && ((c = o.mode.indent(i, a.text.slice(u.length), a.text)) == U || c > 150)) { + if (!r) return; + n = "prev" + } + } else c = 0, n = "not"; + "prev" == n ? c = t > o.first ? B($e(o, t - 1).text, null, s) : 0 : "add" == n ? c = l + e.options.indentUnit : "subtract" == n ? c = l - e.options.indentUnit : "number" == typeof n && (c = l + n), c = Math.max(0, c); + var h = "", + p = 0; + if (e.options.indentWithTabs) + for (var d = Math.floor(c / s); d; --d) p += s, h += "\t"; + if (p < c && (h += q(c - p)), h != u) return mo(o, h, et(t, 0), et(t, u.length), "+input"), a.stateAfter = null, !0; + for (var f = 0; f < o.sel.ranges.length; f++) { + var m = o.sel.ranges[f]; + if (m.head.line == t && m.head.ch < u.length) { + var g = et(t, u.length); + Qi(o, f, new Ei(g, g)); + break } - }, - clearHistory: function () { - this.history = new ur(this.history.maxGeneration) - }, - markClean: function () { - this.cleanGeneration = this.changeGeneration(!0) - }, - changeGeneration: function (e) { - return e && (this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null), this.history.generation - }, - isClean: function (e) { - return this.history.generation == (e || this.cleanGeneration) - }, - getHistory: function () { - return { - done: kr(this.history.done), - undone: kr(this.history.undone) + } + } + Rs.defineInitHook = function (e) { + return Ds.push(e) + }; + var As = null; + + function Ms(e) { + As = e + } + + function Ps(e, t, n, r, i) { + var o = e.doc; + e.display.shift = !1, r || (r = o.sel); + var s = +new Date - 200, + a = "paste" == i || e.state.pasteIncoming > s, + l = Me(t), + c = null; + if (a && r.ranges.length > 1) + if (As && As.text.join("\n") == t) { + if (r.ranges.length % As.text.length == 0) { + c = []; + for (var u = 0; u < As.text.length; u++) c.push(o.splitLines(As.text[u])) + } + } else l.length == r.ranges.length && e.options.pasteLinesPerSelection && (c = Y(l, (function (e) { + return [e] + }))); + for (var h = e.curOp.updateInput, p = r.ranges.length - 1; p >= 0; p--) { + var d = r.ranges[p], + f = d.from(), + m = d.to(); + d.empty() && (n && n > 0 ? f = et(f.line, f.ch - n) : e.state.overwrite && !a ? m = et(m.line, Math.min($e(o, m.line).text.length, m.ch + K(l).length)) : a && As && As.lineWise && As.text.join("\n") == t && (f = m = et(f.line, 0))); + var g = { + from: f, + to: m, + text: c ? c[p % c.length] : l, + origin: i || (a ? "paste" : e.state.cutIncoming > s ? "cut" : "+input") + }; + co(e.doc, g), ln(e, "inputRead", e, g) + } + t && !a && Os(e, t), Mr(e), e.curOp.updateInput < 2 && (e.curOp.updateInput = h), e.curOp.typing = !0, e.state.pasteIncoming = e.state.cutIncoming = -1 + } + + function Is(e, t) { + var n = e.clipboardData && e.clipboardData.getData("Text"); + if (n) return e.preventDefault(), t.isReadOnly() || t.options.disableInput || Jr(t, (function () { + return Ps(t, n, 0, null, "paste") + })), !0 + } + + function Os(e, t) { + if (e.options.electricChars && e.options.smartIndent) + for (var n = e.doc.sel, r = n.ranges.length - 1; r >= 0; r--) { + var i = n.ranges[r]; + if (!(i.head.ch > 100 || r && n.ranges[r - 1].head.line == i.head.line)) { + var o = e.getModeAt(i.head), + s = !1; + if (o.electricChars) { + for (var a = 0; a < o.electricChars.length; a++) + if (t.indexOf(o.electricChars.charAt(a)) > -1) { + s = _s(e, i.head.line, "smart"); + break + } + } else o.electricInput && o.electricInput.test($e(e.doc, i.head.line).text.slice(0, i.head.ch)) && (s = _s(e, i.head.line, "smart")); + s && ln(e, "electricInput", e, i.head.line) + } } - }, - setHistory: function (e) { - var t = this.history = new ur(this.history.maxGeneration); - t.done = kr(e.done.slice(0), null, !0), t.undone = kr(e.undone.slice(0), null, !0) - }, - setGutterMarker: Do(function (e, t, n) { - return Zr(this, e, 'gutter', function (e) { - var o = e.gutterMarkers || (e.gutterMarkers = {}); - return o[t] = n, !n && D(o) && (e.gutterMarkers = null), !0 - }) - }), - clearGutter: Do(function (e) { - var t = this; - this.iter(function (n) { - n.gutterMarkers && n.gutterMarkers[e] && Zr(t, n, 'gutter', function () { - return n.gutterMarkers[e] = null, D(n.gutterMarkers) && (n.gutterMarkers = null), !0 - }) - }) - }), - lineInfo: function (e) { - var t; - if ('number' == typeof e) { - if (!me(this, e)) return null; - if (t = e, e = se(this, e), !e) return null - } else if (t = pe(e), null == t) return null; - return { - line: t, - handle: e, - text: e.text, - gutterMarkers: e.gutterMarkers, - textClass: e.textClass, - bgClass: e.bgClass, - wrapClass: e.wrapClass, - widgets: e.widgets - } - }, - addLineClass: Do(function (t, n, o) { - return Zr(this, t, 'gutter' == n ? 'gutter' : 'class', function (t) { - var r = 'text' == n ? 'textClass' : 'background' == n ? 'bgClass' : 'gutter' == n ? 'gutterClass' : 'wrapClass'; - if (!t[r]) t[r] = o; - else { - if (e(o).test(t[r])) return !1; - t[r] += ' ' + o - } - return !0 - }) - }), - removeLineClass: Do(function (t, n, o) { - return Zr(this, t, 'gutter' == n ? 'gutter' : 'class', function (t) { - var r = 'text' == n ? 'textClass' : 'background' == n ? 'bgClass' : 'gutter' == n ? 'gutterClass' : 'wrapClass', - i = t[r]; - if (!i) return !1; - if (null == o) t[r] = null; - else { - var a = i.match(e(o)); - if (!a) return !1; - var s = a.index + a[0].length; - t[r] = i.slice(0, a.index) + (a.index && s != i.length ? ' ' : '') + i.slice(s) || null - } - return !0 - }) - }), - addLineWidget: Do(function (e, t, n) { - return ni(this, e, t, n) - }), - removeLineWidget: function (e) { - e.clear() - }, - markText: function (e, t, n) { - return oi(this, Ee(this, e), Ee(this, t), n, n && n.type || 'range') - }, - setBookmark: function (e, t) { - var n = { - replacedWith: t && (null == t.nodeType ? t.widget : t), - insertLeft: t && t.insertLeft, - clearWhenEmpty: !1, - shared: t && t.shared, - handleMouseEvents: t && t.handleMouseEvents - }; - return e = Ee(this, e), oi(this, e, e, n, 'bookmark') - }, - findMarksAt: function (e) { - e = Ee(this, e); - var t = [], - n = se(this, e.line).markedSpans; - if (n) - for (var o = 0, r; o < n.length; ++o) r = n[o], (null == r.from || r.from <= e.ch) && (null == r.to || r.to >= e.ch) && t.push(r.marker.parent || r.marker); - return t - }, - findMarks: function (e, t, n) { - e = Ee(this, e), t = Ee(this, t); - var o = [], - r = e.line; - return this.iter(e.line, t.line + 1, function (a) { - var s = a.markedSpans; - if (s) - for (var d = 0, i; d < s.length; d++) i = s[d], null != i.to && r == e.line && e.ch >= i.to || null == i.from && r != e.line || null != i.from && r == t.line && i.from >= t.ch || n && !n(i.marker) || o.push(i.marker.parent || i.marker); - ++r - }), o - }, - getAllMarks: function () { - var e = []; - return this.iter(function (t) { - var n = t.markedSpans; - if (n) - for (var o = 0; o < n.length; ++o) null != n[o].from && e.push(n[o].marker) - }), e - }, - posFromIndex: function (e) { - var t = this.first, - n = this.lineSeparator().length, - o; - return this.iter(function (r) { - var i = r.text.length + n; - return i > e ? (o = e, !0) : void(e -= i, ++t) - }), Ee(this, fe(t, o)) - }, - indexFromPos: function (e) { - e = Ee(this, e); - var t = e.ch; - if (e.line < this.first || 0 > e.ch) return 0; - var n = this.lineSeparator().length; - return this.iter(this.first, e.line, function (e) { - t += e.text.length + n - }), t - }, - copy: function (e) { - var t = new Vs(le(this, this.first, this.first + this.size), this.modeOption, this.first, this.lineSep, this.direction); - return t.scrollTop = this.scrollTop, t.scrollLeft = this.scrollLeft, t.sel = this.sel, t.extend = !1, e && (t.history.undoDepth = this.history.undoDepth, t.setHistory(this.getHistory())), t - }, - linkedDoc: function (e) { - e || (e = {}); - var t = this.first, - n = this.first + this.size; - null != e.from && e.from > t && (t = e.from), null != e.to && e.to < n && (n = e.to); - var o = new Vs(le(this, t, n), e.mode || this.modeOption, t, this.lineSep, this.direction); - return e.sharedHist && (o.history = this.history), (this.linked || (this.linked = [])).push({ - doc: o, - sharedHist: e.sharedHist - }), o.linked = [{ - doc: this, - isParent: !0, - sharedHist: e.sharedHist - }], ai(o, ii(this)), o - }, - unlinkDoc: function (e) { - var t = this; - if (e instanceof oa && (e = e.doc), this.linked) - for (var n = 0, o; n < this.linked.length; ++n) - if (o = t.linked[n], o.doc == e) { - t.linked.splice(n, 1), e.unlinkDoc(t), si(ii(t)); - break - } if (e.history == this.history) { - var r = [e.id]; - dr(e, function (e) { - return r.push(e.id) - }, !0), e.history = new ur(null), e.history.done = kr(this.history.done, r), e.history.undone = kr(this.history.undone, r) - } - }, - iterLinkedDocs: function (e) { - dr(this, e) - }, - getMode: function () { - return this.mode - }, - getEditor: function () { - return this.cm - }, - splitLines: function (e) { - return this.lineSep ? e.split(this.lineSep) : ss(e) - }, - lineSeparator: function () { - return this.lineSep || '\n' - }, - setDirection: Do(function (e) { - 'rtl' != e && (e = 'ltr'), e == this.direction || (this.direction = e, this.iter(function (e) { - return e.order = null - }), this.cm && pr(this.cm)) - }) - }), Vs.prototype.eachLine = Vs.prototype.iter; - for (var Gs = 0, Ks = !1, js = { - 3: 'Pause', - 8: 'Backspace', - 9: 'Tab', - 13: 'Enter', - 16: 'Shift', - 17: 'Ctrl', - 18: 'Alt', - 19: 'Pause', - 20: 'CapsLock', - 27: 'Esc', - 32: 'Space', - 33: 'PageUp', - 34: 'PageDown', - 35: 'End', - 36: 'Home', - 37: 'Left', - 38: 'Up', - 39: 'Right', - 40: 'Down', - 44: 'PrintScrn', - 45: 'Insert', - 46: 'Delete', - 59: ';', - 61: '=', - 91: 'Mod', - 92: 'Mod', - 93: 'Mod', - 106: '*', - 107: '=', - 109: '-', - 110: '.', - 111: '/', - 145: 'ScrollLock', - 173: '-', - 186: ';', - 187: '=', - 188: ',', - 189: '-', - 190: '.', - 191: '/', - 192: '`', - 219: '[', - 220: '\\', - 221: ']', - 222: '\'', - 63232: 'Up', - 63233: 'Down', - 63234: 'Left', - 63235: 'Right', - 63272: 'Delete', - 63273: 'Home', - 63275: 'End', - 63276: 'PageUp', - 63277: 'PageDown', - 63302: 'Insert' - }, qs = 0; 10 > qs; qs++) js[qs + 48] = js[qs + 96] = qs + ''; - for (var i = 65; 90 >= i; i++) js[i] = t(i); - for (var Ys = 1; 12 >= Ys; Ys++) js[Ys + 111] = js[Ys + 63235] = 'F' + Ys; - var Xs = {}; - Xs.basic = { - Left: 'goCharLeft', - Right: 'goCharRight', - Up: 'goLineUp', - Down: 'goLineDown', - End: 'goLineEnd', - Home: 'goLineStartSmart', - PageUp: 'goPageUp', - PageDown: 'goPageDown', - Delete: 'delCharAfter', - Backspace: 'delCharBefore', - "Shift-Backspace": 'delCharBefore', - Tab: 'defaultTab', - "Shift-Tab": 'indentAuto', - Enter: 'newlineAndIndent', - Insert: 'toggleOverwrite', - Esc: 'singleSelection' - }, Xs.pcDefault = { - "Ctrl-A": 'selectAll', - "Ctrl-D": 'deleteLine', - "Ctrl-Z": 'undo', - "Shift-Ctrl-Z": 'redo', - "Ctrl-Y": 'redo', - "Ctrl-Home": 'goDocStart', - "Ctrl-End": 'goDocEnd', - "Ctrl-Up": 'goLineUp', - "Ctrl-Down": 'goLineDown', - "Ctrl-Left": 'goGroupLeft', - "Ctrl-Right": 'goGroupRight', - "Alt-Left": 'goLineStart', - "Alt-Right": 'goLineEnd', - "Ctrl-Backspace": 'delGroupBefore', - "Ctrl-Delete": 'delGroupAfter', - "Ctrl-S": 'save', - "Ctrl-F": 'find', - "Ctrl-G": 'findNext', - "Shift-Ctrl-G": 'findPrev', - "Shift-Ctrl-F": 'replace', - "Shift-Ctrl-R": 'replaceAll', - "Ctrl-[": 'indentLess', - "Ctrl-]": 'indentMore', - "Ctrl-U": 'undoSelection', - "Shift-Ctrl-U": 'redoSelection', - "Alt-U": 'redoSelection', - fallthrough: 'basic' - }, Xs.emacsy = { - "Ctrl-F": 'goCharRight', - "Ctrl-B": 'goCharLeft', - "Ctrl-P": 'goLineUp', - "Ctrl-N": 'goLineDown', - "Alt-F": 'goWordRight', - "Alt-B": 'goWordLeft', - "Ctrl-A": 'goLineStart', - "Ctrl-E": 'goLineEnd', - "Ctrl-V": 'goPageDown', - "Shift-Ctrl-V": 'goPageUp', - "Ctrl-D": 'delCharAfter', - "Ctrl-H": 'delCharBefore', - "Alt-D": 'delWordAfter', - "Alt-Backspace": 'delWordBefore', - "Ctrl-K": 'killLine', - "Ctrl-T": 'transposeChars', - "Ctrl-O": 'openLine' - }, Xs.macDefault = { - "Cmd-A": 'selectAll', - "Cmd-D": 'deleteLine', - "Cmd-Z": 'undo', - "Shift-Cmd-Z": 'redo', - "Cmd-Y": 'redo', - "Cmd-Home": 'goDocStart', - "Cmd-Up": 'goDocStart', - "Cmd-End": 'goDocEnd', - "Cmd-Down": 'goDocEnd', - "Alt-Left": 'goGroupLeft', - "Alt-Right": 'goGroupRight', - "Cmd-Left": 'goLineLeft', - "Cmd-Right": 'goLineRight', - "Alt-Backspace": 'delGroupBefore', - "Ctrl-Alt-Backspace": 'delGroupAfter', - "Alt-Delete": 'delGroupAfter', - "Cmd-S": 'save', - "Cmd-F": 'find', - "Cmd-G": 'findNext', - "Shift-Cmd-G": 'findPrev', - "Cmd-Alt-F": 'replace', - "Shift-Cmd-Alt-F": 'replaceAll', - "Cmd-[": 'indentLess', - "Cmd-]": 'indentMore', - "Cmd-Backspace": 'delWrappedLineLeft', - "Cmd-Delete": 'delWrappedLineRight', - "Cmd-U": 'undoSelection', - "Shift-Cmd-U": 'redoSelection', - "Ctrl-Up": 'goDocStart', - "Ctrl-Down": 'goDocEnd', - fallthrough: ['basic', 'emacsy'] - }, Xs['default'] = Ha ? Xs.macDefault : Xs.pcDefault; - var Qs = { - selectAll: zr, - singleSelection: function (e) { - return e.setSelection(e.getCursor('anchor'), e.getCursor('head'), $a) - }, - killLine: function (e) { - return wi(e, function (t) { - if (t.empty()) { - var n = se(e.doc, t.head.line).text.length; - return t.head.ch == n && t.head.line < e.lastLine() ? { - from: t.head, - to: fe(t.head.line + 1, 0) - } : { - from: t.head, - to: fe(t.head.line, n) + } + + function Ls(e) { + for (var t = [], n = [], r = 0; r < e.doc.sel.ranges.length; r++) { + var i = e.doc.sel.ranges[r].head.line, + o = { + anchor: et(i, 0), + head: et(i + 1, 0) + }; + n.push(o), t.push(e.getRange(o.anchor, o.head)) + } + return { + text: t, + ranges: n + } + } + + function Ns(e, t, n, r) { + e.setAttribute("autocorrect", n ? "" : "off"), e.setAttribute("autocapitalize", r ? "" : "off"), e.setAttribute("spellcheck", !!t) + } + + function Fs() { + var e = _("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"), + t = _("div", [e], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); + return l ? e.style.width = "1000px" : e.setAttribute("wrap", "off"), m && (e.style.border = "1px solid black"), Ns(e), t + } + + function Bs(e, t, n, r, i) { + var o = t, + s = n, + a = $e(e, t.line); + + function l(r) { + var o, s; + if (null == (o = i ? function (e, t, n, r) { + var i = ce(t, e.doc.direction); + if (!i) return Jo(t, n, r); + n.ch >= t.text.length ? (n.ch = t.text.length, n.sticky = "before") : n.ch <= 0 && (n.ch = 0, n.sticky = "after"); + var o = ae(i, n.ch, n.sticky), + s = i[o]; + if ("ltr" == e.doc.direction && s.level % 2 == 0 && (r > 0 ? s.to > n.ch : s.from < n.ch)) return Jo(t, n, r); + var a, l = function (e, n) { + return Xo(t, e instanceof et ? e.ch : e, n) + }, + c = function (n) { + return e.options.lineWrapping ? (a = a || Pn(e, t), Xn(e, t, a, n)) : { + begin: 0, + end: t.text.length + } + }, + u = c("before" == n.sticky ? l(n, -1) : n.ch); + if ("rtl" == e.doc.direction || 1 == s.level) { + var h = 1 == s.level == r < 0, + p = l(n, h ? 1 : -1); + if (null != p && (h ? p <= s.to && p <= u.end : p >= s.from && p >= u.begin)) { + var d = h ? "before" : "after"; + return new et(n.line, p, d) } } - return { - from: t.from(), - to: t.to() - } - }) - }, - deleteLine: function (e) { - return wi(e, function (t) { - return { - from: fe(t.from().line, 0), - to: Ee(e.doc, fe(t.to().line + 1, 0)) - } - }) - }, - delLineLeft: function (e) { - return wi(e, function (e) { - return { - from: fe(e.from().line, 0), - to: e.from() - } - }) - }, - delWrappedLineLeft: function (e) { - return wi(e, function (t) { - var n = e.charCoords(t.head, 'div').top + 5, - o = e.coordsChar({ - left: 0, - top: n - }, 'div'); - return { - from: o, - to: t.from() - } - }) - }, - delWrappedLineRight: function (e) { - return wi(e, function (t) { - var n = e.charCoords(t.head, 'div').top + 5, - o = e.coordsChar({ - left: e.display.lineDiv.offsetWidth + 100, - top: n - }, 'div'); - return { - from: t.from(), - to: o - } - }) - }, - undo: function (e) { - return e.undo() - }, - redo: function (e) { - return e.redo() - }, - undoSelection: function (e) { - return e.undoSelection() - }, - redoSelection: function (e) { - return e.redoSelection() - }, - goDocStart: function (e) { - return e.extendSelection(fe(e.firstLine(), 0)) - }, - goDocEnd: function (e) { - return e.extendSelection(fe(e.lastLine())) - }, - goLineStart: function (e) { - return e.extendSelectionsBy(function (t) { - return xi(e, t.head.line) - }, { - origin: '+move', - bias: 1 - }) - }, - goLineStartSmart: function (e) { - return e.extendSelectionsBy(function (t) { - return Di(e, t.head) - }, { - origin: '+move', - bias: 1 - }) - }, - goLineEnd: function (e) { - return e.extendSelectionsBy(function (t) { - return Pi(e, t.head.line) - }, { - origin: '+move', - bias: -1 - }) - }, - goLineRight: function (e) { - return e.extendSelectionsBy(function (t) { - var n = e.cursorCoords(t.head, 'div').top + 5; - return e.coordsChar({ - left: e.display.lineDiv.offsetWidth + 100, - top: n - }, 'div') - }, Ja) - }, - goLineLeft: function (e) { - return e.extendSelectionsBy(function (t) { - var n = e.cursorCoords(t.head, 'div').top + 5; - return e.coordsChar({ - left: 0, - top: n - }, 'div') - }, Ja) - }, - goLineLeftSmart: function (e) { - return e.extendSelectionsBy(function (t) { - var n = e.cursorCoords(t.head, 'div').top + 5, - o = e.coordsChar({ - left: 0, - top: n - }, 'div'); - return o.ch < e.getLine(o.line).search(/\S/) ? Di(e, t.head) : o - }, Ja) - }, - goLineUp: function (e) { - return e.moveV(-1, 'line') - }, - goLineDown: function (e) { - return e.moveV(1, 'line') - }, - goPageUp: function (e) { - return e.moveV(-1, 'page') - }, - goPageDown: function (e) { - return e.moveV(1, 'page') - }, - goCharLeft: function (e) { - return e.moveH(-1, 'char') - }, - goCharRight: function (e) { - return e.moveH(1, 'char') - }, - goColumnLeft: function (e) { - return e.moveH(-1, 'column') - }, - goColumnRight: function (e) { - return e.moveH(1, 'column') - }, - goWordLeft: function (e) { - return e.moveH(-1, 'word') - }, - goGroupRight: function (e) { - return e.moveH(1, 'group') - }, - goGroupLeft: function (e) { - return e.moveH(-1, 'group') - }, - goWordRight: function (e) { - return e.moveH(1, 'word') - }, - delCharBefore: function (e) { - return e.deleteH(-1, 'char') - }, - delCharAfter: function (e) { - return e.deleteH(1, 'char') - }, - delWordBefore: function (e) { - return e.deleteH(-1, 'word') - }, - delWordAfter: function (e) { - return e.deleteH(1, 'word') - }, - delGroupBefore: function (e) { - return e.deleteH(-1, 'group') - }, - delGroupAfter: function (e) { - return e.deleteH(1, 'group') - }, - indentAuto: function (e) { - return e.indentSelection('smart') - }, - indentMore: function (e) { - return e.indentSelection('add') - }, - indentLess: function (e) { - return e.indentSelection('subtract') - }, - insertTab: function (e) { - return e.replaceSelection('\t') - }, - insertSoftTab: function (e) { - for (var t = [], n = e.listSelections(), o = e.options.tabSize, r = 0; r < n.length; r++) { - var i = n[r].from(), - a = C(e.getLine(i.line), i.ch, o); - t.push(E(o - a % o)) - } - e.replaceSelections(t) - }, - defaultTab: function (e) { - e.somethingSelected() ? e.indentSelection('add') : e.execCommand('insertTab') - }, - transposeChars: function (e) { - return Ro(e, function () { - for (var t = e.listSelections(), n = [], o = 0; o < t.length; o++) - if (t[o].empty()) { - var r = t[o].head, - i = se(e.doc, r.line).text; - if (i) - if (r.ch == i.length && (r = new fe(r.line, r.ch - 1)), 0 < r.ch) r = new fe(r.line, r.ch + 1), e.replaceRange(i.charAt(r.ch - 1) + i.charAt(r.ch - 2), fe(r.line, r.ch - 2), r, '+transpose'); - else if (r.line > e.doc.first) { - var a = se(e.doc, r.line - 1).text; - a && (r = new fe(r.line, 1), e.replaceRange(i.charAt(0) + e.doc.lineSeparator() + a.charAt(a.length - 1), fe(r.line - 1, a.length - 1), r, '+transpose')) + var f = function (e, t, r) { + for (var o = function (e, t) { + return t ? new et(n.line, l(e, 1), "before") : new et(n.line, e, "after") + }; e >= 0 && e < i.length; e += t) { + var s = i[e], + a = t > 0 == (1 != s.level), + c = a ? r.begin : l(r.end, -1); + if (s.from <= c && c < s.to) return o(c, a); + if (c = a ? s.from : l(s.to, -1), r.begin <= c && c < r.end) return o(c, a) } - n.push(new Ns(r, r)) - } e.setSelections(n) - }) - }, - newlineAndIndent: function (e) { - return Ro(e, function () { - for (var t = e.listSelections(), n = t.length - 1; 0 <= n; n--) e.replaceRange(e.doc.lineSeparator(), t[n].anchor, t[n].head, '+input'); - t = e.listSelections(); - for (var o = 0; o < t.length; o++) e.indentLine(t[o].from().line, null, !0); - ao(e) - }) - }, - openLine: function (e) { - return e.replaceSelection('\n', 'start') - }, - toggleOverwrite: function (e) { - return e.toggleOverwrite() + }, + m = f(o + r, r, u); + if (m) return m; + var g = r > 0 ? u.end : l(u.begin, -1); + return null == g || r > 0 && g == t.text.length || !(m = f(r > 0 ? 0 : i.length - 1, r, c(g))) ? null : m + }(e.cm, a, t, n) : Jo(a, t, n))) { + if (r || (s = t.line + n) < e.first || s >= e.first + e.size || (t = new et(s, t.ch, t.sticky), !(a = $e(e, s)))) return !1; + t = es(i, e.cm, a, t.line, n) + } else t = o; + return !0 + } + if ("char" == r) l(); + else if ("column" == r) l(!0); + else if ("word" == r || "group" == r) + for (var c = null, u = "group" == r, h = e.cm && e.cm.getHelper(t, "wordChars"), p = !0; !(n < 0) || l(!p); p = !1) { + var d = a.text.charAt(t.ch) || "\n", + f = ee(d, h) ? "w" : u && "\n" == d ? "n" : !u || /\s/.test(d) ? null : "p"; + if (!u || p || f || (f = "s"), c && c != f) { + n < 0 && (n = 1, l(), t.sticky = "after"); + break + } + if (f && (c = f), n > 0 && !l(!p)) break } - }, - $s = new Ya, - Zs = null, - Js = function (e, t, n) { - this.time = e, this.pos = t, this.button = n - }; - Js.prototype.compare = function (e, t, n) { - return this.time + 400 > e && 0 == ge(t, this.pos) && n == this.button - }; - var ed = { - toString: function () { - return 'CodeMirror.Init' + var m = oo(e, t, o, s, !0); + return nt(o, m) && (m.hitSide = !0), m + } + + function Hs(e, t, n, r) { + var i, o, s = e.doc, + a = t.left; + if ("page" == r) { + var l = Math.min(e.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight), + c = Math.max(l - .5 * rr(e.display), 3); + i = (n > 0 ? t.bottom : t.top) + n * c + } else "line" == r && (i = n > 0 ? t.bottom + 3 : t.top - 3); + for (; + (o = Qn(e, a, i)).outside;) { + if (n < 0 ? i <= 0 : i >= s.height) { + o.hitSide = !0; + break } - }, - td = {}, - nd = {}, - od, rd; - oa.defaults = td, oa.optionHandlers = nd; - var id = []; - oa.defineInitHook = function (e) { - return id.push(e) + i += 5 * n + } + return o + } + var zs = function (e) { + this.cm = e, this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null, this.polling = new H, this.composing = null, this.gracePeriod = !1, this.readDOMTimeout = null }; - var ad = null, - sd = function (e) { - this.cm = e, this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null, this.polling = new Ya, this.composing = null, this.gracePeriod = !1, this.readDOMTimeout = null - }; - sd.prototype.init = function (e) { - function t(t) { - if (!z(r, t)) { - if (r.somethingSelected()) aa({ + + function Us(e, t) { + var n = Mn(e, t.line); + if (!n || n.hidden) return null; + var r = $e(e.doc, t.line), + i = _n(n, r, t.line), + o = ce(r, e.doc.direction), + s = "left"; + o && (s = ae(o, t.ch) % 2 ? "right" : "left"); + var a = Nn(i.map, t.ch, s); + return a.offset = "right" == a.collapse ? a.end : a.start, a + } + + function Ws(e, t) { + return t && (e.bad = !0), e + } + + function Vs(e, t, n) { + var r; + if (t == e.display.lineDiv) { + if (!(r = e.display.lineDiv.childNodes[n])) return Ws(e.clipPos(et(e.display.viewTo - 1)), !0); + t = null, n = 0 + } else + for (r = t;; r = r.parentNode) { + if (!r || r == e.display.lineDiv) return null; + if (r.parentNode && r.parentNode == e.display.lineDiv) break + } + for (var i = 0; i < e.display.view.length; i++) { + var o = e.display.view[i]; + if (o.node == r) return js(o, t, n) + } + } + + function js(e, t, n) { + var r = e.text.firstChild, + i = !1; + if (!t || !M(r, t)) return Ws(et(Qe(e.line), 0), !0); + if (t == r && (i = !0, t = r.childNodes[n], n = 0, !t)) { + var o = e.rest ? K(e.rest) : e.line; + return Ws(et(Qe(o), o.text.length), i) + } + var s = 3 == t.nodeType ? t : null, + a = t; + for (s || 1 != t.childNodes.length || 3 != t.firstChild.nodeType || (s = t.firstChild, n && (n = s.nodeValue.length)); a.parentNode != r;) a = a.parentNode; + var l = e.measure, + c = l.maps; + + function u(t, n, r) { + for (var i = -1; i < (c ? c.length : 0); i++) + for (var o = i < 0 ? l.map : c[i], s = 0; s < o.length; s += 3) { + var a = o[s + 2]; + if (a == t || a == n) { + var u = Qe(i < 0 ? e.line : e.rest[i]), + h = o[s] + r; + return (r < 0 || a != t) && (h = o[s + (r ? 1 : 0)]), et(u, h) + } + } + } + var h = u(s, a, n); + if (h) return Ws(h, i); + for (var p = a.nextSibling, d = s ? s.nodeValue.length - n : 0; p; p = p.nextSibling) { + if (h = u(p, p.firstChild, 0)) return Ws(et(h.line, h.ch - d), i); + d += p.textContent.length + } + for (var f = a.previousSibling, m = n; f; f = f.previousSibling) { + if (h = u(f, f.firstChild, -1)) return Ws(et(h.line, h.ch + m), i); + m += f.textContent.length + } + } + zs.prototype.init = function (e) { + var t = this, + n = this, + r = n.cm, + i = n.div = e.lineDiv; + + function o(e) { + if (!me(r, e)) { + if (r.somethingSelected()) Ms({ lineWise: !1, text: r.getSelections() - }), 'cut' == t.type && r.replaceSelection('', null, 'cut'); + }), "cut" == e.type && r.replaceSelection("", null, "cut"); else { if (!r.options.lineWiseCopyCut) return; - var e = ca(r); - aa({ + var t = Ls(r); + Ms({ lineWise: !0, - text: e.text - }), 'cut' == t.type && r.operation(function () { - r.setSelections(e.ranges, 0, $a), r.replaceSelection('', null, 'cut') - }) + text: t.text + }), "cut" == e.type && r.operation((function () { + r.setSelections(t.ranges, 0, W), r.replaceSelection("", null, "cut") + })) } - if (t.clipboardData) { - t.clipboardData.clearData(); - var n = ad.text.join('\n'); - if (t.clipboardData.setData('Text', n), t.clipboardData.getData('Text') == n) return void t.preventDefault() + if (e.clipboardData) { + e.clipboardData.clearData(); + var o = As.text.join("\n"); + if (e.clipboardData.setData("Text", o), e.clipboardData.getData("Text") == o) return void e.preventDefault() } - var a = ua(), - s = a.firstChild; - r.display.lineSpace.insertBefore(a, r.display.lineSpace.firstChild), s.value = ad.text.join('\n'); - var d = document.activeElement; - qa(s), setTimeout(function () { - r.display.lineSpace.removeChild(a), d.focus(), d == i && o.showPrimarySelection() - }, 50) - } - } - var n = this, - o = this, - r = o.cm, - i = o.div = e.lineDiv; - pa(i, r.options.spellcheck, r.options.autocorrect, r.options.autocapitalize), as(i, 'paste', function (t) { - z(r, t) || da(t, r) || 11 >= xa && setTimeout(xo(r, function () { - return n.updateFromDOM() - }), 20) - }), as(i, 'compositionstart', function (t) { - n.composing = { - data: t.data, + var s = Fs(), + a = s.firstChild; + r.display.lineSpace.insertBefore(s, r.display.lineSpace.firstChild), a.value = As.text.join("\n"); + var l = document.activeElement; + L(a), setTimeout((function () { + r.display.lineSpace.removeChild(s), l.focus(), l == i && n.showPrimarySelection() + }), 50) + } + } + Ns(i, r.options.spellcheck, r.options.autocorrect, r.options.autocapitalize), he(i, "paste", (function (e) { + me(r, e) || Is(e, r) || a <= 11 && setTimeout(ei(r, (function () { + return t.updateFromDOM() + })), 20) + })), he(i, "compositionstart", (function (e) { + t.composing = { + data: e.data, done: !1 } - }), as(i, 'compositionupdate', function (t) { - n.composing || (n.composing = { - data: t.data, + })), he(i, "compositionupdate", (function (e) { + t.composing || (t.composing = { + data: e.data, done: !1 }) - }), as(i, 'compositionend', function (t) { - n.composing && (t.data != n.composing.data && n.readFromDOMSoon(), n.composing.done = !0) - }), as(i, 'touchstart', function () { - return o.forceCompositionEnd() - }), as(i, 'input', function () { - n.composing || n.readFromDOMSoon() - }), as(i, 'copy', t), as(i, 'cut', t) - }, sd.prototype.prepareSelection = function () { - var e = Vn(this.cm, !1); + })), he(i, "compositionend", (function (e) { + t.composing && (e.data != t.composing.data && t.readFromDOMSoon(), t.composing.done = !0) + })), he(i, "touchstart", (function () { + return n.forceCompositionEnd() + })), he(i, "input", (function () { + t.composing || t.readFromDOMSoon() + })), he(i, "copy", o), he(i, "cut", o) + }, zs.prototype.prepareSelection = function () { + var e = yr(this.cm, !1); return e.focus = this.cm.state.focused, e - }, sd.prototype.showSelection = function (e, t) { + }, zs.prototype.showSelection = function (e, t) { e && this.cm.display.view.length && ((e.focus || t) && this.showPrimarySelection(), this.showMultipleSelections(e)) - }, sd.prototype.getSelection = function () { + }, zs.prototype.getSelection = function () { return this.cm.display.wrapper.ownerDocument.getSelection() - }, sd.prototype.showPrimarySelection = function () { + }, zs.prototype.showPrimarySelection = function () { var e = this.getSelection(), t = this.cm, - n = t.doc.sel.primary(), - o = n.from(), - r = n.to(); - if (t.display.viewTo == t.display.viewFrom || o.line >= t.display.viewTo || r.line < t.display.viewFrom) return void e.removeAllRanges(); - var i = Ca(t, e.anchorNode, e.anchorOffset), - a = Ca(t, e.focusNode, e.focusOffset); - if (!i || i.bad || !a || a.bad || 0 != ge(be(i, a), o) || 0 != ge(Ce(i, a), r)) { - var s = t.display.view, - d = o.line >= t.display.viewFrom && fa(t, o) || { - node: s[0].measure.map[2], - offset: 0 - }, - l = r.line < t.display.viewTo && fa(t, r); - if (!l) { - var c = s[s.length - 1].measure, - p = c.maps ? c.maps[c.maps.length - 1] : c.map; - l = { - node: p[p.length - 1], - offset: p[p.length - 2] - p[p.length - 3] + r = t.doc.sel.primary(), + i = r.from(), + o = r.to(); + if (t.display.viewTo == t.display.viewFrom || i.line >= t.display.viewTo || o.line < t.display.viewFrom) e.removeAllRanges(); + else { + var s = Vs(t, e.anchorNode, e.anchorOffset), + a = Vs(t, e.focusNode, e.focusOffset); + if (!s || s.bad || !a || a.bad || 0 != tt(ot(s, a), i) || 0 != tt(it(s, a), o)) { + var l = t.display.view, + c = i.line >= t.display.viewFrom && Us(t, i) || { + node: l[0].measure.map[2], + offset: 0 + }, + u = o.line < t.display.viewTo && Us(t, o); + if (!u) { + var h = l[l.length - 1].measure, + p = h.maps ? h.maps[h.maps.length - 1] : h.map; + u = { + node: p[p.length - 1], + offset: p[p.length - 2] - p[p.length - 3] + } } + if (c && u) { + var d, f = e.rangeCount && e.getRangeAt(0); + try { + d = x(c.node, c.offset, u.offset, u.node) + } catch (e) {} + d && (!n && t.state.focused ? (e.collapse(c.node, c.offset), d.collapsed || (e.removeAllRanges(), e.addRange(d))) : (e.removeAllRanges(), e.addRange(d)), f && null == e.anchorNode ? e.addRange(f) : n && this.startGracePeriod()), this.rememberSelection() + } else e.removeAllRanges() } - if (!d || !l) return void e.removeAllRanges(); - var u = e.rangeCount && e.getRangeAt(0), - m; - try { - m = ja(d.node, d.offset, l.offset, l.node) - } catch (t) {} - m && (!wa && t.state.focused ? (e.collapse(d.node, d.offset), !m.collapsed && (e.removeAllRanges(), e.addRange(m))) : (e.removeAllRanges(), e.addRange(m)), u && null == e.anchorNode ? e.addRange(u) : wa && this.startGracePeriod()), this.rememberSelection() } - }, sd.prototype.startGracePeriod = function () { + }, zs.prototype.startGracePeriod = function () { var e = this; - clearTimeout(this.gracePeriod), this.gracePeriod = setTimeout(function () { - e.gracePeriod = !1, e.selectionChanged() && e.cm.operation(function () { + clearTimeout(this.gracePeriod), this.gracePeriod = setTimeout((function () { + e.gracePeriod = !1, e.selectionChanged() && e.cm.operation((function () { return e.cm.curOp.selectionChanged = !0 - }) - }, 20) - }, sd.prototype.showMultipleSelections = function (e) { - c(this.cm.display.cursorDiv, e.cursors), c(this.cm.display.selectionDiv, e.selection) - }, sd.prototype.rememberSelection = function () { + })) + }), 20) + }, zs.prototype.showMultipleSelections = function (e) { + D(this.cm.display.cursorDiv, e.cursors), D(this.cm.display.selectionDiv, e.selection) + }, zs.prototype.rememberSelection = function () { var e = this.getSelection(); this.lastAnchorNode = e.anchorNode, this.lastAnchorOffset = e.anchorOffset, this.lastFocusNode = e.focusNode, this.lastFocusOffset = e.focusOffset - }, sd.prototype.selectionInEditor = function () { + }, zs.prototype.selectionInEditor = function () { var e = this.getSelection(); if (!e.rangeCount) return !1; var t = e.getRangeAt(0).commonAncestorContainer; - return m(this.div, t) - }, sd.prototype.focus = function () { - 'nocursor' != this.cm.options.readOnly && (!this.selectionInEditor() && this.showSelection(this.prepareSelection(), !0), this.div.focus()) - }, sd.prototype.blur = function () { + return M(this.div, t) + }, zs.prototype.focus = function () { + "nocursor" != this.cm.options.readOnly && (this.selectionInEditor() || this.showSelection(this.prepareSelection(), !0), this.div.focus()) + }, zs.prototype.blur = function () { this.div.blur() - }, sd.prototype.getField = function () { + }, zs.prototype.getField = function () { return this.div - }, sd.prototype.supportsTouch = function () { + }, zs.prototype.supportsTouch = function () { return !0 - }, sd.prototype.receivedFocus = function () { - function e() { - t.cm.state.focused && (t.pollSelection(), t.polling.set(t.cm.options.pollInterval, e)) - } - var t = this; - this.selectionInEditor() ? this.pollSelection() : Ro(this.cm, function () { - return t.cm.curOp.selectionChanged = !0 - }), this.polling.set(this.cm.options.pollInterval, e) - }, sd.prototype.selectionChanged = function () { + }, zs.prototype.receivedFocus = function () { + var e = this; + this.selectionInEditor() ? this.pollSelection() : Jr(this.cm, (function () { + return e.cm.curOp.selectionChanged = !0 + })), this.polling.set(this.cm.options.pollInterval, (function t() { + e.cm.state.focused && (e.pollSelection(), e.polling.set(e.cm.options.pollInterval, t)) + })) + }, zs.prototype.selectionChanged = function () { var e = this.getSelection(); return e.anchorNode != this.lastAnchorNode || e.anchorOffset != this.lastAnchorOffset || e.focusNode != this.lastFocusNode || e.focusOffset != this.lastFocusOffset - }, sd.prototype.pollSelection = function () { + }, zs.prototype.pollSelection = function () { if (null == this.readDOMTimeout && !this.gracePeriod && this.selectionChanged()) { var e = this.getSelection(), t = this.cm; - if (Na && Ma && this.cm.display.gutterSpecs.length && ga(e.anchorNode)) return this.cm.triggerOnKeyDown({ - type: 'keydown', + if (g && u && this.cm.display.gutterSpecs.length && function (e) { + for (var t = e; t; t = t.parentNode) + if (/CodeMirror-gutter-wrapper/.test(t.className)) return !0; + return !1 + }(e.anchorNode)) return this.cm.triggerOnKeyDown({ + type: "keydown", keyCode: 8, - preventDefault: o + preventDefault: Math.abs }), this.blur(), void this.focus(); if (!this.composing) { this.rememberSelection(); - var n = Ca(t, e.anchorNode, e.anchorOffset), - r = Ca(t, e.focusNode, e.focusOffset); - n && r && Ro(t, function () { - Ar(t.doc, Zo(n, r), $a), (n.bad || r.bad) && (t.curOp.selectionChanged = !0) - }) + var n = Vs(t, e.anchorNode, e.anchorOffset), + r = Vs(t, e.focusNode, e.focusOffset); + n && r && Jr(t, (function () { + Ji(t.doc, xi(n, r), W), (n.bad || r.bad) && (t.curOp.selectionChanged = !0) + })) } } - }, sd.prototype.pollContent = function () { + }, zs.prototype.pollContent = function () { null != this.readDOMTimeout && (clearTimeout(this.readDOMTimeout), this.readDOMTimeout = null); - var e = this.cm, - t = e.display, - n = e.doc.sel.primary(), - o = n.from(), - r = n.to(); - if (0 == o.ch && o.line > e.firstLine() && (o = fe(o.line - 1, se(e.doc, o.line - 1).length)), r.ch == se(e.doc, r.line).text.length && r.line < e.lastLine() && (r = fe(r.line + 1, 0)), o.line < t.viewFrom || r.line > t.viewTo - 1) return !1; - var i, a, s; - o.line == t.viewFrom || 0 == (i = Fn(e, o.line)) ? (a = pe(t.view[0].line), s = t.view[0].node) : (a = pe(t.view[i].line), s = t.view[i - 1].node.nextSibling); - var l = Fn(e, r.line), - c, p; - if (l == t.view.length - 1 ? (c = t.viewTo - 1, p = t.lineDiv.lastChild) : (c = pe(t.view[l + 1].line) - 1, p = t.view[l + 1].node.previousSibling), !s) return !1; - for (var u = e.doc.splitLines(Sa(e, s, p, a, c)), m = de(e.doc, fe(a, 0), fe(c, se(e.doc, c).text.length)); 1 < u.length && 1 < m.length;) - if (w(u) == w(m)) u.pop(), m.pop(), c--; - else if (u[0] == m[0]) u.shift(), m.shift(), a++; - else break; - for (var h = 0, f = 0, g = u[0], y = m[0], S = d(g.length, y.length); h < S && g.charCodeAt(h) == y.charCodeAt(h);) ++h; - for (var C = w(u), b = w(m), v = d(C.length - (1 == u.length ? h : 0), b.length - (1 == m.length ? h : 0)); f < v && C.charCodeAt(C.length - f - 1) == b.charCodeAt(b.length - f - 1);) ++f; - if (1 == u.length && 1 == m.length && a == o.line) - for (; h && h > o.ch && C.charCodeAt(C.length - f - 1) == b.charCodeAt(b.length - f - 1);) h--, f++; - u[u.length - 1] = C.slice(0, C.length - f).replace(/^\u200b+/, ''), u[0] = u[0].slice(h).replace(/\u200b+$/, ''); - var E = fe(a, h), - k = fe(c, m.length ? w(m).length - f : 0); - if (1 < u.length || u[0] || ge(E, k)) return Yr(e.doc, u, E, k, '+input'), !0 - }, sd.prototype.ensurePolled = function () { + var e, t, n, r = this.cm, + i = r.display, + o = r.doc.sel.primary(), + s = o.from(), + a = o.to(); + if (0 == s.ch && s.line > r.firstLine() && (s = et(s.line - 1, $e(r.doc, s.line - 1).length)), a.ch == $e(r.doc, a.line).text.length && a.line < r.lastLine() && (a = et(a.line + 1, 0)), s.line < i.viewFrom || a.line > i.viewTo - 1) return !1; + s.line == i.viewFrom || 0 == (e = ur(r, s.line)) ? (t = Qe(i.view[0].line), n = i.view[0].node) : (t = Qe(i.view[e].line), n = i.view[e - 1].node.nextSibling); + var l, c, u = ur(r, a.line); + if (u == i.view.length - 1 ? (l = i.viewTo - 1, c = i.lineDiv.lastChild) : (l = Qe(i.view[u + 1].line) - 1, c = i.view[u + 1].node.previousSibling), !n) return !1; + for (var h = r.doc.splitLines(function (e, t, n, r, i) { + var o = "", + s = !1, + a = e.doc.lineSeparator(), + l = !1; + + function c() { + s && (o += a, l && (o += a), s = l = !1) + } + + function u(e) { + e && (c(), o += e) + } + + function h(t) { + if (1 == t.nodeType) { + var n = t.getAttribute("cm-text"); + if (n) return void u(n); + var o, p = t.getAttribute("cm-marker"); + if (p) { + var d = e.findMarks(et(r, 0), et(i + 1, 0), (g = +p, function (e) { + return e.id == g + })); + return void(d.length && (o = d[0].find(0)) && u(qe(e.doc, o.from, o.to).join(a))) + } + if ("false" == t.getAttribute("contenteditable")) return; + var f = /^(pre|div|p|li|table|br)$/i.test(t.nodeName); + if (!/^br$/i.test(t.nodeName) && 0 == t.textContent.length) return; + f && c(); + for (var m = 0; m < t.childNodes.length; m++) h(t.childNodes[m]); + /^(pre|p)$/i.test(t.nodeName) && (l = !0), f && (s = !0) + } else 3 == t.nodeType && u(t.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " ")); + var g + } + for (; h(t), t != n;) t = t.nextSibling, l = !1; + return o + }(r, n, c, t, l)), p = qe(r.doc, et(t, 0), et(l, $e(r.doc, l).text.length)); h.length > 1 && p.length > 1;) + if (K(h) == K(p)) h.pop(), p.pop(), l--; + else { + if (h[0] != p[0]) break; + h.shift(), p.shift(), t++ + } for (var d = 0, f = 0, m = h[0], g = p[0], y = Math.min(m.length, g.length); d < y && m.charCodeAt(d) == g.charCodeAt(d);) ++d; + for (var v = K(h), w = K(p), b = Math.min(v.length - (1 == h.length ? d : 0), w.length - (1 == p.length ? d : 0)); f < b && v.charCodeAt(v.length - f - 1) == w.charCodeAt(w.length - f - 1);) ++f; + if (1 == h.length && 1 == p.length && t == s.line) + for (; d && d > s.ch && v.charCodeAt(v.length - f - 1) == w.charCodeAt(w.length - f - 1);) d--, f++; + h[h.length - 1] = v.slice(0, v.length - f).replace(/^\u200b+/, ""), h[0] = h[0].slice(d).replace(/\u200b+$/, ""); + var S = et(t, d), + C = et(l, p.length ? K(p).length - f : 0); + return h.length > 1 || h[0] || tt(S, C) ? (mo(r.doc, h, S, C, "+input"), !0) : void 0 + }, zs.prototype.ensurePolled = function () { this.forceCompositionEnd() - }, sd.prototype.reset = function () { + }, zs.prototype.reset = function () { this.forceCompositionEnd() - }, sd.prototype.forceCompositionEnd = function () { + }, zs.prototype.forceCompositionEnd = function () { this.composing && (clearTimeout(this.readDOMTimeout), this.composing = null, this.updateFromDOM(), this.div.blur(), this.div.focus()) - }, sd.prototype.readFromDOMSoon = function () { + }, zs.prototype.readFromDOMSoon = function () { var e = this; - null != this.readDOMTimeout || (this.readDOMTimeout = setTimeout(function () { - if (e.readDOMTimeout = null, e.composing) - if (e.composing.done) e.composing = null; - else return; + null == this.readDOMTimeout && (this.readDOMTimeout = setTimeout((function () { + if (e.readDOMTimeout = null, e.composing) { + if (!e.composing.done) return; + e.composing = null + } e.updateFromDOM() - }, 80)) - }, sd.prototype.updateFromDOM = function () { + }), 80)) + }, zs.prototype.updateFromDOM = function () { var e = this; - (this.cm.isReadOnly() || !this.pollContent()) && Ro(this.cm, function () { - return Bn(e.cm) - }) - }, sd.prototype.setUneditable = function (e) { - e.contentEditable = 'false' - }, sd.prototype.onKeyPress = function (n) { - 0 == n.charCode || this.composing || (n.preventDefault(), !this.cm.isReadOnly() && xo(this.cm, sa)(this.cm, t(null == n.charCode ? n.keyCode : n.charCode), 0)) - }, sd.prototype.readOnlyChanged = function (e) { - this.div.contentEditable = ('nocursor' != e) + '' - }, sd.prototype.onContextMenu = function () {}, sd.prototype.resetPosition = function () {}, sd.prototype.needsContentAttribute = !0; - var dd = function (e) { - this.cm = e, this.prevInput = '', this.pollingFast = !1, this.polling = new Ya, this.hasSelection = !1, this.composing = null + !this.cm.isReadOnly() && this.pollContent() || Jr(this.cm, (function () { + return hr(e.cm) + })) + }, zs.prototype.setUneditable = function (e) { + e.contentEditable = "false" + }, zs.prototype.onKeyPress = function (e) { + 0 == e.charCode || this.composing || (e.preventDefault(), this.cm.isReadOnly() || ei(this.cm, Ps)(this.cm, String.fromCharCode(null == e.charCode ? e.keyCode : e.charCode), 0)) + }, zs.prototype.readOnlyChanged = function (e) { + this.div.contentEditable = String("nocursor" != e) + }, zs.prototype.onContextMenu = function () {}, zs.prototype.resetPosition = function () {}, zs.prototype.needsContentAttribute = !0; + var Gs = function (e) { + this.cm = e, this.prevInput = "", this.pollingFast = !1, this.polling = new H, this.hasSelection = !1, this.composing = null }; - dd.prototype.init = function (t) { - function e(t) { - if (!z(r, t)) { - if (r.somethingSelected()) aa({ + Gs.prototype.init = function (e) { + var t = this, + n = this, + r = this.cm; + this.createField(e); + var i = this.textarea; + + function o(e) { + if (!me(r, e)) { + if (r.somethingSelected()) Ms({ lineWise: !1, text: r.getSelections() }); else { if (!r.options.lineWiseCopyCut) return; - var e = ca(r); - aa({ + var t = Ls(r); + Ms({ lineWise: !0, - text: e.text - }), 'cut' == t.type ? r.setSelections(e.ranges, null, $a) : (o.prevInput = '', i.value = e.text.join('\n'), qa(i)) + text: t.text + }), "cut" == e.type ? r.setSelections(t.ranges, null, W) : (n.prevInput = "", i.value = t.text.join("\n"), L(i)) } - 'cut' == t.type && (r.state.cutIncoming = +new Date) + "cut" == e.type && (r.state.cutIncoming = +new Date) } } - var n = this, - o = this, - r = this.cm; - this.createField(t); - var i = this.textarea; - t.wrapper.insertBefore(this.wrapper, t.wrapper.firstChild), Ba && (i.style.width = '0px'), as(i, 'input', function () { - Ra && 9 <= xa && n.hasSelection && (n.hasSelection = null), o.poll() - }), as(i, 'paste', function (t) { - z(r, t) || da(t, r) || (r.state.pasteIncoming = +new Date, o.fastPoll()) - }), as(i, 'cut', e), as(i, 'copy', e), as(t.scroller, 'paste', function (n) { - if (!(Vt(t, n) || z(r, n))) { - if (!i.dispatchEvent) return r.state.pasteIncoming = +new Date, void o.focus(); - var e = new Event('paste'); - e.clipboardData = n.clipboardData, i.dispatchEvent(e) + e.wrapper.insertBefore(this.wrapper, e.wrapper.firstChild), m && (i.style.width = "0px"), he(i, "input", (function () { + s && a >= 9 && t.hasSelection && (t.hasSelection = null), n.poll() + })), he(i, "paste", (function (e) { + me(r, e) || Is(e, r) || (r.state.pasteIncoming = +new Date, n.fastPoll()) + })), he(i, "cut", o), he(i, "copy", o), he(e.scroller, "paste", (function (t) { + if (!Cn(e, t) && !me(r, t)) { + if (!i.dispatchEvent) return r.state.pasteIncoming = +new Date, void n.focus(); + var o = new Event("paste"); + o.clipboardData = t.clipboardData, i.dispatchEvent(o) } - }), as(t.lineSpace, 'selectstart', function (n) { - Vt(t, n) || G(n) - }), as(i, 'compositionstart', function () { - var e = r.getCursor('from'); - o.composing && o.composing.range.clear(), o.composing = { + })), he(e.lineSpace, "selectstart", (function (t) { + Cn(e, t) || we(t) + })), he(i, "compositionstart", (function () { + var e = r.getCursor("from"); + n.composing && n.composing.range.clear(), n.composing = { start: e, - range: r.markText(e, r.getCursor('to'), { - className: 'CodeMirror-composing' + range: r.markText(e, r.getCursor("to"), { + className: "CodeMirror-composing" }) } - }), as(i, 'compositionend', function () { - o.composing && (o.poll(), o.composing.range.clear(), o.composing = null) - }) - }, dd.prototype.createField = function () { - this.wrapper = ua(), this.textarea = this.wrapper.firstChild - }, dd.prototype.prepareSelection = function () { + })), he(i, "compositionend", (function () { + n.composing && (n.poll(), n.composing.range.clear(), n.composing = null) + })) + }, Gs.prototype.createField = function (e) { + this.wrapper = Fs(), this.textarea = this.wrapper.firstChild + }, Gs.prototype.prepareSelection = function () { var e = this.cm, t = e.display, n = e.doc, - o = Vn(e); + r = yr(e); if (e.options.moveInputWithCursor) { - var i = Sn(e, n.sel.primary().head, 'div'), - a = t.wrapper.getBoundingClientRect(), + var i = qn(e, n.sel.primary().head, "div"), + o = t.wrapper.getBoundingClientRect(), s = t.lineDiv.getBoundingClientRect(); - o.teTop = r(0, d(t.wrapper.clientHeight - 10, i.top + s.top - a.top)), o.teLeft = r(0, d(t.wrapper.clientWidth - 10, i.left + s.left - a.left)) - } - return o - }, dd.prototype.showSelection = function (e) { - var t = this.cm, - n = t.display; - c(n.cursorDiv, e.cursors), c(n.selectionDiv, e.selection), null != e.teTop && (this.wrapper.style.top = e.teTop + 'px', this.wrapper.style.left = e.teLeft + 'px') - }, dd.prototype.reset = function (e) { - if (!(this.contextMenuPending || this.composing)) { + r.teTop = Math.max(0, Math.min(t.wrapper.clientHeight - 10, i.top + s.top - o.top)), r.teLeft = Math.max(0, Math.min(t.wrapper.clientWidth - 10, i.left + s.left - o.left)) + } + return r + }, Gs.prototype.showSelection = function (e) { + var t = this.cm.display; + D(t.cursorDiv, e.cursors), D(t.selectionDiv, e.selection), null != e.teTop && (this.wrapper.style.top = e.teTop + "px", this.wrapper.style.left = e.teLeft + "px") + }, Gs.prototype.reset = function (e) { + if (!this.contextMenuPending && !this.composing) { var t = this.cm; if (t.somethingSelected()) { - this.prevInput = ''; + this.prevInput = ""; var n = t.getSelection(); - this.textarea.value = n, t.state.focused && qa(this.textarea), Ra && 9 <= xa && (this.hasSelection = n) - } else e || (this.prevInput = this.textarea.value = '', Ra && 9 <= xa && (this.hasSelection = null)) + this.textarea.value = n, t.state.focused && L(this.textarea), s && a >= 9 && (this.hasSelection = n) + } else e || (this.prevInput = this.textarea.value = "", s && a >= 9 && (this.hasSelection = null)) } - }, dd.prototype.getField = function () { + }, Gs.prototype.getField = function () { return this.textarea - }, dd.prototype.supportsTouch = function () { + }, Gs.prototype.supportsTouch = function () { return !1 - }, dd.prototype.focus = function () { - if ('nocursor' != this.cm.options.readOnly && (!Oa || h() != this.textarea)) try { + }, Gs.prototype.focus = function () { + if ("nocursor" != this.cm.options.readOnly && (!y || P() != this.textarea)) try { this.textarea.focus() - } catch (t) {} - }, dd.prototype.blur = function () { + } catch (e) {} + }, Gs.prototype.blur = function () { this.textarea.blur() - }, dd.prototype.resetPosition = function () { + }, Gs.prototype.resetPosition = function () { this.wrapper.style.top = this.wrapper.style.left = 0 - }, dd.prototype.receivedFocus = function () { + }, Gs.prototype.receivedFocus = function () { this.slowPoll() - }, dd.prototype.slowPoll = function () { + }, Gs.prototype.slowPoll = function () { var e = this; - this.pollingFast || this.polling.set(this.cm.options.pollInterval, function () { + this.pollingFast || this.polling.set(this.cm.options.pollInterval, (function () { e.poll(), e.cm.state.focused && e.slowPoll() - }) - }, dd.prototype.fastPoll = function () { - function e() { - var o = n.poll(); - o || t ? (n.pollingFast = !1, n.slowPoll()) : (t = !0, n.polling.set(60, e)) - } - var t = !1, - n = this; - n.pollingFast = !0, n.polling.set(20, e) - }, dd.prototype.poll = function () { + })) + }, Gs.prototype.fastPoll = function () { + var e = !1, + t = this; + t.pollingFast = !0, t.polling.set(20, (function n() { + t.poll() || e ? (t.pollingFast = !1, t.slowPoll()) : (e = !0, t.polling.set(60, n)) + })) + }, Gs.prototype.poll = function () { var e = this, t = this.cm, n = this.textarea, - o = this.prevInput; - if (this.contextMenuPending || !t.state.focused || ds(n) && !o && !this.composing || t.isReadOnly() || t.options.disableInput || t.state.keySeq) return !1; - var r = n.value; - if (r == o && !t.somethingSelected()) return !1; - if (Ra && 9 <= xa && this.hasSelection === r || Ha && /[\uf700-\uf7ff]/.test(r)) return t.display.input.reset(), !1; + r = this.prevInput; + if (this.contextMenuPending || !t.state.focused || Pe(n) && !r && !this.composing || t.isReadOnly() || t.options.disableInput || t.state.keySeq) return !1; + var i = n.value; + if (i == r && !t.somethingSelected()) return !1; + if (s && a >= 9 && this.hasSelection === i || v && /[\uf700-\uf7ff]/.test(i)) return t.display.input.reset(), !1; if (t.doc.sel == t.display.selForContextMenu) { - var i = r.charCodeAt(0); - if (8203 != i || o || (o = '\u200B'), 8666 == i) return this.reset(), this.cm.execCommand('undo') + var o = i.charCodeAt(0); + if (8203 != o || r || (r = "​"), 8666 == o) return this.reset(), this.cm.execCommand("undo") } - for (var a = 0, s = d(o.length, r.length); a < s && o.charCodeAt(a) == r.charCodeAt(a);) ++a; - return Ro(t, function () { - sa(t, r.slice(a), o.length - a, null, e.composing ? '*compose' : null), 1e3 < r.length || -1 < r.indexOf('\n') ? n.value = e.prevInput = '' : e.prevInput = r, e.composing && (e.composing.range.clear(), e.composing.range = t.markText(e.composing.start, t.getCursor('to'), { - className: 'CodeMirror-composing' + for (var l = 0, c = Math.min(r.length, i.length); l < c && r.charCodeAt(l) == i.charCodeAt(l);) ++l; + return Jr(t, (function () { + Ps(t, i.slice(l), r.length - l, null, e.composing ? "*compose" : null), i.length > 1e3 || i.indexOf("\n") > -1 ? n.value = e.prevInput = "" : e.prevInput = i, e.composing && (e.composing.range.clear(), e.composing.range = t.markText(e.composing.start, t.getCursor("to"), { + className: "CodeMirror-composing" })) - }), !0 - }, dd.prototype.ensurePolled = function () { + })), !0 + }, Gs.prototype.ensurePolled = function () { this.pollingFast && this.poll() && (this.pollingFast = !1) - }, dd.prototype.onKeyPress = function () { - Ra && 9 <= xa && (this.hasSelection = null), this.fastPoll() - }, dd.prototype.onContextMenu = function (t) { - function e() { - if (null != s.selectionStart) { - var e = r.somethingSelected(), - t = '\u200B' + (e ? s.value : ''); - s.value = '\u21DA', s.value = t, o.prevInput = e ? '' : '\u200B', s.selectionStart = 1, s.selectionEnd = t.length, a.selForContextMenu = r.doc.sel + }, Gs.prototype.onKeyPress = function () { + s && a >= 9 && (this.hasSelection = null), this.fastPoll() + }, Gs.prototype.onContextMenu = function (e) { + var t = this, + n = t.cm, + r = n.display, + i = t.textarea; + t.contextMenuPending && t.contextMenuPending(); + var o = cr(n, e), + c = r.scroller.scrollTop; + if (o && !h) { + n.options.resetSelectionOnContextMenu && -1 == n.doc.sel.contains(o) && ei(n, Ji)(n.doc, xi(o), W); + var u, p = i.style.cssText, + d = t.wrapper.style.cssText, + f = t.wrapper.offsetParent.getBoundingClientRect(); + if (t.wrapper.style.cssText = "position: static", i.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - f.top - 5) + "px; left: " + (e.clientX - f.left - 5) + "px;\n z-index: 1000; background: " + (s ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);", l && (u = window.scrollY), r.input.focus(), l && window.scrollTo(null, u), r.input.reset(), n.somethingSelected() || (i.value = t.prevInput = " "), t.contextMenuPending = y, r.selForContextMenu = n.doc.sel, clearTimeout(r.detectingSelectAll), s && a >= 9 && g(), E) { + Ce(e); + var m = function () { + de(window, "mouseup", m), setTimeout(y, 20) + }; + he(window, "mouseup", m) + } else setTimeout(y, 50) + } + + function g() { + if (null != i.selectionStart) { + var e = n.somethingSelected(), + o = "​" + (e ? i.value : ""); + i.value = "⇚", i.value = o, t.prevInput = e ? "" : "​", i.selectionStart = 1, i.selectionEnd = o.length, r.selForContextMenu = n.doc.sel } } - function n() { - if (o.contextMenuPending == n && (o.contextMenuPending = !1, o.wrapper.style.cssText = p, s.style.cssText = c, Ra && 9 > xa && a.scrollbars.setScrollTop(a.scroller.scrollTop = d), null != s.selectionStart)) { - (!Ra || Ra && 9 > xa) && e(); - var t = 0, - i = function () { - a.selForContextMenu == r.doc.sel && 0 == s.selectionStart && 0 < s.selectionEnd && '\u200B' == o.prevInput ? xo(r, zr)(r) : 10 > t++ ? a.detectingSelectAll = setTimeout(i, 500) : (a.selForContextMenu = null, a.input.reset()) + function y() { + if (t.contextMenuPending == y && (t.contextMenuPending = !1, t.wrapper.style.cssText = d, i.style.cssText = p, s && a < 9 && r.scrollbars.setScrollTop(r.scroller.scrollTop = c), null != i.selectionStart)) { + (!s || s && a < 9) && g(); + var e = 0, + o = function () { + r.selForContextMenu == n.doc.sel && 0 == i.selectionStart && i.selectionEnd > 0 && "​" == t.prevInput ? ei(n, ao)(n) : e++ < 10 ? r.detectingSelectAll = setTimeout(o, 500) : (r.selForContextMenu = null, r.input.reset()) }; - a.detectingSelectAll = setTimeout(i, 200) + r.detectingSelectAll = setTimeout(o, 200) } } - var o = this, - r = o.cm, - a = r.display, - s = o.textarea; - o.contextMenuPending && o.contextMenuPending(); - var i = Ln(r, t), - d = a.scroller.scrollTop; - if (i && !Aa) { - var l = r.options.resetSelectionOnContextMenu; - l && -1 == r.doc.sel.contains(i) && xo(r, Ar)(r.doc, Zo(i), $a); - var c = s.style.cssText, - p = o.wrapper.style.cssText, - u = o.wrapper.offsetParent.getBoundingClientRect(); - o.wrapper.style.cssText = 'position: static', s.style.cssText = 'position: absolute; width: 30px; height: 30px;\n top: ' + (t.clientY - u.top - 5) + 'px; left: ' + (t.clientX - u.left - 5) + 'px;\n z-index: 1000; background: ' + (Ra ? 'rgba(255, 255, 255, .05)' : 'transparent') + ';\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);'; - var m; - if (Pa && (m = window.scrollY), a.input.focus(), Pa && window.scrollTo(null, m), a.input.reset(), r.somethingSelected() || (s.value = o.prevInput = ' '), o.contextMenuPending = n, a.selForContextMenu = r.doc.sel, clearTimeout(a.detectingSelectAll), Ra && 9 <= xa && e(), Ga) { - q(t); - var h = function () { - O(window, 'mouseup', h), setTimeout(n, 20) - }; - as(window, 'mouseup', h) - } else setTimeout(n, 50) - } - }, dd.prototype.readOnlyChanged = function (e) { - e || this.reset(), this.textarea.disabled = 'nocursor' == e - }, dd.prototype.setUneditable = function () {}, dd.prototype.needsContentAttribute = !1, + }, Gs.prototype.readOnlyChanged = function (e) { + e || this.reset(), this.textarea.disabled = "nocursor" == e + }, Gs.prototype.setUneditable = function () {}, Gs.prototype.needsContentAttribute = !1, function (e) { - function t(t, o, r, i) { - e.defaults[t] = o, r && (n[t] = i ? function (e, t, n) { - n != ed && r(e, t, n) - } : r) + var t = e.optionHandlers; + + function n(n, r, i, o) { + e.defaults[n] = r, i && (t[n] = o ? function (e, t, n) { + n != Cs && i(e, t, n) + } : i) } - var n = e.optionHandlers; - e.defineOption = t, e.Init = ed, t('value', '', function (e, t) { + e.defineOption = n, e.Init = Cs, n("value", "", (function (e, t) { return e.setValue(t) - }, !0), t('mode', null, function (e, t) { - e.doc.modeOption = t, rr(e) - }, !0), t('indentUnit', 2, rr, !0), t('indentWithTabs', !1), t('smartIndent', !0), t('tabSize', 4, function (e) { - ir(e), pn(e), Bn(e) - }, !0), t('lineSeparator', null, function (e, t) { - if (e.doc.lineSep = t, !!t) { + }), !0), n("mode", null, (function (e, t) { + e.doc.modeOption = t, Ai(e) + }), !0), n("indentUnit", 2, Ai, !0), n("indentWithTabs", !1), n("smartIndent", !0), n("tabSize", 4, (function (e) { + Mi(e), zn(e), hr(e) + }), !0), n("lineSeparator", null, (function (e, t) { + if (e.doc.lineSep = t, t) { var n = [], - o = e.doc.first; - e.doc.iter(function (e) { - for (var r = 0, i;;) { - if (i = e.text.indexOf(t, r), -1 == i) break; - r = i + t.length, n.push(fe(o, i)) + r = e.doc.first; + e.doc.iter((function (e) { + for (var i = 0;;) { + var o = e.text.indexOf(t, i); + if (-1 == o) break; + i = o + t.length, n.push(et(r, o)) } - o++ - }); - for (var r = n.length - 1; 0 <= r; r--) Yr(e.doc, t, n[r], fe(n[r].line, n[r].ch + t.length)) + r++ + })); + for (var i = n.length - 1; i >= 0; i--) mo(e.doc, t, n[i], et(n[i].line, n[i].ch + t.length)) } - }), t('specialChars', /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (e, t, n) { - e.state.specialChars = new RegExp(t.source + (t.test('\t') ? '' : '|\t'), 'g'), n != ed && e.refresh() - }), t('specialCharPlaceholder', yt, function (e) { + })), n("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, (function (e, t, n) { + e.state.specialChars = new RegExp(t.source + (t.test("\t") ? "" : "|\t"), "g"), n != Cs && e.refresh() + })), n("specialCharPlaceholder", Xt, (function (e) { return e.refresh() - }, !0), t('electricChars', !0), t('inputStyle', Oa ? 'contenteditable' : 'textarea', function () { - throw new Error('inputStyle can not (yet) be changed in a running editor') - }, !0), t('spellcheck', !1, function (e, t) { + }), !0), n("electricChars", !0), n("inputStyle", y ? "contenteditable" : "textarea", (function () { + throw new Error("inputStyle can not (yet) be changed in a running editor") + }), !0), n("spellcheck", !1, (function (e, t) { return e.getInputField().spellcheck = t - }, !0), t('autocorrect', !1, function (e, t) { + }), !0), n("autocorrect", !1, (function (e, t) { return e.getInputField().autocorrect = t - }, !0), t('autocapitalize', !1, function (e, t) { + }), !0), n("autocapitalize", !1, (function (e, t) { return e.getInputField().autocapitalize = t - }, !0), t('rtlMoveVisually', !Ua), t('wholeLineUpdateBefore', !0), t('theme', 'default', function (e) { - ea(e), jo(e) - }, !0), t('keyMap', 'default', function (e, t, n) { - var o = Ei(t), - r = n != ed && Ei(n); - r && r.detach && r.detach(e, o), o.attach && o.attach(e, r || null) - }), t('extraKeys', null), t('configureMouse', null), t('lineWrapping', !1, na, !0), t('gutters', [], function (e, t) { - e.display.gutterSpecs = Go(t, e.options.lineNumbers), jo(e) - }, !0), t('fixedGutter', !0, function (e, t) { - e.display.gutters.style.left = t ? Mn(e.display) + 'px' : '0', e.refresh() - }, !0), t('coverGutterNextToScrollbar', !1, function (e) { - return go(e) - }, !0), t('scrollbarStyle', 'native', function (e) { - So(e), go(e), e.display.scrollbars.setScrollTop(e.doc.scrollTop), e.display.scrollbars.setScrollLeft(e.doc.scrollLeft) - }, !0), t('lineNumbers', !1, function (e, t) { - e.display.gutterSpecs = Go(e.options.gutters, t), jo(e) - }, !0), t('firstLineNumber', 1, jo, !0), t('lineNumberFormatter', function (e) { + }), !0), n("rtlMoveVisually", !b), n("wholeLineUpdateBefore", !0), n("theme", "default", (function (e) { + Ss(e), mi(e) + }), !0), n("keyMap", "default", (function (e, t, n) { + var r = Qo(t), + i = n != Cs && Qo(n); + i && i.detach && i.detach(e, r), r.attach && r.attach(e, i || null) + })), n("extraKeys", null), n("configureMouse", null), n("lineWrapping", !1, Ts, !0), n("gutters", [], (function (e, t) { + e.display.gutterSpecs = di(t, e.options.lineNumbers), mi(e) + }), !0), n("fixedGutter", !0, (function (e, t) { + e.display.gutters.style.left = t ? sr(e.display) + "px" : "0", e.refresh() + }), !0), n("coverGutterNextToScrollbar", !1, (function (e) { + return Ur(e) + }), !0), n("scrollbarStyle", "native", (function (e) { + jr(e), Ur(e), e.display.scrollbars.setScrollTop(e.doc.scrollTop), e.display.scrollbars.setScrollLeft(e.doc.scrollLeft) + }), !0), n("lineNumbers", !1, (function (e, t) { + e.display.gutterSpecs = di(e.options.gutters, t), mi(e) + }), !0), n("firstLineNumber", 1, mi, !0), n("lineNumberFormatter", (function (e) { return e - }, jo, !0), t('showCursorWhenSelecting', !1, Wn, !0), t('resetSelectionOnContextMenu', !0), t('lineWiseCopyCut', !0), t('pasteLinesPerSelection', !0), t('selectionsMayTouch', !1), t('readOnly', !1, function (e, t) { - 'nocursor' == t && ($n(e), e.display.input.blur()), e.display.input.readOnlyChanged(t) - }), t('disableInput', !1, function (e, t) { + }), mi, !0), n("showCursorWhenSelecting", !1, gr, !0), n("resetSelectionOnContextMenu", !0), n("lineWiseCopyCut", !0), n("pasteLinesPerSelection", !0), n("selectionsMayTouch", !1), n("readOnly", !1, (function (e, t) { + "nocursor" == t && (xr(e), e.display.input.blur()), e.display.input.readOnlyChanged(t) + })), n("disableInput", !1, (function (e, t) { t || e.display.input.reset() - }, !0), t('dragDrop', !0, ta), t('allowDropFileTypes', null), t('cursorBlinkRate', 530), t('cursorScrollMargin', 0), t('cursorHeight', 1, Wn, !0), t('singleCursorHeightPerLine', !0, Wn, !0), t('workTime', 100), t('workDelay', 100), t('flattenSpans', !0, ir, !0), t('addModeClass', !1, ir, !0), t('pollInterval', 100), t('undoDepth', 200, function (e, t) { + }), !0), n("dragDrop", !0, xs), n("allowDropFileTypes", null), n("cursorBlinkRate", 530), n("cursorScrollMargin", 0), n("cursorHeight", 1, gr, !0), n("singleCursorHeightPerLine", !0, gr, !0), n("workTime", 100), n("workDelay", 100), n("flattenSpans", !0, Mi, !0), n("addModeClass", !1, Mi, !0), n("pollInterval", 100), n("undoDepth", 200, (function (e, t) { return e.doc.history.undoDepth = t - }), t('historyEventDelay', 1250), t('viewportMargin', 10, function (e) { + })), n("historyEventDelay", 1250), n("viewportMargin", 10, (function (e) { return e.refresh() - }, !0), t('maxHighlightLength', 1e4, ir, !0), t('moveInputWithCursor', !0, function (e, t) { + }), !0), n("maxHighlightLength", 1e4, Mi, !0), n("moveInputWithCursor", !0, (function (e, t) { t || e.display.input.resetPosition() - }), t('tabindex', null, function (e, t) { - return e.display.input.getField().tabIndex = t || '' - }), t('autofocus', null), t('direction', 'ltr', function (e, t) { + })), n("tabindex", null, (function (e, t) { + return e.display.input.getField().tabIndex = t || "" + })), n("autofocus", null), n("direction", "ltr", (function (e, t) { return e.doc.setDirection(t) - }, !0), t('phrases', null) - }(oa), + }), !0), n("phrases", null) + }(Rs), function (e) { var t = e.optionHandlers, n = e.helpers = {}; @@ -7732,9 +7820,9 @@ module.exports = function (e) { window.focus(), this.display.input.focus() }, setOption: function (e, n) { - var o = this.options, - r = o[e]; - o[e] == n && 'mode' != e || (o[e] = n, t.hasOwnProperty(e) && xo(this, t[e])(this, n, r), H(this, 'optionChange', this, e)) + var r = this.options, + i = r[e]; + r[e] == n && "mode" != e || (r[e] = n, t.hasOwnProperty(e) && ei(this, t[e])(this, n, i), fe(this, "optionChange", this, e)) }, getOption: function (e) { return this.options[e] @@ -7743,69 +7831,78 @@ module.exports = function (e) { return this.doc }, addKeyMap: function (e, t) { - this.state.keyMaps[t ? 'push' : 'unshift'](Ei(e)) + this.state.keyMaps[t ? "push" : "unshift"](Qo(e)) }, removeKeyMap: function (e) { for (var t = this.state.keyMaps, n = 0; n < t.length; ++n) if (t[n] == e || t[n].name == e) return t.splice(n, 1), !0 }, - addOverlay: Po(function (t, n) { - var o = t.token ? t : e.getMode(this.options, t); - if (o.startState) throw new Error('Overlays may not be stateful.'); - T(this.state.overlays, { - mode: o, + addOverlay: ti((function (t, n) { + var r = t.token ? t : e.getMode(this.options, t); + if (r.startState) throw new Error("Overlays may not be stateful."); + ! function (e, t, n) { + for (var r = 0, i = n(t); r < e.length && n(e[r]) <= i;) r++; + e.splice(r, 0, t) + }(this.state.overlays, { + mode: r, modeSpec: t, opaque: n && n.opaque, priority: n && n.priority || 0 - }, function (e) { + }, (function (e) { return e.priority - }), this.state.modeGen++, Bn(this) - }), - removeOverlay: Po(function (e) { - for (var t = this, n = this.state.overlays, o = 0, r; o < n.length; ++o) - if (r = n[o].modeSpec, r == e || 'string' == typeof e && r.name == e) return n.splice(o, 1), t.state.modeGen++, void Bn(t) - }), - indentLine: Po(function (e, t, n) { - 'string' != typeof t && 'number' != typeof t && (null == t ? t = this.options.smartIndent ? 'smart' : 'prev' : t = t ? 'add' : 'subtract'), me(this.doc, e) && ia(this, e, t, n) - }), - indentSelection: Po(function (e) { - for (var t = this, n = this.doc.sel.ranges, o = -1, a = 0, i; a < n.length; a++) - if (i = n[a], !i.empty()) { - var s = i.from(), - l = i.to(), - c = r(o, s.line); - o = d(t.lastLine(), l.line - (l.ch ? 0 : 1)) + 1; - for (var p = c; p < o; ++p) ia(t, p, e); - var u = t.doc.sel.ranges; - 0 == s.ch && n.length == u.length && 0 < u[a].from().ch && xr(t.doc, a, new Ns(s, u[a].to()), $a) - } else i.head.line > o && (ia(t, i.head.line, e, !0), o = i.head.line, a == t.doc.sel.primIndex && ao(t)) - }), + })), this.state.modeGen++, hr(this) + })), + removeOverlay: ti((function (e) { + for (var t = this.state.overlays, n = 0; n < t.length; ++n) { + var r = t[n].modeSpec; + if (r == e || "string" == typeof e && r.name == e) return t.splice(n, 1), this.state.modeGen++, void hr(this) + } + })), + indentLine: ti((function (e, t, n) { + "string" != typeof t && "number" != typeof t && (t = null == t ? this.options.smartIndent ? "smart" : "prev" : t ? "add" : "subtract"), Xe(this.doc, e) && _s(this, e, t, n) + })), + indentSelection: ti((function (e) { + for (var t = this.doc.sel.ranges, n = -1, r = 0; r < t.length; r++) { + var i = t[r]; + if (i.empty()) i.head.line > n && (_s(this, i.head.line, e, !0), n = i.head.line, r == this.doc.sel.primIndex && Mr(this)); + else { + var o = i.from(), + s = i.to(), + a = Math.max(n, o.line); + n = Math.min(this.lastLine(), s.line - (s.ch ? 0 : 1)) + 1; + for (var l = a; l < n; ++l) _s(this, l, e); + var c = this.doc.sel.ranges; + 0 == o.ch && t.length == c.length && c[r].from().ch > 0 && Qi(this.doc, r, new Ei(o, c[r].to()), W) + } + } + })), getTokenAt: function (e, t) { - return Me(this, e, t) + return vt(this, e, t) }, getLineTokens: function (e, t) { - return Me(this, fe(e), t, !0) + return vt(this, et(e), t, !0) }, getTokenTypeAt: function (e) { - e = Ee(this.doc, e); - var t = _e(this, se(this.doc, e.line)), - n = 0, - o = (t.length - 1) / 2, - r = e.ch, - i; - if (0 == r) i = t[2]; + e = at(this.doc, e); + var t, n = pt(this, $e(this.doc, e.line)), + r = 0, + i = (n.length - 1) / 2, + o = e.ch; + if (0 == o) t = n[2]; else for (;;) { - var a = n + o >> 1; - if ((a ? t[2 * a - 1] : 0) >= r) o = a; - else if (t[2 * a + 1] < r) n = a + 1; + var s = r + i >> 1; + if ((s ? n[2 * s - 1] : 0) >= o) i = s; else { - i = t[2 * a + 2]; - break + if (!(n[2 * s + 1] < o)) { + t = n[2 * s + 2]; + break + } + r = s + 1 } } - var s = i ? i.indexOf('overlay ') : -1; - return 0 > s ? i : 0 == s ? null : i.slice(0, s - 1) + var a = t ? t.indexOf("overlay ") : -1; + return a < 0 ? t : 0 == a ? null : t.slice(0, a - 1) }, getModeAt: function (t) { var n = this.doc.mode; @@ -7815,56 +7912,58 @@ module.exports = function (e) { return this.getHelpers(e, t)[0] }, getHelpers: function (e, t) { - var o = this, - r = []; + var r = []; if (!n.hasOwnProperty(t)) return r; - var a = n[t], - s = this.getModeAt(e); - if ('string' == typeof s[t]) a[s[t]] && r.push(a[s[t]]); - else if (s[t]) - for (var d = 0, i; d < s[t].length; d++) i = a[s[t][d]], i && r.push(i); - else s.helperType && a[s.helperType] ? r.push(a[s.helperType]) : a[s.name] && r.push(a[s.name]); - for (var l = 0, c; l < a._global.length; l++) c = a._global[l], c.pred(s, o) && -1 == b(r, c.val) && r.push(c.val); + var i = n[t], + o = this.getModeAt(e); + if ("string" == typeof o[t]) i[o[t]] && r.push(i[o[t]]); + else if (o[t]) + for (var s = 0; s < o[t].length; s++) { + var a = i[o[t][s]]; + a && r.push(a) + } else o.helperType && i[o.helperType] ? r.push(i[o.helperType]) : i[o.name] && r.push(i[o.name]); + for (var l = 0; l < i._global.length; l++) { + var c = i._global[l]; + c.pred(o, this) && -1 == z(r, c.val) && r.push(c.val) + } return r }, getStateAfter: function (e, t) { var n = this.doc; - return e = ve(n, null == e ? n.first + n.size - 1 : e), Re(this, e + 1, t).state + return dt(this, (e = st(n, null == e ? n.first + n.size - 1 : e)) + 1, t).state }, cursorCoords: function (e, t) { - var n = this.doc.sel.primary(), - o; - return o = null == e ? n.head : 'object' == typeof e ? Ee(this.doc, e) : e ? n.from() : n.to(), Sn(this, o, t || 'page') + var n = this.doc.sel.primary(); + return qn(this, null == e ? n.head : "object" == typeof e ? at(this.doc, e) : e ? n.from() : n.to(), t || "page") }, charCoords: function (e, t) { - return yn(this, Ee(this.doc, e), t || 'page') + return $n(this, at(this.doc, e), t || "page") }, coordsChar: function (e, t) { - return e = gn(this, e, t || 'page'), vn(this, e.left, e.top) + return Qn(this, (e = Gn(this, e, t || "page")).left, e.top) }, lineAtHeight: function (e, t) { - return e = gn(this, { + return e = Gn(this, { top: e, left: 0 - }, t || 'page').top, ue(this.doc, e + this.display.viewOffset) + }, t || "page").top, Ze(this.doc, e + this.display.viewOffset) }, heightAtLine: function (e, t, n) { - var o = !1, - r; - if ('number' == typeof e) { - var i = this.doc.first + this.doc.size - 1; - e < this.doc.first ? e = this.doc.first : e > i && (e = i, o = !0), r = se(this.doc, e) + var r, i = !1; + if ("number" == typeof e) { + var o = this.doc.first + this.doc.size - 1; + e < this.doc.first ? e = this.doc.first : e > o && (e = o, i = !0), r = $e(this.doc, e) } else r = e; - return fn(this, r, { + return jn(this, r, { top: 0, left: 0 - }, t || 'page', n || o).top + (o ? this.doc.height - ct(r) : 0) + }, t || "page", n || i).top + (i ? this.doc.height - Vt(r) : 0) }, defaultTextHeight: function () { - return xn(this.display) + return rr(this.display) }, defaultCharWidth: function () { - return Pn(this.display) + return ir(this.display) }, getViewport: function () { return { @@ -7872,170 +7971,171 @@ module.exports = function (e) { to: this.display.viewTo } }, - addWidget: function (e, t, n, o, i) { - var a = this.display; - e = Sn(this, Ee(this.doc, e)); - var s = e.bottom, - d = e.left; - if (t.style.position = 'absolute', t.setAttribute('cm-ignore-events', 'true'), this.display.input.setUneditable(t), a.sizer.appendChild(t), 'over' == o) s = e.top; - else if ('above' == o || 'near' == o) { - var l = r(a.wrapper.clientHeight, this.doc.height), - c = r(a.sizer.clientWidth, a.lineSpace.clientWidth); - ('above' == o || e.bottom + t.offsetHeight > l) && e.top > t.offsetHeight ? s = e.top - t.offsetHeight : e.bottom + t.offsetHeight <= l && (s = e.bottom), d + t.offsetWidth > c && (d = c - t.offsetWidth) + addWidget: function (e, t, n, r, i) { + var o, s, a, l = this.display, + c = (e = qn(this, at(this.doc, e))).bottom, + u = e.left; + if (t.style.position = "absolute", t.setAttribute("cm-ignore-events", "true"), this.display.input.setUneditable(t), l.sizer.appendChild(t), "over" == r) c = e.top; + else if ("above" == r || "near" == r) { + var h = Math.max(l.wrapper.clientHeight, this.doc.height), + p = Math.max(l.sizer.clientWidth, l.lineSpace.clientWidth); + ("above" == r || e.bottom + t.offsetHeight > h) && e.top > t.offsetHeight ? c = e.top - t.offsetHeight : e.bottom + t.offsetHeight <= h && (c = e.bottom), u + t.offsetWidth > p && (u = p - t.offsetWidth) } - t.style.top = s + 'px', t.style.left = t.style.right = '', 'right' == i ? (d = a.sizer.clientWidth - t.offsetWidth, t.style.right = '0px') : ('left' == i ? d = 0 : 'middle' == i && (d = (a.sizer.clientWidth - t.offsetWidth) / 2), t.style.left = d + 'px'), n && oo(this, { - left: d, - top: s, - right: d + t.offsetWidth, - bottom: s + t.offsetHeight - }) + t.style.top = c + "px", t.style.left = t.style.right = "", "right" == i ? (u = l.sizer.clientWidth - t.offsetWidth, t.style.right = "0px") : ("left" == i ? u = 0 : "middle" == i && (u = (l.sizer.clientWidth - t.offsetWidth) / 2), t.style.left = u + "px"), n && (o = this, s = { + left: u, + top: c, + right: u + t.offsetWidth, + bottom: c + t.offsetHeight + }, null != (a = _r(o, s)).scrollTop && Lr(o, a.scrollTop), null != a.scrollLeft && Fr(o, a.scrollLeft)) }, - triggerOnKeyDown: Po(Ni), - triggerOnKeyPress: Po(zi), - triggerOnKeyUp: Hi, - triggerOnMouseDown: Po(Wi), + triggerOnKeyDown: ti(us), + triggerOnKeyPress: ti(ps), + triggerOnKeyUp: hs, + triggerOnMouseDown: ti(gs), execCommand: function (e) { - if (Qs.hasOwnProperty(e)) return Qs[e].call(null, this) + if (ts.hasOwnProperty(e)) return ts[e].call(null, this) }, - triggerElectric: Po(function (e) { - la(this, e) - }), - findPosH: function (e, t, n, o) { - var r = this, - a = 1; - 0 > t && (a = -1, t = -t); - for (var s = Ee(this.doc, e), d = 0; d < t && (s = ma(r.doc, s, a, n, o), !s.hitSide); ++d); - return s + triggerElectric: ti((function (e) { + Os(this, e) + })), + findPosH: function (e, t, n, r) { + var i = 1; + t < 0 && (i = -1, t = -t); + for (var o = at(this.doc, e), s = 0; s < t && !(o = Bs(this.doc, o, i, n, r)).hitSide; ++s); + return o }, - moveH: Po(function (e, t) { + moveH: ti((function (e, t) { var n = this; - this.extendSelectionsBy(function (o) { - return n.display.shift || n.doc.extend || o.empty() ? ma(n.doc, o.head, e, t, n.options.rtlMoveVisually) : 0 > e ? o.from() : o.to() - }, Ja) - }), - deleteH: Po(function (e, t) { + this.extendSelectionsBy((function (r) { + return n.display.shift || n.doc.extend || r.empty() ? Bs(n.doc, r.head, e, t, n.options.rtlMoveVisually) : e < 0 ? r.from() : r.to() + }), j) + })), + deleteH: ti((function (e, t) { var n = this.doc.sel, - o = this.doc; - n.somethingSelected() ? o.replaceSelection('', null, '+delete') : wi(this, function (n) { - var r = ma(o, n.head, e, t, !1); - return 0 > e ? { - from: r, + r = this.doc; + n.somethingSelected() ? r.replaceSelection("", null, "+delete") : Zo(this, (function (n) { + var i = Bs(r, n.head, e, t, !1); + return e < 0 ? { + from: i, to: n.head } : { from: n.head, - to: r + to: i } - }) - }), - findPosV: function (e, t, n, o) { - var r = this, - a = 1, - s = o; - 0 > t && (a = -1, t = -t); - for (var d = Ee(this.doc, e), l = 0, i; l < t && (i = Sn(r, d, 'div'), null == s ? s = i.left : i.left = s, d = ha(r, i, a, n), !d.hitSide); ++l); - return d + })) + })), + findPosV: function (e, t, n, r) { + var i = 1, + o = r; + t < 0 && (i = -1, t = -t); + for (var s = at(this.doc, e), a = 0; a < t; ++a) { + var l = qn(this, s, "div"); + if (null == o ? o = l.left : l.left = o, (s = Hs(this, l, i, n)).hitSide) break + } + return s }, - moveV: Po(function (e, t) { + moveV: ti((function (e, t) { var n = this, - o = this.doc, - r = [], - a = !this.display.shift && !o.extend && o.sel.somethingSelected(); - if (o.extendSelectionsBy(function (i) { - if (a) return 0 > e ? i.from() : i.to(); - var s = Sn(n, i.head, 'div'); - null != i.goalColumn && (s.left = i.goalColumn), r.push(s.left); - var d = ha(n, s, e, t); - return 'page' == t && i == o.sel.primary() && io(n, yn(n, d, 'div').top - s.top), d - }, Ja), r.length) - for (var s = 0; s < o.sel.ranges.length; s++) o.sel.ranges[s].goalColumn = r[s] - }), + r = this.doc, + i = [], + o = !this.display.shift && !r.extend && r.sel.somethingSelected(); + if (r.extendSelectionsBy((function (s) { + if (o) return e < 0 ? s.from() : s.to(); + var a = qn(n, s.head, "div"); + null != s.goalColumn && (a.left = s.goalColumn), i.push(a.left); + var l = Hs(n, a, e, t); + return "page" == t && s == r.sel.primary() && Ar(n, $n(n, l, "div").top - a.top), l + }), j), i.length) + for (var s = 0; s < r.sel.ranges.length; s++) r.sel.ranges[s].goalColumn = i[s] + })), findWordAt: function (e) { - var t = this.doc, - n = se(t, e.line).text, - o = e.ch, + var t = $e(this.doc, e.line).text, + n = e.ch, r = e.ch; - if (n) { - var i = this.getHelper(e, 'wordChars'); - ('before' == e.sticky || r == n.length) && o ? --o : ++r; - for (var a = n.charAt(o), s = P(a, i) ? function (e) { - return P(e, i) - } : /\s/.test(a) ? function (e) { + if (t) { + var i = this.getHelper(e, "wordChars"); + "before" != e.sticky && r != t.length || !n ? ++r : --n; + for (var o = t.charAt(n), s = ee(o, i) ? function (e) { + return ee(e, i) + } : /\s/.test(o) ? function (e) { return /\s/.test(e) } : function (e) { - return !/\s/.test(e) && !P(e) - }; 0 < o && s(n.charAt(o - 1));) --o; - for (; r < n.length && s(n.charAt(r));) ++r + return !/\s/.test(e) && !ee(e) + }; n > 0 && s(t.charAt(n - 1));) --n; + for (; r < t.length && s(t.charAt(r));) ++r } - return new Ns(fe(e.line, o), fe(e.line, r)) + return new Ei(et(e.line, n), et(e.line, r)) }, toggleOverwrite: function (e) { - null != e && e == this.state.overwrite || ((this.state.overwrite = !this.state.overwrite) ? f(this.display.cursorDiv, 'CodeMirror-overwrite') : Ka(this.display.cursorDiv, 'CodeMirror-overwrite'), H(this, 'overwriteToggle', this, this.state.overwrite)) + null != e && e == this.state.overwrite || ((this.state.overwrite = !this.state.overwrite) ? I(this.display.cursorDiv, "CodeMirror-overwrite") : T(this.display.cursorDiv, "CodeMirror-overwrite"), fe(this, "overwriteToggle", this, this.state.overwrite)) }, hasFocus: function () { - return this.display.input.getField() == h() + return this.display.input.getField() == P() }, isReadOnly: function () { - return !!(this.options.readOnly || this.doc.cantEdit) + return !(!this.options.readOnly && !this.doc.cantEdit) }, - scrollTo: Po(function (e, t) { - so(this, e, t) - }), + scrollTo: ti((function (e, t) { + Pr(this, e, t) + })), getScrollInfo: function () { var e = this.display.scroller; return { left: e.scrollLeft, top: e.scrollTop, - height: e.scrollHeight - qt(this) - this.display.barHeight, - width: e.scrollWidth - qt(this) - this.display.barWidth, - clientHeight: Xt(this), - clientWidth: Yt(this) + height: e.scrollHeight - Tn(this) - this.display.barHeight, + width: e.scrollWidth - Tn(this) - this.display.barWidth, + clientHeight: Dn(this), + clientWidth: Rn(this) } }, - scrollIntoView: Po(function (e, t) { + scrollIntoView: ti((function (e, t) { null == e ? (e = { from: this.doc.sel.primary().head, to: null - }, null == t && (t = this.options.cursorScrollMargin)) : 'number' == typeof e ? e = { - from: fe(e, 0), + }, null == t && (t = this.options.cursorScrollMargin)) : "number" == typeof e ? e = { + from: et(e, 0), to: null } : null == e.from && (e = { from: e, to: null - }), e.to || (e.to = e.from), e.margin = t || 0, null == e.from.line ? po(this, e.from, e.to, e.margin) : lo(this, e) - }), - setSize: Po(function (e, t) { + }), e.to || (e.to = e.from), e.margin = t || 0, null != e.from.line ? function (e, t) { + Ir(e), e.curOp.scrollToPos = t + }(this, e) : Or(this, e.from, e.to, e.margin) + })), + setSize: ti((function (e, t) { var n = this, - o = function (e) { - return 'number' == typeof e || /^\d+$/.test(e + '') ? e + 'px' : e + r = function (e) { + return "number" == typeof e || /^\d+$/.test(String(e)) ? e + "px" : e }; - null != e && (this.display.wrapper.style.width = o(e)), null != t && (this.display.wrapper.style.height = o(t)), this.options.lineWrapping && cn(this); - var r = this.display.viewFrom; - this.doc.iter(r, this.display.viewTo, function (e) { + null != e && (this.display.wrapper.style.width = r(e)), null != t && (this.display.wrapper.style.height = r(t)), this.options.lineWrapping && Hn(this); + var i = this.display.viewFrom; + this.doc.iter(i, this.display.viewTo, (function (e) { if (e.widgets) for (var t = 0; t < e.widgets.length; t++) if (e.widgets[t].noHScroll) { - Nn(n, r, 'widget'); + pr(n, i, "widget"); break - }++ r - }), this.curOp.forceUpdate = !0, H(this, 'refresh', this) - }), + }++ i + })), this.curOp.forceUpdate = !0, fe(this, "refresh", this) + })), operation: function (e) { - return Ro(this, e) + return Jr(this, e) }, startOperation: function () { - return Co(this) + return $r(this) }, endOperation: function () { - return bo(this) + return qr(this) }, - refresh: Po(function () { + refresh: ti((function () { var e = this.display.cachedTextHeight; - Bn(this), this.curOp.forceUpdate = !0, pn(this), so(this, this.doc.scrollLeft, this.doc.scrollTop), zo(this.display), (null == e || .5 < o(e - xn(this.display))) && In(this), H(this, 'refresh', this) - }), - swapDoc: Po(function (e) { + hr(this), this.curOp.forceUpdate = !0, zn(this), Pr(this, this.doc.scrollLeft, this.doc.scrollTop), ci(this.display), (null == e || Math.abs(e - rr(this.display)) > .5) && lr(this), fe(this, "refresh", this) + })), + swapDoc: ti((function (e) { var t = this.doc; - return t.cm = null, this.state.selectingText && this.state.selectingText(), lr(this, e), pn(this), this.display.input.reset(), so(this, e.scrollLeft, e.scrollTop), this.curOp.forceScroll = !0, xt(this, 'swapDoc', this, t), t - }), + return t.cm = null, this.state.selectingText && this.state.selectingText(), Li(this, e), zn(this), this.display.input.reset(), Pr(this, e.scrollLeft, e.scrollTop), this.curOp.forceScroll = !0, ln(this, "swapDoc", this, t), t + })), phrase: function (e) { var t = this.options.phrases; return t && Object.prototype.hasOwnProperty.call(t, e) ? t[e] : e @@ -8052,57668 +8152,49981 @@ module.exports = function (e) { getGutterElement: function () { return this.display.gutters } - }, V(e), e.registerHelper = function (t, o, r) { + }, ve(e), e.registerHelper = function (t, r, i) { n.hasOwnProperty(t) || (n[t] = e[t] = { _global: [] - }), n[t][o] = r - }, e.registerGlobalHelper = function (t, o, r, i) { - e.registerHelper(t, o, i), n[t]._global.push({ - pred: r, - val: i + }), n[t][r] = i + }, e.registerGlobalHelper = function (t, r, i, o) { + e.registerHelper(t, r, o), n[t]._global.push({ + pred: i, + val: o }) } - }(oa); - var ld = ['iter', 'insert', 'remove', 'copy', 'getEditor', 'constructor']; - for (var cd in Vs.prototype) Vs.prototype.hasOwnProperty(cd) && 0 > b(ld, cd) && (oa.prototype[cd] = function (e) { + }(Rs); + var $s = "iter insert remove copy getEditor constructor".split(" "); + for (var qs in Mo.prototype) Mo.prototype.hasOwnProperty(qs) && z($s, qs) < 0 && (Rs.prototype[qs] = function (e) { return function () { return e.apply(this.doc, arguments) } - }(Vs.prototype[cd])); - return V(Vs), oa.inputStyles = { - textarea: dd, - contenteditable: sd - }, oa.defineMode = function (e) { - oa.defaults.mode || 'null' == e || (oa.defaults.mode = e), J.apply(this, arguments) - }, oa.defineMIME = function (e, t) { - us[e] = t - }, oa.defineMode('null', function () { + }(Mo.prototype[qs])); + return ve(Mo), Rs.inputStyles = { + textarea: Gs, + contenteditable: zs + }, Rs.defineMode = function (e) { + Rs.defaults.mode || "null" == e || (Rs.defaults.mode = e), Fe.apply(this, arguments) + }, Rs.defineMIME = function (e, t) { + Ne[e] = t + }, Rs.defineMode("null", (function () { return { token: function (e) { return e.skipToEnd() } } - }), oa.defineMIME('text/plain', 'null'), oa.defineExtension = function (e, t) { - oa.prototype[e] = t - }, oa.defineDocExtension = function (e, t) { - Vs.prototype[e] = t - }, oa.fromTextArea = function (e, t) { - function n() { - e.value = s.getValue() + })), Rs.defineMIME("text/plain", "null"), Rs.defineExtension = function (e, t) { + Rs.prototype[e] = t + }, Rs.defineDocExtension = function (e, t) { + Mo.prototype[e] = t + }, Rs.fromTextArea = function (e, t) { + if ((t = t ? F(t) : {}).value = e.value, !t.tabindex && e.tabIndex && (t.tabindex = e.tabIndex), !t.placeholder && e.placeholder && (t.placeholder = e.placeholder), null == t.autofocus) { + var n = P(); + t.autofocus = n == e || null != e.getAttribute("autofocus") && n == document.body } - if (t = t ? S(t) : {}, t.value = e.value, !t.tabindex && e.tabIndex && (t.tabindex = e.tabIndex), !t.placeholder && e.placeholder && (t.placeholder = e.placeholder), null == t.autofocus) { - var o = h(); - t.autofocus = o == e || null != e.getAttribute('autofocus') && o == document.body + + function r() { + e.value = a.getValue() } - var r; - if (e.form && (as(e.form, 'submit', n), !t.leaveSubmitMethodAlone)) { - var i = e.form; - r = i.submit; + var i; + if (e.form && (he(e.form, "submit", r), !t.leaveSubmitMethodAlone)) { + var o = e.form; + i = o.submit; try { - var a = i.submit = function () { - n(), i.submit = r, i.submit(), i.submit = a + var s = o.submit = function () { + r(), o.submit = i, o.submit(), o.submit = s } - } catch (t) {} + } catch (e) {} } - t.finishInit = function (o) { - o.save = n, o.getTextArea = function () { + t.finishInit = function (n) { + n.save = r, n.getTextArea = function () { return e - }, o.toTextArea = function () { - o.toTextArea = isNaN, n(), e.parentNode.removeChild(o.getWrapperElement()), e.style.display = '', e.form && (O(e.form, 'submit', n), !t.leaveSubmitMethodAlone && 'function' == typeof e.form.submit && (e.form.submit = r)) + }, n.toTextArea = function () { + n.toTextArea = isNaN, r(), e.parentNode.removeChild(n.getWrapperElement()), e.style.display = "", e.form && (de(e.form, "submit", r), t.leaveSubmitMethodAlone || "function" != typeof e.form.submit || (e.form.submit = i)) } - }, e.style.display = 'none'; - var s = oa(function (t) { + }, e.style.display = "none"; + var a = Rs((function (t) { return e.parentNode.insertBefore(t, e.nextSibling) - }, t); - return s + }), t); + return a }, function (e) { - e.off = O, e.on = as, e.wheelEventPixels = Xo, e.Doc = Vs, e.splitLines = ss, e.countColumn = C, e.findColumn = v, e.isWordChar = x, e.Pass = Qa, e.signal = H, e.Line = Es, e.changeEnd = Jo, e.scrollbarModel = Ms, e.Pos = fe, e.cmpPos = ge, e.modes = ps, e.mimeModes = us, e.resolveMode = ee, e.getMode = te, e.modeExtensions = ms, e.extendMode = ne, e.copyState = oe, e.startState = ae, e.innerMode = re, e.commands = Qs, e.keyMap = Xs, e.keyName = vi, e.isModifierKey = Ci, e.lookupKey = Si, e.normalizeKeyMap = yi, e.StringStream = hs, e.SharedTextMarker = Us, e.TextMarker = zs, e.LineWidget = Os, e.e_preventDefault = G, e.e_stopPropagation = K, e.e_stop = q, e.addClass = f, e.contains = m, e.rmClass = Ka, e.keyNames = js - }(oa), oa.version = '5.49.2', oa - }) -}, function (e) { - var t = e.exports = { - version: '1.2.6' - }; - 'number' == typeof __e && (__e = t) + e.off = de, e.on = he, e.wheelEventPixels = bi, e.Doc = Mo, e.splitLines = Me, e.countColumn = B, e.findColumn = G, e.isWordChar = J, e.Pass = U, e.signal = fe, e.Line = $t, e.changeEnd = Ti, e.scrollbarModel = Vr, e.Pos = et, e.cmpPos = tt, e.modes = Le, e.mimeModes = Ne, e.resolveMode = Be, e.getMode = He, e.modeExtensions = ze, e.extendMode = Ue, e.copyState = We, e.startState = je, e.innerMode = Ve, e.commands = ts, e.keyMap = Vo, e.keyName = Yo, e.isModifierKey = qo, e.lookupKey = $o, e.normalizeKeyMap = Go, e.StringStream = Ge, e.SharedTextMarker = Ro, e.TextMarker = xo, e.LineWidget = Co, e.e_preventDefault = we, e.e_stopPropagation = be, e.e_stop = Ce, e.addClass = I, e.contains = M, e.rmClass = T, e.keyNames = Ho + }(Rs), Rs.version = "5.49.2", Rs + }() +}, function (e, t) { + e.exports = require("os") }, function (e, t, n) { - 'use strict'; - - function o(e, t) { - return e.type === i.Local && e.name !== t && null != e.upstream + "use strict"; + t.fromCallback = function (e) { + return Object.defineProperty((function () { + if ("function" != typeof arguments[arguments.length - 1]) return new Promise((t, n) => { + arguments[arguments.length] = (e, r) => { + if (e) return n(e); + t(r) + }, arguments.length++, e.apply(this, arguments) + }); + e.apply(this, arguments) + }), "name", { + value: e.name + }) + }, t.fromPromise = function (e) { + return Object.defineProperty((function () { + const t = arguments[arguments.length - 1]; + if ("function" != typeof t) return e.apply(this, arguments); + e.apply(this, arguments).then(e => t(null, e), t) + }), "name", { + value: e.name + }) } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const r = n(705); - var i; - (function (e) { - e[e.Local = 0] = 'Local', e[e.Remote = 1] = 'Remote' - })(i = t.BranchType || (t.BranchType = {})); - var a; - (function (e) { - e.CurrentBranch = 'CurrentBranch', e.DefaultBranch = 'DefaultBranch', e.Head = 'Head', e.UpstreamDefaultBranch = 'UpstreamDefaultBranch' - })(a = t.StartPoint || (t.StartPoint = {})), t.eligibleForFastForward = o; - class s { - constructor(e, t, n, o) { - this.name = e, this.upstream = t, this.tip = n, this.type = o - } - get remote() { - const e = this.upstream; - if (!e) return null; - const t = e.match(/(.*?)\/.*/); - return !t || 2 > t.length ? null : t[1] - } - get upstreamWithoutRemote() { - return this.upstream ? r.removeRemotePrefix(this.upstream) : null - } - get nameWithoutRemote() { - if (this.type === i.Local) return this.name; - else { - const e = r.removeRemotePrefix(this.name); - return e || this.name +}, function (e, t, n) { + "use strict"; + const r = (0, n(16).fromCallback)(n(172)), + i = n(173); + e.exports = { + mkdirs: r, + mkdirsSync: i, + mkdirp: r, + mkdirpSync: i, + ensureDir: r, + ensureDirSync: i + } +}, function (e, t, n) { + "use strict"; + ! function e() { + if ("undefined" != typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) { + 0; + try { + __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e) + } catch (e) { + console.error(e) } } + }(), e.exports = n(149) +}, function (e, t, n) { + "use strict"; + t.__esModule = !0; + var r, i = n(54), + o = (r = i) && r.__esModule ? r : { + default: r + }; + t.default = o.default || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]) + } + return e } - t.Branch = s }, function (e, t) { - 'use strict'; - - function n(e, t) { - return e < t ? -1 : e > t ? 1 : 0 - } - - function o(e, t) { - return e < t ? 1 : e > t ? -1 : 0 - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), t.compare = n, t.compareDescending = o, t.caseInsensitiveEquals = function (e, t) { - return e.toLowerCase() === t.toLowerCase() - }, t.caseInsensitiveCompare = function (e, t) { - return n(e.toLowerCase(), t.toLowerCase()) - }, t.caseInsensitiveCompareDescending = function (e, t) { - return o(e.toLowerCase(), t.toLowerCase()) - } -}, function (e) { - e.exports = require('child_process') + var n = e.exports = { + version: "2.5.1" + }; + "number" == typeof __e && (__e = n) }, function (e, t, n) { - (function () { - t.Emitter = n(778), t.Disposable = n(180), t.CompositeDisposable = n(777) - }).call(this) + "use strict"; + const r = n(16).fromPromise, + i = n(95); + e.exports = { + pathExists: r((function (e) { + return i.access(e).then(() => !0).catch(() => !1) + })), + pathExistsSync: i.existsSync + } +}, function (e, t) { + var n = e.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(); + "number" == typeof __g && (__g = n) }, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5); - var i; - (function (e) { - e[e.Tabs = 0] = 'Tabs', e[e.Switch = 1] = 'Switch', e[e.Vertical = 2] = 'Vertical' - })(i = t.TabBarType || (t.TabBarType = {})); - class a extends o.Component { - constructor() { - super(...arguments), this.tabRefsByIndex = new Map, this.onSelectAdjacentTab = (e, t) => { - const n = o.Children.toArray(this.props.children); - if (0 !== n.length) { - const o = 'next' === e ? 1 : -1, - r = (t + o + n.length) % n.length, - i = this.tabRefsByIndex.get(r); - i && i.focus(), this.props.onTabClicked(r) - } - }, this.onTabClicked = (e) => { - this.props.onTabClicked(e) - }, this.onTabRef = (e, t) => { - t ? this.tabRefsByIndex.set(e, t) : this.tabRefsByIndex.delete(e) - } - } - render() { - const { - type: e - } = this.props; - return o.createElement('div', { - className: 'tab-bar ' + (e === i.Switch ? 'switch' : e === i.Vertical ? 'vertical' : 'tabs'), - role: 'tablist' - }, this.renderItems()) - } - renderItems() { - const e = o.Children.toArray(this.props.children); - return e.map((e, t) => { - const n = t === this.props.selectedIndex; - return o.createElement(s, { - key: t, - selected: n, - index: t, - onClick: this.onTabClicked, - onSelectAdjacent: this.onSelectAdjacentTab, - onButtonRef: this.onTabRef, - type: this.props.type - }, e) - }) - } + "use strict"; + t.__esModule = !0, t.default = function (e, t) { + if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } - t.TabBar = a; - class s extends o.Component { - constructor() { - super(...arguments), this.onClick = () => { - this.props.onClick(this.props.index) - }, this.onKeyDown = (e) => { - const { - type: t, - index: n - } = this.props, o = t === i.Vertical ? 'ArrowUp' : 'ArrowLeft', r = t === i.Vertical ? 'ArrowDown' : 'ArrowRight'; - e.key === o ? (this.props.onSelectAdjacent('previous', n), e.preventDefault()) : e.key === r && (this.props.onSelectAdjacent('next', n), e.preventDefault()) - }, this.onButtonRef = (e) => { - this.props.onButtonRef(this.props.index, e) +}, function (e, t, n) { + "use strict"; + t.__esModule = !0; + var r, i = n(243), + o = (r = i) && r.__esModule ? r : { + default: r + }; + t.default = function () { + function e(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), (0, o.default)(e, r.key, r) } } - render() { - const e = this.props.selected, - t = r('tab-bar-item', { - selected: e - }); - return o.createElement('button', { - ref: this.onButtonRef, - className: t, - onClick: this.onClick, - role: 'tab', - "aria-selected": e, - tabIndex: e ? void 0 : -1, - onKeyDown: this.onKeyDown, - type: 'button' - }, this.props.children) + return function (t, n, r) { + return n && e(t.prototype, n), r && e(t, r), t } - } + }() }, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(4); - class i extends o.Component { - render() { - return o.createElement(r.Octicon, { - className: 'spin', - symbol: r.OcticonSymbol.sync - }) - } + var r = n(22), + i = n(20), + o = n(105), + s = n(29), + a = function (e, t, n) { + var l, c, u, h = e & a.F, + p = e & a.G, + d = e & a.S, + f = e & a.P, + m = e & a.B, + g = e & a.W, + y = p ? i : i[t] || (i[t] = {}), + v = y.prototype, + w = p ? r : d ? r[t] : (r[t] || {}).prototype; + for (l in p && (n = t), n)(c = !h && w && void 0 !== w[l]) && l in y || (u = c ? w[l] : n[l], y[l] = p && "function" != typeof w[l] ? n[l] : m && c ? o(u, r) : g && w[l] == u ? function (e) { + var t = function (t, n, r) { + if (this instanceof e) { + switch (arguments.length) { + case 0: + return new e; + case 1: + return new e(t); + case 2: + return new e(t, n) + } + return new e(t, n, r) + } + return e.apply(this, arguments) + }; + return t.prototype = e.prototype, t + }(u) : f && "function" == typeof u ? o(Function.call, u) : u, f && ((y.virtual || (y.virtual = {}))[l] = u, e & a.R && v && !v[l] && s(v, l, u))) + }; + a.F = 1, a.G = 2, a.S = 4, a.P = 8, a.B = 16, a.W = 32, a.U = 64, a.R = 128, e.exports = a +}, function (e, t, n) { + var r = n(37), + i = n(106), + o = n(64), + s = Object.defineProperty; + t.f = n(27) ? Object.defineProperty : function (e, t, n) { + if (r(e), t = o(t, !0), r(n), i) try { + return s(e, t, n) + } catch (e) {} + if ("get" in n || "set" in n) throw TypeError("Accessors not supported!"); + return "value" in n && (e[t] = n.value), e } - t.Loading = i }, function (e, t, n) { - 'use strict'; - async function o(e, t = process.env, n = a.resolveGitProxy) { - if (i.enableAutomaticGitProxyConfiguration()) { - if ('ALL_PROXY' in t || 'all_proxy' in t) return void log.info(`proxy url not resolved, ALL_PROXY already set`); - const o = /^(https?):\/\//i.exec(e); - if (null === o) return void log.info(`proxy url not resolved, protocol not supported`); - const r = o[1].toLowerCase(), - i = `${r}_proxy`; - if (i in t || 'https' === r && 'HTTPS_PROXY' in t) return void log.info(`proxy url not resolved, ${i} already set`); - const a = await n(e).catch((e) => { - log.error('Failed resolving Git proxy', e) - }); - return void 0 === a ? void 0 : { - [i]: a + e.exports = !n(30)((function () { + return 7 != Object.defineProperty({}, "a", { + get: function () { + return 7 } - } + }).a + })) +}, function (e, t) { + var n = {}.hasOwnProperty; + e.exports = function (e, t) { + return n.call(e, t) } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const r = n(100), - i = n(25), - a = n(704), - s = n(10); - t.getFallbackUrlForProxyResolve = function (e, t) { - return null === e ? null !== t.gitHubRepository && null !== t.gitHubRepository.cloneURL ? t.gitHubRepository.cloneURL : 'https://github.com' : e.endpoint === s.getDotComAPIEndpoint() ? 'https://github.com' : e.endpoint - }, t.envForRemoteOperation = async function (e, t) { - return Object.assign({}, r.envForAuthentication(e), (await o(t))) - }, t.envForProxy = o }, function (e, t, n) { - 'use strict'; - const o = n(39).fromPromise, - r = n(290); - e.exports = { - pathExists: o(function (e) { - return r.access(e).then(() => !0).catch(() => !1) - }), - pathExistsSync: r.existsSync + var r = n(26), + i = n(46); + e.exports = n(27) ? function (e, t, n) { + return r.f(e, t, i(1, n)) + } : function (e, t, n) { + return e[t] = n, e } }, function (e, t) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }), t.merge = function (e, t) { - const n = Object.assign({}, e); - for (const o in t) n[o] = t[o]; - return n + e.exports = function (e) { + try { + return !!e() + } catch (e) { + return !0 + } } }, function (e, t, n) { - 'use strict'; - - function o(e, t) { - const n = d.getHTMLURL(e.endpoint), - o = a.parse(n), - r = o.hostname, - i = l.parseRemote(t); - if (!i) return null; - const s = i.owner, - c = i.name; - return r && i.hostname.toLowerCase() === r.toLowerCase() && s && c ? { - name: c, - owner: s, - endpoint: e.endpoint - } : null + var r = n(109), + i = n(65); + e.exports = function (e) { + return r(i(e)) } +}, function (e, t, n) { + var r = n(68)("wks"), + i = n(47), + o = n(22).Symbol, + s = "function" == typeof o; + (e.exports = function (e) { + return r[e] || (r[e] = s && o[e] || (s ? o : i)("Symbol." + e)) + }).store = r +}, function (e, t, n) { + var r = n(43), + i = n(36), + o = n(223); - function r(e, t) { - if (null == e) return !1; - const n = l.parseRemote(e), - o = l.parseRemote(t.url); - return null != o && null != n && !!c.caseInsensitiveEquals(o.hostname, n.hostname) && null != o.owner && null != n.owner && null != o.name && null != n.name && c.caseInsensitiveEquals(o.owner, n.owner) && c.caseInsensitiveEquals(o.name, n.name) + function s(e, t) { + if (!e) throw new Error("expected readStream"); + if (!e.readable) throw new Error("readStream must be readable"); + var n = new a(t); + return e.pipe(n), n } - function i(e, t) { - const n = l.parseRepositoryIdentifier(e), - o = l.parseRepositoryIdentifier(t); - return null !== n && null !== o && n.hostname === o.hostname && n.owner === o.owner && n.name === o.name + function a(e) { + r.Transform.call(this, e), e = e || {}, this._readableState.objectMode = !0, this._lineBuffer = [], this._keepEmptyLines = e.keepEmptyLines || !1, this._lastChunkEndedWithCR = !1; + var t = this; + this.on("pipe", (function (e) { + t.encoding || e instanceof r.Readable && (t.encoding = e._readableState.encoding) + })) } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const a = n(42), - s = n(1), - d = n(10), - l = n(104), - c = n(47); - t.matchGitHubRepository = function (e, t) { - for (const n of e) { - const e = o(n, t); - if (e) return e - } - return null - }, t.matchExistingRepository = function (e, t) { - return e.find((e) => s.normalize(e.path).toLowerCase() === s.normalize(t).toLowerCase()) || null - }, t.repositoryMatchesRemote = function (e, t) { - return r(e.htmlURL, t) || r(e.cloneURL, t) - }, t.urlMatchesRemote = r, t.urlMatchesCloneURL = function (e, t) { - return null !== t.cloneURL && i(t.cloneURL, e) - }, t.urlsMatch = i -}, function (e, t) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }), t.getBoolean = function (e, t) { - const n = localStorage.getItem(e); - return null === n ? t : !('1' !== n && 'true' !== n) || '0' !== n && 'false' !== n && t - }, t.setBoolean = function (e, t) { - localStorage.setItem(e, t ? '1' : '0') - }, t.getNumber = function (e, t) { - const n = localStorage.getItem(e); - if (null === n || 0 === n.length) return t; - const o = parseInt(n, 10); - return isNaN(o) ? t : o - }, t.setNumber = function (e, t) { - localStorage.setItem(e, t.toString()) - }, t.getNumberArray = function (e) { - return (localStorage.getItem(e) || '').split(n).map(parseFloat).filter((e) => !isNaN(e)) - }, t.setNumberArray = function (e, t) { - localStorage.setItem(e, t.join(n)) - }, t.getStringArray = function (e) { - const t = localStorage.getItem(e) || '[]'; - try { - const e = JSON.parse(t); - return e instanceof Array ? e.some((e) => 'string' != typeof e) ? [] : e : [] - } catch (t) { - return [] + e.exports = function (t, n) { + return e.exports.createStream(t, n) + }, e.exports.createStream = function (e, t) { + return e ? s(e, t) : new a(t) + }, e.exports.createLineStream = function (e) { + return console.log("WARNING: byline#createLineStream is deprecated and will be removed soon"), s(e) + }, e.exports.LineStream = a, i.inherits(a, r.Transform), a.prototype._transform = function (e, t, n) { + t = t || "utf8", Buffer.isBuffer(e) && ("buffer" == t ? (e = e.toString(), t = "utf8") : e = e.toString(t)), this._chunkEncoding = t; + var r = e.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g); + this._lastChunkEndedWithCR && "\n" == e[0] && r.shift(), this._lineBuffer.length > 0 && (this._lineBuffer[this._lineBuffer.length - 1] += r[0], r.shift()), this._lastChunkEndedWithCR = "\r" == e[e.length - 1], this._lineBuffer = this._lineBuffer.concat(r), this._pushBuffer(t, 1, n) + }, a.prototype._pushBuffer = function (e, t, n) { + for (; this._lineBuffer.length > t;) { + var r = this._lineBuffer.shift(); + if ((this._keepEmptyLines || r.length > 0) && !this.push(this._reencode(r, e))) { + var i = this; + return void o.setImmediate((function () { + i._pushBuffer(e, t, n) + })) + } } - }, t.setStringArray = function (e, t) { - const n = JSON.stringify(t); - localStorage.setItem(e, n) + n() + }, a.prototype._flush = function (e) { + this._pushBuffer(this._chunkEncoding, 0, e) + }, a.prototype._reencode = function (e, t) { + return this.encoding && this.encoding != t ? new Buffer(e, t).toString(this.encoding) : this.encoding ? e : new Buffer(e, t) + } +}, , function (e, t) { + t.getArg = function (e, t, n) { + if (t in e) return e[t]; + if (3 === arguments.length) return n; + throw new Error('"' + t + '" is a required argument.') }; - const n = ',' -}, function (e, t, n) { - var o = Math.round, - r = Math.abs, - i = Math.floor, - a = Math.ceil, - s = Math.min; - (function (e) { - var t; //! moment.js - (function (t, n) { - e.exports = n() - })(this, function () { - 'use strict'; - - function t() { - return Ot.apply(null, arguments) - } - - function n(e) { - return e instanceof Array || '[object Array]' === Object.prototype.toString.call(e) - } + var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/, + r = /^data:.+\,.+$/; - function d(e) { - return null != e && '[object Object]' === Object.prototype.toString.call(e) - } - - function l(e) { - if (Object.getOwnPropertyNames) return 0 === Object.getOwnPropertyNames(e).length; - for (var t in e) - if (e.hasOwnProperty(t)) return !1; - return !0 - } - - function p(e) { - return void 0 === e - } - - function c(e) { - return 'number' == typeof e || '[object Number]' === Object.prototype.toString.call(e) - } - - function u(e) { - return e instanceof Date || '[object Date]' === Object.prototype.toString.call(e) - } + function i(e) { + var t = e.match(n); + return t ? { + scheme: t[1], + auth: t[2], + host: t[3], + port: t[4], + path: t[5] + } : null + } - function m(e, t) { - var n = [], - o; - for (o = 0; o < e.length; ++o) n.push(t(e[o], o)); - return n - } + function o(e) { + var t = ""; + return e.scheme && (t += e.scheme + ":"), t += "//", e.auth && (t += e.auth + "@"), e.host && (t += e.host), e.port && (t += ":" + e.port), e.path && (t += e.path), t + } - function h(e, t) { - return Object.prototype.hasOwnProperty.call(e, t) - } + function s(e) { + var n = e, + r = i(e); + if (r) { + if (!r.path) return e; + n = r.path + } + for (var s, a = t.isAbsolute(n), l = n.split(/\/+/), c = 0, u = l.length - 1; u >= 0; u--) "." === (s = l[u]) ? l.splice(u, 1) : ".." === s ? c++ : c > 0 && ("" === s ? (l.splice(u + 1, c), c = 0) : (l.splice(u, 2), c--)); + return "" === (n = l.join("/")) && (n = a ? "/" : "."), r ? (r.path = n, o(r)) : n + } + t.urlParse = i, t.urlGenerate = o, t.normalize = s, t.join = function (e, t) { + "" === e && (e = "."), "" === t && (t = "."); + var n = i(t), + a = i(e); + if (a && (e = a.path || "/"), n && !n.scheme) return a && (n.scheme = a.scheme), o(n); + if (n || t.match(r)) return t; + if (a && !a.host && !a.path) return a.host = t, o(a); + var l = "/" === t.charAt(0) ? t : s(e.replace(/\/+$/, "") + "/" + t); + return a ? (a.path = l, o(a)) : l + }, t.isAbsolute = function (e) { + return "/" === e.charAt(0) || !!e.match(n) + }, t.relative = function (e, t) { + "" === e && (e = "."), e = e.replace(/\/$/, ""); + for (var n = 0; 0 !== t.indexOf(e + "/");) { + var r = e.lastIndexOf("/"); + if (r < 0) return t; + if ((e = e.slice(0, r)).match(/^([^\/]+:\/)?\/*$/)) return t; + ++n + } + return Array(n + 1).join("../") + t.substr(e.length + 1) + }; + var a = !("__proto__" in Object.create(null)); - function f(e, t) { - for (var n in t) h(t, n) && (e[n] = t[n]); - return h(t, 'toString') && (e.toString = t.toString), h(t, 'valueOf') && (e.valueOf = t.valueOf), e - } + function l(e) { + return e + } - function g(e, t, n, o) { - return Xe(e, t, n, o, !0).utc() - } + function c(e) { + if (!e) return !1; + var t = e.length; + if (t < 9) return !1; + if (95 !== e.charCodeAt(t - 1) || 95 !== e.charCodeAt(t - 2) || 111 !== e.charCodeAt(t - 3) || 116 !== e.charCodeAt(t - 4) || 111 !== e.charCodeAt(t - 5) || 114 !== e.charCodeAt(t - 6) || 112 !== e.charCodeAt(t - 7) || 95 !== e.charCodeAt(t - 8) || 95 !== e.charCodeAt(t - 9)) return !1; + for (var n = t - 10; n >= 0; n--) + if (36 !== e.charCodeAt(n)) return !1; + return !0 + } - function y() { - return { - empty: !1, - unusedTokens: [], - unusedInput: [], - overflow: -2, - charsLeftOver: 0, - nullInput: !1, - invalidMonth: null, - invalidFormat: !1, - userInvalidated: !1, - iso: !1, - parsedDateParts: [], - meridiem: null, - rfc2822: !1, - weekdayMismatch: !1 - } - } + function u(e, t) { + return e === t ? 0 : e > t ? 1 : -1 + } + t.toSetString = a ? l : function (e) { + return c(e) ? "$" + e : e + }, t.fromSetString = a ? l : function (e) { + return c(e) ? e.slice(1) : e + }, t.compareByOriginalPositions = function (e, t, n) { + var r = e.source - t.source; + return 0 !== r || 0 !== (r = e.originalLine - t.originalLine) || 0 !== (r = e.originalColumn - t.originalColumn) || n || 0 !== (r = e.generatedColumn - t.generatedColumn) || 0 !== (r = e.generatedLine - t.generatedLine) ? r : e.name - t.name + }, t.compareByGeneratedPositionsDeflated = function (e, t, n) { + var r = e.generatedLine - t.generatedLine; + return 0 !== r || 0 !== (r = e.generatedColumn - t.generatedColumn) || n || 0 !== (r = e.source - t.source) || 0 !== (r = e.originalLine - t.originalLine) || 0 !== (r = e.originalColumn - t.originalColumn) ? r : e.name - t.name + }, t.compareByGeneratedPositionsInflated = function (e, t) { + var n = e.generatedLine - t.generatedLine; + return 0 !== n || 0 !== (n = e.generatedColumn - t.generatedColumn) || 0 !== (n = u(e.source, t.source)) || 0 !== (n = e.originalLine - t.originalLine) || 0 !== (n = e.originalColumn - t.originalColumn) ? n : u(e.name, t.name) + } +}, function (e, t) { + e.exports = require("util") +}, function (e, t, n) { + var r = n(38); + e.exports = function (e) { + if (!r(e)) throw TypeError(e + " is not an object!"); + return e + } +}, function (e, t) { + e.exports = function (e) { + return "object" == typeof e ? null !== e : "function" == typeof e + } +}, function (e, t, n) { + var r = n(108), + i = n(69); + e.exports = Object.keys || function (e) { + return r(e, i) + } +}, function (e, t, n) { + "use strict"; + n.r(t), n.d(t, "start", (function () { + return o + })), n.d(t, "stop", (function () { + return s + })), n.d(t, "measure", (function () { + return a + })); + let r = !1, + i = 0; - function S(e) { - return null == e._pf && (e._pf = y()), e._pf - } + function o() { + r = !0 + } - function C(e) { - if (null == e._isValid) { - var t = S(e), - n = Ht.call(t.parsedDateParts, function (e) { - return null != e - }), - o = !isNaN(e._d.getTime()) && 0 > t.overflow && !t.empty && !t.invalidMonth && !t.invalidWeekday && !t.weekdayMismatch && !t.nullInput && !t.invalidFormat && !t.userInvalidated && (!t.meridiem || t.meridiem && n); - if (e._strict && (o = o && 0 === t.charsLeftOver && 0 === t.unusedTokens.length && void 0 === t.bigHour), null == Object.isFrozen || !Object.isFrozen(e)) e._isValid = o; - else return o + function s() { + r = !1 + } + async function a(e, t) { + const n = ++i, + o = performance && performance.now ? performance.now() : null; + ! function (e, t) { + if (!r) return; + const n = `${e}::${t}`; + performance.mark(n) + }(n, e); + try { + return await t() + } finally { + if (o) { + const t = performance.now() - o; + if (t > 1e3) { + const n = (t / 1e3).toFixed(3); + log.info(`Executing ${e} (took ${n}s)`) } - return e._isValid + }! function (e, t) { + if (!r) return; + const n = `${e}::${t}`, + i = t; + performance.measure(i, n), performance.clearMarks(n), performance.clearMeasures(i) + }(n, e) + } + } +}, function (e, t, n) { + "use strict"; + t.__esModule = !0; + var r, i = n(113), + o = (r = i) && r.__esModule ? r : { + default: r + }; + t.default = function (e, t) { + if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return !t || "object" !== (void 0 === t ? "undefined" : (0, o.default)(t)) && "function" != typeof t ? e : t + } +}, function (e, t) { + e.exports = function (e) { + return e.webpackPolyfill || (e.deprecate = function () {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", { + enumerable: !0, + get: function () { + return e.l } - - function b(e) { - var t = g(NaN); - return null == e ? S(t).userInvalidated = !0 : f(S(t), e), t + }), Object.defineProperty(e, "id", { + enumerable: !0, + get: function () { + return e.i } - - function v(e, t) { - var n, o, r; - if (p(t._isAMomentObject) || (e._isAMomentObject = t._isAMomentObject), p(t._i) || (e._i = t._i), p(t._f) || (e._f = t._f), p(t._l) || (e._l = t._l), p(t._strict) || (e._strict = t._strict), p(t._tzm) || (e._tzm = t._tzm), p(t._isUTC) || (e._isUTC = t._isUTC), p(t._offset) || (e._offset = t._offset), p(t._pf) || (e._pf = S(t)), p(t._locale) || (e._locale = t._locale), 0 < zt.length) - for (n = 0; n < zt.length; n++) o = zt[n], r = t[o], p(r) || (e[o] = r); - return e + }), e.webpackPolyfill = 1), e + } +}, function (e, t) { + e.exports = require("stream") +}, function (e, t) { + e.exports = require("assert") +}, function (e, t, n) { + "use strict"; + const r = n(16).fromCallback, + i = n(176); + e.exports = { + remove: r(i), + removeSync: i.sync + } +}, function (e, t) { + e.exports = function (e, t) { + return { + enumerable: !(1 & e), + configurable: !(2 & e), + writable: !(4 & e), + value: t + } + } +}, function (e, t) { + var n = 0, + r = Math.random(); + e.exports = function (e) { + return "Symbol(".concat(void 0 === e ? "" : e, ")_", (++n + r).toString(36)) + } +}, function (e, t) { + t.f = {}.propertyIsEnumerable +}, function (e, t, n) { + var r = n(65); + e.exports = function (e) { + return Object(r(e)) + } +}, function (e, t) { + e.exports = function (e) { + return e && e.__esModule ? e : { + default: e + } + } +}, function (e, t) { + (function () { + var e, n, r, i, o, s, a, l, c, u, h, p, d, f, m, g; + t.score = function (e, t, r) { + var i, s, a; + return i = r.preparedQuery, r.allowErrors || o(e, i.core_lw, i.core_up) ? (a = e.toLowerCase(), s = n(e, a, i), Math.ceil(s)) : 0 + }, t.isMatch = o = function (e, t, n) { + var r, i, o, s, a, l, c; + if (o = e.length, s = t.length, !o || s > o) return !1; + for (r = -1, i = -1; ++i < s;) { + for (a = t.charCodeAt(i), l = n.charCodeAt(i); ++r < o && (c = e.charCodeAt(r)) !== a && c !== l;); + if (r === o) return !1 } + return !0 + }, t.computeScore = n = function (e, t, n) { + var r, i, o, s, a, f, m, y, v, w, b, S, C, E, k, x, T, R, D, _, A, M, P, I; + if (k = n.query, x = n.query_lw, w = e.length, C = k.length, i = (r = c(e, t, k, x)).score, r.count === C) return p(C, w, i, r.pos); + if ((E = t.indexOf(x)) > -1) return d(e, t, k, x, E, C, w); + for (_ = new Array(C), a = new Array(C), I = g(C, w), S = b = Math.ceil(.75 * C) + 5, m = !0, v = -1; ++v < C;) _[v] = 0, a[v] = 0; + for (y = -1; ++y < w;) + if (!(M = t[y]).charCodeAt(0) in n.charCodes) { + if (m) { + for (v = -1; ++v < C;) a[v] = 0; + m = !1 + } + } else + for (R = 0, D = 0, s = 0, T = !0, m = !0, v = -1; ++v < C;) { + if ((A = _[v]) > R && (R = A), f = 0, x[v] === M) + if (P = l(y, e, t), f = s > 0 ? s : h(e, t, k, x, y, v, P), (o = D + u(y, v, P, i, f)) > R) R = o, S = b; + else { + if (T && --S <= 0) return Math.max(R, _[C - 1]) * I; + T = !1 + } D = A, s = a[v], a[v] = f, _[v] = R + } + return (R = _[C - 1]) * I + }, t.isWordStart = l = function (e, t, n) { + var r, i; + return 0 === e || (r = t[e], i = t[e - 1], s(i) || r !== n[e] && i === n[e - 1]) + }, t.isWordEnd = a = function (e, t, n, r) { + var i, o; + return e === r - 1 || (i = t[e], o = t[e + 1], s(o) || i === n[e] && o !== n[e + 1]) + }, s = function (e) { + return " " === e || "." === e || "-" === e || "_" === e || "/" === e || "\\" === e + }, m = function (e) { + var t; + return e < 20 ? 100 + (t = 20 - e) * t : Math.max(120 - e, 0) + }, t.scoreSize = g = function (e, t) { + return 150 / (150 + Math.abs(t - e)) + }, p = function (e, t, n, r) { + return 2 * e * (150 * n + m(r)) * g(e, t) + }, t.scorePattern = f = function (e, t, n, r, i) { + var o, s; + return s = e, o = 6, n === e && (o += 2), r && (o += 3), i && (o += 1), e === t && (r && (s += n === t ? 2 : 1), i && (o += 1)), n + s * (s + o) + }, t.scoreCharacter = u = function (e, t, n, r, i) { + var o; + return o = m(e), n ? o + 150 * ((r > i ? r : i) + 10) : o + 150 * i + }, t.scoreConsecutives = h = function (e, t, n, r, i, o, s) { + var l, c, u, h, p, d, m; + for (l = (u = (c = e.length) - i) < (p = (h = n.length) - o) ? u : p, d = 0, m = 0, n[o] === e[i] && d++; ++m < l && r[++o] === t[++i];) n[o] === e[i] && d++; + return m < l && i--, 1 === m ? 1 + 2 * d : f(m, h, d, s, a(i, e, t, c)) + }, t.scoreExactMatch = d = function (e, t, n, r, i, o, s) { + var c, u, h, d, m; + for ((m = l(i, e, t)) || (h = t.indexOf(r, i + 1)) > -1 && (m = l(h, e, t)) && (i = h), u = -1, d = 0; ++u < o;) n[i + u] === e[u] && d++; + return c = a(i + o - 1, e, t, s), p(o, s, f(o, o, d, m, c), i) + }, r = new(e = function (e, t, n) { + this.score = e, this.pos = t, this.count = n + })(0, .1, 0), t.scoreAcronyms = c = function (t, n, o, a) { + var c, u, h, p, d, m, g, y, v, w, b; + if (d = t.length, m = o.length, !(d > 1 && m > 1)) return r; + for (c = 0, w = 0, b = 0, y = 0, h = -1, p = -1; ++p < m;) { + if (g = a[p], s(g)) { + if ((h = n.indexOf(g, h + 1)) > -1) { + w++; + continue + } + break + } + for (; ++h < d;) + if (g === n[h] && l(h, t, n)) { + o[p] === t[h] && y++, b += h, c++; + break + } if (h === d) break + } + return c < 2 ? r : (u = c === m && i(t, n, o, c), v = f(c, m, y, !0, u), new e(v, b / c, c + w)) + }, i = function (e, t, n, r) { + var i, o, s; + if (i = 0, (s = e.length) > 12 * n.length) return !1; + for (o = -1; ++o < s;) + if (l(o, e, t) && ++i > r) return !1; + return !0 + } + }).call(this) +}, function (e, t) { + e.exports = require("crypto") +}, function (e, t, n) { + "use strict"; + n(193); + const r = async e => { + throw new Error("macOS only") + }; + e.exports = r, e.exports.default = r, e.exports.sync = e => { + throw new Error("macOS only") + } +}, function (e, t, n) { + e.exports = { + default: n(234), + __esModule: !0 + } +}, function (e, t, n) { + e.exports = { + default: n(241), + __esModule: !0 + } +}, function (e, t, n) { + "use strict"; + t.__esModule = !0; + var r = s(n(267)), + i = s(n(271)), + o = s(n(113)); - function E(e) { - v(this, e), this._d = new Date(null == e._d ? NaN : e._d.getTime()), this.isValid() || (this._d = new Date(NaN)), !1 === Ut && (Ut = !0, t.updateOffset(this), Ut = !1) + function s(e) { + return e && e.__esModule ? e : { + default: e + } + } + t.default = function (e, t) { + if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : (0, o.default)(t))); + e.prototype = (0, i.default)(t && t.prototype, { + constructor: { + value: e, + enumerable: !1, + writable: !0, + configurable: !0 } + }), t && (r.default ? (0, r.default)(e, t) : e.__proto__ = t) + } +}, function (e, t, n) { + var r = n(222); - function w(e) { - return e instanceof E || null != e && null != e._isAMomentObject - } + function i(e, t) { + if (!e || e.length <= 0) throw new Error(t + " is required.") + } + e.exports = { + getPassword: function (e, t) { + return i(e, "Service"), i(t, "Account"), r.getPassword(e, t) + }, + setPassword: function (e, t, n) { + return i(e, "Service"), i(t, "Account"), i(n, "Password"), r.setPassword(e, t, n) + }, + deletePassword: function (e, t) { + return i(e, "Service"), i(t, "Account"), r.deletePassword(e, t) + }, + findPassword: function (e) { + return i(e, "Service"), r.findPassword(e) + }, + findCredentials: function (e) { + return i(e, "Service"), r.findCredentials(e) + } + } +}, function (e, t, n) { + const r = n(7), + { + spawn: i, + spawnSync: o + } = n(8), + s = (n(62), n(297)), + a = e.exports; - function k(e) { - return 0 > e ? a(e) || 0 : i(e) - } + function l(e, t) { + return n => t(0 === n ? null : new Error(e + " failed with exit status " + n)) + } + a.testMode = !1, Object.assign(a, { + symlink(e, t, n) { + s.spawnAsAdmin("cmd", ["/c", "mklink", "/j", t, e], a.testMode, l("mklink", n)) + }, + unlink(e, t) { + r.stat(e, (n, r) => { + if (n) return t(n); + r.isDirectory() ? s.spawnAsAdmin("cmd", ["/c", "rmdir", "/s", "/q", e], a.testMode, l("rmdir", t)) : s.spawnAsAdmin("cmd", ["/c", "del", "/f", "/q", e], a.testMode, l("del", t)) + }) + }, + makeTree(e, t) { + s.spawnAsAdmin("cmd", ["/c", "mkdir", e], a.testMode, l("mkdir", t)) + }, + recursiveCopy(e, t, n) { + s.spawnAsAdmin("cmd", ["/c", 298, e, t], a.testMode, l("robocopy", n)) + } + }) +}, function (e, t, n) { + "use strict"; + /* + object-assign + (c) Sindre Sorhus + @license MIT + */ + var r = Object.getOwnPropertySymbols, + i = Object.prototype.hasOwnProperty, + o = Object.prototype.propertyIsEnumerable; - function T(e) { - var t = +e, - n = 0; - return 0 != t && isFinite(t) && (n = k(t)), n + function s(e) { + if (null == e) throw new TypeError("Object.assign cannot be called with null or undefined"); + return Object(e) + } + e.exports = function () { + try { + if (!Object.assign) return !1; + var e = new String("abc"); + if (e[5] = "de", "5" === Object.getOwnPropertyNames(e)[0]) return !1; + for (var t = {}, n = 0; n < 10; n++) t["_" + String.fromCharCode(n)] = n; + if ("0123456789" !== Object.getOwnPropertyNames(t).map((function (e) { + return t[e] + })).join("")) return !1; + var r = {}; + return "abcdefghijklmnopqrst".split("").forEach((function (e) { + r[e] = e + })), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, r)).join("") + } catch (e) { + return !1 + } + }() ? Object.assign : function (e, t) { + for (var n, a, l = s(e), c = 1; c < arguments.length; c++) { + for (var u in n = Object(arguments[c])) i.call(n, u) && (l[u] = n[u]); + if (r) { + a = r(n); + for (var h = 0; h < a.length; h++) o.call(n, a[h]) && (l[a[h]] = n[a[h]]) } - - function _(e, t, n) { - var o = s(e.length, t.length), - a = r(e.length - t.length), - d = 0, - l; - for (l = 0; l < o; l++)(n && e[l] !== t[l] || !n && T(e[l]) !== T(t[l])) && d++; - return d + a + } + return l + } +}, function (e, t) { + (function () { + e.exports = function () { + function e(e) { + this.disposalAction = e } - - function R(e) { - !1 === t.suppressDeprecationWarnings && 'undefined' != typeof console && console.warn && console.warn('Deprecation warning: ' + e) + return e.prototype.disposed = !1, e.isDisposable = function (e) { + return "function" == typeof (null != e ? e.dispose : void 0) + }, e.prototype.dispose = function () { + this.disposed || (this.disposed = !0, "function" == typeof this.disposalAction && this.disposalAction(), this.disposalAction = null) + }, e + }() + }).call(this) +}, function (e, t, n) { + "use strict"; + const r = n(16).fromCallback, + i = n(184); + e.exports = { + readJson: r(i.readFile), + readJsonSync: i.readFileSync, + writeJson: r(i.writeFile), + writeJsonSync: i.writeFileSync + } +}, function (e, t) { + e.exports = require("events") +}, function (e, t, n) { + e.exports = n(232)() +}, function (e, t, n) { + var r = n(38); + e.exports = function (e, t) { + if (!r(e)) return e; + var n, i; + if (t && "function" == typeof (n = e.toString) && !r(i = n.call(e))) return i; + if ("function" == typeof (n = e.valueOf) && !r(i = n.call(e))) return i; + if (!t && "function" == typeof (n = e.toString) && !r(i = n.call(e))) return i; + throw TypeError("Can't convert object to primitive value") + } +}, function (e, t) { + e.exports = function (e) { + if (null == e) throw TypeError("Can't call method on " + e); + return e + } +}, function (e, t) { + var n = Math.ceil, + r = Math.floor; + e.exports = function (e) { + return isNaN(e = +e) ? 0 : (e > 0 ? r : n)(e) + } +}, function (e, t, n) { + var r = n(68)("keys"), + i = n(47); + e.exports = function (e) { + return r[e] || (r[e] = i(e)) + } +}, function (e, t, n) { + var r = n(22), + i = r["__core-js_shared__"] || (r["__core-js_shared__"] = {}); + e.exports = function (e) { + return i[e] || (i[e] = {}) + } +}, function (e, t) { + e.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",") +}, function (e, t) { + t.f = Object.getOwnPropertySymbols +}, function (e, t) { + e.exports = !0 +}, function (e, t) { + e.exports = {} +}, function (e, t, n) { + var r = n(37), + i = n(251), + o = n(69), + s = n(67)("IE_PROTO"), + a = function () {}, + l = function () { + var e, t = n(107)("iframe"), + r = o.length; + for (t.style.display = "none", n(252).appendChild(t), t.src = "javascript:", (e = t.contentWindow.document).open(), e.write("', f = a.removeChild(a.firstChild)) : 'string' == typeof m.is ? f = f.createElement(a, { - is: m.is - }) : (f = f.createElement(a), 'select' === a && m.multiple && (f.multiple = !0)) : f = f.createElementNS(h, a), a = f, a[Ci] = y, a[bi] = d, dd(a, o, !1, !1), m = a, f = e, y = d; - var p = c, - t = qe(f, y); - switch (f) { - case 'iframe': - case 'object': - sn('load', m), c = y; - break; - case 'video': - case 'audio': - for (c = 0; c < Li.length; c++) sn(Li[c], m); - c = y; - break; - case 'source': - sn('error', m), c = y; - break; - case 'img': - case 'image': - case 'link': - sn('error', m), sn('load', m), c = y; - break; - case 'form': - sn('reset', m), sn('submit', m), c = y; - break; - case 'details': - sn('toggle', m), c = y; - break; - case 'input': - Lt(m, y), c = It(m, y), sn('invalid', m), re(p, 'onChange'); - break; - case 'option': - c = vn(m, y); - break; - case 'select': - m._wrapperState = { - wasMultiple: !!y.multiple - }, c = Kr({}, y, { - value: void 0 - }), sn('invalid', m), re(p, 'onChange'); - break; - case 'textarea': - be(m, y), c = ae(m, y), sn('invalid', m), re(p, 'onChange'); - break; - default: - c = y; - } - oe(f, c), h = void 0; - var S = f, - C = m, - b = c; - for (h in b) - if (b.hasOwnProperty(h)) { - var u = b[h]; - 'style' === h ? ne(C, u) : 'dangerouslySetInnerHTML' === h ? (u = u ? u.__html : void 0, null != u && ie(C, u)) : 'children' === h ? 'string' == typeof u ? ('textarea' !== S || '' !== u) && he(C, u) : 'number' == typeof u && he(C, '' + u) : 'suppressContentEditableWarning' !== h && 'suppressHydrationWarning' !== h && 'autoFocus' !== h && (ei.hasOwnProperty(h) ? null != u && re(p, h) : null != u && Mt(C, h, u, t)) - } - 'input' === f ? (Et(m), Nt(m, y, !1)) : 'textarea' === f ? (Et(m), de(m, y)) : 'option' === f ? null != y.value && m.setAttribute('value', '' + At(y.value)) : 'select' === f ? (c = m, c.multiple = !!y.multiple, m = y.value, null == m ? null != y.defaultValue && En(c, !!y.multiple, y.defaultValue, !0) : En(c, !!y.multiple, m, !1)) : 'function' == typeof c.onClick && (m.onclick = se), (d = te(e, d)) && No(o), o.stateNode = a - } - null !== o.ref && (o.effectTag |= 128) - } else null === o.stateNode ? s('166') : void 0; - break; - case 6: - a && null != o.stateNode ? pd(a, o, a.memoizedProps, d) : ('string' != typeof d && (null === o.stateNode ? s('166') : void 0), a = On(Ts.current), On(ks.current), so(o) ? (d = o, e = d.stateNode, a = d.memoizedProps, e[Ci] = d, (d = e.nodeValue !== a) && No(o)) : (e = o, d = (9 === a.nodeType ? a : a.ownerDocument).createTextNode(d), d[Ci] = o, e.stateNode = d)); - break; - case 11: - break; - case 13: - if (d = o.memoizedState, 0 != (64 & o.effectTag)) { - o.expirationTime = e, bd = o; - break a - } - d = null !== d, e = null !== a && null !== a.memoizedState, null !== a && !d && e && (a = a.child.sibling, null !== a && (c = o.firstEffect, null === c ? (o.firstEffect = o.lastEffect = a, a.nextEffect = null) : (o.firstEffect = a, a.nextEffect = c), a.effectTag = 8)), (d || e) && (o.effectTag |= 4); - break; - case 7: - break; - case 8: - break; - case 12: - break; - case 4: - zn(o), ld(o); - break; - case 10: - Eo(o); - break; - case 9: - break; - case 14: - break; - case 17: - Je(o.type) && J(o); - break; - case 18: - break; - default: - s('156'); - } - bd = null - } - if (o = n, 1 === vd || 1 !== o.childExpirationTime) { - for (d = 0, e = o.child; null !== e;) a = e.expirationTime, c = e.childExpirationTime, a > d && (d = a), c > d && (d = c), e = e.sibling; - o.childExpirationTime = d - } - if (null !== bd) return bd; - null !== r && 0 == (1024 & r.effectTag) && (null === r.firstEffect && (r.firstEffect = n.firstEffect), null !== n.lastEffect && (null !== r.lastEffect && (r.lastEffect.nextEffect = n.firstEffect), r.lastEffect = n.lastEffect), 1 < n.effectTag && (null === r.lastEffect ? r.firstEffect = n : r.lastEffect.nextEffect = n, r.lastEffect = n)) - } else { - if (n = Xo(n, vd), null !== n) return n.effectTag &= 1023, n; - null !== r && (r.firstEffect = r.lastEffect = null, r.effectTag |= 1024) - } - if (null !== i) return i; - if (null !== r) n = r; - else break + setCommitMessage(e, t) { + return this.appStore._setCommitMessage(e, t) + } + removeAccount(e) { + return this.appStore._removeAccount(e) + } + setAppMenuState(e) { + return this.appStore._setAppMenuState(e) + } + executeMenuItem(e) { + return function (e) { + r.ipcRenderer.send("execute-menu-item", { + id: e.id + }) + }(e), Promise.resolve() + } + setAccessKeyHighlightState(e) { + return this.appStore._setAccessKeyHighlightState(e) } - return null - } - - function rr(e) { - var t = bo(e.alternate, e, vd); - return e.memoizedProps = e.pendingProps, null === t && (t = or(e)), gd.current = null, t - } - - function ir(n, o) { - Cd ? s('243') : void 0, tr(), Cd = !0; - var r = fd.current; - fd.current = Ks; - var i = n.nextExpirationTimeToWorkOn; - (i !== vd || n !== T || null === bd) && (Qo(), T = n, vd = i, bd = We(T.current, null, vd), n.pendingCommitExpirationTime = 0); - var a = !1; - do { - try { - if (o) - for (; null !== bd && !vr();) bd = rr(bd); - else - for (; null !== bd;) bd = rr(bd) - } catch (o) { - if (nd = td = ed = null, jn(), null === bd) a = !0, Rr(o); - else { - null === bd ? s('271') : void 0; - var e = bd, - d = e.return; - if (null === d) a = !0, Rr(o); - else { - a: { - var c = n, - h = d, - l = e, - f = o; - if (d = vd, l.effectTag |= 1024, l.firstEffect = l.lastEffect = null, null !== f && 'object' == typeof f && 'function' == typeof f.then) { - var u = f; - f = h; - var p = -1, - t = -1; - do { - if (13 === f.tag) { - var g = f.alternate; - if (null !== g && (g = g.memoizedState, null !== g)) { - t = 10 * (1073741822 - g.timedOutAt); - break - } - g = f.pendingProps.maxDuration, 'number' == typeof g && (0 >= g ? p = 0 : (-1 === p || g < p) && (p = g)) - } - f = f.return - } while (null !== f); - f = h; - do { - if ((g = 13 === f.tag) && (g = void 0 !== f.memoizedProps.fallback && null === f.memoizedState), g) { - if (h = f.updateQueue, null === h ? (h = new Set, h.add(u), f.updateQueue = h) : h.add(u), 0 == (1 & f.mode)) { - f.effectTag |= 64, l.effectTag &= -1957, 1 === l.tag && (null === l.alternate ? l.tag = 17 : (d = Ro(1073741823), d.tag = id, Po(l, d))), l.expirationTime = 1073741823; - break a - } - l = c, h = d; - var y = l.pingCache; - null === y ? (y = l.pingCache = new hd, g = new Set, y.set(u, g)) : (g = y.get(u), void 0 === g && (g = new Set, y.set(u, g))), g.has(h) || (g.add(h), l = dr.bind(null, l, u, h), u.then(l, l)), -1 === p ? c = 1073741823 : (-1 === t && (t = 10 * (1073741822 - Rn(c, d)) - 5E3), c = t + p), 0 <= c && U < c && (U = c), f.effectTag |= 2048, f.expirationTime = d; - break a - } - f = f.return - } while (null !== f); - f = Error((Tt(l.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display.' + _t(l)) - } - Ed = !0, - f = Bo(f, l), - c = h;do { - switch (c.tag) { - case 3: - c.effectTag |= 2048, c.expirationTime = d, d = qo(c, f, d), Do(c, d); - break a; - case 1: - if (p = f, t = c.type, l = c.stateNode, 0 == (64 & c.effectTag) && ('function' == typeof t.getDerivedStateFromError || null !== l && 'function' == typeof l.componentDidCatch && (null === Rd || !Rd.has(l)))) { - c.effectTag |= 2048, c.expirationTime = d, d = Yo(c, p, d), Do(c, d); - break a - } - } - c = c.return - } while (null !== c) - } - bd = or(e); - continue - } - } - } - break - } while (1); - if (Cd = !1, fd.current = r, nd = td = ed = null, jn(), a) T = null, n.finishedWork = null; - else if (null !== bd) n.finishedWork = null; - else { - if (r = n.current.alternate, null === r ? s('281') : void 0, T = null, Ed) { - if (a = n.latestPendingTime, e = n.latestSuspendedTime, d = n.latestPingedTime, 0 !== a && a < i || 0 !== e && e < i || 0 !== d && d < i) return _n(n, i), void fr(n, r, i, n.expirationTime, -1); - if (!n.didError && o) return n.didError = !0, i = n.nextExpirationTimeToWorkOn = i, o = n.expirationTime = 1073741823, void fr(n, r, i, o, -1) - } - o && -1 !== U ? (_n(n, i), o = 10 * (1073741822 - Rn(n, i)), o < U && (U = o), o = 10 * (1073741822 - Sr()), o = U - o, fr(n, r, i, n.expirationTime, 0 > o ? 0 : o)) : (n.pendingCommitExpirationTime = i, n.finishedWork = r) + mergeBranch(e, t, n) { + return this.appStore._mergeBranch(e, t, n) } - } - - function ar(e, t) { - for (var n = e.return; null !== n;) { - switch (n.tag) { - case 1: - var o = n.stateNode; - if ('function' == typeof n.type.getDerivedStateFromError || 'function' == typeof o.componentDidCatch && (null === Rd || !Rd.has(o))) return e = Bo(t, e), e = Yo(n, e, 1073741823), Po(n, e), void pr(n, 1073741823); - break; - case 3: - return e = Bo(t, e), e = qo(n, e, 1073741823), Po(n, e), void pr(n, 1073741823); - } - n = n.return + setConflictsResolved(e) { + return this.appStore._setConflictsResolved(e) } - 3 === e.tag && (n = Bo(t, e), n = qo(e, n, 1073741823), Po(e, n), pr(e, 1073741823)) - } - - function sr(e, t) { - var o = n.unstable_getCurrentPriorityLevel(), - r; - return 0 == (1 & t.mode) ? r = 1073741823 : Cd && !V ? r = vd : (o === n.unstable_ImmediatePriority ? r = 1073741823 : o === n.unstable_UserBlockingPriority ? r = 1073741822 - 10 * ((0 | (1073741822 - e + 15) / 10) + 1) : o === n.unstable_NormalPriority ? r = 1073741822 - 25 * ((0 | (1073741822 - e + 500) / 25) + 1) : o === n.unstable_LowPriority || o === n.unstable_IdlePriority ? r = 1 : s('313'), null !== T && r === vd && --r), o === n.unstable_UserBlockingPriority && (0 === Z || r < Z) && (Z = r), r - } - - function dr(e, t, n) { - var o = e.pingCache; - null !== o && o.delete(t), null !== T && vd === n ? T = null : (t = e.earliestSuspendedTime, o = e.latestSuspendedTime, 0 !== t && n <= t && n >= o) && (e.didError = !1, t = e.latestPingedTime, (0 === t || t > n) && (e.latestPingedTime = n), xn(n, e), n = e.expirationTime, 0 !== n && Cr(e, n)) - } - - function lr(e, t) { - var n = e.stateNode; - null !== n && n.delete(t), t = Sr(), t = sr(t, e), e = cr(e, t), null !== e && (kn(e, t), t = e.expirationTime, 0 !== t && Cr(e, t)) - } - - function cr(t, n) { - t.expirationTime < n && (t.expirationTime = n); - var o = t.alternate; - null !== o && o.expirationTime < n && (o.expirationTime = n); - var r = t.return, - i = null; - if (null === r && 3 === t.tag) i = t.stateNode; - else - for (; null !== r;) { - if (o = r.alternate, r.childExpirationTime < n && (r.childExpirationTime = n), null !== o && o.childExpirationTime < n && (o.childExpirationTime = n), null === r.return && 3 === r.tag) { - i = r.stateNode; - break - } - r = r.return - } - return i - } - - function pr(e, t) { - e = cr(e, t), null !== e && (!Cd && 0 !== vd && t > vd && Qo(), kn(e, t), Cd && !V && T === e || Cr(e, e.expirationTime), ji > vi && (ji = 0, s('185'))) - } - - function ur(t, o, r, i, a) { - return n.unstable_runWithPriority(n.unstable_ImmediatePriority, function () { - return t(o, r, i, a) - }) - } - - function mr() { - ti = 1073741822 - (0 | (n.unstable_now() - si) / 10) - } - - function hr(e, t) { - if (0 !== Y) { - if (t < Y) return; - null !== mi && n.unstable_cancelCallback(mi) + initializeRebaseProgress(e, t) { + return this.appStore._initializeRebaseProgress(e, t) } - Y = t, e = n.unstable_now() - si, mi = n.unstable_scheduleCallback(Er, { - timeout: 10 * (1073741822 - t) - e - }) - } - - function fr(t, n, o, r, i) { - t.expirationTime = r, 0 !== i || vr() ? 0 < i && (t.timeoutHandle = ve(gr.bind(null, t, n, o), i)) : (t.pendingCommitExpirationTime = o, t.finishedWork = n) - } - - function gr(e, t, n) { - e.pendingCommitExpirationTime = n, e.finishedWork = t, mr(), ui = ti, kr(e, n) - } - - function yr(e, t) { - e.expirationTime = t, e.finishedWork = null - } - - function Sr() { - return ni ? ui : (br(), (0 === oi || 1 === oi) && (mr(), ui = ti), ui) - } - - function Cr(e, t) { - null === e.nextScheduledRoot ? (e.expirationTime = t, null === li ? (Pd = li = e, e.nextScheduledRoot = e) : (li = li.nextScheduledRoot = e, li.nextScheduledRoot = Pd)) : t > e.expirationTime && (e.expirationTime = t), ni || (qi ? X && (W = e, oi = 1073741823, Tr(e, 1073741823, !1)) : 1073741823 === t ? wr(1073741823, !1) : hr(e, t)) - } - - function br() { - var t = 0, - n = null; - if (null !== li) - for (var o = li, r = Pd, i; null !== r;) - if (i = r.expirationTime, 0 === i) { - if (null === o || null === li ? s('244') : void 0, r === r.nextScheduledRoot) { - Pd = li = r.nextScheduledRoot = null; - break - } else if (r === Pd) Pd = i = r.nextScheduledRoot, li.nextScheduledRoot = i, r.nextScheduledRoot = null; - else if (r === li) { - li = o, li.nextScheduledRoot = Pd, r.nextScheduledRoot = null; - break - } else o.nextScheduledRoot = r.nextScheduledRoot, r.nextScheduledRoot = null; - r = o.nextScheduledRoot - } else { - if (i > t && (t = i, n = r), r === li) break; - if (1073741823 == t) break; - o = r, r = r.nextScheduledRoot - } W = n, oi = t - } - - function vr() { - return !!wi || !!n.unstable_shouldYield() && (wi = !0) - } - - function Er() { - try { - if (!vr() && null !== Pd) { - mr(); - var e = Pd; - do { - var t = e.expirationTime; - 0 !== t && ti <= t && (e.nextExpirationTimeToWorkOn = ti), e = e.nextScheduledRoot - } while (e !== Pd) - } - wr(0, !0) - } finally { - wi = !1 + setRebaseProgressFromState(e) { + return this.appStore._setRebaseProgressFromState(e) } - } - - function wr(e, t) { - if (br(), t) - for (mr(), ui = ti; null !== W && 0 !== oi && e <= oi && !(wi && ti > oi);) Tr(W, oi, ti > oi), br(), mr(), ui = ti; - else - for (; null !== W && 0 !== oi && e <= oi;) Tr(W, oi, !1), br(); - if (t && (Y = 0, mi = null), 0 !== oi && hr(W, oi), ji = 0, ii = null, null !== Dd) - for (e = Dd, Dd = null, t = 0; t < e.length; t++) { - var n = e[t]; - try { - n._onComplete() - } catch (e) { - gi || (gi = !0, pi = e) - } - } - if (gi) throw e = pi, pi = null, gi = !1, e - } - - function kr(e, t) { - ni ? s('253') : void 0, W = e, oi = t, Tr(e, t, !1), wr(1073741823, !1) - } - - function Tr(e, t, n) { - if (ni ? s('245') : void 0, ni = !0, n) { - var o = e.finishedWork; - null === o ? (e.finishedWork = null, o = e.timeoutHandle, -1 !== o && (e.timeoutHandle = -1, ye(o)), ir(e, n), o = e.finishedWork, null !== o && (vr() ? e.finishedWork = o : _r(e, o, t))) : _r(e, o, t) - } else o = e.finishedWork, null === o ? (e.finishedWork = null, o = e.timeoutHandle, -1 !== o && (e.timeoutHandle = -1, ye(o)), ir(e, n), o = e.finishedWork, null !== o && _r(e, o, t)) : _r(e, o, t); - ni = !1 - } - - function _r(e, t, o) { - var r = e.firstBatch; - return null !== r && r._expirationTime >= o && (null == Dd ? Dd = [r] : Dd.push(r), r._defer) ? (e.finishedWork = t, void(e.expirationTime = 0)) : void(e.finishedWork = null, e === ii ? ji++ : (ii = e, ji = 0), n.unstable_runWithPriority(n.unstable_ImmediatePriority, function () { - nr(e, t) - })) - } - - function Rr(e) { - null === W ? s('246') : void 0, W.expirationTime = 0, gi || (gi = !0, pi = e) - } - - function xr(e, t) { - var n = qi; - qi = !0; - try { - return e(t) - } finally { - (qi = n) || ni || wr(1073741823, !1) + setRebaseFlowStep(e, t) { + return this.appStore._setRebaseFlowStep(e, t) } - } - - function Pr(e, t) { - if (qi && !X) { - X = !0; - try { - return e(t) - } finally { - X = !1 - } + endRebaseFlow(e) { + return this.appStore._endRebaseFlow(e) } - return e(t) - } - - function Dr(e, t, o) { - qi || ni || 0 === Z || (wr(Z, !1), Z = 0); - var r = qi; - qi = !0; - try { - return n.unstable_runWithPriority(n.unstable_UserBlockingPriority, function () { - return e(t, o) - }) - } finally { - (qi = r) || ni || wr(1073741823, !1) + async rebase(e, t, n) { + const r = ob(this.repositoryStateManager.get(e).branchesState.tip); + log.info(`[rebase] starting rebase for ${n.name} at ${r}`), log.info("[rebase] to restore the previous state if this completed rebase is unsatisfactory:"), log.info("[rebase] - git checkout " + n.name), log.info(`[rebase] - git reset ${r} --hard`); + const i = await this.appStore._rebase(e, t, n); + await this.appStore._loadStatus(e); + const o = this.repositoryStateManager.get(e), + { + tip: s + } = o.branchesState, + a = ob(s); + if (log.info(`[rebase] completed rebase - got ${i} and on tip ${a} - kind ${s.kind}`), i === vl.ConflictsEncountered) { + const { + conflictState: r + } = o.changesState; + if (null === r) return void log.warn("[rebase] conflict state after rebase is null - unable to continue"); + if (Y(r)) return void log.warn("[rebase] conflict state after rebase is merge conflicts - unable to continue"); + const i = Object.assign(Object.assign({}, r), { + baseBranch: t.name, + targetBranch: n.name + }); + this.switchToConflicts(e, i) + } else if (i === vl.CompletedWithoutError) { + if (s.kind !== Qi.Valid) return void log.warn(`[rebase] tip after completing rebase is ${s.kind} but this should be a valid tip if the rebase completed without error`); + this.statsStore.recordRebaseSuccessWithoutConflicts(), await this.completeRebase(e, { + type: lu.SuccessfulRebase, + targetBranch: n.name, + baseBranch: t.name + }, s, r) + } else i === vl.Error && this.endRebaseFlow(e) } - } - - function Mr(t, n, o, r, i) { - var e = n.current; - a: if (o) { - o = o._reactInternalFiber; - b: { - 2 === Jt(o) && 1 === o.tag ? void 0 : s('170'); - var d = o;do { - switch (d.tag) { - case 3: - d = d.stateNode.context; - break b; - case 1: - if (Je(d.type)) { - d = d.stateNode.__reactInternalMemoizedMergedChildContext; - break b - } - } - d = d.return - } while (null !== d);s('171'), - d = void 0 - } - if (1 === o.tag) { - var l = o.type; - if (Je(l)) { - o = Me(o, l, d); - break a - } + async abortRebase(e) { + await this.appStore._abortRebase(e), await this.appStore._loadStatus(e) + } + async continueRebase(e, t, n) { + const r = this.repositoryStateManager.get(e), + { + targetBranch: i, + baseBranch: o, + originalBranchTip: s, + manualResolutions: a + } = n, + l = ob(r.branchesState.tip); + log.info("[continueRebase] continuing rebase for " + l); + const c = await this.appStore._continueRebase(e, t, a); + await this.appStore._loadStatus(e); + const u = this.repositoryStateManager.get(e), + { + tip: h + } = u.branchesState, + p = ob(h); + if (log.info(`[continueRebase] completed rebase - got ${c} and on tip ${p} - kind ${h.kind}`), c === vl.ConflictsEncountered) { + const { + conflictState: t + } = u.changesState; + if (null === t) return void log.warn("[continueRebase] conflict state after rebase is null - unable to continue"); + if (Y(t)) return void log.warn("[continueRebase] conflict state after rebase is merge conflicts - unable to continue"); + const n = Object.assign(Object.assign({}, t), { + baseBranch: o, + targetBranch: i + }); + this.switchToConflicts(e, n) + } else if (c === vl.CompletedWithoutError) { + if (h.kind !== Qi.Valid) return void log.warn(`[continueRebase] tip after completing rebase is ${h.kind} but this should be a valid tip if the rebase completed without error`); + this.statsStore.recordRebaseSuccessAfterConflicts(), await this.completeRebase(e, { + type: lu.SuccessfulRebase, + targetBranch: i, + baseBranch: o + }, h, s) } - o = d - } else o = Ge; - return null === n.context ? n.context = o : n.pendingContext = o, n = i, i = Ro(r), i.payload = { - element: t - }, n = void 0 === n ? null : n, null !== n && (i.callback = n), tr(), Po(e, i), pr(e, r), r - } - - function Ar(t, n, o, r) { - var i = n.current, - e = Sr(); - return i = sr(e, i), Mr(t, n, o, i, r) - } - - function Ir(e) { - if (e = e.current, !e.child) return null; - switch (e.child.tag) { - case 5: - return e.child.stateNode; - default: - return e.child.stateNode; } - } - - function Lr(e, t, n) { - var o = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; - return { - $$typeof: la, - key: null == o ? null : '' + o, - children: e, - containerInfo: t, - implementation: n + async completeRebase(e, t, n, r) { + this.closePopup(), this.setBanner(t), n.kind === Qi.Valid && this.addRebasedBranchToForcePushList(e, n, r), this.endRebaseFlow(e), await this.refreshRepository(e) } - } - - function Fr(e) { - var t = 1073741822 - 25 * ((0 | (1073741822 - Sr() + 500) / 25) + 1); - t >= yd && (t = yd - 1), this._expirationTime = yd = t, this._root = e, this._callbacks = this._next = null, this._hasChildren = this._didComplete = !1, this._children = null, this._defer = !0 - } - - function Br() { - this._callbacks = null, this._didCommit = !1, this._onCommit = this._onCommit.bind(this) - } - - function Nr(e, t, n) { - t = Ue(3, null, null, t ? 3 : 0), e = { - current: t, - containerInfo: e, - pendingChildren: null, - pingCache: null, - earliestPendingTime: 0, - latestPendingTime: 0, - earliestSuspendedTime: 0, - latestSuspendedTime: 0, - latestPingedTime: 0, - didError: !1, - pendingCommitExpirationTime: 0, - finishedWork: null, - timeoutHandle: -1, - context: null, - pendingContext: null, - hydrate: n, - nextExpirationTimeToWorkOn: 0, - expirationTime: 0, - firstBatch: null, - nextScheduledRoot: null - }, this._internalRoot = t.stateNode = e - } - - function Or(e) { - return e && (1 === e.nodeType || 9 === e.nodeType || 11 === e.nodeType || 8 === e.nodeType && ' react-mount-point-unstable ' === e.nodeValue) - } - - function Hr(e, t) { - if (t || (t = e ? 9 === e.nodeType ? e.documentElement : e.firstChild : null, t = t && 1 === t.nodeType && t.hasAttribute('data-reactroot')), !t) - for (var n; n = e.lastChild;) e.removeChild(n); - return new Nr(e, !1, t) - } - - function zr(t, n, o, r, i) { - var s = o._reactRootContainer; - if (s) { - if ('function' == typeof i) { - var d = i; - i = function () { - var e = Ir(s._internalRoot); - d.call(e) - } - } - null == t ? s.render(n, i) : s.legacy_renderSubtreeIntoContainer(t, n, i) - } else { - if (s = o._reactRootContainer = Hr(o, r), 'function' == typeof i) { - var l = i; - i = function () { - var e = Ir(s._internalRoot); - l.call(e) - } - } - Pr(function () { - null == t ? s.render(n, i) : s.legacy_renderSubtreeIntoContainer(t, n, i) + async abortMerge(e) { + await this.appStore._abortMerge(e), await this.appStore._loadStatus(e) + } + async finishConflictedMerge(e, t, n) { + const r = this.repositoryStateManager.get(e), + { + conflictState: i + } = r.changesState; + if (null === i) return void log.error("Conflict state missing during finishConflictedMerge. No merge will be committed."); + void 0 !== await this.appStore._finishConflictedMerge(e, t, i.manualResolutions) && this.setBanner(n) + } + recordLaunchStats(e) { + return this.appStore._recordLaunchStats(e) + } + reportStats() { + return this.appStore._reportStats() + } + setRemoteURL(e, t, n) { + return this.appStore._setRemoteURL(e, t, n) + } + openInBrowser(e) { + return this.appStore._openInBrowser(e) + } + appendIgnoreRule(e, t) { + return this.appStore._appendIgnoreRule(e, t) + } + async openShell(e, t = !1) { + await async function () { + return void 0 !== await oc() + }() || t ? this.appStore._openShell(e) : this.appStore._showPopup({ + type: Zi.InstallGit, + path: e }) } - return Ir(s._internalRoot) - } - - function Ur(e, t) { - var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null; - return Or(t) ? void 0 : s('200'), Lr(e, t, null, n) - } - var Wr = String.fromCharCode, - Vr = Math.min, - Gr = o(0), - Kr = o(183), - n = o(788); - Gr ? void 0 : s('227'); - var r = !1, - jr = null, - qr = !1, - Yr = null, - Xr = { - onError: function (e) { - r = !0, jr = e - } - }, - Qr = null, - $r = {}, - Zr = [], - Jr = {}, - ei = {}, - ai = {}, - di = null, - ci = null, - hi = null, - fi = null, - yi = { - injectEventPluginOrder: function (e) { - Qr ? s('101') : void 0, Qr = Array.prototype.slice.call(e), p() - }, - injectEventPluginsByName: function (e) { - var t = !1, - n; - for (n in e) - if (e.hasOwnProperty(n)) { - var o = e[n]; - $r.hasOwnProperty(n) && $r[n] === o || ($r[n] ? s('102', n) : void 0, $r[n] = o, t = !0) - } t && p() - } - }, - Si = Math.random().toString(36).slice(2), - Ci = '__reactInternalInstance$' + Si, - bi = '__reactEventHandlers$' + Si, - ki = 'undefined' != typeof window && window.document && window.document.createElement, - _i = { - animationend: $('Animation', 'AnimationEnd'), - animationiteration: $('Animation', 'AnimationIteration'), - animationstart: $('Animation', 'AnimationStart'), - transitionend: $('Transition', 'TransitionEnd') - }, - Ri = {}, - xi = {}; - ki && (xi = document.createElement('div').style, 'AnimationEvent' in window || (delete _i.animationend.animation, delete _i.animationiteration.animation, delete _i.animationstart.animation), 'TransitionEvent' in window || delete _i.transitionend.transition); - var Pi = _e('animationend'), - Di = _e('animationiteration'), - Mi = _e('animationstart'), - Ai = _e('transitionend'), - Li = ['abort', 'canplay', 'canplaythrough', 'durationchange', 'emptied', 'encrypted', 'ended', 'error', 'loadeddata', 'loadedmetadata', 'loadstart', 'pause', 'play', 'playing', 'progress', 'ratechange', 'seeked', 'seeking', 'stalled', 'suspend', 'timeupdate', 'volumechange', 'waiting'], - Fi = null, - Bi = null, - Ni = null; - Kr(ot.prototype, { - preventDefault: function () { - this.defaultPrevented = !0; - var e = this.nativeEvent; - e && (e.preventDefault ? e.preventDefault() : 'unknown' != typeof e.returnValue && (e.returnValue = !1), this.isDefaultPrevented = tt) - }, - stopPropagation: function () { - var e = this.nativeEvent; - e && (e.stopPropagation ? e.stopPropagation() : 'unknown' != typeof e.cancelBubble && (e.cancelBubble = !0), this.isPropagationStopped = tt) - }, - persist: function () { - this.isPersistent = tt - }, - isPersistent: nt, - destructor: function () { - var e = this.constructor.Interface, - t; - for (t in e) this[t] = null; - this.nativeEvent = this._targetInst = this.dispatchConfig = null, this.isPropagationStopped = this.isDefaultPrevented = nt, this._dispatchInstances = this._dispatchListeners = null + async openInExternalEditor(e) { + return this.appStore._openInExternalEditor(e) } - }), ot.Interface = { - type: null, - target: null, - currentTarget: function () { - return null - }, - eventPhase: null, - bubbles: null, - cancelable: null, - timeStamp: function (e) { - return e.timeStamp || Date.now() - }, - defaultPrevented: null, - isTrusted: null - }, ot.extend = function (t) { - function n() {} - - function o() { - return r.apply(this, arguments) + saveGitIgnore(e, t) { + return this.appStore._saveGitIgnore(e, t) } - var r = this; - n.prototype = r.prototype; - var i = new n; - return Kr(i, o.prototype), o.prototype = i, o.prototype.constructor = o, o.Interface = Kr({}, r.Interface, t), o.extend = r.extend, it(o), o - }, it(ot); - var Oi = ot.extend({ - data: null - }), - Hi = ot.extend({ - data: null - }), - zi = [9, 13, 27, 32], - Ui = ki && 'CompositionEvent' in window, - Ki = null; - ki && 'documentMode' in document && (Ki = document.documentMode); - var Yi = ki && 'TextEvent' in window && !Ki, - Qi = ki && (!Ui || Ki && 8 < Ki && 11 >= Ki), - $i = ' ', - Zi = { - beforeInput: { - phasedRegistrationNames: { - bubbled: 'onBeforeInput', - captured: 'onBeforeInputCapture' - }, - dependencies: ['compositionend', 'keypress', 'textInput', 'paste'] - }, - compositionEnd: { - phasedRegistrationNames: { - bubbled: 'onCompositionEnd', - captured: 'onCompositionEndCapture' - }, - dependencies: ['blur', 'compositionend', 'keydown', 'keypress', 'keyup', 'mousedown'] - }, - compositionStart: { - phasedRegistrationNames: { - bubbled: 'onCompositionStart', - captured: 'onCompositionStartCapture' - }, - dependencies: ['blur', 'compositionstart', 'keydown', 'keypress', 'keyup', 'mousedown'] - }, - compositionUpdate: { - phasedRegistrationNames: { - bubbled: 'onCompositionUpdate', - captured: 'onCompositionUpdateCapture' - }, - dependencies: ['blur', 'compositionupdate', 'keydown', 'keypress', 'keyup', 'mousedown'] - } - }, - Ji = !1, - ea = !1, - ta = null, - na = null, - oa = null, - ra = !1, - ia = { - color: !0, - date: !0, - datetime: !0, - "datetime-local": !0, - email: !0, - month: !0, - number: !0, - password: !0, - range: !0, - search: !0, - tel: !0, - text: !0, - time: !0, - url: !0, - week: !0 - }, - aa = Gr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - aa.hasOwnProperty('ReactCurrentDispatcher') || (aa.ReactCurrentDispatcher = { - current: null - }); - var sa = /^(.*)[\\\/]/, - da = 'function' == typeof Symbol && Symbol.for, - z = da ? Symbol.for('react.element') : 60103, - la = da ? Symbol.for('react.portal') : 60106, - ca = da ? Symbol.for('react.fragment') : 60107, - pa = da ? Symbol.for('react.strict_mode') : 60108, - ua = da ? Symbol.for('react.profiler') : 60114, - ma = da ? Symbol.for('react.provider') : 60109, - ha = da ? Symbol.for('react.context') : 60110, - fa = da ? Symbol.for('react.concurrent_mode') : 60111, - ga = da ? Symbol.for('react.forward_ref') : 60112, - ya = da ? Symbol.for('react.suspense') : 60113, - Sa = da ? Symbol.for('react.memo') : 60115, - Ca = da ? Symbol.for('react.lazy') : 60116, - ba = 'function' == typeof Symbol && Symbol.iterator, - va = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, - Ea = Object.prototype.hasOwnProperty, - wa = {}, - ka = {}, - Ta = {}; - ['children', 'dangerouslySetInnerHTML', 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (e) { - Ta[e] = new Dt(e, 0, !1, e, null) - }), [ - ['acceptCharset', 'accept-charset'], - ['className', 'class'], - ['htmlFor', 'for'], - ['httpEquiv', 'http-equiv'] - ].forEach(function (e) { - var t = e[0]; - Ta[t] = new Dt(t, 1, !1, e[1], null) - }), ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (e) { - Ta[e] = new Dt(e, 2, !1, e.toLowerCase(), null) - }), ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (e) { - Ta[e] = new Dt(e, 2, !1, e, null) - }), ['allowFullScreen', 'async', 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', 'itemScope'].forEach(function (e) { - Ta[e] = new Dt(e, 3, !1, e.toLowerCase(), null) - }), ['checked', 'multiple', 'muted', 'selected'].forEach(function (e) { - Ta[e] = new Dt(e, 3, !0, e, null) - }), ['capture', 'download'].forEach(function (e) { - Ta[e] = new Dt(e, 4, !1, e, null) - }), ['cols', 'rows', 'size', 'span'].forEach(function (e) { - Ta[e] = new Dt(e, 6, !1, e, null) - }), ['rowSpan', 'start'].forEach(function (e) { - Ta[e] = new Dt(e, 5, !1, e.toLowerCase(), null) - }); - var D = /[\-:]([a-z])/g; - ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (e) { - var t = e.replace(D, C); - Ta[t] = new Dt(t, 1, !1, e, null) - }), ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (e) { - var t = e.replace(D, C); - Ta[t] = new Dt(t, 1, !1, e, 'http://www.w3.org/1999/xlink') - }), ['xml:base', 'xml:lang', 'xml:space'].forEach(function (e) { - var t = e.replace(D, C); - Ta[t] = new Dt(t, 1, !1, e, 'http://www.w3.org/XML/1998/namespace') - }), ['tabIndex', 'crossOrigin'].forEach(function (e) { - Ta[e] = new Dt(e, 1, !1, e.toLowerCase(), null) - }); - var _a = { - change: { - phasedRegistrationNames: { - bubbled: 'onChange', - captured: 'onChangeCapture' - }, - dependencies: ['blur', 'change', 'click', 'focus', 'input', 'keydown', 'keyup', 'selectionchange'] - } - }, - xa = null, - Pa = null, - Da = !1; - ki && (Da = Ct('input') && (!document.documentMode || 9 < document.documentMode)); - var Ma = { - eventTypes: _a, - _isInputEventSupported: Da, - extractEvents: function (t, n, o, r) { - var i = n ? R(n) : window, - e = i.nodeName && i.nodeName.toLowerCase(), - a, s; - return 'select' === e || 'input' === e && 'file' === i.type ? a = Wt : yt(i) ? Da ? a = Yt : (a = jt, s = Kt) : (e = i.nodeName) && 'input' === e.toLowerCase() && ('checkbox' === i.type || 'radio' === i.type) && (a = qt), a && (a = a(t, n)) ? Ht(a, o, r) : void(s && s(t, i, n), 'blur' === t && (t = i._wrapperState) && t.controlled && 'number' === i.type && Ot(i, 'number', i.value)) - } - }, - Aa = ot.extend({ - view: null, - detail: null - }), - Ia = { - Alt: 'altKey', - Control: 'ctrlKey', - Meta: 'metaKey', - Shift: 'shiftKey' - }, - La = 0, - Fa = 0, - Ba = !1, - Na = !1, - Oa = Aa.extend({ - screenX: null, - screenY: null, - clientX: null, - clientY: null, - pageX: null, - pageY: null, - ctrlKey: null, - shiftKey: null, - altKey: null, - metaKey: null, - getModifierState: Qt, - button: null, - buttons: null, - relatedTarget: function (e) { - return e.relatedTarget || (e.fromElement === e.srcElement ? e.toElement : e.fromElement) - }, - movementX: function (e) { - if ('movementX' in e) return e.movementX; - var t = La; - return La = e.screenX, Ba ? 'mousemove' === e.type ? e.screenX - t : 0 : (Ba = !0, 0) - }, - movementY: function (e) { - if ('movementY' in e) return e.movementY; - var t = Fa; - return Fa = e.screenY, Na ? 'mousemove' === e.type ? e.screenY - t : 0 : (Na = !0, 0) - } - }), - za = Oa.extend({ - pointerId: null, - width: null, - height: null, - pressure: null, - tangentialPressure: null, - tiltX: null, - tiltY: null, - twist: null, - pointerType: null, - isPrimary: null - }), - Ua = { - mouseEnter: { - registrationName: 'onMouseEnter', - dependencies: ['mouseout', 'mouseover'] - }, - mouseLeave: { - registrationName: 'onMouseLeave', - dependencies: ['mouseout', 'mouseover'] - }, - pointerEnter: { - registrationName: 'onPointerEnter', - dependencies: ['pointerout', 'pointerover'] - }, - pointerLeave: { - registrationName: 'onPointerLeave', - dependencies: ['pointerout', 'pointerover'] - } - }, - Wa = Object.prototype.hasOwnProperty, - Va = ot.extend({ - animationName: null, - elapsedTime: null, - pseudoElement: null - }), - Ga = ot.extend({ - clipboardData: function (e) { - return 'clipboardData' in e ? e.clipboardData : window.clipboardData - } - }), - Ka = Aa.extend({ - relatedTarget: null - }), - ja = { - Esc: 'Escape', - Spacebar: ' ', - Left: 'ArrowLeft', - Up: 'ArrowUp', - Right: 'ArrowRight', - Down: 'ArrowDown', - Del: 'Delete', - Win: 'OS', - Menu: 'ContextMenu', - Apps: 'ContextMenu', - Scroll: 'ScrollLock', - MozPrintableKey: 'Unidentified' - }, - qa = { - 8: 'Backspace', - 9: 'Tab', - 12: 'Clear', - 13: 'Enter', - 16: 'Shift', - 17: 'Control', - 18: 'Alt', - 19: 'Pause', - 20: 'CapsLock', - 27: 'Escape', - 32: ' ', - 33: 'PageUp', - 34: 'PageDown', - 35: 'End', - 36: 'Home', - 37: 'ArrowLeft', - 38: 'ArrowUp', - 39: 'ArrowRight', - 40: 'ArrowDown', - 45: 'Insert', - 46: 'Delete', - 112: 'F1', - 113: 'F2', - 114: 'F3', - 115: 'F4', - 116: 'F5', - 117: 'F6', - 118: 'F7', - 119: 'F8', - 120: 'F9', - 121: 'F10', - 122: 'F11', - 123: 'F12', - 144: 'NumLock', - 145: 'ScrollLock', - 224: 'Meta' - }, - Ya = Aa.extend({ - key: function (e) { - if (e.key) { - var t = ja[e.key] || e.key; - if ('Unidentified' !== t) return t - } - return 'keypress' === e.type ? (e = on(e), 13 === e ? 'Enter' : Wr(e)) : 'keydown' === e.type || 'keyup' === e.type ? qa[e.keyCode] || 'Unidentified' : '' - }, - location: null, - ctrlKey: null, - shiftKey: null, - altKey: null, - metaKey: null, - repeat: null, - locale: null, - getModifierState: Qt, - charCode: function (e) { - return 'keypress' === e.type ? on(e) : 0 - }, - keyCode: function (e) { - return 'keydown' === e.type || 'keyup' === e.type ? e.keyCode : 0 - }, - which: function (e) { - return 'keypress' === e.type ? on(e) : 'keydown' === e.type || 'keyup' === e.type ? e.keyCode : 0 - } - }), - Xa = Oa.extend({ - dataTransfer: null - }), - Qa = Aa.extend({ - touches: null, - targetTouches: null, - changedTouches: null, - altKey: null, - metaKey: null, - ctrlKey: null, - shiftKey: null, - getModifierState: Qt - }), - $a = ot.extend({ - propertyName: null, - elapsedTime: null, - pseudoElement: null - }), - Za = Oa.extend({ - deltaX: function (e) { - return 'deltaX' in e ? e.deltaX : 'wheelDeltaX' in e ? -e.wheelDeltaX : 0 - }, - deltaY: function (e) { - return 'deltaY' in e ? e.deltaY : 'wheelDeltaY' in e ? -e.wheelDeltaY : 'wheelDelta' in e ? -e.wheelDelta : 0 - }, - deltaZ: null, - deltaMode: null - }), - Ja = {}, - es = {}; - [ - ['blur', 'blur'], - ['cancel', 'cancel'], - ['click', 'click'], - ['close', 'close'], - ['contextmenu', 'contextMenu'], - ['copy', 'copy'], - ['cut', 'cut'], - ['auxclick', 'auxClick'], - ['dblclick', 'doubleClick'], - ['dragend', 'dragEnd'], - ['dragstart', 'dragStart'], - ['drop', 'drop'], - ['focus', 'focus'], - ['input', 'input'], - ['invalid', 'invalid'], - ['keydown', 'keyDown'], - ['keypress', 'keyPress'], - ['keyup', 'keyUp'], - ['mousedown', 'mouseDown'], - ['mouseup', 'mouseUp'], - ['paste', 'paste'], - ['pause', 'pause'], - ['play', 'play'], - ['pointercancel', 'pointerCancel'], - ['pointerdown', 'pointerDown'], - ['pointerup', 'pointerUp'], - ['ratechange', 'rateChange'], - ['reset', 'reset'], - ['seeked', 'seeked'], - ['submit', 'submit'], - ['touchcancel', 'touchCancel'], - ['touchend', 'touchEnd'], - ['touchstart', 'touchStart'], - ['volumechange', 'volumeChange'] - ].forEach(function (e) { - rn(e, !0) - }), [ - ['abort', 'abort'], - [Pi, 'animationEnd'], - [Di, 'animationIteration'], - [Mi, 'animationStart'], - ['canplay', 'canPlay'], - ['canplaythrough', 'canPlayThrough'], - ['drag', 'drag'], - ['dragenter', 'dragEnter'], - ['dragexit', 'dragExit'], - ['dragleave', 'dragLeave'], - ['dragover', 'dragOver'], - ['durationchange', 'durationChange'], - ['emptied', 'emptied'], - ['encrypted', 'encrypted'], - ['ended', 'ended'], - ['error', 'error'], - ['gotpointercapture', 'gotPointerCapture'], - ['load', 'load'], - ['loadeddata', 'loadedData'], - ['loadedmetadata', 'loadedMetadata'], - ['loadstart', 'loadStart'], - ['lostpointercapture', 'lostPointerCapture'], - ['mousemove', 'mouseMove'], - ['mouseout', 'mouseOut'], - ['mouseover', 'mouseOver'], - ['playing', 'playing'], - ['pointermove', 'pointerMove'], - ['pointerout', 'pointerOut'], - ['pointerover', 'pointerOver'], - ['progress', 'progress'], - ['scroll', 'scroll'], - ['seeking', 'seeking'], - ['stalled', 'stalled'], - ['suspend', 'suspend'], - ['timeupdate', 'timeUpdate'], - ['toggle', 'toggle'], - ['touchmove', 'touchMove'], - [Ai, 'transitionEnd'], - ['waiting', 'waiting'], - ['wheel', 'wheel'] - ].forEach(function (e) { - rn(e, !1) - }); - var ts = { - eventTypes: Ja, - isInteractiveTopLevelEventType: function (e) { - return e = es[e], void 0 !== e && !0 === e.isInteractive - }, - extractEvents: function (t, n, o, r) { - var i = es[t]; - if (!i) return null; - switch (t) { - case 'keypress': - if (0 === on(o)) return null; - case 'keydown': - case 'keyup': - t = Ya; - break; - case 'blur': - case 'focus': - t = Ka; - break; - case 'click': - if (2 === o.button) return null; - case 'auxclick': - case 'dblclick': - case 'mousedown': - case 'mousemove': - case 'mouseup': - case 'mouseout': - case 'mouseover': - case 'contextmenu': - t = Oa; - break; - case 'drag': - case 'dragend': - case 'dragenter': - case 'dragexit': - case 'dragleave': - case 'dragover': - case 'dragstart': - case 'drop': - t = Xa; - break; - case 'touchcancel': - case 'touchend': - case 'touchmove': - case 'touchstart': - t = Qa; - break; - case Pi: - case Di: - case Mi: - t = Va; - break; - case Ai: - t = $a; - break; - case 'scroll': - t = Aa; - break; - case 'wheel': - t = Za; - break; - case 'copy': - case 'cut': - case 'paste': - t = Ga; - break; - case 'gotpointercapture': - case 'lostpointercapture': - case 'pointercancel': - case 'pointerdown': - case 'pointermove': - case 'pointerout': - case 'pointerover': - case 'pointerup': - t = za; - break; - default: - t = ot; - } - return n = t.getPooled(i, n, o, r), q(n), n - } - }, - ns = ts.isInteractiveTopLevelEventType, - os = [], - rs = !0, - is = {}, - as = 0, - ss = '_reactListenersID' + ('' + Math.random()).slice(2), - ds = ki && 'documentMode' in document && 11 >= document.documentMode, - ls = { - select: { - phasedRegistrationNames: { - bubbled: 'onSelect', - captured: 'onSelectCapture' - }, - dependencies: ['blur', 'contextmenu', 'dragend', 'focus', 'keydown', 'keyup', 'mousedown', 'mouseup', 'selectionchange'] - } - }, - cs = null, - ps = null, - us = null, - ms = !1; - yi.injectEventPluginOrder(['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']), di = b, ci = g, hi = R, yi.injectEventPluginsByName({ - SimpleEventPlugin: ts, - EnterLeaveEventPlugin: { - eventTypes: Ua, - extractEvents: function (t, n, o, r) { - var i = 'mouseover' === t || 'pointerover' === t, - a = 'mouseout' === t || 'pointerout' === t; - if (i && (o.relatedTarget || o.fromElement) || !a && !i) return null; - if (i = r.window === r ? r : (i = r.ownerDocument) ? i.defaultView || i.parentWindow : window, a ? (a = n, n = (n = o.relatedTarget || o.toElement) ? _(n) : null) : a = null, a === n) return null; - var s, d, c, l; - 'mouseout' === t || 'mouseover' === t ? (s = Oa, d = Ua.mouseLeave, c = Ua.mouseEnter, l = 'mouse') : ('pointerout' === t || 'pointerover' === t) && (s = za, d = Ua.pointerLeave, c = Ua.pointerEnter, l = 'pointer'); - var p = null == a ? i : R(a); - if (i = null == n ? i : R(n), t = s.getPooled(d, a, o, r), t.type = l + 'leave', t.target = p, t.relatedTarget = i, o = s.getPooled(c, n, o, r), o.type = l + 'enter', o.target = i, o.relatedTarget = p, r = n, a && r) a: { - for (n = a, i = r, l = 0, s = n; s; s = x(s)) l++; - for (s = 0, c = i; c; c = x(c)) s++; - for (; 0 < l - s;) n = x(n), - l--; - for (; 0 < s - l;) i = x(i), - s--; - for (; l--;) { - if (n === i || n === i.alternate) break a; - n = x(n), i = x(i) - } - n = null - } - else n = null; - for (i = n, n = []; a && a !== i && (l = a.alternate, null === l || l !== i);) n.push(a), a = x(a); - for (a = []; r && r !== i && (l = r.alternate, null === l || l !== i);) a.push(r), r = x(r); - for (r = 0; r < n.length; r++) B(n[r], 'bubbled', t); - for (r = a.length; 0 < r--;) B(a[r], 'captured', o); - return [t, o] - } - }, - ChangeEventPlugin: Ma, - SelectEventPlugin: { - eventTypes: ls, - extractEvents: function (t, n, o, r) { - var i = r.window === r ? r.document : 9 === r.nodeType ? r : r.ownerDocument, - a; - if (!(a = !i)) { - a: { - i = cn(i), - a = ai.onSelect; - for (var s = 0, d; s < a.length; s++) - if (d = a[s], !i.hasOwnProperty(d) || !i[d]) { - i = !1; - break a - } i = !0 - } - a = !i - } - if (a) return null; - switch (i = n ? R(n) : window, t) { - case 'focus': - (yt(i) || 'true' === i.contentEditable) && (cs = i, ps = n, us = null); - break; - case 'blur': - us = ps = cs = null; - break; - case 'mousedown': - ms = !0; - break; - case 'contextmenu': - case 'mouseup': - case 'dragend': - return ms = !1, Cn(o, r); - case 'selectionchange': - if (ds) break; - case 'keydown': - case 'keyup': - return Cn(o, r); - } - return null - } - }, - BeforeInputEventPlugin: { - eventTypes: Zi, - extractEvents: function (t, n, o, r) { - var i = void 0, - e = void 0; - if (Ui) b: 'compositionstart' === t ? i = Zi.compositionStart : 'compositionend' === t ? i = Zi.compositionEnd : 'compositionupdate' === t ? i = Zi.compositionUpdate : void 0, i = void 0; - else ea ? at(t, o) && (i = Zi.compositionEnd) : 'keydown' === t && 229 === o.keyCode && (i = Zi.compositionStart); - return i ? (Qi && 'ko' !== o.locale && (ea || i !== Zi.compositionStart ? i === Zi.compositionEnd && ea && (e = et()) : (Fi = r, Bi = 'value' in Fi ? Fi.value : Fi.textContent, ea = !0)), i = Oi.getPooled(i, n, o, r), e ? i.data = e : (e = st(o), null !== e && (i.data = e)), q(i), e = i) : e = null, (t = Yi ? dt(t, o) : lt(t, o)) ? (n = Hi.getPooled(Zi.beforeInput, n, o, r), n.data = t, q(n)) : n = null, null === e ? n : null === n ? e : [e, n] - } + setStatsOptOut(e, t) { + return this.appStore.setStatsOptOut(e, t) + } + markUsageStatsNoteSeen() { + this.appStore.markUsageStatsNoteSeen() + } + resetSignInState() { + return this.appStore._resetSignInState() + } + onDotComSupportsBasicAuthUpdated(e) { + return this.appStore._onDotComSupportsBasicAuthUpdated(e) + } + tryGetDotComSupportsBasicAuth() { + return this.appStore._tryGetDotComSupportsBasicAuth() + } + beginDotComSignIn() { + return this.appStore._beginDotComSignIn() + } + beginEnterpriseSignIn() { + return this.appStore._beginEnterpriseSignIn() + } + setSignInEndpoint(e) { + return this.appStore._setSignInEndpoint(e) + } + setSignInCredentials(e, t) { + return this.appStore._setSignInCredentials(e, t) + } + requestBrowserAuthentication() { + return this.appStore._requestBrowserAuthentication() + } + async requestBrowserAuthenticationToDotcom() { + return await this.beginDotComSignIn(), this.requestBrowserAuthentication() + } + setSignInOTP(e) { + return this.appStore._setSignInOTP(e) + } + async showDotComSignInDialog() { + await this.appStore._beginDotComSignIn(), await this.appStore._showPopup({ + type: Zi.SignIn + }) } - }); - var hs = { - html: 'http://www.w3.org/1999/xhtml', - mathml: 'http://www.w3.org/1998/Math/MathML', - svg: 'http://www.w3.org/2000/svg' - }, - fe = void 0, - ie = function (t) { - return 'undefined' != typeof MSApp && MSApp.execUnsafeLocalFunction ? function (n, o, r, i) { - MSApp.execUnsafeLocalFunction(function () { - return t(n, o, r, i) - }) - } : t - }(function (e, t) { - if (e.namespaceURI !== hs.svg || 'innerHTML' in e) e.innerHTML = t; - else { - for (fe = fe || document.createElement('div'), fe.innerHTML = '' + t + '', t = fe.firstChild; e.firstChild;) e.removeChild(e.firstChild); - for (; t.firstChild;) e.appendChild(t.firstChild) + async showEnterpriseSignInDialog() { + await this.appStore._beginEnterpriseSignIn(), await this.appStore._showPopup({ + type: Zi.SignIn + }) + } + async showCreateForkDialog(e) { + await this.appStore._showCreateforkDialog(e) + } + registerErrorHandler(e) { + return this.errorHandlers.push(e), new ne.Disposable(() => { + const t = this.errorHandlers.indexOf(e); + t >= 0 && this.errorHandlers.splice(t, 1) + }) + } + async relocateRepository(e) { + const t = r.remote.getCurrentWindow(), + { + filePaths: n + } = await r.remote.dialog.showOpenDialog(t, { + properties: ["openDirectory"] + }); + if (n.length > 0) { + const t = n[0]; + await this.updateRepositoryPath(e, t) } - }), - je = { - animationIterationCount: !0, - borderImageOutset: !0, - borderImageSlice: !0, - borderImageWidth: !0, - boxFlex: !0, - boxFlexGroup: !0, - boxOrdinalGroup: !0, - columnCount: !0, - columns: !0, - flex: !0, - flexGrow: !0, - flexPositive: !0, - flexShrink: !0, - flexNegative: !0, - flexOrder: !0, - gridArea: !0, - gridRow: !0, - gridRowEnd: !0, - gridRowSpan: !0, - gridRowStart: !0, - gridColumn: !0, - gridColumnEnd: !0, - gridColumnSpan: !0, - gridColumnStart: !0, - fontWeight: !0, - lineClamp: !0, - lineHeight: !0, - opacity: !0, - order: !0, - orphans: !0, - tabSize: !0, - widows: !0, - zIndex: !0, - zoom: !0, - fillOpacity: !0, - floodOpacity: !0, - stopOpacity: !0, - strokeDasharray: !0, - strokeDashoffset: !0, - strokeMiterlimit: !0, - strokeOpacity: !0, - strokeWidth: !0 - }, - le = ['Webkit', 'ms', 'Moz', 'O']; - Object.keys(je).forEach(function (e) { - le.forEach(function (t) { - t = t + e.charAt(0).toUpperCase() + e.substring(1), je[t] = je[e] - }) - }); - var me = Kr({ - menuitem: !0 - }, { - area: !0, - base: !0, - br: !0, - col: !0, - embed: !0, - hr: !0, - img: !0, - input: !0, - keygen: !0, - link: !0, - meta: !0, - param: !0, - source: !0, - track: !0, - wbr: !0 - }), - pe = null, - fs = null, - ve = 'function' == typeof setTimeout ? setTimeout : void 0, - ye = 'function' == typeof clearTimeout ? clearTimeout : void 0, - ze = n.unstable_scheduleCallback, - Ae = n.unstable_cancelCallback; - new Set; - var Be = [], - Fe = -1, - Ge = {}, - gs = { - current: Ge - }, - H = { - current: !1 - }, - I = Ge, - Ie = null, - ys = null, - Ss = new Gr.Component().refs, - Cs = { - isMounted: function (e) { - return !!(e = e._reactInternalFiber) && 2 === Jt(e) - }, - enqueueSetState: function (t, n, o) { - t = t._reactInternalFiber; - var r = Sr(); - r = sr(r, t); - var i = Ro(r); - i.payload = n, void 0 !== o && null !== o && (i.callback = o), tr(), Po(t, i), pr(t, r) - }, - enqueueReplaceState: function (t, n, o) { - t = t._reactInternalFiber; - var r = Sr(); - r = sr(r, t); - var i = Ro(r); - i.tag = rd, i.payload = n, void 0 !== o && null !== o && (i.callback = o), tr(), Po(t, i), pr(t, r) - }, - enqueueForceUpdate: function (e, t) { - e = e._reactInternalFiber; - var n = Sr(); - n = sr(n, e); - var o = Ro(n); - o.tag = id, void 0 !== t && null !== t && (o.callback = t), tr(), Po(e, o), pr(e, n) + } + async updateRepositoryWorkflowPreferences(e, t) { + await this.appStore._updateRepositoryWorkflowPreferences(e, t) + } + async updateRepositoryPath(e, t) { + await this.appStore._updateRepositoryPath(e, t) + } + async setAppFocusState(e) { + await this.appStore._setAppFocusState(e), e ? this.commitStatusStore.startBackgroundRefresh() : this.commitStatusStore.stopBackgroundRefresh() + } + async getForkAndUpstreamRepos(e) { + const t = this.appStore.getState().repositories, + n = [], + r = []; + for (const i of t) + if (i instanceof Xi && Ji(i)) { + const t = i.gitHubRepository.htmlURL, + o = i.gitHubRepository.parent && i.gitHubRepository.parent.htmlURL; + t && Dt(t, e) ? r.push(i) : o && Dt(o, e) && n.push(i) + } return { + forks: n, + upstreams: r } - }, - bs = Array.isArray, - vs = Nn(!0), - Es = Nn(!1), - ws = {}, - ks = { - current: ws - }, - N = { - current: ws - }, - Ts = { - current: ws - }, - _s = 0, - Rs = 2, - xs = 4, - Ps = 8, - Ds = 16, - Ms = 32, - As = 64, - Is = 128, - Ls = aa.ReactCurrentDispatcher, - Fs = 0, - Bs = null, - Ns = null, - O = null, - P = null, - Os = null, - Q = null, - Hs = 0, - zs = null, - Us = 0, - Ws = !1, - Vs = null, - Gs = 0, - Ks = { - readContext: ko, - useCallback: Vn, - useContext: Vn, - useEffect: Vn, - useImperativeHandle: Vn, - useLayoutEffect: Vn, - useMemo: Vn, - useReducer: Vn, - useRef: Vn, - useState: Vn, - useDebugValue: Vn - }, - js = { - readContext: ko, - useCallback: function (e, t) { - return qn().memoizedState = [e, void 0 === t ? null : t], e - }, - useContext: ko, - useEffect: function (e, t) { - return Zn(516, Is | As, e, t) - }, - useImperativeHandle: function (e, t, n) { - return n = null !== n && void 0 !== n ? n.concat([e]) : null, Zn(4, xs | Ms, eo.bind(null, t, e), n) - }, - useLayoutEffect: function (e, t) { - return Zn(4, xs | Ms, e, t) - }, - useMemo: function (e, t) { - var n = qn(); - return t = void 0 === t ? null : t, e = e(), n.memoizedState = [e, t], e - }, - useReducer: function (e, t, n) { - var o = qn(); - return t = void 0 === n ? t : n(t), o.memoizedState = o.baseState = t, e = o.queue = { - last: null, - dispatch: null, - eagerReducer: e, - eagerState: t - }, e = e.dispatch = no.bind(null, Bs, e), [o.memoizedState, e] - }, - useRef: function (e) { - var t = qn(); - return e = { - current: e - }, t.memoizedState = e - }, - useState: function (e) { - var t = qn(); - return 'function' == typeof e && (e = e()), t.memoizedState = t.baseState = e, e = t.queue = { - last: null, - dispatch: null, - eagerReducer: Xn, - eagerState: e - }, e = e.dispatch = no.bind(null, Bs, e), [t.memoizedState, e] - }, - useDebugValue: to - }, - qs = { - readContext: ko, - useCallback: function (e, t) { - var n = Yn(); - t = void 0 === t ? null : t; - var o = n.memoizedState; - return null !== o && null !== t && Gn(t, o[1]) ? o[0] : (n.memoizedState = [e, t], e) - }, - useContext: ko, - useEffect: function (e, t) { - return Jn(516, Is | As, e, t) - }, - useImperativeHandle: function (e, t, n) { - return n = null !== n && void 0 !== n ? n.concat([e]) : null, Jn(4, xs | Ms, eo.bind(null, t, e), n) - }, - useLayoutEffect: function (e, t) { - return Jn(4, xs | Ms, e, t) - }, - useMemo: function (e, t) { - var n = Yn(); - t = void 0 === t ? null : t; - var o = n.memoizedState; - return null !== o && null !== t && Gn(t, o[1]) ? o[0] : (e = e(), n.memoizedState = [e, t], e) - }, - useReducer: Qn, - useRef: function () { - return Yn().memoizedState - }, - useState: function (e) { - return Qn(Xn, e) - }, - useDebugValue: to - }, - Ys = null, - Xs = null, - Qs = !1, - $s = aa.ReactCurrentOwner, - Zs = !1, - Js = { - current: null - }, - ed = null, - td = null, - nd = null, - od = 0, - rd = 1, - id = 2, - ad = 3, - sd = !1, - dd = void 0, - ld = void 0, - cd = void 0, - pd = void 0; - dd = function (e, t) { - for (var n = t.child; null !== n;) { - if (5 === n.tag || 6 === n.tag) e.appendChild(n.stateNode); - else if (4 !== n.tag && null !== n.child) { - n.child.return = n, n = n.child; - continue + } + async openRepositoryFromUrl(e) { + const { + url: t, + pr: n + } = e, r = n ? await this.appStore.fetchPullRequest(t, n) : null, i = r && r.head.repo && r.head.repo.html_url, { + forks: o, + upstreams: s + } = await this.getForkAndUpstreamRepos(t), a = o.find(e => Boolean(e.gitHubRepository && e.gitHubRepository.htmlURL && i && Dt(e.gitHubRepository.htmlURL, i))); + if (a) { + await this.selectRepository(a); + const e = r && r.head.ref; + return void(e && await this.checkoutLocalBranch(a, e)) } - if (n === t) break; - for (; null === n.sibling;) { - if (null === n.return || n.return === t) return; - n = n.return + const l = s.find(e => Boolean(e.gitHubRepository && e.gitHubRepository.htmlURL && i && Dt(e.gitHubRepository.htmlURL, i))); + if (l) return await this.selectRepository(l), void await this.handleCloneInDesktopOptions(l, e); + if (o.length > 0 && 0 === s.length) { + const t = o[0]; + return await this.selectRepository(t), void await this.handleCloneInDesktopOptions(t, e) } - n.sibling.return = n.return, n = n.sibling + const c = await this.openOrCloneRepository(t); + c ? await this.handleCloneInDesktopOptions(c, e) : log.warn(`Open Repository from URL failed, did not find or clone repository: ${t} - payload: ${JSON.stringify(e)}`) } - }, ld = function () {}, cd = function (t, n, o, r, i) { - var e = t.memoizedProps; - if (e !== r) { - var a = n.stateNode; - On(ks.current), t = null; - 'input' === o ? (e = It(a, e), r = It(a, r), t = []) : 'option' === o ? (e = vn(a, e), r = vn(a, r), t = []) : 'select' === o ? (e = Kr({}, e, { - value: void 0 - }), r = Kr({}, r, { - value: void 0 - }), t = []) : 'textarea' === o ? (e = ae(a, e), r = ae(a, r), t = []) : 'function' != typeof e.onClick && 'function' == typeof r.onClick && (a.onclick = se); - oe(o, r), a = o = void 0; - var s = null; - for (o in e) - if (!r.hasOwnProperty(o) && e.hasOwnProperty(o) && null != e[o]) - if ('style' === o) { - var d = e[o]; - for (a in d) d.hasOwnProperty(a) && (s || (s = {}), s[a] = '') - } else 'dangerouslySetInnerHTML' !== o && 'children' !== o && 'suppressContentEditableWarning' !== o && 'suppressHydrationWarning' !== o && 'autoFocus' !== o && (ei.hasOwnProperty(o) ? t || (t = []) : (t = t || []).push(o, null)); - for (o in r) { - var l = r[o]; - if (d = null == e ? void 0 : e[o], r.hasOwnProperty(o) && l !== d && (null != l || null != d)) - if ('style' !== o) 'dangerouslySetInnerHTML' === o ? (l = l ? l.__html : void 0, d = d ? d.__html : void 0, null != l && d !== l && (t = t || []).push(o, '' + l)) : 'children' === o ? d === l || 'string' != typeof l && 'number' != typeof l || (t = t || []).push(o, '' + l) : 'suppressContentEditableWarning' !== o && 'suppressHydrationWarning' !== o && (ei.hasOwnProperty(o) ? (null != l && re(i, o), t || d === l || (t = [])) : (t = t || []).push(o, l)); - else if (d) { - for (a in d) !d.hasOwnProperty(a) || l && l.hasOwnProperty(a) || (s || (s = {}), s[a] = ''); - for (a in l) l.hasOwnProperty(a) && d[a] !== l[a] && (s || (s = {}), s[a] = l[a]) - } else s || (t || (t = []), t.push(o, s)), s = l - } - s && (t = t || []).push('style', s), i = t, (n.updateQueue = i) && No(n) - } - }, pd = function (e, t, n, o) { - n !== o && No(t) - }; - var md = 'function' == typeof WeakSet ? WeakSet : Set, - hd = 'function' == typeof WeakMap ? WeakMap : Map, - fd = aa.ReactCurrentDispatcher, - gd = aa.ReactCurrentOwner, - yd = 1073741822, - Cd = !1, - bd = null, - T = null, - vd = 0, - U = -1, - Ed = !1, - wd = null, - V = !1, - kd = null, - Td = null, - _d = null, - Rd = null, - Pd = null, - li = null, - Y = 0, - mi = void 0, - ni = !1, - W = null, - oi = 0, - Z = 0, - gi = !1, - pi = null, - qi = !1, - X = !1, - Dd = null, - si = n.unstable_now(), - ti = 1073741822 - (0 | si / 10), - ui = ti, - vi = 50, - ji = 0, - ii = null, - wi = !1; - ta = function (t, n, o) { - switch (n) { - case 'input': - if (Bt(t, o), n = o.name, 'radio' === o.type && null != n) { - for (o = t; o.parentNode;) o = o.parentNode; - for (o = o.querySelectorAll('input[name=' + JSON.stringify('' + n) + '][type="radio"]'), n = 0; n < o.length; n++) { - var r = o[n]; - if (r !== t && r.form === t.form) { - var i = b(r); - i ? void 0 : s('90'), wt(r), Bt(r, i) + async dispatchURLAction(e) { + switch (e.name) { + case "oauth": + try { + log.info("[Dispatcher] requesting authenticated user"); + const n = await ju(e.code, e.state); + n ? (t = n, Wu || Z("`askUserToOAuth` must be called before resolving an auth request."), Wu.resolve(t), Wu = null) : null === n && Gu(new Error("Unable to fetch authenticated user.")) + } catch (e) { + Gu(e) + } + 0; + break; + case "open-repository-from-url": + this.openRepositoryFromUrl(e); + break; + case "open-repository-from-path": + const n = await Dc(e.path) || e.path; + let r = kt(this.appStore.getState().repositories, n); + if (null == r) { + if (await qa(n)) { + r = (await this.addRepositories([n]))[0] } } - } - break; - case 'textarea': - ce(t, o); - break; - case 'select': - n = o.value, null != n && En(t, !!o.multiple, n, !1); + r ? (await this.selectRepository(r), this.statsStore.recordAddExistingRepository()) : await this.showPopup({ + type: Zi.AddRepository, + path: n + }); + break; + default: + const i = e; + log.warn(`Unknown URL action: ${i.name} - payload: ${JSON.stringify(i)}`) + } + var t } - }, Fr.prototype.render = function (e) { - this._defer ? void 0 : s('250'), this._hasChildren = !0, this._children = e; - var t = this._root._internalRoot, - n = this._expirationTime, - o = new Br; - return Mr(e, t, null, n, o._onCommit), o - }, Fr.prototype.then = function (e) { - if (this._didComplete) e(); - else { - var t = this._callbacks; - null === t && (t = this._callbacks = []), t.push(e) + setConfirmRepoRemovalSetting(e) { + return this.appStore._setConfirmRepositoryRemovalSetting(e) } - }, Fr.prototype.commit = function () { - var t = this._root._internalRoot, - n = t.firstBatch; - if (this._defer && null !== n ? void 0 : s('251'), this._hasChildren) { - var o = this._expirationTime; - if (n !== this) { - this._hasChildren && (o = this._expirationTime = n._expirationTime, this.render(this._children)); - for (var r = null, i = n; i !== this;) r = i, i = i._next; - null === r ? s('251') : void 0, r._next = i._next, this._next = n, t.firstBatch = this - } - this._defer = !1, kr(t, o), n = this._next, this._next = null, n = t.firstBatch = n, null !== n && n._hasChildren && n.render(n._children) - } else this._next = null, this._defer = !1 - }, Fr.prototype._onComplete = function () { - if (!this._didComplete) { - this._didComplete = !0; - var e = this._callbacks; - if (null !== e) - for (var t = 0; t < e.length; t++)(0, e[t])() + setConfirmDiscardChangesSetting(e) { + return this.appStore._setConfirmDiscardChangesSetting(e) } - }, Br.prototype.then = function (e) { - if (this._didCommit) e(); - else { - var t = this._callbacks; - null === t && (t = this._callbacks = []), t.push(e) + setUncommittedChangesStrategyKindSetting(e) { + return this.appStore._setUncommittedChangesStrategyKindSetting(e) } - }, Br.prototype._onCommit = function () { - if (!this._didCommit) { - this._didCommit = !0; - var e = this._callbacks; - if (null !== e) - for (var t = 0, n; t < e.length; t++) n = e[t], 'function' == typeof n ? void 0 : s('191', n), n() + setExternalEditor(e) { + return this.appStore._setExternalEditor(e) } - }, Nr.prototype.render = function (e, t) { - var n = this._internalRoot, - o = new Br; - return t = void 0 === t ? null : t, null !== t && o.then(t), Ar(e, n, null, o._onCommit), o - }, Nr.prototype.unmount = function (e) { - var t = this._internalRoot, - n = new Br; - return e = void 0 === e ? null : e, null !== e && n.then(e), Ar(null, t, null, n._onCommit), n - }, Nr.prototype.legacy_renderSubtreeIntoContainer = function (t, n, o) { - var r = this._internalRoot, - i = new Br; - return o = void 0 === o ? null : o, null !== o && i.then(o), Ar(n, r, t, i._onCommit), i - }, Nr.prototype.createBatch = function () { - var e = new Fr(this), - t = e._expirationTime, - n = this._internalRoot, - o = n.firstBatch; - if (null === o) n.firstBatch = e, e._next = null; - else { - for (n = null; null !== o && o._expirationTime >= t;) n = o, o = o._next; - e._next = o, null !== n && (n._next = e) + setShell(e) { + return this.appStore._setShell(e) } - return e - }, mt = xr, ht = Dr, ft = function () { - ni || 0 === Z || (wr(Z, !1), Z = 0) - }; - var Md = { - createPortal: Ur, - findDOMNode: function (e) { - if (null == e) return null; - if (1 === e.nodeType) return e; - var t = e._reactInternalFiber; - return void 0 === t && ('function' == typeof e.render ? s('188') : s('268', Object.keys(e))), e = nn(t), e = null === e ? null : e.stateNode, e - }, - hydrate: function (e, t, n) { - return Or(t) ? void 0 : s('200'), zr(null, e, t, !0, n) - }, - render: function (e, t, n) { - return Or(t) ? void 0 : s('200'), zr(null, e, t, !1, n) - }, - unstable_renderSubtreeIntoContainer: function (e, t, n, o) { - return Or(n) ? void 0 : s('200'), null == e || void 0 === e._reactInternalFiber ? s('38') : void 0, zr(e, t, n, !1, o) - }, - unmountComponentAtNode: function (e) { - return Or(e) ? void 0 : s('40'), !!e._reactRootContainer && (Pr(function () { - zr(null, null, e, !1, function () { - e._reactRootContainer = null + async checkoutLocalBranch(e, t) { + let n = !0; + const r = this.repositoryStateManager.get(e), + i = r.branchesState.allBranches, + { + tip: o + } = r.branchesState; + o.kind === Qi.Valid && (n = o.branch.nameWithoutRemote !== t); + const s = i.find(e => e.nameWithoutRemote === t); + n && void 0 !== s && await this.checkoutBranch(e, s) + } + async handleCloneInDesktopOptions(e, t) { + const { + filepath: n, + pr: r, + branch: i + } = t; + null != r && null != i && await this.fetchRefspec(e, `pull/${r}/head:${i}`), await this.appStore._refreshRepository(e); + const o = this.repositoryStateManager.get(e).branchesState.allBranches; + if (null == r && null != i) { + null == (o.find(e => e.upstreamWithoutRemote === i) || null) && await this.fetch(e, Li.BackgroundTask) + } + if (null != i && await this.checkoutLocalBranch(e, i), null != n) { + const t = await + function (e, ...t) { + return Pc(e, t) + }(e.path, n); + null !== t ? ee.showItemInFolder(t) : log.error("Prevented attempt to open path outside of the repository root: " + n) + } + } + async openOrCloneRepository(e) { + const t = this.appStore.getState().repositories.find(t => { + if (t instanceof Xi) { + const n = t.gitHubRepository; + return !!n && Rt(e, n) + } + return !1 + }); + return t ? await this.selectRepository(t) : this.appStore._startOpenInDesktop(() => { + this.changeCloneRepositoriesTab(Si.Generic), this.showPopup({ + type: Zi.CloneRepository, + initialURL: e }) - }), !0) - }, - unstable_createPortal: function () { - return Ur.apply(void 0, arguments) - }, - unstable_batchedUpdates: xr, - unstable_interactiveUpdates: Dr, - flushSync: function (e, t) { - ni ? s('187') : void 0; - var n = qi; - qi = !0; + }) + } + async installCLI() { try { - return ur(e, t) - } finally { - qi = n, wr(1073741823, !1) + await Jv(), this.showPopup({ + type: Zi.CLIInstalled + }) + } catch (e) { + log.error("Error installing CLI", e), this.postError(e) } - }, - unstable_createRoot: function (e, t) { - return Or(e) ? void 0 : s('299', 'unstable_createRoot'), new Nr(e, !0, null != t && !0 === t.hydrate) - }, - unstable_flushControlled: function (e) { - var t = qi; - qi = !0; + } + promptForGenericGitAuthentication(e, t) { + return this.appStore.promptForGenericGitAuthentication(e, t) + } + async saveGenericGitCredentials(e, t, n) { + log.info(`storing generic credentials for '${e}' and '${t}'`), + function (e, t) { + const n = es(e); + localStorage.setItem(n, t) + }(e, t); try { - ur(e) - } finally { - (qi = t) || ni || wr(1073741823, !1) + await + function (e, t, n) { + const r = yi(e); + return Xo.setItem(r, t, n) + }(e, t, n) + } catch (n) { + log.error(`Error saving generic git credentials: ${t}@${e}`, n), this.postError(n) } - }, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { - Events: [g, R, b, yi.injectEventPluginsByName, Jr, q, function (e) { - c(e, j) - }, pt, ut, ln, w] } - }; - (function (e) { - var t = e.findFiberByHostInstance; - return Se(Kr({}, e, { - overrideProps: null, - currentDispatcherRef: aa.ReactCurrentDispatcher, - findHostInstanceByFiber: function (e) { - return e = nn(e), null === e ? null : e.stateNode - }, - findFiberByHostInstance: function (e) { - return t ? t(e) : null - } - })) - })({ - findFiberByHostInstance: _, - bundleType: 0, - version: '16.8.4', - rendererPackageName: 'react-dom' - }); - var Ad = { - default: Md - }, - Wi = Ad && Md || Ad; - e.exports = Wi.default || Wi -}, function (e, o, i) { - 'use strict'; - /** @license React v16.8.4 - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - function s(t, n, o, r, i, e, s, d) { - if (!t) { - if (t = void 0, void 0 === n) t = Error('Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.'); - else { - var c = [o, r, i, e, s, d], - l = 0; - t = Error(n.replace(/%s/g, function () { - return c[l++] - })), t.name = 'Invariant Violation' + async performRetry(e) { + switch (e.type) { + case rc.Push: + return this.push(e.repository); + case rc.Pull: + return this.pull(e.repository); + case rc.Fetch: + return this.fetch(e.repository, Li.UserInitiatedTask); + case rc.Clone: + await this.clone(e.url, e.path, e.options); + break; + case rc.Checkout: + await this.checkoutBranch(e.repository, e.branch); + break; + case rc.Merge: + return this.mergeBranch(e.repository, e.theirBranch, null); + case rc.Rebase: + return this.rebase(e.repository, e.baseBranch, e.targetBranch); + default: + return X(0, "Unknown retry action: " + e) } - throw t.framesToPop = 1, t } - } - - function _(e) { - for (var t = arguments.length - 1, n = 'https://reactjs.org/docs/error-decoder.html?invariant=' + e, o = 0; o < t; o++) n += '&args[]=' + encodeURIComponent(arguments[o + 1]); - s(!1, 'Minified React error #' + e + '; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ', n) - } - - function a(e, t, n) { - this.props = e, this.context = t, this.refs = C, this.updater = n || A - } - - function d() {} - - function l(e, t, n) { - this.props = e, this.context = t, this.refs = C, this.updater = n || A - } - - function c(t, o, r) { - var i = {}, - s = null, - d = null, - u; - if (null != o) - for (u in void 0 !== o.ref && (d = o.ref), void 0 !== o.key && (s = '' + o.key), o) ce.call(o, u) && !K.hasOwnProperty(u) && (i[u] = o[u]); - var c = arguments.length - 2; - if (1 === c) i.children = r; - else if (1 < c) { - for (var f = Array(c), l = 0; l < c; l++) f[l] = arguments[l + 2]; - i.children = f - } - if (t && t.defaultProps) - for (u in c = t.defaultProps, c) void 0 === i[u] && (i[u] = c[u]); - return { - $$typeof: n, - type: t, - key: s, - ref: d, - props: i, - _owner: le.current + changeImageDiffType(e) { + return this.appStore._changeImageDiffType(e) } - } - - function m(e, t) { - return { - $$typeof: n, - type: e.type, - key: t, - ref: e.ref, - props: e.props, - _owner: e._owner + onHideWhitespaceInDiffChanged(e, t, n = null) { + return this.appStore._setHideWhitespaceInDiff(e, t, n) } - } - - function h(e) { - return 'object' == typeof e && null !== e && e.$$typeof === n - } - - function f(e) { - var t = { - "=": '=0', - ":": '=2' - }; - return '$' + ('' + e).replace(/[=:]/g, function (e) { - return t[e] - }) - } - - function F(t, n, o, r) { - if (O.length) { - var i = O.pop(); - return i.result = t, i.keyPrefix = n, i.func = o, i.context = r, i.count = 0, i + installGlobalLFSFilters(e) { + return this.appStore._installGlobalLFSFilters(e) } - return { - result: t, - keyPrefix: n, - func: o, - context: r, - count: 0 + installLFSHooks(e) { + return this.appStore._installLFSHooks(e) } - } - - function B(e) { - e.result = null, e.keyPrefix = null, e.func = null, e.context = null, e.count = 0, 10 > O.length && O.push(e) - } - - function R(t, o, r, i) { - var s = typeof t; - ('undefined' === s || 'boolean' === s) && (t = null); - var e = !1; - if (null === t) e = !0; - else switch (s) { - case 'string': - case 'number': - e = !0; - break; - case 'object': - switch (t.$$typeof) { - case n: - case Q: - e = !0; - } - } - if (e) return r(i, t, '' === o ? '.' + U(t, 0) : o), 1; - if (e = 0, o = '' === o ? '.' : o + ':', Array.isArray(t)) - for (var d = 0; d < t.length; d++) { - s = t[d]; - var l = o + U(s, d); - e += R(s, l, r, i) - } else if (null === t || 'object' != typeof t ? l = null : (l = de && t[de] || t['@@iterator'], l = 'function' == typeof l ? l : null), 'function' == typeof l) - for (t = l.call(t), d = 0; !(s = t.next()).done;) s = s.value, l = o + U(s, d++), e += R(s, l, r, i); - else 'object' === s && (r = '' + t, _('31', '[object Object]' === r ? 'object with keys {' + Object.keys(t).join(', ') + '}' : r, '')); - return e - } - - function S(e, t, n) { - return null == e ? 0 : R(e, '', t, n) - } - - function U(e, t) { - return 'object' == typeof e && null !== e && null != e.key ? f(e.key) : t.toString(36) - } - - function g(e, t) { - e.func.call(e.context, t, e.count++) - } - - function T(t, n, o) { - var r = t.result, - i = t.keyPrefix; - t = t.func.call(t.context, n, t.count++), Array.isArray(t) ? j(t, r, o, function (e) { - return e - }) : null != t && (h(t) && (t = m(t, i + (!t.key || n && n.key === t.key ? '' : ('' + t.key).replace(L, '$&/') + '/') + o)), r.push(t)) - } - - function j(t, n, o, r, i) { - var e = ''; - null != o && (e = ('' + o).replace(L, '$&/') + '/'), n = F(n, e, r, i), S(t, T, n), B(n) - } - - function V() { - var e = H.current; - return null === e ? _('307') : void 0, e - } - var W = i(183), - b = 'function' == typeof Symbol && Symbol.for, - n = b ? Symbol.for('react.element') : 60103, - Q = b ? Symbol.for('react.portal') : 60106, - q = b ? Symbol.for('react.fragment') : 60107, - $ = b ? Symbol.for('react.strict_mode') : 60108, - ee = b ? Symbol.for('react.profiler') : 60114, - te = b ? Symbol.for('react.provider') : 60109, - ne = b ? Symbol.for('react.context') : 60110, - oe = b ? Symbol.for('react.concurrent_mode') : 60111, - re = b ? Symbol.for('react.forward_ref') : 60112, - ie = b ? Symbol.for('react.suspense') : 60113, - ae = b ? Symbol.for('react.memo') : 60115, - se = b ? Symbol.for('react.lazy') : 60116, - de = 'function' == typeof Symbol && Symbol.iterator, - A = { - isMounted: function () { - return !1 - }, - enqueueForceUpdate: function () {}, - enqueueReplaceState: function () {}, - enqueueSetState: function () {} - }, - C = {}; - a.prototype.isReactComponent = {}, a.prototype.setState = function (e, t) { - 'object' != typeof e && 'function' != typeof e && null != e ? _('85') : void 0, this.updater.enqueueSetState(this, e, t, 'setState') - }, a.prototype.forceUpdate = function (e) { - this.updater.enqueueForceUpdate(this, e, 'forceUpdate') - }, d.prototype = a.prototype; - var D = l.prototype = new d; - D.constructor = l, W(D, a.prototype), D.isPureReactComponent = !0; - var H = { - current: null - }, - le = { - current: null - }, - ce = Object.prototype.hasOwnProperty, - K = { - key: !0, - ref: !0, - __self: !0, - __source: !0 - }, - L = /\/+/g, - O = [], - P = { - Children: { - map: function (e, t, n) { - if (null == e) return e; - var o = []; - return j(e, o, null, t, n), o - }, - forEach: function (e, t, n) { - return null == e ? e : void(t = F(null, null, t, n), S(e, g, t), B(t)) - }, - count: function (e) { - return S(e, function () { - return null - }, null) - }, - toArray: function (e) { - var t = []; - return j(e, t, null, function (e) { - return e - }), t - }, - only: function (e) { - return h(e) ? void 0 : _('143'), e - } - }, - createRef: function () { - return { - current: null - } - }, - Component: a, - PureComponent: l, - createContext: function (e, t) { - return void 0 === t && (t = null), e = { - $$typeof: ne, - _calculateChangedBits: t, - _currentValue: e, - _currentValue2: e, - _threadCount: 0, - Provider: null, - Consumer: null - }, e.Provider = { - $$typeof: te, - _context: e - }, e.Consumer = e - }, - forwardRef: function (e) { - return { - $$typeof: re, - render: e - } - }, - lazy: function (e) { - return { - $$typeof: se, - _ctor: e, - _status: -1, - _result: null - } - }, - memo: function (e, t) { - return { - $$typeof: ae, - type: e, - compare: void 0 === t ? null : t - } - }, - useCallback: function (e, t) { - return V().useCallback(e, t) - }, - useContext: function (e, t) { - return V().useContext(e, t) - }, - useEffect: function (e, t) { - return V().useEffect(e, t) - }, - useImperativeHandle: function (e, t, n) { - return V().useImperativeHandle(e, t, n) - }, - useDebugValue: function () {}, - useLayoutEffect: function (e, t) { - return V().useLayoutEffect(e, t) - }, - useMemo: function (e, t) { - return V().useMemo(e, t) - }, - useReducer: function (e, t, n) { - return V().useReducer(e, t, n) - }, - useRef: function (e) { - return V().useRef(e) - }, - useState: function (e) { - return V().useState(e) - }, - Fragment: q, - StrictMode: $, - Suspense: ie, - createElement: c, - cloneElement: function (t, o, r) { - null === t || void 0 === t ? _('267', t) : void 0; - var i = W({}, t.props), - a = t.key, - s = t.ref, - d = t._owner, - u; - if (null != o) { - void 0 !== o.ref && (s = o.ref, d = le.current), void 0 !== o.key && (a = '' + o.key); - var c; - for (u in t.type && t.type.defaultProps && (c = t.type.defaultProps), o) ce.call(o, u) && !K.hasOwnProperty(u) && (i[u] = void 0 === o[u] && void 0 !== c ? c[u] : o[u]) - } - if (u = arguments.length - 2, 1 === u) i.children = r; - else if (1 < u) { - c = Array(u); - for (var l = 0; l < u; l++) c[l] = arguments[l + 2]; - i.children = c - } - return { - $$typeof: n, - type: t.type, - key: a, - ref: s, - props: i, - _owner: d - } - }, - createFactory: function (e) { - var t = c.bind(null, e); - return t.type = e, t - }, - isValidElement: h, - version: '16.8.4', - unstable_ConcurrentMode: oe, - unstable_Profiler: ee, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { - ReactCurrentDispatcher: H, - ReactCurrentOwner: le, - assign: W - } - }, - pe = { - default: P - }, - Y = pe && P || pe; - e.exports = Y.default || Y -}, function (e) { - e.exports = require('module') -}, function (e, t, n) { - function o(e, t, n, o, r) { - this.children = [], this.sourceContents = {}, this.line = null == e ? null : e, this.column = null == t ? null : t, this.source = null == n ? null : n, this.name = null == r ? null : r, this[s] = !0, null != o && this.add(o) - } - var r = n(313).SourceMapGenerator, - a = n(108), - i = /(\r?\n)/, - s = '$$$isSourceNode$$$'; - o.fromStringWithSourceMap = function (e, t, n) { - function r(e, t) { - if (null === e || void 0 === e.source) s.add(t); - else { - var r = n ? a.join(n, e.source) : e.source; - s.add(new o(e.originalLine, e.originalColumn, r, t, e.name)) - } + changeCloneRepositoriesTab(e) { + return this.appStore._changeCloneRepositoriesTab(e) + } + refreshApiRepositories(e) { + return this.appStore._refreshApiRepositories(e) + } + changeBranchesTab(e) { + return this.appStore._changeBranchesTab(e) + } + showGitHubExplore(e) { + return this.appStore._showGitHubExplore(e) + } + createPullRequest(e) { + return this.appStore._createPullRequest(e) + } + showPullRequest(e) { + return this.appStore._showPullRequest(e) + } + openCreatePullRequestInBrowser(e, t) { + return this.appStore._openCreatePullRequestInBrowser(e, t) + } + updateExistingUpstreamRemote(e) { + return this.appStore._updateExistingUpstreamRemote(e) + } + ignoreExistingUpstreamRemote(e) { + return this.appStore._ignoreExistingUpstreamRemote(e) + } + async checkoutPullRequest(e, t) { + return this.appStore._checkoutPullRequest(e, t) + } + setShowCoAuthoredBy(e, t) { + return this.appStore._setShowCoAuthoredBy(e, t) + } + setCoAuthors(e, t) { + return this.appStore._setCoAuthors(e, t) + } + initializeCompare(e, t) { + return this.appStore._initializeCompare(e, t) + } + executeCompare(e, t) { + return this.appStore._executeCompare(e, t) + } + updateCompareForm(e, t) { + return this.appStore._updateCompareForm(e, t) + } + updateManualConflictResolution(e, t, n) { + return this.appStore._updateManualConflictResolution(e, t, n) + } + async confirmOrForcePush(e) { + const { + askForConfirmationOnForcePush: t + } = this.appStore.getState(), { + branchesState: n + } = this.repositoryStateManager.get(e), { + tip: r + } = n; + if (r.kind !== Qi.Valid) return void log.warn("Could not find a branch to perform force push"); + const { + upstream: i + } = r.branch; + null !== i ? t ? this.showPopup({ + type: Zi.ConfirmForcePush, + repository: e, + upstreamBranch: i + }) : await this.performForcePush(e) : log.warn("Could not find an upstream branch which will be pushed") } - var s = new o, - d = e.split(i), - l = 0, - c = function () { - function e() { - return l < d.length ? d[l++] : void 0 - } - var t = e(), - n = e() || ''; - return t + n - }, - p = 1, - u = 0, - m = null; - return t.eachMapping(function (e) { - if (null !== m) - if (p < e.generatedLine) r(m, c()), p++, u = 0; - else { - var t = d[l], - n = t.substr(0, e.generatedColumn - u); - return d[l] = t.substr(e.generatedColumn - u), u = e.generatedColumn, r(m, n), void(m = e) - } for (; p < e.generatedLine;) s.add(c()), p++; - if (u < e.generatedColumn) { - var t = d[l]; - s.add(t.substr(0, e.generatedColumn)), d[l] = t.substr(e.generatedColumn), u = e.generatedColumn - } - m = e - }, this), l < d.length && (m && r(m, c()), s.add(d.splice(l).join(''))), t.sources.forEach(function (e) { - var o = t.sourceContentFor(e); - null != o && (null != n && (e = a.join(n, e)), s.setSourceContent(e, o)) - }), s - }, o.prototype.add = function (e) { - if (Array.isArray(e)) e.forEach(function (e) { - this.add(e) - }, this); - else if (e[s] || 'string' == typeof e) e && this.children.push(e); - else throw new TypeError('Expected a SourceNode, string, or an array of SourceNodes and strings. Got ' + e); - return this - }, o.prototype.prepend = function (e) { - if (Array.isArray(e)) - for (var t = e.length - 1; 0 <= t; t--) this.prepend(e[t]); - else if (e[s] || 'string' == typeof e) this.children.unshift(e); - else throw new TypeError('Expected a SourceNode, string, or an array of SourceNodes and strings. Got ' + e); - return this - }, o.prototype.walk = function (e) { - for (var t = 0, n = this.children.length, o; t < n; t++) o = this.children[t], o[s] ? o.walk(e) : '' !== o && e(o, { - source: this.source, - line: this.line, - column: this.column, - name: this.name - }) - }, o.prototype.join = function (e) { - var t = this.children.length, - n, o; - if (0 < t) { - for (n = [], o = 0; o < t - 1; o++) n.push(this.children[o]), n.push(e); - n.push(this.children[o]), this.children = n + async performForcePush(e) { + await this.pushWithOptions(e, { + forceWithLease: !0 + }), await this.appStore._loadStatus(e) } - return this - }, o.prototype.replaceRight = function (e, t) { - var n = this.children[this.children.length - 1]; - return n[s] ? n.replaceRight(e, t) : 'string' == typeof n ? this.children[this.children.length - 1] = n.replace(e, t) : this.children.push(''.replace(e, t)), this - }, o.prototype.setSourceContent = function (e, t) { - this.sourceContents[a.toSetString(e)] = t - }, o.prototype.walkSourceContents = function (e) { - for (var t = 0, n = this.children.length; t < n; t++) this.children[t][s] && this.children[t].walkSourceContents(e); - for (var o = Object.keys(this.sourceContents), t = 0, n = o.length; t < n; t++) e(a.fromSetString(o[t]), this.sourceContents[o[t]]) - }, o.prototype.toString = function () { - var e = ''; - return this.walk(function (t) { - e += t - }), e - }, o.prototype.toStringWithSourceMap = function (e) { - var t = { - code: '', - line: 1, - column: 0 - }, - n = new r(e), - o = !1, - i = null, - a = null, - s = null, - d = null; - return this.walk(function (e, r) { - t.code += e, null !== r.source && null !== r.line && null !== r.column ? ((i !== r.source || a !== r.line || s !== r.column || d !== r.name) && n.addMapping({ - source: r.source, - original: { - line: r.line, - column: r.column - }, - generated: { - line: t.line, - column: t.column - }, - name: r.name - }), i = r.source, a = r.line, s = r.column, d = r.name, o = !0) : o && (n.addMapping({ - generated: { - line: t.line, - column: t.column - } - }), i = null, o = !1); - for (var l = 0, c = e.length; l < c; l++) e.charCodeAt(l) === 10 ? (t.line++, t.column = 0, l + 1 === c ? (i = null, o = !1) : o && n.addMapping({ - source: r.source, - original: { - line: r.line, - column: r.column - }, - generated: { - line: t.line, - column: t.column - }, - name: r.name - })) : t.column++ - }), this.walkSourceContents(function (e, t) { - n.setSourceContent(e, t) - }), { - code: t.code, - map: n + setConfirmForcePushSetting(e) { + return this.appStore._setConfirmForcePushSetting(e) } - }, t.SourceNode = o -}, function (e, t) { - function n(e, t, n) { - var o = e[t]; - e[t] = e[n], e[n] = o - } - - function o(e, t) { - return Math.round(e + Math.random() * (t - e)) - } - - function a(e, t, s, d) { - if (s < d) { - var r = o(s, d), - l = s - 1; - n(e, r, d); - for (var i = e[d], c = s; c < d; c++) 0 >= t(e[c], i) && (l += 1, n(e, l, c)); - n(e, l + 1, c); - var p = l + 1; - a(e, t, s, p - 1), a(e, t, p + 1, d) + async convertRepositoryToFork(e, t) { + return this.appStore._convertRepositoryToFork(e, t) } - } - t.quickSort = function (e, t) { - a(e, t, 0, e.length - 1) - } -}, function (e, t) { - function n(e, o, r, i, a, s) { - var d = Math.floor((o - e) / 2) + e, - l = a(r, i[d], !0); - return 0 === l ? d : 0 < l ? 1 < o - d ? n(d, o, r, i, a, s) : s == t.LEAST_UPPER_BOUND ? o < i.length ? o : -1 : d : 1 < d - e ? n(e, d, r, i, a, s) : s == t.LEAST_UPPER_BOUND ? d : 0 > e ? -1 : e - } - t.GREATEST_LOWER_BOUND = 1, t.LEAST_UPPER_BOUND = 2, t.search = function (e, o, r, i) { - if (0 === o.length) return -1; - var a = n(-1, o.length, e, o, r, i || t.GREATEST_LOWER_BOUND); - if (0 > a) return -1; - for (; 0 <= a - 1 && !(0 !== r(o[a], o[a - 1], !0));) --a; - return a - } -}, function (e, t, n) { - function o(e) { - var t = e; - return 'string' == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ''))), null == t.sections ? new r(t) : new i(t) - } - - function r(e) { - var t = e; - 'string' == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ''))); - var n = d.getArg(t, 'version'), - o = d.getArg(t, 'sources'), - r = d.getArg(t, 'names', []), - i = d.getArg(t, 'sourceRoot', null), - a = d.getArg(t, 'sourcesContent', null), - s = d.getArg(t, 'mappings'), - c = d.getArg(t, 'file', null); - if (n != this._version) throw new Error('Unsupported version: ' + n); - o = o.map(String).map(d.normalize).map(function (e) { - return i && d.isAbsolute(i) && d.isAbsolute(e) ? d.relative(i, e) : e - }), this._names = l.fromArray(r.map(String), !0), this._sources = l.fromArray(o, !0), this.sourceRoot = i, this.sourcesContent = a, this._mappings = s, this.file = c - } - - function a() { - this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null - } - - function i(e) { - var t = e; - 'string' == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ''))); - var n = d.getArg(t, 'version'), - r = d.getArg(t, 'sections'); - if (n != this._version) throw new Error('Unsupported version: ' + n); - this._sources = new l, this._names = new l; - var i = { - line: -1, - column: 0 - }; - this._sections = r.map(function (e) { - if (e.url) throw new Error('Support for url field in sections not implemented.'); - var t = d.getArg(e, 'offset'), - n = d.getArg(t, 'line'), - r = d.getArg(t, 'column'); - if (n < i.line || n === i.line && r < i.column) throw new Error('Section offsets must be ordered and non-overlapping.'); - return i = t, { - generatedOffset: { - generatedLine: n + 1, - generatedColumn: r + 1 - }, - consumer: new o(d.getArg(e, 'map')) - } - }) - } - var d = n(108), - s = n(794), - l = n(311).ArraySet, - c = n(312), - p = n(793).quickSort; - o.fromSourceMap = function (e) { - return r.fromSourceMap(e) - }, o.prototype._version = 3, o.prototype.__generatedMappings = null, Object.defineProperty(o.prototype, '_generatedMappings', { - get: function () { - return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings + mergeConflictDetectedFromPull() { + return this.statsStore.recordMergeConflictFromPull() } - }), o.prototype.__originalMappings = null, Object.defineProperty(o.prototype, '_originalMappings', { - get: function () { - return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings + mergeConflictDetectedFromExplicitMerge() { + return this.statsStore.recordMergeConflictFromExplicitMerge() } - }), o.prototype._charIsMappingSeparator = function (e, t) { - var n = e.charAt(t); - return ';' === n || ',' === n - }, o.prototype._parseMappings = function () { - throw new Error('Subclasses must implement _parseMappings') - }, o.GENERATED_ORDER = 1, o.ORIGINAL_ORDER = 2, o.GREATEST_LOWER_BOUND = 1, o.LEAST_UPPER_BOUND = 2, o.prototype.eachMapping = function (e, t, n) { - var r = n || o.GENERATED_ORDER, - i; - switch (r) { - case o.GENERATED_ORDER: - i = this._generatedMappings; - break; - case o.ORIGINAL_ORDER: - i = this._originalMappings; - break; - default: - throw new Error('Unknown order of iteration.'); + recordMenuInitiatedMerge() { + return this.statsStore.recordMenuInitiatedMerge() } - var a = this.sourceRoot; - i.map(function (e) { - var t = null === e.source ? null : this._sources.at(e.source); - return null != t && null != a && (t = d.join(a, t)), { - source: t, - generatedLine: e.generatedLine, - generatedColumn: e.generatedColumn, - originalLine: e.originalLine, - originalColumn: e.originalColumn, - name: null === e.name ? null : this._names.at(e.name) - } - }, this).forEach(e, t || null) - }, o.prototype.allGeneratedPositionsFor = function (e) { - var t = d.getArg(e, 'line'), - n = { - source: d.getArg(e, 'source'), - originalLine: t, - originalColumn: d.getArg(e, 'column', 0) - }; - if (null != this.sourceRoot && (n.source = d.relative(this.sourceRoot, n.source)), !this._sources.has(n.source)) return []; - n.source = this._sources.indexOf(n.source); - var o = [], - r = this._findMapping(n, this._originalMappings, 'originalLine', 'originalColumn', d.compareByOriginalPositions, s.LEAST_UPPER_BOUND); - if (0 <= r) { - var i = this._originalMappings[r]; - if (void 0 === e.column) - for (var a = i.originalLine; i && i.originalLine === a;) o.push({ - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - }), i = this._originalMappings[++r]; - else - for (var l = i.originalColumn; i && i.originalLine === t && i.originalColumn == l;) o.push({ - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - }), i = this._originalMappings[++r] + recordMenuInitiatedRebase() { + return this.statsStore.recordMenuInitiatedRebase() } - return o - }, t.SourceMapConsumer = o, r.prototype = Object.create(o.prototype), r.prototype.consumer = o, r.fromSourceMap = function (e) { - var t = Object.create(r.prototype), - n = t._names = l.fromArray(e._names.toArray(), !0), - o = t._sources = l.fromArray(e._sources.toArray(), !0); - t.sourceRoot = e._sourceRoot, t.sourcesContent = e._generateSourcesContent(t._sources.toArray(), t.sourceRoot), t.file = e._file; - for (var s = e._mappings.toArray().slice(), c = t.__generatedMappings = [], u = t.__originalMappings = [], m = 0, i = s.length; m < i; m++) { - var h = s[m], - f = new a; - f.generatedLine = h.generatedLine, f.generatedColumn = h.generatedColumn, h.source && (f.source = o.indexOf(h.source), f.originalLine = h.originalLine, f.originalColumn = h.originalColumn, h.name && (f.name = n.indexOf(h.name)), u.push(f)), c.push(f) + recordMenuInitiatedUpdate() { + return this.statsStore.recordMenuInitiatedUpdate() } - return p(t.__originalMappings, d.compareByOriginalPositions), t - }, r.prototype._version = 3, Object.defineProperty(r.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (e) { - return null == this.sourceRoot ? e : d.join(this.sourceRoot, e) - }, this) - } - }), r.prototype._parseMappings = function (e) { - for (var t = 1, n = 0, o = 0, r = 0, i = 0, s = 0, l = e.length, u = 0, m = {}, h = {}, f = [], g = [], y, S, C, b, v; u < l;) - if (';' === e.charAt(u)) t++, u++, n = 0; - else if (',' === e.charAt(u)) u++; - else { - for (y = new a, y.generatedLine = t, b = u; b < l && !this._charIsMappingSeparator(e, b); b++); - if (S = e.slice(u, b), C = m[S], C) u += S.length; - else { - for (C = []; u < b;) c.decode(e, u, h), v = h.value, u = h.rest, C.push(v); - if (2 === C.length) throw new Error('Found a source, but no line and column'); - if (3 === C.length) throw new Error('Found a source and line, but no column'); - m[S] = C - } - y.generatedColumn = n + C[0], n = y.generatedColumn, 1 < C.length && (y.source = i + C[1], i += C[1], y.originalLine = o + C[2], o = y.originalLine, y.originalLine += 1, y.originalColumn = r + C[3], r = y.originalColumn, 4 < C.length && (y.name = s + C[4], s += C[4])), g.push(y), 'number' == typeof y.originalLine && f.push(y) - } - p(g, d.compareByGeneratedPositionsDeflated), this.__generatedMappings = g, p(f, d.compareByOriginalPositions), this.__originalMappings = f - }, r.prototype._findMapping = function (e, t, n, o, r, i) { - if (0 >= e[n]) throw new TypeError('Line must be greater than or equal to 1, got ' + e[n]); - if (0 > e[o]) throw new TypeError('Column must be greater than or equal to 0, got ' + e[o]); - return s.search(e, t, r, i) - }, r.prototype.computeColumnSpans = function () { - for (var e = 0, t; e < this._generatedMappings.length; ++e) { - if (t = this._generatedMappings[e], e + 1 < this._generatedMappings.length) { - var n = this._generatedMappings[e + 1]; - if (t.generatedLine === n.generatedLine) { - t.lastGeneratedColumn = n.generatedColumn - 1; - continue - } - } - t.lastGeneratedColumn = Infinity + recordCompareInitiatedMerge() { + return this.statsStore.recordCompareInitiatedMerge() } - }, r.prototype.originalPositionFor = function (e) { - var t = { - generatedLine: d.getArg(e, 'line'), - generatedColumn: d.getArg(e, 'column') - }, - n = this._findMapping(t, this._generatedMappings, 'generatedLine', 'generatedColumn', d.compareByGeneratedPositionsDeflated, d.getArg(e, 'bias', o.GREATEST_LOWER_BOUND)); - if (0 <= n) { - var r = this._generatedMappings[n]; - if (r.generatedLine === t.generatedLine) { - var i = d.getArg(r, 'source', null); - null !== i && (i = this._sources.at(i), null != this.sourceRoot && (i = d.join(this.sourceRoot, i))); - var a = d.getArg(r, 'name', null); - return null !== a && (a = this._names.at(a)), { - source: i, - line: d.getArg(r, 'originalLine', null), - column: d.getArg(r, 'originalColumn', null), - name: a - } - } + setSelectedTheme(e) { + return this.appStore._setSelectedTheme(e) } - return { - source: null, - line: null, - column: null, - name: null + onAutomaticallySwitchThemeChanged(e) { + return this.appStore._setAutomaticallySwitchTheme(e) } - }, r.prototype.hasContentsOfAllSources = function () { - return !!this.sourcesContent && this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (e) { - return null == e - }) - }, r.prototype.sourceContentFor = function (e, t) { - if (!this.sourcesContent) return null; - if (null != this.sourceRoot && (e = d.relative(this.sourceRoot, e)), this._sources.has(e)) return this.sourcesContent[this._sources.indexOf(e)]; - var n; - if (null != this.sourceRoot && (n = d.urlParse(this.sourceRoot))) { - var o = e.replace(/^file:\/\//, ''); - if ('file' == n.scheme && this._sources.has(o)) return this.sourcesContent[this._sources.indexOf(o)]; - if ((!n.path || '/' == n.path) && this._sources.has('/' + e)) return this.sourcesContent[this._sources.indexOf('/' + e)] + recordRepoClicked(e) { + return this.statsStore.recordRepoClicked(e) } - if (t) return null; - throw new Error('"' + e + '" is not in the SourceMap.') - }, r.prototype.generatedPositionFor = function (e) { - var t = d.getArg(e, 'source'); - if (null != this.sourceRoot && (t = d.relative(this.sourceRoot, t)), !this._sources.has(t)) return { - line: null, - column: null, - lastColumn: null - }; - t = this._sources.indexOf(t); - var n = { - source: t, - originalLine: d.getArg(e, 'line'), - originalColumn: d.getArg(e, 'column') - }, - r = this._findMapping(n, this._originalMappings, 'originalLine', 'originalColumn', d.compareByOriginalPositions, d.getArg(e, 'bias', o.GREATEST_LOWER_BOUND)); - if (0 <= r) { - var i = this._originalMappings[r]; - if (i.source === n.source) return { - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - } + recordDivergingBranchBannerDismissal() { + return this.statsStore.recordDivergingBranchBannerDismissal() } - return { - line: null, - column: null, - lastColumn: null + recordDivergingBranchBannerInitiatedCompare() { + return this.statsStore.recordDivergingBranchBannerInitiatedCompare() } - }, t.BasicSourceMapConsumer = r, i.prototype = Object.create(o.prototype), i.prototype.constructor = o, i.prototype._version = 3, Object.defineProperty(i.prototype, 'sources', { - get: function () { - for (var e = [], t = 0; t < this._sections.length; t++) - for (var n = 0; n < this._sections[t].consumer.sources.length; n++) e.push(this._sections[t].consumer.sources[n]); - return e + recordDivergingBranchBannerInfluencedMerge() { + return this.statsStore.recordDivergingBranchBannerInfluencedMerge() } - }), i.prototype.originalPositionFor = function (e) { - var t = { - generatedLine: d.getArg(e, 'line'), - generatedColumn: d.getArg(e, 'column') - }, - n = s.search(t, this._sections, function (e, t) { - var n = e.generatedLine - t.generatedOffset.generatedLine; - return n ? n : e.generatedColumn - t.generatedOffset.generatedColumn - }), - o = this._sections[n]; - return o ? o.consumer.originalPositionFor({ - line: t.generatedLine - (o.generatedOffset.generatedLine - 1), - column: t.generatedColumn - (o.generatedOffset.generatedLine === t.generatedLine ? o.generatedOffset.generatedColumn - 1 : 0), - bias: e.bias - }) : { - source: null, - line: null, - column: null, - name: null + recordDivergingBranchBannerInitatedMerge() { + return this.statsStore.recordDivergingBranchBannerInitatedMerge() + } + recordCreatePullRequest() { + return this.statsStore.recordCreatePullRequest() + } + recordWelcomeWizardInitiated() { + return this.statsStore.recordWelcomeWizardInitiated() + } + recordCreateRepository() { + this.statsStore.recordCreateRepository() + } + recordAddExistingRepository() { + this.statsStore.recordAddExistingRepository() + } + recordMergeConflictsDialogDismissal() { + this.statsStore.recordMergeConflictsDialogDismissal() + } + recordMergeConflictsDialogReopened() { + this.statsStore.recordMergeConflictsDialogReopened() + } + recordAnyConflictsLeftOnMergeConflictsDialogDismissal() { + this.statsStore.recordAnyConflictsLeftOnMergeConflictsDialogDismissal() + } + recordGuidedConflictedMergeCompletion() { + this.statsStore.recordGuidedConflictedMergeCompletion() + } + recordUnguidedConflictedMergeCompletion() { + this.statsStore.recordUnguidedConflictedMergeCompletion() + } + recordRebaseConflictsDialogDismissal() { + this.statsStore.recordRebaseConflictsDialogDismissal() + } + recordRebaseConflictsDialogReopened() { + this.statsStore.recordRebaseConflictsDialogReopened() + } + recordErrorWhenSwitchingBranchesWithUncommmittedChanges() { + return this.statsStore.recordErrorWhenSwitchingBranchesWithUncommmittedChanges() + } + refreshPullRequests(e) { + return this.appStore._refreshPullRequests(e) + } + tryGetCommitStatus(e, t) { + return this.commitStatusStore.tryGetStatus(e, t) + } + subscribeToCommitStatus(e, t, n) { + return this.commitStatusStore.subscribe(e, t, n) } - }, i.prototype.hasContentsOfAllSources = function () { - return this._sections.every(function (e) { - return e.consumer.hasContentsOfAllSources() - }) - }, i.prototype.sourceContentFor = function (e, t) { - for (var n = 0; n < this._sections.length; n++) { - var o = this._sections[n], - r = o.consumer.sourceContentFor(e, !0); - if (r) return r + createStashForCurrentBranch(e, t = !0) { + return this.appStore._createStashForCurrentBranch(e, t) } - if (t) return null; - throw new Error('"' + e + '" is not in the SourceMap.') - }, i.prototype.generatedPositionFor = function (e) { - for (var t = 0, n; t < this._sections.length; t++) - if (n = this._sections[t], -1 !== n.consumer.sources.indexOf(d.getArg(e, 'source'))) { - var o = n.consumer.generatedPositionFor(e); - if (o) { - var r = { - line: o.line + (n.generatedOffset.generatedLine - 1), - column: o.column + (n.generatedOffset.generatedLine === o.line ? n.generatedOffset.generatedColumn - 1 : 0) - }; - return r - } - } return { - line: null, - column: null + dropStash(e, t) { + return this.appStore._dropStashEntry(e, t) } - }, i.prototype._parseMappings = function () { - this.__generatedMappings = [], this.__originalMappings = []; - for (var e = 0; e < this._sections.length; e++) - for (var t = this._sections[e], n = t.consumer._generatedMappings, o = 0; o < n.length; o++) { - var r = n[o], - i = t.consumer._sources.at(r.source); - null !== t.consumer.sourceRoot && (i = d.join(t.consumer.sourceRoot, i)), this._sources.add(i), i = this._sources.indexOf(i); - var a = t.consumer._names.at(r.name); - this._names.add(a), a = this._names.indexOf(a); - var s = { - source: i, - generatedLine: r.generatedLine + (t.generatedOffset.generatedLine - 1), - generatedColumn: r.generatedColumn + (t.generatedOffset.generatedLine === r.generatedLine ? t.generatedOffset.generatedColumn - 1 : 0), - originalLine: r.originalLine, - originalColumn: r.originalColumn, - name: a - }; - this.__generatedMappings.push(s), 'number' == typeof s.originalLine && this.__originalMappings.push(s) - } - p(this.__generatedMappings, d.compareByGeneratedPositionsDeflated), p(this.__originalMappings, d.compareByOriginalPositions) - }, t.IndexedSourceMapConsumer = i -}, function (e, t, n) { - function o(e, t) { - var n = e.generatedLine, - o = t.generatedLine, - r = e.generatedColumn, - a = t.generatedColumn; - return o > n || o == n && a >= r || 0 >= i.compareByGeneratedPositionsInflated(e, t) - } - - function r() { - this._array = [], this._sorted = !0, this._last = { - generatedLine: -1, - generatedColumn: 0 + popStash(e, t) { + return this.appStore._popStashEntry(e, t) } - } - var i = n(108); - r.prototype.unsortedForEach = function (e, t) { - this._array.forEach(e, t) - }, r.prototype.add = function (e) { - o(this._last, e) ? (this._last = e, this._array.push(e)) : (this._sorted = !1, this._array.push(e)) - }, r.prototype.toArray = function () { - return this._sorted || (this._array.sort(i.compareByGeneratedPositionsInflated), this._sorted = !0), this._array - }, t.MappingList = r -}, function (e, t) { - var n = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/']; - t.encode = function (e) { - if (0 <= e && e < n.length) return n[e]; - throw new TypeError('Must be between 0 and 63: ' + e) - }, t.decode = function (e) { - var t = 65, - n = 97, - o = 48; - return t <= e && e <= 90 ? e - t : n <= e && e <= 122 ? e - n + 26 : o <= e && e <= 57 ? e - o + 52 : e == 43 ? 62 : e == 47 ? 63 : -1 - } -}, function (e, t, n) { - t.SourceMapGenerator = n(313).SourceMapGenerator, t.SourceMapConsumer = n(795).SourceMapConsumer, t.SourceNode = n(792).SourceNode -}, function (e, t, n) { - function o() { - return !('browser' !== w) || 'node' !== w && 'undefined' != typeof window && 'function' == typeof XMLHttpRequest && !(window.require && window.module && window.process && 'renderer' === window.process.type) - } - - function r() { - return 'object' == typeof process && null !== process && 'function' == typeof process.on - } - - function i(e) { - return function (t) { - for (var n = 0, o; n < e.length; n++) - if (o = e[n](t), o) return o; - return null + hideStashedChanges(e) { + return this.appStore._hideStashedChanges(e) } - } - - function a(e, t) { - if (!e) return t; - var n = S.dirname(e), - o = /^\w+:\/\/[^\/]*/.exec(n), - r = o ? o[0] : ''; - return r + S.resolve(n.slice(r.length), t) - } - - function s(e) { - var t; - if (o()) try { - var n = new XMLHttpRequest; - n.open('GET', e, !1), n.send(null), t = 4 === n.readyState ? n.responseText : null; - var r = n.getResponseHeader('SourceMap') || n.getResponseHeader('X-SourceMap'); - if (r) return r - } catch (t) {} - t = P(e); - for (var i = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg, a, s; s = i.exec(t);) a = s; - return a ? a[1] : null - } - - function d(e) { - var t = T[e.source]; - if (!t) { - var n = D(e.source); - n ? (t = T[e.source] = { - url: n.url, - map: new y(n.map) - }, t.map.sourcesContent && t.map.sources.forEach(function (e, n) { - var o = t.map.sourcesContent[n]; - if (o) { - var r = a(t.url, e); - k[r] = o - } - })) : t = T[e.source] = { - url: null, - map: null - } + recordSuggestedStepOpenInExternalEditor() { + return this.statsStore.recordSuggestedStepOpenInExternalEditor() } - if (t && t.map) { - var o = t.map.originalPositionFor(e); - if (null !== o.source) return o.source = a(t.url, o.source), o + recordSuggestedStepOpenWorkingDirectory() { + return this.statsStore.recordSuggestedStepOpenWorkingDirectory() } - return e - } - - function l(e) { - var t = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e); - if (t) { - var n = d({ - source: t[2], - line: +t[3], - column: t[4] - 1 - }); - return 'eval at ' + t[1] + ' (' + n.source + ':' + n.line + ':' + (n.column + 1) + ')' + recordSuggestedStepViewOnGitHub() { + return this.statsStore.recordSuggestedStepViewOnGitHub() } - return t = /^eval at ([^(]+) \((.+)\)$/.exec(e), t ? 'eval at ' + t[1] + ' (' + l(t[2]) + ')' : e - } - - function c() { - var e = '', - t; - if (this.isNative()) e = 'native'; - else { - t = this.getScriptNameOrSourceURL(), !t && this.isEval() && (e = this.getEvalOrigin(), e += ', '), e += t ? t : ''; - var n = this.getLineNumber(); - if (null != n) { - e += ':' + n; - var o = this.getColumnNumber(); - o && (e += ':' + o) - } + recordSuggestedStepPublishRepository() { + return this.statsStore.recordSuggestedStepPublishRepository() } - var r = '', - i = this.getFunctionName(), - a = !0, - s = this.isConstructor(), - d = !(this.isToplevel() || s); - if (d) { - var l = this.getTypeName(); - '[object Object]' === l && (l = 'null'); - var c = this.getMethodName(); - i ? (l && 0 != i.indexOf(l) && (r += l + '.'), r += i, c && i.indexOf('.' + c) != i.length - c.length - 1 && (r += ' [as ' + c + ']')) : r += l + '.' + (c || '') - } else s ? r += 'new ' + (i || '') : i ? r += i : (r += e, a = !1); - return a && (r += ' (' + e + ')'), r - } - - function p(e) { - var t = {}; - return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(function (n) { - t[n] = /^(?:is|get)/.test(n) ? function () { - return e[n].call(e) - } : e[n] - }), t.toString = c, t - } - - function u(e) { - if (e.isNative()) return e; - var t = e.getFileName() || e.getScriptNameOrSourceURL(); - if (t) { - var n = e.getLineNumber(), - r = e.getColumnNumber() - 1, - i = 62; - 1 !== n || !(r > i) || o() || e.isEval() || (r -= i); - var a = d({ - source: t, - line: n, - column: r - }); - return e = p(e), e.getFileName = function () { - return a.source - }, e.getLineNumber = function () { - return a.line - }, e.getColumnNumber = function () { - return a.column + 1 - }, e.getScriptNameOrSourceURL = function () { - return a.source - }, e + recordSuggestedStepPublishBranch() { + return this.statsStore.recordSuggestedStepPublishBranch() } - var s = e.isEval() && e.getEvalOrigin(); - return s ? (s = l(s), e = p(e), e.getEvalOrigin = function () { - return s - }, e) : e - } - - function m(e, t) { - return E && (k = {}, T = {}), e + t.map(function (e) { - return '\n at ' + u(e) - }).join('') - } - - function h(e) { - var t = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack); - if (t) { - var n = t[1], - o = +t[2], - r = +t[3], - i = k[n]; - if (!i && C && C.existsSync(n)) try { - i = C.readFileSync(n, 'utf8') - } catch (e) { - i = '' - } - if (i) { - var a = i.split(/(?:\r\n|\r|\n)/)[o - 1]; - if (a) return n + ':' + o + '\n' + a + '\n' + Array(r).join(' ') + '^' - } + recordSuggestedStepCreatePullRequest() { + return this.statsStore.recordSuggestedStepCreatePullRequest() } - return null - } - - function f(e) { - var t = h(e); - t && (console.error(), console.error(t)), console.error(e.stack), process.exit(1) - } - - function g() { - var e = process.emit; - process.emit = function (t) { - if ('uncaughtException' === t) { - var n = arguments[1] && arguments[1].stack, - o = 0 < this.listeners(t).length; - if (n && !o) return f(arguments[1]) - } - return e.apply(this, arguments) + recordSuggestedStepViewStash() { + return this.statsStore.recordSuggestedStepViewStash() } - } - var y = n(798).SourceMapConsumer, - S = n(1), - C; - try { - C = n(33), C.existsSync && C.readFileSync || (C = null) - } catch (e) {} - var b = !1, - v = !1, - E = !1, - w = 'auto', - k = {}, - T = {}, - _ = /^data:application\/json[^,]+base64,/, - R = [], - x = [], - P = i(R); - R.push(function (e) { - if (e = e.trim(), e in k) return k[e]; - var t = null; - if (!C) { - var n = new XMLHttpRequest; - n.open('GET', e, !1), n.send(null); - var t = null; - 4 === n.readyState && 200 === n.status && (t = n.responseText) - } else if (C.existsSync(e)) try { - t = C.readFileSync(e, 'utf8') - } catch (e) { - t = '' + async moveChangesToBranchAndCheckout(e, t) { + return this.appStore._moveChangesToBranchAndCheckout(e, t) } - return k[e] = t - }); - var D = i(x); - x.push(function (e) { - var t = s(e); - if (!t) return null; - var n; - if (_.test(t)) { - var o = t.slice(t.indexOf(',') + 1); - n = new Buffer(o, 'base64').toString(), t = e - } else t = a(e, t), n = P(t); - return n ? { - url: t, - map: n - } : null - }), t.wrapCallSite = u, t.getErrorSource = h, t.mapSourcePosition = d, t.retrieveSourceMap = D, t.install = function (e) { - if (e = e || {}, e.environment && (w = e.environment, -1 === ['node', 'browser', 'auto'].indexOf(w))) throw new Error('environment ' + w + ' was unknown. Available options are {auto, browser, node}'); - if (e.retrieveFile && (e.overrideRetrieveFile && (R.length = 0), R.unshift(e.retrieveFile)), e.retrieveSourceMap && (e.overrideRetrieveSourceMap && (x.length = 0), x.unshift(e.retrieveSourceMap)), e.hookRequire && !o()) { - var t; - try { - t = n(791) - } catch (e) {} - var i = t.prototype._compile; - i.__sourceMapSupport || (t.prototype._compile = function (e, t) { - return k[t] = e, T[t] = void 0, i.call(this, e, t) - }, t.prototype._compile.__sourceMapSupport = !0) + recordNoActionTakenOnStash() { + return this.statsStore.recordNoActionTakenOnStash() } - if (E || (E = !!('emptyCacheBetweenOperations' in e) && e.emptyCacheBetweenOperations), b || (b = !0, Error.prepareStackTrace = m), !v) { - var a = !('handleUncaughtExceptions' in e) || e.handleUncaughtExceptions; - a && r() && (v = !0, g()) + recordStashView() { + return this.statsStore.recordStashView() } - } -}, function (e, t, n) { - var o = n(1).sep || '/'; - e.exports = function (e) { - if ('string' != typeof e || 7 >= e.length || 'file://' != e.substring(0, 7)) throw new TypeError('must pass in a file:// URI to convert to a file path'); - var t = unescape(e.substring(7)), - n = t.indexOf('/'), - r = t.substring(0, n), - i = t.substring(n + 1); - return 'localhost' == r && (r = ''), r && (r = o + o + r), i = i.replace(/^(.+)\|/, '$1:'), '\\' == o && (i = i.replace(/\//g, '\\')), /^.+\:/.test(i) || (i = o + i), r + i - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(314); - t.formatError = function (e, t) { - return e = o.withSourceMappedStack(e), e.stack ? t ? `${t}\n${e.stack}` : e.stack.trim() : t ? `${t}\n${e.name}: ${e.message}` : `${e.name}: ${e.message}` - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(801); - t.formatLogMessage = function (e, t) { - return t ? o.formatError(t, e) : e - } -}, function (e, t, n) { - 'use strict'; - - function o(e, t, n) { - r.ipcRenderer.send('log', e, i.formatLogMessage(`[${'ui'}] ${t}`, n)) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const r = n(22), - i = n(802), - a = global; - a.log = { - error(e, t) { - o('error', e, t), console.error(i.formatLogMessage(e, t)) - }, - warn(e, t) { - o('warn', e, t), console.warn(i.formatLogMessage(e, t)) - }, - info(e, t) { - o('info', e, t), console.info(i.formatLogMessage(e, t)) - }, - debug(e, t) { - o('debug', e, t), console.debug(i.formatLogMessage(e, t)) + skipPickEditorTutorialStep(e) { + return this.appStore._skipPickEditorTutorialStep(e) } - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }), n(803); - const o = n(0), - r = n(43), - i = n(1), - a = n(57), - s = n(22), - d = n(310), - l = n(342), - c = n(72), - p = n(184), - u = n(28), - m = n(86), - h = n(184), - f = n(335), - g = n(334), - y = n(27), - S = n(134), - C = n(86), - b = n(314), - v = n(333), - E = n(332), - w = n(331), - k = n(330), - T = n(234); - !1, f.shellNeedsPatching(process) && f.updateEnvironmentForProcess(), b.enableSourceMaps(), process.env.LOCAL_GIT_DIRECTORY = i.resolve(__dirname, 'git'), n(326); - const _ = n(325); - _(a); - const R = performance.now(); - n(324); - let x = null, - P = null, - D = null; - const M = (e, t = {}, n) => { - e = b.withSourceMappedStack(e), console.error('Uncaught exception', e); { - const o = Object.assign({ - osVersion: S.getOS(), - guid: C.getGUID() - }, t); - try { - x && (null !== x.currentBanner && (o.currentBanner = x.currentBanner.type), null !== x.currentPopup && (o.currentPopup = `${x.currentPopup.type}`), null !== x.selectedState && (o.selectedState = `${x.selectedState.type}`, x.selectedState.type === u.SelectionType.Repository && (o.selectedRepositorySection = `${x.selectedState.state.selectedSection}`)), null !== x.currentFoldout && (o.currentFoldout = `${x.currentFoldout.type}`), x.showWelcomeFlow && (o.inWelcomeFlow = 'true'), 1 !== x.windowZoomFactor && (o.windowZoomFactor = `${x.windowZoomFactor}`), 0 < x.errors.length && (o.activeAppErrors = `${x.errors.length}`), null != P && null != D && (o.lastUnhandledRejection = P, o.lastUnhandledRejectionTime = D.toString()), o.repositoryCount = `${x.repositories.length}`, o.windowState = x.windowState, o.accounts = `${x.accounts.length}`, !1) - } catch (e) {} - y.sendErrorReport(e, o, n) + markPullRequestTutorialStepAsComplete(e) { + return this.appStore._markPullRequestTutorialStepAsComplete(e) } - }; - process.once('uncaughtException', (e) => { - M(e), y.reportUncaughtException(e) - }), process.on('send-non-fatal-exception', (e, t) => { - M(e, t, !0) - }), window.addEventListener('unhandledrejection', (e) => { - if (null !== e.reason && e.reason !== void 0) try { - P = `${e.reason}`, D = new Date - } catch (e) {} - }); - const A = new c.GitHubUserStore(new p.GitHubUserDatabase('GitHubUserDatabase')), - I = new c.CloningRepositoriesStore, - L = new c.IssuesStore(new h.IssuesDatabase('IssuesDatabase')), - F = new m.StatsStore(new m.StatsDatabase('StatsDatabase'), new v.UiActivityMonitor()), - B = new c.SignInStore, - N = new c.AccountsStore(localStorage, c.TokenStore), - O = new c.RepositoriesStore(new h.RepositoriesDatabase('Database')), - H = new c.PullRequestStore(new h.PullRequestDatabase('PullRequestDatabase'), O), - z = new T.PullRequestCoordinator(H, O), - U = new E.RepositoryStateCache((e) => A.getUsersForRepository(e)), - W = new w.ApiRepositoriesStore(N), - V = new k.CommitStatusStore(N), - G = new c.AppStore(A, I, L, F, B, N, O, z, U, W); - G.onDidUpdate((e) => { - x = e - }); - const K = new l.Dispatcher(G, U, F, V); - K.registerErrorHandler(l.defaultErrorHandler), K.registerErrorHandler(l.upstreamAlreadyExistsHandler), K.registerErrorHandler(l.externalEditorErrorHandler), K.registerErrorHandler(l.openShellErrorHandler), K.registerErrorHandler(l.mergeConflictHandler), K.registerErrorHandler(l.lfsAttributeMismatchHandler), K.registerErrorHandler(l.insufficientGitHubRepoPermissions), K.registerErrorHandler(l.schannelUnableToCheckRevocationForCertificate), K.registerErrorHandler(l.gitAuthenticationErrorHandler), K.registerErrorHandler(l.pushNeedsPullHandler), K.registerErrorHandler(l.samlReauthRequired), K.registerErrorHandler(l.backgroundTaskHandler), K.registerErrorHandler(l.missingRepositoryHandler), K.registerErrorHandler(l.localChangesOverwrittenHandler), K.registerErrorHandler(l.rebaseConflictsHandler), K.registerErrorHandler(l.refusedWorkflowUpdate), document.body.classList.add(`platform-${'win32'}`), K.setAppFocusState(s.remote.getCurrentWindow().isFocused()), s.ipcRenderer.on('focus', () => { + recordForkCreated() { + return this.statsStore.recordForkCreated() + } + createTutorialRepository(e) { + return this.appStore._createTutorialRepository(e) + } + async openIssueCreationPage(e) { + const t = no(e); + return null !== t && (this.statsStore.recordIssueCreationWebpageOpened(), this.appStore._openInBrowser(t + "/issues/new/choose")) + } + }(jb, Ub, Lb, Vb); + Gb.registerErrorHandler((async function (e, t) { + const n = ab(e) || e; + return await t.presentError(n), null + })), Gb.registerErrorHandler((async function (e, t) { + return e instanceof Bc ? (t.showPopup({ + type: Zi.UpstreamAlreadyExists, + repository: e.repository, + existingRemote: e.existingRemote + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = function (e) { + return e instanceof Eo ? e : null + }(e); + if (!n) return e; + const { + suggestAtom: r, + openPreferences: i + } = n.metadata; + return await t.showPopup({ + type: Zi.ExternalEditorFailed, + message: n.message, + suggestAtom: r, + openPreferences: i + }), null + })), Gb.registerErrorHandler((async function (e, t) { + return e instanceof uc ? (await t.showPopup({ + type: Zi.OpenShellFailed, + message: e.message + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (i !== Ao.GitError.MergeConflicts) return e; + const { + repository: o, + gitContext: s + } = n.metadata; + if (null == o) return e; + if (!(o instanceof Xi)) return e; + if (null == s) return e; + if ("merge" !== s.kind && "pull" !== s.kind) return e; + switch (s.kind) { + case "pull": + t.mergeConflictDetectedFromPull(); + break; + case "merge": + t.mergeConflictDetectedFromExplicitMerge() + } + const { + currentBranch: a, + theirBranch: l + } = s; + return t.showPopup({ + type: Zi.MergeConflicts, + repository: o, + ourBranch: a, + theirBranch: l + }), null + })), Gb.registerErrorHandler((async function (e, t) { + const n = lb(e); + if (!n) return e; + const r = n.result.gitError; + return r ? r !== Ao.GitError.LFSAttributeDoesNotMatch ? e : (t.showPopup({ + type: Zi.LFSAttributeMismatch + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r || null === r.result.gitError) return e; + if (!Ho(r.result.gitError)) return e; + const { + repository: i, + retryAction: o + } = n.metadata; + return i instanceof Xi && Ji(i) ? void 0 === o || o.type !== rc.Push || ji(i.gitHubRepository) ? e : (t.showCreateForkDialog(i), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e), + r = lb(null === n ? e : n.underlyingError); + if (null === r) return e; + const i = hb.exec(r.message); + return i ? (_u("schannelUnableToCheckRevocationForCertificate", e), t.showPopup({ + type: Zi.SChannelNoRevocationCheck, + url: i[1] + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (!js.has(i)) return e; + const o = n.metadata.repository; + if (!o) return e; + if (o instanceof Xi && o.gitHubRepository) return e; + const s = n.metadata.retryAction; + return s ? (await t.promptForGenericGitAuthentication(o, s), null) : (log.error("No retry action provided for a git authentication error.", n), e) + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (i !== Ao.GitError.PushNotFastForward) return e; + const o = n.metadata.repository; + return o && o instanceof Xi ? (t.showPopup({ + type: Zi.PushNeedsPull, + repository: o + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r || null === r.result.gitError) return e; + if (!Ho(r.result.gitError)) return e; + const { + repository: i + } = n.metadata; + if (!(i instanceof Xi)) return e; + if (null === i.gitHubRepository) return e; + const o = r.result.stderr.split(/\r?\n/).filter(e => e.startsWith("remote: ")).map(e => e.substr("remote: ".length)).join("\n"), + s = ub.exec(o); + if (!s) return e; + const a = s[1], + l = i.gitHubRepository.endpoint; + return t.showPopup({ + type: Zi.SAMLReauthRequired, + organizationName: a, + endpoint: l, + retryAction: n.metadata.retryAction + }), null + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + return n && n.metadata.backgroundTask ? null : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = n.metadata.repository; + if (!(r && r instanceof Xi)) return e; + if (r.missing) return null; + const i = sb(n.underlyingError), + o = lb(n.underlyingError); + return o && o.result.gitError === Ao.GitError.NotAGitRepository || i && i.code === Ao.RepositoryDoesNotExistErrorCode ? (await t.updateRepositoryMissing(r, !0), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (null === n) return e; + const r = lb(n.underlyingError); + if (null === r) return e; + const i = r.result.gitError; + if (null === i) return e; + if (i !== Ao.GitError.LocalChangesOverwritten && i !== Ao.GitError.MergeWithLocalChanges && i !== Ao.GitError.RebaseWithLocalChanges) return e; + const { + repository: o + } = n.metadata; + return o instanceof Xi ? void 0 === n.metadata.retryAction ? e : (t.showPopup({ + type: Zi.LocalChangesOverwritten, + repository: o, + retryAction: n.metadata.retryAction + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (i !== Ao.GitError.LocalChangesOverwritten) return e; + const { + repository: o, + gitContext: s + } = n.metadata; + if (null == o) return e; + if (!(o instanceof Xi)) return e; + if (void 0 === s || "checkout" !== s.kind) return t.recordErrorWhenSwitchingBranchesWithUncommmittedChanges(), e; + const { + branchToCheckout: a + } = s; + return await t.moveChangesToBranchAndCheckout(o, a), null + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (i !== Ao.GitError.RebaseConflicts) return e; + const { + repository: o, + gitContext: s + } = n.metadata; + if (null == o) return e; + if (!(o instanceof Xi)) return e; + if (null == s) return e; + if ("merge" !== s.kind && "pull" !== s.kind) return e; + const { + currentBranch: a + } = s; + return t.launchRebaseFlow(o, a), null + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + if (!lb(n.underlyingError)) return e; + const { + repository: r + } = n.metadata; + if (!(r instanceof Xi)) return e; + if (null === r.gitHubRepository) return e; + if (r.gitHubRepository.endpoint !== pt()) return e; + const i = cb.exec(e.message); + return i ? (t.showPopup({ + type: Zi.PushRejectedDueToMissingWorkflowScope, + rejectedPath: i[1], + repository: r + }), null) : e + })), document.body.classList.add("platform-win32"), Gb.setAppFocusState(r.remote.getCurrentWindow().isFocused()), r.ipcRenderer.on("focus", () => { const { selectedState: e - } = G.getState(); - e && e.type !== u.SelectionType.CloningRepository && K.refreshRepository(e.repository), K.setAppFocusState(!0) - }), s.ipcRenderer.on('blur', () => { - K.setAccessKeyHighlightState(!1), K.setAppFocusState(!1) - }), s.ipcRenderer.on('url-action', (e, { + } = jb.getState(); + e && e.type !== W.CloningRepository && Gb.refreshRepository(e.repository), Gb.setAppFocusState(!0) + }), r.ipcRenderer.on("blur", () => { + Gb.setAccessKeyHighlightState(!1), Gb.setAppFocusState(!1) + }), r.ipcRenderer.on("url-action", (e, { action: t }) => { - K.dispatchURLAction(t) - }), r.render(o.createElement(d.App, { - dispatcher: K, - appStore: G, - repositoryStateManager: U, - issuesStore: L, - gitHubUserStore: A, - startTime: R - }), document.getElementById('desktop-app-container')) + Gb.dispatchURLAction(t) + }), S.render(w.createElement(rb, { + dispatcher: Gb, + appStore: jb, + repositoryStateManager: Ub, + issuesStore: Ob, + gitHubUserStore: Pb, + startTime: Rb + }), document.getElementById("desktop-app-container")) }]); //# sourceMappingURL=renderer.js.map \ No newline at end of file diff --git a/main.js b/main.js index 79087d2..d68a46e 100644 --- a/main.js +++ b/main.js @@ -1,6904 +1,6806 @@ module.exports = function (e) { - function n(r) { - if (t[r]) return t[r].exports; - var o = t[r] = { - i: r, - l: !1, - exports: {} - }; - return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports - } - var t = {}; - return n.m = e, n.c = t, n.d = function (e, t, r) { - n.o(e, t) || Object.defineProperty(e, t, { - configurable: !1, - enumerable: !0, - get: r - }) - }, n.r = function (e) { - Object.defineProperty(e, '__esModule', { - value: !0 - }) - }, n.n = function (e) { - var t = e && e.__esModule ? function () { - return e['default'] - } : function () { - return e - }; - return n.d(t, 'a', t), t - }, n.o = function (e, n) { - return Object.prototype.hasOwnProperty.call(e, n) - }, n.p = '', n(n.s = 135) -}([function (e) { - e.exports = require('path') -}, function (e, n, t) { - function r(e) { - function n(n) { - return m.apply(e, n) - } + var t = {}; - function t() { - return this instanceof t ? (f.apply(this, arguments), this) : t.apply(Object.create(t.prototype), arguments) + function n(r) { + if (t[r]) return t[r].exports; + var i = t[r] = { + i: r, + l: !1, + exports: {} + }; + return e[r].call(i.exports, i, i.exports, n), i.l = !0, i.exports } - - function a() { - return this instanceof a ? (h.apply(this, arguments), this) : a.apply(Object.create(a.prototype), arguments) + return n.m = e, n.c = t, n.d = function (e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { + enumerable: !0, + get: r + }) + }, n.r = function (e) { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { + value: "Module" + }), Object.defineProperty(e, "__esModule", { + value: !0 + }) + }, n.t = function (e, t) { + if (1 & t && (e = n(e)), 8 & t) return e; + if (4 & t && "object" == typeof e && e && e.__esModule) return e; + var r = Object.create(null); + if (n.r(r), Object.defineProperty(r, "default", { + enumerable: !0, + value: e + }), 2 & t && "string" != typeof e) + for (var i in e) n.d(r, i, function (t) { + return e[t] + }.bind(null, i)); + return r + }, n.n = function (e) { + var t = e && e.__esModule ? function () { + return e.default + } : function () { + return e + }; + return n.d(t, "a", t), t + }, n.o = function (e, t) { + return Object.prototype.hasOwnProperty.call(e, t) + }, n.p = "", n(n.s = 121) +}([function (e, t) { + e.exports = require("electron") +}, function (e, t) { + e.exports = require("path") +}, function (e, t, n) { + var r, i, o = n(3), + s = n(83), + a = n(84), + c = n(85), + l = n(7); + "function" == typeof Symbol && "function" == typeof Symbol.for ? (r = Symbol.for("graceful-fs.queue"), i = Symbol.for("graceful-fs.previous")) : (r = "___graceful-fs.queue", i = "___graceful-fs.previous"); + var u = function () {}; + if (l.debuglog ? u = l.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (u = function () { + var e = l.format.apply(l, arguments); + e = "GFS4: " + e.split(/\n/).join("\nGFS4: "), console.error(e) + }), !global[r]) { + var f = []; + Object.defineProperty(global, r, { + get: function () { + return f + } + }), o.close = function (e) { + function t(t, n) { + return e.call(o, t, (function (e) { + e || d(), "function" == typeof n && n.apply(this, arguments) + })) + } + return Object.defineProperty(t, i, { + value: e + }), t + }(o.close), o.closeSync = function (e) { + function t(t) { + e.apply(o, arguments), d() + } + return Object.defineProperty(t, i, { + value: e + }), t + }(o.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", (function () { + u(global[r]), n(27).equal(global[r].length, 0) + })) } - function l(e, n, t, r) { - function a(e, n, t, r) { - return b(e, n, t, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? o([a, [e, n, t, r]]) : ('function' == typeof r && r.apply(this, arguments), i()) - }) - } - return 'function' == typeof t && (r = t, t = null), a(e, n, t, r) + function h(e) { + s(e), e.gracefulify = h, e.createReadStream = function (t, n) { + return new e.ReadStream(t, n) + }, e.createWriteStream = function (t, n) { + return new e.WriteStream(t, n) + }; + var t = e.readFile; + e.readFile = function (e, n, r) { + "function" == typeof n && (r = n, n = null); + return function e(n, r, i) { + return t(n, r, (function (t) { + !t || "EMFILE" !== t.code && "ENFILE" !== t.code ? ("function" == typeof i && i.apply(this, arguments), d()) : p([e, [n, r, i]]) + })) + }(e, n, r) + }; + var n = e.writeFile; + e.writeFile = function (e, t, r, i) { + "function" == typeof r && (i = r, r = null); + return function e(t, r, i, o) { + return n(t, r, i, (function (n) { + !n || "EMFILE" !== n.code && "ENFILE" !== n.code ? ("function" == typeof o && o.apply(this, arguments), d()) : p([e, [t, r, i, o]]) + })) + }(e, t, r, i) + }; + var r = e.appendFile; + r && (e.appendFile = function (e, t, n, i) { + "function" == typeof n && (i = n, n = null); + return function e(t, n, i, o) { + return r(t, n, i, (function (r) { + !r || "EMFILE" !== r.code && "ENFILE" !== r.code ? ("function" == typeof o && o.apply(this, arguments), d()) : p([e, [t, n, i, o]]) + })) + }(e, t, n, i) + }); + var i = e.readdir; + + function o(t) { + return i.apply(e, t) + } + if (e.readdir = function (e, t, n) { + var r = [e]; + "function" != typeof t ? r.push(t) : n = t; + return r.push((function (e, t) { + t && t.sort && t.sort(); + !e || "EMFILE" !== e.code && "ENFILE" !== e.code ? ("function" == typeof n && n.apply(this, arguments), d()) : p([o, [r]]) + })), o(r) + }, "v0.8" === process.version.substr(0, 4)) { + var c = a(e); + g = c.ReadStream, y = c.WriteStream + } + var l = e.ReadStream; + l && (g.prototype = Object.create(l.prototype), g.prototype.open = function () { + var e = this; + w(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.autoClose && e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n), e.read()) + })) + }); + var u = e.WriteStream; + u && (y.prototype = Object.create(u.prototype), y.prototype.open = function () { + var e = this; + w(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n)) + })) + }), Object.defineProperty(e, "ReadStream", { + get: function () { + return g + }, + set: function (e) { + g = e + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(e, "WriteStream", { + get: function () { + return y + }, + set: function (e) { + y = e + }, + enumerable: !0, + configurable: !0 + }); + var f = g; + Object.defineProperty(e, "FileReadStream", { + get: function () { + return f + }, + set: function (e) { + f = e + }, + enumerable: !0, + configurable: !0 + }); + var m = y; + + function g(e, t) { + return this instanceof g ? (l.apply(this, arguments), this) : g.apply(Object.create(g.prototype), arguments) + } + + function y(e, t) { + return this instanceof y ? (u.apply(this, arguments), this) : y.apply(Object.create(y.prototype), arguments) + } + Object.defineProperty(e, "FileWriteStream", { + get: function () { + return m + }, + set: function (e) { + m = e + }, + enumerable: !0, + configurable: !0 + }); + var v = e.open; + + function w(e, t, n, r) { + return "function" == typeof n && (r = n, n = null), + function e(t, n, r, i) { + return v(t, n, r, (function (o, s) { + !o || "EMFILE" !== o.code && "ENFILE" !== o.code ? ("function" == typeof i && i.apply(this, arguments), d()) : p([e, [t, n, r, i]]) + })) + }(e, t, n, r) + } + return e.open = w, e } - s(e), e.gracefulify = r, e.createReadStream = function (n, t) { - return new e.ReadStream(n, t) - }, e.createWriteStream = function (n, t) { - return new e.WriteStream(n, t) - }; - var c = e.readFile; - e.readFile = function (e, n, t) { - function r(e, n, t) { - return c(e, n, function (a) { - a && ('EMFILE' === a.code || 'ENFILE' === a.code) ? o([r, [e, n, t]]) : ('function' == typeof t && t.apply(this, arguments), i()) - }) - } - return 'function' == typeof n && (t = n, n = null), r(e, n, t) - }; - var p = e.writeFile; - e.writeFile = function (e, n, t, r) { - function a(e, n, t, r) { - return p(e, n, t, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? o([a, [e, n, t, r]]) : ('function' == typeof r && r.apply(this, arguments), i()) + + function p(e) { + u("ENQUEUE", e[0].name, e[1]), global[r].push(e) + } + + function d() { + var e = global[r].shift(); + e && (u("RETRY", e[0].name, e[1]), e[0].apply(null, e[1])) + } + e.exports = h(c(o)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !o.__patched && (e.exports = h(o), o.__patched = !0) +}, function (e, t) { + e.exports = require("fs") +}, function (e, t, n) { + "use strict"; + e.exports = Object.assign({}, n(33), n(35), n(39), n(90), n(92), n(98), n(6), n(104), n(105), n(106), n(8), n(21)); + const r = n(3); + Object.getOwnPropertyDescriptor(r, "promises") && Object.defineProperty(e.exports, "promises", { + get: () => r.promises + }) +}, function (e, t, n) { + "use strict"; + t.fromCallback = function (e) { + return Object.defineProperty((function () { + if ("function" != typeof arguments[arguments.length - 1]) return new Promise((t, n) => { + arguments[arguments.length] = (e, r) => { + if (e) return n(e); + t(r) + }, arguments.length++, e.apply(this, arguments) + }); + e.apply(this, arguments) + }), "name", { + value: e.name }) - } - return 'function' == typeof t && (r = t, t = null), a(e, n, t, r) - }; - var u = e.appendFile; - u && (e.appendFile = function (e, n, t, r) { - function a(e, n, t, r) { - return u(e, n, t, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? o([a, [e, n, t, r]]) : ('function' == typeof r && r.apply(this, arguments), i()) + }, t.fromPromise = function (e) { + return Object.defineProperty((function () { + const t = arguments[arguments.length - 1]; + if ("function" != typeof t) return e.apply(this, arguments); + e.apply(this, arguments).then(e => t(null, e), t) + }), "name", { + value: e.name }) - } - return 'function' == typeof t && (r = t, t = null), a(e, n, t, r) - }); - var m = e.readdir; - if (e.readdir = function (e, t, r) { - function a(e, t) { - t && t.sort && t.sort(), e && ('EMFILE' === e.code || 'ENFILE' === e.code) ? o([n, [s]]) : ('function' == typeof r && r.apply(this, arguments), i()) - } - var s = [e]; - return 'function' == typeof t ? r = t : s.push(t), s.push(a), n(s) - }, 'v0.8' === process.version.substr(0, 4)) { - var g = d(e); - t = g.ReadStream, a = g.WriteStream - } - var f = e.ReadStream; - f && (t.prototype = Object.create(f.prototype), t.prototype.open = function () { - var e = this; - l(e.path, e.flags, e.mode, function (n, t) { - n ? (e.autoClose && e.destroy(), e.emit('error', n)) : (e.fd = t, e.emit('open', t), e.read()) - }) - }); - var h = e.WriteStream; - h && (a.prototype = Object.create(h.prototype), a.prototype.open = function () { - var e = this; - l(e.path, e.flags, e.mode, function (n, t) { - n ? (e.destroy(), e.emit('error', n)) : (e.fd = t, e.emit('open', t)) - }) - }), Object.defineProperty(e, 'ReadStream', { - get: function () { - return t - }, - set: function (e) { - t = e - }, - enumerable: !0, - configurable: !0 - }), Object.defineProperty(e, 'WriteStream', { - get: function () { - return a - }, - set: function (e) { - a = e - }, - enumerable: !0, - configurable: !0 - }); - var y = t; - Object.defineProperty(e, 'FileReadStream', { - get: function () { - return y - }, - set: function (e) { - y = e - }, - enumerable: !0, - configurable: !0 - }); - var _ = a; - Object.defineProperty(e, 'FileWriteStream', { - get: function () { - return _ - }, - set: function (e) { - _ = e - }, - enumerable: !0, - configurable: !0 + } +}, function (e, t, n) { + "use strict"; + const r = (0, n(5).fromCallback)(n(87)), + i = n(88); + e.exports = { + mkdirs: r, + mkdirsSync: i, + mkdirp: r, + mkdirpSync: i, + ensureDir: r, + ensureDirSync: i + } +}, function (e, t) { + e.exports = require("util") +}, function (e, t, n) { + "use strict"; + const r = n(5).fromPromise, + i = n(33); + e.exports = { + pathExists: r((function (e) { + return i.access(e).then(() => !0).catch(() => !1) + })), + pathExistsSync: i.existsSync + } +}, function (e, t) { + e.exports = require("os") +}, function (e, t, n) { + var r = t; + r.version = n(55).version, r.transports = n(56); + var i = n(12); + r.hash = i.hash, r.clone = i.clone, r.longestElement = i.longestElement, r.exception = n(32), r.config = n(26), r.addColors = r.config.addColors, r.Container = n(81).Container, r.Logger = n(82).Logger, r.Transport = n(16).Transport, r.loggers = new r.Container; + var o = new r.Logger({ + transports: [new r.transports.Console] }); - var b = e.open; - return e.open = l, e - } - - function o(e) { - m('ENQUEUE', e[0].name, e[1]), global[p].push(e) - } - - function i() { - var e = global[p].shift(); - e && (m('RETRY', e[0].name, e[1]), e[0].apply(null, e[1])) - } - var a = t(5), - s = t(105), - d = t(103), - l = t(102), - c = t(6), - p, u; - 'function' == typeof Symbol && 'function' == typeof Symbol.for ? (p = Symbol.for('graceful-fs.queue'), u = Symbol.for('graceful-fs.previous')) : (p = '___graceful-fs.queue', u = '___graceful-fs.previous'); - var m = function () {}; - if (c.debuglog ? m = c.debuglog('gfs4') : /\bgfs4\b/i.test(process.env.NODE_DEBUG || '') && (m = function () { - var e = c.format.apply(c, arguments); - e = 'GFS4: ' + e.split(/\n/).join('\nGFS4: '), console.error(e) - }), !global[p]) { - var g = []; - Object.defineProperty(global, p, { - get: function () { - return g - } - }), a.close = function (e) { - function n(n, t) { - return e.call(a, n, function (e) { - e || i(), 'function' == typeof t && t.apply(this, arguments) + i.setLevels(r, null, o.levels), ["log", "query", "stream", "add", "remove", "clear", "profile", "startTimer", "extend", "cli", "handleExceptions", "unhandleExceptions", "configure"].forEach((function (e) { + r[e] = function () { + return o[e].apply(o, arguments) + } + })), r.cli = function () { + return r.padLevels = !0, i.setLevels(r, o.levels, r.config.cli.levels), o.setLevels(r.config.cli.levels), r.config.addColors(r.config.cli.colors), o.transports.console && (o.transports.console.colorize = !0, o.transports.console.timestamp = !1), r + }, r.setLevels = function (e) { + i.setLevels(r, o.levels, e), o.setLevels(e) + }, Object.defineProperty(r, "level", { + get: function () { + return o.level + }, + set: function (e) { + o.level = e, Object.keys(o.transports).forEach((function (t) { + o.transports[t].level = e + })) + } + }), ["emitErrs", "exitOnError", "padLevels", "levelLength", "stripColors"].forEach((function (e) { + Object.defineProperty(r, e, { + get: function () { + return o[e] + }, + set: function (t) { + o[e] = t + } }) - } - return Object.defineProperty(n, u, { - value: e - }), n - }(a.close), a.closeSync = function (e) { - function n() { - e.apply(a, arguments), i() - } - return Object.defineProperty(n, u, { - value: e - }), n - }(a.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || '') && process.on('exit', function () { - m(global[p]), t(42).equal(global[p].length, 0) - }) - } - e.exports = r(l(a)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !a.__patched && (e.exports = r(a), a.__patched = !0) -}, function (e, n) { - 'use strict'; - n.fromCallback = function (e) { - return Object.defineProperty(function () { - return 'function' == typeof arguments[arguments.length - 1] ? void e.apply(this, arguments) : new Promise((n, t) => { - arguments[arguments.length] = (e, r) => e ? t(e) : void n(r), arguments.length++, e.apply(this, arguments) - }) - }, 'name', { - value: e.name - }) - }, n.fromPromise = function (e) { - return Object.defineProperty(function () { - const n = arguments[arguments.length - 1]; - return 'function' == typeof n ? void e.apply(this, arguments).then((e) => n(null, e), n) : e.apply(this, arguments) - }, 'name', { - value: e.name + })), Object.defineProperty(r, "default", { + get: function () { + return { + transports: o.transports, + exceptionHandlers: o.exceptionHandlers + } + } }) - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = r(t(100)), - i = t(99); - e.exports = { - mkdirs: o, - mkdirsSync: i, - mkdirp: o, - mkdirpSync: i, - ensureDir: o, - ensureDirSync: i - } -}, function (e) { - e.exports = require('electron') -}, function (e) { - e.exports = require('fs') -}, function (e) { - e.exports = require('util') -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromPromise, - o = t(43); - e.exports = { - pathExists: r(function (e) { - return o.access(e).then(() => !0).catch(() => !1) - }), - pathExistsSync: o.existsSync - } -}, function (e) { - e.exports = require('stream') -}, function (e, n, t) { - var r = t(6), - o = t(130), - i = t(129), - a = t(5), - s = t(128).StringDecoder, - d = t(8).Stream, - l = t(21); - n.setLevels = function (e, t, r) { - this; - return t && Object.keys(t).forEach(function (n) { - delete e[n] - }), e.levels = r || l.npm.levels, e.padLevels && (e.levelLength = n.longestElement(Object.keys(e.levels))), Object.keys(e.levels).forEach(function (n) { - return 'log' === n ? void console.warn('Log level named "log" will clash with the method "log". Consider using a different name.') : void(e[n] = function () { - var t = [n].concat(Array.prototype.slice.call(arguments)); - e.log.apply(e, t) - }) - }), e - }, n.longestElement = function (e) { - return Math.max.apply(null, e.map(function (e) { - return e.length +}, function (e, t) { + e.exports = require("stream") +}, function (e, t, n) { + var r = n(7), + i = n(58), + o = n(59), + s = n(3), + a = n(60).StringDecoder, + c = n(11).Stream, + l = n(26); + t.setLevels = function (e, n, r, i) { + return n && Object.keys(n).forEach((function (t) { + delete e[t] + })), e.levels = r || l.npm.levels, e.padLevels && (e.levelLength = t.longestElement(Object.keys(e.levels))), Object.keys(e.levels).forEach((function (t) { + "log" !== t ? e[t] = function (n) { + var r = [t].concat(Array.prototype.slice.call(arguments)); + e.log.apply(e, r) + } : console.warn('Log level named "log" will clash with the method "log". Consider using a different name.') + })), e + }, t.longestElement = function (e) { + return Math.max.apply(null, e.map((function (e) { + return e.length + }))) + }, t.clone = function (e) { + var n = {}; + if (e instanceof Error) return n = { + message: e.message + }, Object.getOwnPropertyNames(e).forEach((function (t) { + n[t] = e[t] + })), n; + if (!(e instanceof Object)) return e; + if (e instanceof Date) return new Date(e.getTime()); + for (var r in e) Array.isArray(e[r]) || e[r] instanceof Buffer ? n[r] = e[r].slice(0) : "function" != typeof e[r] ? n[r] = e[r] instanceof Object ? t.clone(e[r]) : e[r] : "function" == typeof e[r] && (n[r] = e[r]); + return n + }, t.log = function (e) { + var n, i = "function" == typeof e.timestamp ? e.timestamp : t.timestamp, + s = e.timestamp ? i() : null, + a = void 0 === e.showLevel || e.showLevel, + c = null === e.meta || void 0 === e.meta || e.meta instanceof Error ? e.meta || null : t.clone(o.decycle(e.meta)); + if (e.raw) return "object" != typeof c && null != c && (c = { + meta: c + }), (n = t.clone(c) || {}).level = e.level, n.message = e.message.stripColors ? e.message.stripColors : e.message, JSON.stringify(n); + if (e.json || !0 === e.logstash) { + if ("object" != typeof c && null != c && (c = { + meta: c + }), (n = t.clone(c) || {}).level = e.level, n.message = n.message || "", e.label && (n.label = e.label), e.message && (n.message = e.message), s && (n.timestamp = s), !0 === e.logstash) { + var u = {}; + void 0 !== n.message && (u["@message"] = n.message, delete n.message), void 0 !== n.timestamp && (u["@timestamp"] = n.timestamp, delete n.timestamp), u["@fields"] = t.clone(n), n = u + } + return "function" == typeof e.stringify ? e.stringify(n) : JSON.stringify(n, (function (e, t) { + return t instanceof Buffer ? t.toString("base64") : t + })) + } + if ("function" == typeof e.formatter) return e.meta = c, String(e.formatter(t.clone(e))); + if (n = s ? s + " - " : "", a && (n += "all" === e.colorize || "level" === e.colorize || !0 === e.colorize ? l.colorize(e.level) : e.level), n += e.align ? "\t" : "", n += s || a ? ": " : "", n += e.label ? "[" + e.label + "] " : "", n += "all" === e.colorize || "message" === e.colorize ? l.colorize(e.level, e.message) : e.message, null != c) + if (c && c instanceof Error && c.stack && (c = c.stack), "object" != typeof c) n += " " + c; + else if (Object.keys(c).length > 0) + if ("function" == typeof e.prettyPrint) n += " " + e.prettyPrint(c); + else if (e.prettyPrint) n += " \n" + r.inspect(c, !1, e.depth || null, e.colorize); + else if (e.humanReadableUnhandledException && 5 === Object.keys(c).length && c.hasOwnProperty("date") && c.hasOwnProperty("process") && c.hasOwnProperty("os") && c.hasOwnProperty("trace") && c.hasOwnProperty("stack")) { + var f = c.stack; + delete c.stack, delete c.trace, n += " " + t.serialize(c), f && (n += "\n" + f.join("\n")) + } else n += " " + t.serialize(c); + return n + }, t.capitalize = function (e) { + return e && e[0].toUpperCase() + e.slice(1) + }, t.hash = function (e) { + return i.createHash("sha1").update(e).digest("hex") + }, t.pad = function (e) { + return e < 10 ? "0" + e.toString(10) : e.toString(10) + }, t.timestamp = function () { + return (new Date).toISOString() + }, t.serialize = function (e, n) { + if ("symbol" == typeof n && (n = n.toString()), "symbol" == typeof e && (e = e.toString()), null === e ? e = "null" : void 0 === e ? e = "undefined" : !1 === e && (e = "false"), "object" != typeof e) return n ? n + "=" + e : e; + if (e instanceof Buffer) return n ? n + "=" + e.toString("base64") : e.toString("base64"); + for (var r = "", i = Object.keys(e), o = i.length, s = 0; s < o; s++) { + if (Array.isArray(e[i[s]])) { + r += i[s] + "=["; + for (var a = 0, c = e[i[s]].length; a < c; a++) r += t.serialize(e[i[s]][a]), a < c - 1 && (r += ", "); + r += "]" + } else e[i[s]] instanceof Date ? r += i[s] + "=" + e[i[s]] : r += t.serialize(e[i[s]], i[s]); + s < o - 1 && (r += ", ") + } + return r + }, t.tailFile = function (e, t) { + var n = new Buffer(65536), + r = new a("utf8"), + i = new c, + o = "", + l = 0, + u = 0; + return -1 === e.start && delete e.start, i.readable = !0, i.destroy = function () { + i.destroyed = !0, i.emit("end"), i.emit("close") + }, s.open(e.file, "a+", "0644", (function (a, c) { + if (a) return t ? t(a) : i.emit("error", a), void i.destroy(); + ! function a() { + if (!i.destroyed) return s.read(c, n, 0, n.length, l, (function (s, c) { + if (s) return t ? t(s) : i.emit("error", s), void i.destroy(); + if (!c) return o && ((null == e.start || u > e.start) && (t ? t(null, o) : i.emit("line", o)), u++, o = ""), setTimeout(a, 1e3); + var f = r.write(n.slice(0, c)); + t || i.emit("data", f); + for (var h = (f = (o + f).split(/\n+/)).length - 1, p = 0; p < h; p++)(null == e.start || u > e.start) && (t ? t(null, f[p]) : i.emit("line", f[p])), u++; + return o = f[h], l += c, a() + })); + s.close(c) + }() + })), t ? i.destroy : i + }, t.stringArrayToSet = function (e, t) { + return void 0 === t && (t = "Cannot make set from Array with non-string elements"), e.reduce((function (e, n) { + if (!("string" == typeof n || n instanceof String)) throw new Error(t); + return e[n] = !0, e + }), Object.create(null)) + } +}, function (e, t, n) { + "use strict"; + var r = n(49); + n.d(t, "buildDefaultMenu", (function () { + return r.a + })); + n(22); + var i = n(46); + n.o(i, "getAllMenuItems") && n.d(t, "getAllMenuItems", (function () { + return i.getAllMenuItems + })), n.o(i, "setCrashMenu") && n.d(t, "setCrashMenu", (function () { + return i.setCrashMenu + })); + var o = n(47); + n.d(t, "setCrashMenu", (function () { + return o.a + })); + var s = n(48); + n.d(t, "getAllMenuItems", (function () { + return s.a })) - }, n.clone = function (e) { - var t = {}; - if (e instanceof Error) return t = { - message: e.message - }, Object.getOwnPropertyNames(e).forEach(function (n) { - t[n] = e[n] - }), t; - if (!(e instanceof Object)) return e; - if (e instanceof Date) return new Date(e.getTime()); - for (var r in e) Array.isArray(e[r]) ? t[r] = e[r].slice(0) : e[r] instanceof Buffer ? t[r] = e[r].slice(0) : 'function' == typeof e[r] ? 'function' == typeof e[r] && (t[r] = e[r]) : t[r] = e[r] instanceof Object ? n.clone(e[r]) : e[r]; - return t - }, n.log = function (e) { - var t = 'function' == typeof e.timestamp ? e.timestamp : n.timestamp, - o = e.timestamp ? t() : null, - a = void 0 === e.showLevel || e.showLevel, - s = null === e.meta || void 0 === e.meta || e.meta instanceof Error ? e.meta || null : n.clone(i.decycle(e.meta)), - d; - if (e.raw) return 'object' != typeof s && null != s && (s = { - meta: s - }), d = n.clone(s) || {}, d.level = e.level, d.message = e.message.stripColors ? e.message.stripColors : e.message, JSON.stringify(d); - if (e.json || !0 === e.logstash) { - if ('object' != typeof s && null != s && (s = { - meta: s - }), d = n.clone(s) || {}, d.level = e.level, d.message = d.message || '', e.label && (d.label = e.label), e.message && (d.message = e.message), o && (d.timestamp = o), !0 === e.logstash) { - var c = {}; - void 0 !== d.message && (c['@message'] = d.message, delete d.message), void 0 !== d.timestamp && (c['@timestamp'] = d.timestamp, delete d.timestamp), c['@fields'] = n.clone(d), d = c - } - return 'function' == typeof e.stringify ? e.stringify(d) : JSON.stringify(d, function (e, n) { - return n instanceof Buffer ? n.toString('base64') : n - }) - } - if ('function' == typeof e.formatter) return e.meta = s, e.formatter(n.clone(e)) + ''; - if (d = o ? o + ' - ' : '', a && (d += 'all' === e.colorize || 'level' === e.colorize || !0 === e.colorize ? l.colorize(e.level) : e.level), d += e.align ? '\t' : '', d += o || a ? ': ' : '', d += e.label ? '[' + e.label + '] ' : '', d += 'all' === e.colorize || 'message' === e.colorize ? l.colorize(e.level, e.message) : e.message, null !== s && void 0 !== s) - if (s && s instanceof Error && s.stack && (s = s.stack), 'object' != typeof s) d += ' ' + s; - else if (0 < Object.keys(s).length) - if ('function' == typeof e.prettyPrint) d += ' ' + e.prettyPrint(s); - else if (e.prettyPrint) d += ' \n' + r.inspect(s, !1, e.depth || null, e.colorize); - else if (e.humanReadableUnhandledException && 5 === Object.keys(s).length && s.hasOwnProperty('date') && s.hasOwnProperty('process') && s.hasOwnProperty('os') && s.hasOwnProperty('trace') && s.hasOwnProperty('stack')) { - var p = s.stack; - delete s.stack, delete s.trace, d += ' ' + n.serialize(s), p && (d += '\n' + p.join('\n')) - } else d += ' ' + n.serialize(s); - return d - }, n.capitalize = function (e) { - return e && e[0].toUpperCase() + e.slice(1) - }, n.hash = function (e) { - return o.createHash('sha1').update(e).digest('hex') - }, n.pad = function (e) { - return 10 > e ? '0' + e.toString(10) : e.toString(10) - }, n.timestamp = function () { - return new Date().toISOString() - }, n.serialize = function (e, t) { - if ('symbol' == typeof t && (t = t.toString()), 'symbol' == typeof e && (e = e.toString()), null === e ? e = 'null' : void 0 === e ? e = 'undefined' : !1 === e && (e = 'false'), 'object' != typeof e) return t ? t + '=' + e : e; - if (e instanceof Buffer) return t ? t + '=' + e.toString('base64') : e.toString('base64'); - for (var r = '', o = Object.keys(e), a = o.length, s = 0; s < a; s++) { - if (Array.isArray(e[o[s]])) { - r += o[s] + '=['; - for (var i = 0, d = e[o[s]].length; i < d; i++) r += n.serialize(e[o[s]][i]), i < d - 1 && (r += ', '); - r += ']' - } else r += e[o[s]] instanceof Date ? o[s] + '=' + e[o[s]] : n.serialize(e[o[s]], o[s]); - s < a - 1 && (r += ', ') - } - return r - }, n.tailFile = function (e, n) { - var t = new Buffer(65536), - r = new s('utf8'), - o = new d, - c = '', - p = 0, - u = 0; - return -1 === e.start && delete e.start, o.readable = !0, o.destroy = function () { - o.destroyed = !0, o.emit('end'), o.emit('close') - }, a.open(e.file, 'a+', '0644', function (i, s) { - return i ? (n ? n(i) : o.emit('error', i), void o.destroy()) : void - function d() { - return o.destroyed ? void a.close(s) : a.read(s, t, 0, t.length, p, function (a, s) { - if (a) return n ? n(a) : o.emit('error', a), void o.destroy(); - if (!s) return c && ((null == e.start || u > e.start) && (n ? n(null, c) : o.emit('line', c)), u++, c = ''), setTimeout(d, 1e3); - var m = r.write(t.slice(0, s)); - n || o.emit('data', m); - for (var m = (c + m).split(/\n+/), g = m.length - 1, l = 0; l < g; l++)(null == e.start || u > e.start) && (n ? n(null, m[l]) : o.emit('line', m[l])), u++; - return c = m[g], p += s, d() - }) - }() - }), n ? o.destroy : o - }, n.stringArrayToSet = function (e, n) { - return 'undefined' == typeof n && (n = 'Cannot make set from Array with non-string elements'), e.reduce(function (e, t) { - if (!('string' == typeof t || t instanceof String)) throw new Error(n); - return e[t] = !0, e - }, Object.create(null)) - } -}, function (e) { - e.exports = require('os') -}, function (e, n) { - function t(e, n, t) { - if (n in e) return e[n]; - if (3 === arguments.length) return t; - throw new Error('"' + n + '" is a required argument.') - } - - function r(e) { - var n = e.match(l); - return n ? { - scheme: n[1], - auth: n[2], - host: n[3], - port: n[4], - path: n[5] - } : null - } - - function o(e) { - var n = ''; - return e.scheme && (n += e.scheme + ':'), n += '//', e.auth && (n += e.auth + '@'), e.host && (n += e.host), e.port && (n += ':' + e.port), e.path && (n += e.path), n - } - - function i(e) { - var t = e, - a = r(e); - if (a) { - if (!a.path) return e; - t = a.path - } - for (var s = n.isAbsolute(t), d = t.split(/\/+/), l = 0, c = d.length - 1, i; 0 <= c; c--) i = d[c], '.' === i ? d.splice(c, 1) : '..' === i ? l++ : 0 < l && ('' === i ? (d.splice(c + 1, l), l = 0) : (d.splice(c, 2), l--)); - return t = d.join('/'), '' === t && (t = s ? '/' : '.'), a ? (a.path = t, o(a)) : t - } - - function a(e) { - return e - } - - function s(e) { - if (!e) return !1; - var n = e.length; - if (9 > n) return !1; - if (95 !== e.charCodeAt(n - 1) || 95 !== e.charCodeAt(n - 2) || 111 !== e.charCodeAt(n - 3) || 116 !== e.charCodeAt(n - 4) || 111 !== e.charCodeAt(n - 5) || 114 !== e.charCodeAt(n - 6) || 112 !== e.charCodeAt(n - 7) || 95 !== e.charCodeAt(n - 8) || 95 !== e.charCodeAt(n - 9)) return !1; - for (var t = n - 10; 0 <= t; t--) - if (36 !== e.charCodeAt(t)) return !1; - return !0 - } - - function d(e, n) { - return e === n ? 0 : e > n ? 1 : -1 - } - n.getArg = t; - var l = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/, - c = /^data:.+\,.+$/; - n.urlParse = r, n.urlGenerate = o, n.normalize = i, n.join = function (e, n) { - '' === e && (e = '.'), '' === n && (n = '.'); - var t = r(n), - a = r(e); - if (a && (e = a.path || '/'), t && !t.scheme) return a && (t.scheme = a.scheme), o(t); - if (t || n.match(c)) return n; - if (a && !a.host && !a.path) return a.host = n, o(a); - var s = '/' === n.charAt(0) ? n : i(e.replace(/\/+$/, '') + '/' + n); - return a ? (a.path = s, o(a)) : s - }, n.isAbsolute = function (e) { - return '/' === e.charAt(0) || !!e.match(l) - }, n.relative = function (e, n) { - '' === e && (e = '.'), e = e.replace(/\/$/, ''); - for (var t = 0, r; 0 !== n.indexOf(e + '/');) { - if (r = e.lastIndexOf('/'), 0 > r) return n; - if (e = e.slice(0, r), e.match(/^([^\/]+:\/)?\/*$/)) return n; - ++t - } - return Array(t + 1).join('../') + n.substr(e.length + 1) - }; - var p = function () { - var e = Object.create(null); - return !('__proto__' in e) - }(); - n.toSetString = p ? a : function (e) { - return s(e) ? '$' + e : e - }, n.fromSetString = p ? a : function (e) { - return s(e) ? e.slice(1) : e - }, n.compareByOriginalPositions = function (e, n, t) { - var r = e.source - n.source; - return 0 == r ? (r = e.originalLine - n.originalLine, 0 != r) ? r : (r = e.originalColumn - n.originalColumn, 0 != r || t) ? r : (r = e.generatedColumn - n.generatedColumn, 0 != r) ? r : (r = e.generatedLine - n.generatedLine, 0 == r ? e.name - n.name : r) : r - }, n.compareByGeneratedPositionsDeflated = function (e, n, t) { - var r = e.generatedLine - n.generatedLine; - return 0 == r ? (r = e.generatedColumn - n.generatedColumn, 0 != r || t) ? r : (r = e.source - n.source, 0 != r) ? r : (r = e.originalLine - n.originalLine, 0 != r) ? r : (r = e.originalColumn - n.originalColumn, 0 == r ? e.name - n.name : r) : r - }, n.compareByGeneratedPositionsInflated = function (e, n) { - var t = e.generatedLine - n.generatedLine; - return 0 === t ? (t = e.generatedColumn - n.generatedColumn, 0 !== t) ? t : (t = d(e.source, n.source), 0 !== t) ? t : (t = e.originalLine - n.originalLine, 0 !== t) ? t : (t = e.originalColumn - n.originalColumn, 0 === t ? d(e.name, n.name) : t) : t - } -}, function (e, n, t) { - var r = t(14), - o = t(6), - i = n.Transport = function (e) { - r.EventEmitter.call(this), e = e || {}, this.silent = e.silent || !1, this.raw = e.raw || !1, this.name = e.name || this.name, this.formatter = e.formatter, this.level = e.level, this.handleExceptions = e.handleExceptions || !1, this.exceptionsLevel = e.exceptionsLevel || 'error', this.humanReadableUnhandledException = e.humanReadableUnhandledException || !1 +}, function (e, t) { + e.exports = require("events") +}, function (e, t, n) { + var r = {}; + e.exports = r, r.themes = {}; + var i = r.styles = n(62), + o = Object.defineProperties; + r.supportsColor = n(63), void 0 === r.enabled && (r.enabled = r.supportsColor), r.stripColors = r.strip = function (e) { + return ("" + e).replace(/\x1B\[\d+m/g, "") }; - o.inherits(i, r.EventEmitter), i.prototype.formatQuery = function (e) { - return e - }, i.prototype.normalizeQuery = function (e) { - return e = e || {}, e.rows = e.rows || e.limit || 10, e.start = e.start || 0, e.until = e.until || new Date, 'object' != typeof e.until && (e.until = new Date(e.until)), e.from = e.from || e.until - 86400000, 'object' != typeof e.from && (e.from = new Date(e.from)), e.order = e.order || 'desc', e.fields = e.fields, e - }, i.prototype.formatResults = function (e) { - return e - }, i.prototype.logException = function (e, n, t) { - function r() { - i || (i = !0, o.removeListener('logged', r), o.removeListener('error', r), t()) - } - var o = this, - i; - return this.silent ? t() : void(this.once('logged', r), this.once('error', r), this.log(o.exceptionsLevel, e, n, function () {})) - } -}, function (e, n, t) { - function r(e) { - var n = function e() { - return o.apply(e, arguments) + r.stylize = function (e, t) { + return i[t].open + e + i[t].close }; - return n._styles = e, n.__proto__ = m, n - } - - function o() { - var e = arguments, - n = e.length, - t = 0 !== n && arguments[0] + ''; - if (1 < n) - for (var r = 1; r < n; r++) t += ' ' + e[r]; - if (!s.enabled || !t) return t; - for (var o = this._styles, d = o.length, i; d--;) i = a[o[d]], t = i.open + t.replace(i.closeRe, i.open) + i.close; - return t - } - - function i(e) { - for (var n in e)(function (n) { - s[n] = function (t) { - return s[e[n]](t) - } - })(n) - } - var s = {}; - e.exports = s, s.themes = {}; - var a = s.styles = t(126), - d = Object.defineProperties; - s.supportsColor = t(125), 'undefined' == typeof s.enabled && (s.enabled = s.supportsColor), s.stripColors = s.strip = function (e) { - return ('' + e).replace(/\x1B\[\d+m/g, '') - }; - var l = s.stylize = function (e, n) { - return a[n].open + e + a[n].close - }, - c = /[|\\{}()[\]^$+*?.]/g, - p = function (e) { - if ('string' != typeof e) throw new TypeError('Expected a string'); - return e.replace(c, '\\$&') - }, - u = function () { - var e = {}; - return a.grey = a.gray, Object.keys(a).forEach(function (n) { - a[n].closeRe = new RegExp(p(a[n].close), 'g'), e[n] = { - get: function () { - return r(this._styles.concat(n)) - } - } - }), e - }(), - m = d(function () {}, u); - s.setTheme = function (e) { - if ('string' == typeof e) try { - return s.themes[e] = t(124)(e), i(s.themes[e]), s.themes[e] - } catch (e) { - return console.log(e), e - } else i(e) - }; - var g = function (e, n) { - var t = n.split(''); - return t = t.map(e), t.join('') - }; - for (var f in s.trap = t(123), s.zalgo = t(122), s.maps = {}, s.maps.america = t(121), s.maps.zebra = t(120), s.maps.rainbow = t(119), s.maps.random = t(118), s.maps)(function (e) { - s[e] = function (n) { - return g(s.maps[e], n) - } - })(f); - d(s, function () { - var e = {}; - return Object.keys(u).forEach(function (n) { - e[n] = { - get: function () { - return r([n]) + var s = /[|\\{}()[\]^$+*?.]/g; + + function a(e) { + var t = function e() { + return f.apply(e, arguments) + }; + return t._styles = e, t.__proto__ = u, t + } + var c, l = (c = {}, i.grey = i.gray, Object.keys(i).forEach((function (e) { + i[e].closeRe = new RegExp(function (e) { + if ("string" != typeof e) throw new TypeError("Expected a string"); + return e.replace(s, "\\$&") + }(i[e].close), "g"), c[e] = { + get: function () { + return a(this._styles.concat(e)) + } + } + })), c), + u = o((function () {}), l); + + function f() { + var e = arguments, + t = e.length, + n = 0 !== t && String(arguments[0]); + if (t > 1) + for (var o = 1; o < t; o++) n += " " + e[o]; + if (!r.enabled || !n) return n; + for (var s = this._styles, a = s.length; a--;) { + var c = i[s[a]]; + n = c.open + n.replace(c.closeRe, c.open) + c.close } - } - }), e - }()) -}, function (e) { - e.exports = require('events') -}, function (e, n, t) { - var r = n; - r.version = t(133).version, r.transports = t(132); - var o = t(9); - r.hash = o.hash, r.clone = o.clone, r.longestElement = o.longestElement, r.exception = t(45), r.config = t(21), r.addColors = r.config.addColors, r.Container = t(107).Container, r.Logger = t(106).Logger, r.Transport = t(12).Transport, r.loggers = new r.Container; - var i = new r.Logger({ - transports: [new r.transports.Console] - }); - o.setLevels(r, null, i.levels), ['log', 'query', 'stream', 'add', 'remove', 'clear', 'profile', 'startTimer', 'extend', 'cli', 'handleExceptions', 'unhandleExceptions', 'configure'].forEach(function (e) { - r[e] = function () { - return i[e].apply(i, arguments) - } - }), r.cli = function () { - return r.padLevels = !0, o.setLevels(r, i.levels, r.config.cli.levels), i.setLevels(r.config.cli.levels), r.config.addColors(r.config.cli.colors), i.transports.console && (i.transports.console.colorize = !0, i.transports.console.timestamp = !1), r - }, r.setLevels = function (e) { - o.setLevels(r, i.levels, e), i.setLevels(e) - }, Object.defineProperty(r, 'level', { - get: function () { - return i.level - }, - set: function (e) { - i.level = e, Object.keys(i.transports).forEach(function (n) { - i.transports[n].level = e - }) - } - }), ['emitErrs', 'exitOnError', 'padLevels', 'levelLength', 'stripColors'].forEach(function (e) { - Object.defineProperty(r, e, { - get: function () { - return i[e] - }, - set: function (n) { - i[e] = n - } - }) - }), Object.defineProperty(r, 'default', { - get: function () { - return { - transports: i.transports, - exceptionHandlers: i.exceptionHandlers - } - } - }) -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(96); - e.exports = { - remove: r(o), - removeSync: o.sync - } -}, function (e) { - (function () { - var n; - e.exports = n = function () { - function e(e) { - this.disposalAction = e - } - return e.prototype.disposed = !1, e.isDisposable = function (e) { - return 'function' == typeof (null == e ? void 0 : e.dispose) - }, e.prototype.dispose = function () { - this.disposed || (this.disposed = !0, 'function' == typeof this.disposalAction && this.disposalAction(), this.disposalAction = null) - }, e - }() - }).call(this) -}, function (e) { - e.exports = require('url') -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(36); - e.exports = { - readJson: r(o.readFile), - readJsonSync: o.readFileSync, - writeJson: r(o.writeFile), - writeJsonSync: o.writeFileSync - } -}, function (e, n, t) { - 'use strict'; - e.exports = Object.assign({}, t(43), t(41), t(37), t(97), t(95), t(89), t(3), t(86), t(85), t(84), t(7), t(16)); - const r = t(5); - Object.getOwnPropertyDescriptor(r, 'promises') && Object.defineProperty(e.exports, 'promises', { - get() { - return r.promises - } - }) -}, function (e, n, t) { - function r(e) { - var n = Array.prototype.slice.call(arguments, 1); - return n.forEach(function (n) { - for (var t = Object.keys(n), r = 0; r < t.length; r++) e[t[r]] = n[t[r]] - }), e - } - var o = t(127); - o.enabled = !0; - var i = n, - a = n.allColors = {}; - i.addColors = function (e) { - r(a, e) - }, i.colorize = function (e, n) { - 'undefined' == typeof n && (n = e); - var t = n; - if (a[e] instanceof Array) - for (var r = 0, i = a[e].length; r < i; ++r) t = o[a[e][r]](t); - else if (a[e].match(/\s/)) { - for (var s = a[e].split(/\s+/), r = 0; r < s.length; ++r) t = o[s[r]](t); - a[e] = s - } else t = o[a[e]](t); - return t - }, i.cli = t(117), i.npm = t(116), i.syslog = t(115), i.addColors(i.cli.colors), i.addColors(i.npm.colors), i.addColors(i.syslog.colors) -}, function (e) { - e.exports = require('child_process') -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(18), - o = t(4); - n.openDirectorySafe = function (e) { - o.shell.openItem(e) - } -}, function (e, n) { - 'use strict'; - - function t(e) { - return e.id || e.label || e.role || 'unknown' - } - - function r(e, n = '@', o = new Set) { - for (const i of e) { - let e = 0, - a = i.id; - if (!a) - do a = `${n}.${t(i)}${e++||''}`; while (o.has(a)); - if (i.id = a, o.add(a), i.submenu) { - const e = i.submenu; - r(e, i.id, o) - } - } - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.ensureItemIds = r -}, function (e, n, t) { - 'use strict'; - - function r(e) { - for (var t in e) n.hasOwnProperty(t) || (n[t] = e[t]) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), r(t(64)), r(t(24)), r(t(60)), r(t(59)) -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.now = function () { - const e = process.hrtime(); - return 1e3 * e[0] + e[1] / 1e6 - } -}, function (e, n) { - 'use strict'; - - function t(e) { - throw new Error(e) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.fatalError = t, n.assertNever = function (e, n) { - throw new Error(n) - }, n.forceUnwrap = function (e, n) { - return null == n ? t(e) : n - } -}, function (e, n) { - 'use strict'; - - function t(e) { - return e.isFullScreen() ? 'full-screen' : e.isMaximized() ? 'maximized' : e.isMinimized() ? 'minimized' : e.isVisible() ? 'normal' : 'hidden' - } - - function r(e, t) { - e.webContents.send(n.windowStateChannelName, t) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.windowStateChannelName = 'window-state-changed', n.getWindowState = t, n.registerWindowStateChangedEvents = function (e) { - e.on('enter-full-screen', () => r(e, 'full-screen')), e.on('leave-full-screen', () => r(e, 'normal')), e.on('maximize', () => r(e, 'maximized')), e.on('minimize', () => r(e, 'minimized')), e.on('unmaximize', () => r(e, 'normal')), e.on('restore', () => r(e, 'normal')), e.on('hide', () => r(e, 'hidden')), e.on('show', () => { - r(e, t(e)) - }) - } -}, function (e, n, t) { - (function () { - n.Emitter = t(70), n.Disposable = t(17), n.CompositeDisposable = t(69) - }).call(this) -}, function (e, n, t) { - function r() { - this._array = [], this._set = a ? new Map : Object.create(null) - } - var o = t(11), - i = Object.prototype.hasOwnProperty, - a = 'undefined' != typeof Map; - r.fromArray = function (e, n) { - for (var t = new r, o = 0, i = e.length; o < i; o++) t.add(e[o], n); - return t - }, r.prototype.size = function () { - return a ? this._set.size : Object.getOwnPropertyNames(this._set).length - }, r.prototype.add = function (e, n) { - var t = a ? e : o.toSetString(e), - r = a ? this.has(e) : i.call(this._set, t), - s = this._array.length; - (!r || n) && this._array.push(e), r || (a ? this._set.set(e, s) : this._set[t] = s) - }, r.prototype.has = function (e) { - if (a) return this._set.has(e); - var n = o.toSetString(e); - return i.call(this._set, n) - }, r.prototype.indexOf = function (e) { - if (a) { - var n = this._set.get(e); - if (0 <= n) return n - } else { - var t = o.toSetString(e); - if (i.call(this._set, t)) return this._set[t] - } - throw new Error('"' + e + '" is not in the set.') - }, r.prototype.at = function (e) { - if (0 <= e && e < this._array.length) return this._array[e]; - throw new Error('No element indexed by ' + e) - }, r.prototype.toArray = function () { - return this._array.slice() - }, n.ArraySet = r -}, function (e, n, t) { - function r(e) { - return 0 > e ? (-e << 1) + 1 : (e << 1) + 0 - } - - function o(e) { - var n = e >> 1; - return 1 == (1 & e) ? -n : n - } - var i = t(78), - a = 5, - s = 1 << a, - d = s - 1, - l = s; - n.encode = function (e) { - var n = '', - t = r(e), - o; - do o = t & d, t >>>= a, 0 < t && (o |= l), n += i.encode(o); while (0 < t); - return n - }, n.decode = function (e, n, t) { - var r = e.length, - s = 0, - c = 0, - p, u; - do { - if (n >= r) throw new Error('Expected more digits in base 64 VLQ value.'); - if (u = i.decode(e.charCodeAt(n++)), -1 === u) throw new Error('Invalid base64 digit: ' + e.charAt(n - 1)); - p = !!(u & l), u &= d, s += u << c, c += a - } while (p); - t.value = o(s), t.rest = n - } -}, function (e, n, t) { - function r(e) { - e || (e = {}), this._file = a.getArg(e, 'file', null), this._sourceRoot = a.getArg(e, 'sourceRoot', null), this._skipValidation = a.getArg(e, 'skipValidation', !1), this._sources = new i, this._names = new i, this._mappings = new s, this._sourcesContents = null - } - var o = t(31), - a = t(11), - i = t(30).ArraySet, - s = t(77).MappingList; - r.prototype._version = 3, r.fromSourceMap = function (e) { - var n = e.sourceRoot, - t = new r({ - file: e.file, - sourceRoot: n - }); - return e.eachMapping(function (e) { - var r = { - generated: { - line: e.generatedLine, - column: e.generatedColumn - } - }; - null != e.source && (r.source = e.source, null != n && (r.source = a.relative(n, r.source)), r.original = { - line: e.originalLine, - column: e.originalColumn - }, null != e.name && (r.name = e.name)), t.addMapping(r) - }), e.sources.forEach(function (n) { - var r = e.sourceContentFor(n); - null != r && t.setSourceContent(n, r) - }), t - }, r.prototype.addMapping = function (e) { - var n = a.getArg(e, 'generated'), - t = a.getArg(e, 'original', null), - r = a.getArg(e, 'source', null), - o = a.getArg(e, 'name', null); - this._skipValidation || this._validateMapping(n, t, r, o), null != r && (r = r + '', !this._sources.has(r) && this._sources.add(r)), null != o && (o = o + '', !this._names.has(o) && this._names.add(o)), this._mappings.add({ - generatedLine: n.line, - generatedColumn: n.column, - originalLine: null != t && t.line, - originalColumn: null != t && t.column, - source: r, - name: o - }) - }, r.prototype.setSourceContent = function (e, n) { - var t = e; - null != this._sourceRoot && (t = a.relative(this._sourceRoot, t)), null == n ? this._sourcesContents && (delete this._sourcesContents[a.toSetString(t)], 0 === Object.keys(this._sourcesContents).length && (this._sourcesContents = null)) : (!this._sourcesContents && (this._sourcesContents = Object.create(null)), this._sourcesContents[a.toSetString(t)] = n) - }, r.prototype.applySourceMap = function (e, n, t) { - var r = n; - if (null == n) { - if (null == e.file) throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.'); - r = e.file - } - var o = this._sourceRoot; - null != o && (r = a.relative(o, r)); - var s = new i, - d = new i; - this._mappings.unsortedForEach(function (n) { - if (n.source === r && null != n.originalLine) { - var i = e.originalPositionFor({ - line: n.originalLine, - column: n.originalColumn - }); - null != i.source && (n.source = i.source, null != t && (n.source = a.join(t, n.source)), null != o && (n.source = a.relative(o, n.source)), n.originalLine = i.line, n.originalColumn = i.column, null != i.name && (n.name = i.name)) - } - var l = n.source; - null == l || s.has(l) || s.add(l); - var c = n.name; - null == c || d.has(c) || d.add(c) - }, this), this._sources = s, this._names = d, e.sources.forEach(function (n) { - var r = e.sourceContentFor(n); - null != r && (null != t && (n = a.join(t, n)), null != o && (n = a.relative(o, n)), this.setSourceContent(n, r)) - }, this) - }, r.prototype._validateMapping = function (e, n, t, r) { - if (n && 'number' != typeof n.line && 'number' != typeof n.column) throw new Error('original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.'); - if (!(e && 'line' in e && 'column' in e && 0 < e.line && 0 <= e.column && !n && !t && !r) && !(e && 'line' in e && 'column' in e && n && 'line' in n && 'column' in n && 0 < e.line && 0 <= e.column && 0 < n.line && 0 <= n.column && t)) throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: e, - source: t, - original: n, - name: r - })) - }, r.prototype._serializeMappings = function () { - for (var e = 0, n = 1, t = 0, r = 0, s = 0, d = 0, l = '', c = this._mappings.toArray(), p = 0, i = c.length, u, m, g, f; p < i; p++) { - if (m = c[p], u = '', m.generatedLine !== n) - for (e = 0; m.generatedLine !== n;) u += ';', n++; - else if (0 < p) { - if (!a.compareByGeneratedPositionsInflated(m, c[p - 1])) continue; - u += ',' - } - u += o.encode(m.generatedColumn - e), e = m.generatedColumn, null != m.source && (f = this._sources.indexOf(m.source), u += o.encode(f - d), d = f, u += o.encode(m.originalLine - 1 - r), r = m.originalLine - 1, u += o.encode(m.originalColumn - t), t = m.originalColumn, null != m.name && (g = this._names.indexOf(m.name), u += o.encode(g - s), s = g)), l += u - } - return l - }, r.prototype._generateSourcesContent = function (e, n) { - return e.map(function (e) { - if (!this._sourcesContents) return null; - null != n && (e = a.relative(n, e)); - var t = a.toSetString(e); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, t) ? this._sourcesContents[t] : null - }, this) - }, r.prototype.toJSON = function () { - var e = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() + return n + } + + function h(e) { + for (var t in e) ! function (t) { + r[t] = function (n) { + return r[e[t]](n) + } + }(t) + } + r.setTheme = function (e) { + if ("string" == typeof e) try { + return r.themes[e] = n(64)(e), h(r.themes[e]), r.themes[e] + } catch (e) { + return console.log(e), e + } else h(e) }; - return null != this._file && (e.file = this._file), null != this._sourceRoot && (e.sourceRoot = this._sourceRoot), this._sourcesContents && (e.sourcesContent = this._generateSourcesContent(e.sources, e.sourceRoot)), e - }, r.prototype.toString = function () { - return JSON.stringify(this.toJSON()) - }, n.SourceMapGenerator = r -}, function (e, n, t) { - 'use strict'; - - function r(e) { - if (!c.some((n) => e.endsWith(n))) return null; - e.startsWith('file://') && (e = d(e)); - const n = `${e}.map`; - if (!1, !!s.existsSync(n)) try { - const e = s.readFileSync(n, 'utf8'); - return { - url: a.basename(n), - map: e - } - } catch (e) {} - } - - function o(e, n) { - return p.set(e, n), e + n.map((e) => `\n at ${e}`).join('') - } - - function i(e) { - let n = p.get(e); - return n || ((e.stack || '').toString(), n = p.get(e)), n ? u(e, n) : e.stack - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const a = t(0), - s = t(5), - d = t(81), - l = t(80), - c = ['renderer.js', 'main.js'], - p = new WeakMap; - let u; - n.enableSourceMaps = function () { - l.install({ - environment: 'node', - handleUncaughtExceptions: !1, - retrieveSourceMap: r - }); - const e = Error; - u = e.prepareStackTrace, e.prepareStackTrace = o - }, n.withSourceMappedStack = function (e) { - return { - name: e.name, - message: e.message, - stack: i(e) - } - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(33); - n.formatError = function (e, n) { - return e = r.withSourceMappedStack(e), e.stack ? n ? `${n}\n${e.stack}` : e.stack.trim() : n ? `${n}\n${e.name}: ${e.message}` : `${e.name}: ${e.message}` - } -}, function (e, n, t) { - function r(e, n, t, s) { - 'function' == typeof n ? (t = n, n = {}) : (!n || 'object' != typeof n) && (n = { - mode: n - }); - var d = n.mode, - l = n.fs || i; - d === void 0 && (d = a & ~process.umask()), s || (s = null); - var c = t || function () {}; - e = o.resolve(e), l.mkdir(e, d, function (t) { - if (!t) return s = s || e, c(null, s); - switch (t.code) { - case 'ENOENT': - r(o.dirname(e), n, function (t, o) { - t ? c(t, o) : r(e, n, c, o) - }); - break; - default: - l.stat(e, function (e, n) { - e || !n.isDirectory() ? c(t, s) : c(null, s) - }); - } - }) - } - var o = t(0), - i = t(5), - a = parseInt('0777', 8); - e.exports = r.mkdirp = r.mkdirP = r, r.sync = function e(n, t, r) { - t && 'object' == typeof t || (t = { - mode: t - }); - var s = t.mode, - d = t.fs || i; - s === void 0 && (s = a & ~process.umask()), r || (r = null), n = o.resolve(n); - try { - d.mkdirSync(n, s), r = r || n - } catch (i) { - switch (i.code) { - case 'ENOENT': - r = e(o.dirname(n), t, r), e(n, t, r); - break; - default: - var l; - try { - l = d.statSync(n) - } catch (e) { - throw i - } - if (!l.isDirectory()) throw i; - } - } - return r - } -}, function (e, n, t) { - function r(e, n, t) { - null == t && (t = n, n = {}), 'string' == typeof n && (n = { - encoding: n - }), n = n || {}; - var r = n.fs || l, - o = !0; - 'throws' in n && (o = n.throws), r.readFile(e, n, function (r, i) { - if (r) return t(r); - i = d(i); - var a; - try { - a = JSON.parse(i, n ? n.reviver : null) - } catch (n) { - return o ? (n.message = e + ': ' + n.message, t(n)) : t(null, null) - } - t(null, a) - }) - } + var p = function (e, t) { + var n = t.split(""); + return (n = n.map(e)).join("") + }; + for (var d in r.trap = n(65), r.zalgo = n(66), r.maps = {}, r.maps.america = n(67), r.maps.zebra = n(68), r.maps.rainbow = n(69), r.maps.random = n(70), r.maps) ! function (e) { + r[e] = function (t) { + return p(r.maps[e], t) + } + }(d); + o(r, function () { + var e = {}; + return Object.keys(l).forEach((function (t) { + e[t] = { + get: function () { + return a([t]) + } + } + })), e + }()) +}, function (e, t, n) { + var r = n(14), + i = n(7), + o = t.Transport = function (e) { + r.EventEmitter.call(this), e = e || {}, this.silent = e.silent || !1, this.raw = e.raw || !1, this.name = e.name || this.name, this.formatter = e.formatter, this.level = e.level, this.handleExceptions = e.handleExceptions || !1, this.exceptionsLevel = e.exceptionsLevel || "error", this.humanReadableUnhandledException = e.humanReadableUnhandledException || !1 + }; + i.inherits(o, r.EventEmitter), o.prototype.formatQuery = function (e) { + return e + }, o.prototype.normalizeQuery = function (e) { + return (e = e || {}).rows = e.rows || e.limit || 10, e.start = e.start || 0, e.until = e.until || new Date, "object" != typeof e.until && (e.until = new Date(e.until)), e.from = e.from || e.until - 864e5, "object" != typeof e.from && (e.from = new Date(e.from)), e.order = e.order || "desc", e.fields = e.fields, e + }, o.prototype.formatResults = function (e, t) { + return e + }, o.prototype.logException = function (e, t, n) { + var r, i = this; + if (this.silent) return n(); + + function o() { + r || (r = !0, i.removeListener("logged", o), i.removeListener("error", o), n()) + } + this.once("logged", o), this.once("error", o), this.log(i.exceptionsLevel, e, t, (function () {})) + } +}, function (e, t) { + t.getArg = function (e, t, n) { + if (t in e) return e[t]; + if (3 === arguments.length) return n; + throw new Error('"' + t + '" is a required argument.') + }; + var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/, + r = /^data:.+\,.+$/; + + function i(e) { + var t = e.match(n); + return t ? { + scheme: t[1], + auth: t[2], + host: t[3], + port: t[4], + path: t[5] + } : null + } - function o(e, n) { - n = n || {}, 'string' == typeof n && (n = { - encoding: n - }); - var t = n.fs || l, - r = !0; - 'throws' in n && (r = n.throws); - try { - var o = t.readFileSync(e, n); - return o = d(o), JSON.parse(o, n.reviver) - } catch (n) { - if (r) throw n.message = e + ': ' + n.message, n; - else return null - } - } - - function i(e, n) { - var t = '\n', - r; - 'object' == typeof n && null !== n && (n.spaces && (r = n.spaces), n.EOL && (t = n.EOL)); - var o = JSON.stringify(e, n ? n.replacer : null, r); - return o.replace(/\n/g, t) + t - } - - function a(e, n, t, r) { - null == r && (r = t, t = {}), t = t || {}; - var o = t.fs || l, - a = ''; - try { - a = i(n, t) - } catch (e) { - return void(r && r(e, null)) - } - o.writeFile(e, a, t, r) - } - - function s(e, n, t) { - t = t || {}; - var r = t.fs || l, - o = i(n, t); - return r.writeFileSync(e, o, t) - } - - function d(e) { - return Buffer.isBuffer(e) && (e = e.toString('utf8')), e = e.replace(/^\uFEFF/, ''), e - } - var l; - try { - l = t(1) - } catch (e) { - l = t(5) - } - e.exports = { - readFile: r, - readFileSync: o, - writeFile: a, - writeFileSync: s - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback; - e.exports = { - copy: r(t(98)) - } -}, function (e) { - 'use strict'; - e.exports = function (e) { - if ('function' == typeof Buffer.allocUnsafe) try { - return Buffer.allocUnsafe(e) - } catch (n) { - return new Buffer(e) - } - return new Buffer(e) - } -}, function (e, n, t) { - 'use strict'; - var r = Math.floor; - const o = t(1), - i = t(10), - a = t(0); - e.exports = { - hasMillisRes: function (e) { - let n = a.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)); - n = a.join(i.tmpdir(), n); - const t = new Date(1435410243862); - o.writeFile(n, 'https://github.com/jprichardson/node-fs-extra/pull/141', (r) => r ? e(r) : void o.open(n, 'r+', (r, i) => r ? e(r) : void o.futimes(i, t, t, (t) => t ? e(t) : void o.close(i, (t) => t ? e(t) : void o.stat(n, (n, t) => n ? e(n) : void e(null, 1435410243e3 < t.mtime)))))) - }, - hasMillisResSync: function () { - let e = a.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)); - e = a.join(i.tmpdir(), e); - const n = new Date(1435410243862); - o.writeFileSync(e, 'https://github.com/jprichardson/node-fs-extra/pull/141'); - const t = o.openSync(e, 'r+'); - return o.futimesSync(t, n, n), o.closeSync(t), 1435410243e3 < o.statSync(e).mtime - }, - timeRemoveMillis: function (e) { - if ('number' == typeof e) return 1e3 * r(e / 1e3); - if (e instanceof Date) return new Date(1e3 * r(e.getTime() / 1e3)); - throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') - }, - utimesMillis: function (e, n, t, r) { - o.open(e, 'r+', (e, i) => e ? r(e) : void o.futimes(i, n, t, (e) => { - o.close(i, (n) => { - r && r(e || n) - }) - })) - }, - utimesMillisSync: function (e, n, t) { - const r = o.openSync(e, 'r+'); - return o.futimesSync(r, n, t), o.closeSync(r) - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e) { - return e = o.normalize(o.resolve(e)).split(o.sep), 0 < e.length ? e[0] : null - } - const o = t(0), - i = /[<>:"|?*]/; - e.exports = { - getRootPath: r, - invalidWin32Path: function (e) { - const n = r(e); - return e = e.replace(n, ''), i.test(e) - } - } -}, function (e, n, t) { - 'use strict'; - e.exports = { - copySync: t(101) - } -}, function (e) { - e.exports = require('assert') -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(1), - i = ['access', 'appendFile', 'chmod', 'chown', 'close', 'copyFile', 'fchmod', 'fchown', 'fdatasync', 'fstat', 'fsync', 'ftruncate', 'futimes', 'lchown', 'lchmod', 'link', 'lstat', 'mkdir', 'mkdtemp', 'open', 'readFile', 'readdir', 'readlink', 'realpath', 'rename', 'rmdir', 'stat', 'symlink', 'truncate', 'unlink', 'utimes', 'writeFile'].filter((e) => 'function' == typeof o[e]); - Object.keys(o).forEach((e) => { - 'promises' === e || (n[e] = o[e]) - }), i.forEach((e) => { - n[e] = r(o[e]) - }), n.exists = function (e, n) { - return 'function' == typeof n ? o.exists(e, n) : new Promise((n) => o.exists(e, n)) - }, n.read = function (e, n, t, r, i, a) { - return 'function' == typeof a ? o.read(e, n, t, r, i, a) : new Promise((a, s) => { - o.read(e, n, t, r, i, (e, n, t) => e ? s(e) : void a({ - bytesRead: n, - buffer: t - })) - }) - }, n.write = function (e, n, ...t) { - return 'function' == typeof t[t.length - 1] ? o.write(e, n, ...t) : new Promise((r, i) => { - o.write(e, n, ...t, (e, n, t) => e ? i(e) : void r({ - bytesWritten: n, - buffer: t - })) - }) - } -}, function (e, n, t) { - 'use strict'; - - function r() { - if (!a) { - const e = i.app.getPath('userData'); - a = o.join(e, 'logs') - } - return a - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(0), - i = t(4); - let a = null; - n.getLogDirectoryPath = r -}, function (e, n, t) { - var r = t(10), - o = t(108), - i = n; - i.getAllInfo = function (e) { - return { - date: new Date().toString(), - process: i.getProcessInfo(), - os: i.getOsInfo(), - trace: i.getTrace(e), - stack: e.stack && e.stack.split('\n') - } - }, i.getProcessInfo = function () { - return { - pid: process.pid, - uid: process.getuid ? process.getuid() : null, - gid: process.getgid ? process.getgid() : null, - cwd: process.cwd(), - execPath: process.execPath, - version: process.version, - argv: process.argv, - memoryUsage: process.memoryUsage() - } - }, i.getOsInfo = function () { - return { - loadavg: r.loadavg(), - uptime: r.uptime() - } - }, i.getTrace = function (e) { - var n = e ? o.parse(e) : o.get(); - return n.map(function (e) { - return { - column: e.getColumnNumber(), - file: e.getFileName(), - function: e.getFunctionName(), - line: e.getLineNumber(), - method: e.getMethodName(), - native: e.isNative() - } - }) - } -}, function (e) { - e.exports = require('zlib') -}, function (e, n) { - var t, r; - /*! - * async - * https://github.com/caolan/async - * - * Copyright 2010-2014 Caolan McMahon - * Released under the MIT license - */ - (function () { function o(e) { - var n = !1; - return function () { - if (n) throw new Error('Callback was already called.'); - n = !0, e.apply(s, arguments) - } - } - var a = {}, - i = function () {}, - s, d; - s = 'object' == typeof window && this === window ? window : 'object' == typeof global && this === global ? global : this, null != s && (d = s.async), a.noConflict = function () { - return s.async = d, a + var t = ""; + return e.scheme && (t += e.scheme + ":"), t += "//", e.auth && (t += e.auth + "@"), e.host && (t += e.host), e.port && (t += ":" + e.port), e.path && (t += e.path), t + } + + function s(e) { + var n = e, + r = i(e); + if (r) { + if (!r.path) return e; + n = r.path + } + for (var s, a = t.isAbsolute(n), c = n.split(/\/+/), l = 0, u = c.length - 1; u >= 0; u--) "." === (s = c[u]) ? c.splice(u, 1) : ".." === s ? l++ : l > 0 && ("" === s ? (c.splice(u + 1, l), l = 0) : (c.splice(u, 2), l--)); + return "" === (n = c.join("/")) && (n = a ? "/" : "."), r ? (r.path = n, o(r)) : n + } + t.urlParse = i, t.urlGenerate = o, t.normalize = s, t.join = function (e, t) { + "" === e && (e = "."), "" === t && (t = "."); + var n = i(t), + a = i(e); + if (a && (e = a.path || "/"), n && !n.scheme) return a && (n.scheme = a.scheme), o(n); + if (n || t.match(r)) return t; + if (a && !a.host && !a.path) return a.host = t, o(a); + var c = "/" === t.charAt(0) ? t : s(e.replace(/\/+$/, "") + "/" + t); + return a ? (a.path = c, o(a)) : c + }, t.isAbsolute = function (e) { + return "/" === e.charAt(0) || !!e.match(n) + }, t.relative = function (e, t) { + "" === e && (e = "."), e = e.replace(/\/$/, ""); + for (var n = 0; 0 !== t.indexOf(e + "/");) { + var r = e.lastIndexOf("/"); + if (r < 0) return t; + if ((e = e.slice(0, r)).match(/^([^\/]+:\/)?\/*$/)) return t; + ++n + } + return Array(n + 1).join("../") + t.substr(e.length + 1) }; - var l = Object.prototype.toString, - c = Array.isArray || function (e) { - return '[object Array]' === l.call(e) - }, - p = function (e, n) { - for (var t = -1, r = e.length; ++t < r;) n(e[t], t, e) - }, - u = function (e, n) { - for (var t = -1, r = e.length, o = Array(r); ++t < r;) o[t] = n(e[t], t, e); + var a = !("__proto__" in Object.create(null)); + + function c(e) { + return e + } + + function l(e) { + if (!e) return !1; + var t = e.length; + if (t < 9) return !1; + if (95 !== e.charCodeAt(t - 1) || 95 !== e.charCodeAt(t - 2) || 111 !== e.charCodeAt(t - 3) || 116 !== e.charCodeAt(t - 4) || 111 !== e.charCodeAt(t - 5) || 114 !== e.charCodeAt(t - 6) || 112 !== e.charCodeAt(t - 7) || 95 !== e.charCodeAt(t - 8) || 95 !== e.charCodeAt(t - 9)) return !1; + for (var n = t - 10; n >= 0; n--) + if (36 !== e.charCodeAt(n)) return !1; + return !0 + } + + function u(e, t) { + return e === t ? 0 : e > t ? 1 : -1 + } + t.toSetString = a ? c : function (e) { + return l(e) ? "$" + e : e + }, t.fromSetString = a ? c : function (e) { + return l(e) ? e.slice(1) : e + }, t.compareByOriginalPositions = function (e, t, n) { + var r = e.source - t.source; + return 0 !== r || 0 !== (r = e.originalLine - t.originalLine) || 0 !== (r = e.originalColumn - t.originalColumn) || n || 0 !== (r = e.generatedColumn - t.generatedColumn) || 0 !== (r = e.generatedLine - t.generatedLine) ? r : e.name - t.name + }, t.compareByGeneratedPositionsDeflated = function (e, t, n) { + var r = e.generatedLine - t.generatedLine; + return 0 !== r || 0 !== (r = e.generatedColumn - t.generatedColumn) || n || 0 !== (r = e.source - t.source) || 0 !== (r = e.originalLine - t.originalLine) || 0 !== (r = e.originalColumn - t.originalColumn) ? r : e.name - t.name + }, t.compareByGeneratedPositionsInflated = function (e, t) { + var n = e.generatedLine - t.generatedLine; + return 0 !== n || 0 !== (n = e.generatedColumn - t.generatedColumn) || 0 !== (n = u(e.source, t.source)) || 0 !== (n = e.originalLine - t.originalLine) || 0 !== (n = e.originalColumn - t.originalColumn) ? n : u(e.name, t.name) + } +}, function (e, t) { + e.exports = require("url") +}, function (e, t, n) { + "use strict"; + n.d(t, "a", (function () { + return i + })); + n(18); + var r = n(0); + + function i(e) { + { + const t = e.endsWith("\\") ? e : e + "\\"; + r.shell.openPath(t).then(t => { + "" !== t && log.error(`Failed to open directory (${e}): ${t}`) + }) + } + } +}, function (e, t, n) { + "use strict"; + Object.defineProperty(t, "__esModule", { + value: !0 + }), + function (e) { + for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) + }(n(118)) +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(91); + e.exports = { + remove: r(i), + removeSync: i.sync + } +}, function (e, t, n) { + "use strict"; + + function r(e) { + return e.id || e.label || e.role || "unknown" + } + + function i(e, t = "@", n = new Set) { + for (const o of e) { + let e = 0, + s = o.id; + if (!s) + do { + s = `${t}.${r(o)}${e++||""}` + } while (n.has(s)); + if (o.id = s, n.add(s), o.submenu) { + i(o.submenu, o.id, n) + } + } + } + n.d(t, "a", (function () { + return i + })) +}, function (e, t, n) { + "use strict"; + n.d(t, "a", (function () { + return s + })); + var r = n(1), + i = n(0); + let o = null; + + function s() { + if (!o) { + const e = i.app.getPath("userData"); + o = r.join(e, "logs") + } return o - }, - m = function (e, n, t) { - return p(e, function (e, r, o) { - t = n(t, e, r, o) - }), t - }, - g = function (e, n) { - p(f(e), function (t) { - n(e[t], t) - }) - }, - f = Object.keys || function (e) { - var n = []; - for (var t in e) e.hasOwnProperty(t) && n.push(t); + } +}, function (e, t, n) { + (function () { + t.Emitter = n(116), t.Disposable = n(29), t.CompositeDisposable = n(117) + }).call(this) +}, function (e, t) { + e.exports = require("child_process") +}, function (e, t, n) { + var r = n(61); + r.enabled = !0; + var i = t, + o = t.allColors = {}; + i.addColors = function (e) { + ! function (e) { + var t = Array.prototype.slice.call(arguments, 1); + t.forEach((function (t) { + for (var n = Object.keys(t), r = 0; r < n.length; r++) e[n[r]] = t[n[r]] + })) + }(o, e) + }, i.colorize = function (e, t) { + void 0 === t && (t = e); + var n = t; + if (o[e] instanceof Array) + for (var i = 0, s = o[e].length; i < s; ++i) n = r[o[e][i]](n); + else if (o[e].match(/\s/)) { + var a = o[e].split(/\s+/); + for (i = 0; i < a.length; ++i) n = r[a[i]](n); + o[e] = a + } else n = r[o[e]](n); return n - }, - h = function (e, n) { - n = n || 0; - var t = -1, - r = e.length; - n && (r -= n, r = 0 > r ? 0 : r); - for (var o = Array(r); ++t < r;) o[t] = e[t + n]; - return o - }, - y; - 'function' == typeof setImmediate && (y = setImmediate), 'undefined' != typeof process && process.nextTick ? (a.nextTick = process.nextTick, a.setImmediate = y ? function (e) { - y(e) - } : a.nextTick) : y ? (a.nextTick = function (e) { - y(e) - }, a.setImmediate = a.nextTick) : (a.nextTick = function (e) { - setTimeout(e, 0) - }, a.setImmediate = a.nextTick), a.each = function (e, n, t) { - function r(n) { - n ? (t(n), t = i) : (a += 1, a >= e.length && t()) - } - if (t = t || i, !e.length) return t(); - var a = 0; - p(e, function (e) { - n(e, o(r)) - }) - }, a.forEach = a.each, a.eachSeries = function (e, n, t) { - if (t = t || i, !e.length) return t(); - var r = 0, - o = function () { - n(e[r], function (n) { - n ? (t(n), t = i) : (r += 1, r >= e.length ? t() : o()) - }) + }, i.cli = n(71), i.npm = n(72), i.syslog = n(73), i.addColors(i.cli.colors), i.addColors(i.npm.colors), i.addColors(i.syslog.colors) +}, function (e, t) { + e.exports = require("assert") +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(40); + e.exports = { + readJson: r(i.readFile), + readJsonSync: i.readFileSync, + writeJson: r(i.writeFile), + writeJsonSync: i.writeFileSync + } +}, function (e, t) { + (function () { + e.exports = function () { + function e(e) { + this.disposalAction = e + } + return e.prototype.disposed = !1, e.isDisposable = function (e) { + return "function" == typeof (null != e ? e.dispose : void 0) + }, e.prototype.dispose = function () { + this.disposed || (this.disposed = !0, "function" == typeof this.disposalAction && this.disposalAction(), this.disposalAction = null) + }, e + }() + }).call(this) +}, function (e, t, n) { + var r; + /*! + * async + * https://github.com/caolan/async + * + * Copyright 2010-2014 Caolan McMahon + * Released under the MIT license + */ + ! function () { + var n, i, o = {}, + s = function () {}; + + function a(e) { + var t = !1; + return function () { + if (t) throw new Error("Callback was already called."); + t = !0, e.apply(n, arguments) + } + } + null != (n = "object" == typeof window && this === window ? window : "object" == typeof global && this === global ? global : this) && (i = n.async), o.noConflict = function () { + return n.async = i, o }; - o() - }, a.forEachSeries = a.eachSeries, a.eachLimit = function (e, n, t, r) { - var o = _(n); - o.apply(null, [e, t, r]) - }, a.forEachLimit = a.eachLimit; - var _ = function (e) { - return function (n, t, r) { - if (r = r || i, !n.length || 0 >= e) return r(); - var o = 0, - a = 0, - s = 0; - (function d() { - if (o >= n.length) return r(); - for (; s < e && a < n.length;) a += 1, s += 1, t(n[a - 1], function (e) { - e ? (r(e), r = i) : (o += 1, s -= 1, o >= n.length ? r() : d()) - }) - })() - } - }; - a.forEachOf = a.eachOf = function (e, n, t) { - t = t || function () {}; - var r = e.length || f(e).length, - o = 0; - return r ? void g(e, function (i, a) { - n(e[a], a, function (e) { - e ? (t(e), t = function () {}) : (o += 1, o === r && t(null)) - }) - }) : t() - }, a.forEachOfSeries = a.eachOfSeries = function (e, n, t) { - t = t || function () {}; - var r = f(e), - o = r.length; - if (!o) return t(); - var i = 0, - s = function () { - var d = !0, - l = r[i]; - n(e[l], l, function (e) { - e ? (t(e), t = function () {}) : (i += 1, i >= o ? t(null) : d ? a.nextTick(s) : s()) - }), d = !1 + var c, l = Object.prototype.toString, + u = Array.isArray || function (e) { + return "[object Array]" === l.call(e) + }, + f = function (e, t) { + for (var n = -1, r = e.length; ++n < r;) t(e[n], n, e) + }, + h = function (e, t) { + for (var n = -1, r = e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e); + return i + }, + p = Object.keys || function (e) { + var t = []; + for (var n in e) e.hasOwnProperty(n) && t.push(n); + return t + }, + d = function (e, t) { + t = t || 0; + var n = -1, + r = e.length; + t && (r = (r -= t) < 0 ? 0 : r); + for (var i = Array(r); ++n < r;) i[n] = e[n + t]; + return i + }; + "function" == typeof setImmediate && (c = setImmediate), "undefined" != typeof process && process.nextTick ? (o.nextTick = process.nextTick, o.setImmediate = c ? function (e) { + c(e) + } : o.nextTick) : c ? (o.nextTick = function (e) { + c(e) + }, o.setImmediate = o.nextTick) : (o.nextTick = function (e) { + setTimeout(e, 0) + }, o.setImmediate = o.nextTick), o.each = function (e, t, n) { + if (n = n || s, !e.length) return n(); + var r = 0; + + function i(t) { + t ? (n(t), n = s) : (r += 1) >= e.length && n() + } + f(e, (function (e) { + t(e, a(i)) + })) + }, o.forEach = o.each, o.eachSeries = function (e, t, n) { + if (n = n || s, !e.length) return n(); + var r = 0, + i = function () { + t(e[r], (function (t) { + t ? (n(t), n = s) : (r += 1) >= e.length ? n() : i() + })) + }; + i() + }, o.forEachSeries = o.eachSeries, o.eachLimit = function (e, t, n, r) { + m(t).apply(null, [e, n, r]) + }, o.forEachLimit = o.eachLimit; + var m = function (e) { + return function (t, n, r) { + if (r = r || s, !t.length || e <= 0) return r(); + var i = 0, + o = 0, + a = 0; + ! function c() { + if (i >= t.length) return r(); + for (; a < e && o < t.length;) a += 1, n(t[(o += 1) - 1], (function (e) { + e ? (r(e), r = s) : (a -= 1, (i += 1) >= t.length ? r() : c()) + })) + }() + } }; - s() - }, a.forEachOfLimit = a.eachOfLimit = function (e, n, t, r) { - b(n)(e, t, r) - }; - var b = function (e) { - return function (n, t, r) { - r = r || function () {}; - var o = f(n), - i = o.length; - if (!i || 0 >= e) return r(); - var a = 0, - s = 0, - d = 0; - (function l() { - if (a >= i) return r(); - for (; d < e && s < i;) { - s += 1, d += 1; - var c = o[s - 1]; - t(n[c], c, function (e) { - e ? (r(e), r = function () {}) : (a += 1, d -= 1, a >= i ? r() : l()) - }) + o.forEachOf = o.eachOf = function (e, t, n) { + n = n || function () {}; + var r = e.length || p(e).length, + i = 0; + if (!r) return n(); + ! function (e, t) { + f(p(e), (function (n) { + t(e[n], n) + })) + }(e, (function (o, s) { + t(e[s], s, (function (e) { + e ? (n(e), n = function () {}) : (i += 1) === r && n(null) + })) + })) + }, o.forEachOfSeries = o.eachOfSeries = function (e, t, n) { + n = n || function () {}; + var r = p(e), + i = r.length; + if (!i) return n(); + var s = 0, + a = function () { + var c = !0, + l = r[s]; + t(e[l], l, (function (e) { + e ? (n(e), n = function () {}) : (s += 1) >= i ? n(null) : c ? o.nextTick(a) : a() + })), c = !1 + }; + a() + }, o.forEachOfLimit = o.eachOfLimit = function (e, t, n, r) { + g(t)(e, n, r) + }; + var g = function (e) { + return function (t, n, r) { + r = r || function () {}; + var i = p(t), + o = i.length; + if (!o || e <= 0) return r(); + var s = 0, + a = 0, + c = 0; + ! function l() { + if (s >= o) return r(); + for (; c < e && a < o;) { + c += 1; + var u = i[(a += 1) - 1]; + n(t[u], u, (function (e) { + e ? (r(e), r = function () {}) : (c -= 1, (s += 1) >= o ? r() : l()) + })) + } + }() + } + }, + y = function (e) { + return function () { + var t = d(arguments); + return e.apply(null, [o.each].concat(t)) + } + }, + v = function (e) { + return function () { + var t = d(arguments); + return e.apply(null, [o.eachSeries].concat(t)) + } + }, + w = function (e, t, n, r) { + if (t = h(t, (function (e, t) { + return { + index: t, + value: e + } + })), r) { + var i = []; + e(t, (function (e, t) { + n(e.value, (function (n, r) { + i[e.index] = r, t(n) + })) + }), (function (e) { + r(e, i) + })) + } else e(t, (function (e, t) { + n(e.value, (function (e) { + t(e) + })) + })) + }; + o.map = y(w), o.mapSeries = v(w), o.mapLimit = function (e, t, n, r) { + return b(t)(e, n, r) + }; + var b = function (e) { + return function (e, t) { + return function () { + var n = d(arguments); + return t.apply(null, [m(e)].concat(n)) + } + }(e, w) + }; + o.reduce = function (e, t, n, r) { + o.eachSeries(e, (function (e, r) { + n(t, e, (function (e, n) { + t = n, r(e) + })) + }), (function (e) { + r(e, t) + })) + }, o.inject = o.reduce, o.foldl = o.reduce, o.reduceRight = function (e, t, n, r) { + var i = h(e, (function (e) { + return e + })).reverse(); + o.reduce(i, t, n, r) + }, o.foldr = o.reduceRight; + var _ = function (e, t, n, r) { + var i = []; + e(t = h(t, (function (e, t) { + return { + index: t, + value: e + } + })), (function (e, t) { + n(e.value, (function (n) { + n && i.push(e), t() + })) + }), (function (e) { + r(h(i.sort((function (e, t) { + return e.index - t.index + })), (function (e) { + return e.value + }))) + })) + }; + o.filter = y(_), o.filterSeries = v(_), o.select = o.filter, o.selectSeries = o.filterSeries; + var E = function (e, t, n, r) { + var i = []; + e(t = h(t, (function (e, t) { + return { + index: t, + value: e + } + })), (function (e, t) { + n(e.value, (function (n) { + n || i.push(e), t() + })) + }), (function (e) { + r(h(i.sort((function (e, t) { + return e.index - t.index + })), (function (e) { + return e.value + }))) + })) + }; + o.reject = y(E), o.rejectSeries = v(E); + var S = function (e, t, n, r) { + e(t, (function (e, t) { + n(e, (function (n) { + n ? (r(e), r = s) : t() + })) + }), (function (e) { + r() + })) + }; + o.detect = y(S), o.detectSeries = v(S), o.some = function (e, t, n) { + o.each(e, (function (e, r) { + t(e, (function (e) { + e && (n(!0), n = s), r() + })) + }), (function (e) { + n(!1) + })) + }, o.any = o.some, o.every = function (e, t, n) { + o.each(e, (function (e, r) { + t(e, (function (e) { + e || (n(!1), n = s), r() + })) + }), (function (e) { + n(!0) + })) + }, o.all = o.every, o.sortBy = function (e, t, n) { + o.map(e, (function (e, n) { + t(e, (function (t, r) { + t ? n(t) : n(null, { + value: e, + criteria: r + }) + })) + }), (function (e, t) { + if (e) return n(e); + n(null, h(t.sort((function (e, t) { + var n = e.criteria, + r = t.criteria; + return n < r ? -1 : n > r ? 1 : 0 + })), (function (e) { + return e.value + }))) + })) + }, o.auto = function (e, t) { + t = t || s; + var n = p(e), + r = n.length; + if (!r) return t(); + var i = {}, + a = [], + c = function (e) { + a.unshift(e) + }, + l = function () { + r--, f(a.slice(0), (function (e) { + e() + })) + }; + c((function () { + if (!r) { + var e = t; + t = s, e(null, i) + } + })), f(n, (function (n) { + for (var r, h = u(e[n]) ? e[n] : [e[n]], m = function (e) { + var r = d(arguments, 1); + if (r.length <= 1 && (r = r[0]), e) { + var a = {}; + f(p(i), (function (e) { + a[e] = i[e] + })), a[n] = r, t(e, a), t = s + } else i[n] = r, o.setImmediate(l) + }, g = h.slice(0, Math.abs(h.length - 1)) || [], y = g.length; y--;) { + if (!(r = e[g[y]])) throw new Error("Has inexistant dependency"); + if (u(r) && ~r.indexOf(n)) throw new Error("Has cyclic dependencies") + } + var v = function () { + return e = function (e, t) { + return e && i.hasOwnProperty(t) + }, t = !0, f(g, (function (n, r, i) { + t = e(t, n, r, i) + })), t && !i.hasOwnProperty(n); + var e, t + }; + if (v()) h[h.length - 1](m, i); + else { + var w = function () { + v() && (! function (e) { + for (var t = 0; t < a.length; t += 1) + if (a[t] === e) return void a.splice(t, 1) + }(w), h[h.length - 1](m, i)) + }; + c(w) + } + })) + }, o.retry = function (e, t, n) { + var r = []; + "function" == typeof e && (n = t, t = e, e = 5), e = parseInt(e, 10) || 5; + var i = function (i, s) { + for (var a = function (e, t) { + return function (n) { + e((function (e, r) { + n(!e || t, { + err: e, + result: r + }) + }), s) + } + }; e;) r.push(a(t, !(e -= 1))); + o.series(r, (function (e, t) { + t = t[t.length - 1], (i || n)(t.err, t.result) + })) + }; + return n ? i() : i + }, o.waterfall = function (e, t) { + if (t = t || s, !u(e)) { + var n = new Error("First argument to waterfall must be an array of functions"); + return t(n) } - })() - } - }, - S = function (e) { - return function () { - var n = h(arguments); - return e.apply(null, [a.each].concat(n)) - } - }, - w = function (e, n) { - return function () { - var t = h(arguments); - return n.apply(null, [_(e)].concat(t)) - } - }, - v = function (e) { - return function () { - var n = h(arguments); - return e.apply(null, [a.eachSeries].concat(n)) - } - }, - x = function (e, n, t, r) { - if (n = u(n, function (e, n) { - return { - index: n, - value: e + if (!e.length) return t(); + var r = function (e) { + return function (n) { + if (n) t.apply(null, arguments), t = s; + else { + var i = d(arguments, 1), + a = e.next(); + a ? i.push(r(a)) : i.push(t), o.setImmediate((function () { + e.apply(null, i) + })) + } + } + }; + r(o.iterator(e))() + }; + var x = function (e, t, n) { + if (n = n || s, u(t)) e.map(t, (function (e, t) { + e && e((function (e) { + var n = d(arguments, 1); + n.length <= 1 && (n = n[0]), t.call(null, e, n) + })) + }), n); + else { + var r = {}; + e.each(p(t), (function (e, n) { + t[e]((function (t) { + var i = d(arguments, 1); + i.length <= 1 && (i = i[0]), r[e] = i, n(t) + })) + }), (function (e) { + n(e, r) + })) } - }), !r) e(n, function (e, n) { - t(e.value, function (e) { - n(e) - }) - }); - else { - var o = []; - e(n, function (e, n) { - t(e.value, function (t, r) { - o[e.index] = r, n(t) - }) - }, function (e) { - r(e, o) - }) + }; + o.parallel = function (e, t) { + x({ + map: o.map, + each: o.each + }, e, t) + }, o.parallelLimit = function (e, t, n) { + x({ + map: b(t), + each: m(t) + }, e, n) + }, o.series = function (e, t) { + if (t = t || s, u(e)) o.mapSeries(e, (function (e, t) { + e && e((function (e) { + var n = d(arguments, 1); + n.length <= 1 && (n = n[0]), t.call(null, e, n) + })) + }), t); + else { + var n = {}; + o.eachSeries(p(e), (function (t, r) { + e[t]((function (e) { + var i = d(arguments, 1); + i.length <= 1 && (i = i[0]), n[t] = i, r(e) + })) + }), (function (e) { + t(e, n) + })) + } + }, o.iterator = function (e) { + var t = function (n) { + var r = function () { + return e.length && e[n].apply(null, arguments), r.next() + }; + return r.next = function () { + return n < e.length - 1 ? t(n + 1) : null + }, r + }; + return t(0) + }, o.apply = function (e) { + var t = d(arguments, 1); + return function () { + return e.apply(null, t.concat(d(arguments))) + } + }; + var C = function (e, t, n, r) { + var i = []; + e(t, (function (e, t) { + n(e, (function (e, n) { + i = i.concat(n || []), t(e) + })) + }), (function (e) { + r(e, i) + })) + }; + o.concat = y(C), o.concatSeries = v(C), o.whilst = function (e, t, n) { + e() ? t((function (r) { + if (r) return n(r); + o.whilst(e, t, n) + })) : n() + }, o.doWhilst = function (e, t, n) { + e((function (r) { + if (r) return n(r); + var i = d(arguments, 1); + t.apply(null, i) ? o.doWhilst(e, t, n) : n() + })) + }, o.until = function (e, t, n) { + e() ? n() : t((function (r) { + if (r) return n(r); + o.until(e, t, n) + })) + }, o.doUntil = function (e, t, n) { + e((function (r) { + if (r) return n(r); + var i = d(arguments, 1); + t.apply(null, i) ? n() : o.doUntil(e, t, n) + })) + }, o.queue = function (e, t) { + if (void 0 === t) t = 1; + else if (0 === t) throw new Error("Concurrency must not be zero"); + + function n(e, t, n, r) { + if (e.started || (e.started = !0), u(t) || (t = [t]), 0 === t.length) return o.setImmediate((function () { + e.drain && e.drain() + })); + f(t, (function (t) { + var i = { + data: t, + callback: "function" == typeof r ? r : null + }; + n ? e.tasks.unshift(i) : e.tasks.push(i), e.saturated && e.tasks.length === e.concurrency && e.saturated(), o.setImmediate(e.process) + })) + } + var r = 0, + i = { + tasks: [], + concurrency: t, + saturated: null, + empty: null, + drain: null, + started: !1, + paused: !1, + push: function (e, t) { + n(i, e, !1, t) + }, + kill: function () { + i.drain = null, i.tasks = [] + }, + unshift: function (e, t) { + n(i, e, !0, t) + }, + process: function () { + if (!i.paused && r < i.concurrency && i.tasks.length) { + var t = i.tasks.shift(); + i.empty && 0 === i.tasks.length && i.empty(), r += 1; + var n = a((function () { + r -= 1, t.callback && t.callback.apply(t, arguments), i.drain && i.tasks.length + r === 0 && i.drain(), i.process() + })); + e(t.data, n) + } + }, + length: function () { + return i.tasks.length + }, + running: function () { + return r + }, + idle: function () { + return i.tasks.length + r === 0 + }, + pause: function () { + !0 !== i.paused && (i.paused = !0) + }, + resume: function () { + if (!1 !== i.paused) { + i.paused = !1; + for (var e = Math.min(i.concurrency, i.tasks.length), t = 1; t <= e; t++) o.setImmediate(i.process) + } + } + }; + return i + }, o.priorityQueue = function (e, t) { + function n(e, t) { + return e.priority - t.priority + } + var r = o.queue(e, t); + return r.push = function (e, t, i) { + ! function (e, t, r, i) { + if (e.started || (e.started = !0), u(t) || (t = [t]), 0 === t.length) return o.setImmediate((function () { + e.drain && e.drain() + })); + f(t, (function (t) { + var s = { + data: t, + priority: r, + callback: "function" == typeof i ? i : null + }; + e.tasks.splice(function (e, t, n) { + for (var r = -1, i = e.length - 1; r < i;) { + var o = r + (i - r + 1 >>> 1); + n(t, e[o]) >= 0 ? r = o : i = o - 1 + } + return r + }(e.tasks, s, n) + 1, 0, s), e.saturated && e.tasks.length === e.concurrency && e.saturated(), o.setImmediate(e.process) + })) + }(r, e, t, i) + }, delete r.unshift, r + }, o.cargo = function (e, t) { + var n = !1, + r = [], + i = { + tasks: r, + payload: t, + saturated: null, + empty: null, + drain: null, + drained: !0, + push: function (e, n) { + u(e) || (e = [e]), f(e, (function (e) { + r.push({ + data: e, + callback: "function" == typeof n ? n : null + }), i.drained = !1, i.saturated && r.length === t && i.saturated() + })), o.setImmediate(i.process) + }, + process: function o() { + if (!n) { + if (0 === r.length) return i.drain && !i.drained && i.drain(), void(i.drained = !0); + var s = "number" == typeof t ? r.splice(0, t) : r.splice(0, r.length), + a = h(s, (function (e) { + return e.data + })); + i.empty && i.empty(), n = !0, e(a, (function () { + n = !1; + var e = arguments; + f(s, (function (t) { + t.callback && t.callback.apply(null, e) + })), o() + })) + } + }, + length: function () { + return r.length + }, + running: function () { + return n + } + }; + return i + }; + var O = function (e) { + return function (t) { + var n = d(arguments, 1); + t.apply(null, n.concat([function (t) { + var n = d(arguments, 1); + "undefined" != typeof console && (t ? console.error && console.error(t) : console[e] && f(n, (function (t) { + console[e](t) + }))) + }])) + } + }; + o.log = O("log"), o.dir = O("dir"), o.memoize = function (e, t) { + var n = {}, + r = {}; + t = t || function (e) { + return e + }; + var i = function () { + var i = d(arguments), + s = i.pop(), + a = t.apply(null, i); + a in n ? o.nextTick((function () { + s.apply(null, n[a]) + })) : a in r ? r[a].push(s) : (r[a] = [s], e.apply(null, i.concat([function () { + n[a] = d(arguments); + var e = r[a]; + delete r[a]; + for (var t = 0, i = e.length; t < i; t++) e[t].apply(null, arguments) + }]))) + }; + return i.memo = n, i.unmemoized = e, i + }, o.unmemoize = function (e) { + return function () { + return (e.unmemoized || e).apply(null, arguments) + } + }, o.times = function (e, t, n) { + for (var r = [], i = 0; i < e; i++) r.push(i); + return o.map(r, t, n) + }, o.timesSeries = function (e, t, n) { + for (var r = [], i = 0; i < e; i++) r.push(i); + return o.mapSeries(r, t, n) + }, o.seq = function () { + var e = arguments; + return function () { + var t = this, + n = d(arguments), + r = n.pop(); + o.reduce(e, n, (function (e, n, r) { + n.apply(t, e.concat([function () { + var e = arguments[0], + t = d(arguments, 1); + r(e, t) + }])) + }), (function (e, n) { + r.apply(t, [e].concat(n)) + })) + } + }, o.compose = function () { + return o.seq.apply(null, Array.prototype.reverse.call(arguments)) + }; + var k = function (e, t) { + var n = function () { + var n = this, + r = d(arguments), + i = r.pop(); + return e(t, (function (e, t) { + e.apply(n, r.concat([t])) + }), i) + }; + if (arguments.length > 2) { + var r = d(arguments, 2); + return n.apply(this, r) + } + return n + }; + o.applyEach = y(k), o.applyEachSeries = v(k), o.forever = function (e, t) { + ! function n(r) { + if (r) { + if (t) return t(r); + throw r + } + e(n) + }() + }, e.exports ? e.exports = o : void 0 === (r = function () { + return o + }.apply(t, [])) || (e.exports = r) + }() +}, function (e, t) { + e.exports = require("zlib") +}, function (e, t, n) { + var r = n(9), + i = n(80), + o = t; + o.getAllInfo = function (e) { + return { + date: (new Date).toString(), + process: o.getProcessInfo(), + os: o.getOsInfo(), + trace: o.getTrace(e), + stack: e.stack && e.stack.split("\n") } - }; - a.map = S(x), a.mapSeries = v(x), a.mapLimit = function (e, n, t, r) { - return E(n)(e, t, r) - }; - var E = function (e) { - return w(e, x) - }; - a.reduce = function (e, n, t, r) { - a.eachSeries(e, function (e, r) { - t(n, e, function (e, t) { - n = t, r(e) - }) - }, function (e) { - r(e, n) - }) - }, a.inject = a.reduce, a.foldl = a.reduce, a.reduceRight = function (e, n, t, r) { - var o = u(e, function (e) { - return e - }).reverse(); - a.reduce(o, n, t, r) - }, a.foldr = a.reduceRight; - var C = function (e, n, t, r) { - var o = []; - n = u(n, function (e, n) { + }, o.getProcessInfo = function () { return { - index: n, - value: e + pid: process.pid, + uid: process.getuid ? process.getuid() : null, + gid: process.getgid ? process.getgid() : null, + cwd: process.cwd(), + execPath: process.execPath, + version: process.version, + argv: process.argv, + memoryUsage: process.memoryUsage() } - }), e(n, function (e, n) { - t(e.value, function (t) { - t && o.push(e), n() - }) - }, function () { - r(u(o.sort(function (e, n) { - return e.index - n.index - }), function (e) { - return e.value - })) - }) - }; - a.filter = S(C), a.filterSeries = v(C), a.select = a.filter, a.selectSeries = a.filterSeries; - var k = function (e, n, t, r) { - var o = []; - n = u(n, function (e, n) { + }, o.getOsInfo = function () { return { - index: n, - value: e + loadavg: r.loadavg(), + uptime: r.uptime() } - }), e(n, function (e, n) { - t(e.value, function (t) { - t || o.push(e), n() - }) - }, function () { - r(u(o.sort(function (e, n) { - return e.index - n.index - }), function (e) { - return e.value + }, o.getTrace = function (e) { + return (e ? i.parse(e) : i.get()).map((function (e) { + return { + column: e.getColumnNumber(), + file: e.getFileName(), + function: e.getFunctionName(), + line: e.getLineNumber(), + method: e.getMethodName(), + native: e.isNative() + } })) - }) - }; - a.reject = S(k), a.rejectSeries = v(k); - var M = function (e, n, t, r) { - e(n, function (e, n) { - t(e, function (t) { - t ? (r(e), r = i) : n() - }) - }, function () { - r() - }) - }; - a.detect = S(M), a.detectSeries = v(M), a.some = function (e, n, t) { - a.each(e, function (e, r) { - n(e, function (e) { - e && (t(!0), t = i), r() - }) - }, function () { - t(!1) - }) - }, a.any = a.some, a.every = function (e, n, t) { - a.each(e, function (e, r) { - n(e, function (e) { - e || (t(!1), t = i), r() + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(2), + o = ["access", "appendFile", "chmod", "chown", "close", "copyFile", "fchmod", "fchown", "fdatasync", "fstat", "fsync", "ftruncate", "futimes", "lchown", "lchmod", "link", "lstat", "mkdir", "mkdtemp", "open", "readFile", "readdir", "readlink", "realpath", "rename", "rmdir", "stat", "symlink", "truncate", "unlink", "utimes", "writeFile"].filter(e => "function" == typeof i[e]); + Object.keys(i).forEach(e => { + "promises" !== e && (t[e] = i[e]) + }), o.forEach(e => { + t[e] = r(i[e]) + }), t.exists = function (e, t) { + return "function" == typeof t ? i.exists(e, t) : new Promise(t => i.exists(e, t)) + }, t.read = function (e, t, n, r, o, s) { + return "function" == typeof s ? i.read(e, t, n, r, o, s) : new Promise((s, a) => { + i.read(e, t, n, r, o, (e, t, n) => { + if (e) return a(e); + s({ + bytesRead: t, + buffer: n + }) + }) }) - }, function () { - t(!0) - }) - }, a.all = a.every, a.sortBy = function (e, n, t) { - a.map(e, function (e, t) { - n(e, function (n, r) { - n ? t(n) : t(null, { - value: e, - criteria: r - }) + }, t.write = function (e, t, ...n) { + return "function" == typeof n[n.length - 1] ? i.write(e, t, ...n) : new Promise((r, o) => { + i.write(e, t, ...n, (e, t, n) => { + if (e) return o(e); + r({ + bytesWritten: t, + buffer: n + }) + }) }) - }, function (e, n) { - if (e) return t(e); - t(null, u(n.sort(function (e, n) { - var t = e.criteria, - r = n.criteria; - return t < r ? -1 : t > r ? 1 : 0 - }), function (e) { - return e.value - })) - }) - }, a.auto = function (e, n) { - n = n || i; - var t = f(e), - r = t.length; - if (!r) return n(); - var o = {}, - s = [], - d = function (e) { - s.unshift(e) + } +}, function (e, t) { + e.exports = require("constants") +}, function (e, t, n) { + "use strict"; + e.exports = { + copySync: n(86) + } +}, function (e, t, n) { + "use strict"; + const r = n(1); + + function i(e) { + return (e = r.normalize(r.resolve(e)).split(r.sep)).length > 0 ? e[0] : null + } + const o = /[<>:"|?*]/; + e.exports = { + getRootPath: i, + invalidWin32Path: function (e) { + const t = i(e); + return e = e.replace(t, ""), o.test(e) + } + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(9), + o = n(1); + e.exports = { + hasMillisRes: function (e) { + let t = o.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2)); + t = o.join(i.tmpdir(), t); + const n = new Date(1435410243862); + r.writeFile(t, "https://github.com/jprichardson/node-fs-extra/pull/141", i => { + if (i) return e(i); + r.open(t, "r+", (i, o) => { + if (i) return e(i); + r.futimes(o, n, n, n => { + if (n) return e(n); + r.close(o, n => { + if (n) return e(n); + r.stat(t, (t, n) => { + if (t) return e(t); + e(null, n.mtime > 1435410243e3) + }) + }) + }) + }) + }) }, - l = function (e) { - for (var n = 0; n < s.length; n += 1) - if (s[n] === e) return void s.splice(n, 1) + hasMillisResSync: function () { + let e = o.join("millis-test-sync" + Date.now().toString() + Math.random().toString().slice(2)); + e = o.join(i.tmpdir(), e); + const t = new Date(1435410243862); + r.writeFileSync(e, "https://github.com/jprichardson/node-fs-extra/pull/141"); + const n = r.openSync(e, "r+"); + return r.futimesSync(n, t, t), r.closeSync(n), r.statSync(e).mtime > 1435410243e3 }, - u = function () { - r--, p(s.slice(0), function (e) { - e() - }) - }; - d(function () { - if (!r) { - var e = n; - n = i, e(null, o) - } - }), p(t, function (t) { - for (var r = c(e[t]) ? e[t] : [e[t]], s = function (e) { - var r = h(arguments, 1); - if (1 >= r.length && (r = r[0]), e) { - var s = {}; - p(f(o), function (e) { - s[e] = o[e] - }), s[t] = r, n(e, s), n = i - } else o[t] = r, a.setImmediate(u) - }, g = r.slice(0, Math.abs(r.length - 1)) || [], y = g.length, _; y--;) { - if (!(_ = e[g[y]])) throw new Error('Has inexistant dependency'); - if (c(_) && !!~_.indexOf(t)) throw new Error('Has cyclic dependencies') - } - var b = function () { - return m(g, function (e, n) { - return e && o.hasOwnProperty(n) - }, !0) && !o.hasOwnProperty(t) - }; - if (b()) r[r.length - 1](s, o); - else { - var S = function () { - b() && (l(S), r[r.length - 1](s, o)) - }; - d(S) - } - }) - }, a.retry = function (e, n, t) { - var r = 5, - o = []; - 'function' == typeof e && (t = n, n = e, e = r), e = parseInt(e, 10) || r; - var i = function (r, i) { - for (var s = function (e, n) { - return function (t) { - e(function (e, r) { - t(!e || n, { - err: e, - result: r + timeRemoveMillis: function (e) { + if ("number" == typeof e) return 1e3 * Math.floor(e / 1e3); + if (e instanceof Date) return new Date(1e3 * Math.floor(e.getTime() / 1e3)); + throw new Error("fs-extra: timeRemoveMillis() unknown parameter type") + }, + utimesMillis: function (e, t, n, i) { + r.open(e, "r+", (e, o) => { + if (e) return i(e); + r.futimes(o, t, n, e => { + r.close(o, t => { + i && i(e || t) + }) }) - }, i) - } - }; e;) o.push(s(n, !(e -= 1))); - a.series(o, function (e, n) { - n = n[n.length - 1], (r || t)(n.err, n.result) - }) - }; - return t ? i() : i - }, a.waterfall = function (e, n) { - if (n = n || i, !c(e)) { - var t = new Error('First argument to waterfall must be an array of functions'); - return n(t) - } - if (!e.length) return n(); - var r = function (e) { - return function (t) { - if (t) n.apply(null, arguments), n = i; - else { - var o = h(arguments, 1), - s = e.next(); - s ? o.push(r(s)) : o.push(n), a.setImmediate(function () { - e.apply(null, o) }) - } + }, + utimesMillisSync: function (e, t, n) { + const i = r.openSync(e, "r+"); + return r.futimesSync(i, t, n), r.closeSync(i) + } + } +}, function (e, t, n) { + "use strict"; + e.exports = function (e) { + if ("function" == typeof Buffer.allocUnsafe) try { + return Buffer.allocUnsafe(e) + } catch (t) { + return new Buffer(e) + } + return new Buffer(e) + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback; + e.exports = { + copy: r(n(89)) + } +}, function (e, t, n) { + var r; + try { + r = n(99) + } catch (e) { + r = n(3) + } + + function i(e, t) { + var n, r = "\n"; + return "object" == typeof t && null !== t && (t.spaces && (n = t.spaces), t.EOL && (r = t.EOL)), JSON.stringify(e, t ? t.replacer : null, n).replace(/\n/g, r) + r + } + + function o(e) { + return Buffer.isBuffer(e) && (e = e.toString("utf8")), e = e.replace(/^\uFEFF/, "") + } + var s = { + readFile: function (e, t, n) { + null == n && (n = t, t = {}), "string" == typeof t && (t = { + encoding: t + }); + var i = (t = t || {}).fs || r, + s = !0; + "throws" in t && (s = t.throws), i.readFile(e, t, (function (r, i) { + if (r) return n(r); + var a; + i = o(i); + try { + a = JSON.parse(i, t ? t.reviver : null) + } catch (t) { + return s ? (t.message = e + ": " + t.message, n(t)) : n(null, null) + } + n(null, a) + })) + }, + readFileSync: function (e, t) { + "string" == typeof (t = t || {}) && (t = { + encoding: t + }); + var n = t.fs || r, + i = !0; + "throws" in t && (i = t.throws); + try { + var s = n.readFileSync(e, t); + return s = o(s), JSON.parse(s, t.reviver) + } catch (t) { + if (i) throw t.message = e + ": " + t.message, t; + return null + } + }, + writeFile: function (e, t, n, o) { + null == o && (o = n, n = {}); + var s = (n = n || {}).fs || r, + a = ""; + try { + a = i(t, n) + } catch (e) { + return void(o && o(e, null)) + } + s.writeFile(e, a, n, o) + }, + writeFileSync: function (e, t, n) { + var o = (n = n || {}).fs || r, + s = i(t, n); + return o.writeFileSync(e, s, n) } - }; - r(a.iterator(e))() }; - var L = function (e, n, t) { - if (t = t || i, c(n)) e.map(n, function (e, n) { - e && e(function (e) { - var t = h(arguments, 1); - 1 >= t.length && (t = t[0]), n.call(null, e, t) - }) - }, t); - else { - var r = {}; - e.each(f(n), function (e, t) { - n[e](function (n) { - var o = h(arguments, 1); - 1 >= o.length && (o = o[0]), r[e] = o, t(n) - }) - }, function (e) { - t(e, r) - }) - } - }; - a.parallel = function (e, n) { - L({ - map: a.map, - each: a.each - }, e, n) - }, a.parallelLimit = function (e, n, t) { - L({ - map: E(n), - each: _(n) - }, e, t) - }, a.series = function (e, n) { - if (n = n || i, c(e)) a.mapSeries(e, function (e, n) { - e && e(function (e) { - var t = h(arguments, 1); - 1 >= t.length && (t = t[0]), n.call(null, e, t) - }) - }, n); - else { - var t = {}; - a.eachSeries(f(e), function (n, r) { - e[n](function (e) { - var o = h(arguments, 1); - 1 >= o.length && (o = o[0]), t[n] = o, r(e) - }) - }, function (e) { - n(e, t) - }) - } - }, a.iterator = function (e) { - var n = function (t) { - var r = function () { - return e.length && e[t].apply(null, arguments), r.next() + e.exports = s +}, function (e, t, n) { + "use strict"; + var r = n(3); + e.exports = function (e) { + if (null === e || "object" != typeof e) return e; + if (e instanceof Object) var t = { + __proto__: e.__proto__ }; - return r.next = function () { - return t < e.length - 1 ? n(t + 1) : null - }, r - }; - return n(0) - }, a.apply = function (e) { - var n = h(arguments, 1); - return function () { - return e.apply(null, n.concat(h(arguments))) - } - }; - var O = function (e, n, t, o) { - var i = []; - e(n, function (e, n) { - t(e, function (e, t) { - i = i.concat(t || []), n(e) - }) - }, function (e) { - o(e, i) - }) - }; - a.concat = S(O), a.concatSeries = v(O), a.whilst = function (e, n, t) { - e() ? n(function (r) { - return r ? t(r) : void a.whilst(e, n, t) - }) : t() - }, a.doWhilst = function (e, n, t) { - e(function (r) { - if (r) return t(r); - var o = h(arguments, 1); - n.apply(null, o) ? a.doWhilst(e, n, t) : t() - }) - }, a.until = function (e, n, t) { - e() ? t() : n(function (r) { - return r ? t(r) : void a.until(e, n, t) - }) - }, a.doUntil = function (e, n, t) { - e(function (r) { - if (r) return t(r); - var o = h(arguments, 1); - n.apply(null, o) ? t() : a.doUntil(e, n, t) - }) - }, a.queue = function (e, n) { - function t(e, n, t, r) { - return e.started || (e.started = !0), c(n) || (n = [n]), 0 === n.length ? a.setImmediate(function () { - e.drain && e.drain() - }) : void p(n, function (n) { - var o = { - data: n, - callback: 'function' == typeof r ? r : null - }; - t ? e.tasks.unshift(o) : e.tasks.push(o), e.saturated && e.tasks.length === e.concurrency && e.saturated(), a.setImmediate(e.process) - }) - } - if (n === void 0) n = 1; - else if (0 === n) throw new Error('Concurrency must not be zero'); - var r = 0, - i = { - tasks: [], - concurrency: n, - saturated: null, - empty: null, - drain: null, - started: !1, - paused: !1, - push: function (e, n) { - t(i, e, !1, n) - }, - kill: function () { - i.drain = null, i.tasks = [] - }, - unshift: function (e, n) { - t(i, e, !0, n) - }, - process: function () { - if (!i.paused && r < i.concurrency && i.tasks.length) { - var n = i.tasks.shift(); - i.empty && 0 === i.tasks.length && i.empty(), r += 1; - var t = function () { - r -= 1, n.callback && n.callback.apply(n, arguments), i.drain && 0 === i.tasks.length + r && i.drain(), i.process() - }, - a = o(t); - e(n.data, a) + else t = Object.create(null); + return Object.getOwnPropertyNames(e).forEach((function (n) { + Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n)) + })), t + }(r) +}, function (e, t, n) { + var r = n(1), + i = n(3), + o = parseInt("0777", 8); + + function s(e, t, n, a) { + "function" == typeof t ? (n = t, t = {}) : t && "object" == typeof t || (t = { + mode: t + }); + var c = t.mode, + l = t.fs || i; + void 0 === c && (c = o & ~process.umask()), a || (a = null); + var u = n || function () {}; + e = r.resolve(e), l.mkdir(e, c, (function (n) { + if (!n) return u(null, a = a || e); + switch (n.code) { + case "ENOENT": + s(r.dirname(e), t, (function (n, r) { + n ? u(n, r) : s(e, t, u, r) + })); + break; + default: + l.stat(e, (function (e, t) { + e || !t.isDirectory() ? u(n, a) : u(null, a) + })) } - }, - length: function () { - return i.tasks.length - }, - running: function () { - return r - }, - idle: function () { - return 0 === i.tasks.length + r - }, - pause: function () { - !0 === i.paused || (i.paused = !0) - }, - resume: function () { - if (!1 !== i.paused) { - i.paused = !1; - for (var e = Math.min(i.concurrency, i.tasks.length), n = 1; n <= e; n++) a.setImmediate(i.process) + })) + } + e.exports = s.mkdirp = s.mkdirP = s, s.sync = function e(t, n, s) { + n && "object" == typeof n || (n = { + mode: n + }); + var a = n.mode, + c = n.fs || i; + void 0 === a && (a = o & ~process.umask()), s || (s = null), t = r.resolve(t); + try { + c.mkdirSync(t, a), s = s || t + } catch (i) { + switch (i.code) { + case "ENOENT": + s = e(r.dirname(t), n, s), e(t, n, s); + break; + default: + var l; + try { + l = c.statSync(t) + } catch (e) { + throw i + } + if (!l.isDirectory()) throw i } - } - }; - return i - }, a.priorityQueue = function (e, n) { - function t(e, n) { - return e.priority - n.priority - } - - function r(e, n, t) { - for (var r = -1, o = e.length - 1, i; r < o;) i = r + (o - r + 1 >>> 1), 0 <= t(n, e[i]) ? r = i : o = i - 1; - return r - } - - function o(e, n, o, i) { - return e.started || (e.started = !0), c(n) || (n = [n]), 0 === n.length ? a.setImmediate(function () { - e.drain && e.drain() - }) : void p(n, function (n) { - var s = { - data: n, - priority: o, - callback: 'function' == typeof i ? i : null - }; - e.tasks.splice(r(e.tasks, s, t) + 1, 0, s), e.saturated && e.tasks.length === e.concurrency && e.saturated(), a.setImmediate(e.process) + } + return s + } +}, function (e, t, n) { + var r = n(44), + i = n(17), + o = n(45).ArraySet, + s = n(110).MappingList; + + function a(e) { + e || (e = {}), this._file = i.getArg(e, "file", null), this._sourceRoot = i.getArg(e, "sourceRoot", null), this._skipValidation = i.getArg(e, "skipValidation", !1), this._sources = new o, this._names = new o, this._mappings = new s, this._sourcesContents = null + } + a.prototype._version = 3, a.fromSourceMap = function (e) { + var t = e.sourceRoot, + n = new a({ + file: e.file, + sourceRoot: t + }); + return e.eachMapping((function (e) { + var r = { + generated: { + line: e.generatedLine, + column: e.generatedColumn + } + }; + null != e.source && (r.source = e.source, null != t && (r.source = i.relative(t, r.source)), r.original = { + line: e.originalLine, + column: e.originalColumn + }, null != e.name && (r.name = e.name)), n.addMapping(r) + })), e.sources.forEach((function (t) { + var r = e.sourceContentFor(t); + null != r && n.setSourceContent(t, r) + })), n + }, a.prototype.addMapping = function (e) { + var t = i.getArg(e, "generated"), + n = i.getArg(e, "original", null), + r = i.getArg(e, "source", null), + o = i.getArg(e, "name", null); + this._skipValidation || this._validateMapping(t, n, r, o), null != r && (r = String(r), this._sources.has(r) || this._sources.add(r)), null != o && (o = String(o), this._names.has(o) || this._names.add(o)), this._mappings.add({ + generatedLine: t.line, + generatedColumn: t.column, + originalLine: null != n && n.line, + originalColumn: null != n && n.column, + source: r, + name: o }) - } - var i = a.queue(e, n); - return i.push = function (e, n, t) { - o(i, e, n, t) - }, delete i.unshift, i - }, a.cargo = function (e, n) { - var t = !1, - r = [], - o = { - tasks: r, - payload: n, - saturated: null, - empty: null, - drain: null, - drained: !0, - push: function (e, t) { - c(e) || (e = [e]), p(e, function (e) { - r.push({ - data: e, - callback: 'function' == typeof t ? t : null - }), o.drained = !1, o.saturated && r.length === n && o.saturated() - }), a.setImmediate(o.process) - }, - process: function i() { - if (!t) { - if (0 === r.length) return o.drain && !o.drained && o.drain(), void(o.drained = !0); - var a = 'number' == typeof n ? r.splice(0, n) : r.splice(0, r.length), - s = u(a, function (e) { - return e.data + }, a.prototype.setSourceContent = function (e, t) { + var n = e; + null != this._sourceRoot && (n = i.relative(this._sourceRoot, n)), null != t ? (this._sourcesContents || (this._sourcesContents = Object.create(null)), this._sourcesContents[i.toSetString(n)] = t) : this._sourcesContents && (delete this._sourcesContents[i.toSetString(n)], 0 === Object.keys(this._sourcesContents).length && (this._sourcesContents = null)) + }, a.prototype.applySourceMap = function (e, t, n) { + var r = t; + if (null == t) { + if (null == e.file) throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.'); + r = e.file + } + var s = this._sourceRoot; + null != s && (r = i.relative(s, r)); + var a = new o, + c = new o; + this._mappings.unsortedForEach((function (t) { + if (t.source === r && null != t.originalLine) { + var o = e.originalPositionFor({ + line: t.originalLine, + column: t.originalColumn }); - o.empty && o.empty(), t = !0, e(s, function () { - t = !1; - var e = arguments; - p(a, function (n) { - n.callback && n.callback.apply(null, e) - }), i() - }) + null != o.source && (t.source = o.source, null != n && (t.source = i.join(n, t.source)), null != s && (t.source = i.relative(s, t.source)), t.originalLine = o.line, t.originalColumn = o.column, null != o.name && (t.name = o.name)) } - }, - length: function () { - return r.length - }, - running: function () { - return t - } + var l = t.source; + null == l || a.has(l) || a.add(l); + var u = t.name; + null == u || c.has(u) || c.add(u) + }), this), this._sources = a, this._names = c, e.sources.forEach((function (t) { + var r = e.sourceContentFor(t); + null != r && (null != n && (t = i.join(n, t)), null != s && (t = i.relative(s, t)), this.setSourceContent(t, r)) + }), this) + }, a.prototype._validateMapping = function (e, t, n, r) { + if (t && "number" != typeof t.line && "number" != typeof t.column) throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."); + if ((!(e && "line" in e && "column" in e && e.line > 0 && e.column >= 0) || t || n || r) && !(e && "line" in e && "column" in e && t && "line" in t && "column" in t && e.line > 0 && e.column >= 0 && t.line > 0 && t.column >= 0 && n)) throw new Error("Invalid mapping: " + JSON.stringify({ + generated: e, + source: n, + original: t, + name: r + })) + }, a.prototype._serializeMappings = function () { + for (var e, t, n, o, s = 0, a = 1, c = 0, l = 0, u = 0, f = 0, h = "", p = this._mappings.toArray(), d = 0, m = p.length; d < m; d++) { + if (e = "", (t = p[d]).generatedLine !== a) + for (s = 0; t.generatedLine !== a;) e += ";", a++; + else if (d > 0) { + if (!i.compareByGeneratedPositionsInflated(t, p[d - 1])) continue; + e += "," + } + e += r.encode(t.generatedColumn - s), s = t.generatedColumn, null != t.source && (o = this._sources.indexOf(t.source), e += r.encode(o - f), f = o, e += r.encode(t.originalLine - 1 - l), l = t.originalLine - 1, e += r.encode(t.originalColumn - c), c = t.originalColumn, null != t.name && (n = this._names.indexOf(t.name), e += r.encode(n - u), u = n)), h += e + } + return h + }, a.prototype._generateSourcesContent = function (e, t) { + return e.map((function (e) { + if (!this._sourcesContents) return null; + null != t && (e = i.relative(t, e)); + var n = i.toSetString(e); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, n) ? this._sourcesContents[n] : null + }), this) + }, a.prototype.toJSON = function () { + var e = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() }; - return o - }; - var P = function (e) { - return function (n) { - var t = h(arguments, 1); - n.apply(null, t.concat([function (n) { - var t = h(arguments, 1); - 'undefined' != typeof console && (n ? console.error && console.error(n) : console[e] && p(t, function (n) { - console[e](n) - })) - }])) - } - }; - a.log = P('log'), a.dir = P('dir'), a.memoize = function (e, n) { - var t = {}, - r = {}; - n = n || function (e) { + return null != this._file && (e.file = this._file), null != this._sourceRoot && (e.sourceRoot = this._sourceRoot), this._sourcesContents && (e.sourcesContent = this._generateSourcesContent(e.sources, e.sourceRoot)), e + }, a.prototype.toString = function () { + return JSON.stringify(this.toJSON()) + }, t.SourceMapGenerator = a +}, function (e, t, n) { + var r = n(109); + t.encode = function (e) { + var t, n = "", + i = function (e) { + return e < 0 ? 1 + (-e << 1) : 0 + (e << 1) + }(e); + do { + t = 31 & i, (i >>>= 5) > 0 && (t |= 32), n += r.encode(t) + } while (i > 0); + return n + }, t.decode = function (e, t, n) { + var i, o, s, a, c = e.length, + l = 0, + u = 0; + do { + if (t >= c) throw new Error("Expected more digits in base 64 VLQ value."); + if (-1 === (o = r.decode(e.charCodeAt(t++)))) throw new Error("Invalid base64 digit: " + e.charAt(t - 1)); + i = !!(32 & o), l += (o &= 31) << u, u += 5 + } while (i); + n.value = (a = (s = l) >> 1, 1 == (1 & s) ? -a : a), n.rest = t + } +}, function (e, t, n) { + var r = n(17), + i = Object.prototype.hasOwnProperty, + o = "undefined" != typeof Map; + + function s() { + this._array = [], this._set = o ? new Map : Object.create(null) + } + s.fromArray = function (e, t) { + for (var n = new s, r = 0, i = e.length; r < i; r++) n.add(e[r], t); + return n + }, s.prototype.size = function () { + return o ? this._set.size : Object.getOwnPropertyNames(this._set).length + }, s.prototype.add = function (e, t) { + var n = o ? e : r.toSetString(e), + s = o ? this.has(e) : i.call(this._set, n), + a = this._array.length; + s && !t || this._array.push(e), s || (o ? this._set.set(e, a) : this._set[n] = a) + }, s.prototype.has = function (e) { + if (o) return this._set.has(e); + var t = r.toSetString(e); + return i.call(this._set, t) + }, s.prototype.indexOf = function (e) { + if (o) { + var t = this._set.get(e); + if (t >= 0) return t + } else { + var n = r.toSetString(e); + if (i.call(this._set, n)) return this._set[n] + } + throw new Error('"' + e + '" is not in the set.') + }, s.prototype.at = function (e) { + if (e >= 0 && e < this._array.length) return this._array[e]; + throw new Error("No element indexed by " + e) + }, s.prototype.toArray = function () { + return this._array.slice() + }, t.ArraySet = s +}, function (e, t) {}, function (e, t, n) { + "use strict"; + n.d(t, "a", (function () { + return i + })); + var r = n(0); + + function i() { + const e = r.Menu.getApplicationMenu(); + if (e) + for (const t of e.items) o(t) + } + + function o(e) { + let t = !1; + if (e.submenu instanceof r.Menu) + for (const n of e.submenu.items) o(n) && (t = !0); + if (t || e.role) return !0; + const n = e.id; + return "show-devtools" === n || "reload-window" === n || (e.enabled = !1, !1) + } +}, function (e, t, n) { + "use strict"; + + function* r(e) { + for (const t of e.items) yield t, "submenu" === t.type && void 0 !== t.submenu && (yield* r(t.submenu)) + } + n.d(t, "a", (function () { + return r + })) +}, function (e, t, n) { + "use strict"; + n.d(t, "a", (function () { + return l + })); + var r = n(0), + i = n(22); + var o = n(23), + s = n(4), + a = n(19); + var c; + + function l({ + selectedExternalEditor: e, + selectedShell: t, + askForConfirmationOnForcePush: n, + askForConfirmationOnRepositoryRemoval: l, + hasCurrentPullRequest: h = !1, + defaultBranchName: p = "default branch", + isForcePushForCurrentRepository: m = !1, + isStashedChangesVisible: g = !1, + askForConfirmationWhenStashingAllChanges: y = !0 + }) { + p = function (e, t) { + if (e.length <= t) return e; + const n = [...e]; + if (n.length <= t) return e; + const r = n.reduce((e, t) => (t >= "︀" && t <= "️" ? e.length && e.push(`${e.pop()}${t}`) : e.push(t), e), []); + return r.length <= t ? e : r.slice(0, t).join("") + "…" + }(p, 25); + const v = l ? "&删除…" : "&删除", + w = h ? "显示拉取请求" : "创建拉取请求", + b = null === t ? "用CMD打开" : "用" + t+"打开", + _ = null === e ? "用external editor打开" : "用" + e+"打开", + E = new Array, + S = { + type: "separator" + }; + const x = { + label: "文件(&F)", + submenu: [{ + label: "新建 存储库…", + id: "new-repository", + click: f("create-repository"), + accelerator: "CmdOrCtrl+N" + }, S, { + label: "添加 本地存储库…", + id: "add-local-repository", + accelerator: "CmdOrCtrl+O", + click: f("add-local-repository") + }, { + label: "克隆 存储库…", + id: "clone-repository", + accelerator: "CmdOrCtrl+Shift+O", + click: f("clone-repository") + }] + }; + x.submenu.push(S, { + label: "&选项…", + id: "preferences", + accelerator: "CmdOrCtrl+,", + click: f("show-preferences") + }, S, { + role: "quit", + label: "退出", + accelerator: "Alt+F4" + }); + E.push(x), E.push({ + label: "编辑(&E)", + submenu: [{ + role: "undo", + label: "&撤消" + }, { + role: "redo", + label: "&恢复" + }, S, { + role: "cut", + label: "剪切" + }, { + role: "copy", + label: "&复制" + }, { + role: "paste", + label: "&粘贴" + }, { + label: "全选", + accelerator: "CmdOrCtrl+A", + click: f("select-all") + }, S, { + id: "find", + label: "&查找", + accelerator: "CmdOrCtrl+F", + click: f("find-text") + }] + }), E.push({ + label: "视图(&V)", + submenu: [{ + label: "&更改", + id: "show-changes", + accelerator: "CmdOrCtrl+1", + click: f("show-changes") + }, { + label: "&历史", + id: "show-history", + accelerator: "CmdOrCtrl+2", + click: f("show-history") + }, { + label: "存储库列表", + id: "show-repository-list", + accelerator: "CmdOrCtrl+T", + click: f("choose-repository") + }, { + label: "分支列表", + id: "show-branches-list", + accelerator: "CmdOrCtrl+B", + click: f("show-branches") + }, S, { + label: "转到摘要", + id: "go-to-commit-message", + accelerator: "CmdOrCtrl+G", + click: f("go-to-commit-message") + }, { + label: u(g), + id: "toggle-stashed-changes", + accelerator: "Ctrl+H", + click: f(g ? "hide-stashed-changes" : "show-stashed-changes") + }, { + label: "全屏切换", + role: "togglefullscreen" + }, S, { + label: "重置缩放", + accelerator: "CmdOrCtrl+0", + click: d(c.Reset) + }, { + label: "放大", + accelerator: "CmdOrCtrl+=", + click: d(c.In) + }, { + label: "缩小", + accelerator: "CmdOrCtrl+-", + click: d(c.Out) + }, S, { + label: "&重载", + id: "reload-window", + accelerator: "CmdOrCtrl+Alt+R", + click(e, t) { + t && t.reload() + }, + visible: !1 + }, { + id: "show-devtools", + label: "&开发工具", + accelerator: "Ctrl+Shift+I", + click(e, t) { + t && t.webContents.toggleDevTools() + } + }] + }); + const C = function (e, t) { + if (!e) return "推送"; + if (t) return "强制推送…"; + return "强制推送" + }(m, n), + O = m ? "force-push" : "push"; + E.push({ + label: "存储库(&R)", + id: "repository", + submenu: [{ + id: "push", + label: C, + accelerator: "CmdOrCtrl+P", + click: f(O) + }, { + id: "pull", + label: "拉取", + accelerator: "CmdOrCtrl+Shift+P", + click: f("pull") + }, { + label: v, + id: "remove-repository", + accelerator: "CmdOrCtrl+Backspace", + click: f("remove-repository") + }, S, { + id: "view-repository-on-github", + label: "在Github上查看", + accelerator: "CmdOrCtrl+Shift+G", + click: f("view-repository-on-github") + }, { + label: b, + id: "open-in-shell", + accelerator: "Ctrl+`", + click: f("open-in-shell") + }, { + label: "资源管理器", + id: "open-working-directory", + accelerator: "CmdOrCtrl+Shift+F", + click: f("open-working-directory") + }, { + label: _, + id: "open-external-editor", + accelerator: "CmdOrCtrl+Shift+A", + click: f("open-external-editor") + }, S, { + id: "create-issue-in-repository-on-github", + label: "在 GitHub 上新建问题", + accelerator: "CmdOrCtrl+I", + click: f("create-issue-in-repository-on-github"), + visible: !0 + }, S, { + label: "存储库设置…", + id: "show-repository-settings", + click: f("show-repository-settings") + }] + }), E.push({ + label: "分支(&B)", + id: "branch", + submenu: [{ + label: "新建分支…", + id: "create-branch", + accelerator: "CmdOrCtrl+Shift+N", + click: f("create-branch") + }, { + label: "&重命名…", + id: "rename-branch", + accelerator: "CmdOrCtrl+Shift+R", + click: f("rename-branch") + }, { + label: "&删除…", + id: "delete-branch", + accelerator: "CmdOrCtrl+Shift+D", + click: f("delete-branch") + }, S, { + label: "放弃所有更改…", + id: "discard-all-changes", + accelerator: "CmdOrCtrl+Shift+Backspace", + click: f("discard-all-changes") + }, { + label: y ? "保存所有更改…" : "保存所有更改", + id: "stash-all-changes", + accelerator: "CmdOrCtrl+Shift+S", + click: f("stash-all-changes") + }, S, { + label: "&更新自 " + p, + id: "update-branch", + accelerator: "CmdOrCtrl+Shift+U", + click: f("update-branch") + }, { + label: "&与分支比较", + id: "compare-to-branch", + accelerator: "CmdOrCtrl+Shift+B", + click: f("compare-to-branch") + }, { + label: "&合并到当前分支…", + id: "merge-branch", + accelerator: "CmdOrCtrl+Shift+M", + click: f("merge-branch") + }, { + label: "恢复当前分支…", + id: "rebase-branch", + accelerator: "CmdOrCtrl+Shift+E", + click: f("rebase-branch") + }, S, { + label: "前往GitHub比较", + id: "compare-on-github", + accelerator: "CmdOrCtrl+Shift+C", + click: f("compare-on-github") + }, { + label: w, + id: "create-pull-request", + accelerator: "CmdOrCtrl+R", + click: f("open-pull-request") + }] + }); + const k = [{ + label: "反馈问题…", + click() { + r.shell.openExternal("https://github.com/desktop/desktop/issues/new/choose").catch(e => log.error("Failed opening issue creation page", e)) + } + }, { + label: "联系Github支持…", + click() { + r.shell.openExternal("https://github.com/contact?from_desktop_app=1&app_version=" + r.app.getVersion()).catch(e => log.error("Failed opening contact support page", e)) + } + }, { + label: "用户指南", + click() { + r.shell.openExternal("https://help.github.com/desktop/guides/").catch(e => log.error("Failed opening user guides page", e)) + } + }, { + label: "键盘快捷键", + click() { + r.shell.openExternal("https://help.github.com/en/desktop/getting-started-with-github-desktop/keyboard-shortcuts-in-github-desktop").catch(e => log.error("Failed opening keyboard shortcuts page", e)) + } + }, { + label: "打开日志文件夹", + click() { + const e = Object(o.a)(); + Object(s.ensureDir)(e).then(() => { + Object(a.a)(e) + }).catch(e => { + log.error("Failed opening logs directory", e) + }) + } + }]; + return E.push({ + label: "帮助(&H)", + submenu: [...k, S, { + label: "关于 Github 桌面", + click: f("show-about"), + id: "about" + }] + }), Object(i.a)(E), r.Menu.buildFromTemplate(E) + } + + function u(e) { + return e ? "隐藏贮藏的变更" : "显示贮藏的变更" + } + + function f(e) { + return (t, n) => { + n ? n.webContents.send("menu-event", { + name: e + }) : r.ipcMain.emit("menu-event", { + name: e + }) + } + }! function (e) { + e[e.Reset = 0] = "Reset", e[e.In = 1] = "In", e[e.Out = 2] = "Out" + }(c || (c = {})); + const h = [1, 1.1, 1.25, 1.5, 1.75, 2], + p = h.slice().reverse(); + + function d(e) { + return (t, n) => { + if (!n) return; + const { + webContents: r + } = n; + if (e === c.Reset) r.zoomFactor = 1, r.send("zoom-factor-changed", 1); + else { + const t = r.zoomFactor, + n = e === c.In ? h : p, + o = (i = t, n.reduce((e, t) => Math.abs(t - i) < Math.abs(e - i) ? t : e)), + s = n.find(t => e === c.In ? t > o : t < o), + a = void 0 === s ? o : s; + r.zoomFactor = a, r.send("zoom-factor-changed", a) + } + var i + } + } +}, function (e, t, n) { + "use strict"; + const r = n(1); + e.exports = function (e) { + if ("string" != typeof e || e.length <= 7 || "file://" !== e.substring(0, 7)) throw new TypeError("must pass in a file:// URI to convert to a file path"); + const t = decodeURI(e.substring(7)), + n = t.indexOf("/"); + let i = t.substring(0, n), + o = t.substring(n + 1); + return "localhost" === i && (i = ""), i && (i = r.sep + r.sep + i), o = o.replace(/^(.+)\|/, "$1:"), "\\" === r.sep && (o = o.replace(/\//g, "\\")), /^.+:/.test(o) || (o = r.sep + o), i + o + } +}, function (e, t, n) { + var r, i = n(108).SourceMapConsumer, + o = n(1); + try { + (r = n(3)).existsSync && r.readFileSync || (r = null) + } catch (e) {} + var s = !1, + a = !1, + c = !1, + l = "auto", + u = {}, + f = {}, + h = /^data:application\/json[^,]+base64,/, + p = [], + d = []; + + function m() { + return "browser" === l || "node" !== l && ("undefined" != typeof window && "function" == typeof XMLHttpRequest && !(window.require && window.module && window.process && "renderer" === window.process.type)) + } + + function g(e) { + return function (t) { + for (var n = 0; n < e.length; n++) { + var r = e[n](t); + if (r) return r + } + return null + } + } + var y = g(p); + + function v(e, t) { + if (!e) return t; + var n = o.dirname(e), + r = /^\w+:\/\/[^\/]*/.exec(n), + i = r ? r[0] : ""; + return i + o.resolve(n.slice(i.length), t) + } + p.push((function (e) { + if ((e = e.trim()) in u) return u[e]; + var t = null; + if (r) { + if (r.existsSync(e)) try { + t = r.readFileSync(e, "utf8") + } catch (e) { + t = "" + } + } else { + var n = new XMLHttpRequest; + n.open("GET", e, !1), n.send(null); + t = null; + 4 === n.readyState && 200 === n.status && (t = n.responseText) + } + return u[e] = t + })); + var w = g(d); + + function b(e) { + var t = f[e.source]; + if (!t) { + var n = w(e.source); + n ? (t = f[e.source] = { + url: n.url, + map: new i(n.map) + }).map.sourcesContent && t.map.sources.forEach((function (e, n) { + var r = t.map.sourcesContent[n]; + if (r) { + var i = v(t.url, e); + u[i] = r + } + })) : t = f[e.source] = { + url: null, + map: null + } + } + if (t && t.map) { + var r = t.map.originalPositionFor(e); + if (null !== r.source) return r.source = v(t.url, r.source), r + } return e - }; - var o = function () { - var o = h(arguments), - i = o.pop(), - s = n.apply(null, o); - s in t ? a.nextTick(function () { - i.apply(null, t[s]) - }) : s in r ? r[s].push(i) : (r[s] = [i], e.apply(null, o.concat([function () { - t[s] = h(arguments); - var e = r[s]; - delete r[s]; - for (var n = 0, o = e.length; n < o; n++) e[n].apply(null, arguments) - }]))) - }; - return o.memo = t, o.unmemoized = e, o - }, a.unmemoize = function (e) { - return function () { - return (e.unmemoized || e).apply(null, arguments) - } - }, a.times = function (e, n, t) { - for (var r = [], o = 0; o < e; o++) r.push(o); - return a.map(r, n, t) - }, a.timesSeries = function (e, n, t) { - for (var r = [], o = 0; o < e; o++) r.push(o); - return a.mapSeries(r, n, t) - }, a.seq = function () { - var e = arguments; - return function () { - var n = this, - t = h(arguments), - r = t.pop(); - a.reduce(e, t, function (e, t, r) { - t.apply(n, e.concat([function () { - var e = arguments[0], - n = h(arguments, 1); - r(e, n) - }])) - }, function (e, t) { - r.apply(n, [e].concat(t)) + } + + function _() { + var e, t = ""; + if (this.isNative()) t = "native"; + else { + !(e = this.getScriptNameOrSourceURL()) && this.isEval() && (t = this.getEvalOrigin(), t += ", "), t += e || ""; + var n = this.getLineNumber(); + if (null != n) { + t += ":" + n; + var r = this.getColumnNumber(); + r && (t += ":" + r) + } + } + var i = "", + o = this.getFunctionName(), + s = !0, + a = this.isConstructor(); + if (!(this.isToplevel() || a)) { + var c = this.getTypeName(); + "[object Object]" === c && (c = "null"); + var l = this.getMethodName(); + o ? (c && 0 != o.indexOf(c) && (i += c + "."), i += o, l && o.indexOf("." + l) != o.length - l.length - 1 && (i += " [as " + l + "]")) : i += c + "." + (l || "") + } else a ? i += "new " + (o || "") : o ? i += o : (i += t, s = !1); + return s && (i += " (" + t + ")"), i + } + + function E(e) { + var t = {}; + return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function (n) { + t[n] = /^(?:is|get)/.test(n) ? function () { + return e[n].call(e) + } : e[n] + })), t.toString = _, t + } + + function S(e) { + if (e.isNative()) return e; + var t = e.getFileName() || e.getScriptNameOrSourceURL(); + if (t) { + var n = e.getLineNumber(), + r = e.getColumnNumber() - 1; + 1 === n && r > 62 && !m() && !e.isEval() && (r -= 62); + var i = b({ + source: t, + line: n, + column: r + }); + return (e = E(e)).getFileName = function () { + return i.source + }, e.getLineNumber = function () { + return i.line + }, e.getColumnNumber = function () { + return i.column + 1 + }, e.getScriptNameOrSourceURL = function () { + return i.source + }, e + } + var o = e.isEval() && e.getEvalOrigin(); + return o ? (o = function e(t) { + var n = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t); + if (n) { + var r = b({ + source: n[2], + line: +n[3], + column: n[4] - 1 + }); + return "eval at " + n[1] + " (" + r.source + ":" + r.line + ":" + (r.column + 1) + ")" + } + return (n = /^eval at ([^(]+) \((.+)\)$/.exec(t)) ? "eval at " + n[1] + " (" + e(n[2]) + ")" : t + }(o), (e = E(e)).getEvalOrigin = function () { + return o + }, e) : e + } + + function x(e, t) { + return c && (u = {}, f = {}), e + t.map((function (e) { + return "\n at " + S(e) + })).join("") + } + + function C(e) { + var t = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack); + if (t) { + var n = t[1], + i = +t[2], + o = +t[3], + s = u[n]; + if (!s && r && r.existsSync(n)) try { + s = r.readFileSync(n, "utf8") + } catch (e) { + s = "" + } + if (s) { + var a = s.split(/(?:\r\n|\r|\n)/)[i - 1]; + if (a) return n + ":" + i + "\n" + a + "\n" + new Array(o).join(" ") + "^" + } + } + return null + } + + function O(e) { + var t = C(e); + t && (console.error(), console.error(t)), console.error(e.stack), process.exit(1) + } + d.push((function (e) { + var t, n = function (e) { + var t; + if (m()) try { + var n = new XMLHttpRequest; + n.open("GET", e, !1), n.send(null), t = 4 === n.readyState ? n.responseText : null; + var r = n.getResponseHeader("SourceMap") || n.getResponseHeader("X-SourceMap"); + if (r) return r + } catch (e) {} + t = y(e); + for (var i, o, s = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm; o = s.exec(t);) i = o; + return i ? i[1] : null + }(e); + if (!n) return null; + if (h.test(n)) { + var r = n.slice(n.indexOf(",") + 1); + t = new Buffer(r, "base64").toString(), n = e + } else n = v(e, n), t = y(n); + return t ? { + url: n, + map: t + } : null + })), t.wrapCallSite = S, t.getErrorSource = C, t.mapSourcePosition = b, t.retrieveSourceMap = w, t.install = function (e) { + if ((e = e || {}).environment && (l = e.environment, -1 === ["node", "browser", "auto"].indexOf(l))) throw new Error("environment " + l + " was unknown. Available options are {auto, browser, node}"); + if (e.retrieveFile && (e.overrideRetrieveFile && (p.length = 0), p.unshift(e.retrieveFile)), e.retrieveSourceMap && (e.overrideRetrieveSourceMap && (d.length = 0), d.unshift(e.retrieveSourceMap)), e.hookRequire && !m()) { + var t; + try { + t = n(115) + } catch (e) {} + var r = t.prototype._compile; + r.__sourceMapSupport || (t.prototype._compile = function (e, t) { + return u[t] = e, f[t] = void 0, r.call(this, e, t) + }, t.prototype._compile.__sourceMapSupport = !0) + } + var i; + (c || (c = "emptyCacheBetweenOperations" in e && e.emptyCacheBetweenOperations), s || (s = !0, Error.prepareStackTrace = x), a) || (!("handleUncaughtExceptions" in e) || e.handleUncaughtExceptions) && "object" == typeof process && null !== process && "function" == typeof process.on && (a = !0, i = process.emit, process.emit = function (e) { + if ("uncaughtException" === e) { + var t = arguments[1] && arguments[1].stack, + n = this.listeners(e).length > 0; + if (t && !n) return O(arguments[1]) + } + return i.apply(this, arguments) }) - } - }, a.compose = function () { - return a.seq.apply(null, Array.prototype.reverse.call(arguments)) - }; - var F = function (e, n) { - var t = function () { - var t = this, - r = h(arguments), - o = r.pop(); - return e(n, function (e, n) { - e.apply(t, r.concat([n])) - }, o) - }; - if (2 < arguments.length) { - var r = h(arguments, 2); - return t.apply(this, r) - } - return t - }; - a.applyEach = S(F), a.applyEachSeries = v(F), a.forever = function (e, n) { - function t(r) { - if (r) { - if (n) return n(r); - throw r - } - e(t) - } - t() - }, 'undefined' != typeof e && e.exports ? e.exports = a : (t = [], r = function () { - return a - }.apply(n, t), !(r !== void 0 && (e.exports = r))) - })() -}, function (e, n, t) { - 'use strict'; - - function r(e) { - const n = `desktop.${'production'}.log`; - return a.join(e, n) - } - - function o(e) { - const n = new s.transports.DailyRotateFile({ - filename: e, - handleExceptions: !1, - json: !1, - datePattern: 'yyyy-MM-dd.', - prepend: !0, - level: 'info', - maxFiles: c - }); - n.on('error', () => {}); - const t = new s.transports.Console({ - level: 'error' - }); - return s.configure({ - transports: [t, n] - }), s.log - } - - function i() { - return p ? p : (p = new Promise((e, n) => { - const t = d.getLogDirectoryPath(); - l.ensureDir(t).then(() => { + } +}, function (e, t, n) { + "use strict"; + const r = n(1); + e.exports = (e, t) => { + if ("string" != typeof e) throw new TypeError("Expected a string, got " + typeof e); + let n = e; + return (t = Object.assign({ + resolve: !0 + }, t)).resolve && (n = r.resolve(e)), n = n.replace(/\\/g, "/"), "/" !== n[0] && (n = "/" + n), encodeURI("file://" + n).replace(/[?#]/g, encodeURIComponent) + } +}, function (e, t, n) { + "use strict"; + const r = n(1), + i = n(0), + o = n(40), + s = n(42); + e.exports = function (e) { + const t = i.app || i.remote.app, + n = i.screen || i.remote.screen; + let a, c, l; + const u = Object.assign({ + file: "window-state.json", + path: t.getPath("userData"), + maximize: !0, + fullScreen: !0 + }, e), + f = r.join(u.path, u.file); + + function h() { + return a && Number.isInteger(a.x) && Number.isInteger(a.y) && Number.isInteger(a.width) && a.width > 0 && Number.isInteger(a.height) && a.height > 0 + } + + function p() { + const e = n.getPrimaryDisplay().bounds; + a = { + width: u.defaultWidth || 800, + height: u.defaultHeight || 600, + x: 0, + y: 0, + displayBounds: e + } + } + + function d() { + if (!n.getAllDisplays().some(e => { + return t = e.bounds, a.x >= t.x && a.y >= t.y && a.x + a.width <= t.x + t.width && a.y + a.height <= t.y + t.height; + var t + })) return p() + } + + function m(e) { + if (e = e || c) try { + const t = e.getBounds(); + (function (e) { + return !e.isMaximized() && !e.isMinimized() && !e.isFullScreen() + })(e) && (a.x = t.x, a.y = t.y, a.width = t.width, a.height = t.height), a.isMaximized = e.isMaximized(), a.isFullScreen = e.isFullScreen(), a.displayBounds = n.getDisplayMatching(t).bounds + } catch (e) {} + } + + function g(e) { + e && m(e); + try { + s.sync(r.dirname(f)), o.writeFileSync(f, a) + } catch (e) {} + } + + function y() { + clearTimeout(l), l = setTimeout(m, 100) + } + + function v() { + m() + } + + function w() { + b(), g() + } + + function b() { + c && (c.removeListener("resize", y), c.removeListener("move", y), clearTimeout(l), c.removeListener("close", v), c.removeListener("closed", w), c = null) + } try { - const n = o(r(t)); - e(n) - } catch (e) { - n(e) - } - }).catch((e) => { - n(e) - }) - }), p) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const a = t(0), - s = t(15), - d = t(44), - l = t(20); - t(83); - const c = 14; - let p = null; - n.log = async function (e, n) { - try { - const t = await i(); - await new Promise((r, o) => { - t(e, n, (e) => { - e ? o(e) : r() - }) - }) - } catch (e) {} - } -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.sendNonFatalException = function (e, n) { - process.emit('send-non-fatal-exception', n, { - kind: e + a = o.readFileSync(f) + } catch (e) {} + return a && (h() || a.isMaximized || a.isFullScreen) ? h() && a.displayBounds && d() : a = null, a = Object.assign({ + width: u.defaultWidth || 800, + height: u.defaultHeight || 600 + }, a), { + get x() { + return a.x + }, + get y() { + return a.y + }, + get width() { + return a.width + }, + get height() { + return a.height + }, + get displayBounds() { + return a.displayBounds + }, + get isMaximized() { + return a.isMaximized + }, + get isFullScreen() { + return a.isFullScreen + }, + saveState: g, + unmanage: b, + manage: function (e) { + u.maximize && a.isMaximized && e.maximize(), u.fullScreen && a.isFullScreen && e.setFullScreen(!0), e.on("resize", y), e.on("move", y), e.on("close", v), e.on("closed", w), c = e + }, + resetStateToDefault: p + } + } +}, function (e, t) { + e.exports = () => Promise.resolve({}) +}, function (e) { + e.exports = JSON.parse('{"name":"winston","description":"A multi-transport async logging library for Node.js","version":"2.3.1","author":"Charlie Robbins ","maintainers":["Jarrett Cruger ","Alberto Pose "],"repository":{"type":"git","url":"https://github.com/winstonjs/winston.git"},"keywords":["winston","logging","sysadmin","tools"],"dependencies":{"async":"~1.0.0","colors":"1.0.x","cycle":"1.0.x","eyes":"0.1.x","isstream":"0.1.x","stack-trace":"0.0.x"},"devDependencies":{"cross-spawn-async":"^2.0.0","hock":"1.x.x","std-mocks":"~1.0.0","vows":"0.7.x"},"main":"./lib/winston","scripts":{"test":"vows --spec --isolate"},"engines":{"node":">= 0.10.0"},"license":"MIT"}') +}, function (e, t, n) { + Object.defineProperty(t, "Console", { + configurable: !0, + enumerable: !0, + get: function () { + return n(57).Console + } + }), Object.defineProperty(t, "File", { + configurable: !0, + enumerable: !0, + get: function () { + return n(74).File + } + }), Object.defineProperty(t, "Http", { + configurable: !0, + enumerable: !0, + get: function () { + return n(76).Http + } + }), Object.defineProperty(t, "Memory", { + configurable: !0, + enumerable: !0, + get: function () { + return n(79).Memory + } }) - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n) { - return (e ? e.toLowerCase() : e) === (n ? n.toLowerCase() : n) - } - - function o() { - const e = a.Menu.buildFromTemplate([{ - role: 'editMenu' - }]).items[0], - n = e && e.submenu ? e.submenu.items : []; - return n.filter((e) => !r(e.role, 'pasteandmatchstyle')) - } - - function i(e, n, t = []) { - const s = new a.Menu; - for (const [d, l] of e.entries()) - if (r(l.role, 'editmenu')) - for (const e of o()) s.append(e); - else { - const e = [...t, d]; - s.append(new a.MenuItem({ - label: l.label, - type: l.type, - enabled: l.enabled, - role: l.role, - click: () => n(e), - submenu: l.submenu ? i(l.submenu, n, e) : void 0 - })) - } return s - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const a = t(4); - n.buildContextMenu = function (e, n) { - return i(e, n) - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(4), - o = t(29), - i = t(28), - a = 600, - s = 500; - n.CrashWindow = class { - constructor(e, n) { - this.emitter = new o.Emitter, this.hasFinishedLoading = !1, this.hasSentReadyEvent = !1; - const t = { - width: a, - height: s, - minWidth: a, - minHeight: s, - show: !1, - backgroundColor: '#fff', - webPreferences: { - disableBlinkFeatures: 'Auxclick', - experimentalFeatures: !1, - nodeIntegration: !0 - } - }; - t.frame = !1, this.window = new r.BrowserWindow(t), this.error = n, this.errorType = e - } - load() { - log.debug('Starting crash process'), this.window.webContents.once('did-start-loading', () => { - log.debug('Crash process in startup') - }), this.window.webContents.once('did-finish-load', () => { - log.debug('Crash process started'), !1, this.hasFinishedLoading = !0, this.maybeEmitDidLoad() - }), this.window.webContents.on('did-finish-load', () => { - this.window.webContents.setVisualZoomLevelLimits(1, 1) - }), this.window.webContents.on('did-fail-load', () => { - log.error('Crash process failed to load'), this.emitter.emit('did-fail-load', null) - }), r.ipcMain.on('crash-ready', () => { - log.debug(`Crash process is ready`), this.hasSentReadyEvent = !0, this.sendError(), this.maybeEmitDidLoad() - }), r.ipcMain.on('crash-quit', () => { - log.debug('Got quit signal from crash process'), this.window.close() - }), i.registerWindowStateChangedEvents(this.window), this.window.loadURL(`file://${__dirname}/crash.html`) - } - maybeEmitDidLoad() { - this.hasFinishedLoading && this.hasSentReadyEvent && this.emitter.emit('did-load', null) - } - onClose(e) { - this.window.on('closed', e) - } - onFailedToLoad(e) { - this.emitter.on('did-fail-load', e) - } - onDidLoad(e) { - return this.emitter.on('did-load', e) - } - focus() { - this.window.focus() - } - show() { - log.debug('Showing crash process window'), this.window.show() - } - sendError() { - const e = { - stack: this.error.stack, - message: this.error.message, - name: this.error.name - }, - n = { - type: this.errorType, - error: e +}, function (e, t, n) { + n(14); + var r = n(9), + i = n(7), + o = n(12), + s = n(16).Transport, + a = t.Console = function (e) { + s.call(this, e), e = e || {}, this.json = e.json || !1, this.colorize = e.colorize || !1, this.prettyPrint = e.prettyPrint || !1, this.timestamp = void 0 !== e.timestamp && e.timestamp, this.showLevel = void 0 === e.showLevel || e.showLevel, this.label = e.label || null, this.logstash = e.logstash || !1, this.depth = e.depth || null, this.align = e.align || !1, this.stderrLevels = function (e, t) { + var n = "Cannot have non-string elements in stderrLevels Array"; + if (t) { + if (e) throw new Error("Cannot set debugStdout and stderrLevels together"); + return o.stringArrayToSet(["error"], n) + } + if (!e) return o.stringArrayToSet(["error", "debug"], n); + if (!Array.isArray(e)) throw new Error("Cannot set stderrLevels to type other than Array"); + return o.stringArrayToSet(e, n) + }(e.stderrLevels, e.debugStdout), this.eol = e.eol || r.EOL, this.json && (this.stringify = e.stringify || function (e) { + return JSON.stringify(e, null, 2) + }) }; - this.window.webContents.send('error', n) - } - destroy() { - this.window.destroy() - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n) { - if (log.error(a.formatError(n)), d) return; - d = !0, i.setCrashMenu(); - const t = new s.CrashWindow(e ? 'launch' : 'generic', n); - t.onDidLoad(() => { - t.show() - }), t.onFailedToLoad(async () => { - await o.dialog.showMessageBox({ - type: 'error', - title: '无法恢复的错误', - message: `GitHub Desktop遇到了一个无法恢复的错误,需要重新启动。${n.stack||n.message}` - }), o.app.relaunch(), o.app.quit() - }), t.onClose(() => { - o.app.relaunch(), o.app.quit() - }), t.load() - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(4), - i = t(25), - a = t(34), - s = t(51); - let d = !1; - n.showUncaughtException = r -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(4); - n.reportError = async function (e, n, t) { - const o = new Map; - if (o.set('name', e.name), o.set('message', e.message), e.stack && o.set('stack', e.stack), o.set('platform', 'win32'), o.set('sha', '41e70ee49004936e5e1058d406996961bd475cf2'), o.set('version', r.app.getVersion()), n) - for (const e of Object.keys(n)) o.set(e, n[e]); - const i = { - method: 'POST', - url: t ? 'https://central.github.com/api/desktop-non-fatal/exception' : 'https://central.github.com/api/desktop/exception', - headers: { - "Content-Type": 'application/x-www-form-urlencoded' - } - }, - a = [...o.entries()].map(([e, n]) => `${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join('&'); - try { - await new Promise((e, n) => { - const t = r.net.request(i); - t.on('response', (t) => { - 200 === t.statusCode ? e() : n(`Got ${t.statusCode} - ${t.statusMessage} from central`) - }), t.on('error', n), t.end(a) - }), log.info('Error report submitted') - } catch (n) { - log.error('Failed submitting error report', e) - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n) { - try { - const t = o.spawn(e, n); - return new Promise((r, o) => { - let i = ''; - t.stdout && t.stdout.on('data', (e) => { - i += e - }), t.on('close', (t) => { - 0 === t ? r(i) : o(new Error(`Command "${e} ${n}" failed: "${i}"`)) - }), t.on('error', (e) => { - o(e) - }), t.stdin && t.stdin.end() - }) - } catch (e) { - return Promise.reject(e) - } - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(22), - i = t(0); - n.getPathSegments = async function () { - let e; - const n = process.env.SystemRoot; - if (null != n) { - const t = i.join(n, 'System32'); - e = i.join(t, 'WindowsPowerShell', 'v1.0', 'powershell.exe') - } else e = 'powershell.exe'; - const t = ['-noprofile', '-ExecutionPolicy', 'RemoteSigned', '-command', ` - [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 - $output=[environment]::GetEnvironmentVariable('Path', 'User') - [Console]::WriteLine($output) - `], - o = await r(e, t), - a = o.replace(/^\s+|\s+$/g, ''); - return a.split(/;+/).filter((e) => e.length) - }, n.setPathSegments = async function (e) { - let n; - const t = process.env.SystemRoot; - if (t) { - const e = i.join(t, 'System32'); - n = i.join(e, 'setx.exe') - } else n = 'setx.exe'; - await r(n, ['Path', e.join(';')]) - }, n.spawn = r -}, function (e, n, t) { - 'use strict'; - async function r() { - await p(['StartMenu', 'Desktop']), await i() - } - async function o() { - await g(), await i() - } - async function i() { - const e = a(); - await y.ensureDir(e), await d(e), await l(e); - const n = await _.getPathSegments(); - 0 > n.indexOf(e) && (await _.setPathSegments([...n, e])) - } - - function a() { - return f.resolve(process.execPath, '../../bin') - } - - function s(e, n) { - const t = f.resolve(process.execPath, '..'); - return f.relative(e, f.join(t, n)) - } - - function d(e) { - const n = s(e, 'resources/app/static/github.bat'), - t = `@echo off\n"%~dp0\\${n}" %*`, - r = f.join(e, 'github.bat'); - return y.writeFile(r, t) - } - - function l(e) { - const n = s(e, 'resources/app/static/github.sh').replace(/\\/g, '/'), - t = `#!/usr/bin/env bash - DIR="$( cd "$( dirname "\$\{BASH_SOURCE[0]\}" )" && pwd )" - sh "$DIR/${n}" "$@"`, - r = f.join(e, 'github'); - return y.writeFile(r, t, { - encoding: 'utf8', - mode: 755 + i.inherits(a, s), a.prototype.name = "console", a.prototype.log = function (e, t, n, r) { + if (this.silent) return r(null, !0); + var i; + i = o.log({ + colorize: this.colorize, + json: this.json, + level: e, + message: t, + meta: n, + stringify: this.stringify, + timestamp: this.timestamp, + showLevel: this.showLevel, + prettyPrint: this.prettyPrint, + raw: this.raw, + label: this.label, + logstash: this.logstash, + depth: this.depth, + formatter: this.formatter, + align: this.align, + humanReadableUnhandledException: this.humanReadableUnhandledException + }), this.stderrLevels[e] ? process.stderr.write(i + this.eol) : process.stdout.write(i + this.eol), this.emit("logged"), r(null, !0) + } +}, function (e, t) { + e.exports = require("crypto") +}, function (module, exports) { + var cycle = exports; + cycle.decycle = function (e) { + "use strict"; + var t = [], + n = []; + return function e(r, i) { + var o, s, a; + if (!("object" != typeof r || null === r || r instanceof Boolean || r instanceof Date || r instanceof Number || r instanceof RegExp || r instanceof String)) { + for (o = 0; o < t.length; o += 1) + if (t[o] === r) return { + $ref: n[o] + }; + if (t.push(r), n.push(i), "[object Array]" === Object.prototype.toString.apply(r)) + for (a = [], o = 0; o < r.length; o += 1) a[o] = e(r[o], i + "[" + o + "]"); + else + for (s in a = {}, r) Object.prototype.hasOwnProperty.call(r, s) && (a[s] = e(r[s], i + "[" + JSON.stringify(s) + "]")); + return a + } + return r + }(e, "$") + }, cycle.retrocycle = function retrocycle($) { + "use strict"; + var px = /^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/; + return function rez(value) { + var i, item, name, path; + if (value && "object" == typeof value) + if ("[object Array]" === Object.prototype.toString.apply(value)) + for (i = 0; i < value.length; i += 1) item = value[i], item && "object" == typeof item && (path = item.$ref, "string" == typeof path && px.test(path) ? value[i] = eval(path) : rez(item)); + else + for (name in value) "object" == typeof value[name] && (item = value[name], item && (path = item.$ref, "string" == typeof path && px.test(path) ? value[name] = eval(path) : rez(item))) + }($), $ + } +}, function (e, t) { + e.exports = require("string_decoder") +}, function (e, t, n) { + var r = n(15); + e.exports = r +}, function (e, t) { + var n = {}; + e.exports = n; + var r = { + reset: [0, 0], + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + grey: [90, 39], + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + blackBG: [40, 49], + redBG: [41, 49], + greenBG: [42, 49], + yellowBG: [43, 49], + blueBG: [44, 49], + magentaBG: [45, 49], + cyanBG: [46, 49], + whiteBG: [47, 49] + }; + Object.keys(r).forEach((function (e) { + var t = r[e], + i = n[e] = []; + i.open = "[" + t[0] + "m", i.close = "[" + t[1] + "m" + })) +}, function (e, t, n) { + var r = process.argv; + e.exports = -1 === r.indexOf("--no-color") && -1 === r.indexOf("--color=false") && (-1 !== r.indexOf("--color") || -1 !== r.indexOf("--color=true") || -1 !== r.indexOf("--color=always") || !(process.stdout && !process.stdout.isTTY)) +}, function (e, t) { + function n(e) { + var t = new Error("Cannot find module '" + e + "'"); + throw t.code = "MODULE_NOT_FOUND", t + } + n.keys = function () { + return [] + }, n.resolve = n, e.exports = n, n.id = 64 +}, function (e, t) { + e.exports = function (e, t) { + var n = ""; + e = (e = e || "Run the trap, drop the bass").split(""); + var r = { + a: ["@", "Ą", "Ⱥ", "Ʌ", "Δ", "Λ", "Д"], + b: ["ß", "Ɓ", "Ƀ", "ɮ", "β", "฿"], + c: ["©", "Ȼ", "Ͼ"], + d: ["Ð", "Ɗ", "Ԁ", "ԁ", "Ԃ", "ԃ"], + e: ["Ë", "ĕ", "Ǝ", "ɘ", "Σ", "ξ", "Ҽ", "੬"], + f: ["Ӻ"], + g: ["ɢ"], + h: ["Ħ", "ƕ", "Ң", "Һ", "Ӈ", "Ԋ"], + i: ["༏"], + j: ["Ĵ"], + k: ["ĸ", "Ҡ", "Ӄ", "Ԟ"], + l: ["Ĺ"], + m: ["ʍ", "Ӎ", "ӎ", "Ԡ", "ԡ", "൩"], + n: ["Ñ", "ŋ", "Ɲ", "Ͷ", "Π", "Ҋ"], + o: ["Ø", "õ", "ø", "Ǿ", "ʘ", "Ѻ", "ם", "۝", "๏"], + p: ["Ƿ", "Ҏ"], + q: ["্"], + r: ["®", "Ʀ", "Ȑ", "Ɍ", "ʀ", "Я"], + s: ["§", "Ϟ", "ϟ", "Ϩ"], + t: ["Ł", "Ŧ", "ͳ"], + u: ["Ʊ", "Ս"], + v: ["ט"], + w: ["Ш", "Ѡ", "Ѽ", "൰"], + x: ["Ҳ", "Ӿ", "Ӽ", "ӽ"], + y: ["¥", "Ұ", "Ӌ"], + z: ["Ƶ", "ɀ"] + }; + return e.forEach((function (e) { + e = e.toLowerCase(); + var t = r[e] || [" "], + i = Math.floor(Math.random() * t.length); + n += void 0 !== r[e] ? r[e][i] : e + })), n + } +}, function (e, t) { + e.exports = function (e, t) { + e = e || " he is here "; + var n = { + up: ["̍", "̎", "̄", "̅", "̿", "̑", "̆", "̐", "͒", "͗", "͑", "̇", "̈", "̊", "͂", "̓", "̈", "͊", "͋", "͌", "̃", "̂", "̌", "͐", "̀", "́", "̋", "̏", "̒", "̓", "̔", "̽", "̉", "ͣ", "ͤ", "ͥ", "ͦ", "ͧ", "ͨ", "ͩ", "ͪ", "ͫ", "ͬ", "ͭ", "ͮ", "ͯ", "̾", "͛", "͆", "̚"], + down: ["̖", "̗", "̘", "̙", "̜", "̝", "̞", "̟", "̠", "̤", "̥", "̦", "̩", "̪", "̫", "̬", "̭", "̮", "̯", "̰", "̱", "̲", "̳", "̹", "̺", "̻", "̼", "ͅ", "͇", "͈", "͉", "͍", "͎", "͓", "͔", "͕", "͖", "͙", "͚", "̣"], + mid: ["̕", "̛", "̀", "́", "͘", "̡", "̢", "̧", "̨", "̴", "̵", "̶", "͜", "͝", "͞", "͟", "͠", "͢", "̸", "̷", "͡", " ҉"] + }, + r = [].concat(n.up, n.down, n.mid); + + function i(e) { + return Math.floor(Math.random() * e) + } + + function o(e) { + var t = !1; + return r.filter((function (n) { + t = n === e + })), t + } + return function (e, t) { + var r, s, a = ""; + for (s in (t = t || {}).up = t.up || !0, t.mid = t.mid || !0, t.down = t.down || !0, t.size = t.size || "maxi", e = e.split("")) + if (!o(s)) { + switch (a += e[s], r = { + up: 0, + down: 0, + mid: 0 + }, t.size) { + case "mini": + r.up = i(8), r.min = i(2), r.down = i(8); + break; + case "maxi": + r.up = i(16) + 3, r.min = i(4) + 1, r.down = i(64) + 3; + break; + default: + r.up = i(8) + 1, r.mid = i(6) / 2, r.down = i(8) + 1 + } + var c = ["up", "mid", "down"]; + for (var l in c) + for (var u = c[l], f = 0; f <= r[u]; f++) t[u] && (a += n[u][i(n[u].length)]) + } return a + }(e) + } +}, function (e, t, n) { + var r = n(15); + e.exports = function (e, t, n) { + if (" " === e) return e; + switch (t % 3) { + case 0: + return r.red(e); + case 1: + return r.white(e); + case 2: + return r.blue(e) + } + } +}, function (e, t, n) { + var r = n(15); + e.exports = function (e, t, n) { + return t % 2 == 0 ? e : r.inverse(e) + } +}, function (e, t, n) { + var r, i = n(15); + e.exports = (r = ["red", "yellow", "green", "blue", "magenta"], function (e, t, n) { + return " " === e ? e : i[r[t++ % r.length]](e) + }) +}, function (e, t, n) { + var r, i = n(15); + e.exports = (r = ["underline", "inverse", "grey", "yellow", "red", "green", "blue", "white", "cyan", "magenta"], function (e, t, n) { + return " " === e ? e : i[r[Math.round(Math.random() * (r.length - 1))]](e) }) - } - async function c(e) { - await _.spawn(w, e) - } - - function p(e) { - return c(['--createShortcut', v, '-l', e.join(',')]) - } - async function u() { - await m(); - const e = await _.getPathSegments(), - n = a(), - t = e.filter((e) => e !== n); - return _.setPathSegments(t) - } - - function m() { - return c(['--removeShortcut', v]) - } - async function g() { - const e = h.homedir(); - if (e) { - const n = f.join(e, 'Desktop', 'GitHub Desktop.lnk'), - t = await y.pathExists(n), - r = t ? ['StartMenu', 'Desktop'] : ['StartMenu']; - return p(r) - } - return p(['StartMenu', 'Desktop']) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const f = t(0), - h = t(10), - y = t(20), - _ = t(54), - b = f.resolve(process.execPath, '..'), - S = f.resolve(b, '..'), - w = f.resolve(f.join(S, 'Update.exe')), - v = f.basename(process.execPath); - n.handleSquirrelEvent = function (e) { - return '--squirrel-install' === e ? r() : '--squirrel-updated' === e ? o() : '--squirrel-uninstall' === e ? u() : '--squirrel-obsolete' === e ? Promise.resolve() : null - } -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const t = /[\x00-\x20\x7F~^:?*\[\\|""<>]+|@{|\.\.+|^\.|\.$|\.lock$|\/$/g; - n.sanitizedRefName = function (e) { - return e.replace(t, '-').replace(/^[-\+]*/g, '') - }, n.testForInvalidChars = function (e) { - return t.test(e) - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n) { - const t = e[n]; - return null == t ? null : Array.isArray(t) ? t[0] : t - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(18), - i = t(56); - n.parseAppURL = function (e) { - const n = o.parse(e, !0), - t = n.hostname, - a = { - name: 'unknown', - url: e - }; - if (!t) return a; - const s = n.query, - d = t.toLowerCase(); - if ('oauth' === d) { - const e = r(s, 'code'), - n = r(s, 'state'); - return null != e && null != n ? { - name: 'oauth', - code: e, - state: n - } : a - } - const l = n.pathname; - if (!l || 1 >= l.length) return a; - const c = l.substr(1); - if ('openrepo' === d) { - const e = r(s, 'pr'), - n = r(s, 'branch'), - t = r(s, 'filepath'); - if (null != e) { - if (!/^\d+$/.test(e)) return a; - if (null != n && !/^pr\/\d+$/.test(n)) return a - } - return null != n && i.testForInvalidChars(n) ? a : { - name: 'open-repository-from-url', - url: c, - branch: n, - pr: e, - filepath: t - } - } - return 'openlocalrepo' === d ? { - name: 'open-repository-from-path', - path: decodeURIComponent(c) - } : a - } -}, function (e, n, t) { - 'use strict'; - async function r() { - const e = o(), - n = new Promise((n) => { - let t = null, - r = null, - o = '', - i = !1; - const a = () => { - !i && t && (t.kill(), i = !0) +}, function (e, t) { + var n = t; + n.levels = { + error: 0, + warn: 1, + help: 2, + data: 3, + info: 4, + debug: 5, + prompt: 6, + verbose: 7, + input: 8, + silly: 9 + }, n.colors = { + error: "red", + warn: "yellow", + help: "cyan", + data: "grey", + info: "green", + debug: "blue", + prompt: "grey", + verbose: "cyan", + input: "grey", + silly: "magenta" + } +}, function (e, t) { + var n = t; + n.levels = { + error: 0, + warn: 1, + info: 2, + verbose: 3, + debug: 4, + silly: 5 + }, n.colors = { + error: "red", + warn: "yellow", + info: "green", + verbose: "cyan", + debug: "blue", + silly: "magenta" + } +}, function (e, t) { + var n = t; + n.levels = { + emerg: 0, + alert: 1, + crit: 2, + error: 3, + warning: 4, + notice: 5, + info: 6, + debug: 7 + }, n.colors = { + emerg: "red", + alert: "yellow", + crit: "red", + error: "red", + warning: "red", + notice: "yellow", + info: "green", + debug: "blue" + } +}, function (e, t, n) { + n(14); + var r = n(3), + i = n(1), + o = n(7), + s = n(30), + a = n(31), + c = n(12), + l = n(16).Transport, + u = n(75).isWritable, + f = n(11).Stream, + h = n(9), + p = t.File = function (e) { + var t = this; + + function n(t) { + Array.prototype.slice.call(arguments, 1).forEach((function (n) { + if (e[n]) throw new Error("Cannot set " + n + " and " + t + "together") + })) + } + if (l.call(this, e), e.filename || e.dirname) n("filename or dirname", "stream"), this._basename = this.filename = e.filename ? i.basename(e.filename) : "winston.log", this.dirname = e.dirname || i.dirname(e.filename), this.options = e.options || { + flags: "a" + }, this.options.highWaterMark = this.options.highWaterMark || 24; + else { + if (!e.stream) throw new Error("Cannot log to file without filename or stream."); + n("stream", "filename", "maxsize"), this._stream = e.stream, this._isStreams2 = u(this._stream), this._stream.on("error", (function (e) { + t.emit("error", e) + })), this._stream.setMaxListeners(1 / 0) + } + this.json = !1 !== e.json, this.logstash = e.logstash || !1, this.colorize = e.colorize || !1, this.maxsize = e.maxsize || null, this.rotationFormat = e.rotationFormat || !1, this.zippedArchive = e.zippedArchive || !1, this.maxFiles = e.maxFiles || null, this.prettyPrint = e.prettyPrint || !1, this.label = e.label || null, this.timestamp = null == e.timestamp || e.timestamp, this.eol = e.eol || h.EOL, this.tailable = e.tailable || !1, this.depth = e.depth || null, this.showLevel = void 0 === e.showLevel || e.showLevel, this.maxRetries = e.maxRetries || 2, this.json && (this.stringify = e.stringify), this._size = 0, this._created = 0, this._buffer = [], this._draining = !1, this._opening = !1, this._failures = 0, this._archive = null }; - process.once('exit', a), setTimeout(() => { - a() - }, 5e3), t = s.spawn(e, ['-ilc', 'command env'], { - detached: !0, - stdio: ['ignore', 'pipe', process.stderr] + o.inherits(p, l), p.prototype.name = "file", p.prototype.log = function (e, t, n, r) { + if (this.silent) return r(null, !0); + if (this._failures >= this.maxRetries) return r(new Error("Transport is in a failed state.")); + var i = this; + "string" != typeof t && (t = "" + t); + var o = c.log({ + level: e, + message: t, + meta: n, + json: this.json, + logstash: this.logstash, + colorize: this.colorize, + prettyPrint: this.prettyPrint, + timestamp: this.timestamp, + showLevel: this.showLevel, + stringify: this.stringify, + label: this.label, + depth: this.depth, + formatter: this.formatter, + humanReadableUnhandledException: this.humanReadableUnhandledException }); - const d = []; - t.on('error', (n) => { - i = !0, r = n - }), t.stdout && t.stdout.on('data', (e) => { - d.push(e) - }), t.on('close', () => { - i = !0, process.removeListener('exit', a), d.length && (o = Buffer.concat(d).toString('utf8')), n({ - stdout: o, - error: r - }) - }) - }), - { - stdout: t, - error: r - } = await n; - return r ? null : t - } - - function o() { - return process.env.SHELL ? process.env.SHELL : '/bin/bash' - } - async function i(e) {} - - function a(e) { - for (const n in e) l.has(n) || (process.env[n] = e[n]) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const s = t(22), - d = t(10), - l = new Set(['LOCAL_GIT_DIRECTORY']); - n.shellNeedsPatching = function () { - return !1 - }, n.updateEnvironmentForProcess = function () { - return i(a) - } -}, function (e, n) { - 'use strict'; - - function* t(e) { - for (const n of e.items) yield n, 'submenu' === n.type && void 0 !== n.submenu && (yield* t(n.submenu)) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.getAllMenuItems = t -}, function (e, n, t) { - 'use strict'; - - function r(e) { - let n = !1; - if (e.submenu instanceof o.Menu) - for (const t of e.submenu.items) r(t) && (n = !0); - if (n || e.role) return !0; - const t = e.id; - return !('show-devtools' !== t && 'reload-window' !== t) || (e.enabled = !1, !1) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const o = t(4); - n.setCrashMenu = function () { - const e = o.Menu.getApplicationMenu(); - if (e) - for (const n of e.items) r(n) - } -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const t = ['.cmd', '.exe', '.bat', '.sh']; - n.CopyFilePathLabel = '复制文件路径', n.DefaultEditorLabel = '用外部编辑器打开', n.RevealInFileManagerLabel = '在资源管理器中显示', n.TrashNameLabel = '回收站', n.OpenWithDefaultProgramLabel = '用默认程序打开', n.isSafeFileExtension = function (e) { - return -1 === t.indexOf(e.toLowerCase()) - } -}, function (e, n) { - 'use strict'; - - function t() { - return !1, '1' === process.env.GITHUB_DESKTOP_PREVIEW_FEATURES - } - - function r() { - return t() || !1 - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - n.enableProgressBarOnIcon = function () { - return r() - }, n.enableRecurseSubmodulesFlag = function () { - return r() - }, n.enableReadmeOverwriteWarning = function () { - return r() - }, n.enableWSLDetection = function () { - return r() - }, n.enableCreateForkFlow = function () { - return !0 - }, n.enableSchannelCheckRevokeOptOut = function () { - return !0 - }, n.enableAutomaticGitProxyConfiguration = function () { - return !0 - }, n.enableCreateGitHubIssueFromMenu = function () { - return !0 - }, n.enableUpdateRemoteUrl = function () { - return !0 - }, n.enableForkyCreateBranchUI = function () { - return !0 - }, n.enableNDDBBanner = function () { - return !1 - }, n.enableGitTagsDisplay = function () { - return !0 - }, n.enableGitTagsCreation = function () { - return !0 - }, n.enableForkSettings = function () { - return !0 - }, n.enableDiscardLines = function () { - return !0 - } -}, function (e, n) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }), n.truncateWithEllipsis = function (e, n) { - if (e.length <= n) return e; - const t = [...e]; - if (t.length <= n) return e; - const r = t.reduce((e, n) => ('\uFE00' <= n && '\uFE0F' >= n ? e.length && e.push(`${e.pop()}${n}`) : e.push(n), e), []); - if (r.length <= n) return e; - const o = r.slice(0, n).join(''); - return `${o}…` - } -}, function (e, n, t) { - 'use strict'; - - function r({ - selectedExternalEditor: e, - selectedShell: n, - askForConfirmationOnForcePush: t, - askForConfirmationOnRepositoryRemoval: r, - hasCurrentPullRequest: s = !1, - defaultBranchName: l = w, - isForcePushForCurrentRepository: M = !1, - isStashedChangesVisible: L = !1, - askForConfirmationWhenStashingAllChanges: O = !0 - }) { - l = u.truncateWithEllipsis(l, 25); - const P = r ? v : x, - F = s ? S : b, - T = null === n ? _ : `用${n}打开`, - N = null === e ? y.DefaultEditorLabel : `用${e}打开`, - A = [], - R = { - type: 'separator' - }; - const I = { - label: '文件(&F)', - submenu: [{ - label: '新建 存储库\u2026', - id: 'new-repository', - click: a('create-repository'), - accelerator: 'CmdOrCtrl+N' - }, R, { - label: '添加 本地存储库\u2026', - id: 'add-local-repository', - accelerator: 'CmdOrCtrl+O', - click: a('add-local-repository') - }, { - label: '克隆 存储库\u2026', - id: 'clone-repository', - accelerator: 'CmdOrCtrl+Shift+O', - click: a('clone-repository') - }] - }; { - const e = I.submenu; - e.push(R, { - label: '&选项\u2026', - id: 'preferences', - accelerator: 'CmdOrCtrl+,', - click: a('show-preferences') - }, R, { - role: 'quit', - label: '退出', - accelerator: 'Alt+F4' - }) - } - A.push(I), A.push({ - label: '编辑(&E)', - submenu: [{ - role: 'undo', - label: '&撤消' - }, { - role: 'redo', - label: '&恢复' - }, R, { - role: 'cut', - label: '剪切' - }, { - role: 'copy', - label: '&复制' - }, { - role: 'paste', - label: '&粘贴' - }, { - label: '全选', - accelerator: 'CmdOrCtrl+A', - click: a('select-all') - }, R, { - id: 'find', - label: '&查找', - accelerator: 'CmdOrCtrl+F', - click: a('find-text') - }] - }), A.push({ - label: '视图(&V)', - submenu: [{ - label: '&更改', - id: 'show-changes', - accelerator: 'CmdOrCtrl+1', - click: a('show-changes') - }, { - label: '&历史', - id: 'show-history', - accelerator: 'CmdOrCtrl+2', - click: a('show-history') - }, { - label: '存储库列表', - id: 'show-repository-list', - accelerator: 'CmdOrCtrl+T', - click: a('choose-repository') - }, { - label: '分支列表', - id: 'show-branches-list', - accelerator: 'CmdOrCtrl+B', - click: a('show-branches') - }, R, { - label: '转到摘要', - id: 'go-to-commit-message', - accelerator: 'CmdOrCtrl+G', - click: a('go-to-commit-message') - }, { - label: i(L), - id: 'toggle-stashed-changes', - accelerator: 'Ctrl+H', - click: L ? a('hide-stashed-changes') : a('show-stashed-changes') - }, { - label: '全屏切换', - role: 'togglefullscreen' - }, R, { - label: '重置缩放', - accelerator: 'CmdOrCtrl+0', - click: d(k.Reset) - }, { - label: '放大', - accelerator: 'CmdOrCtrl+=', - click: d(k.In) - }, { - label: '缩小', - accelerator: 'CmdOrCtrl+-', - click: d(k.Out) - }, R, { - label: '&重载', - id: 'reload-window', - accelerator: 'CmdOrCtrl+Alt+R', - click(e, n) { - n && n.reload() - }, - visible: !1 - }, { - id: 'show-devtools', - label: '&开发工具', - accelerator: (() => 'Ctrl+Shift+I')(), - click(e, n) { - n && n.webContents.toggleDevTools() - } - }] - }); - const D = o(M, t), - z = M ? 'force-push' : 'push'; - A.push({ - label: '存储库(&R)', - id: 'repository', - submenu: [{ - id: 'push', - label: D, - accelerator: 'CmdOrCtrl+P', - click: a(z) - }, { - id: 'pull', - label: '拉取', - accelerator: 'CmdOrCtrl+Shift+P', - click: a('pull') - }, { - label: P, - id: 'remove-repository', - accelerator: 'CmdOrCtrl+Backspace', - click: a('remove-repository') - }, R, { - id: 'view-repository-on-github', - label: '在Github上查看', - accelerator: 'CmdOrCtrl+Shift+G', - click: a('view-repository-on-github') - }, { - label: T, - id: 'open-in-shell', - accelerator: 'Ctrl+`', - click: a('open-in-shell') - }, { - label: '资源管理器', - id: 'open-working-directory', - accelerator: 'CmdOrCtrl+Shift+F', - click: a('open-working-directory') - }, { - label: N, - id: 'open-external-editor', - accelerator: 'CmdOrCtrl+Shift+A', - click: a('open-external-editor') - }, R, { - id: 'create-issue-in-repository-on-github', - label: '在 GitHub 上新建问题', - accelerator: 'CmdOrCtrl+I', - click: a('create-issue-in-repository-on-github'), - visible: h.enableCreateGitHubIssueFromMenu() - }, R, { - label: '存储库设置\u2026', - id: 'show-repository-settings', - click: a('show-repository-settings') - }] - }), A.push({ - label: '分支(&B)', - id: 'branch', - submenu: [{ - label: '新建分支\u2026', - id: 'create-branch', - accelerator: 'CmdOrCtrl+Shift+N', - click: a('create-branch') - }, { - label: '重命名\u2026', - id: 'rename-branch', - accelerator: 'CmdOrCtrl+Shift+R', - click: a('rename-branch') - }, { - label: '删除\u2026', - id: 'delete-branch', - accelerator: 'CmdOrCtrl+Shift+D', - click: a('delete-branch') - }, R, { - label: '放弃所有更改\u2026', - id: 'discard-all-changes', - accelerator: 'CmdOrCtrl+Shift+Backspace', - click: a('discard-all-changes') - }, { - label: O ? E : C, - id: 'stash-all-changes', - accelerator: 'CmdOrCtrl+Shift+S', - click: a('stash-all-changes') - }, R, { - label: `更新自${l}`, - id: 'update-branch', - accelerator: 'CmdOrCtrl+Shift+U', - click: a('update-branch') - }, { - label: '与分支比较', - id: 'compare-to-branch', - accelerator: 'CmdOrCtrl+Shift+B', - click: a('compare-to-branch') - }, { - label: '合并到当前分支\u2026', - id: 'merge-branch', - accelerator: 'CmdOrCtrl+Shift+M', - click: a('merge-branch') - }, { - label: '恢复当前分支\u2026', - id: 'rebase-branch', - accelerator: 'CmdOrCtrl+Shift+E', - click: a('rebase-branch') - }, R, { - label: '前往GitHub比较', - id: 'compare-on-github', - accelerator: 'CmdOrCtrl+Shift+C', - click: a('compare-on-github') - }, { - label: F, - id: 'create-pull-request', - accelerator: 'CmdOrCtrl+R', - click: a('open-pull-request') - }] - }), !1; - const j = { - label: '反馈问题\u2026', - click() { - c.shell.openExternal('https://github.com/desktop/desktop/issues/new/choose').catch((e) => log.error('Failed opening issue creation page', e)) - } - }, - B = { - label: '联系Github支持\u2026', - click() { - c.shell.openExternal(`https://github.com/contact?from_desktop_app=1&app_version=${c.app.getVersion()}`).catch((e) => log.error('Failed opening contact support page', e)) - } - }, - U = { - label: '用户指南', - click() { - c.shell.openExternal('https://help.github.com/desktop/guides/').catch((e) => log.error('Failed opening user guides page', e)) - } - }, - W = { - label: '键盘快捷键', - click() { - c.shell.openExternal('https://help.github.com/en/desktop/getting-started-with-github-desktop/keyboard-shortcuts-in-github-desktop').catch((e) => log.error('Failed opening keyboard shortcuts page', e)) - } - }, - G = '打开日志文件夹', - H = { - label: G, - click() { - const e = m.getLogDirectoryPath(); - g.ensureDir(e).then(() => { - f.openDirectorySafe(e) - }).catch((e) => { - log.error('Failed opening logs directory', e) - }) - } - }; - return !1, A.push({ - label: '帮助(&H)', - submenu: [...[j, B, U, W, H], R, { - label: '关于 Github 桌面', - click: a('show-about'), - id: 'about' - }] - }), p.ensureItemIds(A), c.Menu.buildFromTemplate(A) - } - - function o(e, n) { - return e ? n ? '强制推送\u2026' : '强制推送' : '推送' - } - - function i(e) { - return e ? '隐藏贮藏的变更' : '显示贮藏的变更' - } - - function a(e) { - return (n, t) => { - t ? t.webContents.send('menu-event', { - name: e - }) : c.ipcMain.emit('menu-event', { - name: e - }) - } - } - - function s(e, n) { - return e.reduce((e, t) => l(t - n) < l(e - n) ? t : e) - } - - function d(e) { - return (n, t) => { - if (t) { - const { - webContents: n - } = t; - if (e === k.Reset) n.zoomFactor = 1, n.send('zoom-factor-changed', 1); - else { - const t = n.zoomFactor, - r = e === k.In ? M : L, - o = s(r, t), - i = r.find((n) => e === k.In ? n > o : n < o), - a = void 0 === i ? o : i; - n.zoomFactor = a, n.send('zoom-factor-changed', a) - } - } - } - } - var l = Math.abs; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const c = t(4), - p = t(24), - u = t(63), - m = t(44), - g = t(20), - f = t(23), - h = t(62), - y = t(61), - _ = '在命令提示符下打开', - b = '创建拉取请求', - S = '显示拉取请求', - w = '默认分支', - v = '删除\u2026', - x = '删除', - E = '保存所有更改\u2026', - C = '保存所有更改'; - var k; - (function (e) { - e[e.Reset = 0] = 'Reset', e[e.In = 1] = 'In', e[e.Out = 2] = 'Out' - })(k || (k = {})), n.buildDefaultMenu = r; - const M = [1, 1.1, 1.25, 1.5, 1.75, 2], - L = M.slice().reverse() -}, function (e, n, t) { - 'use strict'; - const r = t(0), - o = t(4), - i = t(36), - a = t(35); - e.exports = function (e) { - function n(e) { - return !e.isMaximized() && !e.isMinimized() && !e.isFullScreen() - } + "string" == typeof o && (o += this.eol), this.filename ? this.open((function (e) { + if (e) return i._buffer.push([o, r]); + i._write(o, r), i._size += o.length, i._lazyDrain() + })) : (this._write(o, r), this._size += o.length, this._lazyDrain()) + }, p.prototype._write = function (e, t) { + if (this._isStreams2) return this._stream.write(e), t && process.nextTick((function () { + t(null, !0) + })); + var n = this._stream.write(e); + return t ? !1 === n ? this._stream.once("drain", (function () { + t(null, !0) + })) : void process.nextTick((function () { + t(null, !0) + })) : void 0 + }, p.prototype.query = function (e, t) { + "function" == typeof e && (t = e, e = {}); + var n = i.join(this.dirname, this.filename), + o = (e = this.normalizeQuery(e), ""), + s = [], + a = 0, + c = r.createReadStream(n, { + encoding: "utf8" + }); - function t() { - var e = Number.isInteger; - return S && e(S.x) && e(S.y) && e(S.width) && 0 < S.width && e(S.height) && 0 < S.height + function l(t, n) { + try { + var r = JSON.parse(t); + (function (t) { + if (!t) return; + if ("object" != typeof t) return; + var n = new Date(t.timestamp); + if (e.from && n < e.from || e.until && n > e.until) return; + return !0 + })(r) && function (t) { + if (e.rows && s.length >= e.rows && "desc" != e.order) return void(c.readable && c.destroy()); + if (e.fields) { + var n = {}; + e.fields.forEach((function (e) { + n[e] = t[e] + })), t = n + } + "desc" === e.order && s.length >= e.rows && s.shift(); + s.push(t) + }(r) + } catch (e) { + n || c.emit("error", e) + } + } + c.on("error", (function (e) { + if (c.readable && c.destroy(), t) return "ENOENT" !== e.code ? t(e) : t(null, s) + })), c.on("data", (function (t) { + for (var n = (t = (o + t).split(/\n+/)).length - 1, r = 0; r < n; r++)(!e.start || a >= e.start) && l(t[r]), a++; + o = t[n] + })), c.on("close", (function () { + o && l(o, !0), "desc" === e.order && (s = s.reverse()), t && t(null, s) + })) + }, p.prototype.stream = function (e) { + var t = i.join(this.dirname, this.filename), + n = (e = e || {}, new f), + r = { + file: t, + start: e.start + }; + return n.destroy = c.tailFile(r, (function (e, t) { + if (e) return n.emit("error", e); + try { + n.emit("data", t), t = JSON.parse(t), n.emit("log", t) + } catch (e) { + n.emit("error", e) + } + })), n + }, p.prototype.open = function (e) { + return this.opening ? e(!0) : !this._stream || this.maxsize && this._size >= this.maxsize ? (e(!0), this._createStream()) : (this._archive = this.zippedArchive ? this._stream.path : null, void e()) + }, p.prototype.close = function () { + var e = this; + this._stream && (this._stream.end(), this._stream.destroySoon(), this._stream.once("finish", (function () { + e.emit("flush"), e.emit("closed") + }))) + }, p.prototype.flush = function () { + var e = this; + if (!this._buffer.length) return e.emit("flush"); + this._buffer.forEach((function (t) { + var n = t[0], + r = t[1]; + process.nextTick((function () { + e._write(n, r), e._size += n.length + })) + })), e._buffer.length = 0, e._stream.once("drain", (function () { + e.emit("flush"), e.emit("logged") + })) + }, p.prototype._createStream = function () { + var e = this; + this.opening = !0, + function t(n) { + var o = i.join(e.dirname, n); + + function s(t) { + e._stream && (e._stream.end(), e._stream.destroySoon()), e._size = t, e.filename = n, e._stream = r.createWriteStream(o, e.options), e._isStreams2 = u(e._stream), e._stream.on("error", (function (t) { + e._failures < e.maxRetries ? (e._createStream(), e._failures++) : e.emit("error", t) + })), e._stream.setMaxListeners(1 / 0), e.once("flush", (function () { + e.flush(), e.opening = !1, e.emit("open", o) + })), e.flush(), + function () { + if (e._archive) { + var t = a.createGzip(), + n = r.createReadStream(String(e._archive)), + i = r.createWriteStream(e._archive + ".gz"); + n.pipe(t).pipe(i), r.unlink(String(e._archive)), e._archive = "" + } + }() + } + r.stat(o, (function (n, r) { + return n ? "ENOENT" !== n.code ? e.emit("error", n) : s(0) : !r || e.maxsize && r.size >= e.maxsize ? e._incFile((function () { + t(e._getFile()) + })) : void s(r.size) + })) + }(this._getFile()) + }, p.prototype._incFile = function (e) { + var t = i.extname(this._basename), + n = i.basename(this._basename, t); + this.tailable ? this._checkMaxFilesTailable(t, n, e) : (this._created += 1, this._checkMaxFilesIncrementing(t, n, e)) + }, p.prototype._getFile = function () { + var e = i.extname(this._basename), + t = i.basename(this._basename, e); + return !this.tailable && this._created ? t + (this.rotationFormat ? this.rotationFormat() : this._created) + e : t + e + }, p.prototype._checkMaxFilesIncrementing = function (e, t, n) { + var o, s; + if (this.zippedArchive && (this._archive = i.join(this.dirname, t + (1 === this._created ? "" : this._created - 1) + e)), !this.maxFiles || this._created < this.maxFiles) return n(); + o = this._created - this.maxFiles, s = i.join(this.dirname, t + (0 !== o ? o : "") + e + (this.zippedArchive ? ".gz" : "")), r.unlink(s, n) + }, p.prototype._checkMaxFilesTailable = function (e, t, n) { + var o = [], + a = this; + if (this.maxFiles) { + for (var c = this.maxFiles - 1; c > 0; c--) o.push(function (n) { + return function (o) { + var s = i.join(a.dirname, t + (n - 1) + e + (a.zippedArchive ? ".gz" : "")); + r.exists(s, (function (c) { + if (!c) return o(null); + r.rename(s, i.join(a.dirname, t + n + e + (a.zippedArchive ? ".gz" : "")), o) + })) + } + }(c)); + a.zippedArchive && (a._archive = i.join(a.dirname, t + 1 + e)), s.series(o, (function (o) { + r.rename(i.join(a.dirname, t + e), i.join(a.dirname, t + 1 + e), n) + })) + } + }, p.prototype._lazyDrain = function () { + var e = this; + !this._draining && this._stream && (this._draining = !0, this._stream.once("drain", (function () { + this._draining = !1, e.emit("logged") + }))) } +}, function (e, t, n) { + var r = n(11); - function s() { - const e = b.getPrimaryDisplay().bounds; - S = { - width: E.defaultWidth || 800, - height: E.defaultHeight || 600, - x: 0, - y: 0, - displayBounds: e - } + function i(e) { + return e instanceof r.Stream } - function d(e) { - return S.x >= e.x && S.y >= e.y && S.x + S.width <= e.x + e.width && S.y + S.height <= e.y + e.height + function o(e) { + return i(e) && "function" == typeof e._read && "object" == typeof e._readableState } - function l() { - const e = b.getAllDisplays().some((e) => d(e.bounds)); - if (!e) return s() + function s(e) { + return i(e) && "function" == typeof e._write && "object" == typeof e._writableState } + e.exports = i, e.exports.isReadable = o, e.exports.isWritable = s, e.exports.isDuplex = function (e) { + return o(e) && s(e) + } +}, function (e, t, n) { + var r = n(7), + i = n(10), + o = n(77), + s = n(78), + a = n(11).Stream, + c = n(16).Transport, + l = t.Http = function (e) { + c.call(this, e), e = e || {}, this.name = "http", this.ssl = !!e.ssl, this.host = e.host || "localhost", this.port = e.port, this.auth = e.auth, this.path = e.path || "", this.agent = e.agent, this.port || (this.port = this.ssl ? 443 : 80) + }; + r.inherits(l, i.Transport), l.prototype.name = "http", l.prototype._request = function (e, t) { + var n, r = (e = e || {}).auth || this.auth, + i = e.path || this.path || ""; + delete e.auth, delete e.path, (n = (this.ssl ? s : o).request({ + host: this.host, + port: this.port, + path: "/" + i.replace(/^\//, ""), + method: "POST", + headers: { + "Content-Type": "application/json" + }, + agent: this.agent, + auth: r ? r.username + ":" + r.password : "" + })).on("error", t), n.on("response", (function (e) { + var n = ""; + e.on("data", (function (e) { + n += e + })), e.on("end", (function () { + t(null, e, n) + })), e.resume() + })), n.end(new Buffer(JSON.stringify(e), "utf8")) + }, l.prototype.log = function (e, t, n, r) { + var i = this; + "function" == typeof n && (r = n, n = {}); + var o = { + method: "collect", + params: { + level: e, + message: t, + meta: n + } + }; + n && (n.path && (o.path = n.path, delete n.path), n.auth && (o.auth = n.auth, delete n.auth)), this._request(o, (function (e, t) { + if (t && 200 !== t.statusCode && (e = new Error("HTTP Status Code: " + t.statusCode)), e) return r(e); + i.emit("logged"), r && r(null, !0) + })) + }, l.prototype.query = function (e, t) { + "function" == typeof e && (t = e, e = {}); + (e = { + method: "query", + params: e = this.normalizeQuery(e) + }).params.path && (e.path = e.params.path, delete e.params.path), e.params.auth && (e.auth = e.params.auth, delete e.params.auth), this._request(e, (function (e, n, r) { + if (n && 200 !== n.statusCode && (e = new Error("HTTP Status Code: " + n.statusCode)), e) return t(e); + if ("string" == typeof r) try { + r = JSON.parse(r) + } catch (e) { + return t(e) + } + t(null, r) + })) + }, l.prototype.stream = function (e) { + e = e || {}; + var t, n, r = new a; + return r.destroy = function () { + t.destroy() + }, (e = { + method: "stream", + params: e + }).params.path && (e.path = e.params.path, delete e.params.path), e.params.auth && (e.auth = e.params.auth, delete e.params.auth), t = this._request(e), n = "", t.on("data", (function (e) { + for (var t = (e = (n + e).split(/\n+/)).length - 1, i = 0; i < t; i++) try { + r.emit("log", JSON.parse(e[i])) + } catch (e) { + r.emit("error", e) + } + n = e[t] + })), t.on("error", (function (e) { + r.emit("error", e) + })), r + } +}, function (e, t) { + e.exports = require("http") +}, function (e, t) { + e.exports = require("https") +}, function (e, t, n) { + n(14); + var r = n(7), + i = n(12), + o = n(16).Transport, + s = t.Memory = function (e) { + o.call(this, e), e = e || {}, this.errorOutput = [], this.writeOutput = [], this.json = e.json || !1, this.colorize = e.colorize || !1, this.prettyPrint = e.prettyPrint || !1, this.timestamp = void 0 !== e.timestamp && e.timestamp, this.showLevel = void 0 === e.showLevel || e.showLevel, this.label = e.label || null, this.depth = e.depth || null, this.json && (this.stringify = e.stringify || function (e) { + return JSON.stringify(e, null, 2) + }) + }; + r.inherits(s, o), s.prototype.name = "memory", s.prototype.log = function (e, t, n, r) { + if (this.silent) return r(null, !0); + var o; + o = i.log({ + colorize: this.colorize, + json: this.json, + level: e, + message: t, + meta: n, + stringify: this.stringify, + timestamp: this.timestamp, + prettyPrint: this.prettyPrint, + raw: this.raw, + label: this.label, + depth: this.depth, + formatter: this.formatter, + humanReadableUnhandledException: this.humanReadableUnhandledException + }), "error" === e || "debug" === e ? this.errorOutput.push(o) : this.writeOutput.push(o), this.emit("logged"), r(null, !0) + }, s.prototype.clearLogs = function () { + this.errorOutput = [], this.writeOutput = [] + } +}, function (e, t) { + function n(e) { + for (var t in e) this[t] = e[t] + } + t.get = function (e) { + var n = Error.stackTraceLimit; + Error.stackTraceLimit = 1 / 0; + var r = {}, + i = Error.prepareStackTrace; + Error.prepareStackTrace = function (e, t) { + return t + }, Error.captureStackTrace(r, e || t.get); + var o = r.stack; + return Error.prepareStackTrace = i, Error.stackTraceLimit = n, o + }, t.parse = function (e) { + if (!e.stack) return []; + var t = this; + return e.stack.split("\n").slice(1).map((function (e) { + if (e.match(/^\s*[-]{4,}$/)) return t._createParsedCallSite({ + fileName: e, + lineNumber: null, + functionName: null, + typeName: null, + methodName: null, + columnNumber: null, + native: null + }); + var n = e.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/); + if (n) { + var r = null, + i = null, + o = null, + s = null, + a = null, + c = "native" === n[5]; + if (n[1]) { + var l = (o = n[1]).lastIndexOf("."); + if ("." == o[l - 1] && l--, l > 0) { + r = o.substr(0, l), i = o.substr(l + 1); + var u = r.indexOf(".Module"); + u > 0 && (o = o.substr(u + 1), r = r.substr(0, u)) + } + s = null + } + i && (s = r, a = i), "" === i && (a = null, o = null); + var f = { + fileName: n[2] || null, + lineNumber: parseInt(n[3], 10) || null, + functionName: o, + typeName: s, + methodName: a, + columnNumber: parseInt(n[4], 10) || null, + native: c + }; + return t._createParsedCallSite(f) + } + })).filter((function (e) { + return !!e + })) + }; + ["this", "typeName", "functionName", "methodName", "fileName", "lineNumber", "columnNumber", "function", "evalOrigin"].forEach((function (e) { + n.prototype[e] = null, n.prototype["get" + e[0].toUpperCase() + e.substr(1)] = function () { + return this[e] + } + })), ["topLevel", "eval", "native", "constructor"].forEach((function (e) { + n.prototype[e] = !1, n.prototype["is" + e[0].toUpperCase() + e.substr(1)] = function () { + return this[e] + } + })), t._createParsedCallSite = function (e) { + return new n(e) + } +}, function (e, t, n) { + var r = n(12), + i = n(10), + o = n(7)._extend, + s = t.Container = function (e) { + this.loggers = {}, this.options = e || {}, this.default = { + transports: [new i.transports.Console({ + level: "silly", + colorize: !1 + })] + } + }; + s.prototype.get = s.prototype.add = function (e, t) { + var n, s = this; + return this.loggers[e] || (n = (t = o({}, t || this.options || this.default)).transports || this.options.transports, t.transports = n ? n.slice() : [], 0 !== t.transports.length || t && t.console || t.transports.push(this.default.transports[0]), Object.keys(t).forEach((function (n) { + if ("transports" !== n) { + var o = r.capitalize(n); + if (!i.transports[o]) throw new Error("Cannot add unknown transport: " + o); + var s = t[n]; + s.id = e, t.transports.push(new i.transports[o](s)) + } + })), t.id = e, this.loggers[e] = new i.Logger(t), this.loggers[e].on("close", (function () { + s._delete(e) + }))), this.loggers[e] + }, s.prototype.has = function (e) { + return !!this.loggers[e] + }, s.prototype.close = function (e) { + var t = this; - function c() { - const e = S && (t() || S.isMaximized || S.isFullScreen); - return e ? void(t() && S.displayBounds && l()) : void(S = null) + function n(e) { + t.loggers[e] && (t.loggers[e].close(), t._delete(e)) + } + return e ? n(e) : Object.keys(this.loggers).forEach((function (e) { + n(e) + })) + }, s.prototype._delete = function (e) { + delete this.loggers[e] + } +}, function (e, t, n) { + var r = n(14), + i = n(7), + o = n(30), + s = n(26), + a = n(12), + c = n(32), + l = n(11).Stream, + u = /%[sdj%]/g, + f = t.Logger = function (e) { + r.EventEmitter.call(this), this.configure(e) + }; + + function h(e) { + this.logger = e, this.start = Date.now() } + i.inherits(f, r.EventEmitter), f.prototype.configure = function (e) { + var t = this; + Array.isArray(this._names) && this._names.length && this.clear(), e = e || {}, this.transports = {}, this._names = [], e.transports && e.transports.forEach((function (e) { + t.add(e, null, !0) + })), this.padLevels = e.padLevels || !1, this.setLevels(e.levels), e.colors && s.addColors(e.colors), this.id = e.id || null, this.level = e.level || "info", this.emitErrs = e.emitErrs || !1, this.stripColors = e.stripColors || !1, this.exitOnError = void 0 === e.exitOnError || e.exitOnError, this.exceptionHandlers = {}, this.profilers = {}, ["rewriters", "filters"].forEach((function (n) { + t[n] = Array.isArray(e[n]) ? e[n] : [] + })), e.exceptionHandlers && this.handleExceptions(e.exceptionHandlers) + }, f.prototype.log = function (e) { + for (var t = Array.prototype.slice.call(arguments, 1), n = this; null === t[t.length - 1];) t.pop(); + var r = "function" == typeof t[t.length - 1] ? t.pop() : null; + + function s(e) { + r ? r(e) : n.emitErrs && n.emit("error", e) + } + if (0 === this._names.length) return s(new Error("Cannot log with no transports.")); + if (void 0 === n.levels[e]) return s(new Error("Unknown log level: " + e)); + var a = this._names.filter((function (t) { + var r = n.transports[t]; + return r.level && n.levels[r.level] >= n.levels[e] || !r.level && n.levels[n.level] >= n.levels[e] + })); + if (a.length) { + var c, l = {}, + f = t && t[0] && t[0].match && null !== t[0].match(u), + h = f ? t[0].match(u) : [], + p = h.filter((function (e) { + return "%%" === e + })); + if (t.length - 1 - (h.length - p.length) > 0 || 1 === t.length) { + l = t[t.length - 1] || t; + var d = Object.prototype.toString.call(l); + l = "[object Object]" === d || "[object Error]" === d || "[object Array]" === d ? t.pop() : {} + } + if (c = i.format.apply(null, t), this.padLevels && (c = new Array(this.levelLength - e.length + 1).join(" ") + c), this.rewriters.forEach((function (t) { + l = t(e, c, l, n) + })), this.filters.forEach((function (t) { + var r = t(e, c, l, n); + "string" == typeof r ? c = r : (c = r.msg, l = r.meta) + })), this.stripColors) { + var m = /\u001b\[(\d+(;\d+)*)?m/g; + c = ("" + c).replace(m, "") + } + return o.forEach(a, y, g), this + } - function p(e) { - if (e = e || w, !!e) try { - const t = e.getBounds(); - n(e) && (S.x = t.x, S.y = t.y, S.width = t.width, S.height = t.height), S.isMaximized = e.isMaximized(), S.isFullScreen = e.isFullScreen(), S.displayBounds = b.getDisplayMatching(t).bounds - } catch (e) {} + function g(t) { + if (r) { + if (t) return r(t); + r(null, e, c, l) + } + r = null, t || n.emit("logged", e, c, l) + } + + function y(t, r) { + var i = n.transports[t]; + i.log(e, c, l, (function (t) { + if (t) return t.transport = i, g(t), r(); + n.emit("logging", i, e, c, l), r() + })) + } + r && r() + }, f.prototype.query = function (e, t) { + "function" == typeof e && (t = e, e = {}); + var n, r = this, + i = (e = e || {}, {}), + s = a.clone(e.query) || {}; + + function c(t, n) { + e.query && (e.query = t.formatQuery(s)), t.query(e, (function (r, i) { + if (r) return n(r); + n(null, t.formatResults(i, e.format)) + })) + } + if (e.transport) return e.transport = e.transport.toLowerCase(), c(this.transports[e.transport], t); + n = this._names.map((function (e) { + return r.transports[e] + })).filter((function (e) { + return !!e.query + })), o.forEach(n, (function (e, t) { + c(e, (function (n, r) { + t && ((r = n || r) && (i[e.name] = r), t()), t = null + })) + }), (function () { + t(null, i) + })) + }, f.prototype.stream = function (e) { + var t = this, + n = (e = e || {}, new l), + r = []; + if (e.transport) { + var i = this.transports[e.transport]; + if (delete e.transport, i && i.stream) return i.stream(e) + } + return n._streams = r, n.destroy = function () { + for (var e = r.length; e--;) r[e].destroy() + }, this._names.map((function (e) { + return t.transports[e] + })).filter((function (e) { + return !!e.stream + })).forEach((function (t) { + var i = t.stream(e); + i && (r.push(i), i.on("log", (function (e) { + e.transport = e.transport || [], e.transport.push(t.name), n.emit("log", e) + })), i.on("error", (function (e) { + e.transport = e.transport || [], e.transport.push(t.name), n.emit("error", e) + }))) + })), n + }, f.prototype.close = function () { + var e = this; + this._names.forEach((function (t) { + var n = e.transports[t]; + n && n.close && n.close() + })), this.emit("close") + }, f.prototype.handleExceptions = function () { + var e = Array.prototype.slice.call(arguments), + t = [], + n = this; + e.forEach((function (e) { + Array.isArray(e) ? t = t.concat(e) : t.push(e) + })), this.exceptionHandlers = this.exceptionHandlers || {}, t.forEach((function (e) { + n.exceptionHandlers[e.name] = e + })), this._hnames = Object.keys(n.exceptionHandlers), this.catchExceptions || (this.catchExceptions = this._uncaughtException.bind(this), process.on("uncaughtException", this.catchExceptions)) + }, f.prototype.unhandleExceptions = function () { + var e = this; + this.catchExceptions && (Object.keys(this.exceptionHandlers).forEach((function (t) { + var n = e.exceptionHandlers[t]; + n.close && n.close() + })), this.exceptionHandlers = {}, Object.keys(this.transports).forEach((function (t) { + var n = e.transports[t]; + n.handleExceptions && (n.handleExceptions = !1) + })), process.removeListener("uncaughtException", this.catchExceptions), this.catchExceptions = !1) + }, f.prototype.add = function (e, t, n) { + var r = n ? e : new e(t); + if (!r.name && !r.log) throw new Error("Unknown transport with no log() method"); + if (this.transports[r.name]) throw new Error("Transport already attached: " + r.name + ", assign a different name"); + return this.transports[r.name] = r, this._names = Object.keys(this.transports), r._onError = this._onError.bind(this, r), n || r.on("error", r._onError), r.handleExceptions && !this.catchExceptions && this.handleExceptions(), this + }, f.prototype.clear = function () { + Object.keys(this.transports).forEach((function (e) { + this.remove({ + name: e + }) + }), this) + }, f.prototype.remove = function (e) { + var t = "string" != typeof e ? e.name || e.prototype.name : e; + if (!this.transports[t]) throw new Error("Transport " + t + " not attached to this instance"); + var n = this.transports[t]; + return delete this.transports[t], this._names = Object.keys(this.transports), n.close && n.close(), n._onError && n.removeListener("error", n._onError), this + }, f.prototype.startTimer = function () { + return new h(this) + }, f.prototype.profile = function (e) { + var t, n, r, i, o, s = Date.now(); + return this.profilers[e] ? (t = this.profilers[e], delete this.profilers[e], o = "function" == typeof (n = Array.prototype.slice.call(arguments))[n.length - 1] ? n.pop() : null, i = "object" == typeof n[n.length - 1] ? n.pop() : {}, r = 2 === n.length ? n[1] : e, i.durationMs = s - t, this.info(r, i, o)) : (this.profilers[e] = s, this) + }, f.prototype.setLevels = function (e) { + return a.setLevels(this, this.levels, e) + }, f.prototype.cli = function () { + return this.padLevels = !0, this.setLevels(s.cli.levels), s.addColors(s.cli.colors), this.transports.console && (this.transports.console.colorize = this.transports.console.colorize || !0, this.transports.console.timestamp = this.transports.console.timestamp || !1), this + }, f.prototype._uncaughtException = function (e) { + var t, n, r = !1, + i = c.getAllInfo(e), + s = this._getExceptionHandlers(); + + function a() { + n && !r && (clearTimeout(t), r = !0, process.exit(1)) + } + if (n = "function" == typeof this.exitOnError ? this.exitOnError(e) : this.exitOnError, !s || 0 === s.length) return a(); + o.forEach(s, (function (t, n) { + t.logException("uncaughtException: " + (e.message || e), i, n, e) + }), a), n && (t = setTimeout(a, 3e3)) + }, f.prototype._getExceptionHandlers = function () { + var e = this; + return this._hnames.map((function (t) { + return e.exceptionHandlers[t] + })).concat(this._names.map((function (t) { + return e.transports[t].handleExceptions && e.transports[t] + }))).filter(Boolean) + }, f.prototype._onError = function (e, t) { + this.emitErrs && this.emit("error", t, e) + }, h.prototype.done = function (e) { + var t = Array.prototype.slice.call(arguments), + n = "function" == typeof t[t.length - 1] ? t.pop() : null, + r = "object" == typeof t[t.length - 1] ? t.pop() : {}; + return r.duration = Date.now() - this.start + "ms", this.logger.info(e, r, n) + } +}, function (e, t, n) { + var r = n(34), + i = process.cwd, + o = null, + s = process.env.GRACEFUL_FS_PLATFORM || "win32"; + process.cwd = function () { + return o || (o = i.call(process)), o + }; + try { + process.cwd() + } catch (e) {} + var a = process.chdir; + process.chdir = function (e) { + o = null, a.call(process, e) + }, e.exports = function (e) { + r.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && function (e) { + e.lchmod = function (t, n, i) { + e.open(t, r.O_WRONLY | r.O_SYMLINK, n, (function (t, r) { + t ? i && i(t) : e.fchmod(r, n, (function (t) { + e.close(r, (function (e) { + i && i(t || e) + })) + })) + })) + }, e.lchmodSync = function (t, n) { + var i, o = e.openSync(t, r.O_WRONLY | r.O_SYMLINK, n), + s = !0; + try { + i = e.fchmodSync(o, n), s = !1 + } finally { + if (s) try { + e.closeSync(o) + } catch (e) {} else e.closeSync(o) + } + return i + } + }(e); + e.lutimes || function (e) { + r.hasOwnProperty("O_SYMLINK") ? (e.lutimes = function (t, n, i, o) { + e.open(t, r.O_SYMLINK, (function (t, r) { + t ? o && o(t) : e.futimes(r, n, i, (function (t) { + e.close(r, (function (e) { + o && o(t || e) + })) + })) + })) + }, e.lutimesSync = function (t, n, i) { + var o, s = e.openSync(t, r.O_SYMLINK), + a = !0; + try { + o = e.futimesSync(s, n, i), a = !1 + } finally { + if (a) try { + e.closeSync(s) + } catch (e) {} else e.closeSync(s) + } + return o + }) : (e.lutimes = function (e, t, n, r) { + r && process.nextTick(r) + }, e.lutimesSync = function () {}) + }(e); + e.chown = o(e.chown), e.fchown = o(e.fchown), e.lchown = o(e.lchown), e.chmod = n(e.chmod), e.fchmod = n(e.fchmod), e.lchmod = n(e.lchmod), e.chownSync = a(e.chownSync), e.fchownSync = a(e.fchownSync), e.lchownSync = a(e.lchownSync), e.chmodSync = i(e.chmodSync), e.fchmodSync = i(e.fchmodSync), e.lchmodSync = i(e.lchmodSync), e.stat = c(e.stat), e.fstat = c(e.fstat), e.lstat = c(e.lstat), e.statSync = l(e.statSync), e.fstatSync = l(e.fstatSync), e.lstatSync = l(e.lstatSync), e.lchmod || (e.lchmod = function (e, t, n) { + n && process.nextTick(n) + }, e.lchmodSync = function () {}); + e.lchown || (e.lchown = function (e, t, n, r) { + r && process.nextTick(r) + }, e.lchownSync = function () {}); + "win32" === s && (e.rename = (t = e.rename, function (n, r, i) { + var o = Date.now(), + s = 0; + t(n, r, (function a(c) { + if (c && ("EACCES" === c.code || "EPERM" === c.code) && Date.now() - o < 6e4) return setTimeout((function () { + e.stat(r, (function (e, o) { + e && "ENOENT" === e.code ? t(n, r, a) : i(c) + })) + }), s), void(s < 100 && (s += 10)); + i && i(c) + })) + })); + var t; + + function n(t) { + return t ? function (n, r, i) { + return t.call(e, n, r, (function (e) { + u(e) && (e = null), i && i.apply(this, arguments) + })) + } : t + } + + function i(t) { + return t ? function (n, r) { + try { + return t.call(e, n, r) + } catch (e) { + if (!u(e)) throw e + } + } : t + } + + function o(t) { + return t ? function (n, r, i, o) { + return t.call(e, n, r, i, (function (e) { + u(e) && (e = null), o && o.apply(this, arguments) + })) + } : t + } + + function a(t) { + return t ? function (n, r, i) { + try { + return t.call(e, n, r, i) + } catch (e) { + if (!u(e)) throw e + } + } : t + } + + function c(t) { + return t ? function (n, r, i) { + function o(e, t) { + t && (t.uid < 0 && (t.uid += 4294967296), t.gid < 0 && (t.gid += 4294967296)), i && i.apply(this, arguments) + } + return "function" == typeof r && (i = r, r = null), r ? t.call(e, n, r, o) : t.call(e, n, o) + } : t + } + + function l(t) { + return t ? function (n, r) { + var i = r ? t.call(e, n, r) : t.call(e, n); + return i.uid < 0 && (i.uid += 4294967296), i.gid < 0 && (i.gid += 4294967296), i + } : t + } + + function u(e) { + return !e || ("ENOSYS" === e.code || !(process.getuid && 0 === process.getuid() || "EINVAL" !== e.code && "EPERM" !== e.code)) + } + e.read = function (t) { + function n(n, r, i, o, s, a) { + var c; + if (a && "function" == typeof a) { + var l = 0; + c = function (u, f, h) { + if (u && "EAGAIN" === u.code && l < 10) return l++, t.call(e, n, r, i, o, s, c); + a.apply(this, arguments) + } + } + return t.call(e, n, r, i, o, s, c) + } + return n.__proto__ = t, n + }(e.read), e.readSync = (f = e.readSync, function (t, n, r, i, o) { + for (var s = 0;;) try { + return f.call(e, t, n, r, i, o) + } catch (e) { + if ("EAGAIN" === e.code && s < 10) { + s++; + continue + } + throw e + } + }); + var f + } +}, function (e, t, n) { + var r = n(11).Stream; + e.exports = function (e) { + return { + ReadStream: function t(n, i) { + if (!(this instanceof t)) return new t(n, i); + r.call(this); + var o = this; + this.path = n, this.fd = null, this.readable = !0, this.paused = !1, this.flags = "r", this.mode = 438, this.bufferSize = 65536, i = i || {}; + for (var s = Object.keys(i), a = 0, c = s.length; a < c; a++) { + var l = s[a]; + this[l] = i[l] + } + this.encoding && this.setEncoding(this.encoding); + if (void 0 !== this.start) { + if ("number" != typeof this.start) throw TypeError("start must be a Number"); + if (void 0 === this.end) this.end = 1 / 0; + else if ("number" != typeof this.end) throw TypeError("end must be a Number"); + if (this.start > this.end) throw new Error("start must be <= end"); + this.pos = this.start + } + if (null !== this.fd) return void process.nextTick((function () { + o._read() + })); + e.open(this.path, this.flags, this.mode, (function (e, t) { + if (e) return o.emit("error", e), void(o.readable = !1); + o.fd = t, o.emit("open", t), o._read() + })) + }, + WriteStream: function t(n, i) { + if (!(this instanceof t)) return new t(n, i); + r.call(this), this.path = n, this.fd = null, this.writable = !0, this.flags = "w", this.encoding = "binary", this.mode = 438, this.bytesWritten = 0, i = i || {}; + for (var o = Object.keys(i), s = 0, a = o.length; s < a; s++) { + var c = o[s]; + this[c] = i[c] + } + if (void 0 !== this.start) { + if ("number" != typeof this.start) throw TypeError("start must be a Number"); + if (this.start < 0) throw new Error("start must be >= zero"); + this.pos = this.start + } + this.busy = !1, this._queue = [], null === this.fd && (this._open = e.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush()) + } + } + } +}, function (e, t, n) { + "use strict"; + e.exports = function (e) { + if (null === e || "object" != typeof e) return e; + if (e instanceof Object) var t = { + __proto__: e.__proto__ + }; + else t = Object.create(null); + return Object.getOwnPropertyNames(e).forEach((function (n) { + Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n)) + })), t + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(6).mkdirsSync, + s = n(37).utimesMillisSync, + a = Symbol("notExist"); + + function c(e, t, n, o) { + if (!o.filter || o.filter(t, n)) return function (e, t, n, o) { + const s = (o.dereference ? r.statSync : r.lstatSync)(t); + if (s.isDirectory()) return function (e, t, n, i, o) { + if (t === a) return function (e, t, n, i) { + return r.mkdirSync(n), u(t, n, i), r.chmodSync(n, e.mode) + }(e, n, i, o); + if (t && !t.isDirectory()) throw new Error(`Cannot overwrite non-directory '${i}' with directory '${n}'.`); + return u(n, i, o) + }(s, e, t, n, o); + if (s.isFile() || s.isCharacterDevice() || s.isBlockDevice()) return function (e, t, n, i, o) { + return t === a ? l(e, n, i, o) : function (e, t, n, i) { + if (i.overwrite) return r.unlinkSync(n), l(e, t, n, i); + if (i.errorOnExist) throw new Error(`'${n}' already exists`) + }(e, n, i, o) + }(s, e, t, n, o); + if (s.isSymbolicLink()) return function (e, t, n, o) { + let s = r.readlinkSync(t); + o.dereference && (s = i.resolve(process.cwd(), s)); + if (e === a) return r.symlinkSync(s, n); { + let e; + try { + e = r.readlinkSync(n) + } catch (e) { + if ("EINVAL" === e.code || "UNKNOWN" === e.code) return r.symlinkSync(s, n); + throw e + } + if (o.dereference && (e = i.resolve(process.cwd(), e)), f(s, e)) throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${e}'.`); + if (r.statSync(n).isDirectory() && f(e, s)) throw new Error(`Cannot overwrite '${e}' with '${s}'.`); + return function (e, t) { + return r.unlinkSync(t), r.symlinkSync(e, t) + }(s, n) + } + }(e, t, n, o) + }(e, t, n, o) + } + + function l(e, t, i, o) { + return "function" == typeof r.copyFileSync ? (r.copyFileSync(t, i), r.chmodSync(i, e.mode), o.preserveTimestamps ? s(i, e.atime, e.mtime) : void 0) : function (e, t, i, o) { + const s = n(38)(65536), + a = r.openSync(t, "r"), + c = r.openSync(i, "w", e.mode); + let l = 0; + for (; l < e.size;) { + const e = r.readSync(a, s, 0, 65536, l); + r.writeSync(c, s, 0, e), l += e + } + o.preserveTimestamps && r.futimesSync(c, e.atime, e.mtime); + r.closeSync(a), r.closeSync(c) + }(e, t, i, o) + } + + function u(e, t, n) { + r.readdirSync(e).forEach(r => function (e, t, n, r) { + const o = i.join(t, e), + s = i.join(n, e); + return c(h(o, s), o, s, r) + }(r, e, t, n)) + } + + function f(e, t) { + const n = i.resolve(e).split(i.sep), + r = i.resolve(t).split(i.sep); + return n.reduce((e, t, n) => e && r[n] === t, !0) + } + + function h(e, t) { + const { + srcStat: n, + destStat: i + } = function (e, t) { + const n = r.statSync(e); + let i; + try { + i = r.statSync(t) + } catch (e) { + if ("ENOENT" === e.code) return { + srcStat: n, + destStat: a + }; + throw e + } + return { + srcStat: n, + destStat: i + } + }(e, t); + if (i.ino && i.ino === n.ino) throw new Error("Source and destination must not be the same."); + if (n.isDirectory() && f(e, t)) throw new Error(`Cannot copy '${e}' to a subdirectory of itself, '${t}'.`); + return i + } + e.exports = function (e, t, n) { + "function" == typeof n && (n = { + filter: n + }), (n = n || {}).clobber = !("clobber" in n) || !!n.clobber, n.overwrite = "overwrite" in n ? !!n.overwrite : n.clobber, n.preserveTimestamps && "ia32" === process.arch && console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"); + const s = h(e, t); + if (n.filter && !n.filter(e, t)) return; + const a = i.dirname(t); + return r.existsSync(a) || o(a), c(s, e, t, n) + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(36).invalidWin32Path, + s = parseInt("0777", 8); + e.exports = function e(t, n, a, c) { + if ("function" == typeof n ? (a = n, n = {}) : n && "object" == typeof n || (n = { + mode: n + }), o(t)) { + const e = new Error(t + " contains invalid WIN32 path characters."); + return e.code = "EINVAL", a(e) + } + let l = n.mode; + const u = n.fs || r; + void 0 === l && (l = s & ~process.umask()), c || (c = null), a = a || function () {}, t = i.resolve(t), u.mkdir(t, l, r => { + if (!r) return a(null, c = c || t); + switch (r.code) { + case "ENOENT": + if (i.dirname(t) === t) return a(r); + e(i.dirname(t), n, (r, i) => { + r ? a(r, i) : e(t, n, a, i) + }); + break; + default: + u.stat(t, (e, t) => { + e || !t.isDirectory() ? a(r, c) : a(null, c) + }) + } + }) + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(36).invalidWin32Path, + s = parseInt("0777", 8); + e.exports = function e(t, n, a) { + n && "object" == typeof n || (n = { + mode: n + }); + let c = n.mode; + const l = n.fs || r; + if (o(t)) { + const e = new Error(t + " contains invalid WIN32 path characters."); + throw e.code = "EINVAL", e + } + void 0 === c && (c = s & ~process.umask()), a || (a = null), t = i.resolve(t); + try { + l.mkdirSync(t, c), a = a || t + } catch (r) { + if ("ENOENT" === r.code) { + if (i.dirname(t) === t) throw r; + a = e(i.dirname(t), n, a), e(t, n, a) + } else { + let e; + try { + e = l.statSync(t) + } catch (e) { + throw r + } + if (!e.isDirectory()) throw r + } + } + return a + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(6).mkdirs, + s = n(8).pathExists, + a = n(37).utimesMillis, + c = Symbol("notExist"); + + function l(e, t, n, r, a) { + const c = i.dirname(n); + s(c, (i, s) => i ? a(i) : s ? f(e, t, n, r, a) : void o(c, i => i ? a(i) : f(e, t, n, r, a))) + } + + function u(e, t, n, r, i, o) { + Promise.resolve(i.filter(n, r)).then(s => s ? t ? e(t, n, r, i, o) : e(n, r, i, o) : o(), e => o(e)) + } + + function f(e, t, n, r, i) { + return r.filter ? u(h, e, t, n, r, i) : h(e, t, n, r, i) + } + + function h(e, t, n, o, s) { + (o.dereference ? r.stat : r.lstat)(t, (a, l) => a ? s(a) : l.isDirectory() ? function (e, t, n, i, o, s) { + if (t === c) return function (e, t, n, i, o) { + r.mkdir(n, s => { + if (s) return o(s); + m(t, n, i, t => t ? o(t) : r.chmod(n, e.mode, o)) + }) + }(e, n, i, o, s); + if (t && !t.isDirectory()) return s(new Error(`Cannot overwrite non-directory '${i}' with directory '${n}'.`)); + return m(n, i, o, s) + }(l, e, t, n, o, s) : l.isFile() || l.isCharacterDevice() || l.isBlockDevice() ? function (e, t, n, i, o, s) { + return t === c ? p(e, n, i, o, s) : function (e, t, n, i, o) { + if (!i.overwrite) return i.errorOnExist ? o(new Error(`'${n}' already exists`)) : o(); + r.unlink(n, r => r ? o(r) : p(e, t, n, i, o)) + }(e, n, i, o, s) + }(l, e, t, n, o, s) : l.isSymbolicLink() ? function (e, t, n, o, s) { + r.readlink(t, (t, a) => t ? s(t) : (o.dereference && (a = i.resolve(process.cwd(), a)), e === c ? r.symlink(a, n, s) : void r.readlink(n, (t, c) => t ? "EINVAL" === t.code || "UNKNOWN" === t.code ? r.symlink(a, n, s) : s(t) : (o.dereference && (c = i.resolve(process.cwd(), c)), y(a, c) ? s(new Error(`Cannot copy '${a}' to a subdirectory of itself, '${c}'.`)) : e.isDirectory() && y(c, a) ? s(new Error(`Cannot overwrite '${c}' with '${a}'.`)) : function (e, t, n) { + r.unlink(t, i => i ? n(i) : r.symlink(e, t, n)) + }(a, n, s))))) + }(e, t, n, o, s) : void 0) + } + + function p(e, t, n, i, o) { + return "function" == typeof r.copyFile ? r.copyFile(t, n, t => t ? o(t) : d(e, n, i, o)) : function (e, t, n, i, o) { + const s = r.createReadStream(t); + s.on("error", e => o(e)).once("open", () => { + const t = r.createWriteStream(n, { + mode: e.mode + }); + t.on("error", e => o(e)).on("open", () => s.pipe(t)).once("close", () => d(e, n, i, o)) + }) + }(e, t, n, i, o) + } + + function d(e, t, n, i) { + r.chmod(t, e.mode, r => r ? i(r) : n.preserveTimestamps ? a(t, e.atime, e.mtime, i) : i()) + } + + function m(e, t, n, i) { + r.readdir(e, (r, o) => r ? i(r) : g(o, e, t, n, i)) + } + + function g(e, t, n, r, o) { + const s = e.pop(); + return s ? function (e, t, n, r, o, s) { + const a = i.join(n, t), + c = i.join(r, t); + v(a, c, (t, i) => { + if (t) return s(t); + f(i, a, c, o, t => t ? s(t) : g(e, n, r, o, s)) + }) + }(e, s, t, n, r, o) : o() + } + + function y(e, t) { + const n = i.resolve(e).split(i.sep), + r = i.resolve(t).split(i.sep); + return n.reduce((e, t, n) => e && r[n] === t, !0) + } + + function v(e, t, n) { + ! function (e, t, n) { + r.stat(e, (e, i) => { + if (e) return n(e); + r.stat(t, (e, t) => e ? "ENOENT" === e.code ? n(null, { + srcStat: i, + destStat: c + }) : n(e) : n(null, { + srcStat: i, + destStat: t + })) + }) + }(e, t, (r, i) => { + if (r) return n(r); + const { + srcStat: o, + destStat: s + } = i; + return s.ino && s.ino === o.ino ? n(new Error("Source and destination must not be the same.")) : o.isDirectory() && y(e, t) ? n(new Error(`Cannot copy '${e}' to a subdirectory of itself, '${t}'.`)) : n(null, s) + }) + } + e.exports = function (e, t, n, r) { + "function" != typeof n || r ? "function" == typeof n && (n = { + filter: n + }) : (r = n, n = {}), r = r || function () {}, (n = n || {}).clobber = !("clobber" in n) || !!n.clobber, n.overwrite = "overwrite" in n ? !!n.overwrite : n.clobber, n.preserveTimestamps && "ia32" === process.arch && console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"), v(e, t, (i, o) => i ? r(i) : n.filter ? u(l, o, e, t, n, r) : l(o, e, t, n, r)) + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(3), + o = n(1), + s = n(6), + a = n(21), + c = r((function (e, t) { + t = t || function () {}, i.readdir(e, (n, r) => { + if (n) return s.mkdirs(e, t); + r = r.map(t => o.join(e, t)), + function e() { + const n = r.pop(); + if (!n) return t(); + a.remove(n, n => { + if (n) return t(n); + e() + }) + }() + }) + })); + + function l(e) { + let t; + try { + t = i.readdirSync(e) + } catch (t) { + return s.mkdirsSync(e) + } + t.forEach(t => { + t = o.join(e, t), a.removeSync(t) + }) + } + e.exports = { + emptyDirSync: l, + emptydirSync: l, + emptyDir: c, + emptydir: c + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(27); + + function s(e) { + ["unlink", "chmod", "stat", "lstat", "rmdir", "readdir"].forEach(t => { + e[t] = e[t] || r[t], e[t += "Sync"] = e[t] || r[t] + }), e.maxBusyTries = e.maxBusyTries || 3 + } + + function a(e, t, n) { + let r = 0; + "function" == typeof t && (n = t, t = {}), o(e, "rimraf: missing path"), o.strictEqual(typeof e, "string", "rimraf: path should be a string"), o.strictEqual(typeof n, "function", "rimraf: callback function required"), o(t, "rimraf: invalid options argument provided"), o.strictEqual(typeof t, "object", "rimraf: options should be object"), s(t), c(e, t, (function i(o) { + if (o) { + if (("EBUSY" === o.code || "ENOTEMPTY" === o.code || "EPERM" === o.code) && r < t.maxBusyTries) { + r++; + return setTimeout(() => c(e, t, i), 100 * r) + } + "ENOENT" === o.code && (o = null) + } + n(o) + })) + } + + function c(e, t, n) { + o(e), o(t), o("function" == typeof n), t.lstat(e, (r, i) => r && "ENOENT" === r.code ? n(null) : r && "EPERM" === r.code ? l(e, t, r, n) : i && i.isDirectory() ? f(e, t, r, n) : void t.unlink(e, r => { + if (r) { + if ("ENOENT" === r.code) return n(null); + if ("EPERM" === r.code) return l(e, t, r, n); + if ("EISDIR" === r.code) return f(e, t, r, n) + } + return n(r) + })) + } + + function l(e, t, n, r) { + o(e), o(t), o("function" == typeof r), n && o(n instanceof Error), t.chmod(e, 438, i => { + i ? r("ENOENT" === i.code ? null : n) : t.stat(e, (i, o) => { + i ? r("ENOENT" === i.code ? null : n) : o.isDirectory() ? f(e, t, n, r) : t.unlink(e, r) + }) + }) + } + + function u(e, t, n) { + let r; + o(e), o(t), n && o(n instanceof Error); + try { + t.chmodSync(e, 438) + } catch (e) { + if ("ENOENT" === e.code) return; + throw n + } + try { + r = t.statSync(e) + } catch (e) { + if ("ENOENT" === e.code) return; + throw n + } + r.isDirectory() ? p(e, t, n) : t.unlinkSync(e) + } + + function f(e, t, n, r) { + o(e), o(t), n && o(n instanceof Error), o("function" == typeof r), t.rmdir(e, s => { + !s || "ENOTEMPTY" !== s.code && "EEXIST" !== s.code && "EPERM" !== s.code ? s && "ENOTDIR" === s.code ? r(n) : r(s) : function (e, t, n) { + o(e), o(t), o("function" == typeof n), t.readdir(e, (r, o) => { + if (r) return n(r); + let s, c = o.length; + if (0 === c) return t.rmdir(e, n); + o.forEach(r => { + a(i.join(e, r), t, r => { + if (!s) return r ? n(s = r) : void(0 == --c && t.rmdir(e, n)) + }) + }) + }) + }(e, t, r) + }) + } + + function h(e, t) { + let n; + s(t = t || {}), o(e, "rimraf: missing path"), o.strictEqual(typeof e, "string", "rimraf: path should be a string"), o(t, "rimraf: missing options"), o.strictEqual(typeof t, "object", "rimraf: options should be object"); + try { + n = t.lstatSync(e) + } catch (n) { + if ("ENOENT" === n.code) return; + "EPERM" === n.code && u(e, t, n) + } + try { + n && n.isDirectory() ? p(e, t, null) : t.unlinkSync(e) + } catch (n) { + if ("ENOENT" === n.code) return; + if ("EPERM" === n.code) return u(e, t, n); + if ("EISDIR" !== n.code) throw n; + p(e, t, n) + } + } + + function p(e, t, n) { + o(e), o(t), n && o(n instanceof Error); + try { + t.rmdirSync(e) + } catch (r) { + if ("ENOTDIR" === r.code) throw n; + if ("ENOTEMPTY" === r.code || "EEXIST" === r.code || "EPERM" === r.code) ! function (e, t) { + o(e), o(t), t.readdirSync(e).forEach(n => h(i.join(e, n), t)); { + const n = Date.now(); + do { + try { + return t.rmdirSync(e, t) + } catch (e) {} + } while (Date.now() - n < 500) + } + }(e, t); + else if ("ENOENT" !== r.code) throw r + } + } + e.exports = a, a.sync = h +}, function (e, t, n) { + "use strict"; + const r = n(93), + i = n(94), + o = n(95); + e.exports = { + createFile: r.createFile, + createFileSync: r.createFileSync, + ensureFile: r.createFile, + ensureFileSync: r.createFileSync, + createLink: i.createLink, + createLinkSync: i.createLinkSync, + ensureLink: i.createLink, + ensureLinkSync: i.createLinkSync, + createSymlink: o.createSymlink, + createSymlinkSync: o.createSymlinkSync, + ensureSymlink: o.createSymlink, + ensureSymlinkSync: o.createSymlinkSync + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(1), + o = n(2), + s = n(6), + a = n(8).pathExists; + e.exports = { + createFile: r((function (e, t) { + function n() { + o.writeFile(e, "", e => { + if (e) return t(e); + t() + }) + } + o.stat(e, (r, o) => { + if (!r && o.isFile()) return t(); + const c = i.dirname(e); + a(c, (e, r) => e ? t(e) : r ? n() : void s.mkdirs(c, e => { + if (e) return t(e); + n() + })) + }) + })), + createFileSync: function (e) { + let t; + try { + t = o.statSync(e) + } catch (e) {} + if (t && t.isFile()) return; + const n = i.dirname(e); + o.existsSync(n) || s.mkdirsSync(n), o.writeFileSync(e, "") + } + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(1), + o = n(2), + s = n(6), + a = n(8).pathExists; + e.exports = { + createLink: r((function (e, t, n) { + function r(e, t) { + o.link(e, t, e => { + if (e) return n(e); + n(null) + }) + } + a(t, (c, l) => c ? n(c) : l ? n(null) : void o.lstat(e, o => { + if (o) return o.message = o.message.replace("lstat", "ensureLink"), n(o); + const c = i.dirname(t); + a(c, (i, o) => i ? n(i) : o ? r(e, t) : void s.mkdirs(c, i => { + if (i) return n(i); + r(e, t) + })) + })) + })), + createLinkSync: function (e, t) { + if (o.existsSync(t)) return; + try { + o.lstatSync(e) + } catch (e) { + throw e.message = e.message.replace("lstat", "ensureLink"), e + } + const n = i.dirname(t); + return o.existsSync(n) || s.mkdirsSync(n), o.linkSync(e, t) + } + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(1), + o = n(2), + s = n(6), + a = s.mkdirs, + c = s.mkdirsSync, + l = n(96), + u = l.symlinkPaths, + f = l.symlinkPathsSync, + h = n(97), + p = h.symlinkType, + d = h.symlinkTypeSync, + m = n(8).pathExists; + e.exports = { + createSymlink: r((function (e, t, n, r) { + r = "function" == typeof n ? n : r, n = "function" != typeof n && n, m(t, (s, c) => s ? r(s) : c ? r(null) : void u(e, t, (s, c) => { + if (s) return r(s); + e = c.toDst, p(c.toCwd, n, (n, s) => { + if (n) return r(n); + const c = i.dirname(t); + m(c, (n, i) => n ? r(n) : i ? o.symlink(e, t, s, r) : void a(c, n => { + if (n) return r(n); + o.symlink(e, t, s, r) + })) + }) + })) + })), + createSymlinkSync: function (e, t, n) { + if (o.existsSync(t)) return; + const r = f(e, t); + e = r.toDst, n = d(r.toCwd, n); + const s = i.dirname(t); + return o.existsSync(s) || c(s), o.symlinkSync(e, t, n) + } + } +}, function (e, t, n) { + "use strict"; + const r = n(1), + i = n(2), + o = n(8).pathExists; + e.exports = { + symlinkPaths: function (e, t, n) { + if (r.isAbsolute(e)) return i.lstat(e, t => t ? (t.message = t.message.replace("lstat", "ensureSymlink"), n(t)) : n(null, { + toCwd: e, + toDst: e + })); { + const s = r.dirname(t), + a = r.join(s, e); + return o(a, (t, o) => t ? n(t) : o ? n(null, { + toCwd: a, + toDst: e + }) : i.lstat(e, t => t ? (t.message = t.message.replace("lstat", "ensureSymlink"), n(t)) : n(null, { + toCwd: e, + toDst: r.relative(s, e) + }))) + } + }, + symlinkPathsSync: function (e, t) { + let n; + if (r.isAbsolute(e)) { + if (n = i.existsSync(e), !n) throw new Error("absolute srcpath does not exist"); + return { + toCwd: e, + toDst: e + } + } { + const o = r.dirname(t), + s = r.join(o, e); + if (n = i.existsSync(s), n) return { + toCwd: s, + toDst: e + }; + if (n = i.existsSync(e), !n) throw new Error("relative srcpath does not exist"); + return { + toCwd: e, + toDst: r.relative(o, e) + } + } + } + } +}, function (e, t, n) { + "use strict"; + const r = n(2); + e.exports = { + symlinkType: function (e, t, n) { + if (n = "function" == typeof t ? t : n, t = "function" != typeof t && t) return n(null, t); + r.lstat(e, (e, r) => { + if (e) return n(null, "file"); + t = r && r.isDirectory() ? "dir" : "file", n(null, t) + }) + }, + symlinkTypeSync: function (e, t) { + let n; + if (t) return t; + try { + n = r.lstatSync(e) + } catch (e) { + return "file" + } + return n && n.isDirectory() ? "dir" : "file" + } + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(28); + i.outputJson = r(n(102)), i.outputJsonSync = n(103), i.outputJSON = i.outputJson, i.outputJSONSync = i.outputJsonSync, i.writeJSON = i.writeJson, i.writeJSONSync = i.writeJsonSync, i.readJSON = i.readJson, i.readJSONSync = i.readJsonSync, e.exports = i +}, function (e, t, n) { + var r = n(3), + i = n(100), + o = n(101), + s = [], + a = n(7); + var c, l, u = function () {}; + + function f(e) { + i(e), e.gracefulify = f, e.FileReadStream = d, e.FileWriteStream = m, e.createReadStream = function (e, t) { + return new d(e, t) + }, e.createWriteStream = function (e, t) { + return new m(e, t) + }; + var t = e.readFile; + e.readFile = function (e, n, r) { + "function" == typeof n && (r = n, n = null); + return function e(n, r, i) { + return t(n, r, (function (t) { + !t || "EMFILE" !== t.code && "ENFILE" !== t.code ? ("function" == typeof i && i.apply(this, arguments), p()) : h([e, [n, r, i]]) + })) + }(e, n, r) + }; + var n = e.writeFile; + e.writeFile = function (e, t, r, i) { + "function" == typeof r && (i = r, r = null); + return function e(t, r, i, o) { + return n(t, r, i, (function (n) { + !n || "EMFILE" !== n.code && "ENFILE" !== n.code ? ("function" == typeof o && o.apply(this, arguments), p()) : h([e, [t, r, i, o]]) + })) + }(e, t, r, i) + }; + var r = e.appendFile; + r && (e.appendFile = function (e, t, n, i) { + "function" == typeof n && (i = n, n = null); + return function e(t, n, i, o) { + return r(t, n, i, (function (r) { + !r || "EMFILE" !== r.code && "ENFILE" !== r.code ? ("function" == typeof o && o.apply(this, arguments), p()) : h([e, [t, n, i, o]]) + })) + }(e, t, n, i) + }); + var s = e.readdir; + + function a(t) { + return s.apply(e, t) + } + if (e.readdir = function (e, t, n) { + var r = [e]; + "function" != typeof t ? r.push(t) : n = t; + return r.push((function (e, t) { + t && t.sort && t.sort(); + !e || "EMFILE" !== e.code && "ENFILE" !== e.code ? ("function" == typeof n && n.apply(this, arguments), p()) : h([a, [r]]) + })), a(r) + }, "v0.8" === process.version.substr(0, 4)) { + var c = o(e); + d = c.ReadStream, m = c.WriteStream + } + var l = e.ReadStream; + d.prototype = Object.create(l.prototype), d.prototype.open = function () { + var e = this; + y(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.autoClose && e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n), e.read()) + })) + }; + var u = e.WriteStream; + + function d(e, t) { + return this instanceof d ? (l.apply(this, arguments), this) : d.apply(Object.create(d.prototype), arguments) + } + + function m(e, t) { + return this instanceof m ? (u.apply(this, arguments), this) : m.apply(Object.create(m.prototype), arguments) + } + m.prototype = Object.create(u.prototype), m.prototype.open = function () { + var e = this; + y(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n)) + })) + }, e.ReadStream = d, e.WriteStream = m; + var g = e.open; + + function y(e, t, n, r) { + return "function" == typeof n && (r = n, n = null), + function e(t, n, r, i) { + return g(t, n, r, (function (o, s) { + !o || "EMFILE" !== o.code && "ENFILE" !== o.code ? ("function" == typeof i && i.apply(this, arguments), p()) : h([e, [t, n, r, i]]) + })) + }(e, t, n, r) + } + return e.open = y, e + } + + function h(e) { + u("ENQUEUE", e[0].name, e[1]), s.push(e) + } + + function p() { + var e = s.shift(); + e && (u("RETRY", e[0].name, e[1]), e[0].apply(null, e[1])) + } + a.debuglog ? u = a.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (u = function () { + var e = a.format.apply(a, arguments); + e = "GFS4: " + e.split(/\n/).join("\nGFS4: "), console.error(e) + }), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", (function () { + u(s), n(27).equal(s.length, 0) + })), e.exports = f(n(41)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && (e.exports = f(r)), e.exports.close = r.close = (c = r.close, function (e, t) { + return c.call(r, e, (function (e) { + e || p(), "function" == typeof t && t.apply(this, arguments) + })) + }), e.exports.closeSync = r.closeSync = (l = r.closeSync, function (e) { + var t = l.apply(r, arguments); + return p(), t + }) +}, function (e, t, n) { + var r = n(41), + i = n(34), + o = process.cwd, + s = null, + a = process.env.GRACEFUL_FS_PLATFORM || "win32"; + process.cwd = function () { + return s || (s = o.call(process)), s + }; + try { + process.cwd() + } catch (e) {} + var c = process.chdir; + + function l(e) { + return e ? function (t, n, i) { + return e.call(r, t, n, (function (e) { + m(e) && (e = null), i && i.apply(this, arguments) + })) + } : e + } + + function u(e) { + return e ? function (t, n) { + try { + return e.call(r, t, n) + } catch (e) { + if (!m(e)) throw e + } + } : e + } + + function f(e) { + return e ? function (t, n, i, o) { + return e.call(r, t, n, i, (function (e) { + m(e) && (e = null), o && o.apply(this, arguments) + })) + } : e + } + + function h(e) { + return e ? function (t, n, i) { + try { + return e.call(r, t, n, i) + } catch (e) { + if (!m(e)) throw e + } + } : e + } + + function p(e) { + return e ? function (t, n) { + return e.call(r, t, (function (e, t) { + if (!t) return n.apply(this, arguments); + t.uid < 0 && (t.uid += 4294967296), t.gid < 0 && (t.gid += 4294967296), n && n.apply(this, arguments) + })) + } : e + } + + function d(e) { + return e ? function (t) { + var n = e.call(r, t); + return n.uid < 0 && (n.uid += 4294967296), n.gid < 0 && (n.gid += 4294967296), n + } : e + } + + function m(e) { + return !e || ("ENOSYS" === e.code || !(process.getuid && 0 === process.getuid() || "EINVAL" !== e.code && "EPERM" !== e.code)) + } + process.chdir = function (e) { + s = null, c.call(process, e) + }, e.exports = function (e) { + i.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && function (e) { + e.lchmod = function (t, n, r) { + e.open(t, i.O_WRONLY | i.O_SYMLINK, n, (function (t, i) { + t ? r && r(t) : e.fchmod(i, n, (function (t) { + e.close(i, (function (e) { + r && r(t || e) + })) + })) + })) + }, e.lchmodSync = function (t, n) { + var r, o = e.openSync(t, i.O_WRONLY | i.O_SYMLINK, n), + s = !0; + try { + r = e.fchmodSync(o, n), s = !1 + } finally { + if (s) try { + e.closeSync(o) + } catch (e) {} else e.closeSync(o) + } + return r + } + }(e); + e.lutimes || function (e) { + i.hasOwnProperty("O_SYMLINK") ? (e.lutimes = function (t, n, r, o) { + e.open(t, i.O_SYMLINK, (function (t, i) { + t ? o && o(t) : e.futimes(i, n, r, (function (t) { + e.close(i, (function (e) { + o && o(t || e) + })) + })) + })) + }, e.lutimesSync = function (t, n, r) { + var o, s = e.openSync(t, i.O_SYMLINK), + a = !0; + try { + o = e.futimesSync(s, n, r), a = !1 + } finally { + if (a) try { + e.closeSync(s) + } catch (e) {} else e.closeSync(s) + } + return o + }) : (e.lutimes = function (e, t, n, r) { + r && process.nextTick(r) + }, e.lutimesSync = function () {}) + }(e); + e.chown = f(e.chown), e.fchown = f(e.fchown), e.lchown = f(e.lchown), e.chmod = l(e.chmod), e.fchmod = l(e.fchmod), e.lchmod = l(e.lchmod), e.chownSync = h(e.chownSync), e.fchownSync = h(e.fchownSync), e.lchownSync = h(e.lchownSync), e.chmodSync = u(e.chmodSync), e.fchmodSync = u(e.fchmodSync), e.lchmodSync = u(e.lchmodSync), e.stat = p(e.stat), e.fstat = p(e.fstat), e.lstat = p(e.lstat), e.statSync = d(e.statSync), e.fstatSync = d(e.fstatSync), e.lstatSync = d(e.lstatSync), e.lchmod || (e.lchmod = function (e, t, n) { + n && process.nextTick(n) + }, e.lchmodSync = function () {}); + e.lchown || (e.lchown = function (e, t, n, r) { + r && process.nextTick(r) + }, e.lchownSync = function () {}); + "win32" === a && (e.rename = (t = e.rename, function (n, r, i) { + var o = Date.now(), + s = 0; + t(n, r, (function a(c) { + if (c && ("EACCES" === c.code || "EPERM" === c.code) && Date.now() - o < 6e4) return setTimeout((function () { + e.stat(r, (function (e, o) { + e && "ENOENT" === e.code ? t(n, r, a) : i(c) + })) + }), s), void(s < 100 && (s += 10)); + i && i(c) + })) + })); + var t; + e.read = (r = e.read, function (t, n, i, o, s, a) { + var c; + if (a && "function" == typeof a) { + var l = 0; + c = function (u, f, h) { + if (u && "EAGAIN" === u.code && l < 10) return l++, r.call(e, t, n, i, o, s, c); + a.apply(this, arguments) + } + } + return r.call(e, t, n, i, o, s, c) + }), e.readSync = (n = e.readSync, function (t, r, i, o, s) { + for (var a = 0;;) try { + return n.call(e, t, r, i, o, s) + } catch (e) { + if ("EAGAIN" === e.code && a < 10) { + a++; + continue + } + throw e + } + }); + var n; + var r + } +}, function (e, t, n) { + var r = n(11).Stream; + e.exports = function (e) { + return { + ReadStream: function t(n, i) { + if (!(this instanceof t)) return new t(n, i); + r.call(this); + var o = this; + this.path = n, this.fd = null, this.readable = !0, this.paused = !1, this.flags = "r", this.mode = 438, this.bufferSize = 65536, i = i || {}; + for (var s = Object.keys(i), a = 0, c = s.length; a < c; a++) { + var l = s[a]; + this[l] = i[l] + } + this.encoding && this.setEncoding(this.encoding); + if (void 0 !== this.start) { + if ("number" != typeof this.start) throw TypeError("start must be a Number"); + if (void 0 === this.end) this.end = 1 / 0; + else if ("number" != typeof this.end) throw TypeError("end must be a Number"); + if (this.start > this.end) throw new Error("start must be <= end"); + this.pos = this.start + } + if (null !== this.fd) return void process.nextTick((function () { + o._read() + })); + e.open(this.path, this.flags, this.mode, (function (e, t) { + if (e) return o.emit("error", e), void(o.readable = !1); + o.fd = t, o.emit("open", t), o._read() + })) + }, + WriteStream: function t(n, i) { + if (!(this instanceof t)) return new t(n, i); + r.call(this), this.path = n, this.fd = null, this.writable = !0, this.flags = "w", this.encoding = "binary", this.mode = 438, this.bytesWritten = 0, i = i || {}; + for (var o = Object.keys(i), s = 0, a = o.length; s < a; s++) { + var c = o[s]; + this[c] = i[c] + } + if (void 0 !== this.start) { + if ("number" != typeof this.start) throw TypeError("start must be a Number"); + if (this.start < 0) throw new Error("start must be >= zero"); + this.pos = this.start + } + this.busy = !1, this._queue = [], null === this.fd && (this._open = e.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush()) + } + } + } +}, function (e, t, n) { + "use strict"; + const r = n(1), + i = n(6), + o = n(8).pathExists, + s = n(28); + e.exports = function (e, t, n, a) { + "function" == typeof n && (a = n, n = {}); + const c = r.dirname(e); + o(c, (r, o) => r ? a(r) : o ? s.writeJson(e, t, n, a) : void i.mkdirs(c, r => { + if (r) return a(r); + s.writeJson(e, t, n, a) + })) + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(6), + s = n(28); + e.exports = function (e, t, n) { + const a = i.dirname(e); + r.existsSync(a) || o.mkdirsSync(a), s.writeJsonSync(e, t, n) + } +}, function (e, t, n) { + "use strict"; + const r = n(2), + i = n(1), + o = n(35).copySync, + s = n(21).removeSync, + a = n(6).mkdirsSync, + c = n(38); + + function l(e, t, n) { + return r.statSync(e).isDirectory() ? function (e, t, n) { + const r = { + overwrite: !1 + }; + n ? (s(t), i()) : i(); + + function i() { + return o(e, t, r), s(e) + } + }(e, t, n) : function (e, t, n) { + const i = c(65536), + o = n ? "w" : "wx", + s = r.openSync(e, "r"), + a = r.fstatSync(s), + l = r.openSync(t, o, a.mode); + let u = 0; + for (; u < a.size;) { + const e = r.readSync(s, i, 0, 65536, u); + r.writeSync(l, i, 0, e), u += e + } + return r.closeSync(s), r.closeSync(l), r.unlinkSync(e) + }(e, t, n) + } + e.exports = { + moveSync: function e(t, n, o) { + const c = (o = o || {}).overwrite || o.clobber || !1; + if (t = i.resolve(t), n = i.resolve(n), t === n) return r.accessSync(t); + if (function (e, t) { + try { + return r.statSync(e).isDirectory() && e !== t && t.indexOf(e) > -1 && t.split(i.dirname(e) + i.sep)[1].split(i.sep)[0] === i.basename(e) + } catch (e) { + return !1 + } + }(t, n)) throw new Error(`Cannot move '${t}' into itself '${n}'.`); + a(i.dirname(n)), + function () { + if (c) try { + r.renameSync(t, n) + } catch (r) { + if ("ENOTEMPTY" === r.code || "EEXIST" === r.code || "EPERM" === r.code) return s(n), o.overwrite = !1, e(t, n, o); + if ("EXDEV" !== r.code) throw r; + return l(t, n, c) + } else try { + r.linkSync(t, n), r.unlinkSync(t) + } catch (e) { + if ("EXDEV" === e.code || "EISDIR" === e.code || "EPERM" === e.code || "ENOTSUP" === e.code) return l(t, n, c); + throw e + } + }() + } + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(2), + o = n(1), + s = n(39).copy, + a = n(21).remove, + c = n(6).mkdirp, + l = n(8).pathExists; + + function u(e, t, n, r) { + i.rename(e, t, i => i ? "EXDEV" !== i.code ? r(i) : function (e, t, n, r) { + s(e, t, { + overwrite: n, + errorOnExist: !0 + }, t => t ? r(t) : a(e, r)) + }(e, t, n, r) : r()) + } + e.exports = { + move: r((function (e, t, n, r) { + "function" == typeof n && (r = n, n = {}); + const s = n.overwrite || n.clobber || !1; + if (e = o.resolve(e), t = o.resolve(t), e === t) return i.access(e, r); + i.stat(e, (n, i) => n ? r(n) : i.isDirectory() && function (e, t) { + const n = e.split(o.sep), + r = t.split(o.sep); + return n.reduce((e, t, n) => e && r[n] === t, !0) + }(e, t) ? r(new Error(`Cannot move '${e}' to a subdirectory of itself, '${t}'.`)) : void c(o.dirname(t), n => n ? r(n) : function (e, t, n, r) { + if (n) return a(t, i => i ? r(i) : u(e, t, n, r)); + l(t, (i, o) => i ? r(i) : o ? r(new Error("dest already exists.")) : u(e, t, n, r)) + }(e, t, s, r))) + })) + } +}, function (e, t, n) { + "use strict"; + const r = n(5).fromCallback, + i = n(2), + o = n(1), + s = n(6), + a = n(8).pathExists; + e.exports = { + outputFile: r((function (e, t, n, r) { + "function" == typeof n && (r = n, n = "utf8"); + const c = o.dirname(e); + a(c, (o, a) => o ? r(o) : a ? i.writeFile(e, t, n, r) : void s.mkdirs(c, o => { + if (o) return r(o); + i.writeFile(e, t, n, r) + })) + })), + outputFileSync: function (e, ...t) { + const n = o.dirname(e); + if (i.existsSync(n)) return i.writeFileSync(e, ...t); + s.mkdirsSync(n), i.writeFileSync(e, ...t) + } + } +}, function (e, t, n) { + "use strict"; + var r = n(3), + i = n(1), + o = n(7), + s = n(12), + a = n(10).Transport, + c = n(11).Stream, + l = n(9), + u = n(10), + f = n(42), + h = n(31), + p = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + d = e.exports = function (e) { + function t(t) { + Array.prototype.slice.call(arguments, 1).forEach((function (n) { + if (e[n]) throw new Error("Cannot set " + n + " and " + t + "together") + })) + } + if (a.call(this, e), e.filename || e.dirname) t("filename or dirname", "stream"), this._basename = this.filename = e.filename ? i.basename(e.filename) : "winston.log", this.dirname = e.dirname || i.dirname(e.filename), this.options = e.options || { + flags: "a" + }, this.options.highWaterMark = this.options.highWaterMark || 24; + else { + if (!e.stream) throw new Error("Cannot log to file without filename or stream."); + t("stream", "filename", "maxsize"), this._stream = e.stream; + var n = this; + this._stream.on("error", (function (e) { + n.emit("error", e) + })), this._stream.setMaxListeners(1 / 0) + } + this.json = !1 !== e.json, this.colorize = e.colorize || !1, this.maxsize = e.maxsize || null, this.logstash = e.logstash || null, this.maxFiles = e.maxFiles || null, this.label = e.label || null, this.prettyPrint = e.prettyPrint || !1, this.showLevel = void 0 === e.showLevel || e.showLevel, this.timestamp = void 0 === e.timestamp || e.timestamp, this.datePattern = e.datePattern ? e.datePattern : ".yyyy-MM-dd", this.depth = e.depth || null, this.eol = e.eol || l.EOL, this.maxRetries = e.maxRetries || 2, this.prepend = e.prepend || !1, this.createTree = e.createTree || !1, this.localTime = e.localTime || !1, this.zippedArchive = e.zippedArchive || !1, this.maxDays = e.maxDays || 0, this.json && (this.stringify = e.stringify), this._size = 0, this._created = 0, this._buffer = [], this._draining = !1, this._failures = 0, this._archive = !1, this._currentFiles = function () { + if (!this.maxsize) try { + return r.readdirSync(this.dirname).filter(function (e) { + return e.includes(this._basename) + }.bind(this)).map(function (e) { + return { + name: e, + time: r.statSync(i.join(this.dirname, e)).mtime.getTime() + } + }.bind(this)).sort((function (e, t) { + return e.time - t.time + })).map((function (e) { + return e.name + })) + } catch (e) {} + return [] + }.bind(this)(), this._year = this._getTime("year"), this._month = this._getTime("month"), this._date = this._getTime("date"), this._hour = this._getTime("hour"), this._minute = this._getTime("minute"), this._weekday = p[this._getTime("day")]; + var o = /d{1,4}|m{1,4}|yy(?:yy)?|([HhM])\1?/g, + s = function (e, t) { + for (e = String(e), t = t || 2; e.length < t;) e = "0" + e; + return e + }; + this.getFormattedDate = function () { + this._year = this._getTime("year"), this._month = this._getTime("month"), this._date = this._getTime("date"), this._hour = this._getTime("hour"), this._minute = this._getTime("minute"), this._weekday = p[this._getTime("day")]; + var e = { + yy: String(this._year).slice(2), + yyyy: this._year, + M: this._month + 1, + MM: s(this._month + 1), + d: this._date, + dd: s(this._date), + H: this._hour, + HH: s(this._hour), + m: this._minute, + mm: s(this._minute), + ddd: this._weekday + }; + return this.datePattern.replace(o, (function (t) { + return t in e ? e[t] : t.slice(1, t.length - 1) + })) + } + }; + o.inherits(d, a), u.transports.DailyRotateFile = d, d.prototype.name = "dailyRotateFile", d.prototype.log = function (e, t, n, r) { + if (this.silent) return r(null, !0); + if (this._failures >= this.maxRetries) return r(new Error("Transport is in a failed state.")); + var i = this, + o = s.log({ + level: e, + message: t, + meta: n, + json: this.json, + colorize: this.colorize, + logstash: this.logstash, + prettyPrint: this.prettyPrint, + timestamp: this.timestamp, + label: this.label, + stringify: this.stringify, + showLevel: this.showLevel, + depth: this.depth, + formatter: this.formatter, + humanReadableUnhandledException: this.humanReadableUnhandledException + }) + this.eol; + this._size += o.length, this.filename ? this.open((function (e) { + if (e) return i._buffer.push([o, r]); + i._write(o, r), i._lazyDrain() + })) : (this._write(o, r), this._lazyDrain()) + }, d.prototype._write = function (e, t) { + var n = this._stream.write(e); + if (t) return !1 === n ? this._stream.once("drain", (function () { + t(null, !0) + })) : void t(null, !0) + }, d.prototype.query = function (e, t) { + "function" == typeof e && (t = e, e = {}); + var n = this, + o = n._currentFiles.slice(0), + s = [], + a = 0; + e = n.normalizeQuery(e), 0 === o.length && t && t(null, s), + function c(l) { + if (l) { + var u = i.join(n.dirname, l), + f = "", + h = r.createReadStream(u, { + encoding: "utf8" + }); + h.on("error", (function (e) { + if (h.readable && h.destroy(), t) return "ENOENT" === e.code ? t(null, s) : t(e) + })), h.on("data", (function (t) { + for (var n = (t = (f + t).split(/\n+/)).length - 1, r = 0; r < n; r++)(!e.start || a >= e.start) && p(t[r]), a++; + f = t[n] + })), h.on("close", (function () { + f && p(f, !0), "desc" === e.order && (s = s.reverse()), o.length ? c(o.shift()) : t && t(null, s) + })) + } + + function p(t, n) { + try { + var r = JSON.parse(t); + (function (t) { + if (!t) return; + if ("object" != typeof t) return; + var n = new Date(t.timestamp); + if (e.from && n < e.from || e.until && n > e.until) return; + return !0 + })(r) && function (t) { + if (e.rows && s.length >= e.rows && "desc" !== e.order) return void(h.readable && h.destroy()); + if (e.fields) { + var n = {}; + e.fields.forEach((function (e) { + n[e] = t[e] + })), t = n + } + "desc" === e.order && s.length >= e.rows && s.shift(); + s.push(t) + }(r) + } catch (e) { + n || h.emit("error", e) + } + } + }(o.shift()) + }, d.prototype.stream = function (e) { + var t = i.join(this.dirname, this._getFilename()); + e = e || {}; + var n = new c, + r = { + file: t, + start: e.start + }; + return n.destroy = s.tailFile(r, (function (e, t) { + if (e) return n.emit("error", e); + try { + n.emit("data", t), t = JSON.parse(t), n.emit("log", t) + } catch (e) { + n.emit("error", e) + } + })), n.resume && n.resume(), n + }, d.prototype.open = function (e) { + return this.opening ? e(!0) : !this._stream || this.maxsize && this._size >= this.maxsize || this._filenameHasExpired() ? (this._cleanOldFiles(), e(!0), this._createStream()) : void e() + }, d.prototype.close = function () { + var e = this; + this._stream && (this._stream.end(), this._stream.destroySoon(), this._stream.once("drain", (function () { + e.emit("flush"), e.emit("closed") + }))) + }, d.prototype.flush = function () { + var e = this; + this._buffer.forEach((function (t) { + var n = t[0], + r = t[1]; + process.nextTick((function () { + e._write(n, r), e._size += n.length + })) + })), e._buffer.length = 0, e._stream.once("drain", (function () { + e.emit("flush"), e.emit("logged") + })) + }, d.prototype._createStream = function () { + var e = this; + this.opening = !0, + function t(n) { + var o = i.join(e.dirname, n); + + function s(t) { + e._stream && (e._archive = !!e.zippedArchive && e._stream.path, e._stream.end(), e._stream.destroySoon()), e.createTree && f.sync(i.dirname(o)), e._size = t, e.filename = n, e._stream = r.createWriteStream(o, e.options), e._stream.on("error", (function (t) { + e._failures < e.maxRetries ? (e._createStream(), e._failures++) : e.emit("error", t) + })), e._stream.setMaxListeners(1 / 0), e.once("flush", (function () { + e.flush(), e.opening = !1, e.emit("open", o) + })), e.flush(), + function () { + var t = e._archive; + if (e._archive = !1, t && r.existsSync(String(t))) { + var n = h.createGzip(), + i = r.createReadStream(String(t)), + o = r.createWriteStream(t + ".gz"); + i.pipe(n).pipe(o), r.unlinkSync(String(t)) + } + }() + } + r.stat(o, (function (n, r) { + return n ? "ENOENT" !== n.code ? e.emit("error", n) : s(0) : !r || e.maxsize && r.size >= e.maxsize ? t(e._getFile(!0)) : e._filenameHasExpired() ? (e._year = e._getTime("year"), e._month = e._getTime("month"), e._date = e._getTime("date"), e._hour = e._getTime("hour"), e._minute = e._getTime("minute"), e._weekday = p[e._getTime("day")], e._created = 0, t(e._getFile())) : void s(r.size) + })) + }(this._getFile()) + }, d.prototype._getFile = function (e) { + var t, n = this._getFilename(); + if (e) { + if (this.maxFiles && this._created >= this.maxFiles - 1) + if (0 === (t = this._created - (this.maxFiles - 1))) try { + r.unlinkSync(i.join(this.dirname, n)) + } catch (e) {} else try { + r.unlinkSync(i.join(this.dirname, n + "." + t)) + } catch (e) {} + this._created += 1 + } else if (!this.maxsize) + for (-1 === this._currentFiles.indexOf(n) && this._currentFiles.push(n); this.maxFiles && this._currentFiles.length > this.maxFiles;) { + try { + r.unlinkSync(i.join(this.dirname, this._currentFiles[0])) + } catch (e) {} + this._currentFiles = this._currentFiles.slice(1) + } + return this._created ? n + "." + this._created : n + }, d.prototype._getFilename = function () { + var e = this.getFormattedDate(); + return this.prepend ? (".yyyy-MM-dd" === this.datePattern && (this.datePattern = "yyyy-MM-dd.", e = this.getFormattedDate()), e + this._basename) : this._basename + e + }, d.prototype._lazyDrain = function () { + var e = this; + !this._draining && this._stream && (this._draining = !0, this._stream.once("drain", (function () { + this._draining = !1, e.emit("logged") + }))) + }, d.prototype._filenameHasExpired = function () { + return this.datePattern.match(/m/) ? this._year < this._getTime("year") || this._month < this._getTime("month") || this._date < this._getTime("date") || this._hour < this._getTime("hour") || this._minute < this._getTime("minute") : this.datePattern.match(/H/) ? this._year < this._getTime("year") || this._month < this._getTime("month") || this._date < this._getTime("date") || this._hour < this._getTime("hour") : this.datePattern.match(/d/) ? this._year < this._getTime("year") || this._month < this._getTime("month") || this._date < this._getTime("date") : this.datePattern.match(/M/) ? this._year < this._getTime("year") || this._month < this._getTime("month") : !!this.datePattern.match(/yy/) && this._year < this._getTime("year") + }, d.prototype._getTime = function (e) { + var t = new Date; + if (this.localTime) { + if ("year" === e) return t.getFullYear(); + if ("month" === e) return t.getMonth(); + if ("date" === e) return t.getDate(); + if ("hour" === e) return t.getHours(); + if ("minute" === e) return t.getMinutes(); + if ("day" === e) return t.getDay() + } + return "year" === e ? t.getUTCFullYear() : "month" === e ? t.getUTCMonth() : "date" === e ? t.getUTCDate() : "hour" === e ? t.getUTCHours() : "minute" === e ? t.getUTCMinutes() : "day" === e ? t.getUTCDay() : void 0 + }, d.prototype._cleanOldFiles = function () { + var e = this, + t = Date.now(); + + function n(n) { + var o = e.dirname + i.sep + n; + r.stat(o, (function (o, s) { + if (o) console.error("Error stats file ", n, o); + else { + var a = s.mtime && s.mtime.getTime() || 0, + c = t - a; + s.isFile() && c > 864e5 * e.maxDays && function (t) { + r.unlink(e.dirname + i.sep + t, (function (e) { + e && console.error("Error removing file ", t) + })) + }(n) + } + })) + } + e.maxDays && r.readdir(e.dirname, (function (t, r) { + if (t) console.error("Error reading directory ", e.dirname, t); + else { + var i = new RegExp(e._basename, "g"); + r.forEach((function (e) { + /.log/.test(e) && i.test(e) && n(e) + })) + } + })) + } +}, function (e, t, n) { + t.SourceMapGenerator = n(43).SourceMapGenerator, t.SourceMapConsumer = n(111).SourceMapConsumer, t.SourceNode = n(114).SourceNode +}, function (e, t) { + var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); + t.encode = function (e) { + if (0 <= e && e < n.length) return n[e]; + throw new TypeError("Must be between 0 and 63: " + e) + }, t.decode = function (e) { + return 65 <= e && e <= 90 ? e - 65 : 97 <= e && e <= 122 ? e - 97 + 26 : 48 <= e && e <= 57 ? e - 48 + 52 : 43 == e ? 62 : 47 == e ? 63 : -1 + } +}, function (e, t, n) { + var r = n(17); + + function i() { + this._array = [], this._sorted = !0, this._last = { + generatedLine: -1, + generatedColumn: 0 + } + } + i.prototype.unsortedForEach = function (e, t) { + this._array.forEach(e, t) + }, i.prototype.add = function (e) { + var t, n, i, o, s, a; + t = this._last, n = e, i = t.generatedLine, o = n.generatedLine, s = t.generatedColumn, a = n.generatedColumn, o > i || o == i && a >= s || r.compareByGeneratedPositionsInflated(t, n) <= 0 ? (this._last = e, this._array.push(e)) : (this._sorted = !1, this._array.push(e)) + }, i.prototype.toArray = function () { + return this._sorted || (this._array.sort(r.compareByGeneratedPositionsInflated), this._sorted = !0), this._array + }, t.MappingList = i +}, function (e, t, n) { + var r = n(17), + i = n(112), + o = n(45).ArraySet, + s = n(44), + a = n(113).quickSort; + + function c(e) { + var t = e; + return "string" == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ""))), null != t.sections ? new f(t) : new l(t) + } + + function l(e) { + var t = e; + "string" == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ""))); + var n = r.getArg(t, "version"), + i = r.getArg(t, "sources"), + s = r.getArg(t, "names", []), + a = r.getArg(t, "sourceRoot", null), + c = r.getArg(t, "sourcesContent", null), + l = r.getArg(t, "mappings"), + u = r.getArg(t, "file", null); + if (n != this._version) throw new Error("Unsupported version: " + n); + i = i.map(String).map(r.normalize).map((function (e) { + return a && r.isAbsolute(a) && r.isAbsolute(e) ? r.relative(a, e) : e + })), this._names = o.fromArray(s.map(String), !0), this._sources = o.fromArray(i, !0), this.sourceRoot = a, this.sourcesContent = c, this._mappings = l, this.file = u + } + + function u() { + this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null + } + + function f(e) { + var t = e; + "string" == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ""))); + var n = r.getArg(t, "version"), + i = r.getArg(t, "sections"); + if (n != this._version) throw new Error("Unsupported version: " + n); + this._sources = new o, this._names = new o; + var s = { + line: -1, + column: 0 + }; + this._sections = i.map((function (e) { + if (e.url) throw new Error("Support for url field in sections not implemented."); + var t = r.getArg(e, "offset"), + n = r.getArg(t, "line"), + i = r.getArg(t, "column"); + if (n < s.line || n === s.line && i < s.column) throw new Error("Section offsets must be ordered and non-overlapping."); + return s = t, { + generatedOffset: { + generatedLine: n + 1, + generatedColumn: i + 1 + }, + consumer: new c(r.getArg(e, "map")) + } + })) + } + c.fromSourceMap = function (e) { + return l.fromSourceMap(e) + }, c.prototype._version = 3, c.prototype.__generatedMappings = null, Object.defineProperty(c.prototype, "_generatedMappings", { + get: function () { + return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings + } + }), c.prototype.__originalMappings = null, Object.defineProperty(c.prototype, "_originalMappings", { + get: function () { + return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings + } + }), c.prototype._charIsMappingSeparator = function (e, t) { + var n = e.charAt(t); + return ";" === n || "," === n + }, c.prototype._parseMappings = function (e, t) { + throw new Error("Subclasses must implement _parseMappings") + }, c.GENERATED_ORDER = 1, c.ORIGINAL_ORDER = 2, c.GREATEST_LOWER_BOUND = 1, c.LEAST_UPPER_BOUND = 2, c.prototype.eachMapping = function (e, t, n) { + var i, o = t || null; + switch (n || c.GENERATED_ORDER) { + case c.GENERATED_ORDER: + i = this._generatedMappings; + break; + case c.ORIGINAL_ORDER: + i = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration.") + } + var s = this.sourceRoot; + i.map((function (e) { + var t = null === e.source ? null : this._sources.at(e.source); + return null != t && null != s && (t = r.join(s, t)), { + source: t, + generatedLine: e.generatedLine, + generatedColumn: e.generatedColumn, + originalLine: e.originalLine, + originalColumn: e.originalColumn, + name: null === e.name ? null : this._names.at(e.name) + } + }), this).forEach(e, o) + }, c.prototype.allGeneratedPositionsFor = function (e) { + var t = r.getArg(e, "line"), + n = { + source: r.getArg(e, "source"), + originalLine: t, + originalColumn: r.getArg(e, "column", 0) + }; + if (null != this.sourceRoot && (n.source = r.relative(this.sourceRoot, n.source)), !this._sources.has(n.source)) return []; + n.source = this._sources.indexOf(n.source); + var o = [], + s = this._findMapping(n, this._originalMappings, "originalLine", "originalColumn", r.compareByOriginalPositions, i.LEAST_UPPER_BOUND); + if (s >= 0) { + var a = this._originalMappings[s]; + if (void 0 === e.column) + for (var c = a.originalLine; a && a.originalLine === c;) o.push({ + line: r.getArg(a, "generatedLine", null), + column: r.getArg(a, "generatedColumn", null), + lastColumn: r.getArg(a, "lastGeneratedColumn", null) + }), a = this._originalMappings[++s]; + else + for (var l = a.originalColumn; a && a.originalLine === t && a.originalColumn == l;) o.push({ + line: r.getArg(a, "generatedLine", null), + column: r.getArg(a, "generatedColumn", null), + lastColumn: r.getArg(a, "lastGeneratedColumn", null) + }), a = this._originalMappings[++s] + } + return o + }, t.SourceMapConsumer = c, l.prototype = Object.create(c.prototype), l.prototype.consumer = c, l.fromSourceMap = function (e) { + var t = Object.create(l.prototype), + n = t._names = o.fromArray(e._names.toArray(), !0), + i = t._sources = o.fromArray(e._sources.toArray(), !0); + t.sourceRoot = e._sourceRoot, t.sourcesContent = e._generateSourcesContent(t._sources.toArray(), t.sourceRoot), t.file = e._file; + for (var s = e._mappings.toArray().slice(), c = t.__generatedMappings = [], f = t.__originalMappings = [], h = 0, p = s.length; h < p; h++) { + var d = s[h], + m = new u; + m.generatedLine = d.generatedLine, m.generatedColumn = d.generatedColumn, d.source && (m.source = i.indexOf(d.source), m.originalLine = d.originalLine, m.originalColumn = d.originalColumn, d.name && (m.name = n.indexOf(d.name)), f.push(m)), c.push(m) + } + return a(t.__originalMappings, r.compareByOriginalPositions), t + }, l.prototype._version = 3, Object.defineProperty(l.prototype, "sources", { + get: function () { + return this._sources.toArray().map((function (e) { + return null != this.sourceRoot ? r.join(this.sourceRoot, e) : e + }), this) + } + }), l.prototype._parseMappings = function (e, t) { + for (var n, i, o, c, l, f = 1, h = 0, p = 0, d = 0, m = 0, g = 0, y = e.length, v = 0, w = {}, b = {}, _ = [], E = []; v < y;) + if (";" === e.charAt(v)) f++, v++, h = 0; + else if ("," === e.charAt(v)) v++; + else { + for ((n = new u).generatedLine = f, c = v; c < y && !this._charIsMappingSeparator(e, c); c++); + if (o = w[i = e.slice(v, c)]) v += i.length; + else { + for (o = []; v < c;) s.decode(e, v, b), l = b.value, v = b.rest, o.push(l); + if (2 === o.length) throw new Error("Found a source, but no line and column"); + if (3 === o.length) throw new Error("Found a source and line, but no column"); + w[i] = o + } + n.generatedColumn = h + o[0], h = n.generatedColumn, o.length > 1 && (n.source = m + o[1], m += o[1], n.originalLine = p + o[2], p = n.originalLine, n.originalLine += 1, n.originalColumn = d + o[3], d = n.originalColumn, o.length > 4 && (n.name = g + o[4], g += o[4])), E.push(n), "number" == typeof n.originalLine && _.push(n) + } + a(E, r.compareByGeneratedPositionsDeflated), this.__generatedMappings = E, a(_, r.compareByOriginalPositions), this.__originalMappings = _ + }, l.prototype._findMapping = function (e, t, n, r, o, s) { + if (e[n] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + e[n]); + if (e[r] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + e[r]); + return i.search(e, t, o, s) + }, l.prototype.computeColumnSpans = function () { + for (var e = 0; e < this._generatedMappings.length; ++e) { + var t = this._generatedMappings[e]; + if (e + 1 < this._generatedMappings.length) { + var n = this._generatedMappings[e + 1]; + if (t.generatedLine === n.generatedLine) { + t.lastGeneratedColumn = n.generatedColumn - 1; + continue + } + } + t.lastGeneratedColumn = 1 / 0 + } + }, l.prototype.originalPositionFor = function (e) { + var t = { + generatedLine: r.getArg(e, "line"), + generatedColumn: r.getArg(e, "column") + }, + n = this._findMapping(t, this._generatedMappings, "generatedLine", "generatedColumn", r.compareByGeneratedPositionsDeflated, r.getArg(e, "bias", c.GREATEST_LOWER_BOUND)); + if (n >= 0) { + var i = this._generatedMappings[n]; + if (i.generatedLine === t.generatedLine) { + var o = r.getArg(i, "source", null); + null !== o && (o = this._sources.at(o), null != this.sourceRoot && (o = r.join(this.sourceRoot, o))); + var s = r.getArg(i, "name", null); + return null !== s && (s = this._names.at(s)), { + source: o, + line: r.getArg(i, "originalLine", null), + column: r.getArg(i, "originalColumn", null), + name: s + } + } + } + return { + source: null, + line: null, + column: null, + name: null + } + }, l.prototype.hasContentsOfAllSources = function () { + return !!this.sourcesContent && (this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some((function (e) { + return null == e + }))) + }, l.prototype.sourceContentFor = function (e, t) { + if (!this.sourcesContent) return null; + if (null != this.sourceRoot && (e = r.relative(this.sourceRoot, e)), this._sources.has(e)) return this.sourcesContent[this._sources.indexOf(e)]; + var n; + if (null != this.sourceRoot && (n = r.urlParse(this.sourceRoot))) { + var i = e.replace(/^file:\/\//, ""); + if ("file" == n.scheme && this._sources.has(i)) return this.sourcesContent[this._sources.indexOf(i)]; + if ((!n.path || "/" == n.path) && this._sources.has("/" + e)) return this.sourcesContent[this._sources.indexOf("/" + e)] + } + if (t) return null; + throw new Error('"' + e + '" is not in the SourceMap.') + }, l.prototype.generatedPositionFor = function (e) { + var t = r.getArg(e, "source"); + if (null != this.sourceRoot && (t = r.relative(this.sourceRoot, t)), !this._sources.has(t)) return { + line: null, + column: null, + lastColumn: null + }; + var n = { + source: t = this._sources.indexOf(t), + originalLine: r.getArg(e, "line"), + originalColumn: r.getArg(e, "column") + }, + i = this._findMapping(n, this._originalMappings, "originalLine", "originalColumn", r.compareByOriginalPositions, r.getArg(e, "bias", c.GREATEST_LOWER_BOUND)); + if (i >= 0) { + var o = this._originalMappings[i]; + if (o.source === n.source) return { + line: r.getArg(o, "generatedLine", null), + column: r.getArg(o, "generatedColumn", null), + lastColumn: r.getArg(o, "lastGeneratedColumn", null) + } + } + return { + line: null, + column: null, + lastColumn: null + } + }, t.BasicSourceMapConsumer = l, f.prototype = Object.create(c.prototype), f.prototype.constructor = c, f.prototype._version = 3, Object.defineProperty(f.prototype, "sources", { + get: function () { + for (var e = [], t = 0; t < this._sections.length; t++) + for (var n = 0; n < this._sections[t].consumer.sources.length; n++) e.push(this._sections[t].consumer.sources[n]); + return e + } + }), f.prototype.originalPositionFor = function (e) { + var t = { + generatedLine: r.getArg(e, "line"), + generatedColumn: r.getArg(e, "column") + }, + n = i.search(t, this._sections, (function (e, t) { + var n = e.generatedLine - t.generatedOffset.generatedLine; + return n || e.generatedColumn - t.generatedOffset.generatedColumn + })), + o = this._sections[n]; + return o ? o.consumer.originalPositionFor({ + line: t.generatedLine - (o.generatedOffset.generatedLine - 1), + column: t.generatedColumn - (o.generatedOffset.generatedLine === t.generatedLine ? o.generatedOffset.generatedColumn - 1 : 0), + bias: e.bias + }) : { + source: null, + line: null, + column: null, + name: null + } + }, f.prototype.hasContentsOfAllSources = function () { + return this._sections.every((function (e) { + return e.consumer.hasContentsOfAllSources() + })) + }, f.prototype.sourceContentFor = function (e, t) { + for (var n = 0; n < this._sections.length; n++) { + var r = this._sections[n].consumer.sourceContentFor(e, !0); + if (r) return r + } + if (t) return null; + throw new Error('"' + e + '" is not in the SourceMap.') + }, f.prototype.generatedPositionFor = function (e) { + for (var t = 0; t < this._sections.length; t++) { + var n = this._sections[t]; + if (-1 !== n.consumer.sources.indexOf(r.getArg(e, "source"))) { + var i = n.consumer.generatedPositionFor(e); + if (i) return { + line: i.line + (n.generatedOffset.generatedLine - 1), + column: i.column + (n.generatedOffset.generatedLine === i.line ? n.generatedOffset.generatedColumn - 1 : 0) + } + } + } + return { + line: null, + column: null + } + }, f.prototype._parseMappings = function (e, t) { + this.__generatedMappings = [], this.__originalMappings = []; + for (var n = 0; n < this._sections.length; n++) + for (var i = this._sections[n], o = i.consumer._generatedMappings, s = 0; s < o.length; s++) { + var c = o[s], + l = i.consumer._sources.at(c.source); + null !== i.consumer.sourceRoot && (l = r.join(i.consumer.sourceRoot, l)), this._sources.add(l), l = this._sources.indexOf(l); + var u = i.consumer._names.at(c.name); + this._names.add(u), u = this._names.indexOf(u); + var f = { + source: l, + generatedLine: c.generatedLine + (i.generatedOffset.generatedLine - 1), + generatedColumn: c.generatedColumn + (i.generatedOffset.generatedLine === c.generatedLine ? i.generatedOffset.generatedColumn - 1 : 0), + originalLine: c.originalLine, + originalColumn: c.originalColumn, + name: u + }; + this.__generatedMappings.push(f), "number" == typeof f.originalLine && this.__originalMappings.push(f) + } + a(this.__generatedMappings, r.compareByGeneratedPositionsDeflated), a(this.__originalMappings, r.compareByOriginalPositions) + }, t.IndexedSourceMapConsumer = f +}, function (e, t) { + t.GREATEST_LOWER_BOUND = 1, t.LEAST_UPPER_BOUND = 2, t.search = function (e, n, r, i) { + if (0 === n.length) return -1; + var o = function e(n, r, i, o, s, a) { + var c = Math.floor((r - n) / 2) + n, + l = s(i, o[c], !0); + return 0 === l ? c : l > 0 ? r - c > 1 ? e(c, r, i, o, s, a) : a == t.LEAST_UPPER_BOUND ? r < o.length ? r : -1 : c : c - n > 1 ? e(n, c, i, o, s, a) : a == t.LEAST_UPPER_BOUND ? c : n < 0 ? -1 : n + }(-1, n.length, e, n, r, i || t.GREATEST_LOWER_BOUND); + if (o < 0) return -1; + for (; o - 1 >= 0 && 0 === r(n[o], n[o - 1], !0);) --o; + return o + } +}, function (e, t) { + function n(e, t, n) { + var r = e[t]; + e[t] = e[n], e[n] = r + } + + function r(e, t, i, o) { + if (i < o) { + var s = i - 1; + n(e, (u = i, f = o, Math.round(u + Math.random() * (f - u))), o); + for (var a = e[o], c = i; c < o; c++) t(e[c], a) <= 0 && n(e, s += 1, c); + n(e, s + 1, c); + var l = s + 1; + r(e, t, i, l - 1), r(e, t, l + 1, o) + } + var u, f + } + t.quickSort = function (e, t) { + r(e, t, 0, e.length - 1) + } +}, function (e, t, n) { + var r = n(43).SourceMapGenerator, + i = n(17), + o = /(\r?\n)/, + s = "$$$isSourceNode$$$"; + + function a(e, t, n, r, i) { + this.children = [], this.sourceContents = {}, this.line = null == e ? null : e, this.column = null == t ? null : t, this.source = null == n ? null : n, this.name = null == i ? null : i, this[s] = !0, null != r && this.add(r) + } + a.fromStringWithSourceMap = function (e, t, n) { + var r = new a, + s = e.split(o), + c = 0, + l = function () { + return e() + (e() || ""); + + function e() { + return c < s.length ? s[c++] : void 0 + } + }, + u = 1, + f = 0, + h = null; + return t.eachMapping((function (e) { + if (null !== h) { + if (!(u < e.generatedLine)) { + var t = (n = s[c]).substr(0, e.generatedColumn - f); + return s[c] = n.substr(e.generatedColumn - f), f = e.generatedColumn, p(h, t), void(h = e) + } + p(h, l()), u++, f = 0 + } + for (; u < e.generatedLine;) r.add(l()), u++; + if (f < e.generatedColumn) { + var n = s[c]; + r.add(n.substr(0, e.generatedColumn)), s[c] = n.substr(e.generatedColumn), f = e.generatedColumn + } + h = e + }), this), c < s.length && (h && p(h, l()), r.add(s.splice(c).join(""))), t.sources.forEach((function (e) { + var o = t.sourceContentFor(e); + null != o && (null != n && (e = i.join(n, e)), r.setSourceContent(e, o)) + })), r; + + function p(e, t) { + if (null === e || void 0 === e.source) r.add(t); + else { + var o = n ? i.join(n, e.source) : e.source; + r.add(new a(e.originalLine, e.originalColumn, o, t, e.name)) + } + } + }, a.prototype.add = function (e) { + if (Array.isArray(e)) e.forEach((function (e) { + this.add(e) + }), this); + else { + if (!e[s] && "string" != typeof e) throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + e); + e && this.children.push(e) + } + return this + }, a.prototype.prepend = function (e) { + if (Array.isArray(e)) + for (var t = e.length - 1; t >= 0; t--) this.prepend(e[t]); + else { + if (!e[s] && "string" != typeof e) throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + e); + this.children.unshift(e) + } + return this + }, a.prototype.walk = function (e) { + for (var t, n = 0, r = this.children.length; n < r; n++)(t = this.children[n])[s] ? t.walk(e) : "" !== t && e(t, { + source: this.source, + line: this.line, + column: this.column, + name: this.name + }) + }, a.prototype.join = function (e) { + var t, n, r = this.children.length; + if (r > 0) { + for (t = [], n = 0; n < r - 1; n++) t.push(this.children[n]), t.push(e); + t.push(this.children[n]), this.children = t + } + return this + }, a.prototype.replaceRight = function (e, t) { + var n = this.children[this.children.length - 1]; + return n[s] ? n.replaceRight(e, t) : "string" == typeof n ? this.children[this.children.length - 1] = n.replace(e, t) : this.children.push("".replace(e, t)), this + }, a.prototype.setSourceContent = function (e, t) { + this.sourceContents[i.toSetString(e)] = t + }, a.prototype.walkSourceContents = function (e) { + for (var t = 0, n = this.children.length; t < n; t++) this.children[t][s] && this.children[t].walkSourceContents(e); + var r = Object.keys(this.sourceContents); + for (t = 0, n = r.length; t < n; t++) e(i.fromSetString(r[t]), this.sourceContents[r[t]]) + }, a.prototype.toString = function () { + var e = ""; + return this.walk((function (t) { + e += t + })), e + }, a.prototype.toStringWithSourceMap = function (e) { + var t = { + code: "", + line: 1, + column: 0 + }, + n = new r(e), + i = !1, + o = null, + s = null, + a = null, + c = null; + return this.walk((function (e, r) { + t.code += e, null !== r.source && null !== r.line && null !== r.column ? (o === r.source && s === r.line && a === r.column && c === r.name || n.addMapping({ + source: r.source, + original: { + line: r.line, + column: r.column + }, + generated: { + line: t.line, + column: t.column + }, + name: r.name + }), o = r.source, s = r.line, a = r.column, c = r.name, i = !0) : i && (n.addMapping({ + generated: { + line: t.line, + column: t.column + } + }), o = null, i = !1); + for (var l = 0, u = e.length; l < u; l++) 10 === e.charCodeAt(l) ? (t.line++, t.column = 0, l + 1 === u ? (o = null, i = !1) : i && n.addMapping({ + source: r.source, + original: { + line: r.line, + column: r.column + }, + generated: { + line: t.line, + column: t.column + }, + name: r.name + })) : t.column++ + })), this.walkSourceContents((function (e, t) { + n.setSourceContent(e, t) + })), { + code: t.code, + map: n + } + }, t.SourceNode = a +}, function (e, t) { + e.exports = require("module") +}, function (e, t, n) { + (function () { + var t; + t = n(29), e.exports = function () { + function e() { + this.clear() + } + return e.exceptionHandlers = [], e.onEventHandlerException = function (e) { + return 0 === this.exceptionHandlers.length && (this.dispatch = this.exceptionHandlingDispatch), this.exceptionHandlers.push(e), new t((n = this, function () { + if (n.exceptionHandlers.splice(n.exceptionHandlers.indexOf(e), 1), 0 === n.exceptionHandlers.length) return n.dispatch = n.simpleDispatch + })); + var n + }, e.simpleDispatch = function (e, t) { + return e(t) + }, e.exceptionHandlingDispatch = function (e, t) { + var n, r, i, o, s, a; + try { + return e(t) + } catch (e) { + for (n = e, a = [], i = 0, o = (s = this.exceptionHandlers).length; i < o; i++) r = s[i], a.push(r(n)); + return a + } + }, e.dispatch = e.simpleDispatch, e.prototype.disposed = !1, e.prototype.clear = function () { + return this.handlersByEventName = {} + }, e.prototype.dispose = function () { + return this.handlersByEventName = null, this.disposed = !0 + }, e.prototype.on = function (e, n, r) { + var i; + if (null == r && (r = !1), this.disposed) throw new Error("Emitter has been disposed"); + if ("function" != typeof n) throw new Error("Handler must be a function"); + return (i = this.handlersByEventName[e]) ? this.handlersByEventName[e] = r ? [n].concat(i) : i.concat(n) : this.handlersByEventName[e] = [n], new t(this.off.bind(this, e, n)) + }, e.prototype.once = function (e, t, n) { + var r, i; + return null == n && (n = !1), i = function (e) { + return r.dispose(), t(e) + }, r = this.on(e, i, n) + }, e.prototype.preempt = function (e, t) { + return this.on(e, t, !0) + }, e.prototype.off = function (e, t) { + var n, r, i, o, s; + if (!this.disposed && (i = this.handlersByEventName[e])) { + for (r = [], o = 0, s = i.length; o < s; o++)(n = i[o]) !== t && r.push(n); + r.length > 0 ? this.handlersByEventName[e] = r : delete this.handlersByEventName[e] + } + }, e.prototype.emit = function (e, t) { + var n, r, i, o, s; + if (r = null != (s = this.handlersByEventName) ? s[e] : void 0) + for (i = 0, o = r.length; i < o; i++) n = r[i], this.constructor.dispatch(n, t) + }, e.prototype.emitAsync = function (e, t) { + var n, r, i, o; + return (r = null != (o = this.handlersByEventName) ? o[e] : void 0) ? (i = function () { + var e, i, o; + for (o = [], e = 0, i = r.length; e < i; e++) n = r[e], o.push(this.constructor.dispatch(n, t)); + return o + }.call(this), Promise.all(i).then((function () {}))) : Promise.resolve() + }, e.prototype.getEventNames = function () { + return Object.keys(this.handlersByEventName) + }, e.prototype.listenerCountForEventName = function (e) { + var t, n; + return null != (t = null != (n = this.handlersByEventName[e]) ? n.length : void 0) ? t : 0 + }, e.prototype.getTotalListenerCount = function () { + var e, t, n, r, i; + for (t = 0, n = 0, r = (i = Object.keys(this.handlersByEventName)).length; n < r; n++) e = i[n], t += this.handlersByEventName[e].length; + return t + }, e + }() + }).call(this) +}, function (e, t, n) { + (function () { + var t, r; + t = null, e.exports = function () { + function e() { + var e, t, n; + for (this.disposables = new Set, t = 0, n = arguments.length; t < n; t++) e = arguments[t], this.add(e) + } + return e.prototype.disposed = !1, e.prototype.dispose = function () { + this.disposed || (this.disposed = !0, this.disposables.forEach((function (e) { + return e.dispose() + })), this.disposables = null) + }, e.prototype.add = function () { + var e, t, n; + if (!this.disposed) + for (t = 0, n = arguments.length; t < n; t += 1) r(e = arguments[t]), this.disposables.add(e) + }, e.prototype.remove = function (e) { + this.disposed || this.disposables.delete(e) + }, e.prototype.delete = function (e) { + this.remove(e) + }, e.prototype.clear = function () { + this.disposed || this.disposables.clear() + }, e + }(), r = function (e) { + if (null == t && (t = n(29)), !t.isDisposable(e)) throw new TypeError("Arguments to CompositeDisposable.add must have a .dispose() method") + } + }).call(this) +}, function (e, t, n) { + "use strict"; + Object.defineProperty(t, "__esModule", { + value: !0 + }); + const r = n(119); + var i; + + function o(e) { + return e === i.HKEY_CLASSES_ROOT ? 2147483648 : e === i.HKEY_CURRENT_USER ? 2147483649 : e === i.HKEY_LOCAL_MACHINE ? 2147483650 : e === i.HKEY_USERS ? 2147483651 : e === i.HKEY_PERFORMANCE_DATA ? 2147483652 : e === i.HKEY_CURRENT_CONFIG ? 2147483653 : e === i.HKEY_DYN_DATA ? 2147483654 : e === i.HKEY_CURRENT_USER_LOCAL_SETTINGS ? 2147483655 : e === i.HKEY_PERFORMANCE_TEXT ? 2147483728 : e === i.HKEY_PERFORMANCE_NLSTEXT ? 2147483744 : function (e, t) { + throw new Error(t) + }(0, "The key does not map to an expected number value") + } + + function s(e, t) { + if (!r) return []; + const n = o(e); + return r.readValues(n, t) + } + + function a(e, t) { + if (!r) return []; + const n = o(e); + return r.enumKeys(n, t) + }! function (e) { + e.REG_BINARY = "REG_BINARY", e.REG_DWORD = "REG_DWORD", e.REG_DWORD_LITTLE_ENDIAN = "REG_DWORD_LITTLE_ENDIAN", e.REG_DWORD_BIG_ENDIAN = "REG_DWORD_BIG_ENDIAN", e.REG_EXPAND_SZ = "REG_EXPAND_SZ", e.REG_LINK = "REG_LINK", e.REG_MULTI_SZ = "REG_MULTI_SZ", e.REG_NONE = "REG_NONE", e.REG_QWORD = "REG_QWORD", e.REG_QWORD_LITTLE_ENDIAN = "REG_QWORD_LITTLE_ENDIAN", e.REG_SZ = "REG_SZ" + }(t.RegistryValueType || (t.RegistryValueType = {})), + function (e) { + e.HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT", e.HKEY_CURRENT_CONFIG = "HKEY_CURRENT_CONFIG", e.HKEY_DYN_DATA = "HKEY_DYN_DATA", e.HKEY_CURRENT_USER_LOCAL_SETTINGS = "HKEY_CURRENT_USER_LOCAL_SETTINGS", e.HKEY_CURRENT_USER = "HKEY_CURRENT_USER", e.HKEY_LOCAL_MACHINE = "HKEY_LOCAL_MACHINE", e.HKEY_PERFORMANCE_DATA = "HKEY_PERFORMANCE_DATA", e.HKEY_PERFORMANCE_TEXT = "HKEY_PERFORMANCE_TEXT", e.HKEY_PERFORMANCE_NLSTEXT = "HKEY_PERFORMANCE_NLSTEXT", e.HKEY_USERS = "HKEY_USERS" + }(i = t.HKEY || (t.HKEY = {})), t.enumerateValues = s, t.enumerateValuesSafe = function (e, t) { + try { + return s(e, t) + } catch (e) { + return [] + } + }, t.enumerateKeys = a, t.enumerateKeysSafe = function (e, t) { + try { + return a(e, t) + } catch (e) { + return [] + } + } +}, function (e, t, n) { + (function (e) { + const t = n(1).join(__dirname, "registry.node"); + try { + global.process.dlopen(e, t) + } catch (e) { + throw new Error("Cannot open " + t + ": " + e) + } + }).call(this, n(120)(e)) +}, function (e, t) { + e.exports = function (e) { + return e.webpackPolyfill || (e.deprecate = function () {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", { + enumerable: !0, + get: function () { + return e.l + } + }), Object.defineProperty(e, "id", { + enumerable: !0, + get: function () { + return e.i + } + }), e.webpackPolyfill = 1), e + } +}, function (e, t, n) { + "use strict"; + n.r(t); + var r = n(1), + i = n(10), + o = n(23), + s = n(4); + n(107); + let a = null; + + function c() { + return a || (a = new Promise((e, t) => { + const n = Object(o.a)(); + Object(s.ensureDir)(n).then(() => { + try { + const t = function (e) { + const t = new i.transports.DailyRotateFile({ + filename: e, + handleExceptions: !1, + json: !1, + datePattern: "yyyy-MM-dd.", + prepend: !0, + level: "info", + maxFiles: 14 + }); + t.on("error", () => {}); + const n = new i.transports.Console({ + level: "error" + }); + return i.configure({ + transports: [n, t] + }), i.log + }((o = n, r.join(o, "desktop.production.log"))); + e(t) + } catch (e) { + t(e) + } + var o + }).catch(e => { + t(e) + }) + }), a) + } + async function l(e, t) { + try { + const n = await c(); + await new Promise((r, i) => { + n(e, t, e => { + e ? i(e) : r() + }) + }) + } catch (e) {} + } + var u = n(3), + f = n(50), + h = n.n(f), + p = n(51), + d = n.n(p); + const m = ["renderer.js", "main.js"]; + + function g(e) { + if (!m.some(t => e.endsWith(t))) return null; + e.startsWith("file://") && (e = h()(e)); + const t = e + ".map"; + if (!u.existsSync(t)) return null; + try { + const e = u.readFileSync(t, "utf8"); + return { + url: r.basename(t), + map: e + } + } catch (e) { + return null + } } + const y = new WeakMap; + let v; - function u(e) { - e && p(e); - try { - a.sync(r.dirname(C)), i.writeFileSync(C, S) - } catch (e) {} + function w(e, t) { + return y.set(e, t), e + t.map(e => "\n at " + e).join("") } - function m() { - clearTimeout(v), v = setTimeout(p, x) + function b(e) { + return { + name: e.name, + message: e.message, + stack: _(e) + } } - function g() { - p() + function _(e) { + let t = y.get(e); + return t || ((e.stack || "").toString(), t = y.get(e)), t ? v(e, t) : e.stack } - function f() { - y(), u() + function E(e, t) { + return (e = b(e)).stack ? t ? `${t}\n${e.stack}` : e.stack.trim() : t ? `${t}\n${e.name}: ${e.message}` : `${e.name}: ${e.message}` } - function h(e) { - E.maximize && S.isMaximized && e.maximize(), E.fullScreen && S.isFullScreen && e.setFullScreen(!0), e.on('resize', m), e.on('move', m), e.on('close', g), e.on('closed', f), w = e - } - - function y() { - w && (w.removeListener('resize', m), w.removeListener('move', m), clearTimeout(v), w.removeListener('close', g), w.removeListener('closed', f), w = null) - } - const _ = o.app || o.remote.app, - b = o.screen || o.remote.screen; - let S, w, v; - const x = 100, - E = Object.assign({ - file: 'window-state.json', - path: _.getPath('userData'), - maximize: !0, - fullScreen: !0 - }, e), - C = r.join(E.path, E.file); - try { - S = i.readFileSync(C) - } catch (e) {} - return c(), S = Object.assign({ - width: E.defaultWidth || 800, - height: E.defaultHeight || 600 - }, S), { - get x() { - return S.x - }, - get y() { - return S.y - }, - get width() { - return S.width - }, - get height() { - return S.height - }, - get displayBounds() { - return S.displayBounds - }, - get isMaximized() { - return S.isMaximized - }, - get isFullScreen() { - return S.isFullScreen - }, - saveState: u, - unmanage: y, - manage: h, - resetStateToDefault: s - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e) { - if (e.accelerator) return e.accelerator; - if (e.role) { - const n = e.getDefaultRoleAccelerator; - if ('function' == typeof n) try { - const t = n.call(e); - if ('string' == typeof t) return t - } catch (e) { - console.error('Could not retrieve default accelerator', e) - } - } - return null - } - - function o(e) { - const n = e.match(/&([^&])/); - return n ? n[1] : null - } - - function i(e) { - switch (e) { - case 'normal': - case 'separator': - case 'submenu': - case 'checkbox': - case 'radio': - return e; - default: - throw new Error(`Unable to parse string ${e} to a valid menu item type`); - } - } - - function a(e) { - const n = e.id; - if (!n) throw new Error(`menuItem must specify id: ${e.label}`); - const t = e.enabled, - a = e.visible, - d = e.label, - l = e.checked, - c = r(e), - u = o(e.label), - m = i(e.type); - switch (m) { - case 'normal': - return { - id: n, type: 'menuItem', label: d, enabled: t, visible: a, accelerator: c, accessKey: u - }; - case 'separator': - return { - id: n, type: 'separator', visible: a - }; - case 'submenu': - const r = s(e.submenu, n); - return { - id: n, type: 'submenuItem', label: d, enabled: t, visible: a, menu: r, accessKey: u - }; - case 'checkbox': - return { - id: n, type: 'checkbox', label: d, enabled: t, visible: a, accelerator: c, checked: l, accessKey: u - }; - case 'radio': - return { - id: n, type: 'radio', label: d, enabled: t, visible: a, accelerator: c, checked: l, accessKey: u - }; - default: - return p.assertNever(m, `Unknown menu item type ${m}`); - } - } - - function s(e, n) { - const t = e.items.map(a); - return !1, { - id: n, - type: 'menu', - items: t - } - } - - function d(e, n = new Map) { - for (const t of e.items) n.set(t.id, t), 'submenuItem' === t.type && d(t.menu, n); - return n - } - - function l(e) { - return 'menuItem' === e.type || 'submenuItem' === e.type || 'checkbox' === e.type || 'radio' === e.type - } - - function c(e) { - return 'separator' !== e.type && e.enabled && e.visible - } - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const p = t(27); - n.menuFromElectronMenu = s, n.itemMayHaveAccessKey = l, n.itemIsSelectable = c, n.findItemByAccessKey = function (e, n) { - const t = e.toLowerCase(); - for (const r of n) - if (l(r) && r.accessKey && r.accessKey.toLowerCase() === t) return r; - return null - }; - class u { - constructor(e, n, t) { - this.menu = e, this.openMenus = n, this.menuItemById = t - } - static fromMenu(e) { - const n = d(e); - return new u(e, [e], n) - } - getItemById(e) { - return this.menuItemById.get(e) - } - withMenu(e) { - const n = d(e), - t = []; - for (const r of this.openMenus) { - let o; - if (!r.id) o = e; - else { - const e = n.get(r.id); - if (e && 'submenuItem' === e.type) o = e.menu; - else break - } - let i; - r.selectedItem && (i = n.get(r.selectedItem.id)), t.push({ - id: o.id, - type: 'menu', - items: o.items, - selectedItem: i - }) - } - return new u(e, t, n) - } - withOpenedMenu(e, n = !1) { - const t = this.menuItemById.get(e.id); - if (!t) return this; - if ('submenuItem' !== t.type) throw new Error(`Attempt to open a submenu from an item of wrong type: ${t.type}`); - const r = this.openMenus.findIndex((e) => -1 !== e.items.indexOf(t)); - if (-1 === r) return this; - const o = this.openMenus.slice(0, r + 1); - if (n) { - const e = t.menu.items.find(c); - o.push(Object.assign({}, t.menu, { - selectedItem: e - })) - } else o.push(t.menu); - return new u(this.menu, o, this.menuItemById) - } - withClosedMenu(e) { - if (!e.id) return this; - const n = this.openMenus.findIndex((n) => n.id === e.id); - if (-1 === n) return this; - const t = this.openMenus.slice(0, n); - return new u(this.menu, t, this.menuItemById) - } - withLastMenu(e) { - const n = this.openMenus.findIndex((n) => n.id === e.id); - if (-1 === n) return this; - const t = this.openMenus.slice(0, n + 1); - return new u(this.menu, t, this.menuItemById) - } - withSelectedItem(e) { - const n = this.menuItemById.get(e.id); - if (!n) return this; - const t = this.openMenus.findIndex((e) => -1 !== e.items.indexOf(n)); - if (-1 === t) return this; - const r = this.openMenus.slice(), - o = r[t]; - r[t] = Object.assign({}, o, { - selectedItem: n - }); - for (let n = t + 1; n < r.length; n++) r[n] = Object.assign({}, r[n], { - selectedItem: void 0 - }); - for (let n = t - 1; 0 <= n; n--) { - const e = r[n], - t = r[n + 1], - o = e.items.find((e) => 'submenuItem' === e.type && e.id === t.id); - r[n] = Object.assign({}, e, { - selectedItem: o - }) - } - return new u(this.menu, r, this.menuItemById) - } - withDeselectedMenu(e) { - const n = this.openMenus.findIndex((n) => n.id === e.id); - if (-1 === n) return this; - const t = this.openMenus[n], - r = this.openMenus.slice(); - r[n] = Object.assign({}, t, { - selectedItem: void 0 - }); - for (let t = n - 1; 0 <= t; t--) { - const e = r[t], - n = r[t + 1], - o = e.items.find((e) => 'submenuItem' === e.type && e.id === n.id); - r[t] = Object.assign({}, e, { - selectedItem: o - }) - } - return new u(this.menu, r, this.menuItemById) - } - withReset() { - return new u(this.menu, [this.menu], this.menuItemById) - } - } - n.AppMenu = u -}, function (e, n, t) { - 'use strict'; - const r = t(0); - e.exports = (e, n) => { - if ('string' != typeof e) throw new TypeError(`Expected a string, got ${typeof e}`); - n = Object.assign({ - resolve: !0 - }, n); - let t = e; - return n.resolve && (t = r.resolve(e)), t = t.replace(/\\/g, '/'), '/' !== t[0] && (t = `/${t}`), encodeURI(`file://${t}`).replace(/[?#]/g, encodeURIComponent) - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(0), - o = t(67); - n.encodePathAsUrl = function (...e) { - const n = r.resolve(...e); - return o(n) - } -}, function (e, n, t) { - (function () { - var n, r, o; - r = null, e.exports = n = function () { - function e() { - var e, n, t; - for (this.disposables = new Set, n = 0, t = arguments.length; n < t; n++) e = arguments[n], this.add(e) - } - return e.prototype.disposed = !1, e.prototype.dispose = function () { - this.disposed || (this.disposed = !0, this.disposables.forEach(function (e) { - return e.dispose() - }), this.disposables = null) - }, e.prototype.add = function () { - var e, n, t; - if (!this.disposed) - for (n = 0, t = arguments.length; n < t; n += 1) e = arguments[n], o(e), this.disposables.add(e) - }, e.prototype.remove = function (e) { - this.disposed || this.disposables['delete'](e) - }, e.prototype['delete'] = function (e) { - this.remove(e) - }, e.prototype.clear = function () { - this.disposed || this.disposables.clear() - }, e - }(), o = function (e) { - if (null == r && (r = t(17)), !r.isDisposable(e)) throw new TypeError('Arguments to CompositeDisposable.add must have a .dispose() method') - } - }).call(this) -}, function (e, n, t) { - (function () { - var n, r; - n = t(17), e.exports = r = function () { - function e() { - this.clear() - } - return e.exceptionHandlers = [], e.onEventHandlerException = function (e) { - return 0 === this.exceptionHandlers.length && (this.dispatch = this.exceptionHandlingDispatch), this.exceptionHandlers.push(e), new n(function (n) { - return function () { - if (n.exceptionHandlers.splice(n.exceptionHandlers.indexOf(e), 1), 0 === n.exceptionHandlers.length) return n.dispatch = n.simpleDispatch - } - }(this)) - }, e.simpleDispatch = function (e, n) { - return e(n) - }, e.exceptionHandlingDispatch = function (e, n) { - var t, r, o, i, a, s; - try { - return e(n) - } catch (e) { - for (t = e, a = this.exceptionHandlers, s = [], (o = 0, i = a.length); o < i; o++) r = a[o], s.push(r(t)); - return s - } - }, e.dispatch = e.simpleDispatch, e.prototype.disposed = !1, e.prototype.clear = function () { - return this.handlersByEventName = {} - }, e.prototype.dispose = function () { - return this.handlersByEventName = null, this.disposed = !0 - }, e.prototype.on = function (e, t, r) { - var o; - if (null == r && (r = !1), this.disposed) throw new Error('Emitter has been disposed'); - if ('function' != typeof t) throw new Error('Handler must be a function'); - return this.handlersByEventName[e] = (o = this.handlersByEventName[e]) ? r ? [t].concat(o) : o.concat(t) : [t], new n(this.off.bind(this, e, t)) - }, e.prototype.once = function (e, n, t) { - var r, o; - return null == t && (t = !1), o = function (e) { - return r.dispose(), n(e) - }, r = this.on(e, o, t) - }, e.prototype.preempt = function (e, n) { - return this.on(e, n, !0) - }, e.prototype.off = function (e, n) { - var t, r, o, i, a; - if (!this.disposed && (o = this.handlersByEventName[e])) { - for (r = [], i = 0, a = o.length; i < a; i++) t = o[i], t !== n && r.push(t); - 0 < r.length ? this.handlersByEventName[e] = r : delete this.handlersByEventName[e] - } - }, e.prototype.emit = function (e, n) { - var t, r, o, i, a; - if (r = null == (a = this.handlersByEventName) ? void 0 : a[e]) - for (o = 0, i = r.length; o < i; o++) t = r[o], this.constructor.dispatch(t, n) - }, e.prototype.emitAsync = function (e, n) { - var t, r, o, i; - return (r = null == (i = this.handlersByEventName) ? void 0 : i[e]) ? (o = function () { - var e, o, i; - for (i = [], e = 0, o = r.length; e < o; e++) t = r[e], i.push(this.constructor.dispatch(t, n)); - return i - }.call(this), Promise.all(o).then(function () {})) : Promise.resolve() - }, e.prototype.getEventNames = function () { - return Object.keys(this.handlersByEventName) - }, e.prototype.listenerCountForEventName = function (e) { - var n, t; - return null == (n = null == (t = this.handlersByEventName[e]) ? void 0 : t.length) ? 0 : n - }, e.prototype.getTotalListenerCount = function () { - var e, n, t, r, o; - for (n = 0, o = Object.keys(this.handlersByEventName), (t = 0, r = o.length); t < r; t++) e = o[t], n += this.handlersByEventName[e].length; - return n - }, e - }() - }).call(this) -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(4), - o = t(29), - i = t(68), - a = t(28), - s = t(66), - d = t(26), - l = t(0), - c = t(65); - class p { - constructor() { - this.emitter = new o.Emitter, this._loadTime = null, this._rendererReadyTime = null, this.minWidth = 960, this.minHeight = 660; - const e = c({ - defaultWidth: this.minWidth, - defaultHeight: this.minHeight - }), - n = { - x: e.x, - y: e.y, - width: e.width, - height: e.height, - minWidth: this.minWidth, - minHeight: this.minHeight, - show: !1, - backgroundColor: '#fff', - webPreferences: { - disableBlinkFeatures: 'Auxclick', - experimentalFeatures: !0, - nodeIntegration: !0 - }, - acceptFirstMouse: !0 - }; - n.frame = !1, this.window = new r.BrowserWindow(n), e.manage(this.window); - let t = !1; - r.app.on('before-quit', () => { - t = !0 - }), r.ipcMain.on('will-quit', (e) => { - t = !0, e.returnValue = !0 - }), !1, this.window.once('ready-to-show', () => { - this.window.on('unmaximize', () => { - setTimeout(() => { - const e = this.window.getBounds(); - e.width += 1, this.window.setBounds(e), e.width -= 1, this.window.setBounds(e) - }, 5) - }) - }) - } - load() { - let e = 0; - this.window.webContents.once('did-start-loading', () => { - this._rendererReadyTime = null, this._loadTime = null, e = d.now() - }), this.window.webContents.once('did-finish-load', () => { - !1, this._loadTime = d.now() - e, this.maybeEmitDidLoad() - }), this.window.webContents.on('did-finish-load', () => { - this.window.webContents.setVisualZoomLevelLimits(1, 1) - }), this.window.webContents.on('did-fail-load', () => { - this.window.webContents.openDevTools(), this.window.show() - }), r.ipcMain.once('renderer-ready', (e, n) => { - this._rendererReadyTime = n, this.maybeEmitDidLoad() - }), this.window.on('focus', () => this.window.webContents.send('focus')), this.window.on('blur', () => this.window.webContents.send('blur')), a.registerWindowStateChangedEvents(this.window), this.window.loadURL(i.encodePathAsUrl(__dirname, 'index.html')) - } - maybeEmitDidLoad() { - this.rendererLoaded && this.emitter.emit('did-load', null) - } - get rendererLoaded() { - return !!this.loadTime && !!this.rendererReadyTime - } - onClose(e) { - this.window.on('closed', e) - } - onDidLoad(e) { - return this.emitter.on('did-load', e) - } - isMinimized() { - return this.window.isMinimized() - } - isVisible() { - return this.window.isVisible() - } - restore() { - this.window.restore() - } - focus() { - this.window.focus() - } - show() { - this.window.show() - } - sendMenuEvent(e) { - this.show(), this.window.webContents.send('menu-event', { - name: e - }) - } - sendURLAction(e) { - this.show(), this.window.webContents.send('url-action', { - action: e - }) - } - sendLaunchTimingStats(e) { - this.window.webContents.send('launch-timing-stats', { - stats: e - }) - } - sendAppMenu() { - const e = r.Menu.getApplicationMenu(); - if (e) { - const n = s.menuFromElectronMenu(e); - this.window.webContents.send('app-menu', { - menu: n - }) - } - } - sendCertificateError(e, n, t) { - this.window.webContents.send('certificate-error', { - certificate: e, - error: n, - url: t - }) - } - showCertificateTrustDialog(e, n) { - const t = r.dialog; - t.showCertificateTrustDialog(this.window, { - certificate: e, - message: n - }, () => {}) - } - sendException(e) { - const n = { - stack: e.stack, - message: e.message, - name: e.name - }; - this.window.webContents.send('main-process-exception', n) - } - get loadTime() { - return this._loadTime - } - get rendererReadyTime() { - return this._rendererReadyTime - } - destroy() { - this.window.destroy() - } - } - n.AppWindow = p -}, function (e) { - e.exports = require('module') -}, function (e, n, t) { - function r(e, n, t, r, o) { - this.children = [], this.sourceContents = {}, this.line = null == e ? null : e, this.column = null == n ? null : n, this.source = null == t ? null : t, this.name = null == o ? null : o, this[s] = !0, null != r && this.add(r) - } - var o = t(32).SourceMapGenerator, - a = t(11), - i = /(\r?\n)/, - s = '$$$isSourceNode$$$'; - r.fromStringWithSourceMap = function (e, n, t) { - function o(e, n) { - if (null === e || void 0 === e.source) s.add(n); - else { - var o = t ? a.join(t, e.source) : e.source; - s.add(new r(e.originalLine, e.originalColumn, o, n, e.name)) - } - } - var s = new r, - d = e.split(i), - l = 0, - c = function () { - function e() { - return l < d.length ? d[l++] : void 0 - } - var n = e(), - t = e() || ''; - return n + t - }, - p = 1, - u = 0, - m = null; - return n.eachMapping(function (e) { - if (null !== m) - if (p < e.generatedLine) o(m, c()), p++, u = 0; - else { - var n = d[l], - t = n.substr(0, e.generatedColumn - u); - return d[l] = n.substr(e.generatedColumn - u), u = e.generatedColumn, o(m, t), void(m = e) - } for (; p < e.generatedLine;) s.add(c()), p++; - if (u < e.generatedColumn) { - var n = d[l]; - s.add(n.substr(0, e.generatedColumn)), d[l] = n.substr(e.generatedColumn), u = e.generatedColumn - } - m = e - }, this), l < d.length && (m && o(m, c()), s.add(d.splice(l).join(''))), n.sources.forEach(function (e) { - var r = n.sourceContentFor(e); - null != r && (null != t && (e = a.join(t, e)), s.setSourceContent(e, r)) - }), s - }, r.prototype.add = function (e) { - if (Array.isArray(e)) e.forEach(function (e) { - this.add(e) - }, this); - else if (e[s] || 'string' == typeof e) e && this.children.push(e); - else throw new TypeError('Expected a SourceNode, string, or an array of SourceNodes and strings. Got ' + e); - return this - }, r.prototype.prepend = function (e) { - if (Array.isArray(e)) - for (var n = e.length - 1; 0 <= n; n--) this.prepend(e[n]); - else if (e[s] || 'string' == typeof e) this.children.unshift(e); - else throw new TypeError('Expected a SourceNode, string, or an array of SourceNodes and strings. Got ' + e); - return this - }, r.prototype.walk = function (e) { - for (var n = 0, t = this.children.length, r; n < t; n++) r = this.children[n], r[s] ? r.walk(e) : '' !== r && e(r, { - source: this.source, - line: this.line, - column: this.column, - name: this.name - }) - }, r.prototype.join = function (e) { - var n = this.children.length, - t, r; - if (0 < n) { - for (t = [], r = 0; r < n - 1; r++) t.push(this.children[r]), t.push(e); - t.push(this.children[r]), this.children = t - } - return this - }, r.prototype.replaceRight = function (e, n) { - var t = this.children[this.children.length - 1]; - return t[s] ? t.replaceRight(e, n) : 'string' == typeof t ? this.children[this.children.length - 1] = t.replace(e, n) : this.children.push(''.replace(e, n)), this - }, r.prototype.setSourceContent = function (e, n) { - this.sourceContents[a.toSetString(e)] = n - }, r.prototype.walkSourceContents = function (e) { - for (var n = 0, t = this.children.length; n < t; n++) this.children[n][s] && this.children[n].walkSourceContents(e); - for (var r = Object.keys(this.sourceContents), n = 0, t = r.length; n < t; n++) e(a.fromSetString(r[n]), this.sourceContents[r[n]]) - }, r.prototype.toString = function () { - var e = ''; - return this.walk(function (n) { - e += n - }), e - }, r.prototype.toStringWithSourceMap = function (e) { - var n = { - code: '', - line: 1, - column: 0 - }, - t = new o(e), - r = !1, - i = null, - a = null, - s = null, - d = null; - return this.walk(function (e, o) { - n.code += e, null !== o.source && null !== o.line && null !== o.column ? ((i !== o.source || a !== o.line || s !== o.column || d !== o.name) && t.addMapping({ - source: o.source, - original: { - line: o.line, - column: o.column - }, - generated: { - line: n.line, - column: n.column - }, - name: o.name - }), i = o.source, a = o.line, s = o.column, d = o.name, r = !0) : r && (t.addMapping({ - generated: { - line: n.line, - column: n.column - } - }), i = null, r = !1); - for (var l = 0, c = e.length; l < c; l++) e.charCodeAt(l) === 10 ? (n.line++, n.column = 0, l + 1 === c ? (i = null, r = !1) : r && t.addMapping({ - source: o.source, - original: { - line: o.line, - column: o.column + function S(e, t) { + return t ? E(t, e) : e + } + global.log = { + error(e, t) { + l("error", "[main] " + S(e, t)) }, - generated: { - line: n.line, - column: n.column + warn(e, t) { + l("warn", "[main] " + S(e, t)) }, - name: o.name - })) : n.column++ - }), this.walkSourceContents(function (e, n) { - t.setSourceContent(e, n) - }), { - code: n.code, - map: t - } - }, n.SourceNode = r -}, function (e, n) { - function t(e, n, t) { - var r = e[n]; - e[n] = e[t], e[t] = r - } - - function o(e, n) { - return Math.round(e + Math.random() * (n - e)) - } - - function a(e, n, s, d) { - if (s < d) { - var r = o(s, d), - l = s - 1; - t(e, r, d); - for (var i = e[d], c = s; c < d; c++) 0 >= n(e[c], i) && (l += 1, t(e, l, c)); - t(e, l + 1, c); - var p = l + 1; - a(e, n, s, p - 1), a(e, n, p + 1, d) - } - } - n.quickSort = function (e, n) { - a(e, n, 0, e.length - 1) - } -}, function (e, n) { - function t(e, r, o, i, a, s) { - var d = Math.floor((r - e) / 2) + e, - l = a(o, i[d], !0); - return 0 === l ? d : 0 < l ? 1 < r - d ? t(d, r, o, i, a, s) : s == n.LEAST_UPPER_BOUND ? r < i.length ? r : -1 : d : 1 < d - e ? t(e, d, o, i, a, s) : s == n.LEAST_UPPER_BOUND ? d : 0 > e ? -1 : e - } - n.GREATEST_LOWER_BOUND = 1, n.LEAST_UPPER_BOUND = 2, n.search = function (e, r, o, i) { - if (0 === r.length) return -1; - var a = t(-1, r.length, e, r, o, i || n.GREATEST_LOWER_BOUND); - if (0 > a) return -1; - for (; 0 <= a - 1 && !(0 !== o(r[a], r[a - 1], !0));) --a; - return a - } -}, function (e, n, t) { - function r(e) { - var n = e; - return 'string' == typeof e && (n = JSON.parse(e.replace(/^\)\]\}'/, ''))), null == n.sections ? new o(n) : new i(n) - } - - function o(e) { - var n = e; - 'string' == typeof e && (n = JSON.parse(e.replace(/^\)\]\}'/, ''))); - var t = d.getArg(n, 'version'), - r = d.getArg(n, 'sources'), - o = d.getArg(n, 'names', []), - i = d.getArg(n, 'sourceRoot', null), - a = d.getArg(n, 'sourcesContent', null), - s = d.getArg(n, 'mappings'), - c = d.getArg(n, 'file', null); - if (t != this._version) throw new Error('Unsupported version: ' + t); - r = r.map(String).map(d.normalize).map(function (e) { - return i && d.isAbsolute(i) && d.isAbsolute(e) ? d.relative(i, e) : e - }), this._names = l.fromArray(o.map(String), !0), this._sources = l.fromArray(r, !0), this.sourceRoot = i, this.sourcesContent = a, this._mappings = s, this.file = c - } - - function a() { - this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null - } - - function i(e) { - var n = e; - 'string' == typeof e && (n = JSON.parse(e.replace(/^\)\]\}'/, ''))); - var t = d.getArg(n, 'version'), - o = d.getArg(n, 'sections'); - if (t != this._version) throw new Error('Unsupported version: ' + t); - this._sources = new l, this._names = new l; - var i = { - line: -1, - column: 0 - }; - this._sections = o.map(function (e) { - if (e.url) throw new Error('Support for url field in sections not implemented.'); - var n = d.getArg(e, 'offset'), - t = d.getArg(n, 'line'), - o = d.getArg(n, 'column'); - if (t < i.line || t === i.line && o < i.column) throw new Error('Section offsets must be ordered and non-overlapping.'); - return i = n, { - generatedOffset: { - generatedLine: t + 1, - generatedColumn: o + 1 + info(e, t) { + l("info", "[main] " + S(e, t)) }, - consumer: new r(d.getArg(e, 'map')) - } - }) - } - var d = t(11), - s = t(75), - l = t(30).ArraySet, - c = t(31), - p = t(74).quickSort; - r.fromSourceMap = function (e) { - return o.fromSourceMap(e) - }, r.prototype._version = 3, r.prototype.__generatedMappings = null, Object.defineProperty(r.prototype, '_generatedMappings', { - get: function () { - return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings - } - }), r.prototype.__originalMappings = null, Object.defineProperty(r.prototype, '_originalMappings', { - get: function () { - return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings - } - }), r.prototype._charIsMappingSeparator = function (e, n) { - var t = e.charAt(n); - return ';' === t || ',' === t - }, r.prototype._parseMappings = function () { - throw new Error('Subclasses must implement _parseMappings') - }, r.GENERATED_ORDER = 1, r.ORIGINAL_ORDER = 2, r.GREATEST_LOWER_BOUND = 1, r.LEAST_UPPER_BOUND = 2, r.prototype.eachMapping = function (e, n, t) { - var o = t || r.GENERATED_ORDER, - i; - switch (o) { - case r.GENERATED_ORDER: - i = this._generatedMappings; - break; - case r.ORIGINAL_ORDER: - i = this._originalMappings; - break; - default: - throw new Error('Unknown order of iteration.'); - } - var a = this.sourceRoot; - i.map(function (e) { - var n = null === e.source ? null : this._sources.at(e.source); - return null != n && null != a && (n = d.join(a, n)), { - source: n, - generatedLine: e.generatedLine, - generatedColumn: e.generatedColumn, - originalLine: e.originalLine, - originalColumn: e.originalColumn, - name: null === e.name ? null : this._names.at(e.name) - } - }, this).forEach(e, n || null) - }, r.prototype.allGeneratedPositionsFor = function (e) { - var n = d.getArg(e, 'line'), - t = { - source: d.getArg(e, 'source'), - originalLine: n, - originalColumn: d.getArg(e, 'column', 0) - }; - if (null != this.sourceRoot && (t.source = d.relative(this.sourceRoot, t.source)), !this._sources.has(t.source)) return []; - t.source = this._sources.indexOf(t.source); - var r = [], - o = this._findMapping(t, this._originalMappings, 'originalLine', 'originalColumn', d.compareByOriginalPositions, s.LEAST_UPPER_BOUND); - if (0 <= o) { - var i = this._originalMappings[o]; - if (void 0 === e.column) - for (var a = i.originalLine; i && i.originalLine === a;) r.push({ - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - }), i = this._originalMappings[++o]; - else - for (var l = i.originalColumn; i && i.originalLine === n && i.originalColumn == l;) r.push({ - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - }), i = this._originalMappings[++o] - } - return r - }, n.SourceMapConsumer = r, o.prototype = Object.create(r.prototype), o.prototype.consumer = r, o.fromSourceMap = function (e) { - var n = Object.create(o.prototype), - t = n._names = l.fromArray(e._names.toArray(), !0), - r = n._sources = l.fromArray(e._sources.toArray(), !0); - n.sourceRoot = e._sourceRoot, n.sourcesContent = e._generateSourcesContent(n._sources.toArray(), n.sourceRoot), n.file = e._file; - for (var s = e._mappings.toArray().slice(), c = n.__generatedMappings = [], u = n.__originalMappings = [], m = 0, i = s.length; m < i; m++) { - var g = s[m], - f = new a; - f.generatedLine = g.generatedLine, f.generatedColumn = g.generatedColumn, g.source && (f.source = r.indexOf(g.source), f.originalLine = g.originalLine, f.originalColumn = g.originalColumn, g.name && (f.name = t.indexOf(g.name)), u.push(f)), c.push(f) - } - return p(n.__originalMappings, d.compareByOriginalPositions), n - }, o.prototype._version = 3, Object.defineProperty(o.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (e) { - return null == this.sourceRoot ? e : d.join(this.sourceRoot, e) - }, this) - } - }), o.prototype._parseMappings = function (e) { - for (var n = 1, t = 0, r = 0, o = 0, i = 0, s = 0, l = e.length, u = 0, m = {}, g = {}, f = [], h = [], y, _, b, S, w; u < l;) - if (';' === e.charAt(u)) n++, u++, t = 0; - else if (',' === e.charAt(u)) u++; - else { - for (y = new a, y.generatedLine = n, S = u; S < l && !this._charIsMappingSeparator(e, S); S++); - if (_ = e.slice(u, S), b = m[_], b) u += _.length; - else { - for (b = []; u < S;) c.decode(e, u, g), w = g.value, u = g.rest, b.push(w); - if (2 === b.length) throw new Error('Found a source, but no line and column'); - if (3 === b.length) throw new Error('Found a source and line, but no column'); - m[_] = b - } - y.generatedColumn = t + b[0], t = y.generatedColumn, 1 < b.length && (y.source = i + b[1], i += b[1], y.originalLine = r + b[2], r = y.originalLine, y.originalLine += 1, y.originalColumn = o + b[3], o = y.originalColumn, 4 < b.length && (y.name = s + b[4], s += b[4])), h.push(y), 'number' == typeof y.originalLine && f.push(y) - } - p(h, d.compareByGeneratedPositionsDeflated), this.__generatedMappings = h, p(f, d.compareByOriginalPositions), this.__originalMappings = f - }, o.prototype._findMapping = function (e, n, t, r, o, i) { - if (0 >= e[t]) throw new TypeError('Line must be greater than or equal to 1, got ' + e[t]); - if (0 > e[r]) throw new TypeError('Column must be greater than or equal to 0, got ' + e[r]); - return s.search(e, n, o, i) - }, o.prototype.computeColumnSpans = function () { - for (var e = 0, n; e < this._generatedMappings.length; ++e) { - if (n = this._generatedMappings[e], e + 1 < this._generatedMappings.length) { - var t = this._generatedMappings[e + 1]; - if (n.generatedLine === t.generatedLine) { - n.lastGeneratedColumn = t.generatedColumn - 1; - continue - } - } - n.lastGeneratedColumn = Infinity - } - }, o.prototype.originalPositionFor = function (e) { - var n = { - generatedLine: d.getArg(e, 'line'), - generatedColumn: d.getArg(e, 'column') - }, - t = this._findMapping(n, this._generatedMappings, 'generatedLine', 'generatedColumn', d.compareByGeneratedPositionsDeflated, d.getArg(e, 'bias', r.GREATEST_LOWER_BOUND)); - if (0 <= t) { - var o = this._generatedMappings[t]; - if (o.generatedLine === n.generatedLine) { - var i = d.getArg(o, 'source', null); - null !== i && (i = this._sources.at(i), null != this.sourceRoot && (i = d.join(this.sourceRoot, i))); - var a = d.getArg(o, 'name', null); - return null !== a && (a = this._names.at(a)), { - source: i, - line: d.getArg(o, 'originalLine', null), - column: d.getArg(o, 'originalColumn', null), - name: a - } - } - } - return { - source: null, - line: null, - column: null, - name: null - } - }, o.prototype.hasContentsOfAllSources = function () { - return !!this.sourcesContent && this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (e) { - return null == e - }) - }, o.prototype.sourceContentFor = function (e, n) { - if (!this.sourcesContent) return null; - if (null != this.sourceRoot && (e = d.relative(this.sourceRoot, e)), this._sources.has(e)) return this.sourcesContent[this._sources.indexOf(e)]; - var t; - if (null != this.sourceRoot && (t = d.urlParse(this.sourceRoot))) { - var r = e.replace(/^file:\/\//, ''); - if ('file' == t.scheme && this._sources.has(r)) return this.sourcesContent[this._sources.indexOf(r)]; - if ((!t.path || '/' == t.path) && this._sources.has('/' + e)) return this.sourcesContent[this._sources.indexOf('/' + e)] - } - if (n) return null; - throw new Error('"' + e + '" is not in the SourceMap.') - }, o.prototype.generatedPositionFor = function (e) { - var n = d.getArg(e, 'source'); - if (null != this.sourceRoot && (n = d.relative(this.sourceRoot, n)), !this._sources.has(n)) return { - line: null, - column: null, - lastColumn: null - }; - n = this._sources.indexOf(n); - var t = { - source: n, - originalLine: d.getArg(e, 'line'), - originalColumn: d.getArg(e, 'column') - }, - o = this._findMapping(t, this._originalMappings, 'originalLine', 'originalColumn', d.compareByOriginalPositions, d.getArg(e, 'bias', r.GREATEST_LOWER_BOUND)); - if (0 <= o) { - var i = this._originalMappings[o]; - if (i.source === t.source) return { - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - } - } - return { - line: null, - column: null, - lastColumn: null - } - }, n.BasicSourceMapConsumer = o, i.prototype = Object.create(r.prototype), i.prototype.constructor = r, i.prototype._version = 3, Object.defineProperty(i.prototype, 'sources', { - get: function () { - for (var e = [], n = 0; n < this._sections.length; n++) - for (var t = 0; t < this._sections[n].consumer.sources.length; t++) e.push(this._sections[n].consumer.sources[t]); - return e - } - }), i.prototype.originalPositionFor = function (e) { - var n = { - generatedLine: d.getArg(e, 'line'), - generatedColumn: d.getArg(e, 'column') - }, - t = s.search(n, this._sections, function (e, n) { - var t = e.generatedLine - n.generatedOffset.generatedLine; - return t ? t : e.generatedColumn - n.generatedOffset.generatedColumn - }), - r = this._sections[t]; - return r ? r.consumer.originalPositionFor({ - line: n.generatedLine - (r.generatedOffset.generatedLine - 1), - column: n.generatedColumn - (r.generatedOffset.generatedLine === n.generatedLine ? r.generatedOffset.generatedColumn - 1 : 0), - bias: e.bias - }) : { - source: null, - line: null, - column: null, - name: null - } - }, i.prototype.hasContentsOfAllSources = function () { - return this._sections.every(function (e) { - return e.consumer.hasContentsOfAllSources() - }) - }, i.prototype.sourceContentFor = function (e, n) { - for (var t = 0; t < this._sections.length; t++) { - var r = this._sections[t], - o = r.consumer.sourceContentFor(e, !0); - if (o) return o - } - if (n) return null; - throw new Error('"' + e + '" is not in the SourceMap.') - }, i.prototype.generatedPositionFor = function (e) { - for (var n = 0, t; n < this._sections.length; n++) - if (t = this._sections[n], -1 !== t.consumer.sources.indexOf(d.getArg(e, 'source'))) { - var r = t.consumer.generatedPositionFor(e); - if (r) { - var o = { - line: r.line + (t.generatedOffset.generatedLine - 1), - column: r.column + (t.generatedOffset.generatedLine === r.line ? t.generatedOffset.generatedColumn - 1 : 0) - }; - return o - } - } return { - line: null, - column: null - } - }, i.prototype._parseMappings = function () { - this.__generatedMappings = [], this.__originalMappings = []; - for (var e = 0; e < this._sections.length; e++) - for (var n = this._sections[e], t = n.consumer._generatedMappings, r = 0; r < t.length; r++) { - var o = t[r], - i = n.consumer._sources.at(o.source); - null !== n.consumer.sourceRoot && (i = d.join(n.consumer.sourceRoot, i)), this._sources.add(i), i = this._sources.indexOf(i); - var a = n.consumer._names.at(o.name); - this._names.add(a), a = this._names.indexOf(a); - var s = { - source: i, - generatedLine: o.generatedLine + (n.generatedOffset.generatedLine - 1), - generatedColumn: o.generatedColumn + (n.generatedOffset.generatedLine === o.generatedLine ? n.generatedOffset.generatedColumn - 1 : 0), - originalLine: o.originalLine, - originalColumn: o.originalColumn, - name: a - }; - this.__generatedMappings.push(s), 'number' == typeof s.originalLine && this.__originalMappings.push(s) - } - p(this.__generatedMappings, d.compareByGeneratedPositionsDeflated), p(this.__originalMappings, d.compareByOriginalPositions) - }, n.IndexedSourceMapConsumer = i -}, function (e, n, t) { - function r(e, n) { - var t = e.generatedLine, - r = n.generatedLine, - o = e.generatedColumn, - a = n.generatedColumn; - return r > t || r == t && a >= o || 0 >= i.compareByGeneratedPositionsInflated(e, n) - } - - function o() { - this._array = [], this._sorted = !0, this._last = { - generatedLine: -1, - generatedColumn: 0 - } - } - var i = t(11); - o.prototype.unsortedForEach = function (e, n) { - this._array.forEach(e, n) - }, o.prototype.add = function (e) { - r(this._last, e) ? (this._last = e, this._array.push(e)) : (this._sorted = !1, this._array.push(e)) - }, o.prototype.toArray = function () { - return this._sorted || (this._array.sort(i.compareByGeneratedPositionsInflated), this._sorted = !0), this._array - }, n.MappingList = o -}, function (e, n) { - var t = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/']; - n.encode = function (e) { - if (0 <= e && e < t.length) return t[e]; - throw new TypeError('Must be between 0 and 63: ' + e) - }, n.decode = function (e) { - var n = 65, - t = 97, - r = 48; - return n <= e && e <= 90 ? e - n : t <= e && e <= 122 ? e - t + 26 : r <= e && e <= 57 ? e - r + 52 : e == 43 ? 62 : e == 47 ? 63 : -1 - } -}, function (e, n, t) { - n.SourceMapGenerator = t(32).SourceMapGenerator, n.SourceMapConsumer = t(76).SourceMapConsumer, n.SourceNode = t(73).SourceNode -}, function (e, n, t) { - function r() { - return !('browser' !== x) || 'node' !== x && 'undefined' != typeof window && 'function' == typeof XMLHttpRequest && !(window.require && window.module && window.process && 'renderer' === window.process.type) - } - - function o() { - return 'object' == typeof process && null !== process && 'function' == typeof process.on - } - - function i(e) { - return function (n) { - for (var t = 0, r; t < e.length; t++) - if (r = e[t](n), r) return r; - return null - } - } - - function a(e, n) { - if (!e) return n; - var t = _.dirname(e), - r = /^\w+:\/\/[^\/]*/.exec(t), - o = r ? r[0] : ''; - return o + _.resolve(t.slice(o.length), n) - } - - function s(e) { - var n; - if (r()) try { - var t = new XMLHttpRequest; - t.open('GET', e, !1), t.send(null), n = 4 === t.readyState ? t.responseText : null; - var o = t.getResponseHeader('SourceMap') || t.getResponseHeader('X-SourceMap'); - if (o) return o - } catch (n) {} - n = O(e); - for (var i = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg, a, s; s = i.exec(n);) a = s; - return a ? a[1] : null - } - - function d(e) { - var n = C[e.source]; - if (!n) { - var t = P(e.source); - t ? (n = C[e.source] = { - url: t.url, - map: new y(t.map) - }, n.map.sourcesContent && n.map.sources.forEach(function (e, t) { - var r = n.map.sourcesContent[t]; - if (r) { - var o = a(n.url, e); - E[o] = r - } - })) : n = C[e.source] = { - url: null, - map: null - } - } - if (n && n.map) { - var r = n.map.originalPositionFor(e); - if (null !== r.source) return r.source = a(n.url, r.source), r - } - return e - } - - function l(e) { - var n = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e); - if (n) { - var t = d({ - source: n[2], - line: +n[3], - column: n[4] - 1 - }); - return 'eval at ' + n[1] + ' (' + t.source + ':' + t.line + ':' + (t.column + 1) + ')' - } - return n = /^eval at ([^(]+) \((.+)\)$/.exec(e), n ? 'eval at ' + n[1] + ' (' + l(n[2]) + ')' : e - } - - function c() { - var e = '', - n; - if (this.isNative()) e = 'native'; - else { - n = this.getScriptNameOrSourceURL(), !n && this.isEval() && (e = this.getEvalOrigin(), e += ', '), e += n ? n : ''; - var t = this.getLineNumber(); - if (null != t) { - e += ':' + t; - var r = this.getColumnNumber(); - r && (e += ':' + r) - } - } - var o = '', - i = this.getFunctionName(), - a = !0, - s = this.isConstructor(), - d = !(this.isToplevel() || s); - if (d) { - var l = this.getTypeName(); - '[object Object]' === l && (l = 'null'); - var c = this.getMethodName(); - i ? (l && 0 != i.indexOf(l) && (o += l + '.'), o += i, c && i.indexOf('.' + c) != i.length - c.length - 1 && (o += ' [as ' + c + ']')) : o += l + '.' + (c || '') - } else s ? o += 'new ' + (i || '') : i ? o += i : (o += e, a = !1); - return a && (o += ' (' + e + ')'), o - } - - function p(e) { - var n = {}; - return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(function (t) { - n[t] = /^(?:is|get)/.test(t) ? function () { - return e[t].call(e) - } : e[t] - }), n.toString = c, n - } - - function u(e) { - if (e.isNative()) return e; - var n = e.getFileName() || e.getScriptNameOrSourceURL(); - if (n) { - var t = e.getLineNumber(), - o = e.getColumnNumber() - 1, - i = 62; - 1 !== t || !(o > i) || r() || e.isEval() || (o -= i); - var a = d({ - source: n, - line: t, - column: o - }); - return e = p(e), e.getFileName = function () { - return a.source - }, e.getLineNumber = function () { - return a.line - }, e.getColumnNumber = function () { - return a.column + 1 - }, e.getScriptNameOrSourceURL = function () { - return a.source - }, e - } - var s = e.isEval() && e.getEvalOrigin(); - return s ? (s = l(s), e = p(e), e.getEvalOrigin = function () { - return s - }, e) : e - } - - function m(e, n) { - return v && (E = {}, C = {}), e + n.map(function (e) { - return '\n at ' + u(e) - }).join('') - } - - function g(e) { - var n = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack); - if (n) { - var t = n[1], - r = +n[2], - o = +n[3], - i = E[t]; - if (!i && b && b.existsSync(t)) try { - i = b.readFileSync(t, 'utf8') - } catch (e) { - i = '' - } - if (i) { - var a = i.split(/(?:\r\n|\r|\n)/)[r - 1]; - if (a) return t + ':' + r + '\n' + a + '\n' + Array(o).join(' ') + '^' - } - } - return null - } - - function f(e) { - var n = g(e); - n && (console.error(), console.error(n)), console.error(e.stack), process.exit(1) - } - - function h() { - var e = process.emit; - process.emit = function (n) { - if ('uncaughtException' === n) { - var t = arguments[1] && arguments[1].stack, - r = 0 < this.listeners(n).length; - if (t && !r) return f(arguments[1]) - } - return e.apply(this, arguments) - } - } - var y = t(79).SourceMapConsumer, - _ = t(0), - b; - try { - b = t(5), b.existsSync && b.readFileSync || (b = null) - } catch (e) {} - var S = !1, - w = !1, - v = !1, - x = 'auto', - E = {}, - C = {}, - k = /^data:application\/json[^,]+base64,/, - M = [], - L = [], - O = i(M); - M.push(function (e) { - if (e = e.trim(), e in E) return E[e]; - var n = null; - if (!b) { - var t = new XMLHttpRequest; - t.open('GET', e, !1), t.send(null); - var n = null; - 4 === t.readyState && 200 === t.status && (n = t.responseText) - } else if (b.existsSync(e)) try { - n = b.readFileSync(e, 'utf8') - } catch (e) { - n = '' - } - return E[e] = n - }); - var P = i(L); - L.push(function (e) { - var n = s(e); - if (!n) return null; - var t; - if (k.test(n)) { - var r = n.slice(n.indexOf(',') + 1); - t = new Buffer(r, 'base64').toString(), n = e - } else n = a(e, n), t = O(n); - return t ? { - url: n, - map: t - } : null - }), n.wrapCallSite = u, n.getErrorSource = g, n.mapSourcePosition = d, n.retrieveSourceMap = P, n.install = function (e) { - if (e = e || {}, e.environment && (x = e.environment, -1 === ['node', 'browser', 'auto'].indexOf(x))) throw new Error('environment ' + x + ' was unknown. Available options are {auto, browser, node}'); - if (e.retrieveFile && (e.overrideRetrieveFile && (M.length = 0), M.unshift(e.retrieveFile)), e.retrieveSourceMap && (e.overrideRetrieveSourceMap && (L.length = 0), L.unshift(e.retrieveSourceMap)), e.hookRequire && !r()) { - var n; - try { - n = t(72) - } catch (e) {} - var i = n.prototype._compile; - i.__sourceMapSupport || (n.prototype._compile = function (e, n) { - return E[n] = e, C[n] = void 0, i.call(this, e, n) - }, n.prototype._compile.__sourceMapSupport = !0) - } - if (v || (v = !!('emptyCacheBetweenOperations' in e) && e.emptyCacheBetweenOperations), S || (S = !0, Error.prepareStackTrace = m), !w) { - var a = !('handleUncaughtExceptions' in e) || e.handleUncaughtExceptions; - a && o() && (w = !0, h()) - } - } -}, function (e, n, t) { - var r = t(0).sep || '/'; - e.exports = function (e) { - if ('string' != typeof e || 7 >= e.length || 'file://' != e.substring(0, 7)) throw new TypeError('must pass in a file:// URI to convert to a file path'); - var n = unescape(e.substring(7)), - t = n.indexOf('/'), - o = n.substring(0, t), - i = n.substring(t + 1); - return 'localhost' == o && (o = ''), o && (o = r + r + o), i = i.replace(/^(.+)\|/, '$1:'), '\\' == r && (i = i.replace(/\//g, '\\')), /^.+\:/.test(i) || (i = r + i), o + i - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(34); - n.formatLogMessage = function (e, n) { - return n ? r.formatError(n, e) : e - } -}, function (e, n, t) { - 'use strict'; - var r = t(5), - o = t(0), - i = t(6), - a = t(9), - s = t(15).Transport, - d = t(8).Stream, - l = t(10), - c = t(15), - p = t(35), - u = t(46), - m = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - g = e.exports = function (e) { - function n(n) { - Array.prototype.slice.call(arguments, 1).forEach(function (t) { - if (e[t]) throw new Error('Cannot set ' + t + ' and ' + n + 'together') - }) - } - if (s.call(this, e), e.filename || e.dirname) n('filename or dirname', 'stream'), this._basename = this.filename = e.filename ? o.basename(e.filename) : 'winston.log', this.dirname = e.dirname || o.dirname(e.filename), this.options = e.options || { - flags: 'a' - }, this.options.highWaterMark = this.options.highWaterMark || 24; - else if (e.stream) { - n('stream', 'filename', 'maxsize'), this._stream = e.stream; - var t = this; - this._stream.on('error', function (e) { - t.emit('error', e) - }), this._stream.setMaxListeners(Infinity) - } else throw new Error('Cannot log to file without filename or stream.'); - this.json = !1 !== e.json, this.colorize = e.colorize || !1, this.maxsize = e.maxsize || null, this.logstash = e.logstash || null, this.maxFiles = e.maxFiles || null, this.label = e.label || null, this.prettyPrint = e.prettyPrint || !1, this.showLevel = void 0 === e.showLevel || e.showLevel, this.timestamp = void 0 === e.timestamp || e.timestamp, this.datePattern = e.datePattern ? e.datePattern : '.yyyy-MM-dd', this.depth = e.depth || null, this.eol = e.eol || l.EOL, this.maxRetries = e.maxRetries || 2, this.prepend = e.prepend || !1, this.createTree = e.createTree || !1, this.localTime = e.localTime || !1, this.zippedArchive = e.zippedArchive || !1, this.maxDays = e.maxDays || 0, this.json && (this.stringify = e.stringify), this._size = 0, this._created = 0, this._buffer = [], this._draining = !1, this._failures = 0, this._archive = !1, this._currentFiles = function () { - if (!this.maxsize) try { - return r.readdirSync(this.dirname).filter(function (e) { - return e.includes(this._basename) - }.bind(this)).map(function (e) { - return { - name: e, - time: r.statSync(o.join(this.dirname, e)).mtime.getTime() - } - }.bind(this)).sort(function (e, n) { - return e.time - n.time - }).map(function (e) { - return e.name - }) - } catch (n) {} - return [] - }.bind(this)(), this._year = this._getTime('year'), this._month = this._getTime('month'), this._date = this._getTime('date'), this._hour = this._getTime('hour'), this._minute = this._getTime('minute'), this._weekday = m[this._getTime('day')]; - var i = /d{1,4}|m{1,4}|yy(?:yy)?|([HhM])\1?/g, - a = function (e, n) { - for (e += '', n = n || 2; e.length < n;) e = '0' + e; - return e - }; - this.getFormattedDate = function () { - this._year = this._getTime('year'), this._month = this._getTime('month'), this._date = this._getTime('date'), this._hour = this._getTime('hour'), this._minute = this._getTime('minute'), this._weekday = m[this._getTime('day')]; - var e = { - yy: (this._year + '').slice(2), - yyyy: this._year, - M: this._month + 1, - MM: a(this._month + 1), - d: this._date, - dd: a(this._date), - H: this._hour, - HH: a(this._hour), - m: this._minute, - mm: a(this._minute), - ddd: this._weekday - }; - return this.datePattern.replace(i, function (n) { - return n in e ? e[n] : n.slice(1, n.length - 1) - }) - } - }; - i.inherits(g, s), c.transports.DailyRotateFile = g, g.prototype.name = 'dailyRotateFile', g.prototype.log = function (e, n, t, r) { - if (this.silent) return r(null, !0); - if (this._failures >= this.maxRetries) return r(new Error('Transport is in a failed state.')); - var o = this, - i = a.log({ - level: e, - message: n, - meta: t, - json: this.json, - colorize: this.colorize, - logstash: this.logstash, - prettyPrint: this.prettyPrint, - timestamp: this.timestamp, - label: this.label, - stringify: this.stringify, - showLevel: this.showLevel, - depth: this.depth, - formatter: this.formatter, - humanReadableUnhandledException: this.humanReadableUnhandledException - }) + this.eol; - this._size += i.length, this.filename ? this.open(function (e) { - return e ? o._buffer.push([i, r]) : void(o._write(i, r), o._lazyDrain()) - }) : (this._write(i, r), this._lazyDrain()) - }, g.prototype._write = function (e, n) { - var t = this._stream.write(e); - return n ? !1 === t ? this._stream.once('drain', function () { - n(null, !0) - }) : void n(null, !0) : void 0 - }, g.prototype.query = function (e, n) { - 'function' == typeof e && (n = e, e = {}); - var t = this, - i = t._currentFiles.slice(0), - a = [], - s = 0; - e = t.normalizeQuery(e), 0 === i.length && n && n(null, a), - function d(l) { - function c(e, n) { - try { - var t = JSON.parse(e); - u(t) && p(t) - } catch (t) { - n || f.emit('error', t) - } - } - - function p(n) { - if (e.rows && a.length >= e.rows && 'desc' !== e.order) return void(f.readable && f.destroy()); - if (e.fields) { - var t = {}; - e.fields.forEach(function (e) { - t[e] = n[e] - }), n = t - } - 'desc' === e.order && a.length >= e.rows && a.shift(), a.push(n) - } - - function u(n) { - if (n && 'object' == typeof n) { - var t = new Date(n.timestamp); - return !(e.from && t < e.from || e.until && t > e.until) || void 0 - } - } - if (l) { - var m = o.join(t.dirname, l), - g = '', - f = r.createReadStream(m, { - encoding: 'utf8' - }); - f.on('error', function (e) { - return f.readable && f.destroy(), n ? 'ENOENT' === e.code ? n(null, a) : n(e) : void 0 - }), f.on('data', function (n) { - n = (g + n).split(/\n+/); - for (var t = n.length - 1, r = 0; r < t; r++)(!e.start || s >= e.start) && c(n[r]), s++; - g = n[t] - }), f.on('close', function () { - g && c(g, !0), 'desc' === e.order && (a = a.reverse()), i.length ? d(i.shift()) : n && n(null, a) - }) - } - }(i.shift()) - }, g.prototype.stream = function (e) { - var n = o.join(this.dirname, this._getFilename()); - e = e || {}; - var t = new d, - r = { - file: n, - start: e.start - }; - return t.destroy = a.tailFile(r, function (e, n) { - if (e) return t.emit('error', e); - try { - t.emit('data', n), n = JSON.parse(n), t.emit('log', n) - } catch (n) { - t.emit('error', n) - } - }), t.resume && t.resume(), t - }, g.prototype.open = function (e) { - if (this.opening) return e(!0); - return !this._stream || this.maxsize && this._size >= this.maxsize || this._filenameHasExpired() ? (this._cleanOldFiles(), e(!0), this._createStream()) : void e() - }, g.prototype.close = function () { - var e = this; - this._stream && (this._stream.end(), this._stream.destroySoon(), this._stream.once('drain', function () { - e.emit('flush'), e.emit('closed') - })) - }, g.prototype.flush = function () { - var e = this; - this._buffer.forEach(function (n) { - var t = n[0], - r = n[1]; - process.nextTick(function () { - e._write(t, r), e._size += t.length - }) - }), e._buffer.length = 0, e._stream.once('drain', function () { - e.emit('flush'), e.emit('logged') - }) - }, g.prototype._createStream = function () { - var e = this; - this.opening = !0, - function n(t) { - function i(n) { - e._stream && (e._archive = !!e.zippedArchive && e._stream.path, e._stream.end(), e._stream.destroySoon()), e.createTree && p.sync(o.dirname(s)), e._size = n, e.filename = t, e._stream = r.createWriteStream(s, e.options), e._stream.on('error', function (n) { - e._failures < e.maxRetries ? (e._createStream(), e._failures++) : e.emit('error', n) - }), e._stream.setMaxListeners(Infinity), e.once('flush', function () { - e.flush(), e.opening = !1, e.emit('open', s) - }), e.flush(), a() + debug(e, t) { + l("debug", "[main] " + S(e, t)) } - - function a() { - var n = e._archive; - if (e._archive = !1, n && r.existsSync(n + '')) { - var t = u.createGzip(), - o = r.createReadStream(n + ''), - i = r.createWriteStream(n + '.gz'); - o.pipe(t).pipe(i), r.unlinkSync(n + '') - } - } - var s = o.join(e.dirname, t); - r.stat(s, function (t, r) { - return t ? 'ENOENT' === t.code ? i(0) : e.emit('error', t) : !r || e.maxsize && r.size >= e.maxsize ? n(e._getFile(!0)) : e._filenameHasExpired() ? (e._year = e._getTime('year'), e._month = e._getTime('month'), e._date = e._getTime('date'), e._hour = e._getTime('hour'), e._minute = e._getTime('minute'), e._weekday = m[e._getTime('day')], e._created = 0, n(e._getFile())) : void i(r.size) + }; + var x = n(0), + C = n(18), + O = n(24), + k = n(52), + L = n.n(k); + + function T(e) { + e.on("enter-full-screen", () => R(e, "full-screen")), e.on("leave-full-screen", () => R(e, "normal")), e.on("maximize", () => R(e, "maximized")), e.on("minimize", () => R(e, "minimized")), e.on("unmaximize", () => R(e, "normal")), e.on("restore", () => R(e, "normal")), e.on("hide", () => R(e, "hidden")), e.on("show", () => { + R(e, function (e) { + return e.isFullScreen() ? "full-screen" : e.isMaximized() ? "maximized" : e.isMinimized() ? "minimized" : e.isVisible() ? "normal" : "hidden" + }(e)) }) - }(this._getFile()) - }, g.prototype._getFile = function (e) { - var n = this._getFilename(), - t; - if (e) { - if (this.maxFiles && this._created >= this.maxFiles - 1) - if (t = this._created - (this.maxFiles - 1), 0 === t) try { - r.unlinkSync(o.join(this.dirname, n)) - } catch (n) {} else try { - r.unlinkSync(o.join(this.dirname, n + '.' + t)) - } catch (n) {} - this._created += 1 - } else if (!this.maxsize) - for (-1 === this._currentFiles.indexOf(n) && this._currentFiles.push(n); this.maxFiles && this._currentFiles.length > this.maxFiles;) { - try { - r.unlinkSync(o.join(this.dirname, this._currentFiles[0])) - } catch (n) {} - this._currentFiles = this._currentFiles.slice(1) - } - return this._created ? n + '.' + this._created : n - }, g.prototype._getFilename = function () { - var e = this.getFormattedDate(); - return this.prepend ? ('.yyyy-MM-dd' === this.datePattern && (this.datePattern = 'yyyy-MM-dd.', e = this.getFormattedDate()), e + this._basename) : this._basename + e - }, g.prototype._lazyDrain = function () { - var e = this; - !this._draining && this._stream && (this._draining = !0, this._stream.once('drain', function () { - this._draining = !1, e.emit('logged') - })) - }, g.prototype._filenameHasExpired = function () { - if (this.datePattern.match(/m/)) return this._year < this._getTime('year') || this._month < this._getTime('month') || this._date < this._getTime('date') || this._hour < this._getTime('hour') || this._minute < this._getTime('minute'); - return this.datePattern.match(/H/) ? this._year < this._getTime('year') || this._month < this._getTime('month') || this._date < this._getTime('date') || this._hour < this._getTime('hour') : this.datePattern.match(/d/) ? this._year < this._getTime('year') || this._month < this._getTime('month') || this._date < this._getTime('date') : this.datePattern.match(/M/) ? this._year < this._getTime('year') || this._month < this._getTime('month') : !!this.datePattern.match(/yy/) && this._year < this._getTime('year') - }, g.prototype._getTime = function (e) { - var n = new Date; - if (this.localTime) { - if ('year' === e) return n.getFullYear(); - if ('month' === e) return n.getMonth(); - if ('date' === e) return n.getDate(); - if ('hour' === e) return n.getHours(); - if ('minute' === e) return n.getMinutes(); - if ('day' === e) return n.getDay() - } - return 'year' === e ? n.getUTCFullYear() : 'month' === e ? n.getUTCMonth() : 'date' === e ? n.getUTCDate() : 'hour' === e ? n.getUTCHours() : 'minute' === e ? n.getUTCMinutes() : 'day' === e ? n.getUTCDay() : void 0 - }, g.prototype._cleanOldFiles = function () { - function e(e) { - r.unlink(t.dirname + o.sep + e, function (n) { - n && console.error('Error removing file ', e) - }) - } - - function n(n) { - var s = t.dirname + o.sep + n; - r.stat(s, function (r, o) { - if (r) return void console.error('Error stats file ', n, r); - var s = o.mtime && o.mtime.getTime() || 0; - o.isFile() && a - s > i * t.maxDays && e(n) - }) - } - var t = this, - i = 864e5, - a = Date.now(); - t.maxDays && r.readdir(t.dirname, function (e, r) { - if (e) return void console.error('Error reading directory ', t.dirname, e); - var o = new RegExp(t._basename, 'g'); - r.forEach(function (e) { - /.log/.test(e) && o.test(e) && n(e) - }) - }) - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(1), - i = t(0), - a = t(3), - s = t(7).pathExists; - e.exports = { - outputFile: r(function (e, n, t, r) { - 'function' == typeof t && (r = t, t = 'utf8'); - const d = i.dirname(e); - s(d, (i, s) => i ? r(i) : s ? o.writeFile(e, n, t, r) : void a.mkdirs(d, (i) => i ? r(i) : void o.writeFile(e, n, t, r))) - }), - outputFileSync: function (e, ...n) { - const t = i.dirname(e); - return o.existsSync(t) ? o.writeFileSync(e, ...n) : void(a.mkdirsSync(t), o.writeFileSync(e, ...n)) - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t, r) { - return t ? p(n, (i) => i ? r(i) : o(e, n, t, r)) : void m(n, (i, a) => i ? r(i) : a ? r(new Error('dest already exists.')) : o(e, n, t, r)) - } - - function o(e, n, t, r) { - d.rename(e, n, (o) => o ? 'EXDEV' === o.code ? i(e, n, t, r) : r(o) : r()) - } - - function i(e, n, t, r) { - c(e, n, { - overwrite: t, - errorOnExist: !0 - }, (n) => n ? r(n) : p(e, r)) - } - - function a(e, n) { - const t = e.split(l.sep), - r = n.split(l.sep); - return t.reduce((e, n, t) => e && r[t] === n, !0) - } - const s = t(2).fromCallback, - d = t(1), - l = t(0), - c = t(37).copy, - p = t(16).remove, - u = t(3).mkdirp, - m = t(7).pathExists; - e.exports = { - move: s(function (e, n, t, o) { - 'function' == typeof t && (o = t, t = {}); - const i = t.overwrite || t.clobber || !1; - return e = l.resolve(e), n = l.resolve(n), e === n ? d.access(e, o) : void d.stat(e, (t, s) => t ? o(t) : s.isDirectory() && a(e, n) ? o(new Error(`Cannot move '${e}' to a subdirectory of itself, '${n}'.`)) : void u(l.dirname(n), (t) => t ? o(t) : r(e, n, i, o))) - }) - } -}, function (e, n, t) { - 'use strict'; + } - function r(e, n, t) { - function i() { - if (a) try { - return d.renameSync(e, n) - } catch (i) { - if ('ENOTEMPTY' === i.code || 'EEXIST' === i.code || 'EPERM' === i.code) return p(n), t.overwrite = !1, r(e, n, t); - if ('EXDEV' !== i.code) throw i; - return o(e, n, a) - } else try { - return d.linkSync(e, n), d.unlinkSync(e) - } catch (t) { - if ('EXDEV' === t.code || 'EISDIR' === t.code || 'EPERM' === t.code || 'ENOTSUP' === t.code) return o(e, n, a); - throw t - } - } - t = t || {}; - const a = t.overwrite || t.clobber || !1; - if (e = l.resolve(e), n = l.resolve(n), e === n) return d.accessSync(e); - if (s(e, n)) throw new Error(`Cannot move '${e}' into itself '${n}'.`); - u(l.dirname(n)), i() - } - - function o(e, n, t) { - const r = d.statSync(e); - return r.isDirectory() ? a(e, n, t) : i(e, n, t) - } - - function i(e, n, t) { - const r = 65536, - o = m(r), - i = t ? 'w' : 'wx', - a = d.openSync(e, 'r'), - s = d.fstatSync(a), - l = d.openSync(n, i, s.mode); - for (let i = 0; i < s.size;) { - const e = d.readSync(a, o, 0, r, i); - d.writeSync(l, o, 0, e), i += e - } - return d.closeSync(a), d.closeSync(l), d.unlinkSync(e) - } - - function a(e, n, t) { - function r() { - return c(e, n, o), p(e) - } - const o = { - overwrite: !1 - }; - t ? (p(n), r()) : r() - } + function R(e, t) { + e.webContents.send("window-state-changed", t) + } + + function M(e) { + throw new Error(e) + } + + function A(e) { + const t = e.id; + if (!t) throw new Error("menuItem must specify id: " + e.label); + const n = e.enabled, + r = e.visible, + i = e.label, + o = e.checked, + s = function (e) { + if (e.accelerator) return e.accelerator; + if (e.role) { + const t = e.getDefaultRoleAccelerator; + if ("function" == typeof t) try { + const n = t.call(e); + if ("string" == typeof n) return n + } catch (e) { + console.error("Could not retrieve default accelerator", e) + } + } + return null + }(e), + a = function (e) { + const t = e.match(/&([^&])/); + return t ? t[1] : null + }(e.label), + c = function (e) { + switch (e) { + case "normal": + case "separator": + case "submenu": + case "checkbox": + case "radio": + return e; + default: + throw new Error(`Unable to parse string ${e} to a valid menu item type`) + } + }(e.type); + switch (c) { + case "normal": + return { + id: t, type: "menuItem", label: i, enabled: n, visible: r, accelerator: s, accessKey: a + }; + case "separator": + return { + id: t, type: "separator", visible: r + }; + case "submenu": + return { + id: t, type: "submenuItem", label: i, enabled: n, visible: r, menu: N(e.submenu, t), accessKey: a + }; + case "checkbox": + return { + id: t, type: "checkbox", label: i, enabled: n, visible: r, accelerator: s, checked: o, accessKey: a + }; + case "radio": + return { + id: t, type: "radio", label: i, enabled: n, visible: r, accelerator: s, checked: o, accessKey: a + }; + default: + return function (e, t) { + throw new Error(t) + }(0, "Unknown menu item type " + c) + } + } - function s(e, n) { - try { - return d.statSync(e).isDirectory() && e !== n && -1 < n.indexOf(e) && n.split(l.dirname(e) + l.sep)[1].split(l.sep)[0] === l.basename(e) - } catch (n) { - return !1 - } - } - const d = t(1), - l = t(0), - c = t(41).copySync, - p = t(16).removeSync, - u = t(3).mkdirsSync, - m = t(38); - e.exports = { - moveSync: r - } -}, function (e, n, t) { - 'use strict'; - const r = t(1), - o = t(0), - i = t(3), - a = t(19); - e.exports = function (e, n, t) { - const s = o.dirname(e); - r.existsSync(s) || i.mkdirsSync(s), a.writeJsonSync(e, n, t) - } -}, function (e, n, t) { - 'use strict'; - const r = t(0), - o = t(3), - i = t(7).pathExists, - a = t(19); - e.exports = function (e, n, t, s) { - 'function' == typeof t && (s = t, t = {}); - const d = r.dirname(e); - i(d, (r, i) => r ? s(r) : i ? a.writeJson(e, n, t, s) : void o.mkdirs(d, (r) => r ? s(r) : void a.writeJson(e, n, t, s))) - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(19); - o.outputJson = r(t(88)), o.outputJsonSync = t(87), o.outputJSON = o.outputJson, o.outputJSONSync = o.outputJsonSync, o.writeJSON = o.writeJson, o.writeJSONSync = o.writeJsonSync, o.readJSON = o.readJson, o.readJSONSync = o.readJsonSync, e.exports = o -}, function (e, n, t) { - 'use strict'; - const r = t(1); - e.exports = { - symlinkType: function (e, n, t) { - return t = 'function' == typeof n ? n : t, n = 'function' != typeof n && n, n ? t(null, n) : void r.lstat(e, (e, r) => e ? t(null, 'file') : void(n = r && r.isDirectory() ? 'dir' : 'file', t(null, n))) - }, - symlinkTypeSync: function (e, n) { - let t; - if (n) return n; - try { - t = r.lstatSync(e) - } catch (n) { - return 'file' - } - return t && t.isDirectory() ? 'dir' : 'file' - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(0), - o = t(1), - i = t(7).pathExists; - e.exports = { - symlinkPaths: function (e, n, t) { - if (r.isAbsolute(e)) return o.lstat(e, (n) => n ? (n.message = n.message.replace('lstat', 'ensureSymlink'), t(n)) : t(null, { - toCwd: e, - toDst: e - })); - else { - const a = r.dirname(n), - s = r.join(a, e); - return i(s, (n, i) => n ? t(n) : i ? t(null, { - toCwd: s, - toDst: e - }) : o.lstat(e, (n) => n ? (n.message = n.message.replace('lstat', 'ensureSymlink'), t(n)) : t(null, { - toCwd: e, - toDst: r.relative(a, e) - }))) - } - }, - symlinkPathsSync: function (e, n) { - let t; - if (r.isAbsolute(e)) { - if (t = o.existsSync(e), !t) throw new Error('absolute srcpath does not exist'); - return { - toCwd: e, - toDst: e - } - } else { - const i = r.dirname(n), - a = r.join(i, e); - if (t = o.existsSync(a), t) return { - toCwd: a, - toDst: e - }; - if (t = o.existsSync(e), !t) throw new Error('relative srcpath does not exist'); + function N(e, t) { return { - toCwd: e, - toDst: r.relative(i, e) - } - } - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(0), - i = t(1), - a = t(3), - s = a.mkdirs, - d = a.mkdirsSync, - l = t(91), - c = l.symlinkPaths, - p = l.symlinkPathsSync, - u = t(90), - m = u.symlinkType, - g = u.symlinkTypeSync, - f = t(7).pathExists; - e.exports = { - createSymlink: r(function (e, n, t, r) { - r = 'function' == typeof t ? t : r, t = 'function' != typeof t && t, f(n, (a, d) => a ? r(a) : d ? r(null) : void c(e, n, (a, d) => a ? r(a) : void(e = d.toDst, m(d.toCwd, t, (t, a) => { - if (t) return r(t); - const d = o.dirname(n); - f(d, (t, o) => t ? r(t) : o ? i.symlink(e, n, a, r) : void s(d, (t) => t ? r(t) : void i.symlink(e, n, a, r))) - })))) - }), - createSymlinkSync: function (e, n, t) { - const r = i.existsSync(n); - if (!r) { - const r = p(e, n); - e = r.toDst, t = g(r.toCwd, t); - const a = o.dirname(n), - s = i.existsSync(a); - return s ? i.symlinkSync(e, n, t) : (d(a), i.symlinkSync(e, n, t)) - } - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(0), - i = t(1), - a = t(3), - s = t(7).pathExists; - e.exports = { - createLink: r(function (e, n, t) { - function r(e, n) { - i.link(e, n, (e) => e ? t(e) : void t(null)) - } - s(n, (d, l) => d ? t(d) : l ? t(null) : void i.lstat(e, (i) => { - if (i) return i.message = i.message.replace('lstat', 'ensureLink'), t(i); - const d = o.dirname(n); - s(d, (o, i) => o ? t(o) : i ? r(e, n) : void a.mkdirs(d, (o) => o ? t(o) : void r(e, n))) - })) - }), - createLinkSync: function (e, n) { - const t = i.existsSync(n); - if (!t) { - try { - i.lstatSync(e) - } catch (e) { - throw e.message = e.message.replace('lstat', 'ensureLink'), e - } - const t = o.dirname(n), - r = i.existsSync(t); - return r ? i.linkSync(e, n) : (a.mkdirsSync(t), i.linkSync(e, n)) - } - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(2).fromCallback, - o = t(0), - i = t(1), - a = t(3), - s = t(7).pathExists; - e.exports = { - createFile: r(function (e, n) { - function t() { - i.writeFile(e, '', (e) => e ? n(e) : void n()) - } - i.stat(e, (r, i) => { - if (!r && i.isFile()) return n(); - const d = o.dirname(e); - s(d, (e, r) => e ? n(e) : r ? t() : void a.mkdirs(d, (e) => e ? n(e) : void t())) - }) - }), - createFileSync: function (e) { - let n; - try { - n = i.statSync(e) - } catch (n) {} - if (!(n && n.isFile())) { - const n = o.dirname(e); - i.existsSync(n) || a.mkdirsSync(n), i.writeFileSync(e, '') - } - } - } -}, function (e, n, t) { - 'use strict'; - const r = t(94), - o = t(93), - i = t(92); - e.exports = { - createFile: r.createFile, - createFileSync: r.createFileSync, - ensureFile: r.createFile, - ensureFileSync: r.createFileSync, - createLink: o.createLink, - createLinkSync: o.createLinkSync, - ensureLink: o.createLink, - ensureLinkSync: o.createLinkSync, - createSymlink: i.createSymlink, - createSymlinkSync: i.createSymlinkSync, - ensureSymlink: i.createSymlink, - ensureSymlinkSync: i.createSymlinkSync - } -}, function (e, n, t) { - 'use strict'; - - function r(e) { - ['unlink', 'chmod', 'stat', 'lstat', 'rmdir', 'readdir'].forEach((n) => { - e[n] = e[n] || p[n], n += 'Sync', e[n] = e[n] || p[n] - }), e.maxBusyTries = e.maxBusyTries || 3 - } - - function o(e, n, t) { - let o = 0; - 'function' == typeof n && (t = n, n = {}), f(e, 'rimraf: missing path'), f.strictEqual(typeof e, 'string', 'rimraf: path should be a string'), f.strictEqual(typeof t, 'function', 'rimraf: callback function required'), f(n, 'rimraf: invalid options argument provided'), f.strictEqual(typeof n, 'object', 'rimraf: options should be object'), r(n), i(e, n, function r(a) { - if (a) { - if (('EBUSY' === a.code || 'ENOTEMPTY' === a.code || 'EPERM' === a.code) && o < n.maxBusyTries) { - o++; - const t = 100 * o; - return setTimeout(() => i(e, n, r), t) - } - 'ENOENT' === a.code && (a = null) - } - t(a) - }) - } - - function i(e, n, t) { - f(e), f(n), f('function' == typeof t), n.lstat(e, (r, o) => r && 'ENOENT' === r.code ? t(null) : r && 'EPERM' === r.code && h ? a(e, n, r, t) : o && o.isDirectory() ? d(e, n, r, t) : void n.unlink(e, (r) => { - if (r) { - if ('ENOENT' === r.code) return t(null); - if ('EPERM' === r.code) return a(e, n, r, t); - if ('EISDIR' === r.code) return d(e, n, r, t) - } - return t(r) - })) - } - - function a(e, n, t, r) { - f(e), f(n), f('function' == typeof r), t && f(t instanceof Error), n.chmod(e, 438, (o) => { - o ? r('ENOENT' === o.code ? null : t) : n.stat(e, (o, i) => { - o ? r('ENOENT' === o.code ? null : t) : i.isDirectory() ? d(e, n, t, r) : n.unlink(e, r) - }) - }) - } - - function s(e, n, t) { - let r; - f(e), f(n), t && f(t instanceof Error); - try { - n.chmodSync(e, 438) - } catch (e) { - if ('ENOENT' === e.code) return; - throw t - } - try { - r = n.statSync(e) - } catch (e) { - if ('ENOENT' === e.code) return; - throw t + id: t, + type: "menu", + items: e.items.map(A) + } } - r.isDirectory() ? u(e, n, t) : n.unlinkSync(e) - } - function d(e, n, t, r) { - f(e), f(n), t && f(t instanceof Error), f('function' == typeof r), n.rmdir(e, (o) => { - o && ('ENOTEMPTY' === o.code || 'EEXIST' === o.code || 'EPERM' === o.code) ? l(e, n, r) : o && 'ENOTDIR' === o.code ? r(t) : r(o) - }) - } - - function l(e, t, r) { - f(e), f(t), f('function' == typeof r), t.readdir(e, (i, a) => { - if (i) return r(i); - let s = a.length, - n; - return 0 === s ? t.rmdir(e, r) : void a.forEach((i) => { - o(g.join(e, i), t, (o) => n ? void 0 : o ? r(n = o) : void(0 == --s && t.rmdir(e, r))) - }) - }) - } - - function c(e, n) { - let t; - n = n || {}, r(n), f(e, 'rimraf: missing path'), f.strictEqual(typeof e, 'string', 'rimraf: path should be a string'), f(n, 'rimraf: missing options'), f.strictEqual(typeof n, 'object', 'rimraf: options should be object'); - try { - t = n.lstatSync(e) - } catch (t) { - if ('ENOENT' === t.code) return; - 'EPERM' === t.code && h && s(e, n, t) - } - try { - t && t.isDirectory() ? u(e, n, null) : n.unlinkSync(e) - } catch (t) { - if ('ENOENT' === t.code) return; - if ('EPERM' === t.code) return s(e, n, t); - if ('EISDIR' !== t.code) throw t; - u(e, n, t) + function j() { + const e = process.hrtime(); + return 1e3 * e[0] + e[1] / 1e6 + } + var F = n(53), + P = n.n(F); + class D { + constructor() { + this.emitter = new O.Emitter, this._loadTime = null, this._rendererReadyTime = null, this.minWidth = 960, this.minHeight = 660; + const e = P()({ + defaultWidth: this.minWidth, + defaultHeight: this.minHeight + }), + t = { + x: e.x, + y: e.y, + width: e.width, + height: e.height, + minWidth: this.minWidth, + minHeight: this.minHeight, + show: !1, + backgroundColor: "#fff", + webPreferences: { + disableBlinkFeatures: "Auxclick", + nodeIntegration: !0, + enableRemoteModule: !0, + spellcheck: !1 + }, + acceptFirstMouse: !0, + frame: !1 + }; + this.window = new x.BrowserWindow(t), e.manage(this.window); + let n = !1; + x.app.on("before-quit", () => { + n = !0 + }), x.ipcMain.on("will-quit", e => { + n = !0, e.returnValue = !0 + }), this.window.once("ready-to-show", () => { + this.window.on("unmaximize", () => { + setTimeout(() => { + const e = this.window.getBounds(); + e.width += 1, this.window.setBounds(e), e.width -= 1, this.window.setBounds(e) + }, 5) + }) + }) + } + load() { + let e = 0; + this.window.webContents.once("did-start-loading", () => { + this._rendererReadyTime = null, this._loadTime = null, e = j() + }), this.window.webContents.once("did-finish-load", () => { + this._loadTime = j() - e, this.maybeEmitDidLoad() + }), this.window.webContents.on("did-finish-load", () => { + this.window.webContents.setVisualZoomLevelLimits(1, 1) + }), this.window.webContents.on("did-fail-load", () => { + this.window.webContents.openDevTools(), this.window.show() + }), x.ipcMain.once("renderer-ready", (e, t) => { + this._rendererReadyTime = t, this.maybeEmitDidLoad() + }), this.window.on("focus", () => this.window.webContents.send("focus")), this.window.on("blur", () => this.window.webContents.send("blur")), T(this.window), this.window.loadURL(function (...e) { + const t = r.resolve(...e); + return L()(t) + }(__dirname, "index.html")) + } + maybeEmitDidLoad() { + this.rendererLoaded && this.emitter.emit("did-load", null) + } + get rendererLoaded() { + return !!this.loadTime && !!this.rendererReadyTime + } + onClose(e) { + this.window.on("closed", e) + } + onDidLoad(e) { + return this.emitter.on("did-load", e) + } + isMinimized() { + return this.window.isMinimized() + } + isVisible() { + return this.window.isVisible() + } + restore() { + this.window.restore() + } + focus() { + this.window.focus() + } + show() { + this.window.show() + } + sendMenuEvent(e) { + this.show(), this.window.webContents.send("menu-event", { + name: e + }) + } + sendURLAction(e) { + this.show(), this.window.webContents.send("url-action", { + action: e + }) + } + sendLaunchTimingStats(e) { + this.window.webContents.send("launch-timing-stats", { + stats: e + }) + } + sendAppMenu() { + const e = x.Menu.getApplicationMenu(); + if (e) { + const t = N(e); + this.window.webContents.send("app-menu", { + menu: t + }) + } + } + sendCertificateError(e, t, n) { + this.window.webContents.send("certificate-error", { + certificate: e, + error: t, + url: n + }) + } + showCertificateTrustDialog(e, t) { + x.dialog.showCertificateTrustDialog(this.window, { + certificate: e, + message: t + }, () => {}) + } + sendException(e) { + const t = { + stack: e.stack, + message: e.message, + name: e.name + }; + this.window.webContents.send("main-process-exception", t) + } + get loadTime() { + return this._loadTime + } + get rendererReadyTime() { + return this._rendererReadyTime + } + destroy() { + this.window.destroy() + } } - } + var I = n(13), + z = n(25), + U = n(9); + new Set(["LOCAL_GIT_DIRECTORY"]); + const H = /[\x00-\x20\x7F~^:?*\[\\|""<>]+|@{|\.\.+|^\.|\.$|\.lock$|\/$/g; - function u(e, n, t) { - f(e), f(n), t && f(t instanceof Error); - try { - n.rmdirSync(e) - } catch (r) { - if ('ENOTDIR' === r.code) throw t; - else if ('ENOTEMPTY' === r.code || 'EEXIST' === r.code || 'EPERM' === r.code) m(e, n); - else if ('ENOENT' !== r.code) throw r - } - } - - function m(e, n) { - f(e), f(n), n.readdirSync(e).forEach((t) => c(g.join(e, t), n)); { - const t = Date.now(); - do try { - const t = n.rmdirSync(e, n); - return t - } catch (e) {} - while (500 > Date.now() - t) - } - } - const p = t(1), - g = t(0), - f = t(42), - h = !0; - e.exports = o, o.sync = c -}, function (e, n, t) { - 'use strict'; - - function r(e) { - let n; - try { - n = i.readdirSync(e) - } catch (n) { - return s.mkdirsSync(e) + function B(e, t) { + const n = e[t]; + return null == n ? null : Array.isArray(n) ? n[0] : n } - n.forEach((n) => { - n = a.join(e, n), d.removeSync(n) - }) - } - const o = t(2).fromCallback, - i = t(5), - a = t(0), - s = t(3), - d = t(16), - l = o(function (e, n) { - n = n || function () {}, i.readdir(e, (t, r) => { - function o() { - const e = r.pop(); - return e ? void d.remove(e, (e) => e ? n(e) : void o()) : n() + + function G(e) { + const t = C.parse(e, !0), + n = t.hostname, + r = { + name: "unknown", + url: e + }; + if (!n) return r; + const i = t.query, + o = n.toLowerCase(); + if ("oauth" === o) { + const e = B(i, "code"), + t = B(i, "state"); + return null != e && null != t ? { + name: "oauth", + code: e, + state: t + } : r } - return t ? s.mkdirs(e, n) : void(r = r.map((n) => a.join(e, n)), o()) - }) - }); - e.exports = { - emptyDirSync: r, - emptydirSync: r, - emptyDir: l, - emptydir: l - } -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t, r) { - 'function' != typeof t || r ? 'function' == typeof t && (t = { - filter: t - }) : (r = t, t = {}), r = r || function () {}, t = t || {}, t.clobber = !('clobber' in t) || !!t.clobber, t.overwrite = 'overwrite' in t ? !!t.overwrite : t.clobber, t.preserveTimestamps && 'ia32' === process.arch && console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`), v(e, n, (a, s) => a ? r(a) : t.filter ? i(o, s, e, n, t, r) : o(s, e, n, t, r)) - } - - function o(e, n, t, r, o) { - const i = E.dirname(t); - k(i, (s, d) => s ? o(s) : d ? a(e, n, t, r, o) : void C(i, (i) => i ? o(i) : a(e, n, t, r, o))) - } - - function i(e, n, t, r, o, i) { - Promise.resolve(o.filter(t, r)).then((a) => a ? n ? e(n, t, r, o, i) : e(t, r, o, i) : i(), (e) => i(e)) - } - - function a(e, n, t, r, o) { - return r.filter ? i(s, e, n, t, r, o) : s(e, n, t, r, o) - } - - function s(e, n, t, r, o) { - const i = r.dereference ? x.stat : x.lstat; - i(n, (i, a) => { - if (i) return o(i); - return a.isDirectory() ? m(a, e, n, t, r, o) : a.isFile() || a.isCharacterDevice() || a.isBlockDevice() ? d(a, e, n, t, r, o) : a.isSymbolicLink() ? _(e, n, t, r, o) : void 0 - }) - } - - function d(e, n, t, r, o, i) { - return n === L ? c(e, t, r, o, i) : l(e, t, r, o, i) - } - - function l(e, n, t, r, o) { - return r.overwrite ? void x.unlink(t, (i) => i ? o(i) : c(e, n, t, r, o)) : r.errorOnExist ? o(new Error(`'${t}' already exists`)) : o() - } - - function c(e, n, t, r, o) { - return 'function' == typeof x.copyFile ? x.copyFile(n, t, (n) => n ? o(n) : u(e, t, r, o)) : p(e, n, t, r, o) - } - - function p(e, n, t, r, o) { - const i = x.createReadStream(n); - i.on('error', (e) => o(e)).once('open', () => { - const n = x.createWriteStream(t, { - mode: e.mode - }); - n.on('error', (e) => o(e)).on('open', () => i.pipe(n)).once('close', () => u(e, t, r, o)) - }) - } - - function u(e, n, t, r) { - x.chmod(n, e.mode, (o) => o ? r(o) : t.preserveTimestamps ? M(n, e.atime, e.mtime, r) : r()) - } - - function m(e, n, t, r, o, i) { - return n === L ? g(e, t, r, o, i) : n && !n.isDirectory() ? i(new Error(`Cannot overwrite non-directory '${r}' with directory '${t}'.`)) : f(t, r, o, i) - } - - function g(e, n, t, r, o) { - x.mkdir(t, (i) => i ? o(i) : void f(n, t, r, (n) => n ? o(n) : x.chmod(t, e.mode, o))) - } - - function f(e, n, t, r) { - x.readdir(e, (o, i) => o ? r(o) : h(i, e, n, t, r)) - } - - function h(e, n, t, r, o) { - const i = e.pop(); - return i ? y(e, i, n, t, r, o) : o() - } - - function y(e, n, t, r, o, i) { - const s = E.join(t, n), - d = E.join(r, n); - v(s, d, (n, l) => n ? i(n) : void a(l, s, d, o, (n) => n ? i(n) : h(e, t, r, o, i))) - } - - function _(e, n, t, r, o) { - x.readlink(n, (n, i) => n ? o(n) : (r.dereference && (i = E.resolve(process.cwd(), i)), e === L ? x.symlink(i, t, o) : void x.readlink(t, (n, a) => n ? 'EINVAL' === n.code || 'UNKNOWN' === n.code ? x.symlink(i, t, o) : o(n) : (r.dereference && (a = E.resolve(process.cwd(), a)), S(i, a) ? o(new Error(`Cannot copy '${i}' to a subdirectory of itself, '${a}'.`)) : e.isDirectory() && S(a, i) ? o(new Error(`Cannot overwrite '${a}' with '${i}'.`)) : b(i, t, o))))) - } - - function b(e, n, t) { - x.unlink(n, (r) => r ? t(r) : x.symlink(e, n, t)) - } - - function S(e, n) { - const t = E.resolve(e).split(E.sep), - r = E.resolve(n).split(E.sep); - return t.reduce((e, n, t) => e && r[t] === n, !0) - } - - function w(e, n, t) { - x.stat(e, (e, r) => e ? t(e) : void x.stat(n, (e, n) => e ? 'ENOENT' === e.code ? t(null, { - srcStat: r, - destStat: L - }) : t(e) : t(null, { - srcStat: r, - destStat: n - }))) - } - - function v(e, n, t) { - w(e, n, (r, o) => { - if (r) return t(r); - const { - srcStat: i, - destStat: a - } = o; - return a.ino && a.ino === i.ino ? t(new Error('Source and destination must not be the same.')) : i.isDirectory() && S(e, n) ? t(new Error(`Cannot copy '${e}' to a subdirectory of itself, '${n}'.`)) : t(null, a) - }) - } - const x = t(1), - E = t(0), - C = t(3).mkdirs, - k = t(7).pathExists, - M = t(39).utimesMillis, - L = Symbol('notExist'); - e.exports = r -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t) { - n && 'object' == typeof n || (n = { - mode: n - }); - let d = n.mode; - const l = n.fs || o; - if (a(e)) { - const n = new Error(e + ' contains invalid WIN32 path characters.'); - throw n.code = 'EINVAL', n + const s = t.pathname; + if (!s || s.length <= 1) return r; + const a = s.substr(1); + if ("openrepo" === o) { + const e = B(i, "pr"), + t = B(i, "branch"), + n = B(i, "filepath"); + if (null != e) { + if (!/^\d+$/.test(e)) return r; + if (null != t && !/^pr\/\d+$/.test(t)) return r + } + return null != t && (c = t, H.test(c)) ? r : { + name: "open-repository-from-url", + url: a, + branch: t, + pr: e, + filepath: n + } + } + var c; + return "openlocalrepo" === o ? { + name: "open-repository-from-path", + path: decodeURIComponent(a) + } : r + } + var $ = n(20); + + function q() { + for (const t of Object($.enumerateValues)($.HKEY.HKEY_CURRENT_USER, "Environment")) + if ("Path" === t.name && ((e = t).type === $.RegistryValueType.REG_SZ || e.type === $.RegistryValueType.REG_EXPAND_SZ)) return t.data.split(";").filter(e => e.length > 0); + var e; + throw new Error("Could not find PATH environment variable") + } + async function W(e) { + let t; + const n = process.env.SystemRoot; + if (n) { + const e = r.join(n, "System32"); + t = r.join(e, "setx.exe") + } else t = "setx.exe"; + await Y(t, ["Path", e.join(";")]) } - d === void 0 && (d = s & ~process.umask()), t || (t = null), e = i.resolve(e); - try { - l.mkdirSync(e, d), t = t || e - } catch (o) { - if ('ENOENT' === o.code) { - if (i.dirname(e) === e) throw o; - t = r(i.dirname(e), n, t), r(e, n, t) - } else { - let n; + + function Y(e, t) { try { - n = l.statSync(e) + const n = Object(z.spawn)(e, t); + return new Promise((r, i) => { + let o = ""; + n.stdout && n.stdout.on("data", e => { + o += e + }), n.on("close", n => { + 0 === n ? r(o) : i(new Error(`Command "${e} ${t}" failed: "${o}"`)) + }), n.on("error", e => { + i(e) + }), n.stdin && n.stdin.end() + }) } catch (e) { - throw o - } - if (!n.isDirectory()) throw o - } - } - return t - } - const o = t(1), - i = t(0), - a = t(40).invalidWin32Path, - s = parseInt('0777', 8); - e.exports = r -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t, d) { - if ('function' == typeof n ? (t = n, n = {}) : (!n || 'object' != typeof n) && (n = { - mode: n - }), a(e)) { - const n = new Error(e + ' contains invalid WIN32 path characters.'); - return n.code = 'EINVAL', t(n) - } - let l = n.mode; - const c = n.fs || o; - void 0 === l && (l = s & ~process.umask()), d || (d = null), t = t || function () {}, e = i.resolve(e), c.mkdir(e, l, (o) => { - if (!o) return d = d || e, t(null, d); - switch (o.code) { - case 'ENOENT': - if (i.dirname(e) === e) return t(o); - r(i.dirname(e), n, (o, i) => { - o ? t(o, i) : r(e, n, t, i) - }); - break; - default: - c.stat(e, (e, n) => { - e || !n.isDirectory() ? t(o, d) : t(null, d) - }); - } - }) - } - const o = t(1), - i = t(0), - a = t(40).invalidWin32Path, - s = parseInt('0777', 8); - e.exports = r -}, function (e, n, t) { - 'use strict'; - - function r(e, n, t) { - 'function' == typeof t && (t = { - filter: t - }), t = t || {}, t.clobber = !('clobber' in t) || !!t.clobber, t.overwrite = 'overwrite' in t ? !!t.overwrite : t.clobber, t.preserveTimestamps && 'ia32' === process.arch && console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`); - const r = _(e, n); - if (!t.filter || t.filter(e, n)) { - const i = S.dirname(n); - return b.existsSync(i) || w(i), o(r, e, n, t) - } - } - - function o(e, n, t, r) { - return r.filter && !r.filter(n, t) ? void 0 : i(e, n, t, r) - } - - function i(e, n, t, r) { - const o = r.dereference ? b.statSync : b.lstatSync, - i = o(n); - if (i.isDirectory()) return c(i, e, n, t, r); - return i.isFile() || i.isCharacterDevice() || i.isBlockDevice() ? a(i, e, n, t, r) : i.isSymbolicLink() ? g(e, n, t, r) : void 0 - } - - function a(e, n, t, r, o) { - return n === x ? d(e, t, r, o) : s(e, t, r, o) - } - - function s(e, n, t, r) { - if (r.overwrite) return b.unlinkSync(t), d(e, n, t, r); - if (r.errorOnExist) throw new Error(`'${t}' already exists`) - } - - function d(e, n, t, r) { - return 'function' == typeof b.copyFileSync ? (b.copyFileSync(n, t), b.chmodSync(t, e.mode), r.preserveTimestamps ? v(t, e.atime, e.mtime) : void 0) : l(e, n, t, r) - } - - function l(e, n, r, o) { - const i = 65536, - a = t(38)(i), - s = b.openSync(n, 'r'), - d = b.openSync(r, 'w', e.mode); - for (let t = 0; t < e.size;) { - const e = b.readSync(s, a, 0, i, t); - b.writeSync(d, a, 0, e), t += e - } - o.preserveTimestamps && b.futimesSync(d, e.atime, e.mtime), b.closeSync(s), b.closeSync(d) - } - - function c(e, n, t, r, o) { - if (n === x) return p(e, t, r, o); - if (n && !n.isDirectory()) throw new Error(`Cannot overwrite non-directory '${r}' with directory '${t}'.`); - return u(t, r, o) - } - - function p(e, n, t, r) { - return b.mkdirSync(t), u(n, t, r), b.chmodSync(t, e.mode) - } - - function u(e, n, t) { - b.readdirSync(e).forEach((r) => m(r, e, n, t)) - } - - function m(e, n, t, r) { - const i = S.join(n, e), - a = S.join(t, e), - s = _(i, a); - return o(s, i, a, r) - } - - function g(e, n, t, r) { - let o = b.readlinkSync(n); - if (r.dereference && (o = S.resolve(process.cwd(), o)), e === x) return b.symlinkSync(o, t); - else { - let e; - try { - e = b.readlinkSync(t) - } catch (e) { - if ('EINVAL' === e.code || 'UNKNOWN' === e.code) return b.symlinkSync(o, t); - throw e - } - if (r.dereference && (e = S.resolve(process.cwd(), e)), h(o, e)) throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${e}'.`); - if (b.statSync(t).isDirectory() && h(e, o)) throw new Error(`Cannot overwrite '${e}' with '${o}'.`); - return f(o, t) - } - } - - function f(e, n) { - return b.unlinkSync(n), b.symlinkSync(e, n) - } - - function h(e, n) { - const t = S.resolve(e).split(S.sep), - r = S.resolve(n).split(S.sep); - return t.reduce((e, n, t) => e && r[t] === n, !0) - } - - function y(e, n) { - const t = b.statSync(e); - let r; - try { - r = b.statSync(n) - } catch (e) { - if ('ENOENT' === e.code) return { - srcStat: t, - destStat: x - }; - throw e - } - return { - srcStat: t, - destStat: r - } - } - - function _(e, n) { - const { - srcStat: t, - destStat: r - } = y(e, n); - if (r.ino && r.ino === t.ino) throw new Error('Source and destination must not be the same.'); - if (t.isDirectory() && h(e, n)) throw new Error(`Cannot copy '${e}' to a subdirectory of itself, '${n}'.`); - return r - } - const b = t(1), - S = t(0), - w = t(3).mkdirsSync, - v = t(39).utimesMillisSync, - x = Symbol('notExist'); - e.exports = r -}, function (e) { - 'use strict'; - e.exports = function (e) { - if (null === e || 'object' != typeof e) return e; - if (e instanceof Object) var n = { - __proto__: e.__proto__ - }; - else var n = Object.create(null); - return Object.getOwnPropertyNames(e).forEach(function (t) { - Object.defineProperty(n, t, Object.getOwnPropertyDescriptor(e, t)) - }), n - } -}, function (e, n, t) { - var r = t(8).Stream; - e.exports = function (e) { - function n(t, o) { - if (!(this instanceof n)) return new n(t, o); - r.call(this); - var i = this; - this.path = t, this.fd = null, this.readable = !0, this.paused = !1, this.flags = 'r', this.mode = 438, this.bufferSize = 65536, o = o || {}; - for (var a = Object.keys(o), s = 0, d = a.length, l; s < d; s++) l = a[s], this[l] = o[l]; - if (this.encoding && this.setEncoding(this.encoding), void 0 !== this.start) { - if ('number' != typeof this.start) throw TypeError('start must be a Number'); - if (void 0 === this.end) this.end = Infinity; - else if ('number' != typeof this.end) throw TypeError('end must be a Number'); - if (this.start > this.end) throw new Error('start must be <= end'); - this.pos = this.start - } - return null === this.fd ? void e.open(this.path, this.flags, this.mode, function (e, n) { - return e ? (i.emit('error', e), void(i.readable = !1)) : void(i.fd = n, i.emit('open', n), i._read()) - }) : void process.nextTick(function () { - i._read() - }) - } - - function t(n, o) { - if (!(this instanceof t)) return new t(n, o); - r.call(this), this.path = n, this.fd = null, this.writable = !0, this.flags = 'w', this.encoding = 'binary', this.mode = 438, this.bytesWritten = 0, o = o || {}; - for (var i = Object.keys(o), a = 0, s = i.length, d; a < s; a++) d = i[a], this[d] = o[d]; - if (this.start !== void 0) { - if ('number' != typeof this.start) throw TypeError('start must be a Number'); - if (0 > this.start) throw new Error('start must be >= zero'); - this.pos = this.start - } - this.busy = !1, this._queue = [], null === this.fd && (this._open = e.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush()) - } - return { - ReadStream: n, - WriteStream: t - } - } -}, function (e) { - e.exports = require('constants') -}, function (e, n, t) { - var r = t(104), - o = process.cwd, - i = null, - a = process.env.GRACEFUL_FS_PLATFORM || 'win32'; - process.cwd = function () { - return i || (i = o.call(process)), i - }; - try { - process.cwd() - } catch (e) {} - var s = process.chdir; - process.chdir = function (e) { - i = null, s.call(process, e) - }, e.exports = function (e) { - function n(n) { - return n ? function (t, r, o) { - return n.call(e, t, r, function (e) { - l(e) && (e = null), o && o.apply(this, arguments) - }) - } : n + return Promise.reject(e) + } } - - function t(n) { - return n ? function (t, r) { + const K = r.resolve(process.execPath, ".."), + J = r.resolve(K, ".."), + V = r.resolve(r.join(J, "Update.exe")), + X = r.basename(process.execPath); + async function Q() { + const e = Z(); + await Object(s.ensureDir)(e), await + function (e) { + const t = `@echo off\n"%~dp0\\${ee(e,"resources/app/static/github.bat")}" %*`, + n = r.join(e, "github.bat"); + return Object(s.writeFile)(n, t) + }(e), await + function (e) { + const t = `#!/usr/bin/env bash\n DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"\n sh "$DIR/${ee(e,"resources/app/static/github.sh").replace(/\\/g,"/")}" "$@"`, + n = r.join(e, "github"); + return Object(s.writeFile)(n, t, { + encoding: "utf8", + mode: 755 + }) + }(e); try { - return n.call(e, t, r) + const t = q(); + t.indexOf(e) < 0 && await W([...t, e]) } catch (e) { - if (!l(e)) throw e + log.error("Failed inserting bin path into PATH environment variable", e) } - } : n } - function o(n) { - return n ? function (t, r, o, i) { - return n.call(e, t, r, o, function (e) { - l(e) && (e = null), i && i.apply(this, arguments) - }) - } : n + function Z() { + return r.resolve(process.execPath, "../../bin") } - function i(n) { - return n ? function (t, r, o) { - try { - return n.call(e, t, r, o) - } catch (e) { - if (!l(e)) throw e - } - } : n + function ee(e, t) { + const n = r.resolve(process.execPath, ".."); + return r.relative(e, r.join(n, t)) + } + async function te(e) { + await Y(V, e) } - function s(n) { - return n ? function (t, r, o) { - function i(e, n) { - n && (0 > n.uid && (n.uid += 4294967296), 0 > n.gid && (n.gid += 4294967296)), o && o.apply(this, arguments) + function ne(e) { + return te(["--createShortcut", X, "-l", e.join(",")]) + } + var re = n(19); + async function ie(e, t, n) { + const r = new Map; + if (r.set("name", e.name), r.set("message", e.message), e.stack && r.set("stack", e.stack), r.set("platform", "win32"), r.set("sha", "ebf4606179c52ba2c755126f6a100e8240969b94"), r.set("version", x.app.getVersion()), t) + for (const e of Object.keys(t)) r.set(e, t[e]); + const i = { + method: "POST", + url: n ? "https://central.github.com/api/desktop-non-fatal/exception" : "https://central.github.com/api/desktop/exception", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + } + }, + o = [...r.entries()].map(([e, t]) => `${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"); + try { + await new Promise((e, t) => { + const n = x.net.request(i); + n.on("response", n => { + 200 === n.statusCode ? e() : t(`Got ${n.statusCode} - ${n.statusMessage} from central`) + }), n.on("error", t), n.end(o) + }), log.info("Error report submitted") + } catch (t) { + log.error("Failed submitting error report", e) } - return 'function' == typeof r && (o = r, r = null), r ? n.call(e, t, r, i) : n.call(e, t, i) - } : n } - - function d(n) { - return n ? function (t, r) { - var o = r ? n.call(e, t, r) : n.call(e, t); - return 0 > o.uid && (o.uid += 4294967296), 0 > o.gid && (o.gid += 4294967296), o - } : n + class oe { + constructor(e, t) { + this.emitter = new O.Emitter, this.hasFinishedLoading = !1, this.hasSentReadyEvent = !1; + const n = { + width: 600, + height: 500, + minWidth: 600, + minHeight: 500, + show: !1, + backgroundColor: "#fff", + webPreferences: { + disableBlinkFeatures: "Auxclick", + nodeIntegration: !0, + spellcheck: !1 + }, + frame: !1 + }; + this.window = new x.BrowserWindow(n), this.error = t, this.errorType = e + } + load() { + log.debug("Starting crash process"), this.window.webContents.once("did-start-loading", () => { + log.debug("Crash process in startup") + }), this.window.webContents.once("did-finish-load", () => { + log.debug("Crash process started"), this.hasFinishedLoading = !0, this.maybeEmitDidLoad() + }), this.window.webContents.on("did-finish-load", () => { + this.window.webContents.setVisualZoomLevelLimits(1, 1) + }), this.window.webContents.on("did-fail-load", () => { + log.error("Crash process failed to load"), this.emitter.emit("did-fail-load", null) + }), x.ipcMain.on("crash-ready", e => { + log.debug("Crash process is ready"), this.hasSentReadyEvent = !0, this.sendError(), this.maybeEmitDidLoad() + }), x.ipcMain.on("crash-quit", e => { + log.debug("Got quit signal from crash process"), this.window.close() + }), T(this.window), this.window.loadURL(`file://${__dirname}/crash.html`) + } + maybeEmitDidLoad() { + this.hasFinishedLoading && this.hasSentReadyEvent && this.emitter.emit("did-load", null) + } + onClose(e) { + this.window.on("closed", e) + } + onFailedToLoad(e) { + this.emitter.on("did-fail-load", e) + } + onDidLoad(e) { + return this.emitter.on("did-load", e) + } + focus() { + this.window.focus() + } + show() { + log.debug("Showing crash process window"), this.window.show() + } + sendError() { + const e = { + stack: this.error.stack, + message: this.error.message, + name: this.error.name + }, + t = { + type: this.errorType, + error: e + }; + this.window.webContents.send("error", t) + } + destroy() { + this.window.destroy() + } } - - function l(e) { - if (!e) return !0; - if ('ENOSYS' === e.code) return !0; - var n = !process.getuid || 0 !== process.getuid(); - return !!(n && ('EINVAL' === e.code || 'EPERM' === e.code)) - } - r.hasOwnProperty('O_SYMLINK') && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && function (e) { - e.lchmod = function (n, t, o) { - e.open(n, r.O_WRONLY | r.O_SYMLINK, t, function (n, r) { - return n ? void(o && o(n)) : void e.fchmod(r, t, function (n) { - e.close(r, function (e) { - o && o(n || e) - }) - }) + let se = !1; + + function ae(e, t) { + return (e ? e.toLowerCase() : e) === (t ? t.toLowerCase() : t) + } + + function ce() { + const e = x.Menu.buildFromTemplate([{ + role: "editMenu" + }]).items[0]; + return (e && e.submenu ? e.submenu.items : []).filter(e => !ae(e.role, "pasteandmatchstyle")) + } + + function le(e, t) { + return function e(t, n, r = []) { + const i = new x.Menu; + for (const [o, s] of t.entries()) + if (ae(s.role, "editmenu")) + for (const e of ce()) i.append(e); + else { + const t = [...r, o]; + i.append(new x.MenuItem({ + label: s.label, + type: s.type, + enabled: s.enabled, + role: s.role, + click: () => n(t), + submenu: s.submenu ? e(s.submenu, n, t) : void 0 + })) + } return i + }(e, t) + } + + function ue(e, t) { + process.emit("send-non-fatal-exception", t, { + kind: e }) - }, e.lchmodSync = function (n, t) { - var o = e.openSync(n, r.O_WRONLY | r.O_SYMLINK, t), - i = !0, - a; - try { - a = e.fchmodSync(o, t), i = !1 - } finally { - if (i) try { - e.closeSync(o) - } catch (e) {} else e.closeSync(o) + } + n(54); + x.app.setAppLogsPath(), x.app.allowRendererProcessReuse = !1, + function () { + d.a.install({ + environment: "node", + handleUncaughtExceptions: !1, + retrieveSourceMap: g + }); + const e = Error; + v = e.prepareStackTrace, e.prepareStackTrace = w + }(); + let fe = null; + const he = j(); + let pe = !1, + de = null, + me = []; + + function ge(e) { + pe = !0; + const t = null === fe; + fe && (fe.destroy(), fe = null), + function (e, t) { + if (log.error(E(t)), se) return; + se = !0, Object(I.setCrashMenu)(); + const n = new oe(e ? "launch" : "generic", t); + n.onDidLoad(() => { + n.show() + }), n.onFailedToLoad(async () => { + await x.dialog.showMessageBox({ + type: "error", + title: "无法恢复的错误", + message: "GitHub Desktop遇到不可恢复的错误,需要重新启动。\n\n已将此问题报告给团队,但如果您反复遇到此问题,请将此问题报告给GitHub桌面问题跟踪程序。\n\n" + (t.stack || t.message) + }), x.app.relaunch(), x.app.quit() + }), n.onClose(() => { + x.app.relaunch(), x.app.quit() + }), n.load() + }(t, e) + } + + function ye() { + return { + uptime: ((j() - he) / 1e3).toFixed(3), + time: (new Date).toString() } - return a - } - }(e), e.lutimes || function (e) { - r.hasOwnProperty('O_SYMLINK') ? (e.lutimes = function (n, t, o, i) { - e.open(n, r.O_SYMLINK, function (n, r) { - return n ? void(i && i(n)) : void e.futimes(r, t, o, function (n) { - e.close(r, function (e) { - i && i(n || e) - }) - }) + } + const ve = new Set(["x-github-client"]); + ve.add("x-github-desktop-auth"), ve.add("github-windows"), x.app.on("window-all-closed", () => {}), process.on("uncaughtException", e => { + ie(e = b(e), ye()), ge(e) + }); + let we = !1; + if (process.argv.length > 1) { + const e = process.argv[1], + t = function (e) { + switch (e) { + case "--squirrel-install": + return async function () { + await ne(["StartMenu", "Desktop"]), await Q() + }(); + case "--squirrel-updated": + return async function () { + await async function () { + const e = U.homedir(); + if (e) { + const t = r.join(e, "Desktop", "GitHub Desktop.lnk"), + n = await Object(s.pathExists)(t); + return ne(n ? ["StartMenu", "Desktop"] : ["StartMenu"]) + } + return ne(["StartMenu", "Desktop"]) + }(), await Q() + }(); + case "--squirrel-uninstall": + return async function () { + await te(["--removeShortcut", X]); + try { + const e = q(), + t = Z(); + return W(e.filter(e => e !== t)) + } catch (e) { + log.error("Failed removing bin path from PATH environment variable", e) + } + }(); + case "--squirrel-obsolete": + return Promise.resolve() + } + return null + }(e); + t ? (we = !0, t.catch(t => { + log.error("Failed handling Squirrel event: " + e, t) + }).then(() => { + x.app.quit() + })) : Ee(process.argv) + } + + function be(e) { + log.info("Processing protocol url"); + const t = G(e); + Se(e => { + e.focus(), e.sendURLAction(t) }) - }, e.lutimesSync = function (n, t, o) { - var i = e.openSync(n, r.O_SYMLINK), - a = !0, - s; - try { - s = e.futimesSync(i, t, o), a = !1 - } finally { - if (a) try { - e.closeSync(i) - } catch (e) {} else e.closeSync(i) + } + let _e = !1; + if (!we) { + const e = x.app.requestSingleInstanceLock(); + _e = !e, x.app.on("second-instance", (e, t, n) => { + fe && (fe.isMinimized() && fe.restore(), fe.isVisible() || fe.show(), fe.focus()), Ee(t) + }), _e && x.app.quit() + } + + function Ee(e) { + log.info("Received possible protocol arguments: " + e.length); { + const t = e.filter(e => { + try { + const t = C.parse(e); + return t.protocol && ve.has(t.protocol.slice(0, -1)) + } catch (t) { + return log.error("Unable to parse argument as URL: " + e), !1 + } + }); + e.includes("--protocol-launcher") && 1 === t.length ? be(t[0]) : log.error("Malformed launch arguments received: " + e) } - return s - }) : (e.lutimes = function (e, n, t, r) { - r && process.nextTick(r) - }, e.lutimesSync = function () {}) - }(e), e.chown = o(e.chown), e.fchown = o(e.fchown), e.lchown = o(e.lchown), e.chmod = n(e.chmod), e.fchmod = n(e.fchmod), e.lchmod = n(e.lchmod), e.chownSync = i(e.chownSync), e.fchownSync = i(e.fchownSync), e.lchownSync = i(e.lchownSync), e.chmodSync = t(e.chmodSync), e.fchmodSync = t(e.fchmodSync), e.lchmodSync = t(e.lchmodSync), e.stat = s(e.stat), e.fstat = s(e.fstat), e.lstat = s(e.lstat), e.statSync = d(e.statSync), e.fstatSync = d(e.fstatSync), e.lstatSync = d(e.lstatSync), e.lchmod || (e.lchmod = function (e, n, t) { - t && process.nextTick(t) - }, e.lchmodSync = function () {}), e.lchown || (e.lchown = function (e, n, t, r) { - r && process.nextTick(r) - }, e.lchownSync = function () {}), 'win32' === a && (e.rename = function (n) { - return function (t, r, o) { - var i = Date.now(), - a = 0; - n(t, r, function s(d) { - return d && ('EACCES' === d.code || 'EPERM' === d.code) && 6e4 > Date.now() - i ? (setTimeout(function () { - e.stat(r, function (e) { - e && 'ENOENT' === e.code ? n(t, r, s) : o(d) + } + + function Se(e) { + me ? me.push(e) : fe && e(fe) + } + process, x.app.on("will-finish-launching", () => { + x.app.on("open-url", (e, t) => { + e.preventDefault(), be(t) + }) + }), process.env.GITHUB_DESKTOP_DISABLE_HARDWARE_ACCELERATION && (log.info("GITHUB_DESKTOP_DISABLE_HARDWARE_ACCELERATION environment variable set, disabling hardware acceleration"), x.app.disableHardwareAcceleration()), x.app.on("ready", () => { + _e || we || (de = j() - he, ve.forEach(e => function (e) { + x.app.setAsDefaultProtocolClient(e, process.execPath, ["--protocol-launcher"]) + }(e)), function () { + const e = new D; + 0; + e.onClose(() => { + fe = null, pe || x.app.quit() + }), e.onDidLoad(() => { + e.show(), e.sendLaunchTimingStats({ + mainReadyTime: de, + loadTime: e.loadTime, + rendererReadyTime: e.rendererReadyTime + }); + const t = me; + me = null; + for (const n of t) n(e) + }), e.load(), fe = e + }(), x.Menu.setApplicationMenu(Object(I.buildDefaultMenu)({ + selectedShell: null, + selectedExternalEditor: null, + askForConfirmationOnRepositoryRemoval: !1, + askForConfirmationOnForcePush: !1 + })), x.ipcMain.on("update-preferred-app-menu-item-labels", (e, t) => { + const n = Object(I.buildDefaultMenu)(t), + r = x.Menu.getApplicationMenu(); + if (null === r) return x.Menu.setApplicationMenu(n), void(null !== fe && fe.sendAppMenu()); + let i = !1; + for (const e of Object(I.getAllMenuItems)(n)) { + const t = e.id; + if (!t) continue; + const n = r.getMenuItemById(t); + n ? (n.label !== e.label && (i = !0), n.enabled !== e.enabled && (e.enabled = n.enabled, i = !0)) : i = !0 + } + i && fe && (x.Menu.setApplicationMenu(n), fe.sendAppMenu()) + }), x.ipcMain.on("menu-event", (e, t) => { + const { + name: n + } = e; + fe && fe.sendMenuEvent(n) + }), x.ipcMain.on("execute-menu-item", (e, { + id: t + }) => { + const n = x.Menu.getApplicationMenu(); + if (null === n) return; + const r = n.getMenuItemById(t); + if (r) { + const t = x.BrowserWindow.fromWebContents(e.sender) || void 0, + n = { + preventDefault: () => {}, + sender: e.sender + }; + r.click(n, t, e.sender) + } + }), x.ipcMain.on("update-menu-state", (e, t) => { + let n = !1; + const r = x.Menu.getApplicationMenu(); + if (null !== r) { + for (const e of t) { + const { + id: t, + state: i + } = e, o = r.getMenuItemById(t); + o ? void 0 !== i.enabled && o.enabled !== i.enabled && (o.enabled = i.enabled, n = !0) : M("Unknown menu id: " + t) + } + n && fe && (x.Menu.setApplicationMenu(r), fe.sendAppMenu()) + } else log.debug("unable to get current menu, bailing out...") + }), x.ipcMain.handle("show-contextual-menu", (e, t) => new Promise(n => { + const r = le(t, e => n(e)), + i = x.BrowserWindow.fromWebContents(e.sender) || void 0; + r.popup({ + window: i, + callback: () => n(null) }) - }, a), void(100 > a && (a += 10))) : void(o && o(d)) + })), x.ipcMain.on("get-app-menu", () => { + fe && fe.sendAppMenu() + }), x.ipcMain.on("show-certificate-trust-dialog", (e, { + certificate: t, + message: n + }) => { + Se(e => { + e.showCertificateTrustDialog(t, n) + }) + }), x.ipcMain.on("log", (e, t, n) => { + l(t, n) + }), x.ipcMain.on("uncaught-exception", (e, t) => { + ge(t) + }), x.ipcMain.on("send-error-report", (e, { + error: t, + extra: n, + nonFatal: r + }) => { + ie(t, Object.assign(Object.assign({}, ye()), n), r) + }), x.ipcMain.on("open-external", async (e, { + path: t + }) => { + const n = t.toLowerCase(); + let r; + (n.startsWith("http://") || n.startsWith("https://")) && log.info("opening in browser: " + t); + try { + await x.shell.openExternal(t), r = !0 + } catch (e) { + log.error(`Call to openExternal failed: '${e}'`), r = !1 + } + e.sender.send("open-external-result", { + result: r + }) + }), x.ipcMain.on("show-item-in-folder", (e, { + path: t + }) => { + u.stat(t, e => { + e ? log.error(`Unable to find file at '${t}'`, e) : x.shell.showItemInFolder(t) + }) + }), x.ipcMain.on("show-folder-contents", async (e, { + path: t + }) => { + const n = await Object(s.stat)(t).catch(e => (log.error("Unable to retrieve file information for " + t, e), null)); + if (n) return n.isDirectory() ? void Object(re.a)(t) : (log.error(`Trying to get the folder contents of a non-folder at '${t}'`), void x.shell.showItemInFolder(t)) + })) + }), x.app.on("activate", () => { + Se(e => { + e.show() }) - } - }(e.rename)), e.read = function (n) { - function t(t, r, o, i, a, s) { - var d; - if (s && 'function' == typeof s) { - var l = 0; - d = function (c) { - return c && 'EAGAIN' === c.code && 10 > l ? (l++, n.call(e, t, r, o, i, a, d)) : void s.apply(this, arguments) - } - } - return n.call(e, t, r, o, i, a, d) - } - return t.__proto__ = n, t - }(e.read), e.readSync = function (n) { - return function (t, r, o, i, a) { - for (var s = 0;;) try { - return n.call(e, t, r, o, i, a) - } catch (e) { - if ('EAGAIN' === e.code && 10 > s) { - s++; - continue - } - throw e - } - } - }(e.readSync) - } -}, function (e, n, t) { - function r(e) { - this.logger = e, this.start = Date.now() - } - var o = t(14), - i = t(6), - a = t(47), - s = t(21), - d = t(9), - l = t(45), - c = t(8).Stream, - p = /%[sdj%]/g, - u = n.Logger = function (e) { - o.EventEmitter.call(this), this.configure(e) - }; - i.inherits(u, o.EventEmitter), u.prototype.configure = function (e) { - var n = this; - Array.isArray(this._names) && this._names.length && this.clear(), e = e || {}, this.transports = {}, this._names = [], e.transports && e.transports.forEach(function (e) { - n.add(e, null, !0) - }), this.padLevels = e.padLevels || !1, this.setLevels(e.levels), e.colors && s.addColors(e.colors), this.id = e.id || null, this.level = e.level || 'info', this.emitErrs = e.emitErrs || !1, this.stripColors = e.stripColors || !1, this.exitOnError = !('undefined' != typeof e.exitOnError) || e.exitOnError, this.exceptionHandlers = {}, this.profilers = {}, ['rewriters', 'filters'].forEach(function (t) { - n[t] = Array.isArray(e[t]) ? e[t] : [] - }), e.exceptionHandlers && this.handleExceptions(e.exceptionHandlers) - }, u.prototype.log = function (e) { - function n(e) { - d ? d(e) : s.emitErrs && s.emit('error', e) - } - - function t(n) { - if (d) { - if (n) return d(n); - d(null, e, h, c) - } - d = null, n || s.emit('logged', e, h, c) - } - - function r(n, r) { - var o = s.transports[n]; - o.log(e, h, c, function (n) { - return n ? (n.transport = o, t(n), r()) : void(s.emit('logging', o, e, h, c), r()) - }) - } - for (var o = Array.prototype.slice.call(arguments, 1), s = this; null === o[o.length - 1];) o.pop(); - var d = 'function' == typeof o[o.length - 1] ? o.pop() : null; - if (0 === this._names.length) return n(new Error('Cannot log with no transports.')); - if ('undefined' == typeof s.levels[e]) return n(new Error('Unknown log level: ' + e)); - var l = this._names.filter(function (n) { - var t = s.transports[n]; - return t.level && s.levels[t.level] >= s.levels[e] || !t.level && s.levels[s.level] >= s.levels[e] - }); - if (!l.length) return void(d && d()); - var c = {}, - u = !1, - m = o && o[0] && o[0].match && null !== o[0].match(p), - g = m ? o[0].match(p) : [], - f = g.filter(function (e) { - return '%%' === e - }), - h; - if (0 < o.length - 1 - (g.length - f.length) || 1 === o.length) { - c = o[o.length - 1] || o; - var y = Object.prototype.toString.call(c); - u = '[object Object]' === y || '[object Error]' === y || '[object Array]' === y, c = u ? o.pop() : {} - } - if (h = i.format.apply(null, o), this.padLevels && (h = Array(this.levelLength - e.length + 1).join(' ') + h), this.rewriters.forEach(function (n) { - c = n(e, h, c, s) - }), this.filters.forEach(function (n) { - var t = n(e, h, c, s); - 'string' == typeof t ? h = t : (h = t.msg, c = t.meta) - }), this.stripColors) { - var _ = /\u001b\[(\d+(;\d+)*)?m/g; - h = ('' + h).replace(_, '') - } - return a.forEach(l, r, t), this - }, u.prototype.query = function (e, n) { - function t(n, t) { - e.query && (e.query = n.formatQuery(i)), n.query(e, function (r, o) { - return r ? t(r) : void t(null, n.formatResults(o, e.format)) - }) - } - 'function' == typeof e && (n = e, e = {}); - var r = this, - e = e || {}, - o = {}, - i = d.clone(e.query) || {}, - s; - return e.transport ? (e.transport = e.transport.toLowerCase(), t(this.transports[e.transport], n)) : void(s = this._names.map(function (e) { - return r.transports[e] - }).filter(function (e) { - return !!e.query - }), a.forEach(s, function (e, n) { - t(e, function (t, r) { - n && (r = t || r, r && (o[e.name] = r), n()), n = null - }) - }, function () { - n(null, o) - })) - }, u.prototype.stream = function (e) { - var n = this, - e = e || {}, - t = new c, - r = [], - o; - if (e.transport) { - var i = this.transports[e.transport]; - if (delete e.transport, i && i.stream) return i.stream(e) - } - return t._streams = r, t.destroy = function () { - for (var e = r.length; e--;) r[e].destroy() - }, o = this._names.map(function (e) { - return n.transports[e] - }).filter(function (e) { - return !!e.stream - }), o.forEach(function (n) { - var o = n.stream(e); - o && (r.push(o), o.on('log', function (e) { - e.transport = e.transport || [], e.transport.push(n.name), t.emit('log', e) - }), o.on('error', function (e) { - e.transport = e.transport || [], e.transport.push(n.name), t.emit('error', e) - })) - }), t - }, u.prototype.close = function () { - var e = this; - this._names.forEach(function (n) { - var t = e.transports[n]; - t && t.close && t.close() - }), this.emit('close') - }, u.prototype.handleExceptions = function () { - var e = Array.prototype.slice.call(arguments), - n = [], - t = this; - e.forEach(function (e) { - Array.isArray(e) ? n = n.concat(e) : n.push(e) - }), this.exceptionHandlers = this.exceptionHandlers || {}, n.forEach(function (e) { - t.exceptionHandlers[e.name] = e - }), this._hnames = Object.keys(t.exceptionHandlers), this.catchExceptions || (this.catchExceptions = this._uncaughtException.bind(this), process.on('uncaughtException', this.catchExceptions)) - }, u.prototype.unhandleExceptions = function () { - var e = this; - this.catchExceptions && (Object.keys(this.exceptionHandlers).forEach(function (n) { - var t = e.exceptionHandlers[n]; - t.close && t.close() - }), this.exceptionHandlers = {}, Object.keys(this.transports).forEach(function (n) { - var t = e.transports[n]; - t.handleExceptions && (t.handleExceptions = !1) - }), process.removeListener('uncaughtException', this.catchExceptions), this.catchExceptions = !1) - }, u.prototype.add = function (e, n, t) { - var r = t ? e : new e(n); - if (!r.name && !r.log) throw new Error('Unknown transport with no log() method'); - else if (this.transports[r.name]) throw new Error('Transport already attached: ' + r.name + ', assign a different name'); - return this.transports[r.name] = r, this._names = Object.keys(this.transports), r._onError = this._onError.bind(this, r), t || r.on('error', r._onError), r.handleExceptions && !this.catchExceptions && this.handleExceptions(), this - }, u.prototype.clear = function () { - Object.keys(this.transports).forEach(function (e) { - this.remove({ - name: e - }) - }, this) - }, u.prototype.remove = function (e) { - var n = 'string' == typeof e ? e : e.name || e.prototype.name; - if (!this.transports[n]) throw new Error('Transport ' + n + ' not attached to this instance'); - var t = this.transports[n]; - return delete this.transports[n], this._names = Object.keys(this.transports), t.close && t.close(), t._onError && t.removeListener('error', t._onError), this - }, u.prototype.startTimer = function () { - return new r(this) - }, u.prototype.profile = function (e) { - var n = Date.now(), - t, r, o, i, a; - return this.profilers[e] ? (t = this.profilers[e], delete this.profilers[e], r = Array.prototype.slice.call(arguments), a = 'function' == typeof r[r.length - 1] ? r.pop() : null, i = 'object' == typeof r[r.length - 1] ? r.pop() : {}, o = 2 === r.length ? r[1] : e, i.durationMs = n - t, this.info(o, i, a)) : (this.profilers[e] = n, this) - }, u.prototype.setLevels = function (e) { - return d.setLevels(this, this.levels, e) - }, u.prototype.cli = function () { - return this.padLevels = !0, this.setLevels(s.cli.levels), s.addColors(s.cli.colors), this.transports.console && (this.transports.console.colorize = this.transports.console.colorize || !0, this.transports.console.timestamp = this.transports.console.timestamp || !1), this - }, u.prototype._uncaughtException = function (e) { - function n() { - d && !r && (clearTimeout(s), r = !0, process.exit(1)) - } - var t = this, - r = !1, - o = l.getAllInfo(e), - i = this._getExceptionHandlers(), - s, d; - return d = 'function' == typeof this.exitOnError ? this.exitOnError(e) : this.exitOnError, i && 0 !== i.length ? void(a.forEach(i, function (n, t) { - n.logException('uncaughtException: ' + (e.message || e), o, t, e) - }, n), d && (s = setTimeout(n, 3e3))) : n() - }, u.prototype._getExceptionHandlers = function () { - var e = this; - return this._hnames.map(function (n) { - return e.exceptionHandlers[n] - }).concat(this._names.map(function (n) { - return e.transports[n].handleExceptions && e.transports[n] - })).filter(Boolean) - }, u.prototype._onError = function (e, n) { - this.emitErrs && this.emit('error', n, e) - }, r.prototype.done = function (e) { - var n = Array.prototype.slice.call(arguments), - t = 'function' == typeof n[n.length - 1] ? n.pop() : null, - r = 'object' == typeof n[n.length - 1] ? n.pop() : {}; - return r.duration = Date.now() - this.start + 'ms', this.logger.info(e, r, t) - } -}, function (e, n, t) { - var r = t(9), - o = t(15), - i = t(6)._extend, - a = n.Container = function (e) { - this.loggers = {}, this.options = e || {}, this.default = { - transports: [new o.transports.Console({ - level: 'silly', - colorize: !1 - })] - } - }; - a.prototype.get = a.prototype.add = function (e, n) { - var t = this, - a; - return this.loggers[e] || (n = i({}, n || this.options || this.default), a = n.transports || this.options.transports, n.transports = a ? a.slice() : [], 0 === n.transports.length && (!n || !n.console) && n.transports.push(this.default.transports[0]), Object.keys(n).forEach(function (t) { - if ('transports' !== t) { - var i = r.capitalize(t); - if (!o.transports[i]) throw new Error('Cannot add unknown transport: ' + i); - var a = n[t]; - a.id = e, n.transports.push(new o.transports[i](a)) - } - }), n.id = e, this.loggers[e] = new o.Logger(n), this.loggers[e].on('close', function () { - t._delete(e) - })), this.loggers[e] - }, a.prototype.has = function (e) { - return !!this.loggers[e] - }, a.prototype.close = function (e) { - function n(e) { - t.loggers[e] && (t.loggers[e].close(), t._delete(e)) - } - var t = this; - return e ? n(e) : Object.keys(this.loggers).forEach(function (e) { - n(e) - }) - }, a.prototype._delete = function (e) { - delete this.loggers[e] - } -}, function (e, n) { - function t(e) { - for (var n in e) this[n] = e[n] - } - n.get = function (e) { - var t = Error.stackTraceLimit; - Error.stackTraceLimit = Infinity; - var r = {}, - o = Error.prepareStackTrace; - Error.prepareStackTrace = function (e, n) { - return n - }, Error.captureStackTrace(r, e || n.get); - var i = r.stack; - return Error.prepareStackTrace = o, Error.stackTraceLimit = t, i - }, n.parse = function (e) { - if (!e.stack) return []; - var n = this, - t = e.stack.split('\n').slice(1); - return t.map(function (e) { - if (e.match(/^\s*[-]{4,}$/)) return n._createParsedCallSite({ - fileName: e, - lineNumber: null, - functionName: null, - typeName: null, - methodName: null, - columnNumber: null, - native: null - }); - var t = e.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/); - if (t) { - var r = null, - o = null, - i = null, - a = null, - s = null, - d = 'native' === t[5]; - if (t[1]) { - i = t[1]; - var l = i.lastIndexOf('.'); - if ('.' == i[l - 1] && l--, 0 < l) { - r = i.substr(0, l), o = i.substr(l + 1); - var c = r.indexOf('.Module'); - 0 < c && (i = i.substr(c + 1), r = r.substr(0, c)) - } - a = null - } - o && (a = r, s = o), '' === o && (s = null, i = null); - var p = { - fileName: t[2] || null, - lineNumber: parseInt(t[3], 10) || null, - functionName: i, - typeName: a, - methodName: s, - columnNumber: parseInt(t[4], 10) || null, - native: d - }; - return n._createParsedCallSite(p) - } - }).filter(function (e) { - return !!e - }) - }; - ['this', 'typeName', 'functionName', 'methodName', 'fileName', 'lineNumber', 'columnNumber', 'function', 'evalOrigin'].forEach(function (e) { - t.prototype[e] = null, t.prototype['get' + e[0].toUpperCase() + e.substr(1)] = function () { - return this[e] - } - }), ['topLevel', 'eval', 'native', 'constructor'].forEach(function (e) { - t.prototype[e] = !1, t.prototype['is' + e[0].toUpperCase() + e.substr(1)] = function () { - return this[e] - } - }), n._createParsedCallSite = function (e) { - return new t(e) - } -}, function (e, n, t) { - var r = t(14), - o = t(6), - i = t(9), - a = t(12).Transport, - s = n.Memory = function (e) { - a.call(this, e), e = e || {}, this.errorOutput = [], this.writeOutput = [], this.json = e.json || !1, this.colorize = e.colorize || !1, this.prettyPrint = e.prettyPrint || !1, this.timestamp = 'undefined' != typeof e.timestamp && e.timestamp, this.showLevel = !(e.showLevel !== void 0) || e.showLevel, this.label = e.label || null, this.depth = e.depth || null, this.json && (this.stringify = e.stringify || function (e) { - return JSON.stringify(e, null, 2) - }) - }; - o.inherits(s, a), s.prototype.name = 'memory', s.prototype.log = function (e, n, t, r) { - if (this.silent) return r(null, !0); - var o = this, - a; - a = i.log({ - colorize: this.colorize, - json: this.json, - level: e, - message: n, - meta: t, - stringify: this.stringify, - timestamp: this.timestamp, - prettyPrint: this.prettyPrint, - raw: this.raw, - label: this.label, - depth: this.depth, - formatter: this.formatter, - humanReadableUnhandledException: this.humanReadableUnhandledException - }), 'error' === e || 'debug' === e ? this.errorOutput.push(a) : this.writeOutput.push(a), o.emit('logged'), r(null, !0) - }, s.prototype.clearLogs = function () { - this.errorOutput = [], this.writeOutput = [] - } -}, function (e) { - e.exports = require('https') -}, function (e) { - e.exports = require('http') -}, function (e, n, t) { - var r = t(6), - o = t(15), - i = t(111), - a = t(110), - s = t(8).Stream, - d = t(12).Transport, - l = n.Http = function (e) { - d.call(this, e), e = e || {}, this.name = 'http', this.ssl = !!e.ssl, this.host = e.host || 'localhost', this.port = e.port, this.auth = e.auth, this.path = e.path || '', this.agent = e.agent, this.port || (this.port = this.ssl ? 443 : 80) - }; - r.inherits(l, o.Transport), l.prototype.name = 'http', l.prototype._request = function (e, n) { - e = e || {}; - var t = e.auth || this.auth, - r = e.path || this.path || '', - o; - delete e.auth, delete e.path, o = (this.ssl ? a : i).request({ - host: this.host, - port: this.port, - path: '/' + r.replace(/^\//, ''), - method: 'POST', - headers: { - "Content-Type": 'application/json' - }, - agent: this.agent, - auth: t ? t.username + ':' + t.password : '' - }), o.on('error', n), o.on('response', function (e) { - var t = ''; - e.on('data', function (e) { - t += e - }), e.on('end', function () { - n(null, e, t) - }), e.resume() - }), o.end(new Buffer(JSON.stringify(e), 'utf8')) - }, l.prototype.log = function (e, n, t, r) { - var o = this; - 'function' == typeof t && (r = t, t = {}); - var i = { - method: 'collect', - params: { - level: e, - message: n, - meta: t - } - }; - t && (t.path && (i.path = t.path, delete t.path), t.auth && (i.auth = t.auth, delete t.auth)), this._request(i, function (e, n) { - return n && 200 !== n.statusCode && (e = new Error('HTTP Status Code: ' + n.statusCode)), e ? r(e) : void(o.emit('logged'), r && r(null, !0)) - }) - }, l.prototype.query = function (e, n) { - 'function' == typeof e && (n = e, e = {}); - var t = this, - e = this.normalizeQuery(e); - e = { - method: 'query', - params: e - }, e.params.path && (e.path = e.params.path, delete e.params.path), e.params.auth && (e.auth = e.params.auth, delete e.params.auth), this._request(e, function (e, t, r) { - if (t && 200 !== t.statusCode && (e = new Error('HTTP Status Code: ' + t.statusCode)), e) return n(e); - if ('string' == typeof r) try { - r = JSON.parse(r) - } catch (t) { - return n(t) - } - n(null, r) - }) - }, l.prototype.stream = function (e) { - e = e || {}; - var n = this, - t = new s, - r, o; - return t.destroy = function () { - r.destroy() - }, e = { - method: 'stream', - params: e - }, e.params.path && (e.path = e.params.path, delete e.params.path), e.params.auth && (e.auth = e.params.auth, delete e.params.auth), r = this._request(e), o = '', r.on('data', function (e) { - for (var e = (o + e).split(/\n+/), n = e.length - 1, r = 0; r < n; r++) try { - t.emit('log', JSON.parse(e[r])) - } catch (n) { - t.emit('error', n) - } - o = e[n] - }), r.on('error', function (e) { - t.emit('error', e) - }), t - } -}, function (e, n, t) { - function r(e) { - return e instanceof a.Stream - } - - function o(e) { - return r(e) && 'function' == typeof e._read && 'object' == typeof e._readableState - } - - function i(e) { - return r(e) && 'function' == typeof e._write && 'object' == typeof e._writableState - } - var a = t(8); - e.exports = r, e.exports.isReadable = o, e.exports.isWritable = i, e.exports.isDuplex = function (e) { - return o(e) && i(e) - } -}, function (e, n, t) { - var r = t(14), - o = t(5), - a = t(0), - i = t(6), - s = t(47), - d = t(46), - l = t(9), - c = t(12).Transport, - p = t(113).isWritable, - u = t(8).Stream, - m = t(10), - g = n.File = function (e) { - function n(n) { - Array.prototype.slice.call(arguments, 1).forEach(function (t) { - if (e[t]) throw new Error('Cannot set ' + t + ' and ' + n + 'together') + }), x.app.on("web-contents-created", (e, t) => { + t.on("new-window", (e, t) => { + e.preventDefault(); + const n = "Prevented new window to: " + t; + log.warn(n), ue("newWindowPrevented", Error(n)) + }), t.on("will-navigate", (e, t) => { + e.preventDefault(); + const n = "Prevented navigation to: " + t; + log.warn(n), ue("willNavigatePrevented", Error(n)) }) - } - var t = this; - if (c.call(this, e), e.filename || e.dirname) n('filename or dirname', 'stream'), this._basename = this.filename = e.filename ? a.basename(e.filename) : 'winston.log', this.dirname = e.dirname || a.dirname(e.filename), this.options = e.options || { - flags: 'a' - }, this.options.highWaterMark = this.options.highWaterMark || 24; - else if (e.stream) n('stream', 'filename', 'maxsize'), this._stream = e.stream, this._isStreams2 = p(this._stream), this._stream.on('error', function (e) { - t.emit('error', e) - }), this._stream.setMaxListeners(Infinity); - else throw new Error('Cannot log to file without filename or stream.'); - this.json = !1 !== e.json, this.logstash = e.logstash || !1, this.colorize = e.colorize || !1, this.maxsize = e.maxsize || null, this.rotationFormat = e.rotationFormat || !1, this.zippedArchive = e.zippedArchive || !1, this.maxFiles = e.maxFiles || null, this.prettyPrint = e.prettyPrint || !1, this.label = e.label || null, this.timestamp = null == e.timestamp || e.timestamp, this.eol = e.eol || m.EOL, this.tailable = e.tailable || !1, this.depth = e.depth || null, this.showLevel = void 0 === e.showLevel || e.showLevel, this.maxRetries = e.maxRetries || 2, this.json && (this.stringify = e.stringify), this._size = 0, this._created = 0, this._buffer = [], this._draining = !1, this._opening = !1, this._failures = 0, this._archive = null - }; - i.inherits(g, c), g.prototype.name = 'file', g.prototype.log = function (e, n, t, r) { - if (this.silent) return r(null, !0); - if (this._failures >= this.maxRetries) return r(new Error('Transport is in a failed state.')); - var o = this; - 'string' != typeof n && (n = '' + n); - var i = l.log({ - level: e, - message: n, - meta: t, - json: this.json, - logstash: this.logstash, - colorize: this.colorize, - prettyPrint: this.prettyPrint, - timestamp: this.timestamp, - showLevel: this.showLevel, - stringify: this.stringify, - label: this.label, - depth: this.depth, - formatter: this.formatter, - humanReadableUnhandledException: this.humanReadableUnhandledException - }); - 'string' == typeof i && (i += this.eol), this.filename ? this.open(function (e) { - return e ? o._buffer.push([i, r]) : void(o._write(i, r), o._size += i.length, o._lazyDrain()) - }) : (this._write(i, r), this._size += i.length, this._lazyDrain()) - }, g.prototype._write = function (e, n) { - if (this._isStreams2) return this._stream.write(e), n && process.nextTick(function () { - n(null, !0) - }); - var t = this._stream.write(e); - return n ? !1 === t ? this._stream.once('drain', function () { - n(null, !0) - }) : void process.nextTick(function () { - n(null, !0) - }) : void 0 - }, g.prototype.query = function (e, n) { - function t(e, n) { - try { - var t = JSON.parse(e); - i(t) && r(t) - } catch (t) { - n || p.emit('error', t) - } - } - - function r(n) { - if (e.rows && l.length >= e.rows && 'desc' != e.order) return void(p.readable && p.destroy()); - if (e.fields) { - var t = {}; - e.fields.forEach(function (e) { - t[e] = n[e] - }), n = t - } - 'desc' === e.order && l.length >= e.rows && l.shift(), l.push(n) - } - - function i(n) { - if (n && 'object' == typeof n) { - var t = new Date(n.timestamp); - return !(e.from && t < e.from || e.until && t > e.until) || void 0 - } - } - 'function' == typeof e && (n = e, e = {}); - var s = a.join(this.dirname, this.filename), - e = this.normalizeQuery(e), - d = '', - l = [], - c = 0, - p = o.createReadStream(s, { - encoding: 'utf8' - }); - p.on('error', function (e) { - return p.readable && p.destroy(), n ? 'ENOENT' === e.code ? n(null, l) : n(e) : void 0 - }), p.on('data', function (n) { - for (var n = (d + n).split(/\n+/), r = n.length - 1, o = 0; o < r; o++)(!e.start || c >= e.start) && t(n[o]), c++; - d = n[r] - }), p.on('close', function () { - d && t(d, !0), 'desc' === e.order && (l = l.reverse()), n && n(null, l) - }) - }, g.prototype.stream = function (e) { - var n = a.join(this.dirname, this.filename), - e = e || {}, - t = new u, - r = { - file: n, - start: e.start - }; - return t.destroy = l.tailFile(r, function (e, n) { - if (e) return t.emit('error', e); - try { - t.emit('data', n), n = JSON.parse(n), t.emit('log', n) - } catch (n) { - t.emit('error', n) - } - }), t - }, g.prototype.open = function (e) { - if (this.opening) return e(!0); - return !this._stream || this.maxsize && this._size >= this.maxsize ? (e(!0), this._createStream()) : void(this._archive = this.zippedArchive ? this._stream.path : null, e()) - }, g.prototype.close = function () { - var e = this; - this._stream && (this._stream.end(), this._stream.destroySoon(), this._stream.once('finish', function () { - e.emit('flush'), e.emit('closed') - })) - }, g.prototype.flush = function () { - var e = this; - return this._buffer.length ? void(this._buffer.forEach(function (n) { - var t = n[0], - r = n[1]; - process.nextTick(function () { - e._write(t, r), e._size += t.length - }) - }), e._buffer.length = 0, e._stream.once('drain', function () { - e.emit('flush'), e.emit('logged') - })) : e.emit('flush') - }, g.prototype._createStream = function () { - var e = this; - this.opening = !0, - function n(t) { - function r(n) { - e._stream && (e._stream.end(), e._stream.destroySoon()), e._size = n, e.filename = t, e._stream = o.createWriteStream(s, e.options), e._isStreams2 = p(e._stream), e._stream.on('error', function (n) { - e._failures < e.maxRetries ? (e._createStream(), e._failures++) : e.emit('error', n) - }), e._stream.setMaxListeners(Infinity), e.once('flush', function () { - e.flush(), e.opening = !1, e.emit('open', s) - }), e.flush(), i() - } - - function i() { - if (e._archive) { - var n = d.createGzip(), - t = o.createReadStream(e._archive + ''), - r = o.createWriteStream(e._archive + '.gz'); - t.pipe(n).pipe(r), o.unlink(e._archive + ''), e._archive = '' - } - } - var s = a.join(e.dirname, t); - o.stat(s, function (t, o) { - return t ? 'ENOENT' === t.code ? r(0) : e.emit('error', t) : !o || e.maxsize && o.size >= e.maxsize ? e._incFile(function () { - n(e._getFile()) - }) : void r(o.size) + }), x.app.on("certificate-error", (e, t, n, r, i, o) => { + o(!1), Se(e => { + e.sendCertificateError(i, r, n) }) - }(this._getFile()) - }, g.prototype._incFile = function (e) { - var n = a.extname(this._basename), - t = a.basename(this._basename, n); - this.tailable ? this._checkMaxFilesTailable(n, t, e) : (this._created += 1, this._checkMaxFilesIncrementing(n, t, e)) - }, g.prototype._getFile = function () { - var e = a.extname(this._basename), - n = a.basename(this._basename, e); - return !this.tailable && this._created ? n + (this.rotationFormat ? this.rotationFormat() : this._created) + e : n + e - }, g.prototype._checkMaxFilesIncrementing = function (e, n, t) { - var r = this, - i, s; - return r.zippedArchive && (r._archive = a.join(r.dirname, n + (1 === r._created ? '' : r._created - 1) + e)), !r.maxFiles || r._created < r.maxFiles ? t() : void(i = r._created - r.maxFiles, s = a.join(r.dirname, n + (0 === i ? '' : i) + e + (r.zippedArchive ? '.gz' : '')), o.unlink(s, t)) - }, g.prototype._checkMaxFilesTailable = function (e, n, t) { - var r = [], - d = this; - if (this.maxFiles) { - for (var i = this.maxFiles - 1; 0 < i; i--) r.push(function (t) { - return function (r) { - var i = a.join(d.dirname, n + (t - 1) + e + (d.zippedArchive ? '.gz' : '')); - o.exists(i, function (s) { - return s ? void o.rename(i, a.join(d.dirname, n + t + e + (d.zippedArchive ? '.gz' : '')), r) : r(null) - }) - } - }(i)); - d.zippedArchive && (d._archive = a.join(d.dirname, n + 1 + e)), s.series(r, function () { - o.rename(a.join(d.dirname, n + e), a.join(d.dirname, n + 1 + e), t) - }) - } - }, g.prototype._lazyDrain = function () { - var e = this; - !this._draining && this._stream && (this._draining = !0, this._stream.once('drain', function () { - this._draining = !1, e.emit('logged') - })) - } -}, function (e, n) { - var t = n; - t.levels = { - emerg: 0, - alert: 1, - crit: 2, - error: 3, - warning: 4, - notice: 5, - info: 6, - debug: 7 - }, t.colors = { - emerg: 'red', - alert: 'yellow', - crit: 'red', - error: 'red', - warning: 'red', - notice: 'yellow', - info: 'green', - debug: 'blue' - } -}, function (e, n) { - var t = n; - t.levels = { - error: 0, - warn: 1, - info: 2, - verbose: 3, - debug: 4, - silly: 5 - }, t.colors = { - error: 'red', - warn: 'yellow', - info: 'green', - verbose: 'cyan', - debug: 'blue', - silly: 'magenta' - } -}, function (e, n) { - var t = n; - t.levels = { - error: 0, - warn: 1, - help: 2, - data: 3, - info: 4, - debug: 5, - prompt: 6, - verbose: 7, - input: 8, - silly: 9 - }, t.colors = { - error: 'red', - warn: 'yellow', - help: 'cyan', - data: 'grey', - info: 'green', - debug: 'blue', - prompt: 'grey', - verbose: 'cyan', - input: 'grey', - silly: 'magenta' - } -}, function (e, n, t) { - var r = t(13); - e.exports = function () { - var e = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; - return function (n) { - return ' ' === n ? n : r[e[Math.round(Math.random() * (e.length - 1))]](n) - } - }() -}, function (e, n, t) { - var r = t(13); - e.exports = function () { - var e = ['red', 'yellow', 'green', 'blue', 'magenta']; - return function (n, t) { - return ' ' === n ? n : r[e[t++ % e.length]](n) - } - }() -}, function (e, n, t) { - var r = t(13); - e.exports = function (e, n) { - return 0 == n % 2 ? e : r.inverse(e) - } -}, function (e, n, t) { - var r = t(13); - e.exports = function () { - return function (e, n) { - if (' ' === e) return e; - switch (n % 3) { - case 0: - return r.red(e); - case 1: - return r.white(e); - case 2: - return r.blue(e); - } - } - }() -}, function (e) { - e.exports = function (e) { - function n(e) { - var n = Math.floor(Math.random() * e); - return n - } - - function t(e) { - var n = !1; - return i.filter(function (t) { - n = t === e - }), n - } - - function r(e, r) { - var a = '', - s, c; - for (c in r = r || {}, r.up = r.up || !0, r.mid = r.mid || !0, r.down = r.down || !0, r.size = r.size || 'maxi', e = e.split(''), e) - if (!t(c)) { - switch (a += e[c], s = { - up: 0, - down: 0, - mid: 0 - }, r.size) { - case 'mini': - s.up = n(8), s.min = n(2), s.down = n(8); - break; - case 'maxi': - s.up = n(16) + 3, s.min = n(4) + 1, s.down = n(64) + 3; - break; - default: - s.up = n(8) + 1, s.mid = n(6) / 2, s.down = n(8) + 1; - } - var l = ['up', 'mid', 'down']; - for (var p in l) - for (var d = l[p], u = 0; u <= s[d]; u++) r[d] && (a += o[d][n(o[d].length)]) - } return a - } - e = e || ' he is here '; - var o = { - up: ['\u030D', '\u030E', '\u0304', '\u0305', '\u033F', '\u0311', '\u0306', '\u0310', '\u0352', '\u0357', '\u0351', '\u0307', '\u0308', '\u030A', '\u0342', '\u0313', '\u0308', '\u034A', '\u034B', '\u034C', '\u0303', '\u0302', '\u030C', '\u0350', '\u0300', '\u0301', '\u030B', '\u030F', '\u0312', '\u0313', '\u0314', '\u033D', '\u0309', '\u0363', '\u0364', '\u0365', '\u0366', '\u0367', '\u0368', '\u0369', '\u036A', '\u036B', '\u036C', '\u036D', '\u036E', '\u036F', '\u033E', '\u035B', '\u0346', '\u031A'], - down: ['\u0316', '\u0317', '\u0318', '\u0319', '\u031C', '\u031D', '\u031E', '\u031F', '\u0320', '\u0324', '\u0325', '\u0326', '\u0329', '\u032A', '\u032B', '\u032C', '\u032D', '\u032E', '\u032F', '\u0330', '\u0331', '\u0332', '\u0333', '\u0339', '\u033A', '\u033B', '\u033C', '\u0345', '\u0347', '\u0348', '\u0349', '\u034D', '\u034E', '\u0353', '\u0354', '\u0355', '\u0356', '\u0359', '\u035A', '\u0323'], - mid: ['\u0315', '\u031B', '\u0300', '\u0301', '\u0358', '\u0321', '\u0322', '\u0327', '\u0328', '\u0334', '\u0335', '\u0336', '\u035C', '\u035D', '\u035E', '\u035F', '\u0360', '\u0362', '\u0338', '\u0337', '\u0361', ' \u0489'] - }, - i = [].concat(o.up, o.down, o.mid), - a = {}; - return r(e) - } -}, function (e) { - e.exports = function (e) { - var n = ''; - e = e || 'Run the trap, drop the bass', e = e.split(''); - var t = { - a: ['@', '\u0104', '\u023A', '\u0245', '\u0394', '\u039B', '\u0414'], - b: ['\xDF', '\u0181', '\u0243', '\u026E', '\u03B2', '\u0E3F'], - c: ['\xA9', '\u023B', '\u03FE'], - d: ['\xD0', '\u018A', '\u0500', '\u0501', '\u0502', '\u0503'], - e: ['\xCB', '\u0115', '\u018E', '\u0258', '\u03A3', '\u03BE', '\u04BC', '\u0A6C'], - f: ['\u04FA'], - g: ['\u0262'], - h: ['\u0126', '\u0195', '\u04A2', '\u04BA', '\u04C7', '\u050A'], - i: ['\u0F0F'], - j: ['\u0134'], - k: ['\u0138', '\u04A0', '\u04C3', '\u051E'], - l: ['\u0139'], - m: ['\u028D', '\u04CD', '\u04CE', '\u0520', '\u0521', '\u0D69'], - n: ['\xD1', '\u014B', '\u019D', '\u0376', '\u03A0', '\u048A'], - o: ['\xD8', '\xF5', '\xF8', '\u01FE', '\u0298', '\u047A', '\u05DD', '\u06DD', '\u0E4F'], - p: ['\u01F7', '\u048E'], - q: ['\u09CD'], - r: ['\xAE', '\u01A6', '\u0210', '\u024C', '\u0280', '\u042F'], - s: ['\xA7', '\u03DE', '\u03DF', '\u03E8'], - t: ['\u0141', '\u0166', '\u0373'], - u: ['\u01B1', '\u054D'], - v: ['\u05D8'], - w: ['\u0428', '\u0460', '\u047C', '\u0D70'], - x: ['\u04B2', '\u04FE', '\u04FC', '\u04FD'], - y: ['\xA5', '\u04B0', '\u04CB'], - z: ['\u01B5', '\u0240'] - }; - return e.forEach(function (e) { - e = e.toLowerCase(); - var r = t[e] || [' '], - o = Math.floor(Math.random() * r.length); - n += 'undefined' == typeof t[e] ? e : t[e][o] - }), n - } -}, function (e) { - function n(n) { - var t = new Error('Cannot find module "' + n + '".'); - throw t.code = 'MODULE_NOT_FOUND', t - } - n.keys = function () { - return [] - }, n.resolve = n, e.exports = n, n.id = 124 -}, function (e) { - var n = process.argv; - e.exports = function () { - return -1 === n.indexOf('--no-color') && -1 === n.indexOf('--color=false') && (!(-1 === n.indexOf('--color') && -1 === n.indexOf('--color=true') && -1 === n.indexOf('--color=always')) || !process.stdout || process.stdout.isTTY) - }() -}, function (e) { - var n = {}; - e.exports = n; - var t = { - reset: [0, 0], - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29], - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], - grey: [90, 39], - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - blackBG: [40, 49], - redBG: [41, 49], - greenBG: [42, 49], - yellowBG: [43, 49], - blueBG: [44, 49], - magentaBG: [45, 49], - cyanBG: [46, 49], - whiteBG: [47, 49] - }; - Object.keys(t).forEach(function (e) { - var r = t[e], - o = n[e] = []; - o.open = '\x1B[' + r[0] + 'm', o.close = '\x1B[' + r[1] + 'm' - }) -}, function (e, n, t) { - var r = t(13); - e.exports = r -}, function (e) { - e.exports = require('string_decoder') -}, function (module, exports) { - var cycle = exports; - cycle.decycle = function (e) { - 'use strict'; - var n = [], - t = []; - return function e(r, o) { - var a, i, s; - if ('object' == typeof r && null !== r && !(r instanceof Boolean) && !(r instanceof Date) && !(r instanceof Number) && !(r instanceof RegExp) && !(r instanceof String)) { - for (a = 0; a < n.length; a += 1) - if (n[a] === r) return { - $ref: t[a] - }; - if (n.push(r), t.push(o), '[object Array]' === Object.prototype.toString.apply(r)) - for (s = [], a = 0; a < r.length; a += 1) s[a] = e(r[a], o + '[' + a + ']'); - else - for (i in s = {}, r) Object.prototype.hasOwnProperty.call(r, i) && (s[i] = e(r[i], o + '[' + JSON.stringify(i) + ']')); - return s - } - return r - }(e, '$') - }, cycle.retrocycle = function ($) { - 'use strict'; - var px = /^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/; - return function rez(value) { - var i, item, name, path; - if (value && 'object' == typeof value) - if ('[object Array]' === Object.prototype.toString.apply(value)) - for (i = 0; i < value.length; i += 1) item = value[i], item && 'object' == typeof item && (path = item.$ref, 'string' == typeof path && px.test(path) ? value[i] = eval(path) : rez(item)); - else - for (name in value) 'object' == typeof value[name] && (item = value[name], item && (path = item.$ref, 'string' == typeof path && px.test(path) ? value[name] = eval(path) : rez(item))) - }($), $ - } -}, function (e) { - e.exports = require('crypto') -}, function (e, n, t) { - var r = t(14), - o = t(10), - i = t(6), - a = t(9), - s = t(12).Transport, - d = n.Console = function (e) { - s.call(this, e), e = e || {}, this.json = e.json || !1, this.colorize = e.colorize || !1, this.prettyPrint = e.prettyPrint || !1, this.timestamp = 'undefined' != typeof e.timestamp && e.timestamp, this.showLevel = !(e.showLevel !== void 0) || e.showLevel, this.label = e.label || null, this.logstash = e.logstash || !1, this.depth = e.depth || null, this.align = e.align || !1, this.stderrLevels = function (e, n) { - var t = 'Cannot have non-string elements in stderrLevels Array'; - if (n) { - if (e) throw new Error('Cannot set debugStdout and stderrLevels together'); - return a.stringArrayToSet(['error'], t) - } - if (!e) return a.stringArrayToSet(['error', 'debug'], t); - if (!Array.isArray(e)) throw new Error('Cannot set stderrLevels to type other than Array'); - return a.stringArrayToSet(e, t) - }(e.stderrLevels, e.debugStdout), this.eol = e.eol || o.EOL, this.json && (this.stringify = e.stringify || function (e) { - return JSON.stringify(e, null, 2) - }) - }; - i.inherits(d, s), d.prototype.name = 'console', d.prototype.log = function (e, n, t, r) { - if (this.silent) return r(null, !0); - var o = this, - i; - i = a.log({ - colorize: this.colorize, - json: this.json, - level: e, - message: n, - meta: t, - stringify: this.stringify, - timestamp: this.timestamp, - showLevel: this.showLevel, - prettyPrint: this.prettyPrint, - raw: this.raw, - label: this.label, - logstash: this.logstash, - depth: this.depth, - formatter: this.formatter, - align: this.align, - humanReadableUnhandledException: this.humanReadableUnhandledException - }), this.stderrLevels[e] ? process.stderr.write(i + this.eol) : process.stdout.write(i + this.eol), o.emit('logged'), r(null, !0) - } -}, function (e, n, t) { - Object.defineProperty(n, 'Console', { - configurable: !0, - enumerable: !0, - get: function () { - return t(131).Console - } - }), Object.defineProperty(n, 'File', { - configurable: !0, - enumerable: !0, - get: function () { - return t(114).File - } - }), Object.defineProperty(n, 'Http', { - configurable: !0, - enumerable: !0, - get: function () { - return t(112).Http - } - }), Object.defineProperty(n, 'Memory', { - configurable: !0, - enumerable: !0, - get: function () { - return t(109).Memory - } - }) -}, function (e) { - e.exports = { - name: 'winston', - description: 'A multi-transport async logging library for Node.js', - version: '2.3.1', - author: 'Charlie Robbins ', - maintainers: ['Jarrett Cruger ', 'Alberto Pose '], - repository: { - type: 'git', - url: 'https://github.com/winstonjs/winston.git' - }, - keywords: ['winston', 'logging', 'sysadmin', 'tools'], - dependencies: { - async: '~1.0.0', - colors: '1.0.x', - cycle: '1.0.x', - eyes: '0.1.x', - isstream: '0.1.x', - "stack-trace": '0.0.x' - }, - devDependencies: { - "cross-spawn-async": '^2.0.0', - hock: '1.x.x', - "std-mocks": '~1.0.0', - vows: '0.7.x' - }, - main: './lib/winston', - scripts: { - test: 'vows --spec --isolate' - }, - engines: { - node: '>= 0.10.0' - }, - license: 'MIT' - } -}, function (e, n, t) { - 'use strict'; - Object.defineProperty(n, '__esModule', { - value: !0 - }); - const r = t(48), - o = t(82), - i = global; - i.log = { - error(e, n) { - r.log('error', '[main] ' + o.formatLogMessage(e, n)) - }, - warn(e, n) { - r.log('warn', '[main] ' + o.formatLogMessage(e, n)) - }, - info(e, n) { - r.log('info', '[main] ' + o.formatLogMessage(e, n)) - }, - debug(e, n) { - r.log('debug', '[main] ' + o.formatLogMessage(e, n)) - } - } -}, function (e, n, t) { - 'use strict'; - - function r(e) { - P = !0; - const n = null === L; - L && (L.destroy(), L = null), C.showUncaughtException(n, e) - } - - function o() { - return (E.now() - O) / 1e3 - } - - function i() { - return { - uptime: o().toFixed(3), - time: new Date().toString() - } - } - - function a(e) { - log.info('Processing protocol url'); - const n = y.parseAppURL(e); - c((e) => { - e.focus(), e.sendURLAction(n) - }) - } - - function s(e) { - log.info(`Received possible protocol arguments: ${e.length}`); { - const n = e.filter((e) => { - try { - const n = m.parse(e); - return n.protocol && A.has(n.protocol.slice(0, -1)) - } catch (n) { - return log.error(`Unable to parse argument as URL: ${e}`), !1 - } - }); - e.includes(N) && 1 === n.length ? a(n[0]) : log.error(`Malformed launch arguments received: ${e}`) - } - } - - function d(e) { - p.app.setAsDefaultProtocolClient(e, process.execPath, [N]) - } - - function l() { - const e = new g.AppWindow; - !1, e.onClose(() => { - L = null, P || p.app.quit() - }), e.onDidLoad(() => { - e.show(), e.sendLaunchTimingStats({ - mainReadyTime: F, - loadTime: e.loadTime, - rendererReadyTime: e.rendererReadyTime - }); - const n = T; - T = null; - for (const t of n) t(e) - }), e.load(), L = e - } - - function c(e) { - T ? T.push(e) : L && e(L) - } - Object.defineProperty(n, '__esModule', { - value: !0 - }), t(134); - const p = t(4), - u = t(5), - m = t(18), - g = t(71), - f = t(25), - h = t(58), - y = t(57), - _ = t(55), - b = t(27), - S = t(48), - w = t(23), - v = t(53), - x = t(33), - E = t(26), - C = t(52), - k = t(50), - M = t(49); - p.app.setAppLogsPath(), x.enableSourceMaps(); - let L = null; - const O = E.now(); - let P = !1, - F = null, - T = []; - const N = '--protocol-launcher', - A = new Set(['x-github-client']); - A.add('x-github-desktop-auth'), A.add('github-windows'), p.app.on('window-all-closed', () => {}), process.on('uncaughtException', (e) => { - e = x.withSourceMappedStack(e), v.reportError(e, i()), r(e) - }); - let R = !1; - if (1 < process.argv.length) { - const n = process.argv[1], - e = _.handleSquirrelEvent(n); - e ? (R = !0, e.catch((t) => { - log.error(`Failed handling Squirrel event: ${n}`, t) - }).then(() => { - p.app.quit() - })) : s(process.argv) - } - let I = !1; - if (!R) { - const e = p.app.requestSingleInstanceLock(); - I = !e, p.app.on('second-instance', (e, n) => { - L && (L.isMinimized() && L.restore(), !L.isVisible() && L.show(), L.focus()), s(n) - }), I && p.app.quit() - } - h.shellNeedsPatching(process) && h.updateEnvironmentForProcess(), p.app.on('will-finish-launching', () => { - p.app.on('open-url', (e, n) => { - e.preventDefault(), a(n) - }) - }), !1, process.env.GITHUB_DESKTOP_DISABLE_HARDWARE_ACCELERATION && (log.info(`GITHUB_DESKTOP_DISABLE_HARDWARE_ACCELERATION environment variable set, disabling hardware acceleration`), p.app.disableHardwareAcceleration()), p.app.on('ready', () => { - I || R || (F = E.now() - O, A.forEach((e) => d(e)), l(), p.Menu.setApplicationMenu(f.buildDefaultMenu({ - selectedShell: null, - selectedExternalEditor: null, - askForConfirmationOnRepositoryRemoval: !1, - askForConfirmationOnForcePush: !1 - })), p.ipcMain.on('update-preferred-app-menu-item-labels', (e, n) => { - const t = f.buildDefaultMenu(n), - r = p.Menu.getApplicationMenu(); - if (null === r) return p.Menu.setApplicationMenu(t), void(null !== L && L.sendAppMenu()); - let o = !1; - for (const i of f.getAllMenuItems(t)) { - const e = i.id; - if (!e) continue; - const n = r.getMenuItemById(e); - n ? (n.label !== i.label && (o = !0), n.enabled !== i.enabled && (i.enabled = n.enabled, o = !0)) : o = !0 - } - o && L && (p.Menu.setApplicationMenu(t), L.sendAppMenu()) - }), p.ipcMain.on('menu-event', (e) => { - const { - name: n - } = e; - L && L.sendMenuEvent(n) - }), p.ipcMain.on('execute-menu-item', (e, { - id: n - }) => { - const t = p.Menu.getApplicationMenu(); - if (null !== t) { - const r = t.getMenuItemById(n); - if (r) { - const n = p.BrowserWindow.fromWebContents(e.sender), - t = { - preventDefault: () => {}, - sender: e.sender - }; - r.click(t, n, e.sender) - } - } - }), p.ipcMain.on('update-menu-state', (e, n) => { - let t = !1; - const r = p.Menu.getApplicationMenu(); - if (null === r) return void log.debug(`unable to get current menu, bailing out...`); - for (const o of n) { - const { - id: e, - state: n - } = o, i = r.getMenuItemById(e); - i ? n.enabled !== void 0 && i.enabled !== n.enabled && (i.enabled = n.enabled, t = !0) : b.fatalError(`Unknown menu id: ${e}`) - } - t && L && (p.Menu.setApplicationMenu(r), L.sendAppMenu()) - }), p.ipcMain.on('show-contextual-menu', (e, n) => { - const t = k.buildContextMenu(n, (n) => e.sender.send('contextual-menu-action', n)), - r = p.BrowserWindow.fromWebContents(e.sender); - t.popup({ - window: r - }) - }), p.ipcMain.on('get-app-menu', () => { - L && L.sendAppMenu() - }), p.ipcMain.on('show-certificate-trust-dialog', (e, { - certificate: n, - message: t - }) => { - c((e) => { - e.showCertificateTrustDialog(n, t) - }) - }), p.ipcMain.on('log', (e, n, t) => { - S.log(n, t) - }), p.ipcMain.on('uncaught-exception', (e, n) => { - r(n) - }), p.ipcMain.on('send-error-report', (e, { - error: n, - extra: t, - nonFatal: r - }) => { - v.reportError(n, Object.assign({}, i(), t), r) - }), p.ipcMain.on('open-external', async (e, { - path: n - }) => { - const t = n.toLowerCase(); - (t.startsWith('http://') || t.startsWith('https://')) && log.info(`opening in browser: ${n}`); - let r; - try { - await p.shell.openExternal(n), r = !0 - } catch (n) { - log.error(`Call to openExternal failed: '${n}'`), r = !1 - } - e.sender.send('open-external-result', { - result: r - }) - }), p.ipcMain.on('show-item-in-folder', (e, { - path: n - }) => { - u.stat(n, (e, t) => e ? void log.error(`Unable to find file at '${n}'`, e) : void(t.isDirectory() ? w.openDirectorySafe(n) : p.shell.showItemInFolder(n))) - })) - }), p.app.on('activate', () => { - c((e) => { - e.show() - }) - }), p.app.on('web-contents-created', (e, n) => { - n.on('new-window', (e, n) => { - e.preventDefault(); - const t = `Prevented new window to: ${n}`; - log.warn(t), M.sendNonFatalException('newWindowPrevented', Error(t)) - }), n.on('will-navigate', (e, n) => { - e.preventDefault(); - const t = `Prevented navigation to: ${n}`; - log.warn(t), M.sendNonFatalException('willNavigatePrevented', Error(t)) - }) - }), p.app.on('certificate-error', (e, n, t, r, o, i) => { - i(!1), c((e) => { - e.sendCertificateError(o, r, t) }) - }) }]); //# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/renderer.js b/renderer.js index 3da2796..a52f61d 100644 --- a/renderer.js +++ b/renderer.js @@ -1,3746 +1,4098 @@ module.exports = function (e) { - function t(o) { - if (n[o]) return n[o].exports; - var r = n[o] = { - i: o, + var t = {}; + + function n(r) { + if (t[r]) return t[r].exports; + var i = t[r] = { + i: r, l: !1, exports: {} }; - return e[o].call(r.exports, r, r.exports, t), r.l = !0, r.exports + return e[r].call(i.exports, i, i.exports, n), i.l = !0, i.exports } - var n = {}; - return t.m = e, t.c = n, t.d = function (e, n, o) { - t.o(e, n) || Object.defineProperty(e, n, { - configurable: !1, + return n.m = e, n.c = t, n.d = function (e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, - get: o + get: r }) - }, t.r = function (e) { - Object.defineProperty(e, '__esModule', { + }, n.r = function (e) { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { + value: "Module" + }), Object.defineProperty(e, "__esModule", { value: !0 }) - }, t.n = function (e) { - var n = e && e.__esModule ? function () { - return e['default'] + }, n.t = function (e, t) { + if (1 & t && (e = n(e)), 8 & t) return e; + if (4 & t && "object" == typeof e && e && e.__esModule) return e; + var r = Object.create(null); + if (n.r(r), Object.defineProperty(r, "default", { + enumerable: !0, + value: e + }), 2 & t && "string" != typeof e) + for (var i in e) n.d(r, i, function (t) { + return e[t] + }.bind(null, i)); + return r + }, n.n = function (e) { + var t = e && e.__esModule ? function () { + return e.default } : function () { return e }; - return t.d(n, 'a', n), n - }, t.o = function (e, t) { + return n.d(t, "a", t), t + }, n.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) - }, t.p = '', t(t.s = 804) + }, n.p = "", n(n.s = 308) }([function (e, t, n) { - 'use strict'; - e.exports = n(790) -}, function (e) { - e.exports = require('path') + "use strict"; + e.exports = n(148) }, function (e, t) { - 'use strict'; - - function n(e) { - throw new Error(e) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), t.fatalError = n, t.assertNever = function (e, t) { - throw new Error(t) - }, t.forceUnwrap = function (e, t) { - return null == t ? n(e) : t - } -}, function (e, t, n) { - 'use strict'; - - function o(e) { - for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), o(n(510)), o(n(509)), o(n(507)), o(n(207)), o(n(7)), o(n(506)) + e.exports = require("path") }, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); - var o = n(627); - t.Octicon = o.Octicon; - var r = n(233); - t.OcticonSymbol = r.OcticonSymbol; - var i = n(626); - t.iconForRepository = i.iconForRepository; - var a = n(625); - t.iconForStatus = a.iconForStatus + var r = n(220); + t.GitProcess = r.GitProcess; + var i = n(104); + t.GitError = i.GitError, t.RepositoryDoesNotExistErrorCode = i.RepositoryDoesNotExistErrorCode, t.GitNotFoundErrorCode = i.GitNotFoundErrorCode +}, function (e, t, n) { + "use strict"; + e.exports = Object.assign({}, n(95), n(97), n(101), n(175), n(177), n(183), n(17), n(190), n(191), n(192), n(21), n(45)); + const r = n(7); + Object.getOwnPropertyDescriptor(r, "promises") && Object.defineProperty(e.exports, "promises", { + get: () => r.promises + }) }, function (e, t) { - var n, o; + e.exports = require("electron") +}, function (e, t, n) { + var r; /*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ - (function () { - 'use strict'; + ! function () { + "use strict"; + var n = {}.hasOwnProperty; - function r() { - for (var e = [], t = 0, n; t < arguments.length; t++) - if (n = arguments[t], n) { - var o = typeof n; - if ('string' === o || 'number' === o) e.push(n); - else if (Array.isArray(n)) e.push(r.apply(null, n)); - else if ('object' === o) - for (var a in n) i.call(n, a) && n[a] && e.push(a) - } return e.join(' ') - } - var i = {}.hasOwnProperty; - 'undefined' != typeof e && e.exports ? e.exports = r : (n = [], o = function () { - return r - }.apply(t, n), !(o !== void 0 && (e.exports = o))) - })() -}, function (e, t, n) { - 'use strict'; - t.__esModule = !0; - var o = n(139), - r = function (e) { - return e && e.__esModule ? e : { - default: e - } - }(o); - t.default = r.default || function (e) { - for (var t = 1, n; t < arguments.length; t++) - for (var o in n = arguments[t], n) Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]); - return e - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5), - i = n(12); - class a extends o.Component { - constructor() { - super(...arguments), this.onOkButtonClick = (e) => { - this.props.onOkButtonClick !== void 0 && this.props.onOkButtonClick(e); - e.defaultPrevented || !0 === this.props.destructive && (e.preventDefault(), e.currentTarget.form && e.currentTarget.form.dispatchEvent(new Event('submit'))) - }, this.onCancelButtonClick = (e) => { - this.props.onCancelButtonClick !== void 0 && this.props.onCancelButtonClick(e); - e.defaultPrevented || !0 === this.props.destructive && (e.preventDefault(), e.currentTarget.form && e.currentTarget.form.dispatchEvent(new Event('reset'))) - } - } - renderOkButton() { - return o.createElement(i.Button, { - onClick: this.onOkButtonClick, - disabled: this.props.okButtonDisabled, - tooltip: this.props.okButtonTitle, - type: !0 === this.props.destructive ? 'button' : 'submit' - }, this.props.okButtonText || '确定') - } - renderCancelButton() { - return !1 === this.props.cancelButtonVisible ? null : o.createElement(i.Button, { - onClick: this.onCancelButtonClick, - disabled: this.props.cancelButtonDisabled, - tooltip: this.props.cancelButtonTitle, - type: !0 === this.props.destructive ? 'submit' : 'reset' - }, this.props.cancelButtonText || '取消') - } - renderButtons() { - return o.createElement(o.Fragment, null, this.renderOkButton(), this.renderCancelButton()) - } - render() { - const e = r('button-group', this.props.className, { - destructive: !0 === this.props.destructive - }); - return o.createElement('div', { - className: e - }, this.renderButtons(), this.props.children) - } - } - t.OkCancelButtonGroup = a -}, function (e, t) { - 'use strict'; - t.__esModule = !0, t.default = function (e, t) { - if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function') - } -}, function (e, t, n) { - 'use strict'; - t.__esModule = !0; - var o = n(231), - r = function (e) { - return e && e.__esModule ? e : { - default: e + function i() { + for (var e = [], t = 0; t < arguments.length; t++) { + var r = arguments[t]; + if (r) { + var o = typeof r; + if ("string" === o || "number" === o) e.push(r); + else if (Array.isArray(r)) e.push(i.apply(null, r)); + else if ("object" === o) + for (var s in r) n.call(r, s) && r[s] && e.push(s) + } } - }(o); - t.default = function () { - function e(e, t) { - for (var n = 0, o; n < t.length; n++) o = t[n], o.enumerable = o.enumerable || !1, o.configurable = !0, 'value' in o && (o.writable = !0), (0, r.default)(e, o.key, o) - } - return function (t, n, o) { - return n && e(t.prototype, n), o && e(t, o), t + return e.join(" ") } + e.exports ? e.exports = i : void 0 === (r = function () { + return i + }.apply(t, [])) || (e.exports = r) }() }, function (e, t, n) { - 'use strict'; + "use strict"; + Object.defineProperty(t, "__esModule", { + value: !0 + }), + function (e) { + for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) + }(n(218)) +}, function (e, t) { + e.exports = require("fs") +}, function (e, t) { + e.exports = require("child_process") +}, function (e, t) { + e.exports = require("url") +}, , function (e, t, n) { + (function () { + t.Emitter = n(152), t.Disposable = n(60), t.CompositeDisposable = n(153) + }).call(this) +}, function (e, t, n) { + (function (e) { + e.exports = function () { + "use strict"; + var t, n; - function o(e) { - const t = e.headers.get('Link'); - if (!t) return null; - for (const n of t.split(',')) { - const e = n.match(/<([^>]+)>; rel="([^"]+)"/); - if (e && 'next' === e[2]) { - const t = u.parse(e[1]); - return t.path || null + function r() { + return t.apply(null, arguments) } - } - return null - } - function r(e) { - const t = o(e); - if (!t) return null; - const { - pathname: n, - query: r - } = u.parse(t, !0), { - per_page: i, - page: a - } = r, s = 'string' == typeof i ? parseInt(i, 10) : NaN, d = 'string' == typeof a ? parseInt(a, 10) : NaN; - if (!s || !d) return t; - const l = (d - 1) * s, - c = Math.min(100, 2 * s); - return s !== c && 0 == l % c ? (r.per_page = `${c}`, r.page = `${l/c+1}`, u.format({ - pathname: n, - query: r - })) : t - } + function i(e) { + return e instanceof Array || "[object Array]" === Object.prototype.toString.call(e) + } - function i(e) { - return e.toISOString().replace(/\.\d{3}Z$/, 'Z') - } - async function a(e, t, n, o) { - const r = Buffer.from(`${t}:${n}`, 'utf8').toString('base64'), - i = `Basic ${r}`, - a = o ? { - "X-GitHub-OTP": o - } : {}, - d = await s(), - l = await h.request(e, null, 'POST', 'authorizations', { - scopes: c(e), - client_id: v, - client_secret: E, - note: d, - note_url: _, - fingerprint: g.uuid() - }, Object.assign({ - Authorization: i - }, a)); - try { - const e = await h.parsedResponse(l); - if (e) { - const t = e.token; - if (t && 'string' == typeof t && t.length) return { - kind: P.Authorized, - token: t - } + function o(e) { + return null != e && "[object Object]" === Object.prototype.toString.call(e) } - } catch (t) { - if (401 === l.status) { - const e = l.headers.get('x-github-otp'); - if (e) { - const t = e.split(';'); - if (2 === t.length) { - const e = t[1].trim(); - return 'app' === e ? { - kind: P.TwoFactorAuthenticationRequired, - type: f.AuthenticationMode.App - } : 'sms' === e ? { - kind: P.TwoFactorAuthenticationRequired, - type: f.AuthenticationMode.Sms - } : { - kind: P.Failed, - response: l - } - } - } - return { - kind: P.Failed, - response: l - } + + function s(e) { + return void 0 === e } - const e = t instanceof h.APIError && t.apiError; - if (e) { - if (403 === l.status && 'This API can only be accessed with username and password Basic Auth' === e.message) return { - kind: P.PersonalAccessTokenBlocked - }; - if (410 === l.status) return { - kind: P.WebFlowRequired - }; - if (422 === l.status) - if (e.errors) - for (const t of e.errors) { - const e = 'oauthaccess' === t.resource.toLowerCase(), - n = 'user' === t.field.toLowerCase(); - if (n && e) return { - kind: P.UserRequiresVerification - } - } else if ('Invalid OAuth application client_id or secret.' === e.message) return { - kind: P.EnterpriseTooOld - } + + function a(e) { + return "number" == typeof e || "[object Number]" === Object.prototype.toString.call(e) } - } - return { - kind: P.Error, - response: l - } - } - async function s() { - let t = 'unknown'; - try { - t = await b() - } catch (n) { - log.error(`getNote: unable to resolve machine username, using '${t}' as a fallback`, n) - } - return `GitHub Desktop on ${t}@${p.hostname()}` - } - function d(e) { - if (e === l() && !C) return 'https://github.com'; - else { - const t = u.parse(e); - return `${t.protocol}//${t.hostname}` - } - } + function l(e) { + return e instanceof Date || "[object Date]" === Object.prototype.toString.call(e) + } - function l() { - return C && 0 < C.length ? C : 'https://api.github.com' - } + function c(e, t) { + var n, r = []; + for (n = 0; n < e.length; ++n) r.push(t(e[n], n)); + return r + } - function c(e) { - return e === l() ? w : k - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const p = n(63), - u = n(42), - m = n(136), - h = n(179), - f = n(178), - g = n(106), - y = n(105), - S = n(135), - C = process.env.DESKTOP_GITHUB_DOTCOM_API_ENDPOINT, - b = n(773), - v = 'de0e3c7e9973e1c4dd77', - E = '1273305a5fc2737c2ca2911948ba24a9d961e2a3'; - v.length && E && E.length || log.warn(`DESKTOP_OAUTH_CLIENT_ID and/or DESKTOP_OAUTH_CLIENT_SECRET is undefined. You won't be able to authenticate new users.`); - const w = ['repo', 'user', 'workflow'], - k = ['repo', 'user']; - var T; - (function (e) { - e[e.NotModified = 304] = 'NotModified', e[e.NotFound = 404] = 'NotFound' - })(T || (T = {})); - const _ = 'https://desktop.github.com/'; - class R extends Error {} - t.MaxResultsError = R, t.getNextPagePathWithIncreasingPageSize = r; - class x { - static fromAccount(e) { - return new x(e.endpoint, e.token) - } - constructor(e, t) { - this.endpoint = e, this.token = t - } - async fetchRepository(t, n) { - try { - const e = await this.request('GET', `repos/${t}/${n}`); - return e.status === T.NotFound ? (log.warn(`fetchRepository: '${t}/${n}' returned a 404`), null) : await h.parsedResponse(e) - } catch (o) { - return log.warn(`fetchRepository: an error occurred for '${t}/${n}'`, o), null + function u(e, t) { + return Object.prototype.hasOwnProperty.call(e, t) } - } - async fetchRepositories() { - try { - const e = await this.fetchAll('user/repos'); - return e.filter((e) => null !== e.owner) - } catch (e) { - return log.warn(`fetchRepositories: ${e}`), null + + function h(e, t) { + for (var n in t) u(t, n) && (e[n] = t[n]); + return u(t, "toString") && (e.toString = t.toString), u(t, "valueOf") && (e.valueOf = t.valueOf), e } - } - async fetchAccount() { - try { - const e = await this.request('GET', 'user'), - t = await h.parsedResponse(e); - return t - } catch (t) { - throw log.warn(`fetchAccount: failed with endpoint ${this.endpoint}`, t), t + + function p(e, t, n, r) { + return Et(e, t, n, r, !0).utc() } - } - async fetchEmails() { - try { - const e = await this.request('GET', 'user/emails'), - t = await h.parsedResponse(e); - return Array.isArray(t) ? t : [] - } catch (t) { - return log.warn(`fetchEmails: failed with endpoint ${this.endpoint}`, t), [] + + function d(e) { + return null == e._pf && (e._pf = { + empty: !1, + unusedTokens: [], + unusedInput: [], + overflow: -2, + charsLeftOver: 0, + nullInput: !1, + invalidMonth: null, + invalidFormat: !1, + userInvalidated: !1, + iso: !1, + parsedDateParts: [], + meridiem: null, + rfc2822: !1, + weekdayMismatch: !1 + }), e._pf } - } - async fetchCommit(t, n, o) { - try { - const e = `repos/${t}/${n}/commits/${o}`, - r = await this.request('GET', e); - return r.status === T.NotFound ? (log.warn(`fetchCommit: '${e}' returned a 404`), null) : await h.parsedResponse(r) - } catch (r) { - return log.warn(`fetchCommit: returned an error '${t}/${n}@${o}'`, r), null + + function f(e) { + if (null == e._isValid) { + var t = d(e), + r = n.call(t.parsedDateParts, (function (e) { + return null != e + })), + i = !isNaN(e._d.getTime()) && t.overflow < 0 && !t.empty && !t.invalidMonth && !t.invalidWeekday && !t.weekdayMismatch && !t.nullInput && !t.invalidFormat && !t.userInvalidated && (!t.meridiem || t.meridiem && r); + if (e._strict && (i = i && 0 === t.charsLeftOver && 0 === t.unusedTokens.length && void 0 === t.bigHour), null != Object.isFrozen && Object.isFrozen(e)) return i; + e._isValid = i + } + return e._isValid } - } - async searchForUserWithEmail(t) { - if (0 === t.length) return null; - try { - const e = { - q: `${t} in:email type:user` - }, - n = h.urlWithQueryString('search/users', e), - o = await this.request('GET', n), - r = await h.parsedResponse(o), - i = r.items; - return i.length ? i[0] : null - } catch (n) { - return log.warn(`searchForUserWithEmail: not found '${t}'`, n), null + + function m(e) { + var t = p(NaN); + return null != e ? h(d(t), e) : d(t).userInvalidated = !0, t } - } - async fetchOrgs() { - try { - return await this.fetchAll('user/orgs') - } catch (t) { - return log.warn(`fetchOrgs: failed with endpoint ${this.endpoint}`, t), [] + n = Array.prototype.some ? Array.prototype.some : function (e) { + for (var t = Object(this), n = t.length >>> 0, r = 0; r < n; r++) + if (r in t && e.call(this, t[r], r, t)) return !0; + return !1 + }; + var g = r.momentProperties = []; + + function y(e, t) { + var n, r, i; + if (s(t._isAMomentObject) || (e._isAMomentObject = t._isAMomentObject), s(t._i) || (e._i = t._i), s(t._f) || (e._f = t._f), s(t._l) || (e._l = t._l), s(t._strict) || (e._strict = t._strict), s(t._tzm) || (e._tzm = t._tzm), s(t._isUTC) || (e._isUTC = t._isUTC), s(t._offset) || (e._offset = t._offset), s(t._pf) || (e._pf = d(t)), s(t._locale) || (e._locale = t._locale), g.length > 0) + for (n = 0; n < g.length; n++) s(i = t[r = g[n]]) || (e[r] = i); + return e } - } - async createRepository(t, e, n, o) { - try { - const r = t ? `orgs/${t.login}/repos` : 'user/repos', - i = await this.request('POST', r, { - name: e, - description: n, - private: o - }); - return await h.parsedResponse(i) - } catch (n) { - if (n instanceof h.APIError) { - if (null !== t) throw new Error(`Unable to create repository for organization '${t.login}'. Verify that the repository does not already exist and that you have permission to create a repository there.`); - throw n - } - throw log.error(`createRepository: failed with endpoint ${this.endpoint}`, n), new Error(`Unable to publish repository. Please check if you have an internet connection and try again.`) + var v = !1; + + function w(e) { + y(this, e), this._d = new Date(null != e._d ? e._d.getTime() : NaN), this.isValid() || (this._d = new Date(NaN)), !1 === v && (v = !0, r.updateOffset(this), v = !1) } - } - async forkRepository(t, n) { - try { - const e = `/repos/${t}/${n}/forks`, - o = await this.request('POST', e); - return await h.parsedResponse(o) - } catch (o) { - throw log.error(`forkRepository: failed to fork ${t}/${n} at endpoint: ${this.endpoint}`, o), o + + function b(e) { + return e instanceof w || null != e && null != e._isAMomentObject } - } - async fetchIssues(t, n, e, o) { - const r = { - state: e - }; - o && !isNaN(o.getTime()) && (r.since = i(o)); - const a = h.urlWithQueryString(`repos/${t}/${n}/issues`, r); - try { - const e = await this.fetchAll(a); - return e.filter((e) => !e.pullRequest) - } catch (o) { - throw log.warn(`fetchIssues: failed for repository ${t}/${n}`, o), o + + function S(e) { + return e < 0 ? Math.ceil(e) || 0 : Math.floor(e) } - } - async fetchAllOpenPullRequests(t, n) { - const e = h.urlWithQueryString(`repos/${t}/${n}/pulls`, { - state: 'open' - }); - try { - return await this.fetchAll(e) - } catch (o) { - throw log.warn(`failed fetching open PRs for repository ${t}/${n}`, o), o + + function C(e) { + var t = +e, + n = 0; + return 0 !== t && isFinite(t) && (n = S(t)), n } - } - async fetchUpdatedPullRequests(t, n, e, o = 320) { - const i = e.getTime(), - a = h.urlWithQueryString(`repos/${t}/${n}/pulls`, { - state: 'all', - sort: 'updated', - direction: 'desc' - }); - try { - const e = await this.fetchAll(a, { - perPage: 10, - getNextPagePath: r, - continue (e) { - if (e.length >= o) throw new R('got max pull requests, aborting'); - const t = e[e.length - 1]; - return t !== void 0 && Date.parse(t.updated_at) > i - }, - suppressErrors: !1 - }); - return e.filter((e) => Date.parse(e.updated_at) >= i) - } catch (o) { - throw log.warn(`failed fetching updated PRs for repository ${t}/${n}`, o), o + + function E(e, t, n) { + var r, i = Math.min(e.length, t.length), + o = Math.abs(e.length - t.length), + s = 0; + for (r = 0; r < i; r++)(n && e[r] !== t[r] || !n && C(e[r]) !== C(t[r])) && s++; + return s + o } - } - async fetchPullRequest(t, n, o) { - try { - const e = `/repos/${t}/${n}/pulls/${o}`, - r = await this.request('GET', e); - return await h.parsedResponse(r) - } catch (r) { - throw log.warn(`failed fetching PR for ${t}/${n}/pulls/${o}`, r), r + + function k(e) { + !1 === r.suppressDeprecationWarnings && "undefined" != typeof console && console.warn && console.warn("Deprecation warning: " + e) } - } - async fetchCombinedRefStatus(e, t, n) { - const o = `repos/${e}/${t}/commits/${n}/status`, - r = await this.request('GET', o); - return await h.parsedResponse(r) - } - async fetchPushControl(e, t, n) { - const o = `repos/${e}/${t}/branches/${encodeURIComponent(n)}/push_control`; - try { - const e = await this.request('GET', o, void 0, { - Accept: 'application/vnd.github.phandalin-preview' - }); - return await h.parsedResponse(e) - } catch (e) { - return log.info(`[fetchPushControl] unable to check if branch is potentially pushable`, e), { - pattern: null, - required_signatures: !1, - required_status_checks: [], - required_approving_review_count: 0, - required_linear_history: !1, - allow_actor: !0, - allow_deletions: !0, - allow_force_pushes: !0 - } + + function x(e, t) { + var n = !0; + return h((function () { + if (null != r.deprecationHandler && r.deprecationHandler(null, e), n) { + for (var i, o = [], s = 0; s < arguments.length; s++) { + if (i = "", "object" == typeof arguments[s]) { + for (var a in i += "\n[" + s + "] ", arguments[0]) i += a + ": " + arguments[0][a] + ", "; + i = i.slice(0, -2) + } else i = arguments[s]; + o.push(i) + } + k(e + "\nArguments: " + Array.prototype.slice.call(o).join("") + "\n" + (new Error).stack), n = !1 + } + return t.apply(this, arguments) + }), t) } - } - async fetchProtectedBranches(e, t) { - const n = `repos/${e}/${t}/branches?protected=true`; - try { - const e = await this.request('GET', n); - return await h.parsedResponse(e) - } catch (e) { - return log.info(`[fetchProtectedBranches] unable to list protected branches`, e), [] + var T, R = {}; + + function D(e, t) { + null != r.deprecationHandler && r.deprecationHandler(e, t), R[e] || (k(t), R[e] = !0) } - } - async fetchAll(e, t) { - const n = [], - r = Object.assign({ - perPage: 100 - }, t), - i = { - per_page: `${r.perPage}` - }; - let a = h.urlWithQueryString(e, i); - do { - const t = await this.request('GET', a); - if (!1 !== r.suppressErrors && !t.ok) return log.warn(`fetchAll: '${e}' returned a ${t.status}`), n; - const i = await h.parsedResponse(t); - i && n.push(...i), a = r.getNextPagePath ? r.getNextPagePath(t) : o(t) - } while (a && (!r.continue || r.continue(n))); - return n - } - request(e, t, n, o) { - return h.request(this.endpoint, this.token, e, t, n, o) - } - async getFetchPollInterval(t, n) { - const e = `repos/${t}/${n}/git`; - try { - const t = await this.request('HEAD', e), - n = t.headers.get('x-poll-interval'); - if (n) { - const e = parseInt(n, 10); - return isNaN(e) ? null : e - } - return null - } catch (o) { - return log.warn(`getFetchPollInterval: failed for ${t}/${n}`, o), null + + function _(e) { + return e instanceof Function || "[object Function]" === Object.prototype.toString.call(e) } - } - async fetchMentionables(t, n, e) { - const o = { - Accept: 'application/vnd.github.jerry-maguire-preview' + + function A(e, t) { + var n, r = h({}, e); + for (n in t) u(t, n) && (o(e[n]) && o(t[n]) ? (r[n] = {}, h(r[n], e[n]), h(r[n], t[n])) : null != t[n] ? r[n] = t[n] : delete r[n]); + for (n in e) u(e, n) && !u(t, n) && o(e[n]) && (r[n] = h({}, r[n])); + return r + } + + function M(e) { + null != e && this.set(e) + } + r.suppressDeprecationWarnings = !1, r.deprecationHandler = null, T = Object.keys ? Object.keys : function (e) { + var t, n = []; + for (t in e) u(e, t) && n.push(t); + return n }; - e && (o['If-None-Match'] = e); - try { - const e = `repos/${t}/${n}/mentionables/users`, - r = await this.request('GET', e, void 0, o); - if (r.status === T.NotFound) return log.warn(`fetchMentionables: '${e}' returned a 404`), null; - if (r.status === T.NotModified) return null; - const i = await h.parsedResponse(r), - a = r.headers.get('etag'); - return { - users: i, - etag: a + var P = {}; + + function I(e, t) { + var n = e.toLowerCase(); + P[n] = P[n + "s"] = P[t] = e + } + + function O(e) { + return "string" == typeof e ? P[e] || P[e.toLowerCase()] : void 0 + } + + function L(e) { + var t, n, r = {}; + for (n in e) u(e, n) && (t = O(n)) && (r[t] = e[n]); + return r + } + var N = {}; + + function F(e, t) { + N[e] = t + } + + function B(e, t, n) { + var r = "" + Math.abs(e), + i = t - r.length; + return (e >= 0 ? n ? "+" : "" : "-") + Math.pow(10, Math.max(0, i)).toString().substr(1) + r + } + var H = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, + z = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, + U = {}, + W = {}; + + function V(e, t, n, r) { + var i = r; + "string" == typeof r && (i = function () { + return this[r]() + }), e && (W[e] = i), t && (W[t[0]] = function () { + return B(i.apply(this, arguments), t[1], t[2]) + }), n && (W[n] = function () { + return this.localeData().ordinal(i.apply(this, arguments), e) + }) + } + + function j(e, t) { + return e.isValid() ? (t = G(t, e.localeData()), U[t] = U[t] || function (e) { + var t, n, r, i = e.match(H); + for (t = 0, n = i.length; t < n; t++) W[i[t]] ? i[t] = W[i[t]] : i[t] = (r = i[t]).match(/\[[\s\S]/) ? r.replace(/^\[|\]$/g, "") : r.replace(/\\/g, ""); + return function (t) { + var r, o = ""; + for (r = 0; r < n; r++) o += _(i[r]) ? i[r].call(t, e) : i[r]; + return o + } + }(t), U[t](e)) : e.localeData().invalidDate() + } + + function G(e, t) { + var n = 5; + + function r(e) { + return t.longDateFormat(e) || e } - } catch (o) { - return log.warn(`fetchMentionables: failed for ${t}/${n}`, o), null + for (z.lastIndex = 0; n >= 0 && z.test(e);) e = e.replace(z, r), z.lastIndex = 0, n -= 1; + return e } - } - async fetchUser(e) { - try { - const t = await this.request('GET', `users/${encodeURIComponent(e)}`); - return 404 === t.status ? null : await h.parsedResponse(t) - } catch (t) { - throw log.warn(`fetchUser: failed with endpoint ${this.endpoint}`, t), t + var $ = /\d/, + q = /\d\d/, + K = /\d{3}/, + Y = /\d{4}/, + Q = /[+-]?\d{6}/, + Z = /\d\d?/, + X = /\d\d\d\d?/, + J = /\d\d\d\d\d\d?/, + ee = /\d{1,3}/, + te = /\d{1,4}/, + ne = /[+-]?\d{1,6}/, + re = /\d+/, + ie = /[+-]?\d+/, + oe = /Z|[+-]\d\d:?\d\d/gi, + se = /Z|[+-]\d\d(?::?\d\d)?/gi, + ae = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, + le = {}; + + function ce(e, t, n) { + le[e] = _(t) ? t : function (e, r) { + return e && n ? n : t + } } - } - } - t.API = x; - var P; - (function (e) { - e[e.Authorized = 0] = 'Authorized', e[e.Failed = 1] = 'Failed', e[e.TwoFactorAuthenticationRequired = 2] = 'TwoFactorAuthenticationRequired', e[e.UserRequiresVerification = 3] = 'UserRequiresVerification', e[e.PersonalAccessTokenBlocked = 4] = 'PersonalAccessTokenBlocked', e[e.Error = 5] = 'Error', e[e.EnterpriseTooOld = 6] = 'EnterpriseTooOld', e[e.WebFlowRequired = 7] = 'WebFlowRequired' - })(P = t.AuthorizationResponseKind || (t.AuthorizationResponseKind = {})), t.createAuthorization = a, t.fetchUser = async function (t, e) { - const n = new x(t, e); - try { - const o = await n.fetchAccount(), - r = await n.fetchEmails(), - i = S.getDefaultEmail(r), - a = y.getAvatarWithEnterpriseFallback(o.avatar_url, i, t); - return new m.Account(o.login, t, e, r, a, o.id, o.name || o.login) - } catch (n) { - throw log.warn(`fetchUser: failed with endpoint ${t}`, n), n - } - }, t.fetchMetadata = async function (e) { - const t = `${e}/meta`; - try { - const t = await h.request(e, null, 'GET', 'meta', void 0, { - "Content-Type": 'application/json' - }), - n = await h.parsedResponse(t); - return n && void 0 !== n.verifiable_password_authentication ? n : null - } catch (n) { - return log.error(`fetchMetadata: unable to load metadata from '${t}' as a fallback`, n), null - } - }, t.getEndpointForRepository = function (e) { - const t = u.parse(e); - return 'github.com' === t.hostname ? l() : `${t.protocol}//${t.hostname}/api` - }, t.getHTMLURL = d, t.getEnterpriseAPIURL = function (e) { - const t = u.parse(e); - return `${t.protocol}//${t.hostname}/api/v3` - }, t.getDotComAPIEndpoint = l, t.getAccountForEndpoint = function (e, t) { - return e.find((e) => e.endpoint === t) || null - }, t.getOAuthAuthorizationURL = function (e, t) { - const n = d(e), - o = c(e), - r = encodeURIComponent(o.join(' ')); - return `${n}/login/oauth/authorize?client_id=${v}&scope=${r}&state=${t}` - }, t.requestOAuthToken = async function (t, e) { - try { - const n = d(t), - o = await h.request(n, null, 'POST', 'login/oauth/access_token', { - client_id: v, - client_secret: E, - code: e - }), - r = await h.parsedResponse(o); - return r.access_token - } catch (n) { - return log.warn(`requestOAuthToken: failed with endpoint ${t}`, n), null - } - } -}, function (e, t, n) { - 'use strict'; - function o(e) { - const t = e.gitErrorDescription; - return t ? t : e.stderr.length ? e.stderr : e.stdout.length ? e.stdout : 'Unknown error' - } + function ue(e, t) { + return u(le, e) ? le[e](t._strict, t._locale) : new RegExp(he(e.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, (function (e, t, n, r, i) { + return t || n || r || i + })))) + } - function r(e) { - return !(e !== a.GitError.SSHAuthenticationFailed && e !== a.GitError.SSHPermissionDenied && e !== a.GitError.HTTPSAuthenticationFailed) - } + function he(e) { + return e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") + } + var pe = {}; - function i(e) { - if (r(e)) { - const e = 'File > Options.'; - return `Authentication failed. Some common reasons include: + function de(e, t) { + var n, r = t; + for ("string" == typeof e && (e = [e]), a(t) && (r = function (e, n) { + n[t] = C(e) + }), n = 0; n < e.length; n++) pe[e[n]] = r + } -- You are not logged in to your account: see ${e} -- You may need to log out and log back in to refresh your token. -- You do not have permission to access this repository. -- The repository is archived on GitHub. Check the repository settings to confirm you are still permitted to push commits. -- If you use SSH authentication, check that your key is added to the ssh-agent and associated with your account.` - } - return e === a.GitError.SSHKeyAuditUnverified ? 'The SSH key is unverified.' : e === a.GitError.RemoteDisconnection ? 'The remote disconnected. Check your Internet connection and try again.' : e === a.GitError.HostDown ? 'The host is down. Check your Internet connection and try again.' : e === a.GitError.RebaseConflicts ? 'We found some conflicts while trying to rebase. Please resolve the conflicts before continuing.' : e === a.GitError.MergeConflicts ? 'We found some conflicts while trying to merge. Please resolve the conflicts and commit the changes.' : e === a.GitError.HTTPSRepositoryNotFound || e === a.GitError.SSHRepositoryNotFound ? 'The repository does not seem to exist anymore. You may not have access, or it may have been deleted or renamed.' : e === a.GitError.PushNotFastForward ? 'The repository has been updated since you last pulled. Try pulling before pushing.' : e === a.GitError.BranchDeletionFailed ? 'Could not delete the branch. It was probably already deleted.' : e === a.GitError.DefaultBranchDeletionFailed ? `The branch is the repository's default branch and cannot be deleted.` : e === a.GitError.RevertConflicts ? 'To finish reverting, please merge and commit the changes.' : e === a.GitError.EmptyRebasePatch ? 'There aren\u2019t any changes left to apply.' : e === a.GitError.NoMatchingRemoteBranch ? 'There aren\u2019t any remote branches that match the current branch.' : e === a.GitError.NothingToCommit ? 'There are no changes to commit.' : e === a.GitError.NoSubmoduleMapping ? 'A submodule was removed from .gitmodules, but the folder still exists in the repository. Delete the folder, commit the change, then try again.' : e === a.GitError.SubmoduleRepositoryDoesNotExist ? 'A submodule points to a location which does not exist.' : e === a.GitError.InvalidSubmoduleSHA ? 'A submodule points to a commit which does not exist.' : e === a.GitError.LocalPermissionDenied ? 'Permission denied.' : e === a.GitError.InvalidMerge ? 'This is not something we can merge.' : e === a.GitError.InvalidRebase ? 'This is not something we can rebase.' : e === a.GitError.NonFastForwardMergeIntoEmptyHead ? 'The merge you attempted is not a fast-forward, so it cannot be performed on an empty branch.' : e === a.GitError.PatchDoesNotApply ? 'The requested changes conflict with one or more files in the repository.' : e === a.GitError.BranchAlreadyExists ? 'A branch with that name already exists.' : e === a.GitError.BadRevision ? 'Bad revision.' : e === a.GitError.NotAGitRepository ? 'This is not a git repository.' : e === a.GitError.ProtectedBranchForcePush ? 'This branch is protected from force-push operations.' : e === a.GitError.ProtectedBranchRequiresReview ? 'This branch is protected and any changes requires an approved review. Open a pull request with changes targeting this branch instead.' : e === a.GitError.PushWithFileSizeExceedingLimit ? 'The push operation includes a file which exceeds GitHub\'s file size restriction of 100MB. Please remove the file from history and try again.' : e === a.GitError.HexBranchNameRejected ? 'The branch name cannot be a 40-character string of hexadecimal characters, as this is the format that Git uses for representing objects.' : e === a.GitError.ForcePushRejected ? 'The force push has been rejected for the current branch.' : e === a.GitError.InvalidRefLength ? 'A ref cannot be longer than 255 characters.' : e === a.GitError.CannotMergeUnrelatedHistories ? 'Unable to merge unrelated histories in this repository.' : e === a.GitError.PushWithPrivateEmail ? 'Cannot push these commits as they contain an email address marked as private on GitHub.' : e === a.GitError.LFSAttributeDoesNotMatch ? 'Git LFS attribute found in global Git configuration does not match expected value.' : e === a.GitError.ProtectedBranchDeleteRejected ? 'This branch cannot be deleted from the remote repository because it is marked as protected.' : e === a.GitError.ProtectedBranchRequiredStatus ? 'The push was rejected by the remote server because a required status check has not been satisfied.' : e === a.GitError.BranchRenameFailed ? 'The branch could not be renamed.' : e === a.GitError.PathDoesNotExist ? 'The path does not exist on disk.' : e === a.GitError.InvalidObjectName ? 'The object was not found in the Git repository.' : e === a.GitError.OutsideRepository ? 'This path is not a valid path inside the repository.' : e === a.GitError.LockFileAlreadyExists ? 'A lock file already exists in the repository, which blocks this operation from completing.' : e === a.GitError.NoMergeToAbort ? 'There is no merge in progress, so there is nothing to abort.' : e === a.GitError.NoExistingRemoteBranch ? 'The remote branch does not exist.' : e === a.GitError.LocalChangesOverwritten ? 'Unable to switch branches as there are working directory changes which would be overwritten. Please commit or stash your changes.' : e === a.GitError.UnresolvedConflicts ? 'There are unresolved conflicts in the working directory.' : e === a.GitError.ConfigLockFileAlreadyExists ? null : e === a.GitError.RemoteAlreadyExists ? null : e === a.GitError.TagAlreadyExists ? 'A tag with that name already exists' : s.assertNever(e, `Unknown error: ${e}`) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const a = n(35), - s = n(2), - d = n(10), - l = n(172), - c = n(1), - p = n(84), - u = n(270); - class m extends Error { - constructor(e, t) { - super(o(e)), this.name = 'GitError', this.result = e, this.args = t - } - } - t.GitError = m, t.git = async function (e, t, n, o) { - const r = { - successExitCodes: new Set([0]), - expectedErrors: new Set - }, - s = Object.assign({}, r, o); - s.env = Object.assign({ - TERM: 'dumb' - }, s.env); - const d = `${n}: git ${e.join(' ')}`, - c = await l.measure(d, () => a.GitProcess.exec(e, t, s)).catch((e) => { - if (u.isErrnoException(e)) throw new Error(`Failed to execute ${n}: ${e.code}`); - throw e - }), - p = c.exitCode; - let h = null; - const f = !!s.successExitCodes && s.successExitCodes.has(p); - f || (h = a.GitProcess.parseError(c.stderr), !h && (h = a.GitProcess.parseError(c.stdout))); - const g = h ? i(h) : null, - y = Object.assign({}, c, { - gitError: h, - gitErrorDescription: g, - path: t - }); - let S = !0; - if (h && s.expectedErrors && (S = s.expectedErrors.has(h)), h && S || f) return y; - const C = []; - throw C.push(`\`git ${e.join(' ')}\` exited with an unexpected code: ${p}.`), c.stdout && (C.push('stdout:'), C.push(c.stdout)), c.stderr && (C.push('stderr:'), C.push(c.stderr)), h && C.push(`(The error was parsed as ${h}: ${g})`), log.error(C.join('\n')), new m(y, e) - }, t.isAuthFailureError = r, t.isConfigFileLockError = function (e) { - return e instanceof m && e.result.gitError === a.GitError.ConfigLockFileAlreadyExists - }; - const h = /^error: could not lock config file (.+?): File exists$/m; - t.parseConfigLockFilePathFromError = function (e) { - const t = h.exec(e.stderr); - if (null === t) return null; - const n = t[1].replace('/', '\\'); - return c.resolve(e.path, `${n}.lock`) - }, t.gitNetworkArguments = async function (e, t) { - const n = ['-c', 'credential.helper=']; - if (null === t) return n; - const o = t.endpoint === d.getDotComAPIEndpoint(); - if (!o) return n; - const r = 'protocol.version', - i = null == e ? await p.getGlobalConfigValue(r) : await p.getConfigValue(e, r); - return null === i ? [...n, '-c', 'protocol.version=2'] : n - }, t.parseCommitSHA = function (e) { - return e.stdout.split(']')[0].split(' ')[1] - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5); - class i extends o.Component { - constructor() { - super(...arguments), this.innerButton = null, this.onButtonRef = (e) => { - this.innerButton = e, this.props.onButtonRef && this.props.onButtonRef(e) - }, this.focus = () => { - this.innerButton && this.innerButton.focus() - }, this.getBoundingClientRect = () => this.innerButton ? this.innerButton.getBoundingClientRect() : void 0, this.onClick = (e) => { - this.props.onClick && this.props.onClick(e), this.props.type === void 0 && e.preventDefault() + function fe(e, t) { + de(e, (function (e, n, r, i) { + r._w = r._w || {}, t(e, r._w, r, i) + })) } - } - blur() { - this.innerButton && this.innerButton.blur() - } - render() { - const e = r('button-component', { - "small-button": 'small' === this.props.size - }, this.props.className); - return o.createElement('button', { - className: e, - disabled: this.props.disabled, - onClick: this.onClick, - type: this.props.type || 'button', - ref: this.onButtonRef, - tabIndex: this.props.tabIndex, - onMouseEnter: this.props.onMouseEnter, - title: this.props.tooltip, - role: this.props.role, - "aria-expanded": this.props.ariaExpanded, - "aria-haspopup": this.props.ariaHasPopup - }, this.props.children) - } - } - t.Button = i -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(40), - i = n(5); - class a extends o.Component { - constructor() { - super(...arguments), this.onClick = (e) => { - if (e.preventDefault(), !this.props.disabled) { - const e = this.props.uri; - e && r.shell.openExternal(e); - const t = this.props.onClick; - t && t() + + function me(e, t, n) { + null != t && u(pe, e) && pe[e](t, n._a, n, e) + } + + function ge(e) { + return ye(e) ? 366 : 365 + } + + function ye(e) { + return e % 4 == 0 && e % 100 != 0 || e % 400 == 0 + } + V("Y", 0, 0, (function () { + var e = this.year(); + return e <= 9999 ? "" + e : "+" + e + })), V(0, ["YY", 2], 0, (function () { + return this.year() % 100 + })), V(0, ["YYYY", 4], 0, "year"), V(0, ["YYYYY", 5], 0, "year"), V(0, ["YYYYYY", 6, !0], 0, "year"), I("year", "y"), F("year", 1), ce("Y", ie), ce("YY", Z, q), ce("YYYY", te, Y), ce("YYYYY", ne, Q), ce("YYYYYY", ne, Q), de(["YYYYY", "YYYYYY"], 0), de("YYYY", (function (e, t) { + t[0] = 2 === e.length ? r.parseTwoDigitYear(e) : C(e) + })), de("YY", (function (e, t) { + t[0] = r.parseTwoDigitYear(e) + })), de("Y", (function (e, t) { + t[0] = parseInt(e, 10) + })), r.parseTwoDigitYear = function (e) { + return C(e) + (C(e) > 68 ? 1900 : 2e3) + }; + var ve, we = be("FullYear", !0); + + function be(e, t) { + return function (n) { + return null != n ? (Ce(this, e, n), r.updateOffset(this, t), this) : Se(this, e) } } - } - render() { - const e = this.props.uri || '', - t = i('link-button-component', this.props.className); - return o.createElement('a', { - className: t, - href: e, - onClick: this.onClick, - title: this.props.title, - tabIndex: this.props.tabIndex - }, this.props.children) - } - } - t.LinkButton = a -}, function (e, t, n) { - 'use strict'; - t.__esModule = !0; - var o = n(230), - r = function (e) { - return e && e.__esModule ? e : { - default: e + + function Se(e, t) { + return e.isValid() ? e._d["get" + (e._isUTC ? "UTC" : "") + t]() : NaN } - }(o); - t.default = function (e, t) { - if (!e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); - return t && ('object' === ('undefined' == typeof t ? 'undefined' : (0, r.default)(t)) || 'function' == typeof t) ? t : e - } -}, function (e, t, n) { - e.exports = n(785)() -}, function (e, t, n) { - 'use strict'; - function o(e) { - return e && e.__esModule ? e : { - default: e - } - } - t.__esModule = !0; - var r = n(597), - i = o(r), - a = n(593), - s = o(a), - d = n(230), - l = o(d); - t.default = function (e, t) { - if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function, not ' + ('undefined' == typeof t ? 'undefined' : (0, l.default)(t))); - e.prototype = (0, s.default)(t && t.prototype, { - constructor: { - value: e, - enumerable: !1, - writable: !0, - configurable: !0 + function Ce(e, t, n) { + e.isValid() && !isNaN(n) && ("FullYear" === t && ye(e.year()) && 1 === e.month() && 29 === e.date() ? e._d["set" + (e._isUTC ? "UTC" : "") + t](n, e.month(), Ee(n, e.month())) : e._d["set" + (e._isUTC ? "UTC" : "") + t](n)) } - }), t && (i.default ? (0, i.default)(e, t) : e.__proto__ = t) - } -}, function (e, t, n) { - e.exports = { - default: n(617), - __esModule: !0 - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5); - class i extends o.Component { - render() { - const e = r('row-component', this.props.className); - return o.createElement('div', { - className: e - }, this.props.children) - } - } - t.Row = i -}, function (e, t, n) { - 'use strict'; - e.exports = Object.assign({}, n(290), n(287), n(283), n(740), n(738), n(732), n(41), n(728), n(727), n(726), n(53), n(133)); - const o = n(33); - Object.getOwnPropertyDescriptor(o, 'promises') && Object.defineProperty(e.exports, 'promises', { - get() { - return o.promises - } - }) -}, function (e, t, n) { - 'use strict'; - function o(e) { - for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), o(n(266)), o(n(706)), o(n(702)), o(n(695)), o(n(694)), o(n(84)), o(n(11)), o(n(255)), o(n(171)), o(n(693)), o(n(263)), o(n(20)), o(n(692)), o(n(254)), o(n(691)), o(n(690)), o(n(689)), o(n(262)), o(n(260)), o(n(258)), o(n(168)), o(n(688)), o(n(251)), o(n(261)), o(n(683)), o(n(250)), o(n(682)), o(n(681)), o(n(680)), o(n(678)), o(n(677)), o(n(128)), o(n(675)), o(n(249)), o(n(674)), o(n(673)), o(n(670)) -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0); - class r extends o.Component { - render() { - return o.createElement('em', { - className: 'ref-component' - }, this.props.children) - } - } - t.Ref = r -}, function (e) { - e.exports = require('electron') -}, function (e, t, n) { - 'use strict'; + function Ee(e, t) { + if (isNaN(e) || isNaN(t)) return NaN; + var n, r = (t % (n = 12) + n) % n; + return e += (t - r) / 12, 1 === r ? ye(e) ? 29 : 28 : 31 - r % 7 % 2 + } + ve = Array.prototype.indexOf ? Array.prototype.indexOf : function (e) { + var t; + for (t = 0; t < this.length; ++t) + if (this[t] === e) return t; + return -1 + }, V("M", ["MM", 2], "Mo", (function () { + return this.month() + 1 + })), V("MMM", 0, 0, (function (e) { + return this.localeData().monthsShort(this, e) + })), V("MMMM", 0, 0, (function (e) { + return this.localeData().months(this, e) + })), I("month", "M"), F("month", 8), ce("M", Z), ce("MM", Z, q), ce("MMM", (function (e, t) { + return t.monthsShortRegex(e) + })), ce("MMMM", (function (e, t) { + return t.monthsRegex(e) + })), de(["M", "MM"], (function (e, t) { + t[1] = C(e) - 1 + })), de(["MMM", "MMMM"], (function (e, t, n, r) { + var i = n._locale.monthsParse(e, r, n._strict); + null != i ? t[1] = i : d(n).invalidMonth = e + })); + var ke = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, + xe = "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), + Te = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"); - function o(e) { - return e.kind === s.Conflicted - } + function Re(e, t, n) { + var r, i, o, s = e.toLocaleLowerCase(); + if (!this._monthsParse) + for (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = [], r = 0; r < 12; ++r) o = p([2e3, r]), this._shortMonthsParse[r] = this.monthsShort(o, "").toLocaleLowerCase(), this._longMonthsParse[r] = this.months(o, "").toLocaleLowerCase(); + return n ? "MMM" === t ? -1 !== (i = ve.call(this._shortMonthsParse, s)) ? i : null : -1 !== (i = ve.call(this._longMonthsParse, s)) ? i : null : "MMM" === t ? -1 !== (i = ve.call(this._shortMonthsParse, s)) || -1 !== (i = ve.call(this._longMonthsParse, s)) ? i : null : -1 !== (i = ve.call(this._longMonthsParse, s)) || -1 !== (i = ve.call(this._shortMonthsParse, s)) ? i : null + } - function r(e) { - if (!e.length) return !0; - const t = e.every((e) => e.selection.getSelectionType() === i.DiffSelectionType.All), - n = e.every((e) => e.selection.getSelectionType() === i.DiffSelectionType.None); - let o = null; - return t ? o = !0 : n && (o = !1), o - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const i = n(30); - var a; - (function (e) { - e.Modified = 'M', e.Added = 'A', e.Deleted = 'D', e.Renamed = 'R', e.Copied = 'C', e.Unchanged = '.', e.Untracked = '?', e.Ignored = '!', e.UpdatedButUnmerged = 'U' - })(a = t.GitStatusEntry || (t.GitStatusEntry = {})); - var s; - (function (e) { - e.New = 'New', e.Modified = 'Modified', e.Deleted = 'Deleted', e.Copied = 'Copied', e.Renamed = 'Renamed', e.Conflicted = 'Conflicted', e.Untracked = 'Untracked' - })(s = t.AppFileStatusKind || (t.AppFileStatusKind = {})), t.isConflictedFileStatus = o, t.isConflictWithMarkers = function (e) { - return e.hasOwnProperty('conflictMarkerCount') - }, t.isManualConflict = function (e) { - return !e.hasOwnProperty('conflictMarkerCount') - }; - var d; - (function (e) { - e.AddedByUs = 'added-by-us', e.DeletedByUs = 'deleted-by-us', e.AddedByThem = 'added-by-them', e.DeletedByThem = 'deleted-by-them', e.BothDeleted = 'both-deleted', e.BothAdded = 'both-added', e.BothModified = 'both-modified' - })(d = t.UnmergedEntrySummary || (t.UnmergedEntrySummary = {})); - class l { - constructor(e, t) { - this.path = e, this.status = t, this.id = t.kind === s.Renamed || t.kind === s.Copied ? `${t.kind}+${e}+${t.oldPath}` : `${t.kind}+${e}` - } - } - t.FileChange = l; - class c extends l { - constructor(e, t, n) { - super(e, t), this.selection = n - } - withIncludeAll(e) { - const t = e ? this.selection.withSelectAll() : this.selection.withSelectNone(); - return this.withSelection(t) - } - withSelection(e) { - return new c(this.path, this.status, e) - } - } - t.WorkingDirectoryFileChange = c; - t.CommittedFileChange = class extends l { - constructor(e, t, n) { - super(e, t), this.commitish = n, this.commitish = n - } - }; - class p { - constructor(e, t = !0) { - this.files = e, this.includeAll = t, this.fileIxById = new Map, e.forEach((e, t) => this.fileIxById.set(e.id, t)) - } - static fromFiles(e) { - return new p(e, r(e)) - } - withIncludeAllFiles(e) { - const t = this.files.map((t) => t.withIncludeAll(e)); - return new p(t, e) - } - findFileWithID(e) { - const t = this.fileIxById.get(e); - return t === void 0 ? null : this.files[t] || null - } - findFileIndexByID(e) { - const t = this.fileIxById.get(e); - return t === void 0 ? -1 : t - } - } - t.WorkingDirectoryStatus = p -}, function (e, t) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - var n; - (function (e) { - e[e.RenameBranch = 1] = 'RenameBranch', e[e.DeleteBranch = 2] = 'DeleteBranch', e[e.ConfirmDiscardChanges = 3] = 'ConfirmDiscardChanges', e[e.Preferences = 4] = 'Preferences', e[e.MergeBranch = 5] = 'MergeBranch', e[e.RepositorySettings = 6] = 'RepositorySettings', e[e.AddRepository = 7] = 'AddRepository', e[e.CreateRepository = 8] = 'CreateRepository', e[e.CloneRepository = 9] = 'CloneRepository', e[e.CreateBranch = 10] = 'CreateBranch', e[e.SignIn = 11] = 'SignIn', e[e.About = 12] = 'About', e[e.InstallGit = 13] = 'InstallGit', e[e.PublishRepository = 14] = 'PublishRepository', e[e.Acknowledgements = 15] = 'Acknowledgements', e[e.UntrustedCertificate = 16] = 'UntrustedCertificate', e[e.RemoveRepository = 17] = 'RemoveRepository', e[e.TermsAndConditions = 18] = 'TermsAndConditions', e[e.PushBranchCommits = 19] = 'PushBranchCommits', e[e.CLIInstalled = 20] = 'CLIInstalled', e[e.GenericGitAuthentication = 21] = 'GenericGitAuthentication', e[e.ExternalEditorFailed = 22] = 'ExternalEditorFailed', e[e.OpenShellFailed = 23] = 'OpenShellFailed', e[e.InitializeLFS = 24] = 'InitializeLFS', e[e.LFSAttributeMismatch = 25] = 'LFSAttributeMismatch', e[e.UpstreamAlreadyExists = 26] = 'UpstreamAlreadyExists', e[e.ReleaseNotes = 27] = 'ReleaseNotes', e[e.DeletePullRequest = 28] = 'DeletePullRequest', e[e.MergeConflicts = 29] = 'MergeConflicts', e[e.AbortMerge = 30] = 'AbortMerge', e[e.OversizedFiles = 31] = 'OversizedFiles', e[e.UsageReportingChanges = 32] = 'UsageReportingChanges', e[e.CommitConflictsWarning = 33] = 'CommitConflictsWarning', e[e.PushNeedsPull = 34] = 'PushNeedsPull', e[e.RebaseFlow = 35] = 'RebaseFlow', e[e.ConfirmForcePush = 36] = 'ConfirmForcePush', e[e.StashAndSwitchBranch = 37] = 'StashAndSwitchBranch', e[e.ConfirmOverwriteStash = 38] = 'ConfirmOverwriteStash', e[e.ConfirmDiscardStash = 39] = 'ConfirmDiscardStash', e[e.CreateTutorialRepository = 40] = 'CreateTutorialRepository', e[e.ConfirmExitTutorial = 41] = 'ConfirmExitTutorial', e[e.PushRejectedDueToMissingWorkflowScope = 42] = 'PushRejectedDueToMissingWorkflowScope', e[e.SAMLReauthRequired = 43] = 'SAMLReauthRequired', e[e.CreateFork = 44] = 'CreateFork', e[e.SChannelNoRevocationCheck = 45] = 'SChannelNoRevocationCheck', e[e.CreateTag = 46] = 'CreateTag', e[e.DeleteTag = 47] = 'DeleteTag', e[e.LocalChangesOverwritten = 48] = 'LocalChangesOverwritten', e[e.RebaseConflicts = 49] = 'RebaseConflicts', e[e.ChooseForkSettings = 50] = 'ChooseForkSettings', e[e.ConfirmDiscardSelection = 51] = 'ConfirmDiscardSelection' - })(n = t.PopupType || (t.PopupType = {})) -}, function (e, t) { - 'use strict'; - - function n() { - return !1, '1' === process.env.GITHUB_DESKTOP_PREVIEW_FEATURES - } - - function o() { - return n() || !1 - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - t.enableProgressBarOnIcon = function () { - return o() - }, t.enableRecurseSubmodulesFlag = function () { - return o() - }, t.enableReadmeOverwriteWarning = function () { - return o() - }, t.enableWSLDetection = function () { - return o() - }, t.enableCreateForkFlow = function () { - return !0 - }, t.enableSchannelCheckRevokeOptOut = function () { - return !0 - }, t.enableAutomaticGitProxyConfiguration = function () { - return !0 - }, t.enableCreateGitHubIssueFromMenu = function () { - return !0 - }, t.enableUpdateRemoteUrl = function () { - return !0 - }, t.enableForkyCreateBranchUI = function () { - return !0 - }, t.enableNDDBBanner = function () { - return !1 - }, t.enableGitTagsDisplay = function () { - return !0 - }, t.enableGitTagsCreation = function () { - return !0 - }, t.enableForkSettings = function () { - return !0 - }, t.enableDiscardLines = function () { - return !0 - } -}, function (e, t, n) { - 'use strict'; - - function o(e) { - const t = d.basename(e); - return 0 === t.length ? e : t - } + function De(e, t) { + var n; + if (!e.isValid()) return e; + if ("string" == typeof t) + if (/^\d+$/.test(t)) t = C(t); + else if (!a(t = e.localeData().monthsParse(t))) return e; + return n = Math.min(e.date(), Ee(e.year(), t)), e._d["set" + (e._isUTC ? "UTC" : "") + "Month"](t, n), e + } - function r(e) { - return e.gitHubRepository instanceof l.GitHubRepository - } + function _e(e) { + return null != e ? (De(this, e), r.updateOffset(this, !0), this) : Se(this, "Month") + } + var Ae = ae, + Me = ae; - function i(e) { - return r(e) && null !== e.gitHubRepository.parent - } + function Pe() { + function e(e, t) { + return t.length - e.length + } + var t, n, r = [], + i = [], + o = []; + for (t = 0; t < 12; t++) n = p([2e3, t]), r.push(this.monthsShort(n, "")), i.push(this.months(n, "")), o.push(this.months(n, "")), o.push(this.monthsShort(n, "")); + for (r.sort(e), i.sort(e), o.sort(e), t = 0; t < 12; t++) r[t] = he(r[t]), i[t] = he(i[t]); + for (t = 0; t < 24; t++) o[t] = he(o[t]); + this._monthsRegex = new RegExp("^(" + o.join("|") + ")", "i"), this._monthsShortRegex = this._monthsRegex, this._monthsStrictRegex = new RegExp("^(" + i.join("|") + ")", "i"), this._monthsShortStrictRegex = new RegExp("^(" + r.join("|") + ")", "i") + } - function a(e) { - if (!i(e)) return e.gitHubRepository; - const t = s(e); - return t === c.ForkContributionTarget.Self ? e.gitHubRepository : t === c.ForkContributionTarget.Parent ? e.gitHubRepository.parent : p.assertNever(t, 'Invalid fork contribution target') - } + function Ie(e, t, n, r, i, o, s) { + var a; + return e < 100 && e >= 0 ? (a = new Date(e + 400, t, n, r, i, o, s), isFinite(a.getFullYear()) && a.setFullYear(e)) : a = new Date(e, t, n, r, i, o, s), a + } - function s(e) { - return e.workflowPreferences.forkContributionTarget === void 0 ? c.ForkContributionTarget.Parent : e.workflowPreferences.forkContributionTarget - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const d = n(1), - l = n(102), - c = n(129), - p = n(2); - class u { - constructor(e, t, n, r, i = {}, a) { - this.id = t, this.gitHubRepository = n, this.missing = r, this.workflowPreferences = i, this._isTutorialRepository = a, this.mainWorkTree = { - path: e - }, this.name = n && n.name || o(e) - } - get path() { - return this.mainWorkTree.path - } - get hash() { - return `${this.id}+${this.gitHubRepository&&this.gitHubRepository.hash}+${this.path}+${this.missing}+${this.name}+${this.isTutorialRepository}+${this.workflowPreferences.forkContributionTarget}` - } - get isTutorialRepository() { - return !0 === this._isTutorialRepository - } - } - t.Repository = u, t.isRepositoryWithGitHubRepository = r, t.isRepositoryWithForkedGitHubRepository = i, t.nameOf = function (e) { - const { - gitHubRepository: t - } = e; - return null === t ? e.name : t.fullName - }, t.getGitHubHtmlUrl = function (e) { - return r(e) ? a(e).htmlURL : null - }, t.getNonForkGitHubRepository = a, t.getForkContributionTarget = s -}, function (e, t, n) { - 'use strict'; + function Oe(e) { + var t; + if (e < 100 && e >= 0) { + var n = Array.prototype.slice.call(arguments); + n[0] = e + 400, t = new Date(Date.UTC.apply(null, n)), isFinite(t.getUTCFullYear()) && t.setUTCFullYear(e) + } else t = new Date(Date.UTC.apply(null, arguments)); + return t + } - function o(e, t) { - let n = { - submenu: e - }; - for (const o of t) { - if (n === void 0 || n.submenu === void 0) return; - n = n.submenu[o] - } - return n - } + function Le(e, t, n) { + var r = 7 + t - n; + return -(7 + Oe(e, 0, r).getUTCDay() - t) % 7 + r - 1 + } - function r(e) { - return { - message: e.message || `${e}`, - name: e.name || `${e.name}`, - stack: e.stack || void 0 - } - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const i = n(22); - t.updateMenuState = function (e) { - i.ipcRenderer.send('update-menu-state', e) - }, t.sendReady = function (e) { - i.ipcRenderer.send('renderer-ready', e) - }, t.executeMenuItem = function (e) { - i.ipcRenderer.send('execute-menu-item', { - id: e.id - }) - }, t.executeMenuItemById = function (e) { - i.ipcRenderer.send('execute-menu-item', { - id: e - }) - }, t.showCertificateTrustDialog = function (e, t) { - i.ipcRenderer.send('show-certificate-trust-dialog', { - certificate: e, - message: t - }) - }, t.sendWillQuitSync = function () { - i.ipcRenderer.sendSync('will-quit') - }, t.getAppMenu = function () { - i.ipcRenderer.send('get-app-menu') - }; - let a = null; - t.registerContextualMenuActionDispatcher = function () { - i.ipcRenderer.on('contextual-menu-action', (e, t) => { - if (null !== a) { - const e = o(a, t); - void 0 !== e && void 0 !== e.action && (e.action(), a = null) + function Ne(e, t, n, r, i) { + var o, s, a = 1 + 7 * (t - 1) + (7 + n - r) % 7 + Le(e, r, i); + return a <= 0 ? s = ge(o = e - 1) + a : a > ge(e) ? (o = e + 1, s = a - ge(e)) : (o = e, s = a), { + year: o, + dayOfYear: s + } } - }) - }, t.showContextualMenu = function (e) { - a = e, i.ipcRenderer.send('show-contextual-menu', e) - }, t.updatePreferredAppMenuItemLabels = function (e) { - i.ipcRenderer.send('update-preferred-app-menu-item-labels', e) - }, t.reportUncaughtException = function (e) { - i.ipcRenderer.send('uncaught-exception', r(e)) - }, t.sendErrorReport = function (e, t = {}, n) { - i.ipcRenderer.send('send-error-report', { - error: r(e), - extra: t, - nonFatal: n - }) - } -}, function (e, t) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - var n; - (function (e) { - e[e.Repository = 0] = 'Repository', e[e.CloningRepository = 1] = 'CloningRepository', e[e.MissingRepository = 2] = 'MissingRepository' - })(n = t.SelectionType || (t.SelectionType = {})); - var o; - (function (e) { - e[e.Repository = 0] = 'Repository', e[e.Branch = 1] = 'Branch', e[e.AppMenu = 2] = 'AppMenu', e[e.AddMenu = 3] = 'AddMenu' - })(o = t.FoldoutType || (t.FoldoutType = {})); - var r; - (function (e) { - e[e.Changes = 0] = 'Changes', e[e.History = 1] = 'History' - })(r = t.RepositorySectionTab || (t.RepositorySectionTab = {})), t.isMergeConflictState = function (e) { - return 'merge' === e.kind - }, t.isRebaseConflictState = function (e) { - return 'rebase' === e.kind - }; - var i; - (function (e) { - e.WorkingDirectory = 'WorkingDirectory', e.Stash = 'Stash' - })(i = t.ChangesSelectionKind || (t.ChangesSelectionKind = {})); - var a; - (function (e) { - e.History = 'History', e.Compare = 'Compare' - })(a = t.HistoryTabMode || (t.HistoryTabMode = {})); - var s; - (function (e) { - e.Ahead = 'Ahead', e.Behind = 'Behind' - })(s = t.ComparisonMode || (t.ComparisonMode = {})) -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5), - i = n(68), - a = n(13), - s = n(27); - class d extends o.Component { - constructor() { - super(...arguments), this.inputElement = null, this.onChange = (e) => { - const t = e.currentTarget.value; - this.setState({ - value: t - }, () => { - this.props.onValueChanged && this.props.onValueChanged(t) - }) - }, this.onSearchTextCleared = () => { - null != this.props.onSearchCleared && this.props.onSearchCleared() - }, this.onInputRef = (e) => { - null != this.inputElement && 'search' === this.props.type && this.inputElement.removeEventListener('search', this.onSearchTextCleared), this.inputElement = e, null != this.inputElement && 'search' === this.props.type && this.inputElement.addEventListener('search', this.onSearchTextCleared) - }, this.onContextMenu = (e) => { - e.preventDefault(), s.showContextualMenu([{ - role: 'editMenu' - }]) - }, this.onKeyDown = (e) => { - const t = this.state.value; - if ('' !== t && 'search' === this.props.type && 'Escape' === e.key) { - const t = ''; - e.preventDefault(), this.setState({ - value: t - }), this.props.onValueChanged && this.props.onValueChanged(t) - } else 'search' === this.props.type && 'Escape' === e.key && '' === t && this.props.onBlur && (this.props.onBlur(), null !== this.inputElement && this.inputElement.blur()); - this.props.onKeyDown !== void 0 && this.props.onKeyDown(e) - }, this.onFocus = () => { - this.props.autoFocus || this.props.onFocus === void 0 || this.props.onFocus() - }, this.onBlur = () => { - this.props.onBlur !== void 0 && this.props.onBlur() + + function Fe(e, t, n) { + var r, i, o = Le(e.year(), t, n), + s = Math.floor((e.dayOfYear() - o - 1) / 7) + 1; + return s < 1 ? r = s + Be(i = e.year() - 1, t, n) : s > Be(e.year(), t, n) ? (r = s - Be(e.year(), t, n), i = e.year() + 1) : (i = e.year(), r = s), { + week: r, + year: i + } } - } - componentWillMount() { - const e = this.props.label || this.props.placeholder, - t = i.createUniqueId(`TextBox_${e}`); - this.setState({ - inputId: t, - value: this.props.value - }) - } - componentWillUnmount() { - this.state.inputId && i.releaseUniqueId(this.state.inputId) - } - componentWillReceiveProps(e) { - this.state.value !== e.value && this.setState({ - value: e.value - }) - } - selectAll() { - null !== this.inputElement && this.inputElement.select() - } - focus() { - null !== this.inputElement && this.inputElement.focus() - } - blur() { - null !== this.inputElement && this.inputElement.blur() - } - renderLabelLink() { - return this.props.labelLinkText ? o.createElement(a.LinkButton, { - uri: this.props.labelLinkUri, - onClick: this.props.onLabelLinkClick, - className: 'link-label' - }, this.props.labelLinkText) : null - } - renderLabel() { - return this.props.label ? o.createElement('div', { - className: 'label-container' - }, o.createElement('label', { - htmlFor: this.state.inputId - }, this.props.label), this.renderLabelLink()) : null - } - render() { - const e = r('text-box-component', this.props.className), - t = this.props.label ? this.state.inputId : void 0; - return o.createElement('div', { - className: e - }, this.renderLabel(), o.createElement('input', { - id: t, - ref: this.onInputRef, - onFocus: this.onFocus, - onBlur: this.onBlur, - autoFocus: this.props.autoFocus, - disabled: this.props.disabled, - type: this.props.type, - placeholder: this.props.placeholder, - value: this.state.value, - onChange: this.onChange, - onKeyDown: this.onKeyDown, - tabIndex: this.props.tabIndex, - onContextMenu: this.onContextMenu - })) - } - } - t.TextBox = d -}, function (e, t, n) { - 'use strict'; - function o(e) { - for (var n in e) t.hasOwnProperty(n) || (t[n] = e[n]) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), o(n(724)), o(n(723)), o(n(722)), o(n(721)), o(n(720)), o(n(719)) -}, function (e, t, n) { - 'use strict'; + function Be(e, t, n) { + var r = Le(e, t, n), + i = Le(e + 1, t, n); + return (ge(e) - r + i) / 7 + } - function o(e, t) { - if (e === t) return !0; - const n = e.kind; - switch (e.kind) { - case a.Unknown: - return e.kind === t.kind; - case a.Unborn: - return e.kind === t.kind && e.ref === t.ref; - case a.Detached: - return e.kind === t.kind && e.currentSha === t.currentSha; - case a.Valid: - return e.kind === t.kind && r(e.branch, t.branch); - default: - return i.assertNever(e, `Unknown tip state ${n}`); - } - } + function He(e, t) { + return e.slice(t, 7).concat(e.slice(0, t)) + } + V("w", ["ww", 2], "wo", "week"), V("W", ["WW", 2], "Wo", "isoWeek"), I("week", "w"), I("isoWeek", "W"), F("week", 5), F("isoWeek", 5), ce("w", Z), ce("ww", Z, q), ce("W", Z), ce("WW", Z, q), fe(["w", "ww", "W", "WW"], (function (e, t, n, r) { + t[r.substr(0, 1)] = C(e) + })), V("d", 0, "do", "day"), V("dd", 0, 0, (function (e) { + return this.localeData().weekdaysMin(this, e) + })), V("ddd", 0, 0, (function (e) { + return this.localeData().weekdaysShort(this, e) + })), V("dddd", 0, 0, (function (e) { + return this.localeData().weekdays(this, e) + })), V("e", 0, 0, "weekday"), V("E", 0, 0, "isoWeekday"), I("day", "d"), I("weekday", "e"), I("isoWeekday", "E"), F("day", 11), F("weekday", 11), F("isoWeekday", 11), ce("d", Z), ce("e", Z), ce("E", Z), ce("dd", (function (e, t) { + return t.weekdaysMinRegex(e) + })), ce("ddd", (function (e, t) { + return t.weekdaysShortRegex(e) + })), ce("dddd", (function (e, t) { + return t.weekdaysRegex(e) + })), fe(["dd", "ddd", "dddd"], (function (e, t, n, r) { + var i = n._locale.weekdaysParse(e, r, n._strict); + null != i ? t.d = i : d(n).invalidWeekday = e + })), fe(["d", "e", "E"], (function (e, t, n, r) { + t[r] = C(e) + })); + var ze = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), + Ue = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), + We = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"); - function r(e, t) { - return e.type === t.type && e.tip.sha === t.tip.sha && e.remote === t.remote && e.upstream === t.upstream - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const i = n(2); - var a; - (function (e) { - e.Unknown = 'Unknown', e.Unborn = 'Unborn', e.Detached = 'Detached', e.Valid = 'Valid' - })(a = t.TipState || (t.TipState = {})), t.tipEquals = o -}, function (e, t, n) { - function o(e) { - function t(t) { - return m.apply(e, t) - } + function Ve(e, t, n) { + var r, i, o, s = e.toLocaleLowerCase(); + if (!this._weekdaysParse) + for (this._weekdaysParse = [], this._shortWeekdaysParse = [], this._minWeekdaysParse = [], r = 0; r < 7; ++r) o = p([2e3, 1]).day(r), this._minWeekdaysParse[r] = this.weekdaysMin(o, "").toLocaleLowerCase(), this._shortWeekdaysParse[r] = this.weekdaysShort(o, "").toLocaleLowerCase(), this._weekdaysParse[r] = this.weekdays(o, "").toLocaleLowerCase(); + return n ? "dddd" === t ? -1 !== (i = ve.call(this._weekdaysParse, s)) ? i : null : "ddd" === t ? -1 !== (i = ve.call(this._shortWeekdaysParse, s)) ? i : null : -1 !== (i = ve.call(this._minWeekdaysParse, s)) ? i : null : "dddd" === t ? -1 !== (i = ve.call(this._weekdaysParse, s)) || -1 !== (i = ve.call(this._shortWeekdaysParse, s)) || -1 !== (i = ve.call(this._minWeekdaysParse, s)) ? i : null : "ddd" === t ? -1 !== (i = ve.call(this._shortWeekdaysParse, s)) || -1 !== (i = ve.call(this._weekdaysParse, s)) || -1 !== (i = ve.call(this._minWeekdaysParse, s)) ? i : null : -1 !== (i = ve.call(this._minWeekdaysParse, s)) || -1 !== (i = ve.call(this._weekdaysParse, s)) || -1 !== (i = ve.call(this._shortWeekdaysParse, s)) ? i : null + } + var je = ae, + Ge = ae, + $e = ae; - function n() { - return this instanceof n ? (f.apply(this, arguments), this) : n.apply(Object.create(n.prototype), arguments) - } + function qe() { + function e(e, t) { + return t.length - e.length + } + var t, n, r, i, o, s = [], + a = [], + l = [], + c = []; + for (t = 0; t < 7; t++) n = p([2e3, 1]).day(t), r = this.weekdaysMin(n, ""), i = this.weekdaysShort(n, ""), o = this.weekdays(n, ""), s.push(r), a.push(i), l.push(o), c.push(r), c.push(i), c.push(o); + for (s.sort(e), a.sort(e), l.sort(e), c.sort(e), t = 0; t < 7; t++) a[t] = he(a[t]), l[t] = he(l[t]), c[t] = he(c[t]); + this._weekdaysRegex = new RegExp("^(" + c.join("|") + ")", "i"), this._weekdaysShortRegex = this._weekdaysRegex, this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = new RegExp("^(" + l.join("|") + ")", "i"), this._weekdaysShortStrictRegex = new RegExp("^(" + a.join("|") + ")", "i"), this._weekdaysMinStrictRegex = new RegExp("^(" + s.join("|") + ")", "i") + } - function a() { - return this instanceof a ? (g.apply(this, arguments), this) : a.apply(Object.create(a.prototype), arguments) - } + function Ke() { + return this.hours() % 12 || 12 + } - function l(e, t, n, o) { - function a(e, t, n, o) { - return C(e, t, n, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? r([a, [e, t, n, o]]) : ('function' == typeof o && o.apply(this, arguments), i()) - }) + function Ye(e, t) { + V(e, 0, 0, (function () { + return this.localeData().meridiem(this.hours(), this.minutes(), t) + })) } - return 'function' == typeof n && (o = n, n = null), a(e, t, n, o) - } - s(e), e.gracefulify = o, e.createReadStream = function (t, n) { - return new e.ReadStream(t, n) - }, e.createWriteStream = function (t, n) { - return new e.WriteStream(t, n) - }; - var c = e.readFile; - e.readFile = function (e, t, n) { - function o(e, t, n) { - return c(e, t, function (a) { - a && ('EMFILE' === a.code || 'ENFILE' === a.code) ? r([o, [e, t, n]]) : ('function' == typeof n && n.apply(this, arguments), i()) - }) + + function Qe(e, t) { + return t._meridiemParse } - return 'function' == typeof t && (n = t, t = null), o(e, t, n) - }; - var p = e.writeFile; - e.writeFile = function (e, t, n, o) { - function a(e, t, n, o) { - return p(e, t, n, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? r([a, [e, t, n, o]]) : ('function' == typeof o && o.apply(this, arguments), i()) - }) + V("H", ["HH", 2], 0, "hour"), V("h", ["hh", 2], 0, Ke), V("k", ["kk", 2], 0, (function () { + return this.hours() || 24 + })), V("hmm", 0, 0, (function () { + return "" + Ke.apply(this) + B(this.minutes(), 2) + })), V("hmmss", 0, 0, (function () { + return "" + Ke.apply(this) + B(this.minutes(), 2) + B(this.seconds(), 2) + })), V("Hmm", 0, 0, (function () { + return "" + this.hours() + B(this.minutes(), 2) + })), V("Hmmss", 0, 0, (function () { + return "" + this.hours() + B(this.minutes(), 2) + B(this.seconds(), 2) + })), Ye("a", !0), Ye("A", !1), I("hour", "h"), F("hour", 13), ce("a", Qe), ce("A", Qe), ce("H", Z), ce("h", Z), ce("k", Z), ce("HH", Z, q), ce("hh", Z, q), ce("kk", Z, q), ce("hmm", X), ce("hmmss", J), ce("Hmm", X), ce("Hmmss", J), de(["H", "HH"], 3), de(["k", "kk"], (function (e, t, n) { + var r = C(e); + t[3] = 24 === r ? 0 : r + })), de(["a", "A"], (function (e, t, n) { + n._isPm = n._locale.isPM(e), n._meridiem = e + })), de(["h", "hh"], (function (e, t, n) { + t[3] = C(e), d(n).bigHour = !0 + })), de("hmm", (function (e, t, n) { + var r = e.length - 2; + t[3] = C(e.substr(0, r)), t[4] = C(e.substr(r)), d(n).bigHour = !0 + })), de("hmmss", (function (e, t, n) { + var r = e.length - 4, + i = e.length - 2; + t[3] = C(e.substr(0, r)), t[4] = C(e.substr(r, 2)), t[5] = C(e.substr(i)), d(n).bigHour = !0 + })), de("Hmm", (function (e, t, n) { + var r = e.length - 2; + t[3] = C(e.substr(0, r)), t[4] = C(e.substr(r)) + })), de("Hmmss", (function (e, t, n) { + var r = e.length - 4, + i = e.length - 2; + t[3] = C(e.substr(0, r)), t[4] = C(e.substr(r, 2)), t[5] = C(e.substr(i)) + })); + var Ze, Xe = be("Hours", !0), + Je = { + calendar: { + sameDay: "[Today at] LT", + nextDay: "[Tomorrow at] LT", + nextWeek: "dddd [at] LT", + lastDay: "[Yesterday at] LT", + lastWeek: "[Last] dddd [at] LT", + sameElse: "L" + }, + longDateFormat: { + LTS: "h:mm:ss A", + LT: "h:mm A", + L: "MM/DD/YYYY", + LL: "MMMM D, YYYY", + LLL: "MMMM D, YYYY h:mm A", + LLLL: "dddd, MMMM D, YYYY h:mm A" + }, + invalidDate: "Invalid date", + ordinal: "%d", + dayOfMonthOrdinalParse: /\d{1,2}/, + relativeTime: { + future: "in %s", + past: "%s ago", + s: "a few seconds", + ss: "%d seconds", + m: "a minute", + mm: "%d minutes", + h: "an hour", + hh: "%d hours", + d: "a day", + dd: "%d days", + M: "a month", + MM: "%d months", + y: "a year", + yy: "%d years" + }, + months: xe, + monthsShort: Te, + week: { + dow: 0, + doy: 6 + }, + weekdays: ze, + weekdaysMin: We, + weekdaysShort: Ue, + meridiemParse: /[ap]\.?m?\.?/i + }, + et = {}, + tt = {}; + + function nt(e) { + return e ? e.toLowerCase().replace("_", "-") : e } - return 'function' == typeof n && (o = n, n = null), a(e, t, n, o) - }; - var u = e.appendFile; - u && (e.appendFile = function (e, t, n, o) { - function a(e, t, n, o) { - return u(e, t, n, function (s) { - s && ('EMFILE' === s.code || 'ENFILE' === s.code) ? r([a, [e, t, n, o]]) : ('function' == typeof o && o.apply(this, arguments), i()) - }) + + function rt(t) { + var n = null; + if (!et[t] && void 0 !== e && e && e.exports) try { + n = Ze._abbr, ! function () { + var e = new Error("Cannot find module 'undefined'"); + throw e.code = "MODULE_NOT_FOUND", e + }(), it(n) + } catch (e) {} + return et[t] } - return 'function' == typeof n && (o = n, n = null), a(e, t, n, o) - }); - var m = e.readdir; - if (e.readdir = function (e, n, o) { - function a(e, n) { - n && n.sort && n.sort(), e && ('EMFILE' === e.code || 'ENFILE' === e.code) ? r([t, [s]]) : ('function' == typeof o && o.apply(this, arguments), i()) - } - var s = [e]; - return 'function' == typeof n ? o = n : s.push(n), s.push(a), t(s) - }, 'v0.8' === process.version.substr(0, 4)) { - var h = d(e); - n = h.ReadStream, a = h.WriteStream - } - var f = e.ReadStream; - f && (n.prototype = Object.create(f.prototype), n.prototype.open = function () { - var e = this; - l(e.path, e.flags, e.mode, function (t, n) { - t ? (e.autoClose && e.destroy(), e.emit('error', t)) : (e.fd = n, e.emit('open', n), e.read()) - }) - }); - var g = e.WriteStream; - g && (a.prototype = Object.create(g.prototype), a.prototype.open = function () { - var e = this; - l(e.path, e.flags, e.mode, function (t, n) { - t ? (e.destroy(), e.emit('error', t)) : (e.fd = n, e.emit('open', n)) - }) - }), Object.defineProperty(e, 'ReadStream', { - get: function () { - return n - }, - set: function (e) { - n = e - }, - enumerable: !0, - configurable: !0 - }), Object.defineProperty(e, 'WriteStream', { - get: function () { - return a - }, - set: function (e) { - a = e - }, - enumerable: !0, - configurable: !0 - }); - var y = n; - Object.defineProperty(e, 'FileReadStream', { - get: function () { - return y - }, - set: function (e) { - y = e - }, - enumerable: !0, - configurable: !0 - }); - var S = a; - Object.defineProperty(e, 'FileWriteStream', { - get: function () { - return S - }, - set: function (e) { - S = e - }, - enumerable: !0, - configurable: !0 - }); - var C = e.open; - return e.open = l, e - } - function r(e) { - m('ENQUEUE', e[0].name, e[1]), global[p].push(e) - } + function it(e, t) { + var n; + return e && ((n = s(t) ? st(e) : ot(e, t)) ? Ze = n : "undefined" != typeof console && console.warn && console.warn("Locale " + e + " not found. Did you forget to load it?")), Ze._abbr + } - function i() { - var e = global[p].shift(); - e && (m('RETRY', e[0].name, e[1]), e[0].apply(null, e[1])) - } - var a = n(33), - s = n(748), - d = n(746), - l = n(745), - c = n(176), - p, u; - 'function' == typeof Symbol && 'function' == typeof Symbol.for ? (p = Symbol.for('graceful-fs.queue'), u = Symbol.for('graceful-fs.previous')) : (p = '___graceful-fs.queue', u = '___graceful-fs.previous'); - var m = function () {}; - if (c.debuglog ? m = c.debuglog('gfs4') : /\bgfs4\b/i.test(process.env.NODE_DEBUG || '') && (m = function () { - var e = c.format.apply(c, arguments); - e = 'GFS4: ' + e.split(/\n/).join('\nGFS4: '), console.error(e) - }), !global[p]) { - var h = []; - Object.defineProperty(global, p, { - get: function () { - return h + function ot(e, t) { + if (null !== t) { + var n, r = Je; + if (t.abbr = e, null != et[e]) D("defineLocaleOverride", "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."), r = et[e]._config; + else if (null != t.parentLocale) + if (null != et[t.parentLocale]) r = et[t.parentLocale]._config; + else { + if (null == (n = rt(t.parentLocale))) return tt[t.parentLocale] || (tt[t.parentLocale] = []), tt[t.parentLocale].push({ + name: e, + config: t + }), null; + r = n._config + } return et[e] = new M(A(r, t)), tt[e] && tt[e].forEach((function (e) { + ot(e.name, e.config) + })), it(e), et[e] + } + return delete et[e], null } - }), a.close = function (e) { - function t(t, n) { - return e.call(a, t, function (e) { - e || i(), 'function' == typeof n && n.apply(this, arguments) - }) + + function st(e) { + var t; + if (e && e._locale && e._locale._abbr && (e = e._locale._abbr), !e) return Ze; + if (!i(e)) { + if (t = rt(e)) return t; + e = [e] + } + return function (e) { + for (var t, n, r, i, o = 0; o < e.length;) { + for (t = (i = nt(e[o]).split("-")).length, n = (n = nt(e[o + 1])) ? n.split("-") : null; t > 0;) { + if (r = rt(i.slice(0, t).join("-"))) return r; + if (n && n.length >= t && E(i, n, !0) >= t - 1) break; + t-- + } + o++ + } + return Ze + }(e) } - return Object.defineProperty(t, u, { - value: e - }), t - }(a.close), a.closeSync = function (e) { - function t() { - e.apply(a, arguments), i() + + function at(e) { + var t, n = e._a; + return n && -2 === d(e).overflow && (t = n[1] < 0 || n[1] > 11 ? 1 : n[2] < 1 || n[2] > Ee(n[0], n[1]) ? 2 : n[3] < 0 || n[3] > 24 || 24 === n[3] && (0 !== n[4] || 0 !== n[5] || 0 !== n[6]) ? 3 : n[4] < 0 || n[4] > 59 ? 4 : n[5] < 0 || n[5] > 59 ? 5 : n[6] < 0 || n[6] > 999 ? 6 : -1, d(e)._overflowDayOfYear && (t < 0 || t > 2) && (t = 2), d(e)._overflowWeeks && -1 === t && (t = 7), d(e)._overflowWeekday && -1 === t && (t = 8), d(e).overflow = t), e } - return Object.defineProperty(t, u, { - value: e - }), t - }(a.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || '') && process.on('exit', function () { - m(global[p]), n(288).equal(global[p].length, 0) - }) - } - e.exports = o(l(a)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !a.__patched && (e.exports = o(a), a.__patched = !0) -}, function (e) { - e.exports = require('fs') -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(1), - r = n(657); - t.encodePathAsUrl = function (...e) { - const t = o.resolve(...e); - return r(t) - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - var o = n(714); - t.GitProcess = o.GitProcess; - var r = n(271); - t.GitError = r.GitError, t.RepositoryDoesNotExistErrorCode = r.RepositoryDoesNotExistErrorCode, t.GitNotFoundErrorCode = r.GitNotFoundErrorCode -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(68); - var i; - (function (e) { - e[e.On = 0] = 'On', e[e.Off = 1] = 'Off', e[e.Mixed = 2] = 'Mixed' - })(i = t.CheckboxValue || (t.CheckboxValue = {})); - class a extends o.Component { - constructor() { - super(...arguments), this.input = null, this.onChange = (e) => { - this.props.onChange && this.props.onChange(e) - }, this.onInputRef = (e) => { - this.input = e, this.updateInputState() + + function lt(e, t, n) { + return null != e ? e : null != t ? t : n } - } - componentDidUpdate() { - this.updateInputState() - } - componentWillMount() { - const e = this.props.label || 'unknown', - t = r.createUniqueId(`Checkbox_${e}`); - this.setState({ - inputId: t - }) - } - componentWillUnmount() { - this.state.inputId && r.releaseUniqueId(this.state.inputId) - } - updateInputState() { - const e = this.input; - if (e) { - const t = this.props.value; - e.indeterminate = t === i.Mixed, e.checked = t !== i.Off + + function ct(e) { + var t, n, i, o, s, a = []; + if (!e._d) { + for (i = function (e) { + var t = new Date(r.now()); + return e._useUTC ? [t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()] : [t.getFullYear(), t.getMonth(), t.getDate()] + }(e), e._w && null == e._a[2] && null == e._a[1] && function (e) { + var t, n, r, i, o, s, a, l; + if (null != (t = e._w).GG || null != t.W || null != t.E) o = 1, s = 4, n = lt(t.GG, e._a[0], Fe(kt(), 1, 4).year), r = lt(t.W, 1), ((i = lt(t.E, 1)) < 1 || i > 7) && (l = !0); + else { + o = e._locale._week.dow, s = e._locale._week.doy; + var c = Fe(kt(), o, s); + n = lt(t.gg, e._a[0], c.year), r = lt(t.w, c.week), null != t.d ? ((i = t.d) < 0 || i > 6) && (l = !0) : null != t.e ? (i = t.e + o, (t.e < 0 || t.e > 6) && (l = !0)) : i = o + } + r < 1 || r > Be(n, o, s) ? d(e)._overflowWeeks = !0 : null != l ? d(e)._overflowWeekday = !0 : (a = Ne(n, r, i, o, s), e._a[0] = a.year, e._dayOfYear = a.dayOfYear) + }(e), null != e._dayOfYear && (s = lt(e._a[0], i[0]), (e._dayOfYear > ge(s) || 0 === e._dayOfYear) && (d(e)._overflowDayOfYear = !0), n = Oe(s, 0, e._dayOfYear), e._a[1] = n.getUTCMonth(), e._a[2] = n.getUTCDate()), t = 0; t < 3 && null == e._a[t]; ++t) e._a[t] = a[t] = i[t]; + for (; t < 7; t++) e._a[t] = a[t] = null == e._a[t] ? 2 === t ? 1 : 0 : e._a[t]; + 24 === e._a[3] && 0 === e._a[4] && 0 === e._a[5] && 0 === e._a[6] && (e._nextDay = !0, e._a[3] = 0), e._d = (e._useUTC ? Oe : Ie).apply(null, a), o = e._useUTC ? e._d.getUTCDay() : e._d.getDay(), null != e._tzm && e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm), e._nextDay && (e._a[3] = 24), e._w && void 0 !== e._w.d && e._w.d !== o && (d(e).weekdayMismatch = !0) + } + } + var ut = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + ht = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + pt = /Z|[+-]\d\d(?::?\d\d)?/, + dt = [ + ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/], + ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/], + ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/], + ["GGGG-[W]WW", /\d{4}-W\d\d/, !1], + ["YYYY-DDD", /\d{4}-\d{3}/], + ["YYYY-MM", /\d{4}-\d\d/, !1], + ["YYYYYYMMDD", /[+-]\d{10}/], + ["YYYYMMDD", /\d{8}/], + ["GGGG[W]WWE", /\d{4}W\d{3}/], + ["GGGG[W]WW", /\d{4}W\d{2}/, !1], + ["YYYYDDD", /\d{7}/] + ], + ft = [ + ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/], + ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/], + ["HH:mm:ss", /\d\d:\d\d:\d\d/], + ["HH:mm", /\d\d:\d\d/], + ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/], + ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/], + ["HHmmss", /\d\d\d\d\d\d/], + ["HHmm", /\d\d\d\d/], + ["HH", /\d\d/] + ], + mt = /^\/?Date\((\-?\d+)/i; + + function gt(e) { + var t, n, r, i, o, s, a = e._i, + l = ut.exec(a) || ht.exec(a); + if (l) { + for (d(e).iso = !0, t = 0, n = dt.length; t < n; t++) + if (dt[t][1].exec(l[1])) { + i = dt[t][0], r = !1 !== dt[t][2]; + break + } if (null == i) return void(e._isValid = !1); + if (l[3]) { + for (t = 0, n = ft.length; t < n; t++) + if (ft[t][1].exec(l[3])) { + o = (l[2] || " ") + ft[t][0]; + break + } if (null == o) return void(e._isValid = !1) + } + if (!r && null != o) return void(e._isValid = !1); + if (l[4]) { + if (!pt.exec(l[4])) return void(e._isValid = !1); + s = "Z" + } + e._f = i + (o || "") + (s || ""), St(e) + } else e._isValid = !1 } - } - renderLabel() { - const e = this.props.label, - t = this.state.inputId; - return e ? o.createElement('label', { - htmlFor: t - }, e) : null - } - render() { - return o.createElement('div', { - className: 'checkbox-component' - }, o.createElement('input', { - id: this.state.inputId, - tabIndex: this.props.tabIndex, - type: 'checkbox', - onChange: this.onChange, - ref: this.onInputRef, - disabled: this.props.disabled - }), this.renderLabel()) - } - } - t.Checkbox = a -}, function (e) { - var t = Object; - e.exports = { - create: t.create, - getProto: t.getPrototypeOf, - isEnum: {}.propertyIsEnumerable, - getDesc: t.getOwnPropertyDescriptor, - setDesc: t.defineProperty, - setDescs: t.defineProperties, - getKeys: t.keys, - getNames: t.getOwnPropertyNames, - getSymbols: t.getOwnPropertySymbols, - each: [].forEach - } -}, function (e, t, n) { - 'use strict'; + var yt = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; - function o(e) { - return e.kind === i.AppFileStatusKind.Conflicted - } + function vt(e) { + var t = parseInt(e, 10); + return t <= 49 ? 2e3 + t : t <= 999 ? 1900 + t : t + } + var wt = { + UT: 0, + GMT: 0, + EDT: -240, + EST: -300, + CDT: -300, + CST: -360, + MDT: -360, + MST: -420, + PDT: -420, + PST: -480 + }; - function r(e, t) { - return !(void 0 !== t) && (!i.isConflictWithMarkers(e) || 0 < e.conflictMarkerCount) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const i = n(23), - a = n(2); - t.mapStatus = function (e) { - switch (e.kind) { - case i.AppFileStatusKind.New: - case i.AppFileStatusKind.Untracked: - return 'New'; - case i.AppFileStatusKind.Modified: - return 'Modified'; - case i.AppFileStatusKind.Deleted: - return 'Deleted'; - case i.AppFileStatusKind.Renamed: - return 'Renamed'; - case i.AppFileStatusKind.Conflicted: - if (i.isConflictWithMarkers(e)) { - const t = e.conflictMarkerCount; - return 0 < t ? 'Conflicted' : 'Resolved' - } - return 'Conflicted'; - case i.AppFileStatusKind.Copied: - return 'Copied'; - } - return a.assertNever(e, `Unknown file status ${e}`) - }, t.isConflictedFile = o, t.hasConflictedFiles = function (e) { - return e.files.some((e) => o(e.status)) - }, t.hasUnresolvedConflicts = r, t.getUnmergedStatusEntryDescription = function (e, t) { - const n = t ? ` from ${t}` : ''; - return e === i.GitStatusEntry.Added ? `Using the added file${n}` : e === i.GitStatusEntry.UpdatedButUnmerged ? `Using the modified file${n}` : e === i.GitStatusEntry.Deleted ? `Using the deleted file${n}` : a.assertNever(e, 'Unknown status entry to format') - }, t.getLabelForManualResolutionOption = function (e, t) { - const n = t ? ` from ${t}` : ''; - return e === i.GitStatusEntry.Added ? `Use the added file${n}` : e === i.GitStatusEntry.UpdatedButUnmerged ? `Use the modified file${n}` : e === i.GitStatusEntry.Deleted ? `Use the deleted file${n}` : a.assertNever(e, 'Unknown status entry to format') - }, t.getUnmergedFiles = function (e) { - return e.files.filter((e) => o(e.status)) - }, t.getUntrackedFiles = function (e) { - return e.files.filter((e) => e.status.kind === i.AppFileStatusKind.Untracked) - }, t.getResolvedFiles = function (e, t) { - return e.files.filter((e) => i.isConflictedFileStatus(e.status) && !r(e.status, t.get(e.path))) - }, t.getConflictedFiles = function (e, t) { - return e.files.filter((e) => i.isConflictedFileStatus(e.status) && r(e.status, t.get(e.path))) - } -}, function (e, t) { - 'use strict'; - t.fromCallback = function (e) { - return Object.defineProperty(function () { - return 'function' == typeof arguments[arguments.length - 1] ? void e.apply(this, arguments) : new Promise((t, n) => { - arguments[arguments.length] = (e, o) => e ? n(e) : void t(o), arguments.length++, e.apply(this, arguments) - }) - }, 'name', { - value: e.name - }) - }, t.fromPromise = function (e) { - return Object.defineProperty(function () { - const t = arguments[arguments.length - 1]; - return 'function' == typeof t ? void e.apply(this, arguments).then((e) => t(null, e), t) : e.apply(this, arguments) - }, 'name', { - value: e.name - }) - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(22), - r = n(1); - t.shell = { - moveItemToTrash: o.shell.moveItemToTrash, - beep: o.shell.beep, - openExternal: (e) => new Promise((t) => { - o.ipcRenderer.once('open-external-result', (e, { - result: n - }) => { - t(n) - }), o.ipcRenderer.send('open-external', { - path: e - }) - }), - showItemInFolder: (e) => { - o.ipcRenderer.send('show-item-in-folder', { - path: e - }) - }, - openItem: o.shell.openItem - }, t.revealInFileManager = function (e, n) { - const o = r.join(e.path, n); - return t.shell.showItemInFolder(o) - } -}, function (e, t, n) { - 'use strict'; - const o = n(39).fromCallback, - r = o(n(743)), - i = n(742); - e.exports = { - mkdirs: r, - mkdirsSync: i, - mkdirp: r, - mkdirpSync: i, - ensureDir: r, - ensureDirSync: i - } -}, function (e) { - e.exports = require('url') -}, function (e, t, n) { - 'use strict'; + function bt(e) { + var t, n, r, i, o, s, a, l = yt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "")); + if (l) { + var c = (t = l[4], n = l[3], r = l[2], i = l[5], o = l[6], s = l[7], a = [vt(t), Te.indexOf(n), parseInt(r, 10), parseInt(i, 10), parseInt(o, 10)], s && a.push(parseInt(s, 10)), a); + if (! function (e, t, n) { + return !e || Ue.indexOf(e) === new Date(t[0], t[1], t[2]).getDay() || (d(n).weekdayMismatch = !0, n._isValid = !1, !1) + }(l[1], c, e)) return; + e._a = c, e._tzm = function (e, t, n) { + if (e) return wt[e]; + if (t) return 0; + var r = parseInt(n, 10), + i = r % 100; + return (r - i) / 100 * 60 + i + }(l[8], l[9], l[10]), e._d = Oe.apply(null, e._a), e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm), d(e).rfc2822 = !0 + } else e._isValid = !1 + } - function o() { - if ('undefined' != typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && 'function' == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) { - try { - __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o) - } catch (e) { - console.error(e) + function St(e) { + if (e._f !== r.ISO_8601) + if (e._f !== r.RFC_2822) { + e._a = [], d(e).empty = !0; + var t, n, i, o, s, a = "" + e._i, + l = a.length, + c = 0; + for (i = G(e._f, e._locale).match(H) || [], t = 0; t < i.length; t++) o = i[t], (n = (a.match(ue(o, e)) || [])[0]) && ((s = a.substr(0, a.indexOf(n))).length > 0 && d(e).unusedInput.push(s), a = a.slice(a.indexOf(n) + n.length), c += n.length), W[o] ? (n ? d(e).empty = !1 : d(e).unusedTokens.push(o), me(o, n, e)) : e._strict && !n && d(e).unusedTokens.push(o); + d(e).charsLeftOver = l - c, a.length > 0 && d(e).unusedInput.push(a), e._a[3] <= 12 && !0 === d(e).bigHour && e._a[3] > 0 && (d(e).bigHour = void 0), d(e).parsedDateParts = e._a.slice(0), d(e).meridiem = e._meridiem, e._a[3] = function (e, t, n) { + var r; + return null == n ? t : null != e.meridiemHour ? e.meridiemHour(t, n) : null != e.isPM ? ((r = e.isPM(n)) && t < 12 && (t += 12), r || 12 !== t || (t = 0), t) : t + }(e._locale, e._a[3], e._meridiem), ct(e), at(e) + } else bt(e); + else gt(e) } - } - } - o(), e.exports = n(789) -}, function (e) { - var t = String.fromCharCode, - n = Math.round, - o = Math.abs, - r = Math.max, - a = Math.floor, - s = Math.ceil, - d = Math.min; - (function (t, n) { - e.exports = n() - })(this, function () { - 'use strict'; - function e(e) { - return new RegExp('(^|\\s)' + e + '(?:$|\\s)\\s*') - } + function Ct(e) { + var t = e._i, + n = e._f; + return e._locale = e._locale || st(e._l), null === t || void 0 === n && "" === t ? m({ + nullInput: !0 + }) : ("string" == typeof t && (e._i = t = e._locale.preparse(t)), b(t) ? new w(at(t)) : (l(t) ? e._d = t : i(n) ? function (e) { + var t, n, r, i, o; + if (0 === e._f.length) return d(e).invalidFormat = !0, void(e._d = new Date(NaN)); + for (i = 0; i < e._f.length; i++) o = 0, t = y({}, e), null != e._useUTC && (t._useUTC = e._useUTC), t._f = e._f[i], St(t), f(t) && (o += d(t).charsLeftOver, o += 10 * d(t).unusedTokens.length, d(t).score = o, (null == r || o < r) && (r = o, n = t)); + h(e, n || t) + }(e) : n ? St(e) : function (e) { + var t = e._i; + s(t) ? e._d = new Date(r.now()) : l(t) ? e._d = new Date(t.valueOf()) : "string" == typeof t ? function (e) { + var t = mt.exec(e._i); + null === t ? (gt(e), !1 === e._isValid && (delete e._isValid, bt(e), !1 === e._isValid && (delete e._isValid, r.createFromInputFallback(e)))) : e._d = new Date(+t[1]) + }(e) : i(t) ? (e._a = c(t.slice(0), (function (e) { + return parseInt(e, 10) + })), ct(e)) : o(t) ? function (e) { + if (!e._d) { + var t = L(e._i); + e._a = c([t.year, t.month, t.day || t.date, t.hour, t.minute, t.second, t.millisecond], (function (e) { + return e && parseInt(e, 10) + })), ct(e) + } + }(e) : a(t) ? e._d = new Date(t) : r.createFromInputFallback(e) + }(e), f(e) || (e._d = null), e)) + } - function l(t) { - for (var e = t.childNodes.length; 0 < e; --e) t.removeChild(t.firstChild); - return t - } + function Et(e, t, n, r, s) { + var a, l = {}; + return !0 !== n && !1 !== n || (r = n, n = void 0), (o(e) && function (e) { + if (Object.getOwnPropertyNames) return 0 === Object.getOwnPropertyNames(e).length; + var t; + for (t in e) + if (e.hasOwnProperty(t)) return !1; + return !0 + }(e) || i(e) && 0 === e.length) && (e = void 0), l._isAMomentObject = !0, l._useUTC = l._isUTC = s, l._l = n, l._i = e, l._f = t, l._strict = r, (a = new w(at(Ct(l))))._nextDay && (a.add(1, "d"), a._nextDay = void 0), a + } - function c(t, n) { - return l(t).appendChild(n) - } + function kt(e, t, n, r) { + return Et(e, t, n, r, !1) + } + r.createFromInputFallback = x("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", (function (e) { + e._d = new Date(e._i + (e._useUTC ? " UTC" : "")) + })), r.ISO_8601 = function () {}, r.RFC_2822 = function () {}; + var xt = x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", (function () { + var e = kt.apply(null, arguments); + return this.isValid() && e.isValid() ? e < this ? this : e : m() + })), + Tt = x("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", (function () { + var e = kt.apply(null, arguments); + return this.isValid() && e.isValid() ? e > this ? this : e : m() + })); - function p(t, n, o, r) { - var a = document.createElement(t); - if (o && (a.className = o), r && (a.style.cssText = r), 'string' == typeof n) a.appendChild(document.createTextNode(n)); - else if (n) - for (var e = 0; e < n.length; ++e) a.appendChild(n[e]); - return a - } + function Rt(e, t) { + var n, r; + if (1 === t.length && i(t[0]) && (t = t[0]), !t.length) return kt(); + for (n = t[0], r = 1; r < t.length; ++r) t[r].isValid() && !t[r][e](n) || (n = t[r]); + return n + } + var Dt = ["year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond"]; - function u(t, n, o, r) { - var i = p(t, n, o, r); - return i.setAttribute('role', 'presentation'), i - } + function _t(e) { + var t = L(e), + n = t.year || 0, + r = t.quarter || 0, + i = t.month || 0, + o = t.week || t.isoWeek || 0, + s = t.day || 0, + a = t.hour || 0, + l = t.minute || 0, + c = t.second || 0, + u = t.millisecond || 0; + this._isValid = function (e) { + for (var t in e) + if (-1 === ve.call(Dt, t) || null != e[t] && isNaN(e[t])) return !1; + for (var n = !1, r = 0; r < Dt.length; ++r) + if (e[Dt[r]]) { + if (n) return !1; + parseFloat(e[Dt[r]]) !== C(e[Dt[r]]) && (n = !0) + } return !0 + }(t), this._milliseconds = +u + 1e3 * c + 6e4 * l + 1e3 * a * 60 * 60, this._days = +s + 7 * o, this._months = +i + 3 * r + 12 * n, this._data = {}, this._locale = st(), this._bubble() + } - function m(e, t) { - if (3 == t.nodeType && (t = t.parentNode), e.contains) return e.contains(t); - do - if (11 == t.nodeType && (t = t.host), t == e) return !0; while (t = t.parentNode) - } + function At(e) { + return e instanceof _t + } - function h() { - var e; - try { - e = document.activeElement - } catch (t) { - e = document.body || null + function Mt(e) { + return e < 0 ? -1 * Math.round(-1 * e) : Math.round(e) } - for (; e && e.shadowRoot && e.shadowRoot.activeElement;) e = e.shadowRoot.activeElement; - return e - } - function f(t, n) { - var o = t.className; - e(n).test(o) || (t.className += (o ? ' ' : '') + n) - } + function Pt(e, t) { + V(e, 0, 0, (function () { + var e = this.utcOffset(), + n = "+"; + return e < 0 && (e = -e, n = "-"), n + B(~~(e / 60), 2) + t + B(~~e % 60, 2) + })) + } + Pt("Z", ":"), Pt("ZZ", ""), ce("Z", se), ce("ZZ", se), de(["Z", "ZZ"], (function (e, t, n) { + n._useUTC = !0, n._tzm = Ot(se, e) + })); + var It = /([\+\-]|\d\d)/gi; - function g(t, n) { - for (var o = t.split(' '), r = 0; r < o.length; r++) o[r] && !e(o[r]).test(n) && (n += ' ' + o[r]); - return n - } + function Ot(e, t) { + var n = (t || "").match(e); + if (null === n) return null; + var r = ((n[n.length - 1] || []) + "").match(It) || ["-", 0, 0], + i = 60 * r[1] + C(r[2]); + return 0 === i ? 0 : "+" === r[0] ? i : -i + } - function y(e) { - var t = Array.prototype.slice.call(arguments, 1); - return function () { - return e.apply(null, t) + function Lt(e, t) { + var n, i; + return t._isUTC ? (n = t.clone(), i = (b(e) || l(e) ? e.valueOf() : kt(e).valueOf()) - n.valueOf(), n._d.setTime(n._d.valueOf() + i), r.updateOffset(n, !1), n) : kt(e).local() } - } - - function S(e, t, n) { - for (var o in t || (t = {}), e) e.hasOwnProperty(o) && (!1 !== n || !t.hasOwnProperty(o)) && (t[o] = e[o]); - return t - } - function C(e, t, o, r, a) { - null == t && (t = e.search(/[^\s\u00a0]/), -1 == t && (t = e.length)); - for (var s = r || 0, i = a || 0, n;;) { - if (n = e.indexOf('\t', s), 0 > n || n >= t) return i + (t - s); - i += n - s, i += o - i % o, s = n + 1 + function Nt(e) { + return 15 * -Math.round(e._d.getTimezoneOffset() / 15) } - } - - function b(e, t) { - for (var n = 0; n < e.length; ++n) - if (e[n] == t) return n; - return -1 - } - function v(e, t, n) { - for (var o = 0, r = 0, i;;) { - i = e.indexOf('\t', o), -1 == i && (i = e.length); - var a = i - o; - if (i == e.length || r + a >= t) return o + d(a, t - r); - if (r += i - o, r += n - r % n, o = i + 1, r >= t) return o + function Ft() { + return !!this.isValid() && this._isUTC && 0 === this._offset } - } - - function E(e) { - for (; es.length <= e;) es.push(w(es) + ' '); - return es[e] - } - - function w(e) { - return e[e.length - 1] - } - - function k(e, t) { - for (var n = [], o = 0; o < e.length; o++) n[o] = t(e[o], o); - return n - } - - function T(e, t, n) { - for (var o = 0, r = n(t); o < e.length && n(e[o]) <= r;) o++; - e.splice(o, 0, t) - } - - function _() {} - - function R(e, t) { - var n; - return Object.create ? n = Object.create(e) : (_.prototype = e, n = new _), t && S(t, n), n - } - - function x(e) { - return /\w/.test(e) || '\x80' < e && (e.toUpperCase() != e.toLowerCase() || ts.test(e)) - } + r.updateOffset = function () {}; + var Bt = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/, + Ht = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; - function P(e, t) { - return t ? !!(-1 < t.source.indexOf('\\w') && x(e)) || t.test(e) : x(e) - } - - function D(e) { - for (var t in e) - if (e.hasOwnProperty(t) && e[t]) return !1; - return !0 - } - - function M(e) { - return 768 <= e.charCodeAt(0) && ns.test(e) - } - - function A(e, t, n) { - for (; - (0 > n ? 0 < t : t < e.length) && M(e.charAt(t));) t += n; - return t - } - - function I(e, t, n) { - for (var o = t > n ? -1 : 1;;) { - if (t == n) return t; - var r = (t + n) / 2, - i = 0 > o ? s(r) : a(r); - if (i == t) return e(i) ? t : n; - e(i) ? n = i : t = i + o + function zt(e, t) { + var n, r, i, o, s, l, c = e, + h = null; + return At(e) ? c = { + ms: e._milliseconds, + d: e._days, + M: e._months + } : a(e) ? (c = {}, t ? c[t] = e : c.milliseconds = e) : (h = Bt.exec(e)) ? (n = "-" === h[1] ? -1 : 1, c = { + y: 0, + d: C(h[2]) * n, + h: C(h[3]) * n, + m: C(h[4]) * n, + s: C(h[5]) * n, + ms: C(Mt(1e3 * h[6])) * n + }) : (h = Ht.exec(e)) ? (n = "-" === h[1] ? -1 : 1, c = { + y: Ut(h[2], n), + M: Ut(h[3], n), + w: Ut(h[4], n), + d: Ut(h[5], n), + h: Ut(h[6], n), + m: Ut(h[7], n), + s: Ut(h[8], n) + }) : null == c ? c = {} : "object" == typeof c && ("from" in c || "to" in c) && (o = kt(c.from), s = kt(c.to), i = o.isValid() && s.isValid() ? (s = Lt(s, o), o.isBefore(s) ? l = Wt(o, s) : ((l = Wt(s, o)).milliseconds = -l.milliseconds, l.months = -l.months), l) : { + milliseconds: 0, + months: 0 + }, (c = {}).ms = i.milliseconds, c.M = i.months), r = new _t(c), At(e) && u(e, "_locale") && (r._locale = e._locale), r } - } - - function L(e, t, n, o) { - if (!e) return o(t, n, 'ltr', 0); - for (var a = !1, s = 0, i; s < e.length; ++s) i = e[s], (i.from < n && i.to > t || t == n && i.to == t) && (o(r(i.from, t), d(i.to, n), 1 == i.level ? 'rtl' : 'ltr', s), a = !0); - a || o(t, n, 'ltr') - } - function F(e, t, n) { - var o; - os = null; - for (var r = 0, i; r < e.length; ++r) { - if (i = e[r], i.from < t && i.to > t) return r; - i.to == t && (i.from != i.to && 'before' == n ? o = r : os = r), i.from == t && (i.from != i.to && 'before' != n ? o = r : os = r) + function Ut(e, t) { + var n = e && parseFloat(e.replace(",", ".")); + return (isNaN(n) ? 0 : n) * t } - return null == o ? os : o - } - - function B(e, t) { - var n = e.order; - return null == n && (n = e.order = rs(e.text, t)), n - } - function N(e, t) { - return e._handlers && e._handlers[t] || is - } + function Wt(e, t) { + var n = {}; + return n.months = t.month() - e.month() + 12 * (t.year() - e.year()), e.clone().add(n.months, "M").isAfter(t) && --n.months, n.milliseconds = +t - +e.clone().add(n.months, "M"), n + } - function O(e, t, n) { - if (e.removeEventListener) e.removeEventListener(t, n, !1); - else if (e.detachEvent) e.detachEvent('on' + t, n); - else { - var o = e._handlers, - r = o && o[t]; - if (r) { - var i = b(r, n); - 1 < i && (o[t] = r.slice(0, i).concat(r.slice(i + 1))) + function Vt(e, t) { + return function (n, r) { + var i; + return null === r || isNaN(+r) || (D(t, "moment()." + t + "(period, number) is deprecated. Please use moment()." + t + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."), i = n, n = r, r = i), jt(this, zt(n = "string" == typeof n ? +n : n, r), e), this } } - } - function H(e, t) { - var n = N(e, t); - if (n.length) - for (var o = Array.prototype.slice.call(arguments, 2), r = 0; r < n.length; ++r) n[r].apply(null, o) - } + function jt(e, t, n, i) { + var o = t._milliseconds, + s = Mt(t._days), + a = Mt(t._months); + e.isValid() && (i = null == i || i, a && De(e, Se(e, "Month") + a * n), s && Ce(e, "Date", Se(e, "Date") + s * n), o && e._d.setTime(e._d.valueOf() + o * n), i && r.updateOffset(e, s || a)) + } + zt.fn = _t.prototype, zt.invalid = function () { + return zt(NaN) + }; + var Gt = Vt(1, "add"), + $t = Vt(-1, "subtract"); - function z(t, n, o) { - return 'string' == typeof n && (n = { - type: n, - preventDefault: function () { - this.defaultPrevented = !0 - } - }), H(t, o || n.type, t, n), j(n) || n.codemirrorIgnore - } + function qt(e, t) { + var n = 12 * (t.year() - e.year()) + (t.month() - e.month()), + r = e.clone().add(n, "months"); + return -(n + (t - r < 0 ? (t - r) / (r - e.clone().add(n - 1, "months")) : (t - r) / (e.clone().add(n + 1, "months") - r))) || 0 + } - function U(e) { - var t = e._handlers && e._handlers.cursorActivity; - if (t) - for (var n = e.curOp.cursorActivityHandlers || (e.curOp.cursorActivityHandlers = []), o = 0; o < t.length; ++o) - 1 == b(n, t[o]) && n.push(t[o]) - } + function Kt(e) { + var t; + return void 0 === e ? this._locale._abbr : (null != (t = st(e)) && (this._locale = t), this) + } + r.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ", r.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]"; + var Yt = x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", (function (e) { + return void 0 === e ? this.localeData() : this.locale(e) + })); - function W(e, t) { - return 0 < N(e, t).length - } + function Qt() { + return this._locale + } - function V(e) { - e.prototype.on = function (e, t) { - as(this, e, t) - }, e.prototype.off = function (e, t) { - O(this, e, t) + function Zt(e, t) { + return (e % t + t) % t } - } - function G(t) { - t.preventDefault ? t.preventDefault() : t.returnValue = !1 - } + function Xt(e, t, n) { + return e < 100 && e >= 0 ? new Date(e + 400, t, n) - 126227808e5 : new Date(e, t, n).valueOf() + } - function K(t) { - t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0 - } + function Jt(e, t, n) { + return e < 100 && e >= 0 ? Date.UTC(e + 400, t, n) - 126227808e5 : Date.UTC(e, t, n) + } - function j(t) { - return null == t.defaultPrevented ? !1 == t.returnValue : t.defaultPrevented - } + function en(e, t) { + V(0, [e, e.length], 0, t) + } - function q(t) { - G(t), K(t) - } + function tn(e, t, n, r, i) { + var o; + return null == e ? Fe(this, r, i).year : (t > (o = Be(e, r, i)) && (t = o), nn.call(this, e, t, n, r, i)) + } - function Y(t) { - return t.target || t.srcElement - } + function nn(e, t, n, r, i) { + var o = Ne(e, t, n, r, i), + s = Oe(o.year, 0, o.dayOfYear); + return this.year(s.getUTCFullYear()), this.month(s.getUTCMonth()), this.date(s.getUTCDate()), this + } + V(0, ["gg", 2], 0, (function () { + return this.weekYear() % 100 + })), V(0, ["GG", 2], 0, (function () { + return this.isoWeekYear() % 100 + })), en("gggg", "weekYear"), en("ggggg", "weekYear"), en("GGGG", "isoWeekYear"), en("GGGGG", "isoWeekYear"), I("weekYear", "gg"), I("isoWeekYear", "GG"), F("weekYear", 1), F("isoWeekYear", 1), ce("G", ie), ce("g", ie), ce("GG", Z, q), ce("gg", Z, q), ce("GGGG", te, Y), ce("gggg", te, Y), ce("GGGGG", ne, Q), ce("ggggg", ne, Q), fe(["gggg", "ggggg", "GGGG", "GGGGG"], (function (e, t, n, r) { + t[r.substr(0, 2)] = C(e) + })), fe(["gg", "GG"], (function (e, t, n, i) { + t[i] = r.parseTwoDigitYear(e) + })), V("Q", 0, "Qo", "quarter"), I("quarter", "Q"), F("quarter", 7), ce("Q", $), de("Q", (function (e, t) { + t[1] = 3 * (C(e) - 1) + })), V("D", ["DD", 2], "Do", "date"), I("date", "D"), F("date", 9), ce("D", Z), ce("DD", Z, q), ce("Do", (function (e, t) { + return e ? t._dayOfMonthOrdinalParse || t._ordinalParse : t._dayOfMonthOrdinalParseLenient + })), de(["D", "DD"], 2), de("Do", (function (e, t) { + t[2] = C(e.match(Z)[0]) + })); + var rn = be("Date", !0); + V("DDD", ["DDDD", 3], "DDDo", "dayOfYear"), I("dayOfYear", "DDD"), F("dayOfYear", 4), ce("DDD", ee), ce("DDDD", K), de(["DDD", "DDDD"], (function (e, t, n) { + n._dayOfYear = C(e) + })), V("m", ["mm", 2], 0, "minute"), I("minute", "m"), F("minute", 14), ce("m", Z), ce("mm", Z, q), de(["m", "mm"], 4); + var on = be("Minutes", !1); + V("s", ["ss", 2], 0, "second"), I("second", "s"), F("second", 15), ce("s", Z), ce("ss", Z, q), de(["s", "ss"], 5); + var sn, an = be("Seconds", !1); + for (V("S", 0, 0, (function () { + return ~~(this.millisecond() / 100) + })), V(0, ["SS", 2], 0, (function () { + return ~~(this.millisecond() / 10) + })), V(0, ["SSS", 3], 0, "millisecond"), V(0, ["SSSS", 4], 0, (function () { + return 10 * this.millisecond() + })), V(0, ["SSSSS", 5], 0, (function () { + return 100 * this.millisecond() + })), V(0, ["SSSSSS", 6], 0, (function () { + return 1e3 * this.millisecond() + })), V(0, ["SSSSSSS", 7], 0, (function () { + return 1e4 * this.millisecond() + })), V(0, ["SSSSSSSS", 8], 0, (function () { + return 1e5 * this.millisecond() + })), V(0, ["SSSSSSSSS", 9], 0, (function () { + return 1e6 * this.millisecond() + })), I("millisecond", "ms"), F("millisecond", 16), ce("S", ee, $), ce("SS", ee, q), ce("SSS", ee, K), sn = "SSSS"; sn.length <= 9; sn += "S") ce(sn, re); + + function ln(e, t) { + t[6] = C(1e3 * ("0." + e)) + } + for (sn = "S"; sn.length <= 9; sn += "S") de(sn, ln); + var cn = be("Milliseconds", !1); + V("z", 0, 0, "zoneAbbr"), V("zz", 0, 0, "zoneName"); + var un = w.prototype; + + function hn(e) { + return e + } + un.add = Gt, un.calendar = function (e, t) { + var n = e || kt(), + i = Lt(n, this).startOf("day"), + o = r.calendarFormat(this, i) || "sameElse", + s = t && (_(t[o]) ? t[o].call(this, n) : t[o]); + return this.format(s || this.localeData().calendar(o, this, kt(n))) + }, un.clone = function () { + return new w(this) + }, un.diff = function (e, t, n) { + var r, i, o; + if (!this.isValid()) return NaN; + if (!(r = Lt(e, this)).isValid()) return NaN; + switch (i = 6e4 * (r.utcOffset() - this.utcOffset()), t = O(t)) { + case "year": + o = qt(this, r) / 12; + break; + case "month": + o = qt(this, r); + break; + case "quarter": + o = qt(this, r) / 3; + break; + case "second": + o = (this - r) / 1e3; + break; + case "minute": + o = (this - r) / 6e4; + break; + case "hour": + o = (this - r) / 36e5; + break; + case "day": + o = (this - r - i) / 864e5; + break; + case "week": + o = (this - r - i) / 6048e5; + break; + default: + o = this - r + } + return n ? o : S(o) + }, un.endOf = function (e) { + var t; + if (void 0 === (e = O(e)) || "millisecond" === e || !this.isValid()) return this; + var n = this._isUTC ? Jt : Xt; + switch (e) { + case "year": + t = n(this.year() + 1, 0, 1) - 1; + break; + case "quarter": + t = n(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; + break; + case "month": + t = n(this.year(), this.month() + 1, 1) - 1; + break; + case "week": + t = n(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; + break; + case "isoWeek": + t = n(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; + break; + case "day": + case "date": + t = n(this.year(), this.month(), this.date() + 1) - 1; + break; + case "hour": + t = this._d.valueOf(), t += 36e5 - Zt(t + (this._isUTC ? 0 : 6e4 * this.utcOffset()), 36e5) - 1; + break; + case "minute": + t = this._d.valueOf(), t += 6e4 - Zt(t, 6e4) - 1; + break; + case "second": + t = this._d.valueOf(), t += 1e3 - Zt(t, 1e3) - 1 + } + return this._d.setTime(t), r.updateOffset(this, !0), this + }, un.format = function (e) { + e || (e = this.isUtc() ? r.defaultFormatUtc : r.defaultFormat); + var t = j(this, e); + return this.localeData().postformat(t) + }, un.from = function (e, t) { + return this.isValid() && (b(e) && e.isValid() || kt(e).isValid()) ? zt({ + to: this, + from: e + }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate() + }, un.fromNow = function (e) { + return this.from(kt(), e) + }, un.to = function (e, t) { + return this.isValid() && (b(e) && e.isValid() || kt(e).isValid()) ? zt({ + from: this, + to: e + }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate() + }, un.toNow = function (e) { + return this.to(kt(), e) + }, un.get = function (e) { + return _(this[e = O(e)]) ? this[e]() : this + }, un.invalidAt = function () { + return d(this).overflow + }, un.isAfter = function (e, t) { + var n = b(e) ? e : kt(e); + return !(!this.isValid() || !n.isValid()) && ("millisecond" === (t = O(t) || "millisecond") ? this.valueOf() > n.valueOf() : n.valueOf() < this.clone().startOf(t).valueOf()) + }, un.isBefore = function (e, t) { + var n = b(e) ? e : kt(e); + return !(!this.isValid() || !n.isValid()) && ("millisecond" === (t = O(t) || "millisecond") ? this.valueOf() < n.valueOf() : this.clone().endOf(t).valueOf() < n.valueOf()) + }, un.isBetween = function (e, t, n, r) { + var i = b(e) ? e : kt(e), + o = b(t) ? t : kt(t); + return !!(this.isValid() && i.isValid() && o.isValid()) && ("(" === (r = r || "()")[0] ? this.isAfter(i, n) : !this.isBefore(i, n)) && (")" === r[1] ? this.isBefore(o, n) : !this.isAfter(o, n)) + }, un.isSame = function (e, t) { + var n, r = b(e) ? e : kt(e); + return !(!this.isValid() || !r.isValid()) && ("millisecond" === (t = O(t) || "millisecond") ? this.valueOf() === r.valueOf() : (n = r.valueOf(), this.clone().startOf(t).valueOf() <= n && n <= this.clone().endOf(t).valueOf())) + }, un.isSameOrAfter = function (e, t) { + return this.isSame(e, t) || this.isAfter(e, t) + }, un.isSameOrBefore = function (e, t) { + return this.isSame(e, t) || this.isBefore(e, t) + }, un.isValid = function () { + return f(this) + }, un.lang = Yt, un.locale = Kt, un.localeData = Qt, un.max = Tt, un.min = xt, un.parsingFlags = function () { + return h({}, d(this)) + }, un.set = function (e, t) { + if ("object" == typeof e) + for (var n = function (e) { + var t = []; + for (var n in e) t.push({ + unit: n, + priority: N[n] + }); + return t.sort((function (e, t) { + return e.priority - t.priority + })), t + }(e = L(e)), r = 0; r < n.length; r++) this[n[r].unit](e[n[r].unit]); + else if (_(this[e = O(e)])) return this[e](t); + return this + }, un.startOf = function (e) { + var t; + if (void 0 === (e = O(e)) || "millisecond" === e || !this.isValid()) return this; + var n = this._isUTC ? Jt : Xt; + switch (e) { + case "year": + t = n(this.year(), 0, 1); + break; + case "quarter": + t = n(this.year(), this.month() - this.month() % 3, 1); + break; + case "month": + t = n(this.year(), this.month(), 1); + break; + case "week": + t = n(this.year(), this.month(), this.date() - this.weekday()); + break; + case "isoWeek": + t = n(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); + break; + case "day": + case "date": + t = n(this.year(), this.month(), this.date()); + break; + case "hour": + t = this._d.valueOf(), t -= Zt(t + (this._isUTC ? 0 : 6e4 * this.utcOffset()), 36e5); + break; + case "minute": + t = this._d.valueOf(), t -= Zt(t, 6e4); + break; + case "second": + t = this._d.valueOf(), t -= Zt(t, 1e3) + } + return this._d.setTime(t), r.updateOffset(this, !0), this + }, un.subtract = $t, un.toArray = function () { + var e = this; + return [e.year(), e.month(), e.date(), e.hour(), e.minute(), e.second(), e.millisecond()] + }, un.toObject = function () { + var e = this; + return { + years: e.year(), + months: e.month(), + date: e.date(), + hours: e.hours(), + minutes: e.minutes(), + seconds: e.seconds(), + milliseconds: e.milliseconds() + } + }, un.toDate = function () { + return new Date(this.valueOf()) + }, un.toISOString = function (e) { + if (!this.isValid()) return null; + var t = !0 !== e, + n = t ? this.clone().utc() : this; + return n.year() < 0 || n.year() > 9999 ? j(n, t ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ") : _(Date.prototype.toISOString) ? t ? this.toDate().toISOString() : new Date(this.valueOf() + 60 * this.utcOffset() * 1e3).toISOString().replace("Z", j(n, "Z")) : j(n, t ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ") + }, un.inspect = function () { + if (!this.isValid()) return "moment.invalid(/* " + this._i + " */)"; + var e = "moment", + t = ""; + this.isLocal() || (e = 0 === this.utcOffset() ? "moment.utc" : "moment.parseZone", t = "Z"); + var n = "[" + e + '("]', + r = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY", + i = t + '[")]'; + return this.format(n + r + "-MM-DD[T]HH:mm:ss.SSS" + i) + }, un.toJSON = function () { + return this.isValid() ? this.toISOString() : null + }, un.toString = function () { + return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ") + }, un.unix = function () { + return Math.floor(this.valueOf() / 1e3) + }, un.valueOf = function () { + return this._d.valueOf() - 6e4 * (this._offset || 0) + }, un.creationData = function () { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict + } + }, un.year = we, un.isLeapYear = function () { + return ye(this.year()) + }, un.weekYear = function (e) { + return tn.call(this, e, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy) + }, un.isoWeekYear = function (e) { + return tn.call(this, e, this.isoWeek(), this.isoWeekday(), 1, 4) + }, un.quarter = un.quarters = function (e) { + return null == e ? Math.ceil((this.month() + 1) / 3) : this.month(3 * (e - 1) + this.month() % 3) + }, un.month = _e, un.daysInMonth = function () { + return Ee(this.year(), this.month()) + }, un.week = un.weeks = function (e) { + var t = this.localeData().week(this); + return null == e ? t : this.add(7 * (e - t), "d") + }, un.isoWeek = un.isoWeeks = function (e) { + var t = Fe(this, 1, 4).week; + return null == e ? t : this.add(7 * (e - t), "d") + }, un.weeksInYear = function () { + var e = this.localeData()._week; + return Be(this.year(), e.dow, e.doy) + }, un.isoWeeksInYear = function () { + return Be(this.year(), 1, 4) + }, un.date = rn, un.day = un.days = function (e) { + if (!this.isValid()) return null != e ? this : NaN; + var t = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + return null != e ? (e = function (e, t) { + return "string" != typeof e ? e : isNaN(e) ? "number" == typeof (e = t.weekdaysParse(e)) ? e : null : parseInt(e, 10) + }(e, this.localeData()), this.add(e - t, "d")) : t + }, un.weekday = function (e) { + if (!this.isValid()) return null != e ? this : NaN; + var t = (this.day() + 7 - this.localeData()._week.dow) % 7; + return null == e ? t : this.add(e - t, "d") + }, un.isoWeekday = function (e) { + if (!this.isValid()) return null != e ? this : NaN; + if (null != e) { + var t = function (e, t) { + return "string" == typeof e ? t.weekdaysParse(e) % 7 || 7 : isNaN(e) ? null : e + }(e, this.localeData()); + return this.day(this.day() % 7 ? t : t - 7) + } + return this.day() || 7 + }, un.dayOfYear = function (e) { + var t = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1; + return null == e ? t : this.add(e - t, "d") + }, un.hour = un.hours = Xe, un.minute = un.minutes = on, un.second = un.seconds = an, un.millisecond = un.milliseconds = cn, un.utcOffset = function (e, t, n) { + var i, o = this._offset || 0; + if (!this.isValid()) return null != e ? this : NaN; + if (null != e) { + if ("string" == typeof e) { + if (null === (e = Ot(se, e))) return this + } else Math.abs(e) < 16 && !n && (e *= 60); + return !this._isUTC && t && (i = Nt(this)), this._offset = e, this._isUTC = !0, null != i && this.add(i, "m"), o !== e && (!t || this._changeInProgress ? jt(this, zt(e - o, "m"), 1, !1) : this._changeInProgress || (this._changeInProgress = !0, r.updateOffset(this, !0), this._changeInProgress = null)), this + } + return this._isUTC ? o : Nt(this) + }, un.utc = function (e) { + return this.utcOffset(0, e) + }, un.local = function (e) { + return this._isUTC && (this.utcOffset(0, e), this._isUTC = !1, e && this.subtract(Nt(this), "m")), this + }, un.parseZone = function () { + if (null != this._tzm) this.utcOffset(this._tzm, !1, !0); + else if ("string" == typeof this._i) { + var e = Ot(oe, this._i); + null != e ? this.utcOffset(e) : this.utcOffset(0, !0) + } + return this + }, un.hasAlignedHourOffset = function (e) { + return !!this.isValid() && (e = e ? kt(e).utcOffset() : 0, (this.utcOffset() - e) % 60 == 0) + }, un.isDST = function () { + return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() + }, un.isLocal = function () { + return !!this.isValid() && !this._isUTC + }, un.isUtcOffset = function () { + return !!this.isValid() && this._isUTC + }, un.isUtc = Ft, un.isUTC = Ft, un.zoneAbbr = function () { + return this._isUTC ? "UTC" : "" + }, un.zoneName = function () { + return this._isUTC ? "Coordinated Universal Time" : "" + }, un.dates = x("dates accessor is deprecated. Use date instead.", rn), un.months = x("months accessor is deprecated. Use month instead", _e), un.years = x("years accessor is deprecated. Use year instead", we), un.zone = x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", (function (e, t) { + return null != e ? ("string" != typeof e && (e = -e), this.utcOffset(e, t), this) : -this.utcOffset() + })), un.isDSTShifted = x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", (function () { + if (!s(this._isDSTShifted)) return this._isDSTShifted; + var e = {}; + if (y(e, this), (e = Ct(e))._a) { + var t = e._isUTC ? p(e._a) : kt(e._a); + this._isDSTShifted = this.isValid() && E(e._a, t.toArray()) > 0 + } else this._isDSTShifted = !1; + return this._isDSTShifted + })); + var pn = M.prototype; - function X(t) { - var e = t.which; - return null == e && (1 & t.button ? e = 1 : 2 & t.button ? e = 3 : 4 & t.button && (e = 2)), Ha && t.ctrlKey && 1 == e && (e = 3), e - } + function dn(e, t, n, r) { + var i = st(), + o = p().set(r, t); + return i[n](o, e) + } - function Q(e) { - if (null == fs) { - var t = p('span', '\u200B'); - c(e, p('span', [t, document.createTextNode('x')])), 0 != e.firstChild.offsetHeight && (fs = 1 >= t.offsetWidth && 2 < t.offsetHeight && !(Ra && 8 > xa)) + function fn(e, t, n) { + if (a(e) && (t = e, e = void 0), e = e || "", null != t) return dn(e, t, n, "month"); + var r, i = []; + for (r = 0; r < 12; r++) i[r] = dn(e, r, n, "month"); + return i } - var n = fs ? p('span', '\u200B') : p('span', '\xA0', null, 'display: inline-block; width: 1px; margin-right: -1px'); - return n.setAttribute('cm-text', ''), n - } - function $(e) { - if (null != gs) return gs; - var t = c(e, document.createTextNode('A\u062EA')), - n = ja(t, 0, 1).getBoundingClientRect(), - o = ja(t, 1, 2).getBoundingClientRect(); - return l(e), !!(n && n.left != n.right) && (gs = 3 > o.right - n.right) - } + function mn(e, t, n, r) { + "boolean" == typeof e ? (a(t) && (n = t, t = void 0), t = t || "") : (n = t = e, e = !1, a(t) && (n = t, t = void 0), t = t || ""); + var i, o = st(), + s = e ? o._week.dow : 0; + if (null != n) return dn(t, (n + s) % 7, r, "day"); + var l = []; + for (i = 0; i < 7; i++) l[i] = dn(t, (i + s) % 7, r, "day"); + return l + } + pn.calendar = function (e, t, n) { + var r = this._calendar[e] || this._calendar.sameElse; + return _(r) ? r.call(t, n) : r + }, pn.longDateFormat = function (e) { + var t = this._longDateFormat[e], + n = this._longDateFormat[e.toUpperCase()]; + return t || !n ? t : (this._longDateFormat[e] = n.replace(/MMMM|MM|DD|dddd/g, (function (e) { + return e.slice(1) + })), this._longDateFormat[e]) + }, pn.invalidDate = function () { + return this._invalidDate + }, pn.ordinal = function (e) { + return this._ordinal.replace("%d", e) + }, pn.preparse = hn, pn.postformat = hn, pn.relativeTime = function (e, t, n, r) { + var i = this._relativeTime[n]; + return _(i) ? i(e, t, n, r) : i.replace(/%d/i, e) + }, pn.pastFuture = function (e, t) { + var n = this._relativeTime[e > 0 ? "future" : "past"]; + return _(n) ? n(t) : n.replace(/%s/i, t) + }, pn.set = function (e) { + var t, n; + for (n in e) _(t = e[n]) ? this[n] = t : this["_" + n] = t; + this._config = e, this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source) + }, pn.months = function (e, t) { + return e ? i(this._months) ? this._months[e.month()] : this._months[(this._months.isFormat || ke).test(t) ? "format" : "standalone"][e.month()] : i(this._months) ? this._months : this._months.standalone + }, pn.monthsShort = function (e, t) { + return e ? i(this._monthsShort) ? this._monthsShort[e.month()] : this._monthsShort[ke.test(t) ? "format" : "standalone"][e.month()] : i(this._monthsShort) ? this._monthsShort : this._monthsShort.standalone + }, pn.monthsParse = function (e, t, n) { + var r, i, o; + if (this._monthsParseExact) return Re.call(this, e, t, n); + for (this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), r = 0; r < 12; r++) { + if (i = p([2e3, r]), n && !this._longMonthsParse[r] && (this._longMonthsParse[r] = new RegExp("^" + this.months(i, "").replace(".", "") + "$", "i"), this._shortMonthsParse[r] = new RegExp("^" + this.monthsShort(i, "").replace(".", "") + "$", "i")), n || this._monthsParse[r] || (o = "^" + this.months(i, "") + "|^" + this.monthsShort(i, ""), this._monthsParse[r] = new RegExp(o.replace(".", ""), "i")), n && "MMMM" === t && this._longMonthsParse[r].test(e)) return r; + if (n && "MMM" === t && this._shortMonthsParse[r].test(e)) return r; + if (!n && this._monthsParse[r].test(e)) return r + } + }, pn.monthsRegex = function (e) { + return this._monthsParseExact ? (u(this, "_monthsRegex") || Pe.call(this), e ? this._monthsStrictRegex : this._monthsRegex) : (u(this, "_monthsRegex") || (this._monthsRegex = Me), this._monthsStrictRegex && e ? this._monthsStrictRegex : this._monthsRegex) + }, pn.monthsShortRegex = function (e) { + return this._monthsParseExact ? (u(this, "_monthsRegex") || Pe.call(this), e ? this._monthsShortStrictRegex : this._monthsShortRegex) : (u(this, "_monthsShortRegex") || (this._monthsShortRegex = Ae), this._monthsShortStrictRegex && e ? this._monthsShortStrictRegex : this._monthsShortRegex) + }, pn.week = function (e) { + return Fe(e, this._week.dow, this._week.doy).week + }, pn.firstDayOfYear = function () { + return this._week.doy + }, pn.firstDayOfWeek = function () { + return this._week.dow + }, pn.weekdays = function (e, t) { + var n = i(this._weekdays) ? this._weekdays : this._weekdays[e && !0 !== e && this._weekdays.isFormat.test(t) ? "format" : "standalone"]; + return !0 === e ? He(n, this._week.dow) : e ? n[e.day()] : n + }, pn.weekdaysMin = function (e) { + return !0 === e ? He(this._weekdaysMin, this._week.dow) : e ? this._weekdaysMin[e.day()] : this._weekdaysMin + }, pn.weekdaysShort = function (e) { + return !0 === e ? He(this._weekdaysShort, this._week.dow) : e ? this._weekdaysShort[e.day()] : this._weekdaysShort + }, pn.weekdaysParse = function (e, t, n) { + var r, i, o; + if (this._weekdaysParseExact) return Ve.call(this, e, t, n); + for (this._weekdaysParse || (this._weekdaysParse = [], this._minWeekdaysParse = [], this._shortWeekdaysParse = [], this._fullWeekdaysParse = []), r = 0; r < 7; r++) { + if (i = p([2e3, 1]).day(r), n && !this._fullWeekdaysParse[r] && (this._fullWeekdaysParse[r] = new RegExp("^" + this.weekdays(i, "").replace(".", "\\.?") + "$", "i"), this._shortWeekdaysParse[r] = new RegExp("^" + this.weekdaysShort(i, "").replace(".", "\\.?") + "$", "i"), this._minWeekdaysParse[r] = new RegExp("^" + this.weekdaysMin(i, "").replace(".", "\\.?") + "$", "i")), this._weekdaysParse[r] || (o = "^" + this.weekdays(i, "") + "|^" + this.weekdaysShort(i, "") + "|^" + this.weekdaysMin(i, ""), this._weekdaysParse[r] = new RegExp(o.replace(".", ""), "i")), n && "dddd" === t && this._fullWeekdaysParse[r].test(e)) return r; + if (n && "ddd" === t && this._shortWeekdaysParse[r].test(e)) return r; + if (n && "dd" === t && this._minWeekdaysParse[r].test(e)) return r; + if (!n && this._weekdaysParse[r].test(e)) return r + } + }, pn.weekdaysRegex = function (e) { + return this._weekdaysParseExact ? (u(this, "_weekdaysRegex") || qe.call(this), e ? this._weekdaysStrictRegex : this._weekdaysRegex) : (u(this, "_weekdaysRegex") || (this._weekdaysRegex = je), this._weekdaysStrictRegex && e ? this._weekdaysStrictRegex : this._weekdaysRegex) + }, pn.weekdaysShortRegex = function (e) { + return this._weekdaysParseExact ? (u(this, "_weekdaysRegex") || qe.call(this), e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex) : (u(this, "_weekdaysShortRegex") || (this._weekdaysShortRegex = Ge), this._weekdaysShortStrictRegex && e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex) + }, pn.weekdaysMinRegex = function (e) { + return this._weekdaysParseExact ? (u(this, "_weekdaysRegex") || qe.call(this), e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex) : (u(this, "_weekdaysMinRegex") || (this._weekdaysMinRegex = $e), this._weekdaysMinStrictRegex && e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex) + }, pn.isPM = function (e) { + return "p" === (e + "").toLowerCase().charAt(0) + }, pn.meridiem = function (e, t, n) { + return e > 11 ? n ? "pm" : "PM" : n ? "am" : "AM" + }, it("en", { + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function (e) { + var t = e % 10; + return e + (1 === C(e % 100 / 10) ? "th" : 1 === t ? "st" : 2 === t ? "nd" : 3 === t ? "rd" : "th") + } + }), r.lang = x("moment.lang is deprecated. Use moment.locale instead.", it), r.langData = x("moment.langData is deprecated. Use moment.localeData instead.", st); + var gn = Math.abs; - function Z(e) { - if (null != cs) return cs; - var t = c(e, p('span', 'x')), - n = t.getBoundingClientRect(), - r = ja(t, 0, 1).getBoundingClientRect(); - return cs = 1 < o(n.left - r.left) - } + function yn(e, t, n, r) { + var i = zt(t, n); + return e._milliseconds += r * i._milliseconds, e._days += r * i._days, e._months += r * i._months, e._bubble() + } - function J(e, t) { - 2 < arguments.length && (t.dependencies = Array.prototype.slice.call(arguments, 2)), ps[e] = t - } + function vn(e) { + return e < 0 ? Math.floor(e) : Math.ceil(e) + } - function ee(e) { - if ('string' == typeof e && us.hasOwnProperty(e)) e = us[e]; - else if (e && 'string' == typeof e.name && us.hasOwnProperty(e.name)) { - var t = us[e.name]; - 'string' == typeof t && (t = { - name: t - }), e = R(t, e), e.name = t.name - } else { - if ('string' == typeof e && /^[\w\-]+\/[\w\-]+\+xml$/.test(e)) return ee('application/xml'); - if ('string' == typeof e && /^[\w\-]+\/[\w\-]+\+json$/.test(e)) return ee('application/json') + function wn(e) { + return 4800 * e / 146097 } - return 'string' == typeof e ? { - name: e - } : e || { - name: 'null' + + function bn(e) { + return 146097 * e / 4800 } - } - function te(e, t) { - t = ee(t); - var n = ps[t.name]; - if (!n) return te(e, 'text/plain'); - var o = n(e, t); - if (ms.hasOwnProperty(t.name)) { - var r = ms[t.name]; - for (var i in r) r.hasOwnProperty(i) && (o.hasOwnProperty(i) && (o['_' + i] = o[i]), o[i] = r[i]) + function Sn(e) { + return function () { + return this.as(e) + } } - if (o.name = t.name, t.helperType && (o.helperType = t.helperType), t.modeProps) - for (var a in t.modeProps) o[a] = t.modeProps[a]; - return o - } + var Cn = Sn("ms"), + En = Sn("s"), + kn = Sn("m"), + xn = Sn("h"), + Tn = Sn("d"), + Rn = Sn("w"), + Dn = Sn("M"), + _n = Sn("Q"), + An = Sn("y"); - function ne(e, t) { - var n = ms.hasOwnProperty(e) ? ms[e] : ms[e] = {}; - S(t, n) - } + function Mn(e) { + return function () { + return this.isValid() ? this._data[e] : NaN + } + } + var Pn = Mn("milliseconds"), + In = Mn("seconds"), + On = Mn("minutes"), + Ln = Mn("hours"), + Nn = Mn("days"), + Fn = Mn("months"), + Bn = Mn("years"), + Hn = Math.round, + zn = { + ss: 44, + s: 45, + m: 45, + h: 22, + d: 26, + M: 11 + }; - function oe(e, t) { - if (!0 === t) return t; - if (e.copyState) return e.copyState(t); - var o = {}; - for (var r in t) { - var n = t[r]; - n instanceof Array && (n = n.concat([])), o[r] = n + function Un(e, t, n, r, i) { + return i.relativeTime(t || 1, !!n, e, r) } - return o - } + var Wn = Math.abs; - function re(e, t) { - for (var n; e.innerMode && (n = e.innerMode(t), n && n.mode != e);) t = n.state, e = n.mode; - return n || { - mode: e, - state: t + function Vn(e) { + return (e > 0) - (e < 0) || +e } + + function jn() { + if (!this.isValid()) return this.localeData().invalidDate(); + var e, t, n = Wn(this._milliseconds) / 1e3, + r = Wn(this._days), + i = Wn(this._months); + e = S(n / 60), t = S(e / 60), n %= 60, e %= 60; + var o = S(i / 12), + s = i %= 12, + a = r, + l = t, + c = e, + u = n ? n.toFixed(3).replace(/\.?0+$/, "") : "", + h = this.asSeconds(); + if (!h) return "P0D"; + var p = h < 0 ? "-" : "", + d = Vn(this._months) !== Vn(h) ? "-" : "", + f = Vn(this._days) !== Vn(h) ? "-" : "", + m = Vn(this._milliseconds) !== Vn(h) ? "-" : ""; + return p + "P" + (o ? d + o + "Y" : "") + (s ? d + s + "M" : "") + (a ? f + a + "D" : "") + (l || c || u ? "T" : "") + (l ? m + l + "H" : "") + (c ? m + c + "M" : "") + (u ? m + u + "S" : "") + } + var Gn = _t.prototype; + return Gn.isValid = function () { + return this._isValid + }, Gn.abs = function () { + var e = this._data; + return this._milliseconds = gn(this._milliseconds), this._days = gn(this._days), this._months = gn(this._months), e.milliseconds = gn(e.milliseconds), e.seconds = gn(e.seconds), e.minutes = gn(e.minutes), e.hours = gn(e.hours), e.months = gn(e.months), e.years = gn(e.years), this + }, Gn.add = function (e, t) { + return yn(this, e, t, 1) + }, Gn.subtract = function (e, t) { + return yn(this, e, t, -1) + }, Gn.as = function (e) { + if (!this.isValid()) return NaN; + var t, n, r = this._milliseconds; + if ("month" === (e = O(e)) || "quarter" === e || "year" === e) switch (t = this._days + r / 864e5, n = this._months + wn(t), e) { + case "month": + return n; + case "quarter": + return n / 3; + case "year": + return n / 12 + } else switch (t = this._days + Math.round(bn(this._months)), e) { + case "week": + return t / 7 + r / 6048e5; + case "day": + return t + r / 864e5; + case "hour": + return 24 * t + r / 36e5; + case "minute": + return 1440 * t + r / 6e4; + case "second": + return 86400 * t + r / 1e3; + case "millisecond": + return Math.floor(864e5 * t) + r; + default: + throw new Error("Unknown unit " + e) + } + }, Gn.asMilliseconds = Cn, Gn.asSeconds = En, Gn.asMinutes = kn, Gn.asHours = xn, Gn.asDays = Tn, Gn.asWeeks = Rn, Gn.asMonths = Dn, Gn.asQuarters = _n, Gn.asYears = An, Gn.valueOf = function () { + return this.isValid() ? this._milliseconds + 864e5 * this._days + this._months % 12 * 2592e6 + 31536e6 * C(this._months / 12) : NaN + }, Gn._bubble = function () { + var e, t, n, r, i, o = this._milliseconds, + s = this._days, + a = this._months, + l = this._data; + return o >= 0 && s >= 0 && a >= 0 || o <= 0 && s <= 0 && a <= 0 || (o += 864e5 * vn(bn(a) + s), s = 0, a = 0), l.milliseconds = o % 1e3, e = S(o / 1e3), l.seconds = e % 60, t = S(e / 60), l.minutes = t % 60, n = S(t / 60), l.hours = n % 24, s += S(n / 24), i = S(wn(s)), a += i, s -= vn(bn(i)), r = S(a / 12), a %= 12, l.days = s, l.months = a, l.years = r, this + }, Gn.clone = function () { + return zt(this) + }, Gn.get = function (e) { + return e = O(e), this.isValid() ? this[e + "s"]() : NaN + }, Gn.milliseconds = Pn, Gn.seconds = In, Gn.minutes = On, Gn.hours = Ln, Gn.days = Nn, Gn.weeks = function () { + return S(this.days() / 7) + }, Gn.months = Fn, Gn.years = Bn, Gn.humanize = function (e) { + if (!this.isValid()) return this.localeData().invalidDate(); + var t = this.localeData(), + n = function (e, t, n) { + var r = zt(e).abs(), + i = Hn(r.as("s")), + o = Hn(r.as("m")), + s = Hn(r.as("h")), + a = Hn(r.as("d")), + l = Hn(r.as("M")), + c = Hn(r.as("y")), + u = i <= zn.ss && ["s", i] || i < zn.s && ["ss", i] || o <= 1 && ["m"] || o < zn.m && ["mm", o] || s <= 1 && ["h"] || s < zn.h && ["hh", s] || a <= 1 && ["d"] || a < zn.d && ["dd", a] || l <= 1 && ["M"] || l < zn.M && ["MM", l] || c <= 1 && ["y"] || ["yy", c]; + return u[2] = t, u[3] = +e > 0, u[4] = n, Un.apply(null, u) + }(this, !e, t); + return e && (n = t.pastFuture(+this, n)), t.postformat(n) + }, Gn.toISOString = jn, Gn.toString = jn, Gn.toJSON = jn, Gn.locale = Kt, Gn.localeData = Qt, Gn.toIsoString = x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", jn), Gn.lang = Yt, V("X", 0, 0, "unix"), V("x", 0, 0, "valueOf"), ce("x", ie), ce("X", /[+-]?\d+(\.\d{1,3})?/), de("X", (function (e, t, n) { + n._d = new Date(1e3 * parseFloat(e, 10)) + })), de("x", (function (e, t, n) { + n._d = new Date(C(e)) + })), r.version = "2.24.0", t = kt, r.fn = un, r.min = function () { + var e = [].slice.call(arguments, 0); + return Rt("isBefore", e) + }, r.max = function () { + var e = [].slice.call(arguments, 0); + return Rt("isAfter", e) + }, r.now = function () { + return Date.now ? Date.now() : +new Date + }, r.utc = p, r.unix = function (e) { + return kt(1e3 * e) + }, r.months = function (e, t) { + return fn(e, t, "months") + }, r.isDate = l, r.locale = it, r.invalid = m, r.duration = zt, r.isMoment = b, r.weekdays = function (e, t, n) { + return mn(e, t, n, "weekdays") + }, r.parseZone = function () { + return kt.apply(null, arguments).parseZone() + }, r.localeData = st, r.isDuration = At, r.monthsShort = function (e, t) { + return fn(e, t, "monthsShort") + }, r.weekdaysMin = function (e, t, n) { + return mn(e, t, n, "weekdaysMin") + }, r.defineLocale = ot, r.updateLocale = function (e, t) { + if (null != t) { + var n, r, i = Je; + null != (r = rt(e)) && (i = r._config), t = A(i, t), (n = new M(t)).parentLocale = et[e], et[e] = n, it(e) + } else null != et[e] && (null != et[e].parentLocale ? et[e] = et[e].parentLocale : null != et[e] && delete et[e]); + return et[e] + }, r.locales = function () { + return T(et) + }, r.weekdaysShort = function (e, t, n) { + return mn(e, t, n, "weekdaysShort") + }, r.normalizeUnits = O, r.relativeTimeRounding = function (e) { + return void 0 === e ? Hn : "function" == typeof e && (Hn = e, !0) + }, r.relativeTimeThreshold = function (e, t) { + return void 0 !== zn[e] && (void 0 === t ? zn[e] : (zn[e] = t, "s" === e && (zn.ss = t - 1), !0)) + }, r.calendarFormat = function (e, t) { + var n = e.diff(t, "days", !0); + return n < -6 ? "sameElse" : n < -1 ? "lastWeek" : n < 0 ? "lastDay" : n < 1 ? "sameDay" : n < 2 ? "nextDay" : n < 7 ? "nextWeek" : "sameElse" + }, r.prototype = un, r.HTML5_FMT = { + DATETIME_LOCAL: "YYYY-MM-DDTHH:mm", + DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss", + DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS", + DATE: "YYYY-MM-DD", + TIME: "HH:mm", + TIME_SECONDS: "HH:mm:ss", + TIME_MS: "HH:mm:ss.SSS", + WEEK: "GGGG-[W]WW", + MONTH: "YYYY-MM" + }, r + }() + }).call(this, n(42)(e)) +}, function (e, t, n) { + var r, i, o = n(7), + s = n(168), + a = n(169), + l = n(170), + c = n(36); + "function" == typeof Symbol && "function" == typeof Symbol.for ? (r = Symbol.for("graceful-fs.queue"), i = Symbol.for("graceful-fs.previous")) : (r = "___graceful-fs.queue", i = "___graceful-fs.previous"); + var u = function () {}; + if (c.debuglog ? u = c.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (u = function () { + var e = c.format.apply(c, arguments); + e = "GFS4: " + e.split(/\n/).join("\nGFS4: "), console.error(e) + }), !global[r]) { + var h = []; + Object.defineProperty(global, r, { + get: function () { + return h + } + }), o.close = function (e) { + function t(t, n) { + return e.call(o, t, (function (e) { + e || f(), "function" == typeof n && n.apply(this, arguments) + })) + } + return Object.defineProperty(t, i, { + value: e + }), t + }(o.close), o.closeSync = function (e) { + function t(t) { + e.apply(o, arguments), f() + } + return Object.defineProperty(t, i, { + value: e + }), t + }(o.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", (function () { + u(global[r]), n(44).equal(global[r].length, 0) + })) + } + + function p(e) { + s(e), e.gracefulify = p, e.createReadStream = function (t, n) { + return new e.ReadStream(t, n) + }, e.createWriteStream = function (t, n) { + return new e.WriteStream(t, n) + }; + var t = e.readFile; + e.readFile = function (e, n, r) { + "function" == typeof n && (r = n, n = null); + return function e(n, r, i) { + return t(n, r, (function (t) { + !t || "EMFILE" !== t.code && "ENFILE" !== t.code ? ("function" == typeof i && i.apply(this, arguments), f()) : d([e, [n, r, i]]) + })) + }(e, n, r) + }; + var n = e.writeFile; + e.writeFile = function (e, t, r, i) { + "function" == typeof r && (i = r, r = null); + return function e(t, r, i, o) { + return n(t, r, i, (function (n) { + !n || "EMFILE" !== n.code && "ENFILE" !== n.code ? ("function" == typeof o && o.apply(this, arguments), f()) : d([e, [t, r, i, o]]) + })) + }(e, t, r, i) + }; + var r = e.appendFile; + r && (e.appendFile = function (e, t, n, i) { + "function" == typeof n && (i = n, n = null); + return function e(t, n, i, o) { + return r(t, n, i, (function (r) { + !r || "EMFILE" !== r.code && "ENFILE" !== r.code ? ("function" == typeof o && o.apply(this, arguments), f()) : d([e, [t, n, i, o]]) + })) + }(e, t, n, i) + }); + var i = e.readdir; + + function o(t) { + return i.apply(e, t) + } + if (e.readdir = function (e, t, n) { + var r = [e]; + "function" != typeof t ? r.push(t) : n = t; + return r.push((function (e, t) { + t && t.sort && t.sort(); + !e || "EMFILE" !== e.code && "ENFILE" !== e.code ? ("function" == typeof n && n.apply(this, arguments), f()) : d([o, [r]]) + })), o(r) + }, "v0.8" === process.version.substr(0, 4)) { + var l = a(e); + g = l.ReadStream, y = l.WriteStream + } + var c = e.ReadStream; + c && (g.prototype = Object.create(c.prototype), g.prototype.open = function () { + var e = this; + w(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.autoClose && e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n), e.read()) + })) + }); + var u = e.WriteStream; + u && (y.prototype = Object.create(u.prototype), y.prototype.open = function () { + var e = this; + w(e.path, e.flags, e.mode, (function (t, n) { + t ? (e.destroy(), e.emit("error", t)) : (e.fd = n, e.emit("open", n)) + })) + }), Object.defineProperty(e, "ReadStream", { + get: function () { + return g + }, + set: function (e) { + g = e + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(e, "WriteStream", { + get: function () { + return y + }, + set: function (e) { + y = e + }, + enumerable: !0, + configurable: !0 + }); + var h = g; + Object.defineProperty(e, "FileReadStream", { + get: function () { + return h + }, + set: function (e) { + h = e + }, + enumerable: !0, + configurable: !0 + }); + var m = y; + + function g(e, t) { + return this instanceof g ? (c.apply(this, arguments), this) : g.apply(Object.create(g.prototype), arguments) } - function ae(e, t, n) { - return !e.startState || e.startState(t, n) + function y(e, t) { + return this instanceof y ? (u.apply(this, arguments), this) : y.apply(Object.create(y.prototype), arguments) } + Object.defineProperty(e, "FileWriteStream", { + get: function () { + return m + }, + set: function (e) { + m = e + }, + enumerable: !0, + configurable: !0 + }); + var v = e.open; - function se(e, t) { - if (t -= e.first, 0 > t || t >= e.size) throw new Error('There is no line ' + (t + e.first) + ' in the document.'); - for (var n = e; !n.lines;) - for (var o = 0;; ++o) { - var r = n.children[o], - i = r.chunkSize(); - if (t < i) { - n = r; - break - } - t -= i - } - return n.lines[t] + function w(e, t, n, r) { + return "function" == typeof n && (r = n, n = null), + function e(t, n, r, i) { + return v(t, n, r, (function (o, s) { + !o || "EMFILE" !== o.code && "ENFILE" !== o.code ? ("function" == typeof i && i.apply(this, arguments), f()) : d([e, [t, n, r, i]]) + })) + }(e, t, n, r) } + return e.open = w, e + } - function de(e, t, o) { - var r = [], - i = t.line; - return e.iter(t.line, o.line + 1, function (e) { - var n = e.text; - i == o.line && (n = n.slice(0, o.ch)), i == t.line && (n = n.slice(t.ch)), r.push(n), ++i - }), r + function d(e) { + u("ENQUEUE", e[0].name, e[1]), global[r].push(e) + } + + function f() { + var e = global[r].shift(); + e && (u("RETRY", e[0].name, e[1]), e[0].apply(null, e[1])) + } + e.exports = p(l(o)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !o.__patched && (e.exports = p(o), o.__patched = !0) +}, function (e, t, n) { + e.exports = function () { + "use strict"; + var e = navigator.userAgent, + t = navigator.platform, + n = /gecko\/\d/i.test(e), + r = /MSIE \d/.test(e), + i = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e), + o = /Edge\/(\d+)/.exec(e), + s = r || i || o, + a = s && (r ? document.documentMode || 6 : +(o || i)[1]), + l = !o && /WebKit\//.test(e), + c = l && /Qt\/\d+\.\d+/.test(e), + u = !o && /Chrome\//.test(e), + h = /Opera\//.test(e), + p = /Apple Computer/.test(navigator.vendor), + d = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e), + f = /PhantomJS/.test(e), + m = !o && /AppleWebKit/.test(e) && /Mobile\/\w+/.test(e), + g = /Android/.test(e), + y = m || g || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e), + v = m || /Mac/.test(t), + w = /\bCrOS\b/.test(e), + b = /win/i.test(t), + S = h && e.match(/Version\/(\d*\.\d*)/); + S && (S = Number(S[1])), S && S >= 15 && (h = !1, l = !0); + var C = v && (c || h && (null == S || S < 12.11)), + E = n || s && a >= 9; + + function k(e) { + return new RegExp("(^|\\s)" + e + "(?:$|\\s)\\s*") } + var x, T = function (e, t) { + var n = e.className, + r = k(t).exec(n); + if (r) { + var i = n.slice(r.index + r[0].length); + e.className = n.slice(0, r.index) + (i ? r[1] + i : "") + } + }; - function le(e, t, n) { - var o = []; - return e.iter(t, n, function (e) { - o.push(e.text) - }), o + function R(e) { + for (var t = e.childNodes.length; t > 0; --t) e.removeChild(e.firstChild); + return e } - function ce(e, t) { - var o = t - e.height; - if (o) - for (var r = e; r; r = r.parent) r.height += o + function D(e, t) { + return R(e).appendChild(t) } - function pe(e) { - if (null == e.parent) return null; - for (var t = e.parent, n = b(t.lines, e), o = t.parent; o; t = o, o = o.parent) - for (var r = 0;; ++r) { - if (o.children[r] == t) break; - n += o.children[r].chunkSize() - } - return n + t.first + function _(e, t, n, r) { + var i = document.createElement(e); + if (n && (i.className = n), r && (i.style.cssText = r), "string" == typeof t) i.appendChild(document.createTextNode(t)); + else if (t) + for (var o = 0; o < t.length; ++o) i.appendChild(t[o]); + return i } - function ue(e, t) { - var o = e.first; - outer: do { - for (var n = 0; n < e.children.length; ++n) { - var r = e.children[n], - a = r.height; - if (t < a) { - e = r; - continue outer - } - t -= a, o += r.chunkSize() - } - return o - } while (!e.lines); - for (var s = 0; s < e.lines.length; ++s) { - var i = e.lines[s], - d = i.height; - if (t < d) break; - t -= d - } - return o + s + function A(e, t, n, r) { + var i = _(e, t, n, r); + return i.setAttribute("role", "presentation"), i } - function me(e, t) { - return t >= e.first && t < e.first + e.size + function M(e, t) { + if (3 == t.nodeType && (t = t.parentNode), e.contains) return e.contains(t); + do { + if (11 == t.nodeType && (t = t.host), t == e) return !0 + } while (t = t.parentNode) } - function he(e, t) { - return e.lineNumberFormatter(t + e.firstLineNumber) + '' + function P() { + var e; + try { + e = document.activeElement + } catch (t) { + e = document.body || null + } + for (; e && e.shadowRoot && e.shadowRoot.activeElement;) e = e.shadowRoot.activeElement; + return e } - function fe(e, t, n) { - return void 0 === n && (n = null), this instanceof fe ? void(this.line = e, this.ch = t, this.sticky = n) : new fe(e, t, n) + function I(e, t) { + var n = e.className; + k(t).test(n) || (e.className += (n ? " " : "") + t) } - function ge(e, t) { - return e.line - t.line || e.ch - t.ch + function O(e, t) { + for (var n = e.split(" "), r = 0; r < n.length; r++) n[r] && !k(n[r]).test(t) && (t += " " + n[r]); + return t } + x = document.createRange ? function (e, t, n, r) { + var i = document.createRange(); + return i.setEnd(r || e, n), i.setStart(e, t), i + } : function (e, t, n) { + var r = document.body.createTextRange(); + try { + r.moveToElementText(e.parentNode) + } catch (e) { + return r + } + return r.collapse(!0), r.moveEnd("character", n), r.moveStart("character", t), r + }; + var L = function (e) { + e.select() + }; - function ye(e, t) { - return e.sticky == t.sticky && 0 == ge(e, t) + function N(e) { + var t = Array.prototype.slice.call(arguments, 1); + return function () { + return e.apply(null, t) + } } - function Se(e) { - return fe(e.line, e.ch) + function F(e, t, n) { + for (var r in t || (t = {}), e) !e.hasOwnProperty(r) || !1 === n && t.hasOwnProperty(r) || (t[r] = e[r]); + return t } - function Ce(e, t) { - return 0 > ge(e, t) ? t : e + function B(e, t, n, r, i) { + null == t && -1 == (t = e.search(/[^\s\u00a0]/)) && (t = e.length); + for (var o = r || 0, s = i || 0;;) { + var a = e.indexOf("\t", o); + if (a < 0 || a >= t) return s + (t - o); + s += a - o, s += n - s % n, o = a + 1 + } } + m ? L = function (e) { + e.selectionStart = 0, e.selectionEnd = e.value.length + } : s && (L = function (e) { + try { + e.select() + } catch (e) {} + }); + var H = function () { + this.id = null, this.f = null, this.time = 0, this.handler = N(this.onTimeout, this) + }; - function be(e, t) { - return 0 > ge(e, t) ? e : t + function z(e, t) { + for (var n = 0; n < e.length; ++n) + if (e[n] == t) return n; + return -1 } + H.prototype.onTimeout = function (e) { + e.id = 0, e.time <= +new Date ? e.f() : setTimeout(e.handler, e.time - +new Date) + }, H.prototype.set = function (e, t) { + this.f = t; + var n = +new Date + e; + (!this.id || n < this.time) && (clearTimeout(this.id), this.id = setTimeout(this.handler, e), this.time = n) + }; + var U = { + toString: function () { + return "CodeMirror.Pass" + } + }, + W = { + scroll: !1 + }, + V = { + origin: "*mouse" + }, + j = { + origin: "+move" + }; - function ve(e, t) { - return r(e.first, d(t, e.first + e.size - 1)) + function G(e, t, n) { + for (var r = 0, i = 0;;) { + var o = e.indexOf("\t", r); - 1 == o && (o = e.length); + var s = o - r; + if (o == e.length || i + s >= t) return r + Math.min(s, t - i); + if (i += o - r, r = o + 1, (i += n - i % n) >= t) return r + } } + var $ = [""]; - function Ee(e, t) { - if (t.line < e.first) return fe(e.first, 0); - var n = e.first + e.size - 1; - return t.line > n ? fe(n, se(e, n).text.length) : we(t, se(e, t.line).text.length) + function q(e) { + for (; $.length <= e;) $.push(K($) + " "); + return $[e] } - function we(e, t) { - var n = e.ch; - return null == n || n > t ? fe(e.line, t) : 0 > n ? fe(e.line, 0) : e + function K(e) { + return e[e.length - 1] } - function ke(e, t) { - for (var n = [], o = 0; o < t.length; o++) n[o] = Ee(e, t[o]); + function Y(e, t) { + for (var n = [], r = 0; r < e.length; r++) n[r] = t(e[r], r); return n } - function Te(e, t, n, r) { - var a = [e.state.modeGen], - s = {}; - Ie(e, t.text, e.doc.mode, n, function (e, t) { - return a.push(e, t) - }, s, r); - for (var l = n.state, i = function (r) { - n.baseTokens = a; - var o = e.state.overlays[r], - c = 1, - i = 0; - n.state = !0, Ie(e, t.text, o.mode, n, function (e, t) { - for (var n = c, r; i < e;) r = a[c], r > e && a.splice(c, 1, e, a[c + 1], r), c += 2, i = d(e, r); - if (t) - if (o.opaque) a.splice(n, c - n, e, 'overlay ' + t), c = n + 2; - else - for (; n < c; n += 2) { - var s = a[n + 1]; - a[n + 1] = (s ? s + ' ' : '') + 'overlay ' + t - } - }, s), n.state = l, n.baseTokens = null, n.baseTokenPos = 1 - }, c = 0; c < e.state.overlays.length; ++c) i(c); - return { - styles: a, - classes: s.bgClass || s.textClass ? s : null - } + function Q() {} + + function Z(e, t) { + var n; + return Object.create ? n = Object.create(e) : (Q.prototype = e, n = new Q), t && F(t, n), n } + var X = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; - function _e(e, t, n) { - if (!t.styles || t.styles[0] != e.state.modeGen) { - var o = Re(e, pe(t)), - i = t.text.length > e.options.maxHighlightLength && oe(e.doc.mode, o.state), - a = Te(e, t, o); - i && (o.state = i), t.stateAfter = o.save(!i), t.styles = a.styles, a.classes ? t.styleClasses = a.classes : t.styleClasses && (t.styleClasses = null), n === e.doc.highlightFrontier && (e.doc.modeFrontier = r(e.doc.modeFrontier, ++e.doc.highlightFrontier)) - } - return t.styles + function J(e) { + return /\w/.test(e) || e > "€" && (e.toUpperCase() != e.toLowerCase() || X.test(e)) } - function Re(e, t, n) { - var o = e.doc, - r = e.display; - if (!o.mode.startState) return new Ss(o, !0, t); - var i = Le(e, t, n), - a = i > o.first && se(o, i - 1).stateAfter, - s = a ? Ss.fromSaved(o, a, i) : new Ss(o, ae(o.mode), i); - return o.iter(i, t, function (n) { - xe(e, n.text, s); - var o = s.line; - n.stateAfter = o == t - 1 || 0 == o % 5 || o >= r.viewFrom && o < r.viewTo ? s.save() : null, s.nextLine() - }), n && (o.modeFrontier = s.line), s + function ee(e, t) { + return t ? !!(t.source.indexOf("\\w") > -1 && J(e)) || t.test(e) : J(e) } - function xe(e, t, n, o) { - var r = e.doc.mode, - i = new hs(t, e.options.tabSize, n); - for (i.start = i.pos = o || 0, '' == t && Pe(r, n.state); !i.eol();) De(r, i, n.state), i.start = i.pos + function te(e) { + for (var t in e) + if (e.hasOwnProperty(t) && e[t]) return !1; + return !0 } + var ne = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/; - function Pe(e, t) { - if (e.blankLine) return e.blankLine(t); - if (e.innerMode) { - var n = re(e, t); - if (n.mode.blankLine) return n.mode.blankLine(n.state) + function re(e) { + return e.charCodeAt(0) >= 768 && ne.test(e) + } + + function ie(e, t, n) { + for (; + (n < 0 ? t > 0 : t < e.length) && re(e.charAt(t));) t += n; + return t + } + + function oe(e, t, n) { + for (var r = t > n ? -1 : 1;;) { + if (t == n) return t; + var i = (t + n) / 2, + o = r < 0 ? Math.ceil(i) : Math.floor(i); + if (o == t) return e(o) ? t : n; + e(o) ? n = o : t = o + r } } + var se = null; - function De(e, t, n, o) { - for (var r = 0; 10 > r; r++) { - o && (o[0] = re(e, n).mode); - var i = e.token(t, n); - if (t.pos > t.start) return i + function ae(e, t, n) { + var r; + se = null; + for (var i = 0; i < e.length; ++i) { + var o = e[i]; + if (o.from < t && o.to > t) return i; + o.to == t && (o.from != o.to && "before" == n ? r = i : se = i), o.from == t && (o.from != o.to && "before" != n ? r = i : se = i) } - throw new Error('Mode ' + e.name + ' failed to advance stream.') + return null != r ? r : se } + var le = function () { + var e = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/, + t = /[stwN]/, + n = /[LRr]/, + r = /[Lb1n]/, + i = /[1n]/; - function Me(e, t, n, o) { - var r = e.doc, - i = r.mode, - a; - t = Ee(r, t); - var s = se(r, t.line), - d = Re(e, t.line, n), - l = new hs(s.text, e.options.tabSize, d), - c; - for (o && (c = []); - (o || l.pos < t.ch) && !l.eol();) l.start = l.pos, a = De(i, l, d.state), o && c.push(new Cs(l, a, oe(r.mode, d.state))); - return o ? c : new Cs(l, a, d.state) - } - - function Ae(e, t) { - if (e) - for (;;) { - var n = e.match(/(?:^|\s+)line-(background-)?(\S+)/); - if (!n) break; - e = e.slice(0, n.index) + e.slice(n.index + n[0].length); - var o = n[1] ? 'bgClass' : 'textClass'; - null == t[o] ? t[o] = n[2] : !new RegExp('(?:^|s)' + n[2] + '(?:$|s)').test(t[o]) && (t[o] += ' ' + n[2]) + function o(e, t, n) { + this.level = e, this.from = t, this.to = n + } + return function (s, a) { + var l = "ltr" == a ? "L" : "R"; + if (0 == s.length || "ltr" == a && !e.test(s)) return !1; + for (var c, u = s.length, h = [], p = 0; p < u; ++p) h.push((c = s.charCodeAt(p)) <= 247 ? "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(c) : 1424 <= c && c <= 1524 ? "R" : 1536 <= c && c <= 1785 ? "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(c - 1536) : 1774 <= c && c <= 2220 ? "r" : 8192 <= c && c <= 8203 ? "w" : 8204 == c ? "b" : "L"); + for (var d = 0, f = l; d < u; ++d) { + var m = h[d]; + "m" == m ? h[d] = f : f = m + } + for (var g = 0, y = l; g < u; ++g) { + var v = h[g]; + "1" == v && "r" == y ? h[g] = "n" : n.test(v) && (y = v, "r" == v && (h[g] = "R")) + } + for (var w = 1, b = h[0]; w < u - 1; ++w) { + var S = h[w]; + "+" == S && "1" == b && "1" == h[w + 1] ? h[w] = "1" : "," != S || b != h[w + 1] || "1" != b && "n" != b || (h[w] = b), b = S + } + for (var C = 0; C < u; ++C) { + var E = h[C]; + if ("," == E) h[C] = "N"; + else if ("%" == E) { + var k = void 0; + for (k = C + 1; k < u && "%" == h[k]; ++k); + for (var x = C && "!" == h[C - 1] || k < u && "1" == h[k] ? "1" : "N", T = C; T < k; ++T) h[T] = x; + C = k - 1 + } } - return e - } + for (var R = 0, D = l; R < u; ++R) { + var _ = h[R]; + "L" == D && "1" == _ ? h[R] = "L" : n.test(_) && (D = _) + } + for (var A = 0; A < u; ++A) + if (t.test(h[A])) { + var M = void 0; + for (M = A + 1; M < u && t.test(h[M]); ++M); + for (var P = "L" == (A ? h[A - 1] : l), I = P == ("L" == (M < u ? h[M] : l)) ? P ? "L" : "R" : l, O = A; O < M; ++O) h[O] = I; + A = M - 1 + } for (var L, N = [], F = 0; F < u;) + if (r.test(h[F])) { + var B = F; + for (++F; F < u && r.test(h[F]); ++F); + N.push(new o(0, B, F)) + } else { + var H = F, + z = N.length; + for (++F; F < u && "L" != h[F]; ++F); + for (var U = H; U < F;) + if (i.test(h[U])) { + H < U && N.splice(z, 0, new o(1, H, U)); + var W = U; + for (++U; U < F && i.test(h[U]); ++U); + N.splice(z, 0, new o(2, W, U)), H = U + } else ++U; + H < F && N.splice(z, 0, new o(1, H, F)) + } return "ltr" == a && (1 == N[0].level && (L = s.match(/^\s+/)) && (N[0].from = L[0].length, N.unshift(new o(0, 0, L[0].length))), 1 == K(N).level && (L = s.match(/\s+$/)) && (K(N).to -= L[0].length, N.push(new o(0, u - L[0].length, u)))), "rtl" == a ? N.reverse() : N + } + }(); - function Ie(e, t, n, o, r, i, a) { - var s = n.flattenSpans; - null == s && (s = e.options.flattenSpans); - var l = 0, - c = null, - p = new hs(t, e.options.tabSize, o), - u = e.options.addModeClass && [null], - m; - for ('' == t && Ae(Pe(n, o.state), i); !p.eol();) { - if (p.pos > e.options.maxHighlightLength ? (s = !1, a && xe(e, t, o, p.pos), p.pos = t.length, m = null) : m = Ae(De(n, p, o.state, u), i), u) { - var h = u[0].name; - h && (m = 'm-' + (m ? h + ' ' + m : h)) + function ce(e, t) { + var n = e.order; + return null == n && (n = e.order = le(e.text, t)), n + } + var ue = [], + he = function (e, t, n) { + if (e.addEventListener) e.addEventListener(t, n, !1); + else if (e.attachEvent) e.attachEvent("on" + t, n); + else { + var r = e._handlers || (e._handlers = {}); + r[t] = (r[t] || ue).concat(n) } - if (!s || c != m) { - for (; l < p.start;) l = d(p.start, l + 5e3), r(l, c); - c = m + }; + + function pe(e, t) { + return e._handlers && e._handlers[t] || ue + } + + function de(e, t, n) { + if (e.removeEventListener) e.removeEventListener(t, n, !1); + else if (e.detachEvent) e.detachEvent("on" + t, n); + else { + var r = e._handlers, + i = r && r[t]; + if (i) { + var o = z(i, n); + o > -1 && (r[t] = i.slice(0, o).concat(i.slice(o + 1))) } - p.start = p.pos - } - for (; l < p.pos;) { - var f = d(p.pos, l + 5e3); - r(f, c), l = f } } - function Le(e, t, n) { - for (var o = e.doc, r = n ? -1 : t - (e.doc.mode.innerMode ? 1e3 : 100), i = t, a, s; i > r; --i) { - if (i <= o.first) return o.first; - var d = se(o, i - 1), - l = d.stateAfter; - if (l && (!n || i + (l instanceof ys ? l.lookAhead : 0) <= o.modeFrontier)) return i; - var c = C(d.text, null, e.options.tabSize); - (null == s || a > c) && (s = i - 1, a = c) - } - return s + function fe(e, t) { + var n = pe(e, t); + if (n.length) + for (var r = Array.prototype.slice.call(arguments, 2), i = 0; i < n.length; ++i) n[i].apply(null, r) } - function Fe(e, t) { - if (e.modeFrontier = d(e.modeFrontier, t), !(e.highlightFrontier < t - 10)) { - for (var n = e.first, o = t - 1, r; o > n; o--) - if (r = se(e, o).stateAfter, r && (!(r instanceof ys) || o + r.lookAhead < t)) { - n = o + 1; - break - } e.highlightFrontier = d(e.highlightFrontier, n) - } + function me(e, t, n) { + return "string" == typeof t && (t = { + type: t, + preventDefault: function () { + this.defaultPrevented = !0 + } + }), fe(e, n || t.type, e, t), Se(t) || t.codemirrorIgnore } - function Be() { - bs = !0 + function ge(e) { + var t = e._handlers && e._handlers.cursorActivity; + if (t) + for (var n = e.curOp.cursorActivityHandlers || (e.curOp.cursorActivityHandlers = []), r = 0; r < t.length; ++r) - 1 == z(n, t[r]) && n.push(t[r]) } - function Ne() { - vs = !0 + function ye(e, t) { + return pe(e, t).length > 0 } - function Oe(e, t, n) { - this.marker = e, this.from = t, this.to = n + function ve(e) { + e.prototype.on = function (e, t) { + he(this, e, t) + }, e.prototype.off = function (e, t) { + de(this, e, t) + } } - function He(e, t) { - if (e) - for (var n = 0, o; n < e.length; ++n) - if (o = e[n], o.marker == t) return o + function we(e) { + e.preventDefault ? e.preventDefault() : e.returnValue = !1 } - function ze(e, t) { - for (var n = 0, o; n < e.length; ++n) e[n] != t && (o || (o = [])).push(e[n]); - return o + function be(e) { + e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0 } - function Ue(e, t) { - e.markedSpans = e.markedSpans ? e.markedSpans.concat([t]) : [t], t.marker.attachLine(e) + function Se(e) { + return null != e.defaultPrevented ? e.defaultPrevented : 0 == e.returnValue } - function We(e, t, n) { - var o; - if (e) - for (var r = 0; r < e.length; ++r) { - var i = e[r], - a = i.marker, - s = null == i.from || (a.inclusiveLeft ? i.from <= t : i.from < t); - if (s || i.from == t && 'bookmark' == a.type && (!n || !i.marker.insertLeft)) { - var d = null == i.to || (a.inclusiveRight ? i.to >= t : i.to > t); - (o || (o = [])).push(new Oe(a, i.from, d ? null : i.to)) - } - } - return o + function Ce(e) { + we(e), be(e) } - function Ve(e, t, n) { - var o; - if (e) - for (var r = 0; r < e.length; ++r) { - var i = e[r], - a = i.marker, - s = null == i.to || (a.inclusiveRight ? i.to >= t : i.to > t); - if (s || i.from == t && 'bookmark' == a.type && (!n || i.marker.insertLeft)) { - var d = null == i.from || (a.inclusiveLeft ? i.from <= t : i.from < t); - (o || (o = [])).push(new Oe(a, d ? null : i.from - t, null == i.to ? null : i.to - t)) - } - } - return o + function Ee(e) { + return e.target || e.srcElement } - function Ge(e, t) { - if (t.full) return null; - var n = me(e, t.from.line) && se(e, t.from.line).markedSpans, - o = me(e, t.to.line) && se(e, t.to.line).markedSpans; - if (!n && !o) return null; - var r = t.from.ch, - a = t.to.ch, - s = 0 == ge(t.from, t.to), - d = We(n, r, s), - l = Ve(o, a, s), - c = 1 == t.text.length, - p = w(t.text).length + (c ? r : 0); - if (d) - for (var u = 0, i; u < d.length; ++u) - if (i = d[u], null == i.to) { - var m = He(l, i.marker); - m ? c && (i.to = null == m.to ? null : m.to + p) : i.to = r - } if (l) - for (var h = 0, f; h < l.length; ++h) - if (f = l[h], null != f.to && (f.to += p), null == f.from) { - var g = He(d, f.marker); - g || (f.from = p, c && (d || (d = [])).push(f)) - } else f.from += p, c && (d || (d = [])).push(f); - d && (d = Ke(d)), l && l != d && (l = Ke(l)); - var y = [d]; - if (!c) { - var S = t.text.length - 2, - C; - if (0 < S && d) - for (var b = 0; b < d.length; ++b) null == d[b].to && (C || (C = [])).push(new Oe(d[b].marker, null, null)); - for (var v = 0; v < S; ++v) y.push(C); - y.push(l) - } - return y + function ke(e) { + var t = e.which; + return null == t && (1 & e.button ? t = 1 : 2 & e.button ? t = 3 : 4 & e.button && (t = 2)), v && e.ctrlKey && 1 == t && (t = 3), t } + var xe, Te, Re = function () { + if (s && a < 9) return !1; + var e = _("div"); + return "draggable" in e || "dragDrop" in e + }(); - function Ke(e) { - for (var t = 0, n; t < e.length; ++t) n = e[t], null != n.from && n.from == n.to && !1 !== n.marker.clearWhenEmpty && e.splice(t--, 1); - return e.length ? e : null + function De(e) { + if (null == xe) { + var t = _("span", "​"); + D(e, _("span", [t, document.createTextNode("x")])), 0 != e.firstChild.offsetHeight && (xe = t.offsetWidth <= 1 && t.offsetHeight > 2 && !(s && a < 8)) + } + var n = xe ? _("span", "​") : _("span", " ", null, "display: inline-block; width: 1px; margin-right: -1px"); + return n.setAttribute("cm-text", ""), n } - function je(e, t, n) { - var o = null; - if (e.iter(t.line, n.line + 1, function (e) { - if (e.markedSpans) - for (var t = 0, n; t < e.markedSpans.length; ++t) n = e.markedSpans[t].marker, n.readOnly && (!o || -1 == b(o, n)) && (o || (o = [])).push(n) - }), !o) return null; - for (var r = [{ - from: t, - to: n - }], a = 0; a < o.length; ++a) - for (var i = o[a], s = i.find(0), d = 0, l; d < r.length; ++d) - if (l = r[d], !(0 > ge(l.to, s.from) || 0 < ge(l.from, s.to))) { - var c = [d, 1], - p = ge(l.from, s.from), - u = ge(l.to, s.to); - !(0 > p) && (i.inclusiveLeft || p) || c.push({ - from: l.from, - to: s.from - }), !(0 < u) && (i.inclusiveRight || u) || c.push({ - from: s.to, - to: l.to - }), r.splice.apply(r, c), d += c.length - 3 - } return r - } - - function qe(e) { - var t = e.markedSpans; - if (t) { - for (var n = 0; n < t.length; ++n) t[n].marker.detachLine(e); - e.markedSpans = null + function _e(e) { + if (null != Te) return Te; + var t = D(e, document.createTextNode("AخA")), + n = x(t, 0, 1).getBoundingClientRect(), + r = x(t, 1, 2).getBoundingClientRect(); + return R(e), !(!n || n.left == n.right) && (Te = r.right - n.right < 3) + } + var Ae, Me = 3 != "\n\nb".split(/\n/).length ? function (e) { + for (var t = 0, n = [], r = e.length; t <= r;) { + var i = e.indexOf("\n", t); - 1 == i && (i = e.length); + var o = e.slice(t, "\r" == e.charAt(i - 1) ? i - 1 : i), + s = o.indexOf("\r"); - 1 != s ? (n.push(o.slice(0, s)), t += s + 1) : (n.push(o), t = i + 1) + } + return n + } : function (e) { + return e.split(/\r\n?|\n/) + }, + Pe = window.getSelection ? function (e) { + try { + return e.selectionStart != e.selectionEnd + } catch (e) { + return !1 + } + } : function (e) { + var t; + try { + t = e.ownerDocument.selection.createRange() + } catch (e) {} + return !(!t || t.parentElement() != e) && 0 != t.compareEndPoints("StartToEnd", t) + }, + Ie = "oncopy" in (Ae = _("div")) || (Ae.setAttribute("oncopy", "return;"), "function" == typeof Ae.oncopy), + Oe = null, + Le = {}, + Ne = {}; + + function Fe(e, t) { + arguments.length > 2 && (t.dependencies = Array.prototype.slice.call(arguments, 2)), Le[e] = t + } + + function Be(e) { + if ("string" == typeof e && Ne.hasOwnProperty(e)) e = Ne[e]; + else if (e && "string" == typeof e.name && Ne.hasOwnProperty(e.name)) { + var t = Ne[e.name]; + "string" == typeof t && (t = { + name: t + }), (e = Z(t, e)).name = t.name + } else { + if ("string" == typeof e && /^[\w\-]+\/[\w\-]+\+xml$/.test(e)) return Be("application/xml"); + if ("string" == typeof e && /^[\w\-]+\/[\w\-]+\+json$/.test(e)) return Be("application/json") + } + return "string" == typeof e ? { + name: e + } : e || { + name: "null" } } - function Ye(e, t) { - if (t) { - for (var n = 0; n < t.length; ++n) t[n].marker.attachLine(e); - e.markedSpans = t + function He(e, t) { + t = Be(t); + var n = Le[t.name]; + if (!n) return He(e, "text/plain"); + var r = n(e, t); + if (ze.hasOwnProperty(t.name)) { + var i = ze[t.name]; + for (var o in i) i.hasOwnProperty(o) && (r.hasOwnProperty(o) && (r["_" + o] = r[o]), r[o] = i[o]) + } + if (r.name = t.name, t.helperType && (r.helperType = t.helperType), t.modeProps) + for (var s in t.modeProps) r[s] = t.modeProps[s]; + return r + } + var ze = {}; + + function Ue(e, t) { + F(t, ze.hasOwnProperty(e) ? ze[e] : ze[e] = {}) + } + + function We(e, t) { + if (!0 === t) return t; + if (e.copyState) return e.copyState(t); + var n = {}; + for (var r in t) { + var i = t[r]; + i instanceof Array && (i = i.concat([])), n[r] = i } + return n } - function Xe(e) { - return e.inclusiveLeft ? -1 : 0 + function Ve(e, t) { + for (var n; e.innerMode && (n = e.innerMode(t)) && n.mode != e;) t = n.state, e = n.mode; + return n || { + mode: e, + state: t + } } - function Qe(e) { - return e.inclusiveRight ? 1 : 0 + function je(e, t, n) { + return !e.startState || e.startState(t, n) } + var Ge = function (e, t, n) { + this.pos = this.start = 0, this.string = e, this.tabSize = t || 8, this.lastColumnPos = this.lastColumnValue = 0, this.lineStart = 0, this.lineOracle = n + }; function $e(e, t) { - var n = e.lines.length - t.lines.length; - if (0 != n) return n; - var o = e.find(), - r = t.find(), - i = ge(o.from, r.from) || Xe(e) - Xe(t); - if (i) return -i; - var a = ge(o.to, r.to) || Qe(e) - Qe(t); - return a ? a : t.id - e.id + if ((t -= e.first) < 0 || t >= e.size) throw new Error("There is no line " + (t + e.first) + " in the document."); + for (var n = e; !n.lines;) + for (var r = 0;; ++r) { + var i = n.children[r], + o = i.chunkSize(); + if (t < o) { + n = i; + break + } + t -= o + } + return n.lines[t] } - function Ze(e, t) { - var n = vs && e.markedSpans, - o; - if (n) - for (var r = void 0, a = 0; a < n.length; ++a) r = n[a], r.marker.collapsed && null == (t ? r.from : r.to) && (!o || 0 > $e(o, r.marker)) && (o = r.marker); - return o + function qe(e, t, n) { + var r = [], + i = t.line; + return e.iter(t.line, n.line + 1, (function (e) { + var o = e.text; + i == n.line && (o = o.slice(0, n.ch)), i == t.line && (o = o.slice(t.ch)), r.push(o), ++i + })), r } - function Je(e) { - return Ze(e, !0) + function Ke(e, t, n) { + var r = []; + return e.iter(t, n, (function (e) { + r.push(e.text) + })), r } - function et(e) { - return Ze(e, !1) + function Ye(e, t) { + var n = t - e.height; + if (n) + for (var r = e; r; r = r.parent) r.height += n } - function tt(e, t) { - var n = vs && e.markedSpans, - o; - if (n) - for (var r = 0, i; r < n.length; ++r) i = n[r], i.marker.collapsed && (null == i.from || i.from < t) && (null == i.to || i.to > t) && (!o || 0 > $e(o, i.marker)) && (o = i.marker); - return o + function Qe(e) { + if (null == e.parent) return null; + for (var t = e.parent, n = z(t.lines, e), r = t.parent; r; t = r, r = r.parent) + for (var i = 0; r.children[i] != t; ++i) n += r.children[i].chunkSize(); + return n + t.first } - function nt(e, t, n, o, r) { - var a = se(e, t), - s = vs && a.markedSpans; - if (s) - for (var d = 0, i; d < s.length; ++d) - if (i = s[d], !!i.marker.collapsed) { - var l = i.marker.find(0), - c = ge(l.from, n) || Xe(i.marker) - Xe(r), - p = ge(l.to, o) || Qe(i.marker) - Qe(r); - if (!(0 <= c && 0 >= p || 0 >= c && 0 <= p) && (0 >= c && (i.marker.inclusiveRight && r.inclusiveLeft ? 0 <= ge(l.to, n) : 0 < ge(l.to, n)) || 0 <= c && (i.marker.inclusiveRight && r.inclusiveLeft ? 0 >= ge(l.from, o) : 0 > ge(l.from, o)))) return !0 + function Ze(e, t) { + var n = e.first; + e: do { + for (var r = 0; r < e.children.length; ++r) { + var i = e.children[r], + o = i.height; + if (t < o) { + e = i; + continue e } + t -= o, n += i.chunkSize() + } + return n + } while (!e.lines); + for (var s = 0; s < e.lines.length; ++s) { + var a = e.lines[s].height; + if (t < a) break; + t -= a + } + return n + s } - function ot(e) { - for (var t; t = Je(e);) e = t.find(-1, !0).line; - return e + function Xe(e, t) { + return t >= e.first && t < e.first + e.size } - function rt(e) { - for (var t; t = et(e);) e = t.find(1, !0).line; - return e + function Je(e, t) { + return String(e.lineNumberFormatter(t + e.firstLineNumber)) } - function it(e) { - for (var t, n; t = et(e);) e = t.find(1, !0).line, (n || (n = [])).push(e); - return n + function et(e, t, n) { + if (void 0 === n && (n = null), !(this instanceof et)) return new et(e, t, n); + this.line = e, this.ch = t, this.sticky = n } - function at(e, t) { - var n = se(e, t), - o = ot(n); - return n == o ? t : pe(o) + function tt(e, t) { + return e.line - t.line || e.ch - t.ch } - function st(e, t) { - if (t > e.lastLine()) return t; - var n = se(e, t), - o; - if (!dt(e, n)) return t; - for (; o = et(n);) n = o.find(1, !0).line; - return pe(n) + 1 + function nt(e, t) { + return e.sticky == t.sticky && 0 == tt(e, t) } - function dt(e, t) { - var n = vs && t.markedSpans; - if (n) - for (var o = void 0, r = 0; r < n.length; ++r) - if (o = n[r], !!o.marker.collapsed) { - if (null == o.from) return !0; - if (!o.marker.widgetNode && 0 == o.from && o.marker.inclusiveLeft && lt(e, t, o)) return !0 - } + function rt(e) { + return et(e.line, e.ch) } - function lt(e, t, n) { - if (null == n.to) { - var o = n.marker.find(1, !0); - return lt(e, o.line, He(o.line.markedSpans, n.marker)) - } - if (n.marker.inclusiveRight && n.to == t.text.length) return !0; - for (var r = void 0, a = 0; a < t.markedSpans.length; ++a) - if (r = t.markedSpans[a], r.marker.collapsed && !r.marker.widgetNode && r.from == n.to && (null == r.to || r.to != n.from) && (r.marker.inclusiveLeft || n.marker.inclusiveRight) && lt(e, t, r)) return !0 + function it(e, t) { + return tt(e, t) < 0 ? t : e } - function ct(e) { - e = ot(e); - for (var t = 0, n = e.parent, o = 0, r; o < n.lines.length && (r = n.lines[o], r != e); ++o) t += r.height; - for (var i = n.parent; i; n = i, i = n.parent) - for (var a = 0, s; a < i.children.length && (s = i.children[a], s != n); ++a) t += s.height; - return t + function ot(e, t) { + return tt(e, t) < 0 ? e : t } - function pt(e) { - if (0 == e.height) return 0; - for (var t = e.text.length, n = e, o, r; o = Je(n);) r = o.find(0, !0), n = r.from.line, t += r.from.ch - r.to.ch; - for (n = e; o = et(n);) { - var i = o.find(0, !0); - t -= n.text.length - i.from.ch, n = i.to.line, t += n.text.length - i.to.ch + function st(e, t) { + return Math.max(e.first, Math.min(t, e.first + e.size - 1)) + } + + function at(e, t) { + if (t.line < e.first) return et(e.first, 0); + var n = e.first + e.size - 1; + return t.line > n ? et(n, $e(e, n).text.length) : function (e, t) { + var n = e.ch; + return null == n || n > t ? et(e.line, t) : n < 0 ? et(e.line, 0) : e + }(t, $e(e, t.line).text.length) + } + + function lt(e, t) { + for (var n = [], r = 0; r < t.length; r++) n[r] = at(e, t[r]); + return n + } + Ge.prototype.eol = function () { + return this.pos >= this.string.length + }, Ge.prototype.sol = function () { + return this.pos == this.lineStart + }, Ge.prototype.peek = function () { + return this.string.charAt(this.pos) || void 0 + }, Ge.prototype.next = function () { + if (this.pos < this.string.length) return this.string.charAt(this.pos++) + }, Ge.prototype.eat = function (e) { + var t = this.string.charAt(this.pos); + if ("string" == typeof e ? t == e : t && (e.test ? e.test(t) : e(t))) return ++this.pos, t + }, Ge.prototype.eatWhile = function (e) { + for (var t = this.pos; this.eat(e);); + return this.pos > t + }, Ge.prototype.eatSpace = function () { + for (var e = this.pos; + /[\s\u00a0]/.test(this.string.charAt(this.pos));) ++this.pos; + return this.pos > e + }, Ge.prototype.skipToEnd = function () { + this.pos = this.string.length + }, Ge.prototype.skipTo = function (e) { + var t = this.string.indexOf(e, this.pos); + if (t > -1) return this.pos = t, !0 + }, Ge.prototype.backUp = function (e) { + this.pos -= e + }, Ge.prototype.column = function () { + return this.lastColumnPos < this.start && (this.lastColumnValue = B(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue), this.lastColumnPos = this.start), this.lastColumnValue - (this.lineStart ? B(this.string, this.lineStart, this.tabSize) : 0) + }, Ge.prototype.indentation = function () { + return B(this.string, null, this.tabSize) - (this.lineStart ? B(this.string, this.lineStart, this.tabSize) : 0) + }, Ge.prototype.match = function (e, t, n) { + if ("string" != typeof e) { + var r = this.string.slice(this.pos).match(e); + return r && r.index > 0 ? null : (r && !1 !== t && (this.pos += r[0].length), r) + } + var i = function (e) { + return n ? e.toLowerCase() : e + }; + if (i(this.string.substr(this.pos, e.length)) == i(e)) return !1 !== t && (this.pos += e.length), !0 + }, Ge.prototype.current = function () { + return this.string.slice(this.start, this.pos) + }, Ge.prototype.hideFirstChars = function (e, t) { + this.lineStart += e; + try { + return t() + } finally { + this.lineStart -= e + } + }, Ge.prototype.lookAhead = function (e) { + var t = this.lineOracle; + return t && t.lookAhead(e) + }, Ge.prototype.baseToken = function () { + var e = this.lineOracle; + return e && e.baseToken(this.pos) + }; + var ct = function (e, t) { + this.state = e, this.lookAhead = t + }, + ut = function (e, t, n, r) { + this.state = t, this.doc = e, this.line = n, this.maxLookAhead = r || 0, this.baseTokens = null, this.baseTokenPos = 1 + }; + + function ht(e, t, n, r) { + var i = [e.state.modeGen], + o = {}; + bt(e, t.text, e.doc.mode, n, (function (e, t) { + return i.push(e, t) + }), o, r); + for (var s = n.state, a = function (r) { + n.baseTokens = i; + var a = e.state.overlays[r], + l = 1, + c = 0; + n.state = !0, bt(e, t.text, a.mode, n, (function (e, t) { + for (var n = l; c < e;) { + var r = i[l]; + r > e && i.splice(l, 1, e, i[l + 1], r), l += 2, c = Math.min(e, r) + } + if (t) + if (a.opaque) i.splice(n, l - n, e, "overlay " + t), l = n + 2; + else + for (; n < l; n += 2) { + var o = i[n + 1]; + i[n + 1] = (o ? o + " " : "") + "overlay " + t + } + }), o), n.state = s, n.baseTokens = null, n.baseTokenPos = 1 + }, l = 0; l < e.state.overlays.length; ++l) a(l); + return { + styles: i, + classes: o.bgClass || o.textClass ? o : null } - return t } - function ut(e) { - var t = e.display, - n = e.doc; - t.maxLine = se(n, n.first), t.maxLineLength = pt(t.maxLine), t.maxLineChanged = !0, n.iter(function (e) { - var n = pt(e); - n > t.maxLineLength && (t.maxLineLength = n, t.maxLine = e) - }) + function pt(e, t, n) { + if (!t.styles || t.styles[0] != e.state.modeGen) { + var r = dt(e, Qe(t)), + i = t.text.length > e.options.maxHighlightLength && We(e.doc.mode, r.state), + o = ht(e, t, r); + i && (r.state = i), t.stateAfter = r.save(!i), t.styles = o.styles, o.classes ? t.styleClasses = o.classes : t.styleClasses && (t.styleClasses = null), n === e.doc.highlightFrontier && (e.doc.modeFrontier = Math.max(e.doc.modeFrontier, ++e.doc.highlightFrontier)) + } + return t.styles } - function mt(e, t, n, o) { - e.text = t, e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null), null != e.order && (e.order = null), qe(e), Ye(e, n); - var r = o ? o(e) : 1; - r != e.height && ce(e, r) + function dt(e, t, n) { + var r = e.doc, + i = e.display; + if (!r.mode.startState) return new ut(r, !0, t); + var o = function (e, t, n) { + for (var r, i, o = e.doc, s = n ? -1 : t - (e.doc.mode.innerMode ? 1e3 : 100), a = t; a > s; --a) { + if (a <= o.first) return o.first; + var l = $e(o, a - 1), + c = l.stateAfter; + if (c && (!n || a + (c instanceof ct ? c.lookAhead : 0) <= o.modeFrontier)) return a; + var u = B(l.text, null, e.options.tabSize); + (null == i || r > u) && (i = a - 1, r = u) + } + return i + }(e, t, n), + s = o > r.first && $e(r, o - 1).stateAfter, + a = s ? ut.fromSaved(r, s, o) : new ut(r, je(r.mode), o); + return r.iter(o, t, (function (n) { + ft(e, n.text, a); + var r = a.line; + n.stateAfter = r == t - 1 || r % 5 == 0 || r >= i.viewFrom && r < i.viewTo ? a.save() : null, a.nextLine() + })), n && (r.modeFrontier = a.line), a } - function ht(e) { - e.parent = null, qe(e) + function ft(e, t, n, r) { + var i = e.doc.mode, + o = new Ge(t, e.options.tabSize, n); + for (o.start = o.pos = r || 0, "" == t && mt(i, n.state); !o.eol();) gt(i, o, n.state), o.start = o.pos } - function ft(e, t) { - if (!e || /^\s*$/.test(e)) return null; - var n = t.addModeClass ? ks : ws; - return n[e] || (n[e] = e.replace(/\S+/g, 'cm-$&')) + function mt(e, t) { + if (e.blankLine) return e.blankLine(t); + if (e.innerMode) { + var n = Ve(e, t); + return n.mode.blankLine ? n.mode.blankLine(n.state) : void 0 + } } - function gt(e, t) { - var n = u('span', null, null, Pa ? 'padding-right: .1px' : null), - o = { - pre: u('pre', [n], 'CodeMirror-line'), - content: n, - col: 0, - pos: 0, - cm: e, - trailingSpace: !1, - splitSpaces: e.getOption('lineWrapping') - }; - t.measure = {}; - for (var r = 0; r <= (t.rest ? t.rest.length : 0); r++) { - var i = r ? t.rest[r - 1] : t.line, - a = void 0; - o.pos = 0, o.addToken = St, $(e.display.measure) && (a = B(i, e.doc.direction)) && (o.addToken = bt(o.addToken, a)), o.map = []; - var s = t != e.display.externalMeasured && pe(i); - Et(i, o, _e(e, i, s)), i.styleClasses && (i.styleClasses.bgClass && (o.bgClass = g(i.styleClasses.bgClass, o.bgClass || '')), i.styleClasses.textClass && (o.textClass = g(i.styleClasses.textClass, o.textClass || ''))), 0 == o.map.length && o.map.push(0, 0, o.content.appendChild(Q(e.display.measure))), 0 == r ? (t.measure.map = o.map, t.measure.cache = {}) : ((t.measure.maps || (t.measure.maps = [])).push(o.map), (t.measure.caches || (t.measure.caches = [])).push({})) + function gt(e, t, n, r) { + for (var i = 0; i < 10; i++) { + r && (r[0] = Ve(e, n).mode); + var o = e.token(t, n); + if (t.pos > t.start) return o } - if (Pa) { - var d = o.content.lastChild; - (/\bcm-tab\b/.test(d.className) || d.querySelector && d.querySelector('.cm-tab')) && (o.content.className = 'cm-tab-wrap-hack') + throw new Error("Mode " + e.name + " failed to advance stream.") + } + ut.prototype.lookAhead = function (e) { + var t = this.doc.getLine(this.line + e); + return null != t && e > this.maxLookAhead && (this.maxLookAhead = e), t + }, ut.prototype.baseToken = function (e) { + if (!this.baseTokens) return null; + for (; this.baseTokens[this.baseTokenPos] <= e;) this.baseTokenPos += 2; + var t = this.baseTokens[this.baseTokenPos + 1]; + return { + type: t && t.replace(/( |^)overlay .*/, ""), + size: this.baseTokens[this.baseTokenPos] - e } - return H(e, 'renderLine', e, t.line, o.pre), o.pre.className && (o.textClass = g(o.pre.className, o.textClass || '')), o + }, ut.prototype.nextLine = function () { + this.line++, this.maxLookAhead > 0 && this.maxLookAhead-- + }, ut.fromSaved = function (e, t, n) { + return t instanceof ct ? new ut(e, We(e.mode, t.state), n, t.lookAhead) : new ut(e, We(e.mode, t), n) + }, ut.prototype.save = function (e) { + var t = !1 !== e ? We(this.doc.mode, this.state) : this.state; + return this.maxLookAhead > 0 ? new ct(t, this.maxLookAhead) : t + }; + var yt = function (e, t, n) { + this.start = e.start, this.end = e.pos, this.string = e.current(), this.type = t || null, this.state = n + }; + + function vt(e, t, n, r) { + var i, o, s = e.doc, + a = s.mode, + l = $e(s, (t = at(s, t)).line), + c = dt(e, t.line, n), + u = new Ge(l.text, e.options.tabSize, c); + for (r && (o = []); + (r || u.pos < t.ch) && !u.eol();) u.start = u.pos, i = gt(a, u, c.state), r && o.push(new yt(u, i, We(s.mode, c.state))); + return r ? o : new yt(u, i, c.state) } - function yt(e) { - var t = p('span', '\u2022', 'cm-invalidchar'); - return t.title = '\\u' + e.charCodeAt(0).toString(16), t.setAttribute('aria-label', t.title), t + function wt(e, t) { + if (e) + for (;;) { + var n = e.match(/(?:^|\s+)line-(background-)?(\S+)/); + if (!n) break; + e = e.slice(0, n.index) + e.slice(n.index + n[0].length); + var r = n[1] ? "bgClass" : "textClass"; + null == t[r] ? t[r] = n[2] : new RegExp("(?:^|s)" + n[2] + "(?:$|s)").test(t[r]) || (t[r] += " " + n[2]) + } + return e } - function St(e, t, n, o, r, i, a) { - if (t) { - var s = e.splitSpaces ? Ct(t, e.trailingSpace) : t, - d = e.cm.state.specialChars, - l = !1, - c; - if (!d.test(t)) e.col += t.length, c = document.createTextNode(s), e.map.push(e.pos, e.pos + t.length, c), Ra && 9 > xa && (l = !0), e.pos += t.length; - else { - c = document.createDocumentFragment(); - for (var u = 0;;) { - d.lastIndex = u; - var h = d.exec(t), - f = h ? h.index - u : t.length - u; - if (f) { - var g = document.createTextNode(s.slice(u, u + f)); - Ra && 9 > xa ? c.appendChild(p('span', [g])) : c.appendChild(g), e.map.push(e.pos, e.pos + f, g), e.col += f, e.pos += f - } - if (!h) break; - u += f + 1; - var y = void 0; - if ('\t' == h[0]) { - var S = e.cm.options.tabSize, - C = S - e.col % S; - y = c.appendChild(p('span', E(C), 'cm-tab')), y.setAttribute('role', 'presentation'), y.setAttribute('cm-text', '\t'), e.col += C - } else '\r' == h[0] || '\n' == h[0] ? (y = c.appendChild(p('span', '\r' == h[0] ? '\u240D' : '\u2424', 'cm-invalidchar')), y.setAttribute('cm-text', h[0]), e.col += 1) : (y = e.cm.options.specialCharPlaceholder(h[0]), y.setAttribute('cm-text', h[0]), Ra && 9 > xa ? c.appendChild(p('span', [y])) : c.appendChild(y), e.col += 1); - e.map.push(e.pos, e.pos + 1, y), e.pos++ - } + function bt(e, t, n, r, i, o, s) { + var a = n.flattenSpans; + null == a && (a = e.options.flattenSpans); + var l, c = 0, + u = null, + h = new Ge(t, e.options.tabSize, r), + p = e.options.addModeClass && [null]; + for ("" == t && wt(mt(n, r.state), o); !h.eol();) { + if (h.pos > e.options.maxHighlightLength ? (a = !1, s && ft(e, t, r, h.pos), h.pos = t.length, l = null) : l = wt(gt(n, h, r.state, p), o), p) { + var d = p[0].name; + d && (l = "m-" + (l ? d + " " + l : d)) } - if (e.trailingSpace = 32 == s.charCodeAt(t.length - 1), n || o || r || l || i) { - var b = n || ''; - o && (b += o), r && (b += r); - var v = p('span', [c], b, i); - if (a) - for (var w in a) a.hasOwnProperty(w) && 'style' != w && 'class' != w && v.setAttribute(w, a[w]); - return e.content.appendChild(v) + if (!a || u != l) { + for (; c < h.start;) i(c = Math.min(h.start, c + 5e3), u); + u = l } - e.content.appendChild(c) + h.start = h.pos + } + for (; c < h.pos;) { + var f = Math.min(h.pos, c + 5e3); + i(f, u), c = f } } + var St = !1, + Ct = !1; - function Ct(e, t) { - if (1 < e.length && !/ /.test(e)) return e; - for (var n = t, o = '', r = 0, i; r < e.length; r++) i = e.charAt(r), ' ' == i && n && (r == e.length - 1 || 32 == e.charCodeAt(r + 1)) && (i = '\xA0'), o += i, n = ' ' == i; - return o + function Et(e, t, n) { + this.marker = e, this.from = t, this.to = n } - function bt(e, t) { - return function (n, o, r, a, s, d, l) { - r = r ? r + ' cm-force-border' : 'cm-force-border'; - for (var c = n.pos, p = c + o.length;;) { - for (var u = void 0, m = 0; m < t.length && (u = t[m], !(u.to > c && u.from <= c)); m++); - if (u.to >= p) return e(n, o, r, a, s, d, l); - e(n, o.slice(0, u.to - c), r, a, null, d, l), a = null, o = o.slice(u.to - c), c = u.to + function kt(e, t) { + if (e) + for (var n = 0; n < e.length; ++n) { + var r = e[n]; + if (r.marker == t) return r } - } } - function vt(e, t, n, o) { - var r = !o && n.widgetNode; - r && e.map.push(e.pos, e.pos + t, r), !o && e.cm.display.input.needsContentAttribute && (!r && (r = e.content.appendChild(document.createElement('span'))), r.setAttribute('cm-marker', n.id)), r && (e.cm.display.input.setUneditable(r), e.content.appendChild(r)), e.pos += t, e.trailingSpace = !1 + function xt(e, t) { + for (var n, r = 0; r < e.length; ++r) e[r] != t && (n || (n = [])).push(e[r]); + return n } - function Et(e, t, n) { - var o = e.markedSpans, - r = e.text, - a = 0; - if (!o) { - for (var s = 1; s < n.length; s += 2) t.addToken(t, r.slice(a, a = n[s]), ft(n[s + 1], t.cm.options)); - return - } - for (var l = r.length, c = 0, p = 1, i = '', u = 0, h, f, g, y, S, C, b;;) { - if (u == c) { - g = y = S = f = '', b = null, C = null, u = Infinity; - for (var v = [], E = void 0, w = 0; w < o.length; ++w) { - var k = o[w], - T = k.marker; - if ('bookmark' == T.type && k.from == c && T.widgetNode) v.push(T); - else if (k.from <= c && (null == k.to || k.to > c || T.collapsed && k.to == c && k.from == c)) { - if (null != k.to && k.to != c && u > k.to && (u = k.to, y = ''), T.className && (g += ' ' + T.className), T.css && (f = (f ? f + ';' : '') + T.css), T.startStyle && k.from == c && (S += ' ' + T.startStyle), T.endStyle && k.to == u && (E || (E = [])).push(T.endStyle, k.to), T.title && ((b || (b = {})).title = T.title), T.attributes) - for (var m in T.attributes)(b || (b = {}))[m] = T.attributes[m]; - T.collapsed && (!C || 0 > $e(C.marker, T)) && (C = k) - } else k.from > c && u > k.from && (u = k.from) - } - if (E) - for (var _ = 0; _ < E.length; _ += 2) E[_ + 1] == u && (y += ' ' + E[_]); - if (!C || C.from == c) - for (var R = 0; R < v.length; ++R) vt(t, 0, v[R]); - if (C && (C.from || 0) == c) { - if (vt(t, (null == C.to ? l + 1 : C.to) - c, C.marker, null == C.from), null == C.to) return; - C.to == c && (C = !1) - } - } - if (c >= l) break; - for (var x = d(l, u);;) { - if (i) { - var P = c + i.length; - if (!C) { - var D = P > x ? i.slice(0, x - c) : i; - t.addToken(t, D, h ? h + g : g, S, c + D.length == u ? y : '', f, b) + function Tt(e, t) { + if (t.full) return null; + var n = Xe(e, t.from.line) && $e(e, t.from.line).markedSpans, + r = Xe(e, t.to.line) && $e(e, t.to.line).markedSpans; + if (!n && !r) return null; + var i = t.from.ch, + o = t.to.ch, + s = 0 == tt(t.from, t.to), + a = function (e, t, n) { + var r; + if (e) + for (var i = 0; i < e.length; ++i) { + var o = e[i], + s = o.marker; + if (null == o.from || (s.inclusiveLeft ? o.from <= t : o.from < t) || o.from == t && "bookmark" == s.type && (!n || !o.marker.insertLeft)) { + var a = null == o.to || (s.inclusiveRight ? o.to >= t : o.to > t); + (r || (r = [])).push(new Et(s, o.from, a ? null : o.to)) + } } - if (P >= x) { - i = i.slice(x - c), c = x; - break + return r + }(n, i, s), + l = function (e, t, n) { + var r; + if (e) + for (var i = 0; i < e.length; ++i) { + var o = e[i], + s = o.marker; + if (null == o.to || (s.inclusiveRight ? o.to >= t : o.to > t) || o.from == t && "bookmark" == s.type && (!n || o.marker.insertLeft)) { + var a = null == o.from || (s.inclusiveLeft ? o.from <= t : o.from < t); + (r || (r = [])).push(new Et(s, a ? null : o.from - t, null == o.to ? null : o.to - t)) + } } - c = P, S = '' + return r + }(r, o, s), + c = 1 == t.text.length, + u = K(t.text).length + (c ? i : 0); + if (a) + for (var h = 0; h < a.length; ++h) { + var p = a[h]; + if (null == p.to) { + var d = kt(l, p.marker); + d ? c && (p.to = null == d.to ? null : d.to + u) : p.to = i } - i = r.slice(a, a = n[p++]), h = ft(n[p++], t.cm.options) } + if (l) + for (var f = 0; f < l.length; ++f) { + var m = l[f]; + null != m.to && (m.to += u), null == m.from ? kt(a, m.marker) || (m.from = u, c && (a || (a = [])).push(m)) : (m.from += u, c && (a || (a = [])).push(m)) + } + a && (a = Rt(a)), l && l != a && (l = Rt(l)); + var g = [a]; + if (!c) { + var y, v = t.text.length - 2; + if (v > 0 && a) + for (var w = 0; w < a.length; ++w) null == a[w].to && (y || (y = [])).push(new Et(a[w].marker, null, null)); + for (var b = 0; b < v; ++b) g.push(y); + g.push(l) } + return g } - function wt(e, t, n) { - this.line = t, this.rest = it(t), this.size = this.rest ? pe(w(this.rest)) - n + 1 : 1, this.node = this.text = null, this.hidden = dt(e, t) + function Rt(e) { + for (var t = 0; t < e.length; ++t) { + var n = e[t]; + null != n.from && n.from == n.to && !1 !== n.marker.clearWhenEmpty && e.splice(t--, 1) + } + return e.length ? e : null } - function kt(e, t, n) { - for (var o = [], r = t, i, a; r < n; r = i) a = new wt(e.doc, se(e.doc, r), r), i = r + a.size, o.push(a); - return o + function Dt(e) { + var t = e.markedSpans; + if (t) { + for (var n = 0; n < t.length; ++n) t[n].marker.detachLine(e); + e.markedSpans = null + } } - function Tt(e) { - Ts ? Ts.ops.push(e) : e.ownsGroup = Ts = { - ops: [e], - delayedCallbacks: [] + function _t(e, t) { + if (t) { + for (var n = 0; n < t.length; ++n) t[n].marker.attachLine(e); + e.markedSpans = t } } - function _t(e) { - var t = e.delayedCallbacks, - n = 0; - do { - for (; n < t.length; n++) t[n].call(null); - for (var o = 0, r; o < e.ops.length; o++) - if (r = e.ops[o], r.cursorActivityHandlers) - for (; r.cursorActivityCalled < r.cursorActivityHandlers.length;) r.cursorActivityHandlers[r.cursorActivityCalled++].call(null, r.cm) - } while (n < t.length) + function At(e) { + return e.inclusiveLeft ? -1 : 0 } - function Rt(e, t) { - var n = e.ownsGroup; - if (n) try { - _t(n) - } finally { - Ts = null, t(n) - } + function Mt(e) { + return e.inclusiveRight ? 1 : 0 } - function xt(e, t) { - var n = N(e, t); - if (n.length) { - var o = Array.prototype.slice.call(arguments, 2), - r; - Ts ? r = Ts.delayedCallbacks : _s ? r = _s : (r = _s = [], setTimeout(Pt, 0)); - for (var a = function (e) { - r.push(function () { - return n[e].apply(null, o) - }) - }, s = 0; s < n.length; ++s) a(s) - } + function Pt(e, t) { + var n = e.lines.length - t.lines.length; + if (0 != n) return n; + var r = e.find(), + i = t.find(), + o = tt(r.from, i.from) || At(e) - At(t); + if (o) return -o; + var s = tt(r.to, i.to) || Mt(e) - Mt(t); + return s || t.id - e.id } - function Pt() { - var e = _s; - _s = null; - for (var t = 0; t < e.length; ++t) e[t]() + function It(e, t) { + var n, r = Ct && e.markedSpans; + if (r) + for (var i = void 0, o = 0; o < r.length; ++o)(i = r[o]).marker.collapsed && null == (t ? i.from : i.to) && (!n || Pt(n, i.marker) < 0) && (n = i.marker); + return n } - function Dt(e, t, n, o) { - for (var r = 0, i; r < t.changes.length; r++) i = t.changes[r], 'text' == i ? Lt(e, t) : 'gutter' == i ? Bt(e, t, n, o) : 'class' == i ? Ft(e, t) : 'widget' == i && Nt(e, t, o); - t.changes = null + function Ot(e) { + return It(e, !0) } - function Mt(e) { - return e.node == e.text && (e.node = p('div', null, null, 'position: relative'), e.text.parentNode && e.text.parentNode.replaceChild(e.node, e.text), e.node.appendChild(e.text), Ra && 8 > xa && (e.node.style.zIndex = 2)), e.node + function Lt(e) { + return It(e, !1) } - function At(e, t) { - var n = t.bgClass ? t.bgClass + ' ' + (t.line.bgClass || '') : t.line.bgClass; - if (n && (n += ' CodeMirror-linebackground'), t.background) n ? t.background.className = n : (t.background.parentNode.removeChild(t.background), t.background = null); - else if (n) { - var o = Mt(t); - t.background = o.insertBefore(p('div', null, n), o.firstChild), e.display.input.setUneditable(t.background) - } + function Nt(e, t) { + var n, r = Ct && e.markedSpans; + if (r) + for (var i = 0; i < r.length; ++i) { + var o = r[i]; + o.marker.collapsed && (null == o.from || o.from < t) && (null == o.to || o.to > t) && (!n || Pt(n, o.marker) < 0) && (n = o.marker) + } + return n } - function It(e, t) { - var n = e.display.externalMeasured; - return n && n.line == t.line ? (e.display.externalMeasured = null, t.measure = n.measure, n.built) : gt(e, t) + function Ft(e, t, n, r, i) { + var o = $e(e, t), + s = Ct && o.markedSpans; + if (s) + for (var a = 0; a < s.length; ++a) { + var l = s[a]; + if (l.marker.collapsed) { + var c = l.marker.find(0), + u = tt(c.from, n) || At(l.marker) - At(i), + h = tt(c.to, r) || Mt(l.marker) - Mt(i); + if (!(u >= 0 && h <= 0 || u <= 0 && h >= 0) && (u <= 0 && (l.marker.inclusiveRight && i.inclusiveLeft ? tt(c.to, n) >= 0 : tt(c.to, n) > 0) || u >= 0 && (l.marker.inclusiveRight && i.inclusiveLeft ? tt(c.from, r) <= 0 : tt(c.from, r) < 0))) return !0 + } + } } - function Lt(e, t) { - var n = t.text.className, - o = It(e, t); - t.text == t.node && (t.node = o.pre), t.text.parentNode.replaceChild(o.pre, t.text), t.text = o.pre, o.bgClass != t.bgClass || o.textClass != t.textClass ? (t.bgClass = o.bgClass, t.textClass = o.textClass, Ft(e, t)) : n && (t.text.className = n) + function Bt(e) { + for (var t; t = Ot(e);) e = t.find(-1, !0).line; + return e } - function Ft(e, t) { - At(e, t), t.line.wrapClass ? Mt(t).className = t.line.wrapClass : t.node != t.text && (t.node.className = ''); - var n = t.textClass ? t.textClass + ' ' + (t.line.textClass || '') : t.line.textClass; - t.text.className = n || '' + function Ht(e, t) { + var n = $e(e, t), + r = Bt(n); + return n == r ? t : Qe(r) } - function Bt(e, t, n, o) { - if (t.gutter && (t.node.removeChild(t.gutter), t.gutter = null), t.gutterBackground && (t.node.removeChild(t.gutterBackground), t.gutterBackground = null), t.line.gutterClass) { - var r = Mt(t); - t.gutterBackground = p('div', null, 'CodeMirror-gutter-background ' + t.line.gutterClass, 'left: ' + (e.options.fixedGutter ? o.fixedPos : -o.gutterTotalWidth) + 'px; width: ' + o.gutterTotalWidth + 'px'), e.display.input.setUneditable(t.gutterBackground), r.insertBefore(t.gutterBackground, t.text) - } - var i = t.line.gutterMarkers; - if (e.options.lineNumbers || i) { - var a = Mt(t), - s = t.gutter = p('div', null, 'CodeMirror-gutter-wrapper', 'left: ' + (e.options.fixedGutter ? o.fixedPos : -o.gutterTotalWidth) + 'px'); - if (e.display.input.setUneditable(s), a.insertBefore(s, t.text), t.line.gutterClass && (s.className += ' ' + t.line.gutterClass), !e.options.lineNumbers || i && i['CodeMirror-linenumbers'] || (t.lineNumber = s.appendChild(p('div', he(e.options, n), 'CodeMirror-linenumber CodeMirror-gutter-elt', 'left: ' + o.gutterLeft['CodeMirror-linenumbers'] + 'px; width: ' + e.display.lineNumInnerWidth + 'px'))), i) - for (var d = 0; d < e.display.gutterSpecs.length; ++d) { - var l = e.display.gutterSpecs[d].className, - c = i.hasOwnProperty(l) && i[l]; - c && s.appendChild(p('div', [c], 'CodeMirror-gutter-elt', 'left: ' + o.gutterLeft[l] + 'px; width: ' + o.gutterWidth[l] + 'px')) - } + function zt(e, t) { + if (t > e.lastLine()) return t; + var n, r = $e(e, t); + if (!Ut(e, r)) return t; + for (; n = Lt(r);) r = n.find(1, !0).line; + return Qe(r) + 1 + } + + function Ut(e, t) { + var n = Ct && t.markedSpans; + if (n) + for (var r = void 0, i = 0; i < n.length; ++i) + if ((r = n[i]).marker.collapsed) { + if (null == r.from) return !0; + if (!r.marker.widgetNode && 0 == r.from && r.marker.inclusiveLeft && Wt(e, t, r)) return !0 + } + } + + function Wt(e, t, n) { + if (null == n.to) { + var r = n.marker.find(1, !0); + return Wt(e, r.line, kt(r.line.markedSpans, n.marker)) + } + if (n.marker.inclusiveRight && n.to == t.text.length) return !0; + for (var i = void 0, o = 0; o < t.markedSpans.length; ++o) + if ((i = t.markedSpans[o]).marker.collapsed && !i.marker.widgetNode && i.from == n.to && (null == i.to || i.to != n.from) && (i.marker.inclusiveLeft || n.marker.inclusiveRight) && Wt(e, t, i)) return !0 + } + + function Vt(e) { + for (var t = 0, n = (e = Bt(e)).parent, r = 0; r < n.lines.length; ++r) { + var i = n.lines[r]; + if (i == e) break; + t += i.height + } + for (var o = n.parent; o; o = (n = o).parent) + for (var s = 0; s < o.children.length; ++s) { + var a = o.children[s]; + if (a == n) break; + t += a.height + } + return t + } + + function jt(e) { + if (0 == e.height) return 0; + for (var t, n = e.text.length, r = e; t = Ot(r);) { + var i = t.find(0, !0); + r = i.from.line, n += i.from.ch - i.to.ch + } + for (r = e; t = Lt(r);) { + var o = t.find(0, !0); + n -= r.text.length - o.from.ch, n += (r = o.to.line).text.length - o.to.ch + } + return n + } + + function Gt(e) { + var t = e.display, + n = e.doc; + t.maxLine = $e(n, n.first), t.maxLineLength = jt(t.maxLine), t.maxLineChanged = !0, n.iter((function (e) { + var n = jt(e); + n > t.maxLineLength && (t.maxLineLength = n, t.maxLine = e) + })) + } + var $t = function (e, t, n) { + this.text = e, _t(this, t), this.height = n ? n(this) : 1 + }; + + function qt(e) { + e.parent = null, Dt(e) + } + $t.prototype.lineNo = function () { + return Qe(this) + }, ve($t); + var Kt = {}, + Yt = {}; + + function Qt(e, t) { + if (!e || /^\s*$/.test(e)) return null; + var n = t.addModeClass ? Yt : Kt; + return n[e] || (n[e] = e.replace(/\S+/g, "cm-$&")) + } + + function Zt(e, t) { + var n = A("span", null, null, l ? "padding-right: .1px" : null), + r = { + pre: A("pre", [n], "CodeMirror-line"), + content: n, + col: 0, + pos: 0, + cm: e, + trailingSpace: !1, + splitSpaces: e.getOption("lineWrapping") + }; + t.measure = {}; + for (var i = 0; i <= (t.rest ? t.rest.length : 0); i++) { + var o = i ? t.rest[i - 1] : t.line, + s = void 0; + r.pos = 0, r.addToken = Jt, _e(e.display.measure) && (s = ce(o, e.doc.direction)) && (r.addToken = en(r.addToken, s)), r.map = [], nn(o, r, pt(e, o, t != e.display.externalMeasured && Qe(o))), o.styleClasses && (o.styleClasses.bgClass && (r.bgClass = O(o.styleClasses.bgClass, r.bgClass || "")), o.styleClasses.textClass && (r.textClass = O(o.styleClasses.textClass, r.textClass || ""))), 0 == r.map.length && r.map.push(0, 0, r.content.appendChild(De(e.display.measure))), 0 == i ? (t.measure.map = r.map, t.measure.cache = {}) : ((t.measure.maps || (t.measure.maps = [])).push(r.map), (t.measure.caches || (t.measure.caches = [])).push({})) + } + if (l) { + var a = r.content.lastChild; + (/\bcm-tab\b/.test(a.className) || a.querySelector && a.querySelector(".cm-tab")) && (r.content.className = "cm-tab-wrap-hack") + } + return fe(e, "renderLine", e, t.line, r.pre), r.pre.className && (r.textClass = O(r.pre.className, r.textClass || "")), r + } + + function Xt(e) { + var t = _("span", "•", "cm-invalidchar"); + return t.title = "\\u" + e.charCodeAt(0).toString(16), t.setAttribute("aria-label", t.title), t + } + + function Jt(e, t, n, r, i, o, l) { + if (t) { + var c, u = e.splitSpaces ? function (e, t) { + if (e.length > 1 && !/ /.test(e)) return e; + for (var n = t, r = "", i = 0; i < e.length; i++) { + var o = e.charAt(i); + " " != o || !n || i != e.length - 1 && 32 != e.charCodeAt(i + 1) || (o = " "), r += o, n = " " == o + } + return r + }(t, e.trailingSpace) : t, + h = e.cm.state.specialChars, + p = !1; + if (h.test(t)) { + c = document.createDocumentFragment(); + for (var d = 0;;) { + h.lastIndex = d; + var f = h.exec(t), + m = f ? f.index - d : t.length - d; + if (m) { + var g = document.createTextNode(u.slice(d, d + m)); + s && a < 9 ? c.appendChild(_("span", [g])) : c.appendChild(g), e.map.push(e.pos, e.pos + m, g), e.col += m, e.pos += m + } + if (!f) break; + d += m + 1; + var y = void 0; + if ("\t" == f[0]) { + var v = e.cm.options.tabSize, + w = v - e.col % v; + (y = c.appendChild(_("span", q(w), "cm-tab"))).setAttribute("role", "presentation"), y.setAttribute("cm-text", "\t"), e.col += w + } else "\r" == f[0] || "\n" == f[0] ? ((y = c.appendChild(_("span", "\r" == f[0] ? "␍" : "␤", "cm-invalidchar"))).setAttribute("cm-text", f[0]), e.col += 1) : ((y = e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text", f[0]), s && a < 9 ? c.appendChild(_("span", [y])) : c.appendChild(y), e.col += 1); + e.map.push(e.pos, e.pos + 1, y), e.pos++ + } + } else e.col += t.length, c = document.createTextNode(u), e.map.push(e.pos, e.pos + t.length, c), s && a < 9 && (p = !0), e.pos += t.length; + if (e.trailingSpace = 32 == u.charCodeAt(t.length - 1), n || r || i || p || o) { + var b = n || ""; + r && (b += r), i && (b += i); + var S = _("span", [c], b, o); + if (l) + for (var C in l) l.hasOwnProperty(C) && "style" != C && "class" != C && S.setAttribute(C, l[C]); + return e.content.appendChild(S) + } + e.content.appendChild(c) } } - function Nt(e, t, n) { + function en(e, t) { + return function (n, r, i, o, s, a, l) { + i = i ? i + " cm-force-border" : "cm-force-border"; + for (var c = n.pos, u = c + r.length;;) { + for (var h = void 0, p = 0; p < t.length && !((h = t[p]).to > c && h.from <= c); p++); + if (h.to >= u) return e(n, r, i, o, s, a, l); + e(n, r.slice(0, h.to - c), i, o, null, a, l), o = null, r = r.slice(h.to - c), c = h.to + } + } + } + + function tn(e, t, n, r) { + var i = !r && n.widgetNode; + i && e.map.push(e.pos, e.pos + t, i), !r && e.cm.display.input.needsContentAttribute && (i || (i = e.content.appendChild(document.createElement("span"))), i.setAttribute("cm-marker", n.id)), i && (e.cm.display.input.setUneditable(i), e.content.appendChild(i)), e.pos += t, e.trailingSpace = !1 + } + + function nn(e, t, n) { + var r = e.markedSpans, + i = e.text, + o = 0; + if (r) + for (var s, a, l, c, u, h, p, d = i.length, f = 0, m = 1, g = "", y = 0;;) { + if (y == f) { + l = c = u = a = "", p = null, h = null, y = 1 / 0; + for (var v = [], w = void 0, b = 0; b < r.length; ++b) { + var S = r[b], + C = S.marker; + if ("bookmark" == C.type && S.from == f && C.widgetNode) v.push(C); + else if (S.from <= f && (null == S.to || S.to > f || C.collapsed && S.to == f && S.from == f)) { + if (null != S.to && S.to != f && y > S.to && (y = S.to, c = ""), C.className && (l += " " + C.className), C.css && (a = (a ? a + ";" : "") + C.css), C.startStyle && S.from == f && (u += " " + C.startStyle), C.endStyle && S.to == y && (w || (w = [])).push(C.endStyle, S.to), C.title && ((p || (p = {})).title = C.title), C.attributes) + for (var E in C.attributes)(p || (p = {}))[E] = C.attributes[E]; + C.collapsed && (!h || Pt(h.marker, C) < 0) && (h = S) + } else S.from > f && y > S.from && (y = S.from) + } + if (w) + for (var k = 0; k < w.length; k += 2) w[k + 1] == y && (c += " " + w[k]); + if (!h || h.from == f) + for (var x = 0; x < v.length; ++x) tn(t, 0, v[x]); + if (h && (h.from || 0) == f) { + if (tn(t, (null == h.to ? d + 1 : h.to) - f, h.marker, null == h.from), null == h.to) return; + h.to == f && (h = !1) + } + } + if (f >= d) break; + for (var T = Math.min(d, y);;) { + if (g) { + var R = f + g.length; + if (!h) { + var D = R > T ? g.slice(0, T - f) : g; + t.addToken(t, D, s ? s + l : l, u, f + D.length == y ? c : "", a, p) + } + if (R >= T) { + g = g.slice(T - f), f = T; + break + } + f = R, u = "" + } + g = i.slice(o, o = n[m++]), s = Qt(n[m++], t.cm.options) + } + } else + for (var _ = 1; _ < n.length; _ += 2) t.addToken(t, i.slice(o, o = n[_]), Qt(n[_ + 1], t.cm.options)) + } + + function rn(e, t, n) { + this.line = t, this.rest = function (e) { + for (var t, n; t = Lt(e);) e = t.find(1, !0).line, (n || (n = [])).push(e); + return n + }(t), this.size = this.rest ? Qe(K(this.rest)) - n + 1 : 1, this.node = this.text = null, this.hidden = Ut(e, t) + } + + function on(e, t, n) { + for (var r, i = [], o = t; o < n; o = r) { + var s = new rn(e.doc, $e(e.doc, o), o); + r = o + s.size, i.push(s) + } + return i + } + var sn = null, + an = null; + + function ln(e, t) { + var n = pe(e, t); + if (n.length) { + var r, i = Array.prototype.slice.call(arguments, 2); + sn ? r = sn.delayedCallbacks : an ? r = an : (r = an = [], setTimeout(cn, 0)); + for (var o = function (e) { + r.push((function () { + return n[e].apply(null, i) + })) + }, s = 0; s < n.length; ++s) o(s) + } + } + + function cn() { + var e = an; + an = null; + for (var t = 0; t < e.length; ++t) e[t]() + } + + function un(e, t, n, r) { + for (var i = 0; i < t.changes.length; i++) { + var o = t.changes[i]; + "text" == o ? dn(e, t) : "gutter" == o ? mn(e, t, n, r) : "class" == o ? fn(e, t) : "widget" == o && gn(e, t, r) + } + t.changes = null + } + + function hn(e) { + return e.node == e.text && (e.node = _("div", null, null, "position: relative"), e.text.parentNode && e.text.parentNode.replaceChild(e.node, e.text), e.node.appendChild(e.text), s && a < 8 && (e.node.style.zIndex = 2)), e.node + } + + function pn(e, t) { + var n = e.display.externalMeasured; + return n && n.line == t.line ? (e.display.externalMeasured = null, t.measure = n.measure, n.built) : Zt(e, t) + } + + function dn(e, t) { + var n = t.text.className, + r = pn(e, t); + t.text == t.node && (t.node = r.pre), t.text.parentNode.replaceChild(r.pre, t.text), t.text = r.pre, r.bgClass != t.bgClass || r.textClass != t.textClass ? (t.bgClass = r.bgClass, t.textClass = r.textClass, fn(e, t)) : n && (t.text.className = n) + } + + function fn(e, t) { + ! function (e, t) { + var n = t.bgClass ? t.bgClass + " " + (t.line.bgClass || "") : t.line.bgClass; + if (n && (n += " CodeMirror-linebackground"), t.background) n ? t.background.className = n : (t.background.parentNode.removeChild(t.background), t.background = null); + else if (n) { + var r = hn(t); + t.background = r.insertBefore(_("div", null, n), r.firstChild), e.display.input.setUneditable(t.background) + } + }(e, t), t.line.wrapClass ? hn(t).className = t.line.wrapClass : t.node != t.text && (t.node.className = ""); + var n = t.textClass ? t.textClass + " " + (t.line.textClass || "") : t.line.textClass; + t.text.className = n || "" + } + + function mn(e, t, n, r) { + if (t.gutter && (t.node.removeChild(t.gutter), t.gutter = null), t.gutterBackground && (t.node.removeChild(t.gutterBackground), t.gutterBackground = null), t.line.gutterClass) { + var i = hn(t); + t.gutterBackground = _("div", null, "CodeMirror-gutter-background " + t.line.gutterClass, "left: " + (e.options.fixedGutter ? r.fixedPos : -r.gutterTotalWidth) + "px; width: " + r.gutterTotalWidth + "px"), e.display.input.setUneditable(t.gutterBackground), i.insertBefore(t.gutterBackground, t.text) + } + var o = t.line.gutterMarkers; + if (e.options.lineNumbers || o) { + var s = hn(t), + a = t.gutter = _("div", null, "CodeMirror-gutter-wrapper", "left: " + (e.options.fixedGutter ? r.fixedPos : -r.gutterTotalWidth) + "px"); + if (e.display.input.setUneditable(a), s.insertBefore(a, t.text), t.line.gutterClass && (a.className += " " + t.line.gutterClass), !e.options.lineNumbers || o && o["CodeMirror-linenumbers"] || (t.lineNumber = a.appendChild(_("div", Je(e.options, n), "CodeMirror-linenumber CodeMirror-gutter-elt", "left: " + r.gutterLeft["CodeMirror-linenumbers"] + "px; width: " + e.display.lineNumInnerWidth + "px"))), o) + for (var l = 0; l < e.display.gutterSpecs.length; ++l) { + var c = e.display.gutterSpecs[l].className, + u = o.hasOwnProperty(c) && o[c]; + u && a.appendChild(_("div", [u], "CodeMirror-gutter-elt", "left: " + r.gutterLeft[c] + "px; width: " + r.gutterWidth[c] + "px")) + } + } + } + + function gn(e, t, n) { t.alignable && (t.alignable = null); - for (var o = t.node.firstChild, r = void 0; o; o = r) r = o.nextSibling, 'CodeMirror-linewidget' == o.className && t.node.removeChild(o); - Ht(e, t, n) + for (var r = t.node.firstChild, i = void 0; r; r = i) i = r.nextSibling, "CodeMirror-linewidget" == r.className && t.node.removeChild(r); + vn(e, t, n) } - function Ot(e, t, n, o) { - var r = It(e, t); - return t.text = t.node = r.pre, r.bgClass && (t.bgClass = r.bgClass), r.textClass && (t.textClass = r.textClass), Ft(e, t), Bt(e, t, n, o), Ht(e, t, o), t.node + function yn(e, t, n, r) { + var i = pn(e, t); + return t.text = t.node = i.pre, i.bgClass && (t.bgClass = i.bgClass), i.textClass && (t.textClass = i.textClass), fn(e, t), mn(e, t, n, r), vn(e, t, r), t.node } - function Ht(e, t, n) { - if (zt(e, t.line, t, n, !0), t.rest) - for (var o = 0; o < t.rest.length; o++) zt(e, t.rest[o], t, n, !1) + function vn(e, t, n) { + if (wn(e, t.line, t, n, !0), t.rest) + for (var r = 0; r < t.rest.length; r++) wn(e, t.rest[r], t, n, !1) } - function zt(e, t, n, o, r) { + function wn(e, t, n, r, i) { if (t.widgets) - for (var a = Mt(n), s = 0, i = t.widgets; s < i.length; ++s) { - var d = i[s], - l = p('div', [d.node], 'CodeMirror-linewidget'); - d.handleMouseEvents || l.setAttribute('cm-ignore-events', 'true'), Ut(d, l, n, o), e.display.input.setUneditable(l), r && d.above ? a.insertBefore(l, n.gutter || n.text) : a.appendChild(l), xt(d, 'redraw') + for (var o = hn(n), s = 0, a = t.widgets; s < a.length; ++s) { + var l = a[s], + c = _("div", [l.node], "CodeMirror-linewidget"); + l.handleMouseEvents || c.setAttribute("cm-ignore-events", "true"), bn(l, c, n, r), e.display.input.setUneditable(c), i && l.above ? o.insertBefore(c, n.gutter || n.text) : o.appendChild(c), ln(l, "redraw") } } - function Ut(e, t, n, o) { + function bn(e, t, n, r) { if (e.noHScroll) { (n.alignable || (n.alignable = [])).push(t); - var r = o.wrapperWidth; - t.style.left = o.fixedPos + 'px', e.coverGutter || (r -= o.gutterTotalWidth, t.style.paddingLeft = o.gutterTotalWidth + 'px'), t.style.width = r + 'px' + var i = r.wrapperWidth; + t.style.left = r.fixedPos + "px", e.coverGutter || (i -= r.gutterTotalWidth, t.style.paddingLeft = r.gutterTotalWidth + "px"), t.style.width = i + "px" } - e.coverGutter && (t.style.zIndex = 5, t.style.position = 'relative', !e.noHScroll && (t.style.marginLeft = -o.gutterTotalWidth + 'px')) + e.coverGutter && (t.style.zIndex = 5, t.style.position = "relative", e.noHScroll || (t.style.marginLeft = -r.gutterTotalWidth + "px")) } - function Wt(e) { + function Sn(e) { if (null != e.height) return e.height; var t = e.doc.cm; if (!t) return 0; - if (!m(document.body, e.node)) { - var n = 'position: relative;'; - e.coverGutter && (n += 'margin-left: -' + t.display.gutters.offsetWidth + 'px;'), e.noHScroll && (n += 'width: ' + t.display.wrapper.clientWidth + 'px;'), c(t.display.measure, p('div', [e.node], null, n)) + if (!M(document.body, e.node)) { + var n = "position: relative;"; + e.coverGutter && (n += "margin-left: -" + t.display.gutters.offsetWidth + "px;"), e.noHScroll && (n += "width: " + t.display.wrapper.clientWidth + "px;"), D(t.display.measure, _("div", [e.node], null, n)) } return e.height = e.node.parentNode.offsetHeight } - function Vt(t, o) { - for (var e = Y(o); e != t.wrapper; e = e.parentNode) - if (!e || 1 == e.nodeType && 'true' == e.getAttribute('cm-ignore-events') || e.parentNode == t.sizer && e != t.mover) return !0 + function Cn(e, t) { + for (var n = Ee(t); n != e.wrapper; n = n.parentNode) + if (!n || 1 == n.nodeType && "true" == n.getAttribute("cm-ignore-events") || n.parentNode == e.sizer && n != e.mover) return !0 } - function Gt(e) { + function En(e) { return e.lineSpace.offsetTop } - function Kt(e) { + function kn(e) { return e.mover.offsetHeight - e.lineSpace.offsetHeight } - function jt(t) { - if (t.cachedPaddingH) return t.cachedPaddingH; - var n = c(t.measure, p('pre', 'x', 'CodeMirror-line-like')), - e = window.getComputedStyle ? window.getComputedStyle(n) : n.currentStyle, - o = { - left: parseInt(e.paddingLeft), - right: parseInt(e.paddingRight) + function xn(e) { + if (e.cachedPaddingH) return e.cachedPaddingH; + var t = D(e.measure, _("pre", "x", "CodeMirror-line-like")), + n = window.getComputedStyle ? window.getComputedStyle(t) : t.currentStyle, + r = { + left: parseInt(n.paddingLeft), + right: parseInt(n.paddingRight) }; - return isNaN(o.left) || isNaN(o.right) || (t.cachedPaddingH = o), o - } - - function qt(e) { - return Xa - e.display.nativeBarWidth + return isNaN(r.left) || isNaN(r.right) || (e.cachedPaddingH = r), r } - function Yt(e) { - return e.display.scroller.clientWidth - qt(e) - e.display.barWidth + function Tn(e) { + return 30 - e.display.nativeBarWidth } - function Xt(e) { - return e.display.scroller.clientHeight - qt(e) - e.display.barHeight + function Rn(e) { + return e.display.scroller.clientWidth - Tn(e) - e.display.barWidth } - function Qt(e, t, n) { - var r = e.options.lineWrapping, - a = r && Yt(e); - if (!t.measure.heights || r && t.measure.width != a) { - var s = t.measure.heights = []; - if (r) { - t.measure.width = a; - for (var d = t.text.firstChild.getClientRects(), l = 0; l < d.length - 1; l++) { - var i = d[l], - c = d[l + 1]; - 2 < o(i.bottom - c.bottom) && s.push((i.bottom + c.top) / 2 - n.top) - } - } - s.push(n.bottom - n.top) - } + function Dn(e) { + return e.display.scroller.clientHeight - Tn(e) - e.display.barHeight } - function $t(e, t, n) { + function _n(e, t, n) { if (e.line == t) return { map: e.measure.map, cache: e.measure.cache }; - for (var o = 0; o < e.rest.length; o++) - if (e.rest[o] == t) return { - map: e.measure.maps[o], - cache: e.measure.caches[o] - }; for (var r = 0; r < e.rest.length; r++) - if (pe(e.rest[r]) > n) return { + if (e.rest[r] == t) return { map: e.measure.maps[r], - cache: e.measure.caches[r], + cache: e.measure.caches[r] + }; + for (var i = 0; i < e.rest.length; i++) + if (Qe(e.rest[i]) > n) return { + map: e.measure.maps[i], + cache: e.measure.caches[i], before: !0 } } - function Zt(e, t) { - t = ot(t); - var n = pe(t), - o = e.display.externalMeasured = new wt(e.doc, t, n); - o.lineN = n; - var r = o.built = gt(e, o); - return o.text = r.pre, c(e.display.lineMeasure, r.pre), o - } - - function Jt(e, t, n, o) { - return nn(e, tn(e, t), n, o) + function An(e, t, n, r) { + return In(e, Pn(e, t), n, r) } - function en(e, t) { - if (t >= e.display.viewFrom && t < e.display.viewTo) return e.display.view[Fn(e, t)]; + function Mn(e, t) { + if (t >= e.display.viewFrom && t < e.display.viewTo) return e.display.view[ur(e, t)]; var n = e.display.externalMeasured; - if (n && t >= n.lineN && t < n.lineN + n.size) return n - } - - function tn(e, t) { - var n = pe(t), - o = en(e, n); - o && !o.text ? o = null : o && o.changes && (Dt(e, o, n, Dn(e)), e.curOp.forceUpdate = !0), o || (o = Zt(e, t)); - var r = $t(o, t, n); + return n && t >= n.lineN && t < n.lineN + n.size ? n : void 0 + } + + function Pn(e, t) { + var n = Qe(t), + r = Mn(e, n); + r && !r.text ? r = null : r && r.changes && (un(e, r, n, or(e)), e.curOp.forceUpdate = !0), r || (r = function (e, t) { + var n = Qe(t = Bt(t)), + r = e.display.externalMeasured = new rn(e.doc, t, n); + r.lineN = n; + var i = r.built = Zt(e, r); + return r.text = i.pre, D(e.display.lineMeasure, i.pre), r + }(e, t)); + var i = _n(r, t, n); return { line: t, - view: o, + view: r, rect: null, - map: r.map, - cache: r.cache, - before: r.before, + map: i.map, + cache: i.cache, + before: i.before, hasHeights: !1 } } - function nn(e, t, n, o, r) { + function In(e, t, n, r, i) { t.before && (n = -1); - var i = n + (o || ''), - a; - return t.cache.hasOwnProperty(i) ? a = t.cache[i] : (!t.rect && (t.rect = t.view.text.getBoundingClientRect()), !t.hasHeights && (Qt(e, t.view, t.rect), t.hasHeights = !0), a = sn(e, t, n, o), !a.bogus && (t.cache[i] = a)), { - left: a.left, - right: a.right, - top: r ? a.rtop : a.top, - bottom: r ? a.rbottom : a.bottom - } - } + var o, l = n + (r || ""); + return t.cache.hasOwnProperty(l) ? o = t.cache[l] : (t.rect || (t.rect = t.view.text.getBoundingClientRect()), t.hasHeights || (function (e, t, n) { + var r = e.options.lineWrapping, + i = r && Rn(e); + if (!t.measure.heights || r && t.measure.width != i) { + var o = t.measure.heights = []; + if (r) { + t.measure.width = i; + for (var s = t.text.firstChild.getClientRects(), a = 0; a < s.length - 1; a++) { + var l = s[a], + c = s[a + 1]; + Math.abs(l.bottom - c.bottom) > 2 && o.push((l.bottom + c.top) / 2 - n.top) + } + } + o.push(n.bottom - n.top) + } + }(e, t.view, t.rect), t.hasHeights = !0), (o = function (e, t, n, r) { + var i, o = Nn(t.map, n, r), + l = o.node, + c = o.start, + u = o.end, + h = o.collapse; + if (3 == l.nodeType) { + for (var p = 0; p < 4; p++) { + for (; c && re(t.line.text.charAt(o.coverStart + c));) --c; + for (; o.coverStart + u < o.coverEnd && re(t.line.text.charAt(o.coverStart + u));) ++u; + if ((i = s && a < 9 && 0 == c && u == o.coverEnd - o.coverStart ? l.parentNode.getBoundingClientRect() : Fn(x(l, c, u).getClientRects(), r)).left || i.right || 0 == c) break; + u = c, c -= 1, h = "right" + } + s && a < 11 && (i = function (e, t) { + if (!window.screen || null == screen.logicalXDPI || screen.logicalXDPI == screen.deviceXDPI || ! function (e) { + if (null != Oe) return Oe; + var t = D(e, _("span", "x")), + n = t.getBoundingClientRect(), + r = x(t, 0, 1).getBoundingClientRect(); + return Oe = Math.abs(n.left - r.left) > 1 + }(e)) return t; + var n = screen.logicalXDPI / screen.deviceXDPI, + r = screen.logicalYDPI / screen.deviceYDPI; + return { + left: t.left * n, + right: t.right * n, + top: t.top * r, + bottom: t.bottom * r + } + }(e.display.measure, i)) + } else { + var d; + c > 0 && (h = r = "right"), i = e.options.lineWrapping && (d = l.getClientRects()).length > 1 ? d["right" == r ? d.length - 1 : 0] : l.getBoundingClientRect() + } + if (s && a < 9 && !c && (!i || !i.left && !i.right)) { + var f = l.parentNode.getClientRects()[0]; + i = f ? { + left: f.left, + right: f.left + ir(e.display), + top: f.top, + bottom: f.bottom + } : Ln + } + for (var m = i.top - t.rect.top, g = i.bottom - t.rect.top, y = (m + g) / 2, v = t.view.measure.heights, w = 0; w < v.length - 1 && !(y < v[w]); w++); + var b = w ? v[w - 1] : 0, + S = v[w], + C = { + left: ("right" == h ? i.right : i.left) - t.rect.left, + right: ("left" == h ? i.left : i.right) - t.rect.left, + top: b, + bottom: S + }; + return i.left || i.right || (C.bogus = !0), e.options.singleCursorHeightPerLine || (C.rtop = m, C.rbottom = g), C + }(e, t, n, r)).bogus || (t.cache[l] = o)), { + left: o.left, + right: o.right, + top: i ? o.rtop : o.top, + bottom: i ? o.rbottom : o.bottom + } + } + var On, Ln = { + left: 0, + right: 0, + top: 0, + bottom: 0 + }; - function rn(e, t, n) { - for (var o = 0, r, i, a, s, d, l; o < e.length; o += 3) - if (d = e[o], l = e[o + 1], t < d ? (i = 0, a = 1, s = 'left') : t < l ? (i = t - d, a = i + 1) : (o == e.length - 3 || t == l && e[o + 3] > t) && (a = l - d, i = a - 1, t >= l && (s = 'right')), null != i) { - if (r = e[o + 2], d == l && n == (r.insertLeft ? 'left' : 'right') && (s = n), 'left' == n && 0 == i) - for (; o && e[o - 2] == e[o - 3] && e[o - 1].insertLeft;) r = e[(o -= 3) + 2], s = 'left'; - if ('right' == n && i == l - d) - for (; o < e.length - 3 && e[o + 3] == e[o + 4] && !e[o + 5].insertLeft;) r = e[(o += 3) + 2], s = 'right'; + function Nn(e, t, n) { + for (var r, i, o, s, a, l, c = 0; c < e.length; c += 3) + if (a = e[c], l = e[c + 1], t < a ? (i = 0, o = 1, s = "left") : t < l ? o = 1 + (i = t - a) : (c == e.length - 3 || t == l && e[c + 3] > t) && (i = (o = l - a) - 1, t >= l && (s = "right")), null != i) { + if (r = e[c + 2], a == l && n == (r.insertLeft ? "left" : "right") && (s = n), "left" == n && 0 == i) + for (; c && e[c - 2] == e[c - 3] && e[c - 1].insertLeft;) r = e[2 + (c -= 3)], s = "left"; + if ("right" == n && i == l - a) + for (; c < e.length - 3 && e[c + 3] == e[c + 4] && !e[c + 5].insertLeft;) r = e[(c += 3) + 2], s = "right"; break } return { node: r, start: i, - end: a, + end: o, collapse: s, - coverStart: d, + coverStart: a, coverEnd: l } } - function an(e, t) { - var n = Rs; - if ('left' == t) - for (var o = 0; o < e.length && (n = e[o]).left == n.right; o++); + function Fn(e, t) { + var n = Ln; + if ("left" == t) + for (var r = 0; r < e.length && (n = e[r]).left == n.right; r++); else - for (var r = e.length - 1; 0 <= r && (n = e[r]).left == n.right; r--); + for (var i = e.length - 1; i >= 0 && (n = e[i]).left == n.right; i--); return n } - function sn(e, t, n, o) { - var r = rn(t.map, n, o), - a = r.node, - s = r.start, - d = r.end, - l = r.collapse, - c; - if (3 == a.nodeType) { - for (var p = 0; 4 > p; p++) { - for (; s && M(t.line.text.charAt(r.coverStart + s));) --s; - for (; r.coverStart + d < r.coverEnd && M(t.line.text.charAt(r.coverStart + d));) ++d; - if (c = Ra && 9 > xa && 0 == s && d == r.coverEnd - r.coverStart ? a.parentNode.getBoundingClientRect() : an(ja(a, s, d).getClientRects(), o), c.left || c.right || 0 == s) break; - d = s, --s, l = 'right' - } - Ra && 11 > xa && (c = dn(e.display.measure, c)) - } else { - 0 < s && (l = o = 'right'); - var u; - c = e.options.lineWrapping && 1 < (u = a.getClientRects()).length ? u['right' == o ? u.length - 1 : 0] : a.getBoundingClientRect() - } - if (Ra && 9 > xa && !s && (!c || !c.left && !c.right)) { - var m = a.parentNode.getClientRects()[0]; - c = m ? { - left: m.left, - right: m.left + Pn(e.display), - top: m.top, - bottom: m.bottom - } : Rs - } - for (var h = c.top - t.rect.top, f = c.bottom - t.rect.top, g = t.view.measure.heights, y = 0; y < g.length - 1 && !((h + f) / 2 < g[y]); y++); - var i = y ? g[y - 1] : 0, - S = g[y], - C = { - left: ('right' == l ? c.right : c.left) - t.rect.left, - right: ('left' == l ? c.left : c.right) - t.rect.left, - top: i, - bottom: S - }; - return c.left || c.right || (C.bogus = !0), e.options.singleCursorHeightPerLine || (C.rtop = h, C.rbottom = f), C - } - - function dn(e, t) { - if (!window.screen || null == screen.logicalXDPI || screen.logicalXDPI == screen.deviceXDPI || !Z(e)) return t; - var n = screen.logicalXDPI / screen.deviceXDPI, - o = screen.logicalYDPI / screen.deviceYDPI; - return { - left: t.left * n, - right: t.right * n, - top: t.top * o, - bottom: t.bottom * o - } - } - - function ln(e) { + function Bn(e) { if (e.measure && (e.measure.cache = {}, e.measure.heights = null, e.rest)) for (var t = 0; t < e.rest.length; t++) e.measure.caches[t] = {} } - function cn(e) { - e.display.externalMeasure = null, l(e.display.lineMeasure); - for (var t = 0; t < e.display.view.length; t++) ln(e.display.view[t]) + function Hn(e) { + e.display.externalMeasure = null, R(e.display.lineMeasure); + for (var t = 0; t < e.display.view.length; t++) Bn(e.display.view[t]) } - function pn(e) { - cn(e), e.display.cachedCharWidth = e.display.cachedTextHeight = e.display.cachedPaddingH = null, e.options.lineWrapping || (e.display.maxLineChanged = !0), e.display.lineNumChars = null + function zn(e) { + Hn(e), e.display.cachedCharWidth = e.display.cachedTextHeight = e.display.cachedPaddingH = null, e.options.lineWrapping || (e.display.maxLineChanged = !0), e.display.lineNumChars = null } - function un() { - return Ma && Na ? -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) : window.pageXOffset || (document.documentElement || document.body).scrollLeft + function Un() { + return u && g ? -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) : window.pageXOffset || (document.documentElement || document.body).scrollLeft } - function mn() { - return Ma && Na ? -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) : window.pageYOffset || (document.documentElement || document.body).scrollTop + function Wn() { + return u && g ? -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) : window.pageYOffset || (document.documentElement || document.body).scrollTop } - function hn(e) { + function Vn(e) { var t = 0; if (e.widgets) - for (var n = 0; n < e.widgets.length; ++n) e.widgets[n].above && (t += Wt(e.widgets[n])); + for (var n = 0; n < e.widgets.length; ++n) e.widgets[n].above && (t += Sn(e.widgets[n])); return t } - function fn(e, t, n, o, r) { - if (!r) { - var i = hn(t); - n.top += i, n.bottom += i + function jn(e, t, n, r, i) { + if (!i) { + var o = Vn(t); + n.top += o, n.bottom += o } - if ('line' == o) return n; - o || (o = 'local'); - var a = ct(t); - if ('local' == o ? a += Gt(e.display) : a -= e.display.viewOffset, 'page' == o || 'window' == o) { - var s = e.display.lineSpace.getBoundingClientRect(); - a += s.top + ('window' == o ? 0 : mn()); - var d = s.left + ('window' == o ? 0 : un()); - n.left += d, n.right += d + if ("line" == r) return n; + r || (r = "local"); + var s = Vt(t); + if ("local" == r ? s += En(e.display) : s -= e.display.viewOffset, "page" == r || "window" == r) { + var a = e.display.lineSpace.getBoundingClientRect(); + s += a.top + ("window" == r ? 0 : Wn()); + var l = a.left + ("window" == r ? 0 : Un()); + n.left += l, n.right += l } - return n.top += a, n.bottom += a, n + return n.top += s, n.bottom += s, n } - function gn(e, t, n) { - if ('div' == n) return t; - var o = t.left, - r = t.top; - if ('page' == n) o -= un(), r -= mn(); - else if ('local' == n || !n) { - var i = e.display.sizer.getBoundingClientRect(); - o += i.left, r += i.top - } - var a = e.display.lineSpace.getBoundingClientRect(); + function Gn(e, t, n) { + if ("div" == n) return t; + var r = t.left, + i = t.top; + if ("page" == n) r -= Un(), i -= Wn(); + else if ("local" == n || !n) { + var o = e.display.sizer.getBoundingClientRect(); + r += o.left, i += o.top + } + var s = e.display.lineSpace.getBoundingClientRect(); return { - left: o - a.left, - top: r - a.top + left: r - s.left, + top: i - s.top } } - function yn(e, t, n, o, r) { - return o || (o = se(e.doc, t.line)), fn(e, o, Jt(e, o, t.ch, r), n) + function $n(e, t, n, r, i) { + return r || (r = $e(e.doc, t.line)), jn(e, r, An(e, r, t.ch, i), n) } - function Sn(e, t, n, o, r, i) { - function a(t, a) { - var s = nn(e, r, t, a ? 'right' : 'left', i); - return a ? s.left = s.right : s.right = s.left, fn(e, o, s, n) + function qn(e, t, n, r, i, o) { + function s(t, s) { + var a = In(e, i, t, s ? "right" : "left", o); + return s ? a.left = a.right : a.right = a.left, jn(e, r, a, n) } - - function s(e, t, n) { - var o = d[t], - r = 1 == o.level; - return a(n ? e - 1 : e, r != n) - } - o = o || se(e.doc, t.line), r || (r = tn(e, o)); - var d = B(o, e.doc.direction), + r = r || $e(e.doc, t.line), i || (i = Pn(e, r)); + var a = ce(r, e.doc.direction), l = t.ch, c = t.sticky; - if (l >= o.text.length ? (l = o.text.length, c = 'before') : 0 >= l && (l = 0, c = 'after'), !d) return a('before' == c ? l - 1 : l, 'before' == c); - var p = F(d, l, c), - u = os, - m = s(l, p, 'before' == c); - return null != u && (m.other = s(l, u, 'before' != c)), m + if (l >= r.text.length ? (l = r.text.length, c = "before") : l <= 0 && (l = 0, c = "after"), !a) return s("before" == c ? l - 1 : l, "before" == c); + + function u(e, t, n) { + return s(n ? e - 1 : e, 1 == a[t].level != n) + } + var h = ae(a, l, c), + p = se, + d = u(l, h, "before" == c); + return null != p && (d.other = u(l, p, "before" != c)), d } - function Cn(e, t) { + function Kn(e, t) { var n = 0; - t = Ee(e.doc, t), e.options.lineWrapping || (n = Pn(e.display) * t.ch); - var o = se(e.doc, t.line), - r = ct(o) + Gt(e.display); + t = at(e.doc, t), e.options.lineWrapping || (n = ir(e.display) * t.ch); + var r = $e(e.doc, t.line), + i = Vt(r) + En(e.display); return { left: n, right: n, - top: r, - bottom: r + o.height + top: i, + bottom: i + r.height } } - function bn(e, t, n, o, r) { - var i = fe(e, t, n); - return i.xRel = r, o && (i.outside = o), i + function Yn(e, t, n, r, i) { + var o = et(e, t, n); + return o.xRel = i, r && (o.outside = r), o } - function vn(e, t, n) { - var o = e.doc; - if (n += e.display.viewOffset, 0 > n) return bn(o.first, 0, null, -1, -1); - var r = ue(o, n), - i = o.first + o.size - 1; - if (r > i) return bn(o.first + o.size - 1, se(o, i).text.length, null, 1, 1); - 0 > t && (t = 0); - for (var a = se(o, r);;) { - var s = Tn(e, a, r, t, n), - d = tt(a, s.ch + (0 < s.xRel || 0 < s.outside ? 1 : 0)); - if (!d) return s; - var l = d.find(1); - if (l.line == r) return l; - a = se(o, r = l.line) - } - } - - function En(e, t, n, o) { - o -= hn(t); - var r = t.text.length, - i = I(function (t) { - return nn(e, n, t - 1).bottom <= o - }, r, 0); - return r = I(function (t) { - return nn(e, n, t).top > o - }, i, r), { - begin: i, - end: r - } - } - - function wn(e, t, n, o) { - n || (n = tn(e, t)); - var r = fn(e, t, nn(e, n, o), 'line').top; - return En(e, t, n, r) - } - - function kn(e, t, n, o) { - return !(e.bottom <= n) && (!!(e.top > n) || (o ? e.left : e.right) > t) - } - - function Tn(e, t, n, o, r) { - r -= ct(t); - var i = tn(e, t), - a = hn(t), - s = 0, - d = t.text.length, - l = !0, - c = B(t, e.doc.direction); - if (c) { - var p = (e.options.lineWrapping ? Rn : _n)(e, t, n, i, c, o, r); - l = 1 != p.level, s = l ? p.from : p.to - 1, d = l ? p.to : p.from - 1 - } - var u = null, + function Qn(e, t, n) { + var r = e.doc; + if ((n += e.display.viewOffset) < 0) return Yn(r.first, 0, null, -1, -1); + var i = Ze(r, n), + o = r.first + r.size - 1; + if (i > o) return Yn(r.first + r.size - 1, $e(r, o).text.length, null, 1, 1); + t < 0 && (t = 0); + for (var s = $e(r, i);;) { + var a = er(e, s, i, t, n), + l = Nt(s, a.ch + (a.xRel > 0 || a.outside > 0 ? 1 : 0)); + if (!l) return a; + var c = l.find(1); + if (c.line == i) return c; + s = $e(r, i = c.line) + } + } + + function Zn(e, t, n, r) { + r -= Vn(t); + var i = t.text.length, + o = oe((function (t) { + return In(e, n, t - 1).bottom <= r + }), i, 0); + return { + begin: o, + end: i = oe((function (t) { + return In(e, n, t).top > r + }), o, i) + } + } + + function Xn(e, t, n, r) { + return n || (n = Pn(e, t)), Zn(e, t, n, jn(e, t, In(e, n, r), "line").top) + } + + function Jn(e, t, n, r) { + return !(e.bottom <= n) && (e.top > n || (r ? e.left : e.right) > t) + } + + function er(e, t, n, r, i) { + i -= Vt(t); + var o = Pn(e, t), + s = Vn(t), + a = 0, + l = t.text.length, + c = !0, + u = ce(t, e.doc.direction); + if (u) { + var h = (e.options.lineWrapping ? nr : tr)(e, t, n, o, u, r, i); + a = (c = 1 != h.level) ? h.from : h.to - 1, l = c ? h.to : h.from - 1 + } + var p, d, f = null, m = null, - h = I(function (t) { - var n = nn(e, i, t); - return (n.top += a, n.bottom += a, !!kn(n, o, r, !1)) && (n.top <= r && n.left <= o && (u = t, m = n), !0) - }, s, d), - f = !1, - g, y; + g = oe((function (t) { + var n = In(e, o, t); + return n.top += s, n.bottom += s, !!Jn(n, r, i, !1) && (n.top <= i && n.left <= r && (f = t, m = n), !0) + }), a, l), + y = !1; if (m) { - var S = o - m.left < m.right - o, - C = S == l; - h = u + (C ? 0 : 1), y = C ? 'after' : 'before', g = S ? m.left : m.right + var v = r - m.left < m.right - r, + w = v == c; + g = f + (w ? 0 : 1), d = w ? "after" : "before", p = v ? m.left : m.right } else { - l || h != d && h != s || h++, y = 0 == h ? 'after' : h == t.text.length ? 'before' : nn(e, i, h - (l ? 1 : 0)).bottom + a <= r == l ? 'after' : 'before'; - var b = Sn(e, fe(n, h, y), 'line', t, i); - g = b.left, f = r < b.top ? -1 : r >= b.bottom ? 1 : 0 - } - return h = A(t.text, h, 1), bn(n, h, y, f, o - g) - } - - function _n(e, t, n, o, r, a, s) { - var i = I(function (d) { - var i = r[d], - l = 1 != i.level; - return kn(Sn(e, fe(n, l ? i.to : i.from, l ? 'before' : 'after'), 'line', t, o), a, s, !0) - }, 0, r.length - 1), - d = r[i]; - if (0 < i) { - var l = 1 != d.level, - c = Sn(e, fe(n, l ? d.from : d.to, l ? 'after' : 'before'), 'line', t, o); - kn(c, a, s, !0) && c.top > s && (d = r[i - 1]) - } - return d - } - - function Rn(e, t, n, o, a, s, l) { - var c = En(e, t, o, l), - u = c.begin, - m = c.end; - /\s/.test(t.text.charAt(m - 1)) && m--; - for (var h = null, f = null, g = 0, i; g < a.length; g++) - if (i = a[g], !(i.from >= m || i.to <= u)) { - var p = 1 != i.level, - y = nn(e, o, p ? d(m, i.to) - 1 : r(u, i.from)).right, - S = y < s ? s - y + 1e9 : y - s; - (!h || f > S) && (h = i, f = S) - } return h || (h = a[a.length - 1]), h.from < u && (h = { - from: u, - to: h.to, - level: h.level - }), h.to > m && (h = { - from: h.from, - to: m, - level: h.level - }), h + c || g != l && g != a || g++, d = 0 == g ? "after" : g == t.text.length ? "before" : In(e, o, g - (c ? 1 : 0)).bottom + s <= i == c ? "after" : "before"; + var b = qn(e, et(n, g, d), "line", t, o); + p = b.left, y = i < b.top ? -1 : i >= b.bottom ? 1 : 0 + } + return Yn(n, g = ie(t.text, g, 1), d, y, r - p) } - function xn(e) { + function tr(e, t, n, r, i, o, s) { + var a = oe((function (a) { + var l = i[a], + c = 1 != l.level; + return Jn(qn(e, et(n, c ? l.to : l.from, c ? "before" : "after"), "line", t, r), o, s, !0) + }), 0, i.length - 1), + l = i[a]; + if (a > 0) { + var c = 1 != l.level, + u = qn(e, et(n, c ? l.from : l.to, c ? "after" : "before"), "line", t, r); + Jn(u, o, s, !0) && u.top > s && (l = i[a - 1]) + } + return l + } + + function nr(e, t, n, r, i, o, s) { + var a = Zn(e, t, r, s), + l = a.begin, + c = a.end; + /\s/.test(t.text.charAt(c - 1)) && c--; + for (var u = null, h = null, p = 0; p < i.length; p++) { + var d = i[p]; + if (!(d.from >= c || d.to <= l)) { + var f = In(e, r, 1 != d.level ? Math.min(c, d.to) - 1 : Math.max(l, d.from)).right, + m = f < o ? o - f + 1e9 : f - o; + (!u || h > m) && (u = d, h = m) + } + } + return u || (u = i[i.length - 1]), u.from < l && (u = { + from: l, + to: u.to, + level: u.level + }), u.to > c && (u = { + from: u.from, + to: c, + level: u.level + }), u + } + + function rr(e) { if (null != e.cachedTextHeight) return e.cachedTextHeight; - if (null == Ps) { - Ps = p('pre', null, 'CodeMirror-line-like'); - for (var t = 0; 49 > t; ++t) Ps.appendChild(document.createTextNode('x')), Ps.appendChild(p('br')); - Ps.appendChild(document.createTextNode('x')) + if (null == On) { + On = _("pre", null, "CodeMirror-line-like"); + for (var t = 0; t < 49; ++t) On.appendChild(document.createTextNode("x")), On.appendChild(_("br")); + On.appendChild(document.createTextNode("x")) } - c(e.measure, Ps); - var n = Ps.offsetHeight / 50; - return 3 < n && (e.cachedTextHeight = n), l(e.measure), n || 1 + D(e.measure, On); + var n = On.offsetHeight / 50; + return n > 3 && (e.cachedTextHeight = n), R(e.measure), n || 1 } - function Pn(e) { + function ir(e) { if (null != e.cachedCharWidth) return e.cachedCharWidth; - var t = p('span', 'xxxxxxxxxx'), - n = p('pre', [t], 'CodeMirror-line-like'); - c(e.measure, n); - var o = t.getBoundingClientRect(), - r = (o.right - o.left) / 10; - return 2 < r && (e.cachedCharWidth = r), r || 10 + var t = _("span", "xxxxxxxxxx"), + n = _("pre", [t], "CodeMirror-line-like"); + D(e.measure, n); + var r = t.getBoundingClientRect(), + i = (r.right - r.left) / 10; + return i > 2 && (e.cachedCharWidth = i), i || 10 } - function Dn(e) { - for (var t = e.display, o = {}, r = {}, a = t.gutters.clientLeft, s = t.gutters.firstChild, n = 0, i; s; s = s.nextSibling, ++n) i = e.display.gutterSpecs[n].className, o[i] = s.offsetLeft + s.clientLeft + a, r[i] = s.clientWidth; + function or(e) { + for (var t = e.display, n = {}, r = {}, i = t.gutters.clientLeft, o = t.gutters.firstChild, s = 0; o; o = o.nextSibling, ++s) { + var a = e.display.gutterSpecs[s].className; + n[a] = o.offsetLeft + o.clientLeft + i, r[a] = o.clientWidth + } return { - fixedPos: Mn(t), + fixedPos: sr(t), gutterTotalWidth: t.gutters.offsetWidth, - gutterLeft: o, + gutterLeft: n, gutterWidth: r, wrapperWidth: t.wrapper.clientWidth } } - function Mn(e) { + function sr(e) { return e.scroller.getBoundingClientRect().left - e.sizer.getBoundingClientRect().left } - function An(e) { - var t = xn(e.display), + function ar(e) { + var t = rr(e.display), n = e.options.lineWrapping, - o = n && r(5, e.display.scroller.clientWidth / Pn(e.display) - 3); - return function (r) { - if (dt(e.doc, r)) return 0; - var a = 0; - if (r.widgets) - for (var d = 0; d < r.widgets.length; d++) r.widgets[d].height && (a += r.widgets[d].height); - return n ? a + (s(r.text.length / o) || 1) * t : a + t + r = n && Math.max(5, e.display.scroller.clientWidth / ir(e.display) - 3); + return function (i) { + if (Ut(e.doc, i)) return 0; + var o = 0; + if (i.widgets) + for (var s = 0; s < i.widgets.length; s++) i.widgets[s].height && (o += i.widgets[s].height); + return n ? o + (Math.ceil(i.text.length / r) || 1) * t : o + t } } - function In(e) { + function lr(e) { var t = e.doc, - n = An(e); - t.iter(function (e) { + n = ar(e); + t.iter((function (e) { var t = n(e); - t != e.height && ce(e, t) - }) + t != e.height && Ye(e, t) + })) } - function Ln(t, o, e, i) { - var a = t.display; - if (!e && 'true' == Y(o).getAttribute('cm-not-content')) return null; - var s = a.lineSpace.getBoundingClientRect(), - d, l; + function cr(e, t, n, r) { + var i = e.display; + if (!n && "true" == Ee(t).getAttribute("cm-not-content")) return null; + var o, s, a = i.lineSpace.getBoundingClientRect(); try { - d = o.clientX - s.left, l = o.clientY - s.top + o = t.clientX - a.left, s = t.clientY - a.top } catch (t) { return null } - var c = vn(t, d, l), - p; - if (i && 1 == c.xRel && (p = se(t.doc, c.line).text).length == c.ch) { - var u = C(p, p.length, t.options.tabSize) - p.length; - c = fe(c.line, r(0, n((d - jt(t.display).left) / Pn(t.display)) - u)) + var l, c = Qn(e, o, s); + if (r && 1 == c.xRel && (l = $e(e.doc, c.line).text).length == c.ch) { + var u = B(l, l.length, e.options.tabSize) - l.length; + c = et(c.line, Math.max(0, Math.round((o - xn(e.display).left) / ir(e.display)) - u)) } return c } - function Fn(e, t) { + function ur(e, t) { if (t >= e.display.viewTo) return null; - if (t -= e.display.viewFrom, 0 > t) return null; - for (var n = e.display.view, o = 0; o < n.length; o++) - if (t -= n[o].size, 0 > t) return o - } - - function Bn(e, t, n, o) { - null == t && (t = e.doc.first), null == n && (n = e.doc.first + e.doc.size), o || (o = 0); - var r = e.display; - if (o && n < r.viewTo && (null == r.updateLineNumbers || r.updateLineNumbers > t) && (r.updateLineNumbers = t), e.curOp.viewChanged = !0, t >= r.viewTo) vs && at(e.doc, t) < r.viewTo && On(e); - else if (n <= r.viewFrom) vs && st(e.doc, n + o) > r.viewFrom ? On(e) : (r.viewFrom += o, r.viewTo += o); - else if (t <= r.viewFrom && n >= r.viewTo) On(e); - else if (t <= r.viewFrom) { - var i = Hn(e, n, n + o, 1); - i ? (r.view = r.view.slice(i.index), r.viewFrom = i.lineN, r.viewTo += o) : On(e) - } else if (n >= r.viewTo) { - var a = Hn(e, t, t, -1); - a ? (r.view = r.view.slice(0, a.index), r.viewTo = a.lineN) : On(e) + if ((t -= e.display.viewFrom) < 0) return null; + for (var n = e.display.view, r = 0; r < n.length; r++) + if ((t -= n[r].size) < 0) return r + } + + function hr(e, t, n, r) { + null == t && (t = e.doc.first), null == n && (n = e.doc.first + e.doc.size), r || (r = 0); + var i = e.display; + if (r && n < i.viewTo && (null == i.updateLineNumbers || i.updateLineNumbers > t) && (i.updateLineNumbers = t), e.curOp.viewChanged = !0, t >= i.viewTo) Ct && Ht(e.doc, t) < i.viewTo && dr(e); + else if (n <= i.viewFrom) Ct && zt(e.doc, n + r) > i.viewFrom ? dr(e) : (i.viewFrom += r, i.viewTo += r); + else if (t <= i.viewFrom && n >= i.viewTo) dr(e); + else if (t <= i.viewFrom) { + var o = fr(e, n, n + r, 1); + o ? (i.view = i.view.slice(o.index), i.viewFrom = o.lineN, i.viewTo += r) : dr(e) + } else if (n >= i.viewTo) { + var s = fr(e, t, t, -1); + s ? (i.view = i.view.slice(0, s.index), i.viewTo = s.lineN) : dr(e) } else { - var s = Hn(e, t, t, -1), - d = Hn(e, n, n + o, 1); - s && d ? (r.view = r.view.slice(0, s.index).concat(kt(e, s.lineN, d.lineN)).concat(r.view.slice(d.index)), r.viewTo += o) : On(e) + var a = fr(e, t, t, -1), + l = fr(e, n, n + r, 1); + a && l ? (i.view = i.view.slice(0, a.index).concat(on(e, a.lineN, l.lineN)).concat(i.view.slice(l.index)), i.viewTo += r) : dr(e) } - var l = r.externalMeasured; - l && (n < l.lineN ? l.lineN += o : t < l.lineN + l.size && (r.externalMeasured = null)) + var c = i.externalMeasured; + c && (n < c.lineN ? c.lineN += r : t < c.lineN + c.size && (i.externalMeasured = null)) } - function Nn(e, t, n) { + function pr(e, t, n) { e.curOp.viewChanged = !0; - var o = e.display, - r = e.display.externalMeasured; - if (r && t >= r.lineN && t < r.lineN + r.size && (o.externalMeasured = null), !(t < o.viewFrom || t >= o.viewTo)) { - var i = o.view[Fn(e, t)]; - if (null != i.node) { - var a = i.changes || (i.changes = []); - 1 == b(a, n) && a.push(n) + var r = e.display, + i = e.display.externalMeasured; + if (i && t >= i.lineN && t < i.lineN + i.size && (r.externalMeasured = null), !(t < r.viewFrom || t >= r.viewTo)) { + var o = r.view[ur(e, t)]; + if (null != o.node) { + var s = o.changes || (o.changes = []); - 1 == z(s, n) && s.push(n) } } } - function On(e) { + function dr(e) { e.display.viewFrom = e.display.viewTo = e.doc.first, e.display.view = [], e.display.viewOffset = 0 } - function Hn(e, t, o, r) { - var a = Fn(e, t), - s = e.display.view, - d; - if (!vs || o == e.doc.first + e.doc.size) return { - index: a, - lineN: o + function fr(e, t, n, r) { + var i, o = ur(e, t), + s = e.display.view; + if (!Ct || n == e.doc.first + e.doc.size) return { + index: o, + lineN: n }; - for (var l = e.display.viewFrom, n = 0; n < a; n++) l += s[n].size; - if (l != t) { - if (0 < r) { - if (a == s.length - 1) return null; - d = l + s[a].size - t, a++ - } else d = l - t; - t += d, o += d - } - for (; at(e.doc, o) != o;) { - if (a == (0 > r ? 0 : s.length - 1)) return null; - o += r * s[a - (0 > r ? 1 : 0)].size, a += r + for (var a = e.display.viewFrom, l = 0; l < o; l++) a += s[l].size; + if (a != t) { + if (r > 0) { + if (o == s.length - 1) return null; + i = a + s[o].size - t, o++ + } else i = a - t; + t += i, n += i + } + for (; Ht(e.doc, n) != n;) { + if (o == (r < 0 ? 0 : s.length - 1)) return null; + n += r * s[o - (r < 0 ? 1 : 0)].size, o += r } return { - index: a, - lineN: o + index: o, + lineN: n } } - function zn(e, t, n) { - var o = e.display, - r = o.view; - 0 == r.length || t >= o.viewTo || n <= o.viewFrom ? (o.view = kt(e, t, n), o.viewFrom = t) : (o.viewFrom > t ? o.view = kt(e, t, o.viewFrom).concat(o.view) : o.viewFrom < t && (o.view = o.view.slice(Fn(e, t))), o.viewFrom = t, o.viewTo < n ? o.view = o.view.concat(kt(e, o.viewTo, n)) : o.viewTo > n && (o.view = o.view.slice(0, Fn(e, n)))), o.viewTo = n - } - - function Un(e) { - for (var t = e.display.view, n = 0, o = 0, r; o < t.length; o++) r = t[o], r.hidden || r.node && !r.changes || ++n; + function mr(e) { + for (var t = e.display.view, n = 0, r = 0; r < t.length; r++) { + var i = t[r]; + i.hidden || i.node && !i.changes || ++n + } return n } - function Wn(e) { + function gr(e) { e.display.input.showSelection(e.display.input.prepareSelection()) } - function Vn(e, t) { + function yr(e, t) { void 0 === t && (t = !0); - for (var n = e.doc, o = {}, r = o.cursors = document.createDocumentFragment(), a = o.selection = document.createDocumentFragment(), s = 0; s < n.sel.ranges.length; s++) + for (var n = e.doc, r = {}, i = r.cursors = document.createDocumentFragment(), o = r.selection = document.createDocumentFragment(), s = 0; s < n.sel.ranges.length; s++) if (t || s != n.sel.primIndex) { - var i = n.sel.ranges[s]; - if (!(i.from().line >= e.display.viewTo || i.to().line < e.display.viewFrom)) { - var d = i.empty(); - (d || e.options.showCursorWhenSelecting) && Gn(e, i.head, r), d || jn(e, i, a) + var a = n.sel.ranges[s]; + if (!(a.from().line >= e.display.viewTo || a.to().line < e.display.viewFrom)) { + var l = a.empty(); + (l || e.options.showCursorWhenSelecting) && vr(e, a.head, i), l || br(e, a, o) } - } return o + } return r } - function Gn(e, t, n) { - var o = Sn(e, t, 'div', null, null, !e.options.singleCursorHeightPerLine), - i = n.appendChild(p('div', '\xA0', 'CodeMirror-cursor')); - if (i.style.left = o.left + 'px', i.style.top = o.top + 'px', i.style.height = r(0, o.bottom - o.top) * e.options.cursorHeight + 'px', o.other) { - var a = n.appendChild(p('div', '\xA0', 'CodeMirror-cursor CodeMirror-secondarycursor')); - a.style.display = '', a.style.left = o.other.left + 'px', a.style.top = o.other.top + 'px', a.style.height = .85 * (o.other.bottom - o.other.top) + 'px' + function vr(e, t, n) { + var r = qn(e, t, "div", null, null, !e.options.singleCursorHeightPerLine), + i = n.appendChild(_("div", " ", "CodeMirror-cursor")); + if (i.style.left = r.left + "px", i.style.top = r.top + "px", i.style.height = Math.max(0, r.bottom - r.top) * e.options.cursorHeight + "px", r.other) { + var o = n.appendChild(_("div", " ", "CodeMirror-cursor CodeMirror-secondarycursor")); + o.style.display = "", o.style.left = r.other.left + "px", o.style.top = r.other.top + "px", o.style.height = .85 * (r.other.bottom - r.other.top) + "px" } } - function Kn(e, t) { + function wr(e, t) { return e.top - t.top || e.left - t.left } - function jn(e, t, o) { - function i(e, t, o, r) { - 0 > t && (t = 0), t = n(t), r = n(r), l.appendChild(p('div', null, 'CodeMirror-selected', 'position: absolute; left: ' + e + 'px;\n top: ' + t + 'px; width: ' + (null == o ? m - e : o) + 'px;\n height: ' + (r - t) + 'px')) - } - - function a(t, n, o) { - function r(n, o) { - return yn(e, fe(t, n), 'div', s, o) - } - - function a(t, n, o) { - var i = wn(e, s, null, t), - a = 'ltr' == n == ('after' == o) ? 'left' : 'right', - d = 'after' == o ? i.begin : i.end - (/\s/.test(s.text.charAt(i.end - 1)) ? 2 : 1); - return r(d, a)[a] - } - var s = se(d, t), - l = s.text.length, - c = B(s, d.direction), - p, f; - return L(c, n || 0, null == o ? l : o, function (e, t, s, d) { - var g = 'ltr' == s, - y = r(e, g ? 'left' : 'right'), - S = r(t - 1, g ? 'right' : 'left'), - C = null == n && 0 == e, - b = null == o && t == l, - v = 0 == d, - E = !c || d == c.length - 1; - if (3 >= S.top - y.top) { - var w = (h ? C : b) && v, - k = (h ? b : C) && E, - T = w ? u : (g ? y : S).left, - _ = k ? m : (g ? S : y).right; - i(T, y.top, _ - T, y.bottom) + function br(e, t, n) { + var r = e.display, + i = e.doc, + o = document.createDocumentFragment(), + s = xn(e.display), + a = s.left, + l = Math.max(r.sizerWidth, Rn(e) - r.sizer.offsetLeft) - s.right, + c = "ltr" == i.direction; + + function u(e, t, n, r) { + t < 0 && (t = 0), t = Math.round(t), r = Math.round(r), o.appendChild(_("div", null, "CodeMirror-selected", "position: absolute; left: " + e + "px;\n top: " + t + "px; width: " + (null == n ? l - e : n) + "px;\n height: " + (r - t) + "px")) + } + + function h(t, n, r) { + var o, s, h = $e(i, t), + p = h.text.length; + + function d(n, r) { + return $n(e, et(t, n), "div", h, r) + } + + function f(t, n, r) { + var i = Xn(e, h, null, t), + o = "ltr" == n == ("after" == r) ? "left" : "right"; + return d("after" == r ? i.begin : i.end - (/\s/.test(h.text.charAt(i.end - 1)) ? 2 : 1), o)[o] + } + var m = ce(h, i.direction); + return function (e, t, n, r) { + if (!e) return r(t, n, "ltr", 0); + for (var i = !1, o = 0; o < e.length; ++o) { + var s = e[o]; + (s.from < n && s.to > t || t == n && s.to == t) && (r(Math.max(s.from, t), Math.min(s.to, n), 1 == s.level ? "rtl" : "ltr", o), i = !0) + } + i || r(t, n, "ltr") + }(m, n || 0, null == r ? p : r, (function (e, t, i, h) { + var g = "ltr" == i, + y = d(e, g ? "left" : "right"), + v = d(t - 1, g ? "right" : "left"), + w = null == n && 0 == e, + b = null == r && t == p, + S = 0 == h, + C = !m || h == m.length - 1; + if (v.top - y.top <= 3) { + var E = (c ? b : w) && C, + k = (c ? w : b) && S ? a : (g ? y : v).left, + x = E ? l : (g ? v : y).right; + u(k, y.top, x - k, y.bottom) } else { - var R, x, P, D; - g ? (R = h && C && v ? u : y.left, x = h ? m : a(e, s, 'before'), P = h ? u : a(t, s, 'after'), D = h && b && E ? m : S.right) : (R = h ? a(e, s, 'before') : u, x = !h && C && v ? m : y.right, P = !h && b && E ? u : S.left, D = h ? a(t, s, 'after') : m), i(R, y.top, x - R, y.bottom), y.bottom < S.top && i(u, y.bottom, null, S.top), i(P, S.top, D - P, S.bottom) - }(!p || 0 > Kn(y, p)) && (p = y), 0 > Kn(S, p) && (p = S), (!f || 0 > Kn(y, f)) && (f = y), 0 > Kn(S, f) && (f = S) - }), { - start: p, - end: f + var T, R, D, _; + g ? (T = c && w && S ? a : y.left, R = c ? l : f(e, i, "before"), D = c ? a : f(t, i, "after"), _ = c && b && C ? l : v.right) : (T = c ? f(e, i, "before") : a, R = !c && w && S ? l : y.right, D = !c && b && C ? a : v.left, _ = c ? f(t, i, "after") : l), u(T, y.top, R - T, y.bottom), y.bottom < v.top && u(a, y.bottom, null, v.top), u(D, v.top, _ - D, v.bottom) + }(!o || wr(y, o) < 0) && (o = y), wr(v, o) < 0 && (o = v), (!s || wr(y, s) < 0) && (s = y), wr(v, s) < 0 && (s = v) + })), { + start: o, + end: s } } - var s = e.display, - d = e.doc, - l = document.createDocumentFragment(), - c = jt(e.display), - u = c.left, - m = r(s.sizerWidth, Yt(e) - s.sizer.offsetLeft) - c.right, - h = 'ltr' == d.direction, - f = t.from(), - g = t.to(); - if (f.line == g.line) a(f.line, f.ch, g.ch); + var p = t.from(), + d = t.to(); + if (p.line == d.line) h(p.line, p.ch, d.ch); else { - var y = se(d, f.line), - S = se(d, g.line), - C = ot(y) == ot(S), - b = a(f.line, f.ch, C ? y.text.length + 1 : null).end, - v = a(g.line, C ? 0 : null, g.ch).start; - C && (b.top < v.top - 2 ? (i(b.right, b.top, null, b.bottom), i(u, v.top, v.left, v.bottom)) : i(b.right, b.top, v.left - b.right, b.bottom)), b.bottom < v.top && i(u, b.bottom, null, v.top) + var f = $e(i, p.line), + m = $e(i, d.line), + g = Bt(f) == Bt(m), + y = h(p.line, p.ch, g ? f.text.length + 1 : null).end, + v = h(d.line, g ? 0 : null, d.ch).start; + g && (y.top < v.top - 2 ? (u(y.right, y.top, null, y.bottom), u(a, v.top, v.left, v.bottom)) : u(y.right, y.top, v.left - y.right, y.bottom)), y.bottom < v.top && u(a, y.bottom, null, v.top) } - o.appendChild(l) + n.appendChild(o) } - function qn(e) { + function Sr(e) { if (e.state.focused) { var t = e.display; clearInterval(t.blinker); var n = !0; - t.cursorDiv.style.visibility = '', 0 < e.options.cursorBlinkRate ? t.blinker = setInterval(function () { - return t.cursorDiv.style.visibility = (n = !n) ? '' : 'hidden' - }, e.options.cursorBlinkRate) : 0 > e.options.cursorBlinkRate && (t.cursorDiv.style.visibility = 'hidden') + t.cursorDiv.style.visibility = "", e.options.cursorBlinkRate > 0 ? t.blinker = setInterval((function () { + return t.cursorDiv.style.visibility = (n = !n) ? "" : "hidden" + }), e.options.cursorBlinkRate) : e.options.cursorBlinkRate < 0 && (t.cursorDiv.style.visibility = "hidden") } } - function Yn(e) { - e.state.focused || (e.display.input.focus(), Qn(e)) + function Cr(e) { + e.state.focused || (e.display.input.focus(), kr(e)) } - function Xn(e) { - e.state.delayingBlurEvent = !0, setTimeout(function () { - e.state.delayingBlurEvent && (e.state.delayingBlurEvent = !1, $n(e)) - }, 100) + function Er(e) { + e.state.delayingBlurEvent = !0, setTimeout((function () { + e.state.delayingBlurEvent && (e.state.delayingBlurEvent = !1, xr(e)) + }), 100) } - function Qn(t, n) { - t.state.delayingBlurEvent && (t.state.delayingBlurEvent = !1), 'nocursor' == t.options.readOnly || (!t.state.focused && (H(t, 'focus', t, n), t.state.focused = !0, f(t.display.wrapper, 'CodeMirror-focused'), !t.curOp && t.display.selForContextMenu != t.doc.sel && (t.display.input.reset(), Pa && setTimeout(function () { - return t.display.input.reset(!0) - }, 20)), t.display.input.receivedFocus()), qn(t)) + function kr(e, t) { + e.state.delayingBlurEvent && (e.state.delayingBlurEvent = !1), "nocursor" != e.options.readOnly && (e.state.focused || (fe(e, "focus", e, t), e.state.focused = !0, I(e.display.wrapper, "CodeMirror-focused"), e.curOp || e.display.selForContextMenu == e.doc.sel || (e.display.input.reset(), l && setTimeout((function () { + return e.display.input.reset(!0) + }), 20)), e.display.input.receivedFocus()), Sr(e)) } - function $n(t, n) { - t.state.delayingBlurEvent || (t.state.focused && (H(t, 'blur', t, n), t.state.focused = !1, Ka(t.display.wrapper, 'CodeMirror-focused')), clearInterval(t.display.blinker), setTimeout(function () { - t.state.focused || (t.display.shift = !1) - }, 150)) + function xr(e, t) { + e.state.delayingBlurEvent || (e.state.focused && (fe(e, "blur", e, t), e.state.focused = !1, T(e.display.wrapper, "CodeMirror-focused")), clearInterval(e.display.blinker), setTimeout((function () { + e.state.focused || (e.display.shift = !1) + }), 150)) } - function Zn(e) { - for (var t = e.display, n = t.lineDiv.offsetTop, o = 0; o < t.view.length; o++) { - var r = t.view[o], - i = e.options.lineWrapping, - a = void 0, - d = 0; - if (!r.hidden) { - if (Ra && 8 > xa) { - var l = r.node.offsetTop + r.node.offsetHeight; - a = l - n, n = l + function Tr(e) { + for (var t = e.display, n = t.lineDiv.offsetTop, r = 0; r < t.view.length; r++) { + var i = t.view[r], + o = e.options.lineWrapping, + l = void 0, + c = 0; + if (!i.hidden) { + if (s && a < 8) { + var u = i.node.offsetTop + i.node.offsetHeight; + l = u - n, n = u } else { - var c = r.node.getBoundingClientRect(); - a = c.bottom - c.top, !i && r.text.firstChild && (d = r.text.firstChild.getBoundingClientRect().right - c.left - 1) + var h = i.node.getBoundingClientRect(); + l = h.bottom - h.top, !o && i.text.firstChild && (c = i.text.firstChild.getBoundingClientRect().right - h.left - 1) } - var p = r.line.height - a; - if ((.005 < p || -.005 > p) && (ce(r.line, a), Jn(r.line), r.rest)) - for (var u = 0; u < r.rest.length; u++) Jn(r.rest[u]); - if (d > e.display.sizerWidth) { - var m = s(d / Pn(e.display)); - m > e.display.maxLineLength && (e.display.maxLineLength = m, e.display.maxLine = r.line, e.display.maxLineChanged = !0) + var p = i.line.height - l; + if ((p > .005 || p < -.005) && (Ye(i.line, l), Rr(i.line), i.rest)) + for (var d = 0; d < i.rest.length; d++) Rr(i.rest[d]); + if (c > e.display.sizerWidth) { + var f = Math.ceil(c / ir(e.display)); + f > e.display.maxLineLength && (e.display.maxLineLength = f, e.display.maxLine = i.line, e.display.maxLineChanged = !0) } } } } - function Jn(e) { + function Rr(e) { if (e.widgets) for (var t = 0; t < e.widgets.length; ++t) { var n = e.widgets[t], - o = n.node.parentNode; - o && (n.height = o.offsetHeight) + r = n.node.parentNode; + r && (n.height = r.offsetHeight) } } - function eo(e, t, n) { - var o = n && null != n.top ? r(0, n.top) : e.scroller.scrollTop; - o = a(o - Gt(e)); - var i = n && null != n.bottom ? n.bottom : o + e.wrapper.clientHeight, - s = ue(t, o), - l = ue(t, i); + function Dr(e, t, n) { + var r = n && null != n.top ? Math.max(0, n.top) : e.scroller.scrollTop; + r = Math.floor(r - En(e)); + var i = n && null != n.bottom ? n.bottom : r + e.wrapper.clientHeight, + o = Ze(t, r), + s = Ze(t, i); if (n && n.ensure) { - var c = n.ensure.from.line, - p = n.ensure.to.line; - c < s ? (s = c, l = ue(t, ct(se(t, c)) + e.wrapper.clientHeight)) : d(p, t.lastLine()) >= l && (s = ue(t, ct(se(t, p)) - e.wrapper.clientHeight), l = p) + var a = n.ensure.from.line, + l = n.ensure.to.line; + a < o ? (o = a, s = Ze(t, Vt($e(t, a)) + e.wrapper.clientHeight)) : Math.min(l, t.lastLine()) >= s && (o = Ze(t, Vt($e(t, l)) - e.wrapper.clientHeight), s = l) } return { - from: s, - to: r(l, s + 1) - } - } - - function to(e, t) { - if (!z(e, 'scrollCursorIntoView')) { - var n = e.display, - o = n.sizer.getBoundingClientRect(), - i = null; - if (0 > t.top + o.top ? i = !0 : t.bottom + o.top > (window.innerHeight || document.documentElement.clientHeight) && (i = !1), null != i && !Fa) { - var a = p('div', '\u200B', null, 'position: absolute;\n top: ' + (t.top - n.viewOffset - Gt(e.display)) + 'px;\n height: ' + (t.bottom - t.top + qt(e) + n.barHeight) + 'px;\n left: ' + t.left + 'px; width: ' + r(2, t.right - t.left) + 'px;'); - e.display.lineSpace.appendChild(a), a.scrollIntoView(i), e.display.lineSpace.removeChild(a) - } - } - } - - function no(e, t, n, i) { - null == i && (i = 0); - var a; - e.options.lineWrapping || t != n || (t = t.ch ? fe(t.line, 'before' == t.sticky ? t.ch - 1 : t.ch, 'after') : t, n = 'before' == t.sticky ? fe(t.line, t.ch + 1, 'before') : t); - for (var s = 0; 5 > s; s++) { - var l = !1, - c = Sn(e, t), - p = n && n != t ? Sn(e, n) : c; - a = { - left: d(c.left, p.left), - top: d(c.top, p.top) - i, - right: r(c.left, p.left), - bottom: r(c.bottom, p.bottom) + i - }; - var u = ro(e, a), - m = e.doc.scrollTop, - h = e.doc.scrollLeft; - if (null != u.scrollTop && (uo(e, u.scrollTop), 1 < o(e.doc.scrollTop - m) && (l = !0)), null != u.scrollLeft && (ho(e, u.scrollLeft), 1 < o(e.doc.scrollLeft - h) && (l = !0)), !l) break + from: o, + to: Math.max(s, o + 1) } - return a - } - - function oo(e, t) { - var n = ro(e, t); - null != n.scrollTop && uo(e, n.scrollTop), null != n.scrollLeft && ho(e, n.scrollLeft) } - function ro(e, t) { + function _r(e, t) { var n = e.display, - o = xn(e.display); - 0 > t.top && (t.top = 0); + r = rr(e.display); + t.top < 0 && (t.top = 0); var i = e.curOp && null != e.curOp.scrollTop ? e.curOp.scrollTop : n.scroller.scrollTop, - a = Xt(e), + o = Dn(e), s = {}; - t.bottom - t.top > a && (t.bottom = t.top + a); - var l = e.doc.height + Kt(n), - c = t.top < o, - p = t.bottom > l - o; - if (t.top < i) s.scrollTop = c ? 0 : t.top; - else if (t.bottom > i + a) { - var u = d(t.top, (p ? l : t.bottom) - a); + t.bottom - t.top > o && (t.bottom = t.top + o); + var a = e.doc.height + kn(n), + l = t.top < r, + c = t.bottom > a - r; + if (t.top < i) s.scrollTop = l ? 0 : t.top; + else if (t.bottom > i + o) { + var u = Math.min(t.top, (c ? a : t.bottom) - o); u != i && (s.scrollTop = u) } - var m = e.curOp && null != e.curOp.scrollLeft ? e.curOp.scrollLeft : n.scroller.scrollLeft, - h = Yt(e) - (e.options.fixedGutter ? n.gutters.offsetWidth : 0), - f = t.right - t.left > h; - return f && (t.right = t.left + h), 10 > t.left ? s.scrollLeft = 0 : t.left < m ? s.scrollLeft = r(0, t.left - (f ? 0 : 10)) : t.right > h + m - 3 && (s.scrollLeft = t.right + (f ? 0 : 10) - h), s + var h = e.curOp && null != e.curOp.scrollLeft ? e.curOp.scrollLeft : n.scroller.scrollLeft, + p = Rn(e) - (e.options.fixedGutter ? n.gutters.offsetWidth : 0), + d = t.right - t.left > p; + return d && (t.right = t.left + p), t.left < 10 ? s.scrollLeft = 0 : t.left < h ? s.scrollLeft = Math.max(0, t.left - (d ? 0 : 10)) : t.right > p + h - 3 && (s.scrollLeft = t.right + (d ? 0 : 10) - p), s } - function io(e, t) { - null == t || (co(e), e.curOp.scrollTop = (null == e.curOp.scrollTop ? e.doc.scrollTop : e.curOp.scrollTop) + t) + function Ar(e, t) { + null != t && (Ir(e), e.curOp.scrollTop = (null == e.curOp.scrollTop ? e.doc.scrollTop : e.curOp.scrollTop) + t) } - function ao(e) { - co(e); + function Mr(e) { + Ir(e); var t = e.getCursor(); e.curOp.scrollToPos = { from: t, @@ -3749,93 +4101,141 @@ module.exports = function (e) { } } - function so(e, t, n) { - (null != t || null != n) && co(e), null != t && (e.curOp.scrollLeft = t), null != n && (e.curOp.scrollTop = n) - } - - function lo(e, t) { - co(e), e.curOp.scrollToPos = t + function Pr(e, t, n) { + null == t && null == n || Ir(e), null != t && (e.curOp.scrollLeft = t), null != n && (e.curOp.scrollTop = n) } - function co(e) { + function Ir(e) { var t = e.curOp.scrollToPos; - if (t) { - e.curOp.scrollToPos = null; - var n = Cn(e, t.from), - o = Cn(e, t.to); - po(e, n, o, t.margin) - } + t && (e.curOp.scrollToPos = null, Or(e, Kn(e, t.from), Kn(e, t.to), t.margin)) } - function po(e, t, n, o) { - var i = ro(e, { - left: d(t.left, n.left), - top: d(t.top, n.top) - o, - right: r(t.right, n.right), - bottom: r(t.bottom, n.bottom) + o + function Or(e, t, n, r) { + var i = _r(e, { + left: Math.min(t.left, n.left), + top: Math.min(t.top, n.top) - r, + right: Math.max(t.right, n.right), + bottom: Math.max(t.bottom, n.bottom) + r }); - so(e, i.scrollLeft, i.scrollTop) + Pr(e, i.scrollLeft, i.scrollTop) } - function uo(e, t) { - 2 > o(e.doc.scrollTop - t) || (!wa && Oo(e, { + function Lr(e, t) { + Math.abs(e.doc.scrollTop - t) < 2 || (n || li(e, { top: t - }), mo(e, t, !0), wa && Oo(e), Mo(e, 100)) + }), Nr(e, t, !0), n && li(e), ri(e, 100)) } - function mo(e, t, n) { - t = d(e.display.scroller.scrollHeight - e.display.scroller.clientHeight, t), (e.display.scroller.scrollTop != t || n) && (e.doc.scrollTop = t, e.display.scrollbars.setScrollTop(t), e.display.scroller.scrollTop != t && (e.display.scroller.scrollTop = t)) + function Nr(e, t, n) { + t = Math.min(e.display.scroller.scrollHeight - e.display.scroller.clientHeight, t), (e.display.scroller.scrollTop != t || n) && (e.doc.scrollTop = t, e.display.scrollbars.setScrollTop(t), e.display.scroller.scrollTop != t && (e.display.scroller.scrollTop = t)) } - function ho(e, t, n, r) { - t = d(t, e.display.scroller.scrollWidth - e.display.scroller.clientWidth), (n ? t == e.doc.scrollLeft : 2 > o(e.doc.scrollLeft - t)) && !r || (e.doc.scrollLeft = t, Wo(e), e.display.scroller.scrollLeft != t && (e.display.scroller.scrollLeft = t), e.display.scrollbars.setScrollLeft(t)) + function Fr(e, t, n, r) { + t = Math.min(t, e.display.scroller.scrollWidth - e.display.scroller.clientWidth), (n ? t == e.doc.scrollLeft : Math.abs(e.doc.scrollLeft - t) < 2) && !r || (e.doc.scrollLeft = t, hi(e), e.display.scroller.scrollLeft != t && (e.display.scroller.scrollLeft = t), e.display.scrollbars.setScrollLeft(t)) } - function fo(e) { + function Br(e) { var t = e.display, - o = t.gutters.offsetWidth, - r = n(e.doc.height + Kt(e.display)); + n = t.gutters.offsetWidth, + r = Math.round(e.doc.height + kn(e.display)); return { clientHeight: t.scroller.clientHeight, viewHeight: t.wrapper.clientHeight, scrollWidth: t.scroller.scrollWidth, clientWidth: t.scroller.clientWidth, viewWidth: t.wrapper.clientWidth, - barLeft: e.options.fixedGutter ? o : 0, + barLeft: e.options.fixedGutter ? n : 0, docHeight: r, - scrollHeight: r + qt(e) + t.barHeight, + scrollHeight: r + Tn(e) + t.barHeight, nativeBarWidth: t.nativeBarWidth, - gutterWidth: o - } - } - - function go(e, t) { - t || (t = fo(e)); - var n = e.display.barWidth, - o = e.display.barHeight; - yo(e, t); - for (var r = 0; 4 > r && n != e.display.barWidth || o != e.display.barHeight; r++) n != e.display.barWidth && e.options.lineWrapping && Zn(e), yo(e, fo(e)), n = e.display.barWidth, o = e.display.barHeight - } - - function yo(e, t) { - var n = e.display, - o = n.scrollbars.update(t); - n.sizer.style.paddingRight = (n.barWidth = o.right) + 'px', n.sizer.style.paddingBottom = (n.barHeight = o.bottom) + 'px', n.heightForcer.style.borderBottom = o.bottom + 'px solid transparent', o.right && o.bottom ? (n.scrollbarFiller.style.display = 'block', n.scrollbarFiller.style.height = o.bottom + 'px', n.scrollbarFiller.style.width = o.right + 'px') : n.scrollbarFiller.style.display = '', o.bottom && e.options.coverGutterNextToScrollbar && e.options.fixedGutter ? (n.gutterFiller.style.display = 'block', n.gutterFiller.style.height = o.bottom + 'px', n.gutterFiller.style.width = t.gutterWidth + 'px') : n.gutterFiller.style.display = '' - } - - function So(e) { - e.display.scrollbars && (e.display.scrollbars.clear(), e.display.scrollbars.addClass && Ka(e.display.wrapper, e.display.scrollbars.addClass)), e.display.scrollbars = new Ms[e.options.scrollbarStyle](function (t) { - e.display.wrapper.insertBefore(t, e.display.scrollbarFiller), as(t, 'mousedown', function () { - e.state.focused && setTimeout(function () { + gutterWidth: n + } + } + var Hr = function (e, t, n) { + this.cm = n; + var r = this.vert = _("div", [_("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar"), + i = this.horiz = _("div", [_("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar"); + r.tabIndex = i.tabIndex = -1, e(r), e(i), he(r, "scroll", (function () { + r.clientHeight && t(r.scrollTop, "vertical") + })), he(i, "scroll", (function () { + i.clientWidth && t(i.scrollLeft, "horizontal") + })), this.checkedZeroWidth = !1, s && a < 8 && (this.horiz.style.minHeight = this.vert.style.minWidth = "18px") + }; + Hr.prototype.update = function (e) { + var t = e.scrollWidth > e.clientWidth + 1, + n = e.scrollHeight > e.clientHeight + 1, + r = e.nativeBarWidth; + if (n) { + this.vert.style.display = "block", this.vert.style.bottom = t ? r + "px" : "0"; + var i = e.viewHeight - (t ? r : 0); + this.vert.firstChild.style.height = Math.max(0, e.scrollHeight - e.clientHeight + i) + "px" + } else this.vert.style.display = "", this.vert.firstChild.style.height = "0"; + if (t) { + this.horiz.style.display = "block", this.horiz.style.right = n ? r + "px" : "0", this.horiz.style.left = e.barLeft + "px"; + var o = e.viewWidth - e.barLeft - (n ? r : 0); + this.horiz.firstChild.style.width = Math.max(0, e.scrollWidth - e.clientWidth + o) + "px" + } else this.horiz.style.display = "", this.horiz.firstChild.style.width = "0"; + return !this.checkedZeroWidth && e.clientHeight > 0 && (0 == r && this.zeroWidthHack(), this.checkedZeroWidth = !0), { + right: n ? r : 0, + bottom: t ? r : 0 + } + }, Hr.prototype.setScrollLeft = function (e) { + this.horiz.scrollLeft != e && (this.horiz.scrollLeft = e), this.disableHoriz && this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz") + }, Hr.prototype.setScrollTop = function (e) { + this.vert.scrollTop != e && (this.vert.scrollTop = e), this.disableVert && this.enableZeroWidthBar(this.vert, this.disableVert, "vert") + }, Hr.prototype.zeroWidthHack = function () { + var e = v && !d ? "12px" : "18px"; + this.horiz.style.height = this.vert.style.width = e, this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none", this.disableHoriz = new H, this.disableVert = new H + }, Hr.prototype.enableZeroWidthBar = function (e, t, n) { + e.style.pointerEvents = "auto", t.set(1e3, (function r() { + var i = e.getBoundingClientRect(); + ("vert" == n ? document.elementFromPoint(i.right - 1, (i.top + i.bottom) / 2) : document.elementFromPoint((i.right + i.left) / 2, i.bottom - 1)) != e ? e.style.pointerEvents = "none" : t.set(1e3, r) + })) + }, Hr.prototype.clear = function () { + var e = this.horiz.parentNode; + e.removeChild(this.horiz), e.removeChild(this.vert) + }; + var zr = function () {}; + + function Ur(e, t) { + t || (t = Br(e)); + var n = e.display.barWidth, + r = e.display.barHeight; + Wr(e, t); + for (var i = 0; i < 4 && n != e.display.barWidth || r != e.display.barHeight; i++) n != e.display.barWidth && e.options.lineWrapping && Tr(e), Wr(e, Br(e)), n = e.display.barWidth, r = e.display.barHeight + } + + function Wr(e, t) { + var n = e.display, + r = n.scrollbars.update(t); + n.sizer.style.paddingRight = (n.barWidth = r.right) + "px", n.sizer.style.paddingBottom = (n.barHeight = r.bottom) + "px", n.heightForcer.style.borderBottom = r.bottom + "px solid transparent", r.right && r.bottom ? (n.scrollbarFiller.style.display = "block", n.scrollbarFiller.style.height = r.bottom + "px", n.scrollbarFiller.style.width = r.right + "px") : n.scrollbarFiller.style.display = "", r.bottom && e.options.coverGutterNextToScrollbar && e.options.fixedGutter ? (n.gutterFiller.style.display = "block", n.gutterFiller.style.height = r.bottom + "px", n.gutterFiller.style.width = t.gutterWidth + "px") : n.gutterFiller.style.display = "" + } + zr.prototype.update = function () { + return { + bottom: 0, + right: 0 + } + }, zr.prototype.setScrollLeft = function () {}, zr.prototype.setScrollTop = function () {}, zr.prototype.clear = function () {}; + var Vr = { + native: Hr, + null: zr + }; + + function jr(e) { + e.display.scrollbars && (e.display.scrollbars.clear(), e.display.scrollbars.addClass && T(e.display.wrapper, e.display.scrollbars.addClass)), e.display.scrollbars = new Vr[e.options.scrollbarStyle]((function (t) { + e.display.wrapper.insertBefore(t, e.display.scrollbarFiller), he(t, "mousedown", (function () { + e.state.focused && setTimeout((function () { return e.display.input.focus() - }, 0) - }), t.setAttribute('cm-not-content', 'true') - }, function (t, n) { - 'horizontal' == n ? ho(e, t) : uo(e, t) - }, e), e.display.scrollbars.addClass && f(e.display.wrapper, e.display.scrollbars.addClass) + }), 0) + })), t.setAttribute("cm-not-content", "true") + }), (function (t, n) { + "horizontal" == n ? Fr(e, t) : Lr(e, t) + }), e), e.display.scrollbars.addClass && I(e.display.wrapper, e.display.scrollbars.addClass) } + var Gr = 0; - function Co(e) { + function $r(e) { + var t; e.curOp = { cm: e, viewChanged: !1, @@ -3852,3877 +4252,3565 @@ module.exports = function (e) { scrollTop: null, scrollToPos: null, focus: !1, - id: ++As - }, Tt(e.curOp) + id: ++Gr + }, t = e.curOp, sn ? sn.ops.push(t) : t.ownsGroup = sn = { + ops: [t], + delayedCallbacks: [] + } } - function bo(e) { + function qr(e) { var t = e.curOp; - t && Rt(t, function (e) { + t && function (e, t) { + var n = e.ownsGroup; + if (n) try { + ! function (e) { + var t = e.delayedCallbacks, + n = 0; + do { + for (; n < t.length; n++) t[n].call(null); + for (var r = 0; r < e.ops.length; r++) { + var i = e.ops[r]; + if (i.cursorActivityHandlers) + for (; i.cursorActivityCalled < i.cursorActivityHandlers.length;) i.cursorActivityHandlers[i.cursorActivityCalled++].call(null, i.cm) + } + } while (n < t.length) + }(n) + } finally { + sn = null, t(n) + } + }(t, (function (e) { for (var t = 0; t < e.ops.length; t++) e.ops[t].cm.curOp = null; - vo(e) - }) - } - - function vo(e) { - for (var t = e.ops, n = 0; n < t.length; n++) Eo(t[n]); - for (var o = 0; o < t.length; o++) wo(t[o]); - for (var r = 0; r < t.length; r++) ko(t[r]); - for (var i = 0; i < t.length; i++) To(t[i]); - for (var a = 0; a < t.length; a++) _o(t[a]) + ! function (e) { + for (var t = e.ops, n = 0; n < t.length; n++) Kr(t[n]); + for (var r = 0; r < t.length; r++) Yr(t[r]); + for (var i = 0; i < t.length; i++) Qr(t[i]); + for (var o = 0; o < t.length; o++) Zr(t[o]); + for (var s = 0; s < t.length; s++) Xr(t[s]) + }(e) + })) } - function Eo(e) { + function Kr(e) { var t = e.cm, n = t.display; - Io(t), e.updateMaxLine && ut(t), e.mustUpdate = e.viewChanged || e.forceUpdate || null != e.scrollTop || e.scrollToPos && (e.scrollToPos.from.line < n.viewFrom || e.scrollToPos.to.line >= n.viewTo) || n.maxLineChanged && t.options.lineWrapping, e.update = e.mustUpdate && new Is(t, e.mustUpdate && { + ! function (e) { + var t = e.display; + !t.scrollbarsClipped && t.scroller.offsetWidth && (t.nativeBarWidth = t.scroller.offsetWidth - t.scroller.clientWidth, t.heightForcer.style.height = Tn(e) + "px", t.sizer.style.marginBottom = -t.nativeBarWidth + "px", t.sizer.style.borderRightWidth = Tn(e) + "px", t.scrollbarsClipped = !0) + }(t), e.updateMaxLine && Gt(t), e.mustUpdate = e.viewChanged || e.forceUpdate || null != e.scrollTop || e.scrollToPos && (e.scrollToPos.from.line < n.viewFrom || e.scrollToPos.to.line >= n.viewTo) || n.maxLineChanged && t.options.lineWrapping, e.update = e.mustUpdate && new oi(t, e.mustUpdate && { top: e.scrollTop, ensure: e.scrollToPos }, e.forceUpdate) } - function wo(e) { - e.updatedDisplay = e.mustUpdate && Bo(e.cm, e.update) + function Yr(e) { + e.updatedDisplay = e.mustUpdate && si(e.cm, e.update) } - function ko(e) { + function Qr(e) { var t = e.cm, n = t.display; - e.updatedDisplay && Zn(t), e.barMeasure = fo(t), n.maxLineChanged && !t.options.lineWrapping && (e.adjustWidthTo = Jt(t, n.maxLine, n.maxLine.text.length).left + 3, t.display.sizerWidth = e.adjustWidthTo, e.barMeasure.scrollWidth = r(n.scroller.clientWidth, n.sizer.offsetLeft + e.adjustWidthTo + qt(t) + t.display.barWidth), e.maxScrollLeft = r(0, n.sizer.offsetLeft + e.adjustWidthTo - Yt(t))), (e.updatedDisplay || e.selectionChanged) && (e.preparedSelection = n.input.prepareSelection()) + e.updatedDisplay && Tr(t), e.barMeasure = Br(t), n.maxLineChanged && !t.options.lineWrapping && (e.adjustWidthTo = An(t, n.maxLine, n.maxLine.text.length).left + 3, t.display.sizerWidth = e.adjustWidthTo, e.barMeasure.scrollWidth = Math.max(n.scroller.clientWidth, n.sizer.offsetLeft + e.adjustWidthTo + Tn(t) + t.display.barWidth), e.maxScrollLeft = Math.max(0, n.sizer.offsetLeft + e.adjustWidthTo - Rn(t))), (e.updatedDisplay || e.selectionChanged) && (e.preparedSelection = n.input.prepareSelection()) } - function To(e) { + function Zr(e) { var t = e.cm; - null != e.adjustWidthTo && (t.display.sizer.style.minWidth = e.adjustWidthTo + 'px', e.maxScrollLeft < t.doc.scrollLeft && ho(t, d(t.display.scroller.scrollLeft, e.maxScrollLeft), !0), t.display.maxLineChanged = !1); - var n = e.focus && e.focus == h(); - e.preparedSelection && t.display.input.showSelection(e.preparedSelection, n), (e.updatedDisplay || e.startHeight != t.doc.height) && go(t, e.barMeasure), e.updatedDisplay && Uo(t, e.barMeasure), e.selectionChanged && qn(t), t.state.focused && e.updateInput && t.display.input.reset(e.typing), n && Yn(e.cm) + null != e.adjustWidthTo && (t.display.sizer.style.minWidth = e.adjustWidthTo + "px", e.maxScrollLeft < t.doc.scrollLeft && Fr(t, Math.min(t.display.scroller.scrollLeft, e.maxScrollLeft), !0), t.display.maxLineChanged = !1); + var n = e.focus && e.focus == P(); + e.preparedSelection && t.display.input.showSelection(e.preparedSelection, n), (e.updatedDisplay || e.startHeight != t.doc.height) && Ur(t, e.barMeasure), e.updatedDisplay && ui(t, e.barMeasure), e.selectionChanged && Sr(t), t.state.focused && e.updateInput && t.display.input.reset(e.typing), n && Cr(e.cm) } - function _o(e) { + function Xr(e) { var t = e.cm, n = t.display, - o = t.doc; - if (e.updatedDisplay && No(t, e.update), null != n.wheelStartX && (null != e.scrollTop || null != e.scrollLeft || e.scrollToPos) && (n.wheelStartX = n.wheelStartY = null), null != e.scrollTop && mo(t, e.scrollTop, e.forceScroll), null != e.scrollLeft && ho(t, e.scrollLeft, !0, !0), e.scrollToPos) { - var r = no(t, Ee(o, e.scrollToPos.from), Ee(o, e.scrollToPos.to), e.scrollToPos.margin); - to(t, r) - } - var a = e.maybeHiddenMarkers, - s = e.maybeUnhiddenMarkers; - if (a) - for (var d = 0; d < a.length; ++d) a[d].lines.length || H(a[d], 'hide'); - if (s) - for (var i = 0; i < s.length; ++i) s[i].lines.length && H(s[i], 'unhide'); - n.wrapper.offsetHeight && (o.scrollTop = t.display.scroller.scrollTop), e.changeObjs && H(t, 'changes', t, e.changeObjs), e.update && e.update.finish() + r = t.doc; + e.updatedDisplay && ai(t, e.update), null == n.wheelStartX || null == e.scrollTop && null == e.scrollLeft && !e.scrollToPos || (n.wheelStartX = n.wheelStartY = null), null != e.scrollTop && Nr(t, e.scrollTop, e.forceScroll), null != e.scrollLeft && Fr(t, e.scrollLeft, !0, !0), e.scrollToPos && function (e, t) { + if (!me(e, "scrollCursorIntoView")) { + var n = e.display, + r = n.sizer.getBoundingClientRect(), + i = null; + if (t.top + r.top < 0 ? i = !0 : t.bottom + r.top > (window.innerHeight || document.documentElement.clientHeight) && (i = !1), null != i && !f) { + var o = _("div", "​", null, "position: absolute;\n top: " + (t.top - n.viewOffset - En(e.display)) + "px;\n height: " + (t.bottom - t.top + Tn(e) + n.barHeight) + "px;\n left: " + t.left + "px; width: " + Math.max(2, t.right - t.left) + "px;"); + e.display.lineSpace.appendChild(o), o.scrollIntoView(i), e.display.lineSpace.removeChild(o) + } + } + }(t, function (e, t, n, r) { + var i; + null == r && (r = 0), e.options.lineWrapping || t != n || (n = "before" == (t = t.ch ? et(t.line, "before" == t.sticky ? t.ch - 1 : t.ch, "after") : t).sticky ? et(t.line, t.ch + 1, "before") : t); + for (var o = 0; o < 5; o++) { + var s = !1, + a = qn(e, t), + l = n && n != t ? qn(e, n) : a, + c = _r(e, i = { + left: Math.min(a.left, l.left), + top: Math.min(a.top, l.top) - r, + right: Math.max(a.left, l.left), + bottom: Math.max(a.bottom, l.bottom) + r + }), + u = e.doc.scrollTop, + h = e.doc.scrollLeft; + if (null != c.scrollTop && (Lr(e, c.scrollTop), Math.abs(e.doc.scrollTop - u) > 1 && (s = !0)), null != c.scrollLeft && (Fr(e, c.scrollLeft), Math.abs(e.doc.scrollLeft - h) > 1 && (s = !0)), !s) break + } + return i + }(t, at(r, e.scrollToPos.from), at(r, e.scrollToPos.to), e.scrollToPos.margin)); + var i = e.maybeHiddenMarkers, + o = e.maybeUnhiddenMarkers; + if (i) + for (var s = 0; s < i.length; ++s) i[s].lines.length || fe(i[s], "hide"); + if (o) + for (var a = 0; a < o.length; ++a) o[a].lines.length && fe(o[a], "unhide"); + n.wrapper.offsetHeight && (r.scrollTop = t.display.scroller.scrollTop), e.changeObjs && fe(t, "changes", t, e.changeObjs), e.update && e.update.finish() } - function Ro(e, t) { + function Jr(e, t) { if (e.curOp) return t(); - Co(e); + $r(e); try { return t() } finally { - bo(e) + qr(e) } } - function xo(e, t) { + function ei(e, t) { return function () { if (e.curOp) return t.apply(e, arguments); - Co(e); + $r(e); try { return t.apply(e, arguments) } finally { - bo(e) + qr(e) } } } - function Po(e) { + function ti(e) { return function () { if (this.curOp) return e.apply(this, arguments); - Co(this); + $r(this); try { return e.apply(this, arguments) } finally { - bo(this) + qr(this) } } } - function Do(e) { + function ni(e) { return function () { var t = this.cm; if (!t || t.curOp) return e.apply(this, arguments); - Co(t); + $r(t); try { return e.apply(this, arguments) } finally { - bo(t) + qr(t) } } } - function Mo(e, t) { - e.doc.highlightFrontier < e.display.viewTo && e.state.highlight.set(t, y(Ao, e)) + function ri(e, t) { + e.doc.highlightFrontier < e.display.viewTo && e.state.highlight.set(t, N(ii, e)) } - function Ao(e) { + function ii(e) { var t = e.doc; if (!(t.highlightFrontier >= e.display.viewTo)) { var n = +new Date + e.options.workTime, - o = Re(e, t.highlightFrontier), - a = []; - t.iter(o.line, d(t.first + t.size, e.display.viewTo + 500), function (r) { - if (o.line >= e.display.viewFrom) { - var s = r.styles, - d = r.text.length > e.options.maxHighlightLength ? oe(t.mode, o.state) : null, - l = Te(e, r, o, !0); - d && (o.state = d), r.styles = l.styles; - var c = r.styleClasses, - p = l.classes; - p ? r.styleClasses = p : c && (r.styleClasses = null); - for (var u = !s || s.length != r.styles.length || c != p && (!c || !p || c.bgClass != p.bgClass || c.textClass != p.textClass), m = 0; !u && m < s.length; ++m) u = s[m] != r.styles[m]; - u && a.push(o.line), r.stateAfter = o.save(), o.nextLine() - } else r.text.length <= e.options.maxHighlightLength && xe(e, r.text, o), r.stateAfter = 0 == o.line % 5 ? o.save() : null, o.nextLine(); - return +new Date > n ? (Mo(e, e.options.workDelay), !0) : void 0 - }), t.highlightFrontier = o.line, t.modeFrontier = r(t.modeFrontier, o.line), a.length && Ro(e, function () { - for (var t = 0; t < a.length; t++) Nn(e, a[t], 'text') - }) + r = dt(e, t.highlightFrontier), + i = []; + t.iter(r.line, Math.min(t.first + t.size, e.display.viewTo + 500), (function (o) { + if (r.line >= e.display.viewFrom) { + var s = o.styles, + a = o.text.length > e.options.maxHighlightLength ? We(t.mode, r.state) : null, + l = ht(e, o, r, !0); + a && (r.state = a), o.styles = l.styles; + var c = o.styleClasses, + u = l.classes; + u ? o.styleClasses = u : c && (o.styleClasses = null); + for (var h = !s || s.length != o.styles.length || c != u && (!c || !u || c.bgClass != u.bgClass || c.textClass != u.textClass), p = 0; !h && p < s.length; ++p) h = s[p] != o.styles[p]; + h && i.push(r.line), o.stateAfter = r.save(), r.nextLine() + } else o.text.length <= e.options.maxHighlightLength && ft(e, o.text, r), o.stateAfter = r.line % 5 == 0 ? r.save() : null, r.nextLine(); + if (+new Date > n) return ri(e, e.options.workDelay), !0 + })), t.highlightFrontier = r.line, t.modeFrontier = Math.max(t.modeFrontier, r.line), i.length && Jr(e, (function () { + for (var t = 0; t < i.length; t++) pr(e, i[t], "text") + })) } } + var oi = function (e, t, n) { + var r = e.display; + this.viewport = t, this.visible = Dr(r, e.doc, t), this.editorIsHidden = !r.wrapper.offsetWidth, this.wrapperHeight = r.wrapper.clientHeight, this.wrapperWidth = r.wrapper.clientWidth, this.oldDisplayWidth = Rn(e), this.force = n, this.dims = or(e), this.events = [] + }; - function Io(e) { - var t = e.display; - !t.scrollbarsClipped && t.scroller.offsetWidth && (t.nativeBarWidth = t.scroller.offsetWidth - t.scroller.clientWidth, t.heightForcer.style.height = qt(e) + 'px', t.sizer.style.marginBottom = -t.nativeBarWidth + 'px', t.sizer.style.borderRightWidth = qt(e) + 'px', t.scrollbarsClipped = !0) - } - - function Lo(e) { - if (e.hasFocus()) return null; - var t = h(); - if (!t || !m(e.display.lineDiv, t)) return null; - var n = { - activeElt: t - }; - if (window.getSelection) { - var o = window.getSelection(); - o.anchorNode && o.extend && m(e.display.lineDiv, o.anchorNode) && (n.anchorNode = o.anchorNode, n.anchorOffset = o.anchorOffset, n.focusNode = o.focusNode, n.focusOffset = o.focusOffset) - } - return n + function si(e, t) { + var n = e.display, + r = e.doc; + if (t.editorIsHidden) return dr(e), !1; + if (!t.force && t.visible.from >= n.viewFrom && t.visible.to <= n.viewTo && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo) && n.renderedView == n.view && 0 == mr(e)) return !1; + pi(e) && (dr(e), t.dims = or(e)); + var i = r.first + r.size, + o = Math.max(t.visible.from - e.options.viewportMargin, r.first), + s = Math.min(i, t.visible.to + e.options.viewportMargin); + n.viewFrom < o && o - n.viewFrom < 20 && (o = Math.max(r.first, n.viewFrom)), n.viewTo > s && n.viewTo - s < 20 && (s = Math.min(i, n.viewTo)), Ct && (o = Ht(e.doc, o), s = zt(e.doc, s)); + var a = o != n.viewFrom || s != n.viewTo || n.lastWrapHeight != t.wrapperHeight || n.lastWrapWidth != t.wrapperWidth; + ! function (e, t, n) { + var r = e.display; + 0 == r.view.length || t >= r.viewTo || n <= r.viewFrom ? (r.view = on(e, t, n), r.viewFrom = t) : (r.viewFrom > t ? r.view = on(e, t, r.viewFrom).concat(r.view) : r.viewFrom < t && (r.view = r.view.slice(ur(e, t))), r.viewFrom = t, r.viewTo < n ? r.view = r.view.concat(on(e, r.viewTo, n)) : r.viewTo > n && (r.view = r.view.slice(0, ur(e, n)))), r.viewTo = n + }(e, o, s), n.viewOffset = Vt($e(e.doc, n.viewFrom)), e.display.mover.style.top = n.viewOffset + "px"; + var c = mr(e); + if (!a && 0 == c && !t.force && n.renderedView == n.view && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo)) return !1; + var u = function (e) { + if (e.hasFocus()) return null; + var t = P(); + if (!t || !M(e.display.lineDiv, t)) return null; + var n = { + activeElt: t + }; + if (window.getSelection) { + var r = window.getSelection(); + r.anchorNode && r.extend && M(e.display.lineDiv, r.anchorNode) && (n.anchorNode = r.anchorNode, n.anchorOffset = r.anchorOffset, n.focusNode = r.focusNode, n.focusOffset = r.focusOffset) + } + return n + }(e); + return c > 4 && (n.lineDiv.style.display = "none"), + function (e, t, n) { + var r = e.display, + i = e.options.lineNumbers, + o = r.lineDiv, + s = o.firstChild; + + function a(t) { + var n = t.nextSibling; + return l && v && e.display.currentWheelTarget == t ? t.style.display = "none" : t.parentNode.removeChild(t), n + } + for (var c = r.view, u = r.viewFrom, h = 0; h < c.length; h++) { + var p = c[h]; + if (p.hidden); + else if (p.node && p.node.parentNode == o) { + for (; s != p.node;) s = a(s); + var d = i && null != t && t <= u && p.lineNumber; + p.changes && (z(p.changes, "gutter") > -1 && (d = !1), un(e, p, u, n)), d && (R(p.lineNumber), p.lineNumber.appendChild(document.createTextNode(Je(e.options, u)))), s = p.node.nextSibling + } else { + var f = yn(e, p, u, n); + o.insertBefore(f, s) + } + u += p.size + } + for (; s;) s = a(s) + }(e, n.updateLineNumbers, t.dims), c > 4 && (n.lineDiv.style.display = ""), n.renderedView = n.view, + function (e) { + if (e && e.activeElt && e.activeElt != P() && (e.activeElt.focus(), e.anchorNode && M(document.body, e.anchorNode) && M(document.body, e.focusNode))) { + var t = window.getSelection(), + n = document.createRange(); + n.setEnd(e.anchorNode, e.anchorOffset), n.collapse(!1), t.removeAllRanges(), t.addRange(n), t.extend(e.focusNode, e.focusOffset) + } + }(u), R(n.cursorDiv), R(n.selectionDiv), n.gutters.style.height = n.sizer.style.minHeight = 0, a && (n.lastWrapHeight = t.wrapperHeight, n.lastWrapWidth = t.wrapperWidth, ri(e, 400)), n.updateLineNumbers = null, !0 } - function Fo(e) { - if (e && e.activeElt && e.activeElt != h() && (e.activeElt.focus(), e.anchorNode && m(document.body, e.anchorNode) && m(document.body, e.focusNode))) { - var t = window.getSelection(), - n = document.createRange(); - n.setEnd(e.anchorNode, e.anchorOffset), n.collapse(!1), t.removeAllRanges(), t.addRange(n), t.extend(e.focusNode, e.focusOffset) + function ai(e, t) { + for (var n = t.viewport, r = !0; + (r && e.options.lineWrapping && t.oldDisplayWidth != Rn(e) || (n && null != n.top && (n = { + top: Math.min(e.doc.height + kn(e.display) - Dn(e), n.top) + }), t.visible = Dr(e.display, e.doc, n), !(t.visible.from >= e.display.viewFrom && t.visible.to <= e.display.viewTo))) && si(e, t); r = !1) { + Tr(e); + var i = Br(e); + gr(e), Ur(e, i), ui(e, i), t.force = !1 } + t.signal(e, "update", e), e.display.viewFrom == e.display.reportedViewFrom && e.display.viewTo == e.display.reportedViewTo || (t.signal(e, "viewportChange", e, e.display.viewFrom, e.display.viewTo), e.display.reportedViewFrom = e.display.viewFrom, e.display.reportedViewTo = e.display.viewTo) } - function Bo(e, t) { - var n = e.display, - o = e.doc; - if (t.editorIsHidden) return On(e), !1; - if (!t.force && t.visible.from >= n.viewFrom && t.visible.to <= n.viewTo && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo) && n.renderedView == n.view && 0 == Un(e)) return !1; - Vo(e) && (On(e), t.dims = Dn(e)); - var i = o.first + o.size, - a = r(t.visible.from - e.options.viewportMargin, o.first), - s = d(i, t.visible.to + e.options.viewportMargin); - n.viewFrom < a && 20 > a - n.viewFrom && (a = r(o.first, n.viewFrom)), n.viewTo > s && 20 > n.viewTo - s && (s = d(i, n.viewTo)), vs && (a = at(e.doc, a), s = st(e.doc, s)); - var c = a != n.viewFrom || s != n.viewTo || n.lastWrapHeight != t.wrapperHeight || n.lastWrapWidth != t.wrapperWidth; - zn(e, a, s), n.viewOffset = ct(se(e.doc, n.viewFrom)), e.display.mover.style.top = n.viewOffset + 'px'; - var p = Un(e); - if (!c && 0 == p && !t.force && n.renderedView == n.view && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo)) return !1; - var u = Lo(e); - return 4 < p && (n.lineDiv.style.display = 'none'), Ho(e, n.updateLineNumbers, t.dims), 4 < p && (n.lineDiv.style.display = ''), n.renderedView = n.view, Fo(u), l(n.cursorDiv), l(n.selectionDiv), n.gutters.style.height = n.sizer.style.minHeight = 0, c && (n.lastWrapHeight = t.wrapperHeight, n.lastWrapWidth = t.wrapperWidth, Mo(e, 400)), n.updateLineNumbers = null, !0 - } - - function No(e, t) { - for (var n = t.viewport, o = !0;; o = !1) { - if ((!o || !e.options.lineWrapping || t.oldDisplayWidth == Yt(e)) && (n && null != n.top && (n = { - top: d(e.doc.height + Kt(e.display) - Xt(e), n.top) - }), t.visible = eo(e.display, e.doc, n), t.visible.from >= e.display.viewFrom && t.visible.to <= e.display.viewTo)) break; - if (!Bo(e, t)) break; - Zn(e); - var r = fo(e); - Wn(e), go(e, r), Uo(e, r), t.force = !1 - } - t.signal(e, 'update', e), (e.display.viewFrom != e.display.reportedViewFrom || e.display.viewTo != e.display.reportedViewTo) && (t.signal(e, 'viewportChange', e, e.display.viewFrom, e.display.viewTo), e.display.reportedViewFrom = e.display.viewFrom, e.display.reportedViewTo = e.display.viewTo) - } - - function Oo(e, t) { - var n = new Is(e, t); - if (Bo(e, n)) { - Zn(e), No(e, n); - var o = fo(e); - Wn(e), go(e, o), Uo(e, o), n.finish() - } - } - - function Ho(e, t, n) { - function o(t) { - var n = t.nextSibling; - return Pa && Ha && e.display.currentWheelTarget == t ? t.style.display = 'none' : t.parentNode.removeChild(t), n - } - for (var r = e.display, a = e.options.lineNumbers, s = r.lineDiv, d = s.firstChild, c = r.view, p = r.viewFrom, u = 0, i; u < c.length; u++) { - if (i = c[u], i.hidden); - else if (!i.node || i.node.parentNode != s) { - var m = Ot(e, i, p, n); - s.insertBefore(m, d) - } else { - for (; d != i.node;) d = o(d); - var h = a && null != t && t <= p && i.lineNumber; - i.changes && (-1 < b(i.changes, 'gutter') && (h = !1), Dt(e, i, p, n)), h && (l(i.lineNumber), i.lineNumber.appendChild(document.createTextNode(he(e.options, p)))), d = i.node.nextSibling - } - p += i.size + function li(e, t) { + var n = new oi(e, t); + if (si(e, n)) { + Tr(e), ai(e, n); + var r = Br(e); + gr(e), Ur(e, r), ui(e, r), n.finish() } - for (; d;) d = o(d) } - function zo(e) { + function ci(e) { var t = e.gutters.offsetWidth; - e.sizer.style.marginLeft = t + 'px' + e.sizer.style.marginLeft = t + "px" } - function Uo(e, t) { - e.display.sizer.style.minHeight = t.docHeight + 'px', e.display.heightForcer.style.top = t.docHeight + 'px', e.display.gutters.style.height = t.docHeight + e.display.barHeight + qt(e) + 'px' + function ui(e, t) { + e.display.sizer.style.minHeight = t.docHeight + "px", e.display.heightForcer.style.top = t.docHeight + "px", e.display.gutters.style.height = t.docHeight + e.display.barHeight + Tn(e) + "px" } - function Wo(e) { + function hi(e) { var t = e.display, n = t.view; if (t.alignWidgets || t.gutters.firstChild && e.options.fixedGutter) { - for (var o = Mn(t) - t.scroller.scrollLeft + e.doc.scrollLeft, r = t.gutters.offsetWidth, a = o + 'px', s = 0; s < n.length; s++) + for (var r = sr(t) - t.scroller.scrollLeft + e.doc.scrollLeft, i = t.gutters.offsetWidth, o = r + "px", s = 0; s < n.length; s++) if (!n[s].hidden) { - e.options.fixedGutter && (n[s].gutter && (n[s].gutter.style.left = a), n[s].gutterBackground && (n[s].gutterBackground.style.left = a)); - var i = n[s].alignable; - if (i) - for (var d = 0; d < i.length; d++) i[d].style.left = a - } e.options.fixedGutter && (t.gutters.style.left = o + r + 'px') + e.options.fixedGutter && (n[s].gutter && (n[s].gutter.style.left = o), n[s].gutterBackground && (n[s].gutterBackground.style.left = o)); + var a = n[s].alignable; + if (a) + for (var l = 0; l < a.length; l++) a[l].style.left = o + } e.options.fixedGutter && (t.gutters.style.left = r + i + "px") } } - function Vo(e) { + function pi(e) { if (!e.options.lineNumbers) return !1; var t = e.doc, - n = he(e.options, t.first + t.size - 1), - o = e.display; - if (n.length != o.lineNumChars) { - var i = o.measure.appendChild(p('div', [p('div', n)], 'CodeMirror-linenumber CodeMirror-gutter-elt')), - a = i.firstChild.offsetWidth, - s = i.offsetWidth - a; - return o.lineGutter.style.width = '', o.lineNumInnerWidth = r(a, o.lineGutter.offsetWidth - s) + 1, o.lineNumWidth = o.lineNumInnerWidth + s, o.lineNumChars = o.lineNumInnerWidth ? n.length : -1, o.lineGutter.style.width = o.lineNumWidth + 'px', zo(e.display), !0 + n = Je(e.options, t.first + t.size - 1), + r = e.display; + if (n.length != r.lineNumChars) { + var i = r.measure.appendChild(_("div", [_("div", n)], "CodeMirror-linenumber CodeMirror-gutter-elt")), + o = i.firstChild.offsetWidth, + s = i.offsetWidth - o; + return r.lineGutter.style.width = "", r.lineNumInnerWidth = Math.max(o, r.lineGutter.offsetWidth - s) + 1, r.lineNumWidth = r.lineNumInnerWidth + s, r.lineNumChars = r.lineNumInnerWidth ? n.length : -1, r.lineGutter.style.width = r.lineNumWidth + "px", ci(e.display), !0 } return !1 } - function Go(e, t) { - for (var n = [], o = !1, r = 0; r < e.length; r++) { - var i = e[r], - a = null; - if ('string' != typeof i && (a = i.style, i = i.className), 'CodeMirror-linenumbers' == i) + function di(e, t) { + for (var n = [], r = !1, i = 0; i < e.length; i++) { + var o = e[i], + s = null; + if ("string" != typeof o && (s = o.style, o = o.className), "CodeMirror-linenumbers" == o) { if (!t) continue; - else o = !0; + r = !0 + } n.push({ - className: i, - style: a + className: o, + style: s }) } - return t && !o && n.push({ - className: 'CodeMirror-linenumbers', + return t && !r && n.push({ + className: "CodeMirror-linenumbers", style: null }), n } - function Ko(e) { + function fi(e) { var t = e.gutters, n = e.gutterSpecs; - l(t), e.lineGutter = null; - for (var o = 0; o < n.length; ++o) { - var r = n[o], - i = r.className, - a = r.style, - s = t.appendChild(p('div', null, 'CodeMirror-gutter ' + i)); - a && (s.style.cssText = a), 'CodeMirror-linenumbers' == i && (e.lineGutter = s, s.style.width = (e.lineNumWidth || 1) + 'px') + R(t), e.lineGutter = null; + for (var r = 0; r < n.length; ++r) { + var i = n[r], + o = i.className, + s = i.style, + a = t.appendChild(_("div", null, "CodeMirror-gutter " + o)); + s && (a.style.cssText = s), "CodeMirror-linenumbers" == o && (e.lineGutter = a, a.style.width = (e.lineNumWidth || 1) + "px") } - t.style.display = n.length ? '' : 'none', zo(e) - } - - function jo(e) { - Ko(e.display), Bn(e), Wo(e) + t.style.display = n.length ? "" : "none", ci(e) } - function qo(e, t, n, o) { - var r = this; - this.input = n, r.scrollbarFiller = p('div', null, 'CodeMirror-scrollbar-filler'), r.scrollbarFiller.setAttribute('cm-not-content', 'true'), r.gutterFiller = p('div', null, 'CodeMirror-gutter-filler'), r.gutterFiller.setAttribute('cm-not-content', 'true'), r.lineDiv = u('div', null, 'CodeMirror-code'), r.selectionDiv = p('div', null, null, 'position: relative; z-index: 1'), r.cursorDiv = p('div', null, 'CodeMirror-cursors'), r.measure = p('div', null, 'CodeMirror-measure'), r.lineMeasure = p('div', null, 'CodeMirror-measure'), r.lineSpace = u('div', [r.measure, r.lineMeasure, r.selectionDiv, r.cursorDiv, r.lineDiv], null, 'position: relative; outline: none'); - var i = u('div', [r.lineSpace], 'CodeMirror-lines'); - r.mover = p('div', [i], null, 'position: relative'), r.sizer = p('div', [r.mover], 'CodeMirror-sizer'), r.sizerWidth = null, r.heightForcer = p('div', null, null, 'position: absolute; height: ' + Xa + 'px; width: 1px;'), r.gutters = p('div', null, 'CodeMirror-gutters'), r.lineGutter = null, r.scroller = p('div', [r.sizer, r.heightForcer, r.gutters], 'CodeMirror-scroll'), r.scroller.setAttribute('tabIndex', '-1'), r.wrapper = p('div', [r.scrollbarFiller, r.gutterFiller, r.scroller], 'CodeMirror'), Ra && 8 > xa && (r.gutters.style.zIndex = -1, r.scroller.style.paddingRight = 0), Pa || wa && Oa || (r.scroller.draggable = !0), e && (e.appendChild ? e.appendChild(r.wrapper) : e(r.wrapper)), r.viewFrom = r.viewTo = t.first, r.reportedViewFrom = r.reportedViewTo = t.first, r.view = [], r.renderedView = null, r.externalMeasured = null, r.viewOffset = 0, r.lastWrapHeight = r.lastWrapWidth = 0, r.updateLineNumbers = null, r.nativeBarWidth = r.barHeight = r.barWidth = 0, r.scrollbarsClipped = !1, r.lineNumWidth = r.lineNumInnerWidth = r.lineNumChars = null, r.alignWidgets = !1, r.cachedCharWidth = r.cachedTextHeight = r.cachedPaddingH = null, r.maxLine = null, r.maxLineLength = 0, r.maxLineChanged = !1, r.wheelDX = r.wheelDY = r.wheelStartX = r.wheelStartY = null, r.shift = !1, r.selForContextMenu = null, r.activeTouch = null, r.gutterSpecs = Go(o.gutters, o.lineNumbers), Ko(r), n.init(r) + function mi(e) { + fi(e.display), hr(e), hi(e) } - function Yo(t) { - var e = t.wheelDeltaX, - n = t.wheelDeltaY; - return null == e && t.detail && t.axis == t.HORIZONTAL_AXIS && (e = t.detail), null == n && t.detail && t.axis == t.VERTICAL_AXIS ? n = t.detail : null == n && (n = t.wheelDelta), { - x: e, + function gi(e, t, r, i) { + var o = this; + this.input = r, o.scrollbarFiller = _("div", null, "CodeMirror-scrollbar-filler"), o.scrollbarFiller.setAttribute("cm-not-content", "true"), o.gutterFiller = _("div", null, "CodeMirror-gutter-filler"), o.gutterFiller.setAttribute("cm-not-content", "true"), o.lineDiv = A("div", null, "CodeMirror-code"), o.selectionDiv = _("div", null, null, "position: relative; z-index: 1"), o.cursorDiv = _("div", null, "CodeMirror-cursors"), o.measure = _("div", null, "CodeMirror-measure"), o.lineMeasure = _("div", null, "CodeMirror-measure"), o.lineSpace = A("div", [o.measure, o.lineMeasure, o.selectionDiv, o.cursorDiv, o.lineDiv], null, "position: relative; outline: none"); + var c = A("div", [o.lineSpace], "CodeMirror-lines"); + o.mover = _("div", [c], null, "position: relative"), o.sizer = _("div", [o.mover], "CodeMirror-sizer"), o.sizerWidth = null, o.heightForcer = _("div", null, null, "position: absolute; height: 30px; width: 1px;"), o.gutters = _("div", null, "CodeMirror-gutters"), o.lineGutter = null, o.scroller = _("div", [o.sizer, o.heightForcer, o.gutters], "CodeMirror-scroll"), o.scroller.setAttribute("tabIndex", "-1"), o.wrapper = _("div", [o.scrollbarFiller, o.gutterFiller, o.scroller], "CodeMirror"), s && a < 8 && (o.gutters.style.zIndex = -1, o.scroller.style.paddingRight = 0), l || n && y || (o.scroller.draggable = !0), e && (e.appendChild ? e.appendChild(o.wrapper) : e(o.wrapper)), o.viewFrom = o.viewTo = t.first, o.reportedViewFrom = o.reportedViewTo = t.first, o.view = [], o.renderedView = null, o.externalMeasured = null, o.viewOffset = 0, o.lastWrapHeight = o.lastWrapWidth = 0, o.updateLineNumbers = null, o.nativeBarWidth = o.barHeight = o.barWidth = 0, o.scrollbarsClipped = !1, o.lineNumWidth = o.lineNumInnerWidth = o.lineNumChars = null, o.alignWidgets = !1, o.cachedCharWidth = o.cachedTextHeight = o.cachedPaddingH = null, o.maxLine = null, o.maxLineLength = 0, o.maxLineChanged = !1, o.wheelDX = o.wheelDY = o.wheelStartX = o.wheelStartY = null, o.shift = !1, o.selForContextMenu = null, o.activeTouch = null, o.gutterSpecs = di(i.gutters, i.lineNumbers), fi(o), r.init(o) + } + oi.prototype.signal = function (e, t) { + ye(e, t) && this.events.push(arguments) + }, oi.prototype.finish = function () { + for (var e = 0; e < this.events.length; e++) fe.apply(null, this.events[e]) + }; + var yi = 0, + vi = null; + + function wi(e) { + var t = e.wheelDeltaX, + n = e.wheelDeltaY; + return null == t && e.detail && e.axis == e.HORIZONTAL_AXIS && (t = e.detail), null == n && e.detail && e.axis == e.VERTICAL_AXIS ? n = e.detail : null == n && (n = e.wheelDelta), { + x: t, y: n } } - function Xo(t) { - var e = Yo(t); - return e.x *= Fs, e.y *= Fs, e - } - - function Qo(t, n) { - var e = Yo(n), - o = e.x, - a = e.y, - s = t.display, - l = s.scroller, - c = l.scrollWidth > l.clientWidth, - p = l.scrollHeight > l.clientHeight; - if (o && c || a && p) { - if (a && Ha && Pa) outer: for (var u = n.target, m = s.view; u != l; u = u.parentNode) - for (var h = 0; h < m.length; h++) - if (m[h].node == u) { - t.display.currentWheelTarget = u; - break outer - } if (o && !wa && !Aa && null != Fs) return a && p && uo(t, r(0, l.scrollTop + a * Fs)), ho(t, r(0, l.scrollLeft + o * Fs)), (!a || a && p) && G(n), void(s.wheelStartX = null); - if (a && null != Fs) { - var i = a * Fs, - f = t.doc.scrollTop, - g = f + s.wrapper.clientHeight; - 0 > i ? f = r(0, f + i - 50) : g = d(t.doc.height, g + i + 50), Oo(t, { - top: f, - bottom: g + function bi(e) { + var t = wi(e); + return t.x *= vi, t.y *= vi, t + } + + function Si(e, t) { + var r = wi(t), + i = r.x, + o = r.y, + s = e.display, + a = s.scroller, + c = a.scrollWidth > a.clientWidth, + u = a.scrollHeight > a.clientHeight; + if (i && c || o && u) { + if (o && v && l) e: for (var p = t.target, d = s.view; p != a; p = p.parentNode) + for (var f = 0; f < d.length; f++) + if (d[f].node == p) { + e.display.currentWheelTarget = p; + break e + } if (i && !n && !h && null != vi) return o && u && Lr(e, Math.max(0, a.scrollTop + o * vi)), Fr(e, Math.max(0, a.scrollLeft + i * vi)), (!o || o && u) && we(t), void(s.wheelStartX = null); + if (o && null != vi) { + var m = o * vi, + g = e.doc.scrollTop, + y = g + s.wrapper.clientHeight; + m < 0 ? g = Math.max(0, g + m - 50) : y = Math.min(e.doc.height, y + m + 50), li(e, { + top: g, + bottom: y }) } - 20 > Ls && (null == s.wheelStartX ? (s.wheelStartX = l.scrollLeft, s.wheelStartY = l.scrollTop, s.wheelDX = o, s.wheelDY = a, setTimeout(function () { + yi < 20 && (null == s.wheelStartX ? (s.wheelStartX = a.scrollLeft, s.wheelStartY = a.scrollTop, s.wheelDX = i, s.wheelDY = o, setTimeout((function () { if (null != s.wheelStartX) { - var e = l.scrollLeft - s.wheelStartX, - t = l.scrollTop - s.wheelStartY, + var e = a.scrollLeft - s.wheelStartX, + t = a.scrollTop - s.wheelStartY, n = t && s.wheelDY && t / s.wheelDY || e && s.wheelDX && e / s.wheelDX; - s.wheelStartX = s.wheelStartY = null, n && (Fs = (Fs * Ls + n) / (Ls + 1), ++Ls) + s.wheelStartX = s.wheelStartY = null, n && (vi = (vi * yi + n) / (yi + 1), ++yi) } - }, 200)) : (s.wheelDX += o, s.wheelDY += a)) + }), 200)) : (s.wheelDX += i, s.wheelDY += o)) } } + s ? vi = -.53 : n ? vi = 15 : u ? vi = -.7 : p && (vi = -1 / 3); + var Ci = function (e, t) { + this.ranges = e, this.primIndex = t + }; + Ci.prototype.primary = function () { + return this.ranges[this.primIndex] + }, Ci.prototype.equals = function (e) { + if (e == this) return !0; + if (e.primIndex != this.primIndex || e.ranges.length != this.ranges.length) return !1; + for (var t = 0; t < this.ranges.length; t++) { + var n = this.ranges[t], + r = e.ranges[t]; + if (!nt(n.anchor, r.anchor) || !nt(n.head, r.head)) return !1 + } + return !0 + }, Ci.prototype.deepCopy = function () { + for (var e = [], t = 0; t < this.ranges.length; t++) e[t] = new Ei(rt(this.ranges[t].anchor), rt(this.ranges[t].head)); + return new Ci(e, this.primIndex) + }, Ci.prototype.somethingSelected = function () { + for (var e = 0; e < this.ranges.length; e++) + if (!this.ranges[e].empty()) return !0; + return !1 + }, Ci.prototype.contains = function (e, t) { + t || (t = e); + for (var n = 0; n < this.ranges.length; n++) { + var r = this.ranges[n]; + if (tt(t, r.from()) >= 0 && tt(e, r.to()) <= 0) return n + } + return -1 + }; + var Ei = function (e, t) { + this.anchor = e, this.head = t + }; - function $o(e, t, n) { - var o = e && e.options.selectionsMayTouch, - r = t[n]; - t.sort(function (e, t) { - return ge(e.from(), t.from()) - }), n = b(t, r); - for (var a = 1; a < t.length; a++) { - var i = t[a], - s = t[a - 1], - d = ge(s.to(), i.from()); - if (o && !i.empty() ? 0 < d : 0 <= d) { - var l = be(s.from(), i.from()), - c = Ce(s.to(), i.to()), - p = s.empty() ? i.from() == i.head : s.from() == s.head; - a <= n && --n, t.splice(--a, 2, new Ns(p ? c : l, p ? l : c)) + function ki(e, t, n) { + var r = e && e.options.selectionsMayTouch, + i = t[n]; + t.sort((function (e, t) { + return tt(e.from(), t.from()) + })), n = z(t, i); + for (var o = 1; o < t.length; o++) { + var s = t[o], + a = t[o - 1], + l = tt(a.to(), s.from()); + if (r && !s.empty() ? l > 0 : l >= 0) { + var c = ot(a.from(), s.from()), + u = it(a.to(), s.to()), + h = a.empty() ? s.from() == s.head : a.from() == a.head; + o <= n && --n, t.splice(--o, 2, new Ei(h ? u : c, h ? c : u)) } } - return new Bs(t, n) + return new Ci(t, n) } - function Zo(e, t) { - return new Bs([new Ns(e, t || e)], 0) + function xi(e, t) { + return new Ci([new Ei(e, t || e)], 0) } - function Jo(e) { - return e.text ? fe(e.from.line + e.text.length - 1, w(e.text).length + (1 == e.text.length ? e.from.ch : 0)) : e.to + function Ti(e) { + return e.text ? et(e.from.line + e.text.length - 1, K(e.text).length + (1 == e.text.length ? e.from.ch : 0)) : e.to } - function er(e, t) { - if (0 > ge(e, t.from)) return e; - if (0 >= ge(e, t.to)) return Jo(t); + function Ri(e, t) { + if (tt(e, t.from) < 0) return e; + if (tt(e, t.to) <= 0) return Ti(t); var n = e.line + t.text.length - (t.to.line - t.from.line) - 1, - o = e.ch; - return e.line == t.to.line && (o += Jo(t).ch - t.to.ch), fe(n, o) - } - - function tr(e, t) { - for (var n = [], o = 0, r; o < e.sel.ranges.length; o++) r = e.sel.ranges[o], n.push(new Ns(er(r.anchor, t), er(r.head, t))); - return $o(e.cm, n, e.sel.primIndex) + r = e.ch; + return e.line == t.to.line && (r += Ti(t).ch - t.to.ch), et(n, r) } - function nr(e, t, n) { - return e.line == t.line ? fe(n.line, e.ch - t.ch + n.ch) : fe(n.line + (e.line - t.line), e.ch) + function Di(e, t) { + for (var n = [], r = 0; r < e.sel.ranges.length; r++) { + var i = e.sel.ranges[r]; + n.push(new Ei(Ri(i.anchor, t), Ri(i.head, t))) + } + return ki(e.cm, n, e.sel.primIndex) } - function or(e, t, n) { - for (var o = [], r = fe(e.first, 0), a = r, s = 0; s < t.length; s++) { - var i = t[s], - d = nr(i.from, r, a), - l = nr(Jo(i), r, a); - if (r = i.to, a = l, 'around' == n) { - var c = e.sel.ranges[s], - p = 0 > ge(c.head, c.anchor); - o[s] = new Ns(p ? l : d, p ? d : l) - } else o[s] = new Ns(d, d) - } - return new Bs(o, e.sel.primIndex) + function _i(e, t, n) { + return e.line == t.line ? et(n.line, e.ch - t.ch + n.ch) : et(n.line + (e.line - t.line), e.ch) } - function rr(e) { - e.doc.mode = te(e.options, e.doc.modeOption), ir(e) + function Ai(e) { + e.doc.mode = He(e.options, e.doc.modeOption), Mi(e) } - function ir(e) { - e.doc.iter(function (e) { + function Mi(e) { + e.doc.iter((function (e) { e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null) - }), e.doc.modeFrontier = e.doc.highlightFrontier = e.doc.first, Mo(e, 100), e.state.modeGen++, e.curOp && Bn(e) + })), e.doc.modeFrontier = e.doc.highlightFrontier = e.doc.first, ri(e, 100), e.state.modeGen++, e.curOp && hr(e) } - function ar(e, t) { - return 0 == t.from.ch && 0 == t.to.ch && '' == w(t.text) && (!e.cm || e.cm.options.wholeLineUpdateBefore) + function Pi(e, t) { + return 0 == t.from.ch && 0 == t.to.ch && "" == K(t.text) && (!e.cm || e.cm.options.wholeLineUpdateBefore) } - function sr(e, t, o, n) { - function r(e) { - return o ? o[e] : null + function Ii(e, t, n, r) { + function i(e) { + return n ? n[e] : null } - function i(e, o, r) { - mt(e, o, r, n), xt(e, 'change', e, t) + function o(e, n, i) { + ! function (e, t, n, r) { + e.text = t, e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null), null != e.order && (e.order = null), Dt(e), _t(e, n); + var i = r ? r(e) : 1; + i != e.height && Ye(e, i) + }(e, n, i, r), ln(e, "change", e, t) } - function a(e, t) { - for (var o = [], a = e; a < t; ++a) o.push(new Es(l[a], r(a), n)); - return o + function s(e, t) { + for (var n = [], o = e; o < t; ++o) n.push(new $t(c[o], i(o), r)); + return n } - var s = t.from, - d = t.to, - l = t.text, - c = se(e, s.line), - p = se(e, d.line), - u = w(l), - m = r(l.length - 1), - h = d.line - s.line; - if (t.full) e.insert(0, a(0, l.length)), e.remove(l.length, e.size - l.length); - else if (ar(e, t)) { - var f = a(0, l.length - 1); - i(p, p.text, m), h && e.remove(s.line, h), f.length && e.insert(s.line, f) - } else if (c == p) { - if (1 == l.length) i(c, c.text.slice(0, s.ch) + u + c.text.slice(d.ch), m); + var a = t.from, + l = t.to, + c = t.text, + u = $e(e, a.line), + h = $e(e, l.line), + p = K(c), + d = i(c.length - 1), + f = l.line - a.line; + if (t.full) e.insert(0, s(0, c.length)), e.remove(c.length, e.size - c.length); + else if (Pi(e, t)) { + var m = s(0, c.length - 1); + o(h, h.text, d), f && e.remove(a.line, f), m.length && e.insert(a.line, m) + } else if (u == h) + if (1 == c.length) o(u, u.text.slice(0, a.ch) + p + u.text.slice(l.ch), d); else { - var g = a(1, l.length - 1); - g.push(new Es(u + c.text.slice(d.ch), m, n)), i(c, c.text.slice(0, s.ch) + l[0], r(0)), e.insert(s.line + 1, g) + var g = s(1, c.length - 1); + g.push(new $t(p + u.text.slice(l.ch), d, r)), o(u, u.text.slice(0, a.ch) + c[0], i(0)), e.insert(a.line + 1, g) } - } else if (1 == l.length) i(c, c.text.slice(0, s.ch) + l[0] + p.text.slice(d.ch), r(0)), e.remove(s.line + 1, h); + else if (1 == c.length) o(u, u.text.slice(0, a.ch) + c[0] + h.text.slice(l.ch), i(0)), e.remove(a.line + 1, f); else { - i(c, c.text.slice(0, s.ch) + l[0], r(0)), i(p, u + p.text.slice(d.ch), m); - var y = a(1, l.length - 1); - 1 < h && e.remove(s.line + 1, h - 1), e.insert(s.line + 1, y) + o(u, u.text.slice(0, a.ch) + c[0], i(0)), o(h, p + h.text.slice(l.ch), d); + var y = s(1, c.length - 1); + f > 1 && e.remove(a.line + 1, f - 1), e.insert(a.line + 1, y) } - xt(e, 'change', e, t) + ln(e, "change", e, t) } - function dr(e, t, n) { - function o(e, r, a) { - if (e.linked) - for (var s = 0, i; s < e.linked.length; ++s) - if (i = e.linked[s], i.doc != r) { - var d = a && i.sharedHist; - (!n || d) && (t(i.doc, d), o(i.doc, e, d)) + function Oi(e, t, n) { + ! function e(r, i, o) { + if (r.linked) + for (var s = 0; s < r.linked.length; ++s) { + var a = r.linked[s]; + if (a.doc != i) { + var l = o && a.sharedHist; + n && !l || (t(a.doc, l), e(a.doc, r, l)) } - } - o(e, null, !0) - } - - function lr(e, t) { - if (t.cm) throw new Error('This document is already in use.'); - e.doc = t, t.cm = e, In(e), rr(e), cr(e), e.options.lineWrapping || ut(e), e.options.mode = t.modeOption, Bn(e) + } + }(e, null, !0) } - function cr(e) { - ('rtl' == e.doc.direction ? f : Ka)(e.display.lineDiv, 'CodeMirror-rtl') + function Li(e, t) { + if (t.cm) throw new Error("This document is already in use."); + e.doc = t, t.cm = e, lr(e), Ai(e), Ni(e), e.options.lineWrapping || Gt(e), e.options.mode = t.modeOption, hr(e) } - function pr(e) { - Ro(e, function () { - cr(e), Bn(e) - }) + function Ni(e) { + ("rtl" == e.doc.direction ? I : T)(e.display.lineDiv, "CodeMirror-rtl") } - function ur(e) { - this.done = [], this.undone = [], this.undoDepth = Infinity, this.lastModTime = this.lastSelTime = 0, this.lastOp = this.lastSelOp = null, this.lastOrigin = this.lastSelOrigin = null, this.generation = this.maxGeneration = e || 1 + function Fi(e) { + this.done = [], this.undone = [], this.undoDepth = 1 / 0, this.lastModTime = this.lastSelTime = 0, this.lastOp = this.lastSelOp = null, this.lastOrigin = this.lastSelOrigin = null, this.generation = this.maxGeneration = e || 1 } - function mr(e, t) { + function Bi(e, t) { var n = { - from: Se(t.from), - to: Jo(t), - text: de(e, t.from, t.to) + from: rt(t.from), + to: Ti(t), + text: qe(e, t.from, t.to) }; - return br(e, n, t.from.line, t.to.line + 1), dr(e, function (e) { - return br(e, n, t.from.line, t.to.line + 1) - }, !0), n - } - - function hr(e) { - for (; e.length;) { - var t = w(e); - if (t.ranges) e.pop(); - else break - } + return Vi(e, n, t.from.line, t.to.line + 1), Oi(e, (function (e) { + return Vi(e, n, t.from.line, t.to.line + 1) + }), !0), n } - function fr(e, t) { - return t ? (hr(e.done), w(e.done)) : e.done.length && !w(e.done).ranges ? w(e.done) : 1 < e.done.length && !e.done[e.done.length - 2].ranges ? (e.done.pop(), w(e.done)) : void 0 + function Hi(e) { + for (; e.length && K(e).ranges;) e.pop() } - function gr(e, t, n, o) { - var r = e.history; - r.undone.length = 0; - var i = +new Date, - a, s; - if ((r.lastOp == o || r.lastOrigin == t.origin && t.origin && ('+' == t.origin.charAt(0) && r.lastModTime > i - (e.cm ? e.cm.options.historyEventDelay : 500) || '*' == t.origin.charAt(0))) && (a = fr(r, r.lastOp == o))) s = w(a.changes), 0 == ge(t.from, t.to) && 0 == ge(t.from, s.to) ? s.to = Jo(t) : a.changes.push(mr(e, t)); + function zi(e, t, n, r) { + var i = e.history; + i.undone.length = 0; + var o, s, a = +new Date; + if ((i.lastOp == r || i.lastOrigin == t.origin && t.origin && ("+" == t.origin.charAt(0) && i.lastModTime > a - (e.cm ? e.cm.options.historyEventDelay : 500) || "*" == t.origin.charAt(0))) && (o = function (e, t) { + return t ? (Hi(e.done), K(e.done)) : e.done.length && !K(e.done).ranges ? K(e.done) : e.done.length > 1 && !e.done[e.done.length - 2].ranges ? (e.done.pop(), K(e.done)) : void 0 + }(i, i.lastOp == r))) s = K(o.changes), 0 == tt(t.from, t.to) && 0 == tt(t.from, s.to) ? s.to = Ti(t) : o.changes.push(Bi(e, t)); else { - var d = w(r.done); - for (d && d.ranges || Cr(e.sel, r.done), a = { - changes: [mr(e, t)], - generation: r.generation - }, r.done.push(a); r.done.length > r.undoDepth;) r.done.shift(), r.done[0].ranges || r.done.shift() + var l = K(i.done); + for (l && l.ranges || Wi(e.sel, i.done), o = { + changes: [Bi(e, t)], + generation: i.generation + }, i.done.push(o); i.done.length > i.undoDepth;) i.done.shift(), i.done[0].ranges || i.done.shift() } - r.done.push(n), r.generation = ++r.maxGeneration, r.lastModTime = r.lastSelTime = i, r.lastOp = r.lastSelOp = o, r.lastOrigin = r.lastSelOrigin = t.origin, s || H(e, 'historyAdded') - } - - function yr(e, t, n, o) { - var r = t.charAt(0); - return '*' == r || '+' == r && n.ranges.length == o.ranges.length && n.somethingSelected() == o.somethingSelected() && new Date - e.history.lastSelTime <= (e.cm ? e.cm.options.historyEventDelay : 500) + i.done.push(n), i.generation = ++i.maxGeneration, i.lastModTime = i.lastSelTime = a, i.lastOp = i.lastSelOp = r, i.lastOrigin = i.lastSelOrigin = t.origin, s || fe(e, "historyAdded") } - function Sr(e, t, n, o) { - var r = e.history, - i = o && o.origin; - n == r.lastSelOp || i && r.lastSelOrigin == i && (r.lastModTime == r.lastSelTime && r.lastOrigin == i || yr(e, i, w(r.done), t)) ? r.done[r.done.length - 1] = t : Cr(t, r.done), r.lastSelTime = +new Date, r.lastSelOrigin = i, r.lastSelOp = n, o && !1 !== o.clearRedo && hr(r.undone) + function Ui(e, t, n, r) { + var i = e.history, + o = r && r.origin; + n == i.lastSelOp || o && i.lastSelOrigin == o && (i.lastModTime == i.lastSelTime && i.lastOrigin == o || function (e, t, n, r) { + var i = t.charAt(0); + return "*" == i || "+" == i && n.ranges.length == r.ranges.length && n.somethingSelected() == r.somethingSelected() && new Date - e.history.lastSelTime <= (e.cm ? e.cm.options.historyEventDelay : 500) + }(e, o, K(i.done), t)) ? i.done[i.done.length - 1] = t : Wi(t, i.done), i.lastSelTime = +new Date, i.lastSelOrigin = o, i.lastSelOp = n, r && !1 !== r.clearRedo && Hi(i.undone) } - function Cr(e, t) { - var n = w(t); + function Wi(e, t) { + var n = K(t); n && n.ranges && n.equals(e) || t.push(e) } - function br(e, t, o, i) { - var a = t['spans_' + e.id], - s = 0; - e.iter(r(e.first, o), d(e.first + e.size, i), function (n) { - n.markedSpans && ((a || (a = t['spans_' + e.id] = {}))[s] = n.markedSpans), ++s - }) + function Vi(e, t, n, r) { + var i = t["spans_" + e.id], + o = 0; + e.iter(Math.max(e.first, n), Math.min(e.first + e.size, r), (function (n) { + n.markedSpans && ((i || (i = t["spans_" + e.id] = {}))[o] = n.markedSpans), ++o + })) } - function vr(e) { + function ji(e) { if (!e) return null; - for (var t = 0, n; t < e.length; ++t) e[t].marker.explicitlyCleared ? n || (n = e.slice(0, t)) : n && n.push(e[t]); - return n ? n.length ? n : null : e - } - - function Er(e, t) { - var n = t['spans_' + e.id]; - if (!n) return null; - for (var o = [], r = 0; r < t.text.length; ++r) o.push(vr(n[r])); - return o + for (var t, n = 0; n < e.length; ++n) e[n].marker.explicitlyCleared ? t || (t = e.slice(0, n)) : t && t.push(e[n]); + return t ? t.length ? t : null : e } - function wr(e, t) { - var n = Er(e, t), - o = Ge(e, t); - if (!n) return o; - if (!o) return n; - for (var r = 0; r < n.length; ++r) { - var i = n[r], - a = o[r]; - if (i && a) spans: for (var s = 0, d; s < a.length; ++s) { - d = a[s]; - for (var l = 0; l < i.length; ++l) - if (i[l].marker == d.marker) continue spans; - i.push(d) - } else a && (n[r] = a) + function Gi(e, t) { + var n = function (e, t) { + var n = t["spans_" + e.id]; + if (!n) return null; + for (var r = [], i = 0; i < t.text.length; ++i) r.push(ji(n[i])); + return r + }(e, t), + r = Tt(e, t); + if (!n) return r; + if (!r) return n; + for (var i = 0; i < n.length; ++i) { + var o = n[i], + s = r[i]; + if (o && s) e: for (var a = 0; a < s.length; ++a) { + for (var l = s[a], c = 0; c < o.length; ++c) + if (o[c].marker == l.marker) continue e; + o.push(l) + } else s && (n[i] = s) } return n } - function kr(e, t, n) { - for (var o = [], r = 0, i; r < e.length; ++r) { - if (i = e[r], i.ranges) { - o.push(n ? Bs.prototype.deepCopy.call(i) : i); - continue - } - var a = i.changes, - s = []; - o.push({ - changes: s - }); - for (var d = 0; d < a.length; ++d) { - var l = a[d], - c = void 0; - if (s.push({ - from: l.from, - to: l.to, - text: l.text - }), t) - for (var p in l)(c = p.match(/^spans_(\d+)$/)) && -1 < b(t, +c[1]) && (w(s)[p] = l[p], delete l[p]) + function $i(e, t, n) { + for (var r = [], i = 0; i < e.length; ++i) { + var o = e[i]; + if (o.ranges) r.push(n ? Ci.prototype.deepCopy.call(o) : o); + else { + var s = o.changes, + a = []; + r.push({ + changes: a + }); + for (var l = 0; l < s.length; ++l) { + var c = s[l], + u = void 0; + if (a.push({ + from: c.from, + to: c.to, + text: c.text + }), t) + for (var h in c)(u = h.match(/^spans_(\d+)$/)) && z(t, Number(u[1])) > -1 && (K(a)[h] = c[h], delete c[h]) + } } } - return o + return r } - function Tr(e, t, n, o) { - if (o) { - var r = e.anchor; + function qi(e, t, n, r) { + if (r) { + var i = e.anchor; if (n) { - var i = 0 > ge(t, r); - i == 0 > ge(n, r) ? i != 0 > ge(t, n) && (t = n) : (r = t, t = n) + var o = tt(t, i) < 0; + o != tt(n, i) < 0 ? (i = t, t = n) : o != tt(t, n) < 0 && (t = n) } - return new Ns(r, t) + return new Ei(i, t) } - return new Ns(n || t, t) - } - - function _r(e, t, n, o, r) { - null == r && (r = e.cm && (e.cm.display.shift || e.extend)), Ar(e, new Bs([Tr(e.sel.primary(), t, n, r)], 0), o) + return new Ei(n || t, t) } - function Rr(e, t, n) { - for (var o = [], r = e.cm && (e.cm.display.shift || e.extend), a = 0; a < e.sel.ranges.length; a++) o[a] = Tr(e.sel.ranges[a], t[a], null, r); - var i = $o(e.cm, o, e.sel.primIndex); - Ar(e, i, n) + function Ki(e, t, n, r, i) { + null == i && (i = e.cm && (e.cm.display.shift || e.extend)), Ji(e, new Ci([qi(e.sel.primary(), t, n, i)], 0), r) } - function xr(e, t, n, o) { - var r = e.sel.ranges.slice(0); - r[t] = n, Ar(e, $o(e.cm, r, e.sel.primIndex), o) + function Yi(e, t, n) { + for (var r = [], i = e.cm && (e.cm.display.shift || e.extend), o = 0; o < e.sel.ranges.length; o++) r[o] = qi(e.sel.ranges[o], t[o], null, i); + Ji(e, ki(e.cm, r, e.sel.primIndex), n) } - function Pr(e, t, n, o) { - Ar(e, Zo(t, n), o) + function Qi(e, t, n, r) { + var i = e.sel.ranges.slice(0); + i[t] = n, Ji(e, ki(e.cm, i, e.sel.primIndex), r) } - function Dr(e, t, n) { - var o = { - ranges: t.ranges, - update: function (t) { - var n = this; - this.ranges = []; - for (var o = 0; o < t.length; o++) n.ranges[o] = new Ns(Ee(e, t[o].anchor), Ee(e, t[o].head)) - }, - origin: n && n.origin - }; - return H(e, 'beforeSelectionChange', e, o), e.cm && H(e.cm, 'beforeSelectionChange', e.cm, o), o.ranges == t.ranges ? t : $o(e.cm, o.ranges, o.ranges.length - 1) + function Zi(e, t, n, r) { + Ji(e, xi(t, n), r) } - function Mr(e, t, n) { - var o = e.history.done, - r = w(o); - r && r.ranges ? (o[o.length - 1] = t, Ir(e, t, n)) : Ar(e, t, n) + function Xi(e, t, n) { + var r = e.history.done, + i = K(r); + i && i.ranges ? (r[r.length - 1] = t, eo(e, t, n)) : Ji(e, t, n) } - function Ar(e, t, n) { - Ir(e, t, n), Sr(e, e.sel, e.cm ? e.cm.curOp.id : NaN, n) + function Ji(e, t, n) { + eo(e, t, n), Ui(e, e.sel, e.cm ? e.cm.curOp.id : NaN, n) } - function Ir(e, t, n) { - (W(e, 'beforeSelectionChange') || e.cm && W(e.cm, 'beforeSelectionChange')) && (t = Dr(e, t, n)); - var o = n && n.bias || (0 > ge(t.primary().head, e.sel.primary().head) ? -1 : 1); - Lr(e, Br(e, t, o, !0)), !(n && !1 === n.scroll) && e.cm && ao(e.cm) + function eo(e, t, n) { + (ye(e, "beforeSelectionChange") || e.cm && ye(e.cm, "beforeSelectionChange")) && (t = function (e, t, n) { + var r = { + ranges: t.ranges, + update: function (t) { + this.ranges = []; + for (var n = 0; n < t.length; n++) this.ranges[n] = new Ei(at(e, t[n].anchor), at(e, t[n].head)) + }, + origin: n && n.origin + }; + return fe(e, "beforeSelectionChange", e, r), e.cm && fe(e.cm, "beforeSelectionChange", e.cm, r), r.ranges != t.ranges ? ki(e.cm, r.ranges, r.ranges.length - 1) : t + }(e, t, n)); + var r = n && n.bias || (tt(t.primary().head, e.sel.primary().head) < 0 ? -1 : 1); + to(e, ro(e, t, r, !0)), n && !1 === n.scroll || !e.cm || Mr(e.cm) } - function Lr(e, t) { - t.equals(e.sel) || (e.sel = t, e.cm && (e.cm.curOp.updateInput = 1, e.cm.curOp.selectionChanged = !0, U(e.cm)), xt(e, 'cursorActivity', e)) + function to(e, t) { + t.equals(e.sel) || (e.sel = t, e.cm && (e.cm.curOp.updateInput = 1, e.cm.curOp.selectionChanged = !0, ge(e.cm)), ln(e, "cursorActivity", e)) } - function Fr(e) { - Lr(e, Br(e, e.sel, null, !1)) + function no(e) { + to(e, ro(e, e.sel, null, !1)) } - function Br(e, t, n, o) { - for (var r = 0, i; r < t.ranges.length; r++) { - var a = t.ranges[r], - s = t.ranges.length == e.sel.ranges.length && e.sel.ranges[r], - d = Or(e, a.anchor, s && s.anchor, n, o), - l = Or(e, a.head, s && s.head, n, o); - (i || d != a.anchor || l != a.head) && (!i && (i = t.ranges.slice(0, r)), i[r] = new Ns(d, l)) + function ro(e, t, n, r) { + for (var i, o = 0; o < t.ranges.length; o++) { + var s = t.ranges[o], + a = t.ranges.length == e.sel.ranges.length && e.sel.ranges[o], + l = oo(e, s.anchor, a && a.anchor, n, r), + c = oo(e, s.head, a && a.head, n, r); + (i || l != s.anchor || c != s.head) && (i || (i = t.ranges.slice(0, o)), i[o] = new Ei(l, c)) } - return i ? $o(e.cm, i, t.primIndex) : t + return i ? ki(e.cm, i, t.primIndex) : t } - function Nr(e, t, n, o, r) { - var a = se(e, t.line); - if (a.markedSpans) - for (var s = 0; s < a.markedSpans.length; ++s) { - var i = a.markedSpans[s], - d = i.marker, - l = 'selectLeft' in d ? !d.selectLeft : d.inclusiveLeft, - c = 'selectRight' in d ? !d.selectRight : d.inclusiveRight; - if ((null == i.from || (l ? i.from <= t.ch : i.from < t.ch)) && (null == i.to || (c ? i.to >= t.ch : i.to > t.ch))) { - if (r && (H(d, 'beforeCursorEnter'), d.explicitlyCleared)) - if (!a.markedSpans) break; - else { + function io(e, t, n, r, i) { + var o = $e(e, t.line); + if (o.markedSpans) + for (var s = 0; s < o.markedSpans.length; ++s) { + var a = o.markedSpans[s], + l = a.marker, + c = "selectLeft" in l ? !l.selectLeft : l.inclusiveLeft, + u = "selectRight" in l ? !l.selectRight : l.inclusiveRight; + if ((null == a.from || (c ? a.from <= t.ch : a.from < t.ch)) && (null == a.to || (u ? a.to >= t.ch : a.to > t.ch))) { + if (i && (fe(l, "beforeCursorEnter"), l.explicitlyCleared)) { + if (o.markedSpans) { --s; continue - } if (!d.atomic) continue; + } + break + } + if (!l.atomic) continue; if (n) { - var p = d.find(0 > o ? 1 : -1), - u = void 0; - if ((0 > o ? c : l) && (p = Hr(e, p, -o, p && p.line == t.line ? a : null)), p && p.line == t.line && (u = ge(p, n)) && (0 > o ? 0 > u : 0 < u)) return Nr(e, p, t, o, r) + var h = l.find(r < 0 ? 1 : -1), + p = void 0; + if ((r < 0 ? u : c) && (h = so(e, h, -r, h && h.line == t.line ? o : null)), h && h.line == t.line && (p = tt(h, n)) && (r < 0 ? p < 0 : p > 0)) return io(e, h, t, r, i) } - var m = d.find(0 > o ? -1 : 1); - return (0 > o ? l : c) && (m = Hr(e, m, o, m.line == t.line ? a : null)), m ? Nr(e, m, t, o, r) : null + var d = l.find(r < 0 ? -1 : 1); + return (r < 0 ? c : u) && (d = so(e, d, r, d.line == t.line ? o : null)), d ? io(e, d, t, r, i) : null } } return t } - function Or(e, t, n, o, r) { - var i = o || 1, - a = Nr(e, t, n, i, r) || !r && Nr(e, t, n, i, !0) || Nr(e, t, n, -i, r) || !r && Nr(e, t, n, -i, !0); - return a ? a : (e.cantEdit = !0, fe(e.first, 0)) + function oo(e, t, n, r, i) { + var o = r || 1, + s = io(e, t, n, o, i) || !i && io(e, t, n, o, !0) || io(e, t, n, -o, i) || !i && io(e, t, n, -o, !0); + return s || (e.cantEdit = !0, et(e.first, 0)) } - function Hr(e, t, n, o) { - return 0 > n && 0 == t.ch ? t.line > e.first ? Ee(e, fe(t.line - 1)) : null : 0 < n && t.ch == (o || se(e, t.line)).text.length ? t.line < e.first + e.size - 1 ? fe(t.line + 1, 0) : null : new fe(t.line, t.ch + n) + function so(e, t, n, r) { + return n < 0 && 0 == t.ch ? t.line > e.first ? at(e, et(t.line - 1)) : null : n > 0 && t.ch == (r || $e(e, t.line)).text.length ? t.line < e.first + e.size - 1 ? et(t.line + 1, 0) : null : new et(t.line, t.ch + n) } - function zr(e) { - e.setSelection(fe(e.firstLine(), 0), fe(e.lastLine()), $a) + function ao(e) { + e.setSelection(et(e.firstLine(), 0), et(e.lastLine()), W) } - function Ur(e, t, n) { - var o = { + function lo(e, t, n) { + var r = { canceled: !1, from: t.from, to: t.to, text: t.text, origin: t.origin, cancel: function () { - return o.canceled = !0 + return r.canceled = !0 } }; - return n && (o.update = function (t, n, r, i) { - t && (o.from = Ee(e, t)), n && (o.to = Ee(e, n)), r && (o.text = r), void 0 !== i && (o.origin = i) - }), H(e, 'beforeChange', e, o), e.cm && H(e.cm, 'beforeChange', e.cm, o), o.canceled ? (e.cm && (e.cm.curOp.updateInput = 2), null) : { - from: o.from, - to: o.to, - text: o.text, - origin: o.origin + return n && (r.update = function (t, n, i, o) { + t && (r.from = at(e, t)), n && (r.to = at(e, n)), i && (r.text = i), void 0 !== o && (r.origin = o) + }), fe(e, "beforeChange", e, r), e.cm && fe(e.cm, "beforeChange", e.cm, r), r.canceled ? (e.cm && (e.cm.curOp.updateInput = 2), null) : { + from: r.from, + to: r.to, + text: r.text, + origin: r.origin } } - function Wr(e, t, n) { + function co(e, t, n) { if (e.cm) { - if (!e.cm.curOp) return xo(e.cm, Wr)(e, t, n); + if (!e.cm.curOp) return ei(e.cm, co)(e, t, n); if (e.cm.state.suppressEdits) return } - if (!((W(e, 'beforeChange') || e.cm && W(e.cm, 'beforeChange')) && (t = Ur(e, t, !0), !t))) { - var o = bs && !n && je(e, t.from, t.to); - if (o) - for (var r = o.length - 1; 0 <= r; --r) Vr(e, { - from: o[r].from, - to: o[r].to, - text: r ? [''] : t.text, + if (!(ye(e, "beforeChange") || e.cm && ye(e.cm, "beforeChange")) || (t = lo(e, t, !0))) { + var r = St && !n && function (e, t, n) { + var r = null; + if (e.iter(t.line, n.line + 1, (function (e) { + if (e.markedSpans) + for (var t = 0; t < e.markedSpans.length; ++t) { + var n = e.markedSpans[t].marker; + !n.readOnly || r && -1 != z(r, n) || (r || (r = [])).push(n) + } + })), !r) return null; + for (var i = [{ + from: t, + to: n + }], o = 0; o < r.length; ++o) + for (var s = r[o], a = s.find(0), l = 0; l < i.length; ++l) { + var c = i[l]; + if (!(tt(c.to, a.from) < 0 || tt(c.from, a.to) > 0)) { + var u = [l, 1], + h = tt(c.from, a.from), + p = tt(c.to, a.to); + (h < 0 || !s.inclusiveLeft && !h) && u.push({ + from: c.from, + to: a.from + }), (p > 0 || !s.inclusiveRight && !p) && u.push({ + from: a.to, + to: c.to + }), i.splice.apply(i, u), l += u.length - 3 + } + } + return i + }(e, t.from, t.to); + if (r) + for (var i = r.length - 1; i >= 0; --i) uo(e, { + from: r[i].from, + to: r[i].to, + text: i ? [""] : t.text, origin: t.origin }); - else Vr(e, t) + else uo(e, t) } } - function Vr(e, t) { - if (1 != t.text.length || '' != t.text[0] || 0 != ge(t.from, t.to)) { - var n = tr(e, t); - gr(e, t, n, e.cm ? e.cm.curOp.id : NaN), jr(e, t, n, Ge(e, t)); - var o = []; - dr(e, function (e, n) { - n || -1 != b(o, e.history) || ($r(e.history, t), o.push(e.history)), jr(e, t, null, Ge(e, t)) - }) + function uo(e, t) { + if (1 != t.text.length || "" != t.text[0] || 0 != tt(t.from, t.to)) { + var n = Di(e, t); + zi(e, t, n, e.cm ? e.cm.curOp.id : NaN), fo(e, t, n, Tt(e, t)); + var r = []; + Oi(e, (function (e, n) { + n || -1 != z(r, e.history) || (vo(e.history, t), r.push(e.history)), fo(e, t, null, Tt(e, t)) + })) } } - function Gr(e, t, n) { - var o = e.cm && e.cm.state.suppressEdits; - if (!o || n) { - for (var r = e.history, a = e.sel, s = 'undo' == t ? r.done : r.undone, d = 'undo' == t ? r.undone : r.done, l = 0, c; l < s.length && (c = s[l], n ? !c.ranges || c.equals(e.sel) : !!c.ranges); l++); - if (l != s.length) { - for (r.lastOrigin = r.lastSelOrigin = null;;) - if (c = s.pop(), c.ranges) { - if (Cr(c, d), n && !c.equals(e.sel)) return void Ar(e, c, { - clearRedo: !1 - }); - a = c - } else { - if (o) return void s.push(c); + function ho(e, t, n) { + var r = e.cm && e.cm.state.suppressEdits; + if (!r || n) { + for (var i, o = e.history, s = e.sel, a = "undo" == t ? o.done : o.undone, l = "undo" == t ? o.undone : o.done, c = 0; c < a.length && (i = a[c], n ? !i.ranges || i.equals(e.sel) : i.ranges); c++); + if (c != a.length) { + for (o.lastOrigin = o.lastSelOrigin = null;;) { + if (!(i = a.pop()).ranges) { + if (r) return void a.push(i); break - } var p = []; - Cr(a, d), d.push({ - changes: p, - generation: r.generation - }), r.generation = c.generation || ++r.maxGeneration; - for (var u = W(e, 'beforeChange') || e.cm && W(e.cm, 'beforeChange'), i = function (n) { - var o = c.changes[n]; - if (o.origin = t, u && !Ur(e, o, !1)) return s.length = 0, {}; - p.push(mr(e, o)); - var r = n ? tr(e, o) : w(s); - jr(e, o, r, wr(e, o)), !n && e.cm && e.cm.scrollIntoView({ - from: o.from, - to: Jo(o) + } + if (Wi(i, l), n && !i.equals(e.sel)) return void Ji(e, i, { + clearRedo: !1 + }); + s = i + } + var u = []; + Wi(s, l), l.push({ + changes: u, + generation: o.generation + }), o.generation = i.generation || ++o.maxGeneration; + for (var h = ye(e, "beforeChange") || e.cm && ye(e.cm, "beforeChange"), p = function (n) { + var r = i.changes[n]; + if (r.origin = t, h && !lo(e, r, !1)) return a.length = 0, {}; + u.push(Bi(e, r)); + var o = n ? Di(e, r) : K(a); + fo(e, r, o, Gi(e, r)), !n && e.cm && e.cm.scrollIntoView({ + from: r.from, + to: Ti(r) }); - var a = []; - dr(e, function (e, t) { - t || -1 != b(a, e.history) || ($r(e.history, o), a.push(e.history)), jr(e, o, null, wr(e, o)) - }) - }, m = c.changes.length - 1, h; 0 <= m; --m) - if (h = i(m), h) return h.v + var s = []; + Oi(e, (function (e, t) { + t || -1 != z(s, e.history) || (vo(e.history, r), s.push(e.history)), fo(e, r, null, Gi(e, r)) + })) + }, d = i.changes.length - 1; d >= 0; --d) { + var f = p(d); + if (f) return f.v + } } } } - function Kr(e, t) { - if (0 != t && (e.first += t, e.sel = new Bs(k(e.sel.ranges, function (e) { - return new Ns(fe(e.anchor.line + t, e.anchor.ch), fe(e.head.line + t, e.head.ch)) - }), e.sel.primIndex), e.cm)) { - Bn(e.cm, e.first, e.first - t, t); - for (var n = e.cm.display, o = n.viewFrom; o < n.viewTo; o++) Nn(e.cm, o, 'gutter') + function po(e, t) { + if (0 != t && (e.first += t, e.sel = new Ci(Y(e.sel.ranges, (function (e) { + return new Ei(et(e.anchor.line + t, e.anchor.ch), et(e.head.line + t, e.head.ch)) + })), e.sel.primIndex), e.cm)) { + hr(e.cm, e.first, e.first - t, t); + for (var n = e.cm.display, r = n.viewFrom; r < n.viewTo; r++) pr(e.cm, r, "gutter") } } - function jr(e, t, n, o) { - if (e.cm && !e.cm.curOp) return xo(e.cm, jr)(e, t, n, o); - if (t.to.line < e.first) return void Kr(e, t.text.length - 1 - (t.to.line - t.from.line)); - if (!(t.from.line > e.lastLine())) { + function fo(e, t, n, r) { + if (e.cm && !e.cm.curOp) return ei(e.cm, fo)(e, t, n, r); + if (t.to.line < e.first) po(e, t.text.length - 1 - (t.to.line - t.from.line)); + else if (!(t.from.line > e.lastLine())) { if (t.from.line < e.first) { - var r = t.text.length - 1 - (e.first - t.from.line); - Kr(e, r), t = { - from: fe(e.first, 0), - to: fe(t.to.line + r, t.to.ch), - text: [w(t.text)], + var i = t.text.length - 1 - (e.first - t.from.line); + po(e, i), t = { + from: et(e.first, 0), + to: et(t.to.line + i, t.to.ch), + text: [K(t.text)], origin: t.origin } } - var i = e.lastLine(); - t.to.line > i && (t = { + var o = e.lastLine(); + t.to.line > o && (t = { from: t.from, - to: fe(i, se(e, i).text.length), + to: et(o, $e(e, o).text.length), text: [t.text[0]], origin: t.origin - }), t.removed = de(e, t.from, t.to), n || (n = tr(e, t)), e.cm ? qr(e.cm, t, o) : sr(e, t, o), Ir(e, n, $a), e.cantEdit && Or(e, fe(e.firstLine(), 0)) && (e.cantEdit = !1) - } - } - - function qr(e, t, n) { - var o = e.doc, - r = e.display, - i = t.from, - a = t.to, - s = !1, - d = i.line; - e.options.lineWrapping || (d = pe(ot(se(o, i.line))), o.iter(d, a.line + 1, function (e) { - if (e == r.maxLine) return s = !0, !0 - })), -1 < o.sel.contains(t.from, t.to) && U(e), sr(o, t, n, An(e)), e.options.lineWrapping || (o.iter(d, i.line + t.text.length, function (e) { - var t = pt(e); - t > r.maxLineLength && (r.maxLine = e, r.maxLineLength = t, r.maxLineChanged = !0, s = !1) - }), s && (e.curOp.updateMaxLine = !0)), Fe(o, i.line), Mo(e, 400); - var l = t.text.length - (a.line - i.line) - 1; - t.full ? Bn(e) : i.line != a.line || 1 != t.text.length || ar(e.doc, t) ? Bn(e, i.line, a.line + 1, l) : Nn(e, i.line, 'text'); - var c = W(e, 'changes'), - p = W(e, 'change'); - if (p || c) { - var u = { - from: i, - to: a, - text: t.text, - removed: t.removed, - origin: t.origin - }; - p && xt(e, 'change', e, u), c && (e.curOp.changeObjs || (e.curOp.changeObjs = [])).push(u) + }), t.removed = qe(e, t.from, t.to), n || (n = Di(e, t)), e.cm ? function (e, t, n) { + var r = e.doc, + i = e.display, + o = t.from, + s = t.to, + a = !1, + l = o.line; + e.options.lineWrapping || (l = Qe(Bt($e(r, o.line))), r.iter(l, s.line + 1, (function (e) { + if (e == i.maxLine) return a = !0, !0 + }))), r.sel.contains(t.from, t.to) > -1 && ge(e), Ii(r, t, n, ar(e)), e.options.lineWrapping || (r.iter(l, o.line + t.text.length, (function (e) { + var t = jt(e); + t > i.maxLineLength && (i.maxLine = e, i.maxLineLength = t, i.maxLineChanged = !0, a = !1) + })), a && (e.curOp.updateMaxLine = !0)), + function (e, t) { + if (e.modeFrontier = Math.min(e.modeFrontier, t), !(e.highlightFrontier < t - 10)) { + for (var n = e.first, r = t - 1; r > n; r--) { + var i = $e(e, r).stateAfter; + if (i && (!(i instanceof ct) || r + i.lookAhead < t)) { + n = r + 1; + break + } + } + e.highlightFrontier = Math.min(e.highlightFrontier, n) + } + }(r, o.line), ri(e, 400); + var c = t.text.length - (s.line - o.line) - 1; + t.full ? hr(e) : o.line != s.line || 1 != t.text.length || Pi(e.doc, t) ? hr(e, o.line, s.line + 1, c) : pr(e, o.line, "text"); + var u = ye(e, "changes"), + h = ye(e, "change"); + if (h || u) { + var p = { + from: o, + to: s, + text: t.text, + removed: t.removed, + origin: t.origin + }; + h && ln(e, "change", e, p), u && (e.curOp.changeObjs || (e.curOp.changeObjs = [])).push(p) + } + e.display.selForContextMenu = null + }(e.cm, t, r) : Ii(e, t, r), eo(e, n, W), e.cantEdit && oo(e, et(e.firstLine(), 0)) && (e.cantEdit = !1) } - e.display.selForContextMenu = null } - function Yr(e, t, n, o, r) { - var i; - o || (o = n), 0 > ge(o, n) && (i = [o, n], n = i[0], o = i[1]), 'string' == typeof t && (t = e.splitLines(t)), Wr(e, { + function mo(e, t, n, r, i) { + var o; + r || (r = n), tt(r, n) < 0 && (n = (o = [r, n])[0], r = o[1]), "string" == typeof t && (t = e.splitLines(t)), co(e, { from: n, - to: o, + to: r, text: t, - origin: r + origin: i }) } - function Xr(e, t, n, o) { - n < e.line ? e.line += o : t < e.line && (e.line = t, e.ch = 0) + function go(e, t, n, r) { + n < e.line ? e.line += r : t < e.line && (e.line = t, e.ch = 0) } - function Qr(e, t, n, o) { - for (var r = 0; r < e.length; ++r) { - var i = e[r], - a = !0; - if (i.ranges) { - i.copied || (i = e[r] = i.deepCopy(), i.copied = !0); - for (var s = 0; s < i.ranges.length; s++) Xr(i.ranges[s].anchor, t, n, o), Xr(i.ranges[s].head, t, n, o); - continue - } - for (var d = 0, l; d < i.changes.length; ++d) - if (l = i.changes[d], n < l.from.line) l.from = fe(l.from.line + o, l.from.ch), l.to = fe(l.to.line + o, l.to.ch); - else if (t <= l.to.line) { - a = !1; - break + function yo(e, t, n, r) { + for (var i = 0; i < e.length; ++i) { + var o = e[i], + s = !0; + if (o.ranges) { + o.copied || ((o = e[i] = o.deepCopy()).copied = !0); + for (var a = 0; a < o.ranges.length; a++) go(o.ranges[a].anchor, t, n, r), go(o.ranges[a].head, t, n, r) + } else { + for (var l = 0; l < o.changes.length; ++l) { + var c = o.changes[l]; + if (n < c.from.line) c.from = et(c.from.line + r, c.from.ch), c.to = et(c.to.line + r, c.to.ch); + else if (t <= c.to.line) { + s = !1; + break + } + } + s || (e.splice(0, i + 1), i = 0) } - a || (e.splice(0, r + 1), r = 0) } } - function $r(e, t) { + function vo(e, t) { var n = t.from.line, - o = t.to.line, - r = t.text.length - (o - n) - 1; - Qr(e.done, n, o, r), Qr(e.undone, n, o, r) + r = t.to.line, + i = t.text.length - (r - n) - 1; + yo(e.done, n, r, i), yo(e.undone, n, r, i) } - function Zr(e, t, n, o) { - var r = t, - i = t; - return ('number' == typeof t ? i = se(e, ve(e, t)) : r = pe(t), null == r) ? null : (o(i, r) && e.cm && Nn(e.cm, r, n), i) + function wo(e, t, n, r) { + var i = t, + o = t; + return "number" == typeof t ? o = $e(e, st(e, t)) : i = Qe(t), null == i ? null : (r(o, i) && e.cm && pr(e.cm, i, n), o) } - function Jr(e) { - var t = this; + function bo(e) { this.lines = e, this.parent = null; - for (var n = 0, o = 0; o < e.length; ++o) e[o].parent = t, n += e[o].height; - this.height = n + for (var t = 0, n = 0; n < e.length; ++n) e[n].parent = this, t += e[n].height; + this.height = t } - function ei(e) { - var t = this; + function So(e) { this.children = e; - for (var n = 0, o = 0, r = 0, i; r < e.length; ++r) i = e[r], n += i.chunkSize(), o += i.height, i.parent = t; - this.size = n, this.height = o, this.parent = null - } - - function ti(e, t, n) { - ct(t) < (e.curOp && e.curOp.scrollTop || e.doc.scrollTop) && io(e, n) - } - - function ni(e, t, n, o) { - var i = new Os(e, n, o), - a = e.cm; - return a && i.noHScroll && (a.display.alignWidgets = !0), Zr(e, t, 'widget', function (t) { - var n = t.widgets || (t.widgets = []); - if (null == i.insertAt ? n.push(i) : n.splice(d(n.length - 1, r(0, i.insertAt)), 0, i), i.line = t, a && !dt(e, t)) { - var o = ct(t) < e.scrollTop; - ce(t, t.height + Wt(i)), o && io(a, i.height), a.curOp.forceUpdate = !0 - } - return !0 - }), a && xt(a, 'lineWidgetAdded', a, i, 'number' == typeof t ? t : pe(t)), i - } - - function oi(e, t, n, o, r) { - if (o && o.shared) return ri(e, t, n, o, r); - if (e.cm && !e.cm.curOp) return xo(e.cm, oi)(e, t, n, o, r); - var a = new zs(e, r), - s = ge(t, n); - if (o && S(o, a, !1), 0 < s || 0 == s && !1 !== a.clearWhenEmpty) return a; - if (a.replacedWith && (a.collapsed = !0, a.widgetNode = u('span', [a.replacedWith], 'CodeMirror-widget'), !o.handleMouseEvents && a.widgetNode.setAttribute('cm-ignore-events', 'true'), o.insertLeft && (a.widgetNode.insertLeft = !0)), a.collapsed) { - if (nt(e, t.line, t, n, a) || t.line != n.line && nt(e, n.line, t, n, a)) throw new Error('Inserting collapsed marker partially overlapping an existing one'); - Ne() + for (var t = 0, n = 0, r = 0; r < e.length; ++r) { + var i = e[r]; + t += i.chunkSize(), n += i.height, i.parent = this } - a.addToHistory && gr(e, { - from: t, - to: n, - origin: 'markText' - }, e.sel, NaN); - var d = t.line, - l = e.cm, - c; - if (e.iter(d, n.line + 1, function (e) { - l && a.collapsed && !l.options.lineWrapping && ot(e) == l.display.maxLine && (c = !0), a.collapsed && d != t.line && ce(e, 0), Ue(e, new Oe(a, d == t.line ? t.ch : null, d == n.line ? n.ch : null)), ++d - }), a.collapsed && e.iter(t.line, n.line + 1, function (t) { - dt(e, t) && ce(t, 0) - }), a.clearOnEnter && as(a, 'beforeCursorEnter', function () { - return a.clear() - }), a.readOnly && (Be(), (e.history.done.length || e.history.undone.length) && e.clearHistory()), a.collapsed && (a.id = ++Hs, a.atomic = !0), l) { - if (c && (l.curOp.updateMaxLine = !0), a.collapsed) Bn(l, t.line, n.line + 1); - else if (a.className || a.startStyle || a.endStyle || a.css || a.attributes || a.title) - for (var p = t.line; p <= n.line; p++) Nn(l, p, 'text'); - a.atomic && Fr(l.doc), xt(l, 'markerAdded', l, a) - } - return a - } - - function ri(e, t, n, o, r) { - o = S(o), o.shared = !1; - var a = [oi(e, t, n, o, r)], - s = a[0], - d = o.widgetNode; - return dr(e, function (e) { - d && (o.widgetNode = d.cloneNode(!0)), a.push(oi(e, Ee(e, t), Ee(e, n), o, r)); - for (var l = 0; l < e.linked.length; ++l) - if (e.linked[l].isParent) return; - s = w(a) - }), new Us(a, s) - } - - function ii(e) { - return e.findMarks(fe(e.first, 0), e.clipPos(fe(e.lastLine())), function (e) { - return e.parent - }) + this.size = t, this.height = n, this.parent = null } - - function ai(e, t) { - for (var n = 0; n < t.length; n++) { - var o = t[n], - r = o.find(), - i = e.clipPos(r.from), - a = e.clipPos(r.to); - if (ge(i, a)) { - var s = oi(e, i, a, o.primary, o.primary.type); - o.markers.push(s), s.parent = o + Ei.prototype.from = function () { + return ot(this.anchor, this.head) + }, Ei.prototype.to = function () { + return it(this.anchor, this.head) + }, Ei.prototype.empty = function () { + return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch + }, bo.prototype = { + chunkSize: function () { + return this.lines.length + }, + removeInner: function (e, t) { + for (var n = e, r = e + t; n < r; ++n) { + var i = this.lines[n]; + this.height -= i.height, qt(i), ln(i, "delete") } + this.lines.splice(e, t) + }, + collapse: function (e) { + e.push.apply(e, this.lines) + }, + insertInner: function (e, t, n) { + this.height += n, this.lines = this.lines.slice(0, e).concat(t).concat(this.lines.slice(e)); + for (var r = 0; r < t.length; ++r) t[r].parent = this + }, + iterN: function (e, t, n) { + for (var r = e + t; e < r; ++e) + if (n(this.lines[e])) return !0 } - } - - function si(e) { - for (var t = function (t) { - var n = e[t], - o = [n.primary.doc]; - dr(n.primary.doc, function (e) { - return o.push(e) - }); - for (var r = 0, i; r < n.markers.length; r++) i = n.markers[r], -1 == b(o, i.doc) && (i.parent = null, n.markers.splice(r--, 1)) - }, n = 0; n < e.length; n++) t(n) - } - - function di(t) { - var e = this; - if (pi(e), !(z(e, t) || Vt(e.display, t))) { - G(t), Ra && (Gs = +new Date); - var o = Ln(e, t, !0), - r = t.dataTransfer.files; - if (o && !e.isReadOnly()) - if (r && r.length && window.FileReader && window.File) - for (var a = r.length, n = Array(a), s = 0, d = function (t, r) { - if (!(e.options.allowDropFileTypes && -1 == b(e.options.allowDropFileTypes, t.type))) { - var i = new FileReader; - i.onload = xo(e, function () { - var t = i.result; - if (/[\x00-\x08\x0e-\x1f]{2}/.test(t) && (t = ''), n[r] = t, ++s == a) { - o = Ee(e.doc, o); - var d = { - from: o, - to: o, - text: e.doc.splitLines(n.join(e.doc.lineSeparator())), - origin: 'paste' - }; - Wr(e.doc, d), Mr(e.doc, Zo(o, Jo(d))) - } - }), i.readAsText(t) - } - }, l = 0; l < a; ++l) d(r[l], l); - else { - if (e.state.draggingText && -1 < e.doc.sel.contains(o)) return e.state.draggingText(t), void setTimeout(function () { - return e.display.input.focus() - }, 20); - try { - var i = t.dataTransfer.getData('Text'); - if (i) { - var c; - if (e.state.draggingText && !e.state.draggingText.copy && (c = e.listSelections()), Ir(e.doc, Zo(o, o)), c) - for (var p = 0; p < c.length; ++p) Yr(e.doc, '', c[p].anchor, c[p].head, 'drag'); - e.replaceSelection(i, 'around', 'paste'), e.display.input.focus() + }, So.prototype = { + chunkSize: function () { + return this.size + }, + removeInner: function (e, t) { + this.size -= t; + for (var n = 0; n < this.children.length; ++n) { + var r = this.children[n], + i = r.chunkSize(); + if (e < i) { + var o = Math.min(t, i - e), + s = r.height; + if (r.removeInner(e, o), this.height -= s - r.height, i == o && (this.children.splice(n--, 1), r.parent = null), 0 == (t -= o)) break; + e = 0 + } else e -= i + } + if (this.size - t < 25 && (this.children.length > 1 || !(this.children[0] instanceof bo))) { + var a = []; + this.collapse(a), this.children = [new bo(a)], this.children[0].parent = this + } + }, + collapse: function (e) { + for (var t = 0; t < this.children.length; ++t) this.children[t].collapse(e) + }, + insertInner: function (e, t, n) { + this.size += t.length, this.height += n; + for (var r = 0; r < this.children.length; ++r) { + var i = this.children[r], + o = i.chunkSize(); + if (e <= o) { + if (i.insertInner(e, t, n), i.lines && i.lines.length > 50) { + for (var s = i.lines.length % 25 + 25, a = s; a < i.lines.length;) { + var l = new bo(i.lines.slice(a, a += 25)); + i.height -= l.height, this.children.splice(++r, 0, l), l.parent = this } - } catch (t) {} - } - } - } - - function li(t, n) { - if (Ra && (!t.state.draggingText || 100 > +new Date - Gs)) return void q(n); - if (!(z(t, n) || Vt(t.display, n)) && (n.dataTransfer.setData('Text', t.getSelection()), n.dataTransfer.effectAllowed = 'copyMove', n.dataTransfer.setDragImage && !Ia)) { - var e = p('img', null, null, 'position: fixed; left: 0; top: 0;'); - e.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==', Aa && (e.width = e.height = 1, t.display.wrapper.appendChild(e), e._top = e.offsetTop), n.dataTransfer.setDragImage(e, 0, 0), Aa && e.parentNode.removeChild(e) - } - } - - function ci(t, n) { - var e = Ln(t, n); - if (e) { - var o = document.createDocumentFragment(); - Gn(t, e, o), t.display.dragCursor || (t.display.dragCursor = p('div', null, 'CodeMirror-cursors CodeMirror-dragcursors'), t.display.lineSpace.insertBefore(t.display.dragCursor, t.display.cursorDiv)), c(t.display.dragCursor, o) - } - } - - function pi(e) { - e.display.dragCursor && (e.display.lineSpace.removeChild(e.display.dragCursor), e.display.dragCursor = null) - } - - function ui(e) { - if (document.getElementsByClassName) { - for (var t = document.getElementsByClassName('CodeMirror'), n = [], o = 0, r; o < t.length; o++) r = t[o].CodeMirror, r && n.push(r); - n.length && n[0].operation(function () { - for (var t = 0; t < n.length; t++) e(n[t]) - }) - } - } - - function mi() { - Ks || (hi(), Ks = !0) - } - - function hi() { - var e; - as(window, 'resize', function () { - null == e && (e = setTimeout(function () { - e = null, ui(fi) - }, 100)) - }), as(window, 'blur', function () { - return ui($n) - }) - } - - function fi(e) { - var t = e.display; - t.cachedCharWidth = t.cachedTextHeight = t.cachedPaddingH = null, t.scrollbarsClipped = !1, e.setSize() - } - - function gi(e) { - var t = e.split(/-(?!$)/); - e = t[t.length - 1]; - for (var n = 0, o, r, i, a, s; n < t.length - 1; n++) - if (s = t[n], /^(cmd|meta|m)$/i.test(s)) a = !0; - else if (/^a(lt)?$/i.test(s)) o = !0; - else if (/^(c|ctrl|control)$/i.test(s)) r = !0; - else if (/^s(hift)?$/i.test(s)) i = !0; - else throw new Error('Unrecognized modifier name: ' + s); - return o && (e = 'Alt-' + e), r && (e = 'Ctrl-' + e), a && (e = 'Cmd-' + e), i && (e = 'Shift-' + e), e - } - - function yi(e) { - var t = {}; - for (var n in e) - if (e.hasOwnProperty(n)) { - var o = e[n]; - if (/^(name|fallthrough|(de|at)tach)$/.test(n)) continue; - if ('...' == o) { - delete e[n]; - continue - } - for (var r = k(n.split(' '), gi), a = 0; a < r.length; a++) { - var i = void 0, - s = void 0; - a == r.length - 1 ? (s = r.join(' '), i = o) : (s = r.slice(0, a + 1).join(' '), i = '...'); - var d = t[s]; - if (!d) t[s] = i; - else if (d != i) throw new Error('Inconsistent bindings for ' + s) - } - delete e[n] - } for (var l in t) e[l] = t[l]; - return e - } - - function Si(e, t, n, o) { - t = Ei(t); - var r = t.call ? t.call(e, o) : t[e]; - if (!1 === r) return 'nothing'; - if ('...' === r) return 'multi'; - if (null != r && n(r)) return 'handled'; - if (t.fallthrough) { - if ('[object Array]' != Object.prototype.toString.call(t.fallthrough)) return Si(e, t.fallthrough, n, o); - for (var a = 0, i; a < t.fallthrough.length; a++) - if (i = Si(e, t.fallthrough[a], n, o), i) return i - } - } - - function Ci(e) { - var t = 'string' == typeof e ? e : js[e.keyCode]; - return 'Ctrl' == t || 'Alt' == t || 'Shift' == t || 'Mod' == t - } - - function bi(e, t, n) { - var o = e; - return t.altKey && 'Alt' != o && (e = 'Alt-' + e), (Va ? t.metaKey : t.ctrlKey) && 'Ctrl' != o && (e = 'Ctrl-' + e), (Va ? t.ctrlKey : t.metaKey) && 'Cmd' != o && (e = 'Cmd-' + e), !n && t.shiftKey && 'Shift' != o && (e = 'Shift-' + e), e - } - - function vi(e, t) { - if (Aa && 34 == e.keyCode && e.char) return !1; - var n = js[e.keyCode]; - return !(null == n || e.altGraphKey) && (3 == e.keyCode && e.code && (n = e.code), bi(n, e, t)) - } - - function Ei(e) { - return 'string' == typeof e ? Xs[e] : e - } - - function wi(e, t) { - for (var n = e.doc.sel.ranges, o = [], r = 0, i; r < n.length; r++) { - for (i = t(n[r]); o.length && 0 >= ge(i.from, w(o).to);) { - var a = o.pop(); - if (0 > ge(a.from, i.from)) { - i.from = a.from; + i.lines = i.lines.slice(0, s), this.maybeSpill() + } break } + e -= o } - o.push(i) - } - Ro(e, function () { - for (var t = o.length - 1; 0 <= t; t--) Yr(e.doc, '', o[t].from, o[t].to, '+delete'); - ao(e) - }) - } - - function ki(e, t, n) { - var o = A(e.text, t + n, n); - return 0 > o || o > e.text.length ? null : o - } - - function Ti(e, t, n) { - var o = ki(e, t.ch, n); - return null == o ? null : new fe(t.line, o, 0 > n ? 'after' : 'before') - } - - function _i(e, t, n, o, r) { - if (e) { - var i = B(n, t.doc.direction); - if (i) { - var a = 0 > r ? w(i) : i[0], - s = 0 > r == (1 == a.level), - d = s ? 'after' : 'before', - l; - if (0 < a.level || 'rtl' == t.doc.direction) { - var c = tn(t, n); - l = 0 > r ? n.text.length - 1 : 0; - var p = nn(t, c, l).top; - l = I(function (e) { - return nn(t, c, e).top == p - }, 0 > r == (1 == a.level) ? a.from : a.to - 1, l), 'before' == d && (l = ki(n, l, 1)) - } else l = 0 > r ? a.to : a.from; - return new fe(o, l, d) - } - } - return new fe(o, 0 > r ? n.text.length : 0, 0 > r ? 'before' : 'after') - } - - function Ri(e, t, n, o) { - var r = B(t, e.doc.direction); - if (!r) return Ti(t, n, o); - n.ch >= t.text.length ? (n.ch = t.text.length, n.sticky = 'before') : 0 >= n.ch && (n.ch = 0, n.sticky = 'after'); - var i = F(r, n.ch, n.sticky), - a = r[i]; - if ('ltr' == e.doc.direction && 0 == a.level % 2 && (0 < o ? a.to > n.ch : a.from < n.ch)) return Ti(t, n, o); - var s = function (e, n) { - return ki(t, e instanceof fe ? e.ch : e, n) - }, - d = function (n) { - return e.options.lineWrapping ? (c = c || tn(e, t), wn(e, t, c, n)) : { - begin: 0, - end: t.text.length - } - }, - l = d('before' == n.sticky ? s(n, -1) : n.ch), - c; - if ('rtl' == e.doc.direction || 1 == a.level) { - var p = 1 == a.level == 0 > o, - u = s(n, p ? 1 : -1); - if (null != u && (p ? u <= a.to && u <= l.end : u >= a.from && u >= l.begin)) { - var m = p ? 'before' : 'after'; - return new fe(n.line, u, m) - } - } - var h = function (e, t, o) { - for (var i = function (e, t) { - return t ? new fe(n.line, s(e, 1), 'before') : new fe(n.line, e, 'after') - }; 0 <= e && e < r.length; e += t) { - var a = r[e], - d = 0 < t == (1 != a.level), - l = d ? o.begin : s(o.end, -1); - if (a.from <= l && l < a.to) return i(l, d); - if (l = d ? a.from : s(a.to, -1), o.begin <= l && l < o.end) return i(l, d) - } - }, - f = h(i + o, o, l); - if (f) return f; - var g = 0 < o ? l.end : s(l.begin, -1); - return null != g && !(0 < o && g == t.text.length) && (f = h(0 < o ? 0 : r.length - 1, o, d(g)), f) ? f : null - } - - function xi(e, t) { - var n = se(e.doc, t), - o = ot(n); - return o != n && (t = pe(o)), _i(!0, e, o, t, 1) - } - - function Pi(e, t) { - var n = se(e.doc, t), - o = rt(n); - return o != n && (t = pe(o)), _i(!0, e, n, t, -1) - } - - function Di(e, t) { - var n = xi(e, t.line), - o = se(e.doc, n.line), - i = B(o, e.doc.direction); - if (!i || 0 == i[0].level) { - var a = r(0, o.text.search(/\S/)), - s = t.line == n.line && t.ch <= a && t.ch; - return fe(n.line, s ? 0 : a, n.sticky) - } - return n - } - - function Mi(e, t, n) { - if ('string' == typeof t && (t = Qs[t], !t)) return !1; - e.display.input.ensurePolled(); - var o = e.display.shift, - r = !1; - try { - e.isReadOnly() && (e.state.suppressEdits = !0), n && (e.display.shift = !1), r = t(e) != Qa - } finally { - e.display.shift = o, e.state.suppressEdits = !1 - } - return r - } - - function Ai(e, t, n) { - for (var o = 0, r; o < e.state.keyMaps.length; o++) - if (r = Si(t, e.state.keyMaps[o], n, e), r) return r; - return e.options.extraKeys && Si(t, e.options.extraKeys, n, e) || Si(t, e.options.keyMap, n, e) - } - - function Ii(t, n, o, e) { - var r = t.state.keySeq; - if (r) { - if (Ci(n)) return 'handled'; - if (/\'$/.test(n) ? t.state.keySeq = null : $s.set(50, function () { - t.state.keySeq == r && (t.state.keySeq = null, t.display.input.reset()) - }), Li(t, r + ' ' + n, o, e)) return !0 - } - return Li(t, n, o, e) - } - - function Li(t, n, o, e) { - var r = Ai(t, n, e); - return 'multi' == r && (t.state.keySeq = n), 'handled' == r && xt(t, 'keyHandled', t, n, o), ('handled' == r || 'multi' == r) && (G(o), qn(t)), !!r - } - - function Fi(t, n) { - var e = vi(n, !0); - return !!e && (n.shiftKey && !t.state.keySeq ? Ii(t, 'Shift-' + e, n, function (e) { - return Mi(t, e, !0) - }) || Ii(t, e, n, function (e) { - if ('string' == typeof e ? /^go[A-Z]/.test(e) : e.motion) return Mi(t, e) - }) : Ii(t, e, n, function (e) { - return Mi(t, e) - })) - } - - function Bi(t, n, e) { - return Ii(t, '\'' + e + '\'', n, function (e) { - return Mi(t, e, !0) - }) - } - - function Ni(t) { - var e = this; - if (e.curOp.focus = h(), !z(e, t)) { - Ra && 11 > xa && 27 == t.keyCode && (t.returnValue = !1); - var n = t.keyCode; - e.display.shift = 16 == n || t.shiftKey; - var o = Fi(e, t); - Aa && (Zs = o ? n : null, !o && 88 == n && !ls && (Ha ? t.metaKey : t.ctrlKey) && e.replaceSelection('', null, 'cut')), 18 != n || /\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className) || Oi(e) - } - } - - function Oi(e) { - function t(o) { - 18 != o.keyCode && o.altKey || (Ka(n, 'CodeMirror-crosshair'), O(document, 'keyup', t), O(document, 'mouseover', t)) - } - var n = e.display.lineDiv; - f(n, 'CodeMirror-crosshair'), as(document, 'keyup', t), as(document, 'mouseover', t) - } - - function Hi(t) { - 16 == t.keyCode && (this.doc.sel.shift = !1), z(this, t) - } - - function zi(n) { - var e = this; - if (!(Vt(e.display, n) || z(e, n) || n.ctrlKey && !n.altKey || Ha && n.metaKey)) { - var o = n.keyCode, - r = n.charCode; - if (Aa && o == Zs) return Zs = null, void G(n); - if (!(Aa && (!n.which || 10 > n.which) && Fi(e, n))) { - var i = t(null == r ? o : r); - '\b' == i || Bi(e, n, i) || e.display.input.onKeyPress(n) + }, + maybeSpill: function () { + if (!(this.children.length <= 10)) { + var e = this; + do { + var t = new So(e.children.splice(e.children.length - 5, 5)); + if (e.parent) { + e.size -= t.size, e.height -= t.height; + var n = z(e.parent.children, e); + e.parent.children.splice(n + 1, 0, t) + } else { + var r = new So(e.children); + r.parent = e, e.children = [r, t], e = r + } + t.parent = e.parent + } while (e.children.length > 10); + e.parent.maybeSpill() } - } - } - - function Ui(e, t) { - var n = +new Date; - return rd && rd.compare(n, e, t) ? (od = rd = null, 'triple') : od && od.compare(n, e, t) ? (rd = new Js(n, e, t), od = null, 'double') : (od = new Js(n, e, t), rd = null, 'single') - } - - function Wi(t) { - var e = this, - n = e.display; - if (!(z(e, t) || n.activeTouch && n.input.supportsTouch())) { - if (n.input.ensurePolled(), n.shift = t.shiftKey, Vt(n, t)) return void(Pa || (n.scroller.draggable = !1, setTimeout(function () { - return n.scroller.draggable = !0 - }, 100))); - if (!$i(e, t)) { - var o = Ln(e, t), - r = X(t), - i = o ? Ui(o, r) : 'single'; - window.focus(), 1 == r && e.state.selectingText && e.state.selectingText(t), o && Vi(e, r, o, i, t) || (1 == r ? o ? Ki(e, o, i, t) : Y(t) == n.scroller && G(t) : 2 == r ? (o && _r(e.doc, o), setTimeout(function () { - return n.input.focus() - }, 20)) : 3 == r && (Ga ? e.display.input.onContextMenu(t) : Xn(e))) + }, + iterN: function (e, t, n) { + for (var r = 0; r < this.children.length; ++r) { + var i = this.children[r], + o = i.chunkSize(); + if (e < o) { + var s = Math.min(t, o - e); + if (i.iterN(e, s, n)) return !0; + if (0 == (t -= s)) break; + e = 0 + } else e -= o } } - } + }; + var Co = function (e, t, n) { + if (n) + for (var r in n) n.hasOwnProperty(r) && (this[r] = n[r]); + this.doc = e, this.node = t + }; - function Vi(e, t, n, o, r) { - var i = 'Click'; - return 'double' == o ? i = 'Double' + i : 'triple' == o && (i = 'Triple' + i), i = (1 == t ? 'Left' : 2 == t ? 'Middle' : 'Right') + i, Ii(e, bi(i, r), r, function (t) { - if ('string' == typeof t && (t = Qs[t]), !t) return !1; - var o = !1; - try { - e.isReadOnly() && (e.state.suppressEdits = !0), o = t(e, n) != Qa - } finally { - e.state.suppressEdits = !1 - } - return o - }) - } + function Eo(e, t, n) { + Vt(t) < (e.curOp && e.curOp.scrollTop || e.doc.scrollTop) && Ar(e, n) + } + Co.prototype.clear = function () { + var e = this.doc.cm, + t = this.line.widgets, + n = this.line, + r = Qe(n); + if (null != r && t) { + for (var i = 0; i < t.length; ++i) t[i] == this && t.splice(i--, 1); + t.length || (n.widgets = null); + var o = Sn(this); + Ye(n, Math.max(0, n.height - o)), e && (Jr(e, (function () { + Eo(e, n, -o), pr(e, r, "widget") + })), ln(e, "lineWidgetCleared", e, this, r)) + } + }, Co.prototype.changed = function () { + var e = this, + t = this.height, + n = this.doc.cm, + r = this.line; + this.height = null; + var i = Sn(this) - t; + i && (Ut(this.doc, r) || Ye(r, r.height + i), n && Jr(n, (function () { + n.curOp.forceUpdate = !0, Eo(n, r, i), ln(n, "lineWidgetChanged", n, e, Qe(r)) + }))) + }, ve(Co); + var ko = 0, + xo = function (e, t) { + this.lines = [], this.type = t, this.doc = e, this.id = ++ko + }; - function Gi(e, t, n) { - var o = e.getOption('configureMouse'), - r = o ? o(e, t, n) : {}; - if (null == r.unit) { - var i = za ? n.shiftKey && n.metaKey : n.altKey; - r.unit = i ? 'rectangle' : 'single' == t ? 'char' : 'double' == t ? 'word' : 'line' + function To(e, t, n, r, i) { + if (r && r.shared) return function (e, t, n, r, i) { + (r = F(r)).shared = !1; + var o = [To(e, t, n, r, i)], + s = o[0], + a = r.widgetNode; + return Oi(e, (function (e) { + a && (r.widgetNode = a.cloneNode(!0)), o.push(To(e, at(e, t), at(e, n), r, i)); + for (var l = 0; l < e.linked.length; ++l) + if (e.linked[l].isParent) return; + s = K(o) + })), new Ro(o, s) + }(e, t, n, r, i); + if (e.cm && !e.cm.curOp) return ei(e.cm, To)(e, t, n, r, i); + var o = new xo(e, i), + s = tt(t, n); + if (r && F(r, o, !1), s > 0 || 0 == s && !1 !== o.clearWhenEmpty) return o; + if (o.replacedWith && (o.collapsed = !0, o.widgetNode = A("span", [o.replacedWith], "CodeMirror-widget"), r.handleMouseEvents || o.widgetNode.setAttribute("cm-ignore-events", "true"), r.insertLeft && (o.widgetNode.insertLeft = !0)), o.collapsed) { + if (Ft(e, t.line, t, n, o) || t.line != n.line && Ft(e, n.line, t, n, o)) throw new Error("Inserting collapsed marker partially overlapping an existing one"); + Ct = !0 + } + o.addToHistory && zi(e, { + from: t, + to: n, + origin: "markText" + }, e.sel, NaN); + var a, l = t.line, + c = e.cm; + if (e.iter(l, n.line + 1, (function (e) { + c && o.collapsed && !c.options.lineWrapping && Bt(e) == c.display.maxLine && (a = !0), o.collapsed && l != t.line && Ye(e, 0), + function (e, t) { + e.markedSpans = e.markedSpans ? e.markedSpans.concat([t]) : [t], t.marker.attachLine(e) + }(e, new Et(o, l == t.line ? t.ch : null, l == n.line ? n.ch : null)), ++l + })), o.collapsed && e.iter(t.line, n.line + 1, (function (t) { + Ut(e, t) && Ye(t, 0) + })), o.clearOnEnter && he(o, "beforeCursorEnter", (function () { + return o.clear() + })), o.readOnly && (St = !0, (e.history.done.length || e.history.undone.length) && e.clearHistory()), o.collapsed && (o.id = ++ko, o.atomic = !0), c) { + if (a && (c.curOp.updateMaxLine = !0), o.collapsed) hr(c, t.line, n.line + 1); + else if (o.className || o.startStyle || o.endStyle || o.css || o.attributes || o.title) + for (var u = t.line; u <= n.line; u++) pr(c, u, "text"); + o.atomic && no(c.doc), ln(c, "markerAdded", c, o) } - return (null == r.extend || e.doc.extend) && (r.extend = e.doc.extend || n.shiftKey), null == r.addNew && (r.addNew = Ha ? n.metaKey : n.ctrlKey), null == r.moveOnDrag && (r.moveOnDrag = Ha ? !n.altKey : !n.ctrlKey), r - } - - function Ki(e, t, n, o) { - Ra ? setTimeout(y(Yn, e), 0) : e.curOp.focus = h(); - var r = Gi(e, n, o), - i = e.doc.sel, - a; - e.options.dragDrop && on && !e.isReadOnly() && 'single' == n && -1 < (a = i.contains(t)) && (0 > ge((a = i.ranges[a]).from(), t) || 0 < t.xRel) && (0 < ge(a.to(), t) || 0 > t.xRel) ? ji(e, o, t, r) : Yi(e, o, t, r) - } - - function ji(t, e, n, r) { - var i = t.display, - a = !1, - s = xo(t, function (o) { - Pa && (i.scroller.draggable = !1), t.state.draggingText = !1, O(i.wrapper.ownerDocument, 'mouseup', s), O(i.wrapper.ownerDocument, 'mousemove', d), O(i.scroller, 'dragstart', l), O(i.scroller, 'drop', s), a || (G(o), !r.addNew && _r(t.doc, n, null, null, r.extend), Pa || Ra && 9 == xa ? setTimeout(function () { - i.wrapper.ownerDocument.body.focus(), i.input.focus() - }, 20) : i.input.focus()) - }), - d = function (t) { - a = a || 10 <= o(e.clientX - t.clientX) + o(e.clientY - t.clientY) - }, - l = function () { - return a = !0 - }; - Pa && (i.scroller.draggable = !0), t.state.draggingText = s, s.copy = !r.moveOnDrag, i.scroller.dragDrop && i.scroller.dragDrop(), as(i.wrapper.ownerDocument, 'mouseup', s), as(i.wrapper.ownerDocument, 'mousemove', d), as(i.scroller, 'dragstart', l), as(i.scroller, 'drop', s), Xn(t), setTimeout(function () { - return i.input.focus() - }, 20) - } - - function qi(e, t, n) { - if ('char' == n) return new Ns(t, t); - if ('word' == n) return e.findWordAt(t); - if ('line' == n) return new Ns(fe(t.line, 0), Ee(e.doc, fe(t.line + 1, 0))); - var o = n(e, t); - return new Ns(o.from, o.to) + return o } - - function Yi(t, e, n, o) { - function i(e) { - if (0 != ge(y, e)) - if (y = e, 'rectangle' == o.unit) { - for (var i = [], a = t.options.tabSize, s = C(se(c, n.line).text, n.ch, a), l = C(se(c, e.line).text, e.ch, a), u = d(s, l), h = r(s, l), g = d(n.line, e.line), S = d(t.lastLine(), r(n.line, e.line)); g <= S; g++) { - var b = se(c, g).text, - E = v(b, u, a); - u == h ? i.push(new Ns(fe(g, E), fe(g, E))) : b.length > E && i.push(new Ns(fe(g, E), fe(g, v(b, h, a)))) - } - i.length || i.push(new Ns(n, n)), Ar(c, $o(t, p.ranges.slice(0, f).concat(i), f), { - origin: '*mouse', - scroll: !1 - }), t.scrollIntoView(e) - } else { - var w = m, - k = qi(t, e, o.unit), - T = w.anchor, - _; - 0 < ge(k.anchor, T) ? (_ = k.head, T = be(w.from(), k.anchor)) : (_ = k.anchor, T = Ce(w.to(), k.head)); - var R = p.ranges.slice(0); - R[f] = Xi(t, new Ns(Ee(c, T), _)), Ar(c, $o(t, R, f), Za) - } - } - - function a(n) { - var e = ++b, - r = Ln(t, n, !0, 'rectangle' == o.unit); - if (r) - if (0 != ge(r, y)) { - t.curOp.focus = h(), i(r); - var s = eo(l, c); - (r.line >= s.to || r.line < s.from) && setTimeout(xo(t, function () { - b == e && a(n) - }), 150) - } else { - var d = n.clientY < S.top ? -20 : n.clientY > S.bottom ? 20 : 0; - d && setTimeout(xo(t, function () { - b != e || (l.scroller.scrollTop += d, a(n)) - }), 50) + xo.prototype.clear = function () { + if (!this.explicitlyCleared) { + var e = this.doc.cm, + t = e && !e.curOp; + if (t && $r(e), ye(this, "clear")) { + var n = this.find(); + n && ln(this, "clear", n.from, n.to) + } + for (var r = null, i = null, o = 0; o < this.lines.length; ++o) { + var s = this.lines[o], + a = kt(s.markedSpans, this); + e && !this.collapsed ? pr(e, Qe(s), "text") : e && (null != a.to && (i = Qe(s)), null != a.from && (r = Qe(s))), s.markedSpans = xt(s.markedSpans, a), null == a.from && this.collapsed && !Ut(this.doc, s) && e && Ye(s, rr(e.display)) + } + if (e && this.collapsed && !e.options.lineWrapping) + for (var l = 0; l < this.lines.length; ++l) { + var c = Bt(this.lines[l]), + u = jt(c); + u > e.display.maxLineLength && (e.display.maxLine = c, e.display.maxLineLength = u, e.display.maxLineChanged = !0) } + null != r && e && this.collapsed && hr(e, r, i + 1), this.lines.length = 0, this.explicitlyCleared = !0, this.atomic && this.doc.cantEdit && (this.doc.cantEdit = !1, e && no(e.doc)), e && ln(e, "markerCleared", e, this, r, i), t && qr(e), this.parent && this.parent.clear() + } + }, xo.prototype.find = function (e, t) { + var n, r; + null == e && "bookmark" == this.type && (e = 1); + for (var i = 0; i < this.lines.length; ++i) { + var o = this.lines[i], + s = kt(o.markedSpans, this); + if (null != s.from && (n = et(t ? o : Qe(o), s.from), -1 == e)) return n; + if (null != s.to && (r = et(t ? o : Qe(o), s.to), 1 == e)) return r + } + return n && { + from: n, + to: r } - - function s(n) { - t.state.selectingText = !1, b = Infinity, n && (G(n), l.input.focus()), O(l.wrapper.ownerDocument, 'mousemove', E), O(l.wrapper.ownerDocument, 'mouseup', w), c.history.lastSelOrigin = null - } - var l = t.display, - c = t.doc; - G(e); - var p = c.sel, - u = p.ranges, - m, f; - if (o.addNew && !o.extend ? (f = c.sel.contains(n), m = -1 < f ? u[f] : new Ns(n, n)) : (m = c.sel.primary(), f = c.sel.primIndex), 'rectangle' == o.unit) o.addNew || (m = new Ns(n, n)), n = Ln(t, e, !0, !0), f = -1; - else { - var g = qi(t, n, o.unit); - m = o.extend ? Tr(m, g.anchor, g.head, o.extend) : g - } - o.addNew ? -1 == f ? (f = u.length, Ar(c, $o(t, u.concat([m]), f), { - scroll: !1, - origin: '*mouse' - })) : 1 < u.length && u[f].empty() && 'char' == o.unit && !o.extend ? (Ar(c, $o(t, u.slice(0, f).concat(u.slice(f + 1)), 0), { - scroll: !1, - origin: '*mouse' - }), p = c.sel) : xr(c, f, m, Za) : (f = 0, Ar(c, new Bs([m], 0), Za), p = c.sel); - var y = n, - S = l.wrapper.getBoundingClientRect(), - b = 0, - E = xo(t, function (t) { - 0 !== t.buttons && X(t) ? a(t) : s(t) - }), - w = xo(t, s); - t.state.selectingText = w, as(l.wrapper.ownerDocument, 'mousemove', E), as(l.wrapper.ownerDocument, 'mouseup', w) - } - - function Xi(e, t) { - var n = t.anchor, - o = t.head, - r = se(e.doc, n.line); - if (0 == ge(n, o) && n.sticky == o.sticky) return t; - var i = B(r); - if (!i) return t; - var a = F(i, n.ch, n.sticky), - s = i[a]; - if (s.from != n.ch && s.to != n.ch) return t; - var d = a + (s.from == n.ch == (1 != s.level) ? 0 : 1); - if (0 == d || d == i.length) return t; - var l; - if (o.line != n.line) l = 0 < (o.line - n.line) * ('ltr' == e.doc.direction ? 1 : -1); - else { - var c = F(i, o.ch, o.sticky), - p = c - a || (o.ch - n.ch) * (1 == s.level ? -1 : 1); - l = c == d - 1 || c == d ? 0 > p : 0 < p + }, xo.prototype.changed = function () { + var e = this, + t = this.find(-1, !0), + n = this, + r = this.doc.cm; + t && r && Jr(r, (function () { + var i = t.line, + o = Qe(t.line), + s = Mn(r, o); + if (s && (Bn(s), r.curOp.selectionChanged = r.curOp.forceUpdate = !0), r.curOp.updateMaxLine = !0, !Ut(n.doc, i) && null != n.height) { + var a = n.height; + n.height = null; + var l = Sn(n) - a; + l && Ye(i, i.height + l) + } + ln(r, "markerChanged", r, e) + })) + }, xo.prototype.attachLine = function (e) { + if (!this.lines.length && this.doc.cm) { + var t = this.doc.cm.curOp; + t.maybeHiddenMarkers && -1 != z(t.maybeHiddenMarkers, this) || (t.maybeUnhiddenMarkers || (t.maybeUnhiddenMarkers = [])).push(this) } - var u = i[d + (l ? -1 : 0)], - m = l == (1 == u.level), - h = m ? u.from : u.to, - f = m ? 'after' : 'before'; - return n.ch == h && n.sticky == f ? t : new Ns(new fe(n.line, h, f), o) - } - - function Qi(t, n, e, o) { - var r, s; - if (n.touches) r = n.touches[0].clientX, s = n.touches[0].clientY; - else try { - r = n.clientX, s = n.clientY - } catch (t) { - return !1 + this.lines.push(e) + }, xo.prototype.detachLine = function (e) { + if (this.lines.splice(z(this.lines, e), 1), !this.lines.length && this.doc.cm) { + var t = this.doc.cm.curOp; + (t.maybeHiddenMarkers || (t.maybeHiddenMarkers = [])).push(this) } - if (r >= a(t.display.gutters.getBoundingClientRect().right)) return !1; - o && G(n); - var d = t.display, - l = d.lineDiv.getBoundingClientRect(); - if (s > l.bottom || !W(t, e)) return j(n); - s -= l.top - d.viewOffset; - for (var c = 0, i; c < t.display.gutterSpecs.length; ++c) - if (i = d.gutters.childNodes[c], i && i.getBoundingClientRect().right >= r) { - var p = ue(t.doc, s), - u = t.display.gutterSpecs[c]; - return H(t, e, t, p, u.className, n), j(n) - } - } - - function $i(t, n) { - return Qi(t, n, 'gutterClick', !0) - } - - function Zi(t, n) { - Vt(t.display, n) || Ji(t, n) || z(t, n, 'contextmenu') || !Ga && t.display.input.onContextMenu(n) - } - - function Ji(t, n) { - return !!W(t, 'gutterContextMenu') && Qi(t, n, 'gutterContextMenu', !1) - } - - function ea(e) { - e.display.wrapper.className = e.display.wrapper.className.replace(/\s*cm-s-\S+/g, '') + e.options.theme.replace(/(^|\s)\s*/g, ' cm-s-'), pn(e) - } + }, ve(xo); + var Ro = function (e, t) { + this.markers = e, this.primary = t; + for (var n = 0; n < e.length; ++n) e[n].parent = this + }; - function ta(e, t, n) { - if (!t != !(n && n != ed)) { - var o = e.display.dragFunctions, - r = t ? as : O; - r(e.display.scroller, 'dragstart', o.start), r(e.display.scroller, 'dragenter', o.enter), r(e.display.scroller, 'dragover', o.over), r(e.display.scroller, 'dragleave', o.leave), r(e.display.scroller, 'drop', o.drop) - } + function Do(e) { + return e.findMarks(et(e.first, 0), e.clipPos(et(e.lastLine())), (function (e) { + return e.parent + })) } - function na(e) { - e.options.lineWrapping ? (f(e.display.wrapper, 'CodeMirror-wrap'), e.display.sizer.style.minWidth = '', e.display.sizerWidth = null) : (Ka(e.display.wrapper, 'CodeMirror-wrap'), ut(e)), In(e), Bn(e), pn(e), setTimeout(function () { - return go(e) - }, 100) + function _o(e) { + for (var t = function (t) { + var n = e[t], + r = [n.primary.doc]; + Oi(n.primary.doc, (function (e) { + return r.push(e) + })); + for (var i = 0; i < n.markers.length; i++) { + var o = n.markers[i]; - 1 == z(r, o.doc) && (o.parent = null, n.markers.splice(i--, 1)) + } + }, n = 0; n < e.length; n++) t(n) } - - function oa(e, t) { - var n = this; - if (!(this instanceof oa)) return new oa(e, t); - this.options = t = t ? S(t) : {}, S(td, t, !1); - var o = t.value; - 'string' == typeof o ? o = new Vs(o, t.mode, null, t.lineSeparator, t.direction) : t.mode && (o.modeOption = t.mode), this.doc = o; - var r = new oa.inputStyles[t.inputStyle](this), - a = this.display = new qo(e, o, r, t); - for (var s in a.wrapper.CodeMirror = this, ea(this), t.lineWrapping && (this.display.wrapper.className += ' CodeMirror-wrap'), So(this), this.state = { - keyMaps: [], - overlays: [], - modeGen: 0, - overwrite: !1, - delayingBlurEvent: !1, - focused: !1, - suppressEdits: !1, - pasteIncoming: -1, - cutIncoming: -1, - selectingText: !1, - draggingText: !1, - highlight: new Ya, - keySeq: null, - specialChars: null - }, t.autofocus && !Oa && a.input.focus(), Ra && 11 > xa && setTimeout(function () { - return n.display.input.reset(!0) - }, 20), ra(this), mi(), Co(this), this.curOp.forceUpdate = !0, lr(this, o), t.autofocus && !Oa || this.hasFocus() ? setTimeout(y(Qn, this), 20) : $n(this), nd) nd.hasOwnProperty(s) && nd[s](n, t[s], ed); - Vo(this), t.finishInit && t.finishInit(this); - for (var d = 0; d < id.length; ++d) id[d](n); - bo(this), Pa && t.lineWrapping && 'optimizelegibility' == getComputedStyle(a.lineDiv).textRendering && (a.lineDiv.style.textRendering = 'auto') - } - - function ra(t) { - function n() { - i.activeTouch && (s = setTimeout(function () { - return i.activeTouch = null - }, 1e3), a = i.activeTouch, a.end = +new Date) + Ro.prototype.clear = function () { + if (!this.explicitlyCleared) { + this.explicitlyCleared = !0; + for (var e = 0; e < this.markers.length; ++e) this.markers[e].clear(); + ln(this, "clear") } - - function o(t) { - if (1 != t.touches.length) return !1; - var e = t.touches[0]; - return 1 >= e.radiusX && 1 >= e.radiusY - } - - function r(e, t) { - if (null == t.left) return !0; - var n = t.left - e.left, - o = t.top - e.top; - return 400 < n * n + o * o - } - var i = t.display; - as(i.scroller, 'mousedown', xo(t, Wi)), Ra && 11 > xa ? as(i.scroller, 'dblclick', xo(t, function (n) { - if (!z(t, n)) { - var e = Ln(t, n); - if (!(!e || $i(t, n) || Vt(t.display, n))) { - G(n); - var o = t.findWordAt(e); - _r(t.doc, o.anchor, o.head) + }, Ro.prototype.find = function (e, t) { + return this.primary.find(e, t) + }, ve(Ro); + var Ao = 0, + Mo = function (e, t, n, r, i) { + if (!(this instanceof Mo)) return new Mo(e, t, n, r, i); + null == n && (n = 0), So.call(this, [new bo([new $t("", null)])]), this.first = n, this.scrollTop = this.scrollLeft = 0, this.cantEdit = !1, this.cleanGeneration = 1, this.modeFrontier = this.highlightFrontier = n; + var o = et(n, 0); + this.sel = xi(o), this.history = new Fi(null), this.id = ++Ao, this.modeOption = t, this.lineSep = r, this.direction = "rtl" == i ? "rtl" : "ltr", this.extend = !1, "string" == typeof e && (e = this.splitLines(e)), Ii(this, { + from: o, + to: o, + text: e + }), Ji(this, xi(o), W) + }; + Mo.prototype = Z(So.prototype, { + constructor: Mo, + iter: function (e, t, n) { + n ? this.iterN(e - this.first, t - e, n) : this.iterN(this.first, this.first + this.size, e) + }, + insert: function (e, t) { + for (var n = 0, r = 0; r < t.length; ++r) n += t[r].height; + this.insertInner(e - this.first, t, n) + }, + remove: function (e, t) { + this.removeInner(e - this.first, t) + }, + getValue: function (e) { + var t = Ke(this, this.first, this.first + this.size); + return !1 === e ? t : t.join(e || this.lineSeparator()) + }, + setValue: ni((function (e) { + var t = et(this.first, 0), + n = this.first + this.size - 1; + co(this, { + from: t, + to: et(n, $e(this, n).text.length), + text: this.splitLines(e), + origin: "setValue", + full: !0 + }, !0), this.cm && Pr(this.cm, 0, 0), Ji(this, xi(t), W) + })), + replaceRange: function (e, t, n, r) { + mo(this, e, t = at(this, t), n = n ? at(this, n) : t, r) + }, + getRange: function (e, t, n) { + var r = qe(this, at(this, e), at(this, t)); + return !1 === n ? r : r.join(n || this.lineSeparator()) + }, + getLine: function (e) { + var t = this.getLineHandle(e); + return t && t.text + }, + getLineHandle: function (e) { + if (Xe(this, e)) return $e(this, e) + }, + getLineNumber: function (e) { + return Qe(e) + }, + getLineHandleVisualStart: function (e) { + return "number" == typeof e && (e = $e(this, e)), Bt(e) + }, + lineCount: function () { + return this.size + }, + firstLine: function () { + return this.first + }, + lastLine: function () { + return this.first + this.size - 1 + }, + clipPos: function (e) { + return at(this, e) + }, + getCursor: function (e) { + var t = this.sel.primary(); + return null == e || "head" == e ? t.head : "anchor" == e ? t.anchor : "end" == e || "to" == e || !1 === e ? t.to() : t.from() + }, + listSelections: function () { + return this.sel.ranges + }, + somethingSelected: function () { + return this.sel.somethingSelected() + }, + setCursor: ni((function (e, t, n) { + Zi(this, at(this, "number" == typeof e ? et(e, t || 0) : e), null, n) + })), + setSelection: ni((function (e, t, n) { + Zi(this, at(this, e), at(this, t || e), n) + })), + extendSelection: ni((function (e, t, n) { + Ki(this, at(this, e), t && at(this, t), n) + })), + extendSelections: ni((function (e, t) { + Yi(this, lt(this, e), t) + })), + extendSelectionsBy: ni((function (e, t) { + Yi(this, lt(this, Y(this.sel.ranges, e)), t) + })), + setSelections: ni((function (e, t, n) { + if (e.length) { + for (var r = [], i = 0; i < e.length; i++) r[i] = new Ei(at(this, e[i].anchor), at(this, e[i].head)); + null == t && (t = Math.min(e.length - 1, this.sel.primIndex)), Ji(this, ki(this.cm, r, t), n) + } + })), + addSelection: ni((function (e, t, n) { + var r = this.sel.ranges.slice(0); + r.push(new Ei(at(this, e), at(this, t || e))), Ji(this, ki(this.cm, r, r.length - 1), n) + })), + getSelection: function (e) { + for (var t, n = this.sel.ranges, r = 0; r < n.length; r++) { + var i = qe(this, n[r].from(), n[r].to()); + t = t ? t.concat(i) : i + } + return !1 === e ? t : t.join(e || this.lineSeparator()) + }, + getSelections: function (e) { + for (var t = [], n = this.sel.ranges, r = 0; r < n.length; r++) { + var i = qe(this, n[r].from(), n[r].to()); + !1 !== e && (i = i.join(e || this.lineSeparator())), t[r] = i + } + return t + }, + replaceSelection: function (e, t, n) { + for (var r = [], i = 0; i < this.sel.ranges.length; i++) r[i] = e; + this.replaceSelections(r, t, n || "+input") + }, + replaceSelections: ni((function (e, t, n) { + for (var r = [], i = this.sel, o = 0; o < i.ranges.length; o++) { + var s = i.ranges[o]; + r[o] = { + from: s.from(), + to: s.to(), + text: this.splitLines(e[o]), + origin: n } } - })) : as(i.scroller, 'dblclick', function (n) { - return z(t, n) || G(n) - }), as(i.scroller, 'contextmenu', function (n) { - return Zi(t, n) - }); - var a = { - end: 0 - }, - s; - as(i.scroller, 'touchstart', function (n) { - if (!z(t, n) && !o(n) && !$i(t, n)) { - i.input.ensurePolled(), clearTimeout(s); - var e = +new Date; - i.activeTouch = { - start: e, - moved: !1, - prev: 300 >= e - a.end ? a : null - }, 1 == n.touches.length && (i.activeTouch.left = n.touches[0].pageX, i.activeTouch.top = n.touches[0].pageY) - } - }), as(i.scroller, 'touchmove', function () { - i.activeTouch && (i.activeTouch.moved = !0) - }), as(i.scroller, 'touchend', function (o) { - var e = i.activeTouch; - if (e && !Vt(i, o) && null != e.left && !e.moved && 300 > new Date - e.start) { - var a = t.coordsChar(i.activeTouch, 'page'), - s; - s = !e.prev || r(e, e.prev) ? new Ns(a, a) : !e.prev.prev || r(e, e.prev.prev) ? t.findWordAt(a) : new Ns(fe(a.line, 0), Ee(t.doc, fe(a.line + 1, 0))), t.setSelection(s.anchor, s.head), t.focus(), G(o) - } - n() - }), as(i.scroller, 'touchcancel', n), as(i.scroller, 'scroll', function () { - i.scroller.clientHeight && (uo(t, i.scroller.scrollTop), ho(t, i.scroller.scrollLeft, !0), H(t, 'scroll', t)) - }), as(i.scroller, 'mousewheel', function (n) { - return Qo(t, n) - }), as(i.scroller, 'DOMMouseScroll', function (n) { - return Qo(t, n) - }), as(i.wrapper, 'scroll', function () { - return i.wrapper.scrollTop = i.wrapper.scrollLeft = 0 - }), i.dragFunctions = { - enter: function (n) { - z(t, n) || q(n) - }, - over: function (n) { - z(t, n) || (ci(t, n), q(n)) - }, - start: function (n) { - return li(t, n) - }, - drop: xo(t, di), - leave: function (n) { - z(t, n) || pi(t) + for (var a = t && "end" != t && function (e, t, n) { + for (var r = [], i = et(e.first, 0), o = i, s = 0; s < t.length; s++) { + var a = t[s], + l = _i(a.from, i, o), + c = _i(Ti(a), i, o); + if (i = a.to, o = c, "around" == n) { + var u = e.sel.ranges[s], + h = tt(u.head, u.anchor) < 0; + r[s] = new Ei(h ? c : l, h ? l : c) + } else r[s] = new Ei(l, l) + } + return new Ci(r, e.sel.primIndex) + }(this, r, t), l = r.length - 1; l >= 0; l--) co(this, r[l]); + a ? Xi(this, a) : this.cm && Mr(this.cm) + })), + undo: ni((function () { + ho(this, "undo") + })), + redo: ni((function () { + ho(this, "redo") + })), + undoSelection: ni((function () { + ho(this, "undo", !0) + })), + redoSelection: ni((function () { + ho(this, "redo", !0) + })), + setExtending: function (e) { + this.extend = e + }, + getExtending: function () { + return this.extend + }, + historySize: function () { + for (var e = this.history, t = 0, n = 0, r = 0; r < e.done.length; r++) e.done[r].ranges || ++t; + for (var i = 0; i < e.undone.length; i++) e.undone[i].ranges || ++n; + return { + undo: t, + redo: n } - }; - var e = i.input.getField(); - as(e, 'keyup', function (n) { - return Hi.call(t, n) - }), as(e, 'keydown', xo(t, Ni)), as(e, 'keypress', xo(t, zi)), as(e, 'focus', function (n) { - return Qn(t, n) - }), as(e, 'blur', function (n) { - return $n(t, n) - }) - } + }, + clearHistory: function () { + this.history = new Fi(this.history.maxGeneration) + }, + markClean: function () { + this.cleanGeneration = this.changeGeneration(!0) + }, + changeGeneration: function (e) { + return e && (this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null), this.history.generation + }, + isClean: function (e) { + return this.history.generation == (e || this.cleanGeneration) + }, + getHistory: function () { + return { + done: $i(this.history.done), + undone: $i(this.history.undone) + } + }, + setHistory: function (e) { + var t = this.history = new Fi(this.history.maxGeneration); + t.done = $i(e.done.slice(0), null, !0), t.undone = $i(e.undone.slice(0), null, !0) + }, + setGutterMarker: ni((function (e, t, n) { + return wo(this, e, "gutter", (function (e) { + var r = e.gutterMarkers || (e.gutterMarkers = {}); + return r[t] = n, !n && te(r) && (e.gutterMarkers = null), !0 + })) + })), + clearGutter: ni((function (e) { + var t = this; + this.iter((function (n) { + n.gutterMarkers && n.gutterMarkers[e] && wo(t, n, "gutter", (function () { + return n.gutterMarkers[e] = null, te(n.gutterMarkers) && (n.gutterMarkers = null), !0 + })) + })) + })), + lineInfo: function (e) { + var t; + if ("number" == typeof e) { + if (!Xe(this, e)) return null; + if (t = e, !(e = $e(this, e))) return null + } else if (null == (t = Qe(e))) return null; + return { + line: t, + handle: e, + text: e.text, + gutterMarkers: e.gutterMarkers, + textClass: e.textClass, + bgClass: e.bgClass, + wrapClass: e.wrapClass, + widgets: e.widgets + } + }, + addLineClass: ni((function (e, t, n) { + return wo(this, e, "gutter" == t ? "gutter" : "class", (function (e) { + var r = "text" == t ? "textClass" : "background" == t ? "bgClass" : "gutter" == t ? "gutterClass" : "wrapClass"; + if (e[r]) { + if (k(n).test(e[r])) return !1; + e[r] += " " + n + } else e[r] = n; + return !0 + })) + })), + removeLineClass: ni((function (e, t, n) { + return wo(this, e, "gutter" == t ? "gutter" : "class", (function (e) { + var r = "text" == t ? "textClass" : "background" == t ? "bgClass" : "gutter" == t ? "gutterClass" : "wrapClass", + i = e[r]; + if (!i) return !1; + if (null == n) e[r] = null; + else { + var o = i.match(k(n)); + if (!o) return !1; + var s = o.index + o[0].length; + e[r] = i.slice(0, o.index) + (o.index && s != i.length ? " " : "") + i.slice(s) || null + } + return !0 + })) + })), + addLineWidget: ni((function (e, t, n) { + return function (e, t, n, r) { + var i = new Co(e, n, r), + o = e.cm; + return o && i.noHScroll && (o.display.alignWidgets = !0), wo(e, t, "widget", (function (t) { + var n = t.widgets || (t.widgets = []); + if (null == i.insertAt ? n.push(i) : n.splice(Math.min(n.length - 1, Math.max(0, i.insertAt)), 0, i), i.line = t, o && !Ut(e, t)) { + var r = Vt(t) < e.scrollTop; + Ye(t, t.height + Sn(i)), r && Ar(o, i.height), o.curOp.forceUpdate = !0 + } + return !0 + })), o && ln(o, "lineWidgetAdded", o, i, "number" == typeof t ? t : Qe(t)), i + }(this, e, t, n) + })), + removeLineWidget: function (e) { + e.clear() + }, + markText: function (e, t, n) { + return To(this, at(this, e), at(this, t), n, n && n.type || "range") + }, + setBookmark: function (e, t) { + var n = { + replacedWith: t && (null == t.nodeType ? t.widget : t), + insertLeft: t && t.insertLeft, + clearWhenEmpty: !1, + shared: t && t.shared, + handleMouseEvents: t && t.handleMouseEvents + }; + return To(this, e = at(this, e), e, n, "bookmark") + }, + findMarksAt: function (e) { + var t = [], + n = $e(this, (e = at(this, e)).line).markedSpans; + if (n) + for (var r = 0; r < n.length; ++r) { + var i = n[r]; + (null == i.from || i.from <= e.ch) && (null == i.to || i.to >= e.ch) && t.push(i.marker.parent || i.marker) + } + return t + }, + findMarks: function (e, t, n) { + e = at(this, e), t = at(this, t); + var r = [], + i = e.line; + return this.iter(e.line, t.line + 1, (function (o) { + var s = o.markedSpans; + if (s) + for (var a = 0; a < s.length; a++) { + var l = s[a]; + null != l.to && i == e.line && e.ch >= l.to || null == l.from && i != e.line || null != l.from && i == t.line && l.from >= t.ch || n && !n(l.marker) || r.push(l.marker.parent || l.marker) + }++i + })), r + }, + getAllMarks: function () { + var e = []; + return this.iter((function (t) { + var n = t.markedSpans; + if (n) + for (var r = 0; r < n.length; ++r) null != n[r].from && e.push(n[r].marker) + })), e + }, + posFromIndex: function (e) { + var t, n = this.first, + r = this.lineSeparator().length; + return this.iter((function (i) { + var o = i.text.length + r; + if (o > e) return t = e, !0; + e -= o, ++n + })), at(this, et(n, t)) + }, + indexFromPos: function (e) { + var t = (e = at(this, e)).ch; + if (e.line < this.first || e.ch < 0) return 0; + var n = this.lineSeparator().length; + return this.iter(this.first, e.line, (function (e) { + t += e.text.length + n + })), t + }, + copy: function (e) { + var t = new Mo(Ke(this, this.first, this.first + this.size), this.modeOption, this.first, this.lineSep, this.direction); + return t.scrollTop = this.scrollTop, t.scrollLeft = this.scrollLeft, t.sel = this.sel, t.extend = !1, e && (t.history.undoDepth = this.history.undoDepth, t.setHistory(this.getHistory())), t + }, + linkedDoc: function (e) { + e || (e = {}); + var t = this.first, + n = this.first + this.size; + null != e.from && e.from > t && (t = e.from), null != e.to && e.to < n && (n = e.to); + var r = new Mo(Ke(this, t, n), e.mode || this.modeOption, t, this.lineSep, this.direction); + return e.sharedHist && (r.history = this.history), (this.linked || (this.linked = [])).push({ + doc: r, + sharedHist: e.sharedHist + }), r.linked = [{ + doc: this, + isParent: !0, + sharedHist: e.sharedHist + }], + function (e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n], + i = r.find(), + o = e.clipPos(i.from), + s = e.clipPos(i.to); + if (tt(o, s)) { + var a = To(e, o, s, r.primary, r.primary.type); + r.markers.push(a), a.parent = r + } + } + }(r, Do(this)), r + }, + unlinkDoc: function (e) { + if (e instanceof Rs && (e = e.doc), this.linked) + for (var t = 0; t < this.linked.length; ++t) + if (this.linked[t].doc == e) { + this.linked.splice(t, 1), e.unlinkDoc(this), _o(Do(this)); + break + } if (e.history == this.history) { + var n = [e.id]; + Oi(e, (function (e) { + return n.push(e.id) + }), !0), e.history = new Fi(null), e.history.done = $i(this.history.done, n), e.history.undone = $i(this.history.undone, n) + } + }, + iterLinkedDocs: function (e) { + Oi(this, e) + }, + getMode: function () { + return this.mode + }, + getEditor: function () { + return this.cm + }, + splitLines: function (e) { + return this.lineSep ? e.split(this.lineSep) : Me(e) + }, + lineSeparator: function () { + return this.lineSep || "\n" + }, + setDirection: ni((function (e) { + var t; + "rtl" != e && (e = "ltr"), e != this.direction && (this.direction = e, this.iter((function (e) { + return e.order = null + })), this.cm && Jr(t = this.cm, (function () { + Ni(t), hr(t) + }))) + })) + }), Mo.prototype.eachLine = Mo.prototype.iter; + var Po = 0; - function ia(e, t, n, o) { - var s = e.doc, - d; - null == n && (n = 'add'), 'smart' == n && (s.mode.indent ? d = Re(e, t).state : n = 'prev'); - var l = e.options.tabSize, - c = se(s, t), - p = C(c.text, null, l); - c.stateAfter && (c.stateAfter = null); - var u = c.text.match(/^\s*/)[0], - m; - if (!o && !/\S/.test(c.text)) m = 0, n = 'not'; - else if ('smart' == n && (m = s.mode.indent(d, c.text.slice(u.length), c.text), m == Qa || 150 < m)) { - if (!o) return; - n = 'prev' + function Io(e) { + var t = this; + if (Oo(t), !me(t, e) && !Cn(t.display, e)) { + we(e), s && (Po = +new Date); + var n = cr(t, e, !0), + r = e.dataTransfer.files; + if (n && !t.isReadOnly()) + if (r && r.length && window.FileReader && window.File) + for (var i = r.length, o = Array(i), a = 0, l = function (e, r) { + if (!t.options.allowDropFileTypes || -1 != z(t.options.allowDropFileTypes, e.type)) { + var s = new FileReader; + s.onload = ei(t, (function () { + var e = s.result; + if (/[\x00-\x08\x0e-\x1f]{2}/.test(e) && (e = ""), o[r] = e, ++a == i) { + var l = { + from: n = at(t.doc, n), + to: n, + text: t.doc.splitLines(o.join(t.doc.lineSeparator())), + origin: "paste" + }; + co(t.doc, l), Xi(t.doc, xi(n, Ti(l))) + } + })), s.readAsText(e) + } + }, c = 0; c < i; ++c) l(r[c], c); + else { + if (t.state.draggingText && t.doc.sel.contains(n) > -1) return t.state.draggingText(e), void setTimeout((function () { + return t.display.input.focus() + }), 20); + try { + var u = e.dataTransfer.getData("Text"); + if (u) { + var h; + if (t.state.draggingText && !t.state.draggingText.copy && (h = t.listSelections()), eo(t.doc, xi(n, n)), h) + for (var p = 0; p < h.length; ++p) mo(t.doc, "", h[p].anchor, h[p].head, "drag"); + t.replaceSelection(u, "around", "paste"), t.display.input.focus() + } + } catch (e) {} + } } - 'prev' == n ? t > s.first ? m = C(se(s, t - 1).text, null, l) : m = 0 : 'add' == n ? m = p + e.options.indentUnit : 'subtract' == n ? m = p - e.options.indentUnit : 'number' == typeof n && (m = p + n), m = r(0, m); - var h = '', - f = 0; - if (e.options.indentWithTabs) - for (var g = a(m / l); g; --g) f += l, h += '\t'; - if (f < m && (h += E(m - f)), h != u) return Yr(s, h, fe(t, 0), fe(t, u.length), '+input'), c.stateAfter = null, !0; - for (var i = 0, y; i < s.sel.ranges.length; i++) - if (y = s.sel.ranges[i], y.head.line == t && y.head.ch < u.length) { - var S = fe(t, u.length); - xr(s, i, new Ns(S, S)); - break - } } - function aa(e) { - ad = e + function Oo(e) { + e.display.dragCursor && (e.display.lineSpace.removeChild(e.display.dragCursor), e.display.dragCursor = null) } - function sa(e, t, n, o, r) { - var a = e.doc; - e.display.shift = !1, o || (o = a.sel); - var s = +new Date - 200, - l = 'paste' == r || e.state.pasteIncoming > s, - c = ss(t), - p = null; - if (l && 1 < o.ranges.length) - if (!(ad && ad.text.join('\n') == t)) c.length == o.ranges.length && e.options.pasteLinesPerSelection && (p = k(c, function (e) { - return [e] - })); - else if (0 == o.ranges.length % ad.text.length) { - p = []; - for (var u = 0; u < ad.text.length; u++) p.push(a.splitLines(ad.text[u])) - } - for (var i = e.curOp.updateInput, m = o.ranges.length - 1; 0 <= m; m--) { - var h = o.ranges[m], - f = h.from(), - g = h.to(); - h.empty() && (n && 0 < n ? f = fe(f.line, f.ch - n) : e.state.overwrite && !l ? g = fe(g.line, d(se(a, g.line).text.length, g.ch + w(c).length)) : l && ad && ad.lineWise && ad.text.join('\n') == t && (f = g = fe(f.line, 0))); - var y = { - from: f, - to: g, - text: p ? p[m % p.length] : c, - origin: r || (l ? 'paste' : e.state.cutIncoming > s ? 'cut' : '+input') - }; - Wr(e.doc, y), xt(e, 'inputRead', e, y) + function Lo(e) { + if (document.getElementsByClassName) { + for (var t = document.getElementsByClassName("CodeMirror"), n = [], r = 0; r < t.length; r++) { + var i = t[r].CodeMirror; + i && n.push(i) + } + n.length && n[0].operation((function () { + for (var t = 0; t < n.length; t++) e(n[t]) + })) } - t && !l && la(e, t), ao(e), 2 > e.curOp.updateInput && (e.curOp.updateInput = i), e.curOp.typing = !0, e.state.pasteIncoming = e.state.cutIncoming = -1 } + var No = !1; - function da(t, e) { - var n = t.clipboardData && t.clipboardData.getData('Text'); - if (n) return t.preventDefault(), e.isReadOnly() || e.options.disableInput || Ro(e, function () { - return sa(e, n, 0, null, 'paste') - }), !0 + function Fo() { + var e; + No || (he(window, "resize", (function () { + null == e && (e = setTimeout((function () { + e = null, Lo(Bo) + }), 100)) + })), he(window, "blur", (function () { + return Lo(xr) + })), No = !0) } - function la(e, t) { - if (e.options.electricChars && e.options.smartIndent) - for (var n = e.doc.sel, o = n.ranges.length - 1, r; 0 <= o; o--) - if (r = n.ranges[o], !(100 < r.head.ch || o && n.ranges[o - 1].head.line == r.head.line)) { - var i = e.getModeAt(r.head), - a = !1; - if (i.electricChars) { - for (var s = 0; s < i.electricChars.length; s++) - if (-1 < t.indexOf(i.electricChars.charAt(s))) { - a = ia(e, r.head.line, 'smart'); - break - } - } else i.electricInput && i.electricInput.test(se(e.doc, r.head.line).text.slice(0, r.head.ch)) && (a = ia(e, r.head.line, 'smart')); - a && xt(e, 'electricInput', e, r.head.line) - } + function Bo(e) { + var t = e.display; + t.cachedCharWidth = t.cachedTextHeight = t.cachedPaddingH = null, t.scrollbarsClipped = !1, e.setSize() } + for (var Ho = { + 3: "Pause", + 8: "Backspace", + 9: "Tab", + 13: "Enter", + 16: "Shift", + 17: "Ctrl", + 18: "Alt", + 19: "Pause", + 20: "CapsLock", + 27: "Esc", + 32: "Space", + 33: "PageUp", + 34: "PageDown", + 35: "End", + 36: "Home", + 37: "Left", + 38: "Up", + 39: "Right", + 40: "Down", + 44: "PrintScrn", + 45: "Insert", + 46: "Delete", + 59: ";", + 61: "=", + 91: "Mod", + 92: "Mod", + 93: "Mod", + 106: "*", + 107: "=", + 109: "-", + 110: ".", + 111: "/", + 145: "ScrollLock", + 173: "-", + 186: ";", + 187: "=", + 188: ",", + 189: "-", + 190: ".", + 191: "/", + 192: "`", + 219: "[", + 220: "\\", + 221: "]", + 222: "'", + 63232: "Up", + 63233: "Down", + 63234: "Left", + 63235: "Right", + 63272: "Delete", + 63273: "Home", + 63275: "End", + 63276: "PageUp", + 63277: "PageDown", + 63302: "Insert" + }, zo = 0; zo < 10; zo++) Ho[zo + 48] = Ho[zo + 96] = String(zo); + for (var Uo = 65; Uo <= 90; Uo++) Ho[Uo] = String.fromCharCode(Uo); + for (var Wo = 1; Wo <= 12; Wo++) Ho[Wo + 111] = Ho[Wo + 63235] = "F" + Wo; + var Vo = {}; - function ca(e) { - for (var t = [], n = [], o = 0; o < e.doc.sel.ranges.length; o++) { - var r = e.doc.sel.ranges[o].head.line, - i = { - anchor: fe(r, 0), - head: fe(r + 1, 0) - }; - n.push(i), t.push(e.getRange(i.anchor, i.head)) + function jo(e) { + var t, n, r, i, o = e.split(/-(?!$)/); + e = o[o.length - 1]; + for (var s = 0; s < o.length - 1; s++) { + var a = o[s]; + if (/^(cmd|meta|m)$/i.test(a)) i = !0; + else if (/^a(lt)?$/i.test(a)) t = !0; + else if (/^(c|ctrl|control)$/i.test(a)) n = !0; + else { + if (!/^s(hift)?$/i.test(a)) throw new Error("Unrecognized modifier name: " + a); + r = !0 + } } - return { - text: t, - ranges: n + return t && (e = "Alt-" + e), n && (e = "Ctrl-" + e), i && (e = "Cmd-" + e), r && (e = "Shift-" + e), e + } + + function Go(e) { + var t = {}; + for (var n in e) + if (e.hasOwnProperty(n)) { + var r = e[n]; + if (/^(name|fallthrough|(de|at)tach)$/.test(n)) continue; + if ("..." == r) { + delete e[n]; + continue + } + for (var i = Y(n.split(" "), jo), o = 0; o < i.length; o++) { + var s = void 0, + a = void 0; + o == i.length - 1 ? (a = i.join(" "), s = r) : (a = i.slice(0, o + 1).join(" "), s = "..."); + var l = t[a]; + if (l) { + if (l != s) throw new Error("Inconsistent bindings for " + a) + } else t[a] = s + } + delete e[n] + } for (var c in t) e[c] = t[c]; + return e + } + + function $o(e, t, n, r) { + var i = (t = Qo(t)).call ? t.call(e, r) : t[e]; + if (!1 === i) return "nothing"; + if ("..." === i) return "multi"; + if (null != i && n(i)) return "handled"; + if (t.fallthrough) { + if ("[object Array]" != Object.prototype.toString.call(t.fallthrough)) return $o(e, t.fallthrough, n, r); + for (var o = 0; o < t.fallthrough.length; o++) { + var s = $o(e, t.fallthrough[o], n, r); + if (s) return s + } } } - function pa(e, t, n, o) { - e.setAttribute('autocorrect', n ? '' : 'off'), e.setAttribute('autocapitalize', o ? '' : 'off'), e.setAttribute('spellcheck', !!t) + function qo(e) { + var t = "string" == typeof e ? e : Ho[e.keyCode]; + return "Ctrl" == t || "Alt" == t || "Shift" == t || "Mod" == t } - function ua() { - var e = p('textarea', null, null, 'position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none'), - t = p('div', [e], null, 'overflow: hidden; position: relative; width: 3px; height: 0px;'); - return Pa ? e.style.width = '1000px' : e.setAttribute('wrap', 'off'), Ba && (e.style.border = '1px solid black'), pa(e), t + function Ko(e, t, n) { + var r = e; + return t.altKey && "Alt" != r && (e = "Alt-" + e), (C ? t.metaKey : t.ctrlKey) && "Ctrl" != r && (e = "Ctrl-" + e), (C ? t.ctrlKey : t.metaKey) && "Cmd" != r && (e = "Cmd-" + e), !n && t.shiftKey && "Shift" != r && (e = "Shift-" + e), e } - function ma(e, t, n, o, r) { - function i() { - var o = t.line + n; - return !(o < e.first || o >= e.first + e.size) && (t = new fe(o, t.ch, t.sticky), c = se(e, o)) - } + function Yo(e, t) { + if (h && 34 == e.keyCode && e.char) return !1; + var n = Ho[e.keyCode]; + return null != n && !e.altGraphKey && (3 == e.keyCode && e.code && (n = e.code), Ko(n, e, t)) + } - function a(o) { - var a; - if (a = r ? Ri(e.cm, c, t, n) : Ti(c, t, n), null != a) t = a; - else if (!o && i()) t = _i(r, e.cm, c, t.line, n); - else return !1; - return !0 - } - var s = t, - d = n, - c = se(e, t.line); - if ('char' == o) a(); - else if ('column' == o) a(!0); - else if ('word' == o || 'group' == o) - for (var l = null, p = 'group' == o, u = e.cm && e.cm.getHelper(t, 'wordChars'), m = !0;; m = !1) { - if (0 > n && !a(!m)) break; - var h = c.text.charAt(t.ch) || '\n', - f = P(h, u) ? 'w' : p && '\n' == h ? 'n' : !p || /\s/.test(h) ? null : 'p'; - if (!p || m || f || (f = 's'), l && l != f) { - 0 > n && (n = 1, a(), t.sticky = 'after'); + function Qo(e) { + return "string" == typeof e ? Vo[e] : e + } + + function Zo(e, t) { + for (var n = e.doc.sel.ranges, r = [], i = 0; i < n.length; i++) { + for (var o = t(n[i]); r.length && tt(o.from, K(r).to) <= 0;) { + var s = r.pop(); + if (tt(s.from, o.from) < 0) { + o.from = s.from; break } - if (f && (l = f), 0 < n && !a(!m)) break - } - var g = Or(e, t, s, d, !0); - return ye(s, g) && (g.hitSide = !0), g - } - - function ha(e, t, n, o) { - var i = e.doc, - a = t.left, - s; - if ('page' == o) { - var l = d(e.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight), - c = r(l - .5 * xn(e.display), 3); - s = (0 < n ? t.bottom : t.top) + n * c - } else 'line' == o && (s = 0 < n ? t.bottom + 3 : t.top - 3); - for (var p;;) { - if (p = vn(e, a, s), !p.outside) break; - if (0 > n ? 0 >= s : s >= i.height) { - p.hitSide = !0; - break } - s += 5 * n - } - return p - } - - function fa(e, t) { - var n = en(e, t.line); - if (!n || n.hidden) return null; - var o = se(e.doc, t.line), - r = $t(n, o, t.line), - i = B(o, e.doc.direction), - a = 'left'; - if (i) { - var s = F(i, t.ch); - a = s % 2 ? 'right' : 'left' + r.push(o) } - var d = rn(r.map, t.ch, a); - return d.offset = 'right' == d.collapse ? d.end : d.start, d - } - - function ga(e) { - for (var t = e; t; t = t.parentNode) - if (/CodeMirror-gutter-wrapper/.test(t.className)) return !0; - return !1 + Jr(e, (function () { + for (var t = r.length - 1; t >= 0; t--) mo(e.doc, "", r[t].from, r[t].to, "+delete"); + Mr(e) + })) } - function ya(e, t) { - return t && (e.bad = !0), e + function Xo(e, t, n) { + var r = ie(e.text, t + n, n); + return r < 0 || r > e.text.length ? null : r } - function Sa(e, t, n, o, r) { - function i(e) { - return function (t) { - return t.id == e - } - } - - function a() { - c && (l += p, u && (l += p), c = u = !1) - } - - function s(e) { - e && (a(), l += e) - } - - function d(t) { - if (1 == t.nodeType) { - var n = t.getAttribute('cm-text'); - if (n) return void s(n); - var l = t.getAttribute('cm-marker'), - m; - if (l) { - var h = e.findMarks(fe(o, 0), fe(r + 1, 0), i(+l)); - return void(h.length && (m = h[0].find(0)) && s(de(e.doc, m.from, m.to).join(p))) - } - if ('false' == t.getAttribute('contenteditable')) return; - var f = /^(pre|div|p|li|table|br)$/i.test(t.nodeName); - if (!/^br$/i.test(t.nodeName) && 0 == t.textContent.length) return; - f && a(); - for (var g = 0; g < t.childNodes.length; g++) d(t.childNodes[g]); - /^(pre|p)$/i.test(t.nodeName) && (u = !0), f && (c = !0) - } else 3 == t.nodeType && s(t.nodeValue.replace(/\u200b/g, '').replace(/\u00a0/g, ' ')) - } - for (var l = '', c = !1, p = e.doc.lineSeparator(), u = !1;;) { - if (d(t), t == n) break; - t = t.nextSibling, u = !1 - } - return l + function Jo(e, t, n) { + var r = Xo(e, t.ch, n); + return null == r ? null : new et(t.line, r, n < 0 ? "after" : "before") } - function Ca(e, t, n) { - var o; - if (t == e.display.lineDiv) { - if (o = e.display.lineDiv.childNodes[n], !o) return ya(e.clipPos(fe(e.display.viewTo - 1)), !0); - t = null, n = 0 - } else - for (o = t;; o = o.parentNode) { - if (!o || o == e.display.lineDiv) return null; - if (o.parentNode && o.parentNode == e.display.lineDiv) break - } - for (var r = 0, i; r < e.display.view.length; r++) - if (i = e.display.view[r], i.node == o) return ba(i, t, n) - } - - function ba(e, t, n) { - function o(t, n, o) { - for (var r = -1, i; r < (c ? c.length : 0); r++) { - i = 0 > r ? l.map : c[r]; - for (var a = 0, s; a < i.length; a += 3) - if (s = i[a + 2], s == t || s == n) { - var d = pe(0 > r ? e.line : e.rest[r]), - p = i[a] + o; - return (0 > o || s != t) && (p = i[a + (o ? 1 : 0)]), fe(d, p) - } - } - } - var r = e.text.firstChild, - i = !1; - if (!t || !m(r, t)) return ya(fe(pe(e.line), 0), !0); - if (t == r && (i = !0, t = r.childNodes[n], n = 0, !t)) { - var a = e.rest ? w(e.rest) : e.line; - return ya(fe(pe(a), a.text.length), i) - } - var s = 3 == t.nodeType ? t : null, - d = t; - for (s || 1 != t.childNodes.length || 3 != t.firstChild.nodeType || (s = t.firstChild, n && (n = s.nodeValue.length)); d.parentNode != r;) d = d.parentNode; - var l = e.measure, - c = l.maps, - p = o(s, d, n); - if (p) return ya(p, i); - for (var u = d.nextSibling, h = s ? s.nodeValue.length - n : 0; u; u = u.nextSibling) { - if (p = o(u, u.firstChild, 0), p) return ya(fe(p.line, p.ch - h), i); - h += u.textContent.length - } - for (var f = d.previousSibling, g = n; f; f = f.previousSibling) { - if (p = o(f, f.firstChild, -1), p) return ya(fe(p.line, p.ch + g), i); - g += f.textContent.length - } - } - var va = navigator.userAgent, - Ea = navigator.platform, - wa = /gecko\/\d/i.test(va), - ka = /MSIE \d/.test(va), - Ta = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(va), - _a = /Edge\/(\d+)/.exec(va), - Ra = ka || Ta || _a, - xa = Ra && (ka ? document.documentMode || 6 : +(_a || Ta)[1]), - Pa = !_a && /WebKit\//.test(va), - Da = Pa && /Qt\/\d+\.\d+/.test(va), - Ma = !_a && /Chrome\//.test(va), - Aa = /Opera\//.test(va), - Ia = /Apple Computer/.test(navigator.vendor), - La = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(va), - Fa = /PhantomJS/.test(va), - Ba = !_a && /AppleWebKit/.test(va) && /Mobile\/\w+/.test(va), - Na = /Android/.test(va), - Oa = Ba || Na || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(va), - Ha = Ba || /Mac/.test(Ea), - za = /\bCrOS\b/.test(va), - Ua = /win/i.test(Ea), - Wa = Aa && va.match(/Version\/(\d*\.\d*)/); - Wa && (Wa = +Wa[1]), Wa && 15 <= Wa && (Aa = !1, Pa = !0); - var Va = Ha && (Da || Aa && (null == Wa || 12.11 > Wa)), - Ga = wa || Ra && 9 <= xa, - Ka = function (t, n) { - var o = t.className, - r = e(n).exec(o); - if (r) { - var i = o.slice(r.index + r[0].length); - t.className = o.slice(0, r.index) + (i ? r[1] + i : '') - } + function es(e, t, n, r, i) { + if (e) { + var o = ce(n, t.doc.direction); + if (o) { + var s, a = i < 0 ? K(o) : o[0], + l = i < 0 == (1 == a.level) ? "after" : "before"; + if (a.level > 0 || "rtl" == t.doc.direction) { + var c = Pn(t, n); + s = i < 0 ? n.text.length - 1 : 0; + var u = In(t, c, s).top; + s = oe((function (e) { + return In(t, c, e).top == u + }), i < 0 == (1 == a.level) ? a.from : a.to - 1, s), "before" == l && (s = Xo(n, s, 1)) + } else s = i < 0 ? a.to : a.from; + return new et(r, s, l) + } + } + return new et(r, i < 0 ? n.text.length : 0, i < 0 ? "before" : "after") + } + Vo.basic = { + Left: "goCharLeft", + Right: "goCharRight", + Up: "goLineUp", + Down: "goLineDown", + End: "goLineEnd", + Home: "goLineStartSmart", + PageUp: "goPageUp", + PageDown: "goPageDown", + Delete: "delCharAfter", + Backspace: "delCharBefore", + "Shift-Backspace": "delCharBefore", + Tab: "defaultTab", + "Shift-Tab": "indentAuto", + Enter: "newlineAndIndent", + Insert: "toggleOverwrite", + Esc: "singleSelection" + }, Vo.pcDefault = { + "Ctrl-A": "selectAll", + "Ctrl-D": "deleteLine", + "Ctrl-Z": "undo", + "Shift-Ctrl-Z": "redo", + "Ctrl-Y": "redo", + "Ctrl-Home": "goDocStart", + "Ctrl-End": "goDocEnd", + "Ctrl-Up": "goLineUp", + "Ctrl-Down": "goLineDown", + "Ctrl-Left": "goGroupLeft", + "Ctrl-Right": "goGroupRight", + "Alt-Left": "goLineStart", + "Alt-Right": "goLineEnd", + "Ctrl-Backspace": "delGroupBefore", + "Ctrl-Delete": "delGroupAfter", + "Ctrl-S": "save", + "Ctrl-F": "find", + "Ctrl-G": "findNext", + "Shift-Ctrl-G": "findPrev", + "Shift-Ctrl-F": "replace", + "Shift-Ctrl-R": "replaceAll", + "Ctrl-[": "indentLess", + "Ctrl-]": "indentMore", + "Ctrl-U": "undoSelection", + "Shift-Ctrl-U": "redoSelection", + "Alt-U": "redoSelection", + fallthrough: "basic" + }, Vo.emacsy = { + "Ctrl-F": "goCharRight", + "Ctrl-B": "goCharLeft", + "Ctrl-P": "goLineUp", + "Ctrl-N": "goLineDown", + "Alt-F": "goWordRight", + "Alt-B": "goWordLeft", + "Ctrl-A": "goLineStart", + "Ctrl-E": "goLineEnd", + "Ctrl-V": "goPageDown", + "Shift-Ctrl-V": "goPageUp", + "Ctrl-D": "delCharAfter", + "Ctrl-H": "delCharBefore", + "Alt-D": "delWordAfter", + "Alt-Backspace": "delWordBefore", + "Ctrl-K": "killLine", + "Ctrl-T": "transposeChars", + "Ctrl-O": "openLine" + }, Vo.macDefault = { + "Cmd-A": "selectAll", + "Cmd-D": "deleteLine", + "Cmd-Z": "undo", + "Shift-Cmd-Z": "redo", + "Cmd-Y": "redo", + "Cmd-Home": "goDocStart", + "Cmd-Up": "goDocStart", + "Cmd-End": "goDocEnd", + "Cmd-Down": "goDocEnd", + "Alt-Left": "goGroupLeft", + "Alt-Right": "goGroupRight", + "Cmd-Left": "goLineLeft", + "Cmd-Right": "goLineRight", + "Alt-Backspace": "delGroupBefore", + "Ctrl-Alt-Backspace": "delGroupAfter", + "Alt-Delete": "delGroupAfter", + "Cmd-S": "save", + "Cmd-F": "find", + "Cmd-G": "findNext", + "Shift-Cmd-G": "findPrev", + "Cmd-Alt-F": "replace", + "Shift-Cmd-Alt-F": "replaceAll", + "Cmd-[": "indentLess", + "Cmd-]": "indentMore", + "Cmd-Backspace": "delWrappedLineLeft", + "Cmd-Delete": "delWrappedLineRight", + "Cmd-U": "undoSelection", + "Shift-Cmd-U": "redoSelection", + "Ctrl-Up": "goDocStart", + "Ctrl-Down": "goDocEnd", + fallthrough: ["basic", "emacsy"] + }, Vo.default = v ? Vo.macDefault : Vo.pcDefault; + var ts = { + selectAll: ao, + singleSelection: function (e) { + return e.setSelection(e.getCursor("anchor"), e.getCursor("head"), W) }, - ja; - ja = document.createRange ? function (e, t, n, o) { - var i = document.createRange(); - return i.setEnd(o || e, n), i.setStart(e, t), i - } : function (e, t, n) { - var o = document.body.createTextRange(); - try { - o.moveToElementText(e.parentNode) - } catch (t) { - return o - } - return o.collapse(!0), o.moveEnd('character', n), o.moveStart('character', t), o - }; - var qa = function (e) { - e.select() - }; - Ba ? qa = function (e) { - e.selectionStart = 0, e.selectionEnd = e.value.length - } : Ra && (qa = function (e) { - try { - e.select() - } catch (e) {} - }); - var Ya = function () { - this.id = null, this.f = null, this.time = 0, this.handler = y(this.onTimeout, this) - }; - Ya.prototype.onTimeout = function (e) { - e.id = 0, e.time <= +new Date ? e.f() : setTimeout(e.handler, e.time - +new Date) - }, Ya.prototype.set = function (e, t) { - this.f = t; - var n = +new Date + e; - (!this.id || n < this.time) && (clearTimeout(this.id), this.id = setTimeout(this.handler, e), this.time = n) - }; - var Xa = 30, - Qa = { - toString: function () { - return 'CodeMirror.Pass' - } + killLine: function (e) { + return Zo(e, (function (t) { + if (t.empty()) { + var n = $e(e.doc, t.head.line).text.length; + return t.head.ch == n && t.head.line < e.lastLine() ? { + from: t.head, + to: et(t.head.line + 1, 0) + } : { + from: t.head, + to: et(t.head.line, n) + } + } + return { + from: t.from(), + to: t.to() + } + })) }, - $a = { - scroll: !1 + deleteLine: function (e) { + return Zo(e, (function (t) { + return { + from: et(t.from().line, 0), + to: at(e.doc, et(t.to().line + 1, 0)) + } + })) }, - Za = { - origin: '*mouse' + delLineLeft: function (e) { + return Zo(e, (function (e) { + return { + from: et(e.from().line, 0), + to: e.from() + } + })) }, - Ja = { - origin: '+move' + delWrappedLineLeft: function (e) { + return Zo(e, (function (t) { + var n = e.charCoords(t.head, "div").top + 5; + return { + from: e.coordsChar({ + left: 0, + top: n + }, "div"), + to: t.from() + } + })) }, - es = [''], - ts = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/, - ns = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/, - os = null, - rs = function () { - function e(e) { - return 247 >= e ? n.charAt(e) : 1424 <= e && 1524 >= e ? 'R' : 1536 <= e && 1785 >= e ? o.charAt(e - 1536) : 1774 <= e && 2220 >= e ? 'r' : 8192 <= e && 8203 >= e ? 'w' : 8204 == e ? 'b' : 'L' - } - - function t(e, t, n) { - this.level = e, this.from = t, this.to = n - } - var n = 'bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN', - o = 'nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111', - r = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/, - i = /[stwN]/, - a = /[LRr]/, - s = /[Lb1n]/, - d = /[1n]/; - return function (n, o) { - var l = 'ltr' == o ? 'L' : 'R'; - if (0 == n.length || 'ltr' == o && !r.test(n)) return !1; - for (var c = n.length, p = [], u = 0; u < c; ++u) p.push(e(n.charCodeAt(u))); - for (var h = 0, f = l, g; h < c; ++h) g = p[h], 'm' == g ? p[h] = f : f = g; - for (var y = 0, S = l, C; y < c; ++y) C = p[y], '1' == C && 'r' == S ? p[y] = 'n' : a.test(C) && (S = C, 'r' == C && (p[y] = 'R')); - for (var b = 1, v = p[0], E; b < c - 1; ++b) E = p[b], '+' == E && '1' == v && '1' == p[b + 1] ? p[b] = '1' : ',' == E && v == p[b + 1] && ('1' == v || 'n' == v) && (p[b] = v), v = E; - for (var k = 0, T; k < c; ++k) - if (T = p[k], ',' == T) p[k] = 'N'; - else if ('%' == T) { - var _ = void 0; - for (_ = k + 1; _ < c && '%' == p[_]; ++_); - for (var R = k && '!' == p[k - 1] || _ < c && '1' == p[_] ? '1' : 'N', x = k; x < _; ++x) p[x] = R; - k = _ - 1 + delWrappedLineRight: function (e) { + return Zo(e, (function (t) { + var n = e.charCoords(t.head, "div").top + 5, + r = e.coordsChar({ + left: e.display.lineDiv.offsetWidth + 100, + top: n + }, "div"); + return { + from: t.from(), + to: r } - for (var P = 0, D = l, M; P < c; ++P) M = p[P], 'L' == D && '1' == M ? p[P] = 'L' : a.test(M) && (D = M); - for (var A = 0; A < c; ++A) - if (i.test(p[A])) { - var I = void 0; - for (I = A + 1; I < c && i.test(p[I]); ++I); - for (var L = 'L' == (A ? p[A - 1] : l), F = 'L' == (I < c ? p[I] : l), B = L == F ? L ? 'L' : 'R' : l, N = A; N < I; ++N) p[N] = B; - A = I - 1 - } for (var O = [], H = 0, z; H < c;) - if (s.test(p[H])) { - var m = H; - for (++H; H < c && s.test(p[H]); ++H); - O.push(new t(0, m, H)) - } else { - var U = H, - W = O.length; - for (++H; H < c && 'L' != p[H]; ++H); - for (var V = U; V < H;) - if (d.test(p[V])) { - U < V && O.splice(W, 0, new t(1, U, V)); - var G = V; - for (++V; V < H && d.test(p[V]); ++V); - O.splice(W, 0, new t(2, G, V)), U = V - } else ++V; - U < H && O.splice(W, 0, new t(1, U, H)) - } return 'ltr' == o && (1 == O[0].level && (z = n.match(/^\s+/)) && (O[0].from = z[0].length, O.unshift(new t(0, 0, z[0].length))), 1 == w(O).level && (z = n.match(/\s+$/)) && (w(O).to -= z[0].length, O.push(new t(0, c - z[0].length, c)))), 'rtl' == o ? O.reverse() : O - } - }(), - is = [], - as = function (e, t, n) { - if (e.addEventListener) e.addEventListener(t, n, !1); - else if (e.attachEvent) e.attachEvent('on' + t, n); - else { - var o = e._handlers || (e._handlers = {}); - o[t] = (o[t] || is).concat(n) - } + })) }, - on = function () { - if (Ra && 9 > xa) return !1; - var e = p('div'); - return 'draggable' in e || 'dragDrop' in e - }(), - ss = 3 == '\n\nb'.split(/\n/).length ? function (e) { - return e.split(/\r\n?|\n/) - } : function (e) { - for (var t = 0, n = [], o = e.length, r; t <= o;) { - r = e.indexOf('\n', t), -1 == r && (r = e.length); - var i = e.slice(t, '\r' == e.charAt(r - 1) ? r - 1 : r), - a = i.indexOf('\r'); - 1 == a ? (n.push(i), t = r + 1) : (n.push(i.slice(0, a)), t += a + 1) - } - return n + undo: function (e) { + return e.undo() }, - ds = window.getSelection ? function (e) { - try { - return e.selectionStart != e.selectionEnd - } catch (t) { - return !1 - } - } : function (e) { - var t; - try { - t = e.ownerDocument.selection.createRange() - } catch (t) {} - return !!(t && t.parentElement() == e) && 0 != t.compareEndPoints('StartToEnd', t) + redo: function (e) { + return e.redo() }, - ls = function () { - var t = p('div'); - return !!('oncopy' in t) || (t.setAttribute('oncopy', 'return;'), 'function' == typeof t.oncopy) - }(), - cs = null, - ps = {}, - us = {}, - ms = {}, - hs = function (e, t, n) { - this.pos = this.start = 0, this.string = e, this.tabSize = t || 8, this.lastColumnPos = this.lastColumnValue = 0, this.lineStart = 0, this.lineOracle = n + undoSelection: function (e) { + return e.undoSelection() }, - fs, gs; - hs.prototype.eol = function () { - return this.pos >= this.string.length - }, hs.prototype.sol = function () { - return this.pos == this.lineStart - }, hs.prototype.peek = function () { - return this.string.charAt(this.pos) || void 0 - }, hs.prototype.next = function () { - if (this.pos < this.string.length) return this.string.charAt(this.pos++) - }, hs.prototype.eat = function (e) { - var t = this.string.charAt(this.pos), - n; - if (n = 'string' == typeof e ? t == e : t && (e.test ? e.test(t) : e(t)), n) return ++this.pos, t - }, hs.prototype.eatWhile = function (e) { - for (var t = this.pos; this.eat(e);); - return this.pos > t - }, hs.prototype.eatSpace = function () { - for (var e = this, t = this.pos; - /[\s\u00a0]/.test(this.string.charAt(this.pos));) ++e.pos; - return this.pos > t - }, hs.prototype.skipToEnd = function () { - this.pos = this.string.length - }, hs.prototype.skipTo = function (e) { - var t = this.string.indexOf(e, this.pos); - if (-1 < t) return this.pos = t, !0 - }, hs.prototype.backUp = function (e) { - this.pos -= e - }, hs.prototype.column = function () { - return this.lastColumnPos < this.start && (this.lastColumnValue = C(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue), this.lastColumnPos = this.start), this.lastColumnValue - (this.lineStart ? C(this.string, this.lineStart, this.tabSize) : 0) - }, hs.prototype.indentation = function () { - return C(this.string, null, this.tabSize) - (this.lineStart ? C(this.string, this.lineStart, this.tabSize) : 0) - }, hs.prototype.match = function (e, t, n) { - if ('string' == typeof e) { - var o = function (e) { - return n ? e.toLowerCase() : e - }, - r = this.string.substr(this.pos, e.length); - if (o(r) == o(e)) return !1 !== t && (this.pos += e.length), !0 - } else { - var i = this.string.slice(this.pos).match(e); - return i && 0 < i.index ? null : (i && !1 !== t && (this.pos += i[0].length), i) - } - }, hs.prototype.current = function () { - return this.string.slice(this.start, this.pos) - }, hs.prototype.hideFirstChars = function (e, t) { - this.lineStart += e; - try { - return t() - } finally { - this.lineStart -= e - } - }, hs.prototype.lookAhead = function (e) { - var t = this.lineOracle; - return t && t.lookAhead(e) - }, hs.prototype.baseToken = function () { - var e = this.lineOracle; - return e && e.baseToken(this.pos) - }; - var ys = function (e, t) { - this.state = e, this.lookAhead = t + redoSelection: function (e) { + return e.redoSelection() }, - Ss = function (e, t, n, o) { - this.state = t, this.doc = e, this.line = n, this.maxLookAhead = o || 0, this.baseTokens = null, this.baseTokenPos = 1 - }; - Ss.prototype.lookAhead = function (e) { - var t = this.doc.getLine(this.line + e); - return null != t && e > this.maxLookAhead && (this.maxLookAhead = e), t - }, Ss.prototype.baseToken = function (e) { - var t = this; - if (!this.baseTokens) return null; - for (; this.baseTokens[this.baseTokenPos] <= e;) t.baseTokenPos += 2; - var n = this.baseTokens[this.baseTokenPos + 1]; - return { - type: n && n.replace(/( |^)overlay .*/, ''), - size: this.baseTokens[this.baseTokenPos] - e - } - }, Ss.prototype.nextLine = function () { - this.line++, 0 < this.maxLookAhead && this.maxLookAhead-- - }, Ss.fromSaved = function (e, t, n) { - return t instanceof ys ? new Ss(e, oe(e.mode, t.state), n, t.lookAhead) : new Ss(e, oe(e.mode, t), n) - }, Ss.prototype.save = function (e) { - var t = !1 === e ? this.state : oe(this.doc.mode, this.state); - return 0 < this.maxLookAhead ? new ys(t, this.maxLookAhead) : t - }; - var Cs = function (e, t, n) { - this.start = e.start, this.end = e.pos, this.string = e.current(), this.type = t || null, this.state = n + goDocStart: function (e) { + return e.extendSelection(et(e.firstLine(), 0)) }, - bs = !1, - vs = !1, - Es = function (e, t, n) { - this.text = e, Ye(this, t), this.height = n ? n(this) : 1 - }; - Es.prototype.lineNo = function () { - return pe(this) - }, V(Es); - var ws = {}, - ks = {}, - Ts = null, - _s = null, - Rs = { - left: 0, - right: 0, - top: 0, - bottom: 0 + goDocEnd: function (e) { + return e.extendSelection(et(e.lastLine())) }, - xs = function (e, t, n) { - this.cm = n; - var o = this.vert = p('div', [p('div', null, null, 'min-width: 1px')], 'CodeMirror-vscrollbar'), - r = this.horiz = p('div', [p('div', null, null, 'height: 100%; min-height: 1px')], 'CodeMirror-hscrollbar'); - o.tabIndex = r.tabIndex = -1, e(o), e(r), as(o, 'scroll', function () { - o.clientHeight && t(o.scrollTop, 'vertical') - }), as(r, 'scroll', function () { - r.clientWidth && t(r.scrollLeft, 'horizontal') - }), this.checkedZeroWidth = !1, Ra && 8 > xa && (this.horiz.style.minHeight = this.vert.style.minWidth = '18px') + goLineStart: function (e) { + return e.extendSelectionsBy((function (t) { + return ns(e, t.head.line) + }), { + origin: "+move", + bias: 1 + }) }, - Ps; - xs.prototype.update = function (e) { - var t = e.scrollWidth > e.clientWidth + 1, - n = e.scrollHeight > e.clientHeight + 1, - o = e.nativeBarWidth; - if (n) { - this.vert.style.display = 'block', this.vert.style.bottom = t ? o + 'px' : '0'; - var i = e.viewHeight - (t ? o : 0); - this.vert.firstChild.style.height = r(0, e.scrollHeight - e.clientHeight + i) + 'px' - } else this.vert.style.display = '', this.vert.firstChild.style.height = '0'; - if (t) { - this.horiz.style.display = 'block', this.horiz.style.right = n ? o + 'px' : '0', this.horiz.style.left = e.barLeft + 'px'; - var a = e.viewWidth - e.barLeft - (n ? o : 0); - this.horiz.firstChild.style.width = r(0, e.scrollWidth - e.clientWidth + a) + 'px' - } else this.horiz.style.display = '', this.horiz.firstChild.style.width = '0'; - return !this.checkedZeroWidth && 0 < e.clientHeight && (0 == o && this.zeroWidthHack(), this.checkedZeroWidth = !0), { - right: n ? o : 0, - bottom: t ? o : 0 - } - }, xs.prototype.setScrollLeft = function (e) { - this.horiz.scrollLeft != e && (this.horiz.scrollLeft = e), this.disableHoriz && this.enableZeroWidthBar(this.horiz, this.disableHoriz, 'horiz') - }, xs.prototype.setScrollTop = function (e) { - this.vert.scrollTop != e && (this.vert.scrollTop = e), this.disableVert && this.enableZeroWidthBar(this.vert, this.disableVert, 'vert') - }, xs.prototype.zeroWidthHack = function () { - var e = Ha && !La ? '12px' : '18px'; - this.horiz.style.height = this.vert.style.width = e, this.horiz.style.pointerEvents = this.vert.style.pointerEvents = 'none', this.disableHoriz = new Ya, this.disableVert = new Ya - }, xs.prototype.enableZeroWidthBar = function (e, t, n) { - function o() { - var r = e.getBoundingClientRect(), - i = 'vert' == n ? document.elementFromPoint(r.right - 1, (r.top + r.bottom) / 2) : document.elementFromPoint((r.right + r.left) / 2, r.bottom - 1); - i == e ? t.set(1e3, o) : e.style.pointerEvents = 'none' - } - e.style.pointerEvents = 'auto', t.set(1e3, o) - }, xs.prototype.clear = function () { - var e = this.horiz.parentNode; - e.removeChild(this.horiz), e.removeChild(this.vert) - }; - var Ds = function () {}; - Ds.prototype.update = function () { - return { - bottom: 0, - right: 0 - } - }, Ds.prototype.setScrollLeft = function () {}, Ds.prototype.setScrollTop = function () {}, Ds.prototype.clear = function () {}; - var Ms = { - native: xs, - null: Ds + goLineStartSmart: function (e) { + return e.extendSelectionsBy((function (t) { + return rs(e, t.head) + }), { + origin: "+move", + bias: 1 + }) }, - As = 0, - Is = function (e, t, n) { - var o = e.display; - this.viewport = t, this.visible = eo(o, e.doc, t), this.editorIsHidden = !o.wrapper.offsetWidth, this.wrapperHeight = o.wrapper.clientHeight, this.wrapperWidth = o.wrapper.clientWidth, this.oldDisplayWidth = Yt(e), this.force = n, this.dims = Dn(e), this.events = [] - }; - Is.prototype.signal = function (e, t) { - W(e, t) && this.events.push(arguments) - }, Is.prototype.finish = function () { - for (var e = this, t = 0; t < this.events.length; t++) H.apply(null, e.events[t]) - }; - var Ls = 0, - Fs = null; - Ra ? Fs = -.53 : wa ? Fs = 15 : Ma ? Fs = -.7 : Ia && (Fs = -1 / 3); - var Bs = function (e, t) { - this.ranges = e, this.primIndex = t - }; - Bs.prototype.primary = function () { - return this.ranges[this.primIndex] - }, Bs.prototype.equals = function (e) { - var t = this; - if (e == this) return !0; - if (e.primIndex != this.primIndex || e.ranges.length != this.ranges.length) return !1; - for (var n = 0; n < this.ranges.length; n++) { - var o = t.ranges[n], - r = e.ranges[n]; - if (!ye(o.anchor, r.anchor) || !ye(o.head, r.head)) return !1 - } - return !0 - }, Bs.prototype.deepCopy = function () { - for (var e = this, t = [], n = 0; n < this.ranges.length; n++) t[n] = new Ns(Se(e.ranges[n].anchor), Se(e.ranges[n].head)); - return new Bs(t, this.primIndex) - }, Bs.prototype.somethingSelected = function () { - for (var e = this, t = 0; t < this.ranges.length; t++) - if (!e.ranges[t].empty()) return !0; - return !1 - }, Bs.prototype.contains = function (e, t) { - var n = this; - t || (t = e); - for (var o = 0, r; o < this.ranges.length; o++) - if (r = n.ranges[o], 0 <= ge(t, r.from()) && 0 >= ge(e, r.to())) return o; - return -1 - }; - var Ns = function (e, t) { - this.anchor = e, this.head = t - }; - Ns.prototype.from = function () { - return be(this.anchor, this.head) - }, Ns.prototype.to = function () { - return Ce(this.anchor, this.head) - }, Ns.prototype.empty = function () { - return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch - }, Jr.prototype = { - chunkSize: function () { - return this.lines.length + goLineEnd: function (e) { + return e.extendSelectionsBy((function (t) { + return function (e, t) { + var n = $e(e.doc, t), + r = function (e) { + for (var t; t = Lt(e);) e = t.find(1, !0).line; + return e + }(n); + return r != n && (t = Qe(r)), es(!0, e, n, t, -1) + }(e, t.head.line) + }), { + origin: "+move", + bias: -1 + }) }, - removeInner: function (e, t) { - for (var n = this, o = e, r; o < e + t; ++o) r = n.lines[o], n.height -= r.height, ht(r), xt(r, 'delete'); - this.lines.splice(e, t) + goLineRight: function (e) { + return e.extendSelectionsBy((function (t) { + var n = e.cursorCoords(t.head, "div").top + 5; + return e.coordsChar({ + left: e.display.lineDiv.offsetWidth + 100, + top: n + }, "div") + }), j) }, - collapse: function (e) { - e.push.apply(e, this.lines) + goLineLeft: function (e) { + return e.extendSelectionsBy((function (t) { + var n = e.cursorCoords(t.head, "div").top + 5; + return e.coordsChar({ + left: 0, + top: n + }, "div") + }), j) }, - insertInner: function (e, t, n) { - var o = this; - this.height += n, this.lines = this.lines.slice(0, e).concat(t).concat(this.lines.slice(e)); - for (var r = 0; r < t.length; ++r) t[r].parent = o + goLineLeftSmart: function (e) { + return e.extendSelectionsBy((function (t) { + var n = e.cursorCoords(t.head, "div").top + 5, + r = e.coordsChar({ + left: 0, + top: n + }, "div"); + return r.ch < e.getLine(r.line).search(/\S/) ? rs(e, t.head) : r + }), j) }, - iterN: function (t, o, n) { - for (var r = this, i = t + o; t < i; ++t) - if (n(r.lines[t])) return !0 - } - }, ei.prototype = { - chunkSize: function () { - return this.size + goLineUp: function (e) { + return e.moveV(-1, "line") }, - removeInner: function (e, t) { - var n = this; - this.size -= t; - for (var o = 0; o < this.children.length; ++o) { - var r = n.children[o], - i = r.chunkSize(); - if (e < i) { - var a = d(t, i - e), - s = r.height; - if (r.removeInner(e, a), n.height -= s - r.height, i == a && (n.children.splice(o--, 1), r.parent = null), 0 == (t -= a)) break; - e = 0 - } else e -= i - } - if (25 > this.size - t && (1 < this.children.length || !(this.children[0] instanceof Jr))) { - var l = []; - this.collapse(l), this.children = [new Jr(l)], this.children[0].parent = this - } + goLineDown: function (e) { + return e.moveV(1, "line") }, - collapse: function (e) { - for (var t = this, n = 0; n < this.children.length; ++n) t.children[n].collapse(e) + goPageUp: function (e) { + return e.moveV(-1, "page") }, - insertInner: function (e, t, n) { - var o = this; - this.size += t.length, this.height += n; - for (var r = 0; r < this.children.length; ++r) { - var i = o.children[r], - a = i.chunkSize(); - if (e <= a) { - if (i.insertInner(e, t, n), i.lines && 50 < i.lines.length) { - for (var s = i.lines.length % 25 + 25, d = s, l; d < i.lines.length;) l = new Jr(i.lines.slice(d, d += 25)), i.height -= l.height, o.children.splice(++r, 0, l), l.parent = o; - i.lines = i.lines.slice(0, s), o.maybeSpill() - } - break - } - e -= a - } + goPageDown: function (e) { + return e.moveV(1, "page") }, - maybeSpill: function () { - if (!(10 >= this.children.length)) { - var e = this; - do { - var t = e.children.splice(e.children.length - 5, 5), - n = new ei(t); - if (!e.parent) { - var o = new ei(e.children); - o.parent = e, e.children = [o, n], e = o - } else { - e.size -= n.size, e.height -= n.height; - var r = b(e.parent.children, e); - e.parent.children.splice(r + 1, 0, n) - } - n.parent = e.parent - } while (10 < e.children.length); - e.parent.maybeSpill() - } + goCharLeft: function (e) { + return e.moveH(-1, "char") }, - iterN: function (e, t, n) { - for (var o = this, r = 0; r < this.children.length; ++r) { - var i = o.children[r], - a = i.chunkSize(); - if (e < a) { - var s = d(t, a - e); - if (i.iterN(e, s, n)) return !0; - if (0 == (t -= s)) break; - e = 0 - } else e -= a + goCharRight: function (e) { + return e.moveH(1, "char") + }, + goColumnLeft: function (e) { + return e.moveH(-1, "column") + }, + goColumnRight: function (e) { + return e.moveH(1, "column") + }, + goWordLeft: function (e) { + return e.moveH(-1, "word") + }, + goGroupRight: function (e) { + return e.moveH(1, "group") + }, + goGroupLeft: function (e) { + return e.moveH(-1, "group") + }, + goWordRight: function (e) { + return e.moveH(1, "word") + }, + delCharBefore: function (e) { + return e.deleteH(-1, "char") + }, + delCharAfter: function (e) { + return e.deleteH(1, "char") + }, + delWordBefore: function (e) { + return e.deleteH(-1, "word") + }, + delWordAfter: function (e) { + return e.deleteH(1, "word") + }, + delGroupBefore: function (e) { + return e.deleteH(-1, "group") + }, + delGroupAfter: function (e) { + return e.deleteH(1, "group") + }, + indentAuto: function (e) { + return e.indentSelection("smart") + }, + indentMore: function (e) { + return e.indentSelection("add") + }, + indentLess: function (e) { + return e.indentSelection("subtract") + }, + insertTab: function (e) { + return e.replaceSelection("\t") + }, + insertSoftTab: function (e) { + for (var t = [], n = e.listSelections(), r = e.options.tabSize, i = 0; i < n.length; i++) { + var o = n[i].from(), + s = B(e.getLine(o.line), o.ch, r); + t.push(q(r - s % r)) } + e.replaceSelections(t) + }, + defaultTab: function (e) { + e.somethingSelected() ? e.indentSelection("add") : e.execCommand("insertTab") + }, + transposeChars: function (e) { + return Jr(e, (function () { + for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) + if (t[r].empty()) { + var i = t[r].head, + o = $e(e.doc, i.line).text; + if (o) + if (i.ch == o.length && (i = new et(i.line, i.ch - 1)), i.ch > 0) i = new et(i.line, i.ch + 1), e.replaceRange(o.charAt(i.ch - 1) + o.charAt(i.ch - 2), et(i.line, i.ch - 2), i, "+transpose"); + else if (i.line > e.doc.first) { + var s = $e(e.doc, i.line - 1).text; + s && (i = new et(i.line, 1), e.replaceRange(o.charAt(0) + e.doc.lineSeparator() + s.charAt(s.length - 1), et(i.line - 1, s.length - 1), i, "+transpose")) + } + n.push(new Ei(i, i)) + } e.setSelections(n) + })) + }, + newlineAndIndent: function (e) { + return Jr(e, (function () { + for (var t = e.listSelections(), n = t.length - 1; n >= 0; n--) e.replaceRange(e.doc.lineSeparator(), t[n].anchor, t[n].head, "+input"); + t = e.listSelections(); + for (var r = 0; r < t.length; r++) e.indentLine(t[r].from().line, null, !0); + Mr(e) + })) + }, + openLine: function (e) { + return e.replaceSelection("\n", "start") + }, + toggleOverwrite: function (e) { + return e.toggleOverwrite() } }; - var Os = function (e, t, n) { - var o = this; - if (n) - for (var r in n) n.hasOwnProperty(r) && (o[r] = n[r]); - this.doc = e, this.node = t - }; - Os.prototype.clear = function () { - var e = this, - t = this.doc.cm, - n = this.line.widgets, - o = this.line, - a = pe(o); - if (null != a && n) { - for (var s = 0; s < n.length; ++s) n[s] == e && n.splice(s--, 1); - n.length || (o.widgets = null); - var i = Wt(this); - ce(o, r(0, o.height - i)), t && (Ro(t, function () { - ti(t, o, -i), Nn(t, a, 'widget') - }), xt(t, 'lineWidgetCleared', t, this, a)) - } - }, Os.prototype.changed = function () { - var e = this, - t = this.height, - n = this.doc.cm, - o = this.line; - this.height = null; - var r = Wt(this) - t; - r && (!dt(this.doc, o) && ce(o, o.height + r), n && Ro(n, function () { - n.curOp.forceUpdate = !0, ti(n, o, r), xt(n, 'lineWidgetChanged', n, e, pe(o)) - })) - }, V(Os); - var Hs = 0, - zs = function (e, t) { - this.lines = [], this.type = t, this.doc = e, this.id = ++Hs - }; - zs.prototype.clear = function () { - var e = this; - if (!this.explicitlyCleared) { - var t = this.doc.cm, - n = t && !t.curOp; - if (n && Co(t), W(this, 'clear')) { - var o = this.find(); - o && xt(this, 'clear', o.from, o.to) - } - for (var r = null, a = null, s = 0; s < this.lines.length; ++s) { - var i = e.lines[s], - d = He(i.markedSpans, e); - t && !e.collapsed ? Nn(t, pe(i), 'text') : t && (null != d.to && (a = pe(i)), null != d.from && (r = pe(i))), i.markedSpans = ze(i.markedSpans, d), null == d.from && e.collapsed && !dt(e.doc, i) && t && ce(i, xn(t.display)) - } - if (t && this.collapsed && !t.options.lineWrapping) - for (var l = 0; l < this.lines.length; ++l) { - var c = ot(e.lines[l]), - p = pt(c); - p > t.display.maxLineLength && (t.display.maxLine = c, t.display.maxLineLength = p, t.display.maxLineChanged = !0) - } - null != r && t && this.collapsed && Bn(t, r, a + 1), this.lines.length = 0, this.explicitlyCleared = !0, this.atomic && this.doc.cantEdit && (this.doc.cantEdit = !1, t && Fr(t.doc)), t && xt(t, 'markerCleared', t, this, r, a), n && bo(t), this.parent && this.parent.clear() + + function ns(e, t) { + var n = $e(e.doc, t), + r = Bt(n); + return r != n && (t = Qe(r)), es(!0, e, r, t, 1) + } + + function rs(e, t) { + var n = ns(e, t.line), + r = $e(e.doc, n.line), + i = ce(r, e.doc.direction); + if (!i || 0 == i[0].level) { + var o = Math.max(0, r.text.search(/\S/)), + s = t.line == n.line && t.ch <= o && t.ch; + return et(n.line, s ? 0 : o, n.sticky) } - }, zs.prototype.find = function (e, t) { - var n = this; - null == e && 'bookmark' == this.type && (e = 1); - for (var o = 0, r, i; o < this.lines.length; ++o) { - var a = n.lines[o], - s = He(a.markedSpans, n); - if (null != s.from && (r = fe(t ? a : pe(a), s.from), -1 == e)) return r; - if (null != s.to && (i = fe(t ? a : pe(a), s.to), 1 == e)) return i - } - return r && { - from: r, - to: i - } - }, zs.prototype.changed = function () { - var e = this, - t = this.find(-1, !0), - n = this, - o = this.doc.cm; - t && o && Ro(o, function () { - var r = t.line, - i = pe(t.line), - a = en(o, i); - if (a && (ln(a), o.curOp.selectionChanged = o.curOp.forceUpdate = !0), o.curOp.updateMaxLine = !0, !dt(n.doc, r) && null != n.height) { - var s = n.height; - n.height = null; - var d = Wt(n) - s; - d && ce(r, r.height + d) + return n + } + + function is(e, t, n) { + if ("string" == typeof t && !(t = ts[t])) return !1; + e.display.input.ensurePolled(); + var r = e.display.shift, + i = !1; + try { + e.isReadOnly() && (e.state.suppressEdits = !0), n && (e.display.shift = !1), i = t(e) != U + } finally { + e.display.shift = r, e.state.suppressEdits = !1 + } + return i + } + var os = new H; + + function ss(e, t, n, r) { + var i = e.state.keySeq; + if (i) { + if (qo(t)) return "handled"; + if (/\'$/.test(t) ? e.state.keySeq = null : os.set(50, (function () { + e.state.keySeq == i && (e.state.keySeq = null, e.display.input.reset()) + })), as(e, i + " " + t, n, r)) return !0 + } + return as(e, t, n, r) + } + + function as(e, t, n, r) { + var i = function (e, t, n) { + for (var r = 0; r < e.state.keyMaps.length; r++) { + var i = $o(t, e.state.keyMaps[r], n, e); + if (i) return i } - xt(o, 'markerChanged', o, e) - }) - }, zs.prototype.attachLine = function (e) { - if (!this.lines.length && this.doc.cm) { - var t = this.doc.cm.curOp; - t.maybeHiddenMarkers && -1 != b(t.maybeHiddenMarkers, this) || (t.maybeUnhiddenMarkers || (t.maybeUnhiddenMarkers = [])).push(this) + return e.options.extraKeys && $o(t, e.options.extraKeys, n, e) || $o(t, e.options.keyMap, n, e) + }(e, t, r); + return "multi" == i && (e.state.keySeq = t), "handled" == i && ln(e, "keyHandled", e, t, n), "handled" != i && "multi" != i || (we(n), Sr(e)), !!i + } + + function ls(e, t) { + var n = Yo(t, !0); + return !!n && (t.shiftKey && !e.state.keySeq ? ss(e, "Shift-" + n, t, (function (t) { + return is(e, t, !0) + })) || ss(e, n, t, (function (t) { + if ("string" == typeof t ? /^go[A-Z]/.test(t) : t.motion) return is(e, t) + })) : ss(e, n, t, (function (t) { + return is(e, t) + }))) + } + var cs = null; + + function us(e) { + var t = this; + if (t.curOp.focus = P(), !me(t, e)) { + s && a < 11 && 27 == e.keyCode && (e.returnValue = !1); + var n = e.keyCode; + t.display.shift = 16 == n || e.shiftKey; + var r = ls(t, e); + h && (cs = r ? n : null, r || 88 != n || Ie || !(v ? e.metaKey : e.ctrlKey) || t.replaceSelection("", null, "cut")), 18 != n || /\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className) || function (e) { + var t = e.display.lineDiv; + + function n(e) { + 18 != e.keyCode && e.altKey || (T(t, "CodeMirror-crosshair"), de(document, "keyup", n), de(document, "mouseover", n)) + } + I(t, "CodeMirror-crosshair"), he(document, "keyup", n), he(document, "mouseover", n) + }(t) } - this.lines.push(e) - }, zs.prototype.detachLine = function (e) { - if (this.lines.splice(b(this.lines, e), 1), !this.lines.length && this.doc.cm) { - var t = this.doc.cm.curOp; - (t.maybeHiddenMarkers || (t.maybeHiddenMarkers = [])).push(this) + } + + function hs(e) { + 16 == e.keyCode && (this.doc.sel.shift = !1), me(this, e) + } + + function ps(e) { + var t = this; + if (!(Cn(t.display, e) || me(t, e) || e.ctrlKey && !e.altKey || v && e.metaKey)) { + var n = e.keyCode, + r = e.charCode; + if (h && n == cs) return cs = null, void we(e); + if (!h || e.which && !(e.which < 10) || !ls(t, e)) { + var i = String.fromCharCode(null == r ? n : r); + "\b" != i && (function (e, t, n) { + return ss(e, "'" + n + "'", t, (function (t) { + return is(e, t, !0) + })) + }(t, e, i) || t.display.input.onKeyPress(e)) + } } - }, V(zs); - var Us = function (e, t) { - var n = this; - this.markers = e, this.primary = t; - for (var o = 0; o < e.length; ++o) e[o].parent = n + } + var ds, fs, ms = function (e, t, n) { + this.time = e, this.pos = t, this.button = n }; - Us.prototype.clear = function () { - var e = this; - if (!this.explicitlyCleared) { - this.explicitlyCleared = !0; - for (var t = 0; t < this.markers.length; ++t) e.markers[t].clear(); - xt(this, 'clear') + + function gs(e) { + var t = this, + n = t.display; + if (!(me(t, e) || n.activeTouch && n.input.supportsTouch())) + if (n.input.ensurePolled(), n.shift = e.shiftKey, Cn(n, e)) l || (n.scroller.draggable = !1, setTimeout((function () { + return n.scroller.draggable = !0 + }), 100)); + else if (!ws(t, e)) { + var r = cr(t, e), + i = ke(e), + o = r ? function (e, t) { + var n = +new Date; + return fs && fs.compare(n, e, t) ? (ds = fs = null, "triple") : ds && ds.compare(n, e, t) ? (fs = new ms(n, e, t), ds = null, "double") : (ds = new ms(n, e, t), fs = null, "single") + }(r, i) : "single"; + window.focus(), 1 == i && t.state.selectingText && t.state.selectingText(e), r && function (e, t, n, r, i) { + var o = "Click"; + return "double" == r ? o = "Double" + o : "triple" == r && (o = "Triple" + o), ss(e, Ko(o = (1 == t ? "Left" : 2 == t ? "Middle" : "Right") + o, i), i, (function (t) { + if ("string" == typeof t && (t = ts[t]), !t) return !1; + var r = !1; + try { + e.isReadOnly() && (e.state.suppressEdits = !0), r = t(e, n) != U + } finally { + e.state.suppressEdits = !1 + } + return r + })) + }(t, i, r, o, e) || (1 == i ? r ? function (e, t, n, r) { + s ? setTimeout(N(Cr, e), 0) : e.curOp.focus = P(); + var i, o = function (e, t, n) { + var r = e.getOption("configureMouse"), + i = r ? r(e, t, n) : {}; + if (null == i.unit) { + var o = w ? n.shiftKey && n.metaKey : n.altKey; + i.unit = o ? "rectangle" : "single" == t ? "char" : "double" == t ? "word" : "line" + } + return (null == i.extend || e.doc.extend) && (i.extend = e.doc.extend || n.shiftKey), null == i.addNew && (i.addNew = v ? n.metaKey : n.ctrlKey), null == i.moveOnDrag && (i.moveOnDrag = !(v ? n.altKey : n.ctrlKey)), i + }(e, n, r), + c = e.doc.sel; + e.options.dragDrop && Re && !e.isReadOnly() && "single" == n && (i = c.contains(t)) > -1 && (tt((i = c.ranges[i]).from(), t) < 0 || t.xRel > 0) && (tt(i.to(), t) > 0 || t.xRel < 0) ? function (e, t, n, r) { + var i = e.display, + o = !1, + c = ei(e, (function (t) { + l && (i.scroller.draggable = !1), e.state.draggingText = !1, de(i.wrapper.ownerDocument, "mouseup", c), de(i.wrapper.ownerDocument, "mousemove", u), de(i.scroller, "dragstart", h), de(i.scroller, "drop", c), o || (we(t), r.addNew || Ki(e.doc, n, null, null, r.extend), l || s && 9 == a ? setTimeout((function () { + i.wrapper.ownerDocument.body.focus(), i.input.focus() + }), 20) : i.input.focus()) + })), + u = function (e) { + o = o || Math.abs(t.clientX - e.clientX) + Math.abs(t.clientY - e.clientY) >= 10 + }, + h = function () { + return o = !0 + }; + l && (i.scroller.draggable = !0), e.state.draggingText = c, c.copy = !r.moveOnDrag, i.scroller.dragDrop && i.scroller.dragDrop(), he(i.wrapper.ownerDocument, "mouseup", c), he(i.wrapper.ownerDocument, "mousemove", u), he(i.scroller, "dragstart", h), he(i.scroller, "drop", c), Er(e), setTimeout((function () { + return i.input.focus() + }), 20) + }(e, r, t, o) : function (e, t, n, r) { + var i = e.display, + o = e.doc; + we(t); + var s, a, l = o.sel, + c = l.ranges; + if (r.addNew && !r.extend ? (a = o.sel.contains(n), s = a > -1 ? c[a] : new Ei(n, n)) : (s = o.sel.primary(), a = o.sel.primIndex), "rectangle" == r.unit) r.addNew || (s = new Ei(n, n)), n = cr(e, t, !0, !0), a = -1; + else { + var u = ys(e, n, r.unit); + s = r.extend ? qi(s, u.anchor, u.head, r.extend) : u + } + r.addNew ? -1 == a ? (a = c.length, Ji(o, ki(e, c.concat([s]), a), { + scroll: !1, + origin: "*mouse" + })) : c.length > 1 && c[a].empty() && "char" == r.unit && !r.extend ? (Ji(o, ki(e, c.slice(0, a).concat(c.slice(a + 1)), 0), { + scroll: !1, + origin: "*mouse" + }), l = o.sel) : Qi(o, a, s, V) : (a = 0, Ji(o, new Ci([s], 0), V), l = o.sel); + var h = n; + + function p(t) { + if (0 != tt(h, t)) + if (h = t, "rectangle" == r.unit) { + for (var i = [], c = e.options.tabSize, u = B($e(o, n.line).text, n.ch, c), p = B($e(o, t.line).text, t.ch, c), d = Math.min(u, p), f = Math.max(u, p), m = Math.min(n.line, t.line), g = Math.min(e.lastLine(), Math.max(n.line, t.line)); m <= g; m++) { + var y = $e(o, m).text, + v = G(y, d, c); + d == f ? i.push(new Ei(et(m, v), et(m, v))) : y.length > v && i.push(new Ei(et(m, v), et(m, G(y, f, c)))) + } + i.length || i.push(new Ei(n, n)), Ji(o, ki(e, l.ranges.slice(0, a).concat(i), a), { + origin: "*mouse", + scroll: !1 + }), e.scrollIntoView(t) + } else { + var w, b = s, + S = ys(e, t, r.unit), + C = b.anchor; + tt(S.anchor, C) > 0 ? (w = S.head, C = ot(b.from(), S.anchor)) : (w = S.anchor, C = it(b.to(), S.head)); + var E = l.ranges.slice(0); + E[a] = function (e, t) { + var n = t.anchor, + r = t.head, + i = $e(e.doc, n.line); + if (0 == tt(n, r) && n.sticky == r.sticky) return t; + var o = ce(i); + if (!o) return t; + var s = ae(o, n.ch, n.sticky), + a = o[s]; + if (a.from != n.ch && a.to != n.ch) return t; + var l, c = s + (a.from == n.ch == (1 != a.level) ? 0 : 1); + if (0 == c || c == o.length) return t; + if (r.line != n.line) l = (r.line - n.line) * ("ltr" == e.doc.direction ? 1 : -1) > 0; + else { + var u = ae(o, r.ch, r.sticky), + h = u - s || (r.ch - n.ch) * (1 == a.level ? -1 : 1); + l = u == c - 1 || u == c ? h < 0 : h > 0 + } + var p = o[c + (l ? -1 : 0)], + d = l == (1 == p.level), + f = d ? p.from : p.to, + m = d ? "after" : "before"; + return n.ch == f && n.sticky == m ? t : new Ei(new et(n.line, f, m), r) + }(e, new Ei(at(o, C), w)), Ji(o, ki(e, E, a), V) + } + } + var d = i.wrapper.getBoundingClientRect(), + f = 0; + + function m(t) { + e.state.selectingText = !1, f = 1 / 0, t && (we(t), i.input.focus()), de(i.wrapper.ownerDocument, "mousemove", g), de(i.wrapper.ownerDocument, "mouseup", y), o.history.lastSelOrigin = null + } + var g = ei(e, (function (t) { + 0 !== t.buttons && ke(t) ? function t(n) { + var s = ++f, + a = cr(e, n, !0, "rectangle" == r.unit); + if (a) + if (0 != tt(a, h)) { + e.curOp.focus = P(), p(a); + var l = Dr(i, o); + (a.line >= l.to || a.line < l.from) && setTimeout(ei(e, (function () { + f == s && t(n) + })), 150) + } else { + var c = n.clientY < d.top ? -20 : n.clientY > d.bottom ? 20 : 0; + c && setTimeout(ei(e, (function () { + f == s && (i.scroller.scrollTop += c, t(n)) + })), 50) + } + }(t) : m(t) + })), + y = ei(e, m); + e.state.selectingText = y, he(i.wrapper.ownerDocument, "mousemove", g), he(i.wrapper.ownerDocument, "mouseup", y) + }(e, r, t, o) + }(t, r, o, e) : Ee(e) == n.scroller && we(e) : 2 == i ? (r && Ki(t.doc, r), setTimeout((function () { + return n.input.focus() + }), 20)) : 3 == i && (E ? t.display.input.onContextMenu(e) : Er(t))) } - }, Us.prototype.find = function (e, t) { - return this.primary.find(e, t) - }, V(Us); - var Ws = 0, - Vs = function (e, t, n, o, r) { - if (!(this instanceof Vs)) return new Vs(e, t, n, o, r); - null == n && (n = 0), ei.call(this, [new Jr([new Es('', null)])]), this.first = n, this.scrollTop = this.scrollLeft = 0, this.cantEdit = !1, this.cleanGeneration = 1, this.modeFrontier = this.highlightFrontier = n; - var i = fe(n, 0); - this.sel = Zo(i), this.history = new ur(null), this.id = ++Ws, this.modeOption = t, this.lineSep = o, this.direction = 'rtl' == r ? 'rtl' : 'ltr', this.extend = !1, 'string' == typeof e && (e = this.splitLines(e)), sr(this, { - from: i, - to: i, - text: e - }), Ar(this, Zo(i), $a) - }; - Vs.prototype = R(ei.prototype, { - constructor: Vs, - iter: function (e, t, n) { - n ? this.iterN(e - this.first, t - e, n) : this.iterN(this.first, this.first + this.size, e) - }, - insert: function (e, t) { - for (var n = 0, o = 0; o < t.length; ++o) n += t[o].height; - this.insertInner(e - this.first, t, n) - }, - remove: function (e, t) { - this.removeInner(e - this.first, t) - }, - getValue: function (e) { - var t = le(this, this.first, this.first + this.size); - return !1 === e ? t : t.join(e || this.lineSeparator()) - }, - setValue: Do(function (e) { - var t = fe(this.first, 0), - n = this.first + this.size - 1; - Wr(this, { - from: t, - to: fe(n, se(this, n).text.length), - text: this.splitLines(e), - origin: 'setValue', - full: !0 - }, !0), this.cm && so(this.cm, 0, 0), Ar(this, Zo(t), $a) - }), - replaceRange: function (e, t, n, o) { - t = Ee(this, t), n = n ? Ee(this, n) : t, Yr(this, e, t, n, o) - }, - getRange: function (e, t, n) { - var o = de(this, Ee(this, e), Ee(this, t)); - return !1 === n ? o : o.join(n || this.lineSeparator()) - }, - getLine: function (e) { - var t = this.getLineHandle(e); - return t && t.text - }, - getLineHandle: function (e) { - if (me(this, e)) return se(this, e) - }, - getLineNumber: function (e) { - return pe(e) - }, - getLineHandleVisualStart: function (e) { - return 'number' == typeof e && (e = se(this, e)), ot(e) - }, - lineCount: function () { - return this.size - }, - firstLine: function () { - return this.first - }, - lastLine: function () { - return this.first + this.size - 1 - }, - clipPos: function (e) { - return Ee(this, e) - }, - getCursor: function (e) { - var t = this.sel.primary(), - n; - return n = null == e || 'head' == e ? t.head : 'anchor' == e ? t.anchor : 'end' == e || 'to' == e || !1 === e ? t.to() : t.from(), n - }, - listSelections: function () { - return this.sel.ranges - }, - somethingSelected: function () { - return this.sel.somethingSelected() - }, - setCursor: Do(function (e, t, n) { - Pr(this, Ee(this, 'number' == typeof e ? fe(e, t || 0) : e), null, n) - }), - setSelection: Do(function (e, t, n) { - Pr(this, Ee(this, e), Ee(this, t || e), n) - }), - extendSelection: Do(function (e, t, n) { - _r(this, Ee(this, e), t && Ee(this, t), n) - }), - extendSelections: Do(function (e, t) { - Rr(this, ke(this, e), t) - }), - extendSelectionsBy: Do(function (e, t) { - var n = k(this.sel.ranges, e); - Rr(this, ke(this, n), t) - }), - setSelections: Do(function (e, t, n) { - var o = this; - if (e.length) { - for (var r = [], a = 0; a < e.length; a++) r[a] = new Ns(Ee(o, e[a].anchor), Ee(o, e[a].head)); - null == t && (t = d(e.length - 1, this.sel.primIndex)), Ar(this, $o(this.cm, r, t), n) + } + + function ys(e, t, n) { + if ("char" == n) return new Ei(t, t); + if ("word" == n) return e.findWordAt(t); + if ("line" == n) return new Ei(et(t.line, 0), at(e.doc, et(t.line + 1, 0))); + var r = n(e, t); + return new Ei(r.from, r.to) + } + + function vs(e, t, n, r) { + var i, o; + if (t.touches) i = t.touches[0].clientX, o = t.touches[0].clientY; + else try { + i = t.clientX, o = t.clientY + } catch (t) { + return !1 + } + if (i >= Math.floor(e.display.gutters.getBoundingClientRect().right)) return !1; + r && we(t); + var s = e.display, + a = s.lineDiv.getBoundingClientRect(); + if (o > a.bottom || !ye(e, n)) return Se(t); + o -= a.top - s.viewOffset; + for (var l = 0; l < e.display.gutterSpecs.length; ++l) { + var c = s.gutters.childNodes[l]; + if (c && c.getBoundingClientRect().right >= i) return fe(e, n, e, Ze(e.doc, o), e.display.gutterSpecs[l].className, t), Se(t) + } + } + + function ws(e, t) { + return vs(e, t, "gutterClick", !0) + } + + function bs(e, t) { + Cn(e.display, t) || function (e, t) { + return !!ye(e, "gutterContextMenu") && vs(e, t, "gutterContextMenu", !1) + }(e, t) || me(e, t, "contextmenu") || E || e.display.input.onContextMenu(t) + } + + function Ss(e) { + e.display.wrapper.className = e.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + e.options.theme.replace(/(^|\s)\s*/g, " cm-s-"), zn(e) + } + ms.prototype.compare = function (e, t, n) { + return this.time + 400 > e && 0 == tt(t, this.pos) && n == this.button + }; + var Cs = { + toString: function () { + return "CodeMirror.Init" } - }), - addSelection: Do(function (e, t, n) { - var o = this.sel.ranges.slice(0); - o.push(new Ns(Ee(this, e), Ee(this, t || e))), Ar(this, $o(this.cm, o, o.length - 1), n) - }), - getSelection: function (e) { - for (var t = this, n = this.sel.ranges, o = 0, r, i; o < n.length; o++) i = de(t, n[o].from(), n[o].to()), r = r ? r.concat(i) : i; - return !1 === e ? r : r.join(e || this.lineSeparator()) - }, - getSelections: function (e) { - for (var t = this, n = [], o = this.sel.ranges, r = 0, i; r < o.length; r++) i = de(t, o[r].from(), o[r].to()), !1 !== e && (i = i.join(e || t.lineSeparator())), n[r] = i; - return n - }, - replaceSelection: function (e, t, n) { - for (var o = [], r = 0; r < this.sel.ranges.length; r++) o[r] = e; - this.replaceSelections(o, t, n || '+input') - }, - replaceSelections: Do(function (e, t, n) { - for (var o = this, r = [], a = this.sel, s = 0, i; s < a.ranges.length; s++) i = a.ranges[s], r[s] = { - from: i.from(), - to: i.to(), - text: o.splitLines(e[s]), - origin: n - }; - for (var d = t && 'end' != t && or(this, r, t), l = r.length - 1; 0 <= l; l--) Wr(o, r[l]); - d ? Mr(this, d) : this.cm && ao(this.cm) - }), - undo: Do(function () { - Gr(this, 'undo') - }), - redo: Do(function () { - Gr(this, 'redo') - }), - undoSelection: Do(function () { - Gr(this, 'undo', !0) - }), - redoSelection: Do(function () { - Gr(this, 'redo', !0) - }), - setExtending: function (e) { - this.extend = e }, - getExtending: function () { - return this.extend - }, - historySize: function () { - for (var e = this.history, t = 0, n = 0, o = 0; o < e.done.length; o++) e.done[o].ranges || ++t; - for (var r = 0; r < e.undone.length; r++) e.undone[r].ranges || ++n; - return { - undo: t, - redo: n + Es = {}, + ks = {}; + + function xs(e, t, n) { + if (!t != !(n && n != Cs)) { + var r = e.display.dragFunctions, + i = t ? he : de; + i(e.display.scroller, "dragstart", r.start), i(e.display.scroller, "dragenter", r.enter), i(e.display.scroller, "dragover", r.over), i(e.display.scroller, "dragleave", r.leave), i(e.display.scroller, "drop", r.drop) + } + } + + function Ts(e) { + e.options.lineWrapping ? (I(e.display.wrapper, "CodeMirror-wrap"), e.display.sizer.style.minWidth = "", e.display.sizerWidth = null) : (T(e.display.wrapper, "CodeMirror-wrap"), Gt(e)), lr(e), hr(e), zn(e), setTimeout((function () { + return Ur(e) + }), 100) + } + + function Rs(e, t) { + var n = this; + if (!(this instanceof Rs)) return new Rs(e, t); + this.options = t = t ? F(t) : {}, F(Es, t, !1); + var r = t.value; + "string" == typeof r ? r = new Mo(r, t.mode, null, t.lineSeparator, t.direction) : t.mode && (r.modeOption = t.mode), this.doc = r; + var i = new Rs.inputStyles[t.inputStyle](this), + o = this.display = new gi(e, r, i, t); + for (var c in o.wrapper.CodeMirror = this, Ss(this), t.lineWrapping && (this.display.wrapper.className += " CodeMirror-wrap"), jr(this), this.state = { + keyMaps: [], + overlays: [], + modeGen: 0, + overwrite: !1, + delayingBlurEvent: !1, + focused: !1, + suppressEdits: !1, + pasteIncoming: -1, + cutIncoming: -1, + selectingText: !1, + draggingText: !1, + highlight: new H, + keySeq: null, + specialChars: null + }, t.autofocus && !y && o.input.focus(), s && a < 11 && setTimeout((function () { + return n.display.input.reset(!0) + }), 20), + function (e) { + var t = e.display; + he(t.scroller, "mousedown", ei(e, gs)), he(t.scroller, "dblclick", s && a < 11 ? ei(e, (function (t) { + if (!me(e, t)) { + var n = cr(e, t); + if (n && !ws(e, t) && !Cn(e.display, t)) { + we(t); + var r = e.findWordAt(n); + Ki(e.doc, r.anchor, r.head) + } + } + })) : function (t) { + return me(e, t) || we(t) + }), he(t.scroller, "contextmenu", (function (t) { + return bs(e, t) + })); + var n, r = { + end: 0 + }; + + function i() { + t.activeTouch && (n = setTimeout((function () { + return t.activeTouch = null + }), 1e3), (r = t.activeTouch).end = +new Date) + } + + function o(e, t) { + if (null == t.left) return !0; + var n = t.left - e.left, + r = t.top - e.top; + return n * n + r * r > 400 + } + he(t.scroller, "touchstart", (function (i) { + if (!me(e, i) && ! function (e) { + if (1 != e.touches.length) return !1; + var t = e.touches[0]; + return t.radiusX <= 1 && t.radiusY <= 1 + }(i) && !ws(e, i)) { + t.input.ensurePolled(), clearTimeout(n); + var o = +new Date; + t.activeTouch = { + start: o, + moved: !1, + prev: o - r.end <= 300 ? r : null + }, 1 == i.touches.length && (t.activeTouch.left = i.touches[0].pageX, t.activeTouch.top = i.touches[0].pageY) + } + })), he(t.scroller, "touchmove", (function () { + t.activeTouch && (t.activeTouch.moved = !0) + })), he(t.scroller, "touchend", (function (n) { + var r = t.activeTouch; + if (r && !Cn(t, n) && null != r.left && !r.moved && new Date - r.start < 300) { + var s, a = e.coordsChar(t.activeTouch, "page"); + s = !r.prev || o(r, r.prev) ? new Ei(a, a) : !r.prev.prev || o(r, r.prev.prev) ? e.findWordAt(a) : new Ei(et(a.line, 0), at(e.doc, et(a.line + 1, 0))), e.setSelection(s.anchor, s.head), e.focus(), we(n) + } + i() + })), he(t.scroller, "touchcancel", i), he(t.scroller, "scroll", (function () { + t.scroller.clientHeight && (Lr(e, t.scroller.scrollTop), Fr(e, t.scroller.scrollLeft, !0), fe(e, "scroll", e)) + })), he(t.scroller, "mousewheel", (function (t) { + return Si(e, t) + })), he(t.scroller, "DOMMouseScroll", (function (t) { + return Si(e, t) + })), he(t.wrapper, "scroll", (function () { + return t.wrapper.scrollTop = t.wrapper.scrollLeft = 0 + })), t.dragFunctions = { + enter: function (t) { + me(e, t) || Ce(t) + }, + over: function (t) { + me(e, t) || (function (e, t) { + var n = cr(e, t); + if (n) { + var r = document.createDocumentFragment(); + vr(e, n, r), e.display.dragCursor || (e.display.dragCursor = _("div", null, "CodeMirror-cursors CodeMirror-dragcursors"), e.display.lineSpace.insertBefore(e.display.dragCursor, e.display.cursorDiv)), D(e.display.dragCursor, r) + } + }(e, t), Ce(t)) + }, + start: function (t) { + return function (e, t) { + if (s && (!e.state.draggingText || +new Date - Po < 100)) Ce(t); + else if (!me(e, t) && !Cn(e.display, t) && (t.dataTransfer.setData("Text", e.getSelection()), t.dataTransfer.effectAllowed = "copyMove", t.dataTransfer.setDragImage && !p)) { + var n = _("img", null, null, "position: fixed; left: 0; top: 0;"); + n.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", h && (n.width = n.height = 1, e.display.wrapper.appendChild(n), n._top = n.offsetTop), t.dataTransfer.setDragImage(n, 0, 0), h && n.parentNode.removeChild(n) + } + }(e, t) + }, + drop: ei(e, Io), + leave: function (t) { + me(e, t) || Oo(e) + } + }; + var l = t.input.getField(); + he(l, "keyup", (function (t) { + return hs.call(e, t) + })), he(l, "keydown", ei(e, us)), he(l, "keypress", ei(e, ps)), he(l, "focus", (function (t) { + return kr(e, t) + })), he(l, "blur", (function (t) { + return xr(e, t) + })) + }(this), Fo(), $r(this), this.curOp.forceUpdate = !0, Li(this, r), t.autofocus && !y || this.hasFocus() ? setTimeout(N(kr, this), 20) : xr(this), ks) ks.hasOwnProperty(c) && ks[c](n, t[c], Cs); + pi(this), t.finishInit && t.finishInit(this); + for (var u = 0; u < Ds.length; ++u) Ds[u](n); + qr(this), l && t.lineWrapping && "optimizelegibility" == getComputedStyle(o.lineDiv).textRendering && (o.lineDiv.style.textRendering = "auto") + } + Rs.defaults = Es, Rs.optionHandlers = ks; + var Ds = []; + + function _s(e, t, n, r) { + var i, o = e.doc; + null == n && (n = "add"), "smart" == n && (o.mode.indent ? i = dt(e, t).state : n = "prev"); + var s = e.options.tabSize, + a = $e(o, t), + l = B(a.text, null, s); + a.stateAfter && (a.stateAfter = null); + var c, u = a.text.match(/^\s*/)[0]; + if (r || /\S/.test(a.text)) { + if ("smart" == n && ((c = o.mode.indent(i, a.text.slice(u.length), a.text)) == U || c > 150)) { + if (!r) return; + n = "prev" + } + } else c = 0, n = "not"; + "prev" == n ? c = t > o.first ? B($e(o, t - 1).text, null, s) : 0 : "add" == n ? c = l + e.options.indentUnit : "subtract" == n ? c = l - e.options.indentUnit : "number" == typeof n && (c = l + n), c = Math.max(0, c); + var h = "", + p = 0; + if (e.options.indentWithTabs) + for (var d = Math.floor(c / s); d; --d) p += s, h += "\t"; + if (p < c && (h += q(c - p)), h != u) return mo(o, h, et(t, 0), et(t, u.length), "+input"), a.stateAfter = null, !0; + for (var f = 0; f < o.sel.ranges.length; f++) { + var m = o.sel.ranges[f]; + if (m.head.line == t && m.head.ch < u.length) { + var g = et(t, u.length); + Qi(o, f, new Ei(g, g)); + break } - }, - clearHistory: function () { - this.history = new ur(this.history.maxGeneration) - }, - markClean: function () { - this.cleanGeneration = this.changeGeneration(!0) - }, - changeGeneration: function (e) { - return e && (this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null), this.history.generation - }, - isClean: function (e) { - return this.history.generation == (e || this.cleanGeneration) - }, - getHistory: function () { - return { - done: kr(this.history.done), - undone: kr(this.history.undone) + } + } + Rs.defineInitHook = function (e) { + return Ds.push(e) + }; + var As = null; + + function Ms(e) { + As = e + } + + function Ps(e, t, n, r, i) { + var o = e.doc; + e.display.shift = !1, r || (r = o.sel); + var s = +new Date - 200, + a = "paste" == i || e.state.pasteIncoming > s, + l = Me(t), + c = null; + if (a && r.ranges.length > 1) + if (As && As.text.join("\n") == t) { + if (r.ranges.length % As.text.length == 0) { + c = []; + for (var u = 0; u < As.text.length; u++) c.push(o.splitLines(As.text[u])) + } + } else l.length == r.ranges.length && e.options.pasteLinesPerSelection && (c = Y(l, (function (e) { + return [e] + }))); + for (var h = e.curOp.updateInput, p = r.ranges.length - 1; p >= 0; p--) { + var d = r.ranges[p], + f = d.from(), + m = d.to(); + d.empty() && (n && n > 0 ? f = et(f.line, f.ch - n) : e.state.overwrite && !a ? m = et(m.line, Math.min($e(o, m.line).text.length, m.ch + K(l).length)) : a && As && As.lineWise && As.text.join("\n") == t && (f = m = et(f.line, 0))); + var g = { + from: f, + to: m, + text: c ? c[p % c.length] : l, + origin: i || (a ? "paste" : e.state.cutIncoming > s ? "cut" : "+input") + }; + co(e.doc, g), ln(e, "inputRead", e, g) + } + t && !a && Os(e, t), Mr(e), e.curOp.updateInput < 2 && (e.curOp.updateInput = h), e.curOp.typing = !0, e.state.pasteIncoming = e.state.cutIncoming = -1 + } + + function Is(e, t) { + var n = e.clipboardData && e.clipboardData.getData("Text"); + if (n) return e.preventDefault(), t.isReadOnly() || t.options.disableInput || Jr(t, (function () { + return Ps(t, n, 0, null, "paste") + })), !0 + } + + function Os(e, t) { + if (e.options.electricChars && e.options.smartIndent) + for (var n = e.doc.sel, r = n.ranges.length - 1; r >= 0; r--) { + var i = n.ranges[r]; + if (!(i.head.ch > 100 || r && n.ranges[r - 1].head.line == i.head.line)) { + var o = e.getModeAt(i.head), + s = !1; + if (o.electricChars) { + for (var a = 0; a < o.electricChars.length; a++) + if (t.indexOf(o.electricChars.charAt(a)) > -1) { + s = _s(e, i.head.line, "smart"); + break + } + } else o.electricInput && o.electricInput.test($e(e.doc, i.head.line).text.slice(0, i.head.ch)) && (s = _s(e, i.head.line, "smart")); + s && ln(e, "electricInput", e, i.head.line) + } } - }, - setHistory: function (e) { - var t = this.history = new ur(this.history.maxGeneration); - t.done = kr(e.done.slice(0), null, !0), t.undone = kr(e.undone.slice(0), null, !0) - }, - setGutterMarker: Do(function (e, t, n) { - return Zr(this, e, 'gutter', function (e) { - var o = e.gutterMarkers || (e.gutterMarkers = {}); - return o[t] = n, !n && D(o) && (e.gutterMarkers = null), !0 - }) - }), - clearGutter: Do(function (e) { - var t = this; - this.iter(function (n) { - n.gutterMarkers && n.gutterMarkers[e] && Zr(t, n, 'gutter', function () { - return n.gutterMarkers[e] = null, D(n.gutterMarkers) && (n.gutterMarkers = null), !0 - }) - }) - }), - lineInfo: function (e) { - var t; - if ('number' == typeof e) { - if (!me(this, e)) return null; - if (t = e, e = se(this, e), !e) return null - } else if (t = pe(e), null == t) return null; - return { - line: t, - handle: e, - text: e.text, - gutterMarkers: e.gutterMarkers, - textClass: e.textClass, - bgClass: e.bgClass, - wrapClass: e.wrapClass, - widgets: e.widgets - } - }, - addLineClass: Do(function (t, n, o) { - return Zr(this, t, 'gutter' == n ? 'gutter' : 'class', function (t) { - var r = 'text' == n ? 'textClass' : 'background' == n ? 'bgClass' : 'gutter' == n ? 'gutterClass' : 'wrapClass'; - if (!t[r]) t[r] = o; - else { - if (e(o).test(t[r])) return !1; - t[r] += ' ' + o - } - return !0 - }) - }), - removeLineClass: Do(function (t, n, o) { - return Zr(this, t, 'gutter' == n ? 'gutter' : 'class', function (t) { - var r = 'text' == n ? 'textClass' : 'background' == n ? 'bgClass' : 'gutter' == n ? 'gutterClass' : 'wrapClass', - i = t[r]; - if (!i) return !1; - if (null == o) t[r] = null; - else { - var a = i.match(e(o)); - if (!a) return !1; - var s = a.index + a[0].length; - t[r] = i.slice(0, a.index) + (a.index && s != i.length ? ' ' : '') + i.slice(s) || null - } - return !0 - }) - }), - addLineWidget: Do(function (e, t, n) { - return ni(this, e, t, n) - }), - removeLineWidget: function (e) { - e.clear() - }, - markText: function (e, t, n) { - return oi(this, Ee(this, e), Ee(this, t), n, n && n.type || 'range') - }, - setBookmark: function (e, t) { - var n = { - replacedWith: t && (null == t.nodeType ? t.widget : t), - insertLeft: t && t.insertLeft, - clearWhenEmpty: !1, - shared: t && t.shared, - handleMouseEvents: t && t.handleMouseEvents - }; - return e = Ee(this, e), oi(this, e, e, n, 'bookmark') - }, - findMarksAt: function (e) { - e = Ee(this, e); - var t = [], - n = se(this, e.line).markedSpans; - if (n) - for (var o = 0, r; o < n.length; ++o) r = n[o], (null == r.from || r.from <= e.ch) && (null == r.to || r.to >= e.ch) && t.push(r.marker.parent || r.marker); - return t - }, - findMarks: function (e, t, n) { - e = Ee(this, e), t = Ee(this, t); - var o = [], - r = e.line; - return this.iter(e.line, t.line + 1, function (a) { - var s = a.markedSpans; - if (s) - for (var d = 0, i; d < s.length; d++) i = s[d], null != i.to && r == e.line && e.ch >= i.to || null == i.from && r != e.line || null != i.from && r == t.line && i.from >= t.ch || n && !n(i.marker) || o.push(i.marker.parent || i.marker); - ++r - }), o - }, - getAllMarks: function () { - var e = []; - return this.iter(function (t) { - var n = t.markedSpans; - if (n) - for (var o = 0; o < n.length; ++o) null != n[o].from && e.push(n[o].marker) - }), e - }, - posFromIndex: function (e) { - var t = this.first, - n = this.lineSeparator().length, - o; - return this.iter(function (r) { - var i = r.text.length + n; - return i > e ? (o = e, !0) : void(e -= i, ++t) - }), Ee(this, fe(t, o)) - }, - indexFromPos: function (e) { - e = Ee(this, e); - var t = e.ch; - if (e.line < this.first || 0 > e.ch) return 0; - var n = this.lineSeparator().length; - return this.iter(this.first, e.line, function (e) { - t += e.text.length + n - }), t - }, - copy: function (e) { - var t = new Vs(le(this, this.first, this.first + this.size), this.modeOption, this.first, this.lineSep, this.direction); - return t.scrollTop = this.scrollTop, t.scrollLeft = this.scrollLeft, t.sel = this.sel, t.extend = !1, e && (t.history.undoDepth = this.history.undoDepth, t.setHistory(this.getHistory())), t - }, - linkedDoc: function (e) { - e || (e = {}); - var t = this.first, - n = this.first + this.size; - null != e.from && e.from > t && (t = e.from), null != e.to && e.to < n && (n = e.to); - var o = new Vs(le(this, t, n), e.mode || this.modeOption, t, this.lineSep, this.direction); - return e.sharedHist && (o.history = this.history), (this.linked || (this.linked = [])).push({ - doc: o, - sharedHist: e.sharedHist - }), o.linked = [{ - doc: this, - isParent: !0, - sharedHist: e.sharedHist - }], ai(o, ii(this)), o - }, - unlinkDoc: function (e) { - var t = this; - if (e instanceof oa && (e = e.doc), this.linked) - for (var n = 0, o; n < this.linked.length; ++n) - if (o = t.linked[n], o.doc == e) { - t.linked.splice(n, 1), e.unlinkDoc(t), si(ii(t)); - break - } if (e.history == this.history) { - var r = [e.id]; - dr(e, function (e) { - return r.push(e.id) - }, !0), e.history = new ur(null), e.history.done = kr(this.history.done, r), e.history.undone = kr(this.history.undone, r) - } - }, - iterLinkedDocs: function (e) { - dr(this, e) - }, - getMode: function () { - return this.mode - }, - getEditor: function () { - return this.cm - }, - splitLines: function (e) { - return this.lineSep ? e.split(this.lineSep) : ss(e) - }, - lineSeparator: function () { - return this.lineSep || '\n' - }, - setDirection: Do(function (e) { - 'rtl' != e && (e = 'ltr'), e == this.direction || (this.direction = e, this.iter(function (e) { - return e.order = null - }), this.cm && pr(this.cm)) - }) - }), Vs.prototype.eachLine = Vs.prototype.iter; - for (var Gs = 0, Ks = !1, js = { - 3: 'Pause', - 8: 'Backspace', - 9: 'Tab', - 13: 'Enter', - 16: 'Shift', - 17: 'Ctrl', - 18: 'Alt', - 19: 'Pause', - 20: 'CapsLock', - 27: 'Esc', - 32: 'Space', - 33: 'PageUp', - 34: 'PageDown', - 35: 'End', - 36: 'Home', - 37: 'Left', - 38: 'Up', - 39: 'Right', - 40: 'Down', - 44: 'PrintScrn', - 45: 'Insert', - 46: 'Delete', - 59: ';', - 61: '=', - 91: 'Mod', - 92: 'Mod', - 93: 'Mod', - 106: '*', - 107: '=', - 109: '-', - 110: '.', - 111: '/', - 145: 'ScrollLock', - 173: '-', - 186: ';', - 187: '=', - 188: ',', - 189: '-', - 190: '.', - 191: '/', - 192: '`', - 219: '[', - 220: '\\', - 221: ']', - 222: '\'', - 63232: 'Up', - 63233: 'Down', - 63234: 'Left', - 63235: 'Right', - 63272: 'Delete', - 63273: 'Home', - 63275: 'End', - 63276: 'PageUp', - 63277: 'PageDown', - 63302: 'Insert' - }, qs = 0; 10 > qs; qs++) js[qs + 48] = js[qs + 96] = qs + ''; - for (var i = 65; 90 >= i; i++) js[i] = t(i); - for (var Ys = 1; 12 >= Ys; Ys++) js[Ys + 111] = js[Ys + 63235] = 'F' + Ys; - var Xs = {}; - Xs.basic = { - Left: 'goCharLeft', - Right: 'goCharRight', - Up: 'goLineUp', - Down: 'goLineDown', - End: 'goLineEnd', - Home: 'goLineStartSmart', - PageUp: 'goPageUp', - PageDown: 'goPageDown', - Delete: 'delCharAfter', - Backspace: 'delCharBefore', - "Shift-Backspace": 'delCharBefore', - Tab: 'defaultTab', - "Shift-Tab": 'indentAuto', - Enter: 'newlineAndIndent', - Insert: 'toggleOverwrite', - Esc: 'singleSelection' - }, Xs.pcDefault = { - "Ctrl-A": 'selectAll', - "Ctrl-D": 'deleteLine', - "Ctrl-Z": 'undo', - "Shift-Ctrl-Z": 'redo', - "Ctrl-Y": 'redo', - "Ctrl-Home": 'goDocStart', - "Ctrl-End": 'goDocEnd', - "Ctrl-Up": 'goLineUp', - "Ctrl-Down": 'goLineDown', - "Ctrl-Left": 'goGroupLeft', - "Ctrl-Right": 'goGroupRight', - "Alt-Left": 'goLineStart', - "Alt-Right": 'goLineEnd', - "Ctrl-Backspace": 'delGroupBefore', - "Ctrl-Delete": 'delGroupAfter', - "Ctrl-S": 'save', - "Ctrl-F": 'find', - "Ctrl-G": 'findNext', - "Shift-Ctrl-G": 'findPrev', - "Shift-Ctrl-F": 'replace', - "Shift-Ctrl-R": 'replaceAll', - "Ctrl-[": 'indentLess', - "Ctrl-]": 'indentMore', - "Ctrl-U": 'undoSelection', - "Shift-Ctrl-U": 'redoSelection', - "Alt-U": 'redoSelection', - fallthrough: 'basic' - }, Xs.emacsy = { - "Ctrl-F": 'goCharRight', - "Ctrl-B": 'goCharLeft', - "Ctrl-P": 'goLineUp', - "Ctrl-N": 'goLineDown', - "Alt-F": 'goWordRight', - "Alt-B": 'goWordLeft', - "Ctrl-A": 'goLineStart', - "Ctrl-E": 'goLineEnd', - "Ctrl-V": 'goPageDown', - "Shift-Ctrl-V": 'goPageUp', - "Ctrl-D": 'delCharAfter', - "Ctrl-H": 'delCharBefore', - "Alt-D": 'delWordAfter', - "Alt-Backspace": 'delWordBefore', - "Ctrl-K": 'killLine', - "Ctrl-T": 'transposeChars', - "Ctrl-O": 'openLine' - }, Xs.macDefault = { - "Cmd-A": 'selectAll', - "Cmd-D": 'deleteLine', - "Cmd-Z": 'undo', - "Shift-Cmd-Z": 'redo', - "Cmd-Y": 'redo', - "Cmd-Home": 'goDocStart', - "Cmd-Up": 'goDocStart', - "Cmd-End": 'goDocEnd', - "Cmd-Down": 'goDocEnd', - "Alt-Left": 'goGroupLeft', - "Alt-Right": 'goGroupRight', - "Cmd-Left": 'goLineLeft', - "Cmd-Right": 'goLineRight', - "Alt-Backspace": 'delGroupBefore', - "Ctrl-Alt-Backspace": 'delGroupAfter', - "Alt-Delete": 'delGroupAfter', - "Cmd-S": 'save', - "Cmd-F": 'find', - "Cmd-G": 'findNext', - "Shift-Cmd-G": 'findPrev', - "Cmd-Alt-F": 'replace', - "Shift-Cmd-Alt-F": 'replaceAll', - "Cmd-[": 'indentLess', - "Cmd-]": 'indentMore', - "Cmd-Backspace": 'delWrappedLineLeft', - "Cmd-Delete": 'delWrappedLineRight', - "Cmd-U": 'undoSelection', - "Shift-Cmd-U": 'redoSelection', - "Ctrl-Up": 'goDocStart', - "Ctrl-Down": 'goDocEnd', - fallthrough: ['basic', 'emacsy'] - }, Xs['default'] = Ha ? Xs.macDefault : Xs.pcDefault; - var Qs = { - selectAll: zr, - singleSelection: function (e) { - return e.setSelection(e.getCursor('anchor'), e.getCursor('head'), $a) - }, - killLine: function (e) { - return wi(e, function (t) { - if (t.empty()) { - var n = se(e.doc, t.head.line).text.length; - return t.head.ch == n && t.head.line < e.lastLine() ? { - from: t.head, - to: fe(t.head.line + 1, 0) - } : { - from: t.head, - to: fe(t.head.line, n) + } + + function Ls(e) { + for (var t = [], n = [], r = 0; r < e.doc.sel.ranges.length; r++) { + var i = e.doc.sel.ranges[r].head.line, + o = { + anchor: et(i, 0), + head: et(i + 1, 0) + }; + n.push(o), t.push(e.getRange(o.anchor, o.head)) + } + return { + text: t, + ranges: n + } + } + + function Ns(e, t, n, r) { + e.setAttribute("autocorrect", n ? "" : "off"), e.setAttribute("autocapitalize", r ? "" : "off"), e.setAttribute("spellcheck", !!t) + } + + function Fs() { + var e = _("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"), + t = _("div", [e], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); + return l ? e.style.width = "1000px" : e.setAttribute("wrap", "off"), m && (e.style.border = "1px solid black"), Ns(e), t + } + + function Bs(e, t, n, r, i) { + var o = t, + s = n, + a = $e(e, t.line); + + function l(r) { + var o, s; + if (null == (o = i ? function (e, t, n, r) { + var i = ce(t, e.doc.direction); + if (!i) return Jo(t, n, r); + n.ch >= t.text.length ? (n.ch = t.text.length, n.sticky = "before") : n.ch <= 0 && (n.ch = 0, n.sticky = "after"); + var o = ae(i, n.ch, n.sticky), + s = i[o]; + if ("ltr" == e.doc.direction && s.level % 2 == 0 && (r > 0 ? s.to > n.ch : s.from < n.ch)) return Jo(t, n, r); + var a, l = function (e, n) { + return Xo(t, e instanceof et ? e.ch : e, n) + }, + c = function (n) { + return e.options.lineWrapping ? (a = a || Pn(e, t), Xn(e, t, a, n)) : { + begin: 0, + end: t.text.length + } + }, + u = c("before" == n.sticky ? l(n, -1) : n.ch); + if ("rtl" == e.doc.direction || 1 == s.level) { + var h = 1 == s.level == r < 0, + p = l(n, h ? 1 : -1); + if (null != p && (h ? p <= s.to && p <= u.end : p >= s.from && p >= u.begin)) { + var d = h ? "before" : "after"; + return new et(n.line, p, d) } } - return { - from: t.from(), - to: t.to() - } - }) - }, - deleteLine: function (e) { - return wi(e, function (t) { - return { - from: fe(t.from().line, 0), - to: Ee(e.doc, fe(t.to().line + 1, 0)) - } - }) - }, - delLineLeft: function (e) { - return wi(e, function (e) { - return { - from: fe(e.from().line, 0), - to: e.from() - } - }) - }, - delWrappedLineLeft: function (e) { - return wi(e, function (t) { - var n = e.charCoords(t.head, 'div').top + 5, - o = e.coordsChar({ - left: 0, - top: n - }, 'div'); - return { - from: o, - to: t.from() - } - }) - }, - delWrappedLineRight: function (e) { - return wi(e, function (t) { - var n = e.charCoords(t.head, 'div').top + 5, - o = e.coordsChar({ - left: e.display.lineDiv.offsetWidth + 100, - top: n - }, 'div'); - return { - from: t.from(), - to: o - } - }) - }, - undo: function (e) { - return e.undo() - }, - redo: function (e) { - return e.redo() - }, - undoSelection: function (e) { - return e.undoSelection() - }, - redoSelection: function (e) { - return e.redoSelection() - }, - goDocStart: function (e) { - return e.extendSelection(fe(e.firstLine(), 0)) - }, - goDocEnd: function (e) { - return e.extendSelection(fe(e.lastLine())) - }, - goLineStart: function (e) { - return e.extendSelectionsBy(function (t) { - return xi(e, t.head.line) - }, { - origin: '+move', - bias: 1 - }) - }, - goLineStartSmart: function (e) { - return e.extendSelectionsBy(function (t) { - return Di(e, t.head) - }, { - origin: '+move', - bias: 1 - }) - }, - goLineEnd: function (e) { - return e.extendSelectionsBy(function (t) { - return Pi(e, t.head.line) - }, { - origin: '+move', - bias: -1 - }) - }, - goLineRight: function (e) { - return e.extendSelectionsBy(function (t) { - var n = e.cursorCoords(t.head, 'div').top + 5; - return e.coordsChar({ - left: e.display.lineDiv.offsetWidth + 100, - top: n - }, 'div') - }, Ja) - }, - goLineLeft: function (e) { - return e.extendSelectionsBy(function (t) { - var n = e.cursorCoords(t.head, 'div').top + 5; - return e.coordsChar({ - left: 0, - top: n - }, 'div') - }, Ja) - }, - goLineLeftSmart: function (e) { - return e.extendSelectionsBy(function (t) { - var n = e.cursorCoords(t.head, 'div').top + 5, - o = e.coordsChar({ - left: 0, - top: n - }, 'div'); - return o.ch < e.getLine(o.line).search(/\S/) ? Di(e, t.head) : o - }, Ja) - }, - goLineUp: function (e) { - return e.moveV(-1, 'line') - }, - goLineDown: function (e) { - return e.moveV(1, 'line') - }, - goPageUp: function (e) { - return e.moveV(-1, 'page') - }, - goPageDown: function (e) { - return e.moveV(1, 'page') - }, - goCharLeft: function (e) { - return e.moveH(-1, 'char') - }, - goCharRight: function (e) { - return e.moveH(1, 'char') - }, - goColumnLeft: function (e) { - return e.moveH(-1, 'column') - }, - goColumnRight: function (e) { - return e.moveH(1, 'column') - }, - goWordLeft: function (e) { - return e.moveH(-1, 'word') - }, - goGroupRight: function (e) { - return e.moveH(1, 'group') - }, - goGroupLeft: function (e) { - return e.moveH(-1, 'group') - }, - goWordRight: function (e) { - return e.moveH(1, 'word') - }, - delCharBefore: function (e) { - return e.deleteH(-1, 'char') - }, - delCharAfter: function (e) { - return e.deleteH(1, 'char') - }, - delWordBefore: function (e) { - return e.deleteH(-1, 'word') - }, - delWordAfter: function (e) { - return e.deleteH(1, 'word') - }, - delGroupBefore: function (e) { - return e.deleteH(-1, 'group') - }, - delGroupAfter: function (e) { - return e.deleteH(1, 'group') - }, - indentAuto: function (e) { - return e.indentSelection('smart') - }, - indentMore: function (e) { - return e.indentSelection('add') - }, - indentLess: function (e) { - return e.indentSelection('subtract') - }, - insertTab: function (e) { - return e.replaceSelection('\t') - }, - insertSoftTab: function (e) { - for (var t = [], n = e.listSelections(), o = e.options.tabSize, r = 0; r < n.length; r++) { - var i = n[r].from(), - a = C(e.getLine(i.line), i.ch, o); - t.push(E(o - a % o)) - } - e.replaceSelections(t) - }, - defaultTab: function (e) { - e.somethingSelected() ? e.indentSelection('add') : e.execCommand('insertTab') - }, - transposeChars: function (e) { - return Ro(e, function () { - for (var t = e.listSelections(), n = [], o = 0; o < t.length; o++) - if (t[o].empty()) { - var r = t[o].head, - i = se(e.doc, r.line).text; - if (i) - if (r.ch == i.length && (r = new fe(r.line, r.ch - 1)), 0 < r.ch) r = new fe(r.line, r.ch + 1), e.replaceRange(i.charAt(r.ch - 1) + i.charAt(r.ch - 2), fe(r.line, r.ch - 2), r, '+transpose'); - else if (r.line > e.doc.first) { - var a = se(e.doc, r.line - 1).text; - a && (r = new fe(r.line, 1), e.replaceRange(i.charAt(0) + e.doc.lineSeparator() + a.charAt(a.length - 1), fe(r.line - 1, a.length - 1), r, '+transpose')) + var f = function (e, t, r) { + for (var o = function (e, t) { + return t ? new et(n.line, l(e, 1), "before") : new et(n.line, e, "after") + }; e >= 0 && e < i.length; e += t) { + var s = i[e], + a = t > 0 == (1 != s.level), + c = a ? r.begin : l(r.end, -1); + if (s.from <= c && c < s.to) return o(c, a); + if (c = a ? s.from : l(s.to, -1), r.begin <= c && c < r.end) return o(c, a) } - n.push(new Ns(r, r)) - } e.setSelections(n) - }) - }, - newlineAndIndent: function (e) { - return Ro(e, function () { - for (var t = e.listSelections(), n = t.length - 1; 0 <= n; n--) e.replaceRange(e.doc.lineSeparator(), t[n].anchor, t[n].head, '+input'); - t = e.listSelections(); - for (var o = 0; o < t.length; o++) e.indentLine(t[o].from().line, null, !0); - ao(e) - }) - }, - openLine: function (e) { - return e.replaceSelection('\n', 'start') - }, - toggleOverwrite: function (e) { - return e.toggleOverwrite() + }, + m = f(o + r, r, u); + if (m) return m; + var g = r > 0 ? u.end : l(u.begin, -1); + return null == g || r > 0 && g == t.text.length || !(m = f(r > 0 ? 0 : i.length - 1, r, c(g))) ? null : m + }(e.cm, a, t, n) : Jo(a, t, n))) { + if (r || (s = t.line + n) < e.first || s >= e.first + e.size || (t = new et(s, t.ch, t.sticky), !(a = $e(e, s)))) return !1; + t = es(i, e.cm, a, t.line, n) + } else t = o; + return !0 + } + if ("char" == r) l(); + else if ("column" == r) l(!0); + else if ("word" == r || "group" == r) + for (var c = null, u = "group" == r, h = e.cm && e.cm.getHelper(t, "wordChars"), p = !0; !(n < 0) || l(!p); p = !1) { + var d = a.text.charAt(t.ch) || "\n", + f = ee(d, h) ? "w" : u && "\n" == d ? "n" : !u || /\s/.test(d) ? null : "p"; + if (!u || p || f || (f = "s"), c && c != f) { + n < 0 && (n = 1, l(), t.sticky = "after"); + break + } + if (f && (c = f), n > 0 && !l(!p)) break } - }, - $s = new Ya, - Zs = null, - Js = function (e, t, n) { - this.time = e, this.pos = t, this.button = n - }; - Js.prototype.compare = function (e, t, n) { - return this.time + 400 > e && 0 == ge(t, this.pos) && n == this.button - }; - var ed = { - toString: function () { - return 'CodeMirror.Init' + var m = oo(e, t, o, s, !0); + return nt(o, m) && (m.hitSide = !0), m + } + + function Hs(e, t, n, r) { + var i, o, s = e.doc, + a = t.left; + if ("page" == r) { + var l = Math.min(e.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight), + c = Math.max(l - .5 * rr(e.display), 3); + i = (n > 0 ? t.bottom : t.top) + n * c + } else "line" == r && (i = n > 0 ? t.bottom + 3 : t.top - 3); + for (; + (o = Qn(e, a, i)).outside;) { + if (n < 0 ? i <= 0 : i >= s.height) { + o.hitSide = !0; + break } - }, - td = {}, - nd = {}, - od, rd; - oa.defaults = td, oa.optionHandlers = nd; - var id = []; - oa.defineInitHook = function (e) { - return id.push(e) + i += 5 * n + } + return o + } + var zs = function (e) { + this.cm = e, this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null, this.polling = new H, this.composing = null, this.gracePeriod = !1, this.readDOMTimeout = null }; - var ad = null, - sd = function (e) { - this.cm = e, this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null, this.polling = new Ya, this.composing = null, this.gracePeriod = !1, this.readDOMTimeout = null - }; - sd.prototype.init = function (e) { - function t(t) { - if (!z(r, t)) { - if (r.somethingSelected()) aa({ + + function Us(e, t) { + var n = Mn(e, t.line); + if (!n || n.hidden) return null; + var r = $e(e.doc, t.line), + i = _n(n, r, t.line), + o = ce(r, e.doc.direction), + s = "left"; + o && (s = ae(o, t.ch) % 2 ? "right" : "left"); + var a = Nn(i.map, t.ch, s); + return a.offset = "right" == a.collapse ? a.end : a.start, a + } + + function Ws(e, t) { + return t && (e.bad = !0), e + } + + function Vs(e, t, n) { + var r; + if (t == e.display.lineDiv) { + if (!(r = e.display.lineDiv.childNodes[n])) return Ws(e.clipPos(et(e.display.viewTo - 1)), !0); + t = null, n = 0 + } else + for (r = t;; r = r.parentNode) { + if (!r || r == e.display.lineDiv) return null; + if (r.parentNode && r.parentNode == e.display.lineDiv) break + } + for (var i = 0; i < e.display.view.length; i++) { + var o = e.display.view[i]; + if (o.node == r) return js(o, t, n) + } + } + + function js(e, t, n) { + var r = e.text.firstChild, + i = !1; + if (!t || !M(r, t)) return Ws(et(Qe(e.line), 0), !0); + if (t == r && (i = !0, t = r.childNodes[n], n = 0, !t)) { + var o = e.rest ? K(e.rest) : e.line; + return Ws(et(Qe(o), o.text.length), i) + } + var s = 3 == t.nodeType ? t : null, + a = t; + for (s || 1 != t.childNodes.length || 3 != t.firstChild.nodeType || (s = t.firstChild, n && (n = s.nodeValue.length)); a.parentNode != r;) a = a.parentNode; + var l = e.measure, + c = l.maps; + + function u(t, n, r) { + for (var i = -1; i < (c ? c.length : 0); i++) + for (var o = i < 0 ? l.map : c[i], s = 0; s < o.length; s += 3) { + var a = o[s + 2]; + if (a == t || a == n) { + var u = Qe(i < 0 ? e.line : e.rest[i]), + h = o[s] + r; + return (r < 0 || a != t) && (h = o[s + (r ? 1 : 0)]), et(u, h) + } + } + } + var h = u(s, a, n); + if (h) return Ws(h, i); + for (var p = a.nextSibling, d = s ? s.nodeValue.length - n : 0; p; p = p.nextSibling) { + if (h = u(p, p.firstChild, 0)) return Ws(et(h.line, h.ch - d), i); + d += p.textContent.length + } + for (var f = a.previousSibling, m = n; f; f = f.previousSibling) { + if (h = u(f, f.firstChild, -1)) return Ws(et(h.line, h.ch + m), i); + m += f.textContent.length + } + } + zs.prototype.init = function (e) { + var t = this, + n = this, + r = n.cm, + i = n.div = e.lineDiv; + + function o(e) { + if (!me(r, e)) { + if (r.somethingSelected()) Ms({ lineWise: !1, text: r.getSelections() - }), 'cut' == t.type && r.replaceSelection('', null, 'cut'); + }), "cut" == e.type && r.replaceSelection("", null, "cut"); else { if (!r.options.lineWiseCopyCut) return; - var e = ca(r); - aa({ + var t = Ls(r); + Ms({ lineWise: !0, - text: e.text - }), 'cut' == t.type && r.operation(function () { - r.setSelections(e.ranges, 0, $a), r.replaceSelection('', null, 'cut') - }) + text: t.text + }), "cut" == e.type && r.operation((function () { + r.setSelections(t.ranges, 0, W), r.replaceSelection("", null, "cut") + })) } - if (t.clipboardData) { - t.clipboardData.clearData(); - var n = ad.text.join('\n'); - if (t.clipboardData.setData('Text', n), t.clipboardData.getData('Text') == n) return void t.preventDefault() + if (e.clipboardData) { + e.clipboardData.clearData(); + var o = As.text.join("\n"); + if (e.clipboardData.setData("Text", o), e.clipboardData.getData("Text") == o) return void e.preventDefault() } - var a = ua(), - s = a.firstChild; - r.display.lineSpace.insertBefore(a, r.display.lineSpace.firstChild), s.value = ad.text.join('\n'); - var d = document.activeElement; - qa(s), setTimeout(function () { - r.display.lineSpace.removeChild(a), d.focus(), d == i && o.showPrimarySelection() - }, 50) - } - } - var n = this, - o = this, - r = o.cm, - i = o.div = e.lineDiv; - pa(i, r.options.spellcheck, r.options.autocorrect, r.options.autocapitalize), as(i, 'paste', function (t) { - z(r, t) || da(t, r) || 11 >= xa && setTimeout(xo(r, function () { - return n.updateFromDOM() - }), 20) - }), as(i, 'compositionstart', function (t) { - n.composing = { - data: t.data, + var s = Fs(), + a = s.firstChild; + r.display.lineSpace.insertBefore(s, r.display.lineSpace.firstChild), a.value = As.text.join("\n"); + var l = document.activeElement; + L(a), setTimeout((function () { + r.display.lineSpace.removeChild(s), l.focus(), l == i && n.showPrimarySelection() + }), 50) + } + } + Ns(i, r.options.spellcheck, r.options.autocorrect, r.options.autocapitalize), he(i, "paste", (function (e) { + me(r, e) || Is(e, r) || a <= 11 && setTimeout(ei(r, (function () { + return t.updateFromDOM() + })), 20) + })), he(i, "compositionstart", (function (e) { + t.composing = { + data: e.data, done: !1 } - }), as(i, 'compositionupdate', function (t) { - n.composing || (n.composing = { - data: t.data, + })), he(i, "compositionupdate", (function (e) { + t.composing || (t.composing = { + data: e.data, done: !1 }) - }), as(i, 'compositionend', function (t) { - n.composing && (t.data != n.composing.data && n.readFromDOMSoon(), n.composing.done = !0) - }), as(i, 'touchstart', function () { - return o.forceCompositionEnd() - }), as(i, 'input', function () { - n.composing || n.readFromDOMSoon() - }), as(i, 'copy', t), as(i, 'cut', t) - }, sd.prototype.prepareSelection = function () { - var e = Vn(this.cm, !1); + })), he(i, "compositionend", (function (e) { + t.composing && (e.data != t.composing.data && t.readFromDOMSoon(), t.composing.done = !0) + })), he(i, "touchstart", (function () { + return n.forceCompositionEnd() + })), he(i, "input", (function () { + t.composing || t.readFromDOMSoon() + })), he(i, "copy", o), he(i, "cut", o) + }, zs.prototype.prepareSelection = function () { + var e = yr(this.cm, !1); return e.focus = this.cm.state.focused, e - }, sd.prototype.showSelection = function (e, t) { + }, zs.prototype.showSelection = function (e, t) { e && this.cm.display.view.length && ((e.focus || t) && this.showPrimarySelection(), this.showMultipleSelections(e)) - }, sd.prototype.getSelection = function () { + }, zs.prototype.getSelection = function () { return this.cm.display.wrapper.ownerDocument.getSelection() - }, sd.prototype.showPrimarySelection = function () { + }, zs.prototype.showPrimarySelection = function () { var e = this.getSelection(), t = this.cm, - n = t.doc.sel.primary(), - o = n.from(), - r = n.to(); - if (t.display.viewTo == t.display.viewFrom || o.line >= t.display.viewTo || r.line < t.display.viewFrom) return void e.removeAllRanges(); - var i = Ca(t, e.anchorNode, e.anchorOffset), - a = Ca(t, e.focusNode, e.focusOffset); - if (!i || i.bad || !a || a.bad || 0 != ge(be(i, a), o) || 0 != ge(Ce(i, a), r)) { - var s = t.display.view, - d = o.line >= t.display.viewFrom && fa(t, o) || { - node: s[0].measure.map[2], - offset: 0 - }, - l = r.line < t.display.viewTo && fa(t, r); - if (!l) { - var c = s[s.length - 1].measure, - p = c.maps ? c.maps[c.maps.length - 1] : c.map; - l = { - node: p[p.length - 1], - offset: p[p.length - 2] - p[p.length - 3] + r = t.doc.sel.primary(), + i = r.from(), + o = r.to(); + if (t.display.viewTo == t.display.viewFrom || i.line >= t.display.viewTo || o.line < t.display.viewFrom) e.removeAllRanges(); + else { + var s = Vs(t, e.anchorNode, e.anchorOffset), + a = Vs(t, e.focusNode, e.focusOffset); + if (!s || s.bad || !a || a.bad || 0 != tt(ot(s, a), i) || 0 != tt(it(s, a), o)) { + var l = t.display.view, + c = i.line >= t.display.viewFrom && Us(t, i) || { + node: l[0].measure.map[2], + offset: 0 + }, + u = o.line < t.display.viewTo && Us(t, o); + if (!u) { + var h = l[l.length - 1].measure, + p = h.maps ? h.maps[h.maps.length - 1] : h.map; + u = { + node: p[p.length - 1], + offset: p[p.length - 2] - p[p.length - 3] + } } + if (c && u) { + var d, f = e.rangeCount && e.getRangeAt(0); + try { + d = x(c.node, c.offset, u.offset, u.node) + } catch (e) {} + d && (!n && t.state.focused ? (e.collapse(c.node, c.offset), d.collapsed || (e.removeAllRanges(), e.addRange(d))) : (e.removeAllRanges(), e.addRange(d)), f && null == e.anchorNode ? e.addRange(f) : n && this.startGracePeriod()), this.rememberSelection() + } else e.removeAllRanges() } - if (!d || !l) return void e.removeAllRanges(); - var u = e.rangeCount && e.getRangeAt(0), - m; - try { - m = ja(d.node, d.offset, l.offset, l.node) - } catch (t) {} - m && (!wa && t.state.focused ? (e.collapse(d.node, d.offset), !m.collapsed && (e.removeAllRanges(), e.addRange(m))) : (e.removeAllRanges(), e.addRange(m)), u && null == e.anchorNode ? e.addRange(u) : wa && this.startGracePeriod()), this.rememberSelection() } - }, sd.prototype.startGracePeriod = function () { + }, zs.prototype.startGracePeriod = function () { var e = this; - clearTimeout(this.gracePeriod), this.gracePeriod = setTimeout(function () { - e.gracePeriod = !1, e.selectionChanged() && e.cm.operation(function () { + clearTimeout(this.gracePeriod), this.gracePeriod = setTimeout((function () { + e.gracePeriod = !1, e.selectionChanged() && e.cm.operation((function () { return e.cm.curOp.selectionChanged = !0 - }) - }, 20) - }, sd.prototype.showMultipleSelections = function (e) { - c(this.cm.display.cursorDiv, e.cursors), c(this.cm.display.selectionDiv, e.selection) - }, sd.prototype.rememberSelection = function () { + })) + }), 20) + }, zs.prototype.showMultipleSelections = function (e) { + D(this.cm.display.cursorDiv, e.cursors), D(this.cm.display.selectionDiv, e.selection) + }, zs.prototype.rememberSelection = function () { var e = this.getSelection(); this.lastAnchorNode = e.anchorNode, this.lastAnchorOffset = e.anchorOffset, this.lastFocusNode = e.focusNode, this.lastFocusOffset = e.focusOffset - }, sd.prototype.selectionInEditor = function () { + }, zs.prototype.selectionInEditor = function () { var e = this.getSelection(); if (!e.rangeCount) return !1; var t = e.getRangeAt(0).commonAncestorContainer; - return m(this.div, t) - }, sd.prototype.focus = function () { - 'nocursor' != this.cm.options.readOnly && (!this.selectionInEditor() && this.showSelection(this.prepareSelection(), !0), this.div.focus()) - }, sd.prototype.blur = function () { + return M(this.div, t) + }, zs.prototype.focus = function () { + "nocursor" != this.cm.options.readOnly && (this.selectionInEditor() || this.showSelection(this.prepareSelection(), !0), this.div.focus()) + }, zs.prototype.blur = function () { this.div.blur() - }, sd.prototype.getField = function () { + }, zs.prototype.getField = function () { return this.div - }, sd.prototype.supportsTouch = function () { + }, zs.prototype.supportsTouch = function () { return !0 - }, sd.prototype.receivedFocus = function () { - function e() { - t.cm.state.focused && (t.pollSelection(), t.polling.set(t.cm.options.pollInterval, e)) - } - var t = this; - this.selectionInEditor() ? this.pollSelection() : Ro(this.cm, function () { - return t.cm.curOp.selectionChanged = !0 - }), this.polling.set(this.cm.options.pollInterval, e) - }, sd.prototype.selectionChanged = function () { + }, zs.prototype.receivedFocus = function () { + var e = this; + this.selectionInEditor() ? this.pollSelection() : Jr(this.cm, (function () { + return e.cm.curOp.selectionChanged = !0 + })), this.polling.set(this.cm.options.pollInterval, (function t() { + e.cm.state.focused && (e.pollSelection(), e.polling.set(e.cm.options.pollInterval, t)) + })) + }, zs.prototype.selectionChanged = function () { var e = this.getSelection(); return e.anchorNode != this.lastAnchorNode || e.anchorOffset != this.lastAnchorOffset || e.focusNode != this.lastFocusNode || e.focusOffset != this.lastFocusOffset - }, sd.prototype.pollSelection = function () { + }, zs.prototype.pollSelection = function () { if (null == this.readDOMTimeout && !this.gracePeriod && this.selectionChanged()) { var e = this.getSelection(), t = this.cm; - if (Na && Ma && this.cm.display.gutterSpecs.length && ga(e.anchorNode)) return this.cm.triggerOnKeyDown({ - type: 'keydown', + if (g && u && this.cm.display.gutterSpecs.length && function (e) { + for (var t = e; t; t = t.parentNode) + if (/CodeMirror-gutter-wrapper/.test(t.className)) return !0; + return !1 + }(e.anchorNode)) return this.cm.triggerOnKeyDown({ + type: "keydown", keyCode: 8, - preventDefault: o + preventDefault: Math.abs }), this.blur(), void this.focus(); if (!this.composing) { this.rememberSelection(); - var n = Ca(t, e.anchorNode, e.anchorOffset), - r = Ca(t, e.focusNode, e.focusOffset); - n && r && Ro(t, function () { - Ar(t.doc, Zo(n, r), $a), (n.bad || r.bad) && (t.curOp.selectionChanged = !0) - }) + var n = Vs(t, e.anchorNode, e.anchorOffset), + r = Vs(t, e.focusNode, e.focusOffset); + n && r && Jr(t, (function () { + Ji(t.doc, xi(n, r), W), (n.bad || r.bad) && (t.curOp.selectionChanged = !0) + })) } } - }, sd.prototype.pollContent = function () { + }, zs.prototype.pollContent = function () { null != this.readDOMTimeout && (clearTimeout(this.readDOMTimeout), this.readDOMTimeout = null); - var e = this.cm, - t = e.display, - n = e.doc.sel.primary(), - o = n.from(), - r = n.to(); - if (0 == o.ch && o.line > e.firstLine() && (o = fe(o.line - 1, se(e.doc, o.line - 1).length)), r.ch == se(e.doc, r.line).text.length && r.line < e.lastLine() && (r = fe(r.line + 1, 0)), o.line < t.viewFrom || r.line > t.viewTo - 1) return !1; - var i, a, s; - o.line == t.viewFrom || 0 == (i = Fn(e, o.line)) ? (a = pe(t.view[0].line), s = t.view[0].node) : (a = pe(t.view[i].line), s = t.view[i - 1].node.nextSibling); - var l = Fn(e, r.line), - c, p; - if (l == t.view.length - 1 ? (c = t.viewTo - 1, p = t.lineDiv.lastChild) : (c = pe(t.view[l + 1].line) - 1, p = t.view[l + 1].node.previousSibling), !s) return !1; - for (var u = e.doc.splitLines(Sa(e, s, p, a, c)), m = de(e.doc, fe(a, 0), fe(c, se(e.doc, c).text.length)); 1 < u.length && 1 < m.length;) - if (w(u) == w(m)) u.pop(), m.pop(), c--; - else if (u[0] == m[0]) u.shift(), m.shift(), a++; - else break; - for (var h = 0, f = 0, g = u[0], y = m[0], S = d(g.length, y.length); h < S && g.charCodeAt(h) == y.charCodeAt(h);) ++h; - for (var C = w(u), b = w(m), v = d(C.length - (1 == u.length ? h : 0), b.length - (1 == m.length ? h : 0)); f < v && C.charCodeAt(C.length - f - 1) == b.charCodeAt(b.length - f - 1);) ++f; - if (1 == u.length && 1 == m.length && a == o.line) - for (; h && h > o.ch && C.charCodeAt(C.length - f - 1) == b.charCodeAt(b.length - f - 1);) h--, f++; - u[u.length - 1] = C.slice(0, C.length - f).replace(/^\u200b+/, ''), u[0] = u[0].slice(h).replace(/\u200b+$/, ''); - var E = fe(a, h), - k = fe(c, m.length ? w(m).length - f : 0); - if (1 < u.length || u[0] || ge(E, k)) return Yr(e.doc, u, E, k, '+input'), !0 - }, sd.prototype.ensurePolled = function () { + var e, t, n, r = this.cm, + i = r.display, + o = r.doc.sel.primary(), + s = o.from(), + a = o.to(); + if (0 == s.ch && s.line > r.firstLine() && (s = et(s.line - 1, $e(r.doc, s.line - 1).length)), a.ch == $e(r.doc, a.line).text.length && a.line < r.lastLine() && (a = et(a.line + 1, 0)), s.line < i.viewFrom || a.line > i.viewTo - 1) return !1; + s.line == i.viewFrom || 0 == (e = ur(r, s.line)) ? (t = Qe(i.view[0].line), n = i.view[0].node) : (t = Qe(i.view[e].line), n = i.view[e - 1].node.nextSibling); + var l, c, u = ur(r, a.line); + if (u == i.view.length - 1 ? (l = i.viewTo - 1, c = i.lineDiv.lastChild) : (l = Qe(i.view[u + 1].line) - 1, c = i.view[u + 1].node.previousSibling), !n) return !1; + for (var h = r.doc.splitLines(function (e, t, n, r, i) { + var o = "", + s = !1, + a = e.doc.lineSeparator(), + l = !1; + + function c() { + s && (o += a, l && (o += a), s = l = !1) + } + + function u(e) { + e && (c(), o += e) + } + + function h(t) { + if (1 == t.nodeType) { + var n = t.getAttribute("cm-text"); + if (n) return void u(n); + var o, p = t.getAttribute("cm-marker"); + if (p) { + var d = e.findMarks(et(r, 0), et(i + 1, 0), (g = +p, function (e) { + return e.id == g + })); + return void(d.length && (o = d[0].find(0)) && u(qe(e.doc, o.from, o.to).join(a))) + } + if ("false" == t.getAttribute("contenteditable")) return; + var f = /^(pre|div|p|li|table|br)$/i.test(t.nodeName); + if (!/^br$/i.test(t.nodeName) && 0 == t.textContent.length) return; + f && c(); + for (var m = 0; m < t.childNodes.length; m++) h(t.childNodes[m]); + /^(pre|p)$/i.test(t.nodeName) && (l = !0), f && (s = !0) + } else 3 == t.nodeType && u(t.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " ")); + var g + } + for (; h(t), t != n;) t = t.nextSibling, l = !1; + return o + }(r, n, c, t, l)), p = qe(r.doc, et(t, 0), et(l, $e(r.doc, l).text.length)); h.length > 1 && p.length > 1;) + if (K(h) == K(p)) h.pop(), p.pop(), l--; + else { + if (h[0] != p[0]) break; + h.shift(), p.shift(), t++ + } for (var d = 0, f = 0, m = h[0], g = p[0], y = Math.min(m.length, g.length); d < y && m.charCodeAt(d) == g.charCodeAt(d);) ++d; + for (var v = K(h), w = K(p), b = Math.min(v.length - (1 == h.length ? d : 0), w.length - (1 == p.length ? d : 0)); f < b && v.charCodeAt(v.length - f - 1) == w.charCodeAt(w.length - f - 1);) ++f; + if (1 == h.length && 1 == p.length && t == s.line) + for (; d && d > s.ch && v.charCodeAt(v.length - f - 1) == w.charCodeAt(w.length - f - 1);) d--, f++; + h[h.length - 1] = v.slice(0, v.length - f).replace(/^\u200b+/, ""), h[0] = h[0].slice(d).replace(/\u200b+$/, ""); + var S = et(t, d), + C = et(l, p.length ? K(p).length - f : 0); + return h.length > 1 || h[0] || tt(S, C) ? (mo(r.doc, h, S, C, "+input"), !0) : void 0 + }, zs.prototype.ensurePolled = function () { this.forceCompositionEnd() - }, sd.prototype.reset = function () { + }, zs.prototype.reset = function () { this.forceCompositionEnd() - }, sd.prototype.forceCompositionEnd = function () { + }, zs.prototype.forceCompositionEnd = function () { this.composing && (clearTimeout(this.readDOMTimeout), this.composing = null, this.updateFromDOM(), this.div.blur(), this.div.focus()) - }, sd.prototype.readFromDOMSoon = function () { + }, zs.prototype.readFromDOMSoon = function () { var e = this; - null != this.readDOMTimeout || (this.readDOMTimeout = setTimeout(function () { - if (e.readDOMTimeout = null, e.composing) - if (e.composing.done) e.composing = null; - else return; + null == this.readDOMTimeout && (this.readDOMTimeout = setTimeout((function () { + if (e.readDOMTimeout = null, e.composing) { + if (!e.composing.done) return; + e.composing = null + } e.updateFromDOM() - }, 80)) - }, sd.prototype.updateFromDOM = function () { + }), 80)) + }, zs.prototype.updateFromDOM = function () { var e = this; - (this.cm.isReadOnly() || !this.pollContent()) && Ro(this.cm, function () { - return Bn(e.cm) - }) - }, sd.prototype.setUneditable = function (e) { - e.contentEditable = 'false' - }, sd.prototype.onKeyPress = function (n) { - 0 == n.charCode || this.composing || (n.preventDefault(), !this.cm.isReadOnly() && xo(this.cm, sa)(this.cm, t(null == n.charCode ? n.keyCode : n.charCode), 0)) - }, sd.prototype.readOnlyChanged = function (e) { - this.div.contentEditable = ('nocursor' != e) + '' - }, sd.prototype.onContextMenu = function () {}, sd.prototype.resetPosition = function () {}, sd.prototype.needsContentAttribute = !0; - var dd = function (e) { - this.cm = e, this.prevInput = '', this.pollingFast = !1, this.polling = new Ya, this.hasSelection = !1, this.composing = null + !this.cm.isReadOnly() && this.pollContent() || Jr(this.cm, (function () { + return hr(e.cm) + })) + }, zs.prototype.setUneditable = function (e) { + e.contentEditable = "false" + }, zs.prototype.onKeyPress = function (e) { + 0 == e.charCode || this.composing || (e.preventDefault(), this.cm.isReadOnly() || ei(this.cm, Ps)(this.cm, String.fromCharCode(null == e.charCode ? e.keyCode : e.charCode), 0)) + }, zs.prototype.readOnlyChanged = function (e) { + this.div.contentEditable = String("nocursor" != e) + }, zs.prototype.onContextMenu = function () {}, zs.prototype.resetPosition = function () {}, zs.prototype.needsContentAttribute = !0; + var Gs = function (e) { + this.cm = e, this.prevInput = "", this.pollingFast = !1, this.polling = new H, this.hasSelection = !1, this.composing = null }; - dd.prototype.init = function (t) { - function e(t) { - if (!z(r, t)) { - if (r.somethingSelected()) aa({ + Gs.prototype.init = function (e) { + var t = this, + n = this, + r = this.cm; + this.createField(e); + var i = this.textarea; + + function o(e) { + if (!me(r, e)) { + if (r.somethingSelected()) Ms({ lineWise: !1, text: r.getSelections() }); else { if (!r.options.lineWiseCopyCut) return; - var e = ca(r); - aa({ + var t = Ls(r); + Ms({ lineWise: !0, - text: e.text - }), 'cut' == t.type ? r.setSelections(e.ranges, null, $a) : (o.prevInput = '', i.value = e.text.join('\n'), qa(i)) + text: t.text + }), "cut" == e.type ? r.setSelections(t.ranges, null, W) : (n.prevInput = "", i.value = t.text.join("\n"), L(i)) } - 'cut' == t.type && (r.state.cutIncoming = +new Date) + "cut" == e.type && (r.state.cutIncoming = +new Date) } } - var n = this, - o = this, - r = this.cm; - this.createField(t); - var i = this.textarea; - t.wrapper.insertBefore(this.wrapper, t.wrapper.firstChild), Ba && (i.style.width = '0px'), as(i, 'input', function () { - Ra && 9 <= xa && n.hasSelection && (n.hasSelection = null), o.poll() - }), as(i, 'paste', function (t) { - z(r, t) || da(t, r) || (r.state.pasteIncoming = +new Date, o.fastPoll()) - }), as(i, 'cut', e), as(i, 'copy', e), as(t.scroller, 'paste', function (n) { - if (!(Vt(t, n) || z(r, n))) { - if (!i.dispatchEvent) return r.state.pasteIncoming = +new Date, void o.focus(); - var e = new Event('paste'); - e.clipboardData = n.clipboardData, i.dispatchEvent(e) + e.wrapper.insertBefore(this.wrapper, e.wrapper.firstChild), m && (i.style.width = "0px"), he(i, "input", (function () { + s && a >= 9 && t.hasSelection && (t.hasSelection = null), n.poll() + })), he(i, "paste", (function (e) { + me(r, e) || Is(e, r) || (r.state.pasteIncoming = +new Date, n.fastPoll()) + })), he(i, "cut", o), he(i, "copy", o), he(e.scroller, "paste", (function (t) { + if (!Cn(e, t) && !me(r, t)) { + if (!i.dispatchEvent) return r.state.pasteIncoming = +new Date, void n.focus(); + var o = new Event("paste"); + o.clipboardData = t.clipboardData, i.dispatchEvent(o) } - }), as(t.lineSpace, 'selectstart', function (n) { - Vt(t, n) || G(n) - }), as(i, 'compositionstart', function () { - var e = r.getCursor('from'); - o.composing && o.composing.range.clear(), o.composing = { + })), he(e.lineSpace, "selectstart", (function (t) { + Cn(e, t) || we(t) + })), he(i, "compositionstart", (function () { + var e = r.getCursor("from"); + n.composing && n.composing.range.clear(), n.composing = { start: e, - range: r.markText(e, r.getCursor('to'), { - className: 'CodeMirror-composing' + range: r.markText(e, r.getCursor("to"), { + className: "CodeMirror-composing" }) } - }), as(i, 'compositionend', function () { - o.composing && (o.poll(), o.composing.range.clear(), o.composing = null) - }) - }, dd.prototype.createField = function () { - this.wrapper = ua(), this.textarea = this.wrapper.firstChild - }, dd.prototype.prepareSelection = function () { + })), he(i, "compositionend", (function () { + n.composing && (n.poll(), n.composing.range.clear(), n.composing = null) + })) + }, Gs.prototype.createField = function (e) { + this.wrapper = Fs(), this.textarea = this.wrapper.firstChild + }, Gs.prototype.prepareSelection = function () { var e = this.cm, t = e.display, n = e.doc, - o = Vn(e); + r = yr(e); if (e.options.moveInputWithCursor) { - var i = Sn(e, n.sel.primary().head, 'div'), - a = t.wrapper.getBoundingClientRect(), + var i = qn(e, n.sel.primary().head, "div"), + o = t.wrapper.getBoundingClientRect(), s = t.lineDiv.getBoundingClientRect(); - o.teTop = r(0, d(t.wrapper.clientHeight - 10, i.top + s.top - a.top)), o.teLeft = r(0, d(t.wrapper.clientWidth - 10, i.left + s.left - a.left)) - } - return o - }, dd.prototype.showSelection = function (e) { - var t = this.cm, - n = t.display; - c(n.cursorDiv, e.cursors), c(n.selectionDiv, e.selection), null != e.teTop && (this.wrapper.style.top = e.teTop + 'px', this.wrapper.style.left = e.teLeft + 'px') - }, dd.prototype.reset = function (e) { - if (!(this.contextMenuPending || this.composing)) { + r.teTop = Math.max(0, Math.min(t.wrapper.clientHeight - 10, i.top + s.top - o.top)), r.teLeft = Math.max(0, Math.min(t.wrapper.clientWidth - 10, i.left + s.left - o.left)) + } + return r + }, Gs.prototype.showSelection = function (e) { + var t = this.cm.display; + D(t.cursorDiv, e.cursors), D(t.selectionDiv, e.selection), null != e.teTop && (this.wrapper.style.top = e.teTop + "px", this.wrapper.style.left = e.teLeft + "px") + }, Gs.prototype.reset = function (e) { + if (!this.contextMenuPending && !this.composing) { var t = this.cm; if (t.somethingSelected()) { - this.prevInput = ''; + this.prevInput = ""; var n = t.getSelection(); - this.textarea.value = n, t.state.focused && qa(this.textarea), Ra && 9 <= xa && (this.hasSelection = n) - } else e || (this.prevInput = this.textarea.value = '', Ra && 9 <= xa && (this.hasSelection = null)) + this.textarea.value = n, t.state.focused && L(this.textarea), s && a >= 9 && (this.hasSelection = n) + } else e || (this.prevInput = this.textarea.value = "", s && a >= 9 && (this.hasSelection = null)) } - }, dd.prototype.getField = function () { + }, Gs.prototype.getField = function () { return this.textarea - }, dd.prototype.supportsTouch = function () { + }, Gs.prototype.supportsTouch = function () { return !1 - }, dd.prototype.focus = function () { - if ('nocursor' != this.cm.options.readOnly && (!Oa || h() != this.textarea)) try { + }, Gs.prototype.focus = function () { + if ("nocursor" != this.cm.options.readOnly && (!y || P() != this.textarea)) try { this.textarea.focus() - } catch (t) {} - }, dd.prototype.blur = function () { + } catch (e) {} + }, Gs.prototype.blur = function () { this.textarea.blur() - }, dd.prototype.resetPosition = function () { + }, Gs.prototype.resetPosition = function () { this.wrapper.style.top = this.wrapper.style.left = 0 - }, dd.prototype.receivedFocus = function () { + }, Gs.prototype.receivedFocus = function () { this.slowPoll() - }, dd.prototype.slowPoll = function () { + }, Gs.prototype.slowPoll = function () { var e = this; - this.pollingFast || this.polling.set(this.cm.options.pollInterval, function () { + this.pollingFast || this.polling.set(this.cm.options.pollInterval, (function () { e.poll(), e.cm.state.focused && e.slowPoll() - }) - }, dd.prototype.fastPoll = function () { - function e() { - var o = n.poll(); - o || t ? (n.pollingFast = !1, n.slowPoll()) : (t = !0, n.polling.set(60, e)) - } - var t = !1, - n = this; - n.pollingFast = !0, n.polling.set(20, e) - }, dd.prototype.poll = function () { + })) + }, Gs.prototype.fastPoll = function () { + var e = !1, + t = this; + t.pollingFast = !0, t.polling.set(20, (function n() { + t.poll() || e ? (t.pollingFast = !1, t.slowPoll()) : (e = !0, t.polling.set(60, n)) + })) + }, Gs.prototype.poll = function () { var e = this, t = this.cm, n = this.textarea, - o = this.prevInput; - if (this.contextMenuPending || !t.state.focused || ds(n) && !o && !this.composing || t.isReadOnly() || t.options.disableInput || t.state.keySeq) return !1; - var r = n.value; - if (r == o && !t.somethingSelected()) return !1; - if (Ra && 9 <= xa && this.hasSelection === r || Ha && /[\uf700-\uf7ff]/.test(r)) return t.display.input.reset(), !1; + r = this.prevInput; + if (this.contextMenuPending || !t.state.focused || Pe(n) && !r && !this.composing || t.isReadOnly() || t.options.disableInput || t.state.keySeq) return !1; + var i = n.value; + if (i == r && !t.somethingSelected()) return !1; + if (s && a >= 9 && this.hasSelection === i || v && /[\uf700-\uf7ff]/.test(i)) return t.display.input.reset(), !1; if (t.doc.sel == t.display.selForContextMenu) { - var i = r.charCodeAt(0); - if (8203 != i || o || (o = '\u200B'), 8666 == i) return this.reset(), this.cm.execCommand('undo') + var o = i.charCodeAt(0); + if (8203 != o || r || (r = "​"), 8666 == o) return this.reset(), this.cm.execCommand("undo") } - for (var a = 0, s = d(o.length, r.length); a < s && o.charCodeAt(a) == r.charCodeAt(a);) ++a; - return Ro(t, function () { - sa(t, r.slice(a), o.length - a, null, e.composing ? '*compose' : null), 1e3 < r.length || -1 < r.indexOf('\n') ? n.value = e.prevInput = '' : e.prevInput = r, e.composing && (e.composing.range.clear(), e.composing.range = t.markText(e.composing.start, t.getCursor('to'), { - className: 'CodeMirror-composing' + for (var l = 0, c = Math.min(r.length, i.length); l < c && r.charCodeAt(l) == i.charCodeAt(l);) ++l; + return Jr(t, (function () { + Ps(t, i.slice(l), r.length - l, null, e.composing ? "*compose" : null), i.length > 1e3 || i.indexOf("\n") > -1 ? n.value = e.prevInput = "" : e.prevInput = i, e.composing && (e.composing.range.clear(), e.composing.range = t.markText(e.composing.start, t.getCursor("to"), { + className: "CodeMirror-composing" })) - }), !0 - }, dd.prototype.ensurePolled = function () { + })), !0 + }, Gs.prototype.ensurePolled = function () { this.pollingFast && this.poll() && (this.pollingFast = !1) - }, dd.prototype.onKeyPress = function () { - Ra && 9 <= xa && (this.hasSelection = null), this.fastPoll() - }, dd.prototype.onContextMenu = function (t) { - function e() { - if (null != s.selectionStart) { - var e = r.somethingSelected(), - t = '\u200B' + (e ? s.value : ''); - s.value = '\u21DA', s.value = t, o.prevInput = e ? '' : '\u200B', s.selectionStart = 1, s.selectionEnd = t.length, a.selForContextMenu = r.doc.sel + }, Gs.prototype.onKeyPress = function () { + s && a >= 9 && (this.hasSelection = null), this.fastPoll() + }, Gs.prototype.onContextMenu = function (e) { + var t = this, + n = t.cm, + r = n.display, + i = t.textarea; + t.contextMenuPending && t.contextMenuPending(); + var o = cr(n, e), + c = r.scroller.scrollTop; + if (o && !h) { + n.options.resetSelectionOnContextMenu && -1 == n.doc.sel.contains(o) && ei(n, Ji)(n.doc, xi(o), W); + var u, p = i.style.cssText, + d = t.wrapper.style.cssText, + f = t.wrapper.offsetParent.getBoundingClientRect(); + if (t.wrapper.style.cssText = "position: static", i.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - f.top - 5) + "px; left: " + (e.clientX - f.left - 5) + "px;\n z-index: 1000; background: " + (s ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);", l && (u = window.scrollY), r.input.focus(), l && window.scrollTo(null, u), r.input.reset(), n.somethingSelected() || (i.value = t.prevInput = " "), t.contextMenuPending = y, r.selForContextMenu = n.doc.sel, clearTimeout(r.detectingSelectAll), s && a >= 9 && g(), E) { + Ce(e); + var m = function () { + de(window, "mouseup", m), setTimeout(y, 20) + }; + he(window, "mouseup", m) + } else setTimeout(y, 50) + } + + function g() { + if (null != i.selectionStart) { + var e = n.somethingSelected(), + o = "​" + (e ? i.value : ""); + i.value = "⇚", i.value = o, t.prevInput = e ? "" : "​", i.selectionStart = 1, i.selectionEnd = o.length, r.selForContextMenu = n.doc.sel } } - function n() { - if (o.contextMenuPending == n && (o.contextMenuPending = !1, o.wrapper.style.cssText = p, s.style.cssText = c, Ra && 9 > xa && a.scrollbars.setScrollTop(a.scroller.scrollTop = d), null != s.selectionStart)) { - (!Ra || Ra && 9 > xa) && e(); - var t = 0, - i = function () { - a.selForContextMenu == r.doc.sel && 0 == s.selectionStart && 0 < s.selectionEnd && '\u200B' == o.prevInput ? xo(r, zr)(r) : 10 > t++ ? a.detectingSelectAll = setTimeout(i, 500) : (a.selForContextMenu = null, a.input.reset()) + function y() { + if (t.contextMenuPending == y && (t.contextMenuPending = !1, t.wrapper.style.cssText = d, i.style.cssText = p, s && a < 9 && r.scrollbars.setScrollTop(r.scroller.scrollTop = c), null != i.selectionStart)) { + (!s || s && a < 9) && g(); + var e = 0, + o = function () { + r.selForContextMenu == n.doc.sel && 0 == i.selectionStart && i.selectionEnd > 0 && "​" == t.prevInput ? ei(n, ao)(n) : e++ < 10 ? r.detectingSelectAll = setTimeout(o, 500) : (r.selForContextMenu = null, r.input.reset()) }; - a.detectingSelectAll = setTimeout(i, 200) + r.detectingSelectAll = setTimeout(o, 200) } } - var o = this, - r = o.cm, - a = r.display, - s = o.textarea; - o.contextMenuPending && o.contextMenuPending(); - var i = Ln(r, t), - d = a.scroller.scrollTop; - if (i && !Aa) { - var l = r.options.resetSelectionOnContextMenu; - l && -1 == r.doc.sel.contains(i) && xo(r, Ar)(r.doc, Zo(i), $a); - var c = s.style.cssText, - p = o.wrapper.style.cssText, - u = o.wrapper.offsetParent.getBoundingClientRect(); - o.wrapper.style.cssText = 'position: static', s.style.cssText = 'position: absolute; width: 30px; height: 30px;\n top: ' + (t.clientY - u.top - 5) + 'px; left: ' + (t.clientX - u.left - 5) + 'px;\n z-index: 1000; background: ' + (Ra ? 'rgba(255, 255, 255, .05)' : 'transparent') + ';\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);'; - var m; - if (Pa && (m = window.scrollY), a.input.focus(), Pa && window.scrollTo(null, m), a.input.reset(), r.somethingSelected() || (s.value = o.prevInput = ' '), o.contextMenuPending = n, a.selForContextMenu = r.doc.sel, clearTimeout(a.detectingSelectAll), Ra && 9 <= xa && e(), Ga) { - q(t); - var h = function () { - O(window, 'mouseup', h), setTimeout(n, 20) - }; - as(window, 'mouseup', h) - } else setTimeout(n, 50) - } - }, dd.prototype.readOnlyChanged = function (e) { - e || this.reset(), this.textarea.disabled = 'nocursor' == e - }, dd.prototype.setUneditable = function () {}, dd.prototype.needsContentAttribute = !1, + }, Gs.prototype.readOnlyChanged = function (e) { + e || this.reset(), this.textarea.disabled = "nocursor" == e + }, Gs.prototype.setUneditable = function () {}, Gs.prototype.needsContentAttribute = !1, function (e) { - function t(t, o, r, i) { - e.defaults[t] = o, r && (n[t] = i ? function (e, t, n) { - n != ed && r(e, t, n) - } : r) + var t = e.optionHandlers; + + function n(n, r, i, o) { + e.defaults[n] = r, i && (t[n] = o ? function (e, t, n) { + n != Cs && i(e, t, n) + } : i) } - var n = e.optionHandlers; - e.defineOption = t, e.Init = ed, t('value', '', function (e, t) { + e.defineOption = n, e.Init = Cs, n("value", "", (function (e, t) { return e.setValue(t) - }, !0), t('mode', null, function (e, t) { - e.doc.modeOption = t, rr(e) - }, !0), t('indentUnit', 2, rr, !0), t('indentWithTabs', !1), t('smartIndent', !0), t('tabSize', 4, function (e) { - ir(e), pn(e), Bn(e) - }, !0), t('lineSeparator', null, function (e, t) { - if (e.doc.lineSep = t, !!t) { + }), !0), n("mode", null, (function (e, t) { + e.doc.modeOption = t, Ai(e) + }), !0), n("indentUnit", 2, Ai, !0), n("indentWithTabs", !1), n("smartIndent", !0), n("tabSize", 4, (function (e) { + Mi(e), zn(e), hr(e) + }), !0), n("lineSeparator", null, (function (e, t) { + if (e.doc.lineSep = t, t) { var n = [], - o = e.doc.first; - e.doc.iter(function (e) { - for (var r = 0, i;;) { - if (i = e.text.indexOf(t, r), -1 == i) break; - r = i + t.length, n.push(fe(o, i)) + r = e.doc.first; + e.doc.iter((function (e) { + for (var i = 0;;) { + var o = e.text.indexOf(t, i); + if (-1 == o) break; + i = o + t.length, n.push(et(r, o)) } - o++ - }); - for (var r = n.length - 1; 0 <= r; r--) Yr(e.doc, t, n[r], fe(n[r].line, n[r].ch + t.length)) + r++ + })); + for (var i = n.length - 1; i >= 0; i--) mo(e.doc, t, n[i], et(n[i].line, n[i].ch + t.length)) } - }), t('specialChars', /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (e, t, n) { - e.state.specialChars = new RegExp(t.source + (t.test('\t') ? '' : '|\t'), 'g'), n != ed && e.refresh() - }), t('specialCharPlaceholder', yt, function (e) { + })), n("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, (function (e, t, n) { + e.state.specialChars = new RegExp(t.source + (t.test("\t") ? "" : "|\t"), "g"), n != Cs && e.refresh() + })), n("specialCharPlaceholder", Xt, (function (e) { return e.refresh() - }, !0), t('electricChars', !0), t('inputStyle', Oa ? 'contenteditable' : 'textarea', function () { - throw new Error('inputStyle can not (yet) be changed in a running editor') - }, !0), t('spellcheck', !1, function (e, t) { + }), !0), n("electricChars", !0), n("inputStyle", y ? "contenteditable" : "textarea", (function () { + throw new Error("inputStyle can not (yet) be changed in a running editor") + }), !0), n("spellcheck", !1, (function (e, t) { return e.getInputField().spellcheck = t - }, !0), t('autocorrect', !1, function (e, t) { + }), !0), n("autocorrect", !1, (function (e, t) { return e.getInputField().autocorrect = t - }, !0), t('autocapitalize', !1, function (e, t) { + }), !0), n("autocapitalize", !1, (function (e, t) { return e.getInputField().autocapitalize = t - }, !0), t('rtlMoveVisually', !Ua), t('wholeLineUpdateBefore', !0), t('theme', 'default', function (e) { - ea(e), jo(e) - }, !0), t('keyMap', 'default', function (e, t, n) { - var o = Ei(t), - r = n != ed && Ei(n); - r && r.detach && r.detach(e, o), o.attach && o.attach(e, r || null) - }), t('extraKeys', null), t('configureMouse', null), t('lineWrapping', !1, na, !0), t('gutters', [], function (e, t) { - e.display.gutterSpecs = Go(t, e.options.lineNumbers), jo(e) - }, !0), t('fixedGutter', !0, function (e, t) { - e.display.gutters.style.left = t ? Mn(e.display) + 'px' : '0', e.refresh() - }, !0), t('coverGutterNextToScrollbar', !1, function (e) { - return go(e) - }, !0), t('scrollbarStyle', 'native', function (e) { - So(e), go(e), e.display.scrollbars.setScrollTop(e.doc.scrollTop), e.display.scrollbars.setScrollLeft(e.doc.scrollLeft) - }, !0), t('lineNumbers', !1, function (e, t) { - e.display.gutterSpecs = Go(e.options.gutters, t), jo(e) - }, !0), t('firstLineNumber', 1, jo, !0), t('lineNumberFormatter', function (e) { + }), !0), n("rtlMoveVisually", !b), n("wholeLineUpdateBefore", !0), n("theme", "default", (function (e) { + Ss(e), mi(e) + }), !0), n("keyMap", "default", (function (e, t, n) { + var r = Qo(t), + i = n != Cs && Qo(n); + i && i.detach && i.detach(e, r), r.attach && r.attach(e, i || null) + })), n("extraKeys", null), n("configureMouse", null), n("lineWrapping", !1, Ts, !0), n("gutters", [], (function (e, t) { + e.display.gutterSpecs = di(t, e.options.lineNumbers), mi(e) + }), !0), n("fixedGutter", !0, (function (e, t) { + e.display.gutters.style.left = t ? sr(e.display) + "px" : "0", e.refresh() + }), !0), n("coverGutterNextToScrollbar", !1, (function (e) { + return Ur(e) + }), !0), n("scrollbarStyle", "native", (function (e) { + jr(e), Ur(e), e.display.scrollbars.setScrollTop(e.doc.scrollTop), e.display.scrollbars.setScrollLeft(e.doc.scrollLeft) + }), !0), n("lineNumbers", !1, (function (e, t) { + e.display.gutterSpecs = di(e.options.gutters, t), mi(e) + }), !0), n("firstLineNumber", 1, mi, !0), n("lineNumberFormatter", (function (e) { return e - }, jo, !0), t('showCursorWhenSelecting', !1, Wn, !0), t('resetSelectionOnContextMenu', !0), t('lineWiseCopyCut', !0), t('pasteLinesPerSelection', !0), t('selectionsMayTouch', !1), t('readOnly', !1, function (e, t) { - 'nocursor' == t && ($n(e), e.display.input.blur()), e.display.input.readOnlyChanged(t) - }), t('disableInput', !1, function (e, t) { + }), mi, !0), n("showCursorWhenSelecting", !1, gr, !0), n("resetSelectionOnContextMenu", !0), n("lineWiseCopyCut", !0), n("pasteLinesPerSelection", !0), n("selectionsMayTouch", !1), n("readOnly", !1, (function (e, t) { + "nocursor" == t && (xr(e), e.display.input.blur()), e.display.input.readOnlyChanged(t) + })), n("disableInput", !1, (function (e, t) { t || e.display.input.reset() - }, !0), t('dragDrop', !0, ta), t('allowDropFileTypes', null), t('cursorBlinkRate', 530), t('cursorScrollMargin', 0), t('cursorHeight', 1, Wn, !0), t('singleCursorHeightPerLine', !0, Wn, !0), t('workTime', 100), t('workDelay', 100), t('flattenSpans', !0, ir, !0), t('addModeClass', !1, ir, !0), t('pollInterval', 100), t('undoDepth', 200, function (e, t) { + }), !0), n("dragDrop", !0, xs), n("allowDropFileTypes", null), n("cursorBlinkRate", 530), n("cursorScrollMargin", 0), n("cursorHeight", 1, gr, !0), n("singleCursorHeightPerLine", !0, gr, !0), n("workTime", 100), n("workDelay", 100), n("flattenSpans", !0, Mi, !0), n("addModeClass", !1, Mi, !0), n("pollInterval", 100), n("undoDepth", 200, (function (e, t) { return e.doc.history.undoDepth = t - }), t('historyEventDelay', 1250), t('viewportMargin', 10, function (e) { + })), n("historyEventDelay", 1250), n("viewportMargin", 10, (function (e) { return e.refresh() - }, !0), t('maxHighlightLength', 1e4, ir, !0), t('moveInputWithCursor', !0, function (e, t) { + }), !0), n("maxHighlightLength", 1e4, Mi, !0), n("moveInputWithCursor", !0, (function (e, t) { t || e.display.input.resetPosition() - }), t('tabindex', null, function (e, t) { - return e.display.input.getField().tabIndex = t || '' - }), t('autofocus', null), t('direction', 'ltr', function (e, t) { + })), n("tabindex", null, (function (e, t) { + return e.display.input.getField().tabIndex = t || "" + })), n("autofocus", null), n("direction", "ltr", (function (e, t) { return e.doc.setDirection(t) - }, !0), t('phrases', null) - }(oa), + }), !0), n("phrases", null) + }(Rs), function (e) { var t = e.optionHandlers, n = e.helpers = {}; @@ -7732,9 +7820,9 @@ module.exports = function (e) { window.focus(), this.display.input.focus() }, setOption: function (e, n) { - var o = this.options, - r = o[e]; - o[e] == n && 'mode' != e || (o[e] = n, t.hasOwnProperty(e) && xo(this, t[e])(this, n, r), H(this, 'optionChange', this, e)) + var r = this.options, + i = r[e]; + r[e] == n && "mode" != e || (r[e] = n, t.hasOwnProperty(e) && ei(this, t[e])(this, n, i), fe(this, "optionChange", this, e)) }, getOption: function (e) { return this.options[e] @@ -7743,69 +7831,78 @@ module.exports = function (e) { return this.doc }, addKeyMap: function (e, t) { - this.state.keyMaps[t ? 'push' : 'unshift'](Ei(e)) + this.state.keyMaps[t ? "push" : "unshift"](Qo(e)) }, removeKeyMap: function (e) { for (var t = this.state.keyMaps, n = 0; n < t.length; ++n) if (t[n] == e || t[n].name == e) return t.splice(n, 1), !0 }, - addOverlay: Po(function (t, n) { - var o = t.token ? t : e.getMode(this.options, t); - if (o.startState) throw new Error('Overlays may not be stateful.'); - T(this.state.overlays, { - mode: o, + addOverlay: ti((function (t, n) { + var r = t.token ? t : e.getMode(this.options, t); + if (r.startState) throw new Error("Overlays may not be stateful."); + ! function (e, t, n) { + for (var r = 0, i = n(t); r < e.length && n(e[r]) <= i;) r++; + e.splice(r, 0, t) + }(this.state.overlays, { + mode: r, modeSpec: t, opaque: n && n.opaque, priority: n && n.priority || 0 - }, function (e) { + }, (function (e) { return e.priority - }), this.state.modeGen++, Bn(this) - }), - removeOverlay: Po(function (e) { - for (var t = this, n = this.state.overlays, o = 0, r; o < n.length; ++o) - if (r = n[o].modeSpec, r == e || 'string' == typeof e && r.name == e) return n.splice(o, 1), t.state.modeGen++, void Bn(t) - }), - indentLine: Po(function (e, t, n) { - 'string' != typeof t && 'number' != typeof t && (null == t ? t = this.options.smartIndent ? 'smart' : 'prev' : t = t ? 'add' : 'subtract'), me(this.doc, e) && ia(this, e, t, n) - }), - indentSelection: Po(function (e) { - for (var t = this, n = this.doc.sel.ranges, o = -1, a = 0, i; a < n.length; a++) - if (i = n[a], !i.empty()) { - var s = i.from(), - l = i.to(), - c = r(o, s.line); - o = d(t.lastLine(), l.line - (l.ch ? 0 : 1)) + 1; - for (var p = c; p < o; ++p) ia(t, p, e); - var u = t.doc.sel.ranges; - 0 == s.ch && n.length == u.length && 0 < u[a].from().ch && xr(t.doc, a, new Ns(s, u[a].to()), $a) - } else i.head.line > o && (ia(t, i.head.line, e, !0), o = i.head.line, a == t.doc.sel.primIndex && ao(t)) - }), + })), this.state.modeGen++, hr(this) + })), + removeOverlay: ti((function (e) { + for (var t = this.state.overlays, n = 0; n < t.length; ++n) { + var r = t[n].modeSpec; + if (r == e || "string" == typeof e && r.name == e) return t.splice(n, 1), this.state.modeGen++, void hr(this) + } + })), + indentLine: ti((function (e, t, n) { + "string" != typeof t && "number" != typeof t && (t = null == t ? this.options.smartIndent ? "smart" : "prev" : t ? "add" : "subtract"), Xe(this.doc, e) && _s(this, e, t, n) + })), + indentSelection: ti((function (e) { + for (var t = this.doc.sel.ranges, n = -1, r = 0; r < t.length; r++) { + var i = t[r]; + if (i.empty()) i.head.line > n && (_s(this, i.head.line, e, !0), n = i.head.line, r == this.doc.sel.primIndex && Mr(this)); + else { + var o = i.from(), + s = i.to(), + a = Math.max(n, o.line); + n = Math.min(this.lastLine(), s.line - (s.ch ? 0 : 1)) + 1; + for (var l = a; l < n; ++l) _s(this, l, e); + var c = this.doc.sel.ranges; + 0 == o.ch && t.length == c.length && c[r].from().ch > 0 && Qi(this.doc, r, new Ei(o, c[r].to()), W) + } + } + })), getTokenAt: function (e, t) { - return Me(this, e, t) + return vt(this, e, t) }, getLineTokens: function (e, t) { - return Me(this, fe(e), t, !0) + return vt(this, et(e), t, !0) }, getTokenTypeAt: function (e) { - e = Ee(this.doc, e); - var t = _e(this, se(this.doc, e.line)), - n = 0, - o = (t.length - 1) / 2, - r = e.ch, - i; - if (0 == r) i = t[2]; + e = at(this.doc, e); + var t, n = pt(this, $e(this.doc, e.line)), + r = 0, + i = (n.length - 1) / 2, + o = e.ch; + if (0 == o) t = n[2]; else for (;;) { - var a = n + o >> 1; - if ((a ? t[2 * a - 1] : 0) >= r) o = a; - else if (t[2 * a + 1] < r) n = a + 1; + var s = r + i >> 1; + if ((s ? n[2 * s - 1] : 0) >= o) i = s; else { - i = t[2 * a + 2]; - break + if (!(n[2 * s + 1] < o)) { + t = n[2 * s + 2]; + break + } + r = s + 1 } } - var s = i ? i.indexOf('overlay ') : -1; - return 0 > s ? i : 0 == s ? null : i.slice(0, s - 1) + var a = t ? t.indexOf("overlay ") : -1; + return a < 0 ? t : 0 == a ? null : t.slice(0, a - 1) }, getModeAt: function (t) { var n = this.doc.mode; @@ -7815,56 +7912,58 @@ module.exports = function (e) { return this.getHelpers(e, t)[0] }, getHelpers: function (e, t) { - var o = this, - r = []; + var r = []; if (!n.hasOwnProperty(t)) return r; - var a = n[t], - s = this.getModeAt(e); - if ('string' == typeof s[t]) a[s[t]] && r.push(a[s[t]]); - else if (s[t]) - for (var d = 0, i; d < s[t].length; d++) i = a[s[t][d]], i && r.push(i); - else s.helperType && a[s.helperType] ? r.push(a[s.helperType]) : a[s.name] && r.push(a[s.name]); - for (var l = 0, c; l < a._global.length; l++) c = a._global[l], c.pred(s, o) && -1 == b(r, c.val) && r.push(c.val); + var i = n[t], + o = this.getModeAt(e); + if ("string" == typeof o[t]) i[o[t]] && r.push(i[o[t]]); + else if (o[t]) + for (var s = 0; s < o[t].length; s++) { + var a = i[o[t][s]]; + a && r.push(a) + } else o.helperType && i[o.helperType] ? r.push(i[o.helperType]) : i[o.name] && r.push(i[o.name]); + for (var l = 0; l < i._global.length; l++) { + var c = i._global[l]; + c.pred(o, this) && -1 == z(r, c.val) && r.push(c.val) + } return r }, getStateAfter: function (e, t) { var n = this.doc; - return e = ve(n, null == e ? n.first + n.size - 1 : e), Re(this, e + 1, t).state + return dt(this, (e = st(n, null == e ? n.first + n.size - 1 : e)) + 1, t).state }, cursorCoords: function (e, t) { - var n = this.doc.sel.primary(), - o; - return o = null == e ? n.head : 'object' == typeof e ? Ee(this.doc, e) : e ? n.from() : n.to(), Sn(this, o, t || 'page') + var n = this.doc.sel.primary(); + return qn(this, null == e ? n.head : "object" == typeof e ? at(this.doc, e) : e ? n.from() : n.to(), t || "page") }, charCoords: function (e, t) { - return yn(this, Ee(this.doc, e), t || 'page') + return $n(this, at(this.doc, e), t || "page") }, coordsChar: function (e, t) { - return e = gn(this, e, t || 'page'), vn(this, e.left, e.top) + return Qn(this, (e = Gn(this, e, t || "page")).left, e.top) }, lineAtHeight: function (e, t) { - return e = gn(this, { + return e = Gn(this, { top: e, left: 0 - }, t || 'page').top, ue(this.doc, e + this.display.viewOffset) + }, t || "page").top, Ze(this.doc, e + this.display.viewOffset) }, heightAtLine: function (e, t, n) { - var o = !1, - r; - if ('number' == typeof e) { - var i = this.doc.first + this.doc.size - 1; - e < this.doc.first ? e = this.doc.first : e > i && (e = i, o = !0), r = se(this.doc, e) + var r, i = !1; + if ("number" == typeof e) { + var o = this.doc.first + this.doc.size - 1; + e < this.doc.first ? e = this.doc.first : e > o && (e = o, i = !0), r = $e(this.doc, e) } else r = e; - return fn(this, r, { + return jn(this, r, { top: 0, left: 0 - }, t || 'page', n || o).top + (o ? this.doc.height - ct(r) : 0) + }, t || "page", n || i).top + (i ? this.doc.height - Vt(r) : 0) }, defaultTextHeight: function () { - return xn(this.display) + return rr(this.display) }, defaultCharWidth: function () { - return Pn(this.display) + return ir(this.display) }, getViewport: function () { return { @@ -7872,170 +7971,171 @@ module.exports = function (e) { to: this.display.viewTo } }, - addWidget: function (e, t, n, o, i) { - var a = this.display; - e = Sn(this, Ee(this.doc, e)); - var s = e.bottom, - d = e.left; - if (t.style.position = 'absolute', t.setAttribute('cm-ignore-events', 'true'), this.display.input.setUneditable(t), a.sizer.appendChild(t), 'over' == o) s = e.top; - else if ('above' == o || 'near' == o) { - var l = r(a.wrapper.clientHeight, this.doc.height), - c = r(a.sizer.clientWidth, a.lineSpace.clientWidth); - ('above' == o || e.bottom + t.offsetHeight > l) && e.top > t.offsetHeight ? s = e.top - t.offsetHeight : e.bottom + t.offsetHeight <= l && (s = e.bottom), d + t.offsetWidth > c && (d = c - t.offsetWidth) + addWidget: function (e, t, n, r, i) { + var o, s, a, l = this.display, + c = (e = qn(this, at(this.doc, e))).bottom, + u = e.left; + if (t.style.position = "absolute", t.setAttribute("cm-ignore-events", "true"), this.display.input.setUneditable(t), l.sizer.appendChild(t), "over" == r) c = e.top; + else if ("above" == r || "near" == r) { + var h = Math.max(l.wrapper.clientHeight, this.doc.height), + p = Math.max(l.sizer.clientWidth, l.lineSpace.clientWidth); + ("above" == r || e.bottom + t.offsetHeight > h) && e.top > t.offsetHeight ? c = e.top - t.offsetHeight : e.bottom + t.offsetHeight <= h && (c = e.bottom), u + t.offsetWidth > p && (u = p - t.offsetWidth) } - t.style.top = s + 'px', t.style.left = t.style.right = '', 'right' == i ? (d = a.sizer.clientWidth - t.offsetWidth, t.style.right = '0px') : ('left' == i ? d = 0 : 'middle' == i && (d = (a.sizer.clientWidth - t.offsetWidth) / 2), t.style.left = d + 'px'), n && oo(this, { - left: d, - top: s, - right: d + t.offsetWidth, - bottom: s + t.offsetHeight - }) + t.style.top = c + "px", t.style.left = t.style.right = "", "right" == i ? (u = l.sizer.clientWidth - t.offsetWidth, t.style.right = "0px") : ("left" == i ? u = 0 : "middle" == i && (u = (l.sizer.clientWidth - t.offsetWidth) / 2), t.style.left = u + "px"), n && (o = this, s = { + left: u, + top: c, + right: u + t.offsetWidth, + bottom: c + t.offsetHeight + }, null != (a = _r(o, s)).scrollTop && Lr(o, a.scrollTop), null != a.scrollLeft && Fr(o, a.scrollLeft)) }, - triggerOnKeyDown: Po(Ni), - triggerOnKeyPress: Po(zi), - triggerOnKeyUp: Hi, - triggerOnMouseDown: Po(Wi), + triggerOnKeyDown: ti(us), + triggerOnKeyPress: ti(ps), + triggerOnKeyUp: hs, + triggerOnMouseDown: ti(gs), execCommand: function (e) { - if (Qs.hasOwnProperty(e)) return Qs[e].call(null, this) + if (ts.hasOwnProperty(e)) return ts[e].call(null, this) }, - triggerElectric: Po(function (e) { - la(this, e) - }), - findPosH: function (e, t, n, o) { - var r = this, - a = 1; - 0 > t && (a = -1, t = -t); - for (var s = Ee(this.doc, e), d = 0; d < t && (s = ma(r.doc, s, a, n, o), !s.hitSide); ++d); - return s + triggerElectric: ti((function (e) { + Os(this, e) + })), + findPosH: function (e, t, n, r) { + var i = 1; + t < 0 && (i = -1, t = -t); + for (var o = at(this.doc, e), s = 0; s < t && !(o = Bs(this.doc, o, i, n, r)).hitSide; ++s); + return o }, - moveH: Po(function (e, t) { + moveH: ti((function (e, t) { var n = this; - this.extendSelectionsBy(function (o) { - return n.display.shift || n.doc.extend || o.empty() ? ma(n.doc, o.head, e, t, n.options.rtlMoveVisually) : 0 > e ? o.from() : o.to() - }, Ja) - }), - deleteH: Po(function (e, t) { + this.extendSelectionsBy((function (r) { + return n.display.shift || n.doc.extend || r.empty() ? Bs(n.doc, r.head, e, t, n.options.rtlMoveVisually) : e < 0 ? r.from() : r.to() + }), j) + })), + deleteH: ti((function (e, t) { var n = this.doc.sel, - o = this.doc; - n.somethingSelected() ? o.replaceSelection('', null, '+delete') : wi(this, function (n) { - var r = ma(o, n.head, e, t, !1); - return 0 > e ? { - from: r, + r = this.doc; + n.somethingSelected() ? r.replaceSelection("", null, "+delete") : Zo(this, (function (n) { + var i = Bs(r, n.head, e, t, !1); + return e < 0 ? { + from: i, to: n.head } : { from: n.head, - to: r + to: i } - }) - }), - findPosV: function (e, t, n, o) { - var r = this, - a = 1, - s = o; - 0 > t && (a = -1, t = -t); - for (var d = Ee(this.doc, e), l = 0, i; l < t && (i = Sn(r, d, 'div'), null == s ? s = i.left : i.left = s, d = ha(r, i, a, n), !d.hitSide); ++l); - return d + })) + })), + findPosV: function (e, t, n, r) { + var i = 1, + o = r; + t < 0 && (i = -1, t = -t); + for (var s = at(this.doc, e), a = 0; a < t; ++a) { + var l = qn(this, s, "div"); + if (null == o ? o = l.left : l.left = o, (s = Hs(this, l, i, n)).hitSide) break + } + return s }, - moveV: Po(function (e, t) { + moveV: ti((function (e, t) { var n = this, - o = this.doc, - r = [], - a = !this.display.shift && !o.extend && o.sel.somethingSelected(); - if (o.extendSelectionsBy(function (i) { - if (a) return 0 > e ? i.from() : i.to(); - var s = Sn(n, i.head, 'div'); - null != i.goalColumn && (s.left = i.goalColumn), r.push(s.left); - var d = ha(n, s, e, t); - return 'page' == t && i == o.sel.primary() && io(n, yn(n, d, 'div').top - s.top), d - }, Ja), r.length) - for (var s = 0; s < o.sel.ranges.length; s++) o.sel.ranges[s].goalColumn = r[s] - }), + r = this.doc, + i = [], + o = !this.display.shift && !r.extend && r.sel.somethingSelected(); + if (r.extendSelectionsBy((function (s) { + if (o) return e < 0 ? s.from() : s.to(); + var a = qn(n, s.head, "div"); + null != s.goalColumn && (a.left = s.goalColumn), i.push(a.left); + var l = Hs(n, a, e, t); + return "page" == t && s == r.sel.primary() && Ar(n, $n(n, l, "div").top - a.top), l + }), j), i.length) + for (var s = 0; s < r.sel.ranges.length; s++) r.sel.ranges[s].goalColumn = i[s] + })), findWordAt: function (e) { - var t = this.doc, - n = se(t, e.line).text, - o = e.ch, + var t = $e(this.doc, e.line).text, + n = e.ch, r = e.ch; - if (n) { - var i = this.getHelper(e, 'wordChars'); - ('before' == e.sticky || r == n.length) && o ? --o : ++r; - for (var a = n.charAt(o), s = P(a, i) ? function (e) { - return P(e, i) - } : /\s/.test(a) ? function (e) { + if (t) { + var i = this.getHelper(e, "wordChars"); + "before" != e.sticky && r != t.length || !n ? ++r : --n; + for (var o = t.charAt(n), s = ee(o, i) ? function (e) { + return ee(e, i) + } : /\s/.test(o) ? function (e) { return /\s/.test(e) } : function (e) { - return !/\s/.test(e) && !P(e) - }; 0 < o && s(n.charAt(o - 1));) --o; - for (; r < n.length && s(n.charAt(r));) ++r + return !/\s/.test(e) && !ee(e) + }; n > 0 && s(t.charAt(n - 1));) --n; + for (; r < t.length && s(t.charAt(r));) ++r } - return new Ns(fe(e.line, o), fe(e.line, r)) + return new Ei(et(e.line, n), et(e.line, r)) }, toggleOverwrite: function (e) { - null != e && e == this.state.overwrite || ((this.state.overwrite = !this.state.overwrite) ? f(this.display.cursorDiv, 'CodeMirror-overwrite') : Ka(this.display.cursorDiv, 'CodeMirror-overwrite'), H(this, 'overwriteToggle', this, this.state.overwrite)) + null != e && e == this.state.overwrite || ((this.state.overwrite = !this.state.overwrite) ? I(this.display.cursorDiv, "CodeMirror-overwrite") : T(this.display.cursorDiv, "CodeMirror-overwrite"), fe(this, "overwriteToggle", this, this.state.overwrite)) }, hasFocus: function () { - return this.display.input.getField() == h() + return this.display.input.getField() == P() }, isReadOnly: function () { - return !!(this.options.readOnly || this.doc.cantEdit) + return !(!this.options.readOnly && !this.doc.cantEdit) }, - scrollTo: Po(function (e, t) { - so(this, e, t) - }), + scrollTo: ti((function (e, t) { + Pr(this, e, t) + })), getScrollInfo: function () { var e = this.display.scroller; return { left: e.scrollLeft, top: e.scrollTop, - height: e.scrollHeight - qt(this) - this.display.barHeight, - width: e.scrollWidth - qt(this) - this.display.barWidth, - clientHeight: Xt(this), - clientWidth: Yt(this) + height: e.scrollHeight - Tn(this) - this.display.barHeight, + width: e.scrollWidth - Tn(this) - this.display.barWidth, + clientHeight: Dn(this), + clientWidth: Rn(this) } }, - scrollIntoView: Po(function (e, t) { + scrollIntoView: ti((function (e, t) { null == e ? (e = { from: this.doc.sel.primary().head, to: null - }, null == t && (t = this.options.cursorScrollMargin)) : 'number' == typeof e ? e = { - from: fe(e, 0), + }, null == t && (t = this.options.cursorScrollMargin)) : "number" == typeof e ? e = { + from: et(e, 0), to: null } : null == e.from && (e = { from: e, to: null - }), e.to || (e.to = e.from), e.margin = t || 0, null == e.from.line ? po(this, e.from, e.to, e.margin) : lo(this, e) - }), - setSize: Po(function (e, t) { + }), e.to || (e.to = e.from), e.margin = t || 0, null != e.from.line ? function (e, t) { + Ir(e), e.curOp.scrollToPos = t + }(this, e) : Or(this, e.from, e.to, e.margin) + })), + setSize: ti((function (e, t) { var n = this, - o = function (e) { - return 'number' == typeof e || /^\d+$/.test(e + '') ? e + 'px' : e + r = function (e) { + return "number" == typeof e || /^\d+$/.test(String(e)) ? e + "px" : e }; - null != e && (this.display.wrapper.style.width = o(e)), null != t && (this.display.wrapper.style.height = o(t)), this.options.lineWrapping && cn(this); - var r = this.display.viewFrom; - this.doc.iter(r, this.display.viewTo, function (e) { + null != e && (this.display.wrapper.style.width = r(e)), null != t && (this.display.wrapper.style.height = r(t)), this.options.lineWrapping && Hn(this); + var i = this.display.viewFrom; + this.doc.iter(i, this.display.viewTo, (function (e) { if (e.widgets) for (var t = 0; t < e.widgets.length; t++) if (e.widgets[t].noHScroll) { - Nn(n, r, 'widget'); + pr(n, i, "widget"); break - }++ r - }), this.curOp.forceUpdate = !0, H(this, 'refresh', this) - }), + }++ i + })), this.curOp.forceUpdate = !0, fe(this, "refresh", this) + })), operation: function (e) { - return Ro(this, e) + return Jr(this, e) }, startOperation: function () { - return Co(this) + return $r(this) }, endOperation: function () { - return bo(this) + return qr(this) }, - refresh: Po(function () { + refresh: ti((function () { var e = this.display.cachedTextHeight; - Bn(this), this.curOp.forceUpdate = !0, pn(this), so(this, this.doc.scrollLeft, this.doc.scrollTop), zo(this.display), (null == e || .5 < o(e - xn(this.display))) && In(this), H(this, 'refresh', this) - }), - swapDoc: Po(function (e) { + hr(this), this.curOp.forceUpdate = !0, zn(this), Pr(this, this.doc.scrollLeft, this.doc.scrollTop), ci(this.display), (null == e || Math.abs(e - rr(this.display)) > .5) && lr(this), fe(this, "refresh", this) + })), + swapDoc: ti((function (e) { var t = this.doc; - return t.cm = null, this.state.selectingText && this.state.selectingText(), lr(this, e), pn(this), this.display.input.reset(), so(this, e.scrollLeft, e.scrollTop), this.curOp.forceScroll = !0, xt(this, 'swapDoc', this, t), t - }), + return t.cm = null, this.state.selectingText && this.state.selectingText(), Li(this, e), zn(this), this.display.input.reset(), Pr(this, e.scrollLeft, e.scrollTop), this.curOp.forceScroll = !0, ln(this, "swapDoc", this, t), t + })), phrase: function (e) { var t = this.options.phrases; return t && Object.prototype.hasOwnProperty.call(t, e) ? t[e] : e @@ -8052,57668 +8152,49981 @@ module.exports = function (e) { getGutterElement: function () { return this.display.gutters } - }, V(e), e.registerHelper = function (t, o, r) { + }, ve(e), e.registerHelper = function (t, r, i) { n.hasOwnProperty(t) || (n[t] = e[t] = { _global: [] - }), n[t][o] = r - }, e.registerGlobalHelper = function (t, o, r, i) { - e.registerHelper(t, o, i), n[t]._global.push({ - pred: r, - val: i + }), n[t][r] = i + }, e.registerGlobalHelper = function (t, r, i, o) { + e.registerHelper(t, r, o), n[t]._global.push({ + pred: i, + val: o }) } - }(oa); - var ld = ['iter', 'insert', 'remove', 'copy', 'getEditor', 'constructor']; - for (var cd in Vs.prototype) Vs.prototype.hasOwnProperty(cd) && 0 > b(ld, cd) && (oa.prototype[cd] = function (e) { + }(Rs); + var $s = "iter insert remove copy getEditor constructor".split(" "); + for (var qs in Mo.prototype) Mo.prototype.hasOwnProperty(qs) && z($s, qs) < 0 && (Rs.prototype[qs] = function (e) { return function () { return e.apply(this.doc, arguments) } - }(Vs.prototype[cd])); - return V(Vs), oa.inputStyles = { - textarea: dd, - contenteditable: sd - }, oa.defineMode = function (e) { - oa.defaults.mode || 'null' == e || (oa.defaults.mode = e), J.apply(this, arguments) - }, oa.defineMIME = function (e, t) { - us[e] = t - }, oa.defineMode('null', function () { + }(Mo.prototype[qs])); + return ve(Mo), Rs.inputStyles = { + textarea: Gs, + contenteditable: zs + }, Rs.defineMode = function (e) { + Rs.defaults.mode || "null" == e || (Rs.defaults.mode = e), Fe.apply(this, arguments) + }, Rs.defineMIME = function (e, t) { + Ne[e] = t + }, Rs.defineMode("null", (function () { return { token: function (e) { return e.skipToEnd() } } - }), oa.defineMIME('text/plain', 'null'), oa.defineExtension = function (e, t) { - oa.prototype[e] = t - }, oa.defineDocExtension = function (e, t) { - Vs.prototype[e] = t - }, oa.fromTextArea = function (e, t) { - function n() { - e.value = s.getValue() + })), Rs.defineMIME("text/plain", "null"), Rs.defineExtension = function (e, t) { + Rs.prototype[e] = t + }, Rs.defineDocExtension = function (e, t) { + Mo.prototype[e] = t + }, Rs.fromTextArea = function (e, t) { + if ((t = t ? F(t) : {}).value = e.value, !t.tabindex && e.tabIndex && (t.tabindex = e.tabIndex), !t.placeholder && e.placeholder && (t.placeholder = e.placeholder), null == t.autofocus) { + var n = P(); + t.autofocus = n == e || null != e.getAttribute("autofocus") && n == document.body } - if (t = t ? S(t) : {}, t.value = e.value, !t.tabindex && e.tabIndex && (t.tabindex = e.tabIndex), !t.placeholder && e.placeholder && (t.placeholder = e.placeholder), null == t.autofocus) { - var o = h(); - t.autofocus = o == e || null != e.getAttribute('autofocus') && o == document.body + + function r() { + e.value = a.getValue() } - var r; - if (e.form && (as(e.form, 'submit', n), !t.leaveSubmitMethodAlone)) { - var i = e.form; - r = i.submit; + var i; + if (e.form && (he(e.form, "submit", r), !t.leaveSubmitMethodAlone)) { + var o = e.form; + i = o.submit; try { - var a = i.submit = function () { - n(), i.submit = r, i.submit(), i.submit = a + var s = o.submit = function () { + r(), o.submit = i, o.submit(), o.submit = s } - } catch (t) {} + } catch (e) {} } - t.finishInit = function (o) { - o.save = n, o.getTextArea = function () { + t.finishInit = function (n) { + n.save = r, n.getTextArea = function () { return e - }, o.toTextArea = function () { - o.toTextArea = isNaN, n(), e.parentNode.removeChild(o.getWrapperElement()), e.style.display = '', e.form && (O(e.form, 'submit', n), !t.leaveSubmitMethodAlone && 'function' == typeof e.form.submit && (e.form.submit = r)) + }, n.toTextArea = function () { + n.toTextArea = isNaN, r(), e.parentNode.removeChild(n.getWrapperElement()), e.style.display = "", e.form && (de(e.form, "submit", r), t.leaveSubmitMethodAlone || "function" != typeof e.form.submit || (e.form.submit = i)) } - }, e.style.display = 'none'; - var s = oa(function (t) { + }, e.style.display = "none"; + var a = Rs((function (t) { return e.parentNode.insertBefore(t, e.nextSibling) - }, t); - return s + }), t); + return a }, function (e) { - e.off = O, e.on = as, e.wheelEventPixels = Xo, e.Doc = Vs, e.splitLines = ss, e.countColumn = C, e.findColumn = v, e.isWordChar = x, e.Pass = Qa, e.signal = H, e.Line = Es, e.changeEnd = Jo, e.scrollbarModel = Ms, e.Pos = fe, e.cmpPos = ge, e.modes = ps, e.mimeModes = us, e.resolveMode = ee, e.getMode = te, e.modeExtensions = ms, e.extendMode = ne, e.copyState = oe, e.startState = ae, e.innerMode = re, e.commands = Qs, e.keyMap = Xs, e.keyName = vi, e.isModifierKey = Ci, e.lookupKey = Si, e.normalizeKeyMap = yi, e.StringStream = hs, e.SharedTextMarker = Us, e.TextMarker = zs, e.LineWidget = Os, e.e_preventDefault = G, e.e_stopPropagation = K, e.e_stop = q, e.addClass = f, e.contains = m, e.rmClass = Ka, e.keyNames = js - }(oa), oa.version = '5.49.2', oa - }) -}, function (e) { - var t = e.exports = { - version: '1.2.6' - }; - 'number' == typeof __e && (__e = t) + e.off = de, e.on = he, e.wheelEventPixels = bi, e.Doc = Mo, e.splitLines = Me, e.countColumn = B, e.findColumn = G, e.isWordChar = J, e.Pass = U, e.signal = fe, e.Line = $t, e.changeEnd = Ti, e.scrollbarModel = Vr, e.Pos = et, e.cmpPos = tt, e.modes = Le, e.mimeModes = Ne, e.resolveMode = Be, e.getMode = He, e.modeExtensions = ze, e.extendMode = Ue, e.copyState = We, e.startState = je, e.innerMode = Ve, e.commands = ts, e.keyMap = Vo, e.keyName = Yo, e.isModifierKey = qo, e.lookupKey = $o, e.normalizeKeyMap = Go, e.StringStream = Ge, e.SharedTextMarker = Ro, e.TextMarker = xo, e.LineWidget = Co, e.e_preventDefault = we, e.e_stopPropagation = be, e.e_stop = Ce, e.addClass = I, e.contains = M, e.rmClass = T, e.keyNames = Ho + }(Rs), Rs.version = "5.49.2", Rs + }() +}, function (e, t) { + e.exports = require("os") }, function (e, t, n) { - 'use strict'; - - function o(e, t) { - return e.type === i.Local && e.name !== t && null != e.upstream + "use strict"; + t.fromCallback = function (e) { + return Object.defineProperty((function () { + if ("function" != typeof arguments[arguments.length - 1]) return new Promise((t, n) => { + arguments[arguments.length] = (e, r) => { + if (e) return n(e); + t(r) + }, arguments.length++, e.apply(this, arguments) + }); + e.apply(this, arguments) + }), "name", { + value: e.name + }) + }, t.fromPromise = function (e) { + return Object.defineProperty((function () { + const t = arguments[arguments.length - 1]; + if ("function" != typeof t) return e.apply(this, arguments); + e.apply(this, arguments).then(e => t(null, e), t) + }), "name", { + value: e.name + }) } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const r = n(705); - var i; - (function (e) { - e[e.Local = 0] = 'Local', e[e.Remote = 1] = 'Remote' - })(i = t.BranchType || (t.BranchType = {})); - var a; - (function (e) { - e.CurrentBranch = 'CurrentBranch', e.DefaultBranch = 'DefaultBranch', e.Head = 'Head', e.UpstreamDefaultBranch = 'UpstreamDefaultBranch' - })(a = t.StartPoint || (t.StartPoint = {})), t.eligibleForFastForward = o; - class s { - constructor(e, t, n, o) { - this.name = e, this.upstream = t, this.tip = n, this.type = o - } - get remote() { - const e = this.upstream; - if (!e) return null; - const t = e.match(/(.*?)\/.*/); - return !t || 2 > t.length ? null : t[1] - } - get upstreamWithoutRemote() { - return this.upstream ? r.removeRemotePrefix(this.upstream) : null - } - get nameWithoutRemote() { - if (this.type === i.Local) return this.name; - else { - const e = r.removeRemotePrefix(this.name); - return e || this.name +}, function (e, t, n) { + "use strict"; + const r = (0, n(16).fromCallback)(n(172)), + i = n(173); + e.exports = { + mkdirs: r, + mkdirsSync: i, + mkdirp: r, + mkdirpSync: i, + ensureDir: r, + ensureDirSync: i + } +}, function (e, t, n) { + "use strict"; + ! function e() { + if ("undefined" != typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) { + 0; + try { + __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e) + } catch (e) { + console.error(e) } } + }(), e.exports = n(149) +}, function (e, t, n) { + "use strict"; + t.__esModule = !0; + var r, i = n(54), + o = (r = i) && r.__esModule ? r : { + default: r + }; + t.default = o.default || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]) + } + return e } - t.Branch = s }, function (e, t) { - 'use strict'; - - function n(e, t) { - return e < t ? -1 : e > t ? 1 : 0 - } - - function o(e, t) { - return e < t ? 1 : e > t ? -1 : 0 - } - Object.defineProperty(t, '__esModule', { - value: !0 - }), t.compare = n, t.compareDescending = o, t.caseInsensitiveEquals = function (e, t) { - return e.toLowerCase() === t.toLowerCase() - }, t.caseInsensitiveCompare = function (e, t) { - return n(e.toLowerCase(), t.toLowerCase()) - }, t.caseInsensitiveCompareDescending = function (e, t) { - return o(e.toLowerCase(), t.toLowerCase()) - } -}, function (e) { - e.exports = require('child_process') + var n = e.exports = { + version: "2.5.1" + }; + "number" == typeof __e && (__e = n) }, function (e, t, n) { - (function () { - t.Emitter = n(778), t.Disposable = n(180), t.CompositeDisposable = n(777) - }).call(this) + "use strict"; + const r = n(16).fromPromise, + i = n(95); + e.exports = { + pathExists: r((function (e) { + return i.access(e).then(() => !0).catch(() => !1) + })), + pathExistsSync: i.existsSync + } +}, function (e, t) { + var n = e.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(); + "number" == typeof __g && (__g = n) }, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(5); - var i; - (function (e) { - e[e.Tabs = 0] = 'Tabs', e[e.Switch = 1] = 'Switch', e[e.Vertical = 2] = 'Vertical' - })(i = t.TabBarType || (t.TabBarType = {})); - class a extends o.Component { - constructor() { - super(...arguments), this.tabRefsByIndex = new Map, this.onSelectAdjacentTab = (e, t) => { - const n = o.Children.toArray(this.props.children); - if (0 !== n.length) { - const o = 'next' === e ? 1 : -1, - r = (t + o + n.length) % n.length, - i = this.tabRefsByIndex.get(r); - i && i.focus(), this.props.onTabClicked(r) - } - }, this.onTabClicked = (e) => { - this.props.onTabClicked(e) - }, this.onTabRef = (e, t) => { - t ? this.tabRefsByIndex.set(e, t) : this.tabRefsByIndex.delete(e) - } - } - render() { - const { - type: e - } = this.props; - return o.createElement('div', { - className: 'tab-bar ' + (e === i.Switch ? 'switch' : e === i.Vertical ? 'vertical' : 'tabs'), - role: 'tablist' - }, this.renderItems()) - } - renderItems() { - const e = o.Children.toArray(this.props.children); - return e.map((e, t) => { - const n = t === this.props.selectedIndex; - return o.createElement(s, { - key: t, - selected: n, - index: t, - onClick: this.onTabClicked, - onSelectAdjacent: this.onSelectAdjacentTab, - onButtonRef: this.onTabRef, - type: this.props.type - }, e) - }) - } + "use strict"; + t.__esModule = !0, t.default = function (e, t) { + if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } - t.TabBar = a; - class s extends o.Component { - constructor() { - super(...arguments), this.onClick = () => { - this.props.onClick(this.props.index) - }, this.onKeyDown = (e) => { - const { - type: t, - index: n - } = this.props, o = t === i.Vertical ? 'ArrowUp' : 'ArrowLeft', r = t === i.Vertical ? 'ArrowDown' : 'ArrowRight'; - e.key === o ? (this.props.onSelectAdjacent('previous', n), e.preventDefault()) : e.key === r && (this.props.onSelectAdjacent('next', n), e.preventDefault()) - }, this.onButtonRef = (e) => { - this.props.onButtonRef(this.props.index, e) +}, function (e, t, n) { + "use strict"; + t.__esModule = !0; + var r, i = n(243), + o = (r = i) && r.__esModule ? r : { + default: r + }; + t.default = function () { + function e(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), (0, o.default)(e, r.key, r) } } - render() { - const e = this.props.selected, - t = r('tab-bar-item', { - selected: e - }); - return o.createElement('button', { - ref: this.onButtonRef, - className: t, - onClick: this.onClick, - role: 'tab', - "aria-selected": e, - tabIndex: e ? void 0 : -1, - onKeyDown: this.onKeyDown, - type: 'button' - }, this.props.children) + return function (t, n, r) { + return n && e(t.prototype, n), r && e(t, r), t } - } + }() }, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(0), - r = n(4); - class i extends o.Component { - render() { - return o.createElement(r.Octicon, { - className: 'spin', - symbol: r.OcticonSymbol.sync - }) - } + var r = n(22), + i = n(20), + o = n(105), + s = n(29), + a = function (e, t, n) { + var l, c, u, h = e & a.F, + p = e & a.G, + d = e & a.S, + f = e & a.P, + m = e & a.B, + g = e & a.W, + y = p ? i : i[t] || (i[t] = {}), + v = y.prototype, + w = p ? r : d ? r[t] : (r[t] || {}).prototype; + for (l in p && (n = t), n)(c = !h && w && void 0 !== w[l]) && l in y || (u = c ? w[l] : n[l], y[l] = p && "function" != typeof w[l] ? n[l] : m && c ? o(u, r) : g && w[l] == u ? function (e) { + var t = function (t, n, r) { + if (this instanceof e) { + switch (arguments.length) { + case 0: + return new e; + case 1: + return new e(t); + case 2: + return new e(t, n) + } + return new e(t, n, r) + } + return e.apply(this, arguments) + }; + return t.prototype = e.prototype, t + }(u) : f && "function" == typeof u ? o(Function.call, u) : u, f && ((y.virtual || (y.virtual = {}))[l] = u, e & a.R && v && !v[l] && s(v, l, u))) + }; + a.F = 1, a.G = 2, a.S = 4, a.P = 8, a.B = 16, a.W = 32, a.U = 64, a.R = 128, e.exports = a +}, function (e, t, n) { + var r = n(37), + i = n(106), + o = n(64), + s = Object.defineProperty; + t.f = n(27) ? Object.defineProperty : function (e, t, n) { + if (r(e), t = o(t, !0), r(n), i) try { + return s(e, t, n) + } catch (e) {} + if ("get" in n || "set" in n) throw TypeError("Accessors not supported!"); + return "value" in n && (e[t] = n.value), e } - t.Loading = i }, function (e, t, n) { - 'use strict'; - async function o(e, t = process.env, n = a.resolveGitProxy) { - if (i.enableAutomaticGitProxyConfiguration()) { - if ('ALL_PROXY' in t || 'all_proxy' in t) return void log.info(`proxy url not resolved, ALL_PROXY already set`); - const o = /^(https?):\/\//i.exec(e); - if (null === o) return void log.info(`proxy url not resolved, protocol not supported`); - const r = o[1].toLowerCase(), - i = `${r}_proxy`; - if (i in t || 'https' === r && 'HTTPS_PROXY' in t) return void log.info(`proxy url not resolved, ${i} already set`); - const a = await n(e).catch((e) => { - log.error('Failed resolving Git proxy', e) - }); - return void 0 === a ? void 0 : { - [i]: a + e.exports = !n(30)((function () { + return 7 != Object.defineProperty({}, "a", { + get: function () { + return 7 } - } + }).a + })) +}, function (e, t) { + var n = {}.hasOwnProperty; + e.exports = function (e, t) { + return n.call(e, t) } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const r = n(100), - i = n(25), - a = n(704), - s = n(10); - t.getFallbackUrlForProxyResolve = function (e, t) { - return null === e ? null !== t.gitHubRepository && null !== t.gitHubRepository.cloneURL ? t.gitHubRepository.cloneURL : 'https://github.com' : e.endpoint === s.getDotComAPIEndpoint() ? 'https://github.com' : e.endpoint - }, t.envForRemoteOperation = async function (e, t) { - return Object.assign({}, r.envForAuthentication(e), (await o(t))) - }, t.envForProxy = o }, function (e, t, n) { - 'use strict'; - const o = n(39).fromPromise, - r = n(290); - e.exports = { - pathExists: o(function (e) { - return r.access(e).then(() => !0).catch(() => !1) - }), - pathExistsSync: r.existsSync + var r = n(26), + i = n(46); + e.exports = n(27) ? function (e, t, n) { + return r.f(e, t, i(1, n)) + } : function (e, t, n) { + return e[t] = n, e } }, function (e, t) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }), t.merge = function (e, t) { - const n = Object.assign({}, e); - for (const o in t) n[o] = t[o]; - return n + e.exports = function (e) { + try { + return !!e() + } catch (e) { + return !0 + } } }, function (e, t, n) { - 'use strict'; - - function o(e, t) { - const n = d.getHTMLURL(e.endpoint), - o = a.parse(n), - r = o.hostname, - i = l.parseRemote(t); - if (!i) return null; - const s = i.owner, - c = i.name; - return r && i.hostname.toLowerCase() === r.toLowerCase() && s && c ? { - name: c, - owner: s, - endpoint: e.endpoint - } : null + var r = n(109), + i = n(65); + e.exports = function (e) { + return r(i(e)) } +}, function (e, t, n) { + var r = n(68)("wks"), + i = n(47), + o = n(22).Symbol, + s = "function" == typeof o; + (e.exports = function (e) { + return r[e] || (r[e] = s && o[e] || (s ? o : i)("Symbol." + e)) + }).store = r +}, function (e, t, n) { + var r = n(43), + i = n(36), + o = n(223); - function r(e, t) { - if (null == e) return !1; - const n = l.parseRemote(e), - o = l.parseRemote(t.url); - return null != o && null != n && !!c.caseInsensitiveEquals(o.hostname, n.hostname) && null != o.owner && null != n.owner && null != o.name && null != n.name && c.caseInsensitiveEquals(o.owner, n.owner) && c.caseInsensitiveEquals(o.name, n.name) + function s(e, t) { + if (!e) throw new Error("expected readStream"); + if (!e.readable) throw new Error("readStream must be readable"); + var n = new a(t); + return e.pipe(n), n } - function i(e, t) { - const n = l.parseRepositoryIdentifier(e), - o = l.parseRepositoryIdentifier(t); - return null !== n && null !== o && n.hostname === o.hostname && n.owner === o.owner && n.name === o.name + function a(e) { + r.Transform.call(this, e), e = e || {}, this._readableState.objectMode = !0, this._lineBuffer = [], this._keepEmptyLines = e.keepEmptyLines || !1, this._lastChunkEndedWithCR = !1; + var t = this; + this.on("pipe", (function (e) { + t.encoding || e instanceof r.Readable && (t.encoding = e._readableState.encoding) + })) } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const a = n(42), - s = n(1), - d = n(10), - l = n(104), - c = n(47); - t.matchGitHubRepository = function (e, t) { - for (const n of e) { - const e = o(n, t); - if (e) return e - } - return null - }, t.matchExistingRepository = function (e, t) { - return e.find((e) => s.normalize(e.path).toLowerCase() === s.normalize(t).toLowerCase()) || null - }, t.repositoryMatchesRemote = function (e, t) { - return r(e.htmlURL, t) || r(e.cloneURL, t) - }, t.urlMatchesRemote = r, t.urlMatchesCloneURL = function (e, t) { - return null !== t.cloneURL && i(t.cloneURL, e) - }, t.urlsMatch = i -}, function (e, t) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }), t.getBoolean = function (e, t) { - const n = localStorage.getItem(e); - return null === n ? t : !('1' !== n && 'true' !== n) || '0' !== n && 'false' !== n && t - }, t.setBoolean = function (e, t) { - localStorage.setItem(e, t ? '1' : '0') - }, t.getNumber = function (e, t) { - const n = localStorage.getItem(e); - if (null === n || 0 === n.length) return t; - const o = parseInt(n, 10); - return isNaN(o) ? t : o - }, t.setNumber = function (e, t) { - localStorage.setItem(e, t.toString()) - }, t.getNumberArray = function (e) { - return (localStorage.getItem(e) || '').split(n).map(parseFloat).filter((e) => !isNaN(e)) - }, t.setNumberArray = function (e, t) { - localStorage.setItem(e, t.join(n)) - }, t.getStringArray = function (e) { - const t = localStorage.getItem(e) || '[]'; - try { - const e = JSON.parse(t); - return e instanceof Array ? e.some((e) => 'string' != typeof e) ? [] : e : [] - } catch (t) { - return [] + e.exports = function (t, n) { + return e.exports.createStream(t, n) + }, e.exports.createStream = function (e, t) { + return e ? s(e, t) : new a(t) + }, e.exports.createLineStream = function (e) { + return console.log("WARNING: byline#createLineStream is deprecated and will be removed soon"), s(e) + }, e.exports.LineStream = a, i.inherits(a, r.Transform), a.prototype._transform = function (e, t, n) { + t = t || "utf8", Buffer.isBuffer(e) && ("buffer" == t ? (e = e.toString(), t = "utf8") : e = e.toString(t)), this._chunkEncoding = t; + var r = e.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g); + this._lastChunkEndedWithCR && "\n" == e[0] && r.shift(), this._lineBuffer.length > 0 && (this._lineBuffer[this._lineBuffer.length - 1] += r[0], r.shift()), this._lastChunkEndedWithCR = "\r" == e[e.length - 1], this._lineBuffer = this._lineBuffer.concat(r), this._pushBuffer(t, 1, n) + }, a.prototype._pushBuffer = function (e, t, n) { + for (; this._lineBuffer.length > t;) { + var r = this._lineBuffer.shift(); + if ((this._keepEmptyLines || r.length > 0) && !this.push(this._reencode(r, e))) { + var i = this; + return void o.setImmediate((function () { + i._pushBuffer(e, t, n) + })) + } } - }, t.setStringArray = function (e, t) { - const n = JSON.stringify(t); - localStorage.setItem(e, n) + n() + }, a.prototype._flush = function (e) { + this._pushBuffer(this._chunkEncoding, 0, e) + }, a.prototype._reencode = function (e, t) { + return this.encoding && this.encoding != t ? new Buffer(e, t).toString(this.encoding) : this.encoding ? e : new Buffer(e, t) + } +}, , function (e, t) { + t.getArg = function (e, t, n) { + if (t in e) return e[t]; + if (3 === arguments.length) return n; + throw new Error('"' + t + '" is a required argument.') }; - const n = ',' -}, function (e, t, n) { - var o = Math.round, - r = Math.abs, - i = Math.floor, - a = Math.ceil, - s = Math.min; - (function (e) { - var t; //! moment.js - (function (t, n) { - e.exports = n() - })(this, function () { - 'use strict'; - - function t() { - return Ot.apply(null, arguments) - } - - function n(e) { - return e instanceof Array || '[object Array]' === Object.prototype.toString.call(e) - } + var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/, + r = /^data:.+\,.+$/; - function d(e) { - return null != e && '[object Object]' === Object.prototype.toString.call(e) - } - - function l(e) { - if (Object.getOwnPropertyNames) return 0 === Object.getOwnPropertyNames(e).length; - for (var t in e) - if (e.hasOwnProperty(t)) return !1; - return !0 - } - - function p(e) { - return void 0 === e - } - - function c(e) { - return 'number' == typeof e || '[object Number]' === Object.prototype.toString.call(e) - } - - function u(e) { - return e instanceof Date || '[object Date]' === Object.prototype.toString.call(e) - } + function i(e) { + var t = e.match(n); + return t ? { + scheme: t[1], + auth: t[2], + host: t[3], + port: t[4], + path: t[5] + } : null + } - function m(e, t) { - var n = [], - o; - for (o = 0; o < e.length; ++o) n.push(t(e[o], o)); - return n - } + function o(e) { + var t = ""; + return e.scheme && (t += e.scheme + ":"), t += "//", e.auth && (t += e.auth + "@"), e.host && (t += e.host), e.port && (t += ":" + e.port), e.path && (t += e.path), t + } - function h(e, t) { - return Object.prototype.hasOwnProperty.call(e, t) - } + function s(e) { + var n = e, + r = i(e); + if (r) { + if (!r.path) return e; + n = r.path + } + for (var s, a = t.isAbsolute(n), l = n.split(/\/+/), c = 0, u = l.length - 1; u >= 0; u--) "." === (s = l[u]) ? l.splice(u, 1) : ".." === s ? c++ : c > 0 && ("" === s ? (l.splice(u + 1, c), c = 0) : (l.splice(u, 2), c--)); + return "" === (n = l.join("/")) && (n = a ? "/" : "."), r ? (r.path = n, o(r)) : n + } + t.urlParse = i, t.urlGenerate = o, t.normalize = s, t.join = function (e, t) { + "" === e && (e = "."), "" === t && (t = "."); + var n = i(t), + a = i(e); + if (a && (e = a.path || "/"), n && !n.scheme) return a && (n.scheme = a.scheme), o(n); + if (n || t.match(r)) return t; + if (a && !a.host && !a.path) return a.host = t, o(a); + var l = "/" === t.charAt(0) ? t : s(e.replace(/\/+$/, "") + "/" + t); + return a ? (a.path = l, o(a)) : l + }, t.isAbsolute = function (e) { + return "/" === e.charAt(0) || !!e.match(n) + }, t.relative = function (e, t) { + "" === e && (e = "."), e = e.replace(/\/$/, ""); + for (var n = 0; 0 !== t.indexOf(e + "/");) { + var r = e.lastIndexOf("/"); + if (r < 0) return t; + if ((e = e.slice(0, r)).match(/^([^\/]+:\/)?\/*$/)) return t; + ++n + } + return Array(n + 1).join("../") + t.substr(e.length + 1) + }; + var a = !("__proto__" in Object.create(null)); - function f(e, t) { - for (var n in t) h(t, n) && (e[n] = t[n]); - return h(t, 'toString') && (e.toString = t.toString), h(t, 'valueOf') && (e.valueOf = t.valueOf), e - } + function l(e) { + return e + } - function g(e, t, n, o) { - return Xe(e, t, n, o, !0).utc() - } + function c(e) { + if (!e) return !1; + var t = e.length; + if (t < 9) return !1; + if (95 !== e.charCodeAt(t - 1) || 95 !== e.charCodeAt(t - 2) || 111 !== e.charCodeAt(t - 3) || 116 !== e.charCodeAt(t - 4) || 111 !== e.charCodeAt(t - 5) || 114 !== e.charCodeAt(t - 6) || 112 !== e.charCodeAt(t - 7) || 95 !== e.charCodeAt(t - 8) || 95 !== e.charCodeAt(t - 9)) return !1; + for (var n = t - 10; n >= 0; n--) + if (36 !== e.charCodeAt(n)) return !1; + return !0 + } - function y() { - return { - empty: !1, - unusedTokens: [], - unusedInput: [], - overflow: -2, - charsLeftOver: 0, - nullInput: !1, - invalidMonth: null, - invalidFormat: !1, - userInvalidated: !1, - iso: !1, - parsedDateParts: [], - meridiem: null, - rfc2822: !1, - weekdayMismatch: !1 - } - } + function u(e, t) { + return e === t ? 0 : e > t ? 1 : -1 + } + t.toSetString = a ? l : function (e) { + return c(e) ? "$" + e : e + }, t.fromSetString = a ? l : function (e) { + return c(e) ? e.slice(1) : e + }, t.compareByOriginalPositions = function (e, t, n) { + var r = e.source - t.source; + return 0 !== r || 0 !== (r = e.originalLine - t.originalLine) || 0 !== (r = e.originalColumn - t.originalColumn) || n || 0 !== (r = e.generatedColumn - t.generatedColumn) || 0 !== (r = e.generatedLine - t.generatedLine) ? r : e.name - t.name + }, t.compareByGeneratedPositionsDeflated = function (e, t, n) { + var r = e.generatedLine - t.generatedLine; + return 0 !== r || 0 !== (r = e.generatedColumn - t.generatedColumn) || n || 0 !== (r = e.source - t.source) || 0 !== (r = e.originalLine - t.originalLine) || 0 !== (r = e.originalColumn - t.originalColumn) ? r : e.name - t.name + }, t.compareByGeneratedPositionsInflated = function (e, t) { + var n = e.generatedLine - t.generatedLine; + return 0 !== n || 0 !== (n = e.generatedColumn - t.generatedColumn) || 0 !== (n = u(e.source, t.source)) || 0 !== (n = e.originalLine - t.originalLine) || 0 !== (n = e.originalColumn - t.originalColumn) ? n : u(e.name, t.name) + } +}, function (e, t) { + e.exports = require("util") +}, function (e, t, n) { + var r = n(38); + e.exports = function (e) { + if (!r(e)) throw TypeError(e + " is not an object!"); + return e + } +}, function (e, t) { + e.exports = function (e) { + return "object" == typeof e ? null !== e : "function" == typeof e + } +}, function (e, t, n) { + var r = n(108), + i = n(69); + e.exports = Object.keys || function (e) { + return r(e, i) + } +}, function (e, t, n) { + "use strict"; + n.r(t), n.d(t, "start", (function () { + return o + })), n.d(t, "stop", (function () { + return s + })), n.d(t, "measure", (function () { + return a + })); + let r = !1, + i = 0; - function S(e) { - return null == e._pf && (e._pf = y()), e._pf - } + function o() { + r = !0 + } - function C(e) { - if (null == e._isValid) { - var t = S(e), - n = Ht.call(t.parsedDateParts, function (e) { - return null != e - }), - o = !isNaN(e._d.getTime()) && 0 > t.overflow && !t.empty && !t.invalidMonth && !t.invalidWeekday && !t.weekdayMismatch && !t.nullInput && !t.invalidFormat && !t.userInvalidated && (!t.meridiem || t.meridiem && n); - if (e._strict && (o = o && 0 === t.charsLeftOver && 0 === t.unusedTokens.length && void 0 === t.bigHour), null == Object.isFrozen || !Object.isFrozen(e)) e._isValid = o; - else return o + function s() { + r = !1 + } + async function a(e, t) { + const n = ++i, + o = performance && performance.now ? performance.now() : null; + ! function (e, t) { + if (!r) return; + const n = `${e}::${t}`; + performance.mark(n) + }(n, e); + try { + return await t() + } finally { + if (o) { + const t = performance.now() - o; + if (t > 1e3) { + const n = (t / 1e3).toFixed(3); + log.info(`Executing ${e} (took ${n}s)`) } - return e._isValid + }! function (e, t) { + if (!r) return; + const n = `${e}::${t}`, + i = t; + performance.measure(i, n), performance.clearMarks(n), performance.clearMeasures(i) + }(n, e) + } + } +}, function (e, t, n) { + "use strict"; + t.__esModule = !0; + var r, i = n(113), + o = (r = i) && r.__esModule ? r : { + default: r + }; + t.default = function (e, t) { + if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return !t || "object" !== (void 0 === t ? "undefined" : (0, o.default)(t)) && "function" != typeof t ? e : t + } +}, function (e, t) { + e.exports = function (e) { + return e.webpackPolyfill || (e.deprecate = function () {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", { + enumerable: !0, + get: function () { + return e.l } - - function b(e) { - var t = g(NaN); - return null == e ? S(t).userInvalidated = !0 : f(S(t), e), t + }), Object.defineProperty(e, "id", { + enumerable: !0, + get: function () { + return e.i } - - function v(e, t) { - var n, o, r; - if (p(t._isAMomentObject) || (e._isAMomentObject = t._isAMomentObject), p(t._i) || (e._i = t._i), p(t._f) || (e._f = t._f), p(t._l) || (e._l = t._l), p(t._strict) || (e._strict = t._strict), p(t._tzm) || (e._tzm = t._tzm), p(t._isUTC) || (e._isUTC = t._isUTC), p(t._offset) || (e._offset = t._offset), p(t._pf) || (e._pf = S(t)), p(t._locale) || (e._locale = t._locale), 0 < zt.length) - for (n = 0; n < zt.length; n++) o = zt[n], r = t[o], p(r) || (e[o] = r); - return e + }), e.webpackPolyfill = 1), e + } +}, function (e, t) { + e.exports = require("stream") +}, function (e, t) { + e.exports = require("assert") +}, function (e, t, n) { + "use strict"; + const r = n(16).fromCallback, + i = n(176); + e.exports = { + remove: r(i), + removeSync: i.sync + } +}, function (e, t) { + e.exports = function (e, t) { + return { + enumerable: !(1 & e), + configurable: !(2 & e), + writable: !(4 & e), + value: t + } + } +}, function (e, t) { + var n = 0, + r = Math.random(); + e.exports = function (e) { + return "Symbol(".concat(void 0 === e ? "" : e, ")_", (++n + r).toString(36)) + } +}, function (e, t) { + t.f = {}.propertyIsEnumerable +}, function (e, t, n) { + var r = n(65); + e.exports = function (e) { + return Object(r(e)) + } +}, function (e, t) { + e.exports = function (e) { + return e && e.__esModule ? e : { + default: e + } + } +}, function (e, t) { + (function () { + var e, n, r, i, o, s, a, l, c, u, h, p, d, f, m, g; + t.score = function (e, t, r) { + var i, s, a; + return i = r.preparedQuery, r.allowErrors || o(e, i.core_lw, i.core_up) ? (a = e.toLowerCase(), s = n(e, a, i), Math.ceil(s)) : 0 + }, t.isMatch = o = function (e, t, n) { + var r, i, o, s, a, l, c; + if (o = e.length, s = t.length, !o || s > o) return !1; + for (r = -1, i = -1; ++i < s;) { + for (a = t.charCodeAt(i), l = n.charCodeAt(i); ++r < o && (c = e.charCodeAt(r)) !== a && c !== l;); + if (r === o) return !1 } + return !0 + }, t.computeScore = n = function (e, t, n) { + var r, i, o, s, a, f, m, y, v, w, b, S, C, E, k, x, T, R, D, _, A, M, P, I; + if (k = n.query, x = n.query_lw, w = e.length, C = k.length, i = (r = c(e, t, k, x)).score, r.count === C) return p(C, w, i, r.pos); + if ((E = t.indexOf(x)) > -1) return d(e, t, k, x, E, C, w); + for (_ = new Array(C), a = new Array(C), I = g(C, w), S = b = Math.ceil(.75 * C) + 5, m = !0, v = -1; ++v < C;) _[v] = 0, a[v] = 0; + for (y = -1; ++y < w;) + if (!(M = t[y]).charCodeAt(0) in n.charCodes) { + if (m) { + for (v = -1; ++v < C;) a[v] = 0; + m = !1 + } + } else + for (R = 0, D = 0, s = 0, T = !0, m = !0, v = -1; ++v < C;) { + if ((A = _[v]) > R && (R = A), f = 0, x[v] === M) + if (P = l(y, e, t), f = s > 0 ? s : h(e, t, k, x, y, v, P), (o = D + u(y, v, P, i, f)) > R) R = o, S = b; + else { + if (T && --S <= 0) return Math.max(R, _[C - 1]) * I; + T = !1 + } D = A, s = a[v], a[v] = f, _[v] = R + } + return (R = _[C - 1]) * I + }, t.isWordStart = l = function (e, t, n) { + var r, i; + return 0 === e || (r = t[e], i = t[e - 1], s(i) || r !== n[e] && i === n[e - 1]) + }, t.isWordEnd = a = function (e, t, n, r) { + var i, o; + return e === r - 1 || (i = t[e], o = t[e + 1], s(o) || i === n[e] && o !== n[e + 1]) + }, s = function (e) { + return " " === e || "." === e || "-" === e || "_" === e || "/" === e || "\\" === e + }, m = function (e) { + var t; + return e < 20 ? 100 + (t = 20 - e) * t : Math.max(120 - e, 0) + }, t.scoreSize = g = function (e, t) { + return 150 / (150 + Math.abs(t - e)) + }, p = function (e, t, n, r) { + return 2 * e * (150 * n + m(r)) * g(e, t) + }, t.scorePattern = f = function (e, t, n, r, i) { + var o, s; + return s = e, o = 6, n === e && (o += 2), r && (o += 3), i && (o += 1), e === t && (r && (s += n === t ? 2 : 1), i && (o += 1)), n + s * (s + o) + }, t.scoreCharacter = u = function (e, t, n, r, i) { + var o; + return o = m(e), n ? o + 150 * ((r > i ? r : i) + 10) : o + 150 * i + }, t.scoreConsecutives = h = function (e, t, n, r, i, o, s) { + var l, c, u, h, p, d, m; + for (l = (u = (c = e.length) - i) < (p = (h = n.length) - o) ? u : p, d = 0, m = 0, n[o] === e[i] && d++; ++m < l && r[++o] === t[++i];) n[o] === e[i] && d++; + return m < l && i--, 1 === m ? 1 + 2 * d : f(m, h, d, s, a(i, e, t, c)) + }, t.scoreExactMatch = d = function (e, t, n, r, i, o, s) { + var c, u, h, d, m; + for ((m = l(i, e, t)) || (h = t.indexOf(r, i + 1)) > -1 && (m = l(h, e, t)) && (i = h), u = -1, d = 0; ++u < o;) n[i + u] === e[u] && d++; + return c = a(i + o - 1, e, t, s), p(o, s, f(o, o, d, m, c), i) + }, r = new(e = function (e, t, n) { + this.score = e, this.pos = t, this.count = n + })(0, .1, 0), t.scoreAcronyms = c = function (t, n, o, a) { + var c, u, h, p, d, m, g, y, v, w, b; + if (d = t.length, m = o.length, !(d > 1 && m > 1)) return r; + for (c = 0, w = 0, b = 0, y = 0, h = -1, p = -1; ++p < m;) { + if (g = a[p], s(g)) { + if ((h = n.indexOf(g, h + 1)) > -1) { + w++; + continue + } + break + } + for (; ++h < d;) + if (g === n[h] && l(h, t, n)) { + o[p] === t[h] && y++, b += h, c++; + break + } if (h === d) break + } + return c < 2 ? r : (u = c === m && i(t, n, o, c), v = f(c, m, y, !0, u), new e(v, b / c, c + w)) + }, i = function (e, t, n, r) { + var i, o, s; + if (i = 0, (s = e.length) > 12 * n.length) return !1; + for (o = -1; ++o < s;) + if (l(o, e, t) && ++i > r) return !1; + return !0 + } + }).call(this) +}, function (e, t) { + e.exports = require("crypto") +}, function (e, t, n) { + "use strict"; + n(193); + const r = async e => { + throw new Error("macOS only") + }; + e.exports = r, e.exports.default = r, e.exports.sync = e => { + throw new Error("macOS only") + } +}, function (e, t, n) { + e.exports = { + default: n(234), + __esModule: !0 + } +}, function (e, t, n) { + e.exports = { + default: n(241), + __esModule: !0 + } +}, function (e, t, n) { + "use strict"; + t.__esModule = !0; + var r = s(n(267)), + i = s(n(271)), + o = s(n(113)); - function E(e) { - v(this, e), this._d = new Date(null == e._d ? NaN : e._d.getTime()), this.isValid() || (this._d = new Date(NaN)), !1 === Ut && (Ut = !0, t.updateOffset(this), Ut = !1) + function s(e) { + return e && e.__esModule ? e : { + default: e + } + } + t.default = function (e, t) { + if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : (0, o.default)(t))); + e.prototype = (0, i.default)(t && t.prototype, { + constructor: { + value: e, + enumerable: !1, + writable: !0, + configurable: !0 } + }), t && (r.default ? (0, r.default)(e, t) : e.__proto__ = t) + } +}, function (e, t, n) { + var r = n(222); - function w(e) { - return e instanceof E || null != e && null != e._isAMomentObject - } + function i(e, t) { + if (!e || e.length <= 0) throw new Error(t + " is required.") + } + e.exports = { + getPassword: function (e, t) { + return i(e, "Service"), i(t, "Account"), r.getPassword(e, t) + }, + setPassword: function (e, t, n) { + return i(e, "Service"), i(t, "Account"), i(n, "Password"), r.setPassword(e, t, n) + }, + deletePassword: function (e, t) { + return i(e, "Service"), i(t, "Account"), r.deletePassword(e, t) + }, + findPassword: function (e) { + return i(e, "Service"), r.findPassword(e) + }, + findCredentials: function (e) { + return i(e, "Service"), r.findCredentials(e) + } + } +}, function (e, t, n) { + const r = n(7), + { + spawn: i, + spawnSync: o + } = n(8), + s = (n(62), n(297)), + a = e.exports; - function k(e) { - return 0 > e ? a(e) || 0 : i(e) - } + function l(e, t) { + return n => t(0 === n ? null : new Error(e + " failed with exit status " + n)) + } + a.testMode = !1, Object.assign(a, { + symlink(e, t, n) { + s.spawnAsAdmin("cmd", ["/c", "mklink", "/j", t, e], a.testMode, l("mklink", n)) + }, + unlink(e, t) { + r.stat(e, (n, r) => { + if (n) return t(n); + r.isDirectory() ? s.spawnAsAdmin("cmd", ["/c", "rmdir", "/s", "/q", e], a.testMode, l("rmdir", t)) : s.spawnAsAdmin("cmd", ["/c", "del", "/f", "/q", e], a.testMode, l("del", t)) + }) + }, + makeTree(e, t) { + s.spawnAsAdmin("cmd", ["/c", "mkdir", e], a.testMode, l("mkdir", t)) + }, + recursiveCopy(e, t, n) { + s.spawnAsAdmin("cmd", ["/c", 298, e, t], a.testMode, l("robocopy", n)) + } + }) +}, function (e, t, n) { + "use strict"; + /* + object-assign + (c) Sindre Sorhus + @license MIT + */ + var r = Object.getOwnPropertySymbols, + i = Object.prototype.hasOwnProperty, + o = Object.prototype.propertyIsEnumerable; - function T(e) { - var t = +e, - n = 0; - return 0 != t && isFinite(t) && (n = k(t)), n + function s(e) { + if (null == e) throw new TypeError("Object.assign cannot be called with null or undefined"); + return Object(e) + } + e.exports = function () { + try { + if (!Object.assign) return !1; + var e = new String("abc"); + if (e[5] = "de", "5" === Object.getOwnPropertyNames(e)[0]) return !1; + for (var t = {}, n = 0; n < 10; n++) t["_" + String.fromCharCode(n)] = n; + if ("0123456789" !== Object.getOwnPropertyNames(t).map((function (e) { + return t[e] + })).join("")) return !1; + var r = {}; + return "abcdefghijklmnopqrst".split("").forEach((function (e) { + r[e] = e + })), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, r)).join("") + } catch (e) { + return !1 + } + }() ? Object.assign : function (e, t) { + for (var n, a, l = s(e), c = 1; c < arguments.length; c++) { + for (var u in n = Object(arguments[c])) i.call(n, u) && (l[u] = n[u]); + if (r) { + a = r(n); + for (var h = 0; h < a.length; h++) o.call(n, a[h]) && (l[a[h]] = n[a[h]]) } - - function _(e, t, n) { - var o = s(e.length, t.length), - a = r(e.length - t.length), - d = 0, - l; - for (l = 0; l < o; l++)(n && e[l] !== t[l] || !n && T(e[l]) !== T(t[l])) && d++; - return d + a + } + return l + } +}, function (e, t) { + (function () { + e.exports = function () { + function e(e) { + this.disposalAction = e } - - function R(e) { - !1 === t.suppressDeprecationWarnings && 'undefined' != typeof console && console.warn && console.warn('Deprecation warning: ' + e) + return e.prototype.disposed = !1, e.isDisposable = function (e) { + return "function" == typeof (null != e ? e.dispose : void 0) + }, e.prototype.dispose = function () { + this.disposed || (this.disposed = !0, "function" == typeof this.disposalAction && this.disposalAction(), this.disposalAction = null) + }, e + }() + }).call(this) +}, function (e, t, n) { + "use strict"; + const r = n(16).fromCallback, + i = n(184); + e.exports = { + readJson: r(i.readFile), + readJsonSync: i.readFileSync, + writeJson: r(i.writeFile), + writeJsonSync: i.writeFileSync + } +}, function (e, t) { + e.exports = require("events") +}, function (e, t, n) { + e.exports = n(232)() +}, function (e, t, n) { + var r = n(38); + e.exports = function (e, t) { + if (!r(e)) return e; + var n, i; + if (t && "function" == typeof (n = e.toString) && !r(i = n.call(e))) return i; + if ("function" == typeof (n = e.valueOf) && !r(i = n.call(e))) return i; + if (!t && "function" == typeof (n = e.toString) && !r(i = n.call(e))) return i; + throw TypeError("Can't convert object to primitive value") + } +}, function (e, t) { + e.exports = function (e) { + if (null == e) throw TypeError("Can't call method on " + e); + return e + } +}, function (e, t) { + var n = Math.ceil, + r = Math.floor; + e.exports = function (e) { + return isNaN(e = +e) ? 0 : (e > 0 ? r : n)(e) + } +}, function (e, t, n) { + var r = n(68)("keys"), + i = n(47); + e.exports = function (e) { + return r[e] || (r[e] = i(e)) + } +}, function (e, t, n) { + var r = n(22), + i = r["__core-js_shared__"] || (r["__core-js_shared__"] = {}); + e.exports = function (e) { + return i[e] || (i[e] = {}) + } +}, function (e, t) { + e.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",") +}, function (e, t) { + t.f = Object.getOwnPropertySymbols +}, function (e, t) { + e.exports = !0 +}, function (e, t) { + e.exports = {} +}, function (e, t, n) { + var r = n(37), + i = n(251), + o = n(69), + s = n(67)("IE_PROTO"), + a = function () {}, + l = function () { + var e, t = n(107)("iframe"), + r = o.length; + for (t.style.display = "none", n(252).appendChild(t), t.src = "javascript:", (e = t.contentWindow.document).open(), e.write("', f = a.removeChild(a.firstChild)) : 'string' == typeof m.is ? f = f.createElement(a, { - is: m.is - }) : (f = f.createElement(a), 'select' === a && m.multiple && (f.multiple = !0)) : f = f.createElementNS(h, a), a = f, a[Ci] = y, a[bi] = d, dd(a, o, !1, !1), m = a, f = e, y = d; - var p = c, - t = qe(f, y); - switch (f) { - case 'iframe': - case 'object': - sn('load', m), c = y; - break; - case 'video': - case 'audio': - for (c = 0; c < Li.length; c++) sn(Li[c], m); - c = y; - break; - case 'source': - sn('error', m), c = y; - break; - case 'img': - case 'image': - case 'link': - sn('error', m), sn('load', m), c = y; - break; - case 'form': - sn('reset', m), sn('submit', m), c = y; - break; - case 'details': - sn('toggle', m), c = y; - break; - case 'input': - Lt(m, y), c = It(m, y), sn('invalid', m), re(p, 'onChange'); - break; - case 'option': - c = vn(m, y); - break; - case 'select': - m._wrapperState = { - wasMultiple: !!y.multiple - }, c = Kr({}, y, { - value: void 0 - }), sn('invalid', m), re(p, 'onChange'); - break; - case 'textarea': - be(m, y), c = ae(m, y), sn('invalid', m), re(p, 'onChange'); - break; - default: - c = y; - } - oe(f, c), h = void 0; - var S = f, - C = m, - b = c; - for (h in b) - if (b.hasOwnProperty(h)) { - var u = b[h]; - 'style' === h ? ne(C, u) : 'dangerouslySetInnerHTML' === h ? (u = u ? u.__html : void 0, null != u && ie(C, u)) : 'children' === h ? 'string' == typeof u ? ('textarea' !== S || '' !== u) && he(C, u) : 'number' == typeof u && he(C, '' + u) : 'suppressContentEditableWarning' !== h && 'suppressHydrationWarning' !== h && 'autoFocus' !== h && (ei.hasOwnProperty(h) ? null != u && re(p, h) : null != u && Mt(C, h, u, t)) - } - 'input' === f ? (Et(m), Nt(m, y, !1)) : 'textarea' === f ? (Et(m), de(m, y)) : 'option' === f ? null != y.value && m.setAttribute('value', '' + At(y.value)) : 'select' === f ? (c = m, c.multiple = !!y.multiple, m = y.value, null == m ? null != y.defaultValue && En(c, !!y.multiple, y.defaultValue, !0) : En(c, !!y.multiple, m, !1)) : 'function' == typeof c.onClick && (m.onclick = se), (d = te(e, d)) && No(o), o.stateNode = a - } - null !== o.ref && (o.effectTag |= 128) - } else null === o.stateNode ? s('166') : void 0; - break; - case 6: - a && null != o.stateNode ? pd(a, o, a.memoizedProps, d) : ('string' != typeof d && (null === o.stateNode ? s('166') : void 0), a = On(Ts.current), On(ks.current), so(o) ? (d = o, e = d.stateNode, a = d.memoizedProps, e[Ci] = d, (d = e.nodeValue !== a) && No(o)) : (e = o, d = (9 === a.nodeType ? a : a.ownerDocument).createTextNode(d), d[Ci] = o, e.stateNode = d)); - break; - case 11: - break; - case 13: - if (d = o.memoizedState, 0 != (64 & o.effectTag)) { - o.expirationTime = e, bd = o; - break a - } - d = null !== d, e = null !== a && null !== a.memoizedState, null !== a && !d && e && (a = a.child.sibling, null !== a && (c = o.firstEffect, null === c ? (o.firstEffect = o.lastEffect = a, a.nextEffect = null) : (o.firstEffect = a, a.nextEffect = c), a.effectTag = 8)), (d || e) && (o.effectTag |= 4); - break; - case 7: - break; - case 8: - break; - case 12: - break; - case 4: - zn(o), ld(o); - break; - case 10: - Eo(o); - break; - case 9: - break; - case 14: - break; - case 17: - Je(o.type) && J(o); - break; - case 18: - break; - default: - s('156'); - } - bd = null - } - if (o = n, 1 === vd || 1 !== o.childExpirationTime) { - for (d = 0, e = o.child; null !== e;) a = e.expirationTime, c = e.childExpirationTime, a > d && (d = a), c > d && (d = c), e = e.sibling; - o.childExpirationTime = d - } - if (null !== bd) return bd; - null !== r && 0 == (1024 & r.effectTag) && (null === r.firstEffect && (r.firstEffect = n.firstEffect), null !== n.lastEffect && (null !== r.lastEffect && (r.lastEffect.nextEffect = n.firstEffect), r.lastEffect = n.lastEffect), 1 < n.effectTag && (null === r.lastEffect ? r.firstEffect = n : r.lastEffect.nextEffect = n, r.lastEffect = n)) - } else { - if (n = Xo(n, vd), null !== n) return n.effectTag &= 1023, n; - null !== r && (r.firstEffect = r.lastEffect = null, r.effectTag |= 1024) - } - if (null !== i) return i; - if (null !== r) n = r; - else break + setCommitMessage(e, t) { + return this.appStore._setCommitMessage(e, t) + } + removeAccount(e) { + return this.appStore._removeAccount(e) + } + setAppMenuState(e) { + return this.appStore._setAppMenuState(e) + } + executeMenuItem(e) { + return function (e) { + r.ipcRenderer.send("execute-menu-item", { + id: e.id + }) + }(e), Promise.resolve() + } + setAccessKeyHighlightState(e) { + return this.appStore._setAccessKeyHighlightState(e) } - return null - } - - function rr(e) { - var t = bo(e.alternate, e, vd); - return e.memoizedProps = e.pendingProps, null === t && (t = or(e)), gd.current = null, t - } - - function ir(n, o) { - Cd ? s('243') : void 0, tr(), Cd = !0; - var r = fd.current; - fd.current = Ks; - var i = n.nextExpirationTimeToWorkOn; - (i !== vd || n !== T || null === bd) && (Qo(), T = n, vd = i, bd = We(T.current, null, vd), n.pendingCommitExpirationTime = 0); - var a = !1; - do { - try { - if (o) - for (; null !== bd && !vr();) bd = rr(bd); - else - for (; null !== bd;) bd = rr(bd) - } catch (o) { - if (nd = td = ed = null, jn(), null === bd) a = !0, Rr(o); - else { - null === bd ? s('271') : void 0; - var e = bd, - d = e.return; - if (null === d) a = !0, Rr(o); - else { - a: { - var c = n, - h = d, - l = e, - f = o; - if (d = vd, l.effectTag |= 1024, l.firstEffect = l.lastEffect = null, null !== f && 'object' == typeof f && 'function' == typeof f.then) { - var u = f; - f = h; - var p = -1, - t = -1; - do { - if (13 === f.tag) { - var g = f.alternate; - if (null !== g && (g = g.memoizedState, null !== g)) { - t = 10 * (1073741822 - g.timedOutAt); - break - } - g = f.pendingProps.maxDuration, 'number' == typeof g && (0 >= g ? p = 0 : (-1 === p || g < p) && (p = g)) - } - f = f.return - } while (null !== f); - f = h; - do { - if ((g = 13 === f.tag) && (g = void 0 !== f.memoizedProps.fallback && null === f.memoizedState), g) { - if (h = f.updateQueue, null === h ? (h = new Set, h.add(u), f.updateQueue = h) : h.add(u), 0 == (1 & f.mode)) { - f.effectTag |= 64, l.effectTag &= -1957, 1 === l.tag && (null === l.alternate ? l.tag = 17 : (d = Ro(1073741823), d.tag = id, Po(l, d))), l.expirationTime = 1073741823; - break a - } - l = c, h = d; - var y = l.pingCache; - null === y ? (y = l.pingCache = new hd, g = new Set, y.set(u, g)) : (g = y.get(u), void 0 === g && (g = new Set, y.set(u, g))), g.has(h) || (g.add(h), l = dr.bind(null, l, u, h), u.then(l, l)), -1 === p ? c = 1073741823 : (-1 === t && (t = 10 * (1073741822 - Rn(c, d)) - 5E3), c = t + p), 0 <= c && U < c && (U = c), f.effectTag |= 2048, f.expirationTime = d; - break a - } - f = f.return - } while (null !== f); - f = Error((Tt(l.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display.' + _t(l)) - } - Ed = !0, - f = Bo(f, l), - c = h;do { - switch (c.tag) { - case 3: - c.effectTag |= 2048, c.expirationTime = d, d = qo(c, f, d), Do(c, d); - break a; - case 1: - if (p = f, t = c.type, l = c.stateNode, 0 == (64 & c.effectTag) && ('function' == typeof t.getDerivedStateFromError || null !== l && 'function' == typeof l.componentDidCatch && (null === Rd || !Rd.has(l)))) { - c.effectTag |= 2048, c.expirationTime = d, d = Yo(c, p, d), Do(c, d); - break a - } - } - c = c.return - } while (null !== c) - } - bd = or(e); - continue - } - } - } - break - } while (1); - if (Cd = !1, fd.current = r, nd = td = ed = null, jn(), a) T = null, n.finishedWork = null; - else if (null !== bd) n.finishedWork = null; - else { - if (r = n.current.alternate, null === r ? s('281') : void 0, T = null, Ed) { - if (a = n.latestPendingTime, e = n.latestSuspendedTime, d = n.latestPingedTime, 0 !== a && a < i || 0 !== e && e < i || 0 !== d && d < i) return _n(n, i), void fr(n, r, i, n.expirationTime, -1); - if (!n.didError && o) return n.didError = !0, i = n.nextExpirationTimeToWorkOn = i, o = n.expirationTime = 1073741823, void fr(n, r, i, o, -1) - } - o && -1 !== U ? (_n(n, i), o = 10 * (1073741822 - Rn(n, i)), o < U && (U = o), o = 10 * (1073741822 - Sr()), o = U - o, fr(n, r, i, n.expirationTime, 0 > o ? 0 : o)) : (n.pendingCommitExpirationTime = i, n.finishedWork = r) + mergeBranch(e, t, n) { + return this.appStore._mergeBranch(e, t, n) } - } - - function ar(e, t) { - for (var n = e.return; null !== n;) { - switch (n.tag) { - case 1: - var o = n.stateNode; - if ('function' == typeof n.type.getDerivedStateFromError || 'function' == typeof o.componentDidCatch && (null === Rd || !Rd.has(o))) return e = Bo(t, e), e = Yo(n, e, 1073741823), Po(n, e), void pr(n, 1073741823); - break; - case 3: - return e = Bo(t, e), e = qo(n, e, 1073741823), Po(n, e), void pr(n, 1073741823); - } - n = n.return + setConflictsResolved(e) { + return this.appStore._setConflictsResolved(e) } - 3 === e.tag && (n = Bo(t, e), n = qo(e, n, 1073741823), Po(e, n), pr(e, 1073741823)) - } - - function sr(e, t) { - var o = n.unstable_getCurrentPriorityLevel(), - r; - return 0 == (1 & t.mode) ? r = 1073741823 : Cd && !V ? r = vd : (o === n.unstable_ImmediatePriority ? r = 1073741823 : o === n.unstable_UserBlockingPriority ? r = 1073741822 - 10 * ((0 | (1073741822 - e + 15) / 10) + 1) : o === n.unstable_NormalPriority ? r = 1073741822 - 25 * ((0 | (1073741822 - e + 500) / 25) + 1) : o === n.unstable_LowPriority || o === n.unstable_IdlePriority ? r = 1 : s('313'), null !== T && r === vd && --r), o === n.unstable_UserBlockingPriority && (0 === Z || r < Z) && (Z = r), r - } - - function dr(e, t, n) { - var o = e.pingCache; - null !== o && o.delete(t), null !== T && vd === n ? T = null : (t = e.earliestSuspendedTime, o = e.latestSuspendedTime, 0 !== t && n <= t && n >= o) && (e.didError = !1, t = e.latestPingedTime, (0 === t || t > n) && (e.latestPingedTime = n), xn(n, e), n = e.expirationTime, 0 !== n && Cr(e, n)) - } - - function lr(e, t) { - var n = e.stateNode; - null !== n && n.delete(t), t = Sr(), t = sr(t, e), e = cr(e, t), null !== e && (kn(e, t), t = e.expirationTime, 0 !== t && Cr(e, t)) - } - - function cr(t, n) { - t.expirationTime < n && (t.expirationTime = n); - var o = t.alternate; - null !== o && o.expirationTime < n && (o.expirationTime = n); - var r = t.return, - i = null; - if (null === r && 3 === t.tag) i = t.stateNode; - else - for (; null !== r;) { - if (o = r.alternate, r.childExpirationTime < n && (r.childExpirationTime = n), null !== o && o.childExpirationTime < n && (o.childExpirationTime = n), null === r.return && 3 === r.tag) { - i = r.stateNode; - break - } - r = r.return - } - return i - } - - function pr(e, t) { - e = cr(e, t), null !== e && (!Cd && 0 !== vd && t > vd && Qo(), kn(e, t), Cd && !V && T === e || Cr(e, e.expirationTime), ji > vi && (ji = 0, s('185'))) - } - - function ur(t, o, r, i, a) { - return n.unstable_runWithPriority(n.unstable_ImmediatePriority, function () { - return t(o, r, i, a) - }) - } - - function mr() { - ti = 1073741822 - (0 | (n.unstable_now() - si) / 10) - } - - function hr(e, t) { - if (0 !== Y) { - if (t < Y) return; - null !== mi && n.unstable_cancelCallback(mi) + initializeRebaseProgress(e, t) { + return this.appStore._initializeRebaseProgress(e, t) } - Y = t, e = n.unstable_now() - si, mi = n.unstable_scheduleCallback(Er, { - timeout: 10 * (1073741822 - t) - e - }) - } - - function fr(t, n, o, r, i) { - t.expirationTime = r, 0 !== i || vr() ? 0 < i && (t.timeoutHandle = ve(gr.bind(null, t, n, o), i)) : (t.pendingCommitExpirationTime = o, t.finishedWork = n) - } - - function gr(e, t, n) { - e.pendingCommitExpirationTime = n, e.finishedWork = t, mr(), ui = ti, kr(e, n) - } - - function yr(e, t) { - e.expirationTime = t, e.finishedWork = null - } - - function Sr() { - return ni ? ui : (br(), (0 === oi || 1 === oi) && (mr(), ui = ti), ui) - } - - function Cr(e, t) { - null === e.nextScheduledRoot ? (e.expirationTime = t, null === li ? (Pd = li = e, e.nextScheduledRoot = e) : (li = li.nextScheduledRoot = e, li.nextScheduledRoot = Pd)) : t > e.expirationTime && (e.expirationTime = t), ni || (qi ? X && (W = e, oi = 1073741823, Tr(e, 1073741823, !1)) : 1073741823 === t ? wr(1073741823, !1) : hr(e, t)) - } - - function br() { - var t = 0, - n = null; - if (null !== li) - for (var o = li, r = Pd, i; null !== r;) - if (i = r.expirationTime, 0 === i) { - if (null === o || null === li ? s('244') : void 0, r === r.nextScheduledRoot) { - Pd = li = r.nextScheduledRoot = null; - break - } else if (r === Pd) Pd = i = r.nextScheduledRoot, li.nextScheduledRoot = i, r.nextScheduledRoot = null; - else if (r === li) { - li = o, li.nextScheduledRoot = Pd, r.nextScheduledRoot = null; - break - } else o.nextScheduledRoot = r.nextScheduledRoot, r.nextScheduledRoot = null; - r = o.nextScheduledRoot - } else { - if (i > t && (t = i, n = r), r === li) break; - if (1073741823 == t) break; - o = r, r = r.nextScheduledRoot - } W = n, oi = t - } - - function vr() { - return !!wi || !!n.unstable_shouldYield() && (wi = !0) - } - - function Er() { - try { - if (!vr() && null !== Pd) { - mr(); - var e = Pd; - do { - var t = e.expirationTime; - 0 !== t && ti <= t && (e.nextExpirationTimeToWorkOn = ti), e = e.nextScheduledRoot - } while (e !== Pd) - } - wr(0, !0) - } finally { - wi = !1 + setRebaseProgressFromState(e) { + return this.appStore._setRebaseProgressFromState(e) } - } - - function wr(e, t) { - if (br(), t) - for (mr(), ui = ti; null !== W && 0 !== oi && e <= oi && !(wi && ti > oi);) Tr(W, oi, ti > oi), br(), mr(), ui = ti; - else - for (; null !== W && 0 !== oi && e <= oi;) Tr(W, oi, !1), br(); - if (t && (Y = 0, mi = null), 0 !== oi && hr(W, oi), ji = 0, ii = null, null !== Dd) - for (e = Dd, Dd = null, t = 0; t < e.length; t++) { - var n = e[t]; - try { - n._onComplete() - } catch (e) { - gi || (gi = !0, pi = e) - } - } - if (gi) throw e = pi, pi = null, gi = !1, e - } - - function kr(e, t) { - ni ? s('253') : void 0, W = e, oi = t, Tr(e, t, !1), wr(1073741823, !1) - } - - function Tr(e, t, n) { - if (ni ? s('245') : void 0, ni = !0, n) { - var o = e.finishedWork; - null === o ? (e.finishedWork = null, o = e.timeoutHandle, -1 !== o && (e.timeoutHandle = -1, ye(o)), ir(e, n), o = e.finishedWork, null !== o && (vr() ? e.finishedWork = o : _r(e, o, t))) : _r(e, o, t) - } else o = e.finishedWork, null === o ? (e.finishedWork = null, o = e.timeoutHandle, -1 !== o && (e.timeoutHandle = -1, ye(o)), ir(e, n), o = e.finishedWork, null !== o && _r(e, o, t)) : _r(e, o, t); - ni = !1 - } - - function _r(e, t, o) { - var r = e.firstBatch; - return null !== r && r._expirationTime >= o && (null == Dd ? Dd = [r] : Dd.push(r), r._defer) ? (e.finishedWork = t, void(e.expirationTime = 0)) : void(e.finishedWork = null, e === ii ? ji++ : (ii = e, ji = 0), n.unstable_runWithPriority(n.unstable_ImmediatePriority, function () { - nr(e, t) - })) - } - - function Rr(e) { - null === W ? s('246') : void 0, W.expirationTime = 0, gi || (gi = !0, pi = e) - } - - function xr(e, t) { - var n = qi; - qi = !0; - try { - return e(t) - } finally { - (qi = n) || ni || wr(1073741823, !1) + setRebaseFlowStep(e, t) { + return this.appStore._setRebaseFlowStep(e, t) } - } - - function Pr(e, t) { - if (qi && !X) { - X = !0; - try { - return e(t) - } finally { - X = !1 - } + endRebaseFlow(e) { + return this.appStore._endRebaseFlow(e) } - return e(t) - } - - function Dr(e, t, o) { - qi || ni || 0 === Z || (wr(Z, !1), Z = 0); - var r = qi; - qi = !0; - try { - return n.unstable_runWithPriority(n.unstable_UserBlockingPriority, function () { - return e(t, o) - }) - } finally { - (qi = r) || ni || wr(1073741823, !1) + async rebase(e, t, n) { + const r = ob(this.repositoryStateManager.get(e).branchesState.tip); + log.info(`[rebase] starting rebase for ${n.name} at ${r}`), log.info("[rebase] to restore the previous state if this completed rebase is unsatisfactory:"), log.info("[rebase] - git checkout " + n.name), log.info(`[rebase] - git reset ${r} --hard`); + const i = await this.appStore._rebase(e, t, n); + await this.appStore._loadStatus(e); + const o = this.repositoryStateManager.get(e), + { + tip: s + } = o.branchesState, + a = ob(s); + if (log.info(`[rebase] completed rebase - got ${i} and on tip ${a} - kind ${s.kind}`), i === vl.ConflictsEncountered) { + const { + conflictState: r + } = o.changesState; + if (null === r) return void log.warn("[rebase] conflict state after rebase is null - unable to continue"); + if (Y(r)) return void log.warn("[rebase] conflict state after rebase is merge conflicts - unable to continue"); + const i = Object.assign(Object.assign({}, r), { + baseBranch: t.name, + targetBranch: n.name + }); + this.switchToConflicts(e, i) + } else if (i === vl.CompletedWithoutError) { + if (s.kind !== Qi.Valid) return void log.warn(`[rebase] tip after completing rebase is ${s.kind} but this should be a valid tip if the rebase completed without error`); + this.statsStore.recordRebaseSuccessWithoutConflicts(), await this.completeRebase(e, { + type: lu.SuccessfulRebase, + targetBranch: n.name, + baseBranch: t.name + }, s, r) + } else i === vl.Error && this.endRebaseFlow(e) } - } - - function Mr(t, n, o, r, i) { - var e = n.current; - a: if (o) { - o = o._reactInternalFiber; - b: { - 2 === Jt(o) && 1 === o.tag ? void 0 : s('170'); - var d = o;do { - switch (d.tag) { - case 3: - d = d.stateNode.context; - break b; - case 1: - if (Je(d.type)) { - d = d.stateNode.__reactInternalMemoizedMergedChildContext; - break b - } - } - d = d.return - } while (null !== d);s('171'), - d = void 0 - } - if (1 === o.tag) { - var l = o.type; - if (Je(l)) { - o = Me(o, l, d); - break a - } + async abortRebase(e) { + await this.appStore._abortRebase(e), await this.appStore._loadStatus(e) + } + async continueRebase(e, t, n) { + const r = this.repositoryStateManager.get(e), + { + targetBranch: i, + baseBranch: o, + originalBranchTip: s, + manualResolutions: a + } = n, + l = ob(r.branchesState.tip); + log.info("[continueRebase] continuing rebase for " + l); + const c = await this.appStore._continueRebase(e, t, a); + await this.appStore._loadStatus(e); + const u = this.repositoryStateManager.get(e), + { + tip: h + } = u.branchesState, + p = ob(h); + if (log.info(`[continueRebase] completed rebase - got ${c} and on tip ${p} - kind ${h.kind}`), c === vl.ConflictsEncountered) { + const { + conflictState: t + } = u.changesState; + if (null === t) return void log.warn("[continueRebase] conflict state after rebase is null - unable to continue"); + if (Y(t)) return void log.warn("[continueRebase] conflict state after rebase is merge conflicts - unable to continue"); + const n = Object.assign(Object.assign({}, t), { + baseBranch: o, + targetBranch: i + }); + this.switchToConflicts(e, n) + } else if (c === vl.CompletedWithoutError) { + if (h.kind !== Qi.Valid) return void log.warn(`[continueRebase] tip after completing rebase is ${h.kind} but this should be a valid tip if the rebase completed without error`); + this.statsStore.recordRebaseSuccessAfterConflicts(), await this.completeRebase(e, { + type: lu.SuccessfulRebase, + targetBranch: i, + baseBranch: o + }, h, s) } - o = d - } else o = Ge; - return null === n.context ? n.context = o : n.pendingContext = o, n = i, i = Ro(r), i.payload = { - element: t - }, n = void 0 === n ? null : n, null !== n && (i.callback = n), tr(), Po(e, i), pr(e, r), r - } - - function Ar(t, n, o, r) { - var i = n.current, - e = Sr(); - return i = sr(e, i), Mr(t, n, o, i, r) - } - - function Ir(e) { - if (e = e.current, !e.child) return null; - switch (e.child.tag) { - case 5: - return e.child.stateNode; - default: - return e.child.stateNode; } - } - - function Lr(e, t, n) { - var o = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; - return { - $$typeof: la, - key: null == o ? null : '' + o, - children: e, - containerInfo: t, - implementation: n + async completeRebase(e, t, n, r) { + this.closePopup(), this.setBanner(t), n.kind === Qi.Valid && this.addRebasedBranchToForcePushList(e, n, r), this.endRebaseFlow(e), await this.refreshRepository(e) } - } - - function Fr(e) { - var t = 1073741822 - 25 * ((0 | (1073741822 - Sr() + 500) / 25) + 1); - t >= yd && (t = yd - 1), this._expirationTime = yd = t, this._root = e, this._callbacks = this._next = null, this._hasChildren = this._didComplete = !1, this._children = null, this._defer = !0 - } - - function Br() { - this._callbacks = null, this._didCommit = !1, this._onCommit = this._onCommit.bind(this) - } - - function Nr(e, t, n) { - t = Ue(3, null, null, t ? 3 : 0), e = { - current: t, - containerInfo: e, - pendingChildren: null, - pingCache: null, - earliestPendingTime: 0, - latestPendingTime: 0, - earliestSuspendedTime: 0, - latestSuspendedTime: 0, - latestPingedTime: 0, - didError: !1, - pendingCommitExpirationTime: 0, - finishedWork: null, - timeoutHandle: -1, - context: null, - pendingContext: null, - hydrate: n, - nextExpirationTimeToWorkOn: 0, - expirationTime: 0, - firstBatch: null, - nextScheduledRoot: null - }, this._internalRoot = t.stateNode = e - } - - function Or(e) { - return e && (1 === e.nodeType || 9 === e.nodeType || 11 === e.nodeType || 8 === e.nodeType && ' react-mount-point-unstable ' === e.nodeValue) - } - - function Hr(e, t) { - if (t || (t = e ? 9 === e.nodeType ? e.documentElement : e.firstChild : null, t = t && 1 === t.nodeType && t.hasAttribute('data-reactroot')), !t) - for (var n; n = e.lastChild;) e.removeChild(n); - return new Nr(e, !1, t) - } - - function zr(t, n, o, r, i) { - var s = o._reactRootContainer; - if (s) { - if ('function' == typeof i) { - var d = i; - i = function () { - var e = Ir(s._internalRoot); - d.call(e) - } - } - null == t ? s.render(n, i) : s.legacy_renderSubtreeIntoContainer(t, n, i) - } else { - if (s = o._reactRootContainer = Hr(o, r), 'function' == typeof i) { - var l = i; - i = function () { - var e = Ir(s._internalRoot); - l.call(e) - } - } - Pr(function () { - null == t ? s.render(n, i) : s.legacy_renderSubtreeIntoContainer(t, n, i) + async abortMerge(e) { + await this.appStore._abortMerge(e), await this.appStore._loadStatus(e) + } + async finishConflictedMerge(e, t, n) { + const r = this.repositoryStateManager.get(e), + { + conflictState: i + } = r.changesState; + if (null === i) return void log.error("Conflict state missing during finishConflictedMerge. No merge will be committed."); + void 0 !== await this.appStore._finishConflictedMerge(e, t, i.manualResolutions) && this.setBanner(n) + } + recordLaunchStats(e) { + return this.appStore._recordLaunchStats(e) + } + reportStats() { + return this.appStore._reportStats() + } + setRemoteURL(e, t, n) { + return this.appStore._setRemoteURL(e, t, n) + } + openInBrowser(e) { + return this.appStore._openInBrowser(e) + } + appendIgnoreRule(e, t) { + return this.appStore._appendIgnoreRule(e, t) + } + async openShell(e, t = !1) { + await async function () { + return void 0 !== await oc() + }() || t ? this.appStore._openShell(e) : this.appStore._showPopup({ + type: Zi.InstallGit, + path: e }) } - return Ir(s._internalRoot) - } - - function Ur(e, t) { - var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null; - return Or(t) ? void 0 : s('200'), Lr(e, t, null, n) - } - var Wr = String.fromCharCode, - Vr = Math.min, - Gr = o(0), - Kr = o(183), - n = o(788); - Gr ? void 0 : s('227'); - var r = !1, - jr = null, - qr = !1, - Yr = null, - Xr = { - onError: function (e) { - r = !0, jr = e - } - }, - Qr = null, - $r = {}, - Zr = [], - Jr = {}, - ei = {}, - ai = {}, - di = null, - ci = null, - hi = null, - fi = null, - yi = { - injectEventPluginOrder: function (e) { - Qr ? s('101') : void 0, Qr = Array.prototype.slice.call(e), p() - }, - injectEventPluginsByName: function (e) { - var t = !1, - n; - for (n in e) - if (e.hasOwnProperty(n)) { - var o = e[n]; - $r.hasOwnProperty(n) && $r[n] === o || ($r[n] ? s('102', n) : void 0, $r[n] = o, t = !0) - } t && p() - } - }, - Si = Math.random().toString(36).slice(2), - Ci = '__reactInternalInstance$' + Si, - bi = '__reactEventHandlers$' + Si, - ki = 'undefined' != typeof window && window.document && window.document.createElement, - _i = { - animationend: $('Animation', 'AnimationEnd'), - animationiteration: $('Animation', 'AnimationIteration'), - animationstart: $('Animation', 'AnimationStart'), - transitionend: $('Transition', 'TransitionEnd') - }, - Ri = {}, - xi = {}; - ki && (xi = document.createElement('div').style, 'AnimationEvent' in window || (delete _i.animationend.animation, delete _i.animationiteration.animation, delete _i.animationstart.animation), 'TransitionEvent' in window || delete _i.transitionend.transition); - var Pi = _e('animationend'), - Di = _e('animationiteration'), - Mi = _e('animationstart'), - Ai = _e('transitionend'), - Li = ['abort', 'canplay', 'canplaythrough', 'durationchange', 'emptied', 'encrypted', 'ended', 'error', 'loadeddata', 'loadedmetadata', 'loadstart', 'pause', 'play', 'playing', 'progress', 'ratechange', 'seeked', 'seeking', 'stalled', 'suspend', 'timeupdate', 'volumechange', 'waiting'], - Fi = null, - Bi = null, - Ni = null; - Kr(ot.prototype, { - preventDefault: function () { - this.defaultPrevented = !0; - var e = this.nativeEvent; - e && (e.preventDefault ? e.preventDefault() : 'unknown' != typeof e.returnValue && (e.returnValue = !1), this.isDefaultPrevented = tt) - }, - stopPropagation: function () { - var e = this.nativeEvent; - e && (e.stopPropagation ? e.stopPropagation() : 'unknown' != typeof e.cancelBubble && (e.cancelBubble = !0), this.isPropagationStopped = tt) - }, - persist: function () { - this.isPersistent = tt - }, - isPersistent: nt, - destructor: function () { - var e = this.constructor.Interface, - t; - for (t in e) this[t] = null; - this.nativeEvent = this._targetInst = this.dispatchConfig = null, this.isPropagationStopped = this.isDefaultPrevented = nt, this._dispatchInstances = this._dispatchListeners = null + async openInExternalEditor(e) { + return this.appStore._openInExternalEditor(e) } - }), ot.Interface = { - type: null, - target: null, - currentTarget: function () { - return null - }, - eventPhase: null, - bubbles: null, - cancelable: null, - timeStamp: function (e) { - return e.timeStamp || Date.now() - }, - defaultPrevented: null, - isTrusted: null - }, ot.extend = function (t) { - function n() {} - - function o() { - return r.apply(this, arguments) + saveGitIgnore(e, t) { + return this.appStore._saveGitIgnore(e, t) } - var r = this; - n.prototype = r.prototype; - var i = new n; - return Kr(i, o.prototype), o.prototype = i, o.prototype.constructor = o, o.Interface = Kr({}, r.Interface, t), o.extend = r.extend, it(o), o - }, it(ot); - var Oi = ot.extend({ - data: null - }), - Hi = ot.extend({ - data: null - }), - zi = [9, 13, 27, 32], - Ui = ki && 'CompositionEvent' in window, - Ki = null; - ki && 'documentMode' in document && (Ki = document.documentMode); - var Yi = ki && 'TextEvent' in window && !Ki, - Qi = ki && (!Ui || Ki && 8 < Ki && 11 >= Ki), - $i = ' ', - Zi = { - beforeInput: { - phasedRegistrationNames: { - bubbled: 'onBeforeInput', - captured: 'onBeforeInputCapture' - }, - dependencies: ['compositionend', 'keypress', 'textInput', 'paste'] - }, - compositionEnd: { - phasedRegistrationNames: { - bubbled: 'onCompositionEnd', - captured: 'onCompositionEndCapture' - }, - dependencies: ['blur', 'compositionend', 'keydown', 'keypress', 'keyup', 'mousedown'] - }, - compositionStart: { - phasedRegistrationNames: { - bubbled: 'onCompositionStart', - captured: 'onCompositionStartCapture' - }, - dependencies: ['blur', 'compositionstart', 'keydown', 'keypress', 'keyup', 'mousedown'] - }, - compositionUpdate: { - phasedRegistrationNames: { - bubbled: 'onCompositionUpdate', - captured: 'onCompositionUpdateCapture' - }, - dependencies: ['blur', 'compositionupdate', 'keydown', 'keypress', 'keyup', 'mousedown'] - } - }, - Ji = !1, - ea = !1, - ta = null, - na = null, - oa = null, - ra = !1, - ia = { - color: !0, - date: !0, - datetime: !0, - "datetime-local": !0, - email: !0, - month: !0, - number: !0, - password: !0, - range: !0, - search: !0, - tel: !0, - text: !0, - time: !0, - url: !0, - week: !0 - }, - aa = Gr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - aa.hasOwnProperty('ReactCurrentDispatcher') || (aa.ReactCurrentDispatcher = { - current: null - }); - var sa = /^(.*)[\\\/]/, - da = 'function' == typeof Symbol && Symbol.for, - z = da ? Symbol.for('react.element') : 60103, - la = da ? Symbol.for('react.portal') : 60106, - ca = da ? Symbol.for('react.fragment') : 60107, - pa = da ? Symbol.for('react.strict_mode') : 60108, - ua = da ? Symbol.for('react.profiler') : 60114, - ma = da ? Symbol.for('react.provider') : 60109, - ha = da ? Symbol.for('react.context') : 60110, - fa = da ? Symbol.for('react.concurrent_mode') : 60111, - ga = da ? Symbol.for('react.forward_ref') : 60112, - ya = da ? Symbol.for('react.suspense') : 60113, - Sa = da ? Symbol.for('react.memo') : 60115, - Ca = da ? Symbol.for('react.lazy') : 60116, - ba = 'function' == typeof Symbol && Symbol.iterator, - va = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, - Ea = Object.prototype.hasOwnProperty, - wa = {}, - ka = {}, - Ta = {}; - ['children', 'dangerouslySetInnerHTML', 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (e) { - Ta[e] = new Dt(e, 0, !1, e, null) - }), [ - ['acceptCharset', 'accept-charset'], - ['className', 'class'], - ['htmlFor', 'for'], - ['httpEquiv', 'http-equiv'] - ].forEach(function (e) { - var t = e[0]; - Ta[t] = new Dt(t, 1, !1, e[1], null) - }), ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (e) { - Ta[e] = new Dt(e, 2, !1, e.toLowerCase(), null) - }), ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (e) { - Ta[e] = new Dt(e, 2, !1, e, null) - }), ['allowFullScreen', 'async', 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', 'itemScope'].forEach(function (e) { - Ta[e] = new Dt(e, 3, !1, e.toLowerCase(), null) - }), ['checked', 'multiple', 'muted', 'selected'].forEach(function (e) { - Ta[e] = new Dt(e, 3, !0, e, null) - }), ['capture', 'download'].forEach(function (e) { - Ta[e] = new Dt(e, 4, !1, e, null) - }), ['cols', 'rows', 'size', 'span'].forEach(function (e) { - Ta[e] = new Dt(e, 6, !1, e, null) - }), ['rowSpan', 'start'].forEach(function (e) { - Ta[e] = new Dt(e, 5, !1, e.toLowerCase(), null) - }); - var D = /[\-:]([a-z])/g; - ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (e) { - var t = e.replace(D, C); - Ta[t] = new Dt(t, 1, !1, e, null) - }), ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (e) { - var t = e.replace(D, C); - Ta[t] = new Dt(t, 1, !1, e, 'http://www.w3.org/1999/xlink') - }), ['xml:base', 'xml:lang', 'xml:space'].forEach(function (e) { - var t = e.replace(D, C); - Ta[t] = new Dt(t, 1, !1, e, 'http://www.w3.org/XML/1998/namespace') - }), ['tabIndex', 'crossOrigin'].forEach(function (e) { - Ta[e] = new Dt(e, 1, !1, e.toLowerCase(), null) - }); - var _a = { - change: { - phasedRegistrationNames: { - bubbled: 'onChange', - captured: 'onChangeCapture' - }, - dependencies: ['blur', 'change', 'click', 'focus', 'input', 'keydown', 'keyup', 'selectionchange'] - } - }, - xa = null, - Pa = null, - Da = !1; - ki && (Da = Ct('input') && (!document.documentMode || 9 < document.documentMode)); - var Ma = { - eventTypes: _a, - _isInputEventSupported: Da, - extractEvents: function (t, n, o, r) { - var i = n ? R(n) : window, - e = i.nodeName && i.nodeName.toLowerCase(), - a, s; - return 'select' === e || 'input' === e && 'file' === i.type ? a = Wt : yt(i) ? Da ? a = Yt : (a = jt, s = Kt) : (e = i.nodeName) && 'input' === e.toLowerCase() && ('checkbox' === i.type || 'radio' === i.type) && (a = qt), a && (a = a(t, n)) ? Ht(a, o, r) : void(s && s(t, i, n), 'blur' === t && (t = i._wrapperState) && t.controlled && 'number' === i.type && Ot(i, 'number', i.value)) - } - }, - Aa = ot.extend({ - view: null, - detail: null - }), - Ia = { - Alt: 'altKey', - Control: 'ctrlKey', - Meta: 'metaKey', - Shift: 'shiftKey' - }, - La = 0, - Fa = 0, - Ba = !1, - Na = !1, - Oa = Aa.extend({ - screenX: null, - screenY: null, - clientX: null, - clientY: null, - pageX: null, - pageY: null, - ctrlKey: null, - shiftKey: null, - altKey: null, - metaKey: null, - getModifierState: Qt, - button: null, - buttons: null, - relatedTarget: function (e) { - return e.relatedTarget || (e.fromElement === e.srcElement ? e.toElement : e.fromElement) - }, - movementX: function (e) { - if ('movementX' in e) return e.movementX; - var t = La; - return La = e.screenX, Ba ? 'mousemove' === e.type ? e.screenX - t : 0 : (Ba = !0, 0) - }, - movementY: function (e) { - if ('movementY' in e) return e.movementY; - var t = Fa; - return Fa = e.screenY, Na ? 'mousemove' === e.type ? e.screenY - t : 0 : (Na = !0, 0) - } - }), - za = Oa.extend({ - pointerId: null, - width: null, - height: null, - pressure: null, - tangentialPressure: null, - tiltX: null, - tiltY: null, - twist: null, - pointerType: null, - isPrimary: null - }), - Ua = { - mouseEnter: { - registrationName: 'onMouseEnter', - dependencies: ['mouseout', 'mouseover'] - }, - mouseLeave: { - registrationName: 'onMouseLeave', - dependencies: ['mouseout', 'mouseover'] - }, - pointerEnter: { - registrationName: 'onPointerEnter', - dependencies: ['pointerout', 'pointerover'] - }, - pointerLeave: { - registrationName: 'onPointerLeave', - dependencies: ['pointerout', 'pointerover'] - } - }, - Wa = Object.prototype.hasOwnProperty, - Va = ot.extend({ - animationName: null, - elapsedTime: null, - pseudoElement: null - }), - Ga = ot.extend({ - clipboardData: function (e) { - return 'clipboardData' in e ? e.clipboardData : window.clipboardData - } - }), - Ka = Aa.extend({ - relatedTarget: null - }), - ja = { - Esc: 'Escape', - Spacebar: ' ', - Left: 'ArrowLeft', - Up: 'ArrowUp', - Right: 'ArrowRight', - Down: 'ArrowDown', - Del: 'Delete', - Win: 'OS', - Menu: 'ContextMenu', - Apps: 'ContextMenu', - Scroll: 'ScrollLock', - MozPrintableKey: 'Unidentified' - }, - qa = { - 8: 'Backspace', - 9: 'Tab', - 12: 'Clear', - 13: 'Enter', - 16: 'Shift', - 17: 'Control', - 18: 'Alt', - 19: 'Pause', - 20: 'CapsLock', - 27: 'Escape', - 32: ' ', - 33: 'PageUp', - 34: 'PageDown', - 35: 'End', - 36: 'Home', - 37: 'ArrowLeft', - 38: 'ArrowUp', - 39: 'ArrowRight', - 40: 'ArrowDown', - 45: 'Insert', - 46: 'Delete', - 112: 'F1', - 113: 'F2', - 114: 'F3', - 115: 'F4', - 116: 'F5', - 117: 'F6', - 118: 'F7', - 119: 'F8', - 120: 'F9', - 121: 'F10', - 122: 'F11', - 123: 'F12', - 144: 'NumLock', - 145: 'ScrollLock', - 224: 'Meta' - }, - Ya = Aa.extend({ - key: function (e) { - if (e.key) { - var t = ja[e.key] || e.key; - if ('Unidentified' !== t) return t - } - return 'keypress' === e.type ? (e = on(e), 13 === e ? 'Enter' : Wr(e)) : 'keydown' === e.type || 'keyup' === e.type ? qa[e.keyCode] || 'Unidentified' : '' - }, - location: null, - ctrlKey: null, - shiftKey: null, - altKey: null, - metaKey: null, - repeat: null, - locale: null, - getModifierState: Qt, - charCode: function (e) { - return 'keypress' === e.type ? on(e) : 0 - }, - keyCode: function (e) { - return 'keydown' === e.type || 'keyup' === e.type ? e.keyCode : 0 - }, - which: function (e) { - return 'keypress' === e.type ? on(e) : 'keydown' === e.type || 'keyup' === e.type ? e.keyCode : 0 - } - }), - Xa = Oa.extend({ - dataTransfer: null - }), - Qa = Aa.extend({ - touches: null, - targetTouches: null, - changedTouches: null, - altKey: null, - metaKey: null, - ctrlKey: null, - shiftKey: null, - getModifierState: Qt - }), - $a = ot.extend({ - propertyName: null, - elapsedTime: null, - pseudoElement: null - }), - Za = Oa.extend({ - deltaX: function (e) { - return 'deltaX' in e ? e.deltaX : 'wheelDeltaX' in e ? -e.wheelDeltaX : 0 - }, - deltaY: function (e) { - return 'deltaY' in e ? e.deltaY : 'wheelDeltaY' in e ? -e.wheelDeltaY : 'wheelDelta' in e ? -e.wheelDelta : 0 - }, - deltaZ: null, - deltaMode: null - }), - Ja = {}, - es = {}; - [ - ['blur', 'blur'], - ['cancel', 'cancel'], - ['click', 'click'], - ['close', 'close'], - ['contextmenu', 'contextMenu'], - ['copy', 'copy'], - ['cut', 'cut'], - ['auxclick', 'auxClick'], - ['dblclick', 'doubleClick'], - ['dragend', 'dragEnd'], - ['dragstart', 'dragStart'], - ['drop', 'drop'], - ['focus', 'focus'], - ['input', 'input'], - ['invalid', 'invalid'], - ['keydown', 'keyDown'], - ['keypress', 'keyPress'], - ['keyup', 'keyUp'], - ['mousedown', 'mouseDown'], - ['mouseup', 'mouseUp'], - ['paste', 'paste'], - ['pause', 'pause'], - ['play', 'play'], - ['pointercancel', 'pointerCancel'], - ['pointerdown', 'pointerDown'], - ['pointerup', 'pointerUp'], - ['ratechange', 'rateChange'], - ['reset', 'reset'], - ['seeked', 'seeked'], - ['submit', 'submit'], - ['touchcancel', 'touchCancel'], - ['touchend', 'touchEnd'], - ['touchstart', 'touchStart'], - ['volumechange', 'volumeChange'] - ].forEach(function (e) { - rn(e, !0) - }), [ - ['abort', 'abort'], - [Pi, 'animationEnd'], - [Di, 'animationIteration'], - [Mi, 'animationStart'], - ['canplay', 'canPlay'], - ['canplaythrough', 'canPlayThrough'], - ['drag', 'drag'], - ['dragenter', 'dragEnter'], - ['dragexit', 'dragExit'], - ['dragleave', 'dragLeave'], - ['dragover', 'dragOver'], - ['durationchange', 'durationChange'], - ['emptied', 'emptied'], - ['encrypted', 'encrypted'], - ['ended', 'ended'], - ['error', 'error'], - ['gotpointercapture', 'gotPointerCapture'], - ['load', 'load'], - ['loadeddata', 'loadedData'], - ['loadedmetadata', 'loadedMetadata'], - ['loadstart', 'loadStart'], - ['lostpointercapture', 'lostPointerCapture'], - ['mousemove', 'mouseMove'], - ['mouseout', 'mouseOut'], - ['mouseover', 'mouseOver'], - ['playing', 'playing'], - ['pointermove', 'pointerMove'], - ['pointerout', 'pointerOut'], - ['pointerover', 'pointerOver'], - ['progress', 'progress'], - ['scroll', 'scroll'], - ['seeking', 'seeking'], - ['stalled', 'stalled'], - ['suspend', 'suspend'], - ['timeupdate', 'timeUpdate'], - ['toggle', 'toggle'], - ['touchmove', 'touchMove'], - [Ai, 'transitionEnd'], - ['waiting', 'waiting'], - ['wheel', 'wheel'] - ].forEach(function (e) { - rn(e, !1) - }); - var ts = { - eventTypes: Ja, - isInteractiveTopLevelEventType: function (e) { - return e = es[e], void 0 !== e && !0 === e.isInteractive - }, - extractEvents: function (t, n, o, r) { - var i = es[t]; - if (!i) return null; - switch (t) { - case 'keypress': - if (0 === on(o)) return null; - case 'keydown': - case 'keyup': - t = Ya; - break; - case 'blur': - case 'focus': - t = Ka; - break; - case 'click': - if (2 === o.button) return null; - case 'auxclick': - case 'dblclick': - case 'mousedown': - case 'mousemove': - case 'mouseup': - case 'mouseout': - case 'mouseover': - case 'contextmenu': - t = Oa; - break; - case 'drag': - case 'dragend': - case 'dragenter': - case 'dragexit': - case 'dragleave': - case 'dragover': - case 'dragstart': - case 'drop': - t = Xa; - break; - case 'touchcancel': - case 'touchend': - case 'touchmove': - case 'touchstart': - t = Qa; - break; - case Pi: - case Di: - case Mi: - t = Va; - break; - case Ai: - t = $a; - break; - case 'scroll': - t = Aa; - break; - case 'wheel': - t = Za; - break; - case 'copy': - case 'cut': - case 'paste': - t = Ga; - break; - case 'gotpointercapture': - case 'lostpointercapture': - case 'pointercancel': - case 'pointerdown': - case 'pointermove': - case 'pointerout': - case 'pointerover': - case 'pointerup': - t = za; - break; - default: - t = ot; - } - return n = t.getPooled(i, n, o, r), q(n), n - } - }, - ns = ts.isInteractiveTopLevelEventType, - os = [], - rs = !0, - is = {}, - as = 0, - ss = '_reactListenersID' + ('' + Math.random()).slice(2), - ds = ki && 'documentMode' in document && 11 >= document.documentMode, - ls = { - select: { - phasedRegistrationNames: { - bubbled: 'onSelect', - captured: 'onSelectCapture' - }, - dependencies: ['blur', 'contextmenu', 'dragend', 'focus', 'keydown', 'keyup', 'mousedown', 'mouseup', 'selectionchange'] - } - }, - cs = null, - ps = null, - us = null, - ms = !1; - yi.injectEventPluginOrder(['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']), di = b, ci = g, hi = R, yi.injectEventPluginsByName({ - SimpleEventPlugin: ts, - EnterLeaveEventPlugin: { - eventTypes: Ua, - extractEvents: function (t, n, o, r) { - var i = 'mouseover' === t || 'pointerover' === t, - a = 'mouseout' === t || 'pointerout' === t; - if (i && (o.relatedTarget || o.fromElement) || !a && !i) return null; - if (i = r.window === r ? r : (i = r.ownerDocument) ? i.defaultView || i.parentWindow : window, a ? (a = n, n = (n = o.relatedTarget || o.toElement) ? _(n) : null) : a = null, a === n) return null; - var s, d, c, l; - 'mouseout' === t || 'mouseover' === t ? (s = Oa, d = Ua.mouseLeave, c = Ua.mouseEnter, l = 'mouse') : ('pointerout' === t || 'pointerover' === t) && (s = za, d = Ua.pointerLeave, c = Ua.pointerEnter, l = 'pointer'); - var p = null == a ? i : R(a); - if (i = null == n ? i : R(n), t = s.getPooled(d, a, o, r), t.type = l + 'leave', t.target = p, t.relatedTarget = i, o = s.getPooled(c, n, o, r), o.type = l + 'enter', o.target = i, o.relatedTarget = p, r = n, a && r) a: { - for (n = a, i = r, l = 0, s = n; s; s = x(s)) l++; - for (s = 0, c = i; c; c = x(c)) s++; - for (; 0 < l - s;) n = x(n), - l--; - for (; 0 < s - l;) i = x(i), - s--; - for (; l--;) { - if (n === i || n === i.alternate) break a; - n = x(n), i = x(i) - } - n = null - } - else n = null; - for (i = n, n = []; a && a !== i && (l = a.alternate, null === l || l !== i);) n.push(a), a = x(a); - for (a = []; r && r !== i && (l = r.alternate, null === l || l !== i);) a.push(r), r = x(r); - for (r = 0; r < n.length; r++) B(n[r], 'bubbled', t); - for (r = a.length; 0 < r--;) B(a[r], 'captured', o); - return [t, o] - } - }, - ChangeEventPlugin: Ma, - SelectEventPlugin: { - eventTypes: ls, - extractEvents: function (t, n, o, r) { - var i = r.window === r ? r.document : 9 === r.nodeType ? r : r.ownerDocument, - a; - if (!(a = !i)) { - a: { - i = cn(i), - a = ai.onSelect; - for (var s = 0, d; s < a.length; s++) - if (d = a[s], !i.hasOwnProperty(d) || !i[d]) { - i = !1; - break a - } i = !0 - } - a = !i - } - if (a) return null; - switch (i = n ? R(n) : window, t) { - case 'focus': - (yt(i) || 'true' === i.contentEditable) && (cs = i, ps = n, us = null); - break; - case 'blur': - us = ps = cs = null; - break; - case 'mousedown': - ms = !0; - break; - case 'contextmenu': - case 'mouseup': - case 'dragend': - return ms = !1, Cn(o, r); - case 'selectionchange': - if (ds) break; - case 'keydown': - case 'keyup': - return Cn(o, r); - } - return null - } - }, - BeforeInputEventPlugin: { - eventTypes: Zi, - extractEvents: function (t, n, o, r) { - var i = void 0, - e = void 0; - if (Ui) b: 'compositionstart' === t ? i = Zi.compositionStart : 'compositionend' === t ? i = Zi.compositionEnd : 'compositionupdate' === t ? i = Zi.compositionUpdate : void 0, i = void 0; - else ea ? at(t, o) && (i = Zi.compositionEnd) : 'keydown' === t && 229 === o.keyCode && (i = Zi.compositionStart); - return i ? (Qi && 'ko' !== o.locale && (ea || i !== Zi.compositionStart ? i === Zi.compositionEnd && ea && (e = et()) : (Fi = r, Bi = 'value' in Fi ? Fi.value : Fi.textContent, ea = !0)), i = Oi.getPooled(i, n, o, r), e ? i.data = e : (e = st(o), null !== e && (i.data = e)), q(i), e = i) : e = null, (t = Yi ? dt(t, o) : lt(t, o)) ? (n = Hi.getPooled(Zi.beforeInput, n, o, r), n.data = t, q(n)) : n = null, null === e ? n : null === n ? e : [e, n] - } + setStatsOptOut(e, t) { + return this.appStore.setStatsOptOut(e, t) + } + markUsageStatsNoteSeen() { + this.appStore.markUsageStatsNoteSeen() + } + resetSignInState() { + return this.appStore._resetSignInState() + } + onDotComSupportsBasicAuthUpdated(e) { + return this.appStore._onDotComSupportsBasicAuthUpdated(e) + } + tryGetDotComSupportsBasicAuth() { + return this.appStore._tryGetDotComSupportsBasicAuth() + } + beginDotComSignIn() { + return this.appStore._beginDotComSignIn() + } + beginEnterpriseSignIn() { + return this.appStore._beginEnterpriseSignIn() + } + setSignInEndpoint(e) { + return this.appStore._setSignInEndpoint(e) + } + setSignInCredentials(e, t) { + return this.appStore._setSignInCredentials(e, t) + } + requestBrowserAuthentication() { + return this.appStore._requestBrowserAuthentication() + } + async requestBrowserAuthenticationToDotcom() { + return await this.beginDotComSignIn(), this.requestBrowserAuthentication() + } + setSignInOTP(e) { + return this.appStore._setSignInOTP(e) + } + async showDotComSignInDialog() { + await this.appStore._beginDotComSignIn(), await this.appStore._showPopup({ + type: Zi.SignIn + }) } - }); - var hs = { - html: 'http://www.w3.org/1999/xhtml', - mathml: 'http://www.w3.org/1998/Math/MathML', - svg: 'http://www.w3.org/2000/svg' - }, - fe = void 0, - ie = function (t) { - return 'undefined' != typeof MSApp && MSApp.execUnsafeLocalFunction ? function (n, o, r, i) { - MSApp.execUnsafeLocalFunction(function () { - return t(n, o, r, i) - }) - } : t - }(function (e, t) { - if (e.namespaceURI !== hs.svg || 'innerHTML' in e) e.innerHTML = t; - else { - for (fe = fe || document.createElement('div'), fe.innerHTML = '' + t + '', t = fe.firstChild; e.firstChild;) e.removeChild(e.firstChild); - for (; t.firstChild;) e.appendChild(t.firstChild) + async showEnterpriseSignInDialog() { + await this.appStore._beginEnterpriseSignIn(), await this.appStore._showPopup({ + type: Zi.SignIn + }) + } + async showCreateForkDialog(e) { + await this.appStore._showCreateforkDialog(e) + } + registerErrorHandler(e) { + return this.errorHandlers.push(e), new ne.Disposable(() => { + const t = this.errorHandlers.indexOf(e); + t >= 0 && this.errorHandlers.splice(t, 1) + }) + } + async relocateRepository(e) { + const t = r.remote.getCurrentWindow(), + { + filePaths: n + } = await r.remote.dialog.showOpenDialog(t, { + properties: ["openDirectory"] + }); + if (n.length > 0) { + const t = n[0]; + await this.updateRepositoryPath(e, t) } - }), - je = { - animationIterationCount: !0, - borderImageOutset: !0, - borderImageSlice: !0, - borderImageWidth: !0, - boxFlex: !0, - boxFlexGroup: !0, - boxOrdinalGroup: !0, - columnCount: !0, - columns: !0, - flex: !0, - flexGrow: !0, - flexPositive: !0, - flexShrink: !0, - flexNegative: !0, - flexOrder: !0, - gridArea: !0, - gridRow: !0, - gridRowEnd: !0, - gridRowSpan: !0, - gridRowStart: !0, - gridColumn: !0, - gridColumnEnd: !0, - gridColumnSpan: !0, - gridColumnStart: !0, - fontWeight: !0, - lineClamp: !0, - lineHeight: !0, - opacity: !0, - order: !0, - orphans: !0, - tabSize: !0, - widows: !0, - zIndex: !0, - zoom: !0, - fillOpacity: !0, - floodOpacity: !0, - stopOpacity: !0, - strokeDasharray: !0, - strokeDashoffset: !0, - strokeMiterlimit: !0, - strokeOpacity: !0, - strokeWidth: !0 - }, - le = ['Webkit', 'ms', 'Moz', 'O']; - Object.keys(je).forEach(function (e) { - le.forEach(function (t) { - t = t + e.charAt(0).toUpperCase() + e.substring(1), je[t] = je[e] - }) - }); - var me = Kr({ - menuitem: !0 - }, { - area: !0, - base: !0, - br: !0, - col: !0, - embed: !0, - hr: !0, - img: !0, - input: !0, - keygen: !0, - link: !0, - meta: !0, - param: !0, - source: !0, - track: !0, - wbr: !0 - }), - pe = null, - fs = null, - ve = 'function' == typeof setTimeout ? setTimeout : void 0, - ye = 'function' == typeof clearTimeout ? clearTimeout : void 0, - ze = n.unstable_scheduleCallback, - Ae = n.unstable_cancelCallback; - new Set; - var Be = [], - Fe = -1, - Ge = {}, - gs = { - current: Ge - }, - H = { - current: !1 - }, - I = Ge, - Ie = null, - ys = null, - Ss = new Gr.Component().refs, - Cs = { - isMounted: function (e) { - return !!(e = e._reactInternalFiber) && 2 === Jt(e) - }, - enqueueSetState: function (t, n, o) { - t = t._reactInternalFiber; - var r = Sr(); - r = sr(r, t); - var i = Ro(r); - i.payload = n, void 0 !== o && null !== o && (i.callback = o), tr(), Po(t, i), pr(t, r) - }, - enqueueReplaceState: function (t, n, o) { - t = t._reactInternalFiber; - var r = Sr(); - r = sr(r, t); - var i = Ro(r); - i.tag = rd, i.payload = n, void 0 !== o && null !== o && (i.callback = o), tr(), Po(t, i), pr(t, r) - }, - enqueueForceUpdate: function (e, t) { - e = e._reactInternalFiber; - var n = Sr(); - n = sr(n, e); - var o = Ro(n); - o.tag = id, void 0 !== t && null !== t && (o.callback = t), tr(), Po(e, o), pr(e, n) + } + async updateRepositoryWorkflowPreferences(e, t) { + await this.appStore._updateRepositoryWorkflowPreferences(e, t) + } + async updateRepositoryPath(e, t) { + await this.appStore._updateRepositoryPath(e, t) + } + async setAppFocusState(e) { + await this.appStore._setAppFocusState(e), e ? this.commitStatusStore.startBackgroundRefresh() : this.commitStatusStore.stopBackgroundRefresh() + } + async getForkAndUpstreamRepos(e) { + const t = this.appStore.getState().repositories, + n = [], + r = []; + for (const i of t) + if (i instanceof Xi && Ji(i)) { + const t = i.gitHubRepository.htmlURL, + o = i.gitHubRepository.parent && i.gitHubRepository.parent.htmlURL; + t && Dt(t, e) ? r.push(i) : o && Dt(o, e) && n.push(i) + } return { + forks: n, + upstreams: r } - }, - bs = Array.isArray, - vs = Nn(!0), - Es = Nn(!1), - ws = {}, - ks = { - current: ws - }, - N = { - current: ws - }, - Ts = { - current: ws - }, - _s = 0, - Rs = 2, - xs = 4, - Ps = 8, - Ds = 16, - Ms = 32, - As = 64, - Is = 128, - Ls = aa.ReactCurrentDispatcher, - Fs = 0, - Bs = null, - Ns = null, - O = null, - P = null, - Os = null, - Q = null, - Hs = 0, - zs = null, - Us = 0, - Ws = !1, - Vs = null, - Gs = 0, - Ks = { - readContext: ko, - useCallback: Vn, - useContext: Vn, - useEffect: Vn, - useImperativeHandle: Vn, - useLayoutEffect: Vn, - useMemo: Vn, - useReducer: Vn, - useRef: Vn, - useState: Vn, - useDebugValue: Vn - }, - js = { - readContext: ko, - useCallback: function (e, t) { - return qn().memoizedState = [e, void 0 === t ? null : t], e - }, - useContext: ko, - useEffect: function (e, t) { - return Zn(516, Is | As, e, t) - }, - useImperativeHandle: function (e, t, n) { - return n = null !== n && void 0 !== n ? n.concat([e]) : null, Zn(4, xs | Ms, eo.bind(null, t, e), n) - }, - useLayoutEffect: function (e, t) { - return Zn(4, xs | Ms, e, t) - }, - useMemo: function (e, t) { - var n = qn(); - return t = void 0 === t ? null : t, e = e(), n.memoizedState = [e, t], e - }, - useReducer: function (e, t, n) { - var o = qn(); - return t = void 0 === n ? t : n(t), o.memoizedState = o.baseState = t, e = o.queue = { - last: null, - dispatch: null, - eagerReducer: e, - eagerState: t - }, e = e.dispatch = no.bind(null, Bs, e), [o.memoizedState, e] - }, - useRef: function (e) { - var t = qn(); - return e = { - current: e - }, t.memoizedState = e - }, - useState: function (e) { - var t = qn(); - return 'function' == typeof e && (e = e()), t.memoizedState = t.baseState = e, e = t.queue = { - last: null, - dispatch: null, - eagerReducer: Xn, - eagerState: e - }, e = e.dispatch = no.bind(null, Bs, e), [t.memoizedState, e] - }, - useDebugValue: to - }, - qs = { - readContext: ko, - useCallback: function (e, t) { - var n = Yn(); - t = void 0 === t ? null : t; - var o = n.memoizedState; - return null !== o && null !== t && Gn(t, o[1]) ? o[0] : (n.memoizedState = [e, t], e) - }, - useContext: ko, - useEffect: function (e, t) { - return Jn(516, Is | As, e, t) - }, - useImperativeHandle: function (e, t, n) { - return n = null !== n && void 0 !== n ? n.concat([e]) : null, Jn(4, xs | Ms, eo.bind(null, t, e), n) - }, - useLayoutEffect: function (e, t) { - return Jn(4, xs | Ms, e, t) - }, - useMemo: function (e, t) { - var n = Yn(); - t = void 0 === t ? null : t; - var o = n.memoizedState; - return null !== o && null !== t && Gn(t, o[1]) ? o[0] : (e = e(), n.memoizedState = [e, t], e) - }, - useReducer: Qn, - useRef: function () { - return Yn().memoizedState - }, - useState: function (e) { - return Qn(Xn, e) - }, - useDebugValue: to - }, - Ys = null, - Xs = null, - Qs = !1, - $s = aa.ReactCurrentOwner, - Zs = !1, - Js = { - current: null - }, - ed = null, - td = null, - nd = null, - od = 0, - rd = 1, - id = 2, - ad = 3, - sd = !1, - dd = void 0, - ld = void 0, - cd = void 0, - pd = void 0; - dd = function (e, t) { - for (var n = t.child; null !== n;) { - if (5 === n.tag || 6 === n.tag) e.appendChild(n.stateNode); - else if (4 !== n.tag && null !== n.child) { - n.child.return = n, n = n.child; - continue + } + async openRepositoryFromUrl(e) { + const { + url: t, + pr: n + } = e, r = n ? await this.appStore.fetchPullRequest(t, n) : null, i = r && r.head.repo && r.head.repo.html_url, { + forks: o, + upstreams: s + } = await this.getForkAndUpstreamRepos(t), a = o.find(e => Boolean(e.gitHubRepository && e.gitHubRepository.htmlURL && i && Dt(e.gitHubRepository.htmlURL, i))); + if (a) { + await this.selectRepository(a); + const e = r && r.head.ref; + return void(e && await this.checkoutLocalBranch(a, e)) } - if (n === t) break; - for (; null === n.sibling;) { - if (null === n.return || n.return === t) return; - n = n.return + const l = s.find(e => Boolean(e.gitHubRepository && e.gitHubRepository.htmlURL && i && Dt(e.gitHubRepository.htmlURL, i))); + if (l) return await this.selectRepository(l), void await this.handleCloneInDesktopOptions(l, e); + if (o.length > 0 && 0 === s.length) { + const t = o[0]; + return await this.selectRepository(t), void await this.handleCloneInDesktopOptions(t, e) } - n.sibling.return = n.return, n = n.sibling + const c = await this.openOrCloneRepository(t); + c ? await this.handleCloneInDesktopOptions(c, e) : log.warn(`Open Repository from URL failed, did not find or clone repository: ${t} - payload: ${JSON.stringify(e)}`) } - }, ld = function () {}, cd = function (t, n, o, r, i) { - var e = t.memoizedProps; - if (e !== r) { - var a = n.stateNode; - On(ks.current), t = null; - 'input' === o ? (e = It(a, e), r = It(a, r), t = []) : 'option' === o ? (e = vn(a, e), r = vn(a, r), t = []) : 'select' === o ? (e = Kr({}, e, { - value: void 0 - }), r = Kr({}, r, { - value: void 0 - }), t = []) : 'textarea' === o ? (e = ae(a, e), r = ae(a, r), t = []) : 'function' != typeof e.onClick && 'function' == typeof r.onClick && (a.onclick = se); - oe(o, r), a = o = void 0; - var s = null; - for (o in e) - if (!r.hasOwnProperty(o) && e.hasOwnProperty(o) && null != e[o]) - if ('style' === o) { - var d = e[o]; - for (a in d) d.hasOwnProperty(a) && (s || (s = {}), s[a] = '') - } else 'dangerouslySetInnerHTML' !== o && 'children' !== o && 'suppressContentEditableWarning' !== o && 'suppressHydrationWarning' !== o && 'autoFocus' !== o && (ei.hasOwnProperty(o) ? t || (t = []) : (t = t || []).push(o, null)); - for (o in r) { - var l = r[o]; - if (d = null == e ? void 0 : e[o], r.hasOwnProperty(o) && l !== d && (null != l || null != d)) - if ('style' !== o) 'dangerouslySetInnerHTML' === o ? (l = l ? l.__html : void 0, d = d ? d.__html : void 0, null != l && d !== l && (t = t || []).push(o, '' + l)) : 'children' === o ? d === l || 'string' != typeof l && 'number' != typeof l || (t = t || []).push(o, '' + l) : 'suppressContentEditableWarning' !== o && 'suppressHydrationWarning' !== o && (ei.hasOwnProperty(o) ? (null != l && re(i, o), t || d === l || (t = [])) : (t = t || []).push(o, l)); - else if (d) { - for (a in d) !d.hasOwnProperty(a) || l && l.hasOwnProperty(a) || (s || (s = {}), s[a] = ''); - for (a in l) l.hasOwnProperty(a) && d[a] !== l[a] && (s || (s = {}), s[a] = l[a]) - } else s || (t || (t = []), t.push(o, s)), s = l - } - s && (t = t || []).push('style', s), i = t, (n.updateQueue = i) && No(n) - } - }, pd = function (e, t, n, o) { - n !== o && No(t) - }; - var md = 'function' == typeof WeakSet ? WeakSet : Set, - hd = 'function' == typeof WeakMap ? WeakMap : Map, - fd = aa.ReactCurrentDispatcher, - gd = aa.ReactCurrentOwner, - yd = 1073741822, - Cd = !1, - bd = null, - T = null, - vd = 0, - U = -1, - Ed = !1, - wd = null, - V = !1, - kd = null, - Td = null, - _d = null, - Rd = null, - Pd = null, - li = null, - Y = 0, - mi = void 0, - ni = !1, - W = null, - oi = 0, - Z = 0, - gi = !1, - pi = null, - qi = !1, - X = !1, - Dd = null, - si = n.unstable_now(), - ti = 1073741822 - (0 | si / 10), - ui = ti, - vi = 50, - ji = 0, - ii = null, - wi = !1; - ta = function (t, n, o) { - switch (n) { - case 'input': - if (Bt(t, o), n = o.name, 'radio' === o.type && null != n) { - for (o = t; o.parentNode;) o = o.parentNode; - for (o = o.querySelectorAll('input[name=' + JSON.stringify('' + n) + '][type="radio"]'), n = 0; n < o.length; n++) { - var r = o[n]; - if (r !== t && r.form === t.form) { - var i = b(r); - i ? void 0 : s('90'), wt(r), Bt(r, i) + async dispatchURLAction(e) { + switch (e.name) { + case "oauth": + try { + log.info("[Dispatcher] requesting authenticated user"); + const n = await ju(e.code, e.state); + n ? (t = n, Wu || Z("`askUserToOAuth` must be called before resolving an auth request."), Wu.resolve(t), Wu = null) : null === n && Gu(new Error("Unable to fetch authenticated user.")) + } catch (e) { + Gu(e) + } + 0; + break; + case "open-repository-from-url": + this.openRepositoryFromUrl(e); + break; + case "open-repository-from-path": + const n = await Dc(e.path) || e.path; + let r = kt(this.appStore.getState().repositories, n); + if (null == r) { + if (await qa(n)) { + r = (await this.addRepositories([n]))[0] } } - } - break; - case 'textarea': - ce(t, o); - break; - case 'select': - n = o.value, null != n && En(t, !!o.multiple, n, !1); + r ? (await this.selectRepository(r), this.statsStore.recordAddExistingRepository()) : await this.showPopup({ + type: Zi.AddRepository, + path: n + }); + break; + default: + const i = e; + log.warn(`Unknown URL action: ${i.name} - payload: ${JSON.stringify(i)}`) + } + var t } - }, Fr.prototype.render = function (e) { - this._defer ? void 0 : s('250'), this._hasChildren = !0, this._children = e; - var t = this._root._internalRoot, - n = this._expirationTime, - o = new Br; - return Mr(e, t, null, n, o._onCommit), o - }, Fr.prototype.then = function (e) { - if (this._didComplete) e(); - else { - var t = this._callbacks; - null === t && (t = this._callbacks = []), t.push(e) + setConfirmRepoRemovalSetting(e) { + return this.appStore._setConfirmRepositoryRemovalSetting(e) } - }, Fr.prototype.commit = function () { - var t = this._root._internalRoot, - n = t.firstBatch; - if (this._defer && null !== n ? void 0 : s('251'), this._hasChildren) { - var o = this._expirationTime; - if (n !== this) { - this._hasChildren && (o = this._expirationTime = n._expirationTime, this.render(this._children)); - for (var r = null, i = n; i !== this;) r = i, i = i._next; - null === r ? s('251') : void 0, r._next = i._next, this._next = n, t.firstBatch = this - } - this._defer = !1, kr(t, o), n = this._next, this._next = null, n = t.firstBatch = n, null !== n && n._hasChildren && n.render(n._children) - } else this._next = null, this._defer = !1 - }, Fr.prototype._onComplete = function () { - if (!this._didComplete) { - this._didComplete = !0; - var e = this._callbacks; - if (null !== e) - for (var t = 0; t < e.length; t++)(0, e[t])() + setConfirmDiscardChangesSetting(e) { + return this.appStore._setConfirmDiscardChangesSetting(e) } - }, Br.prototype.then = function (e) { - if (this._didCommit) e(); - else { - var t = this._callbacks; - null === t && (t = this._callbacks = []), t.push(e) + setUncommittedChangesStrategyKindSetting(e) { + return this.appStore._setUncommittedChangesStrategyKindSetting(e) } - }, Br.prototype._onCommit = function () { - if (!this._didCommit) { - this._didCommit = !0; - var e = this._callbacks; - if (null !== e) - for (var t = 0, n; t < e.length; t++) n = e[t], 'function' == typeof n ? void 0 : s('191', n), n() + setExternalEditor(e) { + return this.appStore._setExternalEditor(e) } - }, Nr.prototype.render = function (e, t) { - var n = this._internalRoot, - o = new Br; - return t = void 0 === t ? null : t, null !== t && o.then(t), Ar(e, n, null, o._onCommit), o - }, Nr.prototype.unmount = function (e) { - var t = this._internalRoot, - n = new Br; - return e = void 0 === e ? null : e, null !== e && n.then(e), Ar(null, t, null, n._onCommit), n - }, Nr.prototype.legacy_renderSubtreeIntoContainer = function (t, n, o) { - var r = this._internalRoot, - i = new Br; - return o = void 0 === o ? null : o, null !== o && i.then(o), Ar(n, r, t, i._onCommit), i - }, Nr.prototype.createBatch = function () { - var e = new Fr(this), - t = e._expirationTime, - n = this._internalRoot, - o = n.firstBatch; - if (null === o) n.firstBatch = e, e._next = null; - else { - for (n = null; null !== o && o._expirationTime >= t;) n = o, o = o._next; - e._next = o, null !== n && (n._next = e) + setShell(e) { + return this.appStore._setShell(e) } - return e - }, mt = xr, ht = Dr, ft = function () { - ni || 0 === Z || (wr(Z, !1), Z = 0) - }; - var Md = { - createPortal: Ur, - findDOMNode: function (e) { - if (null == e) return null; - if (1 === e.nodeType) return e; - var t = e._reactInternalFiber; - return void 0 === t && ('function' == typeof e.render ? s('188') : s('268', Object.keys(e))), e = nn(t), e = null === e ? null : e.stateNode, e - }, - hydrate: function (e, t, n) { - return Or(t) ? void 0 : s('200'), zr(null, e, t, !0, n) - }, - render: function (e, t, n) { - return Or(t) ? void 0 : s('200'), zr(null, e, t, !1, n) - }, - unstable_renderSubtreeIntoContainer: function (e, t, n, o) { - return Or(n) ? void 0 : s('200'), null == e || void 0 === e._reactInternalFiber ? s('38') : void 0, zr(e, t, n, !1, o) - }, - unmountComponentAtNode: function (e) { - return Or(e) ? void 0 : s('40'), !!e._reactRootContainer && (Pr(function () { - zr(null, null, e, !1, function () { - e._reactRootContainer = null + async checkoutLocalBranch(e, t) { + let n = !0; + const r = this.repositoryStateManager.get(e), + i = r.branchesState.allBranches, + { + tip: o + } = r.branchesState; + o.kind === Qi.Valid && (n = o.branch.nameWithoutRemote !== t); + const s = i.find(e => e.nameWithoutRemote === t); + n && void 0 !== s && await this.checkoutBranch(e, s) + } + async handleCloneInDesktopOptions(e, t) { + const { + filepath: n, + pr: r, + branch: i + } = t; + null != r && null != i && await this.fetchRefspec(e, `pull/${r}/head:${i}`), await this.appStore._refreshRepository(e); + const o = this.repositoryStateManager.get(e).branchesState.allBranches; + if (null == r && null != i) { + null == (o.find(e => e.upstreamWithoutRemote === i) || null) && await this.fetch(e, Li.BackgroundTask) + } + if (null != i && await this.checkoutLocalBranch(e, i), null != n) { + const t = await + function (e, ...t) { + return Pc(e, t) + }(e.path, n); + null !== t ? ee.showItemInFolder(t) : log.error("Prevented attempt to open path outside of the repository root: " + n) + } + } + async openOrCloneRepository(e) { + const t = this.appStore.getState().repositories.find(t => { + if (t instanceof Xi) { + const n = t.gitHubRepository; + return !!n && Rt(e, n) + } + return !1 + }); + return t ? await this.selectRepository(t) : this.appStore._startOpenInDesktop(() => { + this.changeCloneRepositoriesTab(Si.Generic), this.showPopup({ + type: Zi.CloneRepository, + initialURL: e }) - }), !0) - }, - unstable_createPortal: function () { - return Ur.apply(void 0, arguments) - }, - unstable_batchedUpdates: xr, - unstable_interactiveUpdates: Dr, - flushSync: function (e, t) { - ni ? s('187') : void 0; - var n = qi; - qi = !0; + }) + } + async installCLI() { try { - return ur(e, t) - } finally { - qi = n, wr(1073741823, !1) + await Jv(), this.showPopup({ + type: Zi.CLIInstalled + }) + } catch (e) { + log.error("Error installing CLI", e), this.postError(e) } - }, - unstable_createRoot: function (e, t) { - return Or(e) ? void 0 : s('299', 'unstable_createRoot'), new Nr(e, !0, null != t && !0 === t.hydrate) - }, - unstable_flushControlled: function (e) { - var t = qi; - qi = !0; + } + promptForGenericGitAuthentication(e, t) { + return this.appStore.promptForGenericGitAuthentication(e, t) + } + async saveGenericGitCredentials(e, t, n) { + log.info(`storing generic credentials for '${e}' and '${t}'`), + function (e, t) { + const n = es(e); + localStorage.setItem(n, t) + }(e, t); try { - ur(e) - } finally { - (qi = t) || ni || wr(1073741823, !1) + await + function (e, t, n) { + const r = yi(e); + return Xo.setItem(r, t, n) + }(e, t, n) + } catch (n) { + log.error(`Error saving generic git credentials: ${t}@${e}`, n), this.postError(n) } - }, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { - Events: [g, R, b, yi.injectEventPluginsByName, Jr, q, function (e) { - c(e, j) - }, pt, ut, ln, w] } - }; - (function (e) { - var t = e.findFiberByHostInstance; - return Se(Kr({}, e, { - overrideProps: null, - currentDispatcherRef: aa.ReactCurrentDispatcher, - findHostInstanceByFiber: function (e) { - return e = nn(e), null === e ? null : e.stateNode - }, - findFiberByHostInstance: function (e) { - return t ? t(e) : null - } - })) - })({ - findFiberByHostInstance: _, - bundleType: 0, - version: '16.8.4', - rendererPackageName: 'react-dom' - }); - var Ad = { - default: Md - }, - Wi = Ad && Md || Ad; - e.exports = Wi.default || Wi -}, function (e, o, i) { - 'use strict'; - /** @license React v16.8.4 - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - function s(t, n, o, r, i, e, s, d) { - if (!t) { - if (t = void 0, void 0 === n) t = Error('Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.'); - else { - var c = [o, r, i, e, s, d], - l = 0; - t = Error(n.replace(/%s/g, function () { - return c[l++] - })), t.name = 'Invariant Violation' + async performRetry(e) { + switch (e.type) { + case rc.Push: + return this.push(e.repository); + case rc.Pull: + return this.pull(e.repository); + case rc.Fetch: + return this.fetch(e.repository, Li.UserInitiatedTask); + case rc.Clone: + await this.clone(e.url, e.path, e.options); + break; + case rc.Checkout: + await this.checkoutBranch(e.repository, e.branch); + break; + case rc.Merge: + return this.mergeBranch(e.repository, e.theirBranch, null); + case rc.Rebase: + return this.rebase(e.repository, e.baseBranch, e.targetBranch); + default: + return X(0, "Unknown retry action: " + e) } - throw t.framesToPop = 1, t } - } - - function _(e) { - for (var t = arguments.length - 1, n = 'https://reactjs.org/docs/error-decoder.html?invariant=' + e, o = 0; o < t; o++) n += '&args[]=' + encodeURIComponent(arguments[o + 1]); - s(!1, 'Minified React error #' + e + '; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ', n) - } - - function a(e, t, n) { - this.props = e, this.context = t, this.refs = C, this.updater = n || A - } - - function d() {} - - function l(e, t, n) { - this.props = e, this.context = t, this.refs = C, this.updater = n || A - } - - function c(t, o, r) { - var i = {}, - s = null, - d = null, - u; - if (null != o) - for (u in void 0 !== o.ref && (d = o.ref), void 0 !== o.key && (s = '' + o.key), o) ce.call(o, u) && !K.hasOwnProperty(u) && (i[u] = o[u]); - var c = arguments.length - 2; - if (1 === c) i.children = r; - else if (1 < c) { - for (var f = Array(c), l = 0; l < c; l++) f[l] = arguments[l + 2]; - i.children = f - } - if (t && t.defaultProps) - for (u in c = t.defaultProps, c) void 0 === i[u] && (i[u] = c[u]); - return { - $$typeof: n, - type: t, - key: s, - ref: d, - props: i, - _owner: le.current + changeImageDiffType(e) { + return this.appStore._changeImageDiffType(e) } - } - - function m(e, t) { - return { - $$typeof: n, - type: e.type, - key: t, - ref: e.ref, - props: e.props, - _owner: e._owner + onHideWhitespaceInDiffChanged(e, t, n = null) { + return this.appStore._setHideWhitespaceInDiff(e, t, n) } - } - - function h(e) { - return 'object' == typeof e && null !== e && e.$$typeof === n - } - - function f(e) { - var t = { - "=": '=0', - ":": '=2' - }; - return '$' + ('' + e).replace(/[=:]/g, function (e) { - return t[e] - }) - } - - function F(t, n, o, r) { - if (O.length) { - var i = O.pop(); - return i.result = t, i.keyPrefix = n, i.func = o, i.context = r, i.count = 0, i + installGlobalLFSFilters(e) { + return this.appStore._installGlobalLFSFilters(e) } - return { - result: t, - keyPrefix: n, - func: o, - context: r, - count: 0 + installLFSHooks(e) { + return this.appStore._installLFSHooks(e) } - } - - function B(e) { - e.result = null, e.keyPrefix = null, e.func = null, e.context = null, e.count = 0, 10 > O.length && O.push(e) - } - - function R(t, o, r, i) { - var s = typeof t; - ('undefined' === s || 'boolean' === s) && (t = null); - var e = !1; - if (null === t) e = !0; - else switch (s) { - case 'string': - case 'number': - e = !0; - break; - case 'object': - switch (t.$$typeof) { - case n: - case Q: - e = !0; - } - } - if (e) return r(i, t, '' === o ? '.' + U(t, 0) : o), 1; - if (e = 0, o = '' === o ? '.' : o + ':', Array.isArray(t)) - for (var d = 0; d < t.length; d++) { - s = t[d]; - var l = o + U(s, d); - e += R(s, l, r, i) - } else if (null === t || 'object' != typeof t ? l = null : (l = de && t[de] || t['@@iterator'], l = 'function' == typeof l ? l : null), 'function' == typeof l) - for (t = l.call(t), d = 0; !(s = t.next()).done;) s = s.value, l = o + U(s, d++), e += R(s, l, r, i); - else 'object' === s && (r = '' + t, _('31', '[object Object]' === r ? 'object with keys {' + Object.keys(t).join(', ') + '}' : r, '')); - return e - } - - function S(e, t, n) { - return null == e ? 0 : R(e, '', t, n) - } - - function U(e, t) { - return 'object' == typeof e && null !== e && null != e.key ? f(e.key) : t.toString(36) - } - - function g(e, t) { - e.func.call(e.context, t, e.count++) - } - - function T(t, n, o) { - var r = t.result, - i = t.keyPrefix; - t = t.func.call(t.context, n, t.count++), Array.isArray(t) ? j(t, r, o, function (e) { - return e - }) : null != t && (h(t) && (t = m(t, i + (!t.key || n && n.key === t.key ? '' : ('' + t.key).replace(L, '$&/') + '/') + o)), r.push(t)) - } - - function j(t, n, o, r, i) { - var e = ''; - null != o && (e = ('' + o).replace(L, '$&/') + '/'), n = F(n, e, r, i), S(t, T, n), B(n) - } - - function V() { - var e = H.current; - return null === e ? _('307') : void 0, e - } - var W = i(183), - b = 'function' == typeof Symbol && Symbol.for, - n = b ? Symbol.for('react.element') : 60103, - Q = b ? Symbol.for('react.portal') : 60106, - q = b ? Symbol.for('react.fragment') : 60107, - $ = b ? Symbol.for('react.strict_mode') : 60108, - ee = b ? Symbol.for('react.profiler') : 60114, - te = b ? Symbol.for('react.provider') : 60109, - ne = b ? Symbol.for('react.context') : 60110, - oe = b ? Symbol.for('react.concurrent_mode') : 60111, - re = b ? Symbol.for('react.forward_ref') : 60112, - ie = b ? Symbol.for('react.suspense') : 60113, - ae = b ? Symbol.for('react.memo') : 60115, - se = b ? Symbol.for('react.lazy') : 60116, - de = 'function' == typeof Symbol && Symbol.iterator, - A = { - isMounted: function () { - return !1 - }, - enqueueForceUpdate: function () {}, - enqueueReplaceState: function () {}, - enqueueSetState: function () {} - }, - C = {}; - a.prototype.isReactComponent = {}, a.prototype.setState = function (e, t) { - 'object' != typeof e && 'function' != typeof e && null != e ? _('85') : void 0, this.updater.enqueueSetState(this, e, t, 'setState') - }, a.prototype.forceUpdate = function (e) { - this.updater.enqueueForceUpdate(this, e, 'forceUpdate') - }, d.prototype = a.prototype; - var D = l.prototype = new d; - D.constructor = l, W(D, a.prototype), D.isPureReactComponent = !0; - var H = { - current: null - }, - le = { - current: null - }, - ce = Object.prototype.hasOwnProperty, - K = { - key: !0, - ref: !0, - __self: !0, - __source: !0 - }, - L = /\/+/g, - O = [], - P = { - Children: { - map: function (e, t, n) { - if (null == e) return e; - var o = []; - return j(e, o, null, t, n), o - }, - forEach: function (e, t, n) { - return null == e ? e : void(t = F(null, null, t, n), S(e, g, t), B(t)) - }, - count: function (e) { - return S(e, function () { - return null - }, null) - }, - toArray: function (e) { - var t = []; - return j(e, t, null, function (e) { - return e - }), t - }, - only: function (e) { - return h(e) ? void 0 : _('143'), e - } - }, - createRef: function () { - return { - current: null - } - }, - Component: a, - PureComponent: l, - createContext: function (e, t) { - return void 0 === t && (t = null), e = { - $$typeof: ne, - _calculateChangedBits: t, - _currentValue: e, - _currentValue2: e, - _threadCount: 0, - Provider: null, - Consumer: null - }, e.Provider = { - $$typeof: te, - _context: e - }, e.Consumer = e - }, - forwardRef: function (e) { - return { - $$typeof: re, - render: e - } - }, - lazy: function (e) { - return { - $$typeof: se, - _ctor: e, - _status: -1, - _result: null - } - }, - memo: function (e, t) { - return { - $$typeof: ae, - type: e, - compare: void 0 === t ? null : t - } - }, - useCallback: function (e, t) { - return V().useCallback(e, t) - }, - useContext: function (e, t) { - return V().useContext(e, t) - }, - useEffect: function (e, t) { - return V().useEffect(e, t) - }, - useImperativeHandle: function (e, t, n) { - return V().useImperativeHandle(e, t, n) - }, - useDebugValue: function () {}, - useLayoutEffect: function (e, t) { - return V().useLayoutEffect(e, t) - }, - useMemo: function (e, t) { - return V().useMemo(e, t) - }, - useReducer: function (e, t, n) { - return V().useReducer(e, t, n) - }, - useRef: function (e) { - return V().useRef(e) - }, - useState: function (e) { - return V().useState(e) - }, - Fragment: q, - StrictMode: $, - Suspense: ie, - createElement: c, - cloneElement: function (t, o, r) { - null === t || void 0 === t ? _('267', t) : void 0; - var i = W({}, t.props), - a = t.key, - s = t.ref, - d = t._owner, - u; - if (null != o) { - void 0 !== o.ref && (s = o.ref, d = le.current), void 0 !== o.key && (a = '' + o.key); - var c; - for (u in t.type && t.type.defaultProps && (c = t.type.defaultProps), o) ce.call(o, u) && !K.hasOwnProperty(u) && (i[u] = void 0 === o[u] && void 0 !== c ? c[u] : o[u]) - } - if (u = arguments.length - 2, 1 === u) i.children = r; - else if (1 < u) { - c = Array(u); - for (var l = 0; l < u; l++) c[l] = arguments[l + 2]; - i.children = c - } - return { - $$typeof: n, - type: t.type, - key: a, - ref: s, - props: i, - _owner: d - } - }, - createFactory: function (e) { - var t = c.bind(null, e); - return t.type = e, t - }, - isValidElement: h, - version: '16.8.4', - unstable_ConcurrentMode: oe, - unstable_Profiler: ee, - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { - ReactCurrentDispatcher: H, - ReactCurrentOwner: le, - assign: W - } - }, - pe = { - default: P - }, - Y = pe && P || pe; - e.exports = Y.default || Y -}, function (e) { - e.exports = require('module') -}, function (e, t, n) { - function o(e, t, n, o, r) { - this.children = [], this.sourceContents = {}, this.line = null == e ? null : e, this.column = null == t ? null : t, this.source = null == n ? null : n, this.name = null == r ? null : r, this[s] = !0, null != o && this.add(o) - } - var r = n(313).SourceMapGenerator, - a = n(108), - i = /(\r?\n)/, - s = '$$$isSourceNode$$$'; - o.fromStringWithSourceMap = function (e, t, n) { - function r(e, t) { - if (null === e || void 0 === e.source) s.add(t); - else { - var r = n ? a.join(n, e.source) : e.source; - s.add(new o(e.originalLine, e.originalColumn, r, t, e.name)) - } + changeCloneRepositoriesTab(e) { + return this.appStore._changeCloneRepositoriesTab(e) + } + refreshApiRepositories(e) { + return this.appStore._refreshApiRepositories(e) + } + changeBranchesTab(e) { + return this.appStore._changeBranchesTab(e) + } + showGitHubExplore(e) { + return this.appStore._showGitHubExplore(e) + } + createPullRequest(e) { + return this.appStore._createPullRequest(e) + } + showPullRequest(e) { + return this.appStore._showPullRequest(e) + } + openCreatePullRequestInBrowser(e, t) { + return this.appStore._openCreatePullRequestInBrowser(e, t) + } + updateExistingUpstreamRemote(e) { + return this.appStore._updateExistingUpstreamRemote(e) + } + ignoreExistingUpstreamRemote(e) { + return this.appStore._ignoreExistingUpstreamRemote(e) + } + async checkoutPullRequest(e, t) { + return this.appStore._checkoutPullRequest(e, t) + } + setShowCoAuthoredBy(e, t) { + return this.appStore._setShowCoAuthoredBy(e, t) + } + setCoAuthors(e, t) { + return this.appStore._setCoAuthors(e, t) + } + initializeCompare(e, t) { + return this.appStore._initializeCompare(e, t) + } + executeCompare(e, t) { + return this.appStore._executeCompare(e, t) + } + updateCompareForm(e, t) { + return this.appStore._updateCompareForm(e, t) + } + updateManualConflictResolution(e, t, n) { + return this.appStore._updateManualConflictResolution(e, t, n) + } + async confirmOrForcePush(e) { + const { + askForConfirmationOnForcePush: t + } = this.appStore.getState(), { + branchesState: n + } = this.repositoryStateManager.get(e), { + tip: r + } = n; + if (r.kind !== Qi.Valid) return void log.warn("Could not find a branch to perform force push"); + const { + upstream: i + } = r.branch; + null !== i ? t ? this.showPopup({ + type: Zi.ConfirmForcePush, + repository: e, + upstreamBranch: i + }) : await this.performForcePush(e) : log.warn("Could not find an upstream branch which will be pushed") } - var s = new o, - d = e.split(i), - l = 0, - c = function () { - function e() { - return l < d.length ? d[l++] : void 0 - } - var t = e(), - n = e() || ''; - return t + n - }, - p = 1, - u = 0, - m = null; - return t.eachMapping(function (e) { - if (null !== m) - if (p < e.generatedLine) r(m, c()), p++, u = 0; - else { - var t = d[l], - n = t.substr(0, e.generatedColumn - u); - return d[l] = t.substr(e.generatedColumn - u), u = e.generatedColumn, r(m, n), void(m = e) - } for (; p < e.generatedLine;) s.add(c()), p++; - if (u < e.generatedColumn) { - var t = d[l]; - s.add(t.substr(0, e.generatedColumn)), d[l] = t.substr(e.generatedColumn), u = e.generatedColumn - } - m = e - }, this), l < d.length && (m && r(m, c()), s.add(d.splice(l).join(''))), t.sources.forEach(function (e) { - var o = t.sourceContentFor(e); - null != o && (null != n && (e = a.join(n, e)), s.setSourceContent(e, o)) - }), s - }, o.prototype.add = function (e) { - if (Array.isArray(e)) e.forEach(function (e) { - this.add(e) - }, this); - else if (e[s] || 'string' == typeof e) e && this.children.push(e); - else throw new TypeError('Expected a SourceNode, string, or an array of SourceNodes and strings. Got ' + e); - return this - }, o.prototype.prepend = function (e) { - if (Array.isArray(e)) - for (var t = e.length - 1; 0 <= t; t--) this.prepend(e[t]); - else if (e[s] || 'string' == typeof e) this.children.unshift(e); - else throw new TypeError('Expected a SourceNode, string, or an array of SourceNodes and strings. Got ' + e); - return this - }, o.prototype.walk = function (e) { - for (var t = 0, n = this.children.length, o; t < n; t++) o = this.children[t], o[s] ? o.walk(e) : '' !== o && e(o, { - source: this.source, - line: this.line, - column: this.column, - name: this.name - }) - }, o.prototype.join = function (e) { - var t = this.children.length, - n, o; - if (0 < t) { - for (n = [], o = 0; o < t - 1; o++) n.push(this.children[o]), n.push(e); - n.push(this.children[o]), this.children = n + async performForcePush(e) { + await this.pushWithOptions(e, { + forceWithLease: !0 + }), await this.appStore._loadStatus(e) } - return this - }, o.prototype.replaceRight = function (e, t) { - var n = this.children[this.children.length - 1]; - return n[s] ? n.replaceRight(e, t) : 'string' == typeof n ? this.children[this.children.length - 1] = n.replace(e, t) : this.children.push(''.replace(e, t)), this - }, o.prototype.setSourceContent = function (e, t) { - this.sourceContents[a.toSetString(e)] = t - }, o.prototype.walkSourceContents = function (e) { - for (var t = 0, n = this.children.length; t < n; t++) this.children[t][s] && this.children[t].walkSourceContents(e); - for (var o = Object.keys(this.sourceContents), t = 0, n = o.length; t < n; t++) e(a.fromSetString(o[t]), this.sourceContents[o[t]]) - }, o.prototype.toString = function () { - var e = ''; - return this.walk(function (t) { - e += t - }), e - }, o.prototype.toStringWithSourceMap = function (e) { - var t = { - code: '', - line: 1, - column: 0 - }, - n = new r(e), - o = !1, - i = null, - a = null, - s = null, - d = null; - return this.walk(function (e, r) { - t.code += e, null !== r.source && null !== r.line && null !== r.column ? ((i !== r.source || a !== r.line || s !== r.column || d !== r.name) && n.addMapping({ - source: r.source, - original: { - line: r.line, - column: r.column - }, - generated: { - line: t.line, - column: t.column - }, - name: r.name - }), i = r.source, a = r.line, s = r.column, d = r.name, o = !0) : o && (n.addMapping({ - generated: { - line: t.line, - column: t.column - } - }), i = null, o = !1); - for (var l = 0, c = e.length; l < c; l++) e.charCodeAt(l) === 10 ? (t.line++, t.column = 0, l + 1 === c ? (i = null, o = !1) : o && n.addMapping({ - source: r.source, - original: { - line: r.line, - column: r.column - }, - generated: { - line: t.line, - column: t.column - }, - name: r.name - })) : t.column++ - }), this.walkSourceContents(function (e, t) { - n.setSourceContent(e, t) - }), { - code: t.code, - map: n + setConfirmForcePushSetting(e) { + return this.appStore._setConfirmForcePushSetting(e) } - }, t.SourceNode = o -}, function (e, t) { - function n(e, t, n) { - var o = e[t]; - e[t] = e[n], e[n] = o - } - - function o(e, t) { - return Math.round(e + Math.random() * (t - e)) - } - - function a(e, t, s, d) { - if (s < d) { - var r = o(s, d), - l = s - 1; - n(e, r, d); - for (var i = e[d], c = s; c < d; c++) 0 >= t(e[c], i) && (l += 1, n(e, l, c)); - n(e, l + 1, c); - var p = l + 1; - a(e, t, s, p - 1), a(e, t, p + 1, d) + async convertRepositoryToFork(e, t) { + return this.appStore._convertRepositoryToFork(e, t) } - } - t.quickSort = function (e, t) { - a(e, t, 0, e.length - 1) - } -}, function (e, t) { - function n(e, o, r, i, a, s) { - var d = Math.floor((o - e) / 2) + e, - l = a(r, i[d], !0); - return 0 === l ? d : 0 < l ? 1 < o - d ? n(d, o, r, i, a, s) : s == t.LEAST_UPPER_BOUND ? o < i.length ? o : -1 : d : 1 < d - e ? n(e, d, r, i, a, s) : s == t.LEAST_UPPER_BOUND ? d : 0 > e ? -1 : e - } - t.GREATEST_LOWER_BOUND = 1, t.LEAST_UPPER_BOUND = 2, t.search = function (e, o, r, i) { - if (0 === o.length) return -1; - var a = n(-1, o.length, e, o, r, i || t.GREATEST_LOWER_BOUND); - if (0 > a) return -1; - for (; 0 <= a - 1 && !(0 !== r(o[a], o[a - 1], !0));) --a; - return a - } -}, function (e, t, n) { - function o(e) { - var t = e; - return 'string' == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ''))), null == t.sections ? new r(t) : new i(t) - } - - function r(e) { - var t = e; - 'string' == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ''))); - var n = d.getArg(t, 'version'), - o = d.getArg(t, 'sources'), - r = d.getArg(t, 'names', []), - i = d.getArg(t, 'sourceRoot', null), - a = d.getArg(t, 'sourcesContent', null), - s = d.getArg(t, 'mappings'), - c = d.getArg(t, 'file', null); - if (n != this._version) throw new Error('Unsupported version: ' + n); - o = o.map(String).map(d.normalize).map(function (e) { - return i && d.isAbsolute(i) && d.isAbsolute(e) ? d.relative(i, e) : e - }), this._names = l.fromArray(r.map(String), !0), this._sources = l.fromArray(o, !0), this.sourceRoot = i, this.sourcesContent = a, this._mappings = s, this.file = c - } - - function a() { - this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null - } - - function i(e) { - var t = e; - 'string' == typeof e && (t = JSON.parse(e.replace(/^\)\]\}'/, ''))); - var n = d.getArg(t, 'version'), - r = d.getArg(t, 'sections'); - if (n != this._version) throw new Error('Unsupported version: ' + n); - this._sources = new l, this._names = new l; - var i = { - line: -1, - column: 0 - }; - this._sections = r.map(function (e) { - if (e.url) throw new Error('Support for url field in sections not implemented.'); - var t = d.getArg(e, 'offset'), - n = d.getArg(t, 'line'), - r = d.getArg(t, 'column'); - if (n < i.line || n === i.line && r < i.column) throw new Error('Section offsets must be ordered and non-overlapping.'); - return i = t, { - generatedOffset: { - generatedLine: n + 1, - generatedColumn: r + 1 - }, - consumer: new o(d.getArg(e, 'map')) - } - }) - } - var d = n(108), - s = n(794), - l = n(311).ArraySet, - c = n(312), - p = n(793).quickSort; - o.fromSourceMap = function (e) { - return r.fromSourceMap(e) - }, o.prototype._version = 3, o.prototype.__generatedMappings = null, Object.defineProperty(o.prototype, '_generatedMappings', { - get: function () { - return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings + mergeConflictDetectedFromPull() { + return this.statsStore.recordMergeConflictFromPull() } - }), o.prototype.__originalMappings = null, Object.defineProperty(o.prototype, '_originalMappings', { - get: function () { - return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings + mergeConflictDetectedFromExplicitMerge() { + return this.statsStore.recordMergeConflictFromExplicitMerge() } - }), o.prototype._charIsMappingSeparator = function (e, t) { - var n = e.charAt(t); - return ';' === n || ',' === n - }, o.prototype._parseMappings = function () { - throw new Error('Subclasses must implement _parseMappings') - }, o.GENERATED_ORDER = 1, o.ORIGINAL_ORDER = 2, o.GREATEST_LOWER_BOUND = 1, o.LEAST_UPPER_BOUND = 2, o.prototype.eachMapping = function (e, t, n) { - var r = n || o.GENERATED_ORDER, - i; - switch (r) { - case o.GENERATED_ORDER: - i = this._generatedMappings; - break; - case o.ORIGINAL_ORDER: - i = this._originalMappings; - break; - default: - throw new Error('Unknown order of iteration.'); + recordMenuInitiatedMerge() { + return this.statsStore.recordMenuInitiatedMerge() } - var a = this.sourceRoot; - i.map(function (e) { - var t = null === e.source ? null : this._sources.at(e.source); - return null != t && null != a && (t = d.join(a, t)), { - source: t, - generatedLine: e.generatedLine, - generatedColumn: e.generatedColumn, - originalLine: e.originalLine, - originalColumn: e.originalColumn, - name: null === e.name ? null : this._names.at(e.name) - } - }, this).forEach(e, t || null) - }, o.prototype.allGeneratedPositionsFor = function (e) { - var t = d.getArg(e, 'line'), - n = { - source: d.getArg(e, 'source'), - originalLine: t, - originalColumn: d.getArg(e, 'column', 0) - }; - if (null != this.sourceRoot && (n.source = d.relative(this.sourceRoot, n.source)), !this._sources.has(n.source)) return []; - n.source = this._sources.indexOf(n.source); - var o = [], - r = this._findMapping(n, this._originalMappings, 'originalLine', 'originalColumn', d.compareByOriginalPositions, s.LEAST_UPPER_BOUND); - if (0 <= r) { - var i = this._originalMappings[r]; - if (void 0 === e.column) - for (var a = i.originalLine; i && i.originalLine === a;) o.push({ - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - }), i = this._originalMappings[++r]; - else - for (var l = i.originalColumn; i && i.originalLine === t && i.originalColumn == l;) o.push({ - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - }), i = this._originalMappings[++r] + recordMenuInitiatedRebase() { + return this.statsStore.recordMenuInitiatedRebase() } - return o - }, t.SourceMapConsumer = o, r.prototype = Object.create(o.prototype), r.prototype.consumer = o, r.fromSourceMap = function (e) { - var t = Object.create(r.prototype), - n = t._names = l.fromArray(e._names.toArray(), !0), - o = t._sources = l.fromArray(e._sources.toArray(), !0); - t.sourceRoot = e._sourceRoot, t.sourcesContent = e._generateSourcesContent(t._sources.toArray(), t.sourceRoot), t.file = e._file; - for (var s = e._mappings.toArray().slice(), c = t.__generatedMappings = [], u = t.__originalMappings = [], m = 0, i = s.length; m < i; m++) { - var h = s[m], - f = new a; - f.generatedLine = h.generatedLine, f.generatedColumn = h.generatedColumn, h.source && (f.source = o.indexOf(h.source), f.originalLine = h.originalLine, f.originalColumn = h.originalColumn, h.name && (f.name = n.indexOf(h.name)), u.push(f)), c.push(f) + recordMenuInitiatedUpdate() { + return this.statsStore.recordMenuInitiatedUpdate() } - return p(t.__originalMappings, d.compareByOriginalPositions), t - }, r.prototype._version = 3, Object.defineProperty(r.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (e) { - return null == this.sourceRoot ? e : d.join(this.sourceRoot, e) - }, this) - } - }), r.prototype._parseMappings = function (e) { - for (var t = 1, n = 0, o = 0, r = 0, i = 0, s = 0, l = e.length, u = 0, m = {}, h = {}, f = [], g = [], y, S, C, b, v; u < l;) - if (';' === e.charAt(u)) t++, u++, n = 0; - else if (',' === e.charAt(u)) u++; - else { - for (y = new a, y.generatedLine = t, b = u; b < l && !this._charIsMappingSeparator(e, b); b++); - if (S = e.slice(u, b), C = m[S], C) u += S.length; - else { - for (C = []; u < b;) c.decode(e, u, h), v = h.value, u = h.rest, C.push(v); - if (2 === C.length) throw new Error('Found a source, but no line and column'); - if (3 === C.length) throw new Error('Found a source and line, but no column'); - m[S] = C - } - y.generatedColumn = n + C[0], n = y.generatedColumn, 1 < C.length && (y.source = i + C[1], i += C[1], y.originalLine = o + C[2], o = y.originalLine, y.originalLine += 1, y.originalColumn = r + C[3], r = y.originalColumn, 4 < C.length && (y.name = s + C[4], s += C[4])), g.push(y), 'number' == typeof y.originalLine && f.push(y) - } - p(g, d.compareByGeneratedPositionsDeflated), this.__generatedMappings = g, p(f, d.compareByOriginalPositions), this.__originalMappings = f - }, r.prototype._findMapping = function (e, t, n, o, r, i) { - if (0 >= e[n]) throw new TypeError('Line must be greater than or equal to 1, got ' + e[n]); - if (0 > e[o]) throw new TypeError('Column must be greater than or equal to 0, got ' + e[o]); - return s.search(e, t, r, i) - }, r.prototype.computeColumnSpans = function () { - for (var e = 0, t; e < this._generatedMappings.length; ++e) { - if (t = this._generatedMappings[e], e + 1 < this._generatedMappings.length) { - var n = this._generatedMappings[e + 1]; - if (t.generatedLine === n.generatedLine) { - t.lastGeneratedColumn = n.generatedColumn - 1; - continue - } - } - t.lastGeneratedColumn = Infinity + recordCompareInitiatedMerge() { + return this.statsStore.recordCompareInitiatedMerge() } - }, r.prototype.originalPositionFor = function (e) { - var t = { - generatedLine: d.getArg(e, 'line'), - generatedColumn: d.getArg(e, 'column') - }, - n = this._findMapping(t, this._generatedMappings, 'generatedLine', 'generatedColumn', d.compareByGeneratedPositionsDeflated, d.getArg(e, 'bias', o.GREATEST_LOWER_BOUND)); - if (0 <= n) { - var r = this._generatedMappings[n]; - if (r.generatedLine === t.generatedLine) { - var i = d.getArg(r, 'source', null); - null !== i && (i = this._sources.at(i), null != this.sourceRoot && (i = d.join(this.sourceRoot, i))); - var a = d.getArg(r, 'name', null); - return null !== a && (a = this._names.at(a)), { - source: i, - line: d.getArg(r, 'originalLine', null), - column: d.getArg(r, 'originalColumn', null), - name: a - } - } + setSelectedTheme(e) { + return this.appStore._setSelectedTheme(e) } - return { - source: null, - line: null, - column: null, - name: null + onAutomaticallySwitchThemeChanged(e) { + return this.appStore._setAutomaticallySwitchTheme(e) } - }, r.prototype.hasContentsOfAllSources = function () { - return !!this.sourcesContent && this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (e) { - return null == e - }) - }, r.prototype.sourceContentFor = function (e, t) { - if (!this.sourcesContent) return null; - if (null != this.sourceRoot && (e = d.relative(this.sourceRoot, e)), this._sources.has(e)) return this.sourcesContent[this._sources.indexOf(e)]; - var n; - if (null != this.sourceRoot && (n = d.urlParse(this.sourceRoot))) { - var o = e.replace(/^file:\/\//, ''); - if ('file' == n.scheme && this._sources.has(o)) return this.sourcesContent[this._sources.indexOf(o)]; - if ((!n.path || '/' == n.path) && this._sources.has('/' + e)) return this.sourcesContent[this._sources.indexOf('/' + e)] + recordRepoClicked(e) { + return this.statsStore.recordRepoClicked(e) } - if (t) return null; - throw new Error('"' + e + '" is not in the SourceMap.') - }, r.prototype.generatedPositionFor = function (e) { - var t = d.getArg(e, 'source'); - if (null != this.sourceRoot && (t = d.relative(this.sourceRoot, t)), !this._sources.has(t)) return { - line: null, - column: null, - lastColumn: null - }; - t = this._sources.indexOf(t); - var n = { - source: t, - originalLine: d.getArg(e, 'line'), - originalColumn: d.getArg(e, 'column') - }, - r = this._findMapping(n, this._originalMappings, 'originalLine', 'originalColumn', d.compareByOriginalPositions, d.getArg(e, 'bias', o.GREATEST_LOWER_BOUND)); - if (0 <= r) { - var i = this._originalMappings[r]; - if (i.source === n.source) return { - line: d.getArg(i, 'generatedLine', null), - column: d.getArg(i, 'generatedColumn', null), - lastColumn: d.getArg(i, 'lastGeneratedColumn', null) - } + recordDivergingBranchBannerDismissal() { + return this.statsStore.recordDivergingBranchBannerDismissal() } - return { - line: null, - column: null, - lastColumn: null + recordDivergingBranchBannerInitiatedCompare() { + return this.statsStore.recordDivergingBranchBannerInitiatedCompare() } - }, t.BasicSourceMapConsumer = r, i.prototype = Object.create(o.prototype), i.prototype.constructor = o, i.prototype._version = 3, Object.defineProperty(i.prototype, 'sources', { - get: function () { - for (var e = [], t = 0; t < this._sections.length; t++) - for (var n = 0; n < this._sections[t].consumer.sources.length; n++) e.push(this._sections[t].consumer.sources[n]); - return e + recordDivergingBranchBannerInfluencedMerge() { + return this.statsStore.recordDivergingBranchBannerInfluencedMerge() } - }), i.prototype.originalPositionFor = function (e) { - var t = { - generatedLine: d.getArg(e, 'line'), - generatedColumn: d.getArg(e, 'column') - }, - n = s.search(t, this._sections, function (e, t) { - var n = e.generatedLine - t.generatedOffset.generatedLine; - return n ? n : e.generatedColumn - t.generatedOffset.generatedColumn - }), - o = this._sections[n]; - return o ? o.consumer.originalPositionFor({ - line: t.generatedLine - (o.generatedOffset.generatedLine - 1), - column: t.generatedColumn - (o.generatedOffset.generatedLine === t.generatedLine ? o.generatedOffset.generatedColumn - 1 : 0), - bias: e.bias - }) : { - source: null, - line: null, - column: null, - name: null + recordDivergingBranchBannerInitatedMerge() { + return this.statsStore.recordDivergingBranchBannerInitatedMerge() + } + recordCreatePullRequest() { + return this.statsStore.recordCreatePullRequest() + } + recordWelcomeWizardInitiated() { + return this.statsStore.recordWelcomeWizardInitiated() + } + recordCreateRepository() { + this.statsStore.recordCreateRepository() + } + recordAddExistingRepository() { + this.statsStore.recordAddExistingRepository() + } + recordMergeConflictsDialogDismissal() { + this.statsStore.recordMergeConflictsDialogDismissal() + } + recordMergeConflictsDialogReopened() { + this.statsStore.recordMergeConflictsDialogReopened() + } + recordAnyConflictsLeftOnMergeConflictsDialogDismissal() { + this.statsStore.recordAnyConflictsLeftOnMergeConflictsDialogDismissal() + } + recordGuidedConflictedMergeCompletion() { + this.statsStore.recordGuidedConflictedMergeCompletion() + } + recordUnguidedConflictedMergeCompletion() { + this.statsStore.recordUnguidedConflictedMergeCompletion() + } + recordRebaseConflictsDialogDismissal() { + this.statsStore.recordRebaseConflictsDialogDismissal() + } + recordRebaseConflictsDialogReopened() { + this.statsStore.recordRebaseConflictsDialogReopened() + } + recordErrorWhenSwitchingBranchesWithUncommmittedChanges() { + return this.statsStore.recordErrorWhenSwitchingBranchesWithUncommmittedChanges() + } + refreshPullRequests(e) { + return this.appStore._refreshPullRequests(e) + } + tryGetCommitStatus(e, t) { + return this.commitStatusStore.tryGetStatus(e, t) + } + subscribeToCommitStatus(e, t, n) { + return this.commitStatusStore.subscribe(e, t, n) } - }, i.prototype.hasContentsOfAllSources = function () { - return this._sections.every(function (e) { - return e.consumer.hasContentsOfAllSources() - }) - }, i.prototype.sourceContentFor = function (e, t) { - for (var n = 0; n < this._sections.length; n++) { - var o = this._sections[n], - r = o.consumer.sourceContentFor(e, !0); - if (r) return r + createStashForCurrentBranch(e, t = !0) { + return this.appStore._createStashForCurrentBranch(e, t) } - if (t) return null; - throw new Error('"' + e + '" is not in the SourceMap.') - }, i.prototype.generatedPositionFor = function (e) { - for (var t = 0, n; t < this._sections.length; t++) - if (n = this._sections[t], -1 !== n.consumer.sources.indexOf(d.getArg(e, 'source'))) { - var o = n.consumer.generatedPositionFor(e); - if (o) { - var r = { - line: o.line + (n.generatedOffset.generatedLine - 1), - column: o.column + (n.generatedOffset.generatedLine === o.line ? n.generatedOffset.generatedColumn - 1 : 0) - }; - return r - } - } return { - line: null, - column: null + dropStash(e, t) { + return this.appStore._dropStashEntry(e, t) } - }, i.prototype._parseMappings = function () { - this.__generatedMappings = [], this.__originalMappings = []; - for (var e = 0; e < this._sections.length; e++) - for (var t = this._sections[e], n = t.consumer._generatedMappings, o = 0; o < n.length; o++) { - var r = n[o], - i = t.consumer._sources.at(r.source); - null !== t.consumer.sourceRoot && (i = d.join(t.consumer.sourceRoot, i)), this._sources.add(i), i = this._sources.indexOf(i); - var a = t.consumer._names.at(r.name); - this._names.add(a), a = this._names.indexOf(a); - var s = { - source: i, - generatedLine: r.generatedLine + (t.generatedOffset.generatedLine - 1), - generatedColumn: r.generatedColumn + (t.generatedOffset.generatedLine === r.generatedLine ? t.generatedOffset.generatedColumn - 1 : 0), - originalLine: r.originalLine, - originalColumn: r.originalColumn, - name: a - }; - this.__generatedMappings.push(s), 'number' == typeof s.originalLine && this.__originalMappings.push(s) - } - p(this.__generatedMappings, d.compareByGeneratedPositionsDeflated), p(this.__originalMappings, d.compareByOriginalPositions) - }, t.IndexedSourceMapConsumer = i -}, function (e, t, n) { - function o(e, t) { - var n = e.generatedLine, - o = t.generatedLine, - r = e.generatedColumn, - a = t.generatedColumn; - return o > n || o == n && a >= r || 0 >= i.compareByGeneratedPositionsInflated(e, t) - } - - function r() { - this._array = [], this._sorted = !0, this._last = { - generatedLine: -1, - generatedColumn: 0 + popStash(e, t) { + return this.appStore._popStashEntry(e, t) } - } - var i = n(108); - r.prototype.unsortedForEach = function (e, t) { - this._array.forEach(e, t) - }, r.prototype.add = function (e) { - o(this._last, e) ? (this._last = e, this._array.push(e)) : (this._sorted = !1, this._array.push(e)) - }, r.prototype.toArray = function () { - return this._sorted || (this._array.sort(i.compareByGeneratedPositionsInflated), this._sorted = !0), this._array - }, t.MappingList = r -}, function (e, t) { - var n = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/']; - t.encode = function (e) { - if (0 <= e && e < n.length) return n[e]; - throw new TypeError('Must be between 0 and 63: ' + e) - }, t.decode = function (e) { - var t = 65, - n = 97, - o = 48; - return t <= e && e <= 90 ? e - t : n <= e && e <= 122 ? e - n + 26 : o <= e && e <= 57 ? e - o + 52 : e == 43 ? 62 : e == 47 ? 63 : -1 - } -}, function (e, t, n) { - t.SourceMapGenerator = n(313).SourceMapGenerator, t.SourceMapConsumer = n(795).SourceMapConsumer, t.SourceNode = n(792).SourceNode -}, function (e, t, n) { - function o() { - return !('browser' !== w) || 'node' !== w && 'undefined' != typeof window && 'function' == typeof XMLHttpRequest && !(window.require && window.module && window.process && 'renderer' === window.process.type) - } - - function r() { - return 'object' == typeof process && null !== process && 'function' == typeof process.on - } - - function i(e) { - return function (t) { - for (var n = 0, o; n < e.length; n++) - if (o = e[n](t), o) return o; - return null + hideStashedChanges(e) { + return this.appStore._hideStashedChanges(e) } - } - - function a(e, t) { - if (!e) return t; - var n = S.dirname(e), - o = /^\w+:\/\/[^\/]*/.exec(n), - r = o ? o[0] : ''; - return r + S.resolve(n.slice(r.length), t) - } - - function s(e) { - var t; - if (o()) try { - var n = new XMLHttpRequest; - n.open('GET', e, !1), n.send(null), t = 4 === n.readyState ? n.responseText : null; - var r = n.getResponseHeader('SourceMap') || n.getResponseHeader('X-SourceMap'); - if (r) return r - } catch (t) {} - t = P(e); - for (var i = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg, a, s; s = i.exec(t);) a = s; - return a ? a[1] : null - } - - function d(e) { - var t = T[e.source]; - if (!t) { - var n = D(e.source); - n ? (t = T[e.source] = { - url: n.url, - map: new y(n.map) - }, t.map.sourcesContent && t.map.sources.forEach(function (e, n) { - var o = t.map.sourcesContent[n]; - if (o) { - var r = a(t.url, e); - k[r] = o - } - })) : t = T[e.source] = { - url: null, - map: null - } + recordSuggestedStepOpenInExternalEditor() { + return this.statsStore.recordSuggestedStepOpenInExternalEditor() } - if (t && t.map) { - var o = t.map.originalPositionFor(e); - if (null !== o.source) return o.source = a(t.url, o.source), o + recordSuggestedStepOpenWorkingDirectory() { + return this.statsStore.recordSuggestedStepOpenWorkingDirectory() } - return e - } - - function l(e) { - var t = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e); - if (t) { - var n = d({ - source: t[2], - line: +t[3], - column: t[4] - 1 - }); - return 'eval at ' + t[1] + ' (' + n.source + ':' + n.line + ':' + (n.column + 1) + ')' + recordSuggestedStepViewOnGitHub() { + return this.statsStore.recordSuggestedStepViewOnGitHub() } - return t = /^eval at ([^(]+) \((.+)\)$/.exec(e), t ? 'eval at ' + t[1] + ' (' + l(t[2]) + ')' : e - } - - function c() { - var e = '', - t; - if (this.isNative()) e = 'native'; - else { - t = this.getScriptNameOrSourceURL(), !t && this.isEval() && (e = this.getEvalOrigin(), e += ', '), e += t ? t : ''; - var n = this.getLineNumber(); - if (null != n) { - e += ':' + n; - var o = this.getColumnNumber(); - o && (e += ':' + o) - } + recordSuggestedStepPublishRepository() { + return this.statsStore.recordSuggestedStepPublishRepository() } - var r = '', - i = this.getFunctionName(), - a = !0, - s = this.isConstructor(), - d = !(this.isToplevel() || s); - if (d) { - var l = this.getTypeName(); - '[object Object]' === l && (l = 'null'); - var c = this.getMethodName(); - i ? (l && 0 != i.indexOf(l) && (r += l + '.'), r += i, c && i.indexOf('.' + c) != i.length - c.length - 1 && (r += ' [as ' + c + ']')) : r += l + '.' + (c || '') - } else s ? r += 'new ' + (i || '') : i ? r += i : (r += e, a = !1); - return a && (r += ' (' + e + ')'), r - } - - function p(e) { - var t = {}; - return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(function (n) { - t[n] = /^(?:is|get)/.test(n) ? function () { - return e[n].call(e) - } : e[n] - }), t.toString = c, t - } - - function u(e) { - if (e.isNative()) return e; - var t = e.getFileName() || e.getScriptNameOrSourceURL(); - if (t) { - var n = e.getLineNumber(), - r = e.getColumnNumber() - 1, - i = 62; - 1 !== n || !(r > i) || o() || e.isEval() || (r -= i); - var a = d({ - source: t, - line: n, - column: r - }); - return e = p(e), e.getFileName = function () { - return a.source - }, e.getLineNumber = function () { - return a.line - }, e.getColumnNumber = function () { - return a.column + 1 - }, e.getScriptNameOrSourceURL = function () { - return a.source - }, e + recordSuggestedStepPublishBranch() { + return this.statsStore.recordSuggestedStepPublishBranch() } - var s = e.isEval() && e.getEvalOrigin(); - return s ? (s = l(s), e = p(e), e.getEvalOrigin = function () { - return s - }, e) : e - } - - function m(e, t) { - return E && (k = {}, T = {}), e + t.map(function (e) { - return '\n at ' + u(e) - }).join('') - } - - function h(e) { - var t = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack); - if (t) { - var n = t[1], - o = +t[2], - r = +t[3], - i = k[n]; - if (!i && C && C.existsSync(n)) try { - i = C.readFileSync(n, 'utf8') - } catch (e) { - i = '' - } - if (i) { - var a = i.split(/(?:\r\n|\r|\n)/)[o - 1]; - if (a) return n + ':' + o + '\n' + a + '\n' + Array(r).join(' ') + '^' - } + recordSuggestedStepCreatePullRequest() { + return this.statsStore.recordSuggestedStepCreatePullRequest() } - return null - } - - function f(e) { - var t = h(e); - t && (console.error(), console.error(t)), console.error(e.stack), process.exit(1) - } - - function g() { - var e = process.emit; - process.emit = function (t) { - if ('uncaughtException' === t) { - var n = arguments[1] && arguments[1].stack, - o = 0 < this.listeners(t).length; - if (n && !o) return f(arguments[1]) - } - return e.apply(this, arguments) + recordSuggestedStepViewStash() { + return this.statsStore.recordSuggestedStepViewStash() } - } - var y = n(798).SourceMapConsumer, - S = n(1), - C; - try { - C = n(33), C.existsSync && C.readFileSync || (C = null) - } catch (e) {} - var b = !1, - v = !1, - E = !1, - w = 'auto', - k = {}, - T = {}, - _ = /^data:application\/json[^,]+base64,/, - R = [], - x = [], - P = i(R); - R.push(function (e) { - if (e = e.trim(), e in k) return k[e]; - var t = null; - if (!C) { - var n = new XMLHttpRequest; - n.open('GET', e, !1), n.send(null); - var t = null; - 4 === n.readyState && 200 === n.status && (t = n.responseText) - } else if (C.existsSync(e)) try { - t = C.readFileSync(e, 'utf8') - } catch (e) { - t = '' + async moveChangesToBranchAndCheckout(e, t) { + return this.appStore._moveChangesToBranchAndCheckout(e, t) } - return k[e] = t - }); - var D = i(x); - x.push(function (e) { - var t = s(e); - if (!t) return null; - var n; - if (_.test(t)) { - var o = t.slice(t.indexOf(',') + 1); - n = new Buffer(o, 'base64').toString(), t = e - } else t = a(e, t), n = P(t); - return n ? { - url: t, - map: n - } : null - }), t.wrapCallSite = u, t.getErrorSource = h, t.mapSourcePosition = d, t.retrieveSourceMap = D, t.install = function (e) { - if (e = e || {}, e.environment && (w = e.environment, -1 === ['node', 'browser', 'auto'].indexOf(w))) throw new Error('environment ' + w + ' was unknown. Available options are {auto, browser, node}'); - if (e.retrieveFile && (e.overrideRetrieveFile && (R.length = 0), R.unshift(e.retrieveFile)), e.retrieveSourceMap && (e.overrideRetrieveSourceMap && (x.length = 0), x.unshift(e.retrieveSourceMap)), e.hookRequire && !o()) { - var t; - try { - t = n(791) - } catch (e) {} - var i = t.prototype._compile; - i.__sourceMapSupport || (t.prototype._compile = function (e, t) { - return k[t] = e, T[t] = void 0, i.call(this, e, t) - }, t.prototype._compile.__sourceMapSupport = !0) + recordNoActionTakenOnStash() { + return this.statsStore.recordNoActionTakenOnStash() } - if (E || (E = !!('emptyCacheBetweenOperations' in e) && e.emptyCacheBetweenOperations), b || (b = !0, Error.prepareStackTrace = m), !v) { - var a = !('handleUncaughtExceptions' in e) || e.handleUncaughtExceptions; - a && r() && (v = !0, g()) + recordStashView() { + return this.statsStore.recordStashView() } - } -}, function (e, t, n) { - var o = n(1).sep || '/'; - e.exports = function (e) { - if ('string' != typeof e || 7 >= e.length || 'file://' != e.substring(0, 7)) throw new TypeError('must pass in a file:// URI to convert to a file path'); - var t = unescape(e.substring(7)), - n = t.indexOf('/'), - r = t.substring(0, n), - i = t.substring(n + 1); - return 'localhost' == r && (r = ''), r && (r = o + o + r), i = i.replace(/^(.+)\|/, '$1:'), '\\' == o && (i = i.replace(/\//g, '\\')), /^.+\:/.test(i) || (i = o + i), r + i - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(314); - t.formatError = function (e, t) { - return e = o.withSourceMappedStack(e), e.stack ? t ? `${t}\n${e.stack}` : e.stack.trim() : t ? `${t}\n${e.name}: ${e.message}` : `${e.name}: ${e.message}` - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const o = n(801); - t.formatLogMessage = function (e, t) { - return t ? o.formatError(t, e) : e - } -}, function (e, t, n) { - 'use strict'; - - function o(e, t, n) { - r.ipcRenderer.send('log', e, i.formatLogMessage(`[${'ui'}] ${t}`, n)) - } - Object.defineProperty(t, '__esModule', { - value: !0 - }); - const r = n(22), - i = n(802), - a = global; - a.log = { - error(e, t) { - o('error', e, t), console.error(i.formatLogMessage(e, t)) - }, - warn(e, t) { - o('warn', e, t), console.warn(i.formatLogMessage(e, t)) - }, - info(e, t) { - o('info', e, t), console.info(i.formatLogMessage(e, t)) - }, - debug(e, t) { - o('debug', e, t), console.debug(i.formatLogMessage(e, t)) + skipPickEditorTutorialStep(e) { + return this.appStore._skipPickEditorTutorialStep(e) } - } -}, function (e, t, n) { - 'use strict'; - Object.defineProperty(t, '__esModule', { - value: !0 - }), n(803); - const o = n(0), - r = n(43), - i = n(1), - a = n(57), - s = n(22), - d = n(310), - l = n(342), - c = n(72), - p = n(184), - u = n(28), - m = n(86), - h = n(184), - f = n(335), - g = n(334), - y = n(27), - S = n(134), - C = n(86), - b = n(314), - v = n(333), - E = n(332), - w = n(331), - k = n(330), - T = n(234); - !1, f.shellNeedsPatching(process) && f.updateEnvironmentForProcess(), b.enableSourceMaps(), process.env.LOCAL_GIT_DIRECTORY = i.resolve(__dirname, 'git'), n(326); - const _ = n(325); - _(a); - const R = performance.now(); - n(324); - let x = null, - P = null, - D = null; - const M = (e, t = {}, n) => { - e = b.withSourceMappedStack(e), console.error('Uncaught exception', e); { - const o = Object.assign({ - osVersion: S.getOS(), - guid: C.getGUID() - }, t); - try { - x && (null !== x.currentBanner && (o.currentBanner = x.currentBanner.type), null !== x.currentPopup && (o.currentPopup = `${x.currentPopup.type}`), null !== x.selectedState && (o.selectedState = `${x.selectedState.type}`, x.selectedState.type === u.SelectionType.Repository && (o.selectedRepositorySection = `${x.selectedState.state.selectedSection}`)), null !== x.currentFoldout && (o.currentFoldout = `${x.currentFoldout.type}`), x.showWelcomeFlow && (o.inWelcomeFlow = 'true'), 1 !== x.windowZoomFactor && (o.windowZoomFactor = `${x.windowZoomFactor}`), 0 < x.errors.length && (o.activeAppErrors = `${x.errors.length}`), null != P && null != D && (o.lastUnhandledRejection = P, o.lastUnhandledRejectionTime = D.toString()), o.repositoryCount = `${x.repositories.length}`, o.windowState = x.windowState, o.accounts = `${x.accounts.length}`, !1) - } catch (e) {} - y.sendErrorReport(e, o, n) + markPullRequestTutorialStepAsComplete(e) { + return this.appStore._markPullRequestTutorialStepAsComplete(e) } - }; - process.once('uncaughtException', (e) => { - M(e), y.reportUncaughtException(e) - }), process.on('send-non-fatal-exception', (e, t) => { - M(e, t, !0) - }), window.addEventListener('unhandledrejection', (e) => { - if (null !== e.reason && e.reason !== void 0) try { - P = `${e.reason}`, D = new Date - } catch (e) {} - }); - const A = new c.GitHubUserStore(new p.GitHubUserDatabase('GitHubUserDatabase')), - I = new c.CloningRepositoriesStore, - L = new c.IssuesStore(new h.IssuesDatabase('IssuesDatabase')), - F = new m.StatsStore(new m.StatsDatabase('StatsDatabase'), new v.UiActivityMonitor()), - B = new c.SignInStore, - N = new c.AccountsStore(localStorage, c.TokenStore), - O = new c.RepositoriesStore(new h.RepositoriesDatabase('Database')), - H = new c.PullRequestStore(new h.PullRequestDatabase('PullRequestDatabase'), O), - z = new T.PullRequestCoordinator(H, O), - U = new E.RepositoryStateCache((e) => A.getUsersForRepository(e)), - W = new w.ApiRepositoriesStore(N), - V = new k.CommitStatusStore(N), - G = new c.AppStore(A, I, L, F, B, N, O, z, U, W); - G.onDidUpdate((e) => { - x = e - }); - const K = new l.Dispatcher(G, U, F, V); - K.registerErrorHandler(l.defaultErrorHandler), K.registerErrorHandler(l.upstreamAlreadyExistsHandler), K.registerErrorHandler(l.externalEditorErrorHandler), K.registerErrorHandler(l.openShellErrorHandler), K.registerErrorHandler(l.mergeConflictHandler), K.registerErrorHandler(l.lfsAttributeMismatchHandler), K.registerErrorHandler(l.insufficientGitHubRepoPermissions), K.registerErrorHandler(l.schannelUnableToCheckRevocationForCertificate), K.registerErrorHandler(l.gitAuthenticationErrorHandler), K.registerErrorHandler(l.pushNeedsPullHandler), K.registerErrorHandler(l.samlReauthRequired), K.registerErrorHandler(l.backgroundTaskHandler), K.registerErrorHandler(l.missingRepositoryHandler), K.registerErrorHandler(l.localChangesOverwrittenHandler), K.registerErrorHandler(l.rebaseConflictsHandler), K.registerErrorHandler(l.refusedWorkflowUpdate), document.body.classList.add(`platform-${'win32'}`), K.setAppFocusState(s.remote.getCurrentWindow().isFocused()), s.ipcRenderer.on('focus', () => { + recordForkCreated() { + return this.statsStore.recordForkCreated() + } + createTutorialRepository(e) { + return this.appStore._createTutorialRepository(e) + } + async openIssueCreationPage(e) { + const t = no(e); + return null !== t && (this.statsStore.recordIssueCreationWebpageOpened(), this.appStore._openInBrowser(t + "/issues/new/choose")) + } + }(jb, Ub, Lb, Vb); + Gb.registerErrorHandler((async function (e, t) { + const n = ab(e) || e; + return await t.presentError(n), null + })), Gb.registerErrorHandler((async function (e, t) { + return e instanceof Bc ? (t.showPopup({ + type: Zi.UpstreamAlreadyExists, + repository: e.repository, + existingRemote: e.existingRemote + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = function (e) { + return e instanceof Eo ? e : null + }(e); + if (!n) return e; + const { + suggestAtom: r, + openPreferences: i + } = n.metadata; + return await t.showPopup({ + type: Zi.ExternalEditorFailed, + message: n.message, + suggestAtom: r, + openPreferences: i + }), null + })), Gb.registerErrorHandler((async function (e, t) { + return e instanceof uc ? (await t.showPopup({ + type: Zi.OpenShellFailed, + message: e.message + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (i !== Ao.GitError.MergeConflicts) return e; + const { + repository: o, + gitContext: s + } = n.metadata; + if (null == o) return e; + if (!(o instanceof Xi)) return e; + if (null == s) return e; + if ("merge" !== s.kind && "pull" !== s.kind) return e; + switch (s.kind) { + case "pull": + t.mergeConflictDetectedFromPull(); + break; + case "merge": + t.mergeConflictDetectedFromExplicitMerge() + } + const { + currentBranch: a, + theirBranch: l + } = s; + return t.showPopup({ + type: Zi.MergeConflicts, + repository: o, + ourBranch: a, + theirBranch: l + }), null + })), Gb.registerErrorHandler((async function (e, t) { + const n = lb(e); + if (!n) return e; + const r = n.result.gitError; + return r ? r !== Ao.GitError.LFSAttributeDoesNotMatch ? e : (t.showPopup({ + type: Zi.LFSAttributeMismatch + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r || null === r.result.gitError) return e; + if (!Ho(r.result.gitError)) return e; + const { + repository: i, + retryAction: o + } = n.metadata; + return i instanceof Xi && Ji(i) ? void 0 === o || o.type !== rc.Push || ji(i.gitHubRepository) ? e : (t.showCreateForkDialog(i), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e), + r = lb(null === n ? e : n.underlyingError); + if (null === r) return e; + const i = hb.exec(r.message); + return i ? (_u("schannelUnableToCheckRevocationForCertificate", e), t.showPopup({ + type: Zi.SChannelNoRevocationCheck, + url: i[1] + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (!js.has(i)) return e; + const o = n.metadata.repository; + if (!o) return e; + if (o instanceof Xi && o.gitHubRepository) return e; + const s = n.metadata.retryAction; + return s ? (await t.promptForGenericGitAuthentication(o, s), null) : (log.error("No retry action provided for a git authentication error.", n), e) + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (i !== Ao.GitError.PushNotFastForward) return e; + const o = n.metadata.repository; + return o && o instanceof Xi ? (t.showPopup({ + type: Zi.PushNeedsPull, + repository: o + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r || null === r.result.gitError) return e; + if (!Ho(r.result.gitError)) return e; + const { + repository: i + } = n.metadata; + if (!(i instanceof Xi)) return e; + if (null === i.gitHubRepository) return e; + const o = r.result.stderr.split(/\r?\n/).filter(e => e.startsWith("remote: ")).map(e => e.substr("remote: ".length)).join("\n"), + s = ub.exec(o); + if (!s) return e; + const a = s[1], + l = i.gitHubRepository.endpoint; + return t.showPopup({ + type: Zi.SAMLReauthRequired, + organizationName: a, + endpoint: l, + retryAction: n.metadata.retryAction + }), null + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + return n && n.metadata.backgroundTask ? null : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = n.metadata.repository; + if (!(r && r instanceof Xi)) return e; + if (r.missing) return null; + const i = sb(n.underlyingError), + o = lb(n.underlyingError); + return o && o.result.gitError === Ao.GitError.NotAGitRepository || i && i.code === Ao.RepositoryDoesNotExistErrorCode ? (await t.updateRepositoryMissing(r, !0), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (null === n) return e; + const r = lb(n.underlyingError); + if (null === r) return e; + const i = r.result.gitError; + if (null === i) return e; + if (i !== Ao.GitError.LocalChangesOverwritten && i !== Ao.GitError.MergeWithLocalChanges && i !== Ao.GitError.RebaseWithLocalChanges) return e; + const { + repository: o + } = n.metadata; + return o instanceof Xi ? void 0 === n.metadata.retryAction ? e : (t.showPopup({ + type: Zi.LocalChangesOverwritten, + repository: o, + retryAction: n.metadata.retryAction + }), null) : e + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (i !== Ao.GitError.LocalChangesOverwritten) return e; + const { + repository: o, + gitContext: s + } = n.metadata; + if (null == o) return e; + if (!(o instanceof Xi)) return e; + if (void 0 === s || "checkout" !== s.kind) return t.recordErrorWhenSwitchingBranchesWithUncommmittedChanges(), e; + const { + branchToCheckout: a + } = s; + return await t.moveChangesToBranchAndCheckout(o, a), null + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + const r = lb(n.underlyingError); + if (!r) return e; + const i = r.result.gitError; + if (!i) return e; + if (i !== Ao.GitError.RebaseConflicts) return e; + const { + repository: o, + gitContext: s + } = n.metadata; + if (null == o) return e; + if (!(o instanceof Xi)) return e; + if (null == s) return e; + if ("merge" !== s.kind && "pull" !== s.kind) return e; + const { + currentBranch: a + } = s; + return t.launchRebaseFlow(o, a), null + })), Gb.registerErrorHandler((async function (e, t) { + const n = ab(e); + if (!n) return e; + if (!lb(n.underlyingError)) return e; + const { + repository: r + } = n.metadata; + if (!(r instanceof Xi)) return e; + if (null === r.gitHubRepository) return e; + if (r.gitHubRepository.endpoint !== pt()) return e; + const i = cb.exec(e.message); + return i ? (t.showPopup({ + type: Zi.PushRejectedDueToMissingWorkflowScope, + rejectedPath: i[1], + repository: r + }), null) : e + })), document.body.classList.add("platform-win32"), Gb.setAppFocusState(r.remote.getCurrentWindow().isFocused()), r.ipcRenderer.on("focus", () => { const { selectedState: e - } = G.getState(); - e && e.type !== u.SelectionType.CloningRepository && K.refreshRepository(e.repository), K.setAppFocusState(!0) - }), s.ipcRenderer.on('blur', () => { - K.setAccessKeyHighlightState(!1), K.setAppFocusState(!1) - }), s.ipcRenderer.on('url-action', (e, { + } = jb.getState(); + e && e.type !== W.CloningRepository && Gb.refreshRepository(e.repository), Gb.setAppFocusState(!0) + }), r.ipcRenderer.on("blur", () => { + Gb.setAccessKeyHighlightState(!1), Gb.setAppFocusState(!1) + }), r.ipcRenderer.on("url-action", (e, { action: t }) => { - K.dispatchURLAction(t) - }), r.render(o.createElement(d.App, { - dispatcher: K, - appStore: G, - repositoryStateManager: U, - issuesStore: L, - gitHubUserStore: A, - startTime: R - }), document.getElementById('desktop-app-container')) + Gb.dispatchURLAction(t) + }), S.render(w.createElement(rb, { + dispatcher: Gb, + appStore: jb, + repositoryStateManager: Ub, + issuesStore: Ob, + gitHubUserStore: Pb, + startTime: Rb + }), document.getElementById("desktop-app-container")) }]); //# sourceMappingURL=renderer.js.map \ No newline at end of file