You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

674 lines
508 KiB

1 year ago
/*!
* https://github.com/paulmillr/es6-shim
* @license es6-shim Copyright 2013-2016 by Paul Miller (http://paulmillr.com)
* and contributors, MIT License
* es6-shim: v0.35.4
* see https://github.com/paulmillr/es6-shim/blob/0.35.3/LICENSE
* Details and documentation:
* https://github.com/paulmillr/es6-shim/
*/
(function (e, t) { if (typeof define === "function" && define.amd) { define(t) } else if (typeof exports === "object") { module.exports = t() } else { e.returnExports = t() } })(this, function () {
"use strict"; var e = Function.call.bind(Function.apply); var t = Function.call.bind(Function.call); var r = Array.isArray; var n = Object.keys; var o = function notThunker(t) { return function notThunk() { return !e(t, this, arguments) } }; var i = function (e) { try { e(); return false } catch (t) { return true } }; var a = function valueOrFalseIfThrows(e) { try { return e() } catch (t) { return false } }; var u = o(i); var f = function () { return !i(function () { return Object.defineProperty({}, "x", { get: function () { } }) }) }; var s = !!Object.defineProperty && f(); var c = function foo() { }.name === "foo"; var l = Function.call.bind(Array.prototype.forEach); var p = Function.call.bind(Array.prototype.reduce); var v = Function.call.bind(Array.prototype.filter); var y = Function.call.bind(Array.prototype.some); var h = function (e, t, r, n) { if (!n && t in e) { return } if (s) { Object.defineProperty(e, t, { configurable: true, enumerable: false, writable: true, value: r }) } else { e[t] = r } }; var b = function (e, t, r) { l(n(t), function (n) { var o = t[n]; h(e, n, o, !!r) }) }; var g = Function.call.bind(Object.prototype.toString); var d = typeof /abc/ === "function" ? function IsCallableSlow(e) { return typeof e === "function" && g(e) === "[object Function]" } : function IsCallableFast(e) { return typeof e === "function" }; var m = { getter: function (e, t, r) { if (!s) { throw new TypeError("getters require true ES5 support") } Object.defineProperty(e, t, { configurable: true, enumerable: false, get: r }) }, proxy: function (e, t, r) { if (!s) { throw new TypeError("getters require true ES5 support") } var n = Object.getOwnPropertyDescriptor(e, t); Object.defineProperty(r, t, { configurable: n.configurable, enumerable: n.enumerable, get: function getKey() { return e[t] }, set: function setKey(r) { e[t] = r } }) }, redefine: function (e, t, r) { if (s) { var n = Object.getOwnPropertyDescriptor(e, t); n.value = r; Object.defineProperty(e, t, n) } else { e[t] = r } }, defineByDescriptor: function (e, t, r) { if (s) { Object.defineProperty(e, t, r) } else if ("value" in r) { e[t] = r.value } }, preserveToString: function (e, t) { if (t && d(t.toString)) { h(e, "toString", t.toString.bind(t), true) } } }; var O = Object.create || function (e, t) { var r = function Prototype() { }; r.prototype = e; var o = new r; if (typeof t !== "undefined") { n(t).forEach(function (e) { m.defineByDescriptor(o, e, t[e]) }) } return o }; var w = function (e, t) { if (!Object.setPrototypeOf) { return false } return a(function () { var r = function Subclass(t) { var r = new e(t); Object.setPrototypeOf(r, Subclass.prototype); return r }; Object.setPrototypeOf(r, e); r.prototype = O(e.prototype, { constructor: { value: r } }); return t(r) }) }; var j = function () { if (typeof self !== "undefined") { return self } if (typeof window !== "undefined") { return window } if (typeof global !== "undefined") { return global } throw new Error("unable to locate global object") }; var S = j(); var T = S.isFinite; var I = Function.call.bind(String.prototype.indexOf); var E = Function.apply.bind(Array.prototype.indexOf); var P = Function.call.bind(Array.prototype.concat); var C = Function.call.bind(String.prototype.slice); var M = Function.call.bind(Array.prototype.push); var x = Function.apply.bind(Array.prototype.push); var N = Function.call.bind(Array.prototype.shift); var A = Math.max; var R = Math.min; var _ = Math.floor; var k = Math.abs; var L = Math.exp; var F = Math.log; var D = Math.sqrt; var z = Function.call.bind(Object.prototype.hasOwnProperty); var q; var W = function () { }; var G = S.Map; var H = G && G.prototype["delete"]; var V = G && G.prototype.get; var B = G && G.prototype.has; var U = G && G.prototype.set; var $ = S.Symbol || {}; var J = $.species || "@@species"; var X = Number.isNaN || function isNaN(e) { return e !== e }; var K = Number.isFinite || function isFinite(e) { return typeof e === "number" && T(e) }; var Z = d(Math.sign) ? Math.sign : function sign(e) { var t = Number(e); if (t === 0) { return t } if (X(t
h(Math, "acosh", Cr.acosh, Math.acosh(Number.MAX_VALUE) === Infinity); h(Math, "acosh", Cr.acosh, !Mr(Math.acosh(1 + Number.EPSILON), Math.sqrt(2 * Number.EPSILON))); h(Math, "cbrt", Cr.cbrt, !Mr(Math.cbrt(1e-300), 1e-100)); h(Math, "sinh", Cr.sinh, Math.sinh(-2e-17) !== -2e-17); var xr = Math.expm1(10); h(Math, "expm1", Cr.expm1, xr > 22025.465794806718 || xr < 22025.465794806718); var Nr = Math.round; var Ar = Math.round(.5 - Number.EPSILON / 4) === 0 && Math.round(-.5 + Number.EPSILON / 3.99) === 1; var Rr = mr + 1; var _r = 2 * mr - 1; var kr = [Rr, _r].every(function (e) { return Math.round(e) === e }); h(Math, "round", function round(e) { var t = _(e); var r = t === -1 ? -0 : t + 1; return e - t < .5 ? t : r }, !Ar || !kr); m.preserveToString(Math.round, Nr); var Lr = Math.imul; if (Math.imul(4294967295, 5) !== -5) { Math.imul = Cr.imul; m.preserveToString(Math.imul, Lr) } if (Math.imul.length !== 2) { ne(Math, "imul", function imul(e, t) { return ce.Call(Lr, Math, arguments) }) } var Fr = function () { var e = S.setTimeout; if (typeof e !== "function" && typeof e !== "object") { return } ce.IsPromise = function (e) { if (!ce.TypeIsObject(e)) { return false } if (typeof e._promise === "undefined") { return false } return true }; var r = function (e) { if (!ce.IsConstructor(e)) { throw new TypeError("Bad promise constructor") } var t = this; var r = function (e, r) { if (t.resolve !== void 0 || t.reject !== void 0) { throw new TypeError("Bad Promise implementation!") } t.resolve = e; t.reject = r }; t.resolve = void 0; t.reject = void 0; t.promise = new e(r); if (!(ce.IsCallable(t.resolve) && ce.IsCallable(t.reject))) { throw new TypeError("Bad promise constructor") } }; var n; if (typeof window !== "undefined" && ce.IsCallable(window.postMessage)) { n = function () { var e = []; var t = "zero-timeout-message"; var r = function (r) { M(e, r); window.postMessage(t, "*") }; var n = function (r) { if (r.source === window && r.data === t) { r.stopPropagation(); if (e.length === 0) { return } var n = N(e); n() } }; window.addEventListener("message", n, true); return r } } var o = function () { var e = S.Promise; var t = e && e.resolve && e.resolve(); return t && function (e) { return t.then(e) } }; var i = ce.IsCallable(S.setImmediate) ? S.setImmediate : typeof process === "object" && process.nextTick ? process.nextTick : o() || (ce.IsCallable(n) ? n() : function (t) { e(t, 0) }); var a = function (e) { return e }; var u = function (e) { throw e }; var f = 0; var s = 1; var c = 2; var l = 0; var p = 1; var v = 2; var y = {}; var h = function (e, t, r) { i(function () { g(e, t, r) }) }; var g = function (e, t, r) { var n, o; if (t === y) { return e(r) } try { n = e(r); o = t.resolve } catch (i) { n = i; o = t.reject } o(n) }; var d = function (e, t) { var r = e._promise; var n = r.reactionLength; if (n > 0) { h(r.fulfillReactionHandler0, r.reactionCapability0, t); r.fulfillReactionHandler0 = void 0; r.rejectReactions0 = void 0; r.reactionCapability0 = void 0; if (n > 1) { for (var o = 1, i = 0; o < n; o++, i += 3) { h(r[i + l], r[i + v], t); e[i + l] = void 0; e[i + p] = void 0; e[i + v] = void 0 } } } r.result = t; r.state = s; r.reactionLength = 0 }; var m = function (e, t) { var r = e._promise; var n = r.reactionLength; if (n > 0) { h(r.rejectReactionHandler0, r.reactionCapability0, t); r.fulfillReactionHandler0 = void 0; r.rejectReactions0 = void 0; r.reactionCapability0 = void 0; if (n > 1) { for (var o = 1, i = 0; o < n; o++, i += 3) { h(r[i + p], r[i + v], t); e[i + l] = void 0; e[i + p] = void 0; e[i + v] = void 0 } } } r.result = t; r.state = c; r.reactionLength = 0 }; var O = function (e) { var t = false; var r = function (r) { var n; if (t) { return } t = true; if (r === e) { return m(e, new TypeError("Self resolution")) } if (!ce.TypeIsObject(r)) { return d(e, r) } try { n = r.then } catch (o) { return m(e, o) } if (!ce.IsCallable(n)) { return d(e, r) } i(function () { j(e, r, n) }) }; var n = function (r) { if (t) { return } t = true; return m(e, r) }; return { resolve: r, reject: n } }; var w = function
});
//# sourceMappingURL=es6-shim.map
/*! jQuery v1.8.3 jquery.com | jquery.org/license */
(function (e, t) { function _(e) { var t = M[e] = {}; return v.each(e.split(y), function (e, n) { t[n] = !0 }), t } function H(e, n, r) { if (r === t && e.nodeType === 1) { var i = "data-" + n.replace(P, "-$1").toLowerCase(); r = e.getAttribute(i); if (typeof r == "string") { try { r = r === "true" ? !0 : r === "false" ? !1 : r === "null" ? null : +r + "" === r ? +r : D.test(r) ? v.parseJSON(r) : r } catch (s) { } v.data(e, n, r) } else r = t } return r } function B(e) { var t; for (t in e) { if (t === "data" && v.isEmptyObject(e[t])) continue; if (t !== "toJSON") return !1 } return !0 } function et() { return !1 } function tt() { return !0 } function ut(e) { return !e || !e.parentNode || e.parentNode.nodeType === 11 } function at(e, t) { do e = e[t]; while (e && e.nodeType !== 1); return e } function ft(e, t, n) { t = t || 0; if (v.isFunction(t)) return v.grep(e, function (e, r) { var i = !!t.call(e, r, e); return i === n }); if (t.nodeType) return v.grep(e, function (e, r) { return e === t === n }); if (typeof t == "string") { var r = v.grep(e, function (e) { return e.nodeType === 1 }); if (it.test(t)) return v.filter(t, r, !n); t = v.filter(t, r) } return v.grep(e, function (e, r) { return v.inArray(e, t) >= 0 === n }) } function lt(e) { var t = ct.split("|"), n = e.createDocumentFragment(); if (n.createElement) while (t.length) n.createElement(t.pop()); return n } function Lt(e, t) { return e.getElementsByTagName(t)[0] || e.appendChild(e.ownerDocument.createElement(t)) } function At(e, t) { if (t.nodeType !== 1 || !v.hasData(e)) return; var n, r, i, s = v._data(e), o = v._data(t, s), u = s.events; if (u) { delete o.handle, o.events = {}; for (n in u) for (r = 0, i = u[n].length; r < i; r++)v.event.add(t, n, u[n][r]) } o.data && (o.data = v.extend({}, o.data)) } function Ot(e, t) { var n; if (t.nodeType !== 1) return; t.clearAttributes && t.clearAttributes(), t.mergeAttributes && t.mergeAttributes(e), n = t.nodeName.toLowerCase(), n === "object" ? (t.parentNode && (t.outerHTML = e.outerHTML), v.support.html5Clone && e.innerHTML && !v.trim(t.innerHTML) && (t.innerHTML = e.innerHTML)) : n === "input" && Et.test(e.type) ? (t.defaultChecked = t.checked = e.checked, t.value !== e.value && (t.value = e.value)) : n === "option" ? t.selected = e.defaultSelected : n === "input" || n === "textarea" ? t.defaultValue = e.defaultValue : n === "script" && t.text !== e.text && (t.text = e.text), t.removeAttribute(v.expando) } function Mt(e) { return typeof e.getElementsByTagName != "undefined" ? e.getElementsByTagName("*") : typeof e.querySelectorAll != "undefined" ? e.querySelectorAll("*") : [] } function _t(e) { Et.test(e.type) && (e.defaultChecked = e.checked) } function Qt(e, t) { if (t in e) return t; var n = t.charAt(0).toUpperCase() + t.slice(1), r = t, i = Jt.length; while (i--) { t = Jt[i] + n; if (t in e) return t } return r } function Gt(e, t) { return e = t || e, v.css(e, "display") === "none" || !v.contains(e.ownerDocument, e) } function Yt(e, t) { var n, r, i = [], s = 0, o = e.length; for (; s < o; s++) { n = e[s]; if (!n.style) continue; i[s] = v._data(n, "olddisplay"), t ? (!i[s] && n.style.display === "none" && (n.style.display = ""), n.style.display === "" && Gt(n) && (i[s] = v._data(n, "olddisplay", nn(n.nodeName)))) : (r = Dt(n, "display"), !i[s] && r !== "none" && v._data(n, "olddisplay", r)) } for (s = 0; s < o; s++) { n = e[s]; if (!n.style) continue; if (!t || n.style.display === "none" || n.style.display === "") n.style.display = t ? i[s] || "" : "none" } return e } function Zt(e, t, n) { var r = Rt.exec(t); return r ? Math.max(0, r[1] - (n || 0)) + (r[2] || "px") : t } function en(e, t, n, r) { var i = n === (r ? "border" : "content") ? 4 : t === "width" ? 1 : 0, s = 0; for (; i < 4; i += 2)n === "margin" && (s += v.css(e, n + $t[i], !0)), r ? (n === "content" && (s -= parseFloat(Dt(e, "padding" + $t[i])) || 0), n !== "margin" && (s -= parseFloat(Dt(e, "border" + $t[i] + "Width")) || 0)) : (s += parseFloat(Dt(e, "padding" + $t[i])) || 0, n !== "padding" && (s += parseFloat(Dt(e, "border" + $t[i] + "Width"
// Underscore.js 1.8.2
// http://underscorejs.org
// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function () { function n(n) { function t(t, r, e, u, i, o) { for (; i >= 0 && o > i; i += n) { var a = u ? u[i] : i; e = r(e, t[a], a, t) } return e } return function (r, e, u, i) { e = d(e, i, 4); var o = !w(r) && m.keys(r), a = (o || r).length, c = n > 0 ? 0 : a - 1; return arguments.length < 3 && (u = r[o ? o[c] : c], c += n), t(r, e, u, o, c, a) } } function t(n) { return function (t, r, e) { r = b(r, e); for (var u = null != t && t.length, i = n > 0 ? 0 : u - 1; i >= 0 && u > i; i += n)if (r(t[i], i, t)) return i; return -1 } } function r(n, t) { var r = S.length, e = n.constructor, u = m.isFunction(e) && e.prototype || o, i = "constructor"; for (m.has(n, i) && !m.contains(t, i) && t.push(i); r--;)i = S[r], i in n && n[i] !== u[i] && !m.contains(t, i) && t.push(i) } var e = this, u = e._, i = Array.prototype, o = Object.prototype, a = Function.prototype, c = i.push, l = i.slice, f = o.toString, s = o.hasOwnProperty, p = Array.isArray, h = Object.keys, v = a.bind, g = Object.create, y = function () { }, m = function (n) { return n instanceof m ? n : this instanceof m ? void (this._wrapped = n) : new m(n) }; "undefined" != typeof exports ? ("undefined" != typeof module && module.exports && (exports = module.exports = m), exports._ = m) : e._ = m, m.VERSION = "1.8.2"; var d = function (n, t, r) { if (t === void 0) return n; switch (null == r ? 3 : r) { case 1: return function (r) { return n.call(t, r) }; case 2: return function (r, e) { return n.call(t, r, e) }; case 3: return function (r, e, u) { return n.call(t, r, e, u) }; case 4: return function (r, e, u, i) { return n.call(t, r, e, u, i) } }return function () { return n.apply(t, arguments) } }, b = function (n, t, r) { return null == n ? m.identity : m.isFunction(n) ? d(n, t, r) : m.isObject(n) ? m.matcher(n) : m.property(n) }; m.iteratee = function (n, t) { return b(n, t, 1 / 0) }; var x = function (n, t) { return function (r) { var e = arguments.length; if (2 > e || null == r) return r; for (var u = 1; e > u; u++)for (var i = arguments[u], o = n(i), a = o.length, c = 0; a > c; c++) { var l = o[c]; t && r[l] !== void 0 || (r[l] = i[l]) } return r } }, _ = function (n) { if (!m.isObject(n)) return {}; if (g) return g(n); y.prototype = n; var t = new y; return y.prototype = null, t }, j = Math.pow(2, 53) - 1, w = function (n) { var t = n && n.length; return "number" == typeof t && t >= 0 && j >= t }; m.each = m.forEach = function (n, t, r) { t = d(t, r); var e, u; if (w(n)) for (e = 0, u = n.length; u > e; e++)t(n[e], e, n); else { var i = m.keys(n); for (e = 0, u = i.length; u > e; e++)t(n[i[e]], i[e], n) } return n }, m.map = m.collect = function (n, t, r) { t = b(t, r); for (var e = !w(n) && m.keys(n), u = (e || n).length, i = Array(u), o = 0; u > o; o++) { var a = e ? e[o] : o; i[o] = t(n[a], a, n) } return i }, m.reduce = m.foldl = m.inject = n(1), m.reduceRight = m.foldr = n(-1), m.find = m.detect = function (n, t, r) { var e; return e = w(n) ? m.findIndex(n, t, r) : m.findKey(n, t, r), e !== void 0 && e !== -1 ? n[e] : void 0 }, m.filter = m.select = function (n, t, r) { var e = []; return t = b(t, r), m.each(n, function (n, r, u) { t(n, r, u) && e.push(n) }), e }, m.reject = function (n, t, r) { return m.filter(n, m.negate(b(t)), r) }, m.every = m.all = function (n, t, r) { t = b(t, r); for (var e = !w(n) && m.keys(n), u = (e || n).length, i = 0; u > i; i++) { var o = e ? e[i] : i; if (!t(n[o], o, n)) return !1 } return !0 }, m.some = m.any = function (n, t, r) { t = b(t, r); for (var e = !w(n) && m.keys(n), u = (e || n).length, i = 0; u > i; i++) { var o = e ? e[i] : i; if (t(n[o], o, n)) return !0 } return !1 }, m.contains = m.includes = m.include = function (n, t, r) { return w(n) || (n = m.values(n)), m.indexOf(n, t, "number" == typeof r && r) >= 0 }, m.invoke = function (n, t) { var r = l.call(arguments, 2), e = m.isFunction(t); return m.map(n, function (n) { var u = e ? t : n[t]; return null == u ? u : u.apply(n, r) }) }, m.pluck = function (n, t) { return m.map(n, m.property(t)) }, m.where = function (n, t) { return m.filter(n, m.matcher(t)) }, m.f
/**
* marked v0.3.3 - a markdown parser
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
* https://github.com/chjj/marked
升级到v0.4.0 从/educoder/public/editormd/lib/marked.min.js复制
*/
!function (e) { "use strict"; var t = { newline: /^\n+/, code: /^( {4}[^\n]+\n*)+/, fences: d, hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/, heading: /^ *(#{1,6})*([^\n]+?) *(?:#+ *)?(?:\n+|$)/, nptable: d, blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, html: "^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))", def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, table: d, lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/, text: /^[^\n]+/ }; function n(e) { this.tokens = [], this.tokens.links = {}, this.options = e || m.defaults, this.rules = t.normal, this.options.pedantic ? this.rules = t.pedantic : this.options.gfm && (this.options.tables ? this.rules = t.tables : this.rules = t.gfm) } t._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/, t._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/, t.def = p(t.def).replace("label", t._label).replace("title", t._title).getRegex(), t.bullet = /(?:[*+-]|\d+\.)/, t.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/, t.item = p(t.item, "gm").replace(/bull/g, t.bullet).getRegex(), t.list = p(t.list).replace(/bull/g, t.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + t.def.source + ")").getRegex(), t._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", t._comment = /<!--(?!-?>)[\s\S]*?-->/, t.html = p(t.html, "i").replace("comment", t._comment).replace("tag", t._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), t.paragraph = p(t.paragraph).replace("hr", t.hr).replace("heading", t.heading).replace("lheading", t.lheading).replace("tag", t._tag).getRegex(), t.blockquote = p(t.blockquote).replace("paragraph", t.paragraph).getRegex(), t.normal = f({}, t), t.gfm = f({}, t.normal, { fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/, paragraph: /^/, heading: /^ *(#{1,6})+([^\n]+?) *#* *(?:\n+|$)/ }), t.gfm.paragraph = p(t.paragraph).replace("(?!", "(?!" + t.gfm.fences.source.replace("\\1", "\\2") + "|" + t.list.source.replace("\\1", "\\3") + "|").getRegex(), t.tables = f({}, t.gfm, { nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/, table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ }), t.pedantic = f({}, t.normal, { html: p("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", t._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/ }), n.rules = t, n.lex = function (e, t) { return new n(t).lex(e) }, n.prototype.lex = function (e) { return e = e.replace(/\r\n|\r/g, "\n").replace(/\t/g, " ").replace(/\u00a0/g, " ").replace(/\u2424/g, "\n"), this.token(e, !0) }, n.prototype.token = function (e, n) { var r, s, i, l, o, a, h, p, u, c, g, d, f; for (e = e.replace(/^ +$/gm, ""); e;)if ((i = this.rules.newline.exec(e)) && (e = e.substring(i[0].length), i[0].length > 1 && this.tokens
// Copyright (C) 2006 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
var IN_GLOBAL_SCOPE = true; window["PR_SHOULD_USE_CONTINUATION"] = true; var prettyPrintOne; var prettyPrint; (function () { var P = window; var i = ["break,continue,do,else,for,if,return,while"]; var u = [i, "auto,case,char,const,default," + "double,enum,extern,float,goto,inline,int,long,register,short,signed," + "sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"]; var p = [u, "catch,class,delete,false,import," + "new,operator,private,protected,public,this,throw,true,try,typeof"]; var l = [p, "alignof,align_union,asm,axiom,bool," + "concept,concept_map,const_cast,constexpr,decltype,delegate," + "dynamic_cast,explicit,export,friend,generic,late_check," + "mutable,namespace,nullptr,property,reinterpret_cast,static_assert," + "static_cast,template,typeid,typename,using,virtual,where"]; var y = [p, "abstract,assert,boolean,byte,extends,final,finally,implements,import," + "instanceof,interface,null,native,package,strictfp,super,synchronized," + "throws,transient"]; var U = [y, "as,base,by,checked,decimal,delegate,descending,dynamic,event," + "fixed,foreach,from,group,implicit,in,internal,into,is,let," + "lock,object,out,override,orderby,params,partial,readonly,ref,sbyte," + "sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort," + "var,virtual,where"]; var r = "all,and,by,catch,class,else,extends,false,finally," + "for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then," + "throw,true,try,unless,until,when,while,yes"; var x = [p, "debugger,eval,export,function,get,null,set,undefined,var,with," + "Infinity,NaN"]; var s = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for," + "goto,if,import,last,local,my,next,no,our,print,package,redo,require," + "sub,undef,unless,until,use,wantarray,while,BEGIN,END"; var K = [i, "and,as,assert,class,def,del," + "elif,except,exec,finally,from,global,import,in,is,lambda," + "nonlocal,not,or,pass,print,raise,try,with,yield," + "False,True,None"]; var g = [i, "alias,and,begin,case,class," + "def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," + "rescue,retry,self,super,then,true,undef,unless,until,when,yield," + "BEGIN,END"]; var z = [i, "as,assert,const,copy,drop," + "enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv," + "pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"]; var J = [i, "case,done,elif,esac,eval,fi," + "function,in,local,set,then,until"]; var C = [l, U, x, s, K, g, J]; var e = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/; var E = "str"; var B = "kwd"; var j = "com"; var R = "typ"; var I = "lit"; var N = "pun"; var H = "pln"; var m = "tag"; var G = "dec"; var L = "src"; var S = "atn"; var n = "atv"; var Q = "nocode"; var O = "(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*"; function k(ac) { var ag = 0; var V = false; var af = false; for (var Y = 0, X = ac.length; Y < X; ++Y) { var ah = ac[Y]; if (ah.ignoreCase) { af = true } else { if (/[a-z]/i.test(ah.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ""))) { V = true; af = false; break } } } var ab = { "b": 8, "t": 9, "n": 10, "v": 11, "f": 12, "r": 13 }; function ae(ak) { var aj = ak.charCodeAt(0); if (aj !== 92) { return aj } var ai = ak.charAt(1); aj = ab[ai]; if (aj) { return aj } else { if ("0" <= ai && ai <= "7") { return parseInt(ak.substring(1), 8) } else { if (ai === "u" || ai === "x") { return parseInt(ak.substring(2), 16) } else { return ak.charCodeAt(1) } } } } function W(ai) { if (ai < 32) { return (ai < 16 ? "\\x0" : "\\x") + ai.toString(16) } var aj = String.fromCharCode(ai); return (aj === "\\" || aj === "-" || aj === "]" || aj === "^") ? "\\" + aj : aj } function aa(ao) { var at = ao.substring(1, ao.length - 1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}" + "|\\\\x[0-9A-Fa-f]{2}" + "|\\\\[0-3][0-7]{0,2}" + "|\\\\[0-7]{1,2}" + "|\\\\[\\s\\S]" + "|-" + "|[^-\\\\]", "g")); var ai = []; var aq = at[0
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël 2.1.3 - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\
// Element= -> __Element=
!function (a) { var b, c, d = "0.4.2", e = "hasOwnProperty", f = /[\.\/]/, g = "*", h = function () { }, i = function (a, b) { return a - b }, j = { n: {} }, k = function (a, d) { a = String(a); var e, f = c, g = Array.prototype.slice.call(arguments, 2), h = k.listeners(a), j = 0, l = [], m = {}, n = [], o = b; b = a, c = 0; for (var p = 0, q = h.length; q > p; p++)"zIndex" in h[p] && (l.push(h[p].zIndex), h[p].zIndex < 0 && (m[h[p].zIndex] = h[p])); for (l.sort(i); l[j] < 0;)if (e = m[l[j++]], n.push(e.apply(d, g)), c) return c = f, n; for (p = 0; q > p; p++)if (e = h[p], "zIndex" in e) if (e.zIndex == l[j]) { if (n.push(e.apply(d, g)), c) break; do if (j++, e = m[l[j]], e && n.push(e.apply(d, g)), c) break; while (e) } else m[e.zIndex] = e; else if (n.push(e.apply(d, g)), c) break; return c = f, b = o, n.length ? n : null }; k._events = j, k.listeners = function (a) { var b, c, d, e, h, i, k, l, m = a.split(f), n = j, o = [n], p = []; for (e = 0, h = m.length; h > e; e++) { for (l = [], i = 0, k = o.length; k > i; i++)for (n = o[i].n, c = [n[m[e]], n[g]], d = 2; d--;)b = c[d], b && (l.push(b), p = p.concat(b.f || [])); o = l } return p }, k.on = function (a, b) { if (a = String(a), "function" != typeof b) return function () { }; for (var c = a.split(f), d = j, e = 0, g = c.length; g > e; e++)d = d.n, d = d.hasOwnProperty(c[e]) && d[c[e]] || (d[c[e]] = { n: {} }); for (d.f = d.f || [], e = 0, g = d.f.length; g > e; e++)if (d.f[e] == b) return h; return d.f.push(b), function (a) { +a == +a && (b.zIndex = +a) } }, k.f = function (a) { var b = [].slice.call(arguments, 1); return function () { k.apply(null, [a, null].concat(b).concat([].slice.call(arguments, 0))) } }, k.stop = function () { c = 1 }, k.nt = function (a) { return a ? new RegExp("(?:\\.|\\/|^)" + a + "(?:\\.|\\/|$)").test(b) : b }, k.nts = function () { return b.split(f) }, k.off = k.unbind = function (a, b) { if (!a) return void (k._events = j = { n: {} }); var c, d, h, i, l, m, n, o = a.split(f), p = [j]; for (i = 0, l = o.length; l > i; i++)for (m = 0; m < p.length; m += h.length - 2) { if (h = [m, 1], c = p[m].n, o[i] != g) c[o[i]] && h.push(c[o[i]]); else for (d in c) c[e](d) && h.push(c[d]); p.splice.apply(p, h) } for (i = 0, l = p.length; l > i; i++)for (c = p[i]; c.n;) { if (b) { if (c.f) { for (m = 0, n = c.f.length; n > m; m++)if (c.f[m] == b) { c.f.splice(m, 1); break } !c.f.length && delete c.f } for (d in c.n) if (c.n[e](d) && c.n[d].f) { var q = c.n[d].f; for (m = 0, n = q.length; n > m; m++)if (q[m] == b) { q.splice(m, 1); break } !q.length && delete c.n[d].f } } else { delete c.f; for (d in c.n) c.n[e](d) && c.n[d].f && delete c.n[d].f } c = c.n } }, k.once = function (a, b) { var c = function () { return k.unbind(a, c), b.apply(this, arguments) }; return k.on(a, c) }, k.version = d, k.toString = function () { return "You are running Eve " + d }, "undefined" != typeof module && module.exports ? module.exports = k : "undefined" != typeof define ? define("eve", [], function () { return k }) : a.eve = k }(window || this), function (a, b) { "function" == typeof define && define.amd ? define(["eve"], function (c) { return b(a, c) }) : b(a, a.eve || "function" == typeof require && require("eve")) }(this, function (a, b) {
function c(a) { if (c.is(a, "function")) return u ? a() : b.on("raphael.DOMload", a); if (c.is(a, V)) return c._engine.create[D](c, a.splice(0, 3 + c.is(a[0], T))).add(a); var d = Array.prototype.slice.call(arguments, 0); if (c.is(d[d.length - 1], "function")) { var e = d.pop(); return u ? e.call(c._engine.create[D](c, d)) : b.on("raphael.DOMload", function () { e.call(c._engine.create[D](c, d)) }) } return c._engine.create[D](c, arguments) } function d(a) { if ("function" == typeof a || Object(a) !== a) return a; var b = new a.constructor; for (var c in a) a[z](c) && (b[c] = d(a[c])); return b } function e(a, b) { for (var c = 0, d = a.length; d > c; c++)if (a[c] === b) return a.push(a.splice(c, 1)[0]) } function f(a, b, c) { function d() { var f = Array.prototype.slice.call(arguments, 0), g = f.join("␀"), h = d.cache = d.cache || {}, i = d.count = d.count || []; return h[z](g) ? (e(i, g), c ? c(h[g]) : h[g]) : (i.length >= 1e3 && delete h[i.shift()], i.push(g), h[g] = a[D](b, f), c ? c(h[g]) : h[g]) } return d } function g() { return this.hex } function h(a, b) { for (var c = [], d = 0, e = a.length; e - 2 * !b > d; d += 2) { var f = [{ x: +a[d - 2], y: +a[d - 1] }, { x: +a[d], y: +a[d + 1] }, { x: +a[d + 2], y: +a[d + 3] }, { x: +a[d + 4], y: +a[d + 5] }]; b ? d ? e - 4 == d ? f[3] = { x: +a[0], y: +a[1] } : e - 2 == d && (f[2] = { x: +a[0], y: +a[1] }, f[3] = { x: +a[2], y: +a[3] }) : f[0] = { x: +a[e - 2], y: +a[e - 1] } : e - 4 == d ? f[3] = f[2] : d || (f[0] = { x: +a[d], y: +a[d + 1] }), c.push(["C", (-f[0].x + 6 * f[1].x + f[2].x) / 6, (-f[0].y + 6 * f[1].y + f[2].y) / 6, (f[1].x + 6 * f[2].x - f[3].x) / 6, (f[1].y + 6 * f[2].y - f[3].y) / 6, f[2].x, f[2].y]) } return c } function i(a, b, c, d, e) { var f = -3 * b + 9 * c - 9 * d + 3 * e, g = a * f + 6 * b - 12 * c + 6 * d; return a * g - 3 * b + 3 * c } function j(a, b, c, d, e, f, g, h, j) { null == j && (j = 1), j = j > 1 ? 1 : 0 > j ? 0 : j; for (var k = j / 2, l = 12, m = [-.1252, .1252, -.3678, .3678, -.5873, .5873, -.7699, .7699, -.9041, .9041, -.9816, .9816], n = [.2491, .2491, .2335, .2335, .2032, .2032, .1601, .1601, .1069, .1069, .0472, .0472], o = 0, p = 0; l > p; p++) { var q = k * m[p] + k, r = i(q, a, c, e, g), s = i(q, b, d, f, h), t = r * r + s * s; o += n[p] * N.sqrt(t) } return k * o } function k(a, b, c, d, e, f, g, h, i) { if (!(0 > i || j(a, b, c, d, e, f, g, h) < i)) { var k, l = 1, m = l / 2, n = l - m, o = .01; for (k = j(a, b, c, d, e, f, g, h, n); Q(k - i) > o;)m /= 2, n += (i > k ? 1 : -1) * m, k = j(a, b, c, d, e, f, g, h, n); return n } } function l(a, b, c, d, e, f, g, h) { if (!(O(a, c) < P(e, g) || P(a, c) > O(e, g) || O(b, d) < P(f, h) || P(b, d) > O(f, h))) { var i = (a * d - b * c) * (e - g) - (a - c) * (e * h - f * g), j = (a * d - b * c) * (f - h) - (b - d) * (e * h - f * g), k = (a - c) * (f - h) - (b - d) * (e - g); if (k) { var l = i / k, m = j / k, n = +l.toFixed(2), o = +m.toFixed(2); if (!(n < +P(a, c).toFixed(2) || n > +O(a, c).toFixed(2) || n < +P(e, g).toFixed(2) || n > +O(e, g).toFixed(2) || o < +P(b, d).toFixed(2) || o > +O(b, d).toFixed(2) || o < +P(f, h).toFixed(2) || o > +O(f, h).toFixed(2))) return { x: l, y: m } } } } function m(a, b, d) { var e = c.bezierBBox(a), f = c.bezierBBox(b); if (!c.isBBoxIntersect(e, f)) return d ? 0 : []; for (var g = j.apply(0, a), h = j.apply(0, b), i = O(~~(g / 5), 1), k = O(~~(h / 5), 1), m = [], n = [], o = {}, p = d ? 0 : [], q = 0; i + 1 > q; q++) { var r = c.findDotsAtSegment.apply(c, a.concat(q / i)); m.push({ x: r.x, y: r.y, t: q / i }) } for (q = 0; k + 1 > q; q++)r = c.findDotsAtSegment.apply(c, b.concat(q / k)), n.push({ x: r.x, y: r.y, t: q / k }); for (q = 0; i > q; q++)for (var s = 0; k > s; s++) { var t = m[q], u = m[q + 1], v = n[s], w = n[s + 1], x = Q(u.x - t.x) < .001 ? "y" : "x", y = Q(w.x - v.x) < .001 ? "y" : "x", z = l(t.x, t.y, u.x, u.y, v.x, v.y, w.x, w.y); if (z) { if (o[z.x.toFixed(4)] == z.y.toFixed(4)) continue; o[z.x.toFixed(4)] = z.y.toFixed(4); var A = t.t + Q((z[x] - t[x]) / (u[x] - t[x])) * (u.t - t.t), B = v.t + Q((z[y] - v[y]) / (w[y] -
b = I(b).replace(/\.{3}|\u2026/g, a), a = c.parseTransformString(a) || [], b = c.parseTransformString(b) || [];
for (var d, e, f, g, h = O(a.length, b.length), i = [], j = [], k = 0; h > k; k++) { if (f = a[k] || Ob(b[k]), g = b[k] || Ob(f), f[0] != g[0] || "r" == f[0].toLowerCase() && (f[2] != g[2] || f[3] != g[3]) || "s" == f[0].toLowerCase() && (f[3] != g[3] || f[4] != g[4])) return; for (i[k] = [], j[k] = [], d = 0, e = O(f.length, g.length); e > d; d++)d in f && (i[k][d] = f[d]), d in g && (j[k][d] = g[d]) } return { from: i, to: j }
}; c._getContainer = function (a, b, d, e) { var f; return f = null != e || c.is(a, "object") ? a : A.doc.getElementById(a), null != f ? f.tagName ? null == b ? { container: f, width: f.style.pixelWidth || f.offsetWidth, height: f.style.pixelHeight || f.offsetHeight } : { container: f, width: b, height: d } : { container: 1, x: a, y: b, width: d, height: e } : void 0 }, c.pathToRelative = Db, c._engine = {}, c.path2curve = Kb, c.matrix = function (a, b, c, d, e, f) { return new o(a, b, c, d, e, f) }, function (a) { function b(a) { return a[0] * a[0] + a[1] * a[1] } function d(a) { var c = N.sqrt(b(a)); a[0] && (a[0] /= c), a[1] && (a[1] /= c) } a.add = function (a, b, c, d, e, f) { var g, h, i, j, k = [[], [], []], l = [[this.a, this.c, this.e], [this.b, this.d, this.f], [0, 0, 1]], m = [[a, c, e], [b, d, f], [0, 0, 1]]; for (a && a instanceof o && (m = [[a.a, a.c, a.e], [a.b, a.d, a.f], [0, 0, 1]]), g = 0; 3 > g; g++)for (h = 0; 3 > h; h++) { for (j = 0, i = 0; 3 > i; i++)j += l[g][i] * m[i][h]; k[g][h] = j } this.a = k[0][0], this.b = k[1][0], this.c = k[0][1], this.d = k[1][1], this.e = k[0][2], this.f = k[1][2] }, a.invert = function () { var a = this, b = a.a * a.d - a.b * a.c; return new o(a.d / b, -a.b / b, -a.c / b, a.a / b, (a.c * a.f - a.d * a.e) / b, (a.b * a.e - a.a * a.f) / b) }, a.clone = function () { return new o(this.a, this.b, this.c, this.d, this.e, this.f) }, a.translate = function (a, b) { this.add(1, 0, 0, 1, a, b) }, a.scale = function (a, b, c, d) { null == b && (b = a), (c || d) && this.add(1, 0, 0, 1, c, d), this.add(a, 0, 0, b, 0, 0), (c || d) && this.add(1, 0, 0, 1, -c, -d) }, a.rotate = function (a, b, d) { a = c.rad(a), b = b || 0, d = d || 0; var e = +N.cos(a).toFixed(9), f = +N.sin(a).toFixed(9); this.add(e, f, -f, e, b, d), this.add(1, 0, 0, 1, -b, -d) }, a.x = function (a, b) { return a * this.a + b * this.c + this.e }, a.y = function (a, b) { return a * this.b + b * this.d + this.f }, a.get = function (a) { return +this[I.fromCharCode(97 + a)].toFixed(4) }, a.toString = function () { return c.svg ? "matrix(" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)].join() + ")" : [this.get(0), this.get(2), this.get(1), this.get(3), 0, 0].join() }, a.toFilter = function () { return "progid:DXImageTransform.Microsoft.Matrix(M11=" + this.get(0) + ", M12=" + this.get(2) + ", M21=" + this.get(1) + ", M22=" + this.get(3) + ", Dx=" + this.get(4) + ", Dy=" + this.get(5) + ", sizingmethod='auto expand')" }, a.offset = function () { return [this.e.toFixed(4), this.f.toFixed(4)] }, a.split = function () { var a = {}; a.dx = this.e, a.dy = this.f; var e = [[this.a, this.c], [this.b, this.d]]; a.scalex = N.sqrt(b(e[0])), d(e[0]), a.shear = e[0][0] * e[1][0] + e[0][1] * e[1][1], e[1] = [e[1][0] - e[0][0] * a.shear, e[1][1] - e[0][1] * a.shear], a.scaley = N.sqrt(b(e[1])), d(e[1]), a.shear /= a.scaley; var f = -e[0][1], g = e[1][1]; return 0 > g ? (a.rotate = c.deg(N.acos(g)), 0 > f && (a.rotate = 360 - a.rotate)) : a.rotate = c.deg(N.asin(f)), a.isSimple = !(+a.shear.toFixed(9) || a.scalex.toFixed(9) != a.scaley.toFixed(9) && a.rotate), a.isSuperSimple = !+a.shear.toFixed(9) && a.scalex.toFixed(9) == a.scaley.toFixed(9) && !a.rotate, a.noRotation = !+a.shear.toFixed(9) && !a.rotate, a }, a.toTransformString = function (a) { var b = a || this[J](); return b.isSimple ? (b.scalex = +b.scalex.toFixed(4), b.scaley = +b.scaley.toFixed(4), b.rotate = +b.rotate.toFixed(4), (b.dx || b.dy ? "t" + [b.dx, b.dy] : G) + (1 != b.scalex || 1 != b.scaley ? "s" + [b.scalex, b.scaley, 0, 0] : G) + (b.rotate ? "r" + [b.rotate, 0, 0] : G)) : "m" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)] } }(o.prototype); var Qb = navigator.userAgent.match(/Version\/(.*?)\s/) || navigator.userAgent.match(/Chrome\/(\d+)/); v.safari = "Apple Computer, Inc." == navigator.vendor && (Qb && Qb[1] < 4 || "iP" == navigator.platform.slice(0, 2)) || "Google Inc." == navigator.vendor && Qb && Qb[1] < 8 ? function () { var a = this.rect(-99, -99, this.width + 99, this.height + 99).att
if (c.svg) {
var a = "hasOwnProperty", b = String, d = parseFloat, e = parseInt, f = Math, g = f.max, h = f.abs, i = f.pow, j = /[, ]+/, k = c.eve, l = "", m = " ", n = "http://www.w3.org/1999/xlink", o = { block: "M5,0 0,2.5 5,5z", classic: "M5,0 0,2.5 5,5 3.5,3 3.5,2z", diamond: "M2.5,0 5,2.5 2.5,5 0,2.5z", open: "M6,1 1,3.5 6,6", oval: "M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z" }, p = {}; c.toString = function () { return "Your browser supports SVG.\nYou are running Raphaël " + this.version }; var q = function (d, e) { if (e) { "string" == typeof d && (d = q(d)); for (var f in e) e[a](f) && ("xlink:" == f.substring(0, 6) ? d.setAttributeNS(n, f.substring(6), b(e[f])) : d.setAttribute(f, b(e[f]))) } else d = c._g.doc.createElementNS("http://www.w3.org/2000/svg", d), d.style && (d.style.webkitTapHighlightColor = "rgba(0,0,0,0)"); return d }, r = function (a, e) { var j = "linear", k = a.id + e, m = .5, n = .5, o = a.node, p = a.paper, r = o.style, s = c._g.doc.getElementById(k); if (!s) { if (e = b(e).replace(c._radial_gradient, function (a, b, c) { if (j = "radial", b && c) { m = d(b), n = d(c); var e = 2 * (n > .5) - 1; i(m - .5, 2) + i(n - .5, 2) > .25 && (n = f.sqrt(.25 - i(m - .5, 2)) * e + .5) && .5 != n && (n = n.toFixed(5) - 1e-5 * e) } return l }), e = e.split(/\s*\-\s*/), "linear" == j) { var t = e.shift(); if (t = -d(t), isNaN(t)) return null; var u = [0, 0, f.cos(c.rad(t)), f.sin(c.rad(t))], v = 1 / (g(h(u[2]), h(u[3])) || 1); u[2] *= v, u[3] *= v, u[2] < 0 && (u[0] = -u[2], u[2] = 0), u[3] < 0 && (u[1] = -u[3], u[3] = 0) } var w = c._parseDots(e); if (!w) return null; if (k = k.replace(/[\(\)\s,\xb0#]/g, "_"), a.gradient && k != a.gradient.id && (p.defs.removeChild(a.gradient), delete a.gradient), !a.gradient) { s = q(j + "Gradient", { id: k }), a.gradient = s, q(s, "radial" == j ? { fx: m, fy: n } : { x1: u[0], y1: u[1], x2: u[2], y2: u[3], gradientTransform: a.matrix.invert() }), p.defs.appendChild(s); for (var x = 0, y = w.length; y > x; x++)s.appendChild(q("stop", { offset: w[x].offset ? w[x].offset : x ? "100%" : "0%", "stop-color": w[x].color || "#fff" })) } } return q(o, { fill: "url(" + document.location + "#" + k + ")", opacity: 1, "fill-opacity": 1 }), r.fill = l, r.opacity = 1, r.fillOpacity = 1, 1 }, s = function (a) { var b = a.getBBox(1); q(a.pattern, { patternTransform: a.matrix.invert() + " translate(" + b.x + "," + b.y + ")" }) }, t = function (d, e, f) { if ("path" == d.type) { for (var g, h, i, j, k, m = b(e).toLowerCase().split("-"), n = d.paper, r = f ? "end" : "start", s = d.node, t = d.attrs, u = t["stroke-width"], v = m.length, w = "classic", x = 3, y = 3, z = 5; v--;)switch (m[v]) { case "block": case "classic": case "oval": case "diamond": case "open": case "none": w = m[v]; break; case "wide": y = 5; break; case "narrow": y = 2; break; case "long": x = 5; break; case "short": x = 2 }if ("open" == w ? (x += 2, y += 2, z += 2, i = 1, j = f ? 4 : 1, k = { fill: "none", stroke: t.stroke }) : (j = i = x / 2, k = { fill: t.stroke, stroke: "none" }), d._.arrows ? f ? (d._.arrows.endPath && p[d._.arrows.endPath]--, d._.arrows.endMarker && p[d._.arrows.endMarker]--) : (d._.arrows.startPath && p[d._.arrows.startPath]--, d._.arrows.startMarker && p[d._.arrows.startMarker]--) : d._.arrows = {}, "none" != w) { var A = "raphael-marker-" + w, B = "raphael-marker-" + r + w + x + y + "-obj" + d.id; c._g.doc.getElementById(A) ? p[A]++ : (n.defs.appendChild(q(q("path"), { "stroke-linecap": "round", d: o[w], id: A })), p[A] = 1); var C, D = c._g.doc.getElementById(B); D ? (p[B]++, C = D.getElementsByTagName("use")[0]) : (D = q(q("marker"), { id: B, markerHeight: y, markerWidth: x, orient: "auto", refX: j, refY: y / 2 }), C = q(q("use"), { "xlink:href": "#" + A, transform: (f ? "rotate(180 " + x / 2 + " " + y / 2 + ") " : l) + "scale(" + x / z + "," + y / z + ")", "stroke-width": (1 / ((x / z + y / z) / 2)).toFixed(4) }), D.appendChild(C), n.defs.appendChild(D), p[B] = 1), q(C, k); var E = i * ("diamond" != w && "oval" != w); f ? (g = d._.arrows.startdx * u || 0, h = c.getTotalLength(t.path) -
var i = d.node, k = d.attrs, m = i.style.visibility; i.style.visibility = "hidden"; for (var o in f) if (f[a](o)) {
if (!c._availableAttrs[a](o)) continue; var p = f[o]; switch (k[o] = p, o) {
case "blur": d.blur(p); break; case "title": var u = i.getElementsByTagName("title"); if (u.length && (u = u[0])) u.firstChild.nodeValue = p; else { u = q("title"); var w = c._g.doc.createTextNode(p); u.appendChild(w), i.appendChild(u) } break; case "href": case "target": var x = i.parentNode; if ("a" != x.tagName.toLowerCase()) { var z = q("a"); x.insertBefore(z, i), z.appendChild(i), x = z } "target" == o ? x.setAttributeNS(n, "show", "blank" == p ? "new" : p) : x.setAttributeNS(n, o, p); break; case "cursor": i.style.cursor = p; break; case "transform": d.transform(p); break; case "arrow-start": t(d, p); break; case "arrow-end": t(d, p, 1); break; case "clip-rect": var A = b(p).split(j); if (4 == A.length) { d.clip && d.clip.parentNode.parentNode.removeChild(d.clip.parentNode); var B = q("clipPath"), C = q("rect"); B.id = c.createUUID(), q(C, { x: A[0], y: A[1], width: A[2], height: A[3] }), B.appendChild(C), d.paper.defs.appendChild(B), q(i, { "clip-path": "url(#" + B.id + ")" }), d.clip = C } if (!p) { var D = i.getAttribute("clip-path"); if (D) { var E = c._g.doc.getElementById(D.replace(/(^url\(#|\)$)/g, l)); E && E.parentNode.removeChild(E), q(i, { "clip-path": l }), delete d.clip } } break; case "path": "path" == d.type && (q(i, { d: p ? k.path = c._pathToAbsolute(p) : "M0,0" }), d._.dirty = 1, d._.arrows && ("startString" in d._.arrows && t(d, d._.arrows.startString), "endString" in d._.arrows && t(d, d._.arrows.endString, 1))); break; case "width": if (i.setAttribute(o, p), d._.dirty = 1, !k.fx) break; o = "x", p = k.x; case "x": k.fx && (p = -k.x - (k.width || 0)); case "rx": if ("rx" == o && "rect" == d.type) break; case "cx": i.setAttribute(o, p), d.pattern && s(d), d._.dirty = 1; break; case "height": if (i.setAttribute(o, p), d._.dirty = 1, !k.fy) break; o = "y", p = k.y; case "y": k.fy && (p = -k.y - (k.height || 0)); case "ry": if ("ry" == o && "rect" == d.type) break; case "cy": i.setAttribute(o, p), d.pattern && s(d), d._.dirty = 1; break; case "r": "rect" == d.type ? q(i, { rx: p, ry: p }) : i.setAttribute(o, p), d._.dirty = 1; break; case "src": "image" == d.type && i.setAttributeNS(n, "href", p); break; case "stroke-width": (1 != d._.sx || 1 != d._.sy) && (p /= g(h(d._.sx), h(d._.sy)) || 1), i.setAttribute(o, p), k["stroke-dasharray"] && v(d, k["stroke-dasharray"], f), d._.arrows && ("startString" in d._.arrows && t(d, d._.arrows.startString), "endString" in d._.arrows && t(d, d._.arrows.endString, 1)); break; case "stroke-dasharray": v(d, p, f); break; case "fill": var F = b(p).match(c._ISURL); if (F) { B = q("pattern"); var G = q("image"); B.id = c.createUUID(), q(B, { x: 0, y: 0, patternUnits: "userSpaceOnUse", height: 1, width: 1 }), q(G, { x: 0, y: 0, "xlink:href": F[1] }), B.appendChild(G), function (a) { c._preload(F[1], function () { var b = this.offsetWidth, c = this.offsetHeight; q(a, { width: b, height: c }), q(G, { width: b, height: c }), d.paper.safari() }) }(B), d.paper.defs.appendChild(B), q(i, { fill: "url(#" + B.id + ")" }), d.pattern = B, d.pattern && s(d); break } var H = c.getRGB(p); if (H.error) { if (("circle" == d.type || "ellipse" == d.type || "r" != b(p).charAt()) && r(d, p)) { if ("opacity" in k || "fill-opacity" in k) { var I = c._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g, l)); if (I) { var J = I.getElementsByTagName("stop"); q(J[J.length - 1], { "stop-opacity": ("opacity" in k ? k.opacity : 1) * ("fill-opacity" in k ? k["fill-opacity"] : 1) }) } } k.gradient = p, k.fill = "none"; break } } else delete f.gradient, delete k.gradient, !c.is(k.opacity, "undefined") && c.is(f.opacity, "undefined") && q(i, { opacity: k.opacity }), !c.is(k["fill-opacity"], "undefined") && c.is(f["fill-opacity"], "undefined") && q(i, { "fill-opacity": k["fill-opacity"] }); H[a]("opacity") && q(i, { "fill-opacity": H.opacity > 1 ? H.opacity / 100 : H.opacity }); case "stroke": H = c.getRGB(p), i.setAttribute(o, H.hex), "stroke" == o && H[a]("opacity") && q(i, { "stroke-opacity": H.opacity > 1 ? H.opacity / 100 : H.opacity }), "stroke" == o && d._.
case "opacity": k.gradient && !k[a]("stroke-opacity") && q(i, { "stroke-opacity": p > 1 ? p / 100 : p }); case "fill-opacity": if (k.gradient) { I = c._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g, l)), I && (J = I.getElementsByTagName("stop"), q(J[J.length - 1], { "stop-opacity": p })); break } default: "font-size" == o && (p = e(p, 10) + "px"); var K = o.replace(/(\-.)/g, function (a) { return a.substring(1).toUpperCase() }); i.style[K] = p, d._.dirty = 1, i.setAttribute(o, p)
}
} y(d, f), i.style.visibility = m
}, x = 1.2, y = function (d, f) { if ("text" == d.type && (f[a]("text") || f[a]("font") || f[a]("font-size") || f[a]("x") || f[a]("y"))) { var g = d.attrs, h = d.node, i = h.firstChild ? e(c._g.doc.defaultView.getComputedStyle(h.firstChild, l).getPropertyValue("font-size"), 10) : 10; if (f[a]("text")) { for (g.text = f.text; h.firstChild;)h.removeChild(h.firstChild); for (var j, k = b(f.text).split("\n"), m = [], n = 0, o = k.length; o > n; n++)j = q("tspan"), n && q(j, { dy: i * x, x: g.x }), j.appendChild(c._g.doc.createTextNode(k[n])), h.appendChild(j), m[n] = j } else for (m = h.getElementsByTagName("tspan"), n = 0, o = m.length; o > n; n++)n ? q(m[n], { dy: i * x, x: g.x }) : q(m[0], { dy: 0 }); q(h, { x: g.x, y: g.y }), d._.dirty = 1; var p = d._getBBox(), r = g.y - (p.y + p.height / 2); r && c.is(r, "finite") && q(m[0], { dy: r }) } }, z = function (a) { return a.parentNode && "a" === a.parentNode.tagName.toLowerCase() ? a.parentNode : a }; __Element = function (a, b) { this[0] = this.node = a, a.raphael = !0, this.id = c._oid++, a.raphaelid = this.id, this.matrix = c.matrix(), this.realPath = null, this.paper = b, this.attrs = this.attrs || {}, this._ = { transform: [], sx: 1, sy: 1, deg: 0, dx: 0, dy: 0, dirty: 1 }, !b.bottom && (b.bottom = this), this.prev = b.top, b.top && (b.top.next = this), b.top = this, this.next = null }, $b = c.el, Element.prototype = $b, $b.constructor = Element, c._engine.path = function (a, b) { var c = q("path"); b.canvas && b.canvas.appendChild(c); var d = new __Element(c, b); return d.type = "path", w(d, { fill: "none", stroke: "#000", path: a }), d }, $b.rotate = function (a, c, e) { if (this.removed) return this; if (a = b(a).split(j), a.length - 1 && (c = d(a[1]), e = d(a[2])), a = d(a[0]), null == e && (c = e), null == c || null == e) { var f = this.getBBox(1); c = f.x + f.width / 2, e = f.y + f.height / 2 } return this.transform(this._.transform.concat([["r", a, c, e]])), this }, $b.scale = function (a, c, e, f) { if (this.removed) return this; if (a = b(a).split(j), a.length - 1 && (c = d(a[1]), e = d(a[2]), f = d(a[3])), a = d(a[0]), null == c && (c = a), null == f && (e = f), null == e || null == f) var g = this.getBBox(1); return e = null == e ? g.x + g.width / 2 : e, f = null == f ? g.y + g.height / 2 : f, this.transform(this._.transform.concat([["s", a, c, e, f]])), this }, $b.translate = function (a, c) { return this.removed ? this : (a = b(a).split(j), a.length - 1 && (c = d(a[1])), a = d(a[0]) || 0, c = +c || 0, this.transform(this._.transform.concat([["t", a, c]])), this) }, $b.transform = function (b) { var d = this._; if (null == b) return d.transform; if (c._extractTransform(this, b), this.clip && q(this.clip, { transform: this.matrix.invert() }), this.pattern && s(this), this.node && q(this.node, { transform: this.matrix }), 1 != d.sx || 1 != d.sy) { var e = this.attrs[a]("stroke-width") ? this.attrs["stroke-width"] : 1; this.attr({ "stroke-width": e }) } return this }, $b.hide = function () { return !this.removed && this.paper.safari(this.node.style.display = "none"), this }, $b.show = function () { return !this.removed && this.paper.safari(this.node.style.display = ""), this }, $b.remove = function () { var a = z(this.node); if (!this.removed && a.parentNode) { var b = this.paper; b.__set__ && b.__set__.exclude(this), k.unbind("raphael.*.*." + this.id), this.gradient && b.defs.removeChild(this.gradient), c._tear(this, b), a.parentNode.removeChild(a), this.removeData(); for (var d in this) this[d] = "function" == typeof this[d] ? c._removedFactory(d) : null; this.removed = !0 } }, $b._getBBox = function () { if ("none" == this.node.style.display) { this.show(); var a = !0 } var b, c = !1; this.paper.canvas.parentElement ? b = this.paper.canvas.parentElement.style : this.paper.canvas.parentNode && (b = this.paper.canvas.parentNode.style), b && "none" == b.display && (c = !0, b.display = ""); var d = {}; try { d = this.node.getBBox() } catch (e) { d = { x: this.node.clientLeft, y: this.node.clientTop, width: this.node.clientWidth, height: this.node.cl
}
}(), function () { if (c.vml) { var a = "hasOwnProperty", b = String, d = parseFloat, e = Math, f = e.round, g = e.max, h = e.min, i = e.abs, j = "fill", k = /[, ]+/, l = c.eve, m = " progid:DXImageTransform.Microsoft", n = " ", o = "", p = { M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x" }, q = /([clmz]),?([^clmz]*)/gi, r = / progid:\S+Blur\([^\)]+\)/g, s = /-?[^,\s-]+/g, t = "position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)", u = 21600, v = { path: 1, rect: 1, image: 1 }, w = { circle: 1, ellipse: 1 }, x = function (a) { var d = /[ahqstv]/gi, e = c._pathToAbsolute; if (b(a).match(d) && (e = c._path2curve), d = /[clmz]/g, e == c._pathToAbsolute && !b(a).match(d)) { var g = b(a).replace(q, function (a, b, c) { var d = [], e = "m" == b.toLowerCase(), g = p[b]; return c.replace(s, function (a) { e && 2 == d.length && (g += d + p["m" == b ? "l" : "L"], d = []), d.push(f(a * u)) }), g + d }); return g } var h, i, j = e(a); g = []; for (var k = 0, l = j.length; l > k; k++) { h = j[k], i = j[k][0].toLowerCase(), "z" == i && (i = "x"); for (var m = 1, r = h.length; r > m; m++)i += f(h[m] * u) + (m != r - 1 ? "," : o); g.push(i) } return g.join(n) }, y = function (a, b, d) { var e = c.matrix(); return e.rotate(-a, .5, .5), { dx: e.x(b, d), dy: e.y(b, d) } }, z = function (a, b, c, d, e, f) { var g = a._, h = a.matrix, k = g.fillpos, l = a.node, m = l.style, o = 1, p = "", q = u / b, r = u / c; if (m.visibility = "hidden", b && c) { if (l.coordsize = i(q) + n + i(r), m.rotation = f * (0 > b * c ? -1 : 1), f) { var s = y(f, d, e); d = s.dx, e = s.dy } if (0 > b && (p += "x"), 0 > c && (p += " y") && (o = -1), m.flip = p, l.coordorigin = d * -q + n + e * -r, k || g.fillsize) { var t = l.getElementsByTagName(j); t = t && t[0], l.removeChild(t), k && (s = y(f, h.x(k[0], k[1]), h.y(k[0], k[1])), t.position = s.dx * o + n + s.dy * o), g.fillsize && (t.size = g.fillsize[0] * i(b) + n + g.fillsize[1] * i(c)), l.appendChild(t) } m.visibility = "visible" } }; c.toString = function () { return "Your browser doesnt support SVG. Falling down to VML.\nYou are running Raphaël " + this.version }; var A = function (a, c, d) { for (var e = b(c).toLowerCase().split("-"), f = d ? "end" : "start", g = e.length, h = "classic", i = "medium", j = "medium"; g--;)switch (e[g]) { case "block": case "classic": case "oval": case "diamond": case "open": case "none": h = e[g]; break; case "wide": case "narrow": j = e[g]; break; case "long": case "short": i = e[g] }var k = a.node.getElementsByTagName("stroke")[0]; k[f + "arrow"] = h, k[f + "arrowlength"] = i, k[f + "arrowwidth"] = j }, B = function (e, i) { e.attrs = e.attrs || {}; var l = e.node, m = e.attrs, p = l.style, q = v[e.type] && (i.x != m.x || i.y != m.y || i.width != m.width || i.height != m.height || i.cx != m.cx || i.cy != m.cy || i.rx != m.rx || i.ry != m.ry || i.r != m.r), r = w[e.type] && (m.cx != i.cx || m.cy != i.cy || m.r != i.r || m.rx != i.rx || m.ry != i.ry), s = e; for (var t in i) i[a](t) && (m[t] = i[t]); if (q && (m.path = c._getPath[e.type](e), e._.dirty = 1), i.href && (l.href = i.href), i.title && (l.title = i.title), i.target && (l.target = i.target), i.cursor && (p.cursor = i.cursor), "blur" in i && e.blur(i.blur), (i.path && "path" == e.type || q) && (l.path = x(~b(m.path).toLowerCase().indexOf("r") ? c._pathToAbsolute(m.path) : m.path), e._.dirty = 1, "image" == e.type && (e._.fillpos = [m.x, m.y], e._.fillsize = [m.width, m.height], z(e, 1, 1, 0, 0, 0))), "transform" in i && e.transform(i.transform), r) { var y = +m.cx, B = +m.cy, D = +m.rx || +m.r || 0, E = +m.ry || +m.r || 0; l.path = c.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x", f((y - D) * u), f((B - E) * u), f((y + D) * u), f((B + E) * u), f(y * u)), e._.dirty = 1 } if ("clip-rect" in i) { var G = b(i["clip-rect"]).split(k); if (4 == G.length) { G[2] = +G[2] + +G[0], G[3] = +G[3] + +G[1]; var H = l.clipRect || c._g.doc.createElement("div"), I = H.style; I.clip = c.format("rect({1}px {2}px {3}px {0}px)", G), l.clipRect || (I.position = "absolute", I.top = 0, I.left =
});
/** js sequence diagrams 1.0.4
* http://bramp.github.io/js-sequence-diagrams/
* (c) 2012-2013 Andrew Brampton (bramp.net)
* @license Simplified BSD license.
*/
!function () { "use strict"; function Diagram() { this.title = void 0, this.actors = [], this.signals = [] } function ParseError(message, hash) { _.extend(this, hash), this.name = "ParseError", this.message = message || "" } Diagram.prototype.getActor = function (alias) { var s = /^(.+) as (\S+)$/i.exec(alias.trim()); s ? (name = s[1].trim(), alias = s[2].trim()) : name = alias.trim(), name = name.replace(/\\n/gm, "\n"); var i, actors = this.actors; for (i in actors) if (actors[i].alias == alias) return actors[i]; return i = actors.push(new Diagram.Actor(alias, name, actors.length)), actors[i - 1] }, Diagram.prototype.setTitle = function (title) { this.title = title }, Diagram.prototype.addSignal = function (signal) { this.signals.push(signal) }, Diagram.Actor = function (alias, name, index) { this.alias = alias, this.name = name, this.index = index }, Diagram.Signal = function (actorA, signaltype, actorB, message) { this.type = "Signal", this.actorA = actorA, this.actorB = actorB, this.linetype = 3 & signaltype, this.arrowtype = 3 & signaltype >> 2, this.message = message }, Diagram.Signal.prototype.isSelf = function () { return this.actorA.index == this.actorB.index }, Diagram.Note = function (actor, placement, message) { if (this.type = "Note", this.actor = actor, this.placement = placement, this.message = message, this.hasManyActors() && actor[0] == actor[1]) throw new Error("Note should be over two different actors") }, Diagram.Note.prototype.hasManyActors = function () { return _.isArray(this.actor) }, Diagram.LINETYPE = { SOLID: 0, DOTTED: 1 }, Diagram.ARROWTYPE = { FILLED: 0, OPEN: 1 }, Diagram.PLACEMENT = { LEFTOF: 0, RIGHTOF: 1, OVER: 2 }; var grammar = function () { function Parser() { this.yy = {} } var parser = { trace: function () { }, yy: {}, symbols_: { error: 2, start: 3, document: 4, EOF: 5, line: 6, statement: 7, NL: 8, participant: 9, actor: 10, signal: 11, note_statement: 12, title: 13, message: 14, note: 15, placement: 16, over: 17, actor_pair: 18, ",": 19, left_of: 20, right_of: 21, signaltype: 22, ACTOR: 23, linetype: 24, arrowtype: 25, LINE: 26, DOTLINE: 27, ARROW: 28, OPENARROW: 29, MESSAGE: 30, $accept: 0, $end: 1 }, terminals_: { 2: "error", 5: "EOF", 8: "NL", 9: "participant", 13: "title", 15: "note", 17: "over", 19: ",", 20: "left_of", 21: "right_of", 23: "ACTOR", 26: "LINE", 27: "DOTLINE", 28: "ARROW", 29: "OPENARROW", 30: "MESSAGE" }, productions_: [0, [3, 2], [4, 0], [4, 2], [6, 1], [6, 1], [7, 2], [7, 1], [7, 1], [7, 2], [12, 4], [12, 4], [18, 1], [18, 3], [16, 1], [16, 1], [11, 4], [10, 1], [22, 2], [22, 1], [24, 1], [24, 1], [25, 1], [25, 1], [14, 1]], performAction: function (yytext, yyleng, yylineno, yy, yystate, $$) { var $0 = $$.length - 1; switch (yystate) { case 1: return yy; case 4: break; case 6: $$[$0]; break; case 7: yy.addSignal($$[$0]); break; case 8: yy.addSignal($$[$0]); break; case 9: yy.setTitle($$[$0]); break; case 10: this.$ = new Diagram.Note($$[$0 - 1], $$[$0 - 2], $$[$0]); break; case 11: this.$ = new Diagram.Note($$[$0 - 1], Diagram.PLACEMENT.OVER, $$[$0]); break; case 12: this.$ = $$[$0]; break; case 13: this.$ = [$$[$0 - 2], $$[$0]]; break; case 14: this.$ = Diagram.PLACEMENT.LEFTOF; break; case 15: this.$ = Diagram.PLACEMENT.RIGHTOF; break; case 16: this.$ = new Diagram.Signal($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0]); break; case 17: this.$ = yy.getActor($$[$0]); break; case 18: this.$ = $$[$0 - 1] | $$[$0] << 2; break; case 19: this.$ = $$[$0]; break; case 20: this.$ = Diagram.LINETYPE.SOLID; break; case 21: this.$ = Diagram.LINETYPE.DOTTED; break; case 22: this.$ = Diagram.ARROWTYPE.FILLED; break; case 23: this.$ = Diagram.ARROWTYPE.OPEN; break; case 24: this.$ = $$[$0].substring(1).trim().replace(/\\n/gm, "\n") } }, table: [{ 3: 1, 4: 2, 5: [2, 2], 8: [2, 2], 9: [2, 2], 13: [2, 2], 15: [2, 2], 23: [2, 2] }, { 1: [3] }, { 5: [1, 3], 6: 4, 7: 5, 8: [1, 6], 9: [1, 7], 10: 11, 11: 8, 12: 9, 13: [1, 10], 15: [1, 12], 23: [1, 13] }, { 1: [2, 1] }, { 5: [2, 3], 8: [2, 3], 9: [2, 3], 13: [2, 3], 15: [2, 3], 23: [2, 3] }, { 5: [2, 4], 8: [2, 4], 9: [2, 4], 13: [2
"use strict";
function AssertException(message) { this.message = message } function assert(exp, message) { if (!exp) throw new AssertException(message) } function getCenterX(box) { return box.x + box.width / 2 } function getCenterY(box) { return box.y + box.height / 2 } var DIAGRAM_MARGIN = 10, ACTOR_MARGIN = 10, ACTOR_PADDING = 10, SIGNAL_MARGIN = 5, SIGNAL_PADDING = 5, NOTE_MARGIN = 10, NOTE_PADDING = 5, NOTE_OVERLAP = 15, TITLE_MARGIN = 0, TITLE_PADDING = 5, SELF_SIGNAL_WIDTH = 20, PLACEMENT = Diagram.PLACEMENT, LINETYPE = Diagram.LINETYPE, ARROWTYPE = Diagram.ARROWTYPE, LINE = { stroke: "#000", "stroke-width": 2 }, RECT = { fill: "#fff" }; AssertException.prototype.toString = function () { return "AssertException: " + this.message }, String.prototype.trim || (String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, "") }), Raphael.fn.line = function (x1, y1, x2, y2) { return assert(_.all([x1, x2, y1, y2], _.isFinite), "x1,x2,y1,y2 must be numeric"), this.path("M{0},{1} L{2},{3}", x1, y1, x2, y2) }, Raphael.fn.wobble = function (x1, y1, x2, y2) { assert(_.all([x1, x2, y1, y2], _.isFinite), "x1,x2,y1,y2 must be numeric"); var wobble = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) / 25, r1 = Math.random(), r2 = Math.random(), xfactor = Math.random() > .5 ? wobble : -wobble, yfactor = Math.random() > .5 ? wobble : -wobble, p1 = { x: (x2 - x1) * r1 + x1 + xfactor, y: (y2 - y1) * r1 + y1 + yfactor }, p2 = { x: (x2 - x1) * r2 + x1 - xfactor, y: (y2 - y1) * r2 + y1 - yfactor }; return "C" + p1.x + "," + p1.y + " " + p2.x + "," + p2.y + " " + x2 + "," + y2 }, Raphael.fn.text_bbox = function (text, font) { var p; font._obj ? p = this.print_center(0, 0, text, font._obj, font["font-size"]) : (p = this.text(0, 0, text), p.attr(font)); var bb = p.getBBox(); return p.remove(), bb }, Raphael.fn.handRect = function (x, y, w, h) { return assert(_.all([x, y, w, h], _.isFinite), "x, y, w, h must be numeric"), this.path("M" + x + "," + y + this.wobble(x, y, x + w, y) + this.wobble(x + w, y, x + w, y + h) + this.wobble(x + w, y + h, x, y + h) + this.wobble(x, y + h, x, y)).attr(RECT) }, Raphael.fn.handLine = function (x1, y1, x2, y2) { return assert(_.all([x1, x2, y1, y2], _.isFinite), "x1,x2,y1,y2 must be numeric"), this.path("M" + x1 + "," + y1 + this.wobble(x1, y1, x2, y2)) }, Raphael.fn.print_center = function (x, y, string, font, size, letter_spacing) { var path = this.print(x, y, string, font, size, "baseline", letter_spacing), bb = path.getBBox(), dx = x - bb.x - bb.width / 2, dy = y - bb.y - bb.height / 2, m = new Raphael.matrix; return m.translate(dx, dy), path.attr("path", Raphael.mapPath(path.attr("path"), m)) }; var BaseTheme = function (diagram) { this.init(diagram) }; _.extend(BaseTheme.prototype, { init: function (diagram) { this.diagram = diagram, this._paper = void 0, this._font = void 0, this._title = void 0, this._actors_height = 0, this._signals_height = 0; var a = this.arrow_types = {}; a[ARROWTYPE.FILLED] = "block", a[ARROWTYPE.OPEN] = "open"; var l = this.line_types = {}; l[LINETYPE.SOLID] = "", l[LINETYPE.DOTTED] = "-" }, init_paper: function (container) { this._paper = new Raphael(container, 320, 200) }, init_font: function () { }, draw_line: function (x1, y1, x2, y2) { return this._paper.line(x1, y1, x2, y2) }, draw_rect: function (x, y, w, h) { return this._paper.rect(x, y, w, h) }, draw: function (container) { var diagram = this.diagram; this.init_paper(container), this.init_font(), this.layout(); var title_height = this._title ? this._title.height : 0; this._paper.setStart(), this._paper.setSize(diagram.width, diagram.height); var y = DIAGRAM_MARGIN + title_height; this.draw_title(), this.draw_actors(y), this.draw_signals(y + this._actors_height), this._paper.setFinish() }, layout: function () { function actor_ensure_distance(a, b, d) { assert(b > a, "a must be less than or equal to b"), 0 > a ? (b = actors[b], b.x = Math.max(d - b.width / 2, b.x)) : b >= actors.length ? (a = actors[a], a.padding_right = Math.max(d, a.padding_right)) : (a = actors[a], a.distances[b] = Math.max(d, a.distances[b
}();
// flowchart, v1.3.4
// Copyright (c)2014 Adriano Raiano (adrai).
// Distributed under MIT license
// http://adrai.github.io/flowchart.js
!function () { function a(b, c) { if (!b || "function" == typeof b) return c; var d = {}; for (var e in c) d[e] = c[e]; for (e in b) b[e] && (d[e] = "object" == typeof d[e] ? a(d[e], b[e]) : b[e]); return d } function b(a, b) { if ("function" == typeof Object.create) a.super_ = b, a.prototype = Object.create(b.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }); else { a.super_ = b; var c = function () { }; c.prototype = b.prototype, a.prototype = new c, a.prototype.constructor = a } } function c(a, b, c) { var d, e, f = "M{0},{1}"; for (d = 2, e = 2 * c.length + 2; e > d; d += 2)f += " L{" + d + "},{" + (d + 1) + "}"; var g = [b.x, b.y]; for (d = 0, e = c.length; e > d; d++)g.push(c[d].x), g.push(c[d].y); var h = a.paper.path(f, g); h.attr("stroke", a.options["element-color"]), h.attr("stroke-width", a.options["line-width"]); var i = a.options.font, j = a.options["font-family"], k = a.options["font-weight"]; return i && h.attr({ font: i }), j && h.attr({ "font-family": j }), k && h.attr({ "font-weight": k }), h } function d(a, b, c, d) { var e, f; "[object Array]" !== Object.prototype.toString.call(c) && (c = [c]); var g = "M{0},{1}"; for (e = 2, f = 2 * c.length + 2; f > e; e += 2)g += " L{" + e + "},{" + (e + 1) + "}"; var h = [b.x, b.y]; for (e = 0, f = c.length; f > e; e++)h.push(c[e].x), h.push(c[e].y); var i = a.paper.path(g, h); i.attr({ stroke: a.options["line-color"], "stroke-width": a.options["line-width"], "arrow-end": a.options["arrow-end"] }); var j = a.options.font, k = a.options["font-family"], l = a.options["font-weight"]; if (j && i.attr({ font: j }), k && i.attr({ "font-family": k }), l && i.attr({ "font-weight": l }), d) { var m = !1, n = a.paper.text(0, 0, d), o = !1, p = c[0]; b.y === p.y && (o = !0); var q = 0, r = 0; m ? (q = b.x > p.x ? b.x - (b.x - p.x) / 2 : p.x - (p.x - b.x) / 2, r = b.y > p.y ? b.y - (b.y - p.y) / 2 : p.y - (p.y - b.y) / 2, o ? (q -= n.getBBox().width / 2, r -= a.options["text-margin"]) : (q += a.options["text-margin"], r -= n.getBBox().height / 2)) : (q = b.x, r = b.y, o ? (q += a.options["text-margin"] / 2, r -= a.options["text-margin"]) : (q += a.options["text-margin"] / 2, r += a.options["text-margin"])), n.attr({ "text-anchor": "start", "font-size": a.options["font-size"], fill: a.options["font-color"], x: q, y: r }), j && n.attr({ font: j }), k && n.attr({ "font-family": k }), l && n.attr({ "font-weight": l }) } return i } function e(a, b, c, d, e, f, g, h) { var i, j, k, l, m, n = { x: null, y: null, onLine1: !1, onLine2: !1 }; return i = (h - f) * (c - a) - (g - e) * (d - b), 0 === i ? n : (j = b - f, k = a - e, l = (g - e) * j - (h - f) * k, m = (c - a) * j - (d - b) * k, j = l / i, k = m / i, n.x = a + j * (c - a), n.y = b + j * (d - b), j > 0 && 1 > j && (n.onLine1 = !0), k > 0 && 1 > k && (n.onLine2 = !0), n) } function f(a, b) { b = b || {}, this.paper = new Raphael(a), this.options = r.defaults(b, q), this.symbols = [], this.lines = [], this.start = null } function g(a, b, c) { this.chart = a, this.group = this.chart.paper.set(), this.symbol = c, this.connectedTo = [], this.symbolType = b.symbolType, this.flowstate = b.flowstate || "future", this.next_direction = b.next && b.direction_next ? b.direction_next : void 0, this.text = this.chart.paper.text(0, 0, b.text), b.key && (this.text.node.id = b.key + "t"), this.text.node.setAttribute("class", this.getAttr("class") + "t"), this.text.attr({ "text-anchor": "start", x: this.getAttr("text-margin"), fill: this.getAttr("font-color"), "font-size": this.getAttr("font-size") }); var d = this.getAttr("font"), e = this.getAttr("font-family"), f = this.getAttr("font-weight"); d && this.text.attr({ font: d }), e && this.text.attr({ "font-family": e }), f && this.text.attr({ "font-weight": f }), b.link && this.text.attr("href", b.link), b.target && this.text.attr("target", b.target); var g = this.getAttr("maxWidth"); if (g) { for (var h = b.text.split(" "), i = "", j = 0, k = h.length; k > j; j++) { var l = h[j]; this.text.attr("text", i + " " + l), i += this.text.getBBox().width > g ?
/*! jQuery.flowchart.js v1.1.0 | jquery.flowchart.min.js | jQuery plugin for flowchart.js. | MIT License | By: Pandao | https://github.com/pandao/jquery.flowchart.js | 2015-03-09 */
(function (factory) { if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory } else { if (typeof define === "function") { factory(jQuery, flowchart) } else { factory($, flowchart) } } }(function (jQuery, flowchart) { (function ($) { $.fn.flowChart = function (options) { options = options || {}; var defaults = { "x": 0, "y": 0, "line-width": 2, "line-length": 50, "text-margin": 10, "font-size": 14, "font-color": "black", "line-color": "black", "element-color": "black", "fill": "white", "yes-text": "yes", "no-text": "no", "arrow-end": "block", "symbols": { "start": { "font-color": "black", "element-color": "black", "fill": "white" }, "end": { "class": "end-element" } }, "flowstate": { "past": { "fill": "#CCCCCC", "font-size": 12 }, "current": { "fill": "black", "font-color": "white", "font-weight": "bold" }, "future": { "fill": "white" }, "request": { "fill": "blue" }, "invalid": { "fill": "#444444" }, "approved": { "fill": "#58C4A3", "font-size": 12, "yes-text": "APPROVED", "no-text": "n/a" }, "rejected": { "fill": "#C45879", "font-size": 12, "yes-text": "n/a", "no-text": "REJECTED" } } }; return this.each(function () { var $this = $(this); var diagram = flowchart.parse($this.text()); var settings = $.extend(true, defaults, options); $this.html(""); diagram.drawSVG(this, settings) }) } })(jQuery) }));
(function () {
function diff_match_patch() { this.Diff_Timeout = 1; this.Diff_EditCost = 4; this.Match_Threshold = 0.5; this.Match_Distance = 1E3; this.Patch_DeleteThreshold = 0.5; this.Patch_Margin = 4; this.Match_MaxBits = 32 }
diff_match_patch.prototype.diff_main = function (a, b, c, d) {
"undefined" == typeof d && (d = 0 >= this.Diff_Timeout ? Number.MAX_VALUE : (new Date).getTime() + 1E3 * this.Diff_Timeout); if (null == a || null == b) throw Error("Null input. (diff_main)"); if (a == b) return a ? [[0, a]] : []; "undefined" == typeof c && (c = !0); var e = c, f = this.diff_commonPrefix(a, b); c = a.substring(0, f); a = a.substring(f); b = b.substring(f); var f = this.diff_commonSuffix(a, b), g = a.substring(a.length - f); a = a.substring(0, a.length - f); b = b.substring(0, b.length - f); a = this.diff_compute_(a,
b, e, d); c && a.unshift([0, c]); g && a.push([0, g]); this.diff_cleanupMerge(a); return a
};
diff_match_patch.prototype.diff_compute_ = function (a, b, c, d) {
if (!a) return [[1, b]]; if (!b) return [[-1, a]]; var e = a.length > b.length ? a : b, f = a.length > b.length ? b : a, g = e.indexOf(f); return -1 != g ? (c = [[1, e.substring(0, g)], [0, f], [1, e.substring(g + f.length)]], a.length > b.length && (c[0][0] = c[2][0] = -1), c) : 1 == f.length ? [[-1, a], [1, b]] : (e = this.diff_halfMatch_(a, b)) ? (f = e[0], a = e[1], g = e[2], b = e[3], e = e[4], f = this.diff_main(f, g, c, d), c = this.diff_main(a, b, c, d), f.concat([[0, e]], c)) : c && 100 < a.length && 100 < b.length ? this.diff_lineMode_(a, b,
d) : this.diff_bisect_(a, b, d)
};
diff_match_patch.prototype.diff_lineMode_ = function (a, b, c) { var d = this.diff_linesToChars_(a, b); a = d.chars1; b = d.chars2; d = d.lineArray; a = this.diff_main(a, b, !1, c); this.diff_charsToLines_(a, d); this.diff_cleanupSemantic(a); a.push([0, ""]); for (var e = d = b = 0, f = "", g = ""; b < a.length;) { switch (a[b][0]) { case 1: e++; g += a[b][1]; break; case -1: d++; f += a[b][1]; break; case 0: if (1 <= d && 1 <= e) { a.splice(b - d - e, d + e); b = b - d - e; d = this.diff_main(f, g, !1, c); for (e = d.length - 1; 0 <= e; e--)a.splice(b, 0, d[e]); b += d.length } d = e = 0; g = f = "" }b++ } a.pop(); return a };
diff_match_patch.prototype.diff_bisect_ = function (a, b, c) {
for (var d = a.length, e = b.length, f = Math.ceil((d + e) / 2), g = f, h = 2 * f, j = Array(h), i = Array(h), k = 0; k < h; k++)j[k] = -1, i[k] = -1; j[g + 1] = 0; i[g + 1] = 0; for (var k = d - e, q = 0 != k % 2, r = 0, t = 0, p = 0, w = 0, v = 0; v < f && !((new Date).getTime() > c); v++) {
for (var n = -v + r; n <= v - t; n += 2) {
var l = g + n, m; m = n == -v || n != v && j[l - 1] < j[l + 1] ? j[l + 1] : j[l - 1] + 1; for (var s = m - n; m < d && s < e && a.charAt(m) == b.charAt(s);)m++, s++; j[l] = m; if (m > d) t += 2; else if (s > e) r += 2; else if (q && (l = g + k - n, 0 <= l && l < h && -1 != i[l])) {
var u = d - i[l]; if (m >=
u) return this.diff_bisectSplit_(a, b, m, s, c)
}
} for (n = -v + p; n <= v - w; n += 2) { l = g + n; u = n == -v || n != v && i[l - 1] < i[l + 1] ? i[l + 1] : i[l - 1] + 1; for (m = u - n; u < d && m < e && a.charAt(d - u - 1) == b.charAt(e - m - 1);)u++, m++; i[l] = u; if (u > d) w += 2; else if (m > e) p += 2; else if (!q && (l = g + k - n, 0 <= l && (l < h && -1 != j[l]) && (m = j[l], s = g + m - l, u = d - u, m >= u))) return this.diff_bisectSplit_(a, b, m, s, c) }
} return [[-1, a], [1, b]]
};
diff_match_patch.prototype.diff_bisectSplit_ = function (a, b, c, d, e) { var f = a.substring(0, c), g = b.substring(0, d); a = a.substring(c); b = b.substring(d); f = this.diff_main(f, g, !1, e); e = this.diff_main(a, b, !1, e); return f.concat(e) };
diff_match_patch.prototype.diff_linesToChars_ = function (a, b) { function c(a) { for (var b = "", c = 0, f = -1, g = d.length; f < a.length - 1;) { f = a.indexOf("\n", c); -1 == f && (f = a.length - 1); var r = a.substring(c, f + 1), c = f + 1; (e.hasOwnProperty ? e.hasOwnProperty(r) : void 0 !== e[r]) ? b += String.fromCharCode(e[r]) : (b += String.fromCharCode(g), e[r] = g, d[g++] = r) } return b } var d = [], e = {}; d[0] = ""; var f = c(a), g = c(b); return { chars1: f, chars2: g, lineArray: d } };
diff_match_patch.prototype.diff_charsToLines_ = function (a, b) { for (var c = 0; c < a.length; c++) { for (var d = a[c][1], e = [], f = 0; f < d.length; f++)e[f] = b[d.charCodeAt(f)]; a[c][1] = e.join("") } }; diff_match_patch.prototype.diff_commonPrefix = function (a, b) { if (!a || !b || a.charAt(0) != b.charAt(0)) return 0; for (var c = 0, d = Math.min(a.length, b.length), e = d, f = 0; c < e;)a.substring(f, e) == b.substring(f, e) ? f = c = e : d = e, e = Math.floor((d - c) / 2 + c); return e };
diff_match_patch.prototype.diff_commonSuffix = function (a, b) { if (!a || !b || a.charAt(a.length - 1) != b.charAt(b.length - 1)) return 0; for (var c = 0, d = Math.min(a.length, b.length), e = d, f = 0; c < e;)a.substring(a.length - e, a.length - f) == b.substring(b.length - e, b.length - f) ? f = c = e : d = e, e = Math.floor((d - c) / 2 + c); return e };
diff_match_patch.prototype.diff_commonOverlap_ = function (a, b) { var c = a.length, d = b.length; if (0 == c || 0 == d) return 0; c > d ? a = a.substring(c - d) : c < d && (b = b.substring(0, c)); c = Math.min(c, d); if (a == b) return c; for (var d = 0, e = 1; ;) { var f = a.substring(c - e), f = b.indexOf(f); if (-1 == f) return d; e += f; if (0 == f || a.substring(c - e) == b.substring(0, e)) d = e, e++ } };
diff_match_patch.prototype.diff_halfMatch_ = function (a, b) {
function c(a, b, c) { for (var d = a.substring(c, c + Math.floor(a.length / 4)), e = -1, g = "", h, j, n, l; -1 != (e = b.indexOf(d, e + 1));) { var m = f.diff_commonPrefix(a.substring(c), b.substring(e)), s = f.diff_commonSuffix(a.substring(0, c), b.substring(0, e)); g.length < s + m && (g = b.substring(e - s, e) + b.substring(e, e + m), h = a.substring(0, c - s), j = a.substring(c + m), n = b.substring(0, e - s), l = b.substring(e + m)) } return 2 * g.length >= a.length ? [h, j, n, l, g] : null } if (0 >= this.Diff_Timeout) return null;
var d = a.length > b.length ? a : b, e = a.length > b.length ? b : a; if (4 > d.length || 2 * e.length < d.length) return null; var f = this, g = c(d, e, Math.ceil(d.length / 4)), d = c(d, e, Math.ceil(d.length / 2)), h; if (!g && !d) return null; h = d ? g ? g[4].length > d[4].length ? g : d : d : g; var j; a.length > b.length ? (g = h[0], d = h[1], e = h[2], j = h[3]) : (e = h[0], j = h[1], g = h[2], d = h[3]); h = h[4]; return [g, d, e, j, h]
};
diff_match_patch.prototype.diff_cleanupSemantic = function (a) {
for (var b = !1, c = [], d = 0, e = null, f = 0, g = 0, h = 0, j = 0, i = 0; f < a.length;)0 == a[f][0] ? (c[d++] = f, g = j, h = i, i = j = 0, e = a[f][1]) : (1 == a[f][0] ? j += a[f][1].length : i += a[f][1].length, e && (e.length <= Math.max(g, h) && e.length <= Math.max(j, i)) && (a.splice(c[d - 1], 0, [-1, e]), a[c[d - 1] + 1][0] = 1, d--, d--, f = 0 < d ? c[d - 1] : -1, i = j = h = g = 0, e = null, b = !0)), f++; b && this.diff_cleanupMerge(a); this.diff_cleanupSemanticLossless(a); for (f = 1; f < a.length;) {
if (-1 == a[f - 1][0] && 1 == a[f][0]) {
b = a[f - 1][1]; c = a[f][1];
d = this.diff_commonOverlap_(b, c); e = this.diff_commonOverlap_(c, b); if (d >= e) { if (d >= b.length / 2 || d >= c.length / 2) a.splice(f, 0, [0, c.substring(0, d)]), a[f - 1][1] = b.substring(0, b.length - d), a[f + 1][1] = c.substring(d), f++ } else if (e >= b.length / 2 || e >= c.length / 2) a.splice(f, 0, [0, b.substring(0, e)]), a[f - 1][0] = 1, a[f - 1][1] = c.substring(0, c.length - e), a[f + 1][0] = -1, a[f + 1][1] = b.substring(e), f++; f++
} f++
}
};
diff_match_patch.prototype.diff_cleanupSemanticLossless = function (a) {
function b(a, b) {
if (!a || !b) return 6; var c = a.charAt(a.length - 1), d = b.charAt(0), e = c.match(diff_match_patch.nonAlphaNumericRegex_), f = d.match(diff_match_patch.nonAlphaNumericRegex_), g = e && c.match(diff_match_patch.whitespaceRegex_), h = f && d.match(diff_match_patch.whitespaceRegex_), c = g && c.match(diff_match_patch.linebreakRegex_), d = h && d.match(diff_match_patch.linebreakRegex_), i = c && a.match(diff_match_patch.blanklineEndRegex_), j = d && b.match(diff_match_patch.blanklineStartRegex_);
return i || j ? 5 : c || d ? 4 : e && !g && h ? 3 : g || h ? 2 : e || f ? 1 : 0
} for (var c = 1; c < a.length - 1;) {
if (0 == a[c - 1][0] && 0 == a[c + 1][0]) {
var d = a[c - 1][1], e = a[c][1], f = a[c + 1][1], g = this.diff_commonSuffix(d, e); if (g) var h = e.substring(e.length - g), d = d.substring(0, d.length - g), e = h + e.substring(0, e.length - g), f = h + f; for (var g = d, h = e, j = f, i = b(d, e) + b(e, f); e.charAt(0) === f.charAt(0);) { var d = d + e.charAt(0), e = e.substring(1) + f.charAt(0), f = f.substring(1), k = b(d, e) + b(e, f); k >= i && (i = k, g = d, h = e, j = f) } a[c - 1][1] != g && (g ? a[c - 1][1] = g : (a.splice(c - 1, 1), c--), a[c][1] =
h, j ? a[c + 1][1] = j : (a.splice(c + 1, 1), c--))
} c++
}
}; diff_match_patch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/; diff_match_patch.whitespaceRegex_ = /\s/; diff_match_patch.linebreakRegex_ = /[\r\n]/; diff_match_patch.blanklineEndRegex_ = /\n\r?\n$/; diff_match_patch.blanklineStartRegex_ = /^\r?\n\r?\n/;
diff_match_patch.prototype.diff_cleanupEfficiency = function (a) { for (var b = !1, c = [], d = 0, e = null, f = 0, g = !1, h = !1, j = !1, i = !1; f < a.length;) { if (0 == a[f][0]) a[f][1].length < this.Diff_EditCost && (j || i) ? (c[d++] = f, g = j, h = i, e = a[f][1]) : (d = 0, e = null), j = i = !1; else if (-1 == a[f][0] ? i = !0 : j = !0, e && (g && h && j && i || e.length < this.Diff_EditCost / 2 && 3 == g + h + j + i)) a.splice(c[d - 1], 0, [-1, e]), a[c[d - 1] + 1][0] = 1, d--, e = null, g && h ? (j = i = !0, d = 0) : (d--, f = 0 < d ? c[d - 1] : -1, j = i = !1), b = !0; f++ } b && this.diff_cleanupMerge(a) };
diff_match_patch.prototype.diff_cleanupMerge = function (a) {
a.push([0, ""]); for (var b = 0, c = 0, d = 0, e = "", f = "", g; b < a.length;)switch (a[b][0]) {
case 1: d++; f += a[b][1]; b++; break; case -1: c++; e += a[b][1]; b++; break; case 0: 1 < c + d ? (0 !== c && 0 !== d && (g = this.diff_commonPrefix(f, e), 0 !== g && (0 < b - c - d && 0 == a[b - c - d - 1][0] ? a[b - c - d - 1][1] += f.substring(0, g) : (a.splice(0, 0, [0, f.substring(0, g)]), b++), f = f.substring(g), e = e.substring(g)), g = this.diff_commonSuffix(f, e), 0 !== g && (a[b][1] = f.substring(f.length - g) + a[b][1], f = f.substring(0, f.length -
g), e = e.substring(0, e.length - g))), 0 === c ? a.splice(b - d, c + d, [1, f]) : 0 === d ? a.splice(b - c, c + d, [-1, e]) : a.splice(b - c - d, c + d, [-1, e], [1, f]), b = b - c - d + (c ? 1 : 0) + (d ? 1 : 0) + 1) : 0 !== b && 0 == a[b - 1][0] ? (a[b - 1][1] += a[b][1], a.splice(b, 1)) : b++, c = d = 0, f = e = ""
}"" === a[a.length - 1][1] && a.pop(); c = !1; for (b = 1; b < a.length - 1;)0 == a[b - 1][0] && 0 == a[b + 1][0] && (a[b][1].substring(a[b][1].length - a[b - 1][1].length) == a[b - 1][1] ? (a[b][1] = a[b - 1][1] + a[b][1].substring(0, a[b][1].length - a[b - 1][1].length), a[b + 1][1] = a[b - 1][1] + a[b + 1][1], a.splice(b - 1, 1), c = !0) : a[b][1].substring(0,
a[b + 1][1].length) == a[b + 1][1] && (a[b - 1][1] += a[b + 1][1], a[b][1] = a[b][1].substring(a[b + 1][1].length) + a[b + 1][1], a.splice(b + 1, 1), c = !0)), b++; c && this.diff_cleanupMerge(a)
}; diff_match_patch.prototype.diff_xIndex = function (a, b) { var c = 0, d = 0, e = 0, f = 0, g; for (g = 0; g < a.length; g++) { 1 !== a[g][0] && (c += a[g][1].length); -1 !== a[g][0] && (d += a[g][1].length); if (c > b) break; e = c; f = d } return a.length != g && -1 === a[g][0] ? f : f + (b - e) };
diff_match_patch.prototype.diff_prettyHtml = function (a) { for (var b = [], c = /&/g, d = /</g, e = />/g, f = /\n/g, g = 0; g < a.length; g++) { var h = a[g][0], j = a[g][1], j = j.replace(c, "&amp;").replace(d, "&lt;").replace(e, "&gt;").replace(f, "&para;<br>"); switch (h) { case 1: b[g] = '<ins style="background:#e6ffe6;">' + j + "</ins>"; break; case -1: b[g] = '<del style="background:#ffe6e6;">' + j + "</del>"; break; case 0: b[g] = "<span>" + j + "</span>" } } return b.join("") };
diff_match_patch.prototype.diff_text1 = function (a) { for (var b = [], c = 0; c < a.length; c++)1 !== a[c][0] && (b[c] = a[c][1]); return b.join("") }; diff_match_patch.prototype.diff_text2 = function (a) { for (var b = [], c = 0; c < a.length; c++)-1 !== a[c][0] && (b[c] = a[c][1]); return b.join("") }; diff_match_patch.prototype.diff_levenshtein = function (a) { for (var b = 0, c = 0, d = 0, e = 0; e < a.length; e++) { var f = a[e][0], g = a[e][1]; switch (f) { case 1: c += g.length; break; case -1: d += g.length; break; case 0: b += Math.max(c, d), d = c = 0 } } return b += Math.max(c, d) };
diff_match_patch.prototype.diff_toDelta = function (a) { for (var b = [], c = 0; c < a.length; c++)switch (a[c][0]) { case 1: b[c] = "+" + encodeURI(a[c][1]); break; case -1: b[c] = "-" + a[c][1].length; break; case 0: b[c] = "=" + a[c][1].length }return b.join("\t").replace(/%20/g, " ") };
diff_match_patch.prototype.diff_fromDelta = function (a, b) {
for (var c = [], d = 0, e = 0, f = b.split(/\t/g), g = 0; g < f.length; g++) {
var h = f[g].substring(1); switch (f[g].charAt(0)) {
case "+": try { c[d++] = [1, decodeURI(h)] } catch (j) { throw Error("Illegal escape in diff_fromDelta: " + h); } break; case "-": case "=": var i = parseInt(h, 10); if (isNaN(i) || 0 > i) throw Error("Invalid number in diff_fromDelta: " + h); h = a.substring(e, e += i); "=" == f[g].charAt(0) ? c[d++] = [0, h] : c[d++] = [-1, h]; break; default: if (f[g]) throw Error("Invalid diff operation in diff_fromDelta: " +
f[g]);
}
} if (e != a.length) throw Error("Delta length (" + e + ") does not equal source text length (" + a.length + ")."); return c
}; diff_match_patch.prototype.match_main = function (a, b, c) { if (null == a || null == b || null == c) throw Error("Null input. (match_main)"); c = Math.max(0, Math.min(c, a.length)); return a == b ? 0 : a.length ? a.substring(c, c + b.length) == b ? c : this.match_bitap_(a, b, c) : -1 };
diff_match_patch.prototype.match_bitap_ = function (a, b, c) {
function d(a, d) { var e = a / b.length, g = Math.abs(c - d); return !f.Match_Distance ? g ? 1 : e : e + g / f.Match_Distance } if (b.length > this.Match_MaxBits) throw Error("Pattern too long for this browser."); var e = this.match_alphabet_(b), f = this, g = this.Match_Threshold, h = a.indexOf(b, c); -1 != h && (g = Math.min(d(0, h), g), h = a.lastIndexOf(b, c + b.length), -1 != h && (g = Math.min(d(0, h), g))); for (var j = 1 << b.length - 1, h = -1, i, k, q = b.length + a.length, r, t = 0; t < b.length; t++) {
i = 0; for (k = q; i < k;)d(t, c +
k) <= g ? i = k : q = k, k = Math.floor((q - i) / 2 + i); q = k; i = Math.max(1, c - k + 1); var p = Math.min(c + k, a.length) + b.length; k = Array(p + 2); for (k[p + 1] = (1 << t) - 1; p >= i; p--) { var w = e[a.charAt(p - 1)]; k[p] = 0 === t ? (k[p + 1] << 1 | 1) & w : (k[p + 1] << 1 | 1) & w | ((r[p + 1] | r[p]) << 1 | 1) | r[p + 1]; if (k[p] & j && (w = d(t, p - 1), w <= g)) if (g = w, h = p - 1, h > c) i = Math.max(1, 2 * c - h); else break } if (d(t + 1, c) > g) break; r = k
} return h
};
diff_match_patch.prototype.match_alphabet_ = function (a) { for (var b = {}, c = 0; c < a.length; c++)b[a.charAt(c)] = 0; for (c = 0; c < a.length; c++)b[a.charAt(c)] |= 1 << a.length - c - 1; return b };
diff_match_patch.prototype.patch_addContext_ = function (a, b) {
if (0 != b.length) {
for (var c = b.substring(a.start2, a.start2 + a.length1), d = 0; b.indexOf(c) != b.lastIndexOf(c) && c.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin;)d += this.Patch_Margin, c = b.substring(a.start2 - d, a.start2 + a.length1 + d); d += this.Patch_Margin; (c = b.substring(a.start2 - d, a.start2)) && a.diffs.unshift([0, c]); (d = b.substring(a.start2 + a.length1, a.start2 + a.length1 + d)) && a.diffs.push([0, d]); a.start1 -= c.length; a.start2 -= c.length; a.length1 +=
c.length + d.length; a.length2 += c.length + d.length
}
};
diff_match_patch.prototype.patch_make = function (a, b, c) {
var d; if ("string" == typeof a && "string" == typeof b && "undefined" == typeof c) d = a, b = this.diff_main(d, b, !0), 2 < b.length && (this.diff_cleanupSemantic(b), this.diff_cleanupEfficiency(b)); else if (a && "object" == typeof a && "undefined" == typeof b && "undefined" == typeof c) b = a, d = this.diff_text1(b); else if ("string" == typeof a && b && "object" == typeof b && "undefined" == typeof c) d = a; else if ("string" == typeof a && "string" == typeof b && c && "object" == typeof c) d = a, b = c; else throw Error("Unknown call format to patch_make.");
if (0 === b.length) return []; c = []; a = new diff_match_patch.patch_obj; for (var e = 0, f = 0, g = 0, h = d, j = 0; j < b.length; j++) {
var i = b[j][0], k = b[j][1]; !e && 0 !== i && (a.start1 = f, a.start2 = g); switch (i) {
case 1: a.diffs[e++] = b[j]; a.length2 += k.length; d = d.substring(0, g) + k + d.substring(g); break; case -1: a.length1 += k.length; a.diffs[e++] = b[j]; d = d.substring(0, g) + d.substring(g + k.length); break; case 0: k.length <= 2 * this.Patch_Margin && e && b.length != j + 1 ? (a.diffs[e++] = b[j], a.length1 += k.length, a.length2 += k.length) : k.length >= 2 * this.Patch_Margin &&
e && (this.patch_addContext_(a, h), c.push(a), a = new diff_match_patch.patch_obj, e = 0, h = d, f = g)
}1 !== i && (f += k.length); -1 !== i && (g += k.length)
} e && (this.patch_addContext_(a, h), c.push(a)); return c
}; diff_match_patch.prototype.patch_deepCopy = function (a) { for (var b = [], c = 0; c < a.length; c++) { var d = a[c], e = new diff_match_patch.patch_obj; e.diffs = []; for (var f = 0; f < d.diffs.length; f++)e.diffs[f] = d.diffs[f].slice(); e.start1 = d.start1; e.start2 = d.start2; e.length1 = d.length1; e.length2 = d.length2; b[c] = e } return b };
diff_match_patch.prototype.patch_apply = function (a, b) {
if (0 == a.length) return [b, []]; a = this.patch_deepCopy(a); var c = this.patch_addPadding(a); b = c + b + c; this.patch_splitMax(a); for (var d = 0, e = [], f = 0; f < a.length; f++) {
var g = a[f].start2 + d, h = this.diff_text1(a[f].diffs), j, i = -1; if (h.length > this.Match_MaxBits) { if (j = this.match_main(b, h.substring(0, this.Match_MaxBits), g), -1 != j && (i = this.match_main(b, h.substring(h.length - this.Match_MaxBits), g + h.length - this.Match_MaxBits), -1 == i || j >= i)) j = -1 } else j = this.match_main(b, h, g);
if (-1 == j) e[f] = !1, d -= a[f].length2 - a[f].length1; else if (e[f] = !0, d = j - g, g = -1 == i ? b.substring(j, j + h.length) : b.substring(j, i + this.Match_MaxBits), h == g) b = b.substring(0, j) + this.diff_text2(a[f].diffs) + b.substring(j + h.length); else if (g = this.diff_main(h, g, !1), h.length > this.Match_MaxBits && this.diff_levenshtein(g) / h.length > this.Patch_DeleteThreshold) e[f] = !1; else {
this.diff_cleanupSemanticLossless(g); for (var h = 0, k, i = 0; i < a[f].diffs.length; i++) {
var q = a[f].diffs[i]; 0 !== q[0] && (k = this.diff_xIndex(g, h)); 1 === q[0] ? b = b.substring(0,
j + k) + q[1] + b.substring(j + k) : -1 === q[0] && (b = b.substring(0, j + k) + b.substring(j + this.diff_xIndex(g, h + q[1].length))); -1 !== q[0] && (h += q[1].length)
}
}
} b = b.substring(c.length, b.length - c.length); return [b, e]
};
diff_match_patch.prototype.patch_addPadding = function (a) {
for (var b = this.Patch_Margin, c = "", d = 1; d <= b; d++)c += String.fromCharCode(d); for (d = 0; d < a.length; d++)a[d].start1 += b, a[d].start2 += b; var d = a[0], e = d.diffs; if (0 == e.length || 0 != e[0][0]) e.unshift([0, c]), d.start1 -= b, d.start2 -= b, d.length1 += b, d.length2 += b; else if (b > e[0][1].length) { var f = b - e[0][1].length; e[0][1] = c.substring(e[0][1].length) + e[0][1]; d.start1 -= f; d.start2 -= f; d.length1 += f; d.length2 += f } d = a[a.length - 1]; e = d.diffs; 0 == e.length || 0 != e[e.length - 1][0] ? (e.push([0,
c]), d.length1 += b, d.length2 += b) : b > e[e.length - 1][1].length && (f = b - e[e.length - 1][1].length, e[e.length - 1][1] += c.substring(0, f), d.length1 += f, d.length2 += f); return c
};
diff_match_patch.prototype.patch_splitMax = function (a) {
for (var b = this.Match_MaxBits, c = 0; c < a.length; c++)if (!(a[c].length1 <= b)) {
var d = a[c]; a.splice(c--, 1); for (var e = d.start1, f = d.start2, g = ""; 0 !== d.diffs.length;) {
var h = new diff_match_patch.patch_obj, j = !0; h.start1 = e - g.length; h.start2 = f - g.length; "" !== g && (h.length1 = h.length2 = g.length, h.diffs.push([0, g])); for (; 0 !== d.diffs.length && h.length1 < b - this.Patch_Margin;) {
var g = d.diffs[0][0], i = d.diffs[0][1]; 1 === g ? (h.length2 += i.length, f += i.length, h.diffs.push(d.diffs.shift()),
j = !1) : -1 === g && 1 == h.diffs.length && 0 == h.diffs[0][0] && i.length > 2 * b ? (h.length1 += i.length, e += i.length, j = !1, h.diffs.push([g, i]), d.diffs.shift()) : (i = i.substring(0, b - h.length1 - this.Patch_Margin), h.length1 += i.length, e += i.length, 0 === g ? (h.length2 += i.length, f += i.length) : j = !1, h.diffs.push([g, i]), i == d.diffs[0][1] ? d.diffs.shift() : d.diffs[0][1] = d.diffs[0][1].substring(i.length))
} g = this.diff_text2(h.diffs); g = g.substring(g.length - this.Patch_Margin); i = this.diff_text1(d.diffs).substring(0, this.Patch_Margin); "" !== i &&
(h.length1 += i.length, h.length2 += i.length, 0 !== h.diffs.length && 0 === h.diffs[h.diffs.length - 1][0] ? h.diffs[h.diffs.length - 1][1] += i : h.diffs.push([0, i])); j || a.splice(++c, 0, h)
}
}
}; diff_match_patch.prototype.patch_toText = function (a) { for (var b = [], c = 0; c < a.length; c++)b[c] = a[c]; return b.join("") };
diff_match_patch.prototype.patch_fromText = function (a) {
var b = []; if (!a) return b; a = a.split("\n"); for (var c = 0, d = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/; c < a.length;) {
var e = a[c].match(d); if (!e) throw Error("Invalid patch string: " + a[c]); var f = new diff_match_patch.patch_obj; b.push(f); f.start1 = parseInt(e[1], 10); "" === e[2] ? (f.start1--, f.length1 = 1) : "0" == e[2] ? f.length1 = 0 : (f.start1--, f.length1 = parseInt(e[2], 10)); f.start2 = parseInt(e[3], 10); "" === e[4] ? (f.start2--, f.length2 = 1) : "0" == e[4] ? f.length2 = 0 : (f.start2--, f.length2 =
parseInt(e[4], 10)); for (c++; c < a.length;) { e = a[c].charAt(0); try { var g = decodeURI(a[c].substring(1)) } catch (h) { throw Error("Illegal escape in patch_fromText: " + g); } if ("-" == e) f.diffs.push([-1, g]); else if ("+" == e) f.diffs.push([1, g]); else if (" " == e) f.diffs.push([0, g]); else if ("@" == e) break; else if ("" !== e) throw Error('Invalid patch mode "' + e + '" in: ' + g); c++ }
} return b
}; diff_match_patch.patch_obj = function () { this.diffs = []; this.start2 = this.start1 = null; this.length2 = this.length1 = 0 };
diff_match_patch.patch_obj.prototype.toString = function () { var a, b; a = 0 === this.length1 ? this.start1 + ",0" : 1 == this.length1 ? this.start1 + 1 : this.start1 + 1 + "," + this.length1; b = 0 === this.length2 ? this.start2 + ",0" : 1 == this.length2 ? this.start2 + 1 : this.start2 + 1 + "," + this.length2; a = ["@@ -" + a + " +" + b + " @@\n"]; var c; for (b = 0; b < this.diffs.length; b++) { switch (this.diffs[b][0]) { case 1: c = "+"; break; case -1: c = "-"; break; case 0: c = " " }a[b + 1] = c + encodeURI(this.diffs[b][1]) + "\n" } return a.join("").replace(/%20/g, " ") };
this.diff_match_patch = diff_match_patch; this.DIFF_DELETE = -1; this.DIFF_INSERT = 1; this.DIFF_EQUAL = 0;
})();
// ---------------------------------------------------------------------------------edu_tpi.js START
// 实训游戏需要的js功能
var EXPAND = 0; // 放大
var SHRINK = 1; // 缩小
var repositoryTabHeight = 40
$(function () {
function update_rows_and_cols(rows) {
window.postMessage({ tp: 'resize', rows: rows, cols: 0 }, "*");
}
window.top.__updateWebsshRows = update_rows_and_cols
// TPI拖拽功能 begin
var doc = $(document);
var lab = $(".b-label");
var cen = $(".h-center");
var nextW2, nextW1;
var dragging = false;
var flag = false;
var wrapWidth;
var wrapHeight;
var nRow = 0;
//var nCol = 0;
lab.live('mousedown touchstart', function () {
$('#game_webssh').css('pointer-events', 'none')
dragging = true;
leftOffset = $(".labelN").offset().left;
wrapWidth = $(".labelN").width();
return false;
}
);
cen.live('mousedown ', function () {
// 使得iframe不捕获事件
$('#game_webssh').css('pointer-events', 'none')
flag = true;
topOffset = $(".centerH").offset().top;
wrapHeight = $(".centerH").height();
return false;
});
var FF = !(window.mozInnerScreenX == null);
var websshLineHeight = FF ? 19 : 18
doc.live('mousemove touchmove', function (e) {
$(".-brother").show();// 代码行的遮罩显示
if (dragging) {
clickX = e.pageX || e.originalEvent.touches[0].pageX;;
if (clickX > leftOffset + 0 && clickX < leftOffset + 1600) {
// console.log('resize')
lab.css('left', clickX - 7 - leftOffset + 'px');
$("#game_left_contents").width(clickX - leftOffset + 'px');
nextW2 = clickX - leftOffset;
$("#game_right_contents").width(wrapWidth - nextW2 + 'px');
} else {
lab.css('left', '0px');
}
}
if (flag) {
clickY = e.pageY;
if (clickY > topOffset + 100) {
cen.css('top', clickY - 7 - topOffset + 'px');
$("#games_repository_contents").height(clickY - topOffset + 'px');
// react add
$('.CodeMirror.cm-s-railscasts')
.css("height", clickY - topOffset - repositoryTabHeight - $('#games_repository_contents .codePath').height() - 12);
nextW1 = clickY - topOffset;
$("#games_valuation_contents").height(wrapHeight - nextW1 + 'px');
var h = $("#games_repository_contents").height() - $("#top_repository").height() - repositoryTabHeight;
var m = $("#games_repository_contents").height() - repositoryTabHeight;
$(".game_webssh").css("min-height", m);
$(".game_webssh").css("max-height", m);
// 火狐下行高为19
// CodeRepositoryView.js有同样的计算逻辑用来初始化ssh
var rows = Math.round(m / websshLineHeight);
//var cols = parseInt(w / 6.2);
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
} else {
cen.css('top', '0px');
}
// 行高发生变化则调整webssh的term的高度
if (nRow != rows) {
//window.frames['game_webssh'].contentWindow.resizeTerminal({rows:rows});
update_rows_and_cols(rows);
nRow = rows;
} else {
nRow = rows;
}
}
});
doc.live("mouseup touchend", function (e) {
// 使得iframe可以继续捕获事件
$('#game_webssh').css('pointer-events', 'inherit')
flag = false;
dragging = false;
e.cancelBubble = true;
$(".-brother").hide(); // 代码行的遮罩隐藏
});
window.__tpiOnResize = function () {
var m = $("#games_repository_contents").height() - repositoryTabHeight;
$(".game_webssh").css("min-height", m);
$(".game_webssh").css("max-height", m);
// var _iframe = document.getElementById("game_webssh");
// if(!_iframe){
// return;
// }
var FF = !(window.mozInnerScreenX == null);
var websshLineHeight = FF ? 19 : 18
var rows = Math.floor(m / websshLineHeight);
window.top.__updateWebsshRows && window.top.__updateWebsshRows(rows)
}
window.refresh_editor_monaco = function (height) {
}
// end;
//解決IE瀏覽器大小改變時webssh佈局變亂。
window.onresize = function () {
__tpiOnResize()
}
// 评论区域的回复按钮
function reply_to_dis(id, name) {
$("#comment_news").attr("placeholder", "回复" + name + ":");
$("#dis_reply_id").val(id);
$("#comment_news").focus();
}
// end
// 点击全部任务向右侧展开
$("#all_task_show").on("click", function (e) {
c = 0;
$("#all_task_tab").removeClass('leftnav-active');
$("#all_task_show").css("background", "rgba(0,0,0,0)");
$("#all_task_index").css("left", 0).stop().animate({
left: "-505px"
}, 400, function () {
$("#all_task_show").hide();
fadein = 0;
});
});
// end
// 列表区域阻止事件冒泡
$("#all_task_index").on("click", function (e) {
e.stopPropagation();
});
// end
// 下一关增加loading效果
$("#next_step").live("click", function () {
nNext = $("#next_step_area");
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
nNext.html(html);
});
// end
// 上一关增加loading效果
$("#prev_step").live("click", function () {
nNext = $("#prev_step_area");
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>上一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
nNext.html(html);
});
// end
});
var control = 0; // 版本库控制 0表示点击放大 1表示点击缩小
var control_1 = 0; // 测评控制 0表示点击放大 1表示点击缩小
// 版本库的放大与缩小
function repository_extend_and_zoom() {
var nGameRes = $("#games_repository_contents"); // 版本库区域
var nGameEva = $("#games_valuation_contents"); // 评测区域
var nRIcon = $("#extend_and_zoom").children("i"); // 版本库放大缩小按钮
var nMove = $(".h-center");
if (control == 0) {
nGameRes.addClass("-flex-basic100");
nGameEva.addClass("-flex-basic0");
nRIcon.addClass("fa-compress");
nRIcon.removeClass("fa-expand");
// $("#extend_and_zoom").attr("data-tip-left","收起");
nMove.hide();
control = 1;
} else if (control == 1) {
nGameRes.removeClass("-flex-basic100");
nGameEva.removeClass("-flex-basic0");
nRIcon.removeClass("fa-compress");
nRIcon.addClass("fa-expand");
// $("#extend_and_zoom").attr("data-tip-left","展开");
nMove.show();
control = 0;
}
}
// 测评的扩大与缩小
function valuation_extend_and_zoom() {
var nGameRes = $("#games_repository_contents"); // 版本库区域
var nGameEva = $("#games_valuation_contents"); // 评测区域
var nVIcon = $("#valuation_extend_and_zoom").children("i"); // 评测放大缩小
var nMove = $(".h-center");
if (control_1 == 0) {
nGameRes.addClass("-flex-basic0");
nGameEva.addClass("-flex-basic100");
nVIcon.removeClass("fa-expand");
nVIcon.addClass("fa-compress");
nMove.hide();
control_1 = 1;
} else if (control_1 == 1) {
nGameRes.removeClass("-flex-basic0");
nGameEva.removeClass("-flex-basic100");
nVIcon.addClass("fa-expand");
nVIcon.removeClass("fa-compress");
nMove.show();
control_1 = 0;
}
}
// end
// 点赞与取消点赞
var h = true;
function game_praise(obj_id, obj_type) {
if (treadStatus) {
return;
}
$.ajax({
url: "/praise_tread/praise_plus?obj_id=" + obj_id + "&obj_type=" + obj_type,
data: { horizontal: h, game_praise: true },
success: function (data) {
h = !h;
var praise_count = $("#game_praise_count");
if (data.praise) {
praiseStatus = true; //已赞
praise_count.html(data.praise_tread_count);
$("#game_praise_tread").children("i").addClass("color-orange03");
$("#game_praise_tread").attr("data-tip-top", "取消点赞")
} else {
praiseStatus = false; //取消赞
praise_count.html(data.praise_tread_count);
$("#game_praise_tread").children("i").removeClass("color-orange03");
$("#game_praise_tread").attr("data-tip-top", "点赞")
}
}
});
}
// 踩/取消踩功能
var d = true;
function game_tread(obj_id) {
if (praiseStatus) {
return;
}
$.ajax({
url: "/praise_tread/praise_plus?obj_id=" + obj_id + "&obj_type=ChallengeTread",
data: { horizontal: d, game_praise: true },
success: function (data) {
d = !d;
var tread_count = $("#game_tread_count");
if (data.praise) {
treadStatus = true; // 取消踩
tread_count.html(data.praise_tread_count);
$("#game_tread").children("i").addClass("color-orange");
$("#game_tread").attr("data-tip-top", "取消踩")
} else {
treadStatus = false; // 已踩
tread_count.html(data.praise_tread_count);
$("#game_tread").children("i").removeClass("color-orange");
$("#game_tread").attr("data-tip-top", "踩");
}
}
});
}
// ---------------------------------------------------------------------------------------------
$(function () { // 这里重新加一次事件监听,不在原有事件的基础上增加代码了
var doc = $(document);
var lab = $(".b-label");
var cen = $(".h-center");
var dragDom;
var dragging = false;
lab.live('mousedown', function () {
dragging = true;
dragDom = lab;
$('#htmlIframe').css('pointer-events', 'none')
$('#can-drag').show()
lab.hide()
return false;
}
);
cen.live('mousedown', function () {
dragging = true;
dragDom = cen;
// 使得iframe不捕获事件
$('#htmlIframe').css('pointer-events', 'none')
return false;
}
);
doc.live("mousemove", function (e) {
if (dragging === true && lab == dragDom) {
window._tpiWidthResize && window._tpiWidthResize()
// React 组件中需要resize搜索该引用可以找到初始化的位置
window._currentChildcommentMDEditor && window._currentChildcommentMDEditor.resize()
}
})
doc.live("mouseup", function (e) {
lab.show()
// 在大窗口将下边测试集滚动条拖上去后,将窗口缩小,再拖下来就有这种情况 https://www.trustie.net/issues/16326
if (dragging === true) {
$('#can-drag').hide()
window.editor_CodeMirror && window.editor_CodeMirror.refresh()
// 使得iframe可以继续捕获事件
$('#htmlIframe').css('pointer-events', 'inherit')
}
dragging = false;
});
})
// ---------------------------------------------------------------------------------------------
// md编辑器拖拽改变高度TODO其他初始化参数高度改变阈值...
// 写这里供非react版本时copy一份用
function initMDEditorDragResize(resizeBarSelector, mdEditor, options) {
if (!options) {
options = {}
}
if ($('#' + mdEditor.id).length === 0) {
console.error('未找到editor')
return;
}
var doc = $(document);
var editor__resize = $('#' + mdEditor.id).parent().find(resizeBarSelector);
if (editor__resize.length === 0) {
console.error('未找到resizeBar')
return;
}
var dragging = false;
var topOffset, clickY, initDelta;
var initHeight = options.initHeight || 240;
editor__resize.on('mousedown', function () {
dragging = true;
topOffset = editor__resize.offset().top;
initDelta = $('#' + mdEditor.id).height() - initHeight;
});
doc.live('mousemove', function (e) {
if (dragging) {
clickY = e.pageY;
var delta = clickY - topOffset + initDelta;
if (delta > 300) {
delta = 300;
}
if (delta < 0) {
delta = 0;
}
mdEditor.resize('', (initHeight + delta) + 'px')
// $('#memo_comment_editorMd').height(initHeight + delta)
}
return false
});
doc.live("mouseup", function (e) {
dragging = false;
});
}
// 计算文本宽度 https://stackoverflow.com/questions/1582534/calculating-text-width
function _textWidth(text, font) {
if (!window._fakeEl) window._fakeEl = $('<span>').hide().appendTo(document.body);
window._fakeEl.text(typeof text == 'object' ? text.val() || text.text() : text).css('font', font || text.css('font'));
return window._fakeEl.width();
}
// ---------------------------------------------------------------------------------------------
/**
* 评论使用的mdeditor初始化
* @param id 渲染DOM的id
* @param width 宽度
* @param high 高度
* @param placeholder
* @param imageUrl 上传图片的url
* @returns {*} 返回一个editorMD实例
*/
var _path = "/editormd/lib/"
var _isDev = window.location.port === "3007";
if (_isDev) {
_path = 'http://localhost:3000/editormd/lib/'
}
function create_editorMD_4comment(id, width, high, placeholder, imageUrl, callback, otherOptions) {
var editorName = window.editormd(id, Object.assign({
width: width,
height: high,
syncScrolling: "single",
//你的lib目录的路径我这边用JSP做测试的
path: _path, // "/editormd/lib/"
markdown: '',
tex: true,
tocm: true,
emoji: true,
taskList: true,
codeFold: true,
searchReplace: true,
htmlDecode: "style,script,iframe",
sequenceDiagram: true,
autoFocus: false,
toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|"
, "testIcon", "testIcon1", '|', "emoji", "image", "table", '|', "watch", "clear"]
},
toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6,
placeholder: placeholder,
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: imageUrl,//url
onload: function () {
// this.previewing();
$("#" + id + " [type=\"latex\"]").bind("click", function () {
editorName.cm.replaceSelection("```latex");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("```");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line - 1, 0);
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");
$("[type=\"latex\"]").attr("title", "多行公式");
callback && callback()
}
}, otherOptions));
return editorName;
}