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.
 
 
 
 

7 lines
751 KiB

try {
!function (d) { d.easyui = { indexOfArray: function (t, e, i) { for (var n = 0, o = t.length; n < o; n++)if (null == i) { if (t[n] == e) return n } else if (t[n][e] == i) return n; return -1 }, removeArrayItem: function (t, e, i) { if ("string" == typeof e) { for (var n = 0, o = t.length; n < o; n++)if (t[n][e] == i) return void t.splice(n, 1) } else { var r = this.indexOfArray(t, e); -1 != r && t.splice(r, 1) } }, addArrayItem: function (t, e, i) { var n = this.indexOfArray(t, e, i ? i[e] : void 0); -1 == n ? t.push(i || e) : t[n] = i || e }, getArrayItem: function (t, e, i) { i = this.indexOfArray(t, e, i); return -1 == i ? null : t[i] }, forEach: function (t, e, i) { for (var n = [], o = 0; o < t.length; o++)n.push(t[o]); for (; n.length;){ var r = n.shift(); if (0 == i(r)) return; if (e && r.children) for (o = r.children.length - 1; 0 <= o; o--)n.unshift(r.children[o]) } } }, d.parser = { auto: !0, emptyFn: function () { }, onComplete: function (t) { }, plugins: ["draggable", "droppable", "resizable", "pagination", "tooltip", "linkbutton", "menu", "sidemenu", "menubutton", "splitbutton", "switchbutton", "progressbar", "radiobutton", "checkbox", "tree", "textbox", "passwordbox", "maskedbox", "filebox", "combo", "combobox", "combotree", "combogrid", "combotreegrid", "tagbox", "numberbox", "validatebox", "searchbox", "spinner", "numberspinner", "timespinner", "datetimespinner", "calendar", "datebox", "datetimebox", "timepicker", "slider", "layout", "panel", "datagrid", "propertygrid", "treegrid", "datalist", "tabs", "accordion", "window", "dialog", "form"], parse: function (i) { for (var n = [], t = 0; t < d.parser.plugins.length; t++){ var e = d.parser.plugins[t], o = d(".easyui-" + e, i); o.length && (o[e] ? o.each(function () { d(this)[e](d.data(this, "options") || {}) }) : n.push({ name: e, jq: o })) } if (n.length && window.easyloader) { for (var r = [], t = 0; t < n.length; t++)r.push(n[t].name); easyloader.load(r, function () { for (var t = 0; t < n.length; t++){ var e = n[t].name; n[t].jq.each(function () { d(this)[e](d.data(this, "options") || {}) }) } d.parser.onComplete.call(d.parser, i) }) } else d.parser.onComplete.call(d.parser, i) }, parseValue: function (t, e, i, n) { n = n || 0; e = d.trim(String(e || "")); return e = "%" == e.substr(e.length - 1, 1) ? (e = parseFloat(e.substr(0, e.length - 1)), 0 <= t.toLowerCase().indexOf("width") ? (n += i[0].offsetWidth - i[0].clientWidth, Math.floor((i.width() - n) * e / 100)) : (n += i[0].offsetHeight - i[0].clientHeight, Math.floor((i.height() - n) * e / 100))) : parseInt(e) || void 0 }, parseOptions: function (i, t) { var e = d(i), n = {}, o = d.trim(e.attr("data-options")); if (o && ("{" != o.substring(0, 1) && (o = "{" + o + "}"), n = new Function("return " + o)()), d.map(["width", "height", "left", "top", "minWidth", "maxWidth", "minHeight", "maxHeight"], function (t) { var e = d.trim(i.style[t] || ""); e && (-1 == e.indexOf("%") && (e = parseInt(e), isNaN(e) && (e = void 0)), n[t] = e) }), t) { for (var r = {}, a = 0; a < t.length; a++){ var s = t[a]; if ("string" == typeof s) r[s] = e.attr(s); else for (var l in s) { var c = s[l]; "boolean" == c ? r[l] = e.attr(l) ? "true" == e.attr(l) : void 0 : "number" == c && (r[l] = "0" == e.attr(l) ? 0 : parseFloat(e.attr(l)) || void 0) } } d.extend(n, r) } return n }, parseVars: function () { var t = d('<div style="position:absolute;top:-1000px;width:100px;height:100px;padding:5px"></div>').appendTo("body"); d._boxModel = 100 != t.outerWidth(), t.remove(), t = d('<div style="position:fixed"></div>').appendTo("body"), d._positionFixed = "fixed" == t.css("position"), t.remove() } }, d(function () { d.parser.parseVars(), !window.easyloader && d.parser.auto && d.parser.parse() }), d.fn._outerWidth = function (t) { return null == t ? this[0] == window ? this.width() || document.body.clientWidth : this.outerWidth() || 0 : this._size("width", t) }, d.fn._outerHeight = function (t) { return null == t ? this[0] == window ? this.height() || document.body.clientHeight : this.outerHeight() || 0 : this._size("height", t) }, d.fn._scrollLeft = function (t) { return null == t ? this.scrollLeft() : this.each(function () { d(this).scrollLeft(t) }) }, d.fn._propAttr = d.fn.prop || d.fn.attr, d.fn._bind = d.fn.on, d.fn._unbind = d.fn.off, d.fn._size = function (i, n) { return "string" == typeof i ? "clear" == i ? this.each(function () { d(this).css({ width: "", minWidth: "", maxWidth: "", height: "", minHeight: "", maxHeight: "" }) }) : "fit" == i ? this.each(function () { o(this, "BODY" == this.tagName ? d("body") : d(this).parent(), !0) }) : "unfit" == i ? this.each(function () { o(this, d(this).parent(), !1) }) : null == n ? t(this[0], i) : this.each(function () { t(this, i, n) }) : this.each(function () { n = n || d(this).parent(), d.extend(i, o(this, n, i.fit) || {}); var t = r(this, "width", n, i), e = r(this, "height", n, i); t || e ? d(this).addClass("easyui-fluid") : d(this).removeClass("easyui-fluid") }); function o(t, e, i) { if (!e.length) return !1; var n = d(t)[0], t = e[0], e = t.fcount || 0; return i ? (n.fitted || (n.fitted = !0, t.fcount = e + 1, d(t).addClass("panel-noscroll"), "BODY" == t.tagName && d("html").addClass("panel-fit")), { width: d(t).width() || 1, height: d(t).height() || 1 }) : (n.fitted && (n.fitted = !1, t.fcount = e - 1, 0 == t.fcount && (d(t).removeClass("panel-noscroll"), "BODY" == t.tagName && d("html").removeClass("panel-fit"))), !1) } function r(t, e, i, n) { var o = d(t), r = e, a = r.substr(0, 1).toUpperCase() + r.substr(1), s = d.parser.parseValue("min" + a, n["min" + a], i), t = d.parser.parseValue("max" + a, n["max" + a], i), e = d.parser.parseValue(r, n[r], i), i = 0 <= String(n[r] || "").indexOf("%"); return isNaN(e) ? (o._size(r, ""), o._size("min" + a, s), o._size("max" + a, t)) : (t = Math.min(Math.max(e, s || 0), t || 99999), i || (n[r] = t), o._size("min" + a, ""), o._size("max" + a, ""), o._size(r, t)), i || n.fit } function t(t, e, i) { var n = d(t); if (null == i) return i = parseInt(t.style[e]), isNaN(i) ? void 0 : (d._boxModel && (i += o()), i); function o() { return 0 <= e.toLowerCase().indexOf("width") ? n.outerWidth() - n.width() : n.outerHeight() - n.height() } "" === i ? n.css(e, "") : (d._boxModel && (i -= o()) < 0 && (i = 0), n.css(e, i + "px")) } } }(jQuery), function (n) { var e = null, i = !1; function o(t, e, i) { e = new n.Event(e); e.pageX = t.changedTouches[0].pageX, e.pageY = t.changedTouches[0].pageY, e.which = i || 1, n(t.target).trigger(e) } document.addEventListener && (document.addEventListener("touchstart", function (t) { 1 == t.touches.length && (i ? (clearTimeout(dblClickTimer), i = !1, o(t, "dblclick")) : (i = !0, dblClickTimer = setTimeout(function () { i = !1 }, 500)), e = setTimeout(function () { o(t, "contextmenu", 3) }, 1e3), o(t, "mousedown"), (n.fn.draggable.isDragging || n.fn.resizable.isResizing) && t.preventDefault()) }, !0), document.addEventListener("touchmove", function (t) { 1 == t.touches.length && (e && clearTimeout(e), o(t, "mousemove"), (n.fn.draggable.isDragging || n.fn.resizable.isResizing) && t.preventDefault()) }, !0), document.addEventListener("touchend", function (t) { e && clearTimeout(e), o(t, "mouseup"), (n.fn.draggable.isDragging || n.fn.resizable.isResizing) && t.preventDefault() }, !0)) }(jQuery), function (l) { function o(t) { var e = l.data(t.data.target, "draggable"), i = e.options, n = e.proxy, o = t.data, r = o.startLeft + t.pageX - o.startX, e = o.startTop + t.pageY - o.startY; n && (n.parent()[0] == document.body ? (r = null != i.deltaX && null != i.deltaX ? t.pageX + i.deltaX : t.pageX - t.data.offsetWidth, e = null != i.deltaY && null != i.deltaY ? t.pageY + i.deltaY : t.pageY - t.data.offsetHeight) : (null != i.deltaX && null != i.deltaX && (r += t.data.offsetWidth + i.deltaX), null != i.deltaY && null != i.deltaY && (e += t.data.offsetHeight + i.deltaY))), t.data.parent != document.body && (r += l(t.data.parent).scrollLeft(), e += l(t.data.parent).scrollTop()), "h" == i.axis ? o.left = r : ("v" == i.axis || (o.left = r), o.top = e) } function r(t) { var e = l.data(t.data.target, "draggable"), i = e.options; (e.proxy || l(t.data.target)).css({ left: t.data.left, top: t.data.top }), l("body").css("cursor", i.cursor) } function a(e) { if (!l.fn.draggable.isDragging) return !1; var t = l.data(e.data.target, "draggable"), i = t.options, n = l(".droppable:visible").filter(function () { return e.data.target != this }).filter(function () { var t = l.data(this, "droppable").options.accept; return !t || 0 < l(t).filter(function () { return this == e.data.target }).length }); t.droppables = n; n = t.proxy; return n || (i.proxy ? (n = "clone" == i.proxy ? l(e.data.target).clone().insertAfter(e.data.target) : i.proxy.call(e.data.target, e.data.target), t.proxy = n) : n = l(e.data.target)), n.css("position", "absolute"), o(e), r(e), i.onStartDrag.call(e.data.target, e), !1 } function c(i) { if (!l.fn.draggable.isDragging) return !1; var t = l.data(i.data.target, "draggable"); o(i), 0 != t.options.onDrag.call(i.data.target, i) && r(i); var n = i.data.target; return t.droppables.each(function () { var t, e = l(this); e.droppable("options").disabled || (t = e.offset(), i.pageX > t.left && i.pageX < t.left + e.outerWidth() && i.pageY > t.top && i.pageY < t.top + e.outerHeight() ? (this.entered || (l(this).trigger("_dragenter", [n]), this.entered = !0), l(this).trigger("_dragover", [n])) : this.entered && (l(this).trigger("_dragleave", [n]), this.entered = !1)) }), !1 } function s(n) { if (!l.fn.draggable.isDragging) return d(), !1; c(n); var t, e, o = l.data(n.data.target, "draggable"), i = o.proxy, r = o.options; function a() { i && i.remove(), o.proxy = null } function s() { var i = !1; return o.droppables.each(function () { var t = l(this); if (!t.droppable("options").disabled) { var e = t.offset(); return n.pageX > e.left && n.pageX < e.left + t.outerWidth() && n.pageY > e.top && n.pageY < e.top + t.outerHeight() ? (r.revert && l(n.data.target).css({ position: n.data.startPosition, left: n.data.startLeft, top: n.data.startTop }), l(this).triggerHandler("_drop", [n.data.target]), a(), i = !0, this.entered = !1) : void 0 } }), i || r.revert || a(), i } return r.onEndDrag.call(n.data.target, n), r.revert ? 1 == s() ? l(n.data.target).css({ position: n.data.startPosition, left: n.data.startLeft, top: n.data.startTop }) : i ? (e = i.parent()[0] == document.body ? (t = n.data.startX - n.data.offsetWidth, n.data.startY - n.data.offsetHeight) : (t = n.data.startLeft, n.data.startTop), i.animate({ left: t, top: e }, function () { a() })) : l(n.data.target).animate({ left: n.data.startLeft, top: n.data.startTop }, function () { l(n.data.target).css("position", n.data.startPosition) }) : (l(n.data.target).css({ position: "absolute", left: n.data.left, top: n.data.top }), s()), r.onStopDrag.call(n.data.target, n), d(), !1 } function d() { l.fn.draggable.timer && (clearTimeout(l.fn.draggable.timer), l.fn.draggable.timer = void 0), l(document)._unbind(".draggable"), l.fn.draggable.isDragging = !1, setTimeout(function () { l("body").css("cursor", "") }, 100) } l.fn.draggable = function (i, t) { return "string" == typeof i ? l.fn.draggable.methods[i](this, t) : this.each(function () { var t = l.data(this, "draggable"), e = t ? (t.handle._unbind(".draggable"), l.extend(t.options, i)) : l.extend({}, l.fn.draggable.defaults, l.fn.draggable.parseOptions(this), i || {}), t = e.handle ? "string" == typeof e.handle ? l(e.handle, this) : e.handle : l(this); function n(t) { var e = l.data(t.data.target, "draggable"), i = e.handle, n = l(i).offset(), o = l(i).outerWidth(), r = l(i).outerHeight(), i = t.pageY - n.top, o = n.left + o - t.pageX, r = n.top + r - t.pageY, n = t.pageX - n.left; return Math.min(i, o, r, n) > e.options.edge } l.data(this, "draggable", { options: e, handle: t }), e.disabled ? l(this).css("cursor", "") : t._unbind(".draggable")._bind("mousemove.draggable", { target: this }, function (t) { var e; l.fn.draggable.isDragging || (e = l.data(t.data.target, "draggable").options, n(t) ? l(this).css("cursor", e.cursor) : l(this).css("cursor", "")) })._bind("mouseleave.draggable", { target: this }, function (t) { l(this).css("cursor", "") })._bind("mousedown.draggable", { target: this }, function (t) { if (0 != n(t)) { l(this).css("cursor", ""); var e = l(t.data.target).position(), i = l(t.data.target).offset(), i = { startPosition: l(t.data.target).css("position"), startLeft: e.left, startTop: e.top, left: e.left, top: e.top, startX: t.pageX, startY: t.pageY, width: l(t.data.target).outerWidth(), height: l(t.data.target).outerHeight(), offsetWidth: t.pageX - i.left, offsetHeight: t.pageY - i.top, target: t.data.target, parent: l(t.data.target).parent()[0] }; l.extend(t.data, i); i = l.data(t.data.target, "draggable").options; if (0 != i.onBeforeDrag.call(t.data.target, t)) return l(document)._bind("mousedown.draggable", t.data, a), l(document)._bind("mousemove.draggable", t.data, c), l(document)._bind("mouseup.draggable", t.data, s), l.fn.draggable.timer = setTimeout(function () { l.fn.draggable.isDragging = !0, a(t) }, i.delay), !1 } }) }) }, l.fn.draggable.methods = { options: function (t) { return l.data(t[0], "draggable").options }, proxy: function (t) { return l.data(t[0], "draggable").proxy }, enable: function (t) { return t.each(function () { l(this).draggable({ disabled: !1 }) }) }, disable: function (t) { return t.each(function () { l(this).draggable({ disabled: !0 }) }) } }, l.fn.draggable.parseOptions = function (t) { var e = l(t); return l.extend({}, l.parser.parseOptions(t, ["cursor", "handle", "axis", { revert: "boolean", deltaX: "number", deltaY: "number", edge: "number", delay: "number" }]), { disabled: !!e.attr("disabled") || void 0 }) }, l.fn.draggable.defaults = { proxy: null, revert: !1, cursor: "move", deltaX: null, deltaY: null, handle: null, disabled: !1, edge: 0, axis: null, delay: 100, onBeforeDrag: function (t) { }, onStartDrag: function (t) { }, onDrag: function (t) { }, onEndDrag: function (t) { }, onStopDrag: function (t) { } }, l.fn.draggable.isDragging = !1 }(jQuery), function (n) { n.fn.droppable = function (e, t) { return "string" == typeof e ? n.fn.droppable.methods[e](this, t) : (e = e || {}, this.each(function () { var i, t = n.data(this, "droppable"); t ? n.extend(t.options, e) : (n(i = this).addClass("droppable"), n(i)._bind("_dragenter", function (t, e) { n.data(i, "droppable").options.onDragEnter.apply(i, [t, e]) }), n(i)._bind("_dragleave", function (t, e) { n.data(i, "droppable").options.onDragLeave.apply(i, [t, e]) }), n(i)._bind("_dragover", function (t, e) { n.data(i, "droppable").options.onDragOver.apply(i, [t, e]) }), n(i)._bind("_drop", function (t, e) { n.data(i, "droppable").options.onDrop.apply(i, [t, e]) }), n.data(this, "droppable", { options: n.extend({}, n.fn.droppable.defaults, n.fn.droppable.parseOptions(this), e) })) })) }, n.fn.droppable.methods = { options: function (t) { return n.data(t[0], "droppable").options }, enable: function (t) { return t.each(function () { n(this).droppable({ disabled: !1 }) }) }, disable: function (t) { return t.each(function () { n(this).droppable({ disabled: !0 }) }) } }, n.fn.droppable.parseOptions = function (t) { var e = n(t); return n.extend({}, n.parser.parseOptions(t, ["accept"]), { disabled: !!e.attr("disabled") || void 0 }) }, n.fn.droppable.defaults = { accept: null, disabled: !1, onDragEnter: function (t, e) { }, onDragOver: function (t, e) { }, onDragLeave: function (t, e) { }, onDrop: function (t, e) { } } }(jQuery), function (d) { function e(t) { var e, i, n = t.data, o = d.data(n.target, "resizable").options; -1 != n.dir.indexOf("e") && (e = n.startWidth + t.pageX - n.startX, e = Math.min(Math.max(e, o.minWidth), o.maxWidth), n.width = e), -1 != n.dir.indexOf("s") && (i = n.startHeight + t.pageY - n.startY, i = Math.min(Math.max(i, o.minHeight), o.maxHeight), n.height = i), -1 != n.dir.indexOf("w") && (e = n.startWidth - t.pageX + n.startX, e = Math.min(Math.max(e, o.minWidth), o.maxWidth), n.width = e, n.left = n.startLeft + n.startWidth - n.width), -1 != n.dir.indexOf("n") && (i = n.startHeight - t.pageY + n.startY, i = Math.min(Math.max(i, o.minHeight), o.maxHeight), n.height = i, n.top = n.startTop + n.startHeight - n.height) } function i(t) { var e = t.data, t = d(e.target); t.css({ left: e.left, top: e.top }), t.outerWidth() != e.width && t._outerWidth(e.width), t.outerHeight() != e.height && t._outerHeight(e.height) } function o(t) { return d.fn.resizable.isResizing = !0, d.data(t.data.target, "resizable").options.onStartResize.call(t.data.target, t), !1 } function r(t) { return e(t), 0 != d.data(t.data.target, "resizable").options.onResize.call(t.data.target, t) && i(t), !1 } function a(t) { return d.fn.resizable.isResizing = !1, e(t), i(t), d.data(t.data.target, "resizable").options.onStopResize.call(t.data.target, t), d(document)._unbind(".resizable"), d("body").css("cursor", ""), !1 } function s(t) { var e = d(t.data.target).resizable("options"), i = d(t.data.target), n = "", o = i.offset(), r = i.outerWidth(), a = i.outerHeight(), i = e.edge; t.pageY > o.top && t.pageY < o.top + i ? n += "n" : t.pageY < o.top + a && t.pageY > o.top + a - i && (n += "s"), t.pageX > o.left && t.pageX < o.left + i ? n += "w" : t.pageX < o.left + r && t.pageX > o.left + r - i && (n += "e"); var s = e.handles.split(","), s = d.map(s, function (t) { return d.trim(t).toLowerCase() }); if (0 <= d.inArray("all", s) || 0 <= d.inArray(n, s)) return n; for (var l = 0; l < n.length; l++){ var c = d.inArray(n.substr(l, 1), s); if (0 <= c) return s[c] } return "" } d.fn.resizable = function (i, t) { return "string" == typeof i ? d.fn.resizable.methods[i](this, t) : this.each(function () { var t = null, e = d.data(this, "resizable"); e ? (d(this)._unbind(".resizable"), t = d.extend(e.options, i || {})) : (t = d.extend({}, d.fn.resizable.defaults, d.fn.resizable.parseOptions(this), i || {}), d.data(this, "resizable", { options: t })), 1 != t.disabled && d(this)._bind("mousemove.resizable", { target: this }, function (t) { var e; d.fn.resizable.isResizing || (e = s(t), d(t.data.target).css("cursor", e ? e + "-resize" : "")) })._bind("mouseleave.resizable", { target: this }, function (t) { d(t.data.target).css("cursor", "") })._bind("mousedown.resizable", { target: this }, function (e) { var t, i = s(e); function n(t) { t = parseInt(d(e.data.target).css(t)); return isNaN(t) ? 0 : t } "" != i && (t = { target: e.data.target, dir: i, startLeft: n("left"), startTop: n("top"), left: n("left"), top: n("top"), startX: e.pageX, startY: e.pageY, startWidth: d(e.data.target).outerWidth(), startHeight: d(e.data.target).outerHeight(), width: d(e.data.target).outerWidth(), height: d(e.data.target).outerHeight(), deltaWidth: d(e.data.target).outerWidth() - d(e.data.target).width(), deltaHeight: d(e.data.target).outerHeight() - d(e.data.target).height() }, d(document)._bind("mousedown.resizable", t, o), d(document)._bind("mousemove.resizable", t, r), d(document)._bind("mouseup.resizable", t, a), d("body").css("cursor", i + "-resize")) }) }) }, d.fn.resizable.methods = { options: function (t) { return d.data(t[0], "resizable").options }, enable: function (t) { return t.each(function () { d(this).resizable({ disabled: !1 }) }) }, disable: function (t) { return t.each(function () { d(this).resizable({ disabled: !0 }) }) } }, d.fn.resizable.parseOptions = function (t) { var e = d(t); return d.extend({}, d.parser.parseOptions(t, ["handles", { minWidth: "number", minHeight: "number", maxWidth: "number", maxHeight: "number", edge: "number" }]), { disabled: !!e.attr("disabled") || void 0 }) }, d.fn.resizable.defaults = { disabled: !1, handles: "n, e, s, w, ne, se, sw, nw, all", minWidth: 10, minHeight: 10, maxWidth: 1e4, maxHeight: 1e4, edge: 5, onStartResize: function (t) { }, onResize: function (t) { }, onStopResize: function (t) { } }, d.fn.resizable.isResizing = !1 }(jQuery), function (s) { function i(t, e) { var i, n, o, r, a = s.data(t, "linkbutton").options; e && s.extend(a, e), (a.width || a.height || a.fit) && (r = (i = s(t)).parent(), (e = i.is(":visible")) || (n = s('<div style="display:none"></div>').insertBefore(t), o = { position: i.css("position"), display: i.css("display"), left: i.css("left") }, i.appendTo("body"), i.css({ position: "absolute", display: "inline-block", left: -2e4 })), i._size(a, r), (r = i.find(".l-btn-left")).css("margin-top", 0), r.css("margin-top", parseInt((i.height() - r.height()) / 2) + "px"), e || (i.insertAfter(n), i.css(o), n.remove())) } function o(t, e) { var i = s.data(t, "linkbutton").options; e ? (i.group && s('a.l-btn[group="' + i.group + '"]').each(function () { var t = s(this).linkbutton("options"); t.toggle && (s(this).removeClass("l-btn-selected l-btn-plain-selected"), t.selected = !1) }), s(t).addClass(i.plain ? "l-btn-selected l-btn-plain-selected" : "l-btn-selected"), i.selected = !0) : i.group || (s(t).removeClass("l-btn-selected l-btn-plain-selected"), i.selected = !1) } function r(t, e) { var i, n = s.data(t, "linkbutton"), o = n.options; s(t).removeClass("l-btn-disabled l-btn-plain-disabled"), e ? (o.disabled = !0, (i = s(t).attr("href")) && (n.href = i, s(t).attr("href", "javascript:;")), t.onclick && (n.onclick = t.onclick, t.onclick = null), o.plain ? s(t).addClass("l-btn-disabled l-btn-plain-disabled") : s(t).addClass("l-btn-disabled")) : (o.disabled = !1, n.href && s(t).attr("href", n.href), n.onclick && (t.onclick = n.onclick)), s(t)._propAttr("disabled", e) } s.fn.linkbutton = function (e, t) { return "string" == typeof e ? s.fn.linkbutton.methods[e](this, t) : (e = e || {}, this.each(function () { var t = s.data(this, "linkbutton"); t ? s.extend(t.options, e) : (s.data(this, "linkbutton", { options: s.extend({}, s.fn.linkbutton.defaults, s.fn.linkbutton.parseOptions(this), e) }), s(this)._propAttr("disabled", !1), s(this)._bind("_resize", function (t, e) { return (s(this).hasClass("easyui-fluid") || e) && i(this), !1 })), function (t) { var e = s.data(t, "linkbutton").options, i = s(t).empty(); i.addClass("l-btn").removeClass("l-btn-plain l-btn-selected l-btn-plain-selected l-btn-outline"), i.removeClass("l-btn-small l-btn-medium l-btn-large").addClass("l-btn-" + e.size), e.plain && i.addClass("l-btn-plain"), e.outline && i.addClass("l-btn-outline"), e.selected && i.addClass(e.plain ? "l-btn-selected l-btn-plain-selected" : "l-btn-selected"), i.attr("group", e.group || ""), i.attr("id", e.id || ""); var n = s('<span class="l-btn-left"></span>').appendTo(i); (e.text ? s('<span class="l-btn-text"></span>').html(e.text) : s('<span class="l-btn-text l-btn-empty">&nbsp;</span>')).appendTo(n), e.iconCls && (s('<span class="l-btn-icon">&nbsp;</span>').addClass(e.iconCls).appendTo(n), n.addClass("l-btn-icon-" + e.iconAlign)), i._unbind(".linkbutton")._bind("focus.linkbutton", function () { e.disabled || s(this).addClass("l-btn-focus") })._bind("blur.linkbutton", function () { s(this).removeClass("l-btn-focus") })._bind("click.linkbutton", function () { e.disabled || (e.toggle && (e.selected ? s(this).linkbutton("unselect") : s(this).linkbutton("select")), e.onClick.call(this)) }), o(t, e.selected), r(t, e.disabled) }(this), i(this) })) }, s.fn.linkbutton.methods = { options: function (t) { return s.data(t[0], "linkbutton").options }, resize: function (t, e) { return t.each(function () { i(this, e) }) }, enable: function (t) { return t.each(function () { r(this, !1) }) }, disable: function (t) { return t.each(function () { r(this, !0) }) }, select: function (t) { return t.each(function () { o(this, !0) }) }, unselect: function (t) { return t.each(function () { o(this, !1) }) } }, s.fn.linkbutton.parseOptions = function (t) { var e = s(t); return s.extend({}, s.parser.parseOptions(t, ["id", "iconCls", "iconAlign", "group", "size", "text", { plain: "boolean", toggle: "boolean", selected: "boolean", outline: "boolean" }]), { disabled: !!e.attr("disabled") || void 0, text: s.trim(e.html()) || void 0, iconCls: e.attr("icon") || e.attr("iconCls") }) }, s.fn.linkbutton.defaults = { id: null, disabled: !1, toggle: !1, selected: !1, outline: !1, group: null, plain: !1, text: "", iconCls: null, iconAlign: "left", size: "small", onClick: function () { } } }(jQuery), function ($) { function _ac(_ad) { var _ae = $.data(_ad, "pagination"), _af = _ae.options, bb = _ae.bb = {}; _af.buttons && !$.isArray(_af.buttons) && $(_af.buttons).insertAfter(_ad); var _b0 = $(_ad).addClass("pagination").html('<table cellspacing="0" cellpadding="0" border="0"><tr></tr></table>'), tr = _b0.find("tr"), aa = $.extend([], _af.layout); _af.showPageList || _b1(aa, "list"), _af.showPageInfo || _b1(aa, "info"), _af.showRefresh || _b1(aa, "refresh"), "sep" == aa[0] && aa.shift(), "sep" == aa[aa.length - 1] && aa.pop(); for (var _b2 = 0; _b2 < aa.length; _b2++){ var _b3 = aa[_b2]; if ("list" == _b3) { var ps = $('<select class="pagination-page-list"></select>'); ps._bind("change", function () { _af.pageSize = parseInt($(this).val()), _af.onChangePageSize.call(_ad, _af.pageSize), _b9(_ad, _af.pageNumber) }); for (var i = 0; i < _af.pageList.length; i++)$("<option></option>").text(_af.pageList[i]).appendTo(ps); $("<td></td>").append(ps).appendTo(tr) } else "sep" == _b3 ? $('<td><div class="pagination-btn-separator"></div></td>').appendTo(tr) : "first" == _b3 ? bb.first = _b4("first") : "prev" == _b3 ? bb.prev = _b4("prev") : "next" == _b3 ? bb.next = _b4("next") : "last" == _b3 ? bb.last = _b4("last") : "manual" == _b3 ? ($('<span style="padding-left:6px;"></span>').html(_af.beforePageText).appendTo(tr).wrap("<td></td>"), bb.num = $('<input class="pagination-num" type="text" value="1" size="2">').appendTo(tr).wrap("<td></td>"), bb.num._unbind(".pagination")._bind("keydown.pagination", function (t) { if (13 == t.keyCode) { t = parseInt($(this).val()) || 1; return _b9(_ad, t), !1 } }), bb.after = $('<span style="padding-right:6px;"></span>').appendTo(tr).wrap("<td></td>")) : "refresh" == _b3 ? bb.refresh = _b4("refresh") : "links" == _b3 ? $('<td class="pagination-links"></td>').appendTo(tr) : "info" == _b3 && (_b2 == aa.length - 1 ? $('<div class="pagination-info"></div>').appendTo(_b0) : $('<td><div class="pagination-info"></div></td>').appendTo(tr)) } if (_af.buttons) if ($('<td><div class="pagination-btn-separator"></div></td>').appendTo(tr), $.isArray(_af.buttons)) for (var i = 0; i < _af.buttons.length; i++){ var btn = _af.buttons[i], td, a; "-" == btn ? $('<td><div class="pagination-btn-separator"></div></td>').appendTo(tr) : (td = $("<td></td>").appendTo(tr), a = $('<a href="javascript:;"></a>').appendTo(td), a[0].onclick = eval(btn.handler || function () { }), a.linkbutton($.extend({}, btn, { plain: !0 }))) } else { var td = $("<td></td>").appendTo(tr); $(_af.buttons).appendTo(td).show() } function _b4(t) { var e = _af.nav[t], t = $('<a href="javascript:;"></a>').appendTo(tr); return t.wrap("<td></td>"), t.linkbutton({ iconCls: e.iconCls, plain: !0 })._unbind(".pagination")._bind("click.pagination", function () { e.handler.call(_ad) }), t } function _b1(t, e) { e = $.inArray(e, t); return 0 <= e && t.splice(e, 1), t } $('<div style="clear:both;"></div>').appendTo(_b0) } function _b9(t, e) { var i = $.data(t, "pagination").options; 0 != i.onBeforeSelectPage.call(t, e, i.pageSize) ? (_bd(t, { pageNumber: e }), i.onSelectPage.call(t, i.pageNumber, i.pageSize)) : _bd(t) } function _bd(e, t) { var i = $.data(e, "pagination"), n = i.options, i = i.bb; $.extend(n, t || {}); t = $(e).find("select.pagination-page-list"); t.length && (t.val(n.pageSize + ""), n.pageSize = parseInt(t.val())); t = Math.ceil(n.total / n.pageSize) || 1; n.pageNumber < 1 && (n.pageNumber = 1), n.pageNumber > t && (n.pageNumber = t), 0 == n.total && (t = n.pageNumber = 0), i.num && i.num.val(n.pageNumber), i.after && i.after.html(n.afterPageText.replace(/{pages}/, t)); var o = $(e).find("td.pagination-links"); if (o.length) { o.empty(); var r = n.pageNumber - Math.floor(n.links / 2); r < 1 && (r = 1); var a = r + n.links - 1; t < a && (a = t), (r = a - n.links + 1) < 1 && (r = 1); for (var s = r; s <= a; s++){ var l = $('<a class="pagination-link" href="javascript:;"></a>').appendTo(o); l.linkbutton({ plain: !0, text: s }), s == n.pageNumber ? l.linkbutton("select") : l._unbind(".pagination")._bind("click.pagination", { pageNumber: s }, function (t) { _b9(e, t.data.pageNumber) }) } } r = n.displayMsg; r = (r = (r = r.replace(/{from}/, 0 == n.total ? 0 : n.pageSize * (n.pageNumber - 1) + 1)).replace(/{to}/, Math.min(n.pageSize * n.pageNumber, n.total))).replace(/{total}/, n.total), $(e).find("div.pagination-info").html(r), i.first && i.first.linkbutton({ disabled: !n.total || 1 == n.pageNumber }), i.prev && i.prev.linkbutton({ disabled: !n.total || 1 == n.pageNumber }), i.next && i.next.linkbutton({ disabled: n.pageNumber == t }), i.last && i.last.linkbutton({ disabled: n.pageNumber == t }), _c6(e, n.loading) } function _c6(t, e) { var i = $.data(t, "pagination"), t = i.options; t.loading = e, t.showRefresh && i.bb.refresh && i.bb.refresh.linkbutton({ iconCls: t.loading ? "pagination-loading" : "pagination-load" }) } $.fn.pagination = function (i, t) { return "string" == typeof i ? $.fn.pagination.methods[i](this, t) : (i = i || {}, this.each(function () { var t, e = $.data(this, "pagination"); e ? t = $.extend(e.options, i) : (t = $.extend({}, $.fn.pagination.defaults, $.fn.pagination.parseOptions(this), i), $.data(this, "pagination", { options: t })), _ac(this), _bd(this) })) }, $.fn.pagination.methods = { options: function (t) { return $.data(t[0], "pagination").options }, loading: function (t) { return t.each(function () { _c6(this, !0) }) }, loaded: function (t) { return t.each(function () { _c6(this, !1) }) }, refresh: function (t, e) { return t.each(function () { _bd(this, e) }) }, select: function (t, e) { return t.each(function () { _b9(this, e) }) } }, $.fn.pagination.parseOptions = function (_d1) { var t = $(_d1); return $.extend({}, $.parser.parseOptions(_d1, [{ total: "number", pageSize: "number", pageNumber: "number", links: "number" }, { loading: "boolean", showPageList: "boolean", showPageInfo: "boolean", showRefresh: "boolean" }]), { pageList: t.attr("pageList") ? eval(t.attr("pageList")) : void 0 }) }, $.fn.pagination.defaults = { total: 1, pageSize: 10, pageNumber: 1, pageList: [10, 20, 30, 50], loading: !1, buttons: null, showPageList: !0, showPageInfo: !0, showRefresh: !0, links: 10, layout: ["list", "sep", "first", "prev", "sep", "manual", "sep", "next", "last", "sep", "refresh", "info"], onBeforeSelectPage: function (t, e) { }, onSelectPage: function (t, e) { }, onBeforeRefresh: function (t, e) { }, onRefresh: function (t, e) { }, onChangePageSize: function (t) { }, beforePageText: "Page", afterPageText: "of {pages}", displayMsg: "Displaying {from} to {to} of {total} items", nav: { first: { iconCls: "pagination-first", handler: function () { 1 < $(this).pagination("options").pageNumber && $(this).pagination("select", 1) } }, prev: { iconCls: "pagination-prev", handler: function () { var t = $(this).pagination("options"); 1 < t.pageNumber && $(this).pagination("select", t.pageNumber - 1) } }, next: { iconCls: "pagination-next", handler: function () { var t = $(this).pagination("options"), e = Math.ceil(t.total / t.pageSize); t.pageNumber < e && $(this).pagination("select", t.pageNumber + 1) } }, last: { iconCls: "pagination-last", handler: function () { var t = $(this).pagination("options"), e = Math.ceil(t.total / t.pageSize); t.pageNumber < e && $(this).pagination("select", e) } }, refresh: { iconCls: "pagination-refresh", handler: function () { var t = $(this).pagination("options"); 0 != t.onBeforeRefresh.call(this, t.pageNumber, t.pageSize) && ($(this).pagination("select", t.pageNumber), t.onRefresh.call(this, t.pageNumber, t.pageSize)) } } } } }(jQuery), function (f) { function c(r) { var a = f.data(r, "tree"), s = a.options, t = a.tree; function l(t, e) { return f(t).closest("ul.tree").tree(e ? "pop" : "getData", t) } function c(t, e) { f(t).draggable("proxy").find("span.tree-dnd-icon").removeClass("tree-dnd-yes tree-dnd-no").addClass(e ? "tree-dnd-yes" : "tree-dnd-no") } function o(e, i) { function t() { var t = l(e, !0); f(r).tree("append", { parent: i, data: [t] }), s.onDrop.call(r, i, t, "append") } "closed" == _(r, i).state ? b(r, i, function () { t() }) : t() } function d(t, e, i) { var n = {}; "top" == i ? n.before = e : n.after = e; t = l(t, !0); n.data = t, f(r).tree("insert", n), s.onDrop.call(r, e, t, i) } a.disabledNodes = [], s.dnd = !0, t.find("div.tree-node").draggable({ disabled: !1, revert: !0, cursor: "pointer", proxy: function (t) { var e = f('<div class="tree-node-proxy"></div>').appendTo("body"); return e.html('<span class="tree-dnd-icon tree-dnd-no">&nbsp;</span>' + f(t).find(".tree-title").html()), e.hide(), e }, deltaX: 15, deltaY: 15, onBeforeDrag: function (t) { if (0 == s.onBeforeDrag.call(r, _(r, this))) return !1; if (f(t.target).hasClass("tree-hit") || f(t.target).hasClass("tree-checkbox")) return !1; if (1 != t.which) return !1; var e = f(this).find("span.tree-indent"); e.length && (t.data.offsetWidth -= e.length * e.width()) }, onStartDrag: function (t) { f(this).next("ul").find("div.tree-node").each(function () { f(this).droppable("disable"), a.disabledNodes.push(this) }), f(this).draggable("proxy").css({ left: -1e4, top: -1e4 }), s.onStartDrag.call(r, _(r, this)); var e = _(r, this); null == e.id && (e.id = "easyui_tree_node_id_temp", v(r, e)), a.draggingNodeId = e.id }, onDrag: function (t) { var e = t.pageX, i = t.pageY, n = t.data.startX, o = t.data.startY; 3 < Math.sqrt((e - n) * (e - n) + (i - o) * (i - o)) && f(this).draggable("proxy").show(), this.pageY = t.pageY }, onStopDrag: function () { for (var t = 0; t < a.disabledNodes.length; t++)f(a.disabledNodes[t]).droppable("enable"); a.disabledNodes = []; var e = w(r, a.draggingNodeId); e && "easyui_tree_node_id_temp" == e.id && (e.id = "", v(r, e)), s.onStopDrag.call(r, e) } }).droppable({ accept: "div.tree-node", onDragEnter: function (t, e) { 0 == s.onDragEnter.call(r, this, l(e)) && (c(e, !1), f(this).removeClass("tree-node-append tree-node-top tree-node-bottom"), f(this).droppable("disable"), a.disabledNodes.push(this)) }, onDragOver: function (t, e) { var i, n, o; f(this).droppable("options").disabled || (i = e.pageY, o = (n = f(this).offset().top) + f(this).outerHeight(), c(e, !0), f(this).removeClass("tree-node-append tree-node-top tree-node-bottom"), n + (o - n) / 2 < i ? o - i < 5 ? f(this).addClass("tree-node-bottom") : f(this).addClass("tree-node-append") : i - n < 5 ? f(this).addClass("tree-node-top") : f(this).addClass("tree-node-append"), 0 == s.onDragOver.call(r, this, l(e)) && (c(e, !1), f(this).removeClass("tree-node-append tree-node-top tree-node-bottom"), f(this).droppable("disable"), a.disabledNodes.push(this))) }, onDragLeave: function (t, e) { c(e, !1), f(this).removeClass("tree-node-append tree-node-top tree-node-bottom"), s.onDragLeave.call(r, this, l(e)) }, onDrop: function (t, e) { var i, n = f(this).hasClass("tree-node-append") ? (i = o, "append") : (i = d, f(this).hasClass("tree-node-top") ? "top" : "bottom"); 0 != s.onBeforeDrop.call(r, this, l(e), n) && i(e, this, n), f(this).removeClass("tree-node-append tree-node-top tree-node-bottom") } }) } function d(t, e, i, n) { var o = f.data(t, "tree").options; if (o.checkbox) { var r = _(t, e); if (r.checkState) { var a = f(e).find(".tree-checkbox"); if (null == i && (i = !a.hasClass("tree-checkbox1") && (!!a.hasClass("tree-checkbox0") || (null == r._checked && (r._checked = f(e).find(".tree-checkbox").hasClass("tree-checkbox1")), !r._checked))), r._checked = i) { if (a.hasClass("tree-checkbox1")) return } else if (a.hasClass("tree-checkbox0")) return; !n && 0 == o.onBeforeCheck.call(t, r, i) || (o.cascadeCheck ? (function (e, t, i) { var n = f.data(e, "tree").options, o = i ? 1 : 0; if (l(e, t, o), n.deepCheck) f.easyui.forEach(t.children || [], !0, function (t) { l(e, t, o) }); else { var r = []; t.children && t.children.length && r.push(t), f.easyui.forEach(t.children || [], !0, function (t) { t.hidden || (l(e, t, o), t.children && t.children.length && r.push(t)) }); for (var a = r.length - 1; 0 <= a; a--){ var s = r[a]; l(e, s, h(s)) } } }(t, r, i), s(t, r)) : l(t, r, i ? "1" : "0"), n || o.onCheck.call(t, r, i)) } } } function l(t, e, i) { t = f.data(t, "tree").options; e.checkState && null != i && (e.hidden && !t.deepCheck || (t = f("#" + e.domId).find(".tree-checkbox"), e.checkState = ["unchecked", "checked", "indeterminate"][i], e.checked = "checked" == e.checkState, t.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2"), t.addClass("tree-checkbox" + i))) } function s(t, e) { e = y(t, f("#" + e.domId)[0]); e && (l(t, e, h(e)), s(t, e)) } function h(t) { var e = 0, i = 0, n = 0; if (f.easyui.forEach(t.children || [], !1, function (t) { t.checkState && (n++ , "checked" == t.checkState ? i++ : "unchecked" == t.checkState && e++) }), 0 != n) return e == n ? 0 : i == n ? 1 : 2 } function u(t, e, i, n, o) { var r = f.data(t, "tree"), a = r.options, s = f(e).prevAll("div.tree-node:first"); i = a.loadFilter.call(t, i, s[0]); s = C(t, "domId", s.attr("id")); n ? s ? s.children ? s.children = s.children.concat(i) : s.children = i : r.data = r.data.concat(i) : (s ? s.children = i : r.data = i, f(e).empty()), a.view.render.call(a.view, t, e, i), a.dnd && c(t), s && v(t, s); for (var l = 0; l < r.tmpIds.length; l++)d(t, f("#" + r.tmpIds[l])[0], !0, !0); r.tmpIds = [], setTimeout(function () { p(t, t) }, 0), o || a.onLoadSuccess.call(t, s, i) } function p(o, t, r) { var e; f.data(o, "tree").options.lines ? (f(o).addClass("tree-lines"), r || (r = !0, f(o).find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom"), f(o).find("div.tree-node").removeClass("tree-node-last tree-root-first tree-root-one"), 1 < (e = f(o).tree("getRoots")).length ? f(e[0].target).addClass("tree-root-first") : 1 == e.length && f(e[0].target).addClass("tree-root-one")), f(t).children("li").each(function () { var t, e, i = f(this).children("div.tree-node"), n = i.next("ul"); n.length ? (f(this).next().length && (e = (t = i).find("span.tree-indent, span.tree-hit").length, t.next().find("div.tree-node").each(function () { f(this).children("span:eq(" + (e - 1) + ")").addClass("tree-line") })), p(o, n, r)) : i.find("span.tree-icon").prev("span.tree-indent").addClass("tree-join") }), f(t).children("li:last").children("div.tree-node").addClass("tree-node-last").children("span.tree-join").removeClass("tree-join").addClass("tree-joinbottom")) : f(o).removeClass("tree-lines") } function g(e, i, t, n) { var o = f.data(e, "tree").options; t = f.extend({}, o.queryParams, t || {}); var r, a, s = null; e != i && (r = f(i).prev(), s = _(e, r[0])), 0 != o.onBeforeLoad.call(e, s, t) && ((a = f(i).prev().children("span.tree-folder")).addClass("tree-loading"), 0 == o.loader.call(e, t, function (t) { a.removeClass("tree-loading"), u(e, i, t), n && n() }, function () { a.removeClass("tree-loading"), o.onLoadError.apply(e, arguments), n && n() }) && a.removeClass("tree-loading")) } function b(t, e, i) { var n, o, r = f.data(t, "tree").options, a = f(e).children("span.tree-hit"); 0 != a.length && (a.hasClass("tree-expanded") || (n = _(t, e), 0 != r.onBeforeExpand.call(t, n) && (a.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded"), a.next().addClass("tree-folder-open"), (a = f(e).next()).length ? r.animate ? a.slideDown("normal", function () { n.state = "open", r.onExpand.call(t, n), i && i() }) : (a.css("display", "block"), n.state = "open", r.onExpand.call(t, n), i && i()) : (o = f('<ul style="display:none"></ul>').insertAfter(e), g(t, o[0], { id: n.id }, function () { o.is(":empty") && o.remove(), r.animate ? o.slideDown("normal", function () { n.state = "open", r.onExpand.call(t, n), i && i() }) : (o.css("display", "block"), n.state = "open", r.onExpand.call(t, n), i && i()) }))))) } function o(t, e) { var i, n = f.data(t, "tree").options, o = f(e).children("span.tree-hit"); 0 != o.length && (o.hasClass("tree-collapsed") || (i = _(t, e), 0 != n.onBeforeCollapse.call(t, i) && (o.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"), o.next().removeClass("tree-folder-open"), e = f(e).next(), n.animate ? e.slideUp("normal", function () { i.state = "closed", n.onCollapse.call(t, i) }) : (e.css("display", "none"), i.state = "closed", n.onCollapse.call(t, i))))) } function r(t, e) { var i = f(e).children("span.tree-hit"); 0 != i.length && (i.hasClass("tree-expanded") ? o : b)(t, e) } function m(t, e) { var i, n = f(e.parent), o = e.data; o && (o = f.isArray(o) ? o : [o]).length && (0 == n.length ? i = f(t) : (k(0, n[0]) && ((e = n.find("span.tree-icon")).removeClass("tree-file").addClass("tree-folder tree-folder-open"), (e = f('<span class="tree-hit tree-expanded"></span>').insertBefore(e)).prev().length && e.prev().remove()), (i = n.next()).length || (i = f("<ul></ul>").insertAfter(n))), u(t, i[0], o, !0, !0)) } function i(o, t) { var e = function (t) { for (var e = f(t).attr("id"), t = y(o, t), i = t ? t.children : f.data(o, "tree").data, n = 0; n < i.length; n++)if (i[n].domId == e) { i.splice(n, 1); break } return t }(t); f(t).parent().remove(), e && (e.children && e.children.length || ((t = f(e.target)).find(".tree-icon").removeClass("tree-folder").addClass("tree-file"), t.find(".tree-hit").remove(), f('<span class="tree-indent"></span>').prependTo(t), t.next().remove()), v(o, e)), p(o, o) } function v(t, e) { var i, n, o = f.data(t, "tree").options, r = f(e.target), a = _(t, e.target); a.iconCls && r.find(".tree-icon").removeClass(a.iconCls), f.extend(a, e), r.find(".tree-title").html(o.formatter.call(t, a)), a.iconCls && r.find(".tree-icon").addClass(a.iconCls), i = t, o = e.target, (r = f.data(i, "tree").options).checkbox && (t = (a = f(o)).find(".tree-checkbox"), e = _(i, o), r.view.hasCheckbox(i, e) ? (t.length || (e.checkState = e.checkState || "unchecked", f('<span class="tree-checkbox"></span>').insertBefore(a.find(".tree-title"))), "checked" == e.checkState ? d(i, o, !0, !0) : "unchecked" == e.checkState || 0 === (n = h(e)) ? d(i, o, !1, !0) : 1 === n && d(i, o, !0, !0)) : (t.remove(), e.checkState = void 0, e.checked = void 0, s(i, e))) } function a(t) { for (var e = f.data(t, "tree").data, i = 0; i < e.length; i++)S(e[i]); return e } function x(t, e) { var i = [], e = _(t, e), t = e ? e.children || [] : f.data(t, "tree").data; return f.easyui.forEach(t, !0, function (t) { i.push(S(t)) }), i } function y(t, e) { return _(t, f(e).closest("ul").prevAll("div.tree-node:first")[0]) } function _(t, e) { return C(t, "domId", f(e).attr("id")) } function w(e, i) { var n; n = f.isFunction(i) ? i : (i = "object" == typeof i ? i : { id: i }, function (t) { for (var e in i) if (t[e] != i[e]) return !1; return !0 }); var o = null, t = f.data(e, "tree").data; return f.easyui.forEach(t, !0, function (t) { if (1 == n.call(e, t)) return o = S(t), !1 }), o } function C(t, e, i) { var n = {}; return n[e] = i, w(t, n) } function S(t) { return t.target = f("#" + t.domId)[0], t } function T(t, e) { var i = f.data(t, "tree").options, n = _(t, e); 0 != i.onBeforeSelect.call(t, n) && (f(t).find("div.tree-node-selected").removeClass("tree-node-selected"), f(e).addClass("tree-node-selected"), i.onSelect.call(t, n)) } function k(t, e) { return 0 == f(e).children("span.tree-hit").length } function O(t, e) { var i = f.data(t, "tree").options; f(e).css("position", ""); var n = f(e).find("input.tree-editor"), o = n.val(); n.remove(); e = _(t, e); e.text = o, v(t, e), i.onAfterEdit.call(t, e) } function F(t, e) { var i = f.data(t, "tree").options; f(e).css("position", ""), f(e).find("input.tree-editor").remove(); e = _(t, e); v(t, e), i.onCancelEdit.call(t, e) } function n(i, e) { var t, n = f.data(i, "tree"), o = n.options, r = {}; for (t in f.easyui.forEach(n.data, !0, function (t) { o.filter.call(i, e, t) ? (f("#" + t.domId).removeClass("tree-node-hidden"), r[t.domId] = 1, t.hidden = !1) : (f("#" + t.domId).addClass("tree-node-hidden"), t.hidden = !0) }), r) !function (t) { for (var e = f(i).tree("getParent", f("#" + t)[0]); e;)f(e.target).removeClass("tree-node-hidden"), e.hidden = !1, e = f(i).tree("getParent", e.target) }(t) } f.fn.tree = function (i, t) { if ("string" == typeof i) return f.fn.tree.methods[i](this, t); i = i || {}; return this.each(function () { var t, n, o, e = f.data(this, "tree"); e ? (t = f.extend(e.options, i), e.options = t) : (t = f.extend({}, f.fn.tree.defaults, f.fn.tree.parseOptions(this), i), f.data(this, "tree", { options: t, tree: ((e = f(e = this)).addClass("tree"), e), data: [], tmpIds: [] }), (e = f.fn.tree.parseData(this)).length && u(this, this, e)), n = this, o = f.data(n, "tree").options, f(n)._unbind()._bind("mouseover", function (t) { var e = f(t.target), i = e.closest("div.tree-node"); i.length && (i.addClass("tree-node-hover"), e.hasClass("tree-hit") && (e.hasClass("tree-expanded") ? e.addClass("tree-expanded-hover") : e.addClass("tree-collapsed-hover")), t.stopPropagation()) })._bind("mouseout", function (t) { var e = f(t.target), i = e.closest("div.tree-node"); i.length && (i.removeClass("tree-node-hover"), e.hasClass("tree-hit") && (e.hasClass("tree-expanded") ? e.removeClass("tree-expanded-hover") : e.removeClass("tree-collapsed-hover")), t.stopPropagation()) })._bind("click", function (t) { var e = f(t.target), i = e.closest("div.tree-node"); if (i.length) return e.hasClass("tree-hit") ? (r(n, i[0]), !1) : e.hasClass("tree-checkbox") ? (d(n, i[0]), !1) : (T(n, i[0]), o.onClick.call(n, _(n, i[0])), void t.stopPropagation()) })._bind("dblclick", function (t) { var e = f(t.target).closest("div.tree-node"); e.length && (T(n, e[0]), o.onDblClick.call(n, _(n, e[0])), t.stopPropagation()) })._bind("contextmenu", function (t) { var e = f(t.target).closest("div.tree-node"); e.length && (o.onContextMenu.call(n, t, _(n, e[0])), t.stopPropagation()) }), t.data && u(this, this, f.extend(!0, [], t.data)), g(this, this) }) }, f.fn.tree.methods = { options: function (t) { return f.data(t[0], "tree").options }, loadData: function (t, e) { return t.each(function () { u(this, this, e) }) }, getNode: function (t, e) { return _(t[0], e) }, getData: function (t, e) { return t = t[0], (e = _(t, e = e)) && e.children && f.easyui.forEach(e.children, !0, function (t) { S(t) }), e }, reload: function (t, e) { return t.each(function () { var t; e ? ((t = f(e)).children("span.tree-hit").removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"), t.next().remove(), b(this, e)) : (f(this).empty(), g(this, this)) }) }, getRoot: function (t, e) { return function (t, e) { if (e) { for (var i = y(t, e); i;)i = y(t, e = i.target); return _(t, e) } var n = a(t); return n.length ? n[0] : null }(t[0], e) }, getRoots: function (t) { return a(t[0]) }, getParent: function (t, e) { return y(t[0], e) }, getChildren: function (t, e) { return x(t[0], e) }, getChecked: function (t, e) { return function (t, e) { e = e || "checked", f.isArray(e) || (e = [e]); var i = []; return f.easyui.forEach(f.data(t, "tree").data, !0, function (t) { t.checkState && -1 != f.easyui.indexOfArray(e, t.checkState) && i.push(S(t)) }), i }(t[0], e) }, getSelected: function (t) { return e = t[0], (t = f(e).find("div.tree-node-selected")).length ? _(e, t[0]) : null; var e }, isLeaf: function (t, e) { return k(t[0], e) }, find: function (t, e) { return w(t[0], e) }, findBy: function (t, e) { return C(t[0], e.field, e.value) }, select: function (t, e) { return t.each(function () { T(this, e) }) }, check: function (t, e) { return t.each(function () { d(this, e, !0) }) }, uncheck: function (t, e) { return t.each(function () { d(this, e, !1) }) }, collapse: function (t, e) { return t.each(function () { o(this, e) }) }, expand: function (t, e) { return t.each(function () { b(this, e) }) }, collapseAll: function (t, e) { return t.each(function () { !function (t, e) { var i = x(t, e); e && i.unshift(_(t, e)); for (var n = 0; n < i.length; n++)o(t, i[n].target) }(this, e) }) }, expandAll: function (t, e) { return t.each(function () { !function (t, e) { var i = x(t, e); e && i.unshift(_(t, e)); for (var n = 0; n < i.length; n++)b(t, i[n].target) }(this, e) }) }, expandTo: function (t, o) { return t.each(function () { !function (t) { for (var e = [], i = y(t, o); i;)e.unshift(i), i = y(t, i.target); for (var n = 0; n < e.length; n++)b(t, e[n].target) }(this) }) }, scrollTo: function (t, e) { return t.each(function () { !function (t, e) { for (var i = f(t).parent(); "BODY" != i[0].tagName && "auto" != i.css("overflow-y");)i = i.parent(); var n = f(e), t = n.offset().top; "BODY" != i[0].tagName ? t < (e = i.offset().top) ? i.scrollTop(i.scrollTop() + t - e) : t + n.outerHeight() > e + i.outerHeight() - 18 && i.scrollTop(i.scrollTop() + t + n.outerHeight() - e - i.outerHeight() + 18) : i.scrollTop(t) }(this, e) }) }, toggle: function (t, e) { return t.each(function () { r(this, e) }) }, append: function (t, e) { return t.each(function () { m(this, e) }) }, insert: function (t, e) { return t.each(function () { !function (t, e) { var i = e.before || e.after, n = y(t, i), o = e.data; if (o && (o = f.isArray(o) ? o : [o]).length) { m(t, { parent: n ? n.target : null, data: o }); for (var r = n ? n.children : f(t).tree("getRoots"), a = 0; a < r.length; a++)if (r[a].domId == f(i).attr("id")) { for (var s = o.length - 1; 0 <= s; s--)r.splice(e.before ? a : a + 1, 0, o[s]); r.splice(r.length - o.length, o.length); break } for (var l = f(), a = 0; a < o.length; a++)l = l.add(f("#" + o[a].domId).parent()); e.before ? l.insertBefore(f(i).parent()) : l.insertAfter(f(i).parent()) } }(this, e) }) }, remove: function (t, e) { return t.each(function () { i(this, e) }) }, pop: function (t, e) { var i = t.tree("getData", e); return t.tree("remove", e), i }, update: function (t, e) { return t.each(function () { v(this, f.extend({}, e, { checkState: e.checked ? "checked" : !1 === e.checked ? "unchecked" : void 0 })) }) }, enableDnd: function (t) { return t.each(function () { c(this) }) }, disableDnd: function (t) { return t.each(function () { var t; t = this, f.data(t, "tree").options.dnd = !1, (t = f(t).find("div.tree-node")).draggable("disable"), t.css("cursor", "pointer") }) }, beginEdit: function (t, a) { return t.each(function () { var e, i, t, n, o, r; e = this, i = a, o = f.data(e, "tree").options, r = _(e, i), 0 != o.onBeforeEdit.call(e, r) && (f(i).css("position", "relative"), t = (n = f(i).find(".tree-title")).outerWidth(), n.empty(), (n = f('<input class="tree-editor">').appendTo(n)).val(r.text).focus(), n.width(t + 20), n._outerHeight(o.editorHeight), n._bind("click", function (t) { return !1 })._bind("mousedown", function (t) { t.stopPropagation() })._bind("mousemove", function (t) { t.stopPropagation() })._bind("keydown", function (t) { return 13 == t.keyCode ? (O(e, i), !1) : 27 == t.keyCode ? (F(e, i), !1) : void 0 })._bind("blur", function (t) { t.stopPropagation(), O(e, i) })) }) }, endEdit: function (t, e) { return t.each(function () { O(this, e) }) }, cancelEdit: function (t, e) { return t.each(function () { F(this, e) }) }, doFilter: function (t, e) { return t.each(function () { n(this, e) }) } }, f.fn.tree.parseOptions = function (t) { f(t); return f.extend({}, f.parser.parseOptions(t, ["url", "method", { checkbox: "boolean", cascadeCheck: "boolean", onlyLeafCheck: "boolean" }, { animate: "boolean", lines: "boolean", dnd: "boolean" }])) }, f.fn.tree.parseData = function (t) { var e = []; return function i(n, t) { t.children("li").each(function () { var t = f(this), e = f.extend({}, f.parser.parseOptions(this, ["id", "iconCls", "state"]), { checked: !!t.attr("checked") || void 0 }); e.text = t.children("span").html(), e.text || (e.text = t.html()); var t = t.children("ul"); t.length && (e.children = [], i(e.children, t)), n.push(e) }) }(e, f(t)), e }; var D = 1, t = { render: function (s, t, e) { var l = f.data(s, "tree"), c = l.options, i = f(t).prev(".tree-node"), d = i.length ? f(s).tree("getNode", i[0]) : null, i = i.find("span.tree-indent, span.tree-hit").length, h = f(s).attr("id") || "", e = u.call(this, i, e); function u(t, e) { for (var i = [], n = 0; n < e.length; n++){ var o = e[n]; "open" != o.state && "closed" != o.state && (o.state = "open"), o.domId = h + "_easyui_tree_" + D++ , i.push("<li>"), i.push('<div id="' + o.domId + '" class="tree-node' + (o.nodeCls ? " " + o.nodeCls : "") + '">'); for (var r, a = 0; a < t; a++)i.push('<span class="tree-indent"></span>'); "closed" == o.state ? (i.push('<span class="tree-hit tree-collapsed"></span>'), i.push('<span class="tree-icon tree-folder ' + (o.iconCls || "") + '"></span>')) : o.children && o.children.length ? (i.push('<span class="tree-hit tree-expanded"></span>'), i.push('<span class="tree-icon tree-folder tree-folder-open ' + (o.iconCls || "") + '"></span>')) : (i.push('<span class="tree-indent"></span>'), i.push('<span class="tree-icon tree-file ' + (o.iconCls || "") + '"></span>')), this.hasCheckbox(s, o) ? (r = 0, d && "checked" == d.checkState && c.cascadeCheck ? (r = 1, o.checked = !0) : o.checked && f.easyui.addArrayItem(l.tmpIds, o.domId), o.checkState = r ? "checked" : "unchecked", i.push('<span class="tree-checkbox tree-checkbox' + r + '"></span>')) : (o.checkState = void 0, o.checked = void 0), i.push('<span class="tree-title">' + c.formatter.call(s, o) + "</span>"), i.push("</div>"), o.children && o.children.length && (r = u.call(this, t + 1, o.children), i.push('<ul style="display:' + ("closed" == o.state ? "none" : "block") + '">'), (i = i.concat(r)).push("</ul>")), i.push("</li>") } return i } f(t).append(e.join("")) }, hasCheckbox: function (t, e) { var i = f.data(t, "tree").options; if (i.checkbox) { if (f.isFunction(i.checkbox)) return !!i.checkbox.call(t, e); if (!i.onlyLeafCheck) return !0; if (!("open" != e.state || e.children && e.children.length)) return !0 } return !1 } }; f.fn.tree.defaults = { url: null, method: "post", animate: !1, checkbox: !1, cascadeCheck: !0, onlyLeafCheck: !1, lines: !1, dnd: !1, editorHeight: 26, data: null, queryParams: {}, formatter: function (t) { return t.text }, filter: function (t, e) { var i = []; f.map(f.isArray(t) ? t : [t], function (t) { (t = f.trim(t)) && i.push(t) }); for (var n = 0; n < i.length; n++)if (0 <= e.text.toLowerCase().indexOf(i[n].toLowerCase())) return !0; return !i.length }, loader: function (t, e, i) { var n = f(this).tree("options"); if (!n.url) return !1; f.ajax({ type: n.method, url: n.url, data: t, dataType: "json", success: function (t) { e(t) }, error: function () { i.apply(this, arguments) } }) }, loadFilter: function (t, e) { return t }, view: t, onBeforeLoad: function (t, e) { }, onLoadSuccess: function (t, e) { }, onLoadError: function () { }, onClick: function (t) { }, onDblClick: function (t) { }, onBeforeExpand: function (t) { }, onExpand: function (t) { }, onBeforeCollapse: function (t) { }, onCollapse: function (t) { }, onBeforeCheck: function (t, e) { }, onCheck: function (t, e) { }, onBeforeSelect: function (t) { }, onSelect: function (t) { }, onContextMenu: function (t, e) { }, onBeforeDrag: function (t) { }, onStartDrag: function (t) { }, onStopDrag: function (t) { }, onDragEnter: function (t, e) { }, onDragOver: function (t, e) { }, onDragLeave: function (t, e) { }, onBeforeDrop: function (t, e, i) { }, onDrop: function (t, e, i) { }, onBeforeEdit: function (t) { }, onAfterEdit: function (t) { }, onCancelEdit: function (t) { } } }(jQuery), function (o) { function n(t, e) { var i = o.data(t, "progressbar").options, t = o.data(t, "progressbar").bar; e && (i.width = e), t._size(i), t.find("div.progressbar-text").css("width", t.width()), t.find("div.progressbar-text,div.progressbar-value").css({ height: t.height() + "px", lineHeight: t.height() + "px" }) } o.fn.progressbar = function (e, t) { if ("string" == typeof e) { var i = o.fn.progressbar.methods[e]; if (i) return i(this, t) } return e = e || {}, this.each(function () { var i, t = o.data(this, "progressbar"); t ? o.extend(t.options, e) : t = o.data(this, "progressbar", { options: o.extend({}, o.fn.progressbar.defaults, o.fn.progressbar.parseOptions(this), e), bar: (o(i = this).addClass("progressbar"), o(i).html('<div class="progressbar-text"></div><div class="progressbar-value"><div class="progressbar-text"></div></div>'), o(i)._bind("_resize", function (t, e) { return (o(this).hasClass("easyui-fluid") || e) && n(i), !1 }), o(i)) }), o(this).progressbar("setValue", t.options.value), n(this) }) }, o.fn.progressbar.methods = { options: function (t) { return o.data(t[0], "progressbar").options }, resize: function (t, e) { return t.each(function () { n(this, e) }) }, getValue: function (t) { return o.data(t[0], "progressbar").options.value }, setValue: function (t, n) { return n < 0 && (n = 0), 100 < n && (n = 100), t.each(function () { var t = o.data(this, "progressbar").options, e = t.text.replace(/{value}/, n), i = t.value; t.value = n, o(this).find("div.progressbar-value").width(n + "%"), o(this).find("div.progressbar-text").html(e), i != n && t.onChange.call(this, n, i) }) } }, o.fn.progressbar.parseOptions = function (t) { return o.extend({}, o.parser.parseOptions(t, ["width", "height", "text", { value: "number" }])) }, o.fn.progressbar.defaults = { width: "auto", height: 22, value: 0, text: "{value}%", onChange: function (t, e) { } } }(jQuery), function (l) { function s(t) { t = l.data(t, "tooltip"); t.showTimer && (clearTimeout(t.showTimer), t.showTimer = null), t.hideTimer && (clearTimeout(t.hideTimer), t.hideTimer = null) } function c(t, e) { var i = l.data(t, "tooltip"), n = i.options; e && (n.content = e), i.tip && (e = "function" == typeof n.content ? n.content.call(t) : n.content, i.tip.children(".tooltip-content").html(e), n.onUpdate.call(t, e)) } l.fn.tooltip = function (n, t) { return "string" == typeof n ? l.fn.tooltip.methods[n](this, t) : (n = n || {}, this.each(function () { var e, i, t = l.data(this, "tooltip"); t ? l.extend(t.options, n) : (l.data(this, "tooltip", { options: l.extend({}, l.fn.tooltip.defaults, l.fn.tooltip.parseOptions(this), n) }), l(this).addClass("tooltip-f")), e = this, i = l.data(e, "tooltip").options, l(e)._unbind(".tooltip")._bind(i.showEvent + ".tooltip", function (t) { l(e).tooltip("show", t) })._bind(i.hideEvent + ".tooltip", function (t) { l(e).tooltip("hide", t) })._bind("mousemove.tooltip", function (t) { i.trackMouse && (i.trackMouseX = t.pageX, i.trackMouseY = t.pageY, l(e).tooltip("reposition")) }), c(this) })) }, l.fn.tooltip.methods = { options: function (t) { return l.data(t[0], "tooltip").options }, tip: function (t) { return l.data(t[0], "tooltip").tip }, arrow: function (t) { return t.tooltip("tip").children(".tooltip-arrow-outer,.tooltip-arrow") }, show: function (t, e) { return t.each(function () { var n, o, t, r, a; n = this, o = e, t = l.data(n, "tooltip"), r = t.options, (a = t.tip) || (a = l('<div tabindex="-1" class="tooltip"><div class="tooltip-content"></div><div class="tooltip-arrow-outer"></div><div class="tooltip-arrow"></div></div>').appendTo("body"), t.tip = a, c(n)), s(n), t.showTimer = setTimeout(function () { l(n).tooltip("reposition"), a.show(), r.onShow.call(n, o); var t = a.children(".tooltip-arrow-outer"), e = a.children(".tooltip-arrow"), i = "border-" + r.position + "-color"; t.add(e).css({ borderTopColor: "", borderBottomColor: "", borderLeftColor: "", borderRightColor: "" }), t.css(i, a.css(i)), e.css(i, a.css("backgroundColor")) }, r.showDelay) }) }, hide: function (t, n) { return t.each(function () { var t, e, i; t = this, e = n, (i = l.data(t, "tooltip")) && i.tip && (s(t), i.hideTimer = setTimeout(function () { i.tip.hide(), i.options.onHide.call(t, e) }, i.options.hideDelay)) }) }, update: function (t, e) { return t.each(function () { c(this, e) }) }, reposition: function (t) { return t.each(function () { function t(t) { a.position = t || "bottom", s.removeClass("tooltip-top tooltip-bottom tooltip-left tooltip-right").addClass("tooltip-" + a.position); var e, i, n, o = l.isFunction(a.deltaX) ? a.deltaX.call(r, a.position) : a.deltaX, t = l.isFunction(a.deltaY) ? a.deltaY.call(r, a.position) : a.deltaY; switch (n = a.trackMouse ? (e = l(), i = a.trackMouseX + o, a.trackMouseY + t) : (i = (e = l(r)).offset().left + o, e.offset().top + t), a.position) { case "right": i += e._outerWidth() + 12 + (a.trackMouse ? 12 : 0), "middle" == a.valign && (n -= (s._outerHeight() - e._outerHeight()) / 2); break; case "left": i -= s._outerWidth() + 12 + (a.trackMouse ? 12 : 0), "middle" == a.valign && (n -= (s._outerHeight() - e._outerHeight()) / 2); break; case "top": i -= (s._outerWidth() - e._outerWidth()) / 2, n -= s._outerHeight() + 12 + (a.trackMouse ? 12 : 0); break; case "bottom": i -= (s._outerWidth() - e._outerWidth()) / 2, n += e._outerHeight() + 12 + (a.trackMouse ? 12 : 0) }return { left: i, top: n } } var r, a, s, e, i; r = this, (i = l.data(r, "tooltip")) && i.tip && (a = i.options, s = i.tip, e = { left: -1e5, top: -1e5 }, l(r).is(":visible") && (e = t(a.position), "top" == a.position && e.top < 0 ? e = t("bottom") : "bottom" == a.position && e.top + s._outerHeight() > l(window)._outerHeight() + l(document).scrollTop() && (e = t("top")), e.left < 0 ? "left" == a.position ? e = t("right") : (l(r).tooltip("arrow").css("left", s._outerWidth() / 2 + e.left), e.left = 0) : e.left + s._outerWidth() > l(window)._outerWidth() + l(document)._scrollLeft() && ("right" == a.position ? e = t("left") : (i = e.left, e.left = l(window)._outerWidth() + l(document)._scrollLeft() - s._outerWidth(), l(r).tooltip("arrow").css("left", s._outerWidth() / 2 - (e.left - i))))), s.css({ left: e.left, top: e.top, zIndex: null != a.zIndex ? a.zIndex : l.fn.window ? l.fn.window.defaults.zIndex++ : "" }), a.onPosition.call(r, e.left, e.top)) }) }, destroy: function (t) { return t.each(function () { var t, e, i; t = this, (i = l.data(t, "tooltip")) && (s(t), e = i.options, i.tip && i.tip.remove(), e._title && l(t).attr("title", e._title), l.removeData(t, "tooltip"), l(t)._unbind(".tooltip").removeClass("tooltip-f"), e.onDestroy.call(t)) }) } }, l.fn.tooltip.parseOptions = function (t) { var e = l(t), t = l.extend({}, l.parser.parseOptions(t, ["position", "showEvent", "hideEvent", "content", { trackMouse: "boolean", deltaX: "number", deltaY: "number", showDelay: "number", hideDelay: "number" }]), { _title: e.attr("title") }); return e.attr("title", ""), t.content || (t.content = t._title), t }, l.fn.tooltip.defaults = { position: "bottom", valign: "middle", content: null, trackMouse: !1, deltaX: 0, deltaY: 0, showEvent: "mouseenter", hideEvent: "mouseleave", showDelay: 200, hideDelay: 100, onShow: function (t) { }, onHide: function (t) { }, onUpdate: function (t) { }, onPosition: function (t, e) { }, onDestroy: function () { } } }(jQuery), function ($) { function _217(t) { t._remove() } function _218(t, e) { var i = $.data(t, "panel"), n = i.options, o = i.panel, r = o.children(".panel-header"), a = o.children(".panel-body"), s = o.children(".panel-footer"), l = "left" == n.halign || "right" == n.halign; e && ($.extend(n, { width: e.width, height: e.height, minWidth: e.minWidth, maxWidth: e.maxWidth, minHeight: e.minHeight, maxHeight: e.maxHeight, left: e.left, top: e.top }), n.hasResized = !1); var c = o.outerWidth(), d = o.outerHeight(); o._size(n); var h, u, f, i = o.outerWidth(), e = o.outerHeight(); n.hasResized && c == i && d == e || (n.hasResized = !0, l || r._outerWidth(o.width()), a._outerWidth(o.width()), isNaN(parseInt(n.height)) ? (a.css("height", ""), h = $.parser.parseValue("minHeight", n.minHeight, o.parent()), u = $.parser.parseValue("maxHeight", n.maxHeight, o.parent()), f = r._outerHeight() + s._outerHeight() + o._outerHeight() - o.height(), a._size("minHeight", h ? h - f : ""), a._size("maxHeight", u ? u - f : "")) : l ? (h = n.header ? $(n.header)._outerWidth() : (r.css("width", ""), r._outerWidth()), u = r.find(".panel-title"), h += Math.min(u._outerWidth(), u._outerHeight()), f = o.height(), r._outerWidth(h)._outerHeight(f), u._outerWidth(r.height()), a._outerWidth(o.width() - h - s._outerWidth())._outerHeight(f), s._outerHeight(f), a.css({ left: "", right: "" }), r.length && a.css(n.halign, r.position()[n.halign] + h + "px"), n.panelCssWidth = o.css("width"), n.collapsed && o._outerWidth(h + s._outerWidth())) : a._outerHeight(o.height() - r._outerHeight() - s._outerHeight()), o.css({ height: l ? void 0 : "", minHeight: "", maxHeight: "", left: n.left, top: n.top }), n.onResize.apply(t, [n.width, n.height]), $(t).panel("doLayout")) } function _229(t, e) { var i = $.data(t, "panel"), n = i.options, i = i.panel; e && (null != e.left && (n.left = e.left), null != e.top && (n.top = e.top)), i.css({ left: n.left, top: n.top }), i.find(".tooltip-f").each(function () { $(this).tooltip("reposition") }), n.onMove.apply(t, [n.left, n.top]) } function _22e(i) { $(i).addClass("panel-body")._size("clear"); var t = $('<div class="panel"></div>').insertBefore(i); return t[0].appendChild(i), t._bind("_resize", function (t, e) { return ($(this).hasClass("easyui-fluid") || e) && _218(i, {}), !1 }), t } function _232(_233) { var _234 = $.data(_233, "panel"), opts = _234.options, _235 = _234.panel; _235.css(opts.style), _235.addClass(opts.cls), _235.removeClass("panel-hleft panel-hright").addClass("panel-h" + opts.halign), _236(), _237(); var _238 = $(_233).panel("header"), body = $(_233).panel("body"), _239 = $(_233).siblings(".panel-footer"); function _236() { var _23a, _23b, tool; opts.noheader || !opts.title && !opts.header ? (_217(_235.children(".panel-header")), _235.children(".panel-body").addClass("panel-body-noheader")) : (opts.header ? $(opts.header).addClass("panel-header").prependTo(_235) : (_23a = _235.children(".panel-header"), _23a.length || (_23a = $('<div class="panel-header"></div>').prependTo(_235)), $.isArray(opts.tools) || _23a.find("div.panel-tool .panel-tool-a").appendTo(opts.tools), _23a.empty(), _23b = $('<div class="panel-title"></div>').html(opts.title).appendTo(_23a), opts.iconCls && (_23b.addClass("panel-with-icon"), $('<div class="panel-icon"></div>').addClass(opts.iconCls).appendTo(_23a)), "left" != opts.halign && "right" != opts.halign || _23b.addClass("panel-title-" + opts.titleDirection), tool = $('<div class="panel-tool"></div>').appendTo(_23a), tool._bind("click", function (t) { t.stopPropagation() }), opts.tools && ($.isArray(opts.tools) ? $.map(opts.tools, function (t) { _23c(tool, t.iconCls, eval(t.handler)) }) : $(opts.tools).children().each(function () { $(this).addClass($(this).attr("iconCls")).addClass("panel-tool-a").appendTo(tool) })), opts.collapsible && _23c(tool, "panel-tool-collapse", function () { (1 == opts.collapsed ? _25d : _24e)(_233, !0) }), opts.minimizable && _23c(tool, "panel-tool-min", function () { _263(_233) }), opts.maximizable && _23c(tool, "panel-tool-max", function () { (1 == opts.maximized ? _266 : _24d)(_233) }), opts.closable && _23c(tool, "panel-tool-close", function () { _24f(_233) })), _235.children("div.panel-body").removeClass("panel-body-noheader")) } function _23c(t, e, i) { $('<a href="javascript:;"></a>').addClass(e).appendTo(t)._bind("click", i) } function _237() { opts.footer ? ($(opts.footer).addClass("panel-footer").appendTo(_235), $(_233).addClass("panel-body-nobottom")) : (_235.children(".panel-footer").remove(), $(_233).removeClass("panel-body-nobottom")) } opts.border ? (_238.removeClass("panel-header-noborder"), body.removeClass("panel-body-noborder"), _239.removeClass("panel-footer-noborder")) : (_238.addClass("panel-header-noborder"), body.addClass("panel-body-noborder"), _239.addClass("panel-footer-noborder")), _238.addClass(opts.headerCls), body.addClass(opts.bodyCls), $(_233).attr("id", opts.id || ""), opts.content && ($(_233).panel("clear"), $(_233).html(opts.content), $.parser.parse($(_233))) } function _23e(i, t) { var e, n = $.data(i, "panel"), o = n.options; o.href && (n.isLoaded && o.cache || (e = $.extend({}, o.queryParams), 0 != o.onBeforeLoad.call(i, e) && (n.isLoaded = !1, o.loadingMessage && ($(i).panel("clear"), $(i).html($('<div class="panel-loading"></div>').html(o.loadingMessage))), o.loader.call(i, e, function (t) { var e = o.extractor.call(i, t); $(i).panel("clear"), $(i).html(e), $.parser.parse($(i)), o.onLoad.apply(i, arguments), n.isLoaded = !0 }, function () { o.onLoadError.apply(i, arguments) })))) } function _244(t) { t = $(t); t.find(".combo-f").each(function () { $(this).combo("destroy") }), t.find(".m-btn").each(function () { $(this).menubutton("destroy") }), t.find(".s-btn").each(function () { $(this).splitbutton("destroy") }), t.find(".tooltip-f").each(function () { $(this).tooltip("destroy") }), t.children("div").each(function () { $(this)._size("unfit") }), t.empty() } function _246(t) { $(t).panel("doLayout", !0) } function _248(t, e) { var i = $.data(t, "panel"), n = i.options, o = i.panel; if (1 == e || 0 != n.onBeforeOpen.call(t)) if (o.stop(!0, !0), $.isFunction(n.openAnimation)) n.openAnimation.call(t, r); else switch (n.openAnimation) { case "slide": o.slideDown(n.openDuration, r); break; case "fade": o.fadeIn(n.openDuration, r); break; case "show": o.show(n.openDuration, r); break; default: o.show(), r() }function r() { n.closed = !1, n.minimized = !1, o.children(".panel-header").find("a.panel-tool-restore").length && (n.maximized = !0), n.onOpen.call(t), 1 == n.maximized && (n.maximized = !1, _24d(t)), 1 == n.collapsed && (n.collapsed = !1, _24e(t)), n.collapsed || !n.href || i.isLoaded && n.cache || (_23e(t), _246(t), n.doneLayout = !0), n.doneLayout || (n.doneLayout = !0, _246(t)) } } function _24f(t, e) { var i = $.data(t, "panel"), n = i.options, o = i.panel; if (1 == e || 0 != n.onBeforeClose.call(t)) if (o.find(".tooltip-f").each(function () { $(this).tooltip("hide") }), o.stop(!0, !0), o._size("unfit"), $.isFunction(n.closeAnimation)) n.closeAnimation.call(t, r); else switch (n.closeAnimation) { case "slide": o.slideUp(n.closeDuration, r); break; case "fade": o.fadeOut(n.closeDuration, r); break; case "hide": o.hide(n.closeDuration, r); break; default: o.hide(), r() }function r() { n.closed = !0, n.onClose.call(t) } } function _254(t, e) { var i = $.data(t, "panel"), n = i.options, i = i.panel; 1 != e && 0 == n.onBeforeDestroy.call(t) || ($(t).panel("clear").panel("clear", "footer"), _217(i), n.onDestroy.call(t)) } function _24e(t, e) { var i = $.data(t, "panel").options, n = $.data(t, "panel").panel, o = n.children(".panel-body"), r = n.children(".panel-header"), a = r.find("a.panel-tool-collapse"); function s() { o.hide(), i.collapsed = !0, i.onCollapse.call(t) } 1 != i.collapsed && (o.stop(!0, !0), 0 != i.onBeforeCollapse.call(t) && (a.addClass("panel-tool-expand"), 1 == e ? "left" == i.halign || "right" == i.halign ? n.animate({ width: r._outerWidth() + n.children(".panel-footer")._outerWidth() }, function () { s() }) : o.slideUp("normal", function () { s() }) : ("left" != i.halign && "right" != i.halign || n._outerWidth(r._outerWidth() + n.children(".panel-footer")._outerWidth()), s()))) } function _25d(t, e) { var i = $.data(t, "panel").options, n = $.data(t, "panel").panel, o = n.children(".panel-body"), r = n.children(".panel-header").find("a.panel-tool-collapse"); function a() { o.show(), i.collapsed = !1, i.onExpand.call(t), _23e(t), _246(t) } 0 != i.collapsed && (o.stop(!0, !0), 0 != i.onBeforeExpand.call(t) && (r.removeClass("panel-tool-expand"), 1 == e ? "left" == i.halign || "right" == i.halign ? (o.show(), n.animate({ width: i.panelCssWidth }, function () { a() })) : o.slideDown("normal", function () { a() }) : ("left" != i.halign && "right" != i.halign || n.css("width", i.panelCssWidth), a()))) } function _24d(t) { var e = $.data(t, "panel").options, i = $.data(t, "panel").panel.children(".panel-header").find("a.panel-tool-max"); 1 != e.maximized && (i.addClass("panel-tool-restore"), $.data(t, "panel").original || ($.data(t, "panel").original = { width: e.width, height: e.height, left: e.left, top: e.top, fit: e.fit }), e.left = 0, e.top = 0, e.fit = !0, _218(t), e.minimized = !1, e.maximized = !0, e.onMaximize.call(t)) } function _263(t) { var e = $.data(t, "panel").options, i = $.data(t, "panel").panel; i._size("unfit"), i.hide(), e.minimized = !0, e.maximized = !1, e.onMinimize.call(t) } function _266(t) { var e = $.data(t, "panel").options, i = $.data(t, "panel").panel, n = i.children(".panel-header").find("a.panel-tool-max"); 0 != e.maximized && (i.show(), n.removeClass("panel-tool-restore"), $.extend(e, $.data(t, "panel").original), _218(t), e.minimized = !1, e.maximized = !1, $.data(t, "panel").original = null, e.onRestore.call(t)) } function _269(t, e) { $.data(t, "panel").options.title = e, $(t).panel("header").find("div.panel-title").html(e) } $.fn._remove = function () { return this.each(function () { $(this).remove(); try { this.outerHTML = "" } catch (t) { } }) }; var _26c = null; $(window)._unbind(".panel")._bind("resize.panel", function () { _26c && clearTimeout(_26c), _26c = setTimeout(function () { var t = $("body.layout"); t.length ? (t.layout("resize"), $("body").children(".easyui-fluid:visible").each(function () { $(this).triggerHandler("_resize") })) : $("body").panel("doLayout"), _26c = null }, 100) }), $.fn.panel = function (i, t) { return "string" == typeof i ? $.fn.panel.methods[i](this, t) : (i = i || {}, this.each(function () { var t, e = $.data(this, "panel"); e ? (t = $.extend(e.options, i), e.isLoaded = !1) : (t = $.extend({}, $.fn.panel.defaults, $.fn.panel.parseOptions(this), i), $(this).attr("title", ""), e = $.data(this, "panel", { options: t, panel: _22e(this), isLoaded: !1 })), _232(this), $(this).show(), 1 == t.doSize && (e.panel.css("display", "block"), _218(this)), 1 == t.closed || 1 == t.minimized ? e.panel.hide() : _248(this) })) }, $.fn.panel.methods = { options: function (t) { return $.data(t[0], "panel").options }, panel: function (t) { return $.data(t[0], "panel").panel }, header: function (t) { return $.data(t[0], "panel").panel.children(".panel-header") }, footer: function (t) { return t.panel("panel").children(".panel-footer") }, body: function (t) { return $.data(t[0], "panel").panel.children(".panel-body") }, setTitle: function (t, e) { return t.each(function () { _269(this, e) }) }, open: function (t, e) { return t.each(function () { _248(this, e) }) }, close: function (t, e) { return t.each(function () { _24f(this, e) }) }, destroy: function (t, e) { return t.each(function () { _254(this, e) }) }, clear: function (t, e) { return t.each(function () { _244("footer" == e ? $(this).panel("footer") : this) }) }, refresh: function (t, e) { return t.each(function () { var t = $.data(this, "panel"); t.isLoaded = !1, e && ("string" == typeof e ? t.options.href = e : t.options.queryParams = e), _23e(this) }) }, resize: function (t, e) { return t.each(function () { _218(this, e || {}) }) }, doLayout: function (t, e) { return t.each(function () { function t(i, n) { var o; i && (o = i == $("body")[0], $(i).find("div.panel:visible,div.accordion:visible,div.tabs-container:visible,div.layout:visible,.easyui-fluid:visible").filter(function (t, e) { e = $(e).parents(".panel-" + n + ":first"); return o ? 0 == e.length : e[0] == i }).each(function () { $(this).triggerHandler("_resize", [e || !1]) })) } t(this, "body"), t($(this).siblings(".panel-footer")[0], "footer") }) }, move: function (t, e) { return t.each(function () { _229(this, e) }) }, maximize: function (t) { return t.each(function () { _24d(this) }) }, minimize: function (t) { return t.each(function () { _263(this) }) }, restore: function (t) { return t.each(function () { _266(this) }) }, collapse: function (t, e) { return t.each(function () { _24e(this, e) }) }, expand: function (t, e) { return t.each(function () { _25d(this, e) }) } }, $.fn.panel.parseOptions = function (t) { var e = $(t), i = e.children(".panel-header,header"), n = e.children(".panel-footer,footer"); return $.extend({}, $.parser.parseOptions(t, ["id", "width", "height", "left", "top", "title", "iconCls", "cls", "headerCls", "bodyCls", "tools", "href", "method", "header", "footer", "halign", "titleDirection", { cache: "boolean", fit: "boolean", border: "boolean", noheader: "boolean" }, { collapsible: "boolean", minimizable: "boolean", maximizable: "boolean" }, { closable: "boolean", collapsed: "boolean", minimized: "boolean", maximized: "boolean", closed: "boolean" }, "openAnimation", "closeAnimation", { openDuration: "number", closeDuration: "number" }]), { loadingMessage: null != e.attr("loadingMessage") ? e.attr("loadingMessage") : void 0, header: i.length ? i.removeClass("panel-header") : void 0, footer: n.length ? n.removeClass("panel-footer") : void 0 }) }, $.fn.panel.defaults = { id: null, title: null, iconCls: null, width: "auto", height: "auto", left: null, top: null, cls: null, headerCls: null, bodyCls: null, style: {}, href: null, cache: !0, fit: !1, border: !0, doSize: !0, noheader: !1, content: null, halign: "top", titleDirection: "down", collapsible: !1, minimizable: !1, maximizable: !1, closable: !1, collapsed: !1, minimized: !1, maximized: !1, closed: !1, openAnimation: !1, openDuration: 400, closeAnimation: !1, closeDuration: 400, tools: null, footer: null, header: null, queryParams: {}, method: "get", loadingMessage: "Loading...", loader: function (t, e, i) { var n = $(this).panel("options"); if (!n.href) return !1; $.ajax({ type: n.method, url: n.href, cache: !1, data: t, dataType: "html", success: function (t) { e(t) }, error: function () { i.apply(this, arguments) } }) }, extractor: function (t) { var e = /<body[^>]*>((.|[\n\r])*)<\/body>/im.exec(t); return e ? e[1] : t }, onBeforeLoad: function (t) { }, onLoad: function () { }, onLoadError: function () { }, onBeforeOpen: function () { }, onOpen: function () { }, onBeforeClose: function () { }, onClose: function () { }, onBeforeDestroy: function () { }, onDestroy: function () { }, onResize: function (t, e) { }, onMove: function (t, e) { }, onMaximize: function () { }, onRestore: function () { }, onMinimize: function () { }, onBeforeCollapse: function () { }, onBeforeExpand: function () { }, onCollapse: function () { }, onExpand: function () { } } }(jQuery), function (l) { function c(t, e) { var i = l.data(t, "window"); e && (null != e.left && (i.options.left = e.left), null != e.top && (i.options.top = e.top)), l(t).panel("move", i.options), i.shadow && i.shadow.css({ left: i.options.left, top: i.options.top }) } function d(t, e) { var i, n = l.data(t, "window").options, o = l(t).window("panel"), r = o._outerWidth(); n.inline ? (i = o.parent(), n.left = Math.ceil((i.width() - r) / 2 + i.scrollLeft())) : (i = n.fixed ? 0 : l(document).scrollLeft(), n.left = Math.ceil((l(window)._outerWidth() - r) / 2 + i)), e && c(t) } function h(t, e) { var i, n = l.data(t, "window").options, o = l(t).window("panel"), r = o._outerHeight(); n.inline ? (i = o.parent(), n.top = Math.ceil((i.height() - r) / 2 + i.scrollTop())) : (i = n.fixed ? 0 : l(document).scrollTop(), n.top = Math.ceil((l(window)._outerHeight() - r) / 2 + i)), e && c(t) } function u(t, e, i, n) { var o = l.data(this, "window").options; if (!o.constrain) return {}; if (l.isFunction(o.constrain)) return o.constrain.call(this, t, e, i, n); var r = l(this).window("window"), a = o.inline ? r.parent() : l(window), o = o.fixed ? 0 : a.scrollTop(); return t < 0 && (t = 0), e < o && (e = o), t + i > a.width() && (i == r.outerWidth() ? t = a.width() - i : i = a.width() - t), e - o + n > a.height() && (n == r.outerHeight() ? e = a.height() - n + o : n = a.height() - e + o), { left: t, top: e, width: i, height: n } } l(function () { l._positionFixed || l(window).resize(function () { l("body>div.window-mask:visible").css({ width: "", height: "" }), setTimeout(function () { l("body>div.window-mask:visible").css(l.fn.window.getMaskSize()) }, 50) }) }), l.fn.window = function (s, t) { if ("string" != typeof s) return s = s || {}, this.each(function () { var i, n, o, t = l.data(this, "window"); function e(t) { n.window.css("position", o.fixed ? "fixed" : "absolute"), n.shadow && n.shadow.css("position", o.fixed ? "fixed" : "absolute"), n.pmask && n.pmask.remove(), n.pmask = l('<div class="window-proxy-mask"></div>').insertAfter(n.window), n.pmask.css({ display: "none", position: o.fixed ? "fixed" : "absolute", zIndex: l.fn.window.defaults.zIndex++, left: t.data.left, top: t.data.top, width: n.window._outerWidth(), height: n.window._outerHeight() }), n.proxy && n.proxy.remove(), n.proxy = l('<div class="window-proxy"></div>').insertAfter(n.window), n.proxy.css({ display: "none", position: o.fixed ? "fixed" : "absolute", zIndex: l.fn.window.defaults.zIndex++, left: t.data.left, top: t.data.top }), n.proxy._outerWidth(t.data.width)._outerHeight(t.data.height), n.proxy.hide(), setTimeout(function () { n.pmask && n.pmask.show(), n.proxy && n.proxy.show() }, 500) } function r(t) { l.extend(t.data, u.call(i, t.data.left, t.data.top, t.data.width, t.data.height)), n.pmask.show(), n.proxy.css({ display: "block", left: t.data.left, top: t.data.top }), n.proxy._outerWidth(t.data.width), n.proxy._outerHeight(t.data.height) } function a(t, e) { n.window.css("position", o.fixed ? "fixed" : "absolute"), n.shadow && n.shadow.css("position", o.fixed ? "fixed" : "absolute"), l.extend(t.data, u.call(i, t.data.left, t.data.top, t.data.width + .1, t.data.height + .1)), l(i).window(e, t.data), n.pmask.remove(), n.pmask = null, n.proxy.remove(), n.proxy = null } t ? l.extend(t.options, s) : (t = l.data(this, "window", { options: l.extend({}, l.fn.window.defaults, l.fn.window.parseOptions(this), s) })).options.inline || document.body.appendChild(this), function (n) { var o = l.data(n, "window"), r = o.options, t = l(n).panel(l.extend({}, o.options, { border: !1, doSize: !0, closed: !0, cls: "window " + (r.border ? "thin" == r.border ? "window-thinborder " : "" : "window-thinborder window-noborder ") + (r.cls || ""), headerCls: "window-header " + (r.headerCls || ""), bodyCls: "window-body " + (r.noheader ? "window-body-noheader " : " ") + (r.bodyCls || ""), onBeforeDestroy: function () { if (0 == r.onBeforeDestroy.call(n)) return !1; o.shadow && o.shadow.remove(), o.mask && o.mask.remove() }, onClose: function () { o.shadow && o.shadow.hide(), o.mask && o.mask.hide(), r.onClose.call(n) }, onOpen: function () { o.mask && o.mask.css(l.extend({ display: "block", zIndex: l.fn.window.defaults.zIndex++ }, l.fn.window.getMaskSize(n))), o.shadow && o.shadow.css({ display: "block", position: r.fixed ? "fixed" : "absolute", zIndex: l.fn.window.defaults.zIndex++, left: r.left, top: r.top, width: o.window._outerWidth(), height: o.window._outerHeight() }), o.window.css({ position: r.fixed ? "fixed" : "absolute", zIndex: l.fn.window.defaults.zIndex++ }), r.onOpen.call(n) }, onResize: function (t, e) { var i = l(this).panel("options"); l.extend(r, { width: i.width, height: i.height, left: i.left, top: i.top }), o.shadow && o.shadow.css({ left: r.left, top: r.top, width: o.window._outerWidth(), height: o.window._outerHeight() }), r.onResize.call(n, t, e) }, onMinimize: function () { o.shadow && o.shadow.hide(), o.mask && o.mask.hide(), o.options.onMinimize.call(n) }, onBeforeCollapse: function () { if (0 == r.onBeforeCollapse.call(n)) return !1; o.shadow && o.shadow.hide() }, onExpand: function () { o.shadow && o.shadow.show(), r.onExpand.call(n) } })); o.window = t.panel("panel"), o.mask && o.mask.remove(), r.modal && (o.mask = l('<div class="window-mask" style="display:none"></div>').insertAfter(o.window)), o.shadow && o.shadow.remove(), r.shadow && (o.shadow = l('<div class="window-shadow" style="display:none"></div>').insertAfter(o.window)); var e = r.closed; null == r.left && d(n), null == r.top && h(n), c(n), e || t.window("open") }(this), i = this, n = l.data(i, "window"), o = n.options, n.window.draggable({ handle: ">div.panel-header>div.panel-title", disabled: 0 == n.options.draggable, onBeforeDrag: function (t) { n.mask && n.mask.css("z-index", l.fn.window.defaults.zIndex++), n.shadow && n.shadow.css("z-index", l.fn.window.defaults.zIndex++), n.window.css("z-index", l.fn.window.defaults.zIndex++) }, onStartDrag: function (t) { e(t) }, onDrag: function (t) { return r(t), !1 }, onStopDrag: function (t) { a(t, "move") } }), n.window.resizable({ disabled: 0 == n.options.resizable, onStartResize: function (t) { e(t) }, onResize: function (t) { return r(t), !1 }, onStopResize: function (t) { a(t, "resize") } }) }); var e = l.fn.window.methods[s]; return e ? e(this, t) : this.panel(s, t) }, l.fn.window.methods = { options: function (t) { var e = t.panel("options"), t = l.data(t[0], "window").options; return l.extend(t, { closed: e.closed, collapsed: e.collapsed, minimized: e.minimized, maximized: e.maximized }) }, window: function (t) { return l.data(t[0], "window").window }, move: function (t, e) { return t.each(function () { c(this, e) }) }, hcenter: function (t) { return t.each(function () { d(this, !0) }) }, vcenter: function (t) { return t.each(function () { h(this, !0) }) }, center: function (t) { return t.each(function () { d(this), h(this), c(this) }) } }, l.fn.window.getMaskSize = function (t) { t = l(t).data("window"); return t && t.options.inline ? {} : l._positionFixed ? { position: "fixed" } : { width: l(document).width(), height: l(document).height() } }, l.fn.window.parseOptions = function (t) { return l.extend({}, l.fn.panel.parseOptions(t), l.parser.parseOptions(t, [{ draggable: "boolean", resizable: "boolean", shadow: "boolean", modal: "boolean", inline: "boolean" }])) }, l.fn.window.defaults = l.extend({}, l.fn.panel.defaults, { zIndex: 9e3, draggable: !0, resizable: !0, shadow: !0, modal: !1, border: !0, inline: !1, title: "New Window", collapsible: !0, minimizable: !0, maximizable: !0, closable: !0, closed: !1, fixed: !1, constrain: !1 }) }(jQuery), function ($) { function _2b6(_2b7) { var opts = $.data(_2b7, "dialog").options; opts.inited = !1, $(_2b7).window($.extend({}, opts, { onResize: function (t, e) { opts.inited && (_2bc(this), opts.onResize.call(this, t, e)) } })); var win = $(_2b7).window("window"); if (opts.toolbar) if ($.isArray(opts.toolbar)) { $(_2b7).siblings("div.dialog-toolbar").remove(); for (var _2b8 = $('<div class="dialog-toolbar"><table cellspacing="0" cellpadding="0"><tr></tr></table></div>').appendTo(win), tr = _2b8.find("tr"), i = 0; i < opts.toolbar.length; i++){ var btn = opts.toolbar[i], td, tool; "-" == btn ? $('<td><div class="dialog-tool-separator"></div></td>').appendTo(tr) : (td = $("<td></td>").appendTo(tr), tool = $('<a href="javascript:;"></a>').appendTo(td), tool[0].onclick = eval(btn.handler || function () { }), tool.linkbutton($.extend({}, btn, { plain: !0 }))) } } else $(opts.toolbar).addClass("dialog-toolbar").appendTo(win), $(opts.toolbar).show(); else $(_2b7).siblings("div.dialog-toolbar").remove(); if (opts.buttons) if ($.isArray(opts.buttons)) { $(_2b7).siblings("div.dialog-button").remove(); for (var _2b9 = $('<div class="dialog-button"></div>').appendTo(win), i = 0; i < opts.buttons.length; i++){ var p = opts.buttons[i], _2ba = $('<a href="javascript:;"></a>').appendTo(_2b9); p.handler && (_2ba[0].onclick = p.handler), _2ba.linkbutton(p) } } else $(opts.buttons).addClass("dialog-button").appendTo(win), $(opts.buttons).show(); else $(_2b7).siblings("div.dialog-button").remove(); opts.inited = !0; var _2bb = opts.closed; win.show(), $(_2b7).window("resize", {}), _2bb && win.hide() } function _2bc(t, e) { var i = $(t), n = i.dialog("options"), o = n.noheader, r = i.siblings(".dialog-toolbar"), a = i.siblings(".dialog-button"); r.insertBefore(t).css({ borderTopWidth: o ? 1 : 0, top: o ? r.length : 0 }), a.insertAfter(t), r.add(a)._outerWidth(i._outerWidth()).find(".easyui-fluid:visible").each(function () { $(this).triggerHandler("_resize") }); a = r._outerHeight() + a._outerHeight(); isNaN(parseInt(n.height)) ? ((n = i._size("min-height")) && i._size("min-height", n - a), (n = i._size("max-height")) && i._size("max-height", n - a)) : i._outerHeight(i._outerHeight() - a); t = $.data(t, "window").shadow; t && (i = i.panel("panel"), t.css({ width: i._outerWidth(), height: i._outerHeight() })) } $.fn.dialog = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = $.data(this, "dialog"); t ? $.extend(t.options, e) : $.data(this, "dialog", { options: $.extend({}, $.fn.dialog.defaults, $.fn.dialog.parseOptions(this), e) }), _2b6(this) }); var i = $.fn.dialog.methods[e]; return i ? i(this, t) : this.window(e, t) }, $.fn.dialog.methods = { options: function (t) { var e = $.data(t[0], "dialog").options, t = t.panel("options"); return $.extend(e, { width: t.width, height: t.height, left: t.left, top: t.top, closed: t.closed, collapsed: t.collapsed, minimized: t.minimized, maximized: t.maximized }), e }, dialog: function (t) { return t.window("window") } }, $.fn.dialog.parseOptions = function (t) { var e = $(t); return $.extend({}, $.fn.window.parseOptions(t), $.parser.parseOptions(t, ["toolbar", "buttons"]), { toolbar: e.children(".dialog-toolbar").length ? e.children(".dialog-toolbar").removeClass("dialog-toolbar") : void 0, buttons: e.children(".dialog-button").length ? e.children(".dialog-button").removeClass("dialog-button") : void 0 }) }, $.fn.dialog.defaults = $.extend({}, $.fn.window.defaults, { title: "New Dialog", collapsible: !1, minimizable: !1, maximizable: !1, resizable: !1, toolbar: null, buttons: null }) }(jQuery), function (r) { function a(t) { r(document)._unbind(".messager")._bind("keydown.messager", function (t) { if (27 == t.keyCode) r("body").children("div.messager-window").children("div.messager-body").each(function () { r(this).dialog("close") }); else if (9 == t.keyCode) { var e = r("body").children("div.messager-window"); if (e.length) for (var i = e.find(".messager-input,.messager-button .l-btn"), n = 0; n < i.length; n++)if (r(i[n]).is(":focus")) return r(i[n >= i.length - 1 ? 0 : n + 1]).focus(), !1 } else 13 != t.keyCode || (t = r(t.target).closest("input.messager-input")).length && s(t.closest(".messager-body"), t.val()) }); var e = r('<div class="messager-body"></div>').appendTo("body"); return e.dialog(r.extend({}, t, { noheader: !t.title, onClose: function () { r(document)._unbind(".messager"), t.onClose && t.onClose.call(this), e.dialog("destroy") } })), e.dialog("dialog").addClass("messager-window").find(".dialog-button").addClass("messager-button").find("a:first").focus(), e } function s(t, e) { var i = t.dialog("options"); t.dialog("close"), i.fn(e) } r.messager = { show: function (t) { return e = t, i = r.extend({}, r.messager.defaults, { modal: !1, shadow: !1, draggable: !1, resizable: !1, closed: !0, style: { left: "", top: "", right: 0, zIndex: r.fn.window.defaults.zIndex++, bottom: -document.body.scrollTop - document.documentElement.scrollTop }, title: "", width: 300, height: 150, minHeight: 0, showType: "slide", showSpeed: 600, content: e.msg, timeout: 4e3 }, e), (n = r('<div class="messager-body"></div>').appendTo("body")).dialog(r.extend({}, i, { noheader: !i.title, openAnimation: i.showType, closeAnimation: "show" == i.showType ? "hide" : i.showType, openDuration: i.showSpeed, closeDuration: i.showSpeed, onOpen: function () { function t() { 0 < i.timeout && (i.timer = setTimeout(function () { n.length && n.data("dialog") && n.dialog("close") }, i.timeout)) } n.dialog("dialog").hover(function () { i.timer && clearTimeout(i.timer) }, function () { t() }), t(), (e.onOpen ? e : i).onOpen.call(this) }, onClose: function () { i.timer && clearTimeout(i.timer), (e.onClose ? e : i).onClose.call(this), n.dialog("destroy") } })), n.dialog("dialog").css(i.style), n.dialog("open"), n; var e, i, n }, alert: function (t, e, i, n) { i = "object" == typeof t ? t : { title: t, msg: e, icon: i, fn: n }, n = i.icon ? "messager-icon messager-" + i.icon : ""; (i = r.extend({}, r.messager.defaults, { content: '<div class="' + n + '"></div><div>' + i.msg + '</div><div style="clear:both;"></div>' }, i)).buttons || (i.buttons = [{ text: i.ok, onClick: function () { s(o) } }]); var o = a(i); return o }, confirm: function (t, e, i) { i = "object" == typeof t ? t : { title: t, msg: e, fn: i }; (i = r.extend({}, r.messager.defaults, { content: '<div class="messager-icon messager-question"></div><div>' + i.msg + '</div><div style="clear:both;"></div>' }, i)).buttons || (i.buttons = [{ text: i.ok, onClick: function () { s(n, !0) } }, { text: i.cancel, onClick: function () { s(n, !1) } }]); var n = a(i); return n }, prompt: function (t, e, i) { i = "object" == typeof t ? t : { title: t, msg: e, fn: i }; (i = r.extend({}, r.messager.defaults, { content: '<div class="messager-icon messager-question"></div><div>' + i.msg + '</div><br><div style="clear:both;"></div><div><input class="messager-input" type="text"></div>' }, i)).buttons || (i.buttons = [{ text: i.ok, onClick: function () { s(n, n.find(".messager-input").val()) } }, { text: i.cancel, onClick: function () { s(n) } }]); var n = a(i); return n.find(".messager-input").focus(), n }, progress: function (t) { var e = { bar: function () { return r("body>div.messager-window").find("div.messager-p-bar") }, close: function () { var t = r("body>div.messager-window>div.messager-body:has(div.messager-progress)"); t.length && t.dialog("close") } }; if ("string" == typeof t) return (0, e[t])(); t = t || {}; var i = r.extend({}, { title: "", minHeight: 0, content: void 0, msg: "", text: void 0, interval: 300 }, t), e = a(r.extend({}, r.messager.defaults, { content: '<div class="messager-progress"><div class="messager-p-msg">' + i.msg + '</div><div class="messager-p-bar"></div></div>', closable: !1, doSize: !1 }, i, { onClose: function () { this.timer && clearInterval(this.timer), (t.onClose ? t : r.messager.defaults).onClose.call(this) } })), n = e.find("div.messager-p-bar"); return n.progressbar({ text: i.text }), e.dialog("resize"), i.interval && (e[0].timer = setInterval(function () { var t = n.progressbar("getValue"); 100 < (t += 10) && (t = 0), n.progressbar("setValue", t) }, i.interval)), e } }, r.messager.defaults = r.extend({}, r.fn.dialog.defaults, { ok: "Ok", cancel: "Cancel", width: 300, height: "auto", minHeight: 150, modal: !0, collapsible: !1, minimizable: !1, maximizable: !1, resizable: !1, fn: function () { } }) }(jQuery), function (h) { function a(t, e) { var i = h.data(t, "accordion"), n = i.options, s = i.panels, l = h(t), c = "left" == n.halign || "right" == n.halign; l.children(".panel-last").removeClass("panel-last"), l.children(".panel:last").addClass("panel-last"), e && h.extend(n, { width: e.width, height: e.height }), l._size(n); var d = 0, t = "auto", e = l.find(">.panel>.accordion-header"); function o(t, e) { for (var i = 0, n = 0; n < s.length; n++){ var o, r, a = s[n]; o = c ? a.panel("header")._outerWidth(d) : a.panel("header")._outerHeight(d), a.panel("options").collapsible == t && (r = isNaN(e) ? void 0 : e + d * o.length, c ? (a.panel("resize", { height: l.height(), width: t ? r : void 0 }), i += a.panel("panel")._outerWidth() - d * o.length) : (a.panel("resize", { width: l.width(), height: t ? r : void 0 }), i += a.panel("panel").outerHeight() - d * o.length)) } return i } e.length && (d = c ? (h(e[0]).next().panel("resize", { width: l.width(), height: l.height() }), h(e[0])._outerWidth()) : h(e[0]).css("height", "")._outerHeight()), isNaN(parseInt(n.height)) || (t = c ? l.width() - d * e.length : l.height() - d * e.length), o(!0, t - o(!1)) } function r(t, e, i, n) { for (var o = h.data(t, "accordion").panels, r = [], a = 0; a < o.length; a++){ var s = o[a]; if (e) s.panel("options")[e] == i && r.push(s); else if (s[0] == h(i)[0]) return a } return e ? n ? r : r.length ? r[0] : null : -1 } function s(t) { return r(t, "collapsed", !1, !0) } function l(t) { t = s(t); return t.length ? t[0] : null } function c(t, e) { return r(t, null, e) } function d(t, e) { var i = h.data(t, "accordion").panels; return "number" == typeof e ? e < 0 || e >= i.length ? null : i[e] : r(t, "title", e) } function u(n, t, o) { var r = h.data(n, "accordion").options; t.panel(h.extend({}, { collapsible: !0, minimizable: !1, maximizable: !1, closable: !1, doSize: !1, collapsed: !0, headerCls: "accordion-header", bodyCls: "accordion-body", halign: r.halign }, o, { onBeforeExpand: function () { if (o.onBeforeExpand && 0 == o.onBeforeExpand.call(this)) return !1; if (!r.multiple) for (var t = h.grep(s(n), function (t) { return t.panel("options").collapsible }), e = 0; e < t.length; e++)p(n, c(n, t[e])); var i = h(this).panel("header"); i.addClass("accordion-header-selected"), i.find(".accordion-collapse").removeClass("accordion-expand") }, onExpand: function () { h(n).find(">.panel-last>.accordion-header").removeClass("accordion-header-border"), o.onExpand && o.onExpand.call(this), r.onSelect.call(n, h(this).panel("options").title, c(n, this)) }, onBeforeCollapse: function () { if (o.onBeforeCollapse && 0 == o.onBeforeCollapse.call(this)) return !1; h(n).find(">.panel-last>.accordion-header").addClass("accordion-header-border"); var t = h(this).panel("header"); t.removeClass("accordion-header-selected"), t.find(".accordion-collapse").addClass("accordion-expand") }, onCollapse: function () { isNaN(parseInt(r.height)) && h(n).find(">.panel-last>.accordion-header").removeClass("accordion-header-border"), o.onCollapse && o.onCollapse.call(this), r.onUnselect.call(n, h(this).panel("options").title, c(n, this)) } })); var e = t.panel("header"), i = e.children("div.panel-tool"); i.children("a.panel-tool-collapse").hide(); i = h('<a href="javascript:;"></a>').addClass("accordion-collapse accordion-expand").appendTo(i); function a(t) { var e = t.panel("options"); e.collapsible && (t = c(n, t), (e.collapsed ? f : p)(n, t)) } i._bind("click", function () { return a(t), !1 }), t.panel("options").collapsible ? i.show() : i.hide(), "left" != r.halign && "right" != r.halign || i.hide(), e._bind("click", function () { return a(t), !1 }) } function f(t, e) { e = d(t, e); e && (g(t), t = h.data(t, "accordion").options, e.panel("expand", t.animate)) } function p(t, e) { e = d(t, e); e && (g(t), t = h.data(t, "accordion").options, e.panel("collapse", t.animate)) } function g(t) { for (var e = h.data(t, "accordion").panels, i = 0; i < e.length; i++)e[i].stop(!0, !0) } h.fn.accordion = function (o, t) { return "string" == typeof o ? h.fn.accordion.methods[o](this, t) : (o = o || {}, this.each(function () { var i, n, t, e = h.data(this, "accordion"); e ? h.extend(e.options, o) : (h.data(this, "accordion", { options: h.extend({}, h.fn.accordion.defaults, h.fn.accordion.parseOptions(this), o), accordion: h(this).addClass("accordion"), panels: [] }), i = this, n = h.data(i, "accordion"), (t = h(i)).addClass("accordion"), n.panels = [], t.children("div").each(function () { var t = h.extend({}, h.parser.parseOptions(this), { selected: !!h(this).attr("selected") || void 0 }), e = h(this); n.panels.push(e), u(i, e, t) }), t._bind("_resize", function (t, e) { return (h(this).hasClass("easyui-fluid") || e) && a(i), !1 })), e = this, t = h.data(e, "accordion").options, e = h(e), t.border ? e.removeClass("accordion-noborder") : e.addClass("accordion-noborder"), a(this), function (i) { var n = h.data(i, "accordion").options; h(i).find(">.panel-last>.accordion-header").addClass("accordion-header-border"); var t = r(i, "selected", !0); function e(t) { var e = n.animate; n.animate = !1, f(i, t), n.animate = e } e(t ? c(i, t) : n.selected) }(this) })) }, h.fn.accordion.methods = { options: function (t) { return h.data(t[0], "accordion").options }, panels: function (t) { return h.data(t[0], "accordion").panels }, resize: function (t, e) { return t.each(function () { a(this, e) }) }, getSelections: function (t) { return s(t[0]) }, getSelected: function (t) { return l(t[0]) }, getPanel: function (t, e) { return d(t[0], e) }, getPanelIndex: function (t, e) { return c(t[0], e) }, select: function (t, e) { return t.each(function () { f(this, e) }) }, unselect: function (t, e) { return t.each(function () { p(this, e) }) }, add: function (t, r) { return t.each(function () { var t, e, i, n, o; t = this, e = r, i = h.data(t, "accordion"), n = i.options, o = i.panels, null == e.selected && (e.selected = !0), g(t), i = h("<div></div>").appendTo(t), o.push(i), u(t, i, e), a(t), n.onAdd.call(t, e.title, o.length - 1), e.selected && f(t, o.length - 1) }) }, remove: function (t, e) { return t.each(function () { !function (t, e) { var i = (r = h.data(t, "accordion")).options, n = r.panels; g(t); var o = d(t, e), r = o.panel("options").title, e = c(t, o); o && 0 != i.onBeforeRemove.call(t, r, e) && (n.splice(e, 1), o.panel("destroy"), n.length && (a(t), l(t) || f(t, 0)), i.onRemove.call(t, r, e)) }(this, e) }) } }, h.fn.accordion.parseOptions = function (t) { h(t); return h.extend({}, h.parser.parseOptions(t, ["width", "height", "halign", { fit: "boolean", border: "boolean", animate: "boolean", multiple: "boolean", selected: "number" }])) }, h.fn.accordion.defaults = { width: "auto", height: "auto", fit: !1, border: !0, animate: !0, multiple: !1, selected: 0, halign: "top", onSelect: function (t, e) { }, onUnselect: function (t, e) { }, onAdd: function (t, e) { }, onBeforeRemove: function (t, e) { }, onRemove: function (t, e) { } } }(jQuery), function ($) { function _338(t) { var e = 0; return $(t).children().each(function () { e += $(this).outerWidth(!0) }), e } function _339(t) { var e = $.data(t, "tabs").options; if (e.showHeader) { var i = $(t).children("div.tabs-header"), n = i.children("div.tabs-tool:not(.tabs-tool-hidden)"), o = i.children("div.tabs-scroller-left"), r = i.children("div.tabs-scroller-right"), t = i.children("div.tabs-wrap"); if ("left" == e.tabPosition || "right" == e.tabPosition) { if (!n.length) return; n._outerWidth(i.width()); var a = { left: "left" == e.tabPosition ? "auto" : 0, right: "left" == e.tabPosition ? 0 : "auto", top: "top" == e.toolPosition ? 0 : "auto", bottom: "top" == e.toolPosition ? "auto" : 0 }, s = { marginTop: "top" == e.toolPosition ? n.outerHeight() : 0 }; return n.css(a), void t.css(s) } a = i.outerHeight(); e.plain && (a -= a - i.height()), n._outerHeight(a); s = _338(i.find("ul.tabs")), i = i.width() - n._outerWidth(); i < s ? (o.add(r).show()._outerHeight(a), "left" == e.toolPosition ? (n.css({ left: o.outerWidth(), right: "" }), t.css({ marginLeft: o.outerWidth() + n._outerWidth(), marginRight: r._outerWidth(), width: i - o.outerWidth() - r.outerWidth() })) : (n.css({ left: "", right: r.outerWidth() }), t.css({ marginLeft: o.outerWidth(), marginRight: r.outerWidth() + n._outerWidth(), width: i - o.outerWidth() - r.outerWidth() }))) : (o.add(r).hide(), "left" == e.toolPosition ? (n.css({ left: 0, right: "" }), t.css({ marginLeft: n._outerWidth(), marginRight: 0, width: i })) : (n.css({ left: "", right: 0 }), t.css({ marginLeft: 0, marginRight: n._outerWidth(), width: i }))) } } function _343(_344) { var opts = $.data(_344, "tabs").options, _345 = $(_344).children("div.tabs-header"); if (opts.tools) if ("string" == typeof opts.tools) $(opts.tools).addClass("tabs-tool").appendTo(_345), $(opts.tools).show(); else { _345.children("div.tabs-tool").remove(); for (var _346 = $('<div class="tabs-tool"><table cellspacing="0" cellpadding="0" style="height:100%"><tr></tr></table></div>').appendTo(_345), tr = _346.find("tr"), i = 0; i < opts.tools.length; i++){ var td = $("<td></td>").appendTo(tr), tool = $('<a href="javascript:;"></a>').appendTo(td); tool[0].onclick = eval(opts.tools[i].handler || function () { }), tool.linkbutton($.extend({}, opts.tools[i], { plain: !0 })) } } else _345.children("div.tabs-tool").remove() } function _347(t, e) { var i, n, o, r, a = $.data(t, "tabs"), s = a.options, l = $(t); function c(t, e) { var i = t.panel("options"), t = i.tab.find(".tabs-inner"); (e = e || parseInt(i.tabWidth || s.tabWidth || void 0)) ? t._outerWidth(e) : t.css("width", ""), t._outerHeight(s.tabHeight), t.css("lineHeight", t.height() + "px"), t.find(".easyui-fluid:visible").triggerHandler("_resize") } s.doSize && (e && $.extend(s, { width: e.width, height: e.height }), l._size(s), o = l.children("div.tabs-header"), n = l.children("div.tabs-panels"), (e = (i = o.find("div.tabs-wrap")).find(".tabs")).children("li").removeClass("tabs-first tabs-last"), e.children("li:first").addClass("tabs-first"), e.children("li:last").addClass("tabs-last"), "left" == s.tabPosition || "right" == s.tabPosition ? (o._outerWidth(s.showHeader ? s.headerWidth : 0), n._outerWidth(l.width() - o.outerWidth()), o.add(n)._size("height", isNaN(parseInt(s.height)) ? "" : l.height()), i._outerWidth(o.width()), e._outerWidth(i.width()).css("height", "")) : (o.children("div.tabs-scroller-left,div.tabs-scroller-right,div.tabs-tool:not(.tabs-tool-hidden)").css("display", s.showHeader ? "block" : "none"), o._outerWidth(l.width()).css("height", ""), s.showHeader ? (o.css("background-color", ""), i.css("height", "")) : (o.css("background-color", "transparent"), o._outerHeight(0), i._outerHeight(0)), e._outerHeight(s.tabHeight).css("width", ""), e._outerHeight(e.outerHeight() - e.height() - 1 + s.tabHeight).css("width", ""), n._size("height", isNaN(parseInt(s.height)) ? "" : l.height() - o.outerHeight()), n._size("width", l.width())), a.tabs.length && (n = e.outerWidth(!0) - e.width(), l = (l = e.children("li:first")).outerWidth(!0) - l.width(), o = o.width() - o.children(".tabs-tool:not(.tabs-tool-hidden)")._outerWidth(), r = Math.floor((o - n - l * a.tabs.length) / a.tabs.length), $.map(a.tabs, function (t) { c(t, s.justified && 0 <= $.inArray(s.tabPosition, ["top", "bottom"]) ? r : void 0) }), s.justified && 0 <= $.inArray(s.tabPosition, ["top", "bottom"]) && (e = o - n - _338(e), c(a.tabs[a.tabs.length - 1], r + e))), _339(t)) } function _353(t) { var e, i = $.data(t, "tabs").options, n = _355(t); n && (e = $(t).children("div.tabs-panels"), t = "auto" == i.width ? "auto" : e.width(), e = "auto" == i.height ? "auto" : e.height(), n.panel("resize", { width: t, height: e })) } function _359(i) { $.data(i, "tabs").tabs; var t = $(i).addClass("tabs-container"), e = $('<div class="tabs-panels"></div>').insertBefore(t); t.children("div").each(function () { e[0].appendChild(this) }), t[0].appendChild(e[0]), $('<div class="tabs-header"><div class="tabs-scroller-left"></div><div class="tabs-scroller-right"></div><div class="tabs-wrap"><ul class="tabs"></ul></div></div>').prependTo(i), t.children("div.tabs-panels").children("div").each(function (t) { var e = $.extend({}, $.parser.parseOptions(this), { disabled: !!$(this).attr("disabled") || void 0, selected: !!$(this).attr("selected") || void 0 }); _368(i, e, $(this)) }), t.children("div.tabs-header").find(".tabs-scroller-left, .tabs-scroller-right")._bind("mouseenter", function () { $(this).addClass("tabs-scroller-over") })._bind("mouseleave", function () { $(this).removeClass("tabs-scroller-over") }), t._bind("_resize", function (t, e) { return ($(this).hasClass("easyui-fluid") || e) && (_347(i), _353(i)), !1 }) } function _35d(i) { var n = $.data(i, "tabs"), o = n.options; function r(e) { var i = 0; return e.parent().children("li").each(function (t) { if (e[0] == this) return i = t, !1 }), i } $(i).children("div.tabs-header")._unbind()._bind("click", function (t) { if ($(t.target).hasClass("tabs-scroller-left")) $(i).tabs("scrollBy", -o.scrollIncrement); else { if (!$(t.target).hasClass("tabs-scroller-right")) { var e = $(t.target).closest("li"); return e.hasClass("tabs-disabled") ? !1 : ($(t.target).closest(".tabs-close").length ? _382(i, r(e)) : e.length && (t = r(e), (!(e = n.tabs[t].panel("options")).collapsible || e.closed ? _379 : _399)(i, t)), !1) } $(i).tabs("scrollBy", o.scrollIncrement) } })._bind("contextmenu", function (t) { var e = $(t.target).closest("li"); e.hasClass("tabs-disabled") || e.length && o.onContextMenu.call(i, t, e.find("span.tabs-title").html(), r(e)) }) } function _364(t) { var e = $.data(t, "tabs").options, i = $(t).children("div.tabs-header"), n = $(t).children("div.tabs-panels"); i.removeClass("tabs-header-top tabs-header-bottom tabs-header-left tabs-header-right"), n.removeClass("tabs-panels-top tabs-panels-bottom tabs-panels-left tabs-panels-right"), "top" == e.tabPosition ? i.insertBefore(n) : "bottom" == e.tabPosition ? (i.insertAfter(n), i.addClass("tabs-header-bottom"), n.addClass("tabs-panels-top")) : "left" == e.tabPosition ? (i.addClass("tabs-header-left"), n.addClass("tabs-panels-right")) : "right" == e.tabPosition && (i.addClass("tabs-header-right"), n.addClass("tabs-panels-left")), 1 == e.plain ? i.addClass("tabs-header-plain") : i.removeClass("tabs-header-plain"), i.removeClass("tabs-header-narrow").addClass(e.narrow ? "tabs-header-narrow" : ""); t = i.find(".tabs"); t.removeClass("tabs-pill").addClass(e.pill ? "tabs-pill" : ""), t.removeClass("tabs-narrow").addClass(e.narrow ? "tabs-narrow" : ""), t.removeClass("tabs-justified").addClass(e.justified ? "tabs-justified" : ""), 1 == e.border ? (i.removeClass("tabs-header-noborder"), n.removeClass("tabs-panels-noborder")) : (i.addClass("tabs-header-noborder"), n.addClass("tabs-panels-noborder")), e.doSize = !0 } function _368(r, a, t) { a = a || {}; var i = $.data(r, "tabs"), e = i.tabs; (null == a.index || a.index > e.length) && (a.index = e.length), a.index < 0 && (a.index = 0); var n = $(r).children("div.tabs-header").find("ul.tabs"), o = $(r).children("div.tabs-panels"), s = $('<li><span class="tabs-inner"><span class="tabs-title"></span><span class="tabs-icon"></span></span></li>'); t = t || $("<div></div>"), a.index >= e.length ? (s.appendTo(n), t.appendTo(o), e.push(t)) : (s.insertBefore(n.children("li:eq(" + a.index + ")")), t.insertBefore(o.children("div.panel:eq(" + a.index + ")")), e.splice(a.index, 0, t)), t.panel($.extend({}, a, { tab: s, border: !1, noheader: !0, closed: !0, doSize: !1, iconCls: a.icon || void 0, onLoad: function () { a.onLoad && a.onLoad.apply(this, arguments), i.options.onLoad.call(r, $(this)) }, onBeforeOpen: function () { if (a.onBeforeOpen && 0 == a.onBeforeOpen.call(this)) return !1; var t = $(r).tabs("getSelected"); if (t) { if (t[0] == this) return _353(r), !1; if ($(r).tabs("unselect", _374(r, t)), t = $(r).tabs("getSelected")) return !1 } var e = $(this).panel("options"); e.tab.addClass("tabs-selected"); var i = $(r).find(">div.tabs-header>div.tabs-wrap"), n = e.tab.position().left, t = n + e.tab.outerWidth(); n < 0 || t > i.width() ? (o = n - (i.width() - e.tab.width()) / 2, $(r).tabs("scrollBy", o)) : $(r).tabs("scrollBy", 0); var o = $(this).panel("panel"); o.css("display", "block"), _353(r), o.css("display", "none") }, onOpen: function () { a.onOpen && a.onOpen.call(this); var t = $(this).panel("options"), e = _374(r, this); i.selectHis.push(e), i.options.onSelect.call(r, t.title, e) }, onBeforeClose: function () { if (a.onBeforeClose && 0 == a.onBeforeClose.call(this)) return !1; $(this).panel("options").tab.removeClass("tabs-selected") }, onClose: function () { a.onClose && a.onClose.call(this); var t = $(this).panel("options"); i.options.onUnselect.call(r, t.title, _374(r, this)) } })), $(r).tabs("update", { tab: t, options: t.panel("options"), type: "header" }) } function _375(t, e) { var i = $.data(t, "tabs").options; null == e.selected && (e.selected = !0), _368(t, e), i.onAdd.call(t, e.title, e.index), e.selected && _379(t, e.index) } function _37a(t, e) { e.type = e.type || "all"; $.data(t, "tabs").selectHis; var i = e.tab, n = i.panel("options"); n.title; if ($.extend(n, e.options, { iconCls: e.options.icon || void 0 }), "all" != e.type && "body" != e.type || i.panel(), "all" == e.type || "header" == e.type) { var o = n.tab; if (n.header) o.find(".tabs-inner").html($(n.header)); else { var r = o.find("span.tabs-title"), e = o.find("span.tabs-icon"); if (r.html(n.title), e.attr("class", "tabs-icon"), o.find(".tabs-close").remove(), n.closable ? (r.addClass("tabs-closable"), $('<span class="tabs-close"></span>').appendTo(o)) : r.removeClass("tabs-closable"), n.iconCls ? (r.addClass("tabs-with-icon"), e.addClass(n.iconCls)) : r.removeClass("tabs-with-icon"), n.tools) { var a = o.find("span.tabs-p-tool"); if (a.length || (a = $('<span class="tabs-p-tool"></span>').insertAfter(o.find(".tabs-inner"))), $.isArray(n.tools)) { a.empty(); for (var s = 0; s < n.tools.length; s++){ var l = $('<a href="javascript:;"></a>').appendTo(a); l.addClass(n.tools[s].iconCls), n.tools[s].handler && l._bind("click", { handler: n.tools[s].handler }, function (t) { $(this).parents("li").hasClass("tabs-disabled") || t.data.handler.call(this) }) } } else $(n.tools).children().appendTo(a); e = 12 * a.children().length; n.closable ? (e += 8, a.css("right", "")) : (e -= 3, a.css("right", "5px")), r.css("padding-right", e + "px") } else o.find("span.tabs-p-tool").remove(), r.css("padding-right", "") } } n.disabled ? n.tab.addClass("tabs-disabled") : n.tab.removeClass("tabs-disabled"), _347(t), $.data(t, "tabs").options.onUpdate.call(t, n.title, _374(t, i)) } function _382(t, e) { var i = $.data(t, "tabs"), n = i.options, o = (i.tabs, i.selectHis); if (_387(t, e)) { var r = _388(t, e), a = r.panel("options").title, s = _374(t, r); if (0 != n.onBeforeClose.call(t, a, s)) { (r = _388(t, e, !0)).panel("options").tab.remove(), r.panel("destroy"), n.onClose.call(t, a, s), _347(t); for (var l = [], c = 0; c < o.length; c++){ var d = o[c]; d != s && l.push(s < d ? d - 1 : d) } i.selectHis = l, !$(t).tabs("getSelected") && l.length && (s = i.selectHis.pop(), $(t).tabs("select", s)) } } } function _388(t, e, i) { var n = $.data(t, "tabs").tabs, o = null; if ("number" == typeof e) 0 <= e && e < n.length && (o = n[e], i && n.splice(e, 1)); else { for (var r = $("<span></span>"), a = 0; a < n.length; a++){ var s = n[a]; r.html(s.panel("options").title); var l = r.text(); if (r.html(e), l == (e = r.text())) { o = s, i && n.splice(a, 1); break } } r.remove() } return o } function _374(t, e) { for (var i = $.data(t, "tabs").tabs, n = 0; n < i.length; n++)if (i[n][0] == $(e)[0]) return n; return -1 } function _355(t) { for (var e = $.data(t, "tabs").tabs, i = 0; i < e.length; i++){ var n = e[i]; if (n.panel("options").tab.hasClass("tabs-selected")) return n } return null } function _393(t) { for (var e = $.data(t, "tabs"), i = e.tabs, n = 0; n < i.length; n++){ var o = i[n].panel("options"); if (o.selected && !o.disabled) return void _379(t, n) } _379(t, e.options.selected) } function _379(t, e) { e = _388(t, e); e && !e.is(":visible") && (_398(t), e.panel("options").disabled || e.panel("open")) } function _399(t, e) { e = _388(t, e); e && e.is(":visible") && (_398(t), e.panel("close")) } function _398(t) { $(t).children("div.tabs-panels").each(function () { $(this).stop(!0, !0) }) } function _387(t, e) { return null != _388(t, e) } function _39f(t, e) { $.data(t, "tabs").options.showHeader = e, $(t).tabs("resize") } function _3a2(t, e) { var i = $(t).find(">.tabs-header>.tabs-tool"); e ? i.removeClass("tabs-tool-hidden").show() : i.addClass("tabs-tool-hidden").hide(), $(t).tabs("resize").tabs("scrollBy", 0) } $.fn.tabs = function (e, t) { return "string" == typeof e ? $.fn.tabs.methods[e](this, t) : (e = e || {}, this.each(function () { var t = $.data(this, "tabs"); t ? $.extend(t.options, e) : ($.data(this, "tabs", { options: $.extend({}, $.fn.tabs.defaults, $.fn.tabs.parseOptions(this), e), tabs: [], selectHis: [] }), _359(this)), _343(this), _364(this), _347(this), _35d(this), _393(this) })) }, $.fn.tabs.methods = { options: function (t) { var e = t[0], i = $.data(e, "tabs").options, t = _355(e); return i.selected = t ? _374(e, t) : -1, i }, tabs: function (t) { return $.data(t[0], "tabs").tabs }, resize: function (t, e) { return t.each(function () { _347(this, e), _353(this) }) }, add: function (t, e) { return t.each(function () { _375(this, e) }) }, close: function (t, e) { return t.each(function () { _382(this, e) }) }, getTab: function (t, e) { return _388(t[0], e) }, getTabIndex: function (t, e) { return _374(t[0], e) }, getSelected: function (t) { return _355(t[0]) }, select: function (t, e) { return t.each(function () { _379(this, e) }) }, unselect: function (t, e) { return t.each(function () { _399(this, e) }) }, exists: function (t, e) { return _387(t[0], e) }, update: function (t, e) { return t.each(function () { _37a(this, e) }) }, enableTab: function (t, e) { return t.each(function () { var t = $(this).tabs("getTab", e).panel("options"); t.tab.removeClass("tabs-disabled"), t.disabled = !1 }) }, disableTab: function (t, e) { return t.each(function () { var t = $(this).tabs("getTab", e).panel("options"); t.tab.addClass("tabs-disabled"), t.disabled = !0 }) }, showHeader: function (t) { return t.each(function () { _39f(this, !0) }) }, hideHeader: function (t) { return t.each(function () { _39f(this, !1) }) }, showTool: function (t) { return t.each(function () { _3a2(this, !0) }) }, hideTool: function (t) { return t.each(function () { _3a2(this, !1) }) }, scrollBy: function (t, r) { return t.each(function () { var t, e, i = $(this).tabs("options"), n = $(this).find(">div.tabs-header>div.tabs-wrap"), o = Math.min(n._scrollLeft() + r, (t = 0, (e = n.children("ul")).children("li").each(function () { t += $(this).outerWidth(!0) }), t - n.width() + (e.outerWidth() - e.width()))); n.animate({ scrollLeft: o }, i.scrollDuration) }) } }, $.fn.tabs.parseOptions = function (t) { return $.extend({}, $.parser.parseOptions(t, ["tools", "toolPosition", "tabPosition", { fit: "boolean", border: "boolean", plain: "boolean" }, { headerWidth: "number", tabWidth: "number", tabHeight: "number", selected: "number" }, { showHeader: "boolean", justified: "boolean", narrow: "boolean", pill: "boolean" }])) }, $.fn.tabs.defaults = { width: "auto", height: "auto", headerWidth: 150, tabWidth: "auto", tabHeight: 32, selected: 0, showHeader: !0, plain: !1, fit: !1, border: !0, justified: !1, narrow: !1, pill: !1, tools: null, toolPosition: "right", tabPosition: "top", scrollIncrement: 100, scrollDuration: 400, onLoad: function (t) { }, onSelect: function (t, e) { }, onUnselect: function (t, e) { }, onBeforeClose: function (t, e) { }, onClose: function (t, e) { }, onAdd: function (t, e) { }, onUpdate: function (t, e) { }, onContextMenu: function (t, e, i) { } } }(jQuery), function (u) { var f = !1; function c(t, e) { var i = u.data(t, "layout"), n = i.options, i = i.panels, o = u(t); e && u.extend(n, { width: e.width, height: e.height }), "body" == t.tagName.toLowerCase() ? o._size("fit") : o._size(n); var r = { top: 0, left: 0, width: o.width(), height: o.height() }; function a(t, e) { var i, n; t.length && b(t) && (i = t.panel("options"), t.panel("resize", { width: o.width(), height: i.height }), n = t.panel("panel").outerHeight(), t.panel("move", { left: 0, top: "n" == e ? 0 : o.height() - n }), r.height -= n, "n" == e && (r.top += n, !i.split && i.border && r.top--), !i.split && i.border && r.height++) } function s(t, e) { var i, n; t.length && b(t) && (i = t.panel("options"), t.panel("resize", { width: i.width, height: r.height }), n = t.panel("panel").outerWidth(), t.panel("move", { left: "e" == e ? o.width() - n : 0, top: r.top }), r.width -= n, "w" == e && (r.left += n, !i.split && i.border && r.left--), !i.split && i.border && r.width++) } a(b(i.expandNorth) ? i.expandNorth : i.north, "n"), a(b(i.expandSouth) ? i.expandSouth : i.south, "s"), s(b(i.expandEast) ? i.expandEast : i.east, "e"), s(b(i.expandWest) ? i.expandWest : i.west, "w"), i.center.panel("resize", r) } function a(i) { var t = u(i); t.addClass("layout"); var e = t.layout("options"), n = e.onAdd; e.onAdd = function () { }, t.find(">div,>form>div").each(function () { var t, e; t = this, e = u.fn.layout.parsePanelOptions(t), 0 <= "north,south,east,west,center".indexOf(e.region) && o(i, e, t) }), e.onAdd = n, t.append('<div class="layout-split-proxy-h"></div><div class="layout-split-proxy-v"></div>'), t._bind("_resize", function (t, e) { return (u(this).hasClass("easyui-fluid") || e) && c(i), !1 }) } function o(a, t, e) { t.region = t.region || "center"; var i, n, s = u.data(a, "layout").panels, o = u(a), l = t.region; function r(t) { var e = "expand" + l.substring(0, 1).toUpperCase() + l.substring(1), i = s.center, n = "north" == l || "south" == l ? "minHeight" : "minWidth", o = "north" == l || "south" == l ? "maxHeight" : "maxWidth", r = "north" == l || "south" == l ? "_outerHeight" : "_outerWidth", o = u.parser.parseValue(o, s[l].panel("options")[o], u(a)), n = u.parser.parseValue(n, i.panel("options")[n], u(a)), n = i.panel("panel")[r]() - n; return b(s[e]) ? n += s[e][r]() - 1 : n += u(t)[r](), o < n && (n = o), n } s[l].length || ((i = u(e)).length || (i = u("<div></div>").appendTo(o)), e = u.extend({}, u.fn.layout.paneldefaults, { width: i.length ? parseInt(i[0].style.width) || i.outerWidth() : "auto", height: i.length ? parseInt(i[0].style.height) || i.outerHeight() : "auto", doSize: !1, collapsible: !0, onOpen: function () { var t = u(this).panel("header").children("div.panel-tool"); t.children("a.panel-tool-collapse").hide(); var e, i = { north: "up", south: "down", east: "right", west: "left" }; i[l] && (e = "layout-button-" + i[l], (i = t.children("a." + e)).length || (i = u('<a href="javascript:;"></a>').addClass(e).appendTo(t))._bind("click", { dir: l }, function (t) { return p(a, t.data.dir), !1 }), u(this).panel("options").collapsible ? i.show() : i.hide()) } }, t, { cls: (t.cls || "") + " layout-panel layout-panel-" + l, bodyCls: (t.bodyCls || "") + " layout-body" }), i.panel(e), n = (s[l] = i).panel("panel"), i.panel("options").split && n.addClass("layout-split-" + l), n.resizable(u.extend({}, { handles: { north: "s", south: "n", east: "w", west: "e" }[l] || "", disabled: !i.panel("options").split, onStartResize: function (t) { var e; f = !0, e = u("north" == l || "south" == l ? ">div.layout-split-proxy-v" : ">div.layout-split-proxy-h", a); var i = { display: "block" }; "north" == l ? (i.top = parseInt(n.css("top")) + n.outerHeight() - e.height(), i.left = parseInt(n.css("left")), i.width = n.outerWidth(), i.height = e.height()) : "south" == l ? (i.top = parseInt(n.css("top")), i.left = parseInt(n.css("left")), i.width = n.outerWidth(), i.height = e.height()) : "east" == l ? (i.top = parseInt(n.css("top")) || 0, i.left = parseInt(n.css("left")) || 0, i.width = e.width(), i.height = n.outerHeight()) : "west" == l && (i.top = parseInt(n.css("top")) || 0, i.left = n.outerWidth() - e.width(), i.width = e.width(), i.height = n.outerHeight()), e.css(i), u('<div class="layout-mask"></div>').css({ left: 0, top: 0, width: o.width(), height: o.height() }).appendTo(o) }, onResize: function (t) { var e, i; return "north" == l || "south" == l ? (e = r(this), u(this).resizable("options").maxHeight = e, i = u(">div.layout-split-proxy-v", a), e = "north" == l ? t.data.height - i.height() : u(a).height() - t.data.height, i.css("top", e)) : (e = r(this), u(this).resizable("options").maxWidth = e, i = u(">div.layout-split-proxy-h", a), t = "west" == l ? t.data.width - i.width() : u(a).width() - t.data.width, i.css("left", t)), !1 }, onStopResize: function (t) { o.children("div.layout-split-proxy-v,div.layout-split-proxy-h").hide(), i.panel("resize", t.data), c(a), f = !1, o.find(">div.layout-mask").remove() } }, t)), o.layout("options").onAdd.call(a, l)) } function p(s, l, t) { null == t && (t = "normal"); var e, i, n, o = u.data(s, "layout"), c = o.panels, d = c[l], h = d.panel("options"); function r() { var t = u(s), e = c.center.panel("options"), i = h.collapsedSize; if ("east" == l) { var n = d.panel("panel")._outerWidth(), o = e.width + n - i; return !h.split && h.border || o++ , { resizeC: { width: o }, expand: { left: t.width() - n }, expandP: { top: e.top, left: t.width() - i, width: i, height: e.height }, collapse: { left: t.width(), top: e.top, height: e.height } } } if ("west" == l) { n = d.panel("panel")._outerWidth(), o = e.width + n - i; return !h.split && h.border || o++ , { resizeC: { width: o, left: i - 1 }, expand: { left: 0 }, expandP: { left: 0, top: e.top, width: i, height: e.height }, collapse: { left: -n, top: e.top, height: e.height } } } if ("north" == l) { var r = d.panel("panel")._outerHeight(), a = e.height; return b(c.expandNorth) || (a += r - i + (h.split || !h.border ? 1 : 0)), c.east.add(c.west).add(c.expandEast).add(c.expandWest).panel("resize", { top: i - 1, height: a }), { resizeC: { top: i - 1, height: a }, expand: { top: 0 }, expandP: { top: 0, left: 0, width: t.width(), height: i }, collapse: { top: -r, width: t.width() } } } if ("south" == l) { r = d.panel("panel")._outerHeight(), a = e.height; return b(c.expandSouth) || (a += r - i + (h.split || !h.border ? 1 : 0)), c.east.add(c.west).add(c.expandEast).add(c.expandWest).panel("resize", { height: a }), { resizeC: { height: a }, expand: { top: t.height() - r }, expandP: { top: t.height() - i, left: 0, width: t.width(), height: i }, collapse: { top: t.height(), width: t.width() } } } } 0 != h.onBeforeCollapse.call(d) && (e = "expand" + l.substring(0, 1).toUpperCase() + l.substring(1), c[e] || (c[e] = function (t) { var e = "north" == h.region || "south" == h.region, i = "layout-button-" + { east: "left", west: "right", north: "down", south: "up" }[t], n = u("<div></div>").appendTo(s); n.panel(u.extend({}, u.fn.layout.paneldefaults, { cls: "layout-expand layout-expand-" + t, title: "&nbsp;", titleDirection: h.titleDirection, iconCls: h.hideCollapsedContent ? null : h.iconCls, closed: !0, minWidth: 0, minHeight: 0, doSize: !1, region: h.region, collapsedSize: h.collapsedSize, noheader: !e && h.hideExpandTool, tools: e && h.hideExpandTool ? null : [{ iconCls: i, handler: function () { return g(s, l), !1 } }], onResize: function () { var t, e, i, n = u(this).children(".layout-expand-title"); n.length && (t = 0 < (i = u(this).children(".panel-icon")).length ? i._outerHeight() + 2 : 0, n._outerWidth(u(this).height() - t), e = (u(this).width() - Math.min(n._outerWidth(), n._outerHeight())) / 2, i = Math.max(n._outerWidth(), n._outerHeight()), n.hasClass("layout-expand-title-down") && (e += Math.min(n._outerWidth(), n._outerHeight()), i = 0), i += t, n.css({ left: e + "px", top: i + "px" })) } })), h.hideCollapsedContent || (i = "function" == typeof h.collapsedContent ? h.collapsedContent.call(n[0], h.title) : h.collapsedContent, e ? n.panel("setTitle", i) : n.html(i)); return n.panel("panel").hover(function () { u(this).addClass("layout-expand-over") }, function () { u(this).removeClass("layout-expand-over") }), n }(l), i = c[e].panel("panel"), h.expandMode ? i._bind("click", function () { var t; return "dock" == h.expandMode ? g(s, l) : (d.panel("expand", !1).panel("open"), t = r(), d.panel("resize", t.collapse), d.panel("panel")._unbind(".layout")._bind("mouseleave.layout", { region: l }, function (t) { var e = this; o.collapseTimer = setTimeout(function () { u(e).stop(!0, !0), 1 != f && (u("body>div.combo-p>div.combo-panel:visible").length || p(s, t.data.region)) }, o.options.collapseDelay) }), d.panel("panel").animate(t.expand, function () { u(s).layout("options").onExpand.call(s, l) })), !1 }) : i.css("cursor", "default")), n = r(), b(c[e]) || c.center.panel("resize", n.resizeC), d.panel("panel").animate(n.collapse, t, function () { d.panel("collapse", !1).panel("close"), c[e].panel("open").panel("resize", n.expandP), u(this)._unbind(".layout"), u(s).layout("options").onCollapse.call(s, l) })) } function g(t, e) { var i, n, o, r = u.data(t, "layout").panels, a = r[e]; 0 != a.panel("options").onBeforeExpand.call(a) && (i = "expand" + e.substring(0, 1).toUpperCase() + e.substring(1), r[i] && (r[i].panel("close"), a.panel("panel").stop(!0, !0), a.panel("expand", !1).panel("open"), n = u(t), o = r.center.panel("options"), i = "east" == e && r.expandEast ? { collapse: { left: n.width(), top: o.top, height: o.height }, expand: { left: n.width() - a.panel("panel")._outerWidth() } } : "west" == e && r.expandWest ? { collapse: { left: -a.panel("panel")._outerWidth(), top: o.top, height: o.height }, expand: { left: 0 } } : "north" == e && r.expandNorth ? { collapse: { top: -a.panel("panel")._outerHeight(), width: n.width() }, expand: { top: 0 } } : "south" == e && r.expandSouth ? { collapse: { top: n.height(), width: n.width() }, expand: { top: n.height() - a.panel("panel")._outerHeight() } } : void 0, a.panel("resize", i.collapse), a.panel("panel").animate(i.expand, function () { c(t), u(t).layout("options").onExpand.call(t, e) }))) } function b(t) { return t && (t.length && t.panel("panel").is(":visible")) } function i(t, e, i) { var n = u(t).layout("panel", e); n.panel("options").split = i; e = "layout-split-" + e, n = n.panel("panel").removeClass(e); i && n.addClass(e), n.resizable({ disabled: !i }), c(t) } u.fn.layout = function (r, t) { return "string" == typeof r ? u.fn.layout.methods[r](this, t) : (r = r || {}, this.each(function () { var i, t, n, e = u.data(this, "layout"); function o(t) { var e = n[t]; e.length && e.panel("options").collapsed && p(i, t, 0) } e ? u.extend(e.options, r) : (t = u.extend({}, u.fn.layout.defaults, u.fn.layout.parseOptions(this), r), u.data(this, "layout", { options: t, panels: { center: u(), north: u(), south: u(), east: u(), west: u() } }), a(this)), c(this), i = this, t = (e = u.data(i, "layout")).options, n = e.panels, e = t.onCollapse, t.onCollapse = function () { }, o("east"), o("west"), o("north"), o("south"), t.onCollapse = e })) }, u.fn.layout.methods = { options: function (t) { return u.data(t[0], "layout").options }, resize: function (t, e) { return t.each(function () { c(this, e) }) }, panel: function (t, e) { return u.data(t[0], "layout").panels[e] }, collapse: function (t, e) { return t.each(function () { p(this, e) }) }, expand: function (t, e) { return t.each(function () { g(this, e) }) }, add: function (t, e) { return t.each(function () { o(this, e), c(this), u(this).layout("panel", e.region).panel("options").collapsed && p(this, e.region, 0) }) }, remove: function (t, o) { return t.each(function () { var t, e, i, n; t = this, e = o, (n = u.data(t, "layout").panels)[e].length && (n[e].panel("destroy"), n[e] = u(), n[i = "expand" + e.substring(0, 1).toUpperCase() + e.substring(1)] && (n[i].panel("destroy"), n[i] = void 0), u(t).layout("options").onRemove.call(t, e)), c(this) }) }, split: function (t, e) { return t.each(function () { i(this, e, !0) }) }, unsplit: function (t, e) { return t.each(function () { i(this, e, !1) }) }, stopCollapsing: function (t) { return t.each(function () { clearTimeout(u(this).data("layout").collapseTimer) }) } }, u.fn.layout.parseOptions = function (t) { return u.extend({}, u.parser.parseOptions(t, [{ fit: "boolean" }])) }, u.fn.layout.defaults = { fit: !1, onExpand: function (t) { }, onCollapse: function (t) { }, onAdd: function (t) { }, onRemove: function (t) { } }, u.fn.layout.parsePanelOptions = function (t) { u(t); return u.extend({}, u.fn.panel.parseOptions(t), u.parser.parseOptions(t, ["region", { split: "boolean", collpasedSize: "number", minWidth: "number", minHeight: "number", maxWidth: "number", maxHeight: "number" }])) }, u.fn.layout.paneldefaults = u.extend({}, u.fn.panel.defaults, { region: null, split: !1, collapseDelay: 100, collapsedSize: 32, expandMode: "float", hideExpandTool: !1, hideCollapsedContent: !0, collapsedContent: function (t) { var e = u(this).panel("options"); if ("north" == e.region || "south" == e.region) return t; var i = []; return e.iconCls && i.push('<div class="panel-icon ' + e.iconCls + '"></div>'), i.push('<div class="panel-title layout-expand-title'), i.push(" layout-expand-title-" + e.titleDirection), i.push(e.iconCls ? " layout-expand-with-icon" : ""), i.push('">'), i.push(t), i.push("</div>"), i.join("") }, minWidth: 10, minHeight: 10, maxWidth: 1e4, maxHeight: 1e4 }) }(jQuery), function ($) { function init(i) { var t = $.data(i, "menu").options; $(i).addClass("menu-top"), t.inline ? $(i).addClass("menu-inline") : $(i).appendTo("body"), $(i)._bind("_resize", function (t, e) { return ($(this).hasClass("easyui-fluid") || e) && $(i).menu("resize", i), !1 }); for (var e = function e(t) { var i = []; t.addClass("menu"); i.push(t); t.hasClass("menu-content") || t.children("div").each(function () { var t = $(this).children("div"); t.length && (t.appendTo("body"), this.submenu = t, t = e(t), i = i.concat(t)) }); return i }($(i)), n = 0; n < e.length; n++)_434(i, e[n]) } function _434(t, e) { e = $(e).addClass("menu"); e.data("menu") || e.data("menu", { options: $.parser.parseOptions(e[0], ["width", "height"]) }), e.hasClass("menu-content") || (e.children("div").each(function () { _436(t, this) }), $('<div class="menu-line"></div>').prependTo(e)), _437(t, e), e.hasClass("menu-inline") || e.hide(), _438(t, e) } function _436(_439, div, _43a) { var item = $(div), _43b = $.extend({}, $.parser.parseOptions(item[0], ["id", "name", "iconCls", "href", { separator: "boolean" }]), { disabled: !!item.attr("disabled") || void 0, text: $.trim(item.html()), onclick: item[0].onclick }, _43a || {}); _43b.onclick = _43b.onclick || _43b.handler || null, item.data("menuitem", { options: _43b }), _43b.separator && item.addClass("menu-sep"), item.hasClass("menu-sep") || (item.addClass("menu-item"), item.empty().append($('<div class="menu-text"></div>').html(_43b.text)), _43b.iconCls && $('<div class="menu-icon"></div>').addClass(_43b.iconCls).appendTo(item), _43b.id && item.attr("id", _43b.id), _43b.onclick && ("string" == typeof _43b.onclick ? item.attr("onclick", _43b.onclick) : item[0].onclick = eval(_43b.onclick)), _43b.disabled && _43c(_439, item[0], !0), item[0].submenu && $('<div class="menu-rightarrow"></div>').appendTo(item)) } function _437(t, e) { var i = $.data(t, "menu").options, n = e.attr("style") || "", o = e.is(":visible"); e.css({ display: "block", left: -1e4, height: "auto", overflow: "hidden" }), e.find(".menu-item").each(function () { $(this)._outerHeight(i.itemHeight), $(this).find(".menu-text").css({ height: i.itemHeight - 2 + "px", lineHeight: i.itemHeight - 2 + "px" }) }), e.removeClass("menu-noline").addClass(i.noline ? "menu-noline" : ""); var r = e.data("menu").options, a = r.width, s = r.height; isNaN(parseInt(a)) && (a = 0, e.find("div.menu-text").each(function () { a < $(this).outerWidth() && (a = $(this).outerWidth()) }), a = a ? a + 40 : ""); var l, c = e.outerHeight(); isNaN(parseInt(s)) && (s = c, e.hasClass("menu-top") && i.alignTo ? (t = (l = $(i.alignTo)).offset().top - $(document).scrollTop(), l = $(window)._outerHeight() + $(document).scrollTop() - l.offset().top - l._outerHeight(), s = Math.min(s, Math.max(t, l))) : s > $(window)._outerHeight() && (s = $(window).height())), e.attr("style", n), e.show(), e._size($.extend({}, r, { width: a, height: s, minWidth: r.minWidth || i.minWidth, maxWidth: r.maxWidth || i.maxWidth })), e.find(".easyui-fluid").triggerHandler("_resize", [!0]), e.css("overflow", e.outerHeight() < c ? "auto" : "hidden"), e.children("div.menu-line")._outerHeight(c - 2), o || e.hide() } function _438(t, e) { var i, n = $.data(t, "menu").options; for (i in e._unbind(".menu"), n.events) e._bind(i + ".menu", { target: t }, n.events[i]) } function _447(t) { t = t.data.target, t = $.data(t, "menu"); t.timer && (clearTimeout(t.timer), t.timer = null) } function _44a(t) { var e = t.data.target, t = $.data(e, "menu"); t.options.hideOnUnhover && (t.timer = setTimeout(function () { _44d(e, $(e).hasClass("menu-inline")) }, t.options.duration)) } function _44e(t) { var e = t.data.target, i = $(t.target).closest(".menu-item"); i.length && (i.siblings().each(function () { this.submenu && _42d(this.submenu), $(this).removeClass("menu-active") }), i.addClass("menu-active"), i.hasClass("menu-item-disabled") ? i.addClass("menu-active-disabled") : (t = i[0].submenu) && $(e).menu("show", { menu: t, parent: i })) } function _451(t) { var e, i = $(t.target).closest(".menu-item"); i.length && (i.removeClass("menu-active menu-active-disabled"), (e = i[0].submenu) ? t.pageX >= parseInt(e.css("left")) ? i.addClass("menu-active") : _42d(e) : i.removeClass("menu-active")) } function _453(t) { var e, i = t.data.target, n = $(t.target).closest(".menu-item"); n.length && (e = $(i).data("menu").options, (t = n.data("menuitem").options).disabled || (n[0].submenu || (_44d(i, e.inline), t.href && (location.href = t.href)), n.trigger("mouseenter"), e.onClick.call(i, $(i).menu("getItem", n[0])))) } function _44d(t, e) { var i = $.data(t, "menu"); i && $(t).is(":visible") && (_42d($(t)), e ? $(t).show() : i.options.onHide.call(t)) } function _459(t, e) { e = e || {}; var i, n, o, r = $.data(t, "menu").options, a = $(e.menu || t); function s(t, e) { return t + a.outerHeight() > $(window)._outerHeight() + $(document).scrollTop() && (t = e ? $(e).offset().top - a._outerHeight() : $(window)._outerHeight() + $(document).scrollTop() - a.outerHeight()), t < 0 && (t = 0), t } $(t).menu("resize", a[0]), o = a.hasClass("menu-top") ? ($.extend(r, e), n = r.left, o = r.top, r.alignTo && (n = (i = $(r.alignTo)).offset().left, o = i.offset().top + i._outerHeight(), "right" == r.align && (n += i.outerWidth() - a.outerWidth())), n + a.outerWidth() > $(window)._outerWidth() + $(document)._scrollLeft() && (n = $(window)._outerWidth() + $(document).scrollLeft() - a.outerWidth() - 5), n < 0 && (n = 0), s(o, r.alignTo)) : ((n = (e = e.parent).offset().left + e.outerWidth() - 2) + a.outerWidth() + 5 > $(window)._outerWidth() + $(document).scrollLeft() && (n = e.offset().left - a.outerWidth() + 2), s(e.offset().top - 3)), a.css(r.position.call(t, a[0], n, o)), a.show(0, function () { a[0].shadow || (a[0].shadow = $('<div class="menu-shadow"></div>').insertAfter(a)), a[0].shadow.css({ display: a.hasClass("menu-inline") ? "none" : "block", zIndex: $.fn.menu.defaults.zIndex++, left: a.css("left"), top: a.css("top"), width: a.outerWidth(), height: a.outerHeight() }), a.css("z-index", $.fn.menu.defaults.zIndex++), a.hasClass("menu-top") && r.onShow.call(t) }) } function _42d(t) { var e; t && t.length && ((e = t).stop(!0, !0), e[0].shadow && e[0].shadow.hide(), e.hide(), t.find("div.menu-item").each(function () { this.submenu && _42d(this.submenu), $(this).removeClass("menu-active") })) } function _460(i, n) { var o = null, r = $.isFunction(n) ? n : function (t) { for (var e in n) if (t[e] != n[e]) return !1; return !0 }; return function e(t) { t.children("div.menu-item").each(function () { var t = $(this).data("menuitem").options; 1 == r.call(i, t) ? o = $(i).menu("getItem", this) : this.submenu && !o && e(this.submenu) }) }($(i)), o } function _43c(t, e, i) { var n = $(e); n.hasClass("menu-item") && (((e = n.data("menuitem").options).disabled = i) ? (n.addClass("menu-item-disabled"), n[0].onclick = null) : (n.removeClass("menu-item-disabled"), n[0].onclick = e.onclick)) } function _467(t, e) { $.data(t, "menu").options; var i, n = $(t); e.parent && (e.parent.submenu || (i = $("<div></div>").appendTo("body"), e.parent.submenu = i, $('<div class="menu-rightarrow"></div>').appendTo(e.parent), _434(t, i)), n = e.parent.submenu), _436(t, $("<div></div>").appendTo(n), e) } function _46b(t, e) { !function t(e) { var i; e.submenu && (e.submenu.children("div.menu-item").each(function () { t(this) }), (i = e.submenu[0].shadow) && i.remove(), e.submenu.remove()), $(e).remove() }(e) } function _470(t, e, i) { var n = $(e).parent(); i ? $(e).show() : $(e).hide(), _437(t, n) } function _474(t) { $(t).children("div.menu-item").each(function () { _46b(t, this) }), t.shadow && t.shadow.remove(), $(t).remove() } $(function () { $(document)._unbind(".menu")._bind("mousedown.menu", function (t) { $(t.target).closest("div.menu,div.combo-p").length || ($("body>div.menu-top:visible").not(".menu-inline").menu("hide"), _42d($("body>div.menu:visible").not(".menu-inline"))) }) }), $.fn.menu = function (e, t) { return "string" == typeof e ? $.fn.menu.methods[e](this, t) : (e = e || {}, this.each(function () { var t = $.data(this, "menu"); t ? $.extend(t.options, e) : (t = $.data(this, "menu", { options: $.extend({}, $.fn.menu.defaults, $.fn.menu.parseOptions(this), e) }), init(this)), $(this).css({ left: t.options.left, top: t.options.top }) })) }, $.fn.menu.methods = { options: function (t) { return $.data(t[0], "menu").options }, show: function (t, e) { return t.each(function () { _459(this, e) }) }, hide: function (t) { return t.each(function () { _44d(this) }) }, destroy: function (t) { return t.each(function () { _474(this) }) }, setText: function (t, e) { return t.each(function () { $(e.target).data("menuitem").options.text = e.text, $(e.target).children("div.menu-text").html(e.text) }) }, setIcon: function (t, e) { return t.each(function () { $(e.target).data("menuitem").options.iconCls = e.iconCls, $(e.target).children("div.menu-icon").remove(), e.iconCls && $('<div class="menu-icon"></div>').addClass(e.iconCls).appendTo(e.target) }) }, getItem: function (t, e) { var i = $(e).data("menuitem").options; return $.extend({}, i, { target: $(e)[0] }) }, findItem: function (t, e) { return _460(t[0], "string" == typeof e ? function (t) { return $("<div>" + t.text + "</div>").text() == e } : e) }, appendItem: function (t, e) { return t.each(function () { _467(this, e) }) }, removeItem: function (t, e) { return t.each(function () { _46b(this, e) }) }, enableItem: function (t, e) { return t.each(function () { _43c(this, e, !1) }) }, disableItem: function (t, e) { return t.each(function () { _43c(this, e, !0) }) }, showItem: function (t, e) { return t.each(function () { _470(this, e, !0) }) }, hideItem: function (t, e) { return t.each(function () { _470(this, e, !1) }) }, resize: function (t, e) { return t.each(function () { _437(this, $(e || this)) }) } }, $.fn.menu.parseOptions = function (t) { return $.extend({}, $.parser.parseOptions(t, [{ minWidth: "number", itemHeight: "number", duration: "number", hideOnUnhover: "boolean" }, { fit: "boolean", inline: "boolean", noline: "boolean" }])) }, $.fn.menu.defaults = { zIndex: 11e4, left: 0, top: 0, alignTo: null, align: "left", minWidth: 150, itemHeight: 32, duration: 100, hideOnUnhover: !0, inline: !1, fit: !1, noline: !1, events: { mouseenter: _447, mouseleave: _44a, mouseover: _44e, mouseout: _451, click: _453 }, position: function (t, e, i) { return { left: e, top: i } }, onShow: function () { }, onHide: function () { }, onClick: function (t) { } } }(jQuery), function (l) { var a = 1; function i(t, e) { var i = l(t).sidemenu("options"); e && l.extend(i, { width: e.width, height: e.height }), l(t)._size(i), l(t).find(".accordion").accordion("resize") } function s(e, t, i) { var n = l(e).sidemenu("options"), o = l('<ul class="sidemenu-tree"></ul>').appendTo(t); o.tree({ data: i, animate: n.animate, onBeforeSelect: function (t) { if (t.children) return !1 }, onSelect: function (t) { c(e, t.id, !0) }, onExpand: function (t) { d(e, t) }, onCollapse: function (t) { d(e, t) }, onClick: function (t) { t.children && ("open" == t.state ? l(t.target).addClass("tree-node-nonleaf-collapsed") : l(t.target).removeClass("tree-node-nonleaf-collapsed"), l(this).tree("toggle", t.target)) } }), o._unbind(".sidemenu")._bind("mouseleave.sidemenu", function () { l(t).trigger("mouseleave") }), c(e, n.selectedItemId) } function r(t, e) { l(t).find(".sidemenu-tree").each(function () { e(l(this)) }), l(t).find(".tooltip-f").each(function () { var t = l(this).tooltip("tip"); t && (t.find(".sidemenu-tree").each(function () { e(l(this)) }), l(this).tooltip("reposition")) }) } function c(t, i, e) { var n = null, o = l(t).sidemenu("options"); r(t, function (t) { t.find("div.tree-node-selected").removeClass("tree-node-selected"); var e = t.tree("find", i); e && (l(e.target).addClass("tree-node-selected"), o.selectedItemId = e.id, t.trigger("mouseleave.sidemenu"), n = e) }), e && n && o.onSelect.call(t, n) } function d(t, o) { r(t, function (t) { var e, i, n = t.tree("find", o.id); n && (i = (e = t.tree("options")).animate, e.animate = !1, t.tree("open" == o.state ? "expand" : "collapse", n.target), e.animate = i) }) } function n(t) { var e = l(t).sidemenu("options"); if (l(t).empty(), e.data) { l.easyui.forEach(e.data, !0, function (t) { t.id || (t.id = "_easyui_sidemenu_" + a++), t.iconCls || (t.iconCls = "sidemenu-default-icon"), t.children && (t.nodeCls = "tree-node-nonleaf", t.state || (t.state = "closed"), "open" == t.state ? t.nodeCls = "tree-node-nonleaf" : t.nodeCls = "tree-node-nonleaf tree-node-nonleaf-collapsed") }); var i = l("<div></div>").appendTo(t); i.accordion({ fit: "auto" != e.height, border: e.border, multiple: e.multiple }); for (var n = e.data, o = 0; o < n.length; o++){ i.accordion("add", { title: n[o].text, selected: "open" == n[o].state, iconCls: n[o].iconCls, onBeforeExpand: function () { return !e.collapsed } }); var r = i.accordion("panels")[o]; s(t, r, n[o].children), function (i, t, e) { var n = l(i).sidemenu("options"); l(t).tooltip({ content: l("<div></div>"), position: n.floatMenuPosition, valign: "top", data: e, onUpdate: function (t) { var e = l(this).tooltip("options").data; t.accordion({ width: n.floatMenuWidth, multiple: !1 }).accordion("add", { title: e.text, collapsed: !1, collapsible: !1 }), s(i, t.accordion("panels")[0], e.children) }, onShow: function () { var t = l(this), e = t.tooltip("tip").addClass("sidemenu-tooltip"); e.children(".tooltip-content").addClass("sidemenu"), e.find(".accordion").accordion("resize"), e.add(e.find("ul.tree"))._unbind(".sidemenu")._bind("mouseover.sidemenu", function () { t.tooltip("show") })._bind("mouseleave.sidemenu", function () { t.tooltip("hide") }), t.tooltip("reposition") }, onPosition: function (t, e) { var i = l(this).tooltip("tip"); n.collapsed ? e + i.outerHeight() > l(window)._outerHeight() + l(document).scrollTop() && (e = l(window)._outerHeight() + l(document).scrollTop() - i.outerHeight(), i.css("top", e)) : i.css({ left: -999999 }) } }) }(t, r.panel("header"), n[o]) } } } function o(t, e) { var i = l(t).sidemenu("options"); i.collapsed = e; var n = l(t).find(".accordion"), o = n.accordion("panels"); if (n.accordion("options").animate = !1, i.collapsed) { l(t).addClass("sidemenu-collapsed"); for (var r = 0; r < o.length; r++)(s = o[r]).panel("options").collapsed ? i.data[r].state = "closed" : (i.data[r].state = "open", n.accordion("unselect", r)), (a = s.panel("header")).find(".panel-title").html(""), a.find(".panel-tool").hide() } else { l(t).removeClass("sidemenu-collapsed"); for (r = 0; r < o.length; r++){ var a, s = o[r]; "open" == i.data[r].state && n.accordion("select", r), (a = s.panel("header")).find(".panel-title").html(s.panel("options").title), a.find(".panel-tool").show() } } n.accordion("options").animate = i.animate } l.fn.sidemenu = function (e, t) { return "string" == typeof e ? (0, l.fn.sidemenu.methods[e])(this, t) : (e = e || {}, this.each(function () { var t = l.data(this, "sidemenu"); t ? l.extend(t.options, e) : (t = l.data(this, "sidemenu", { options: l.extend({}, l.fn.sidemenu.defaults, l.fn.sidemenu.parseOptions(this), e) }), l(this).addClass("sidemenu")), i(this), n(this), o(this, t.options.collapsed) })) }, l.fn.sidemenu.methods = { options: function (t) { return t.data("sidemenu").options }, resize: function (t, e) { return t.each(function () { i(this, e) }) }, collapse: function (t) { return t.each(function () { o(this, !0) }) }, expand: function (t) { return t.each(function () { o(this, !1) }) }, destroy: function (t) { return t.each(function () { var t; l(t = this).find(".tooltip-f").each(function () { l(this).tooltip("destroy") }), l(t).remove() }) } }, l.fn.sidemenu.parseOptions = function (t) { l(t); return l.extend({}, l.parser.parseOptions(t, ["width", "height"])) }, l.fn.sidemenu.defaults = { width: 200, height: "auto", border: !0, animate: !0, multiple: !0, collapsed: !1, data: null, floatMenuWidth: 200, floatMenuPosition: "right", onSelect: function (t) { } } }(jQuery), function (a) { function s(n) { var t = a.data(n, "menubutton").options, e = a(n), i = e.find("." + t.cls.trigger); i.length || (i = e), i._unbind(".menubutton"); var o = null; i._bind(t.showEvent + ".menubutton", function () { if (!a(n).linkbutton("options").disabled) return o = setTimeout(function () { var t, e, i; !(i = a(t = n).menubutton("options")).disabled && i.menu && (a("body>div.menu-top").menu("hide"), e = a(t), (t = a(i.menu)).length && (t.menu("options").alignTo = e, t.menu("show", { alignTo: e, align: i.menuAlign })), e.blur()) }, t.duration), !1 })._bind(t.hideEvent + ".menubutton", function () { o && clearTimeout(o), a(t.menu).triggerHandler("mouseleave") }) } a.fn.menubutton = function (r, t) { if ("string" != typeof r) return r = r || {}, this.each(function () { var t, i, n, e, o = a.data(this, "menubutton"); o ? a.extend(o.options, r) : (a.data(this, "menubutton", { options: a.extend({}, a.fn.menubutton.defaults, a.fn.menubutton.parseOptions(this), r) }), a(this)._propAttr("disabled", !1)), t = this, e = a.data(t, "menubutton").options, (o = a(t)).linkbutton(e), e.hasDownArrow && (o.removeClass(e.cls.btn1 + " " + e.cls.btn2).addClass("m-btn"), o.removeClass("m-btn-small m-btn-medium m-btn-large").addClass("m-btn-" + e.size), o = o.find(".l-btn-left"), a("<span></span>").addClass(e.cls.arrow).appendTo(o), a("<span></span>").addClass("m-btn-line").appendTo(o)), a(t).menubutton("resize"), e.menu && (a(e.menu).menu({ duration: e.duration }), e = a(e.menu).menu("options"), i = e.onShow, n = e.onHide, a.extend(e, { onShow: function () { var t = a(this).menu("options"), e = a(t.alignTo), t = e.menubutton("options"); e.addClass(1 == t.plain ? t.cls.btn2 : t.cls.btn1), i.call(this) }, onHide: function () { var t = a(this).menu("options"), e = a(t.alignTo), t = e.menubutton("options"); e.removeClass(1 == t.plain ? t.cls.btn2 : t.cls.btn1), n.call(this) } })), s(this) }); var e = a.fn.menubutton.methods[r]; return e ? e(this, t) : this.linkbutton(r, t) }, a.fn.menubutton.methods = { options: function (t) { var e = t.linkbutton("options"); return a.extend(a.data(t[0], "menubutton").options, { toggle: e.toggle, selected: e.selected, disabled: e.disabled }) }, destroy: function (t) { return t.each(function () { var t = a(this).menubutton("options"); t.menu && a(t.menu).menu("destroy"), a(this).remove() }) } }, a.fn.menubutton.parseOptions = function (t) { a(t); return a.extend({}, a.fn.linkbutton.parseOptions(t), a.parser.parseOptions(t, ["menu", { plain: "boolean", hasDownArrow: "boolean", duration: "number" }])) }, a.fn.menubutton.defaults = a.extend({}, a.fn.linkbutton.defaults, { plain: !0, hasDownArrow: !0, menu: null, menuAlign: "left", duration: 100, showEvent: "mouseenter", hideEvent: "mouseleave", cls: { btn1: "m-btn-active", btn2: "m-btn-plain-active", arrow: "m-btn-downarrow", trigger: "m-btn" } }) }(jQuery), function (n) { n.fn.splitbutton = function (i, t) { if ("string" != typeof i) return i = i || {}, this.each(function () { var t, e = n.data(this, "splitbutton"); e ? n.extend(e.options, i) : (n.data(this, "splitbutton", { options: n.extend({}, n.fn.splitbutton.defaults, n.fn.splitbutton.parseOptions(this), i) }), n(this)._propAttr("disabled", !1)), t = this, e = n.data(t, "splitbutton").options, n(t).menubutton(e), n(t).addClass("s-btn") }); var e = n.fn.splitbutton.methods[i]; return e ? e(this, t) : this.menubutton(i, t) }, n.fn.splitbutton.methods = { options: function (t) { var e = t.menubutton("options"), t = n.data(t[0], "splitbutton").options; return n.extend(t, { disabled: e.disabled, toggle: e.toggle, selected: e.selected }), t } }, n.fn.splitbutton.parseOptions = function (t) { n(t); return n.extend({}, n.fn.linkbutton.parseOptions(t), n.parser.parseOptions(t, ["menu", { plain: "boolean", duration: "number" }])) }, n.fn.splitbutton.defaults = n.extend({}, n.fn.linkbutton.defaults, { plain: !0, menu: null, duration: 100, cls: { btn1: "m-btn-active s-btn-active", btn2: "m-btn-plain-active s-btn-plain-active", arrow: "m-btn-downarrow", trigger: "m-btn-line" } }) }(jQuery), function (h) { var u = 1; function f(t, e) { var i = h.data(t, "switchbutton"), n = i.options, o = i.switchbutton; e && h.extend(n, e); var r = o.is(":visible"); r || o.appendTo("body"), o._size(n), n.label && n.labelPosition && ("top" == n.labelPosition ? i.label._size({ width: n.labelWidth }, o) : (i.label._size({ width: n.labelWidth, height: o.outerHeight() }, o), i.label.css("lineHeight", o.outerHeight() + "px"))); var a = o.width(), s = o.height(), a = o.outerWidth(), s = o.outerHeight(), e = parseInt(n.handleWidth) || o.height(), i = 2 * a - e; o.find(".switchbutton-inner").css({ width: i + "px", height: s + "px", lineHeight: s + "px" }), o.find(".switchbutton-handle")._outerWidth(e)._outerHeight(s).css({ marginLeft: -e / 2 + "px" }), o.find(".switchbutton-on").css({ width: a - e / 2 + "px", textIndent: (n.reversed ? "" : "-") + e / 2 + "px" }), o.find(".switchbutton-off").css({ width: a - e / 2 + "px", textIndent: (n.reversed ? "-" : "") + e / 2 + "px" }), n.marginWidth = a - e, p(t, n.checked, !1), r || o.insertAfter(t) } function p(t, e, i) { var n = h.data(t, "switchbutton"), o = n.options, r = n.switchbutton.find(".switchbutton-inner"), a = r.find(".switchbutton-on"), s = o.reversed ? e ? o.marginWidth : 0 : e ? 0 : o.marginWidth, n = {}; n["margin-" + a.css("float").toLowerCase()] = -s + "px", i ? r.animate(n, 200) : r.css(n); r = r.find(".switchbutton-value"); h(t).add(r)._propAttr("checked", e), o.checked != e && (o.checked = e, o.onChange.call(t, o.checked), h(t).closest("form").trigger("_change", [t])) } function g(t, e) { var i = h.data(t, "switchbutton"), n = i.options, o = i.switchbutton, i = o.find(".switchbutton-value"); e ? (n.disabled = !0, h(t).add(i)._propAttr("disabled", !0), o.addClass("switchbutton-disabled"), o.removeAttr("tabindex")) : (n.disabled = !1, h(t).add(i)._propAttr("disabled", !1), o.removeClass("switchbutton-disabled"), o.attr("tabindex", h(t).attr("tabindex") || "")) } function b(t, e) { var i = h.data(t, "switchbutton"), t = i.options; t.readonly = null == e || e, i.switchbutton.removeClass("switchbutton-readonly").addClass(t.readonly ? "switchbutton-readonly" : "") } h.fn.switchbutton = function (d, t) { return "string" == typeof d ? h.fn.switchbutton.methods[d](this, t) : (d = d || {}, this.each(function () { var t, e, i, n, o, r, a, s, l, c = h.data(this, "switchbutton"); c ? h.extend(c.options, d) : c = h.data(this, "switchbutton", { options: h.extend({}, h.fn.switchbutton.defaults, h.fn.switchbutton.parseOptions(this), d), switchbutton: function (i) { var t = h('<span class="switchbutton"><span class="switchbutton-inner"><span class="switchbutton-on"></span><span class="switchbutton-handle"></span><span class="switchbutton-off"></span><input class="switchbutton-value" type="checkbox" tabindex="-1"></span></span>').insertAfter(i), e = h(i); e.addClass("switchbutton-f").hide(); var n = e.attr("name"); return n && (e.removeAttr("name").attr("switchbuttonName", n), t.find(".switchbutton-value").attr("name", n)), t._bind("_resize", function (t, e) { return (h(this).hasClass("easyui-fluid") || e) && f(i), !1 }), t }(this) }), c.options.originalChecked = c.options.checked, t = this, e = h.data(t, "switchbutton"), s = e.options, i = e.switchbutton, n = i.find(".switchbutton-inner"), o = n.find(".switchbutton-on").html(s.onText), r = n.find(".switchbutton-off").html(s.offText), c = n.find(".switchbutton-handle").html(s.handleText), s.reversed ? (r.prependTo(n), o.insertAfter(c)) : (o.prependTo(n), r.insertAfter(c)), c = "_easyui_switchbutton_" + ++u, i.find(".switchbutton-value")._propAttr("checked", s.checked).attr("id", c)._unbind(".switchbutton")._bind("change.switchbutton", function (t) { return !1 }), i.removeClass("switchbutton-reversed").addClass(s.reversed ? "switchbutton-reversed" : ""), s.label ? "object" == typeof s.label ? (e.label = h(s.label), e.label.attr("for", c)) : (h(e.label).remove(), e.label = h('<label class="textbox-label"></label>').html(s.label), e.label.css("textAlign", s.labelAlign).attr("for", c), "after" == s.labelPosition ? e.label.insertAfter(i) : e.label.insertBefore(t), e.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"), e.label.addClass("textbox-label-" + s.labelPosition)) : h(e.label).remove(), p(t, s.checked), b(t, s.readonly), g(t, s.disabled), h(t).switchbutton("setValue", s.value), f(this), a = this, s = h.data(a, "switchbutton"), l = s.options, s.switchbutton._unbind(".switchbutton")._bind("click.switchbutton", function () { l.disabled || l.readonly || p(a, !l.checked, !0) })._bind("keydown.switchbutton", function (t) { if (!(13 != t.which && 32 != t.which || l.disabled || l.readonly)) return p(a, !l.checked, !0), !1 }) })) }, h.fn.switchbutton.methods = { options: function (t) { t = t.data("switchbutton"); return h.extend(t.options, { value: t.switchbutton.find(".switchbutton-value").val() }) }, resize: function (t, e) { return t.each(function () { f(this, e) }) }, enable: function (t) { return t.each(function () { g(this, !1) }) }, disable: function (t) { return t.each(function () { g(this, !0) }) }, readonly: function (t, e) { return t.each(function () { b(this, e) }) }, check: function (t) { return t.each(function () { p(this, !0) }) }, uncheck: function (t) { return t.each(function () { p(this, !1) }) }, clear: function (t) { return t.each(function () { p(this, !1) }) }, reset: function (t) { return t.each(function () { p(this, h(this).switchbutton("options").originalChecked) }) }, setValue: function (t, e) { return t.each(function () { h(this).val(e), h.data(this, "switchbutton").switchbutton.find(".switchbutton-value").val(e) }) } }, h.fn.switchbutton.parseOptions = function (t) { var e = h(t); return h.extend({}, h.parser.parseOptions(t, ["onText", "offText", "handleText", { handleWidth: "number", reversed: "boolean" }, "label", "labelPosition", "labelAlign", { labelWidth: "number" }]), { value: e.val() || void 0, checked: !!e.attr("checked") || void 0, disabled: !!e.attr("disabled") || void 0, readonly: !!e.attr("readonly") || void 0 }) }, h.fn.switchbutton.defaults = { handleWidth: "auto", width: 60, height: 30, checked: !1, disabled: !1, readonly: !1, reversed: !1, onText: "ON", offText: "OFF", handleText: "", value: "on", label: null, labelWidth: "auto", labelPosition: "before", labelAlign: "left", onChange: function (t) { } } }(jQuery), function (l) { var c = 1; function d(t, e) { var i; function n(t, e) { var i = l(t).data("radiobutton"), n = i.options, o = i.radiobutton; o.find(".radiobutton-inner").css("display", e ? "" : "none"), o.find(".radiobutton-value")._propAttr("checked", e), e ? (o.addClass("radiobutton-checked"), l(i.label).addClass("textbox-label-checked")) : (o.removeClass("radiobutton-checked"), l(i.label).removeClass("textbox-label-checked")), n.checked != e && (n.checked = e, n.onChange.call(l(t)[0], e), l(t).closest("form").trigger("_change", [l(t)[0]])) } e ? (i = l(t).closest("form"), e = l(t).attr("radiobuttonName"), i.find('.radiobutton-f[radiobuttonName="' + e + '"]').each(function () { this != t && n(this, !1) }), n(t, !0)) : n(t, !1) } function h(t, e) { var i = l.data(t, "radiobutton"), n = i.options, o = i.radiobutton, r = o.find(".radiobutton-value"); (n.disabled = e) ? (l(t).add(r)._propAttr("disabled", !0), o.addClass("radiobutton-disabled"), l(i.label).addClass("textbox-label-disabled")) : (l(t).add(r)._propAttr("disabled", !1), o.removeClass("radiobutton-disabled"), l(i.label).removeClass("textbox-label-disabled")) } function u(t, e) { var i = l.data(t, "radiobutton"), t = i.options; t.readonly = null == e || e, t.readonly ? (i.radiobutton.addClass("radiobutton-readonly"), l(i.label).addClass("textbox-label-readonly")) : (i.radiobutton.removeClass("radiobutton-readonly"), l(i.label).removeClass("textbox-label-readonly")) } l.fn.radiobutton = function (s, t) { return "string" == typeof s ? l.fn.radiobutton.methods[s](this, t) : (s = s || {}, this.each(function () { var t, e, i, n, o, r, a = l.data(this, "radiobutton"); a ? l.extend(a.options, s) : a = l.data(this, "radiobutton", { options: l.extend({}, l.fn.radiobutton.defaults, l.fn.radiobutton.parseOptions(this), s), radiobutton: (o = this, t = l('<span class="radiobutton inputbox"><span class="radiobutton-inner" style="display:none"></span><input type="radio" class="radiobutton-value"></span>').insertAfter(o), (r = l(o)).addClass("radiobutton-f").hide(), (o = r.attr("name")) && (r.removeAttr("name").attr("radiobuttonName", o), t.find(".radiobutton-value").attr("name", o)), t) }), a.options.originalChecked = a.options.checked, n = this, r = l.data(n, "radiobutton"), o = r.options, t = r.radiobutton, a = "_easyui_radiobutton_" + ++c, t.find(".radiobutton-value").attr("id", a)._unbind(".radiobutton")._bind("change.radiobutton", function (t) { return !1 }), o.label ? "object" == typeof o.label ? (r.label = l(o.label), r.label.attr("for", a)) : (l(r.label).remove(), r.label = l('<label class="textbox-label"></label>').html(o.label), r.label.css("textAlign", o.labelAlign).attr("for", a), "after" == o.labelPosition ? r.label.insertAfter(t) : r.label.insertBefore(n), r.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"), r.label.addClass("textbox-label-" + o.labelPosition)) : l(r.label).remove(), l(n).radiobutton("setValue", o.value), d(n, o.checked), u(n, o.readonly), h(n, o.disabled), e = this, r = l.data(e, "radiobutton"), i = r.options, r.radiobutton._unbind(".radiobutton")._bind("click.radiobutton", function () { i.disabled || i.readonly || d(e, !0) }), n = this, o = l.data(n, "radiobutton"), r = o.options, (n = o.radiobutton)._size(r, n.parent()), r.label && r.labelPosition && ("top" == r.labelPosition ? o.label._size({ width: r.labelWidth }, n) : (o.label._size({ width: r.labelWidth, height: n.outerHeight() }, n), o.label.css("lineHeight", n.outerHeight() + "px"))) })) }, l.fn.radiobutton.methods = { options: function (t) { t = t.data("radiobutton"); return l.extend(t.options, { value: t.radiobutton.find(".radiobutton-value").val() }) }, setValue: function (t, e) { return t.each(function () { l(this).val(e), l.data(this, "radiobutton").radiobutton.find(".radiobutton-value").val(e) }) }, enable: function (t) { return t.each(function () { h(this, !1) }) }, disable: function (t) { return t.each(function () { h(this, !0) }) }, readonly: function (t, e) { return t.each(function () { u(this, e) }) }, check: function (t) { return t.each(function () { d(this, !0) }) }, uncheck: function (t) { return t.each(function () { d(this, !1) }) }, clear: function (t) { return t.each(function () { d(this, !1) }) }, reset: function (t) { return t.each(function () { d(this, l(this).radiobutton("options").originalChecked) }) } }, l.fn.radiobutton.parseOptions = function (t) { var e = l(t); return l.extend({}, l.parser.parseOptions(t, ["label", "labelPosition", "labelAlign", { labelWidth: "number" }]), { value: e.val() || void 0, checked: !!e.attr("checked") || void 0, disabled: !!e.attr("disabled") || void 0, readonly: !!e.attr("readonly") || void 0 }) }, l.fn.radiobutton.defaults = { width: 20, height: 20, value: null, disabled: !1, readonly: !1, checked: !1, label: null, labelWidth: "auto", labelPosition: "before", labelAlign: "left", onChange: function (t) { } } }(jQuery), function (l) { var c = 1; function d(t, e) { var i = l.data(t, "checkbox"), n = i.options, o = i.checkbox; o.find(".checkbox-value")._propAttr("checked", e); o.find(".checkbox-inner").css("display", e ? "" : "none"); e ? (o.addClass("checkbox-checked"), l(i.label).addClass("textbox-label-checked")) : (o.removeClass("checkbox-checked"), l(i.label).removeClass("textbox-label-checked")), n.checked != e && (n.checked = e, n.onChange.call(t, e), l(t).closest("form").trigger("_change", [t])) } function h(t, e) { var i = l.data(t, "checkbox"), t = i.options; t.readonly = null == e || e, t.readonly ? (i.checkbox.addClass("checkbox-readonly"), l(i.label).addClass("textbox-label-readonly")) : (i.checkbox.removeClass("checkbox-readonly"), l(i.label).removeClass("textbox-label-readonly")) } function u(t, e) { var i = l.data(t, "checkbox"), n = i.options, o = i.checkbox, r = o.find(".checkbox-value"); (n.disabled = e) ? (l(t).add(r)._propAttr("disabled", !0), o.addClass("checkbox-disabled"), l(i.label).addClass("textbox-label-disabled")) : (l(t).add(r)._propAttr("disabled", !1), o.removeClass("checkbox-disabled"), l(i.label).removeClass("textbox-label-disabled")) } l.fn.checkbox = function (s, t) { return "string" == typeof s ? l.fn.checkbox.methods[s](this, t) : (s = s || {}, this.each(function () { var t, e, i, n, o, r, a = l.data(this, "checkbox"); a ? l.extend(a.options, s) : a = l.data(this, "checkbox", { options: l.extend({}, l.fn.checkbox.defaults, l.fn.checkbox.parseOptions(this), s), checkbox: (o = this, t = l('<span class="checkbox inputbox"><span class="checkbox-inner"><svg xml:space="preserve" focusable="false" version="1.1" viewBox="0 0 24 24"><path d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"></path></svg></span><input type="checkbox" class="checkbox-value"></span>').insertAfter(o), (r = l(o)).addClass("checkbox-f").hide(), (o = r.attr("name")) && (r.removeAttr("name").attr("checkboxName", o), t.find(".checkbox-value").attr("name", o)), t) }), a.options.originalChecked = a.options.checked, n = this, r = l.data(n, "checkbox"), o = r.options, t = r.checkbox, a = "_easyui_checkbox_" + ++c, t.find(".checkbox-value").attr("id", a)._unbind(".checkbox")._bind("change.checkbox", function (t) { return !1 }), o.label ? "object" == typeof o.label ? (r.label = l(o.label), r.label.attr("for", a)) : (l(r.label).remove(), r.label = l('<label class="textbox-label"></label>').html(o.label), r.label.css("textAlign", o.labelAlign).attr("for", a), "after" == o.labelPosition ? r.label.insertAfter(t) : r.label.insertBefore(n), r.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"), r.label.addClass("textbox-label-" + o.labelPosition)) : l(r.label).remove(), l(n).checkbox("setValue", o.value), d(n, o.checked), h(n, o.readonly), u(n, o.disabled), e = this, r = l.data(e, "checkbox"), i = r.options, r.checkbox._unbind(".checkbox")._bind("click.checkbox", function () { i.disabled || i.readonly || d(e, !i.checked) }), n = this, o = l.data(n, "checkbox"), r = o.options, (n = o.checkbox)._size(r, n.parent()), r.label && r.labelPosition && ("top" == r.labelPosition ? o.label._size({ width: r.labelWidth }, n) : (o.label._size({ width: r.labelWidth, height: n.outerHeight() }, n), o.label.css("lineHeight", n.outerHeight() + "px"))) })) }, l.fn.checkbox.methods = { options: function (t) { t = t.data("checkbox"); return l.extend(t.options, { value: t.checkbox.find(".checkbox-value").val() }) }, setValue: function (t, e) { return t.each(function () { l(this).val(e), l.data(this, "checkbox").checkbox.find(".checkbox-value").val(e) }) }, enable: function (t) { return t.each(function () { u(this, !1) }) }, disable: function (t) { return t.each(function () { u(this, !0) }) }, readonly: function (t, e) { return t.each(function () { h(this, e) }) }, check: function (t) { return t.each(function () { d(this, !0) }) }, uncheck: function (t) { return t.each(function () { d(this, !1) }) }, clear: function (t) { return t.each(function () { d(this, !1) }) }, reset: function (t) { return t.each(function () { d(this, l(this).checkbox("options").originalChecked) }) } }, l.fn.checkbox.parseOptions = function (t) { var e = l(t); return l.extend({}, l.parser.parseOptions(t, ["label", "labelPosition", "labelAlign", { labelWidth: "number" }]), { value: e.val() || void 0, checked: !!e.attr("checked") || void 0, disabled: !!e.attr("disabled") || void 0, readonly: !!e.attr("readonly") || void 0 }) }, l.fn.checkbox.defaults = { width: 20, height: 20, value: null, disabled: !1, readonly: !1, checked: !1, label: null, labelWidth: "auto", labelPosition: "before", labelAlign: "left", onChange: function (t) { } } }(jQuery), function ($) { function init(t) { $(t).addClass("validatebox-text") } function _547(t) { var e = $.data(t, "validatebox"); e.validating = !1, e.vtimer && clearTimeout(e.vtimer), e.ftimer && clearTimeout(e.ftimer), $(t).tooltip("destroy"), $(t)._unbind(), $(t).remove() } function _54a(t) { var e = $.data(t, "validatebox").options; if ($(t)._unbind(".validatebox"), !e.novalidate && !e.disabled) for (var i in e.events) $(t)._bind(i + ".validatebox", { target: t }, e.events[i]) } function _54d(t) { var e = t.data.target, i = $.data(e, "validatebox"), n = i.options; $(e).attr("readonly") || (i.validating = !0, i.value = n.val(e), function () { var t; $(e).is(":visible") || (i.validating = !1), i.validating && (t = n.val(e), i.value != t ? (i.value = t, i.vtimer && clearTimeout(i.vtimer), i.vtimer = setTimeout(function () { $(e).validatebox("validate") }, n.delay)) : i.message && n.err(e, i.message), i.ftimer = setTimeout(arguments.callee, n.interval)) }()) } function _551(t) { var e = t.data.target, i = $.data(e, "validatebox"), t = i.options; i.validating = !1, i.vtimer && (clearTimeout(i.vtimer), i.vtimer = void 0), i.ftimer && (clearTimeout(i.ftimer), i.ftimer = void 0), t.validateOnBlur && setTimeout(function () { $(e).validatebox("validate") }, 0), t.err(e, i.message, "hide") } function _554(t) { var e = t.data.target, t = $.data(e, "validatebox"); t.options.err(e, t.message, "show") } function _557(t) { var e = t.data.target, t = $.data(e, "validatebox"); t.validating || t.options.err(e, t.message, "hide") } function _55a(t, e, i) { var n = $.data(t, "validatebox"), o = n.options, t = $(t); "hide" != i && e ? (t.is(":focus") && n.validating || "show" == i) && t.tooltip($.extend({}, o.tipOptions, { content: e, position: o.tipPosition, deltaX: o.deltaX, deltaY: o.deltaY })).tooltip("show") : t.tooltip("hide") } function _55f(_560) { var _561 = $.data(_560, "validatebox"), opts = _561.options, box = $(_560); opts.onBeforeValidate.call(_560); var _562 = _563(); return _562 ? box.removeClass("validatebox-invalid") : box.addClass("validatebox-invalid"), opts.err(_560, _561.message), opts.onValidate.call(_560, _562), _562; function _564(t) { _561.message = t } function _565(_566, _567) { var _568 = opts.val(_560), _569 = /([a-zA-Z_]+)(.*)/.exec(_566), rule = opts.rules[_569[1]]; if (rule && _568) { var _56a = _567 || opts.validParams || eval(_569[2]); if (!rule.validator.call(_560, _568, _56a)) { var _56b = rule.message; if (_56a) for (var i = 0; i < _56a.length; i++)_56b = _56b.replace(new RegExp("\\{" + i + "\\}", "g"), _56a[i]); return void _564(opts.invalidMessage || _56b) } } return 1 } function _563() { if (_564(""), !opts._validateOnCreate) return setTimeout(function () { opts._validateOnCreate = !0 }, 0), !0; if (opts.novalidate || opts.disabled) return !0; if (opts.required && "" == opts.val(_560)) return _564(opts.missingMessage), !1; if (opts.validType) if ($.isArray(opts.validType)) { for (var t = 0; t < opts.validType.length; t++)if (!_565(opts.validType[t])) return !1 } else if ("string" == typeof opts.validType) { if (!_565(opts.validType)) return !1 } else for (var e in opts.validType) if (!_565(e, opts.validType[e])) return !1; return !0 } } function _56e(t, e) { var i = $.data(t, "validatebox").options; null != e && (i.disabled = e), i.disabled ? $(t).addClass("validatebox-disabled")._propAttr("disabled", !0) : $(t).removeClass("validatebox-disabled")._propAttr("disabled", !1) } function _571(t, e) { var i = $.data(t, "validatebox").options; i.readonly = null == e || e, i.readonly || !i.editable ? ($(t).triggerHandler("blur.validatebox"), $(t).addClass("validatebox-readonly")._propAttr("readonly", !0)) : $(t).removeClass("validatebox-readonly")._propAttr("readonly", !1) } $.fn.validatebox = function (e, t) { return "string" == typeof e ? $.fn.validatebox.methods[e](this, t) : (e = e || {}, this.each(function () { var t = $.data(this, "validatebox"); t ? $.extend(t.options, e) : (init(this), t = $.data(this, "validatebox", { options: $.extend({}, $.fn.validatebox.defaults, $.fn.validatebox.parseOptions(this), e) })), t.options._validateOnCreate = t.options.validateOnCreate, _56e(this, t.options.disabled), _571(this, t.options.readonly), _54a(this), _55f(this) })) }, $.fn.validatebox.methods = { options: function (t) { return $.data(t[0], "validatebox").options }, destroy: function (t) { return t.each(function () { _547(this) }) }, validate: function (t) { return t.each(function () { _55f(this) }) }, isValid: function (t) { return _55f(t[0]) }, enableValidation: function (t) { return t.each(function () { $(this).validatebox("options").novalidate = !1, _54a(this), _55f(this) }) }, disableValidation: function (t) { return t.each(function () { $(this).validatebox("options").novalidate = !0, _54a(this), _55f(this) }) }, resetValidation: function (t) { return t.each(function () { var t = $(this).validatebox("options"); t._validateOnCreate = t.validateOnCreate, _55f(this) }) }, enable: function (t) { return t.each(function () { _56e(this, !1), _54a(this), _55f(this) }) }, disable: function (t) { return t.each(function () { _56e(this, !0), _54a(this), _55f(this) }) }, readonly: function (t, e) { return t.each(function () { _571(this, e), _54a(this), _55f(this) }) } }, $.fn.validatebox.parseOptions = function (t) { var e = $(t); return $.extend({}, $.parser.parseOptions(t, ["validType", "missingMessage", "invalidMessage", "tipPosition", { delay: "number", interval: "number", deltaX: "number" }, { editable: "boolean", validateOnCreate: "boolean", validateOnBlur: "boolean" }]), { required: !!e.attr("required") || void 0, disabled: !!e.attr("disabled") || void 0, readonly: !!e.attr("readonly") || void 0, novalidate: null != e.attr("novalidate") || void 0 }) }, $.fn.validatebox.defaults = { required: !1, validType: null, validParams: null, delay: 200, interval: 200, missingMessage: "This field is required.", invalidMessage: null, tipPosition: "right", deltaX: 0, deltaY: 0, novalidate: !1, editable: !0, disabled: !1, readonly: !1, validateOnCreate: !0, validateOnBlur: !1, events: { focus: _54d, blur: _551, mouseenter: _554, mouseleave: _557, click: function (t) { t = $(t.data.target); "checkbox" != t.attr("type") && "radio" != t.attr("type") || t.focus().validatebox("validate") } }, val: function (t) { return $(t).val() }, err: function (t, e, i) { _55a(t, e, i) }, tipOptions: { showEvent: "none", hideEvent: "none", showDelay: 0, hideDelay: 0, zIndex: "", onShow: function () { $(this).tooltip("tip").css({ color: "#000", borderColor: "#CC9933", backgroundColor: "#FFFFCC" }) }, onHide: function () { $(this).tooltip("destroy") } }, rules: { email: { validator: function (t) { return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(t) }, message: "Please enter a valid email address." }, url: { validator: function (t) { return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t) }, message: "Please enter a valid URL." }, length: { validator: function (t, e) { t = $.trim(t).length; return t >= e[0] && t <= e[1] }, message: "Please enter a value between {0} and {1}." }, remote: { validator: function (t, e) { var i = {}; return i[e[1]] = t, "true" == $.ajax({ url: e[0], dataType: "json", data: i, async: !1, cache: !1, type: "post" }).responseText }, message: "Please fix this field." } }, onBeforeValidate: function () { }, onValidate: function (t) { } } }(jQuery), function (u) { var l = 0; function a(t, e) { var i = u.data(t, "textbox"), n = i.options, o = i.textbox, r = o.parent(); e && ("object" == typeof e ? u.extend(n, e) : n.width = e), isNaN(parseInt(n.width)) && ((c = u(t).clone()).css("visibility", "hidden"), c.insertAfter(t), n.width = c.outerWidth(), c.remove()); var a = o.is(":visible"); a || o.appendTo("body"); var e = o.find(".textbox-text"), s = o.find(".textbox-button"), l = o.find(".textbox-addon"), c = l.find(".textbox-icon"); "auto" == n.height && e.css({ margin: "", paddingTop: "", paddingBottom: "", height: "", lineHeight: "" }), o._size(n, r), n.label && n.labelPosition && ("top" == n.labelPosition ? (i.label._size({ width: "auto" == n.labelWidth ? o.outerWidth() : n.labelWidth }, o), "auto" != n.height && o._size("height", o.outerHeight() - i.label.outerHeight())) : (i.label._size({ width: n.labelWidth, height: o.outerHeight() }, o), n.multiline || i.label.css("lineHeight", i.label.height() + "px"), o._size("width", o.outerWidth() - i.label.outerWidth()))), "left" == n.buttonAlign || "right" == n.buttonAlign ? s.linkbutton("resize", { height: o.height() }) : s.linkbutton("resize", { width: "100%" }); r = o.width() - c.length * n.iconWidth - h("left") - h("right"), i = "auto" == n.height ? e.outerHeight() : o.height() - h("top") - h("bottom"); function d(t) { return (n.iconAlign == t ? l._outerWidth() : 0) + h(t) } function h(t) { var e = 0; return s.filter(".textbox-button-" + t).each(function () { e += "left" == t || "right" == t ? u(this).outerWidth() : u(this).outerHeight() }), e } l.css(n.iconAlign, h(n.iconAlign) + "px"), l.css("top", h("top") + "px"), c.css({ width: n.iconWidth + "px", height: i + "px" }), e.css({ paddingLeft: t.style.paddingLeft || "", paddingRight: t.style.paddingRight || "", marginLeft: d("left"), marginRight: d("right"), marginTop: h("top"), marginBottom: h("bottom") }), n.multiline ? (e.css({ paddingTop: t.style.paddingTop || "", paddingBottom: t.style.paddingBottom || "" }), e._outerHeight(i)) : e.css({ paddingTop: 0, paddingBottom: 0, height: i + "px", lineHeight: i + "px" }), e._outerWidth(r), n.onResizing.call(t, n.width, n.height), a || o.insertAfter(t), n.onResize.call(t, n.width, n.height) } function c(i) { var n = u(i).textbox("options"); u(i).textbox("textbox").validatebox(u.extend({}, n, { deltaX: function (t) { return u(i).textbox("getTipX", t) }, deltaY: function (t) { return u(i).textbox("getTipY", t) }, onBeforeValidate: function () { n.onBeforeValidate.call(i); var t = u(this); t.is(":focus") || t.val() !== n.value && (n.oldInputValue = t.val(), t.val(n.value)) }, onValidate: function (t) { var e = u(this); null != n.oldInputValue && (e.val(n.oldInputValue), n.oldInputValue = void 0); e = e.parent(); t ? e.removeClass("textbox-invalid") : e.addClass("textbox-invalid"), n.onValidate.call(i, t) } })) } function s(o) { var t = u.data(o, "textbox"), r = t.options, e = t.textbox, i = e.find(".textbox-text"); if (i.attr("placeholder", r.prompt), i._unbind(".textbox"), u(t.label)._unbind(".textbox"), !r.disabled && !r.readonly) for (var n in t.label && u(t.label)._bind("click.textbox", function (t) { r.hasFocusMe || (i.focus(), u(o).textbox("setSelectionRange", { start: 0, end: i.val().length })) }), i._bind("blur.textbox", function (t) { e.hasClass("textbox-focused") && (r.value = u(this).val(), "" == r.value ? u(this).val(r.prompt).addClass("textbox-prompt") : u(this).removeClass("textbox-prompt"), e.removeClass("textbox-focused"), e.closest(".form-field").removeClass("form-field-focused")) })._bind("focus.textbox", function (t) { r.hasFocusMe = !0, e.hasClass("textbox-focused") || (u(this).val() != r.value && u(this).val(r.value), u(this).removeClass("textbox-prompt"), e.addClass("textbox-focused"), e.closest(".form-field").addClass("form-field-focused")) }), r.inputEvents) i._bind(n + ".textbox", { target: o }, r.inputEvents[n]); t = e.find(".textbox-addon"); t._unbind()._bind("click", { target: o }, function (t) { var e, i, n = u(t.target).closest("a.textbox-icon:not(.textbox-icon-disabled)"); n.length && (e = parseInt(n.attr("icon-index")), (i = r.icons[e]) && i.handler && i.handler.call(n[0], t), r.onClickIcon.call(o, e)) }), t.find(".textbox-icon").each(function (t) { var e = r.icons[t], t = u(this); !e || e.disabled || r.disabled || r.readonly ? t.addClass("textbox-icon-disabled") : t.removeClass("textbox-icon-disabled") }), e.find(".textbox-button").linkbutton(r.disabled || r.readonly ? "disable" : "enable"), e._unbind(".textbox")._bind("_resize.textbox", function (t, e) { return (u(this).hasClass("easyui-fluid") || e) && a(o), !1 }) } function d(t, e) { var i = u.data(t, "textbox"), n = i.options, o = i.textbox, r = o.find(".textbox-text"), t = u(t).add(o.find(".textbox-value")); n.disabled = e, n.disabled ? (r.blur(), r.validatebox("disable"), o.addClass("textbox-disabled"), t._propAttr("disabled", !0), u(i.label).addClass("textbox-label-disabled")) : (r.validatebox("enable"), o.removeClass("textbox-disabled"), t._propAttr("disabled", !1), u(i.label).removeClass("textbox-label-disabled")) } function h(t, e) { var i = u.data(t, "textbox"), n = i.options, o = i.textbox, t = o.find(".textbox-text"); n.readonly = null == e || e, n.readonly && t.triggerHandler("blur.textbox"), t.validatebox("readonly", n.readonly), n.readonly ? (o.addClass("textbox-readonly"), u(i.label).addClass("textbox-label-readonly")) : (o.removeClass("textbox-readonly"), u(i.label).removeClass("textbox-label-readonly")) } u.fn.textbox = function (i, t) { if ("string" != typeof i) return i = i || {}, this.each(function () { var t = u.data(this, "textbox"); t ? (u.extend(t.options, i), null != i.value && (t.options.originalValue = i.value)) : (t = u.data(this, "textbox", { options: u.extend({}, u.fn.textbox.defaults, u.fn.textbox.parseOptions(this), i), textbox: function (t) { u(t).addClass("textbox-f").hide(); var e = u('<span class="textbox"><input class="textbox-text" autocomplete="off"><input type="hidden" class="textbox-value"></span>').insertAfter(t), i = u(t).attr("name"); return i && (e.find("input.textbox-value").attr("name", i), u(t).removeAttr("name").attr("textboxName", i)), e }(this) })).options.originalValue = t.options.value, function (t) { var e = u.data(t, "textbox"), i = e.options, n = e.textbox, o = "_easyui_textbox_input" + ++l; n.addClass(i.cls), n.find(".textbox-text").remove(), (i.multiline ? u('<textarea id="' + o + '" class="textbox-text" autocomplete="off"></textarea>') : u('<input id="' + o + '" type="' + i.type + '" class="textbox-text" autocomplete="off">')).prependTo(n), u("#" + o).attr("tabindex", u(t).attr("tabindex") || "").css("text-align", t.style.textAlign || ""), n.find(".textbox-addon").remove(); var r = i.icons ? u.extend(!0, [], i.icons) : []; if (i.iconCls && r.push({ iconCls: i.iconCls, disabled: !0 }), r.length) { var a = u('<span class="textbox-addon"></span>').prependTo(n); a.addClass("textbox-addon-" + i.iconAlign); for (var s = 0; s < r.length; s++)a.append('<a href="javascript:;" class="textbox-icon ' + r[s].iconCls + '" icon-index="' + s + '" tabindex="-1"></a>') } n.find(".textbox-button").remove(), (i.buttonText || i.buttonIcon) && u('<a href="javascript:;" class="textbox-button"></a>').prependTo(n).addClass("textbox-button-" + i.buttonAlign).linkbutton({ text: i.buttonText, iconCls: i.buttonIcon, onClick: function () { var t = u(this).parent().prev(); t.textbox("options").onClickButton.call(t[0]) } }), i.label ? "object" == typeof i.label ? (e.label = u(i.label), e.label.attr("for", o)) : (u(e.label).remove(), e.label = u('<label class="textbox-label"></label>').html(i.label), e.label.css("textAlign", i.labelAlign).attr("for", o), "after" == i.labelPosition ? e.label.insertAfter(n) : e.label.insertBefore(t), e.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"), e.label.addClass("textbox-label-" + i.labelPosition)) : u(e.label).remove(), c(t), d(t, i.disabled), h(t, i.readonly) }(this), s(this), t.options.doSize && a(this); var e = t.options.value; t.options.value = "", u(this).textbox("initValue", e) }); var e = u.fn.textbox.methods[i]; return e ? e(this, t) : this.each(function () { u(this).textbox("textbox").validatebox(i, t) }) }, u.fn.textbox.methods = { options: function (t) { return u.data(t[0], "textbox").options }, cloneFrom: function (t, r) { return t.each(function () { var t, e, i, n, o = u(this); o.data("textbox") || (u(r).data("textbox") || u(r).textbox(), t = u.extend(!0, {}, u(r).textbox("options")), n = o.attr("name") || "", o.addClass("textbox-f").hide(), o.removeAttr("name").attr("textboxName", n), e = u(r).next().clone().insertAfter(o), i = "_easyui_textbox_input" + ++l, e.find(".textbox-value").attr("name", n), e.find(".textbox-text").attr("id", i), (n = u(u(r).textbox("label")).clone()).length && (n.attr("for", i), "after" == t.labelPosition ? n.insertAfter(o.next()) : n.insertBefore(o)), u.data(this, "textbox", { options: t, textbox: e, label: n.length ? n : void 0 }), (n = u(r).textbox("button")).length && o.textbox("button").linkbutton(u.extend(!0, {}, n.linkbutton("options"))), s(this), c(this)) }) }, textbox: function (t) { return u.data(t[0], "textbox").textbox.find(".textbox-text") }, button: function (t) { return u.data(t[0], "textbox").textbox.find(".textbox-button") }, label: function (t) { return u.data(t[0], "textbox").label }, destroy: function (t) { return t.each(function () { var t, e, i; t = this, e = u.data(t, "textbox"), (i = e.textbox).find(".textbox-text").validatebox("destroy"), i.remove(), u(e.label).remove(), u(t).remove() }) }, resize: function (t, e) { return t.each(function () { a(this, e) }) }, disable: function (t) { return t.each(function () { d(this, !0), s(this) }) }, enable: function (t) { return t.each(function () { d(this, !1), s(this) }) }, readonly: function (t, e) { return t.each(function () { h(this, e), s(this) }) }, isValid: function (t) { return t.textbox("textbox").validatebox("isValid") }, clear: function (t) { return t.each(function () { u(this).textbox("setValue", "") }) }, setText: function (t, i) { return t.each(function () { var t = u(this).textbox("options"), e = u(this).textbox("textbox"); i = null == i ? "" : String(i), u(this).textbox("getText") != i && e.val(i), t.value = i, e.is(":focus") || (i ? e.removeClass("textbox-prompt") : e.val(t.prompt).addClass("textbox-prompt")), t.value ? u(this).closest(".form-field").removeClass("form-field-empty") : u(this).closest(".form-field").addClass("form-field-empty"), u(this).textbox("validate") }) }, initValue: function (t, e) { return t.each(function () { var t = u.data(this, "textbox"); u(this).textbox("setText", e), t.textbox.find(".textbox-value").val(e), u(this).val(e) }) }, setValue: function (t, i) { return t.each(function () { var t = u.data(this, "textbox").options, e = u(this).textbox("getValue"); u(this).textbox("initValue", i), e != i && (t.onChange.call(this, i, e), u(this).closest("form").trigger("_change", [this])) }) }, getText: function (t) { var e = t.textbox("textbox"); return e.is(":focus") ? e.val() : t.textbox("options").value }, getValue: function (t) { return t.data("textbox").textbox.find(".textbox-value").val() }, reset: function (t) { return t.each(function () { var t = u(this).textbox("options"); u(this).textbox("textbox").val(t.originalValue), u(this).textbox("setValue", t.originalValue) }) }, getIcon: function (t, e) { return t.data("textbox").textbox.find(".textbox-icon:eq(" + e + ")") }, getTipX: function (t, e) { var i = t.data("textbox"), n = i.options, o = i.textbox, t = o.find(".textbox-text"), e = e || n.tipPosition, i = o.offset(), n = t.offset(), o = o.outerWidth(), t = t.outerWidth(); return "right" == e ? o - t - n.left + i.left : "left" == e ? i.left - n.left : (o - t - n.left + i.left) / 2 - (n.left - i.left) / 2 }, getTipY: function (t, e) { var i = t.data("textbox"), n = i.options, o = i.textbox, t = o.find(".textbox-text"), e = e || n.tipPosition, i = o.offset(), n = t.offset(), o = o.outerHeight(), t = t.outerHeight(); return "left" == e || "right" == e ? (o - t - n.top + i.top) / 2 - (n.top - i.top) / 2 : "bottom" == e ? o - t - n.top + i.top : i.top - n.top }, getSelectionStart: function (t) { return t.textbox("getSelectionRange").start }, getSelectionRange: function (t) { var e = t.textbox("textbox")[0], i = 0, n = 0; return "number" == typeof e.selectionStart ? (i = e.selectionStart, n = e.selectionEnd) : e.createTextRange && (t = document.selection.createRange(), (e = e.createTextRange()).setEndPoint("EndToStart", t), n = (i = e.text.length) + t.text.length), { start: i, end: n } }, setSelectionRange: function (t, n) { return t.each(function () { var t = u(this).textbox("textbox")[0], e = n.start, i = n.end; t.setSelectionRange ? t.setSelectionRange(e, i) : t.createTextRange && ((t = t.createTextRange()).collapse(), t.moveEnd("character", i), t.moveStart("character", e), t.select()) }) } }, u.fn.textbox.parseOptions = function (t) { var e = u(t); return u.extend({}, u.fn.validatebox.parseOptions(t), u.parser.parseOptions(t, ["prompt", "iconCls", "iconAlign", "buttonText", "buttonIcon", "buttonAlign", "label", "labelPosition", "labelAlign", { multiline: "boolean", iconWidth: "number", labelWidth: "number" }]), { value: e.val() || void 0, type: e.attr("type") ? e.attr("type") : void 0 }) }, u.fn.textbox.defaults = u.extend({}, u.fn.validatebox.defaults, { doSize: !0, width: "auto", height: "auto", cls: null, prompt: "", value: "", type: "text", multiline: !1, icons: [], iconCls: null, iconAlign: "right", iconWidth: 26, buttonText: "", buttonIcon: null, buttonAlign: "right", label: null, labelWidth: "auto", labelPosition: "before", labelAlign: "left", inputEvents: { blur: function (t) { var e = u(t.data.target), t = e.textbox("options"); e.textbox("getValue") != t.value && e.textbox("setValue", t.value) }, keydown: function (t) { 13 == t.keyCode && (t = u(t.data.target)).textbox("setValue", t.textbox("getText")) } }, onChange: function (t, e) { }, onResizing: function (t, e) { }, onResize: function (t, e) { }, onClickButton: function () { }, onClickIcon: function (t) { } }) }(jQuery), function (h) { function r(t, e, i) { var n = h(t).data("passwordbox"), o = h(t), t = o.passwordbox("options"); if (t.revealed) o.textbox("setValue", e); else { n.converting = !0; for (var r = unescape(t.passwordChar), a = e.split(""), s = o.passwordbox("getValue").split(""), l = 0; l < a.length; l++){ var c = a[l]; c != s[l] && c != r && s.splice(l, 0, c) } var d = o.passwordbox("getSelectionStart"); a.length < s.length && s.splice(d, s.length - a.length, ""); for (l = 0; l < a.length; l++)!i && l == d - 1 || (a[l] = r); o.textbox("setValue", s.join("")), o.textbox("setText", a.join("")), o.textbox("setSelectionRange", { start: d, end: d }), setTimeout(function () { n.converting = !1 }, 0) } } function o(t, e) { var i = h(t), n = i.passwordbox("options"), o = i.next().find(".passwordbox-open"), t = unescape(n.passwordChar); e = null == e ? i.textbox("getValue") : e, i.textbox("setValue", e), i.textbox("setText", n.revealed ? e : e.replace(/./gi, t)), n.revealed ? o.addClass("passwordbox-close") : o.removeClass("passwordbox-close") } h.fn.passwordbox = function (n, t) { if ("string" != typeof n) return n = n || {}, this.each(function () { var e, i, t = h.data(this, "passwordbox"); t ? h.extend(t.options, n) : t = h.data(this, "passwordbox", { options: h.extend({}, h.fn.passwordbox.defaults, h.fn.passwordbox.parseOptions(this), n) }), e = this, i = h.data(e, "passwordbox").options, t = h.extend(!0, [], i.icons), i.showEye && t.push({ iconCls: "passwordbox-open", handler: function (t) { i.revealed = !i.revealed, o(e) } }), h(e).addClass("passwordbox-f").textbox(h.extend({}, i, { icons: t })), o(e) }); var e = h.fn.passwordbox.methods[n]; return e ? e(this, t) : this.textbox(n, t) }, h.fn.passwordbox.methods = { options: function (t) { return h.data(t[0], "passwordbox").options }, setValue: function (t, e) { return t.each(function () { o(this, e) }) }, clear: function (t) { return t.each(function () { o(this, "") }) }, reset: function (t) { return t.each(function () { h(this).textbox("reset"), o(this) }) }, showPassword: function (t) { return t.each(function () { h(this).passwordbox("options").revealed = !0, o(this) }) }, hidePassword: function (t) { return t.each(function () { h(this).passwordbox("options").revealed = !1, o(this) }) } }, h.fn.passwordbox.parseOptions = function (t) { return h.extend({}, h.fn.textbox.parseOptions(t), h.parser.parseOptions(t, ["passwordChar", { checkInterval: "number", lastDelay: "number", revealed: "boolean", showEye: "boolean" }])) }, h.fn.passwordbox.defaults = h.extend({}, h.fn.textbox.defaults, { passwordChar: "%u25CF", checkInterval: 200, lastDelay: 500, revealed: !1, showEye: !0, inputEvents: { focus: function (t) { var e = t.data.target, i = h(t.data.target), n = i.data("passwordbox"), o = i.data("passwordbox").options; n.checking = !0, n.value = i.passwordbox("getText"), function () { var t; n.checking && (t = i.passwordbox("getText"), n.value != t && (n.value = t, n.lastTimer && (clearTimeout(n.lastTimer), n.lastTimer = void 0), r(e, t), n.lastTimer = setTimeout(function () { r(e, i.passwordbox("getText"), !0), n.lastTimer = void 0 }, o.lastDelay)), setTimeout(arguments.callee, o.checkInterval)) }() }, blur: function (t) { var e = t.data.target; (t = h(e).data("passwordbox")).checking = !1, t.lastTimer && (clearTimeout(t.lastTimer), t.lastTimer = void 0), o(e) }, keydown: function (t) { return !h(t.data.target).data("passwordbox").converting } }, val: function (t) { return h(t).parent().prev().passwordbox("getValue") } }) }(jQuery), function (c) { function a(t, e) { for (var i, n = c(t).maskedbox("options"), o = (e || c(t).maskedbox("getText") || "").split(""), r = [], a = 0; a < n.mask.length; a++)n.masks[n.mask[a]] && (i = o[a], r.push(i != n.promptChar ? i : " ")); return r.join("") } function s(t, e) { for (var i = c(t).maskedbox("options"), n = e.split(""), o = [], r = 0; r < i.mask.length; r++){ var a = i.mask[r], s = i.masks[a]; if (s) { var l = n.shift(); if (null != l) if (new RegExp(s, "i").test(l)) { o.push(l); continue } o.push(i.promptChar) } else o.push(a) } return o.join("") } function l(t, e) { c(t).maskedbox("options"); var i, n, o = a(t).split(""), r = c(t).maskedbox("getSelectionRange"); r.start == r.end ? 0 <= (n = (i = (e ? u : h)(t, r.start)) - d(t, i)) && o.splice(n, 1) : (i = h(t, r.start), r = u(t, r.end), n = i - d(t, i), r = r - d(t, r), o.splice(n, r - n + 1)), c(t).maskedbox("setValue", s(t, o.join(""))), c(t).maskedbox("setSelectionRange", { start: i, end: i }) } function d(t, e) { var i = c(t).maskedbox("options"), n = 0; e >= i.mask.length && e--; for (var o = e; 0 <= o; o--)null == i.masks[i.mask[o]] && n++; return n } function h(t, e) { for (var i = c(t).maskedbox("options"), n = i.mask[e], o = i.masks[n]; e < i.mask.length && !o;)e++ , n = i.mask[e], o = i.masks[n]; return e } function u(t, e) { for (var i = c(t).maskedbox("options"), n = i.mask[--e], o = i.masks[n]; 0 <= e && !o;)e-- , n = i.mask[e], o = i.masks[n]; return e < 0 ? 0 : e } c.extend(c.fn.textbox.methods, { inputMask: function (t, n) { return t.each(function () { var t = c.extend({}, c.fn.maskedbox.defaults, n); c.data(this, "maskedbox", { options: t }); var e, i = c(this).textbox("textbox"); for (e in i._unbind(".maskedbox"), t.inputEvents) i._bind(e + ".maskedbox", { target: this }, t.inputEvents[e]) }) } }), c.fn.maskedbox = function (i, t) { if ("string" != typeof i) return i = i || {}, this.each(function () { var t, e = c.data(this, "maskedbox"); e ? c.extend(e.options, i) : c.data(this, "maskedbox", { options: c.extend({}, c.fn.maskedbox.defaults, c.fn.maskedbox.parseOptions(this), i) }), e = c(t = this).data("maskedbox").options, c(t).textbox(e), c(t).maskedbox("initValue", e.value) }); var e = c.fn.maskedbox.methods[i]; return e ? e(this, t) : this.textbox(i, t) }, c.fn.maskedbox.methods = { options: function (t) { var e = t.textbox("options"); return c.extend(c.data(t[0], "maskedbox").options, { width: e.width, value: e.value, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, initValue: function (t, e) { return t.each(function () { e = s(this, a(this, e)), c(this).textbox("initValue", e) }) }, setValue: function (t, e) { return t.each(function () { e = s(this, a(this, e)), c(this).textbox("setValue", e) }) } }, c.fn.maskedbox.parseOptions = function (t) { c(t); return c.extend({}, c.fn.textbox.parseOptions(t), c.parser.parseOptions(t, ["mask", "promptChar"]), {}) }, c.fn.maskedbox.defaults = c.extend({}, c.fn.textbox.defaults, { mask: "", promptChar: "_", masks: { 9: "[0-9]", a: "[a-zA-Z]", "*": "[0-9a-zA-Z]" }, inputEvents: { keydown: function (t) { if (!t.metaKey && !t.ctrlKey) { var e = t.data.target; c(e).maskedbox("options"); if (-1 != c.inArray(t.keyCode, [9, 13, 35, 36, 37, 39])) return !0; 96 <= t.keyCode && t.keyCode <= 105 && (t.keyCode -= 48); var i, n, o, r = String.fromCharCode(t.keyCode); return 65 <= t.keyCode && t.keyCode <= 90 && !t.shiftKey ? r = r.toLowerCase() : 189 == t.keyCode ? r = "-" : 187 == t.keyCode ? r = "+" : 190 == t.keyCode && (r = "."), 8 == t.keyCode ? l(e, !0) : 46 == t.keyCode ? l(e, !1) : (n = r, o = c(i = e).maskedbox("options"), t = c(i).maskedbox("getSelectionRange"), r = h(i, t.start), e = h(i, t.end), -1 != r && new RegExp(o.masks[o.mask[r]], "i").test(n) && (t = a(i).split(""), o = r - d(i, r), e = e - d(i, e), t.splice(o, e - o, n), c(i).maskedbox("setValue", s(i, t.join(""))), r = h(i, ++r), c(i).maskedbox("setSelectionRange", { start: r, end: r }))), !1 } } } }) }(jQuery), function (o) { var r = 0; function a(e) { var t = o.data(e, "filebox"), i = t.options; t.filebox.find(".textbox-value").remove(), i.oldValue = ""; t = o('<input type="file" class="textbox-value">').appendTo(t.filebox); return t.attr("id", i.fileboxId).attr("name", o(e).attr("textboxName") || ""), t.attr("accept", i.accept), t.attr("capture", i.capture), i.multiple && t.attr("multiple", "multiple"), t.change(function () { var t = this.value; this.files && (t = o.map(this.files, function (t) { return t.name }).join(i.separator)), o(e).filebox("setText", t), i.onChange.call(e, t, i.oldValue), i.oldValue = t }), t } o.fn.filebox = function (n, t) { if ("string" != typeof n) return n = n || {}, this.each(function () { var t, e, i = o.data(this, "filebox"); i ? o.extend(i.options, n) : o.data(this, "filebox", { options: o.extend({}, o.fn.filebox.defaults, o.fn.filebox.parseOptions(this), n) }), t = this, e = o.data(t, "filebox"), (i = e.options).fileboxId = "filebox_file_id_" + ++r, o(t).addClass("filebox-f").textbox(i), o(t).textbox("textbox").attr("readonly", "readonly"), e.filebox = o(t).next().addClass("filebox"), e = a(t), (t = o(t).filebox("button")).length && (o('<label class="filebox-label" for="' + i.fileboxId + '"></label>').appendTo(t), t.linkbutton("options").disabled ? e._propAttr("disabled", !0) : e._propAttr("disabled", !1)) }); var e = o.fn.filebox.methods[n]; return e ? e(this, t) : this.textbox(n, t) }, o.fn.filebox.methods = { options: function (t) { var e = t.textbox("options"); return o.extend(o.data(t[0], "filebox").options, { width: e.width, value: e.value, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, clear: function (t) { return t.each(function () { o(this).textbox("clear"), a(this) }) }, reset: function (t) { return t.each(function () { o(this).filebox("clear") }) }, setValue: function (t) { return t }, setValues: function (t) { return t }, files: function (t) { return t.next().find(".textbox-value")[0].files } }, o.fn.filebox.parseOptions = function (t) { var e = o(t); return o.extend({}, o.fn.textbox.parseOptions(t), o.parser.parseOptions(t, ["accept", "capture", "separator"]), { multiple: !!e.attr("multiple") || void 0 }) }, o.fn.filebox.defaults = o.extend({}, o.fn.textbox.defaults, { buttonIcon: null, buttonText: "Choose File", buttonAlign: "right", inputEvents: {}, accept: "", capture: "", separator: ",", multiple: !1 }) }(jQuery), function ($) { function _62e(e) { var t, i, n = $.data(e, "searchbox"), o = n.options, r = $.extend(!0, [], o.icons); r.push({ iconCls: "searchbox-button", handler: function (t) { var e = $(t.data.target); e.searchbox("options").searcher.call(t.data.target, e.searchbox("getValue"), e.searchbox("getName")) } }), o.menu ? (n.menu = $(o.menu).menu(), t = n.menu.menu("options"), i = t.onClick, t.onClick = function (t) { s(t), i.call(this, t) }) : (n.menu && n.menu.menu("destroy"), n.menu = null); var a = function () { { if (n.menu) { var t = n.menu.children("div.menu-item:first"); return n.menu.children("div.menu-item").each(function () { if ($.extend({}, $.parser.parseOptions(this), { selected: !!$(this).attr("selected") || void 0 }).selected) return t = $(this), !1 }), n.menu.menu("getItem", t[0]) } return null } }(); function s(t) { t && ($(e).textbox("button").menubutton({ text: t.text, iconCls: t.iconCls || null, menu: n.menu, menuAlign: o.buttonAlign, plain: !1 }), n.searchbox.find("input.textbox-value").attr("name", t.name || t.text), $(e).searchbox("resize")) } $(e).addClass("searchbox-f").textbox($.extend({}, o, { icons: r, buttonText: a ? a.text : "" })), $(e).attr("searchboxName", $(e).attr("textboxName")), n.searchbox = $(e).next(), n.searchbox.addClass("searchbox"), s(a) } $.fn.searchbox = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = $.data(this, "searchbox"); t ? $.extend(t.options, e) : $.data(this, "searchbox", { options: $.extend({}, $.fn.searchbox.defaults, $.fn.searchbox.parseOptions(this), e) }), _62e(this) }); var i = $.fn.searchbox.methods[e]; return i ? i(this, t) : this.textbox(e, t) }, $.fn.searchbox.methods = { options: function (t) { var e = t.textbox("options"); return $.extend($.data(t[0], "searchbox").options, { width: e.width, value: e.value, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, menu: function (t) { return $.data(t[0], "searchbox").menu }, getName: function (t) { return $.data(t[0], "searchbox").searchbox.find("input.textbox-value").attr("name") }, selectName: function (t, e) { return t.each(function () { var t = $.data(this, "searchbox").menu; t && t.children("div.menu-item").each(function () { if (t.menu("getItem", this).name == e) return $(this).trigger("click"), !1 }) }) }, destroy: function (t) { return t.each(function () { var t = $(this).searchbox("menu"); t && t.menu("destroy"), $(this).textbox("destroy") }) } }, $.fn.searchbox.parseOptions = function (_63d) { var t = $(_63d); return $.extend({}, $.fn.textbox.parseOptions(_63d), $.parser.parseOptions(_63d, ["menu"]), { searcher: t.attr("searcher") ? eval(t.attr("searcher")) : void 0 }) }, $.fn.searchbox.defaults = $.extend({}, $.fn.textbox.defaults, { inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents, { keydown: function (t) { if (13 == t.keyCode) { t.preventDefault(); var e = $(t.data.target), i = e.searchbox("options"); return e.searchbox("setValue", $(this).val()), i.searcher.call(t.data.target, e.searchbox("getValue"), e.searchbox("getName")), !1 } } }), buttonAlign: "left", menu: null, searcher: function (t, e) { } }) }(jQuery), function (h) { function n(t, e) { var i = h.data(t, "form").options; h.extend(i, e || {}); var n, o = h.extend({}, i.queryParams); 0 != i.onSubmit.call(t, o) && ((e = h(t).find(".textbox-text:focus")).triggerHandler("blur"), e.focus(), e = null, i.dirty && (n = [], h.map(i.dirtyFields, function (t) { h(t).hasClass("textbox-f") ? h(t).next().find(".textbox-value").each(function () { n.push(this) }) : n.push(t) }), (e = h(t).find("input[name]:enabled,textarea[name]:enabled,select[name]:enabled").filter(function () { return -1 == h.inArray(this, n) }))._propAttr("disabled", !0)), i.ajax ? (!i.iframe && void 0 !== window.FormData ? function (i, t) { var e, n = h.data(i, "form").options, o = new FormData(h(i)[0]); for (e in t) o.append(e, t[e]); h.ajax({ url: n.url, type: "post", xhr: function () { var t = h.ajaxSettings.xhr(); return t.upload && t.upload.addEventListener("progress", function (t) { var e; t.lengthComputable && (e = t.total, t = t.loaded || t.position, e = Math.ceil(100 * t / e), n.onProgress.call(i, e)) }, !1), t }, data: o, dataType: "html", cache: !1, contentType: !1, processData: !1, complete: function (t) { n.success.call(i, t.responseText) } }) } : r)(t, o) : h(t).submit(), i.dirty && e._propAttr("disabled", !1)) } function r(s, t) { var l = h.data(s, "form").options, c = "easyui_frame_" + (new Date).getTime(), e = h("<iframe id=" + c + " name=" + c + "></iframe>").appendTo("body"); function d() { var t = h("#" + c); if (t.length) try { var e = t.contents()[0].readyState; e && "uninitialized" == e.toLowerCase() && setTimeout(d, 100) } catch (t) { r() } } e.attr("src", window.ActiveXObject ? "javascript:false" : "about:blank"), e.css({ position: "absolute", top: -1e3, left: -1e3 }), e.bind("load", r), function (t) { var e = h(s); l.url && e.attr("action", l.url); var i = e.attr("target"), n = e.attr("action"); e.attr("target", c); var o = h(); try { for (var r in t) { var a = h('<input type="hidden" name="' + r + '">').val(t[r]).appendTo(e); o = o.add(a) } d(), e[0].submit() } finally { e.attr("action", n), i ? e.attr("target", i) : e.removeAttr("target"), o.remove() } }(t); var o = 10; function r() { var t = h("#" + c); if (t.length) { t.unbind(); var e = ""; try { var i = t.contents().find("body"), e = i.html(); if ("" == e && --o) return void setTimeout(r, 100); var n = i.find(">textarea"); n.length ? e = n.val() : (i = i.find(">pre")).length && (e = i.html()) } catch (t) { } l.success.call(s, e), setTimeout(function () { t.unbind(), t.remove() }, 100) } } } function i(a, t) { var s = h.data(a, "form").options; if ("string" == typeof t) { var e = {}; if (0 == s.onBeforeLoad.call(a, e)) return; h.ajax({ url: t, data: e, dataType: "json", success: function (t) { i(t) }, error: function () { s.onLoadError.apply(a, arguments) } }) } else i(t); function i(t) { var e, i = h(a); for (e in t) { var n = t[e]; (function (t, e) { for (var i = ["switchbutton", "radiobutton", "checkbox"], n = 0; n < i.length; n++){ var o, r = i[n]; if ((o = h(a).find("[" + r + 'Name="' + t + '"]')).length) return o[r]("uncheck"), o.each(function () { l(h(this)[r]("options").value, e) && h(this)[r]("check") }), !0 } if ((o = h(a).find('input[name="' + t + '"][type=radio], input[name="' + t + '"][type=checkbox]')).length) return o._propAttr("checked", !1), o.each(function () { l(h(this).val(), e) && h(this)._propAttr("checked", !0) }), !0; return !1 })(e, n) || !function (t, e) { var i = h(a).find('[textboxName="' + t + '"],[sliderName="' + t + '"]'); if (i.length) for (var n = 0; n < s.fieldTypes.length; n++){ var o = s.fieldTypes[n], r = i.data(o); if (r) return r.options.multiple || r.options.range ? i[o]("setValues", e) : i[o]("setValue", e), !0 } return !1 }(e, n) && (i.find('input[name="' + e + '"]').val(n), i.find('textarea[name="' + e + '"]').val(n), i.find('select[name="' + e + '"]').val(n)) } s.onLoadSuccess.call(a, t), i.form("validate") } function l(t, e) { return t == String(e) || 0 <= h.inArray(t, h.isArray(e) ? e : [e]) } } function o(t, e) { e = e || {}; var i = h.data(t, "form"); i ? h.extend(i.options, e) : h.data(t, "form", { options: h.extend({}, h.fn.form.defaults, h.fn.form.parseOptions(t), e) }) } function a(t, e) { h.data(t, "form").options.novalidate = e, h(t).find(".validatebox-text:not(:disabled)").validatebox(e ? "disableValidation" : "enableValidation") } h.fn.form = function (e, t) { return "string" == typeof e ? (this.each(function () { o(this) }), h.fn.form.methods[e](this, t)) : this.each(function () { var t, i; o(this, e), t = this, i = h.data(t, "form").options, h(t).unbind(".form"), i.ajax && h(t).bind("submit.form", function () { return setTimeout(function () { n(t, i) }, 0), !1 }), h(t).bind("_change.form", function (t, e) { -1 == h.inArray(e, i.dirtyFields) && i.dirtyFields.push(e), i.onChange.call(this, e) }).bind("change.form", function (t) { t = t.target; h(t).hasClass("textbox-text") || (-1 == h.inArray(t, i.dirtyFields) && i.dirtyFields.push(t), i.onChange.call(this, t)) }), a(t, i.novalidate) }) }, h.fn.form.methods = { options: function (t) { return h.data(t[0], "form").options }, submit: function (t, e) { return t.each(function () { n(this, e) }) }, load: function (t, e) { return t.each(function () { i(this, e) }) }, clear: function (t) { return t.each(function () { !function (t) { h("input,select,textarea", t).each(function () { var t, e, i, n; h(this).hasClass("textbox-value") || (t = this.type, e = this.tagName.toLowerCase(), "text" == t || "hidden" == t || "password" == t || "textarea" == e ? this.value = "" : "file" == t ? (i = h(this)).hasClass("textbox-value") || ((n = i.clone().val("")).insertAfter(i), i.data("validatebox") ? (i.validatebox("destroy"), n.validatebox()) : i.remove()) : "checkbox" == t || "radio" == t ? this.checked = !1 : "select" == e && (this.selectedIndex = -1)) }); for (var e = h(), i = h(t), n = h.data(t, "form").options, o = 0; o < n.fieldTypes.length; o++){ var r = n.fieldTypes[o], a = i.find("." + r + "-f").not(e); a.length && a[r] && (a[r]("clear"), e = e.add(a)) } i.form("validate") }(this) }) }, reset: function (t) { return t.each(function () { !function (t) { t.reset(); for (var e = h(t), i = h.data(t, "form").options, n = i.fieldTypes.length - 1; 0 <= n; n--){ var o = i.fieldTypes[n], r = e.find("." + o + "-f"); r.length && r[o] && r[o]("reset") } e.form("validate") }(this) }) }, validate: function (t) { return function (t) { if (h.fn.validatebox) { t = h(t); t.find(".validatebox-text:not(:disabled)").validatebox("validate"); t = t.find(".validatebox-invalid"); return t.filter(":not(:disabled):first").focus(), 0 == t.length } return !0 }(t[0]) }, disableValidation: function (t) { return t.each(function () { a(this, !0) }) }, enableValidation: function (t) { return t.each(function () { a(this, !1) }) }, resetValidation: function (t) { return t.each(function () { h(this).find(".validatebox-text:not(:disabled)").validatebox("resetValidation") }) }, resetDirty: function (t) { return t.each(function () { h(this).form("options").dirtyFields = [] }) } }, h.fn.form.parseOptions = function (t) { var e = h(t); return h.extend({}, h.parser.parseOptions(t, [{ ajax: "boolean", dirty: "boolean" }]), { url: e.attr("action") ? e.attr("action") : void 0 }) }, h.fn.form.defaults = { fieldTypes: ["tagbox", "combobox", "combotree", "combogrid", "combotreegrid", "datetimebox", "datebox", "timepicker", "combo", "datetimespinner", "timespinner", "numberspinner", "spinner", "slider", "searchbox", "numberbox", "passwordbox", "filebox", "textbox", "switchbutton", "radiobutton", "checkbox"], novalidate: !1, ajax: !0, iframe: !0, dirty: !1, dirtyFields: [], url: null, queryParams: {}, onSubmit: function (t) { return h(this).form("validate") }, onProgress: function (t) { }, success: function (t) { }, onBeforeLoad: function (t) { }, onLoadSuccess: function (t) { }, onLoadError: function () { }, onChange: function (t) { } } }(jQuery), function (a) { a.fn.numberbox = function (n, t) { if ("string" != typeof n) return n = n || {}, this.each(function () { var t, e, i = a.data(this, "numberbox"); i ? a.extend(i.options, n) : i = a.data(this, "numberbox", { options: a.extend({}, a.fn.numberbox.defaults, a.fn.numberbox.parseOptions(this), n) }), t = this, e = a.data(t, "numberbox"), i = e.options, a(t).addClass("numberbox-f").textbox(i), a(t).textbox("textbox").css({ imeMode: "disabled" }), a(t).attr("numberboxName", a(t).attr("textboxName")), e.numberbox = a(t).next(), e.numberbox.addClass("numberbox"), e = i.parser.call(t, i.value), i = i.formatter.call(t, e), a(t).numberbox("initValue", e).numberbox("setText", i) }); var e = a.fn.numberbox.methods[n]; return e ? e(this, t) : this.textbox(n, t) }, a.fn.numberbox.methods = { options: function (t) { var e = t.data("textbox") ? t.textbox("options") : {}; return a.extend(a.data(t[0], "numberbox").options, { width: e.width, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, cloneFrom: function (t, e) { return t.each(function () { a(this).textbox("cloneFrom", e), a.data(this, "numberbox", { options: a.extend(!0, {}, a(e).numberbox("options")) }), a(this).addClass("numberbox-f") }) }, fix: function (t) { return t.each(function () { var t = a(this).numberbox("options"); t.value = null; t = t.parser.call(this, a(this).numberbox("getText")); a(this).numberbox("setValue", t) }) }, setValue: function (t, e) { return t.each(function () { !function (t, e) { var i = a.data(t, "numberbox").options; i.value = parseFloat(e); var e = i.parser.call(t, e), n = i.formatter.call(t, e); i.value = e, a(t).textbox("setText", n).textbox("setValue", e), n = i.formatter.call(t, a(t).textbox("getValue")), a(t).textbox("setText", n) }(this, e) }) }, clear: function (t) { return t.each(function () { a(this).textbox("clear"), a(this).numberbox("options").value = "" }) }, reset: function (t) { return t.each(function () { a(this).textbox("reset"), a(this).numberbox("setValue", a(this).numberbox("getValue")) }) } }, a.fn.numberbox.parseOptions = function (t) { var e = a(t); return a.extend({}, a.fn.textbox.parseOptions(t), a.parser.parseOptions(t, ["decimalSeparator", "groupSeparator", "suffix", { min: "number", max: "number", precision: "number" }]), { prefix: e.attr("prefix") ? e.attr("prefix") : void 0 }) }, a.fn.numberbox.defaults = a.extend({}, a.fn.textbox.defaults, { inputEvents: { keypress: function (t) { var e = t.data.target; return a(e).numberbox("options").filter.call(e, t) }, blur: function (t) { a(t.data.target).numberbox("fix") }, keydown: function (t) { 13 == t.keyCode && a(t.data.target).numberbox("fix") } }, min: null, max: null, precision: 0, decimalSeparator: ".", groupSeparator: "", prefix: "", suffix: "", filter: function (t) { var e = a(this).numberbox("options"), i = a(this).numberbox("getText"); if (t.metaKey || t.ctrlKey) return !0; if (0 <= a.inArray(String(t.which), ["46", "8", "13", "0"])) return !0; var n = a("<span></span>"); n.html(String.fromCharCode(t.which)); t = n.text(); return n.remove(), !t || !("-" == t && null != e.min && 0 <= e.min) && ("-" == t || t == e.decimalSeparator ? -1 == i.indexOf(t) : t == e.groupSeparator || 0 <= "0123456789".indexOf(t)) }, formatter: function (t) { if (!t) return t; t += ""; var e = a(this).numberbox("options"), i = t, n = "", o = t.indexOf("."); if (0 <= o && (i = t.substring(0, o), n = t.substring(o + 1, t.length)), e.groupSeparator) for (var r = /(\d+)(\d{3})/; r.test(i);)i = i.replace(r, "$1" + e.groupSeparator + "$2"); return n ? e.prefix + i + e.decimalSeparator + n + e.suffix : e.prefix + i + e.suffix }, parser: function (t) { t += ""; var e = a(this).numberbox("options"); e.prefix && (t = a.trim(t.replace(new RegExp("\\" + a.trim(e.prefix), "g"), ""))), e.suffix && (t = a.trim(t.replace(new RegExp("\\" + a.trim(e.suffix), "g"), ""))), parseFloat(t) != e.value && (e.groupSeparator && (t = a.trim(t.replace(new RegExp("\\" + e.groupSeparator, "g"), ""))), e.decimalSeparator && (t = a.trim(t.replace(new RegExp("\\" + e.decimalSeparator, "g"), "."))), t = t.replace(/\s/g, "")); t = parseFloat(t).toFixed(e.precision); return isNaN(t) ? t = "" : "number" == typeof e.min && t < e.min ? t = e.min.toFixed(e.precision) : "number" == typeof e.max && t > e.max && (t = e.max.toFixed(e.precision)), t } }) }(jQuery), function (_) { function n(t, e) { var i = _.data(t, "calendar").options, n = _(t); e && _.extend(i, { width: e.width, height: e.height }), n._size(i, n.parent()), n.find(".calendar-body")._outerHeight(n.height() - n.find(".calendar-header")._outerHeight()), n.find(".calendar-menu").is(":visible") && h(t) } function h(t) { var e = _.data(t, "calendar").options; if (_(t).find(".calendar-menu").show(), _(t).find(".calendar-menu-month-inner").is(":empty")) { _(t).find(".calendar-menu-month-inner").empty(); for (var i = _('<table class="calendar-mtable"></table>').appendTo(_(t).find(".calendar-menu-month-inner")), n = 0, o = 0; o < 3; o++)for (var r = _("<tr></tr>").appendTo(i), a = 0; a < 4; a++)_('<td class="calendar-nav calendar-menu-month"></td>').html(e.months[n++]).attr("abbr", n).appendTo(r) } var s = _(t).find(".calendar-body"), l = _(t).find(".calendar-menu"), c = l.find(".calendar-menu-year-inner"), t = l.find(".calendar-menu-month-inner"); c.find("input").val(e.year).focus(), t.find("td.calendar-selected").removeClass("calendar-selected"), t.find("td:eq(" + (e.month - 1) + ")").addClass("calendar-selected"), l._outerWidth(s._outerWidth()), l._outerHeight(s._outerHeight()), t._outerHeight(l.height() - c._outerHeight()) } function u(t) { var e = _.data(t, "calendar").options; e.current && !e.validator.call(t, e.current) && (e.current = null); var i = new e.Date, n = i.getFullYear() + "," + (i.getMonth() + 1) + "," + i.getDate(), o = e.current ? e.current.getFullYear() + "," + (e.current.getMonth() + 1) + "," + e.current.getDate() : "", r = 6 - e.firstDay, a = r + 1; 7 <= r && (r -= 7), 7 <= a && (a -= 7), _(t).find(".calendar-title span").html(e.months[e.month - 1] + " " + e.year); i = _(t).find("div.calendar-body"); i.children("table").remove(); var s = ['<table class="calendar-dtable" cellspacing="0" cellpadding="0" border="0">']; s.push("<thead><tr>"), e.showWeek && s.push('<th class="calendar-week">' + e.weekNumberHeader + "</th>"); for (var l = e.firstDay; l < e.weeks.length; l++)s.push("<th>" + e.weeks[l] + "</th>"); for (l = 0; l < e.firstDay; l++)s.push("<th>" + e.weeks[l] + "</th>"); s.push("</tr></thead>"), s.push("<tbody>"); for (var c = function (t, e, i) { for (var n = _.data(t, "calendar").options, o = [], r = new n.Date(e, i, 0).getDate(), a = 1; a <= r; a++)o.push([e, i, a]); for (var s = [], l = [], c = -1; 0 < o.length;){ var d = o.shift(); l.push(d); var h = new n.Date(d[0], d[1] - 1, d[2]).getDay(); c == h ? h = 0 : h == (0 == n.firstDay ? 7 : n.firstDay) - 1 && (s.push(l), l = []), c = h } l.length && s.push(l); var u = s[0]; if (u.length < 7) for (; u.length < 7;){ var f = u[0], d = new n.Date(f[0], f[1] - 1, f[2] - 1); u.unshift([d.getFullYear(), d.getMonth() + 1, d.getDate()]) } else { for (f = u[0], l = [], a = 1; a <= 7; a++){ d = new n.Date(f[0], f[1] - 1, f[2] - a); l.unshift([d.getFullYear(), d.getMonth() + 1, d.getDate()]) } s.unshift(l) } for (var p = s[s.length - 1]; p.length < 7;){ var g = p[p.length - 1], d = new n.Date(g[0], g[1] - 1, g[2] + 1); p.push([d.getFullYear(), d.getMonth() + 1, d.getDate()]) } if (s.length < 6) { for (g = p[p.length - 1], l = [], a = 1; a <= 7; a++){ d = new n.Date(g[0], g[1] - 1, g[2] + a); l.push([d.getFullYear(), d.getMonth() + 1, d.getDate()]) } s.push(l) } return s }(t, e.year, e.month), l = 0; l < c.length; l++){ var d, h = c[l], u = ""; 0 == l ? u = "calendar-first" : l == c.length - 1 && (u = "calendar-last"), s.push('<tr class="' + u + '">'), e.showWeek && (d = e.getWeekNumber(new e.Date(h[0][0], parseInt(h[0][1]) - 1, h[0][2])), s.push('<td class="calendar-week">' + d + "</td>")); for (var f = 0; f < h.length; f++){ var p = h[f], g = p[0] + "," + p[1] + "," + p[2], b = new e.Date(p[0], parseInt(p[1]) - 1, p[2]), m = e.formatter.call(t, b), v = e.styler.call(t, b), x = "", y = ""; "string" == typeof v ? y = v : v && (x = v.class || "", y = v.style || ""); u = "calendar-day"; e.year == p[0] && e.month == p[1] || (u += " calendar-other-month"), g == n && (u += " calendar-today"), g == o && (u += " calendar-selected"), f == r ? u += " calendar-saturday" : f == a && (u += " calendar-sunday"), 0 == f ? u += " calendar-first" : f == h.length - 1 && (u += " calendar-last"), u += " " + x, e.validator.call(t, b) || (u += " calendar-disabled"), s.push('<td class="' + u + '" abbr="' + g + '" style="' + y + '">' + m + "</td>") } s.push("</tr>") } s.push("</tbody>"), s.push("</table>"), i.append(s.join("")), i.children("table.calendar-dtable").prependTo(i), e.onNavigate.call(t, e.year, e.month) } var t; _.fn.calendar = function (e, t) { return "string" == typeof e ? _.fn.calendar.methods[e](this, t) : (e = e || {}, this.each(function () { var i, o, r, a, t = _.data(this, "calendar"); function s(t) { var e = _(t).closest(".calendar-day"); return e.length ? e : _(t) } function l(t) { var e = _(o).find(".calendar-menu"), i = e.find(".calendar-menu-year").val(), n = e.find(".calendar-selected").attr("abbr"); isNaN(i) || (r.year = parseInt(i), r.month = parseInt(n), u(o)), t && e.hide() } function c(t) { r.year += t, u(o), a.find(".calendar-menu-year").val(r.year) } function d(t) { r.month += t, 12 < r.month ? (r.year++ , r.month = 1) : r.month < 1 && (r.year-- , r.month = 12), u(o), a.find("td.calendar-selected").removeClass("calendar-selected"), a.find("td:eq(" + (r.month - 1) + ")").addClass("calendar-selected") } t ? _.extend(t.options, e) : (t = _.data(this, "calendar", { options: _.extend({}, _.fn.calendar.defaults, _.fn.calendar.parseOptions(this), e) }), _(i = this).addClass("calendar").html('<div class="calendar-header"><div class="calendar-nav calendar-prevmonth"></div><div class="calendar-nav calendar-nextmonth"></div><div class="calendar-nav calendar-prevyear"></div><div class="calendar-nav calendar-nextyear"></div><div class="calendar-title"><span class="calendar-text"></span></div></div><div class="calendar-body"><div class="calendar-menu"><div class="calendar-menu-year-inner"><span class="calendar-nav calendar-menu-prev"></span><span><input class="calendar-menu-year" type="text"></span><span class="calendar-nav calendar-menu-next"></span></div><div class="calendar-menu-month-inner"></div></div></div>'), _(i)._bind("_resize", function (t, e) { return (_(this).hasClass("easyui-fluid") || e) && n(i), !1 })), 0 == t.options.border && _(this).addClass("calendar-noborder"), n(this), o = this, r = _.data(o, "calendar").options, (a = _(o).find(".calendar-menu")).find(".calendar-menu-year")._unbind(".calendar")._bind("keypress.calendar", function (t) { 13 == t.keyCode && l(!0) }), _(o)._unbind(".calendar")._bind("mouseover.calendar", function (t) { t = s(t.target); (t.hasClass("calendar-nav") || t.hasClass("calendar-text") || t.hasClass("calendar-day") && !t.hasClass("calendar-disabled")) && t.addClass("calendar-nav-hover") })._bind("mouseout.calendar", function (t) { t = s(t.target); (t.hasClass("calendar-nav") || t.hasClass("calendar-text") || t.hasClass("calendar-day") && !t.hasClass("calendar-disabled")) && t.removeClass("calendar-nav-hover") })._bind("click.calendar", function (t) { var e, i, n = s(t.target); n.hasClass("calendar-menu-next") || n.hasClass("calendar-nextyear") ? c(1) : n.hasClass("calendar-menu-prev") || n.hasClass("calendar-prevyear") ? c(-1) : n.hasClass("calendar-menu-month") ? (a.find(".calendar-selected").removeClass("calendar-selected"), n.addClass("calendar-selected"), l(!0)) : n.hasClass("calendar-prevmonth") ? d(-1) : n.hasClass("calendar-nextmonth") ? d(1) : n.hasClass("calendar-text") ? a.is(":visible") ? a.hide() : h(o) : n.hasClass("calendar-day") && (n.hasClass("calendar-disabled") || (e = r.current, n.closest("div.calendar-body").find(".calendar-selected").removeClass("calendar-selected"), n.addClass("calendar-selected"), i = n.attr("abbr").split(","), t = parseInt(i[0]), n = parseInt(i[1]), i = parseInt(i[2]), r.current = new r.Date(t, n - 1, i), r.onSelect.call(o, r.current), e && e.getTime() == r.current.getTime() || r.onChange.call(o, r.current, e), r.year == t && r.month == n || (r.year = t, r.month = n, u(o)))) }), u(this), _(this).find("div.calendar-menu").hide() })) }, _.fn.calendar.methods = { options: function (t) { return _.data(t[0], "calendar").options }, resize: function (t, e) { return t.each(function () { n(this, e) }) }, moveTo: function (t, i) { return t.each(function () { var t, e = _(this).calendar("options"); i ? e.validator.call(this, i) && (t = e.current, _(this).calendar({ year: i.getFullYear(), month: i.getMonth() + 1, current: i }), t && t.getTime() == i.getTime() || e.onChange.call(this, e.current, t)) : (e = new e.Date, _(this).calendar({ year: e.getFullYear(), month: e.getMonth() + 1, current: i })) }) } }, _.fn.calendar.parseOptions = function (t) { _(t); return _.extend({}, _.parser.parseOptions(t, ["weekNumberHeader", { firstDay: "number", fit: "boolean", border: "boolean", showWeek: "boolean" }])) }, _.fn.calendar.defaults = { Date: Date, width: 180, height: 180, fit: !1, border: !0, showWeek: !1, firstDay: 0, weeks: ["S", "M", "T", "W", "T", "F", "S"], months: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], year: (new Date).getFullYear(), month: (new Date).getMonth() + 1, current: (t = new Date, new Date(t.getFullYear(), t.getMonth(), t.getDate())), weekNumberHeader: "", getWeekNumber: function (t) { var e = new Date(t.getTime()); e.setDate(e.getDate() + 4 - (e.getDay() || 7)); t = e.getTime(); return e.setMonth(0), e.setDate(1), Math.floor(Math.round((t - e) / 864e5) / 7) + 1 }, formatter: function (t) { return t.getDate() }, styler: function (t) { return "" }, validator: function (t) { return !0 }, onSelect: function (t) { }, onChange: function (t, e) { }, onNavigate: function (t, e) { } } }(jQuery), function (s) { function r(t, e) { var i = s(t).spinner("options"); i.spin.call(t, e), i[e ? "onSpinDown" : "onSpinUp"].call(t), s(t).spinner("validate") } s.fn.spinner = function (o, t) { if ("string" != typeof o) return o = o || {}, this.each(function () { var t, e, a, i, n = s.data(this, "spinner"); n ? s.extend(n.options, o) : n = s.data(this, "spinner", { options: s.extend({}, s.fn.spinner.defaults, s.fn.spinner.parseOptions(this), o) }), t = this, e = s.data(t, "spinner"), a = e.options, i = s.extend(!0, [], a.icons), "left" == a.spinAlign || "right" == a.spinAlign ? (a.spinArrow = !0, a.iconAlign = a.spinAlign, n = { iconCls: "spinner-button-updown", handler: function (t) { var e = s(t.target).closest(".spinner-arrow-up,.spinner-arrow-down"); r(t.data.target, e.hasClass("spinner-arrow-down")) } }, "left" == a.spinAlign ? i.unshift(n) : i.push(n)) : (a.spinArrow = !1, "vertical" == a.spinAlign ? ("top" != a.buttonAlign && (a.buttonAlign = "bottom"), a.clsLeft = "textbox-button-bottom", a.clsRight = "textbox-button-top") : (a.clsLeft = "textbox-button-left", a.clsRight = "textbox-button-right")), s(t).addClass("spinner-f").textbox(s.extend({}, a, { icons: i, doSize: !1, onResize: function (t, e) { var i, n, o, r; a.spinArrow || (o = (r = s(this).next()).find(".textbox-button:not(.spinner-button)")).length && (i = o.outerWidth(), n = o.outerHeight(), o = r.find(".spinner-button." + a.clsLeft), r = r.find(".spinner-button." + a.clsRight), "right" == a.buttonAlign ? r.css("marginRight", i + "px") : "left" == a.buttonAlign ? o.css("marginLeft", i + "px") : "top" == a.buttonAlign ? r.css("marginTop", n + "px") : o.css("marginBottom", n + "px")), a.onResize.call(this, t, e) } })), s(t).attr("spinnerName", s(t).attr("textboxName")), e.spinner = s(t).next(), e.spinner.addClass("spinner"), a.spinArrow ? e.spinner.find(".spinner-button-updown").append('<span class="spinner-arrow spinner-button-top"><span class="spinner-arrow-up"></span></span><span class="spinner-arrow spinner-button-bottom"><span class="spinner-arrow-down"></span></span>') : (i = s('<a href="javascript:;" class="textbox-button spinner-button"></a>').addClass(a.clsLeft).appendTo(e.spinner), e = s('<a href="javascript:;" class="textbox-button spinner-button"></a>').addClass(a.clsRight).appendTo(e.spinner), i.linkbutton({ iconCls: a.reversed ? "spinner-button-up" : "spinner-button-down", onClick: function () { r(t, !a.reversed) } }), e.linkbutton({ iconCls: a.reversed ? "spinner-button-down" : "spinner-button-up", onClick: function () { r(t, a.reversed) } }), a.disabled && s(t).spinner("disable"), a.readonly && s(t).spinner("readonly")), s(t).spinner("resize") }); var e = s.fn.spinner.methods[o]; return e ? e(this, t) : this.textbox(o, t) }, s.fn.spinner.methods = { options: function (t) { var e = t.textbox("options"); return s.extend(s.data(t[0], "spinner").options, { width: e.width, value: e.value, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) } }, s.fn.spinner.parseOptions = function (t) { return s.extend({}, s.fn.textbox.parseOptions(t), s.parser.parseOptions(t, ["min", "max", "spinAlign", { increment: "number", reversed: "boolean" }])) }, s.fn.spinner.defaults = s.extend({}, s.fn.textbox.defaults, { min: null, max: null, increment: 1, spinAlign: "right", reversed: !1, spin: function (t) { }, onSpinUp: function () { }, onSpinDown: function () { } }) }(jQuery), function (o) { o.fn.numberspinner = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = o.data(this, "numberspinner"); t ? o.extend(t.options, e) : o.data(this, "numberspinner", { options: o.extend({}, o.fn.numberspinner.defaults, o.fn.numberspinner.parseOptions(this), e) }), function (t) { o(t).addClass("numberspinner-f"); var e = o.data(t, "numberspinner").options; o(t).numberbox(o.extend({}, e, { doSize: !1 })).spinner(e), o(t).numberbox("setValue", e.value) }(this) }); var i = o.fn.numberspinner.methods[e]; return i ? i(this, t) : this.numberbox(e, t) }, o.fn.numberspinner.methods = { options: function (t) { var e = t.numberbox("options"); return o.extend(o.data(t[0], "numberspinner").options, { width: e.width, value: e.value, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) } }, o.fn.numberspinner.parseOptions = function (t) { return o.extend({}, o.fn.spinner.parseOptions(t), o.fn.numberbox.parseOptions(t), {}) }, o.fn.numberspinner.defaults = o.extend({}, o.fn.spinner.defaults, o.fn.numberbox.defaults, { spin: function (t) { var e, i, n; e = this, i = t, n = o.data(e, "numberspinner").options, t = parseFloat(o(e).numberbox("getValue") || n.value) || 0, i ? t -= n.increment : t += n.increment, o(e).numberbox("setValue", t) } }) }(jQuery), function (s) { function l(t, e) { var i = s.data(t, "timespinner").options; null != e && (i.highlight = e); e = i.selections[i.highlight]; e && (i = s(t).timespinner("textbox"), s(t).timespinner("setSelectionRange", { start: e[0], end: e[1] }), i.focus()) } s.fn.timespinner = function (i, t) { if ("string" != typeof i) return i = i || {}, this.each(function () { var t, e = s.data(this, "timespinner"); e ? s.extend(e.options, i) : s.data(this, "timespinner", { options: s.extend({}, s.fn.timespinner.defaults, s.fn.timespinner.parseOptions(this), i) }), t = this, e = s.data(t, "timespinner").options, s(t).addClass("timespinner-f").spinner(e), e = e.formatter.call(t, e.parser.call(t, e.value)), s(t).timespinner("initValue", e) }); var e = s.fn.timespinner.methods[i]; return e ? e(this, t) : this.spinner(i, t) }, s.fn.timespinner.methods = { options: function (t) { var e = t.data("spinner") ? t.spinner("options") : {}; return s.extend(s.data(t[0], "timespinner").options, { width: e.width, value: e.value, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, setValue: function (t, n) { return t.each(function () { var t, e, i; t = this, e = n, i = s.data(t, "timespinner").options, e = i.parser.call(t, e), e = i.formatter.call(t, e), s(t).spinner("setValue", e) }) }, getHours: function (t) { t = s.data(t[0], "timespinner").options.parser.call(t[0], t.timespinner("getValue")); return t ? t.getHours() : null }, getMinutes: function (t) { t = s.data(t[0], "timespinner").options.parser.call(t[0], t.timespinner("getValue")); return t ? t.getMinutes() : null }, getSeconds: function (t) { t = s.data(t[0], "timespinner").options.parser.call(t[0], t.timespinner("getValue")); return t ? t.getSeconds() : null } }, s.fn.timespinner.parseOptions = function (t) { return s.extend({}, s.fn.spinner.parseOptions(t), s.parser.parseOptions(t, ["separator", { hour12: "boolean", showSeconds: "boolean", highlight: "number" }])) }, s.fn.timespinner.defaults = s.extend({}, s.fn.spinner.defaults, { inputEvents: s.extend({}, s.fn.spinner.defaults.inputEvents, { click: function (t) { (function (t) { for (var e = t.data.target, i = s.data(e, "timespinner").options, n = s(e).timespinner("getSelectionStart"), o = 0; o < i.selections.length; o++){ var r = i.selections[o]; if (n >= r[0] && n <= r[1]) return void l(e, o) } }).call(this, t) }, blur: function (t) { t = s(t.data.target); t.timespinner("setValue", t.timespinner("getText")) }, keydown: function (t) { 13 == t.keyCode && (t = s(t.data.target)).timespinner("setValue", t.timespinner("getText")) } }), formatter: function (t) { if (!t) return ""; var e = s(this).timespinner("options"), i = t.getHours(), n = t.getMinutes(), o = t.getSeconds(), t = ""; e.hour12 && (t = 12 <= i ? e.ampm[1] : e.ampm[0], 0 == (i %= 12) && (i = 12)); n = [r(i), r(n)]; e.showSeconds && n.push(r(o)); t = n.join(e.separator) + " " + t; return s.trim(t); function r(t) { return (t < 10 ? "0" : "") + t } }, parser: function (t) { var o = s(this).timespinner("options"), e = i(t); return e && ((t = i(o.min)) && e < t && (e = t), (t = i(o.max)) && t < e && (e = t)), e; function i(t) { if (!t) return null; var e = t.split(" "), i = e[0].split(o.separator), n = parseInt(i[0], 10) || 0, t = parseInt(i[1], 10) || 0, i = parseInt(i[2], 10) || 0; return o.hour12 && ((e = e[1]) == o.ampm[1] && n < 12 ? n += 12 : e == o.ampm[0] && 12 == n && (n -= 12)), new Date(1900, 0, 0, n, t, i) } }, selections: [[0, 2], [3, 5], [6, 8], [9, 11]], separator: ":", showSeconds: !1, highlight: 0, hour12: !1, ampm: ["AM", "PM"], spin: function (t) { var e, i, n, o, r, a; e = this, i = t, n = s.data(e, "timespinner").options, o = s(e).timespinner("getValue"), r = n.selections[n.highlight], a = o.substring(0, r[0]), t = o.substring(r[0], r[1]), o = o.substring(r[1]), t == n.ampm[0] ? t = n.ampm[1] : t == n.ampm[1] ? t = n.ampm[0] : (t = parseInt(t, 10) || 0, n.selections.length - 4 == n.highlight && n.hour12 && (12 == t ? t = 0 : 11 != t || i || (r = o.replace(n.ampm[0], n.ampm[1]), o = o != r ? r : o.replace(n.ampm[1], n.ampm[0]))), t += n.increment * (i ? -1 : 1)), o = a + t + o, s(e).timespinner("setValue", o), l(e) } }) }(jQuery), function (n) { n.fn.datetimespinner = function (i, t) { if ("string" != typeof i) return i = i || {}, this.each(function () { var t, e = n.data(this, "datetimespinner"); e ? n.extend(e.options, i) : n.data(this, "datetimespinner", { options: n.extend({}, n.fn.datetimespinner.defaults, n.fn.datetimespinner.parseOptions(this), i) }), t = this, e = n.data(t, "datetimespinner").options, n(t).addClass("datetimespinner-f").timespinner(e) }); var e = n.fn.datetimespinner.methods[i]; return e ? e(this, t) : this.timespinner(i, t) }, n.fn.datetimespinner.methods = { options: function (t) { var e = t.timespinner("options"); return n.extend(n.data(t[0], "datetimespinner").options, { width: e.width, value: e.value, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) } }, n.fn.datetimespinner.parseOptions = function (t) { return n.extend({}, n.fn.timespinner.parseOptions(t), n.parser.parseOptions(t, [])) }, n.fn.datetimespinner.defaults = n.extend({}, n.fn.timespinner.defaults, { formatter: function (t) { return t ? n.fn.datebox.defaults.formatter.call(this, t) + " " + n.fn.timespinner.defaults.formatter.call(this, t) : "" }, parser: function (t) { if (!(t = n.trim(t))) return null; var e = t.split(" "), t = n.fn.datebox.defaults.parser.call(this, e[0]); if (e.length < 2) return t; e = n.fn.timespinner.defaults.parser.call(this, e[1] + (e[2] ? " " + e[2] : "")); return new Date(t.getFullYear(), t.getMonth(), t.getDate(), e.getHours(), e.getMinutes(), e.getSeconds()) }, selections: [[0, 2], [3, 5], [6, 10], [11, 13], [14, 16], [17, 19], [20, 22]] }) }(jQuery), function ($) { var _708 = 0; function _709(t, e) { return $.easyui.indexOfArray(t, e) } function _70a(t, e, i) { $.easyui.removeArrayItem(t, e, i) } function _70b(t, e, i) { $.easyui.addArrayItem(t, e, i) } function _70c(t, e) { return $.data(t, "treegrid") ? e.slice(1) : e } function _70e(t) { var e = $.data(t, "datagrid"), i = e.options, n = e.panel, t = e.dc, e = null; i.sharedStyleSheet ? e = "boolean" == typeof i.sharedStyleSheet ? "head" : i.sharedStyleSheet : (e = n.closest("div.datagrid-view")).length || (e = t.view); var a = $(e), s = (s = $.data(a[0], "ss")) || $.data(a[0], "ss", { cache: {}, dirty: [] }); return { add: function (t) { for (var e = ['<style type="text/css" easyui="true">'], i = 0; i < t.length; i++)s.cache[t[i][0]] = { width: t[i][1] }; var n, o = 0; for (n in s.cache) { var r = s.cache[n]; r.index = o++ , e.push(n + "{width:" + r.width + "}") } e.push("</style>"), $(e.join("\n")).appendTo(a), a.children("style[easyui]:not(:last)").remove() }, getRule: function (t) { var e = a.children("style[easyui]:last")[0], e = e.styleSheet || e.sheet || document.styleSheets[document.styleSheets.length - 1]; return (e.cssRules || e.rules)[t] }, set: function (t, e) { t = s.cache[t]; t && (t.width = e, (t = this.getRule(t.index)) && (t.style.width = e)) }, remove: function (t) { var e, i = []; for (e in s.cache) -1 == e.indexOf(t) && i.push([e, s.cache[e].width]); s.cache = {}, this.add(i) }, dirty: function (t) { t && s.dirty.push(t) }, clean: function () { for (var t = 0; t < s.dirty.length; t++)this.remove(s.dirty[t]); s.dirty = [] } } } function _71d(t, e) { var i = $.data(t, "datagrid"), t = i.options, i = i.panel; e && $.extend(t, e), 1 == t.fit && (e = i.panel("panel").parent(), t.width = e.width(), t.height = e.height()), i.panel("resize", t) } function _722(t) { var e, i, n, o, r, a, s, l, c, d = $.data(t, "datagrid"), h = d.options, u = d.dc, f = d.panel; f.is(":visible") && (e = f.width(), i = f.height(), n = u.view, o = u.view1, r = u.view2, s = o.children("div.datagrid-header"), c = r.children("div.datagrid-header"), a = s.find("table"), t = c.find("table"), n.width(e), d = s.children("div.datagrid-header-inner").show(), o.width(d.find("table").width()), h.showHeader || d.hide(), r.width(e - o._outerWidth()), o.children()._outerWidth(o.width()), r.children()._outerWidth(r.width()), (s = s.add(c).add(a).add(t)).css("height", ""), t = Math.max(a.height(), t.height()), s._outerHeight(t), n.children(".datagrid-empty").css("top", t + "px"), u.body1.add(u.body2).children("table.datagrid-btable-frozen").css({ position: "absolute", top: u.header2._outerHeight() }), t = u.body2.children("table.datagrid-btable-frozen")._outerHeight(), l = t + c._outerHeight() + r.children(".datagrid-footer")._outerHeight(), f.children(":not(.datagrid-view,.datagrid-mask,.datagrid-mask-msg)").each(function () { l += $(this)._outerHeight() }), u = f.outerHeight() - f.height(), c = f._size("minHeight") || "", f = f._size("maxHeight") || "", o.add(r).children("div.datagrid-body").css({ marginTop: t, height: isNaN(parseInt(h.height)) ? "" : i - l, minHeight: c ? c - u - l : "", maxHeight: f ? f - u - l : "" }), n.height(r.height())) } function _733(t, e, i) { $.data(t, "datagrid").data.rows; var n, o, r, a = $.data(t, "datagrid").options, s = $.data(t, "datagrid").dc, l = $('<tr class="datagrid-row" style="position:absolute;left:-999999px"></tr>').appendTo("body"), c = l.outerHeight(); function d(t, e) { for (var i = 0; i < e.length; i++){ var n = $(t[i]), o = $(e[i]); n.css("height", ""), o.css("height", ""); var r = Math.max(n.outerHeight(), o.outerHeight()); r != c && (r = Math.max(r, c) + 1, n.css("height", r), o.css("height", r)) } } l.remove(), s.body1.is(":empty") || a.nowrap && !a.autoRowHeight && !i || (null != e ? d(a.finder.getTr(t, e, "body", 1), a.finder.getTr(t, e, "body", 2)) : (d(a.finder.getTr(t, 0, "allbody", 1), a.finder.getTr(t, 0, "allbody", 2)), a.showFooter && d(a.finder.getTr(t, 0, "allfooter", 1), a.finder.getTr(t, 0, "allfooter", 2)))), _722(t), "auto" == a.height && (e = s.body1.parent(), n = s.body2, r = o = 0, $(n).children().each(function () { var t = $(this); t.is(":visible") && (r += t._outerHeight(), o < t._outerWidth() && (o = t._outerWidth())) }), a = (t = { width: o, height: r }).height, t.width > n.width() && (a += 18), a -= parseInt(n.css("marginTop")) || 0, e.height(a), n.height(a), s.view.height(s.view2.height())), s.body2.triggerHandler("scroll") } function _741(i, n) { var t = $.data(i, "datagrid"), o = t.options, r = t.dc; function e(t) { var e = t ? 1 : 2, e = o.finder.getTr(i, n, "body", e); (t ? r.body1 : r.body2).children("table.datagrid-btable-frozen").append(e) } r.body2.children("table.datagrid-btable-frozen").length || r.body1.add(r.body2).prepend('<table class="datagrid-btable datagrid-btable-frozen" cellspacing="0" cellpadding="0"></table>'), e(!0), e(!1), _722(i) } function _748(_749, _74a) { function _74b() { var _74c = [], _74d = []; return $(_749).children("thead").each(function () { var opt = $.parser.parseOptions(this, [{ frozen: "boolean" }]); $(this).find("tr").each(function () { var cols = []; $(this).find("th").each(function () { var th = $(this), col = $.extend({}, $.parser.parseOptions(this, ["id", "field", "align", "halign", "order", "width", { sortable: "boolean", checkbox: "boolean", resizable: "boolean", fixed: "boolean" }, { rowspan: "number", colspan: "number" }]), { title: th.html() || void 0, hidden: !!th.attr("hidden") || void 0, hformatter: th.attr("hformatter") ? eval(th.attr("hformatter")) : void 0, hstyler: th.attr("hstyler") ? eval(th.attr("hstyler")) : void 0, formatter: th.attr("formatter") ? eval(th.attr("formatter")) : void 0, styler: th.attr("styler") ? eval(th.attr("styler")) : void 0, sorter: th.attr("sorter") ? eval(th.attr("sorter")) : void 0 }), s; col.width && -1 == String(col.width).indexOf("%") && (col.width = parseInt(col.width)), th.attr("editor") && (s = $.trim(th.attr("editor")), "{" == s.substr(0, 1) ? col.editor = eval("(" + s + ")") : col.editor = s), cols.push(col) }), (opt.frozen ? _74c : _74d).push(cols) }) }), [_74c, _74d] } var _74e = $('<div class="datagrid-wrap"><div class="datagrid-view"><div class="datagrid-view1"><div class="datagrid-header"><div class="datagrid-header-inner"></div></div><div class="datagrid-body"><div class="datagrid-body-inner"></div></div><div class="datagrid-footer"><div class="datagrid-footer-inner"></div></div></div><div class="datagrid-view2"><div class="datagrid-header"><div class="datagrid-header-inner"></div></div><div class="datagrid-body"></div><div class="datagrid-footer"><div class="datagrid-footer-inner"></div></div></div></div></div>').insertAfter(_749); _74e.panel({ doSize: !1, cls: "datagrid" }), $(_749).addClass("datagrid-f").hide().appendTo(_74e.children("div.datagrid-view")); var cc = _74b(), view = _74e.children("div.datagrid-view"), _74f = view.children("div.datagrid-view1"), _750 = view.children("div.datagrid-view2"); return { panel: _74e, frozenColumns: cc[0], columns: cc[1], dc: { view: view, view1: _74f, view2: _750, header1: _74f.children("div.datagrid-header").children("div.datagrid-header-inner"), header2: _750.children("div.datagrid-header").children("div.datagrid-header-inner"), body1: _74f.children("div.datagrid-body").children("div.datagrid-body-inner"), body2: _750.children("div.datagrid-body"), footer1: _74f.children("div.datagrid-footer").children("div.datagrid-footer-inner"), footer2: _750.children("div.datagrid-footer").children("div.datagrid-footer-inner") } } } function _751(_752) { var _753 = $.data(_752, "datagrid"), opts = _753.options, dc = _753.dc, _754 = _753.panel; _753.ss = $(_752).datagrid("createStyleSheet"), _754.panel($.extend({}, opts, { id: null, doSize: !1, onResize: function (t, e) { $.data(_752, "datagrid") && (_722(_752), $(_752).datagrid("fitColumns"), opts.onResize.call(_754, t, e)) }, onExpand: function () { $.data(_752, "datagrid") && ($(_752).datagrid("fixRowHeight").datagrid("fitColumns"), opts.onExpand.call(_754)) } })); var _757 = $(_752).attr("id") || "", _75a, ptop; if (_757 && (_757 += "_"), _753.rowIdPrefix = _757 + "datagrid-row-r" + ++_708, _753.cellClassPrefix = _757 + "datagrid-cell-c" + _708, _758(dc.header1, opts.frozenColumns, !0), _758(dc.header2, opts.columns, !1), _759(), dc.header1.add(dc.header2).css("display", opts.showHeader ? "block" : "none"), dc.footer1.add(dc.footer2).css("display", opts.showFooter ? "block" : "none"), opts.toolbar) if ($.isArray(opts.toolbar)) { $("div.datagrid-toolbar", _754).remove(); for (var tb = $('<div class="datagrid-toolbar"><table cellspacing="0" cellpadding="0"><tr></tr></table></div>').prependTo(_754), tr = tb.find("tr"), i = 0; i < opts.toolbar.length; i++){ var btn = opts.toolbar[i], td, tool; "-" == btn ? $('<td><div class="datagrid-btn-separator"></div></td>').appendTo(tr) : (td = $("<td></td>").appendTo(tr), tool = $('<a href="javascript:;"></a>').appendTo(td), tool[0].onclick = eval(btn.handler || function () { }), tool.linkbutton($.extend({}, btn, { plain: !0 }))) } } else $(opts.toolbar).addClass("datagrid-toolbar").prependTo(_754), $(opts.toolbar).show(); else $("div.datagrid-toolbar", _754).remove(); function _758(t, e, i) { if (e) { $(t).show(), $(t).empty(); var n = $('<div class="datagrid-cell" style="position:absolute;left:-99999px"></div>').appendTo("body"); n._outerWidth(99); var o = 100 - parseInt(n[0].style.width); n.remove(); var r = [], a = [], s = []; opts.sortName && (r = opts.sortName.split(","), a = opts.sortOrder.split(",")); for (var l = $('<table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"><tbody></tbody></table>').appendTo(t), c = 0; c < e.length; c++)for (var d = $('<tr class="datagrid-header-row"></tr>').appendTo($("tbody", l)), h = e[c], u = 0; u < h.length; u++){ var f = h[u], p = ""; f.rowspan && (p += 'rowspan="' + f.rowspan + '" '), f.colspan && (p += 'colspan="' + f.colspan + '" ', f.id || (f.id = ["datagrid-td-group" + _708, c, u].join("-"))), f.id && (p += 'id="' + f.id + '"'); var g, b = f.hstyler ? f.hstyler(f.title, f) : ""; b = "string" == typeof b ? (g = b, "") : (g = (b = b || {}).style || "", b.class || ""); var m = $("<td " + p + ' class="' + b + '" style="' + g + '"></td>').appendTo(d); f.checkbox ? (m.attr("field", f.field), $('<div class="datagrid-header-check"></div>').html('<input type="checkbox">').appendTo(m)) : f.field ? (m.attr("field", f.field), m.append('<div class="datagrid-cell"><span></span><span class="datagrid-sort-icon"></span></div>'), m.find("span:first").html(f.hformatter ? f.hformatter(f.title, f) : f.title), p = m.find("div.datagrid-cell"), 0 <= (b = _709(r, f.field)) && p.addClass("datagrid-sort-" + a[b]), f.sortable && p.addClass("datagrid-sort"), 0 == f.resizable && p.attr("resizable", "false"), f.width ? (b = $.parser.parseValue("width", f.width, dc.view, opts.scrollbarSize + (opts.rownumbers ? opts.rownumberWidth : 0)), f.deltaWidth = o, f.boxWidth = b - o) : f.auto = !0, p.css("text-align", f.halign || f.align || ""), f.cellClass = _753.cellClassPrefix + "-" + f.field.replace(/[\.|\s]/g, "-"), p.addClass(f.cellClass)) : $('<div class="datagrid-cell-group"></div>').html(f.hformatter ? f.hformatter(f.title, f) : f.title).appendTo(m), f.hidden && (m.hide(), s.push(f.field)) } i && opts.rownumbers && (m = $('<td rowspan="' + opts.frozenColumns.length + '"><div class="datagrid-header-rownumber"></div></td>'), 0 == $("tr", l).length ? m.wrap('<tr class="datagrid-header-row"></tr>').parent().appendTo($("tbody", l)) : m.prependTo($("tr:first", l))); for (c = 0; c < s.length; c++)_7a8(_752, s[c], -1) } } function _759() { for (var t = [[".datagrid-header-rownumber", opts.rownumberWidth - 1 + "px"], [".datagrid-cell-rownumber", opts.rownumberWidth - 1 + "px"]], e = _769(_752, !0).concat(_769(_752)), i = 0; i < e.length; i++){ var n = _76a(_752, e[i]); n && !n.checkbox && t.push(["." + n.cellClass, n.boxWidth ? n.boxWidth + "px" : "auto"]) } _753.ss.add(t), _753.ss.dirty(_753.cellSelectorPrefix), _753.cellSelectorPrefix = "." + _753.cellClassPrefix } $("div.datagrid-pager", _754).remove(), opts.pagination && (_75a = $('<div class="datagrid-pager"></div>'), "bottom" == opts.pagePosition ? _75a.appendTo(_754) : "top" == opts.pagePosition ? _75a.addClass("datagrid-pager-top").prependTo(_754) : (ptop = $('<div class="datagrid-pager datagrid-pager-top"></div>').prependTo(_754), _75a.appendTo(_754), _75a = _75a.add(ptop)), _75a.pagination({ total: 0, pageNumber: opts.pageNumber, pageSize: opts.pageSize, pageList: opts.pageList, onSelectPage: function (t, e) { opts.pageNumber = t || 1, opts.pageSize = e, _75a.pagination("refresh", { pageNumber: t, pageSize: e }), _7a6(_752) } }), opts.pageSize = _75a.pagination("options").pageSize) } function _76b(n) { var o = $.data(n, "datagrid"), e = o.panel, r = o.options, a = o.dc, s = a.header1.add(a.header2); for (l in s._unbind(".datagrid"), r.headerEvents) s._bind(l + ".datagrid", r.headerEvents[l]); var t = s.find("div.datagrid-cell"), i = "right" == r.resizeHandle ? "e" : "left" == r.resizeHandle ? "w" : "e,w"; t.each(function () { $(this).resizable({ handles: i, edge: r.resizeEdge, disabled: !!$(this).attr("resizable") && "false" == $(this).attr("resizable"), minWidth: 25, onStartResize: function (t) { o.resizing = !0, s.css("cursor", $("body").css("cursor")), o.proxy || (o.proxy = $('<div class="datagrid-resize-proxy"></div>').appendTo(a.view)), "e" == t.data.dir ? t.data.deltaEdge = $(this)._outerWidth() - (t.pageX - $(this).offset().left) : t.data.deltaEdge = $(this).offset().left - t.pageX - 1, o.proxy.css({ left: t.pageX - $(e).offset().left - 1 + t.data.deltaEdge, display: "none" }), setTimeout(function () { o.proxy && o.proxy.show() }, 500) }, onResize: function (t) { return o.proxy.css({ left: t.pageX - $(e).offset().left - 1 + t.data.deltaEdge, display: "block" }), !1 }, onStopResize: function (t) { s.css("cursor", ""), $(this).css("height", ""); var e = $(this).parent().attr("field"), i = _76a(n, e); i.width = $(this)._outerWidth() + 1, i.boxWidth = i.width - i.deltaWidth, i.auto = void 0, $(this).css("width", ""), $(n).datagrid("fixColumnSize", e), o.proxy.remove(), o.proxy = null, $(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1") && _722(n), $(n).datagrid("fitColumns"), r.onResizeColumn.call(n, e, i.width), setTimeout(function () { o.resizing = !1 }, 0) } }) }); var l, c = a.body1.add(a.body2); for (l in c._unbind(), r.rowEvents) c._bind(l, r.rowEvents[l]); a.body1._bind("mousewheel DOMMouseScroll MozMousePixelScroll", function (t) { t.preventDefault(); var e = t.originalEvent || window.event, i = e.wheelDelta || -1 * e.detail; "deltaY" in e && (i = -1 * e.deltaY); t = $(t.target).closest("div.datagrid-view").children(".datagrid-f").data("datagrid").dc; t.body2.scrollTop(t.body2.scrollTop() - i) }), a.body2._bind("scroll", function () { var t = a.view1.children("div.datagrid-body"), e = $(this).scrollTop(); $(this).scrollTop(e), t.scrollTop(e); var i = a.body1.children(":first"), e = a.body2.children(":first"); i.length && e.length && ((i = i.offset().top) != (e = e.offset().top) && t.scrollTop(t.scrollTop() + i - e)), a.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft()), a.body2.children("table.datagrid-btable-frozen").css("left", -$(this)._scrollLeft()) }) } function _775(i) { return function (t) { var e = $(t.target).closest("td[field]"); e.length && (t = _778(e), !$(t).data("datagrid").resizing && i ? e.addClass("datagrid-header-over") : e.removeClass("datagrid-header-over")) } } function _779(t) { var e = _778(t.target), i = $(e).datagrid("options"), n = $(t.target).closest("input[type=checkbox]"); if (n.length) { if (i.singleSelect && i.selectOnCheck) return !1; (n.is(":checked") ? _77b : _77c)(e), t.stopPropagation() } else { var o = $(t.target).closest(".datagrid-cell"); o.length && (i = o.offset().left + 5, n = o.offset().left + o._outerWidth() - 5, t.pageX < n && t.pageX > i && _77d(e, o.parent().attr("field"))) } } function _77e(t) { var e, i, n = _778(t.target), o = $(n).datagrid("options"), r = $(t.target).closest(".datagrid-cell"); r.length && (e = r.offset().left + 5, i = r.offset().left + r._outerWidth() - 5, !("right" == o.resizeHandle ? t.pageX > i : "left" == o.resizeHandle ? t.pageX < e : t.pageX < e || t.pageX > i) || 0 != (r = _76a(n, i = r.parent().attr("field"))).resizable && ($(n).datagrid("autoSizeColumn", i), r.auto = !1)) } function _781(t) { var e = _778(t.target), i = $(e).datagrid("options"), n = $(t.target).closest("td[field]"); i.onHeaderContextMenu.call(e, t, n.attr("field")) } function _783(i) { return function (t) { var e = _785(t.target); e && (t = _778(e), $.data(t, "datagrid").resizing || (e = _788(e), i ? _789(t, e) : $.data(t, "datagrid").options.finder.getTr(t, e).removeClass("datagrid-row-over"))) } } function _78a(t) { var e = _785(t.target); if (e) { var i = _778(e), n = $.data(i, "datagrid").options, o = _788(e), r = $(t.target); if (r.parent().hasClass("datagrid-cell-check")) n.singleSelect && n.selectOnCheck ? (r._propAttr("checked", !r.is(":checked")), _78d(i, o)) : r.is(":checked") ? (r._propAttr("checked", !1), _78d(i, o)) : (r._propAttr("checked", !0), _78e(i, o)); else { var a = n.finder.getRow(i, o), r = r.closest("td[field]", e); if (r.length && (r = r.attr("field"), n.onClickCell.call(i, o, r, a[r])), 1 == n.singleSelect) _790(i, o); else if (n.ctrlSelect) if (t.metaKey || t.ctrlKey) (e.hasClass("datagrid-row-selected") ? _791 : _790)(i, o); else if (t.shiftKey) { $(i).datagrid("clearSelections"); for (var t = Math.min(n.lastSelectedIndex || 0, o), s = Math.max(n.lastSelectedIndex || 0, o), l = t; l <= s; l++)_790(i, l) } else $(i).datagrid("clearSelections"), _790(i, o), n.lastSelectedIndex = o; else (e.hasClass("datagrid-row-selected") ? _791 : _790)(i, o); n.onClickRow.apply(i, _70c(i, [o, a])) } } } function _794(t) { var e, i, n, o, r = _785(t.target); r && (e = _778(r), i = $.data(e, "datagrid").options, n = _788(r), o = i.finder.getRow(e, n), (r = $(t.target).closest("td[field]", r)).length && (r = r.attr("field"), i.onDblClickCell.call(e, n, r, o[r])), i.onDblClickRow.apply(e, _70c(e, [n, o]))) } function _798(t) { var e, i, n, o = _785(t.target); o ? (i = _778(o), n = $.data(i, "datagrid").options, o = _788(o), e = n.finder.getRow(i, o), n.onRowContextMenu.call(i, t, o, e)) : (e = _785(t.target, ".datagrid-body")) && (i = _778(e), (n = $.data(i, "datagrid").options).onRowContextMenu.call(i, t, -1, null)) } function _778(t) { return $(t).closest("div.datagrid-view").children(".datagrid-f")[0] } function _785(t, e) { e = $(t).closest(e || "tr.datagrid-row"); if (e.length && e.parent().length) return e } function _788(t) { return t.attr("datagrid-row-index") ? parseInt(t.attr("datagrid-row-index")) : t.attr("node-id") } function _77d(t, e) { var i = $.data(t, "datagrid"), n = i.options; e = e || {}; var o = { sortName: n.sortName, sortOrder: n.sortOrder }; "object" == typeof e && $.extend(o, e); var r = [], a = []; if (o.sortName && (r = o.sortName.split(","), a = o.sortOrder.split(",")), "string" == typeof e) { var s = e; if (!(u = _76a(t, s)).sortable || i.resizing) return; var l = u.order || "asc", c = _709(r, s); 0 <= c ? (e = "asc" == a[c] ? "desc" : "asc", n.multiSort && e == l ? (r.splice(c, 1), a.splice(c, 1)) : a[c] = e) : n.multiSort ? (r.push(s), a.push(l)) : (r = [s], a = [l]), o.sortName = r.join(","), o.sortOrder = a.join(",") } if (0 != n.onBeforeSortColumn.call(t, o.sortName, o.sortOrder)) { $.extend(n, o); var i = i.dc, d = i.header1.add(i.header2); d.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc"); for (var h = 0; h < r.length; h++){ var u = _76a(t, r[h]); d.find("div." + u.cellClass).addClass("datagrid-sort-" + a[h]) } n.remoteSort ? _7a6(t) : _7a7(t, $(t).datagrid("getData")), n.onSortColumn.call(t, n.sortName, n.sortOrder) } } function _7a8(a, s, l) { function t(t) { var e = _7ae(a, t); if (e.length) { var i = _709(e[e.length - 1], s); if (0 <= i) for (var n = 0; n < e.length - 1; n++){ var o = $("#" + e[n][i]), r = parseInt(o.attr("colspan") || 1) + (l || 0); o.attr("colspan", r), r ? o.show() : o.hide() } } } t(!0), t(!1) } function _7b3(c) { var i, t, d = $.data(c, "datagrid"), h = d.options, n = d.dc, u = n.view2.children("div.datagrid-header"), f = u.children("div.datagrid-header-inner"); function e(t) { var e = n.header1.add(n.header2).find(".datagrid-cell-group"); e.length && (e.each(function () { $(this)._outerWidth(t ? $(this).parent().width() : 10) }), t && _722(c)) } n.body2.css("overflow-x", ""), e(), t = _769(c, !(i = !1)).concat(_769(c, !1)), $.map(t, function (t) { var e = _76a(c, t); 0 <= String(e.width || "").indexOf("%") && (0 < (t = $.parser.parseValue("width", e.width, n.view, h.scrollbarSize + (h.rownumbers ? h.rownumberWidth : 0)) - e.deltaWidth) && (e.boxWidth = t, i = !0)) }), i && $(c).datagrid("fixColumnSize"), function () { if (h.fitColumns) { d.leftWidth || (d.leftWidth = 0); for (var t = 0, e = [], i = _769(c, !1), n = 0; n < i.length; n++){ var o = _76a(c, i[n]); !function (t) { if (0 <= String(t.width || "").indexOf("%")) return !1; if (!(t.hidden || t.checkbox || t.auto || t.fixed)) return !0 }(o) || (t += o.width, e.push({ field: o.field, col: o, addingWidth: 0 })) } if (t) { e[e.length - 1].addingWidth -= d.leftWidth, f.show(); var r = u.width() - u.find("table").width() - h.scrollbarSize + d.leftWidth, a = r / t; for (h.showHeader || f.hide(), n = 0; n < e.length; n++){ var s = e[n], l = parseInt(s.col.width * a); s.addingWidth += l, r -= l } for (e[e.length - 1].addingWidth += r, n = 0; n < e.length; n++)0 < (s = e[n]).col.boxWidth + s.addingWidth && (s.col.boxWidth += s.addingWidth, s.col.width += s.addingWidth); d.leftWidth = r, $(c).datagrid("fixColumnSize") } } }(), e(!0), f.show(), u.width() >= u.find("table").width() && n.body2.css("overflow-x", "hidden"), h.showHeader || f.hide() } function _7c5(r, t) { var e = $.data(r, "datagrid"), a = e.options, s = e.dc, l = $('<div class="datagrid-cell" style="position:absolute;left:-9999px"></div>').appendTo("body"); if (t) c(t), $(r).datagrid("fitColumns"); else { for (var i = !1, n = _769(r, !0).concat(_769(r, !1)), o = 0; o < n.length; o++){ t = n[o]; _76a(r, t).auto && (c(t), i = !0) } i && $(r).datagrid("fitColumns") } function c(n) { var o = s.view.find('div.datagrid-header td[field="' + n + '"] div.datagrid-cell'); o.css("width", ""); var t = $(r).datagrid("getColumnOption", n); t.width = void 0, t.boxWidth = void 0, t.auto = !0, $(r).datagrid("fixColumnSize", n); var e = Math.max(i("header"), i("allbody"), i("allfooter")) + 1; function i(t) { var e = 0; return "header" == t ? e = i(o) : a.finder.getTr(r, 0, t).find('td[field="' + n + '"] div.datagrid-cell').each(function () { var t = i($(this)); e < t && (e = t) }), e; function i(t) { return (t.is(":visible") ? t : l.html(t.html()))._outerWidth() } } o._outerWidth(e - 1), t.width = e, t.boxWidth = parseInt(o[0].style.width), t.deltaWidth = e - t.boxWidth, o.css("width", ""), $(r).datagrid("fixColumnSize", n), a.onResizeColumn.call(r, n, t.width) } l.remove() } function _7d1(e, t) { var i = $.data(e, "datagrid"), n = (i.options, i.dc.view.find("table.datagrid-btable,table.datagrid-ftable")); if (n.css("table-layout", "fixed"), t) a(t); else for (var o = _769(e, !0).concat(_769(e, !1)), r = 0; r < o.length; r++)a(o[r]); function a(t) { t = _76a(e, t); t.cellClass && i.ss.set("." + t.cellClass, t.boxWidth ? t.boxWidth + "px" : "auto") } n.css("table-layout", ""), _7d6(e), _733(e), _7d7(e) } function _7d6(r, t) { var e = $.data(r, "datagrid").dc; (t = t || e.view.find("td.datagrid-td-merged")).each(function () { var t = $(this), e = t.attr("colspan") || 1; if (1 < e) { for (var i = _76a(r, t.attr("field")), n = i.boxWidth + i.deltaWidth - 1, o = 1; o < e; o++)t = t.next(), n += (i = _76a(r, t.attr("field"))).boxWidth + i.deltaWidth; $(this).children("div.datagrid-cell")._outerWidth(n) } }) } function _7d7(i) { $.data(i, "datagrid").dc.view.find("div.datagrid-editable").each(function () { var t = $(this), e = t.parent().attr("field"), e = $(i).datagrid("getColumnOption", e); t._outerWidth(e.boxWidth + e.deltaWidth - 1); e = $.data(this, "datagrid.editor"); e.actions.resize && e.actions.resize(e.target, t.width()) }) } function _76a(t, r) { function e(t) { if (t) for (var e = 0; e < t.length; e++)for (var i = t[e], n = 0; n < i.length; n++){ var o = i[n]; if (o.field == r) return o } return null } t = $.data(t, "datagrid").options; return e(t.columns) || e(t.frozenColumns) } function _7ae(t, e) { for (var i, t = $.data(t, "datagrid").options, n = e ? t.frozenColumns : t.columns, r = [], o = (i = 0, $.map(n[0] || [], function (t) { i += t.colspan || 1 }), i), a = 0; a < n.length; a++)r[a] = new Array(o); for (var s = 0; s < n.length; s++)$.map(n[s], function (t) { var e = function (t) { for (var e = 0; e < t.length; e++)if (null == t[e]) return e; return -1 }(r[s]); if (0 <= e) for (var i = t.field || t.id || "", n = 0; n < (t.colspan || 1); n++){ for (var o = 0; o < (t.rowspan || 1); o++)r[s + o][e] = i; e++ } }); return r } function _769(t, e) { e = _7ae(t, e); return e.length ? e[e.length - 1] : e } function _7a7(a, t) { var s, l, e = $.data(a, "datagrid"), i = e.options, n = e.dc; t = i.loadFilter.call(a, t), $.isArray(t) && (t = { total: t.length, rows: t }), t.total = parseInt(t.total), (e.data = t).footer && (e.footer = t.footer), !i.remoteSort && i.sortName && (s = i.sortName.split(","), l = i.sortOrder.split(","), t.rows.sort(function (t, e) { for (var i = 0, n = 0; n < s.length; n++){ var o = s[n], r = l[n]; if (0 != (i = (_76a(a, o).sorter || function (t, e) { return t == e ? 0 : e < t ? 1 : -1 })(t[o], e[o], t, e) * ("asc" == r ? 1 : -1))) return i } return i })), i.view.onBeforeRender && i.view.onBeforeRender.call(i.view, a, t.rows), i.view.render.call(i.view, a, n.body2, !1), i.view.render.call(i.view, a, n.body1, !0), i.showFooter && (i.view.renderFooter.call(i.view, a, n.footer2, !1), i.view.renderFooter.call(i.view, a, n.footer1, !0)), i.view.onAfterRender && i.view.onAfterRender.call(i.view, a), e.ss.clean(); var o = $(a).datagrid("getPager"); !o.length || (e = o.pagination("options")).total != t.total && (o.pagination("refresh", { pageNumber: i.pageNumber, total: t.total }), i.pageNumber != e.pageNumber && 0 < e.pageNumber && (i.pageNumber = e.pageNumber, _7a6(a))), _733(a), n.body2.triggerHandler("scroll"), $(a).datagrid("setSelectionState"), $(a).datagrid("autoSizeColumn"), i.onLoadSuccess.call(a, t) } function _7f4(t) { var e = $.data(t, "datagrid"), n = e.options, i = e.dc; if (i.header1.add(i.header2).find("input[type=checkbox]")._propAttr("checked", !1), n.idField) { var o = !!$.data(t, "treegrid"), r = n.onSelect, i = n.onCheck; n.onSelect = n.onCheck = function () { }; for (var a = n.finder.getRows(t), s = 0; s < a.length; s++){ var l = a[s], c = o ? l[n.idField] : $(t).datagrid("getRowIndex", l[n.idField]); d(e.selectedRows, l) && _790(t, c, !0, !0), d(e.checkedRows, l) && _78d(t, c, !0) } n.onSelect = r, n.onCheck = i } function d(t, e) { for (var i = 0; i < t.length; i++)if (t[i][n.idField] == e[n.idField]) return t[i] = e, 1 } } function _7fc(t, e) { var t = $.data(t, "datagrid"), i = t.options, n = t.data.rows; if ("object" == typeof e) return _709(n, e); for (var o = 0; o < n.length; o++)if (n[o][i.idField] == e) return o; return -1 } function _7ff(t) { var e = $.data(t, "datagrid"), i = e.options; e.data; if (i.idField) return e.selectedRows; var n = []; return i.finder.getTr(t, "", "selected", 2).each(function () { n.push(i.finder.getRow(t, $(this))) }), n } function _802(t) { var e = $.data(t, "datagrid"), i = e.options; if (i.idField) return e.checkedRows; var n = []; return i.finder.getTr(t, "", "checked", 2).each(function () { n.push(i.finder.getRow(t, $(this))) }), n } function _805(t, e) { var i = $.data(t, "datagrid"), n = i.dc, o = i.options, r = o.finder.getTr(t, e); r.length && (r.closest("table").hasClass("datagrid-btable-frozen") || (i = n.view2.children("div.datagrid-header")._outerHeight(), t = n.body2, e = o.scrollbarSize, t[0].offsetHeight && t[0].clientHeight && t[0].offsetHeight <= t[0].clientHeight && (e = 0), o = t.outerHeight(!0) - t.outerHeight(), (o = r.offset().top - n.view2.offset().top - i - o) < 0 ? t.scrollTop(t.scrollTop() + o) : o + r._outerHeight() > t.height() - e && t.scrollTop(t.scrollTop() + o + r._outerHeight() - t.height() + e))) } function _789(t, e) { var i = $.data(t, "datagrid"), n = i.options; n.finder.getTr(t, i.highlightIndex).removeClass("datagrid-row-over"), n.finder.getTr(t, e).addClass("datagrid-row-over"), i.highlightIndex = e } function _790(t, e, i, n) { var o = $.data(t, "datagrid"), r = o.options, a = r.finder.getRow(t, e); a && 0 != r.onBeforeSelect.apply(t, _70c(t, [e, a])) && (r.singleSelect && (_815(t, !0), o.selectedRows = []), !i && r.checkOnSelect && _78d(t, e, !0), r.idField && _70b(o.selectedRows, r.idField, a), r.finder.getTr(t, e).addClass("datagrid-row-selected"), r.onSelect.apply(t, _70c(t, [e, a])), !n && r.scrollOnSelect && _805(t, e)) } function _791(t, e, i) { var n = $.data(t, "datagrid"), o = (n.dc, n.options), r = o.finder.getRow(t, e); r && 0 != o.onBeforeUnselect.apply(t, _70c(t, [e, r])) && (!i && o.checkOnSelect && _78e(t, e, !0), o.finder.getTr(t, e).removeClass("datagrid-row-selected"), o.idField && _70a(n.selectedRows, o.idField, r[o.idField]), o.onUnselect.apply(t, _70c(t, [e, r]))) } function _81a(t, e) { var i = $.data(t, "datagrid").options, n = i.finder.getRows(t), o = $.data(t, "datagrid").selectedRows; if (!e && i.checkOnSelect && _77b(t, !0), i.finder.getTr(t, "", "allbody").addClass("datagrid-row-selected"), i.idField) for (var r = 0; r < n.length; r++)_70b(o, i.idField, n[r]); i.onSelectAll.call(t, n) } function _815(t, e) { var i = $.data(t, "datagrid").options, n = i.finder.getRows(t), o = $.data(t, "datagrid").selectedRows; if (!e && i.checkOnSelect && _77c(t, !0), i.finder.getTr(t, "", "selected").removeClass("datagrid-row-selected"), i.idField) for (var r = 0; r < n.length; r++)_70a(o, i.idField, n[r][i.idField]); i.onUnselectAll.call(t, n) } function _78d(t, e, i) { var n = $.data(t, "datagrid"), o = n.options, r = o.finder.getRow(t, e); r && 0 != o.onBeforeCheck.apply(t, _70c(t, [e, r])) && (o.singleSelect && o.selectOnCheck && (_77c(t, !0), n.checkedRows = []), !i && o.selectOnCheck && _790(t, e, !0), o.finder.getTr(t, e).addClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", !0), o.finder.getTr(t, "", "checked", 2).length == o.finder.getRows(t).length && (i = n.dc).header1.add(i.header2).find("input[type=checkbox]")._propAttr("checked", !0), o.idField && _70b(n.checkedRows, o.idField, r), o.onCheck.apply(t, _70c(t, [e, r]))) } function _78e(t, e, i) { var n = $.data(t, "datagrid"), o = n.options, r = o.finder.getRow(t, e); r && 0 != o.onBeforeUncheck.apply(t, _70c(t, [e, r])) && (!i && o.selectOnCheck && _791(t, e, !0), o.finder.getTr(t, e).removeClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", !1), (i = n.dc).header1.add(i.header2).find("input[type=checkbox]")._propAttr("checked", !1), o.idField && _70a(n.checkedRows, o.idField, r[o.idField]), o.onUncheck.apply(t, _70c(t, [e, r]))) } function _77b(t, e) { var i = $.data(t, "datagrid"), n = i.options, o = n.finder.getRows(t); !e && n.selectOnCheck && _81a(t, !0); var r = i.dc, e = r.header1.add(r.header2).find("input[type=checkbox]"), r = n.finder.getTr(t, "", "allbody").addClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]"); if (e.add(r)._propAttr("checked", !0), n.idField) for (var a = 0; a < o.length; a++)_70b(i.checkedRows, n.idField, o[a]); n.onCheckAll.call(t, o) } function _77c(t, e) { var i = $.data(t, "datagrid"), n = i.options, o = n.finder.getRows(t); !e && n.selectOnCheck && _815(t, !0); var r = i.dc, e = r.header1.add(r.header2).find("input[type=checkbox]"), r = n.finder.getTr(t, "", "checked").removeClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]"); if (e.add(r)._propAttr("checked", !1), n.idField) for (var a = 0; a < o.length; a++)_70a(i.checkedRows, n.idField, o[a][n.idField]); n.onUncheckAll.call(t, o) } function _834(t, e) { var i = $.data(t, "datagrid").options, n = i.finder.getTr(t, e), o = i.finder.getRow(t, e); n.hasClass("datagrid-row-editing") || 0 != i.onBeforeEdit.apply(t, _70c(t, [e, o])) && (n.addClass("datagrid-row-editing"), _837(t, e), _7d7(t), n.find("div.datagrid-editable").each(function () { var t = $(this).parent().attr("field"), e = $.data(this, "datagrid.editor"); e.actions.setValue(e.target, o[t]) }), _839(t, e), i.onBeginEdit.apply(t, _70c(t, [e, o]))) } function _83a(t, e, i) { var n = $.data(t, "datagrid"), o = n.options, r = n.updatedRows, a = n.insertedRows, n = o.finder.getTr(t, e), s = o.finder.getRow(t, e); if (n.hasClass("datagrid-row-editing")) { if (!i) { if (!_839(t, e)) return; var l = !1, c = {}; n.find("div.datagrid-editable").each(function () { var t = $(this).parent().attr("field"), e = $.data(this, "datagrid.editor"), i = $(e.target), i = i.data("textbox") ? i.textbox("textbox") : i; i.is(":focus") && i.triggerHandler("blur"); e = e.actions.getValue(e.target); s[t] !== e && (s[t] = e, l = !0, c[t] = e) }), l && -1 == _709(a, s) && -1 == _709(r, s) && r.push(s), o.onEndEdit.apply(t, _70c(t, [e, s, c])) } n.removeClass("datagrid-row-editing"), _846(t, e), $(t).datagrid("refreshRow", e), i ? o.onCancelEdit.apply(t, _70c(t, [e, s])) : o.onAfterEdit.apply(t, _70c(t, [e, s, c])) } } function _847(t, e) { var e = $.data(t, "datagrid").options.finder.getTr(t, e), i = []; return e.children("td").each(function () { var t = $(this).find("div.datagrid-editable"); t.length && (t = $.data(t[0], "datagrid.editor"), i.push(t)) }), i } function _84b(t, e) { for (var i = _847(t, null != e.index ? e.index : e.id), n = 0; n < i.length; n++)if (i[n].field == e.field) return i[n]; return null } function _837(s, t) { var l = $.data(s, "datagrid").options; l.finder.getTr(s, t).children("td").each(function () { var t, e, i, n, o = $(this).find("div.datagrid-cell"), r = $(this).attr("field"), a = _76a(s, r); a && a.editor && ("string" == typeof a.editor ? t = a.editor : (t = a.editor.type, e = a.editor.options), (i = l.editors[t]) && (n = o.html(), a = o._outerWidth(), o.addClass("datagrid-editable"), o._outerWidth(a), o.html('<table border="0" cellspacing="0" cellpadding="1"><tr><td></td></tr></table>'), o.children("table")._bind("click dblclick contextmenu", function (t) { t.stopPropagation() }), $.data(o[0], "datagrid.editor", { actions: i, target: i.init(o.find("td"), $.extend({ height: l.editorHeight }, e)), field: r, type: t, oldHtml: n }))) }), _733(s, t, !0) } function _846(t, e) { $.data(t, "datagrid").options.finder.getTr(t, e).children("td").each(function () { var t, e = $(this).find("div.datagrid-editable"); e.length && ((t = $.data(e[0], "datagrid.editor")).actions.destroy && t.actions.destroy(t.target), e.html(t.oldHtml), $.removeData(e[0], "datagrid.editor"), e.removeClass("datagrid-editable"), e.css("width", "")) }) } function _839(t, e) { t = $.data(t, "datagrid").options.finder.getTr(t, e); if (!t.hasClass("datagrid-row-editing")) return !0; e = t.find(".validatebox-text"); return e.validatebox("validate"), e.trigger("mouseleave"), 0 == t.find(".validatebox-invalid").length } function _85c(t, e) { var i = $.data(t, "datagrid").insertedRows, n = $.data(t, "datagrid").deletedRows, t = $.data(t, "datagrid").updatedRows; if (e) return "inserted" == e ? i : "deleted" == e ? n : "updated" == e ? t : []; e = []; return e = (e = (e = e.concat(i)).concat(n)).concat(t) } function _862(t, e) { var i = $.data(t, "datagrid"), n = i.options, o = i.data, r = i.insertedRows, a = i.deletedRows; $(t).datagrid("cancelEdit", e); var s = n.finder.getRow(t, e); 0 <= _709(r, s) ? _70a(r, s) : a.push(s), _70a(i.selectedRows, n.idField, s[n.idField]), _70a(i.checkedRows, n.idField, s[n.idField]), n.view.deleteRow.call(n.view, t, e), "auto" == n.height && _733(t), $(t).datagrid("getPager").pagination("refresh", { total: o.total }) } function _868(t, e) { var i = $.data(t, "datagrid").data, n = $.data(t, "datagrid").options.view, o = $.data(t, "datagrid").insertedRows; n.insertRow.call(n, t, e.index, e.row), o.push(e.row), $(t).datagrid("getPager").pagination("refresh", { total: i.total }) } function _86c(t, e) { var i = $.data(t, "datagrid").data, n = $.data(t, "datagrid").options.view, o = $.data(t, "datagrid").insertedRows; n.insertRow.call(n, t, null, e), o.push(e), $(t).datagrid("getPager").pagination("refresh", { total: i.total }) } function _86f(t, e) { var i, n = $.data(t, "datagrid"), o = n.options, r = o.finder.getRow(t, e.index), a = !1; for (i in e.row = e.row || {}, e.row) if (r[i] !== e.row[i]) { a = !0; break } a && (-1 == _709(n.insertedRows, r) && -1 == _709(n.updatedRows, r) && n.updatedRows.push(r), o.view.updateRow.call(o.view, t, e.index, e.row)) } function _875(t) { for (var t = $.data(t, "datagrid"), e = t.data.rows, i = [], n = 0; n < e.length; n++)i.push($.extend({}, e[n])); t.originalRows = i, t.updatedRows = [], t.insertedRows = [], t.deletedRows = [] } function _879(t) { for (var e = !0, i = 0, n = $.data(t, "datagrid").data.rows.length; i < n; i++)_839(t, i) ? $(t).datagrid("endEdit", i) : e = !1; e && _875(t) } function _87b(o) { var t = $.data(o, "datagrid"), n = t.options, e = t.originalRows, i = t.insertedRows, r = t.deletedRows, a = t.selectedRows, s = t.checkedRows, l = t.data; function c(t) { for (var e = [], i = 0; i < t.length; i++)e.push(t[i][n.idField]); return e } function d(t, e) { for (var i = 0; i < t.length; i++){ var n = _7fc(o, t[i]); 0 <= n && ("s" == e ? _790 : _78d)(o, n, !0) } } for (var h = 0; h < l.rows.length; h++)$(o).datagrid("cancelEdit", h); var u = c(a), t = c(s); a.splice(0, a.length), s.splice(0, s.length), l.total += r.length - i.length, l.rows = e, _7a7(o, l), d(u, "s"), d(t, "c"), _875(o) } function _7a6(e, t, i) { var n = $.data(e, "datagrid").options; t && (n.queryParams = t); t = $.extend({}, n.queryParams); n.pagination && $.extend(t, { page: n.pageNumber || 1, rows: n.pageSize }), n.sortName && n.remoteSort && $.extend(t, { sort: n.sortName, order: n.sortOrder }), 0 != n.onBeforeLoad.call(e, t) ? ($(e).datagrid("loading"), 0 == n.loader.call(e, t, function (t) { $(e).datagrid("loaded"), $(e).datagrid("loadData", t), i && i() }, function () { $(e).datagrid("loaded"), n.onLoadError.apply(e, arguments) }) && ($(e).datagrid("loaded"), n.view.setEmptyMsg(e))) : n.view.setEmptyMsg(e) } function _88d(t, e) { var i = $.data(t, "datagrid").options; if (e.type = e.type || "body", e.rowspan = e.rowspan || 1, e.colspan = e.colspan || 1, 1 != e.rowspan || 1 != e.colspan) { var n = i.finder.getTr(t, null != e.index ? e.index : e.id, e.type); if (n.length) { i = n.find('td[field="' + e.field + '"]'); i.attr("rowspan", e.rowspan).attr("colspan", e.colspan), i.addClass("datagrid-td-merged"), r(i.next(), e.colspan - 1); for (var o = 1; o < e.rowspan && (n = n.next()).length; o++)r(n.find('td[field="' + e.field + '"]'), e.colspan); _7d6(t, i) } } function r(t, e) { for (var i = 0; i < e; i++)t.hide(), t = t.next() } } function _896(t) { var e = {}; return $.map(t, function (t) { function n(t) { return null != $.data($(t)[0], o) } var o; e[t] = (o = t, { init: function (t, e) { t = $('<input type="text" class="datagrid-editable-input">').appendTo(t); return t[o] && "text" != o ? t[o](e) : t }, destroy: function (t) { n(t) && $(t)[o]("destroy") }, getValue: function (t) { if (n(t)) { var e = $(t)[o]("options"); return e.multiple ? $(t)[o]("getValues").join(e.separator) : $(t)[o]("getValue") } return $(t).val() }, setValue: function (t, e) { var i; n(t) ? (i = $(t)[o]("options")).multiple ? e ? $(t)[o]("setValues", e.split(i.separator)) : $(t)[o]("clear") : $(t)[o]("setValue", e) : $(t).val(e) }, resize: function (t, e) { n(t) ? $(t)[o]("resize", e) : $(t)._size({ width: e, height: $.fn.datagrid.defaults.editorHeight }) } }) }), e } $.fn.datagrid = function (i, t) { return "string" == typeof i ? $.fn.datagrid.methods[i](this, t) : (i = i || {}, this.each(function () { var t, e = $.data(this, "datagrid"); e ? (t = $.extend(e.options, i), e.options = t) : (t = $.extend({}, $.extend({}, $.fn.datagrid.defaults, { queryParams: {} }), $.fn.datagrid.parseOptions(this), i), $(this).css("width", "").css("height", ""), e = _748(this, t.rownumbers), t.columns || (t.columns = e.columns), t.frozenColumns || (t.frozenColumns = e.frozenColumns), t.columns = $.extend(!0, [], t.columns), t.frozenColumns = $.extend(!0, [], t.frozenColumns), t.view = $.extend({}, t.view), $.data(this, "datagrid", { options: t, panel: e.panel, dc: e.dc, ss: null, selectedRows: [], checkedRows: [], data: { total: 0, rows: [] }, originalRows: [], updatedRows: [], insertedRows: [], deletedRows: [] })), _751(this), _76b(this), _71d(this), t.data ? $(this).datagrid("loadData", t.data) : 0 < (t = $.fn.datagrid.parseData(this)).total ? $(this).datagrid("loadData", t) : $(this).datagrid("autoSizeColumn"), _7a6(this) })) }; var _8a4 = $.extend({}, _896(["text", "textbox", "passwordbox", "filebox", "numberbox", "numberspinner", "combobox", "combotree", "combogrid", "combotreegrid", "datebox", "datetimebox", "timespinner", "datetimespinner"]), { textarea: { init: function (t, e) { t = $('<textarea class="datagrid-editable-input"></textarea>').appendTo(t); return t.css("vertical-align", "middle")._outerHeight(e.height), t }, getValue: function (t) { return $(t).val() }, setValue: function (t, e) { $(t).val(e) }, resize: function (t, e) { $(t)._outerWidth(e) } }, checkbox: { init: function (t, e) { t = $('<input type="checkbox">').appendTo(t); return t.val(e.on), t.attr("offval", e.off), t }, getValue: function (t) { return $(t).is(":checked") ? $(t).val() : $(t).attr("offval") }, setValue: function (t, e) { var i = !1; $(t).val() == e && (i = !0), $(t)._propAttr("checked", i) } }, validatebox: { init: function (t, e) { t = $('<input type="text" class="datagrid-editable-input">').appendTo(t); return t.validatebox(e), t }, destroy: function (t) { $(t).validatebox("destroy") }, getValue: function (t) { return $(t).val() }, setValue: function (t, e) { $(t).val(e) }, resize: function (t, e) { $(t)._outerWidth(e)._outerHeight($.fn.datagrid.defaults.editorHeight) } } }); $.fn.datagrid.methods = { options: function (t) { var e = $.data(t[0], "datagrid").options, t = $.data(t[0], "datagrid").panel.panel("options"); return $.extend(e, { width: t.width, height: t.height, closed: t.closed, collapsed: t.collapsed, minimized: t.minimized, maximized: t.maximized }) }, setSelectionState: function (t) { return t.each(function () { _7f4(this) }) }, createStyleSheet: function (t) { return _70e(t[0]) }, getPanel: function (t) { return $.data(t[0], "datagrid").panel }, getPager: function (t) { return $.data(t[0], "datagrid").panel.children("div.datagrid-pager") }, getColumnFields: function (t, e) { return _769(t[0], e) }, getColumnOption: function (t, e) { return _76a(t[0], e) }, resize: function (t, e) { return t.each(function () { _71d(this, e) }) }, load: function (t, e) { return t.each(function () { var t = $(this).datagrid("options"); "string" == typeof e && (t.url = e, e = null), t.pageNumber = 1, $(this).datagrid("getPager").pagination("refresh", { pageNumber: 1 }), _7a6(this, e) }) }, reload: function (t, e) { return t.each(function () { var t = $(this).datagrid("options"); "string" == typeof e && (t.url = e, e = null), _7a6(this, e) }) }, reloadFooter: function (t, i) { return t.each(function () { var t = $.data(this, "datagrid").options, e = $.data(this, "datagrid").dc; i && ($.data(this, "datagrid").footer = i), t.showFooter && (t.view.renderFooter.call(t.view, this, e.footer2, !1), t.view.renderFooter.call(t.view, this, e.footer1, !0), t.view.onAfterRender && t.view.onAfterRender.call(t.view, this), $(this).datagrid("fixRowHeight")) }) }, loading: function (t) { return t.each(function () { var t, e = $.data(this, "datagrid").options; $(this).datagrid("getPager").pagination("loading"), e.loadMsg && ((t = $(this).datagrid("getPanel")).children("div.datagrid-mask").length || ($('<div class="datagrid-mask" style="display:block"></div>').appendTo(t), (t = $('<div class="datagrid-mask-msg" style="display:block;left:50%"></div>').html(e.loadMsg).appendTo(t))._outerHeight(40), t.css({ marginLeft: -t.outerWidth() / 2, lineHeight: t.height() + "px" }))) }) }, loaded: function (t) { return t.each(function () { $(this).datagrid("getPager").pagination("loaded"); var t = $(this).datagrid("getPanel"); t.children("div.datagrid-mask-msg").remove(), t.children("div.datagrid-mask").remove() }) }, fitColumns: function (t) { return t.each(function () { _7b3(this) }) }, fixColumnSize: function (t, e) { return t.each(function () { _7d1(this, e) }) }, fixRowHeight: function (t, e) { return t.each(function () { _733(this, e) }) }, freezeRow: function (t, e) { return t.each(function () { _741(this, e) }) }, autoSizeColumn: function (t, e) { return t.each(function () { _7c5(this, e) }) }, loadData: function (t, e) { return t.each(function () { _7a7(this, e), _875(this) }) }, getData: function (t) { return $.data(t[0], "datagrid").data }, getRows: function (t) { return $.data(t[0], "datagrid").data.rows }, getFooterRows: function (t) { return $.data(t[0], "datagrid").footer }, getRowIndex: function (t, e) { return _7fc(t[0], e) }, getChecked: function (t) { return _802(t[0]) }, getSelected: function (t) { t = _7ff(t[0]); return 0 < t.length ? t[0] : null }, getSelections: function (t) { return _7ff(t[0]) }, clearSelections: function (t) { return t.each(function () { var t = $.data(this, "datagrid"), e = t.selectedRows, i = t.checkedRows; e.splice(0, e.length), _815(this), t.options.checkOnSelect && i.splice(0, i.length) }) }, clearChecked: function (t) { return t.each(function () { var t = $.data(this, "datagrid"), e = t.selectedRows, i = t.checkedRows; i.splice(0, i.length), _77c(this), t.options.selectOnCheck && e.splice(0, e.length) }) }, scrollTo: function (t, e) { return t.each(function () { _805(this, e) }) }, highlightRow: function (t, e) { return t.each(function () { _789(this, e), _805(this, e) }) }, selectAll: function (t) { return t.each(function () { _81a(this) }) }, unselectAll: function (t) { return t.each(function () { _815(this) }) }, selectRow: function (t, e) { return t.each(function () { _790(this, e) }) }, selectRecord: function (t, e) { return t.each(function () { var t; !$.data(this, "datagrid").options.idField || 0 <= (t = _7fc(this, e)) && $(this).datagrid("selectRow", t) }) }, unselectRow: function (t, e) { return t.each(function () { _791(this, e) }) }, checkRow: function (t, e) { return t.each(function () { _78d(this, e) }) }, uncheckRow: function (t, e) { return t.each(function () { _78e(this, e) }) }, checkAll: function (t) { return t.each(function () { _77b(this) }) }, uncheckAll: function (t) { return t.each(function () { _77c(this) }) }, beginEdit: function (t, e) { return t.each(function () { _834(this, e) }) }, endEdit: function (t, e) { return t.each(function () { _83a(this, e, !1) }) }, cancelEdit: function (t, e) { return t.each(function () { _83a(this, e, !0) }) }, getEditors: function (t, e) { return _847(t[0], e) }, getEditor: function (t, e) { return _84b(t[0], e) }, refreshRow: function (t, e) { return t.each(function () { var t = $.data(this, "datagrid").options; t.view.refreshRow.call(t.view, this, e) }) }, validateRow: function (t, e) { return _839(t[0], e) }, updateRow: function (t, e) { return t.each(function () { _86f(this, e) }) }, appendRow: function (t, e) { return t.each(function () { _86c(this, e) }) }, insertRow: function (t, e) { return t.each(function () { _868(this, e) }) }, deleteRow: function (t, e) { return t.each(function () { _862(this, e) }) }, getChanges: function (t, e) { return _85c(t[0], e) }, acceptChanges: function (t) { return t.each(function () { _879(this) }) }, rejectChanges: function (t) { return t.each(function () { _87b(this) }) }, mergeCells: function (t, e) { return t.each(function () { _88d(this, e) }) }, showColumn: function (t, e) { return t.each(function () { var t = $(this).datagrid("getColumnOption", e); t.hidden && (t.hidden = !1, $(this).datagrid("getPanel").find('td[field="' + e + '"]').show(), _7a8(this, e, 1), $(this).datagrid("fitColumns")) }) }, hideColumn: function (t, e) { return t.each(function () { var t = $(this).datagrid("getColumnOption", e); t.hidden || (t.hidden = !0, $(this).datagrid("getPanel").find('td[field="' + e + '"]').hide(), _7a8(this, e, -1), $(this).datagrid("fitColumns")) }) }, sort: function (t, e) { return t.each(function () { _77d(this, e) }) }, gotoPage: function (t, n) { return t.each(function () { var t, e, i = this; "object" == typeof n ? (t = n.page, e = n.callback) : t = n, $(i).datagrid("options").pageNumber = t, $(i).datagrid("getPager").pagination("refresh", { pageNumber: t }), _7a6(i, null, function () { e && e.call(i, t) }) }) } }, $.fn.datagrid.parseOptions = function (_8ea) { var t = $(_8ea); return $.extend({}, $.fn.panel.parseOptions(_8ea), $.parser.parseOptions(_8ea, ["url", "toolbar", "idField", "sortName", "sortOrder", "pagePosition", "resizeHandle", { sharedStyleSheet: "boolean", fitColumns: "boolean", autoRowHeight: "boolean", striped: "boolean", nowrap: "boolean" }, { rownumbers: "boolean", singleSelect: "boolean", ctrlSelect: "boolean", checkOnSelect: "boolean", selectOnCheck: "boolean" }, { pagination: "boolean", pageSize: "number", pageNumber: "number" }, { multiSort: "boolean", remoteSort: "boolean", showHeader: "boolean", showFooter: "boolean" }, { scrollbarSize: "number", scrollOnSelect: "boolean" }]), { pageList: t.attr("pageList") ? eval(t.attr("pageList")) : void 0, loadMsg: null != t.attr("loadMsg") ? t.attr("loadMsg") : void 0, rowStyler: t.attr("rowStyler") ? eval(t.attr("rowStyler")) : void 0 }) }, $.fn.datagrid.parseData = function (t) { var t = $(t), i = { total: 0, rows: [] }, n = t.datagrid("getColumnFields", !0).concat(t.datagrid("getColumnFields", !1)); return t.find("tbody tr").each(function () { i.total++; var t = {}; $.extend(t, $.parser.parseOptions(this, ["iconCls", "state"])); for (var e = 0; e < n.length; e++)t[n[e]] = $(this).find("td:eq(" + e + ")").html(); i.rows.push(t) }), i }; var _8ed = { render: function (t, e, i) { var n = $(t).datagrid("getRows"); $(e).empty().html(this.renderTable(t, 0, n, i)) }, renderFooter: function (t, e, i) { $.data(t, "datagrid").options; for (var n = $.data(t, "datagrid").footer || [], o = $(t).datagrid("getColumnFields", i), r = ['<table class="datagrid-ftable" cellspacing="0" cellpadding="0" border="0"><tbody>'], a = 0; a < n.length; a++)r.push('<tr class="datagrid-row" datagrid-row-index="' + a + '">'), r.push(this.renderRow.call(this, t, o, i, a, n[a])), r.push("</tr>"); r.push("</tbody></table>"), $(e).html(r.join("")) }, renderTable: function (t, e, i, n) { var o = $.data(t, "datagrid"), r = o.options; if (n && !(r.rownumbers || r.frozenColumns && r.frozenColumns.length)) return ""; for (var a = $(t).datagrid("getColumnFields", n), s = ['<table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0"><tbody>'], l = 0; l < i.length; l++){ var c = i[l], d = r.rowStyler ? r.rowStyler.call(t, e, c) : "", h = this.getStyleValue(d), u = 'class="datagrid-row ' + (e % 2 && r.striped ? "datagrid-row-alt " : " ") + h.c + '"', d = h.s ? 'style="' + h.s + '"' : "", h = o.rowIdPrefix + "-" + (n ? 1 : 2) + "-" + e; s.push('<tr id="' + h + '" datagrid-row-index="' + e + '" ' + u + " " + d + ">"), s.push(this.renderRow.call(this, t, a, n, e, c)), s.push("</tr>"), e++ } return s.push("</tbody></table>"), s.join("") }, renderRow: function (t, e, i, n, o) { var r = $.data(t, "datagrid").options, a = []; i && r.rownumbers && (i = n + 1, r.pagination && (i += (r.pageNumber - 1) * r.pageSize), a.push('<td class="datagrid-td-rownumber"><div class="datagrid-cell-rownumber">' + i + "</div></td>")); for (var s = 0; s < e.length; s++){ var l, c, d, h = e[s], u = $(t).datagrid("getColumnOption", h); u && (l = o[h], c = u.styler && u.styler.call(t, l, o, n) || "", c = (d = this.getStyleValue(c)).c ? 'class="' + d.c + '"' : "", d = u.hidden ? 'style="display:none;' + d.s + '"' : d.s ? 'style="' + d.s + '"' : "", a.push('<td field="' + h + '" ' + c + " " + d + ">"), d = "", u.checkbox || (u.align && (d += "text-align:" + u.align + ";"), r.nowrap ? r.autoRowHeight && (d += "height:auto;") : d += "white-space:normal;height:auto;"), a.push('<div style="' + d + '" '), a.push(u.checkbox ? 'class="datagrid-cell-check"' : 'class="datagrid-cell ' + u.cellClass + '"'), a.push(">"), u.checkbox ? (a.push('<input type="checkbox" ' + (o.checked ? 'checked="checked"' : "")), a.push(' name="' + h + '" value="' + (null != l ? l : "") + '">')) : u.formatter ? a.push(u.formatter(l, o, n)) : a.push(l), a.push("</div>"), a.push("</td>")) } return a.join("") }, getStyleValue: function (t) { var e = "", i = ""; return "string" == typeof t ? i = t : t && (e = t.class || "", i = t.style || ""), { c: e, s: i } }, refreshRow: function (t, e) { this.updateRow.call(this, t, e, {}) }, updateRow: function (o, r, t) { var a = $.data(o, "datagrid").options, s = a.finder.getRow(o, r); $.extend(s, t); var t = function (t) { t = a.rowStyler ? a.rowStyler.call(o, t, s) : ""; return this.getStyleValue(t) }.call(this, r), l = t.s, c = "datagrid-row " + (r % 2 && a.striped ? "datagrid-row-alt " : " ") + t.c; function e(t) { var e, i, n = a.finder.getTr(o, r, "body", t ? 1 : 2); n.length && (e = $(o).datagrid("getColumnFields", t), i = n.find("div.datagrid-cell-check input[type=checkbox]").is(":checked"), n.html(this.renderRow.call(this, o, e, t, r, s)), t = (n.hasClass("datagrid-row-checked") ? " datagrid-row-checked" : "") + (n.hasClass("datagrid-row-selected") ? " datagrid-row-selected" : ""), n.attr("style", l).attr("class", c + t), i && n.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", !0)) } e.call(this, !0), e.call(this, !1), $(o).datagrid("fixRowHeight", r) }, insertRow: function (r, a, t) { var s = $.data(r, "datagrid"), l = s.options, n = s.dc, c = s.data; function e(t) { for (var e = t ? 1 : 2, i = c.rows.length - 1; a <= i; i--){ var n, o = l.finder.getTr(r, i, "body", e); o.attr("datagrid-row-index", i + 1), o.attr("id", s.rowIdPrefix + "-" + e + "-" + (i + 1)), t && l.rownumbers && (n = i + 2, l.pagination && (n += (l.pageNumber - 1) * l.pageSize), o.find("div.datagrid-cell-rownumber").html(n)), l.striped && o.removeClass("datagrid-row-alt").addClass((i + 1) % 2 ? "datagrid-row-alt" : "") } } function i(t) { var e = t ? 1 : 2, i = ($(r).datagrid("getColumnFields", t), '<tr id="' + (s.rowIdPrefix + "-" + e + "-" + a) + '" class="datagrid-row" datagrid-row-index="' + a + '"></tr>'); a >= c.rows.length ? c.rows.length ? l.finder.getTr(r, "", "last", e).after(i) : (t ? n.body1 : n.body2).html('<table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0"><tbody>' + i + "</tbody></table>") : l.finder.getTr(r, a + 1, "body", e).before(i) } null != a && null != a || (a = c.rows.length), a > c.rows.length && (a = c.rows.length), e.call(this, !0), e.call(this, !1), i.call(this, !0), i.call(this, !1), c.total += 1, c.rows.splice(a, 0, t), this.setEmptyMsg(r), this.refreshRow.call(this, r, a) }, deleteRow: function (r, a) { var s = $.data(r, "datagrid"), l = s.options, c = s.data; function t(t) { for (var e = t ? 1 : 2, i = a + 1; i < c.rows.length; i++){ var n, o = l.finder.getTr(r, i, "body", e); o.attr("datagrid-row-index", i - 1), o.attr("id", s.rowIdPrefix + "-" + e + "-" + (i - 1)), t && l.rownumbers && (n = i, l.pagination && (n += (l.pageNumber - 1) * l.pageSize), o.find("div.datagrid-cell-rownumber").html(n)), l.striped && o.removeClass("datagrid-row-alt").addClass((i - 1) % 2 ? "datagrid-row-alt" : "") } } l.finder.getTr(r, a).remove(), t.call(this, !0), t.call(this, !1), --c.total, c.rows.splice(a, 1), this.setEmptyMsg(r) }, onBeforeRender: function (t, e) { }, onAfterRender: function (t) { $.data(t, "datagrid").options.showFooter && $(t).datagrid("getPanel").find("div.datagrid-footer").find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility", "hidden"), this.setEmptyMsg(t) }, setEmptyMsg: function (t) { var e = $.data(t, "datagrid"), i = e.options, n = 0 == i.finder.getRows(t).length; n && this.renderEmptyRow(t), i.emptyMsg && (e.dc.view.children(".datagrid-empty").remove(), n && (n = e.dc.header2.parent().outerHeight(), $('<div class="datagrid-empty"></div>').appendTo(e.dc.view).html(i.emptyMsg).css("top", n + "px"))) }, renderEmptyRow: function (e) { var t = $(e).datagrid("options"), i = $.map($(e).datagrid("getColumnFields"), function (t) { return $(e).datagrid("getColumnOption", t) }); $.map(i, function (t) { t.formatter1 = t.formatter, t.styler1 = t.styler, t.formatter = t.styler = void 0 }); var n = t.rowStyler; t.rowStyler = function () { }; var o = $.data(e, "datagrid").dc.body2; o.html(this.renderTable(e, 0, [{}], !1)), o.find("tbody *").css({ height: 1, borderColor: "transparent", background: "transparent" }); o = o.find(".datagrid-row"); o.removeClass("datagrid-row").removeAttr("datagrid-row-index"), o.find(".datagrid-cell,.datagrid-cell-check").empty(), $.map(i, function (t) { t.formatter = t.formatter1, t.styler = t.styler1, t.formatter1 = t.styler1 = void 0 }), t.rowStyler = n } }; $.fn.datagrid.defaults = $.extend({}, $.fn.panel.defaults, { sharedStyleSheet: !1, frozenColumns: void 0, columns: void 0, fitColumns: !1, resizeHandle: "right", resizeEdge: 5, autoRowHeight: !0, toolbar: null, striped: !1, method: "post", nowrap: !0, idField: null, url: null, data: null, loadMsg: "Processing, please wait ...", emptyMsg: "", rownumbers: !1, singleSelect: !1, ctrlSelect: !1, selectOnCheck: !0, checkOnSelect: !0, pagination: !1, pagePosition: "bottom", pageNumber: 1, pageSize: 10, pageList: [10, 20, 30, 40, 50], queryParams: {}, sortName: null, sortOrder: "asc", multiSort: !1, remoteSort: !0, showHeader: !0, showFooter: !1, scrollOnSelect: !0, scrollbarSize: 18, rownumberWidth: 30, editorHeight: 31, headerEvents: { mouseover: _775(!0), mouseout: _775(!1), click: _779, dblclick: _77e, contextmenu: _781 }, rowEvents: { mouseover: _783(!0), mouseout: _783(!1), click: _78a, dblclick: _794, contextmenu: _798 }, rowStyler: function (t, e) { }, loader: function (t, e, i) { var n = $(this).datagrid("options"); if (!n.url) return !1; $.ajax({ type: n.method, url: n.url, data: t, dataType: "json", success: function (t) { e(t) }, error: function () { i.apply(this, arguments) } }) }, loadFilter: function (t) { return t }, editors: _8a4, finder: { getTr: function (t, e, i, n) { i = i || "body", n = n || 0; var o = $.data(t, "datagrid"), r = o.dc, a = o.options; if (0 == n) { var s = a.finder.getTr(t, e, i, 1), t = a.finder.getTr(t, e, i, 2); return s.add(t) } if ("body" != i) return "footer" == i ? (1 == n ? r.footer1 : r.footer2).find(">table>tbody>tr[datagrid-row-index=" + e + "]") : "selected" == i ? (1 == n ? r.body1 : r.body2).find(">table>tbody>tr.datagrid-row-selected") : "highlight" == i ? (1 == n ? r.body1 : r.body2).find(">table>tbody>tr.datagrid-row-over") : "checked" == i ? (1 == n ? r.body1 : r.body2).find(">table>tbody>tr.datagrid-row-checked") : "editing" == i ? (1 == n ? r.body1 : r.body2).find(">table>tbody>tr.datagrid-row-editing") : "last" == i ? (1 == n ? r.body1 : r.body2).find(">table>tbody>tr[datagrid-row-index]:last") : "allbody" == i ? (1 == n ? r.body1 : r.body2).find(">table>tbody>tr[datagrid-row-index]") : "allfooter" == i ? (1 == n ? r.footer1 : r.footer2).find(">table>tbody>tr[datagrid-row-index]") : void 0; o = $("#" + o.rowIdPrefix + "-" + n + "-" + e); return o.length || (o = (1 == n ? r.body1 : r.body2).find(">table>tbody>tr[datagrid-row-index=" + e + "]")), o }, getRow: function (t, e) { e = "object" == typeof e ? e.attr("datagrid-row-index") : e; return $.data(t, "datagrid").data.rows[parseInt(e)] }, getRows: function (t) { return $(t).datagrid("getRows") } }, view: _8ed, onBeforeLoad: function (t) { }, onLoadSuccess: function () { }, onLoadError: function () { }, onClickRow: function (t, e) { }, onDblClickRow: function (t, e) { }, onClickCell: function (t, e, i) { }, onDblClickCell: function (t, e, i) { }, onBeforeSortColumn: function (t, e) { }, onSortColumn: function (t, e) { }, onResizeColumn: function (t, e) { }, onBeforeSelect: function (t, e) { }, onSelect: function (t, e) { }, onBeforeUnselect: function (t, e) { }, onUnselect: function (t, e) { }, onSelectAll: function (t) { }, onUnselectAll: function (t) { }, onBeforeCheck: function (t, e) { }, onCheck: function (t, e) { }, onBeforeUncheck: function (t, e) { }, onUncheck: function (t, e) { }, onCheckAll: function (t) { }, onUncheckAll: function (t) { }, onBeforeEdit: function (t, e) { }, onBeginEdit: function (t, e) { }, onEndEdit: function (t, e, i) { }, onAfterEdit: function (t, e, i) { }, onCancelEdit: function (t, e) { }, onHeaderContextMenu: function (t, e) { }, onRowContextMenu: function (t, e, i) { } }) }(jQuery), function (b) { var a; function s(t) { var e, i = b(t); i.length && ((e = b.data(t, "propertygrid").options).finder.getTr(t, null, "editing").each(function () { var t = parseInt(b(this).attr("datagrid-row-index")); i.datagrid("validateRow", t) ? i.datagrid("endEdit", t) : i.datagrid("cancelEdit", t) }), e.editIndex = void 0) } b(document)._unbind(".propertygrid")._bind("mousedown.propertygrid", function (t) { b(t.target).closest("div.datagrid-view,div.combo-panel").length || (s(a), a = void 0) }), b.fn.propertygrid = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = b.data(this, "propertygrid"); t ? b.extend(t.options, e) : ((t = b.extend({}, b.fn.propertygrid.defaults, b.fn.propertygrid.parseOptions(this), e)).frozenColumns = b.extend(!0, [], t.frozenColumns), t.columns = b.extend(!0, [], t.columns), b.data(this, "propertygrid", { options: t })), function (o) { b.data(o, "propertygrid"); var r = b.data(o, "propertygrid").options; b(o).datagrid(b.extend({}, r, { cls: "propertygrid", view: r.showGroup ? r.groupView : r.view, onBeforeEdit: function (t, e) { if (0 == r.onBeforeEdit.call(o, t, e)) return !1; var i = b(this), e = i.datagrid("getRows")[t]; i.datagrid("getColumnOption", "value").editor = e.editor }, onClickCell: function (t, e, i) { var n; a != this && (s(a), a = this), r.editIndex != t && (s(a), b(this).datagrid("beginEdit", t), (n = (n = b(this).datagrid("getEditor", { index: t, field: e })) || b(this).datagrid("getEditor", { index: t, field: "value" })) && (((n = b(n.target)).data("textbox") ? n.textbox("textbox") : n).focus(), r.editIndex = t)), r.onClickCell.call(o, t, e, i) }, loadFilter: function (t) { return s(this), r.loadFilter.call(this, t) } })) }(this) }); var i = b.fn.propertygrid.methods[e]; return i ? i(this, t) : this.datagrid(e, t) }, b.fn.propertygrid.methods = { options: function (t) { return b.data(t[0], "propertygrid").options } }, b.fn.propertygrid.parseOptions = function (t) { return b.extend({}, b.fn.datagrid.parseOptions(t), b.parser.parseOptions(t, [{ showGroup: "boolean" }])) }; var t = b.extend({}, b.fn.datagrid.defaults.view, { render: function (t, e, i) { for (var n = [], o = this.groups, r = 0; r < o.length; r++)n.push(this.renderGroup.call(this, t, r, o[r], i)); b(e).html(n.join("")) }, renderGroup: function (t, e, i, n) { var o = b.data(t, "datagrid"), r = o.options, a = b(t).datagrid("getColumnFields", n), s = r.frozenColumns && r.frozenColumns.length; if (n && !r.rownumbers && !s) return ""; var l = [], c = function (t, e) { var i = "", n = ""; "string" == typeof t ? n = t : t && (i = t.class || "", n = t.style || ""); return 'class="' + e + (i ? " " + i : "") + '" style="' + n + '"' }(u = r.groupStyler.call(t, i.value, i.rows), "datagrid-group"); l.push("<div group-index=" + e + " " + c + ">"), (n && (r.rownumbers || r.frozenColumns.length) || !n && !r.rownumbers && !r.frozenColumns.length) && (l.push('<span class="datagrid-group-expander">'), l.push('<span class="datagrid-row-expander datagrid-row-collapse">&nbsp;</span>'), l.push("</span>")), (n && s || !n) && (l.push('<span class="datagrid-group-title">'), l.push(r.groupFormatter.call(t, i.value, i.rows)), l.push("</span>")), l.push("</div>"), l.push('<table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0"><tbody>'); for (var d = i.startIndex, h = 0; h < i.rows.length; h++){ var u, f = "", p = ""; "string" == typeof (u = r.rowStyler ? r.rowStyler.call(t, d, i.rows[h]) : "") ? p = u : u && (f = u.class || "", p = u.style || ""); var g = 'class="datagrid-row ' + (d % 2 && r.striped ? "datagrid-row-alt " : " ") + f + '"', f = p ? 'style="' + p + '"' : "", p = o.rowIdPrefix + "-" + (n ? 1 : 2) + "-" + d; l.push('<tr id="' + p + '" datagrid-row-index="' + d + '" ' + g + " " + f + ">"), l.push(this.renderRow.call(this, t, a, n, d, i.rows[h])), l.push("</tr>"), d++ } return l.push("</tbody></table>"), l.join("") }, bindEvents: function (n) { var t = b.data(n, "datagrid").dc, t = t.body1.add(t.body2), o = (b.data(t[0], "events") || b._data(t[0], "events")).click[0].handler; t._unbind("click")._bind("click", function (t) { var e, i = b(t.target).closest("span.datagrid-row-expander"); i.length ? (e = i.closest("div.datagrid-group").attr("group-index"), i.hasClass("datagrid-row-collapse") ? b(n).datagrid("collapseGroup", e) : b(n).datagrid("expandGroup", e)) : o(t), t.stopPropagation() }) }, onBeforeRender: function (t, e) { var i = b.data(t, "datagrid"), n = i.options; b("#datagrid-group-style").length || b("head").append('<style id="datagrid-group-style">.datagrid-group{height:' + n.groupHeight + "px;overflow:hidden;font-weight:bold;border-bottom:1px solid #ccc;white-space:nowrap;word-break:normal;}.datagrid-group-title,.datagrid-group-expander{display:inline-block;vertical-align:bottom;height:100%;line-height:" + n.groupHeight + "px;padding:0 4px;}.datagrid-group-title{position:relative;}.datagrid-group-expander{width:" + n.expanderWidth + "px;text-align:center;padding:0}.datagrid-group-expander .datagrid-row-expander{margin:" + Math.floor((n.groupHeight - 16) / 2) + "px 0;display:inline-block;width:16px;height:16px;cursor:pointer}</style>"); for (var o = [], r = 0; r < e.length; r++){ var a = e[r]; (s = function (t) { for (var e = 0; e < o.length; e++){ var i = o[e]; if (i.value == t) return i } return null }(a[n.groupField])) ? s.rows.push(a) : (s = { value: a[n.groupField], rows: [a] }, o.push(s)) } for (var s, l = 0, c = [], r = 0; r < o.length; r++)(s = o[r]).startIndex = l, l += s.rows.length, c = c.concat(s.rows); i.data.rows = c, this.groups = o; var d = this; setTimeout(function () { d.bindEvents(t) }, 0) }, onAfterRender: function (i) { b.fn.datagrid.defaults.view.onAfterRender.call(this, i); var n = this, o = b.data(i, "datagrid"), t = o.options; o.onResizeColumn || (o.onResizeColumn = t.onResizeColumn), o.onResize || (o.onResize = t.onResize), t.onResizeColumn = function (t, e) { n.resizeGroup(i), o.onResizeColumn.call(i, t, e) }, t.onResize = function (t, e) { n.resizeGroup(i), o.onResize.call(b(i).datagrid("getPanel")[0], t, e) }, n.resizeGroup(i) } }); b.extend(b.fn.datagrid.methods, { groups: function (t) { return t.datagrid("options").view.groups }, expandGroup: function (t, n) { return t.each(function () { var t = b(this).datagrid("options"), e = b.data(this, "datagrid").dc.view.find(null != n ? 'div.datagrid-group[group-index="' + n + '"]' : "div.datagrid-group"), i = e.find("span.datagrid-row-expander"); i.hasClass("datagrid-row-expand") && (i.removeClass("datagrid-row-expand").addClass("datagrid-row-collapse"), e.next("table").show()), b(this).datagrid("fixRowHeight"), t.onExpandGroup && t.onExpandGroup.call(this, n) }) }, collapseGroup: function (t, n) { return t.each(function () { var t = b(this).datagrid("options"), e = b.data(this, "datagrid").dc.view.find(null != n ? 'div.datagrid-group[group-index="' + n + '"]' : "div.datagrid-group"), i = e.find("span.datagrid-row-expander"); i.hasClass("datagrid-row-collapse") && (i.removeClass("datagrid-row-collapse").addClass("datagrid-row-expand"), e.next("table").hide()), b(this).datagrid("fixRowHeight"), t.onCollapseGroup && t.onCollapseGroup.call(this, n) }) }, scrollToGroup: function (t, r) { return t.each(function () { var t, e, i, n = b.data(this, "datagrid").dc, o = n.body2.children('div.datagrid-group[group-index="' + r + '"]'); o.length && (t = o.outerHeight(), e = n.view2.children("div.datagrid-header")._outerHeight(), i = n.body2.outerHeight(!0) - n.body2.outerHeight(), (i = o.position().top - e - i) < 0 ? n.body2.scrollTop(n.body2.scrollTop() + i) : i + t > n.body2.height() - 18 && n.body2.scrollTop(n.body2.scrollTop() + i + t - n.body2.height() + 18)) }) } }), b.extend(t, { refreshGroupTitle: function (t, e) { var i = b.data(t, "datagrid"), n = i.options, o = i.dc, i = this.groups[e]; o.body1.add(o.body2).children("div.datagrid-group[group-index=" + e + "]").find("span.datagrid-group-title").html(n.groupFormatter.call(t, i.value, i.rows)) }, resizeGroup: function (t, e) { var i = b.data(t, "datagrid"), n = i.dc, o = n.header2.find("table").find("tr.datagrid-filter-row").hide(), t = n.body2.children("table.datagrid-btable:first").width(); (e = null == e ? n.body2.children("div.datagrid-group") : n.body2.children("div.datagrid-group[group-index=" + e + "]"))._outerWidth(t); t = i.options; t.frozenColumns && t.frozenColumns.length && (i = n.view1.width() - t.expanderWidth, n = "rtl" == n.view1.css("direction").toLowerCase(), e.find(".datagrid-group-title").css(n ? "right" : "left", -i + "px")), o.length && t.showFilterBar && o.show() }, insertRow: function (n, t, e) { var i, o = b.data(n, "datagrid"), r = o.options, a = o.dc, s = null; if (o.data.rows.length) { for (var l = 0; l < this.groups.length; l++)if (this.groups[l].value == e[r.groupField]) { s = this.groups[l], i = l; break } s ? (null != t && null != t || (t = o.data.rows.length), t < s.startIndex ? t = s.startIndex : t > s.startIndex + s.rows.length && (t = s.startIndex + s.rows.length), b.fn.datagrid.defaults.view.insertRow.call(this, n, t, e), t >= s.startIndex + s.rows.length && (c(t, !0), c(t, !1)), s.rows.splice(t - s.startIndex, 0, e)) : (s = { value: e[r.groupField], rows: [e], startIndex: o.data.rows.length }, i = this.groups.length, a.body1.append(this.renderGroup.call(this, n, i, s, !0)), a.body2.append(this.renderGroup.call(this, n, i, s, !1)), this.groups.push(s), o.data.rows.push(e)), this.setGroupIndex(n), this.refreshGroupTitle(n, i), this.resizeGroup(n) } else b(n).datagrid("loadData", [e]); function c(t, e) { var i = e ? 1 : 2, e = r.finder.getTr(n, t - 1, "body", i); r.finder.getTr(n, t, "body", i).insertAfter(e) } }, updateRow: function (t, e, i) { var n = b.data(t, "datagrid").options; b.fn.datagrid.defaults.view.updateRow.call(this, t, e, i); e = n.finder.getTr(t, e, "body", 2).closest("table.datagrid-btable"), e = parseInt(e.prev().attr("group-index")); this.refreshGroupTitle(t, e) }, deleteRow: function (t, e) { var i = b.data(t, "datagrid"), n = i.options, i = i.dc, o = i.body1.add(i.body2), i = n.finder.getTr(t, e, "body", 2).closest("table.datagrid-btable"), n = parseInt(i.prev().attr("group-index")); b.fn.datagrid.defaults.view.deleteRow.call(this, t, e); i = this.groups[n]; if (1 < i.rows.length) i.rows.splice(e - i.startIndex, 1), this.refreshGroupTitle(t, n); else { o.children("div.datagrid-group[group-index=" + n + "]").remove(); for (var r = n + 1; r < this.groups.length; r++)o.children("div.datagrid-group[group-index=" + r + "]").attr("group-index", r - 1); this.groups.splice(n, 1) } this.setGroupIndex(t) }, setGroupIndex: function (t) { for (var e = 0, i = 0; i < this.groups.length; i++){ var n = this.groups[i]; n.startIndex = e, e += n.rows.length } } }), b.fn.propertygrid.defaults = b.extend({}, b.fn.datagrid.defaults, { groupHeight: 28, expanderWidth: 20, singleSelect: !0, remoteSort: !1, fitColumns: !0, loadMsg: "", frozenColumns: [[{ field: "f", width: 20, resizable: !1 }]], columns: [[{ field: "name", title: "Name", width: 100, sortable: !0 }, { field: "value", title: "Value", width: 100, resizable: !1 }]], showGroup: !1, groupView: t, groupField: "group", groupStyler: function (t, e) { return "" }, groupFormatter: function (t, e) { return t } }) }(jQuery), function (m) { function h(t, e) { var i, n, o, r = m.data(t, "datagrid").options, a = m.data(t, "datagrid").dc; if (!a.body1.is(":empty") && (!r.nowrap || r.autoRowHeight) && null != e) for (var s = v(t, e), l = 0; l < s.length; l++)i = s[l][r.idField], o = n = void 0, n = r.finder.getTr(t, i, "body", 1), o = r.finder.getTr(t, i, "body", 2), n.css("height", ""), o.css("height", ""), i = Math.max(n.height(), o.height()), n.css("height", i), !void o.css("height", i); m(t).datagrid("fixRowHeight", e) } function u(t) { var e = m.data(t, "datagrid").dc; m.data(t, "treegrid").options.rownumbers && e.body1.find("div.datagrid-cell-rownumber").each(function (t) { m(this).html(t + 1) }) } function t(i) { return function (t) { m.fn.datagrid.defaults.rowEvents[i ? "mouseover" : "mouseout"](t); var e = m(t.target), t = i ? "addClass" : "removeClass"; e.hasClass("tree-hit") && (e.hasClass("tree-expanded") ? e[t]("tree-expanded-hover") : e[t]("tree-collapsed-hover")) } } function f(t, e, i, n) { var o = m.data(t, "treegrid"), r = (o.checkedRows, o.options); if (r.checkbox) { o = x(t, e); if (o.checkState) { var a, s, e = r.finder.getTr(t, e).find(".tree-checkbox"); if (null == i && (i = !e.hasClass("tree-checkbox1") && (!!e.hasClass("tree-checkbox0") || (null == o._checked && (o._checked = e.hasClass("tree-checkbox1")), !o._checked))), o._checked = i) { if (e.hasClass("tree-checkbox1")) return } else if (e.hasClass("tree-checkbox0")) return; !n && 0 == r.onBeforeCheckNode.call(t, o, i) || (r.cascadeCheck ? (l(a = t, e = o, s = i ? 1 : 0), m.easyui.forEach(e.children || [], !0, function (t) { l(a, t, s) }), c(t, o)) : l(t, o, i ? "1" : "0"), n || r.onCheckNode.call(t, o, i)) } } } function l(t, e, i) { var n = m.data(t, "treegrid"), o = n.checkedRows, n = n.options; !e.checkState || null == i || (t = n.finder.getTr(t, e[n.idField]).find(".tree-checkbox")).length && (e.checkState = ["unchecked", "checked", "indeterminate"][i], e.checked = "checked" == e.checkState, t.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2"), t.addClass("tree-checkbox" + i), 0 == i ? m.easyui.removeArrayItem(o, n.idField, e[n.idField]) : m.easyui.addArrayItem(o, n.idField, e)) } function c(t, e) { e = b(t, e[m.data(t, "treegrid").options.idField]); e && (l(t, e, s(e)), c(t, e)) } function s(t) { var e = 0, i = 0, n = 0; if (m.easyui.forEach(t.children || [], !1, function (t) { t.checkState && (e++ , "checked" == t.checkState ? n++ : "unchecked" == t.checkState && i++) }), 0 != e) return i == e ? 0 : n == e ? 1 : 2 } function a(t, e) { var i, n, o, r, a = m.data(t, "treegrid").options; a.checkbox && (i = x(t, e), o = (n = a.finder.getTr(t, e)).find(".tree-checkbox"), a.view.hasCheckbox(t, i) ? (o.length || (i.checkState = i.checkState || "unchecked", m('<span class="tree-checkbox"></span>').insertBefore(n.find(".tree-title"))), "checked" == i.checkState ? f(t, e, !0, !0) : "unchecked" == i.checkState || 0 === (r = s(i)) ? f(t, e, !1, !0) : 1 === r && f(t, e, !0, !0)) : (o.remove(), i.checkState = void 0, i.checked = void 0, c(t, i))) } function d(t, e) { var i = m.data(t, "treegrid").options, n = i.finder.getTr(t, e, "body", 1), e = i.finder.getTr(t, e, "body", 2), i = m(t).datagrid("getColumnFields", !0).length + (i.rownumbers ? 1 : 0), t = m(t).datagrid("getColumnFields", !1).length; function o(t, e) { m('<tr class="treegrid-tr-tree"><td style="border:0px" colspan="' + e + '"><div></div></td></tr>').insertAfter(t) } o(n, i), o(e, t) } function p(t, e, i, n, o) { var r = m.data(t, "treegrid"), a = r.options, s = r.dc; i = a.loadFilter.call(t, i, e); var l, c, d = x(t, e); d ? (l = a.finder.getTr(t, e, "body", 1), c = a.finder.getTr(t, e, "body", 2), l = l.next("tr.treegrid-tr-tree").children("td").children("div"), c = c.next("tr.treegrid-tr-tree").children("td").children("div"), n || (d.children = [])) : (l = s.body1, c = s.body2, n || (r.data = [])), n || (l.empty(), c.empty()), a.view.onBeforeRender && a.view.onBeforeRender.call(a.view, t, e, i), a.view.render.call(a.view, t, l, !0), a.view.render.call(a.view, t, c, !1), a.showFooter && (a.view.renderFooter.call(a.view, t, s.footer1, !0), a.view.renderFooter.call(a.view, t, s.footer2, !1)), a.view.onAfterRender && a.view.onAfterRender.call(a.view, t), !e && a.pagination && (m.data(t, "treegrid").total, (e = (s = m(t).datagrid("getPager")).pagination("options")).total != i.total && (s.pagination("refresh", { pageNumber: a.pageNumber, total: i.total }), a.pageNumber != e.pageNumber && 0 < e.pageNumber && (a.pageNumber = e.pageNumber, g(t)))), h(t), u(t), m(t).treegrid("showLines"), m(t).treegrid("setSelectionState"), m(t).treegrid("autoSizeColumn"), o || a.onLoadSuccess.call(t, d, i) } function g(e, i, t, n, o) { var r = m.data(e, "treegrid").options, a = m(e).datagrid("getPanel").find("div.datagrid-body"); null == i && r.queryParams && (r.queryParams.id = void 0), t && (r.queryParams = t); var s = m.extend({}, r.queryParams); r.pagination && m.extend(s, { page: r.pageNumber, rows: r.pageSize }), r.sortName && m.extend(s, { sort: r.sortName, order: r.sortOrder }); var l, t = x(e, i); 0 != r.onBeforeLoad.call(e, t, s) && ((l = a.find('tr[node-id="' + i + '"] span.tree-folder')).addClass("tree-loading"), m(e).treegrid("loading"), 0 == r.loader.call(e, s, function (t) { l.removeClass("tree-loading"), m(e).treegrid("loaded"), p(e, i, t, n), o && o() }, function () { l.removeClass("tree-loading"), m(e).treegrid("loaded"), r.onLoadError.apply(e, arguments), o && o() }) && (l.removeClass("tree-loading"), m(e).treegrid("loaded"))) } function e(t) { return m.data(t, "treegrid").data } function b(t, e) { e = x(t, e); return e._parentId ? x(t, e._parentId) : null } function v(t, e) { var i = m.data(t, "treegrid").data; e && (i = (e = x(t, e)) && e.children || []); var n = []; return m.easyui.forEach(i, !0, function (t) { n.push(t) }), n } function x(t, e) { var t = m.data(t, "treegrid"), i = t.options, n = null; return m.easyui.forEach(t.data, !0, function (t) { if (t[i.idField] == e) return n = t, !1 }), n } function r(t, e) { var i = m.data(t, "treegrid").options, n = x(t, e), o = i.finder.getTr(t, e), r = o.find("span.tree-hit"); 0 != r.length && (r.hasClass("tree-collapsed") || 0 != i.onBeforeCollapse.call(t, n) && (r.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"), r.next().removeClass("tree-folder-open"), n.state = "closed", o = (o = o.next("tr.treegrid-tr-tree")).children("td").children("div"), i.animate ? o.slideUp("normal", function () { m(t).treegrid("autoSizeColumn"), h(t, e), i.onCollapse.call(t, n) }) : (o.hide(), m(t).treegrid("autoSizeColumn"), h(t, e), i.onCollapse.call(t, n)))) } function y(e, i) { var t, n, o = m.data(e, "treegrid").options, r = o.finder.getTr(e, i), a = r.find("span.tree-hit"), s = x(e, i); function l(t) { s.state = "open", o.animate ? t.slideDown("normal", function () { m(e).treegrid("autoSizeColumn"), h(e, i), o.onExpand.call(e, s) }) : (t.show(), m(e).treegrid("autoSizeColumn"), h(e, i), o.onExpand.call(e, s)) } 0 != a.length && (a.hasClass("tree-expanded") || 0 != o.onBeforeExpand.call(e, s) && (a.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded"), a.next().addClass("tree-folder-open"), (t = r.next("tr.treegrid-tr-tree")).length ? l(n = t.children("td").children("div")) : (d(e, s[o.idField]), t = r.next("tr.treegrid-tr-tree"), (n = t.children("td").children("div")).hide(), (r = m.extend({}, o.queryParams || {})).id = s[o.idField], g(e, s[o.idField], r, !0, function () { n.is(":empty") ? t.remove() : l(n) })))) } function _(t, e) { (m.data(t, "treegrid").options.finder.getTr(t, e).find("span.tree-hit").hasClass("tree-expanded") ? r : y)(t, e) } function w(t, e) { var i, n = m.data(t, "treegrid"), o = n.options; e.parent && (0 == (i = o.finder.getTr(t, e.parent)).next("tr.treegrid-tr-tree").length && d(t, e.parent), (o = i.children('td[field="' + o.treeField + '"]').children("div.datagrid-cell").children("span.tree-icon")).hasClass("tree-file") && (o.removeClass("tree-file").addClass("tree-folder tree-folder-open"), (o = m('<span class="tree-hit tree-expanded"></span>').insertBefore(o)).prev().length && o.prev().remove())), p(t, e.parent, e.data, 0 < n.data.length, !0) } function i(r) { var t, a = m(r), s = a.treegrid("options"); function i(t) { return s.finder.getTr(r, t[s.idField]).find('td[field="' + s.treeField + '"] div.datagrid-cell') } s.lines ? (a.treegrid("getPanel").addClass("tree-lines"), a.treegrid("getPanel").find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom"), a.treegrid("getPanel").find("div.datagrid-cell").removeClass("tree-node-last tree-root-first tree-root-one"), 1 < (t = a.treegrid("getRoots")).length ? i(t[0]).addClass("tree-root-first") : 1 == t.length && i(t[0]).addClass("tree-root-one"), function e(t) { m.map(t, function (t) { t.children && t.children.length ? e(t.children) : i(t).find(".tree-icon").prev().addClass("tree-join") }); t.length && ((t = i(t[t.length - 1])).addClass("tree-node-last"), t.find(".tree-join").removeClass("tree-join").addClass("tree-joinbottom")) }(t), function e(t) { m.map(t, function (t) { t.children && t.children.length && e(t.children) }); for (var i = 0; i < t.length - 1; i++){ var n = t[i], o = a.treegrid("getLevel", n[s.idField]), n = s.finder.getTr(r, n[s.idField]), n = n.next().find('tr.datagrid-row td[field="' + s.treeField + '"] div.datagrid-cell'); n.find("span:eq(" + (o - 1) + ")").addClass("tree-line") } }(t)) : a.treegrid("getPanel").removeClass("tree-lines") } m.fn.treegrid = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = m.data(this, "treegrid"); t ? m.extend(t.options, e) : t = m.data(this, "treegrid", { options: m.extend({}, m.fn.treegrid.defaults, m.fn.treegrid.parseOptions(this), e), data: [], checkedRows: [], tmpIds: [] }), function (n) { var t = m.data(n, "treegrid"), o = t.options; m(n).datagrid(m.extend({}, o, { url: null, data: null, loader: function () { return !1 }, onBeforeLoad: function () { return !1 }, onLoadSuccess: function () { }, onResizeColumn: function (t, e) { h(n), o.onResizeColumn.call(n, t, e) }, onBeforeSortColumn: function (t, e) { if (0 == o.onBeforeSortColumn.call(n, t, e)) return !1 }, onSortColumn: function (t, e) { var i; o.sortName = t, o.sortOrder = e, o.remoteSort ? g(n) : (i = m(n).treegrid("getData"), p(n, null, i)), o.onSortColumn.call(n, t, e) }, onClickCell: function (t, e) { o.onClickCell.call(n, e, x(n, t)) }, onDblClickCell: function (t, e) { o.onDblClickCell.call(n, e, x(n, t)) }, onRowContextMenu: function (t, e) { o.onContextMenu.call(n, t, x(n, e)) } })); var i, e = m.data(n, "datagrid").options; o.columns = e.columns, o.frozenColumns = e.frozenColumns, t.dc = m.data(n, "datagrid").dc, o.pagination && ((i = m(n).datagrid("getPager")).pagination({ total: 0, pageNumber: o.pageNumber, pageSize: o.pageSize, pageList: o.pageList, onSelectPage: function (t, e) { o.pageNumber = t || 1, o.pageSize = e, i.pagination("refresh", { pageNumber: t, pageSize: e }), g(n) } }), o.pageSize = i.pagination("options").pageSize) }(this), t.options.data && m(this).treegrid("loadData", t.options.data), g(this) }); var i = m.fn.treegrid.methods[e]; return i ? i(this, t) : this.datagrid(e, t) }, m.fn.treegrid.methods = { options: function (t) { return m.data(t[0], "treegrid").options }, resize: function (t, e) { return t.each(function () { m(this).datagrid("resize", e) }) }, fixRowHeight: function (t, e) { return t.each(function () { h(this, e) }) }, loadData: function (t, e) { return t.each(function () { p(this, e.parent, e) }) }, load: function (t, e) { return t.each(function () { m(this).treegrid("options").pageNumber = 1, m(this).treegrid("getPager").pagination({ pageNumber: 1 }), m(this).treegrid("reload", e) }) }, reload: function (t, n) { return t.each(function () { var t, e = m(this).treegrid("options"), i = {}; "object" == typeof n ? i = n : (i = m.extend({}, e.queryParams)).id = n, i.id ? ((t = m(this).treegrid("find", i.id)).children && t.children.splice(0, t.children.length), e.queryParams = i, (e = e.finder.getTr(this, i.id)).next("tr.treegrid-tr-tree").remove(), e.find("span.tree-hit").removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"), y(this, i.id)) : g(this, null, i) }) }, reloadFooter: function (t, i) { return t.each(function () { var t = m.data(this, "treegrid").options, e = m.data(this, "datagrid").dc; i && (m.data(this, "treegrid").footer = i), t.showFooter && (t.view.renderFooter.call(t.view, this, e.footer1, !0), t.view.renderFooter.call(t.view, this, e.footer2, !1), t.view.onAfterRender && t.view.onAfterRender.call(t.view, this), m(this).treegrid("fixRowHeight")) }) }, getData: function (t) { return m.data(t[0], "treegrid").data }, getFooterRows: function (t) { return m.data(t[0], "treegrid").footer }, getRoot: function (t) { return (t = e(t = t[0])).length ? t[0] : null }, getRoots: function (t) { return e(t[0]) }, getParent: function (t, e) { return b(t[0], e) }, getChildren: function (t, e) { return v(t[0], e) }, getLevel: function (t, e) { return i = t[0], t = e, (e = m.data(i, "treegrid").options).finder.getTr(i, t).children('td[field="' + e.treeField + '"]').find("span.tree-indent,span.tree-hit").length; var i }, find: function (t, e) { return x(t[0], e) }, isLeaf: function (t, e) { return 0 == m.data(t[0], "treegrid").options.finder.getTr(t[0], e).find("span.tree-hit").length }, select: function (t, e) { return t.each(function () { m(this).datagrid("selectRow", e) }) }, unselect: function (t, e) { return t.each(function () { m(this).datagrid("unselectRow", e) }) }, collapse: function (t, e) { return t.each(function () { r(this, e) }) }, expand: function (t, e) { return t.each(function () { y(this, e) }) }, toggle: function (t, e) { return t.each(function () { _(this, e) }) }, collapseAll: function (t, e) { return t.each(function () { !function (t, e) { var i = m.data(t, "treegrid").options, n = v(t, e); e && n.unshift(x(t, e)); for (var o = 0; o < n.length; o++)r(t, n[o][i.idField]) }(this, e) }) }, expandAll: function (t, e) { return t.each(function () { !function (t, e) { var i = m.data(t, "treegrid").options, n = v(t, e); e && n.unshift(x(t, e)); for (var o = 0; o < n.length; o++)y(t, n[o][i.idField]) }(this, e) }) }, expandTo: function (t, e) { return t.each(function () { !function (t, e) { for (var i = m.data(t, "treegrid").options, n = [], o = b(t, e); o;){ var r = o[i.idField]; n.unshift(r), o = b(t, r) } for (var a = 0; a < n.length; a++)y(t, n[a]) }(this, e) }) }, append: function (t, e) { return t.each(function () { w(this, e) }) }, insert: function (t, e) { return t.each(function () { !function (o, r) { var a = r.before || r.after, s = m.data(o, "treegrid").options, t = b(o, a); w(o, { parent: t ? t[s.idField] : null, data: [r.data] }); for (var e = t ? t.children : m(o).treegrid("getRoots"), i = 0; i < e.length; i++)if (e[i][s.idField] == a) { var n = e[e.length - 1]; e.splice(r.before ? i : i + 1, 0, n), e.splice(e.length - 1, 1); break } function l(t) { var e = t ? 1 : 2, i = (n = s.finder.getTr(o, r.data[s.idField], "body", e)).closest("table.datagrid-btable"), n = n.parent().children(), t = s.finder.getTr(o, a, "body", e); r.before ? n.insertBefore(t) : (e = t.next("tr.treegrid-tr-tree"), n.insertAfter(e.length ? e : t)), i.remove() } l(!0), l(!1), u(o), m(o).treegrid("showLines") }(this, e) }) }, remove: function (t, r) { return t.each(function () { var t, e, i, n, o; t = this, e = r, i = m.data(t, "treegrid"), n = i.options, o = b(t, e), m(t).datagrid("deleteRow", e), m.easyui.removeArrayItem(i.checkedRows, n.idField, e), u(t), o && a(t, o[n.idField]), --i.total, m(t).datagrid("getPager").pagination("refresh", { total: i.total }), m(t).treegrid("showLines") }) }, pop: function (t, e) { var i = t.treegrid("find", e); return t.treegrid("remove", e), i }, refresh: function (t, e) { return t.each(function () { var t = m.data(this, "treegrid").options; t.view.refreshRow.call(t.view, this, e) }) }, update: function (t, i) { return t.each(function () { var t = m.data(this, "treegrid").options, e = i.row; t.view.updateRow.call(t.view, this, i.id, e), null != e.checked && (e = x(this, i.id), m.extend(e, { checkState: e.checked ? "checked" : !1 === e.checked ? "unchecked" : void 0 }), a(this, i.id)) }) }, beginEdit: function (t, e) { return t.each(function () { m(this).datagrid("beginEdit", e), m(this).treegrid("fixRowHeight", e) }) }, endEdit: function (t, e) { return t.each(function () { m(this).datagrid("endEdit", e) }) }, cancelEdit: function (t, e) { return t.each(function () { m(this).datagrid("cancelEdit", e) }) }, showLines: function (t) { return t.each(function () { i(this) }) }, setSelectionState: function (t) { return t.each(function () { m(this).datagrid("setSelectionState"); for (var t = m(this).data("treegrid"), e = 0; e < t.tmpIds.length; e++)f(this, t.tmpIds[e], !0, !0); t.tmpIds = [] }) }, getCheckedNodes: function (t, e) { e = e || "checked"; var i = []; return m.easyui.forEach(t.data("treegrid").checkedRows, !1, function (t) { t.checkState == e && i.push(t) }), i }, checkNode: function (t, e) { return t.each(function () { f(this, e, !0) }) }, uncheckNode: function (t, e) { return t.each(function () { f(this, e, !1) }) }, clearChecked: function (t) { return t.each(function () { var e = this, i = m(e).treegrid("options"); m(e).datagrid("clearChecked"), m.map(m(e).treegrid("getCheckedNodes"), function (t) { f(e, t[i.idField], !1, !0) }) }) } }, m.fn.treegrid.parseOptions = function (t) { return m.extend({}, m.fn.datagrid.parseOptions(t), m.parser.parseOptions(t, ["treeField", { checkbox: "boolean", cascadeCheck: "boolean", onlyLeafCheck: "boolean" }, { animate: "boolean" }])) }; var n = m.extend({}, m.fn.datagrid.defaults.view, { render: function (h, t, e) { var u, f = m.data(h, "treegrid").options, p = m(h).datagrid("getColumnFields", e), g = m.data(h, "datagrid").rowIdPrefix; function b(t, e, i) { for (var n = m(h).treegrid("getParent", i[0][f.idField]), o = (n ? n.children : m(h).treegrid("getRoots")).length - i.length, r = ['<table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0"><tbody>'], a = 0; a < i.length; a++){ var s = i[a]; "open" != s.state && "closed" != s.state && (s.state = "open"); var l = f.rowStyler ? f.rowStyler.call(h, s) : "", c = this.getStyleValue(l), d = 'class="datagrid-row ' + (o++ % 2 && f.striped ? "datagrid-row-alt " : " ") + c.c + '"', l = c.s ? 'style="' + c.s + '"' : "", c = g + "-" + (t ? 1 : 2) + "-" + s[f.idField]; r.push('<tr id="' + c + '" node-id="' + s[f.idField] + '" ' + d + " " + l + ">"), (r = r.concat(u.renderRow.call(u, h, p, t, e, s))).push("</tr>"), s.children && s.children.length && (l = b.call(this, t, e + 1, s.children), s = "closed" == s.state ? "none" : "block", r.push('<tr class="treegrid-tr-tree"><td style="border:0px" colspan=' + (p.length + (f.rownumbers ? 1 : 0)) + '><div style="display:' + s + '">'), (r = r.concat(l)).push("</div></td></tr>")) } return r.push("</tbody></table>"), r } !(!e || f.rownumbers || f.frozenColumns && f.frozenColumns.length) || (u = this).treeNodes && this.treeNodes.length && (e = b.call(this, e, this.treeLevel, this.treeNodes), m(t).append(e.join(""))) }, renderFooter: function (t, e, i) { for (var n = m.data(t, "treegrid").options, o = m.data(t, "treegrid").footer || [], r = m(t).datagrid("getColumnFields", i), a = ['<table class="datagrid-ftable" cellspacing="0" cellpadding="0" border="0"><tbody>'], s = 0; s < o.length; s++){ var l = o[s]; l[n.idField] = l[n.idField] || "foot-row-id" + s, a.push('<tr class="datagrid-row" node-id="' + l[n.idField] + '">'), a.push(this.renderRow.call(this, t, r, i, 0, l)), a.push("</tr>") } a.push("</tbody></table>"), m(e).html(a.join("")) }, renderRow: function (t, e, i, n, o) { var r = m.data(t, "treegrid"), a = r.options, s = []; i && a.rownumbers && s.push('<td class="datagrid-td-rownumber"><div class="datagrid-cell-rownumber">0</div></td>'); for (var l = 0; l < e.length; l++){ var c = e[l], d = m(t).datagrid("getColumnOption", c); if (d) { var h = d.styler && d.styler(o[c], o) || "", u = this.getStyleValue(h), h = u.c ? 'class="' + u.c + '"' : "", u = d.hidden ? 'style="display:none;' + u.s + '"' : u.s ? 'style="' + u.s + '"' : ""; s.push('<td field="' + c + '" ' + h + " " + u + ">"); u = ""; if (d.checkbox || (d.align && (u += "text-align:" + d.align + ";"), a.nowrap ? a.autoRowHeight && (u += "height:auto;") : u += "white-space:normal;height:auto;"), s.push('<div style="' + u + '" '), d.checkbox ? s.push('class="datagrid-cell-check ') : s.push('class="datagrid-cell ' + d.cellClass), c == a.treeField && s.push(" tree-node"), s.push('">'), d.checkbox) o.checked ? s.push('<input type="checkbox" checked="checked"') : s.push('<input type="checkbox"'), s.push(' name="' + c + '" value="' + (null != o[c] ? o[c] : "") + '">'); else { u = null, u = d.formatter ? d.formatter(o[c], o) : o[c]; if (c == a.treeField) { for (var f = 0; f < n; f++)s.push('<span class="tree-indent"></span>'); "closed" == o.state ? (s.push('<span class="tree-hit tree-collapsed"></span>'), s.push('<span class="tree-icon tree-folder ' + (o.iconCls || "") + '"></span>')) : o.children && o.children.length ? (s.push('<span class="tree-hit tree-expanded"></span>'), s.push('<span class="tree-icon tree-folder tree-folder-open ' + (o.iconCls || "") + '"></span>')) : (s.push('<span class="tree-indent"></span>'), s.push('<span class="tree-icon tree-file ' + (o.iconCls || "") + '"></span>')), this.hasCheckbox(t, o) ? (d = 0, (c = m.easyui.getArrayItem(r.checkedRows, a.idField, o[a.idField])) ? (d = "checked" == c.checkState ? 1 : 2, o.checkState = c.checkState, o.checked = c.checked, m.easyui.addArrayItem(r.checkedRows, a.idField, o)) : ((c = m.easyui.getArrayItem(r.checkedRows, a.idField, o._parentId)) && "checked" == c.checkState && a.cascadeCheck ? (d = 1, o.checked = !0, m.easyui.addArrayItem(r.checkedRows, a.idField, o)) : o.checked && m.easyui.addArrayItem(r.tmpIds, o[a.idField]), o.checkState = d ? "checked" : "unchecked"), s.push('<span class="tree-checkbox tree-checkbox' + d + '"></span>')) : (o.checkState = void 0, o.checked = void 0), s.push('<span class="tree-title">' + u + "</span>") } else s.push(u) } s.push("</div>"), s.push("</td>") } } return s.join("") }, hasCheckbox: function (t, e) { var i = m.data(t, "treegrid").options; if (i.checkbox) { if (m.isFunction(i.checkbox)) return !!i.checkbox.call(t, e); if (!i.onlyLeafCheck) return !0; if (!("open" != e.state || e.children && e.children.length)) return !0 } return !1 }, refreshRow: function (t, e) { this.updateRow.call(this, t, e, {}) }, updateRow: function (r, a, t) { var s = m.data(r, "treegrid").options, l = m(r).treegrid("find", a); m.extend(l, t); var c = m(r).treegrid("getLevel", a) - 1, d = s.rowStyler ? s.rowStyler.call(r, l) : "", h = m.data(r, "datagrid").rowIdPrefix, u = l[s.idField]; function e(t) { var e = m(r).treegrid("getColumnFields", t), i = s.finder.getTr(r, a, "body", t ? 1 : 2), n = i.find("div.datagrid-cell-rownumber").html(), o = i.find("div.datagrid-cell-check input[type=checkbox]").is(":checked"); i.html(this.renderRow(r, e, t, c, l)), i.attr("style", d || ""), i.find("div.datagrid-cell-rownumber").html(n), o && i.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", !0), u != a && (i.attr("id", h + "-" + (t ? 1 : 2) + "-" + u), i.attr("node-id", u)) } e.call(this, !0), e.call(this, !1), m(r).treegrid("fixRowHeight", a) }, deleteRow: function (o, t) { var r = m.data(o, "treegrid").options, e = r.finder.getTr(o, t); e.next("tr.treegrid-tr-tree").remove(), e.remove(); t = function (t) { var e, i = m(o).treegrid("getParent", t); e = i ? i.children : m(o).treegrid("getData"); for (var n = 0; n < e.length; n++)if (e[n][r.idField] == t) { e.splice(n, 1); break } return i }(t); t && 0 == t.children.length && ((e = r.finder.getTr(o, t[r.idField])).next("tr.treegrid-tr-tree").remove(), (e = e.children('td[field="' + r.treeField + '"]').children("div.datagrid-cell")).find(".tree-icon").removeClass("tree-folder").addClass("tree-file"), e.find(".tree-hit").remove(), m('<span class="tree-indent"></span>').prependTo(e)), this.setEmptyMsg(o) }, onBeforeRender: function (t, e, i) { if (m.isArray(e) && (i = { total: e.length, rows: e }, e = null), !i) return !1; var n = m.data(t, "treegrid"), r = n.options; null == i.length ? (i.footer && (n.footer = i.footer), i.total && (n.total = i.total), i = this.transfer(t, e, i.rows)) : function t(e, i) { for (var n = 0; n < e.length; n++){ var o = e[n]; o._parentId = i, o.children && o.children.length && t(o.children, o[r.idField]) } }(i, e), this.sort(t, i), this.treeNodes = i, this.treeLevel = m(t).treegrid("getLevel", e); e = x(t, e); e ? e.children ? e.children = e.children.concat(i) : e.children = i : n.data = n.data.concat(i) }, sort: function (s, t) { var l, c, e = m.data(s, "treegrid").options; !e.remoteSort && e.sortName && (l = e.sortName.split(","), c = e.sortOrder.split(","), function t(e) { e.sort(function (t, e) { for (var i = 0, n = 0; n < l.length; n++){ var o = l[n], r = c[n], a = m(s).treegrid("getColumnOption", o), a = a.sorter || function (t, e) { return t == e ? 0 : e < t ? 1 : -1 }; if (0 != (i = a(t[o], e[o]) * ("asc" == r ? 1 : -1))) return i } return i }); for (var i = 0; i < e.length; i++){ var n = e[i].children; n && n.length && t(n) } }(t)) }, transfer: function (t, e, i) { for (var n = m.data(t, "treegrid").options, o = m.extend([], i), e = l(e, o), r = m.extend([], e); r.length;){ var a = r.shift(), s = l(a[n.idField], o); s.length && (a.children ? a.children = a.children.concat(s) : a.children = s, r = r.concat(s)) } return e; function l(t, e) { for (var i = [], n = 0; n < e.length; n++){ var o = e[n]; o._parentId == t && (i.push(o), e.splice(n, 1), n--) } return i } } }); m.fn.treegrid.defaults = m.extend({}, m.fn.datagrid.defaults, { treeField: null, checkbox: !1, cascadeCheck: !0, onlyLeafCheck: !1, lines: !1, animate: !1, singleSelect: !0, view: n, rowEvents: m.extend({}, m.fn.datagrid.defaults.rowEvents, { mouseover: t(!0), mouseout: t(!1), click: function (t) { var e = m(t.target); if ((c = e.closest("tr.datagrid-row")).length && c.parent().length) { var i = c.attr("node-id"), n = m(c).closest("div.datagrid-view").children(".datagrid-f")[0]; if (e.hasClass("tree-hit")) _(n, i); else if (e.hasClass("tree-checkbox")) f(n, i); else { var o = m(n).datagrid("options"); if (e.parent().hasClass("datagrid-cell-check") || o.singleSelect || !t.shiftKey) m.fn.datagrid.defaults.rowEvents.click(t); else { var r = m(n).treegrid("getChildren"), a = m.easyui.indexOfArray(r, o.idField, o.lastSelectedIndex), s = m.easyui.indexOfArray(r, o.idField, i), t = Math.min(Math.max(a, 0), s), l = Math.max(a, s), s = r[s], c = e.closest("td[field]", c); c.length && (c = c.attr("field"), o.onClickCell.call(n, i, c, s[c])), m(n).treegrid("clearSelections"); for (var d = t; d <= l; d++)m(n).treegrid("selectRow", r[d][o.idField]); o.onClickRow.call(n, s) } } } } }), loader: function (t, e, i) { var n = m(this).treegrid("options"); if (!n.url) return !1; m.ajax({ type: n.method, url: n.url, data: t, dataType: "json", success: function (t) { e(t) }, error: function () { i.apply(this, arguments) } }) }, loadFilter: function (t, e) { return t }, finder: { getTr: function (t, e, i, n) { i = i || "body", n = n || 0; var o = m.data(t, "datagrid").dc; if (0 == n) { var r = m.data(t, "treegrid").options, a = r.finder.getTr(t, e, i, 1), r = r.finder.getTr(t, e, i, 2); return a.add(r) } if ("body" != i) return "footer" == i ? (1 == n ? o.footer1 : o.footer2).find('tr[node-id="' + e + '"]') : "selected" == i ? (1 == n ? o.body1 : o.body2).find("tr.datagrid-row-selected") : "highlight" == i ? (1 == n ? o.body1 : o.body2).find("tr.datagrid-row-over") : "checked" == i ? (1 == n ? o.body1 : o.body2).find("tr.datagrid-row-checked") : "last" == i ? (1 == n ? o.body1 : o.body2).find("tr:last[node-id]") : "allbody" == i ? (1 == n ? o.body1 : o.body2).find("tr[node-id]") : "allfooter" == i ? (1 == n ? o.footer1 : o.footer2).find("tr[node-id]") : void 0; t = m("#" + m.data(t, "datagrid").rowIdPrefix + "-" + n + "-" + e); return t.length || (t = (1 == n ? o.body1 : o.body2).find('tr[node-id="' + e + '"]')), t }, getRow: function (t, e) { e = "object" == typeof e ? e.attr("node-id") : e; return m(t).treegrid("find", e) }, getRows: function (t) { return m(t).treegrid("getChildren") } }, onBeforeLoad: function (t, e) { }, onLoadSuccess: function (t, e) { }, onLoadError: function () { }, onBeforeCollapse: function (t) { }, onCollapse: function (t) { }, onBeforeExpand: function (t) { }, onExpand: function (t) { }, onClickRow: function (t) { }, onDblClickRow: function (t) { }, onClickCell: function (t, e) { }, onDblClickCell: function (t, e) { }, onContextMenu: function (t, e) { }, onBeforeEdit: function (t) { }, onAfterEdit: function (t, e) { }, onCancelEdit: function (t) { }, onBeforeCheckNode: function (t, e) { }, onCheckNode: function (t, e) { } }) }(jQuery), function (l) { var t = l.extend({}, l.fn.datagrid.defaults.view, { render: function (t, e, i) { var n = l.data(t, "datagrid"); if (n.options.groupField) { var o = this.groupRows(t, n.data.rows); this.groups = o.groups, n.data.rows = o.rows; for (var r = [], a = 0; a < o.groups.length; a++)r.push(this.renderGroup.call(this, t, a, o.groups[a], i)); l(e).html(r.join("")) } else l(e).html(this.renderTable(t, 0, n.data.rows, i)) }, renderGroup: function (t, e, i, n) { var o = l.data(t, "datagrid").options, r = (l(t).datagrid("getColumnFields", n), []); return r.push('<div class="datagrid-group" group-index=' + e + ">"), n || (r.push('<span class="datagrid-group-title">'), r.push(o.groupFormatter.call(t, i.value, i.rows)), r.push("</span>")), r.push("</div>"), r.push(this.renderTable(t, i.startIndex, i.rows, n)), r.join("") }, groupRows: function (t, e) { for (var i = l.data(t, "datagrid").options, n = [], o = 0; o < e.length; o++){ var r = e[o]; (a = function (t) { for (var e = 0; e < n.length; e++){ var i = n[e]; if (i.value == t) return i } return null }(r[i.groupField])) ? a.rows.push(r) : (a = { value: r[i.groupField], rows: [r] }, n.push(a)) } for (var a, s = 0, e = [], o = 0; o < n.length; o++)(a = n[o]).startIndex = s, s += a.rows.length, e = e.concat(a.rows); return { groups: n, rows: e } } }); l.fn.datalist = function (i, t) { if ("string" != typeof i) return i = i || {}, this.each(function () { var t, n, e = l.data(this, "datalist"); e ? l.extend(e.options, i) : ((t = l.extend({}, l.fn.datalist.defaults, l.fn.datalist.parseOptions(this), i)).columns = l.extend(!0, [], t.columns), e = l.data(this, "datalist", { options: t })), t = this, n = l.data(t, "datalist").options, l(t).datagrid(l.extend({}, n, { cls: "datalist" + (n.lines ? " datalist-lines" : ""), frozenColumns: n.frozenColumns && n.frozenColumns.length ? n.frozenColumns : n.checkbox ? [[{ field: "_ck", checkbox: !0 }]] : void 0, columns: n.columns && n.columns.length ? n.columns : [[{ field: n.textField, width: "100%", formatter: function (t, e, i) { return n.textFormatter ? n.textFormatter(t, e, i) : t } }]] })), e.options.data || (e = l.fn.datalist.parseData(this)).total && l(this).datalist("loadData", e) }); var e = l.fn.datalist.methods[i]; return e ? e(this, t) : this.datagrid(i, t) }, l.fn.datalist.methods = { options: function (t) { return l.data(t[0], "datalist").options } }, l.fn.datalist.parseOptions = function (t) { return l.extend({}, l.fn.datagrid.parseOptions(t), l.parser.parseOptions(t, ["valueField", "textField", "groupField", { checkbox: "boolean", lines: "boolean" }])) }, l.fn.datalist.parseData = function (t) { var n = l.data(t, "datalist").options, o = { total: 0, rows: [] }; return l(t).children().each(function () { var t = l.parser.parseOptions(this, ["value", "group"]), e = {}, i = l(this).html(); e[n.valueField] = null != t.value ? t.value : i, e[n.textField] = i, n.groupField && (e[n.groupField] = t.group), o.total++ , o.rows.push(e) }), o }, l.fn.datalist.defaults = l.extend({}, l.fn.datagrid.defaults, { fitColumns: !0, singleSelect: !0, showHeader: !1, checkbox: !1, lines: !1, valueField: "value", textField: "text", groupField: "", view: t, textFormatter: function (t, e) { return t }, groupFormatter: function (t, e) { return t } }) }(jQuery), function (s) { function r(t) { var e, i = s.data(t, "combo").panel; i.is(":visible") ? (l(e = i.combo("combo")), e != t && s(t).combo("showPanel")) : (e = s(t).closest("div.combo-p").children(".combo-panel"), s("div.combo-panel:visible").not(i).not(e).panel("close"), s(t).combo("showPanel")), s(t).combo("textbox").focus() } function a(t) { s(t).find(".combo-f").each(function () { var t = s(this).combo("panel"); t.is(":visible") && t.panel("close") }) } function t(e) { var i = e.data.target, n = s(i), o = n.data("combo"), r = n.combo("options"); switch (o.panel.panel("options").comboTarget = i, e.keyCode) { case 38: r.keyHandler.up.call(i, e); break; case 40: r.keyHandler.down.call(i, e); break; case 37: r.keyHandler.left.call(i, e); break; case 39: r.keyHandler.right.call(i, e); break; case 13: return e.preventDefault(), r.keyHandler.enter.call(i, e), !1; case 9: case 27: l(i); break; default: r.editable && (o.timer && clearTimeout(o.timer), o.timer = setTimeout(function () { var t = n.combo("getText"); o.previousText != t && (o.previousText = t, n.combo("showPanel"), r.keyHandler.query.call(i, t, e), n.combo("validate")) }, r.delay)) } } function e(t) { var e = s.data(t, "combo"), i = e.combo, n = e.panel, o = s(t).combo("options"), r = n.panel("options"); r.comboTarget = t, r.closed && (n.panel("panel").show().css({ zIndex: s.fn.menu ? s.fn.menu.defaults.zIndex++ : s.fn.window ? s.fn.window.defaults.zIndex++ : 99, left: -999999 }), n.panel("resize", { width: o.panelWidth || i._outerWidth(), height: o.panelHeight }), n.panel("panel").hide(), n.panel("open")), function () { r.comboTarget == t && n.is(":visible") && (n.panel("move", { left: function () { var t = i.offset().left; "right" == o.panelAlign && (t += i._outerWidth() - n._outerWidth()); t + n._outerWidth() > s(window)._outerWidth() + s(document).scrollLeft() && (t = s(window)._outerWidth() + s(document).scrollLeft() - n._outerWidth()); t < 0 && (t = 0); return t }(), top: function () { { var t; "top" == o.panelValign ? t = i.offset().top - n._outerHeight() : "bottom" == o.panelValign ? t = i.offset().top + i._outerHeight() : ((t = i.offset().top + i._outerHeight()) + n._outerHeight() > s(window)._outerHeight() + s(document).scrollTop() && (t = i.offset().top - n._outerHeight()), t < s(document).scrollTop() && (t = i.offset().top + i._outerHeight())) } return t }() }), setTimeout(arguments.callee, 200)) }() } function l(t) { s.data(t, "combo").panel.panel("close") } function c(t) { var e = s.data(t, "combo").options, t = s(t).next(), i = []; return t.find(".textbox-value").each(function () { i.push(s(this).val()) }), !e.multivalue && i.length ? i[0].split(e.separator) : i } function o(n, e) { var o = s.data(n, "combo").combo, r = s(n).combo("options"); s.isArray(e) || (e = e.split(r.separator)); var i = c(n); if (o.find(".textbox-value").remove(), e.length) if (r.multivalue) for (var t = 0; t < e.length; t++)a(e[t]); else a(e.join(r.separator)); function a(t) { var e = s(n).attr("textboxName") || "", i = s('<input type="hidden" class="textbox-value">').appendTo(o); i.attr("name", e), r.disabled && i.attr("disabled", "disabled"), i.val(t) } !function () { if (r.onChange == s.parser.emptyFn) return !1; if (i.length != e.length) return !0; for (var t = 0; t < e.length; t++)if (e[t] != i[t]) return !0; return !1 }() || (s(n).val(e.join(r.separator)), r.multiple ? r.onChange.call(n, e, i) : r.onChange.call(n, e[0], i[0]), s(n).closest("form").trigger("_change", [n])) } function d(t, e) { o(t, [e]) } s(function () { s(document)._unbind(".combo")._bind("mousedown.combo mousewheel.combo", function (t) { t = s(t.target).closest("span.combo,div.combo-p,div.menu"); t.length ? a(t) : s("body>div.combo-p>div.combo-panel:visible").panel("close") }) }), s.fn.combo = function (n, t) { if ("string" != typeof n) return n = n || {}, this.each(function () { var t, e, i = s.data(this, "combo"); i ? (s.extend(i.options, n), null != n.value && (i.options.originalValue = n.value)) : (i = s.data(this, "combo", { options: s.extend({}, s.fn.combo.defaults, s.fn.combo.parseOptions(this), n), previousText: "" })).options.multiple && "" == i.options.value ? i.options.originalValue = [] : i.options.originalValue = i.options.value, function (t) { var e = s.data(t, "combo"), i = e.options; e.panel || (e.panel = s('<div class="combo-panel"></div>').appendTo("html>body"), e.panel.panel({ minWidth: i.panelMinWidth, maxWidth: i.panelMaxWidth, minHeight: i.panelMinHeight, maxHeight: i.panelMaxHeight, doSize: !1, closed: !0, cls: "combo-p", style: { position: "absolute", zIndex: 10 }, onOpen: function () { var t = s(this).panel("options").comboTarget, e = s.data(t, "combo"); e && e.options.onShowPanel.call(t) }, onBeforeClose: function () { a(s(this).parent()) }, onClose: function () { var t = s(this).panel("options").comboTarget, e = s(t).data("combo"); e && e.options.onHidePanel.call(t) } })); var n, o = s.extend(!0, [], i.icons); for (n in i.hasDownArrow && o.push({ iconCls: "combo-arrow", handler: function (t) { r(t.data.target) } }), s(t).addClass("combo-f").textbox(s.extend({}, i, { icons: o, onChange: function () { } })), s(t).attr("comboName", s(t).attr("textboxName")), e.combo = s(t).next(), e.combo.addClass("combo"), e.panel._unbind(".combo"), i.panelEvents) e.panel._bind(n + ".combo", { target: t }, i.panelEvents[n]) }(this), t = this, e = s.data(t, "combo").options, i = e.onChange, e.onChange = s.parser.emptyFn, e.multiple ? o(t, e.value || []) : d(t, e.value), e.onChange = i }); var e = s.fn.combo.methods[n]; return e ? e(this, t) : this.textbox(n, t) }, s.fn.combo.methods = { options: function (t) { var e = t.textbox("options"); return s.extend(s.data(t[0], "combo").options, { width: e.width, height: e.height, disabled: e.disabled, readonly: e.readonly }) }, cloneFrom: function (t, e) { return t.each(function () { s(this).textbox("cloneFrom", e), s.data(this, "combo", { options: s.extend(!0, { cloned: !0 }, s(e).combo("options")), combo: s(this).next(), panel: s(e).combo("panel") }), s(this).addClass("combo-f").attr("comboName", s(this).attr("textboxName")) }) }, combo: function (t) { return t.closest(".combo-panel").panel("options").comboTarget }, panel: function (t) { return s.data(t[0], "combo").panel }, destroy: function (t) { return t.each(function () { var t, e, i; t = this, e = s.data(t, "combo"), i = e.options, (e = e.panel).is(":visible") && e.panel("close"), i.cloned || e.panel("destroy"), s(t).textbox("destroy") }) }, showPanel: function (t) { return t.each(function () { e(this) }) }, hidePanel: function (t) { return t.each(function () { l(this) }) }, clear: function (t) { return t.each(function () { s(this).textbox("setText", ""), s.data(this, "combo").options.multiple ? s(this).combo("setValues", []) : s(this).combo("setValue", "") }) }, reset: function (t) { return t.each(function () { var t = s.data(this, "combo").options; t.multiple ? s(this).combo("setValues", t.originalValue) : s(this).combo("setValue", t.originalValue) }) }, setText: function (t, n) { return t.each(function () { var t, e, i; t = this, e = n, i = s.data(t, "combo"), s(t).textbox("getText") != e && s(t).textbox("setText", e), i.previousText = e }) }, getValues: function (t) { return c(t[0]) }, setValues: function (t, e) { return t.each(function () { o(this, e) }) }, getValue: function (t) { return c(t[0])[0] }, setValue: function (t, e) { return t.each(function () { d(this, e) }) } }, s.fn.combo.parseOptions = function (t) { var e = s(t); return s.extend({}, s.fn.textbox.parseOptions(t), s.parser.parseOptions(t, ["separator", "panelAlign", { panelWidth: "number", hasDownArrow: "boolean", delay: "number", reversed: "boolean", multivalue: "boolean", selectOnNavigation: "boolean" }, { panelMinWidth: "number", panelMaxWidth: "number", panelMinHeight: "number", panelMaxHeight: "number" }]), { panelHeight: "auto" == e.attr("panelHeight") ? "auto" : parseInt(e.attr("panelHeight")) || void 0, multiple: !!e.attr("multiple") || void 0 }) }, s.fn.combo.defaults = s.extend({}, s.fn.textbox.defaults, { inputEvents: { click: function (t) { var e = t.data.target; s.data(e, "combo").options.editable ? (t = s(e).closest("div.combo-p").children(".combo-panel"), s("div.combo-panel:visible").not(t).each(function () { var t = s(this).combo("combo"); t != e && l(t) })) : r(e) }, keydown: t, paste: t, drop: t, blur: function (t) { t = t.data.target, (t = s(t).data("combo")).timer && clearTimeout(t.timer) } }, panelEvents: { mousedown: function (t) { t.preventDefault(), t.stopPropagation() } }, panelWidth: null, panelHeight: 300, panelMinWidth: null, panelMaxWidth: null, panelMinHeight: null, panelMaxHeight: null, panelAlign: "left", panelValign: "auto", reversed: !1, multiple: !1, multivalue: !0, selectOnNavigation: !0, separator: ",", hasDownArrow: !0, delay: 200, keyHandler: { up: function (t) { }, down: function (t) { }, left: function (t) { }, right: function (t) { }, enter: function (t) { }, query: function (t, e) { } }, onShowPanel: function () { }, onHidePanel: function () { }, onChange: function (t, e) { } }) }(jQuery), function (p) { function a(t, e) { t = p.data(t, "combobox"); return p.easyui.indexOfArray(t.data, t.options.valueField, e) } function e(t, e) { var i = p.data(t, "combobox").options, n = p(t).combobox("panel"), o = n.children("div.combobox-item-hover"); o.length || (o = n.children("div.combobox-item-selected")), o.removeClass("combobox-item-hover"); var r = "div.combobox-item:visible:not(.combobox-item-disabled):first", a = "div.combobox-item:visible:not(.combobox-item-disabled):last"; o.length ? "next" == e ? (o = o.nextAll(r)).length || (o = n.children(r)) : (o = o.prevAll(r)).length || (o = n.children(a)) : o = n.children("next" == e ? r : a), o.length && (o.addClass("combobox-item-hover"), (o = i.finder.getRow(t, o)) && (p(t).combobox("scrollTo", o[i.valueField]), i.selectOnNavigation && f(t, o[i.valueField]))) } function f(t, e, i) { var n = p.data(t, "combobox").options, o = p(t).combo("getValues"); -1 == p.inArray(e + "", o) && (n.multiple ? o.push(e) : o = [e], s(t, o, i)) } function r(t, e) { p.data(t, "combobox").options; var i = p(t).combo("getValues"), e = p.inArray(e + "", i); 0 <= e && (i.splice(e, 1), s(t, i)) } function s(i, n, t) { var o = p.data(i, "combobox").options, e = p(i).combo("panel"); p.isArray(n) || (n = n.split(o.separator)), o.multiple || (n = n.length ? [n[0]] : [""]); var r = p(i).combo("getValues"); e.is(":visible") && e.find(".combobox-item-selected").each(function () { var t = o.finder.getRow(i, p(this)); t && -1 == p.easyui.indexOfArray(r, t[o.valueField]) && p(this).removeClass("combobox-item-selected") }), p.map(r, function (t) { var e; -1 != p.easyui.indexOfArray(n, t) || (e = o.finder.getEl(i, t)).hasClass("combobox-item-selected") && (e.removeClass("combobox-item-selected"), o.onUnselect.call(i, o.finder.getRow(i, t))) }); for (var a = null, s = [], l = [], c = 0; c < n.length; c++){ var d, h = n[c], u = h, f = o.finder.getRow(i, h); f ? (u = f[o.textField], a = f, (d = o.finder.getEl(i, h)).hasClass("combobox-item-selected") || (d.addClass("combobox-item-selected"), o.onSelect.call(i, f))) : u = function (t, e) { t = p.easyui.getArrayItem(e, o.valueField, t); return t ? t[o.textField] : void 0 }(h, o.mappingRows) || h, s.push(h), l.push(u) } t || p(i).combo("setText", l.join(o.separator)), o.showItemIcon && ((t = p(i).combobox("textbox")).removeClass("textbox-bgicon " + o.textboxIconCls), a && a.iconCls && (t.addClass("textbox-bgicon " + a.iconCls), o.textboxIconCls = a.iconCls)), p(i).combo("setValues", s), e.triggerHandler("scroll") } function l(t, e, i) { var n = p.data(t, "combobox"), o = n.options; n.data = o.loadFilter.call(t, e), o.view.render.call(o.view, t, p(t).combo("panel"), n.data); var r = p(t).combobox("getValues"); p.easyui.forEach(n.data, !1, function (t) { t.selected && p.easyui.addArrayItem(r, t[o.valueField] + "") }), o.multiple ? s(t, r, i) : s(t, r.length ? [r[r.length - 1]] : [], i), o.onLoadSuccess.call(t, e) } function g(e, t, i, n) { var o = p.data(e, "combobox").options; t && (o.url = t), i = p.extend({}, o.queryParams, i || {}), 0 != o.onBeforeLoad.call(e, i) && o.loader.call(e, i, function (t) { l(e, t, n) }, function () { o.onLoadError.apply(this, arguments) }) } p.fn.combobox = function (n, t) { if ("string" != typeof n) return n = n || {}, this.each(function () { var t, e, i = p.data(this, "combobox"); i ? p.extend(i.options, n) : i = p.data(this, "combobox", { options: p.extend({}, p.fn.combobox.defaults, p.fn.combobox.parseOptions(this), n), data: [] }), t = this, e = p.data(t, "combobox").options, p(t).addClass("combobox-f"), p(t).combo(p.extend({}, e, { onShowPanel: function () { p(this).combo("panel").find("div.combobox-item:hidden,div.combobox-group:hidden").show(), s(this, p(this).combobox("getValues"), !0), p(this).combobox("scrollTo", p(this).combobox("getValue")), e.onShowPanel.call(this) } })), i.options.data ? l(this, i.options.data) : (i = p.fn.combobox.parseData(this)).length && l(this, i), g(this) }); var e = p.fn.combobox.methods[n]; return e ? e(this, t) : this.combo(n, t) }, p.fn.combobox.methods = { options: function (t) { var e = t.combo("options"); return p.extend(p.data(t[0], "combobox").options, { width: e.width, height: e.height, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, cloneFrom: function (t, e) { return t.each(function () { p(this).combo("cloneFrom", e), p.data(this, "combobox", p(e).data("combobox")), p(this).addClass("combobox-f").attr("comboboxName", p(this).attr("textboxName")) }) }, getData: function (t) { return p.data(t[0], "combobox").data }, setValues: function (t, i) { return t.each(function () { var e = p(this).combobox("options"); p.isArray(i) && (i = p.map(i, function (t) { return t && "object" == typeof t ? (p.easyui.addArrayItem(e.mappingRows, e.valueField, t), t[e.valueField]) : t })), s(this, i) }) }, setValue: function (t, e) { return t.each(function () { p(this).combobox("setValues", p.isArray(e) ? e : [e]) }) }, clear: function (t) { return t.each(function () { s(this, []) }) }, reset: function (t) { return t.each(function () { var t = p(this).combobox("options"); t.multiple ? p(this).combobox("setValues", t.originalValue) : p(this).combobox("setValue", t.originalValue) }) }, loadData: function (t, e) { return t.each(function () { l(this, e) }) }, reload: function (t, e) { return t.each(function () { "string" == typeof e ? g(this, e) : (e && (p(this).combobox("options").queryParams = e), g(this)) }) }, select: function (t, e) { return t.each(function () { f(this, e) }) }, unselect: function (t, e) { return t.each(function () { r(this, e) }) }, scrollTo: function (t, r) { return t.each(function () { var t, e, i, n, o; t = this, e = r, n = p.data(t, "combobox").options, o = p(t).combo("panel"), (e = n.finder.getEl(t, e)).length && (e.position().top <= 0 ? (i = o.scrollTop() + e.position().top, o.scrollTop(i)) : e.position().top + e.outerHeight() > o.height() && (i = o.scrollTop() + e.position().top + e.outerHeight() - o.height(), o.scrollTop(i))), o.triggerHandler("scroll") }) } }, p.fn.combobox.parseOptions = function (t) { p(t); return p.extend({}, p.fn.combo.parseOptions(t), p.parser.parseOptions(t, ["valueField", "textField", "groupField", "groupPosition", "mode", "method", "url", { showItemIcon: "boolean", limitToList: "boolean" }])) }, p.fn.combobox.parseData = function (t) { var o = [], r = p(t).combobox("options"); return p(t).children().each(function () { var t; "optgroup" == this.tagName.toLowerCase() ? (t = p(this).attr("label"), p(this).children().each(function () { e(this, t) })) : e(this) }), o; function e(t, e) { var i = p(t), n = {}; n[r.valueField] = null != i.attr("value") ? i.attr("value") : i.text(), n[r.textField] = i.text(), n.iconCls = p.parser.parseOptions(t, ["iconCls"]).iconCls, n.selected = i.is(":selected"), n.disabled = i.is(":disabled"), e && (r.groupField = r.groupField || "group", n[r.groupField] = e), o.push(n) } }; var u = 0, t = { render: function (t, e, i) { var n = p.data(t, "combobox"), o = n.options, r = p(t).attr("id") || ""; u++ , n.itemIdPrefix = r + "_easyui_combobox_i" + u, n.groupIdPrefix = r + "_easyui_combobox_g" + u, n.groups = []; for (var a = [], s = void 0, l = 0; l < i.length; l++){ var c = i[l], d = (c[o.valueField], c[o.textField]), h = c[o.groupField]; h ? s != h ? (s = h, n.groups.push({ value: h, startIndex: l, count: 1 }), a.push('<div id="' + n.groupIdPrefix + "_" + (n.groups.length - 1) + '" class="combobox-group">'), a.push(o.groupFormatter ? o.groupFormatter.call(t, h) : h), a.push("</div>")) : n.groups[n.groups.length - 1].count++ : s = void 0; h = "combobox-item" + (c.disabled ? " combobox-item-disabled" : "") + (h ? " combobox-gitem" : ""); a.push('<div id="' + n.itemIdPrefix + "_" + l + '" class="' + h + '">'), o.showItemIcon && c.iconCls && a.push('<span class="combobox-icon ' + c.iconCls + '"></span>'), a.push(o.formatter ? o.formatter.call(t, c) : d), a.push("</div>") } p(e).html(a.join("")) } }; p.fn.combobox.defaults = p.extend({}, p.fn.combo.defaults, { valueField: "value", textField: "text", groupPosition: "static", groupField: null, groupFormatter: function (t) { return t }, mode: "local", method: "post", url: null, data: null, queryParams: {}, showItemIcon: !1, limitToList: !1, unselectedValues: [], mappingRows: [], view: t, keyHandler: { up: function (t) { e(this, "prev"), t.preventDefault() }, down: function (t) { e(this, "next"), t.preventDefault() }, left: function (t) { }, right: function (t) { }, enter: function (t) { !function (e) { var t, i = p(e), n = i.combobox("options"), o = i.combobox("panel").children("div.combobox-item-hover"); o.length && (o.removeClass("combobox-item-hover"), t = n.finder.getRow(e, o)[n.valueField], n.multiple && o.hasClass("combobox-item-selected") ? i.combobox("unselect", t) : i.combobox("select", t)); var r = []; p.map(i.combobox("getValues"), function (t) { 0 <= a(e, t) && r.push(t) }), i.combobox("setValues", r), n.multiple || i.combobox("hidePanel") }(this) }, query: function (t, e) { function i(t) { h.reversed ? u.addClass("combobox-item-hover") : s(l, !h.multiple || n ? t : [], !0) } var l, n, c, d, o, h, u, r; l = this, n = t, o = p.data(l, "combobox"), h = o.options, u = p(), r = h.multiple ? n.split(h.separator) : [n], "remote" == h.mode ? (i(r), g(l, null, { q: n }, !0)) : ((t = p(l).combo("panel")).find(".combobox-item-hover").removeClass("combobox-item-hover"), t.find(".combobox-item,.combobox-group").hide(), c = o.data, d = [], p.map(r, function (t) { var e = t = p.trim(t), i = void 0; u = p(); for (var n = 0; n < c.length; n++){ var o, r, a, s = c[n]; h.filter.call(l, t, s) && (o = s[h.valueField], r = s[h.textField], a = s[h.groupField], s = h.finder.getEl(l, o).show(), r.toLowerCase() == t.toLowerCase() && (e = o, h.reversed ? u = s : f(l, o, !0)), h.groupField && i != a && (h.finder.getGroupEl(l, a).show(), i = a)) } d.push(e) }), i(d)) } }, inputEvents: p.extend({}, p.fn.combo.defaults.inputEvents, { blur: function (t) { p.fn.combo.defaults.inputEvents.blur(t); var i = t.data.target, n = p(i).combobox("options"); (n.reversed || n.limitToList) && (n.blurTimer && clearTimeout(n.blurTimer), n.blurTimer = setTimeout(function () { var e; p(i).parent().length && (n.reversed ? p(i).combobox("setValues", p(i).combobox("getValues")) : n.limitToList && (e = [], p.map(p(i).combobox("getValues"), function (t) { 0 <= p.easyui.indexOfArray(p(i).combobox("getData"), n.valueField, t) && e.push(t) }), p(i).combobox("setValues", e)), n.blurTimer = null) }, 50)) } }), panelEvents: { mouseover: function (t) { p(this).children("div.combobox-item-hover").removeClass("combobox-item-hover"); var e = p(t.target).closest("div.combobox-item"); e.hasClass("combobox-item-disabled") || e.addClass("combobox-item-hover"), t.stopPropagation() }, mouseout: function (t) { p(t.target).closest("div.combobox-item").removeClass("combobox-item-hover"), t.stopPropagation() }, mousedown: function (t) { t.preventDefault(), t.stopPropagation() }, click: function (t) { var e, i, n, o = p(this).panel("options").comboTarget; o && (e = p(o).combobox("options"), !(i = p(t.target).closest("div.combobox-item")).length || i.hasClass("combobox-item-disabled") || (n = e.finder.getRow(o, i)) && (e.blurTimer && (clearTimeout(e.blurTimer), e.blurTimer = null), e.onClick.call(o, n), n = n[e.valueField], e.multiple ? (i.hasClass("combobox-item-selected") ? r : f)(o, n) : p(o).combobox("setValue", n).combobox("hidePanel"), t.stopPropagation())) }, scroll: function (t) { var i, n, o, r = p(this).panel("options").comboTarget; !r || "sticky" == (i = p(r).combobox("options")).groupPosition && ((n = p(this).children(".combobox-stick")).length || (n = p('<div class="combobox-stick"></div>').appendTo(this)), n.hide(), o = p(r).data("combobox"), p(this).children(".combobox-group:visible").each(function () { var t = p(this), e = i.finder.getGroup(r, t), e = o.data[e.startIndex + e.count - 1], e = i.finder.getEl(r, e[i.valueField]); if (t.position().top < 0 && 0 < e.position().top) return n.show().html(t.html()), !1 })) } }, filter: function (t, e) { return 0 <= e[p(this).combobox("options").textField].toLowerCase().indexOf(t.toLowerCase()) }, formatter: function (t) { return t[p(this).combobox("options").textField] }, loader: function (t, e, i) { var n = p(this).combobox("options"); if (!n.url) return !1; p.ajax({ type: n.method, url: n.url, data: t, dataType: "json", success: function (t) { e(t) }, error: function () { i.apply(this, arguments) } }) }, loadFilter: function (t) { return t }, finder: { getEl: function (t, e) { e = a(t, e), e = p.data(t, "combobox").itemIdPrefix + "_" + e; return p("#" + e) }, getGroupEl: function (t, e) { t = p.data(t, "combobox"), e = p.easyui.indexOfArray(t.groups, "value", e), e = t.groupIdPrefix + "_" + e; return p("#" + e) }, getGroup: function (t, e) { t = p.data(t, "combobox"), e = e.attr("id").substr(t.groupIdPrefix.length + 1); return t.groups[parseInt(e)] }, getRow: function (t, e) { var i = p.data(t, "combobox"), e = e instanceof p ? e.attr("id").substr(i.itemIdPrefix.length + 1) : a(t, e); return i.data[parseInt(e)] } }, onBeforeLoad: function (t) { }, onLoadSuccess: function (t) { }, onLoadError: function () { }, onSelect: function (t) { }, onUnselect: function (t) { }, onClick: function (t) { } }) }(jQuery), function (f) { function s(t) { var e = f.data(t, "combotree"), i = e.options, n = e.tree, o = []; i.multiple ? o = f.map(n.tree("getChecked"), function (t) { return t.id }) : (n = n.tree("getSelected")) && o.push(n.id), l(t, o = o.concat(i.unselectedValues), e.remainText) } function l(t, e, i) { var n = f.data(t, "combotree"), o = n.options, r = n.tree, a = r.tree("options"), s = a.onBeforeCheck, l = a.onCheck, c = a.onBeforeSelect, n = a.onSelect; a.onBeforeCheck = a.onCheck = a.onBeforeSelect = a.onSelect = function () { }, f.isArray(e) || (e = e.split(o.separator)), o.multiple || (e = e.length ? [e[0]] : [""]); var d = f.map(e, function (t) { return String(t) }); r.find("div.tree-node-selected").removeClass("tree-node-selected"), f.map(r.tree("getChecked"), function (t) { -1 == f.inArray(String(t.id), d) && r.tree("uncheck", t.target) }); var h = []; function u(t) { return t[o.textField || ""] || t.text } o.unselectedValues = [], f.map(d, function (t) { var e = r.tree("find", t); e ? (r.tree("check", e.target).tree("select", e.target), h.push(u(e))) : (h.push(function (t, e) { t = f.easyui.getArrayItem(e, "id", t); return t ? u(t) : void 0 }(t, o.mappingRows) || t), o.unselectedValues.push(t)) }), o.multiple && f.map(r.tree("getChecked"), function (t) { var e = String(t.id); -1 == f.inArray(e, d) && (d.push(e), h.push(u(t))) }), a.onBeforeCheck = s, a.onCheck = l, a.onBeforeSelect = c, a.onSelect = n, i || (i = h.join(o.separator), f(t).combo("getText") != i && f(t).combo("setText", i)), f(t).combo("setValues", d) } f.fn.combotree = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = f.data(this, "combotree"); t ? f.extend(t.options, e) : f.data(this, "combotree", { options: f.extend({}, f.fn.combotree.defaults, f.fn.combotree.parseOptions(this), e) }), function (n) { var o = f.data(n, "combotree"), r = o.options, a = o.tree; f(n).addClass("combotree-f"), f(n).combo(f.extend({}, r, { onShowPanel: function () { r.editable && a.tree("doFilter", ""), r.onShowPanel.call(this) } })); var t = f(n).combo("panel"); a || (a = f("<ul></ul>").appendTo(t), o.tree = a), a.tree(f.extend({}, r, { checkbox: r.multiple, onLoadSuccess: function (t, e) { var i = f(n).combotree("getValues"); r.multiple && f.map(a.tree("getChecked"), function (t) { f.easyui.addArrayItem(i, t.id) }), l(n, i, o.remainText), r.onLoadSuccess.call(this, t, e) }, onClick: function (t) { r.multiple ? f(this).tree(t.checked ? "uncheck" : "check", t.target) : f(n).combo("hidePanel"), o.remainText = !1, s(n), r.onClick.call(this, t) }, onCheck: function (t, e) { o.remainText = !1, s(n), r.onCheck.call(this, t, e) } })) }(this) }); var i = f.fn.combotree.methods[e]; return i ? i(this, t) : this.combo(e, t) }, f.fn.combotree.methods = { options: function (t) { var e = t.combo("options"); return f.extend(f.data(t[0], "combotree").options, { width: e.width, height: e.height, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, clone: function (t, e) { e = t.combo("clone", e); return e.data("combotree", { options: f.extend(!0, {}, t.combotree("options")), tree: t.combotree("tree") }), e }, tree: function (t) { return f.data(t[0], "combotree").tree }, loadData: function (t, e) { return t.each(function () { f.data(this, "combotree").options.data = e, f.data(this, "combotree").tree.tree("loadData", e) }) }, reload: function (t, i) { return t.each(function () { var t = f.data(this, "combotree").options, e = f.data(this, "combotree").tree; i && (t.url = i), e.tree({ url: t.url }) }) }, setValues: function (t, i) { return t.each(function () { var e = f(this).combotree("options"); f.isArray(i) && (i = f.map(i, function (t) { return t && "object" == typeof t ? (f.easyui.addArrayItem(e.mappingRows, "id", t), t.id) : t })), l(this, i) }) }, setValue: function (t, e) { return t.each(function () { f(this).combotree("setValues", f.isArray(e) ? e : [e]) }) }, clear: function (t) { return t.each(function () { f(this).combotree("setValues", []) }) }, reset: function (t) { return t.each(function () { var t = f(this).combotree("options"); t.multiple ? f(this).combotree("setValues", t.originalValue) : f(this).combotree("setValue", t.originalValue) }) } }, f.fn.combotree.parseOptions = function (t) { return f.extend({}, f.fn.combo.parseOptions(t), f.fn.tree.parseOptions(t)) }, f.fn.combotree.defaults = f.extend({}, f.fn.combo.defaults, f.fn.tree.defaults, { editable: !1, textField: null, unselectedValues: [], mappingRows: [], keyHandler: { up: function (t) { }, down: function (t) { }, left: function (t) { }, right: function (t) { }, enter: function (t) { var e; e = this, f.data(e, "combotree").remainText = !1, f(e).combotree("setValues", f(e).combotree("getValues")), f(e).combotree("hidePanel") }, query: function (t, e) { var i, n, o; i = this, n = t, o = f.data(i, "combotree"), t = o.options, i = o.tree, o.remainText = !0, i.tree("doFilter", t.multiple ? n.split(t.separator) : n) } } }) }(jQuery), function (g) { function n(e) { var t = g.data(e, "combogrid"), o = t.options, i = t.grid; g(e).addClass("combogrid-f").combo(g.extend({}, o, { onShowPanel: function () { c(this, g(this).combogrid("getValues"), !0); var t = g(this).combogrid("panel"), e = t.outerHeight() - t.height(), i = t._size("minHeight"), n = t._size("maxHeight"), t = g(this).combogrid("grid"); t.datagrid("resize", { width: "100%", height: isNaN(parseInt(o.panelHeight)) ? "auto" : "100%", minHeight: i ? i - e : "", maxHeight: n ? n - e : "" }); e = t.datagrid("getSelected"); e && t.datagrid("scrollTo", t.datagrid("getRowIndex", e)), o.onShowPanel.call(this) } })); var n = g(e).combo("panel"); function a(t) { return g(t).closest(".combo-panel").panel("options").comboTarget || e } function r(n) { return function (t, e) { var i = a(this), i = g(i).combogrid("options"); "onUnselectAll" == n && !i.multiple || s.call(this), i[n].call(this, t, e) } } function s() { var t = g(this), e = a(t), i = g(e).data("combogrid"), n = i.options, o = (o = g.map(t.datagrid("getSelections"), function (t) { return t[n.idField] })).concat(n.unselectedValues), r = t.data("datagrid").dc.body2, t = r.scrollTop(); c(e, o, i.remainText), r.scrollTop(t) } i || (i = g("<table></table>").appendTo(n), t.grid = i), i.datagrid(g.extend({}, o, { border: !1, singleSelect: !o.multiple, onLoadSuccess: function (t) { var e = a(this), i = g(e).data("combogrid"), n = i.options, o = g(e).combo("getValues"); c(e, o, i.remainText), n.onLoadSuccess.call(this, t) }, onClickRow: function (t, e) { var i = a(this), n = g(i).data("combogrid"), o = n.options; n.remainText = !1, s.call(this), o.multiple || g(i).combo("hidePanel"); o.onClickRow.call(this, t, e) }, onSelect: r("onSelect"), onUnselect: r("onUnselect"), onSelectAll: r("onSelectAll"), onUnselectAll: r("onUnselectAll") })) } function e(t, e) { var i, n = g.data(t, "combogrid"), o = n.options, r = n.grid, a = r.datagrid("getRows").length; a && ((t = o.finder.getTr(r[0], null, "highlight")).length || (t = o.finder.getTr(r[0], null, "selected")), t.length ? (i = parseInt(t.attr("datagrid-row-index")), (i += "next" == e ? 1 : -1) < 0 && (i = a - 1), a <= i && (i = 0)) : i = "next" == e ? 0 : a - 1, r.datagrid("highlightRow", i), o.selectOnNavigation && (n.remainText = !1, r.datagrid("selectRow", i))) } function c(t, e, i) { var n = g.data(t, "combogrid"), o = n.options, r = n.grid, a = g(t).combo("getValues"), s = g(t).combo("options"), l = s.onChange; s.onChange = function () { }; var c = r.datagrid("options"), d = c.onSelect, n = c.onUnselectAll; c.onSelect = c.onUnselectAll = function () { }, g.isArray(e) || (e = e.split(o.separator)), o.multiple || (e = e.length ? [e[0]] : [""]); var h = g.map(e, function (t) { return String(t) }), h = g.grep(h, function (t, e) { return e === g.inArray(t, h) }), u = g.grep(r.datagrid("getSelections"), function (t, e) { return 0 <= g.inArray(String(t[o.idField]), h) }); r.datagrid("clearSelections"), r.data("datagrid").selectedRows = u; var f = []; function p(t, e) { t = g.easyui.getArrayItem(e, o.idField, t); return t ? t[o.textField] : void 0 } o.unselectedValues = [], g.map(h, function (t) { var e = r.datagrid("getRowIndex", t); 0 <= e ? r.datagrid("selectRow", e) : -1 == g.easyui.indexOfArray(u, o.idField, t) && o.unselectedValues.push(t), f.push(p(t, r.datagrid("getRows")) || p(t, u) || p(t, o.mappingRows) || t) }), g(t).combo("setValues", a), s.onChange = l, c.onSelect = d, c.onUnselectAll = n, i || (i = f.join(o.separator), g(t).combo("getText") != i && g(t).combo("setText", i)), g(t).combo("setValues", e) } g.fn.combogrid = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = g.data(this, "combogrid"); t ? g.extend(t.options, e) : t = g.data(this, "combogrid", { options: g.extend({}, g.fn.combogrid.defaults, g.fn.combogrid.parseOptions(this), e) }), n(this) }); var i = g.fn.combogrid.methods[e]; return i ? i(this, t) : this.combo(e, t) }, g.fn.combogrid.methods = { options: function (t) { var e = t.combo("options"); return g.extend(g.data(t[0], "combogrid").options, { width: e.width, height: e.height, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, cloneFrom: function (t, e) { return t.each(function () { g(this).combo("cloneFrom", e), g.data(this, "combogrid", { options: g.extend(!0, { cloned: !0 }, g(e).combogrid("options")), combo: g(this).next(), panel: g(e).combo("panel"), grid: g(e).combogrid("grid") }) }) }, grid: function (t) { return g.data(t[0], "combogrid").grid }, setValues: function (t, i) { return t.each(function () { var e = g(this).combogrid("options"); g.isArray(i) && (i = g.map(i, function (t) { return t && "object" == typeof t ? (g.easyui.addArrayItem(e.mappingRows, e.idField, t), t[e.idField]) : t })), c(this, i) }) }, setValue: function (t, e) { return t.each(function () { g(this).combogrid("setValues", g.isArray(e) ? e : [e]) }) }, clear: function (t) { return t.each(function () { g(this).combogrid("setValues", []) }) }, reset: function (t) { return t.each(function () { var t = g(this).combogrid("options"); t.multiple ? g(this).combogrid("setValues", t.originalValue) : g(this).combogrid("setValue", t.originalValue) }) } }, g.fn.combogrid.parseOptions = function (t) { g(t); return g.extend({}, g.fn.combo.parseOptions(t), g.fn.datagrid.parseOptions(t), g.parser.parseOptions(t, ["idField", "textField", "mode"])) }, g.fn.combogrid.defaults = g.extend({}, g.fn.combo.defaults, g.fn.datagrid.defaults, { loadMsg: null, idField: null, textField: null, unselectedValues: [], mappingRows: [], mode: "local", keyHandler: { up: function (t) { e(this, "prev"), t.preventDefault() }, down: function (t) { e(this, "next"), t.preventDefault() }, left: function (t) { }, right: function (t) { }, enter: function (t) { !function (t) { var e = g.data(t, "combogrid"), i = e.options, n = e.grid, o = i.finder.getTr(n[0], null, "highlight"); e.remainText = !1, o.length && (e = parseInt(o.attr("datagrid-row-index")), i.multiple && o.hasClass("datagrid-row-selected") ? n.datagrid("unselectRow", e) : n.datagrid("selectRow", e)); var r = []; g.map(n.datagrid("getSelections"), function (t) { r.push(t[i.idField]) }), g.map(i.unselectedValues, function (t) { 0 <= g.easyui.indexOfArray(i.mappingRows, i.idField, t) && g.easyui.addArrayItem(r, t) }), g(t).combogrid("setValues", r), i.multiple || g(t).combogrid("hidePanel") }(this) }, query: function (t, e) { !function (n, t) { var o = (i = g.data(n, "combogrid")).options, r = i.grid; i.remainText = !0; var e, a, i = o.multiple ? t.split(o.separator) : [t]; function s(t, e) { for (var i = 0; i < t.length; i++){ var n = t[i]; if ((n[o.textField] || "").toLowerCase() == e.toLowerCase()) return a.push(n[o.idField]), i } return -1 } function l(t) { o.reversed || c(n, t, !0) } i = g.grep(i, function (t) { return "" != g.trim(t) }), "remote" == o.mode ? (l(i), r.datagrid("load", g.extend({}, o.queryParams, { q: t }))) : (r.datagrid("highlightRow", -1), e = r.datagrid("getRows"), a = [], g.map(i, function (i) { i = g.trim(i); s(o.mappingRows, i), s(r.datagrid("getSelections"), i); var t = s(e, i); 0 <= t ? o.reversed && r.datagrid("highlightRow", t) : g.map(e, function (t, e) { o.filter.call(n, i, t) && r.datagrid("highlightRow", e) }) }), l(a)) }(this, t) } }, inputEvents: g.extend({}, g.fn.combo.defaults.inputEvents, { blur: function (t) { g.fn.combo.defaults.inputEvents.blur(t); t = t.data.target; g(t).combogrid("options").reversed && g(t).combogrid("setValues", g(t).combogrid("getValues")) } }), panelEvents: { mousedown: function (t) { } }, filter: function (t, e) { return 0 <= (e[g(this).combogrid("options").textField] || "").toLowerCase().indexOf(t.toLowerCase()) } }) }(jQuery), function (f) { function a(t) { var e = f.data(t, "combotreegrid"), i = e.options, n = e.grid, e = []; i.multiple ? e = f.map(n.treegrid("getCheckedNodes"), function (t) { return t[i.idField] }) : (n = n.treegrid("getSelected")) && e.push(n[i.idField]), s(t, e = e.concat(i.unselectedValues)) } function s(t, e) { var i = f.data(t, "combotreegrid"), n = i.options, o = i.grid, r = o.datagrid("options"), a = r.onBeforeCheck, s = r.onCheck, l = r.onBeforeSelect, c = r.onSelect; r.onBeforeCheck = r.onCheck = r.onBeforeSelect = r.onSelect = function () { }, f.isArray(e) || (e = e.split(n.separator)), n.multiple || (e = e.length ? [e[0]] : [""]); var d = f.map(e, function (t) { return String(t) }), d = f.grep(d, function (t, e) { return e === f.inArray(t, d) }), e = o.treegrid("getSelected"); e && o.treegrid("unselect", e[n.idField]), f.map(o.treegrid("getCheckedNodes"), function (t) { -1 == f.inArray(String(t[n.idField]), d) && o.treegrid("uncheckNode", t[n.idField]) }); var h = []; function u(t) { return t[n.textField || ""] || t[n.treeField] } n.unselectedValues = [], f.map(d, function (t) { var e = o.treegrid("find", t); e ? (n.multiple ? o.treegrid("checkNode", t) : o.treegrid("select", t), h.push(u(e))) : (h.push(function (t, e) { t = f.easyui.getArrayItem(e, n.idField, t); return t ? u(t) : void 0 }(t, n.mappingRows) || t), n.unselectedValues.push(t)) }), n.multiple && f.map(o.treegrid("getCheckedNodes"), function (t) { var e = String(t[n.idField]); -1 == f.inArray(e, d) && (d.push(e), h.push(u(t))) }), r.onBeforeCheck = a, r.onCheck = s, r.onBeforeSelect = l, r.onSelect = c, i.remainText || (i = h.join(n.separator), f(t).combo("getText") != i && f(t).combo("setText", i)), f(t).combo("setValues", d) } function e(t) { var e = f.data(t, "combotreegrid"), i = e.options, n = e.grid, o = i.finder.getTr(n[0], null, "highlight"); e.remainText = !1, o.length && (e = o.attr("node-id"), i.multiple ? o.hasClass("datagrid-row-selected") ? n.treegrid("uncheckNode", e) : n.treegrid("checkNode", e) : n.treegrid("selectRow", e)); var r = []; i.multiple ? f.map(n.treegrid("getCheckedNodes"), function (t) { r.push(t[i.idField]) }) : (n = n.treegrid("getSelected")) && r.push(n[i.idField]), f.map(i.unselectedValues, function (t) { 0 <= f.easyui.indexOfArray(i.mappingRows, i.idField, t) && f.easyui.addArrayItem(r, t) }), f(t).combotreegrid("setValues", r), i.multiple || f(t).combotreegrid("hidePanel") } f.fn.combotreegrid = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var n, o, r, t = f.data(this, "combotreegrid"); t ? f.extend(t.options, e) : t = f.data(this, "combotreegrid", { options: f.extend({}, f.fn.combotreegrid.defaults, f.fn.combotreegrid.parseOptions(this), e) }), n = this, o = f.data(n, "combotreegrid"), r = o.options, f(n).addClass("combotreegrid-f").combo(f.extend({}, r, { onShowPanel: function () { var t = f(this).combotreegrid("panel"), e = t.outerHeight() - t.height(), i = t._size("minHeight"), n = t._size("maxHeight"), t = f(this).combotreegrid("grid"); t.treegrid("resize", { width: "100%", height: isNaN(parseInt(r.panelHeight)) ? "auto" : "100%", minHeight: i ? i - e : "", maxHeight: n ? n - e : "" }); e = t.treegrid("getSelected"); e && t.treegrid("scrollTo", e[r.idField]), r.onShowPanel.call(this) } })), o.grid || (t = f(n).combo("panel"), o.grid = f("<table></table>").appendTo(t)), o.grid.treegrid(f.extend({}, r, { border: !1, checkbox: r.multiple, onLoadSuccess: function (t, e) { var i = f(n).combotreegrid("getValues"); r.multiple && f.map(f(this).treegrid("getCheckedNodes"), function (t) { f.easyui.addArrayItem(i, t[r.idField]) }), s(n, i), r.onLoadSuccess.call(this, t, e), o.remainText = !1 }, onClickRow: function (t) { r.multiple ? (f(this).treegrid(t.checked ? "uncheckNode" : "checkNode", t[r.idField]), f(this).treegrid("unselect", t[r.idField])) : f(n).combo("hidePanel"), a(n), r.onClickRow.call(this, t) }, onCheckNode: function (t, e) { a(n), r.onCheckNode.call(this, t, e) } })) }); var i = f.fn.combotreegrid.methods[e]; return i ? i(this, t) : this.combo(e, t) }, f.fn.combotreegrid.methods = { options: function (t) { var e = t.combo("options"); return f.extend(f.data(t[0], "combotreegrid").options, { width: e.width, height: e.height, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, grid: function (t) { return f.data(t[0], "combotreegrid").grid }, setValues: function (t, i) { return t.each(function () { var e = f(this).combotreegrid("options"); f.isArray(i) && (i = f.map(i, function (t) { return t && "object" == typeof t ? (f.easyui.addArrayItem(e.mappingRows, e.idField, t), t[e.idField]) : t })), s(this, i) }) }, setValue: function (t, e) { return t.each(function () { f(this).combotreegrid("setValues", f.isArray(e) ? e : [e]) }) }, clear: function (t) { return t.each(function () { f(this).combotreegrid("setValues", []) }) }, reset: function (t) { return t.each(function () { var t = f(this).combotreegrid("options"); t.multiple ? f(this).combotreegrid("setValues", t.originalValue) : f(this).combotreegrid("setValue", t.originalValue) }) } }, f.fn.combotreegrid.parseOptions = function (t) { f(t); return f.extend({}, f.fn.combo.parseOptions(t), f.fn.treegrid.parseOptions(t), f.parser.parseOptions(t, ["mode", { limitToGrid: "boolean" }])) }, f.fn.combotreegrid.defaults = f.extend({}, f.fn.combo.defaults, f.fn.treegrid.defaults, { editable: !1, singleSelect: !0, limitToGrid: !1, unselectedValues: [], mappingRows: [], mode: "local", textField: null, keyHandler: { up: function (t) { }, down: function (t) { }, left: function (t) { }, right: function (t) { }, enter: function (t) { e(this) }, query: function (t, e) { !function (n, t) { var e = f.data(n, "combotreegrid"), o = e.options, r = e.grid; e.remainText = !0; var a, s, i = o.multiple ? t.split(o.separator) : [t]; function l(t) { o.reversed || f(n).combotreegrid("setValues", t) } i = f.grep(i, function (t) { return "" != f.trim(t) }), r.treegrid("clearSelections").treegrid("clearChecked").treegrid("highlightRow", -1), "remote" == o.mode ? (l(i), r.treegrid("load", f.extend({}, o.queryParams, { q: t }))) : t && (a = r.treegrid("getData"), s = [], f.map(i, function (e) { var i; (e = f.trim(e)) && (i = void 0, f.easyui.forEach(a, !0, function (t) { return e.toLowerCase() == String(t[o.treeField]).toLowerCase() ? (i = t[o.idField], !1) : o.filter.call(n, e, t) ? (r.treegrid("expandTo", t[o.idField]), r.treegrid("highlightRow", t[o.idField]), !1) : void 0 }), null == i && f.easyui.forEach(o.mappingRows, !1, function (t) { if (e.toLowerCase() == String(t[o.treeField])) return i = t[o.idField], !1 }), null != i ? s.push(i) : s.push(e)) }), l(s), e.remainText = !1) }(this, t) } }, inputEvents: f.extend({}, f.fn.combo.defaults.inputEvents, { blur: function (t) { f.fn.combo.defaults.inputEvents.blur(t); t = t.data.target; f(t).combotreegrid("options").limitToGrid && e(t) } }), filter: function (t, e) { return 0 <= (e[f(this).combotreegrid("options").treeField] || "").toLowerCase().indexOf(t.toLowerCase()) } }) }(jQuery), function (l) { function c(t, e) { var i = l(t).next(), n = e ? l(e) : i.find(".tagbox-label"); n.length && (e = l(t).tagbox("textbox"), t = (t = l(n[0])).outerHeight(!0) - t.outerHeight(), t = e.outerHeight() - 2 * t, n.css({ height: t + "px", lineHeight: t + "px" }), i.find(".textbox-addon").css("height", "100%").find(".textbox-icon").css("height", "100%"), i.find(".textbox-button").linkbutton("resize", { height: "100%" })) } function r(t) { var e = l(t).tagbox("options"), i = l(t).tagbox("textbox"), n = l(t).next(), o = l("<span></span>").appendTo("body"); o.attr("style", i.attr("style")), o.css({ position: "absolute", top: -9999, left: -9999, width: "auto", fontFamily: i.css("fontFamily"), fontSize: i.css("fontSize"), fontWeight: i.css("fontWeight"), whiteSpace: "nowrap" }); t = r(i.val()), e = r(e.prompt || ""); o.remove(); e = Math.min(Math.max(t, e) + 20, n.width()); function r(t) { t = t.replace(/&/g, "&amp;").replace(/\s/g, " ").replace(/</g, "&lt;").replace(/>/g, "&gt;"); return o.html(t), o.outerWidth() } i._outerWidth(e), n.find(".textbox-button").linkbutton("resize", { height: "100%" }) } function e(t) { var e, i, n = l(t), o = n.tagbox("options"); o.limitToList ? ((e = n.tagbox("panel").children("div.combobox-item-hover")).length && (e.removeClass("combobox-item-hover"), i = o.finder.getRow(t, e)[o.valueField], l(t).tagbox(e.hasClass("combobox-item-selected") ? "unselect" : "select", i)), l(t).tagbox("hidePanel")) : "" !== (e = l.trim(l(t).tagbox("getText"))) && ((i = l(t).tagbox("getValues")).push(e), l(t).tagbox("setValues", i)) } l.fn.tagbox = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var a, s, o, t = l.data(this, "tagbox"); function i() { l(a).next().find(".tagbox-label").remove(); var r = l(a).tagbox("textbox"); l.map(l(a).tagbox("getValues"), function (t, e) { var i = s.finder.getRow(a, t), n = s.tagFormatter.call(a, t, i), o = {}, i = s.tagStyler.call(a, t, i) || "", o = "string" == typeof i ? { s: i } : { c: i.class || "", s: i.style || "" }, n = l('<span class="tagbox-label"></span>').insertBefore(r).html(n); n.attr("tagbox-index", e), n.attr("style", o.s).addClass(o.c), l('<a href="javascript:;" class="tagbox-remove"></a>').appendTo(n) }), c(a), l(a).combobox("setText", "") } t ? l.extend(t.options, e) : l.data(this, "tagbox", { options: l.extend({}, l.fn.tagbox.defaults, l.fn.tagbox.parseOptions(this), e) }), a = this, s = l.data(a, "tagbox").options, l(a).addClass("tagbox-f").combobox(l.extend({}, s, { cls: "tagbox", reversed: !0, onChange: function (t, e) { i(), l(this).combobox("hidePanel"), s.onChange.call(a, t, e) }, onResizing: function (t, e) { var i = l(this).combobox("textbox"), n = l(this).data("textbox").textbox, o = n.outerWidth(); n.css({ height: "", paddingLeft: i.css("marginLeft"), paddingRight: i.css("marginRight") }), i.css("margin", 0), n._outerWidth(o), r(a), c(this), s.onResizing.call(a, t, e) }, onLoadSuccess: function (t) { i(), s.onLoadSuccess.call(a, t) } })), i(), r(a), l(o = this).next()._unbind(".tagbox")._bind("click.tagbox", function (t) { var e = l(o).tagbox("options"); if (!e.disabled && !e.readonly) { if (l(t.target).hasClass("tagbox-remove")) { var i = parseInt(l(t.target).parent().attr("tagbox-index")), n = l(o).tagbox("getValues"); if (0 == e.onBeforeRemoveTag.call(o, n[i])) return; e.onRemoveTag.call(o, n[i]), n.splice(i, 1), l(o).tagbox("setValues", n) } else { t = l(t.target).closest(".tagbox-label"); t.length && (i = parseInt(t.attr("tagbox-index")), n = l(o).tagbox("getValues"), e.onClickTag.call(o, n[i])) } l(this).find(".textbox-text").focus() } })._bind("keyup.tagbox", function (t) { r(o) })._bind("mouseover.tagbox", function (t) { l(t.target).closest(".textbox-button,.textbox-addon,.tagbox-label").length ? l(this).triggerHandler("mouseleave") : l(this).find(".textbox-text").triggerHandler("mouseenter") })._bind("mouseleave.tagbox", function (t) { l(this).find(".textbox-text").triggerHandler("mouseleave") }) }); var i = l.fn.tagbox.methods[e]; return i ? i(this, t) : this.combobox(e, t) }, l.fn.tagbox.methods = { options: function (t) { var e = t.combobox("options"); return l.extend(l.data(t[0], "tagbox").options, { width: e.width, height: e.height, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, setValues: function (t, i) { return t.each(function () { var t, e; e = i, l(t = this).combobox("setText", ""), r(t), l(t).combobox("setValues", e), l(t).combobox("setText", ""), l(t).tagbox("validate") }) }, reset: function (t) { return t.each(function () { l(this).combobox("reset").combobox("setText", "") }) } }, l.fn.tagbox.parseOptions = function (t) { return l.extend({}, l.fn.combobox.parseOptions(t), l.parser.parseOptions(t, [])) }, l.fn.tagbox.defaults = l.extend({}, l.fn.combobox.defaults, { hasDownArrow: !1, multiple: !0, reversed: !0, selectOnNavigation: !1, tipOptions: l.extend({}, l.fn.textbox.defaults.tipOptions, { showDelay: 200 }), val: function (t) { var e = l(t).parent().prev().tagbox("getValues"); return l(t).is(":focus") && e.push(l(t).val()), e.join(",") }, inputEvents: l.extend({}, l.fn.combo.defaults.inputEvents, { blur: function (t) { t = t.data.target; l(t).tagbox("options").limitToList && e(t) } }), keyHandler: l.extend({}, l.fn.combobox.defaults.keyHandler, { enter: function (t) { e(this) }, query: function (t, e) { l(this).tagbox("options").limitToList ? l.fn.combobox.defaults.keyHandler.query.call(this, t, e) : l(this).combobox("hidePanel") } }), tagFormatter: function (t, e) { var i = l(this).tagbox("options"); return e ? e[i.textField] : t }, tagStyler: function (t, e) { return "" }, onClickTag: function (t) { }, onBeforeRemoveTag: function (t) { }, onRemoveTag: function (t) { } }) }(jQuery), function (l) { function n(t) { var e, i, a = l.data(t, "datebox"), s = a.options; l(t).addClass("datebox-f").combo(l.extend({}, s, { onShowPanel: function () { var i, n, t, e, o, r; n = l(i = this).datebox("options"), l(i).combo("panel")._unbind(".datebox")._bind("click.datebox", function (t) { var e; l(t.target).hasClass("datebox-button-a") && (e = parseInt(l(t.target).attr("datebox-button-index")), n.buttons[e].handler.call(t.target, i)) }), function (t) { var e = l(t).combo("panel"); if (!e.children("div.datebox-button").length) { for (var i = l('<div class="datebox-button"><table cellspacing="0" cellpadding="0" style="width:100%"><tr></tr></table></div>').appendTo(e).find("tr"), n = 0; n < s.buttons.length; n++){ var o = l("<td></td>").appendTo(i), r = s.buttons[n]; l('<a class="datebox-button-a" href="javascript:;"></a>').html(l.isFunction(r.text) ? r.text(t) : r.text).appendTo(o).attr("datebox-button-index", n) } i.find("td").css("width", 100 / s.buttons.length + "%") } }(this), o = l(t = this).combo("panel"), r = o.children("div.datebox-calendar-inner"), o.children()._outerWidth(o.width()), a.calendar.appendTo(r), a.calendar[0].target = t, "auto" != s.panelHeight && (e = o.height(), o.children().not(r).each(function () { e -= l(this).outerHeight() }), r._outerHeight(e)), a.calendar.calendar("resize"), c(this, l(this).datebox("getText"), !0), s.onShowPanel.call(this) } })), a.calendar || ((i = l(t).combo("panel").css("overflow", "hidden")).panel("options").onBeforeDestroy = function () { var t = l(this).find(".calendar-shared"); t.length && t.insertBefore(t[0].pholder) }, e = l('<div class="datebox-calendar-inner"></div>').prependTo(i), s.sharedCalendar ? ((i = l(s.sharedCalendar))[0].pholder || (i[0].pholder = l('<div class="calendar-pholder" style="display:none"></div>').insertAfter(i)), i.addClass("calendar-shared").appendTo(e), i.hasClass("calendar") || i.calendar(), a.calendar = i) : a.calendar = l("<div></div>").appendTo(e).calendar(), l.extend(a.calendar.calendar("options"), { fit: !0, border: !1, onSelect: function (t) { var e = this.target, i = l(e).datebox("options"); i.onSelect.call(e, t), c(e, i.formatter.call(e, t)), l(e).combo("hidePanel") } })), l(t).combo("textbox").parent().addClass("datebox"), l(t).datebox("initValue", s.value) } function o(t) { var e = l.data(t, "datebox"), i = e.options, e = e.calendar.calendar("options").current; e && (c(t, i.formatter.call(t, e)), l(t).combo("hidePanel")) } function c(t, e, i) { var n = l.data(t, "datebox"), o = n.options, n = n.calendar; n.calendar("moveTo", o.parser.call(t, e)), i ? l(t).combo("setValue", e) : (e = e && o.formatter.call(t, n.calendar("options").current), l(t).combo("setText", e).combo("setValue", e)) } l.fn.datebox = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = l.data(this, "datebox"); t ? l.extend(t.options, e) : l.data(this, "datebox", { options: l.extend({}, l.fn.datebox.defaults, l.fn.datebox.parseOptions(this), e) }), n(this) }); var i = l.fn.datebox.methods[e]; return i ? i(this, t) : this.combo(e, t) }, l.fn.datebox.methods = { options: function (t) { var e = t.combo("options"); return l.extend(l.data(t[0], "datebox").options, { width: e.width, height: e.height, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, cloneFrom: function (t, e) { return t.each(function () { l(this).combo("cloneFrom", e), l.data(this, "datebox", { options: l.extend(!0, {}, l(e).datebox("options")), calendar: l(e).datebox("calendar") }), l(this).addClass("datebox-f") }) }, calendar: function (t) { return l.data(t[0], "datebox").calendar }, initValue: function (t, e) { return t.each(function () { var t, e = l(this).datebox("options"), i = e.value; i && (t = e.parser.call(this, i), i = e.formatter.call(this, t), l(this).datebox("calendar").calendar("moveTo", t)), l(this).combo("initValue", i).combo("setText", i) }) }, setValue: function (t, e) { return t.each(function () { c(this, e) }) }, reset: function (t) { return t.each(function () { var t = l(this).datebox("options"); l(this).datebox("setValue", t.originalValue) }) }, setDate: function (t, e) { return t.each(function () { var t = l(this).datebox("options"); l(this).datebox("calendar").calendar("moveTo", e), c(this, e ? t.formatter.call(this, e) : "") }) }, getDate: function (t) { return t.datebox("getValue") ? t.datebox("calendar").calendar("options").current : null } }, l.fn.datebox.parseOptions = function (t) { return l.extend({}, l.fn.combo.parseOptions(t), l.parser.parseOptions(t, ["sharedCalendar"])) }, l.fn.datebox.defaults = l.extend({}, l.fn.combo.defaults, { panelWidth: 250, panelHeight: "auto", sharedCalendar: null, keyHandler: { up: function (t) { }, down: function (t) { }, left: function (t) { }, right: function (t) { }, enter: function (t) { o(this) }, query: function (t, e) { c(this, t, !0) } }, currentText: "Today", closeText: "Close", okText: "Ok", buttons: [{ text: function (t) { return l(t).datebox("options").currentText }, handler: function (t) { var e = l(t).datebox("options"), i = new Date, i = new Date(i.getFullYear(), i.getMonth(), i.getDate()); l(t).datebox("calendar").calendar({ year: i.getFullYear(), month: i.getMonth() + 1, current: i }), e.onSelect.call(t, i), o(t) } }, { text: function (t) { return l(t).datebox("options").closeText }, handler: function (t) { l(this).closest("div.combo-panel").panel("close") } }], formatter: function (t) { var e = t.getFullYear(), i = t.getMonth() + 1, t = t.getDate(); return (i < 10 ? "0" + i : i) + "/" + (t < 10 ? "0" + t : t) + "/" + e }, parser: function (t) { var e = l.fn.calendar.defaults.Date; if (l(this).data("datebox") && (e = l(this).datebox("calendar").calendar("options").Date), !t) return new e; var i = t.split("/"), n = parseInt(i[0], 10), t = parseInt(i[1], 10), i = parseInt(i[2], 10); return isNaN(i) || isNaN(n) || isNaN(t) ? new e : new e(i, n - 1, t) }, onSelect: function (t) { } }) }(jQuery), function (r) { function e(t) { var e, i, n = r.data(t, "datetimebox").options, e = (i = r(e = t).datetimebox("calendar"), e = r(e).datetimebox("spinner"), i = i.calendar("options").current, new Date(i.getFullYear(), i.getMonth(), i.getDate(), e.timespinner("getHours"), e.timespinner("getMinutes"), e.timespinner("getSeconds"))); a(t, n.formatter.call(t, e)), r(t).combo("hidePanel") } function a(n, t, e) { var o = r.data(n, "datetimebox").options; r(n).combo("setValue", t), e || (t ? (i = o.parser.call(n, t), r(n).combo("setText", o.formatter.call(n, i)), r(n).combo("setValue", o.formatter.call(n, i))) : r(n).combo("setText", t)); var i = o.parser.call(n, t); r(n).datetimebox("calendar").calendar("moveTo", i), r(n).datetimebox("spinner").timespinner("setValue", function (t) { function e(t) { return (t < 10 ? "0" : "") + t } var i = [e(t.getHours()), e(t.getMinutes())]; o.showSeconds && i.push(e(t.getSeconds())); return i.join(r(n).datetimebox("spinner").timespinner("options").separator) }(i)) } r.fn.datetimebox = function (o, t) { if ("string" != typeof o) return o = o || {}, this.each(function () { var t, e, i, n = r.data(this, "datetimebox"); n ? r.extend(n.options, o) : r.data(this, "datetimebox", { options: r.extend({}, r.fn.datetimebox.defaults, r.fn.datetimebox.parseOptions(this), o) }), t = this, e = r.data(t, "datetimebox"), i = e.options, r(t).datebox(r.extend({}, i, { onShowPanel: function () { a(this, r(this).datetimebox("getValue"), !0), i.onShowPanel.call(this) }, formatter: r.fn.datebox.defaults.formatter, parser: r.fn.datebox.defaults.parser })), r(t).removeClass("datebox-f").addClass("datetimebox-f"), r(t).datebox("calendar").calendar({ onSelect: function (t) { i.onSelect.call(this.target, t) } }), e.spinner || (n = r(t).datebox("panel"), n = r('<div style="padding:2px"><input></div>').insertAfter(n.children("div.datebox-calendar-inner")), e.spinner = n.children("input")), e.spinner.timespinner({ width: i.spinnerWidth, showSeconds: i.showSeconds, separator: i.timeSeparator, hour12: i.hour12 }), r(t).datetimebox("initValue", i.value) }); var e = r.fn.datetimebox.methods[o]; return e ? e(this, t) : this.datebox(o, t) }, r.fn.datetimebox.methods = { options: function (t) { var e = t.datebox("options"); return r.extend(r.data(t[0], "datetimebox").options, { originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, cloneFrom: function (t, e) { return t.each(function () { r(this).datebox("cloneFrom", e), r.data(this, "datetimebox", { options: r.extend(!0, {}, r(e).datetimebox("options")), spinner: r(e).datetimebox("spinner") }), r(this).removeClass("datebox-f").addClass("datetimebox-f") }) }, spinner: function (t) { return r.data(t[0], "datetimebox").spinner }, initValue: function (t, e) { return t.each(function () { var t, e = r(this).datetimebox("options"), i = e.value; i && (t = e.parser.call(this, i), i = e.formatter.call(this, t), r(this).datetimebox("calendar").calendar("moveTo", t)), r(this).combo("initValue", i).combo("setText", i) }) }, setValue: function (t, e) { return t.each(function () { a(this, e) }) }, reset: function (t) { return t.each(function () { var t = r(this).datetimebox("options"); r(this).datetimebox("setValue", t.originalValue) }) }, setDate: function (t, e) { return t.each(function () { var t = r(this).datetimebox("options"); r(this).datetimebox("calendar").calendar("moveTo", e), a(this, e ? t.formatter.call(this, e) : "") }) }, getDate: function (t) { return t.datetimebox("getValue") ? t.datetimebox("calendar").calendar("options").current : null } }, r.fn.datetimebox.parseOptions = function (t) { r(t); return r.extend({}, r.fn.datebox.parseOptions(t), r.parser.parseOptions(t, ["timeSeparator", "spinnerWidth", { showSeconds: "boolean" }])) }, r.fn.datetimebox.defaults = r.extend({}, r.fn.datebox.defaults, { spinnerWidth: "100%", showSeconds: !0, timeSeparator: ":", hour12: !1, panelEvents: { mousedown: function (t) { } }, keyHandler: { up: function (t) { }, down: function (t) { }, left: function (t) { }, right: function (t) { }, enter: function (t) { e(this) }, query: function (t, e) { a(this, t, !0) } }, buttons: [{ text: function (t) { return r(t).datetimebox("options").currentText }, handler: function (t) { a(t, r(t).datetimebox("options").formatter.call(t, new Date)), r(t).datetimebox("hidePanel") } }, { text: function (t) { return r(t).datetimebox("options").okText }, handler: function (t) { e(t) } }, { text: function (t) { return r(t).datetimebox("options").closeText }, handler: function (t) { r(t).datetimebox("hidePanel") } }], formatter: function (t) { return t ? r.fn.datebox.defaults.formatter.call(this, t) + " " + r.fn.timespinner.defaults.formatter.call(r(this).datetimebox("spinner")[0], t) : "" }, parser: function (t) { if (!(t = r.trim(t))) return new Date; var e = t.split(" "), t = r.fn.datebox.defaults.parser.call(this, e[0]); if (e.length < 2) return t; e = r.fn.timespinner.defaults.parser.call(r(this).datetimebox("spinner")[0], e[1] + (e[2] ? " " + e[2] : "")); return new Date(t.getFullYear(), t.getMonth(), t.getDate(), e.getHours(), e.getMinutes(), e.getSeconds()) } }) }(jQuery), function (b) { function n(t) { var a = b.data(t, "timepicker").options; b(t).addClass("timepicker-f").combo(b.extend({}, a, { onShowPanel: function () { var i, n; n = b(i = this).timepicker("options"), b(i).combo("panel")._unbind(".timepicker")._bind("click.timepicker", function (t) { var e; b(t.target).hasClass("datebox-button-a") && (e = parseInt(b(t.target).attr("datebox-button-index")), n.buttons[e].handler.call(t.target, i)) }), function (t) { var e = b(t).combo("panel"); if (!e.children("div.datebox-button").length) { for (var i = b('<div class="datebox-button"><table cellspacing="0" cellpadding="0" style="width:100%"><tr></tr></table></div>').appendTo(e).find("tr"), n = 0; n < a.buttons.length; n++){ var o = b("<td></td>").appendTo(i), r = a.buttons[n]; b('<a class="datebox-button-a" href="javascript:;"></a>').html(b.isFunction(r.text) ? r.text(t) : r.text).appendTo(o).attr("datebox-button-index", n) } i.find("td").css("width", 100 / a.buttons.length + "%") } }(t), o(t, b(t).timepicker("getValue")) } })), b(t).timepicker("initValue", a.value) } function o(t, e) { var i, n = b(t).data("timepicker").options; e ? (e = (i = e.split(" "))[0].split(":"), n.selectingHour = parseInt(e[0], 10), n.selectingMinute = parseInt(e[1], 10), n.selectingAmpm = i[1]) : (n.selectingHour = 12, n.selectingMinute = 0, n.selectingAmpm = n.ampm[0]), function i(n) { var o = b(n).data("timepicker").options; var t = b(n).combo("panel"); var e = t.children(".timepicker-panel"); e.length || (e = b('<div class="timepicker-panel f-column"></div>').prependTo(t)); e.empty(); "auto" != o.panelHeight && (t = t.height() - t.find(".datebox-button").outerHeight(), e._outerHeight(t)); a(n); s(n); e.off(".timepicker"); e.on("click.timepicker", ".title-hour", function (t) { o.selectingType = "hour", i(n) }).on("click.timepicker", ".title-minute", function (t) { o.selectingType = "minute", i(n) }).on("click.timepicker", ".title-am", function (t) { o.selectingAmpm = o.ampm[0], i(n) }).on("click.timepicker", ".title-pm", function (t) { o.selectingAmpm = o.ampm[1], i(n) }).on("click.timepicker", ".item", function (t) { var e = parseInt(b(this).text(), 10); "hour" == o.selectingType ? o.selectingHour = e : o.selectingMinute = e, i(n) }) }(t) } function r(t) { var e = b(t).data("timepicker").options, i = e.selectingHour, n = e.selectingMinute, t = (t = e.selectingAmpm) || e.ampm[0], n = (i < 10 ? "0" + i : i) + ":" + (n < 10 ? "0" + n : n); return e.hour24 || (n += " " + t), n } function a(t) { var e = b(t).data("timepicker").options, i = b(t).combo("panel").find(".timepicker-panel"), n = e.selectingHour, t = e.selectingMinute; b('<div class="panel-header f-noshrink f-row f-content-center"><div class="title title-hour">' + (n < 10 ? "0" + n : n) + '</div><div class="sep">:</div><div class="title title-minute">' + (t < 10 ? "0" + t : t) + '</div><div class="ampm f-column"><div class="title title-am">' + e.ampm[0] + '</div><div class="title title-pm">' + e.ampm[1] + "</div></div></div>").appendTo(i); i = i.find(".panel-header"); ("hour" == e.selectingType ? i.find(".title-hour") : i.find(".title-minute")).addClass("title-selected"), e.selectingAmpm == e.ampm[0] && i.find(".title-am").addClass("title-selected"), e.selectingAmpm == e.ampm[1] && i.find(".title-pm").addClass("title-selected"), e.hour24 && i.find(".ampm").hide() } function s(t) { var i = b(t).data("timepicker").options, e = b(t).combo("panel").find(".timepicker-panel"), n = b('<div class="clock-wrap f-full f-column f-content-center"></div>').appendTo(e), o = n.outerWidth(), t = n.outerHeight(), e = Math.min(o, t) - 20, r = e / 2, o = e, t = e, a = "hour" == i.selectingType ? i.selectingHour : i.selectingMinute, s = a / ("hour" == i.selectingType ? 12 : 60) * 360, e = { transform: "rotate(" + (s = parseFloat(s).toFixed(4)) + "deg)" }; i.hour24 && "hour" == i.selectingType && (0 == a ? e.top = i.hourDistance[0] + "px" : a <= 12 && (e.top = i.hourDistance[1] + "px")); var t = { width: o + "px", height: t + "px", marginLeft: -o / 2 + "px", marginTop: -t / 2 + "px" }, l = []; l.push('<div class="clock">'), l.push('<div class="center"></div>'), l.push('<div class="hand">'), l.push('<div class="drag"></div>'), l.push("</div>"); var c = function () { var t = []; if ("hour" == i.selectingType) { for (var e = 0; e < 12; e++)t.push(String(e)); t[0] = "12" } else { for (e = 0; e < 60; e += 5)t.push(e < 10 ? "0" + e : String(e)); t[0] = "00" } return t }(); if (i.hour24 && "hour" == i.selectingType) { for (var d = 0; d < c.length; d++){ var h = parseInt(c[d], 10); 24 == (h += 12) && (h = "00"); var u = "item f-column f-content-center"; h == a && (u += " item-selected"); var s = h / ("hour" == i.selectingType ? 12 : 60) * 360 * Math.PI / 180, f = (r - 20) * Math.sin(s), p = -(r - 20) * Math.cos(s); s = parseFloat(s).toFixed(4); var g = { transform: "translate(" + (f = parseFloat(f).toFixed(4)) + "px," + (p = parseFloat(p).toFixed(4)) + "px)" }, g = "transform:translate(" + f + "px," + p + "px)"; l.push('<div class="' + u + '" style="' + g + '">' + h + "</div>") } r -= i.hourDistance[1] - i.hourDistance[0] } for (d = 0; d < c.length; d++){ u = "item f-column f-content-center"; (h = c[d]) == a && (u += " item-selected"); s = h / ("hour" == i.selectingType ? 12 : 60) * 360 * Math.PI / 180, f = (r - 20) * Math.sin(s), p = -(r - 20) * Math.cos(s); s = parseFloat(s).toFixed(4); g = { transform: "translate(" + (f = parseFloat(f).toFixed(4)) + "px," + (p = parseFloat(p).toFixed(4)) + "px)" }, g = "transform:translate(" + f + "px," + p + "px)"; l.push('<div class="' + u + '" style="' + g + '">' + h + "</div>") } l.push("</div>"), n.html(l.join("")), n.find(".clock").css(t), n.find(".hand").css(e) } b.fn.timepicker = function (e, t) { if ("string" != typeof e) return e = e || {}, this.each(function () { var t = b.data(this, "timepicker"); t ? b.extend(t.options, e) : b.data(this, "timepicker", { options: b.extend({}, b.fn.timepicker.defaults, b.fn.timepicker.parseOptions(this), e) }), n(this) }); var i = b.fn.timepicker.methods[e]; return i ? i(this, t) : this.combo(e, t) }, b.fn.timepicker.methods = { options: function (t) { var e = t.combo("options"); return b.extend(b.data(t[0], "timepicker").options, { width: e.width, height: e.height, originalValue: e.originalValue, disabled: e.disabled, readonly: e.readonly }) }, initValue: function (t, e) { return t.each(function () { var t = b(this).timepicker("options"); o(this, t.value = e), e && (t.value = r(this), b(this).combo("initValue", t.value).combo("setText", t.value)) }) }, setValue: function (t, n) { return t.each(function () { var t, e, i; e = n, i = b(t = this).data("timepicker").options, o(t, e), i.value = r(t), b(t).combo("setValue", i.value).combo("setText", i.value) }) }, reset: function (t) { return t.each(function () { var t = b(this).timepicker("options"); b(this).timepicker("setValue", t.originalValue) }) } }, b.fn.timepicker.parseOptions = function (t) { return b.extend({}, b.fn.combo.parseOptions(t), b.parser.parseOptions(t, [{ hour24: "boolean" }])) }, b.fn.timepicker.defaults = b.extend({}, b.fn.combo.defaults, { closeText: "Close", okText: "Ok", buttons: [{ text: function (t) { return b(t).timepicker("options").okText }, handler: function (t) { b(t).timepicker("setValue", r(t)), b(this).closest("div.combo-panel").panel("close") } }, { text: function (t) { return b(t).timepicker("options").closeText }, handler: function (t) { b(this).closest("div.combo-panel").panel("close") } }], editable: !1, ampm: ["am", "pm"], value: "", selectingHour: 12, selectingMinute: 0, selectingType: "hour", hour24: !1, hourDistance: [20, 50] }) }(jQuery), function ($) { function init(i) { var t = $('<div class="slider"><div class="slider-inner"><a href="javascript:;" class="slider-handle"></a><span class="slider-tip"></span></div><div class="slider-rule"></div><div class="slider-rulelabel"></div><div style="clear:both"></div><input type="hidden" class="slider-value"></div>').insertAfter(i), e = $(i); e.addClass("slider-f").hide(); var n = e.attr("name"); return n && (t.find("input.slider-value").attr("name", n), e.removeAttr("name").attr("sliderName", n)), t._bind("_resize", function (t, e) { return ($(this).hasClass("easyui-fluid") || e) && _d04(i), !1 }), t } function _d04(t, e) { var i = $.data(t, "slider"), n = i.options, i = i.slider; e && (e.width && (n.width = e.width), e.height && (n.height = e.height)), i._size(n), "h" == n.mode ? (i.css("height", ""), i.children("div").css("height", "")) : (i.css("width", ""), i.children("div").css("width", ""), i.children("div.slider-rule,div.slider-rulelabel,div.slider-inner")._outerHeight(i._outerHeight())), _d09(t) } function _d0a(t) { var t = $.data(t, "slider"), a = t.options, s = t.slider, t = "h" == a.mode ? a.rule : a.rule.slice(0).reverse(); a.reversed && (t = t.slice(0).reverse()), function (t) { var e = s.find("div.slider-rule"), i = s.find("div.slider-rulelabel"); e.empty(), i.empty(); for (var n = 0; n < t.length; n++){ var o = 100 * n / (t.length - 1) + "%", r = $("<span></span>").appendTo(e); r.css("h" == a.mode ? "left" : "top", o), "|" != t[n] && ((r = $("<span></span>").appendTo(i)).html(t[n]), "h" == a.mode ? r.css({ left: o, marginLeft: -Math.round(r.outerWidth() / 2) }) : r.css({ top: o, marginTop: -Math.round(r.outerHeight() / 2) })) } }(t) } function _d11(r) { var i = $.data(r, "slider"), a = i.options, n = i.slider; n.removeClass("slider-h slider-v slider-disabled"), n.addClass("h" == a.mode ? "slider-h" : "slider-v"), n.addClass(a.disabled ? "slider-disabled" : ""); var t = n.find(".slider-inner"); function o(t, e) { var i, n = _d1c(r, t), o = Math.abs(n % a.step); o < a.step / 2 ? n -= o : n = n - o + a.step, i = n, t = 1 < (t = String(a.step).split(".")).length ? t[1].length : 0, n = parseFloat(i.toFixed(t)), a.range ? (o = a.value[0], i = a.value[1], t = parseFloat((o + i) / 2), e ? (e = 0 < $(e).nextAll(".slider-handle").length, n <= i && e ? o = n : o <= n && !e && (i = n)) : n < o || !(i < n) && n < t ? o = n : i = n, $(r).slider("setValues", [o, i])) : $(r).slider("setValue", n) } t.html('<a href="javascript:;" class="slider-handle"></a><span class="slider-tip"></span>'), a.range && t.append('<a href="javascript:;" class="slider-handle"></a><span class="slider-tip"></span>'), n.find("a.slider-handle").draggable({ axis: a.mode, cursor: "pointer", disabled: a.disabled, onDrag: function (t) { var e = t.data.left, i = n.width(); return "h" != a.mode && (e = t.data.top, i = n.height()), e < 0 || i < e || o(e, this), !1 }, onStartDrag: function () { i.isDragging = !0, a.onSlideStart.call(r, a.value) }, onStopDrag: function (t) { o("h" == a.mode ? t.data.left : t.data.top, this), a.onSlideEnd.call(r, a.value), a.onComplete.call(r, a.value), i.isDragging = !1 } }), n.find("div.slider-inner")._unbind(".slider")._bind("mousedown.slider", function (t) { var e; i.isDragging || a.disabled || (e = $(this).offset(), o("h" == a.mode ? t.pageX - e.left : t.pageY - e.top), a.onComplete.call(r, a.value)) }) } function _d1e(t, e) { var i = $.data(t, "slider"), n = i.options, o = i.slider, i = $.isArray(n.value) ? n.value : [n.value], r = []; $.isArray(e) || (e = $.map(String(e).split(n.separator), function (t) { return parseFloat(t) })), o.find(".slider-value").remove(); for (var a = $(t).attr("sliderName") || "", s = 0; s < e.length; s++){ var l = e[s]; l < n.min && (l = n.min), l > n.max && (l = n.max); var c = $('<input type="hidden" class="slider-value">').appendTo(o); c.attr("name", a), c.val(l), r.push(l); var d, h = o.find(".slider-handle:eq(" + s + ")"), u = h.next(), c = _d28(t, l); n.showTip ? (u.show(), u.html(n.tipFormatter.call(t, l))) : u.hide(), "h" == n.mode ? (d = "left:" + c + "px;", h.attr("style", d), u.attr("style", d + "margin-left:" + -Math.round(u.outerWidth() / 2) + "px")) : (d = "top:" + c + "px;", h.attr("style", d), u.attr("style", d + "margin-left:" + -Math.round(u.outerWidth()) + "px")) } n.value = n.range ? r : r[0], $(t).val(n.range ? r.join(n.separator) : r[0]), i.join(",") != r.join(",") && n.onChange.call(t, n.value, n.range ? i : i[0]) } function _d09(t) { var e = $.data(t, "slider").options, i = e.onChange; e.onChange = function () { }, _d1e(t, e.value), e.onChange = i } function _d28(t, e) { var i = $.data(t, "slider"), n = i.options, o = i.slider, i = "h" == n.mode ? o.width() : o.height(), e = n.converter.toPosition.call(t, e, i); return "v" == n.mode && (e = o.height() - e), n.reversed && (e = i - e), e } function _d1c(t, e) { var i = $.data(t, "slider"), n = i.options, i = i.slider, i = "h" == n.mode ? i.width() : i.height(), e = "h" == n.mode ? n.reversed ? i - e : e : n.reversed ? e : i - e; return n.converter.toValue.call(t, e, i) } $.fn.slider = function (e, t) { return "string" == typeof e ? $.fn.slider.methods[e](this, t) : (e = e || {}, this.each(function () { var t = $.data(this, "slider"); t ? $.extend(t.options, e) : (t = $.data(this, "slider", { options: $.extend({}, $.fn.slider.defaults, $.fn.slider.parseOptions(this), e), slider: init(this) }), $(this)._propAttr("disabled", !1)); t = t.options; t.min = parseFloat(t.min), t.max = parseFloat(t.max), t.range ? ($.isArray(t.value) || (t.value = $.map(String(t.value).split(t.separator), function (t) { return parseFloat(t) })), t.value.length < 2 && t.value.push(t.max)) : t.value = parseFloat(t.value), t.step = parseFloat(t.step), t.originalValue = t.value, _d11(this), _d0a(this), _d04(this) })) }, $.fn.slider.methods = { options: function (t) { return $.data(t[0], "slider").options }, destroy: function (t) { return t.each(function () { $.data(this, "slider").slider.remove(), $(this).remove() }) }, resize: function (t, e) { return t.each(function () { _d04(this, e) }) }, getValue: function (t) { return t.slider("options").value }, getValues: function (t) { return t.slider("options").value }, setValue: function (t, e) { return t.each(function () { _d1e(this, [e]) }) }, setValues: function (t, e) { return t.each(function () { _d1e(this, e) }) }, clear: function (t) { return t.each(function () { var t = $(this).slider("options"); _d1e(this, t.range ? [t.min, t.max] : [t.min]) }) }, reset: function (t) { return t.each(function () { var t = $(this).slider("options"); $(this).slider(t.range ? "setValues" : "setValue", t.originalValue) }) }, enable: function (t) { return t.each(function () { $.data(this, "slider").options.disabled = !1, _d11(this) }) }, disable: function (t) { return t.each(function () { $.data(this, "slider").options.disabled = !0, _d11(this) }) } }, $.fn.slider.parseOptions = function (_d39) { var t = $(_d39); return $.extend({}, $.parser.parseOptions(_d39, ["width", "height", "mode", { reversed: "boolean", showTip: "boolean", range: "boolean", min: "number", max: "number", step: "number" }]), { value: t.val() || void 0, disabled: !!t.attr("disabled") || void 0, rule: t.attr("rule") ? eval(t.attr("rule")) : void 0 }) }, $.fn.slider.defaults = { width: "auto", height: "auto", mode: "h", reversed: !1, showTip: !1, disabled: !1, range: !1, value: 0, separator: ",", min: 0, max: 100, step: 1, rule: [], tipFormatter: function (t) { return t }, converter: { toPosition: function (t, e) { var i = $(this).slider("options"); return (t - i.min) / (i.max - i.min) * e }, toValue: function (t, e) { var i = $(this).slider("options"); return i.min + (i.max - i.min) * (t / e) } }, onChange: function (t, e) { }, onSlideStart: function (t) { }, onSlideEnd: function (t) { }, onComplete: function (t) { } } }(jQuery); var fabric = fabric || { version: "4.3.0" }, jsdom, virtualWindow; function resizeCanvasIfNeeded(t) { var e = t.targetCanvas, i = e.width, n = e.height, o = t.destinationWidth, t = t.destinationHeight; i === o && n === t || (e.width = o, e.height = t) } function copyGLTo2DDrawImage(t, e) { var i = t.canvas, n = e.targetCanvas, t = n.getContext("2d"); t.translate(0, n.height), t.scale(1, -1); e = i.height - n.height; t.drawImage(i, 0, e, n.width, n.height, 0, 0, n.width, n.height) } function copyGLTo2DPutImageData(t, e) { var i = e.targetCanvas.getContext("2d"), n = e.destinationWidth, o = e.destinationHeight, r = n * o * 4, e = new Uint8Array(this.imageBuffer, 0, r), r = new Uint8ClampedArray(this.imageBuffer, 0, r); t.readPixels(0, 0, n, o, t.RGBA, t.UNSIGNED_BYTE, e); o = new ImageData(r, n, o); i.putImageData(o, 0, 0) } "undefined" != typeof exports ? exports.fabric = fabric : "function" == typeof define && define.amd && define([], function () { return fabric }), "undefined" != typeof document && "undefined" != typeof window ? (document instanceof ("undefined" != typeof HTMLDocument ? HTMLDocument : Document) ? fabric.document = document : fabric.document = document.implementation.createHTMLDocument(""), fabric.window = window) : (jsdom = require("jsdom"), virtualWindow = new jsdom.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"), { features: { FetchExternalResources: ["img"] }, resources: "usable" }).window, fabric.document = virtualWindow.document, fabric.jsdomImplForWrapper = require("jsdom/lib/jsdom/living/generated/utils").implForWrapper, fabric.nodeCanvas = require("jsdom/lib/jsdom/utils").Canvas, fabric.window = virtualWindow, DOMParser = fabric.window.DOMParser), fabric.isTouchSupported = "ontouchstart" in fabric.window || "ontouchstart" in fabric.document || fabric.window && fabric.window.navigator && 0 < fabric.window.navigator.maxTouchPoints, fabric.isLikelyNode = "undefined" != typeof Buffer && "undefined" == typeof window, fabric.SHARED_ATTRIBUTES = ["display", "transform", "fill", "fill-opacity", "fill-rule", "opacity", "stroke", "stroke-dasharray", "stroke-linecap", "stroke-dashoffset", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "id", "paint-order", "vector-effect", "instantiated_by_use", "clip-path"], fabric.DPI = 96, fabric.reNum = "(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)", fabric.commaWsp = "(?:\\s+,?\\s*|,\\s*)", fabric.rePathCommand = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi, fabric.reNonWord = /[ \n\.,;!\?\-]/, fabric.fontPaths = {}, fabric.iMatrix = [1, 0, 0, 1, 0, 0], fabric.svgNS = "http://www.w3.org/2000/svg", fabric.perfLimitSizeTotal = 2097152, fabric.maxCacheSideLimit = 4096, fabric.minCacheSideLimit = 256, fabric.charWidthsCache = {}, fabric.textureSize = 2048, fabric.disableStyleCopyPaste = !1, fabric.enableGLFiltering = !0, fabric.devicePixelRatio = fabric.window.devicePixelRatio || fabric.window.webkitDevicePixelRatio || fabric.window.mozDevicePixelRatio || 1, fabric.browserShadowBlurConstant = 1, fabric.arcToSegmentsCache = {}, fabric.boundsOfCurveCache = {}, fabric.cachesBoundsOfCurve = !0, fabric.forceGLPutImageData = !1, fabric.initFilterBackend = function () { return fabric.enableGLFiltering && fabric.isWebglSupported && fabric.isWebglSupported(fabric.textureSize) ? (console.log("max texture size: " + fabric.maxTextureSize), new fabric.WebglFilterBackend({ tileSize: fabric.textureSize })) : fabric.Canvas2dFilterBackend ? new fabric.Canvas2dFilterBackend : void 0 }, "undefined" != typeof document && "undefined" != typeof window && (window.fabric = fabric), function () { function n(t, e) { this.__eventListeners[t] && (t = this.__eventListeners[t], e ? t[t.indexOf(e)] = !1 : fabric.util.array.fill(t, !1)) } fabric.Observable = { fire: function (t, e) { if (!this.__eventListeners) return this; var i = this.__eventListeners[t]; if (!i) return this; for (var n = 0, o = i.length; n < o; n++)i[n] && i[n].call(this, e || {}); return this.__eventListeners[t] = i.filter(function (t) { return !1 !== t }), this }, on: function (t, e) { if (this.__eventListeners || (this.__eventListeners = {}), 1 === arguments.length) for (var i in t) this.on(i, t[i]); else this.__eventListeners[t] || (this.__eventListeners[t] = []), this.__eventListeners[t].push(e); return this }, off: function (t, e) { if (!this.__eventListeners) return this; if (0 === arguments.length) for (t in this.__eventListeners) n.call(this, t); else if (1 === arguments.length && "object" == typeof arguments[0]) for (var i in t) n.call(this, i, t[i]); else n.call(this, t, e); return this } } }(), fabric.Collection = { _objects: [], add: function () { if (this._objects.push.apply(this._objects, arguments), this._onObjectAdded) for (var t = 0, e = arguments.length; t < e; t++)this._onObjectAdded(arguments[t]); return this.renderOnAddRemove && this.requestRenderAll(), this }, insertAt: function (t, e, i) { var n = this._objects; return i ? n[e] = t : n.splice(e, 0, t), this._onObjectAdded && this._onObjectAdded(t), this.renderOnAddRemove && this.requestRenderAll(), this }, remove: function () { for (var t, e = this._objects, i = !1, n = 0, o = arguments.length; n < o; n++)-1 !== (t = e.indexOf(arguments[n])) && (i = !0, e.splice(t, 1), this._onObjectRemoved && this._onObjectRemoved(arguments[n])); return this.renderOnAddRemove && i && this.requestRenderAll(), this }, forEachObject: function (t, e) { for (var i = this.getObjects(), n = 0, o = i.length; n < o; n++)t.call(e, i[n], n, i); return this }, getObjects: function (e) { return void 0 === e ? this._objects.concat() : this._objects.filter(function (t) { return t.type === e }) }, item: function (t) { return this._objects[t] }, isEmpty: function () { return 0 === this._objects.length }, size: function () { return this._objects.length }, contains: function (t) { return -1 < this._objects.indexOf(t) }, complexity: function () { return this._objects.reduce(function (t, e) { return t += e.complexity ? e.complexity() : 0 }, 0) } }, fabric.CommonMethods = { _setOptions: function (t) { for (var e in t) this.set(e, t[e]) }, _initGradient: function (t, e) { !t || !t.colorStops || t instanceof fabric.Gradient || this.set(e, new fabric.Gradient(t)) }, _initPattern: function (t, e, i) { !t || !t.source || t instanceof fabric.Pattern ? i && i() : this.set(e, new fabric.Pattern(t, i)) }, _setObject: function (t) { for (var e in t) this._set(e, t[e]) }, set: function (t, e) { return "object" == typeof t ? this._setObject(t) : this._set(t, e), this }, _set: function (t, e) { this[t] = e }, toggle: function (t) { var e = this.get(t); return "boolean" == typeof e && this.set(t, !e), this }, get: function (t) { return this[t] } }, function (r) { var d = Math.sqrt, h = Math.atan2, a = Math.pow, s = Math.PI / 180, i = Math.PI / 2; fabric.util = { cos: function (t) { if (0 === t) return 1; switch (t < 0 && (t = -t), t / i) { case 1: case 3: return 0; case 2: return -1 }return Math.cos(t) }, sin: function (t) { if (0 === t) return 0; var e = t < 0 ? -1 : 1; switch (t / i) { case 1: return e; case 2: return 0; case 3: return -e }return Math.sin(t) }, removeFromArray: function (t, e) { e = t.indexOf(e); return -1 !== e && t.splice(e, 1), t }, getRandomInt: function (t, e) { return Math.floor(Math.random() * (e - t + 1)) + t }, degreesToRadians: function (t) { return t * s }, radiansToDegrees: function (t) { return t / s }, rotatePoint: function (t, e, i) { t.subtractEquals(e); i = fabric.util.rotateVector(t, i); return new fabric.Point(i.x, i.y).addEquals(e) }, rotateVector: function (t, e) { var i = fabric.util.sin(e), e = fabric.util.cos(e); return { x: t.x * e - t.y * i, y: t.x * i + t.y * e } }, transformPoint: function (t, e, i) { return i ? new fabric.Point(e[0] * t.x + e[2] * t.y, e[1] * t.x + e[3] * t.y) : new fabric.Point(e[0] * t.x + e[2] * t.y + e[4], e[1] * t.x + e[3] * t.y + e[5]) }, makeBoundingBoxFromPoints: function (t, e) { if (e) for (var i = 0; i < t.length; i++)t[i] = fabric.util.transformPoint(t[i], e); var n = [t[0].x, t[1].x, t[2].x, t[3].x], o = fabric.util.array.min(n), r = fabric.util.array.max(n) - o, a = [t[0].y, t[1].y, t[2].y, t[3].y], n = fabric.util.array.min(a); return { left: o, top: n, width: r, height: fabric.util.array.max(a) - n } }, invertTransform: function (t) { var e = 1 / (t[0] * t[3] - t[1] * t[2]), e = [e * t[3], -e * t[1], -e * t[2], e * t[0]], t = fabric.util.transformPoint({ x: t[4], y: t[5] }, e, !0); return e[4] = -t.x, e[5] = -t.y, e }, toFixed: function (t, e) { return parseFloat(Number(t).toFixed(e)) }, parseUnit: function (t, e) { var i = /\D{0,2}$/.exec(t), n = parseFloat(t); switch (e = e || fabric.Text.DEFAULT_SVG_FONT_SIZE, i[0]) { case "mm": return n * fabric.DPI / 25.4; case "cm": return n * fabric.DPI / 2.54; case "in": return n * fabric.DPI; case "pt": return n * fabric.DPI / 72; case "pc": return n * fabric.DPI / 72 * 12; case "em": return n * e; default: return n } }, falseFunction: function () { return !1 }, getKlass: function (t, e) { return t = fabric.util.string.camelize(t.charAt(0).toUpperCase() + t.slice(1)), fabric.util.resolveNamespace(e)[t] }, getSvgAttributes: function (t) { var e = ["instantiated_by_use", "style", "id", "class"]; switch (t) { case "linearGradient": e = e.concat(["x1", "y1", "x2", "y2", "gradientUnits", "gradientTransform"]); break; case "radialGradient": e = e.concat(["gradientUnits", "gradientTransform", "cx", "cy", "r", "fx", "fy", "fr"]); break; case "stop": e = e.concat(["offset", "stop-color", "stop-opacity"]) }return e }, resolveNamespace: function (t) { if (!t) return fabric; for (var e = t.split("."), i = e.length, n = r || fabric.window, o = 0; o < i; ++o)n = n[e[o]]; return n }, loadImage: function (t, e, i, n) { var o, r; t ? (r = function () { e && e.call(i, o, !1), o = o.onload = o.onerror = null }, (o = fabric.util.createImage()).onload = r, o.onerror = function () { fabric.log("Error loading " + o.src), e && e.call(i, null, !0), o = o.onload = o.onerror = null }, 0 !== t.indexOf("data") && null != n && (o.crossOrigin = n), "data:image/svg" === t.substring(0, 14) && (o.onload = null, fabric.util.loadImageInDom(o, r)), o.src = t) : e && e.call(i, t) }, loadImageInDom: function (t, e) { var i = fabric.document.createElement("div"); i.style.width = i.style.height = "1px", i.style.left = i.style.top = "-100%", i.style.position = "absolute", i.appendChild(t), fabric.document.querySelector("body").appendChild(i), t.onload = function () { e(), i.parentNode.removeChild(i), i = null } }, enlivenObjects: function (t, e, o, r) { var a = [], i = 0, n = (t = t || []).length; function s() { ++i === n && e && e(a.filter(function (t) { return t })) } n ? t.forEach(function (i, n) { i && i.type ? fabric.util.getKlass(i.type, o).fromObject(i, function (t, e) { e || (a[n] = t), r && r(i, t, e), s() }) : s() }) : e && e(a) }, enlivenPatterns: function (t, e) { function i() { ++o === r && e && e(n) } var n = [], o = 0, r = (t = t || []).length; r ? t.forEach(function (t, e) { t && t.source ? new fabric.Pattern(t, function (t) { n[e] = t, i() }) : (n[e] = t, i()) }) : e && e(n) }, groupSVGElements: function (t, e, i) { return t && 1 === t.length ? t[0] : (e && (e.width && e.height ? e.centerPoint = { x: e.width / 2, y: e.height / 2 } : (delete e.width, delete e.height)), e = new fabric.Group(t, e), void 0 !== i && (e.sourcePath = i), e) }, populateWithProperties: function (t, e, i) { if (i && "[object Array]" === Object.prototype.toString.call(i)) for (var n = 0, o = i.length; n < o; n++)i[n] in t && (e[i[n]] = t[i[n]]) }, drawDashedLine: function (t, e, i, n, o, r) { var n = n - e, o = o - i, a = d(n * n + o * o), n = h(o, n), s = r.length, l = 0, c = !0; for (t.save(), t.translate(e, i), t.moveTo(0, 0), t.rotate(n), e = 0; e < a;)a < (e += r[l++ % s]) && (e = a), t[c ? "lineTo" : "moveTo"](e, 0), c = !c; t.restore() }, createCanvasElement: function () { return fabric.document.createElement("canvas") }, copyCanvasElement: function (t) { var e = fabric.util.createCanvasElement(); return e.width = t.width, e.height = t.height, e.getContext("2d").drawImage(t, 0, 0), e }, toDataURL: function (t, e, i) { return t.toDataURL("image/" + e, i) }, createImage: function () { return fabric.document.createElement("img") }, multiplyTransformMatrices: function (t, e, i) { return [t[0] * e[0] + t[2] * e[1], t[1] * e[0] + t[3] * e[1], t[0] * e[2] + t[2] * e[3], t[1] * e[2] + t[3] * e[3], i ? 0 : t[0] * e[4] + t[2] * e[5] + t[4], i ? 0 : t[1] * e[4] + t[3] * e[5] + t[5]] }, qrDecompose: function (t) { var e = h(t[1], t[0]), i = a(t[0], 2) + a(t[1], 2), n = d(i), o = (t[0] * t[3] - t[2] * t[1]) / n, i = h(t[0] * t[2] + t[1] * t[3], i); return { angle: e / s, scaleX: n, scaleY: o, skewX: i / s, skewY: 0, translateX: t[4], translateY: t[5] } }, calcRotateMatrix: function (t) { if (!t.angle) return fabric.iMatrix.concat(); var e = fabric.util.degreesToRadians(t.angle), t = fabric.util.cos(e), e = fabric.util.sin(e); return [t, e, -e, t, 0, 0] }, calcDimensionsMatrix: function (t) { var e = void 0 === t.scaleX ? 1 : t.scaleX, i = void 0 === t.scaleY ? 1 : t.scaleY, n = [t.flipX ? -e : e, 0, 0, t.flipY ? -i : i, 0, 0], e = fabric.util.multiplyTransformMatrices, i = fabric.util.degreesToRadians; return t.skewX && (n = e(n, [1, 0, Math.tan(i(t.skewX)), 1], !0)), t.skewY && (n = e(n, [1, Math.tan(i(t.skewY)), 0, 1], !0)), n }, composeMatrix: function (t) { var e = [1, 0, 0, 1, t.translateX || 0, t.translateY || 0], i = fabric.util.multiplyTransformMatrices; return t.angle && (e = i(e, fabric.util.calcRotateMatrix(t))), (1 !== t.scaleX || 1 !== t.scaleY || t.skewX || t.skewY || t.flipX || t.flipY) && (e = i(e, fabric.util.calcDimensionsMatrix(t))), e }, resetObjectTransform: function (t) { t.scaleX = 1, t.scaleY = 1, t.skewX = 0, t.skewY = 0, t.flipX = !1, t.flipY = !1, t.rotate(0) }, saveObjectTransform: function (t) { return { scaleX: t.scaleX, scaleY: t.scaleY, skewX: t.skewX, skewY: t.skewY, angle: t.angle, left: t.left, flipX: t.flipX, flipY: t.flipY, top: t.top } }, isTransparent: function (t, e, i, n) { 0 < n && (n < e ? e -= n : e = 0, n < i ? i -= n : i = 0); for (var o = !0, r = t.getImageData(e, i, 2 * n || 1, 2 * n || 1), a = r.data.length, s = 3; s < a && !1 !== (o = r.data[s] <= 0); s += 4); return r = null, o }, parsePreserveAspectRatioAttribute: function (t) { var e, i = "meet", t = t.split(" "); return t && t.length && ("meet" !== (i = t.pop()) && "slice" !== i ? (e = i, i = "meet") : t.length && (e = t.pop())), { meetOrSlice: i, alignX: "none" !== e ? e.slice(1, 4) : "none", alignY: "none" !== e ? e.slice(5, 8) : "none" } }, clearFabricFontCache: function (t) { (t = (t || "").toLowerCase()) ? fabric.charWidthsCache[t] && delete fabric.charWidthsCache[t] : fabric.charWidthsCache = {} }, limitDimsByArea: function (t, e) { t = Math.sqrt(e * t), e = Math.floor(e / t); return { x: Math.floor(t), y: e } }, capValue: function (t, e, i) { return Math.max(t, Math.min(e, i)) }, findScaleToFit: function (t, e) { return Math.min(e.width / t.width, e.height / t.height) }, findScaleToCover: function (t, e) { return Math.max(e.width / t.width, e.height / t.height) }, matrixToSVG: function (t) { return "matrix(" + t.map(function (t) { return fabric.util.toFixed(t, fabric.Object.NUM_FRACTION_DIGITS) }).join(" ") + ")" }, sizeAfterTransform: function (t, e, i) { t /= 2, e /= 2, e = [{ x: -t, y: -e }, { x: t, y: -e }, { x: -t, y: e }, { x: t, y: e }], i = fabric.util.calcDimensionsMatrix(i), i = fabric.util.makeBoundingBoxFromPoints(e, i); return { x: i.width, y: i.height } } } }("undefined" != typeof exports ? exports : this), function () { var k = Array.prototype.join, S = { m: 2, l: 2, h: 1, v: 1, c: 6, s: 4, q: 4, t: 2, a: 7 }, T = { m: "l", M: "L" }; function b(t, e, i, n, o, r, a) { var s = Math.PI, l = a * s / 180, c = fabric.util.sin(l), d = fabric.util.cos(l), h = 0, u = 0, f = -d * t * .5 - c * e * .5, p = -d * e * .5 + c * t * .5, g = (i = Math.abs(i)) * i, b = (n = Math.abs(n)) * n, m = p * p, v = f * f, x = g * b - g * m - b * v, a = 0; x < 0 ? (i *= l = Math.sqrt(1 - x / (g * b)), n *= l) : a = (o === r ? -1 : 1) * Math.sqrt(x / (g * m + b * v)); var v = a * i * p / n, a = -a * n * f / i, y = d * v - c * a + .5 * t, _ = c * v + d * a + .5 * e, w = B(1, 0, (f - v) / i, (p - a) / n), a = B((f - v) / i, (p - a) / n, (-f - v) / i, (-p - a) / n); 0 === r && 0 < a ? a -= 2 * s : 1 === r && a < 0 && (a += 2 * s); for (var C, S, T, k, O, F, D, A, P, E, $, j, M, I = Math.ceil(Math.abs(a / s * 2)), R = [], z = a / I, L = 8 / 3 * Math.sin(z / 4) * Math.sin(z / 4) / Math.sin(z / 2), H = w + z, W = 0; W < I; W++)R[W] = (C = w, S = H, T = d, k = c, O = i, F = n, D = y, A = _, P = L, E = h, $ = u, M = j = void 0, j = fabric.util.cos(C), M = fabric.util.sin(C), C = fabric.util.cos(S), S = fabric.util.sin(S), ["C", E + P * (-T * O * M - k * F * j), $ + P * (-k * O * M + T * F * j), (D = T * O * C - k * F * S + D) + P * (T * O * S + k * F * C), (A = k * O * C + T * F * S + A) + P * (k * O * S - T * F * C), D, A]), h = R[W][5], u = R[W][6], w = H, H += z; return R } function B(t, e, i, n) { t = Math.atan2(e, t), i = Math.atan2(n, i); return t <= i ? i - t : 2 * Math.PI - (t - i) } function m(t, e, i, n, o, r, a, s) { var l; if (fabric.cachesBoundsOfCurve && (l = k.call(arguments), fabric.boundsOfCurveCache[l])) return fabric.boundsOfCurveCache[l]; for (var c, d, h, u = Math.sqrt, f = Math.min, p = Math.max, g = Math.abs, b = [], m = [[], []], v = 6 * t - 12 * i + 6 * o, x = -3 * t + 9 * i - 9 * o + 3 * a, y = 3 * i - 3 * t, _ = 0; _ < 2; ++_)0 < _ && (v = 6 * e - 12 * n + 6 * r, x = -3 * e + 9 * n - 9 * r + 3 * s, y = 3 * n - 3 * e), g(x) < 1e-12 ? g(v) < 1e-12 || 0 < (c = -y / v) && c < 1 && b.push(c) : (d = v * v - 4 * y * x) < 0 || (0 < (d = (-v + (h = u(d))) / (2 * x)) && d < 1 && b.push(d), 0 < (h = (-v - h) / (2 * x)) && h < 1 && b.push(h)); for (var w, C, S = b.length, T = S; S--;)w = (C = 1 - (c = b[S])) * C * C * t + 3 * C * C * c * i + 3 * C * c * c * o + c * c * c * a, m[0][S] = w, C = C * C * C * e + 3 * C * C * c * n + 3 * C * c * c * r + c * c * c * s, m[1][S] = C; m[0][T] = t, m[1][T] = e, m[0][T + 1] = a, m[1][T + 1] = s; p = [{ x: f.apply(null, m[0]), y: f.apply(null, m[1]) }, { x: p.apply(null, m[0]), y: p.apply(null, m[1]) }]; return fabric.cachesBoundsOfCurve && (fabric.boundsOfCurveCache[l] = p), p } function f(t, e, i) { for (var n = i[1], o = i[2], r = i[3], a = i[4], s = i[5], l = b(i[6] - t, i[7] - e, n, o, a, s, r), c = 0, d = l.length; c < d; c++)l[c][1] += t, l[c][2] += e, l[c][3] += t, l[c][4] += e, l[c][5] += t, l[c][6] += e; return l } function u(t, e, i, n) { return Math.sqrt((i - t) * (i - t) + (n - e) * (n - e)) } function p(t, e, i) { for (var n, o = { x: e, y: i }, r = 0, a = .01; a <= 1; a += .01)n = t(a), r += u(o.x, o.y, n.x, n.y), o = n; return r } function l(t, e) { for (var i, n, o = 0, r = 0, a = t.iterator, s = { x: t.x, y: t.y }, l = .01; r < e && o <= 1 && 1e-4 < l;)i = a(o), e < (n = u(s.x, s.y, i.x, i.y)) + r ? o -= l /= 2 : (s = i, o += l, r += n); return i } function c(t) { for (var e, i, n, o = 0, r = t.length, a = 0, s = 0, l = 0, c = 0, d = [], h = 0; h < r; h++){ switch (n = { x: a, y: s, command: (e = t[h])[0] }, e[0]) { case "M": n.length = 0, l = a = e[1], c = s = e[2]; break; case "L": n.length = u(a, s, e[1], e[2]), a = e[1], s = e[2]; break; case "C": i = function (o, r, a, s, l, c, d, h) { return function (t) { var e, i, n = (i = t) * i * i, i = 3 * (e = t) * e * (1 - e), e = 3 * (e = t) * (1 - e) * (1 - e), t = (1 - (t = t)) * (1 - t) * (1 - t); return { x: d * n + l * i + a * e + o * t, y: h * n + c * i + s * e + r * t } } }(a, s, e[1], e[2], e[3], e[4], e[5], e[6]), n.iterator = i, n.length = p(i, a, s), a = e[5], s = e[6]; break; case "Q": i = function (n, o, r, a, s, l) { return function (t) { var e, i = (e = t) * e, e = 2 * (e = t) * (1 - e), t = (1 - (t = t)) * (1 - t); return { x: s * i + r * e + n * t, y: l * i + a * e + o * t } } }(a, s, e[1], e[2], e[3], e[4]), n.iterator = i, n.length = p(i, a, s), a = e[3], s = e[4]; break; case "Z": case "z": n.destX = l, n.destY = c, n.length = u(a, s, l, c), a = l, s = c }o += n.length, d.push(n) } return d.push({ length: o, x: a, y: s }), d } fabric.util.parsePath = function (t) { var e, i, n, o, r, a = [], s = [], l = fabric.rePathCommand, c = "[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*", d = "(" + c + ")" + fabric.commaWsp, h = "([01])" + fabric.commaWsp + "?", u = new RegExp(d + "?" + d + "?" + d + h + h + d + "?(" + c + ")", "g"); if (!t || !t.match) return a; for (var f = 0, p = (r = t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length; f < p; f++){ o = (e = r[f]).slice(1).trim(), s.length = 0; var g, b = e.charAt(0), m = [b]; if ("a" === b.toLowerCase()) for (; g = u.exec(o);)for (var v = 1; v < g.length; v++)s.push(g[v]); else for (; n = l.exec(o);)s.push(n[0]); for (var v = 0, x = s.length; v < x; v++)i = parseFloat(s[v]), isNaN(i) || m.push(i); var y = S[b.toLowerCase()], _ = T[b] || b; if (m.length - 1 > y) for (var w = 1, C = m.length; w < C; w += y)a.push([b].concat(m.slice(w, w + y))), b = _; else a.push(m) } return a }, fabric.util.makePathSimpler = function (t) { for (var e, i, n, o, r, a = 0, s = 0, l = t.length, c = 0, d = 0, h = [], u = 0; u < l; ++u){ switch (i = !1, (e = t[u].slice(0))[0]) { case "l": e[0] = "L", e[1] += a, e[2] += s; case "L": a = e[1], s = e[2]; break; case "h": e[1] += a; case "H": e[0] = "L", e[2] = s, a = e[1]; break; case "v": e[1] += s; case "V": e[0] = "L", s = e[1], e[1] = a, e[2] = s; break; case "m": e[0] = "M", e[1] += a, e[2] += s; case "M": a = e[1], s = e[2], c = e[1], d = e[2]; break; case "c": e[0] = "C", e[1] += a, e[2] += s, e[3] += a, e[4] += s, e[5] += a, e[6] += s; case "C": o = e[3], r = e[4], a = e[5], s = e[6]; break; case "s": e[0] = "S", e[1] += a, e[2] += s, e[3] += a, e[4] += s; case "S": r = "C" === n ? (o = 2 * a - o, 2 * s - r) : (o = a, s), a = e[3], s = e[4], e[0] = "C", e[5] = e[3], e[6] = e[4], e[3] = e[1], e[4] = e[2], e[1] = o, e[2] = r, o = e[3], r = e[4]; break; case "q": e[0] = "Q", e[1] += a, e[2] += s, e[3] += a, e[4] += s; case "Q": o = e[1], r = e[2], a = e[3], s = e[4]; break; case "t": e[0] = "T", e[1] += a, e[2] += s; case "T": r = "Q" === n ? (o = 2 * a - o, 2 * s - r) : (o = a, s), e[0] = "Q", a = e[1], s = e[2], e[1] = o, e[2] = r, e[3] = a, e[4] = s; break; case "a": e[0] = "A", e[6] += a, e[7] += s; case "A": i = !0, h = h.concat(f(a, s, e)), a = e[6], s = e[7]; break; case "z": case "Z": a = c, s = d }i || h.push(e), n = e[0] } return h }, fabric.util.getPathSegmentsInfo = c, fabric.util.fromArcToBeziers = f, fabric.util.fromArcToBeizers = f, fabric.util.getBoundsOfCurve = m, fabric.util.getPointOnPath = function (t, e, i) { i = i || c(t); for (var n = 0; 0 < e - i[n].length && n < i.length - 2;)e -= i[n].length, n++; var o = i[n], r = e / o.length, a = o.command, s = t[n]; switch (a) { case "M": return { x: o.x, y: o.y }; case "Z": case "z": return new fabric.Point(o.x, o.y).lerp(new fabric.Point(o.destX, o.destY), r); case "L": return new fabric.Point(o.x, o.y).lerp(new fabric.Point(s[1], s[2]), r); case "C": case "Q": return l(o, e) } }, fabric.util.getBoundsOfArc = function (t, e, i, n, o, r, a, s, l) { for (var c, d = 0, h = 0, u = [], f = b(s - t, l - e, i, n, r, a, o), p = 0, g = f.length; p < g; p++)c = m(d, h, f[p][1], f[p][2], f[p][3], f[p][4], f[p][5], f[p][6]), u.push({ x: c[0].x + t, y: c[0].y + e }), u.push({ x: c[1].x + t, y: c[1].y + e }), d = f[p][5], h = f[p][6]; return u }, fabric.util.drawArc = function (e, t, i, n) { f(t, i, n = n.slice(0).unshift("X")).forEach(function (t) { e.bezierCurveTo.apply(e, t.slice(1)) }) } }(), function () { var a = Array.prototype.slice; function i(t, e, i) { if (t && 0 !== t.length) { var n = t.length - 1, o = e ? t[n][e] : t[n]; if (e) for (; n--;)i(t[n][e], o) && (o = t[n][e]); else for (; n--;)i(t[n], o) && (o = t[n]); return o } } fabric.util.array = { fill: function (t, e) { for (var i = t.length; i--;)t[i] = e; return t }, invoke: function (t, e) { for (var i = a.call(arguments, 2), n = [], o = 0, r = t.length; o < r; o++)n[o] = i.length ? t[o][e].apply(t[o], i) : t[o][e].call(t[o]); return n }, min: function (t, e) { return i(t, e, function (t, e) { return t < e }) }, max: function (t, e) { return i(t, e, function (t, e) { return e <= t }) } } }(), function () { function a(t, e, i) { if (i) if (!fabric.isLikelyNode && e instanceof Element) t = e; else if (e instanceof Array) { t = []; for (var n = 0, o = e.length; n < o; n++)t[n] = a({}, e[n], i) } else if (e && "object" == typeof e) for (var r in e) "canvas" === r || "group" === r ? t[r] = null : e.hasOwnProperty(r) && (t[r] = a({}, e[r], i)); else t = e; else for (var r in e) t[r] = e[r]; return t } fabric.util.object = { extend: a, clone: function (t, e) { return a({}, t, e) } }, fabric.util.object.extend(fabric.util, fabric.Observable) }(), fabric.util.string = { camelize: function (t) { return t.replace(/-+(.)?/g, function (t, e) { return e ? e.toUpperCase() : "" }) }, capitalize: function (t, e) { return t.charAt(0).toUpperCase() + (e ? t.slice(1) : t.slice(1).toLowerCase()) }, escapeXml: function (t) { return t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;") }, graphemeSplit: function (t) { for (var e, i = 0, n = [], i = 0; i < t.length; i++)!1 !== (e = function (t, e) { var i = t.charCodeAt(e); if (isNaN(i)) return ""; if (i < 55296 || 57343 < i) return t.charAt(e); if (55296 <= i && i <= 56319) { if (t.length <= e + 1) throw "High surrogate without following low surrogate"; i = t.charCodeAt(e + 1); if (i < 56320 || 57343 < i) throw "High surrogate without following low surrogate"; return t.charAt(e) + t.charAt(e + 1) } if (0 === e) throw "Low surrogate without preceding high surrogate"; e = t.charCodeAt(e - 1); if (e < 55296 || 56319 < e) throw "Low surrogate without preceding high surrogate"; return !1 }(t, i)) && n.push(e); return n } }, function () { function r() { } var a = Array.prototype.slice, s = function () { for (var t in { toString: 1 }) if ("toString" === t) return !1; return !0 }(); function l() { } function c(t) { for (var e = null, i = this; i.constructor.superclass;){ var n = i.constructor.superclass.prototype[t]; if (i[t] !== n) { e = n; break } i = i.constructor.superclass.prototype } return e ? 1 < arguments.length ? e.apply(this, a.call(arguments, 1)) : e.call(this) : console.log("tried to callSuper " + t + ", method not found in prototype chain", this) } fabric.util.createClass = function () { var t = null, e = a.call(arguments, 0); function i() { this.initialize.apply(this, arguments) } "function" == typeof e[0] && (t = e.shift()), i.superclass = t, i.subclasses = [], t && (l.prototype = t.prototype, i.prototype = new l, t.subclasses.push(i)); for (var n = 0, o = e.length; n < o; n++)!function (t, n, o) { for (var e in n) e in t.prototype && "function" == typeof t.prototype[e] && -1 < (n[e] + "").indexOf("callSuper") ? t.prototype[e] = function (i) { return function () { var t = this.constructor.superclass; this.constructor.superclass = o; var e = n[i].apply(this, arguments); if (this.constructor.superclass = t, "initialize" !== i) return e } }(e) : t.prototype[e] = n[e], s && (n.toString !== Object.prototype.toString && (t.prototype.toString = n.toString), n.valueOf !== Object.prototype.valueOf && (t.prototype.valueOf = n.valueOf)) }(i, e[n], t); return i.prototype.initialize || (i.prototype.initialize = r), (i.prototype.constructor = i).prototype.callSuper = c, i } }(), function () { var o = !!fabric.document.createElement("div").attachEvent, e = ["touchstart", "touchmove", "touchend"]; fabric.util.addListener = function (t, e, i, n) { t && t.addEventListener(e, i, !o && n) }, fabric.util.removeListener = function (t, e, i, n) { t && t.removeEventListener(e, i, !o && n) }, fabric.util.getPointer = function (t) { var e = t.target, i = fabric.util.getScrollLeftTop(e), e = (t = (e = t).changedTouches) && t[0] ? t[0] : e; return { x: e.clientX + i.left, y: e.clientY + i.top } }, fabric.util.isTouchEvent = function (t) { return -1 < e.indexOf(t.type) || "touch" === t.pointerType } }(), function () { var t = "string" == typeof (e = fabric.document.createElement("div")).style.opacity, e = "string" == typeof e.style.filter, n = /alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/, o = function (t) { return t }; t ? o = function (t, e) { return t.style.opacity = e, t } : e && (o = function (t, e) { var i = t.style; return t.currentStyle && !t.currentStyle.hasLayout && (i.zoom = 1), n.test(i.filter) ? (e = .9999 <= e ? "" : "alpha(opacity=" + 100 * e + ")", i.filter = i.filter.replace(n, e)) : i.filter += " alpha(opacity=" + 100 * e + ")", t }), fabric.util.setStyle = function (t, e) { var i, n = t.style; if (!n) return t; if ("string" == typeof e) return t.style.cssText += ";" + e, -1 < e.indexOf("opacity") ? o(t, e.match(/opacity:\s*(\d?\.?\d*)/)[1]) : t; for (i in e) "opacity" === i ? o(t, e[i]) : n["float" === i || "cssFloat" === i ? void 0 === n.styleFloat ? "cssFloat" : "styleFloat" : i] = e[i]; return t } }(), function () { var t, s, e, i, n = Array.prototype.slice, o = function (t) { return n.call(t, 0) }; try { t = o(fabric.document.childNodes) instanceof Array } catch (t) { } function r(t, e) { var i, n = fabric.document.createElement(t); for (i in e) "class" === i ? n.className = e[i] : "for" === i ? n.htmlFor = e[i] : n.setAttribute(i, e[i]); return n } function l(t) { for (var e = 0, i = 0, n = fabric.document.documentElement, o = fabric.document.body || { scrollLeft: 0, scrollTop: 0 }; t && (t.parentNode || t.host) && ((t = t.parentNode || t.host) === fabric.document ? (e = o.scrollLeft || n.scrollLeft || 0, i = o.scrollTop || n.scrollTop || 0) : (e += t.scrollLeft || 0, i += t.scrollTop || 0), 1 !== t.nodeType || "fixed" !== t.style.position);); return { left: e, top: i } } t || (o = function (t) { for (var e = new Array(t.length), i = t.length; i--;)e[i] = t[i]; return e }), s = fabric.document.defaultView && fabric.document.defaultView.getComputedStyle ? function (t, e) { t = fabric.document.defaultView.getComputedStyle(t, null); return t ? t[e] : void 0 } : function (t, e) { var i = t.style[e]; return !i && t.currentStyle && (i = t.currentStyle[e]), i }, e = fabric.document.documentElement.style, i = "userSelect" in e ? "userSelect" : "MozUserSelect" in e ? "MozUserSelect" : "WebkitUserSelect" in e ? "WebkitUserSelect" : "KhtmlUserSelect" in e ? "KhtmlUserSelect" : "", fabric.util.makeElementUnselectable = function (t) { return void 0 !== t.onselectstart && (t.onselectstart = fabric.util.falseFunction), i ? t.style[i] = "none" : "string" == typeof t.unselectable && (t.unselectable = "on"), t }, fabric.util.makeElementSelectable = function (t) { return void 0 !== t.onselectstart && (t.onselectstart = null), i ? t.style[i] = "" : "string" == typeof t.unselectable && (t.unselectable = ""), t }, fabric.util.setImageSmoothing = function (t, e) { t.imageSmoothingEnabled = t.imageSmoothingEnabled || t.webkitImageSmoothingEnabled || t.mozImageSmoothingEnabled || t.msImageSmoothingEnabled || t.oImageSmoothingEnabled, t.imageSmoothingEnabled = e }, fabric.util.getById = function (t) { return "string" == typeof t ? fabric.document.getElementById(t) : t }, fabric.util.toArray = o, fabric.util.addClass = function (t, e) { t && -1 === (" " + t.className + " ").indexOf(" " + e + " ") && (t.className += (t.className ? " " : "") + e) }, fabric.util.makeElement = r, fabric.util.wrapElement = function (t, e, i) { return "string" == typeof e && (e = r(e, i)), t.parentNode && t.parentNode.replaceChild(e, t), e.appendChild(t), e }, fabric.util.getScrollLeftTop = l, fabric.util.getElementOffset = function (t) { var e, i, n = t && t.ownerDocument, o = { left: 0, top: 0 }, r = { left: 0, top: 0 }, a = { borderLeftWidth: "left", borderTopWidth: "top", paddingLeft: "left", paddingTop: "top" }; if (!n) return r; for (i in a) r[a[i]] += parseInt(s(t, i), 10) || 0; return e = n.documentElement, void 0 !== t.getBoundingClientRect && (o = t.getBoundingClientRect()), n = l(t), { left: o.left + n.left - (e.clientLeft || 0) + r.left, top: o.top + n.top - (e.clientTop || 0) + r.top } }, fabric.util.getNodeCanvas = function (t) { return (t = fabric.jsdomImplForWrapper(t))._canvas || t._image }, fabric.util.cleanUpJsdomNode = function (t) { !fabric.isLikelyNode || (t = fabric.jsdomImplForWrapper(t)) && (t._image = null, t._canvas = null, t._currentSrc = null, t._attributes = null, t._classList = null) } }(), function () { function s() { } fabric.util.request = function (t, e) { var i, n = (e = e || {}).method ? e.method.toUpperCase() : "GET", o = e.onComplete || function () { }, r = new fabric.window.XMLHttpRequest, a = e.body || e.parameters; return r.onreadystatechange = function () { 4 === r.readyState && (o(r), r.onreadystatechange = s) }, "GET" === n && (a = null, "string" == typeof e.parameters && (i = t, e = e.parameters, t = i + (/\?/.test(i) ? "&" : "?") + e)), r.open(n, t, !0), "POST" !== n && "PUT" !== n || r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), r.send(a), r } }(), fabric.log = console.log, fabric.warn = console.warn, function () { function i() { return !1 } function n(t, e, i, n) { return -i * Math.cos(t / n * (Math.PI / 2)) + i + e } var t = fabric.window.requestAnimationFrame || fabric.window.webkitRequestAnimationFrame || fabric.window.mozRequestAnimationFrame || fabric.window.oRequestAnimationFrame || fabric.window.msRequestAnimationFrame || function (t) { return fabric.window.setTimeout(t, 1e3 / 60) }, e = fabric.window.cancelAnimationFrame || fabric.window.clearTimeout; function g() { return t.apply(fabric.window, arguments) } fabric.util.animate = function (e) { g(function (t) { e = e || {}; var o, r = t || +new Date, a = e.duration || 500, s = r + a, l = e.onChange || i, c = e.abort || i, d = e.onComplete || i, h = e.easing || n, u = "startValue" in e ? e.startValue : 0, f = "endValue" in e ? e.endValue : 100, p = e.byValue || f - u; e.onStart && e.onStart(), function t(e) { o = e || +new Date; var i = s < o ? a : o - r, n = i / a, e = h(i, u, p, a), i = Math.abs((e - u) / p); c() ? d(f, 1, 1) : s < o ? (l(f, 1, 1), d(f, 1, 1)) : (l(e, i, n), g(t)) }(r) }) }, fabric.util.requestAnimFrame = g, fabric.util.cancelAnimFrame = function () { return e.apply(fabric.window, arguments) } }(), function () { function s(t, e, i) { var n = "rgba(" + parseInt(t[0] + i * (e[0] - t[0]), 10) + "," + parseInt(t[1] + i * (e[1] - t[1]), 10) + "," + parseInt(t[2] + i * (e[2] - t[2]), 10); return n += "," + (t && e ? parseFloat(t[3] + i * (e[3] - t[3])) : 1), n += ")" } fabric.util.animateColor = function (t, e, i, o) { var t = new fabric.Color(t).getSource(), n = new fabric.Color(e).getSource(), r = o.onComplete, a = o.onChange; o = o || {}, fabric.util.animate(fabric.util.object.extend(o, { duration: i || 500, startValue: t, endValue: n, byValue: n, easing: function (t, e, i, n) { return s(e, i, o.colorEasing ? o.colorEasing(t, n) : 1 - Math.cos(t / n * (Math.PI / 2))) }, onComplete: function (t, e, i) { if (r) return r(s(n, n, 0), e, i) }, onChange: function (t, e, i) { if (a) { if (Array.isArray(t)) return a(s(t, t, 0), e, i); a(t, e, i) } } })) } }(), function () { function r(t, e, i, n) { return n = t < Math.abs(e) ? (t = e, i / 4) : 0 === e && 0 === t ? i / (2 * Math.PI) * Math.asin(1) : i / (2 * Math.PI) * Math.asin(e / t), { a: t, c: e, p: i, s: n } } function a(t, e, i) { return t.a * Math.pow(2, 10 * --e) * Math.sin((e * i - t.s) * (2 * Math.PI) / t.p) } function o(t, e, i, n) { return i - s(n - t, 0, i, n) + e } function s(t, e, i, n) { return (t /= n) < 1 / 2.75 ? i * (7.5625 * t * t) + e : t < 2 / 2.75 ? i * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + e : t < 2.5 / 2.75 ? i * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + e : i * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + e } fabric.util.ease = { easeInQuad: function (t, e, i, n) { return i * (t /= n) * t + e }, easeOutQuad: function (t, e, i, n) { return -i * (t /= n) * (t - 2) + e }, easeInOutQuad: function (t, e, i, n) { return (t /= n / 2) < 1 ? i / 2 * t * t + e : -i / 2 * (--t * (t - 2) - 1) + e }, easeInCubic: function (t, e, i, n) { return i * (t /= n) * t * t + e }, easeOutCubic: function (t, e, i, n) { return i * ((t = t / n - 1) * t * t + 1) + e }, easeInOutCubic: function (t, e, i, n) { return (t /= n / 2) < 1 ? i / 2 * t * t * t + e : i / 2 * ((t -= 2) * t * t + 2) + e }, easeInQuart: function (t, e, i, n) { return i * (t /= n) * t * t * t + e }, easeOutQuart: function (t, e, i, n) { return -i * ((t = t / n - 1) * t * t * t - 1) + e }, easeInOutQuart: function (t, e, i, n) { return (t /= n / 2) < 1 ? i / 2 * t * t * t * t + e : -i / 2 * ((t -= 2) * t * t * t - 2) + e }, easeInQuint: function (t, e, i, n) { return i * (t /= n) * t * t * t * t + e }, easeOutQuint: function (t, e, i, n) { return i * ((t = t / n - 1) * t * t * t * t + 1) + e }, easeInOutQuint: function (t, e, i, n) { return (t /= n / 2) < 1 ? i / 2 * t * t * t * t * t + e : i / 2 * ((t -= 2) * t * t * t * t + 2) + e }, easeInSine: function (t, e, i, n) { return -i * Math.cos(t / n * (Math.PI / 2)) + i + e }, easeOutSine: function (t, e, i, n) { return i * Math.sin(t / n * (Math.PI / 2)) + e }, easeInOutSine: function (t, e, i, n) { return -i / 2 * (Math.cos(Math.PI * t / n) - 1) + e }, easeInExpo: function (t, e, i, n) { return 0 === t ? e : i * Math.pow(2, 10 * (t / n - 1)) + e }, easeOutExpo: function (t, e, i, n) { return t === n ? e + i : i * (1 - Math.pow(2, -10 * t / n)) + e }, easeInOutExpo: function (t, e, i, n) { return 0 === t ? e : t === n ? e + i : (t /= n / 2) < 1 ? i / 2 * Math.pow(2, 10 * (t - 1)) + e : i / 2 * (2 - Math.pow(2, -10 * --t)) + e }, easeInCirc: function (t, e, i, n) { return -i * (Math.sqrt(1 - (t /= n) * t) - 1) + e }, easeOutCirc: function (t, e, i, n) { return i * Math.sqrt(1 - (t = t / n - 1) * t) + e }, easeInOutCirc: function (t, e, i, n) { return (t /= n / 2) < 1 ? -i / 2 * (Math.sqrt(1 - t * t) - 1) + e : i / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + e }, easeInElastic: function (t, e, i, n) { var o = 0; return 0 === t ? e : 1 === (t /= n) ? e + i : -a(r(i, i, o = o || .3 * n, 1.70158), t, n) + e }, easeOutElastic: function (t, e, i, n) { var o = 0; return 0 === t ? e : 1 === (t /= n) ? e + i : (o = r(i, i, o = o || .3 * n, 1.70158)).a * Math.pow(2, -10 * t) * Math.sin((t * n - o.s) * (2 * Math.PI) / o.p) + o.c + e }, easeInOutElastic: function (t, e, i, n) { var o = 0; return 0 === t ? e : 2 === (t /= n / 2) ? e + i : (o = r(i, i, o = o || n * (.3 * 1.5), 1.70158), t < 1 ? -.5 * a(o, t, n) + e : o.a * Math.pow(2, -10 * --t) * Math.sin((t * n - o.s) * (2 * Math.PI) / o.p) * .5 + o.c + e) }, easeInBack: function (t, e, i, n, o) { return void 0 === o && (o = 1.70158), i * (t /= n) * t * ((o + 1) * t - o) + e }, easeOutBack: function (t, e, i, n, o) { return void 0 === o && (o = 1.70158), i * ((t = t / n - 1) * t * ((o + 1) * t + o) + 1) + e }, easeInOutBack: function (t, e, i, n, o) { return void 0 === o && (o = 1.70158), (t /= n / 2) < 1 ? i / 2 * (t * t * ((1 + (o *= 1.525)) * t - o)) + e : i / 2 * ((t -= 2) * t * ((1 + (o *= 1.525)) * t + o) + 2) + e }, easeInBounce: o, easeOutBounce: s, easeInOutBounce: function (t, e, i, n) { return t < n / 2 ? .5 * o(2 * t, 0, i, n) + e : .5 * s(2 * t - n, 0, i, n) + .5 * i + e } } }(), function (t) { "use strict"; var h, e, u, i, n, y = t.fabric || (t.fabric = {}), f = y.util.object.extend, p = y.util.object.clone, g = y.util.toFixed, _ = y.util.parseUnit, b = y.util.multiplyTransformMatrices, m = { cx: "left", x: "left", r: "radius", cy: "top", y: "top", display: "visible", visibility: "visible", transform: "transformMatrix", "fill-opacity": "fillOpacity", "fill-rule": "fillRule", "font-family": "fontFamily", "font-size": "fontSize", "font-style": "fontStyle", "font-weight": "fontWeight", "letter-spacing": "charSpacing", "paint-order": "paintFirst", "stroke-dasharray": "strokeDashArray", "stroke-dashoffset": "strokeDashOffset", "stroke-linecap": "strokeLineCap", "stroke-linejoin": "strokeLineJoin", "stroke-miterlimit": "strokeMiterLimit", "stroke-opacity": "strokeOpacity", "stroke-width": "strokeWidth", "text-decoration": "textDecoration", "text-anchor": "textAnchor", opacity: "opacity", "clip-path": "clipPath", "clip-rule": "clipRule", "vector-effect": "strokeUniform", "image-rendering": "imageSmoothing" }, v = { stroke: "strokeOpacity", fill: "fillOpacity" }, x = "font-size", w = "clip-path"; function o(t) { return new RegExp("^(" + t.join("|") + ")\\b", "i") } function C(t, e) { for (var i, n = [], o = 0, r = e.length; o < r; o++)i = e[o], i = t.getElementsByTagName(i), n = n.concat(Array.prototype.slice.call(i)); return n } function S(t, e, i) { t[i] = Math.tan(y.util.degreesToRadians(e[0])) } function T(t, e) { var i, n = {}; for (i in y.cssRules[e]) if (function (t, e) { var i, n = !0; (i = r(t, e.pop())) && e.length && (n = function (t, e) { var i, n = !0; for (; t.parentNode && 1 === t.parentNode.nodeType && e.length;)n && (i = e.pop()), t = t.parentNode, n = r(t, i); return 0 === e.length }(t, e)); return i && n && 0 === e.length }(t, i.split(" "))) for (var o in y.cssRules[e][i]) n[o] = y.cssRules[e][i][o]; return n } function r(t, e) { var i, n = t.nodeName, o = t.getAttribute("class"), t = t.getAttribute("id"), r = new RegExp("^" + n, "i"); if (e = e.replace(r, ""), t && e.length && (r = new RegExp("#" + t + "(?![a-zA-Z\\-]+)", "i"), e = e.replace(r, "")), o && e.length) for (i = (o = o.split(" ")).length; i--;)r = new RegExp("\\." + o[i] + "(?![a-zA-Z\\-]+)", "i"), e = e.replace(r, ""); return 0 === e.length } function k(t, e) { var i; if (t.getElementById && (i = t.getElementById(e)), i) return i; for (var n, o = t.getElementsByTagName("*"), r = 0, a = o.length; r < a; r++)if (e === (n = o[r]).getAttribute("id")) return n } y.svgValidTagNamesRegEx = o(["path", "circle", "polygon", "polyline", "ellipse", "rect", "line", "image", "text"]), y.svgViewBoxElementsRegEx = o(["symbol", "image", "marker", "pattern", "view", "svg"]), y.svgInvalidAncestorsRegEx = o(["pattern", "defs", "symbol", "metadata", "clipPath", "mask", "desc"]), y.svgValidParentsRegEx = o(["symbol", "g", "a", "svg", "clipPath", "defs"]), y.cssRules = {}, y.gradientDefs = {}, y.clipPaths = {}, y.parseTransformAttribute = (h = y.iMatrix, e = y.reNum, t = y.commaWsp, u = "(?:" + ("(?:(matrix)\\s*\\(\\s*(" + e + ")" + t + "(" + e + ")" + t + "(" + e + ")" + t + "(" + e + ")" + t + "(" + e + ")" + t + "(" + e + ")\\s*\\))") + "|" + ("(?:(translate)\\s*\\(\\s*(" + e + ")(?:" + t + "(" + e + "))?\\s*\\))") + "|" + ("(?:(scale)\\s*\\(\\s*(" + e + ")(?:" + t + "(" + e + "))?\\s*\\))") + "|" + ("(?:(rotate)\\s*\\(\\s*(" + e + ")(?:" + t + "(" + e + ")" + t + "(" + e + "))?\\s*\\))") + "|" + ("(?:(skewX)\\s*\\(\\s*(" + e + ")\\s*\\))") + "|" + ("(?:(skewY)\\s*\\(\\s*(" + e + ")\\s*\\))") + ")", i = new RegExp("^\\s*(?:" + ("(?:" + u + "(?:" + t + "*" + u + ")*)") + "?)\\s*$"), n = new RegExp(u, "g"), function (t) { var c = h.concat(), d = []; if (!t || t && !i.test(t)) return c; t.replace(n, function (t) { var e, i, n, o, r, a, s = new RegExp(u).exec(t).filter(function (t) { return !!t }), t = s[1], l = s.slice(2).map(parseFloat); switch (t) { case "translate": a = l, (r = c)[4] = a[0], 2 === a.length && (r[5] = a[1]); break; case "rotate": l[0] = y.util.degreesToRadians(l[0]), e = c, r = l, i = y.util.cos(r[0]), a = y.util.sin(r[0]), o = n = 0, 3 === r.length && (n = r[1], o = r[2]), e[0] = i, e[1] = a, e[2] = -a, e[3] = i, e[4] = n - (i * n - a * o), e[5] = o - (a * n + i * o); break; case "scale": n = c, o = (i = l)[0], i = 2 === i.length ? i[1] : i[0], n[0] = o, n[3] = i; break; case "skewX": S(c, l, 2); break; case "skewY": S(c, l, 1); break; case "matrix": c = l }d.push(c.concat()), c = h.concat() }); for (var e = d[0]; 1 < d.length;)d.shift(), e = y.util.multiplyTransformMatrices(e, d[0]); return e }); var O = new RegExp("^\\s*(" + y.reNum + "+)\\s*,?\\s*(" + y.reNum + "+)\\s*,?\\s*(" + y.reNum + "+)\\s*,?\\s*(" + y.reNum + "+)\\s*$"); function F(t) { if (y.svgViewBoxElementsRegEx.test(t.nodeName)) { var e, i, n, o, r = t.getAttribute("viewBox"), a = 1, s = 1, l = t.getAttribute("width"), c = t.getAttribute("height"), d = t.getAttribute("x") || 0, h = t.getAttribute("y") || 0, u = t.getAttribute("preserveAspectRatio") || "", f = !r || !(r = r.match(O)), p = !l || !c || "100%" === l || "100%" === c, g = f && p, b = {}, m = "", v = 0, x = 0; if (b.width = 0, b.height = 0, b.toBeParsed = g, f && (d || h) && "#document" !== t.parentNode.nodeName && (m = " translate(" + _(d) + " " + _(h) + ") ", n = (t.getAttribute("transform") || "") + m, t.setAttribute("transform", n), t.removeAttribute("x"), t.removeAttribute("y")), g) return b; if (f) return b.width = _(l), b.height = _(c), b; if (e = -parseFloat(r[1]), i = -parseFloat(r[2]), f = parseFloat(r[3]), r = parseFloat(r[4]), b.minX = e, b.minY = i, b.viewBoxWidth = f, b.viewBoxHeight = r, p ? (b.width = f, b.height = r) : (b.width = _(l), b.height = _(c), a = b.width / f, s = b.height / r), "none" !== (u = y.util.parsePreserveAspectRatioAttribute(u)).alignX && ("meet" === u.meetOrSlice && (s = a = s < a ? s : a), "slice" === u.meetOrSlice && (s = a = s < a ? a : s), v = b.width - f * a, x = b.height - r * a, "Mid" === u.alignX && (v /= 2), "Mid" === u.alignY && (x /= 2), "Min" === u.alignX && (v = 0), "Min" === u.alignY && (x = 0)), 1 === a && 1 === s && 0 == e && 0 == i && 0 === d && 0 === h) return b; if ((d || h) && "#document" !== t.parentNode.nodeName && (m = " translate(" + _(d) + " " + _(h) + ") "), n = m + " matrix(" + a + " 0 0 " + s + " " + (e * a + v) + " " + (i * s + x) + ") ", "svg" === t.nodeName) { for (o = t.ownerDocument.createElementNS(y.svgNS, "g"); t.firstChild;)o.appendChild(t.firstChild); t.appendChild(o) } else (o = t).removeAttribute("x"), o.removeAttribute("y"), n = o.getAttribute("transform") + n; return o.setAttribute("transform", n), b } } y.parseSVGDocument = function (t, i, e, n) { if (t) { !function (t) { for (var e = C(t, ["use", "svg:use"]), i = 0; e.length && i < e.length;){ var n, o = e[i], r = (o.getAttribute("xlink:href") || o.getAttribute("href")).substr(1), a = o.getAttribute("x") || 0, s = o.getAttribute("y") || 0, l = k(t, r).cloneNode(!0), c = (l.getAttribute("transform") || "") + " translate(" + a + ", " + s + ")", s = e.length, d = y.svgNS; if (F(l), /^svg$/i.test(l.nodeName)) { for (var h, u = l.ownerDocument.createElementNS(d, "g"), f = 0, p = (h = l.attributes).length; f < p; f++)n = h.item(f), u.setAttributeNS(d, n.nodeName, n.nodeValue); for (; l.firstChild;)u.appendChild(l.firstChild); l = u } for (f = 0, p = (h = o.attributes).length; f < p; f++)"x" !== (n = h.item(f)).nodeName && "y" !== n.nodeName && "xlink:href" !== n.nodeName && "href" !== n.nodeName && ("transform" === n.nodeName ? c = n.nodeValue + " " + c : l.setAttribute(n.nodeName, n.nodeValue)); l.setAttribute("transform", c), l.setAttribute("instantiated_by_use", "1"), l.removeAttribute("id"), o.parentNode.replaceChild(l, o), e.length === s && i++ } }(t); var o = y.Object.__uid++, r = F(t), a = y.util.toArray(t.getElementsByTagName("*")); if (r.crossOrigin = n && n.crossOrigin, r.svgUid = o, 0 === a.length && y.isLikelyNode) { for (var s = [], l = 0, c = (a = t.selectNodes('//*[name(.)!="svg"]')).length; l < c; l++)s[l] = a[l]; a = s } var d, h = a.filter(function (t) { return F(t), y.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:", "")) && !function (t, e) { for (; t = t && t.parentNode;)if (t.nodeName && e.test(t.nodeName.replace("svg:", "")) && !t.getAttribute("instantiated_by_use")) return 1 }(t, y.svgInvalidAncestorsRegEx) }); !h || h && !h.length ? i && i([], {}) : (d = {}, a.filter(function (t) { return "clipPath" === t.nodeName.replace("svg:", "") }).forEach(function (t) { var e = t.getAttribute("id"); d[e] = y.util.toArray(t.getElementsByTagName("*")).filter(function (t) { return y.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:", "")) }) }), y.gradientDefs[o] = y.getGradientDefs(t), y.cssRules[o] = y.getCSSRules(t), y.clipPaths[o] = d, y.parseElements(h, function (t, e) { i && (i(t, r, e, a), delete y.gradientDefs[o], delete y.cssRules[o], delete y.clipPaths[o]) }, p(r), e, n)) } }; var a = new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*(" + y.reNum + "(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|" + y.reNum + "))?\\s+(.*)"); f(y, { parseFontDeclaration: function (t, e) { var i, n, o, r = t.match(a); r && (i = r[1], n = r[3], o = r[4], t = r[5], r = r[6], i && (e.fontStyle = i), n && (e.fontWeight = isNaN(parseFloat(n)) ? n : parseFloat(n)), o && (e.fontSize = _(o)), r && (e.fontFamily = r), t && (e.lineHeight = "normal" === t ? 1 : t)) }, getGradientDefs: function (t) { for (var e, i = C(t, ["linearGradient", "radialGradient", "svg:linearGradient", "svg:radialGradient"]), n = 0, o = {}, n = i.length; n--;)(e = i[n]).getAttribute("xlink:href") && function t(e, i) { var n = "xlink:href", o = k(e, i.getAttribute(n).substr(1)); if (o && o.getAttribute(n) && t(e, o), ["gradientTransform", "x1", "x2", "y1", "y2", "gradientUnits", "cx", "cy", "r", "fx", "fy"].forEach(function (t) { o && !i.hasAttribute(t) && o.hasAttribute(t) && i.setAttribute(t, o.getAttribute(t)) }), !i.children.length) for (var r = o.cloneNode(!0); r.firstChild;)i.appendChild(r.firstChild); i.removeAttribute(n) }(t, e), o[e.getAttribute("id")] = e; return o }, parseAttributes: function (i, t, e) { if (i) { var n, o, r = {}; void 0 === e && (e = i.getAttribute("svgUid")), i.parentNode && y.svgValidParentsRegEx.test(i.parentNode.nodeName) && (r = y.parseAttributes(i.parentNode, t, e)); var a = t.reduce(function (t, e) { return (n = i.getAttribute(e)) && (t[e] = n), t }, {}), e = f(T(i, e), y.parseStyleAttribute(i)), a = f(a, e); e[w] && i.setAttribute(w, e[w]), o = e = r.fontSize || y.Text.DEFAULT_SVG_FONT_SIZE, a[x] && (a[x] = o = _(a[x], e)); var s, l, c, d = {}; for (l in a) c = function (t, e, i, n) { var o, r = "[object Array]" === Object.prototype.toString.call(e); if ("fill" !== t && "stroke" !== t || "none" !== e) { if ("strokeUniform" === t) return "non-scaling-stroke" === e; if ("strokeDashArray" === t) e = "none" === e ? null : e.replace(/,/g, " ").split(/\s+/).map(parseFloat); else if ("transformMatrix" === t) e = i && i.transformMatrix ? b(i.transformMatrix, y.parseTransformAttribute(e)) : y.parseTransformAttribute(e); else if ("visible" === t) e = "none" !== e && "hidden" !== e, i && !1 === i.visible && (e = !1); else if ("opacity" === t) e = parseFloat(e), i && void 0 !== i.opacity && (e *= i.opacity); else if ("textAnchor" === t) e = "start" === e ? "left" : "end" === e ? "right" : "center"; else if ("charSpacing" === t) o = _(e, n) / n * 1e3; else if ("paintFirst" === t) { var a = e.indexOf("fill"), i = e.indexOf("stroke"), e = "fill"; (-1 < a && -1 < i && i < a || -1 === a && -1 < i) && (e = "stroke") } else { if ("href" === t || "xlink:href" === t || "font" === t) return e; if ("imageSmoothing" === t) return "optimizeQuality" === e; o = r ? e.map(_) : _(e, n) } } else e = ""; return !r && isNaN(o) ? e : o }(s = (c = l) in m ? m[c] : c, a[l], r, o), d[s] = c; d && d.font && y.parseFontDeclaration(d.font, d); e = f(r, d); return y.svgValidParentsRegEx.test(i.nodeName) ? e : function (t) { for (var e in v) if (void 0 !== t[v[e]] && "" !== t[e]) { if (void 0 === t[e]) { if (!y.Object.prototype[e]) continue; t[e] = y.Object.prototype[e] } var i; 0 !== t[e].indexOf("url(") && (i = new y.Color(t[e]), t[e] = i.setAlpha(g(i.getAlpha() * t[v[e]], 2)).toRgba()) } return t }(e) } }, parseElements: function (t, e, i, n, o) { new y.ElementsParser(t, e, i, n, o).parse() }, parseStyleAttribute: function (t) { var e, i, n, o = {}, t = t.getAttribute("style"); return t && ("string" == typeof t ? (e = o, t.replace(/;\s*$/, "").split(";").forEach(function (t) { t = t.split(":"); i = t[0].trim().toLowerCase(), n = t[1].trim(), e[i] = n })) : function (t, e) { var i, n, o; for (o in t) void 0 !== t[o] && (i = o.toLowerCase(), n = t[o], e[i] = n) }(t, o)), o }, parsePointsAttribute: function (t) { if (!t) return null; for (var e = [], i = 0, n = (t = (t = t.replace(/,/g, " ").trim()).split(/\s+/)).length; i < n; i += 2)e.push({ x: parseFloat(t[i]), y: parseFloat(t[i + 1]) }); return e }, getCSSRules: function (t) { for (var e = t.getElementsByTagName("style"), a = {}, s = 0, l = e.length; s < l; s++){ var i = e[s].textContent; "" !== (i = i.replace(/\/\*[\s\S]*?\*\//g, "")).trim() && i.match(/[^{]*\{[\s\S]*?\}/g).map(function (t) { return t.trim() }).forEach(function (t) { var e = t.match(/([\s\S]*?)\s*\{([^}]*)\}/), i = {}, n = e[2].trim().replace(/;$/, "").split(/\s*;\s*/); for (s = 0, l = n.length; s < l; s++){ var o = n[s].split(/\s*:\s*/), r = o[0], o = o[1]; i[r] = o } (t = e[1]).split(",").forEach(function (t) { "" !== (t = t.replace(/^svg/i, "").trim()) && (a[t] ? y.util.object.extend(a[t], i) : a[t] = y.util.object.clone(i)) }) }) } return a }, loadSVGFromURL: function (t, o, e, i) { t = t.replace(/^\n\s*/, "").trim(), new y.util.request(t, { method: "get", onComplete: function (t) { t = t.responseXML; if (!t || !t.documentElement) return o && o(null), !1; y.parseSVGDocument(t.documentElement, function (t, e, i, n) { o && o(t, e, i, n) }, e, i) } }) }, loadSVGFromString: function (t, o, e, i) { t = (new y.window.DOMParser).parseFromString(t.trim(), "text/xml"); y.parseSVGDocument(t.documentElement, function (t, e, i, n) { o(t, e, i, n) }, e, i) } }) }("undefined" != typeof exports ? exports : this), fabric.ElementsParser = function (t, e, i, n, o, r) { this.elements = t, this.callback = e, this.options = i, this.reviver = n, this.svgUid = i && i.svgUid || 0, this.parsingOptions = o, this.regexUrl = /^url\(['"]?#([^'"]+)['"]?\)/g, this.doc = r }, function (t) { t.parse = function () { this.instances = new Array(this.elements.length), this.numElements = this.elements.length, this.createObjects() }, t.createObjects = function () { var i = this; this.elements.forEach(function (t, e) { t.setAttribute("svgUid", i.svgUid), i.createObject(t, e) }) }, t.findTag = function (t) { return fabric[fabric.util.string.capitalize(t.tagName.replace("svg:", ""))] }, t.createObject = function (t, e) { var i = this.findTag(t); if (i && i.fromElement) try { i.fromElement(t, this.createCallback(e, t), this.options) } catch (t) { fabric.log(t) } else this.checkIfDone() }, t.createCallback = function (i, n) { var o = this; return function (t) { var e; o.resolveGradient(t, n, "fill"), o.resolveGradient(t, n, "stroke"), t instanceof fabric.Image && t._originalElement && (e = t.parsePreserveAspectRatioAttribute(n)), t._removeTransformMatrix(e), o.resolveClipPath(t, n), o.reviver && o.reviver(n, t), o.instances[i] = t, o.checkIfDone() } }, t.extractPropertyDefinition = function (t, e, i) { t = t[e], e = this.regexUrl; if (e.test(t)) { e.lastIndex = 0; t = e.exec(t)[1]; return e.lastIndex = 0, fabric[i][this.svgUid][t] } }, t.resolveGradient = function (t, e, i) { var n = this.extractPropertyDefinition(t, i, "gradientDefs"); n && (e = e.getAttribute(i + "-opacity"), e = fabric.Gradient.fromElement(n, t, e, this.options), t.set(i, e)) }, t.createClipPathCallback = function (t, e) { return function (t) { t._removeTransformMatrix(), t.fillRule = t.clipRule, e.push(t) } }, t.resolveClipPath = function (t, e) { var i, n, o = this.extractPropertyDefinition(t, "clipPath", "clipPaths"); if (o) { n = [], l = fabric.util.invertTransform(t.calcTransformMatrix()); for (var r = o[0].parentNode, a = e; a.parentNode && a.getAttribute("clip-path") !== t.clipPath;)a = a.parentNode; a.parentNode.appendChild(r); for (var s = 0; s < o.length; s++)i = o[s], this.findTag(i).fromElement(i, this.createClipPathCallback(t, n), this.options); o = 1 === n.length ? n[0] : new fabric.Group(n), l = fabric.util.multiplyTransformMatrices(l, o.calcTransformMatrix()), o.clipPath && this.resolveClipPath(o, a); var l = fabric.util.qrDecompose(l); o.flipX = !1, o.flipY = !1, o.set("scaleX", l.scaleX), o.set("scaleY", l.scaleY), o.angle = l.angle, o.skewX = l.skewX, o.skewY = 0, o.setPositionByOrigin({ x: l.translateX, y: l.translateY }, "center", "center"), t.clipPath = o } else delete t.clipPath }, t.checkIfDone = function () { 0 == --this.numElements && (this.instances = this.instances.filter(function (t) { return null != t }), this.callback(this.instances, this.elements)) } }(fabric.ElementsParser.prototype), function (t) { "use strict"; function i(t, e) { this.x = t, this.y = e } (t = t.fabric || (t.fabric = {})).Point ? t.warn("fabric.Point is already defined") : (t.Point = i).prototype = { type: "point", constructor: i, add: function (t) { return new i(this.x + t.x, this.y + t.y) }, addEquals: function (t) { return this.x += t.x, this.y += t.y, this }, scalarAdd: function (t) { return new i(this.x + t, this.y + t) }, scalarAddEquals: function (t) { return this.x += t, this.y += t, this }, subtract: function (t) { return new i(this.x - t.x, this.y - t.y) }, subtractEquals: function (t) { return this.x -= t.x, this.y -= t.y, this }, scalarSubtract: function (t) { return new i(this.x - t, this.y - t) }, scalarSubtractEquals: function (t) { return this.x -= t, this.y -= t, this }, multiply: function (t) { return new i(this.x * t, this.y * t) }, multiplyEquals: function (t) { return this.x *= t, this.y *= t, this }, divide: function (t) { return new i(this.x / t, this.y / t) }, divideEquals: function (t) { return this.x /= t, this.y /= t, this }, eq: function (t) { return this.x === t.x && this.y === t.y }, lt: function (t) { return this.x < t.x && this.y < t.y }, lte: function (t) { return this.x <= t.x && this.y <= t.y }, gt: function (t) { return this.x > t.x && this.y > t.y }, gte: function (t) { return this.x >= t.x && this.y >= t.y }, lerp: function (t, e) { return void 0 === e && (e = .5), e = Math.max(Math.min(1, e), 0), new i(this.x + (t.x - this.x) * e, this.y + (t.y - this.y) * e) }, distanceFrom: function (t) { var e = this.x - t.x, t = this.y - t.y; return Math.sqrt(e * e + t * t) }, midPointFrom: function (t) { return this.lerp(t) }, min: function (t) { return new i(Math.min(this.x, t.x), Math.min(this.y, t.y)) }, max: function (t) { return new i(Math.max(this.x, t.x), Math.max(this.y, t.y)) }, toString: function () { return this.x + "," + this.y }, setXY: function (t, e) { return this.x = t, this.y = e, this }, setX: function (t) { return this.x = t, this }, setY: function (t) { return this.y = t, this }, setFromPoint: function (t) { return this.x = t.x, this.y = t.y, this }, swap: function (t) { var e = this.x, i = this.y; this.x = t.x, this.y = t.y, t.x = e, t.y = i }, clone: function () { return new i(this.x, this.y) } } }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var s = t.fabric || (t.fabric = {}); function l(t) { this.status = t, this.points = [] } s.Intersection ? s.warn("fabric.Intersection is already defined") : (s.Intersection = l, s.Intersection.prototype = { constructor: l, appendPoint: function (t) { return this.points.push(t), this }, appendPoints: function (t) { return this.points = this.points.concat(t), this } }, s.Intersection.intersectLineLine = function (t, e, i, n) { var o, r = (n.x - i.x) * (t.y - i.y) - (n.y - i.y) * (t.x - i.x), a = (e.x - t.x) * (t.y - i.y) - (e.y - t.y) * (t.x - i.x), n = (n.y - i.y) * (e.x - t.x) - (n.x - i.x) * (e.y - t.y); return 0 != n ? (i = a / n, 0 <= (n = r / n) && n <= 1 && 0 <= i && i <= 1 ? (o = new l("Intersection")).appendPoint(new s.Point(t.x + n * (e.x - t.x), t.y + n * (e.y - t.y))) : o = new l) : o = new l(0 == r || 0 == a ? "Coincident" : "Parallel"), o }, s.Intersection.intersectLinePolygon = function (t, e, i) { for (var n, o, r = new l, a = i.length, s = 0; s < a; s++)n = i[s], o = i[(s + 1) % a], o = l.intersectLineLine(t, e, n, o), r.appendPoints(o.points); return 0 < r.points.length && (r.status = "Intersection"), r }, s.Intersection.intersectPolygonPolygon = function (t, e) { for (var i = new l, n = t.length, o = 0; o < n; o++){ var r = t[o], a = t[(o + 1) % n], a = l.intersectLinePolygon(r, a, e); i.appendPoints(a.points) } return 0 < i.points.length && (i.status = "Intersection"), i }, s.Intersection.intersectPolygonRectangle = function (t, e, i) { var n = e.min(i), o = e.max(i), r = new s.Point(o.x, n.y), e = new s.Point(n.x, o.y), i = l.intersectLinePolygon(n, r, t), r = l.intersectLinePolygon(r, o, t), o = l.intersectLinePolygon(o, e, t), n = l.intersectLinePolygon(e, n, t), t = new l; return t.appendPoints(i.points), t.appendPoints(r.points), t.appendPoints(o.points), t.appendPoints(n.points), 0 < t.points.length && (t.status = "Intersection"), t }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var c = t.fabric || (t.fabric = {}); function s(t) { t ? this._tryParsingColor(t) : this.setSource([0, 0, 0, 1]) } function l(t, e, i) { return i < 0 && (i += 1), 1 < i && --i, i < 1 / 6 ? t + 6 * (e - t) * i : i < .5 ? e : i < 2 / 3 ? t + (e - t) * (2 / 3 - i) * 6 : t } c.Color ? c.warn("fabric.Color is already defined.") : (c.Color = s, c.Color.prototype = { _tryParsingColor: function (t) { var e; t in s.colorNameMap && (t = s.colorNameMap[t]), "transparent" === t && (e = [255, 255, 255, 0]), (e = (e = (e = (e = e || s.sourceFromHex(t)) || s.sourceFromRgb(t)) || s.sourceFromHsl(t)) || [0, 0, 0, 1]) && this.setSource(e) }, _rgbToHsl: function (t, e, i) { t /= 255, e /= 255, i /= 255; var n, o = c.util.array.max([t, e, i]), r = c.util.array.min([t, e, i]), a = (o + r) / 2; if (o === r) n = l = 0; else { var s = o - r, l = .5 < a ? s / (2 - o - r) : s / (o + r); switch (o) { case t: n = (e - i) / s + (e < i ? 6 : 0); break; case e: n = (i - t) / s + 2; break; case i: n = (t - e) / s + 4 }n /= 6 } return [Math.round(360 * n), Math.round(100 * l), Math.round(100 * a)] }, getSource: function () { return this._source }, setSource: function (t) { this._source = t }, toRgb: function () { var t = this.getSource(); return "rgb(" + t[0] + "," + t[1] + "," + t[2] + ")" }, toRgba: function () { var t = this.getSource(); return "rgba(" + t[0] + "," + t[1] + "," + t[2] + "," + t[3] + ")" }, toHsl: function () { var t = this.getSource(), t = this._rgbToHsl(t[0], t[1], t[2]); return "hsl(" + t[0] + "," + t[1] + "%," + t[2] + "%)" }, toHsla: function () { var t = this.getSource(), e = this._rgbToHsl(t[0], t[1], t[2]); return "hsla(" + e[0] + "," + e[1] + "%," + e[2] + "%," + t[3] + ")" }, toHex: function () { var t, e = this.getSource(), i = e[0].toString(16); return i = 1 === i.length ? "0" + i : i, t = 1 === (t = e[1].toString(16)).length ? "0" + t : t, e = 1 === (e = e[2].toString(16)).length ? "0" + e : e, i.toUpperCase() + t.toUpperCase() + e.toUpperCase() }, toHexa: function () { var t = this.getSource(), t = Math.round(255 * t[3]); return t = 1 === (t = t.toString(16)).length ? "0" + t : t, this.toHex() + t.toUpperCase() }, getAlpha: function () { return this.getSource()[3] }, setAlpha: function (t) { var e = this.getSource(); return e[3] = t, this.setSource(e), this }, toGrayscale: function () { var t = this.getSource(), e = parseInt((.3 * t[0] + .59 * t[1] + .11 * t[2]).toFixed(0), 10), t = t[3]; return this.setSource([e, e, e, t]), this }, toBlackWhite: function (t) { var e = this.getSource(), i = (.3 * e[0] + .59 * e[1] + .11 * e[2]).toFixed(0), e = e[3]; return t = t || 127, i = Number(i) < Number(t) ? 0 : 255, this.setSource([i, i, i, e]), this }, overlayWith: function (t) { t instanceof s || (t = new s(t)); for (var e = [], i = this.getAlpha(), n = this.getSource(), o = t.getSource(), r = 0; r < 3; r++)e.push(Math.round(.5 * n[r] + .5 * o[r])); return e[3] = i, this.setSource(e), this } }, c.Color.reRGBa = /^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i, c.Color.reHSLa = /^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i, c.Color.reHex = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i, c.Color.colorNameMap = { aliceblue: "#F0F8FF", antiquewhite: "#FAEBD7", aqua: "#00FFFF", aquamarine: "#7FFFD4", azure: "#F0FFFF", beige: "#F5F5DC", bisque: "#FFE4C4", black: "#000000", blanchedalmond: "#FFEBCD", blue: "#0000FF", blueviolet: "#8A2BE2", brown: "#A52A2A", burlywood: "#DEB887", cadetblue: "#5F9EA0", chartreuse: "#7FFF00", chocolate: "#D2691E", coral: "#FF7F50", cornflowerblue: "#6495ED", cornsilk: "#FFF8DC", crimson: "#DC143C", cyan: "#00FFFF", darkblue: "#00008B", darkcyan: "#008B8B", darkgoldenrod: "#B8860B", darkgray: "#A9A9A9", darkgrey: "#A9A9A9", darkgreen: "#006400", darkkhaki: "#BDB76B", darkmagenta: "#8B008B", darkolivegreen: "#556B2F", darkorange: "#FF8C00", darkorchid: "#9932CC", darkred: "#8B0000", darksalmon: "#E9967A", darkseagreen: "#8FBC8F", darkslateblue: "#483D8B", darkslategray: "#2F4F4F", darkslategrey: "#2F4F4F", darkturquoise: "#00CED1", darkviolet: "#9400D3", deeppink: "#FF1493", deepskyblue: "#00BFFF", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1E90FF", firebrick: "#B22222", floralwhite: "#FFFAF0", forestgreen: "#228B22", fuchsia: "#FF00FF", gainsboro: "#DCDCDC", ghostwhite: "#F8F8FF", gold: "#FFD700", goldenrod: "#DAA520", gray: "#808080", grey: "#808080", green: "#008000", greenyellow: "#ADFF2F", honeydew: "#F0FFF0", hotpink: "#FF69B4", indianred: "#CD5C5C", indigo: "#4B0082", ivory: "#FFFFF0", khaki: "#F0E68C", lavender: "#E6E6FA", lavenderblush: "#FFF0F5", lawngreen: "#7CFC00", lemonchiffon: "#FFFACD", lightblue: "#ADD8E6", lightcoral: "#F08080", lightcyan: "#E0FFFF", lightgoldenrodyellow: "#FAFAD2", lightgray: "#D3D3D3", lightgrey: "#D3D3D3", lightgreen: "#90EE90", lightpink: "#FFB6C1", lightsalmon: "#FFA07A", lightseagreen: "#20B2AA", lightskyblue: "#87CEFA", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#B0C4DE", lightyellow: "#FFFFE0", lime: "#00FF00", limegreen: "#32CD32", linen: "#FAF0E6", magenta: "#FF00FF", maroon: "#800000", mediumaquamarine: "#66CDAA", mediumblue: "#0000CD", mediumorchid: "#BA55D3", mediumpurple: "#9370DB", mediumseagreen: "#3CB371", mediumslateblue: "#7B68EE", mediumspringgreen: "#00FA9A", mediumturquoise: "#48D1CC", mediumvioletred: "#C71585", midnightblue: "#191970", mintcream: "#F5FFFA", mistyrose: "#FFE4E1", moccasin: "#FFE4B5", navajowhite: "#FFDEAD", navy: "#000080", oldlace: "#FDF5E6", olive: "#808000", olivedrab: "#6B8E23", orange: "#FFA500", orangered: "#FF4500", orchid: "#DA70D6", palegoldenrod: "#EEE8AA", palegreen: "#98FB98", paleturquoise: "#AFEEEE", palevioletred: "#DB7093", papayawhip: "#FFEFD5", peachpuff: "#FFDAB9", peru: "#CD853F", pink: "#FFC0CB", plum: "#DDA0DD", powderblue: "#B0E0E6", purple: "#800080", rebeccapurple: "#663399", red: "#FF0000", rosybrown: "#BC8F8F", royalblue: "#4169E1", saddlebrown: "#8B4513", salmon: "#FA8072", sandybrown: "#F4A460", seagreen: "#2E8B57", seashell: "#FFF5EE", sienna: "#A0522D", silver: "#C0C0C0", skyblue: "#87CEEB", slateblue: "#6A5ACD", slategray: "#708090", slategrey: "#708090", snow: "#FFFAFA", springgreen: "#00FF7F", steelblue: "#4682B4", tan: "#D2B48C", teal: "#008080", thistle: "#D8BFD8", tomato: "#FF6347", turquoise: "#40E0D0", violet: "#EE82EE", wheat: "#F5DEB3", white: "#FFFFFF", whitesmoke: "#F5F5F5", yellow: "#FFFF00", yellowgreen: "#9ACD32" }, c.Color.fromRgb = function (t) { return s.fromSource(s.sourceFromRgb(t)) }, c.Color.sourceFromRgb = function (t) { var e = t.match(s.reRGBa); if (e) { var i = parseInt(e[1], 10) / (/%$/.test(e[1]) ? 100 : 1) * (/%$/.test(e[1]) ? 255 : 1), n = parseInt(e[2], 10) / (/%$/.test(e[2]) ? 100 : 1) * (/%$/.test(e[2]) ? 255 : 1), t = parseInt(e[3], 10) / (/%$/.test(e[3]) ? 100 : 1) * (/%$/.test(e[3]) ? 255 : 1); return [parseInt(i, 10), parseInt(n, 10), parseInt(t, 10), e[4] ? parseFloat(e[4]) : 1] } }, c.Color.fromRgba = s.fromRgb, c.Color.fromHsl = function (t) { return s.fromSource(s.sourceFromHsl(t)) }, c.Color.sourceFromHsl = function (t) { var e = t.match(s.reHSLa); if (e) { var i, n, o, r = (parseFloat(e[1]) % 360 + 360) % 360 / 360, a = parseFloat(e[2]) / (/%$/.test(e[2]) ? 100 : 1), t = parseFloat(e[3]) / (/%$/.test(e[3]) ? 100 : 1); return 0 == a ? i = n = o = t : (i = l(a = 2 * t - (t = t <= .5 ? t * (1 + a) : t + a - t * a), t, r + 1 / 3), n = l(a, t, r), o = l(a, t, r - 1 / 3)), [Math.round(255 * i), Math.round(255 * n), Math.round(255 * o), e[4] ? parseFloat(e[4]) : 1] } }, c.Color.fromHsla = s.fromHsl, c.Color.fromHex = function (t) { return s.fromSource(s.sourceFromHex(t)) }, c.Color.sourceFromHex = function (t) { if (t.match(s.reHex)) { var e = t.slice(t.indexOf("#") + 1), i = 3 === e.length || 4 === e.length, n = 8 === e.length || 4 === e.length, o = i ? e.charAt(0) + e.charAt(0) : e.substring(0, 2), r = i ? e.charAt(1) + e.charAt(1) : e.substring(2, 4), t = i ? e.charAt(2) + e.charAt(2) : e.substring(4, 6), e = n ? i ? e.charAt(3) + e.charAt(3) : e.substring(6, 8) : "FF"; return [parseInt(o, 16), parseInt(r, 16), parseInt(t, 16), parseFloat((parseInt(e, 16) / 255).toFixed(2))] } }, c.Color.fromSource = function (t) { var e = new s; return e.setSource(t), e }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var s = t.fabric || (t.fabric = {}), o = ["e", "se", "s", "sw", "w", "nw", "n", "ne", "e"], r = ["ns", "nesw", "ew", "nwse"], a = {}, c = "left", d = "top", h = "right", u = "bottom", l = "center", b = { top: u, bottom: d, left: h, right: c, center: l }, f = s.util.radiansToDegrees, m = Math.sign || function (t) { return (0 < t) - (t < 0) || +t }; function p(t, e) { e = t.angle + f(Math.atan2(e.y, e.x)) + 360; return Math.round(e % 360 / 45) } function v(t, e) { var i = e.transform.target, n = i.canvas, o = s.util.object.clone(e); o.target = i, n && n.fire("object:" + t, o), i.fire(t, e) } function x(t, e) { e = e.canvas, t = t[e.uniScaleKey]; return e.uniformScaling && !t || !e.uniformScaling && t } function y(t) { return t.originX === l && t.originY === l } function _(t, e, i) { var n = t.lockScalingX, t = t.lockScalingY; return !(!n || !t) || (!(e || !n && !t || !i) || (!(!n || "x" !== e) || !(!t || "y" !== e))) } function w(t, e, i, n) { return { e: t, transform: e, pointer: { x: i, y: n } } } function g(a) { return function (t, e, i, n) { var o = e.target, r = o.getCenterPoint(), r = o.translateToOriginPoint(r, e.originX, e.originY), n = a(t, e, i, n); return o.setPositionByOrigin(r, e.originX, e.originY), n } } function C(t, e, i, n, o) { var r = t.target, a = r.controls[t.corner], t = r.canvas.getZoom(), t = r.padding / t, i = r.toLocalPoint(new s.Point(n, o), e, i); return i.x >= t && (i.x -= t), i.x <= -t && (i.x += t), i.y >= t && (i.y -= t), i.y <= t && (i.y += t), i.x -= a.offsetX, i.y -= a.offsetY, i } function S(t) { return t.flipX && !t.flipY || !t.flipX && t.flipY } function T(t, e, i, n, o) { 0 !== t[e] && (n = o / t._getTransformedDimensions()[n] * t[i], t.set(i, n)) } function k(t, e, i, n) { var o, r = e.target, a = r._getTransformedDimensions(0, r.skewY), s = C(e, e.originX, e.originY, i, n), l = Math.abs(2 * s.x) - a.x, s = r.skewX; l < 2 ? o = 0 : (o = f(Math.atan2(l / r.scaleX, a.y / r.scaleY)), e.originX === c && e.originY === u && (o = -o), e.originX === h && e.originY === d && (o = -o), S(r) && (o = -o)); a = s !== o; return a && (s = r._getTransformedDimensions().y, r.set("skewX", o), T(r, "skewY", "scaleY", "y", s), v("skewing", w(t, e, i, n))), a } function O(t, e, i, n) { var o, r = e.target, a = r._getTransformedDimensions(r.skewX, 0), s = C(e, e.originX, e.originY, i, n), l = Math.abs(2 * s.y) - a.y, s = r.skewY; l < 2 ? o = 0 : (o = f(Math.atan2(l / r.scaleY, a.x / r.scaleX)), e.originX === c && e.originY === u && (o = -o), e.originX === h && e.originY === d && (o = -o), S(r) && (o = -o)); a = s !== o; return a && (s = r._getTransformedDimensions().x, r.set("skewY", o), T(r, "skewX", "scaleX", "x", s), v("skewing", w(t, e, i, n))), a } function F(t, e, i, n, o) { o = o || {}; var r = e.target, a = r.lockScalingX, s = r.lockScalingY, l = o.by, c = x(t, r), d = _(r, l, c), h = e.gestureScale; if (d) return !1; if (h) u = e.scaleX * h, f = e.scaleY * h; else { if (o = C(e, e.originX, e.originY, i, n), p = "y" !== l ? m(o.x) : 1, g = "x" !== l ? m(o.y) : 1, e.signX || (e.signX = p), e.signY || (e.signY = g), r.lockScalingFlip && (e.signX !== p || e.signY !== g)) return !1; var u, f, d = r._getTransformedDimensions(); f = c && !l ? (h = Math.abs(o.x) + Math.abs(o.y), c = e.original, h = h / (Math.abs(d.x * c.scaleX / r.scaleX) + Math.abs(d.y * c.scaleY / r.scaleY)), u = c.scaleX * h, c.scaleY * h) : (u = Math.abs(o.x * r.scaleX / d.x), Math.abs(o.y * r.scaleY / d.y)), y(e) && (u *= 2, f *= 2), e.signX !== p && "y" !== l && (e.originX = b[e.originX], u *= -1, e.signX = p), e.signY !== g && "x" !== l && (e.originY = b[e.originY], f *= -1, e.signY = g) } var p = r.scaleX, g = r.scaleY; return l ? ("x" === l && r.set("scaleX", u), "y" === l && r.set("scaleY", f)) : (a || r.set("scaleX", u), s || r.set("scaleY", f)), (r = p !== r.scaleX || g !== r.scaleY) && v("scaling", w(t, e, i, n)), r } a.scaleCursorStyleHandler = function (t, e, i) { var n = x(t, i), t = ""; return 0 !== e.x && 0 === e.y ? t = "x" : 0 === e.x && 0 !== e.y && (t = "y"), _(i, t, n) ? "not-allowed" : (e = p(i, e), o[e] + "-resize") }, a.skewCursorStyleHandler = function (t, e, i) { var n = "not-allowed"; return 0 !== e.x && i.lockSkewingY || 0 !== e.y && i.lockSkewingX ? n : (e = p(i, e) % 4, r[e] + "-resize") }, a.scaleSkewCursorStyleHandler = function (t, e, i) { return t[i.canvas.altActionKey] ? a.skewCursorStyleHandler(t, e, i) : a.scaleCursorStyleHandler(t, e, i) }, a.rotationWithSnapping = g(function (t, e, i, n) { var o = e, r = o.target, a = r.translateToOriginPoint(r.getCenterPoint(), o.originX, o.originY); if (r.lockRotation) return !1; var s = Math.atan2(o.ey - a.y, o.ex - a.x), l = Math.atan2(n - a.y, i - a.x), c = f(l - s + o.theta); return 0 < r.snapAngle && (l = r.snapAngle, s = r.snapThreshold || l, o = Math.ceil(c / l) * l, l = Math.floor(c / l) * l, Math.abs(c - l) < s ? c = l : Math.abs(c - o) < s && (c = o)), c < 0 && (c = 360 + c), c %= 360, a = r.angle !== c, r.angle = c, a && v("rotating", w(t, e, i, n)), a }), a.scalingEqually = g(function (t, e, i, n) { return F(t, e, i, n) }), a.scalingX = g(function (t, e, i, n) { return F(t, e, i, n, { by: "x" }) }), a.scalingY = g(function (t, e, i, n) { return F(t, e, i, n, { by: "y" }) }), a.scalingYOrSkewingX = function (t, e, i, n) { return t[e.target.canvas.altActionKey] ? a.skewHandlerX(t, e, i, n) : a.scalingY(t, e, i, n) }, a.scalingXOrSkewingY = function (t, e, i, n) { return t[e.target.canvas.altActionKey] ? a.skewHandlerY(t, e, i, n) : a.scalingX(t, e, i, n) }, a.changeWidth = g(function (t, e, i, n) { var o = e.target, r = C(e, e.originX, e.originY, i, n), a = o.strokeWidth / (o.strokeUniform ? o.scaleX : 1), s = y(e) ? 2 : 1, l = o.width, a = Math.abs(r.x * s / o.scaleX) - a; return o.set("width", Math.max(a, 0)), (a = l !== a) && v("resizing", w(t, e, i, n)), a }), a.skewHandlerX = function (t, e, i, n) { var o, r = e.target, a = r.skewX, s = e.originY; return !r.lockSkewingX && (0 === a ? o = 0 < C(e, l, l, i, n).x ? c : h : (0 < a && (o = s === d ? c : h), a < 0 && (o = s === d ? h : c), S(r) && (o = o === c ? h : c)), e.originX = o, g(k)(t, e, i, n)) }, a.skewHandlerY = function (t, e, i, n) { var o, r = e.target, a = r.skewY, s = e.originX; return !r.lockSkewingY && (0 === a ? o = 0 < C(e, l, l, i, n).y ? d : u : (0 < a && (o = s === c ? d : u), a < 0 && (o = s === c ? u : d), S(r) && (o = o === d ? u : d)), e.originY = o, g(O)(t, e, i, n)) }, a.dragHandler = function (t, e, i, n) { var o = e.target, r = i - e.offsetX, a = n - e.offsetY, s = !o.get("lockMovementX") && o.left !== r, l = !o.get("lockMovementY") && o.top !== a; return s && o.set("left", r), l && o.set("top", a), (s || l) && v("moving", w(t, e, i, n)), s || l }, a.scaleOrSkewActionName = function (t, e, i) { return i = t[i.canvas.altActionKey], 0 === e.x ? i ? "skewX" : "scaleY" : 0 === e.y ? i ? "skewY" : "scaleX" : void 0 }, a.rotationStyleHandler = function (t, e, i) { return i.lockRotation ? "not-allowed" : e.cursorStyle }, a.fireEvent = v, a.wrapWithFixedAnchor = g, a.getLocalPoint = C, s.controlsUtils = a }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var h = (t = t.fabric || (t.fabric = {})).util.degreesToRadians; (t = t.controlsUtils).renderCircleControl = function (t, e, i, n, o) { n = n || {}; var r, a = this.sizeX || n.cornerSize || o.cornerSize, s = this.sizeY || n.cornerSize || o.cornerSize, l = (h = (void 0 !== n.transparentCorners ? n : this).transparentCorners) ? "stroke" : "fill", c = !h && (n.cornerStrokeColor || o.cornerStrokeColor), d = e, h = i; t.save(), t.fillStyle = n.cornerColor || o.cornerColor, t.strokeStyle = n.cornerStrokeColor || o.cornerStrokeColor, s < a ? (r = a, t.scale(1, s / a), h = i * a / s) : a < s ? (r = s, t.scale(a / s, 1), d = e * s / a) : r = a, t.lineWidth = 1, t.beginPath(), t.arc(d, h, r / 2, 0, 2 * Math.PI, !1), t[l](), c && t.stroke(), t.restore() }, t.renderSquareControl = function (t, e, i, n, o) { n = n || {}; var r = this.sizeX || n.cornerSize || o.cornerSize, a = this.sizeY || n.cornerSize || o.cornerSize, s = (d = (void 0 !== n.transparentCorners ? n : o).transparentCorners) ? "stroke" : "fill", l = !d && (n.cornerStrokeColor || o.cornerStrokeColor), c = r / 2, d = a / 2; t.save(), t.fillStyle = n.cornerColor || o.cornerColor, t.strokeStyle = n.strokeCornerColor || o.strokeCornerColor, t.lineWidth = 1, t.translate(e, i), t.rotate(h(o.angle)), t[s + "Rect"](-c, -d, r, a), l && t.strokeRect(-c, -d, r, a), t.restore() } }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var u = t.fabric || (t.fabric = {}); u.Control = function (t) { for (var e in t) this[e] = t[e] }, u.Control.prototype = { visible: !0, actionName: "scale", angle: 0, x: 0, y: 0, offsetX: 0, offsetY: 0, sizeX: null, sizeY: null, touchSizeX: null, touchSizeY: null, cursorStyle: "crosshair", withConnection: !1, actionHandler: function () { }, mouseDownHandler: function () { }, mouseUpHandler: function () { }, getActionHandler: function () { return this.actionHandler }, getMouseDownHandler: function () { return this.mouseDownHandler }, getMouseUpHandler: function () { return this.mouseUpHandler }, cursorStyleHandler: function (t, e) { return e.cursorStyle }, getActionName: function (t, e) { return e.actionName }, getVisibility: function (t, e) { t = t._controlsVisibility; return t && void 0 !== t[e] ? t[e] : this.visible }, setVisibility: function (t) { this.visible = t }, positionHandler: function (t, e) { return u.util.transformPoint({ x: this.x * t.x + this.offsetX, y: this.y * t.y + this.offsetY }, e) }, calcCornerCoords: function (t, e, i, n, o) { var r, a, s, l, c, d, h = o ? this.touchSizeX : this.sizeX, o = o ? this.touchSizeY : this.sizeY; return h && o && h !== o ? (s = Math.atan2(o, h), c = Math.sqrt(h * h + o * o) / 2, d = s - u.util.degreesToRadians(t), l = Math.PI / 2 - s - u.util.degreesToRadians(t), r = c * u.util.cos(d), a = c * u.util.sin(d), s = c * u.util.cos(l), l = c * u.util.sin(l)) : (c = .7071067812 * (h && o ? h : e), d = u.util.degreesToRadians(45 - t), r = s = c * u.util.cos(d), a = l = c * u.util.sin(d)), { tl: { x: i - l, y: n - s }, tr: { x: i + r, y: n - a }, bl: { x: i - r, y: n + a }, br: { x: i + l, y: n + s } } }, render: function (t, e, i, n, o) { ("circle" === ((n = n || {}).cornerStyle || o.cornerStyle) ? u.controlsUtils.renderCircleControl : u.controlsUtils.renderSquareControl).call(this, t, e, i, n, o) } } }("undefined" != typeof exports ? exports : this), function () { var g = fabric.util.object.clone; fabric.Gradient = fabric.util.createClass({ offsetX: 0, offsetY: 0, gradientTransform: null, gradientUnits: "pixels", type: "linear", initialize: function (e) { (e = e || {}).coords || (e.coords = {}); var t, i = this; Object.keys(e).forEach(function (t) { i[t] = e[t] }), this.id ? this.id += "_" + fabric.Object.__uid++ : this.id = fabric.Object.__uid++ , t = { x1: e.coords.x1 || 0, y1: e.coords.y1 || 0, x2: e.coords.x2 || 0, y2: e.coords.y2 || 0 }, "radial" === this.type && (t.r1 = e.coords.r1 || 0, t.r2 = e.coords.r2 || 0), this.coords = t, this.colorStops = e.colorStops.slice() }, addColorStop: function (t) { for (var e in t) { var i = new fabric.Color(t[e]); this.colorStops.push({ offset: parseFloat(e), color: i.toRgb(), opacity: i.getAlpha() }) } return this }, toObject: function (t) { var e = { type: this.type, coords: this.coords, colorStops: this.colorStops, offsetX: this.offsetX, offsetY: this.offsetY, gradientUnits: this.gradientUnits, gradientTransform: this.gradientTransform && this.gradientTransform.concat() }; return fabric.util.populateWithProperties(this, e, t), e }, toSVG: function (t, e) { var i, n = g(this.coords, !0), e = e || {}, o = g(this.colorStops, !0), r = n.r1 > n.r2, a = (this.gradientTransform || fabric.iMatrix).concat(), s = -this.offsetX, l = -this.offsetY, c = !!e.additionalTransform, d = "pixels" === this.gradientUnits ? "userSpaceOnUse" : "objectBoundingBox"; if (o.sort(function (t, e) { return t.offset - e.offset }), "objectBoundingBox" == d ? (s /= t.width, l /= t.height) : (s += t.width / 2, l += t.height / 2), "path" === t.type && "percentage" !== this.gradientUnits && (s -= t.pathOffset.x, l -= t.pathOffset.y), a[4] -= s, a[5] -= l, d = 'id="SVGID_' + this.id + '" gradientUnits="' + d + '"', d += ' gradientTransform="' + (c ? e.additionalTransform + " " : "") + fabric.util.matrixToSVG(a) + '" ', "linear" === this.type ? i = ["<linearGradient ", d, ' x1="', n.x1, '" y1="', n.y1, '" x2="', n.x2, '" y2="', n.y2, '">\n'] : "radial" === this.type && (i = ["<radialGradient ", d, ' cx="', r ? n.x1 : n.x2, '" cy="', r ? n.y1 : n.y2, '" r="', r ? n.r1 : n.r2, '" fx="', r ? n.x2 : n.x1, '" fy="', r ? n.y2 : n.y1, '">\n']), "radial" === this.type) { if (r) for ((o = o.concat()).reverse(), u = 0, f = o.length; u < f; u++)o[u].offset = 1 - o[u].offset; r = Math.min(n.r1, n.r2); if (0 < r) for (var h = r / Math.max(n.r1, n.r2), u = 0, f = o.length; u < f; u++)o[u].offset += h * (1 - o[u].offset) } for (u = 0, f = o.length; u < f; u++){ var p = o[u]; i.push("<stop ", 'offset="', 100 * p.offset + "%", '" style="stop-color:', p.color, void 0 !== p.opacity ? ";stop-opacity: " + p.opacity : ";", '"/>\n') } return i.push("linear" === this.type ? "</linearGradient>\n" : "</radialGradient>\n"), i.join("") }, toLive: function (t) { var e, i, n, o = fabric.util.object.clone(this.coords); if (this.type) { for ("linear" === this.type ? e = t.createLinearGradient(o.x1, o.y1, o.x2, o.y2) : "radial" === this.type && (e = t.createRadialGradient(o.x1, o.y1, o.r1, o.x2, o.y2, o.r2)), i = 0, n = this.colorStops.length; i < n; i++){ var r = this.colorStops[i].color, a = this.colorStops[i].opacity, s = this.colorStops[i].offset; void 0 !== a && (r = new fabric.Color(r).setAlpha(a).toRgba()), e.addColorStop(s, r) } return e } } }), fabric.util.object.extend(fabric.Gradient, { fromElement: function (t, e, i, n) { var o = (o = parseFloat(i) / (/%$/.test(i) ? 100 : 1)) < 0 ? 0 : 1 < o ? 1 : o; isNaN(o) && (o = 1); for (var r, a, s, l, c, d, h = t.getElementsByTagName("stop"), u = "userSpaceOnUse" === t.getAttribute("gradientUnits") ? "pixels" : "percentage", f = t.getAttribute("gradientTransform") || "", p = [], g = 0, b = 0, m = "linearGradient" === t.nodeName || "LINEARGRADIENT" === t.nodeName ? (r = "linear", { x1: (i = t).getAttribute("x1") || 0, y1: i.getAttribute("y1") || 0, x2: i.getAttribute("x2") || "100%", y2: i.getAttribute("y2") || 0 }) : (r = "radial", { x1: (m = t).getAttribute("fx") || m.getAttribute("cx") || "50%", y1: m.getAttribute("fy") || m.getAttribute("cy") || "50%", r1: 0, x2: m.getAttribute("cx") || "50%", y2: m.getAttribute("cy") || "50%", r2: m.getAttribute("r") || "50%" }), v = h.length; v--;)p.push(function (t, e) { var i, n, o, r = t.getAttribute("style"), a = t.getAttribute("offset") || 0; if (a = (a = parseFloat(a) / (/%$/.test(a) ? 100 : 1)) < 0 ? 0 : 1 < a ? 1 : a, r) { var s = r.split(/\s*;\s*/); for ("" === s[s.length - 1] && s.pop(), o = s.length; o--;){ var l = s[o].split(/\s*:\s*/), c = l[0].trim(), l = l[1].trim(); "stop-color" === c ? i = l : "stop-opacity" === c && (n = l) } } return i = i || (t.getAttribute("stop-color") || "rgb(0,0,0)"), n = n || t.getAttribute("stop-opacity"), t = (i = new fabric.Color(i)).getAlpha(), n = isNaN(parseFloat(n)) ? 1 : parseFloat(n), n *= t * e, { offset: a, color: i.toRgb(), opacity: n } }(h[v], o)); return f = fabric.parseTransformAttribute(f), a = m, s = n, l = u, Object.keys(a).forEach(function (t) { "Infinity" === (c = a[t]) ? d = 1 : "-Infinity" === c ? d = 0 : (d = parseFloat(a[t], 10), "string" == typeof c && /^(\d+\.\d+)%|(\d+)%$/.test(c) && (d *= .01, "pixels" === l && ("x1" !== t && "x2" !== t && "r2" !== t || (d *= s.viewBoxWidth || s.width), "y1" !== t && "y2" !== t || (d *= s.viewBoxHeight || s.height)))), a[t] = d }), "pixels" == u && (g = -e.left, b = -e.top), new fabric.Gradient({ id: t.getAttribute("id"), type: r, coords: m, colorStops: p, gradientUnits: u, gradientTransform: f, offsetX: g, offsetY: b }) } }) }(), function () { "use strict"; var n = fabric.util.toFixed; fabric.Pattern = fabric.util.createClass({ repeat: "repeat", offsetX: 0, offsetY: 0, crossOrigin: "", patternTransform: null, initialize: function (t, i) { var n; t = t || {}, this.id = fabric.Object.__uid++ , this.setOptions(t), !t.source || t.source && "string" != typeof t.source ? i && i(this) : ((n = this).source = fabric.util.createImage(), fabric.util.loadImage(t.source, function (t, e) { n.source = t, i && i(n, e) }, null, this.crossOrigin)) }, toObject: function (t) { var e, i = fabric.Object.NUM_FRACTION_DIGITS; return "string" == typeof this.source.src ? e = this.source.src : "object" == typeof this.source && this.source.toDataURL && (e = this.source.toDataURL()), i = { type: "pattern", source: e, repeat: this.repeat, crossOrigin: this.crossOrigin, offsetX: n(this.offsetX, i), offsetY: n(this.offsetY, i), patternTransform: this.patternTransform ? this.patternTransform.concat() : null }, fabric.util.populateWithProperties(this, i, t), i }, toSVG: function (t) { var e = "function" == typeof this.source ? this.source() : this.source, i = e.width / t.width, n = e.height / t.height, o = this.offsetX / t.width, r = this.offsetY / t.height, t = ""; return "repeat-x" !== this.repeat && "no-repeat" !== this.repeat || (n = 1, r && (n += Math.abs(r))), "repeat-y" !== this.repeat && "no-repeat" !== this.repeat || (i = 1, o && (i += Math.abs(o))), e.src ? t = e.src : e.toDataURL && (t = e.toDataURL()), '<pattern id="SVGID_' + this.id + '" x="' + o + '" y="' + r + '" width="' + i + '" height="' + n + '">\n<image x="0" y="0" width="' + e.width + '" height="' + e.height + '" xlink:href="' + t + '"></image>\n</pattern>\n' }, setOptions: function (t) { for (var e in t) this[e] = t[e] }, toLive: function (t) { var e = this.source; if (!e) return ""; if (void 0 !== e.src) { if (!e.complete) return ""; if (0 === e.naturalWidth || 0 === e.naturalHeight) return "" } return t.createPattern(e, this.repeat) } }) }(), function (t) { "use strict"; var a = t.fabric || (t.fabric = {}), s = a.util.toFixed; a.Shadow ? a.warn("fabric.Shadow is already defined.") : (a.Shadow = a.util.createClass({ color: "rgb(0,0,0)", blur: 0, offsetX: 0, offsetY: 0, affectStroke: !1, includeDefaultValues: !0, nonScaling: !1, initialize: function (t) { for (var e in "string" == typeof t && (t = this._parseShadow(t)), t) this[e] = t[e]; this.id = a.Object.__uid++ }, _parseShadow: function (t) { var e = t.trim(), t = a.Shadow.reOffsetsAndBlur.exec(e) || []; return { color: (e.replace(a.Shadow.reOffsetsAndBlur, "") || "rgb(0,0,0)").trim(), offsetX: parseInt(t[1], 10) || 0, offsetY: parseInt(t[2], 10) || 0, blur: parseInt(t[3], 10) || 0 } }, toString: function () { return [this.offsetX, this.offsetY, this.blur, this.color].join("px ") }, toSVG: function (t) { var e = 40, i = 40, n = a.Object.NUM_FRACTION_DIGITS, o = a.util.rotateVector({ x: this.offsetX, y: this.offsetY }, a.util.degreesToRadians(-t.angle)), r = new a.Color(this.color); return t.width && t.height && (e = 100 * s((Math.abs(o.x) + this.blur) / t.width, n) + 20, i = 100 * s((Math.abs(o.y) + this.blur) / t.height, n) + 20), t.flipX && (o.x *= -1), t.flipY && (o.y *= -1), '<filter id="SVGID_' + this.id + '" y="-' + i + '%" height="' + (100 + 2 * i) + '%" x="-' + e + '%" width="' + (100 + 2 * e) + '%" >\n\t<feGaussianBlur in="SourceAlpha" stdDeviation="' + s(this.blur ? this.blur / 2 : 0, n) + '"></feGaussianBlur>\n\t<feOffset dx="' + s(o.x, n) + '" dy="' + s(o.y, n) + '" result="oBlur" ></feOffset>\n\t<feFlood flood-color="' + r.toRgb() + '" flood-opacity="' + r.getAlpha() + '"/>\n\t<feComposite in2="oBlur" operator="in" />\n\t<feMerge>\n\t\t<feMergeNode></feMergeNode>\n\t\t<feMergeNode in="SourceGraphic"></feMergeNode>\n\t</feMerge>\n</filter>\n' }, toObject: function () { if (this.includeDefaultValues) return { color: this.color, blur: this.blur, offsetX: this.offsetX, offsetY: this.offsetY, affectStroke: this.affectStroke, nonScaling: this.nonScaling }; var e = {}, i = a.Shadow.prototype; return ["color", "blur", "offsetX", "offsetY", "affectStroke", "nonScaling"].forEach(function (t) { this[t] !== i[t] && (e[t] = this[t]) }, this), e } }), a.Shadow.reOffsetsAndBlur = /(?:\s|^)(-?\d+(?:px)?(?:\s?|$))?(-?\d+(?:px)?(?:\s?|$))?(\d+(?:px)?)?(?:\s?|$)(?:$|\s)/) }("undefined" != typeof exports ? exports : this), function () { Function.prototype.bind = function () { var __method = this; var args = Array.prototype.slice.call(arguments); var object = args.shift(); return function () { return __method.apply(object, args.concat(Array.prototype.slice.call(arguments))); }; }; "use strict"; var o, t, c, s, r, a, i, n, e; fabric.StaticCanvas ? fabric.warn("fabric.StaticCanvas is already defined.") : (o = fabric.util.object.extend, t = fabric.util.getElementOffset, c = fabric.util.removeFromArray, s = fabric.util.toFixed, r = fabric.util.transformPoint, a = fabric.util.invertTransform, i = fabric.util.getNodeCanvas, n = fabric.util.createCanvasElement, e = new Error("Could not initialize `canvas` element"), fabric.StaticCanvas = fabric.util.createClass(fabric.CommonMethods, { initialize: function (t, e) { e = e || {}, this.renderAndResetBound = this.renderAndReset.bind(this), this.requestRenderAllBound = this.requestRenderAll.bind(this), this._initStatic(t, e) }, backgroundColor: "", backgroundImage: null, overlayColor: "", overlayImage: null, includeDefaultValues: !0, stateful: !1, renderOnAddRemove: !0, controlsAboveOverlay: !1, allowTouchScrolling: !1, imageSmoothingEnabled: !0, viewportTransform: fabric.iMatrix.concat(), backgroundVpt: !0, overlayVpt: !0, enableRetinaScaling: !0, vptCoords: {}, skipOffscreen: !0, clipPath: void 0, _initStatic: function (t, e) { var i = this.requestRenderAllBound; this._objects = [], this._createLowerCanvas(t), this._initOptions(e), this.interactive || this._initRetinaScaling(), e.overlayImage && this.setOverlayImage(e.overlayImage, i), e.backgroundImage && this.setBackgroundImage(e.backgroundImage, i), e.backgroundColor && this.setBackgroundColor(e.backgroundColor, i), e.overlayColor && this.setOverlayColor(e.overlayColor, i), this.calcOffset() }, _isRetinaScaling: function () { return 1 !== fabric.devicePixelRatio && this.enableRetinaScaling }, getRetinaScaling: function () { return this._isRetinaScaling() ? fabric.devicePixelRatio : 1 }, _initRetinaScaling: function () { var t; this._isRetinaScaling() && (t = fabric.devicePixelRatio, this.__initRetinaScaling(t, this.lowerCanvasEl, this.contextContainer), this.upperCanvasEl && this.__initRetinaScaling(t, this.upperCanvasEl, this.contextTop)) }, __initRetinaScaling: function (t, e, i) { e.setAttribute("width", this.width * t), e.setAttribute("height", this.height * t), i.scale(t, t) }, calcOffset: function () { return this._offset = t(this.lowerCanvasEl), this }, setOverlayImage: function (t, e, i) { return this.__setBgOverlayImage("overlayImage", t, e, i) }, setBackgroundImage: function (t, e, i) { return this.__setBgOverlayImage("backgroundImage", t, e, i) }, setOverlayColor: function (t, e) { return this.__setBgOverlayColor("overlayColor", t, e) }, setBackgroundColor: function (t, e) { return this.__setBgOverlayColor("backgroundColor", t, e) }, __setBgOverlayImage: function (n, t, o, r) { return "string" == typeof t ? fabric.util.loadImage(t, function (t, e) { var i; t && (i = new fabric.Image(t, r), (this[n] = i).canvas = this), o && o(t, e) }, this, r && r.crossOrigin) : (r && t.setOptions(r), (this[n] = t) && (t.canvas = this), o && o(t, !1)), this }, __setBgOverlayColor: function (t, e, i) { return this[t] = e, this._initGradient(e, t), this._initPattern(e, t, i), this }, _createCanvasElement: function () { var t = n(); if (!t) throw e; if (t.style || (t.style = {}), void 0 === t.getContext) throw e; return t }, _initOptions: function (t) { var e = this.lowerCanvasEl; this._setOptions(t), this.width = this.width || parseInt(e.width, 10) || 0, this.height = this.height || parseInt(e.height, 10) || 0, this.lowerCanvasEl.style && (e.width = this.width, e.height = this.height, e.style.width = this.width + "px", e.style.height = this.height + "px", this.viewportTransform = this.viewportTransform.slice()) }, _createLowerCanvas: function (t) { t && t.getContext ? this.lowerCanvasEl = t : this.lowerCanvasEl = fabric.util.getById(t) || this._createCanvasElement(), fabric.util.addClass(this.lowerCanvasEl, "lower-canvas"), this.interactive && this._applyCanvasStyle(this.lowerCanvasEl), this.contextContainer = this.lowerCanvasEl.getContext("2d") }, getWidth: function () { return this.width }, getHeight: function () { return this.height }, setWidth: function (t, e) { return this.setDimensions({ width: t }, e) }, setHeight: function (t, e) { return this.setDimensions({ height: t }, e) }, setDimensions: function (t, e) { var i, n; for (n in e = e || {}, t) i = t[n], e.cssOnly || (this._setBackstoreDimension(n, t[n]), i += "px", this.hasLostContext = !0), e.backstoreOnly || this._setCssDimension(n, i); return this._isCurrentlyDrawing && this.freeDrawingBrush && this.freeDrawingBrush._setBrushStyles(), this._initRetinaScaling(), this.calcOffset(), e.cssOnly || this.requestRenderAll(), this }, _setBackstoreDimension: function (t, e) { return this.lowerCanvasEl[t] = e, this.upperCanvasEl && (this.upperCanvasEl[t] = e), this.cacheCanvasEl && (this.cacheCanvasEl[t] = e), this[t] = e, this }, _setCssDimension: function (t, e) { return this.lowerCanvasEl.style[t] = e, this.upperCanvasEl && (this.upperCanvasEl.style[t] = e), this.wrapperEl && (this.wrapperEl.style[t] = e), this }, getZoom: function () { return this.viewportTransform[0] }, setViewportTransform: function (t) { var e, i, n, o = this._activeObject; for (this.viewportTransform = t, i = 0, n = this._objects.length; i < n; i++)(e = this._objects[i]).group || e.setCoords(!0); return o && o.setCoords(), this.calcViewportBoundaries(), this.renderOnAddRemove && this.requestRenderAll(), this }, zoomToPoint: function (t, e) { var i = t, n = this.viewportTransform.slice(0); t = r(t, a(this.viewportTransform)), n[0] = e, n[3] = e; t = r(t, n); return n[4] += i.x - t.x, n[5] += i.y - t.y, this.setViewportTransform(n) }, setZoom: function (t) { return this.zoomToPoint(new fabric.Point(0, 0), t), this }, absolutePan: function (t) { var e = this.viewportTransform.slice(0); return e[4] = -t.x, e[5] = -t.y, this.setViewportTransform(e) }, relativePan: function (t) { return this.absolutePan(new fabric.Point(-t.x - this.viewportTransform[4], -t.y - this.viewportTransform[5])) }, getElement: function () { return this.lowerCanvasEl }, _onObjectAdded: function (t) { this.stateful && t.setupState(), t._set("canvas", this), t.setCoords(), this.fire("object:added", { target: t }), t.fire("added") }, _onObjectRemoved: function (t) { this.fire("object:removed", { target: t }), t.fire("removed"), delete t.canvas }, clearContext: function (t) { return t.clearRect(0, 0, this.width, this.height), this }, getContext: function () { return this.contextContainer }, clear: function () { return this._objects.length = 0, this.backgroundImage = null, this.overlayImage = null, this.backgroundColor = "", this.overlayColor = "", this._hasITextHandlers && (this.off("mouse:up", this._mouseUpITextHandler), this._iTextInstances = null, this._hasITextHandlers = !1), this.clearContext(this.contextContainer), this.fire("canvas:cleared"), this.renderOnAddRemove && this.requestRenderAll(), this }, renderAll: function () { var t = this.contextContainer; return this.renderCanvas(t, this._objects), this }, renderAndReset: function () { this.isRendering = 0, this.renderAll() }, requestRenderAll: function () { return this.isRendering || (this.isRendering = fabric.util.requestAnimFrame(this.renderAndResetBound)), this }, calcViewportBoundaries: function () { var t = {}, e = this.width, i = this.height, n = a(this.viewportTransform); return t.tl = r({ x: 0, y: 0 }, n), t.br = r({ x: e, y: i }, n), t.tr = new fabric.Point(t.br.x, t.tl.y), t.bl = new fabric.Point(t.tl.x, t.br.y), this.vptCoords = t }, cancelRequestedRender: function () { this.isRendering && (fabric.util.cancelAnimFrame(this.isRendering), this.isRendering = 0) }, renderCanvas: function (t, e) { var i = this.viewportTransform, n = this.clipPath; this.cancelRequestedRender(), this.calcViewportBoundaries(), this.clearContext(t), fabric.util.setImageSmoothing(t, this.imageSmoothingEnabled), this.fire("before:render", { ctx: t }), this._renderBackground(t), t.save(), t.transform(i[0], i[1], i[2], i[3], i[4], i[5]), this._renderObjects(t, e), t.restore(), !this.controlsAboveOverlay && this.interactive && this.drawControls(t), n && (n.canvas = this, n.shouldCache(), n._transformDone = !0, n.renderCache({ forClipping: !0 }), this.drawClipPathOnCanvas(t)), this._renderOverlay(t), this.controlsAboveOverlay && this.interactive && this.drawControls(t), this.fire("after:render", { ctx: t }) }, drawClipPathOnCanvas: function (t) { var e = this.viewportTransform, i = this.clipPath; t.save(), t.transform(e[0], e[1], e[2], e[3], e[4], e[5]), t.globalCompositeOperation = "destination-in", i.transform(t), t.scale(1 / i.zoomX, 1 / i.zoomY), t.drawImage(i._cacheCanvas, -i.cacheTranslationX, -i.cacheTranslationY), t.restore() }, _renderObjects: function (t, e) { for (var i = 0, n = e.length; i < n; ++i)e[i] && e[i].render(t) }, _renderBackgroundOrOverlay: function (t, e) { var i = this[e + "Color"], n = this[e + "Image"], o = this.viewportTransform, e = this[e + "Vpt"]; (i || n) && (i && (t.save(), t.beginPath(), t.moveTo(0, 0), t.lineTo(this.width, 0), t.lineTo(this.width, this.height), t.lineTo(0, this.height), t.closePath(), t.fillStyle = i.toLive ? i.toLive(t, this) : i, e && t.transform(o[0], o[1], o[2], o[3], o[4], o[5]), t.transform(1, 0, 0, 1, i.offsetX || 0, i.offsetY || 0), (i = i.gradientTransform || i.patternTransform) && t.transform(i[0], i[1], i[2], i[3], i[4], i[5]), t.fill(), t.restore()), n && (t.save(), e && t.transform(o[0], o[1], o[2], o[3], o[4], o[5]), n.render(t), t.restore())) }, _renderBackground: function (t) { this._renderBackgroundOrOverlay(t, "background") }, _renderOverlay: function (t) { this._renderBackgroundOrOverlay(t, "overlay") }, getCenter: function () { return { top: this.height / 2, left: this.width / 2 } }, centerObjectH: function (t) { return this._centerObject(t, new fabric.Point(this.getCenter().left, t.getCenterPoint().y)) }, centerObjectV: function (t) { return this._centerObject(t, new fabric.Point(t.getCenterPoint().x, this.getCenter().top)) }, centerObject: function (t) { var e = this.getCenter(); return this._centerObject(t, new fabric.Point(e.left, e.top)) }, viewportCenterObject: function (t) { var e = this.getVpCenter(); return this._centerObject(t, e) }, viewportCenterObjectH: function (t) { var e = this.getVpCenter(); return this._centerObject(t, new fabric.Point(e.x, t.getCenterPoint().y)), this }, viewportCenterObjectV: function (t) { var e = this.getVpCenter(); return this._centerObject(t, new fabric.Point(t.getCenterPoint().x, e.y)) }, getVpCenter: function () { var t = this.getCenter(), e = a(this.viewportTransform); return r({ x: t.left, y: t.top }, e) }, _centerObject: function (t, e) { return t.setPositionByOrigin(e, "center", "center"), t.setCoords(), this.renderOnAddRemove && this.requestRenderAll(), this }, toDatalessJSON: function (t) { return this.toDatalessObject(t) }, toObject: function (t) { return this._toObjectMethod("toObject", t) }, toDatalessObject: function (t) { return this._toObjectMethod("toDatalessObject", t) }, _toObjectMethod: function (t, e) { var i = this.clipPath, n = { version: fabric.version, objects: this._toObjects(t, e) }; return i && (n.clipPath = this._toObject(this.clipPath, t, e)), o(n, this.__serializeBgOverlay(t, e)), fabric.util.populateWithProperties(this, n, e), n }, _toObjects: function (e, i) { return this._objects.filter(function (t) { return !t.excludeFromExport }).map(function (t) { return this._toObject(t, e, i) }, this) }, _toObject: function (t, e, i) { var n; this.includeDefaultValues || (n = t.includeDefaultValues, t.includeDefaultValues = !1); i = t[e](i); return this.includeDefaultValues || (t.includeDefaultValues = n), i }, __serializeBgOverlay: function (t, e) { var i = {}, n = this.backgroundImage, o = this.overlayImage; return this.backgroundColor && (i.background = this.backgroundColor.toObject ? this.backgroundColor.toObject(e) : this.backgroundColor), this.overlayColor && (i.overlay = this.overlayColor.toObject ? this.overlayColor.toObject(e) : this.overlayColor), n && !n.excludeFromExport && (i.backgroundImage = this._toObject(n, t, e)), o && !o.excludeFromExport && (i.overlayImage = this._toObject(o, t, e)), i }, svgViewportTransformation: !0, toSVG: function (t, e) { (t = t || {}).reviver = e; var i = []; return this._setSVGPreamble(i, t), this._setSVGHeader(i, t), this.clipPath && i.push('<g clip-path="url(#' + this.clipPath.clipPathId + ')" >\n'), this._setSVGBgOverlayColor(i, "background"), this._setSVGBgOverlayImage(i, "backgroundImage", e), this._setSVGObjects(i, e), this.clipPath && i.push("</g>\n"), this._setSVGBgOverlayColor(i, "overlay"), this._setSVGBgOverlayImage(i, "overlayImage", e), i.push("</svg>"), i.join("") }, _setSVGPreamble: function (t, e) { e.suppressPreamble || t.push('<?xml version="1.0" encoding="', e.encoding || "UTF-8", '" standalone="no" ?>\n', '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ', '"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n') }, _setSVGHeader: function (t, e) { var i, n = e.width || this.width, o = e.height || this.height, r = 'viewBox="0 0 ' + this.width + " " + this.height + '" ', a = fabric.Object.NUM_FRACTION_DIGITS; e.viewBox ? r = 'viewBox="' + e.viewBox.x + " " + e.viewBox.y + " " + e.viewBox.width + " " + e.viewBox.height + '" ' : this.svgViewportTransformation && (i = this.viewportTransform, r = 'viewBox="' + s(-i[4] / i[0], a) + " " + s(-i[5] / i[3], a) + " " + s(this.width / i[0], a) + " " + s(this.height / i[3], a) + '" '), t.push("<svg ", 'xmlns="http://www.w3.org/2000/svg" ', 'xmlns:xlink="http://www.w3.org/1999/xlink" ', 'version="1.1" ', 'width="', n, '" ', 'height="', o, '" ', r, 'xml:space="preserve">\n', "<desc>Created with Fabric.js ", fabric.version, "</desc>\n", "<defs>\n", this.createSVGFontFacesMarkup(), this.createSVGRefElementsMarkup(), this.createSVGClipPathMarkup(e), "</defs>\n") }, createSVGClipPathMarkup: function (t) { var e = this.clipPath; return e ? (e.clipPathId = "CLIPPATH_" + fabric.Object.__uid++ , '<clipPath id="' + e.clipPathId + '" >\n' + this.clipPath.toClipPathSVG(t.reviver) + "</clipPath>\n") : "" }, createSVGRefElementsMarkup: function () { var o = this; return ["background", "overlay"].map(function (t) { var e = o[t + "Color"]; if (e && e.toLive) { var i = o[t + "Vpt"], n = o.viewportTransform, t = { width: o.width / (i ? n[0] : 1), height: o.height / (i ? n[3] : 1) }; return e.toSVG(t, { additionalTransform: i ? fabric.util.matrixToSVG(n) : "" }) } }).join("") }, createSVGFontFacesMarkup: function () { var t, e, i, n, o, r, a, s, l, c = "", d = {}, h = fabric.fontPaths, u = []; for (this._objects.forEach(function t(e) { u.push(e), e._objects && e._objects.forEach(t) }), a = 0, s = u.length; a < s; a++)if (t = u[a], e = t.fontFamily, -1 !== t.type.indexOf("text") && !d[e] && h[e] && (d[e] = !0, t.styles)) for (o in i = t.styles) for (r in n = i[o]) !d[e = n[r].fontFamily] && h[e] && (d[e] = !0); for (l in d) c += ["\t\t@font-face {\n", "\t\t\tfont-family: '", l, "';\n", "\t\t\tsrc: url('", h[l], "');\n", "\t\t}\n"].join(""); return c = c && ['\t<style type="text/css">', "<![CDATA[\n", c, "]]>", "</style>\n"].join("") }, _setSVGObjects: function (t, e) { for (var i, n = this._objects, o = 0, r = n.length; o < r; o++)(i = n[o]).excludeFromExport || this._setSVGObject(t, i, e) }, _setSVGObject: function (t, e, i) { t.push(e.toSVG(i)) }, _setSVGBgOverlayImage: function (t, e, i) { this[e] && !this[e].excludeFromExport && this[e].toSVG && t.push(this[e].toSVG(i)) }, _setSVGBgOverlayColor: function (t, e) { var i, n = this[e + "Color"], o = this.viewportTransform, r = this.width, a = this.height; n && (n.toLive ? (i = n.repeat, o = fabric.util.invertTransform(o), o = this[e + "Vpt"] ? fabric.util.matrixToSVG(o) : "", t.push('<rect transform="' + o + " translate(", r / 2, ",", a / 2, ')"', ' x="', n.offsetX - r / 2, '" y="', n.offsetY - a / 2, '" ', 'width="', "repeat-y" === i || "no-repeat" === i ? n.source.width : r, '" height="', "repeat-x" === i || "no-repeat" === i ? n.source.height : a, '" fill="url(#SVGID_' + n.id + ')"', "></rect>\n")) : t.push('<rect x="0" y="0" width="100%" height="100%" ', 'fill="', n, '"', "></rect>\n")) }, sendToBack: function (t) { if (!t) return this; var e, i, n, o = this._activeObject; if (t === o && "activeSelection" === t.type) for (e = (n = o._objects).length; e--;)i = n[e], c(this._objects, i), this._objects.unshift(i); else c(this._objects, t), this._objects.unshift(t); return this.renderOnAddRemove && this.requestRenderAll(), this }, bringToFront: function (t) { if (!t) return this; var e, i, n, o = this._activeObject; if (t === o && "activeSelection" === t.type) for (n = o._objects, e = 0; e < n.length; e++)i = n[e], c(this._objects, i), this._objects.push(i); else c(this._objects, t), this._objects.push(t); return this.renderOnAddRemove && this.requestRenderAll(), this }, sendBackwards: function (t, e) { if (!t) return this; var i, n, o, r, a, s = this._activeObject, l = 0; if (t === s && "activeSelection" === t.type) for (a = s._objects, i = 0; i < a.length; i++)n = a[i], 0 + l < (o = this._objects.indexOf(n)) && (r = o - 1, c(this._objects, n), this._objects.splice(r, 0, n)), l++; else 0 !== (o = this._objects.indexOf(t)) && (r = this._findNewLowerIndex(t, o, e), c(this._objects, t), this._objects.splice(r, 0, t)); return this.renderOnAddRemove && this.requestRenderAll(), this }, _findNewLowerIndex: function (t, e, i) { var n, o; if (i) { for (o = (n = e) - 1; 0 <= o; --o)if (t.intersectsWithObject(this._objects[o]) || t.isContainedWithinObject(this._objects[o]) || this._objects[o].isContainedWithinObject(t)) { n = o; break } } else n = e - 1; return n }, bringForward: function (t, e) { if (!t) return this; var i, n, o, r, a, s = this._activeObject, l = 0; if (t === s && "activeSelection" === t.type) for (i = (a = s._objects).length; i--;)n = a[i], (o = this._objects.indexOf(n)) < this._objects.length - 1 - l && (r = o + 1, c(this._objects, n), this._objects.splice(r, 0, n)), l++; else (o = this._objects.indexOf(t)) !== this._objects.length - 1 && (r = this._findNewUpperIndex(t, o, e), c(this._objects, t), this._objects.splice(r, 0, t)); return this.renderOnAddRemove && this.requestRenderAll(), this }, _findNewUpperIndex: function (t, e, i) { var n, o, r; if (i) { for (o = (n = e) + 1, r = this._objects.length; o < r; ++o)if (t.intersectsWithObject(this._objects[o]) || t.isContainedWithinObject(this._objects[o]) || this._objects[o].isContainedWithinObject(t)) { n = o; break } } else n = e + 1; return n }, moveTo: function (t, e) { return c(this._objects, t), this._objects.splice(e, 0, t), this.renderOnAddRemove && this.requestRenderAll() }, dispose: function () { return this.isRendering && (fabric.util.cancelAnimFrame(this.isRendering), this.isRendering = 0), this.forEachObject(function (t) { t.dispose && t.dispose() }), this._objects = [], this.backgroundImage && this.backgroundImage.dispose && this.backgroundImage.dispose(), this.backgroundImage = null, this.overlayImage && this.overlayImage.dispose && this.overlayImage.dispose(), this.overlayImage = null, this._iTextInstances = null, this.contextContainer = null, fabric.util.cleanUpJsdomNode(this.lowerCanvasEl), this.lowerCanvasEl = void 0, this }, toString: function () { return "#<fabric.Canvas (" + this.complexity() + "): { objects: " + this._objects.length + " }>" } }), o(fabric.StaticCanvas.prototype, fabric.Observable), o(fabric.StaticCanvas.prototype, fabric.Collection), o(fabric.StaticCanvas.prototype, fabric.DataURLExporter), o(fabric.StaticCanvas, { EMPTY_JSON: '{"objects": [], "background": "white"}', supports: function (t) { var e = n(); if (!e || !e.getContext) return null; e = e.getContext("2d"); return !e || "setLineDash" !== t ? null : void 0 !== e.setLineDash } }), fabric.StaticCanvas.prototype.toJSON = fabric.StaticCanvas.prototype.toObject, fabric.isLikelyNode && (fabric.StaticCanvas.prototype.createPNGStream = function () { var t = i(this.lowerCanvasEl); return t && t.createPNGStream() }, fabric.StaticCanvas.prototype.createJPEGStream = function (t) { var e = i(this.lowerCanvasEl); return e && e.createJPEGStream(t) })) }(), fabric.BaseBrush = fabric.util.createClass({ color: "rgb(0, 0, 0)", width: 1, shadow: null, strokeLineCap: "round", strokeLineJoin: "round", strokeMiterLimit: 10, strokeDashArray: null, _setBrushStyles: function () { var t = this.canvas.contextTop; t.strokeStyle = this.color, t.lineWidth = this.width, t.lineCap = this.strokeLineCap, t.miterLimit = this.strokeMiterLimit, t.lineJoin = this.strokeLineJoin, fabric.StaticCanvas.supports("setLineDash") && t.setLineDash(this.strokeDashArray || []) }, _saveAndTransform: function (t) { var e = this.canvas.viewportTransform; t.save(), t.transform(e[0], e[1], e[2], e[3], e[4], e[5]) }, _setShadow: function () { var t, e, i, n; this.shadow && (t = this.canvas, e = this.shadow, i = t.contextTop, n = t.getZoom(), t && t._isRetinaScaling() && (n *= fabric.devicePixelRatio), i.shadowColor = e.color, i.shadowBlur = e.blur * n, i.shadowOffsetX = e.offsetX * n, i.shadowOffsetY = e.offsetY * n) }, needsFullRender: function () { return new fabric.Color(this.color).getAlpha() < 1 || !!this.shadow }, _resetShadow: function () { var t = this.canvas.contextTop; t.shadowColor = "", t.shadowBlur = t.shadowOffsetX = t.shadowOffsetY = 0 } }), fabric.PencilBrush = fabric.util.createClass(fabric.BaseBrush, { decimate: .4, initialize: function (t) { this.canvas = t, this._points = [] }, _drawSegment: function (t, e, i) { i = e.midPointFrom(i); return t.quadraticCurveTo(e.x, e.y, i.x, i.y), i }, onMouseDown: function (t, e) { this.canvas._isMainEvent(e.e) && (this._prepareForDrawing(t), this._captureDrawingPath(t), this._render()) }, onMouseMove: function (t, e) { var i; this.canvas._isMainEvent(e.e) && this._captureDrawingPath(t) && 1 < this._points.length && (this.needsFullRender() ? (this.canvas.clearContext(this.canvas.contextTop), this._render()) : (e = (i = this._points).length, t = this.canvas.contextTop, this._saveAndTransform(t), this.oldEnd && (t.beginPath(), t.moveTo(this.oldEnd.x, this.oldEnd.y)), this.oldEnd = this._drawSegment(t, i[e - 2], i[e - 1], !0), t.stroke(), t.restore())) }, onMouseUp: function (t) { return !this.canvas._isMainEvent(t.e) || (this.oldEnd = void 0, this._finalizeAndAddPath(), !1) }, _prepareForDrawing: function (t) { t = new fabric.Point(t.x, t.y); this._reset(), this._addPoint(t), this.canvas.contextTop.moveTo(t.x, t.y) }, _addPoint: function (t) { return !(1 < this._points.length && t.eq(this._points[this._points.length - 1])) && (this._points.push(t), !0) }, _reset: function () { this._points = [], this._setBrushStyles(), this._setShadow() }, _captureDrawingPath: function (t) { t = new fabric.Point(t.x, t.y); return this._addPoint(t) }, _render: function () { var t, e, i, n = this.canvas.contextTop, o = this._points[0], r = this._points[1]; for (this._saveAndTransform(n), n.beginPath(), 2 === this._points.length && o.x === r.x && o.y === r.y && (i = this.width / 1e3, o = new fabric.Point(o.x, o.y), r = new fabric.Point(r.x, r.y), o.x -= i, r.x += i), n.moveTo(o.x, o.y), t = 1, e = this._points.length; t < e; t++)this._drawSegment(n, o, r), o = this._points[t], r = this._points[t + 1]; n.lineTo(o.x, o.y), n.stroke(), n.restore() }, convertPointsToSVGPath: function (t) { var e, i, n = [], o = this.width / 1e3, r = new fabric.Point(t[0].x, t[0].y), a = new fabric.Point(t[1].x, t[1].y), s = t.length, l = 1, c = 0, d = 2 < s; for (d && (l = t[2].x < a.x ? -1 : t[2].x === a.x ? 0 : 1, c = t[2].y < a.y ? -1 : t[2].y === a.y ? 0 : 1), n.push("M ", r.x - l * o, " ", r.y - c * o, " "), e = 1; e < s; e++)r.eq(a) || (i = r.midPointFrom(a), n.push("Q ", r.x, " ", r.y, " ", i.x, " ", i.y, " ")), r = t[e], e + 1 < t.length && (a = t[e + 1]); return d && (l = r.x > t[e - 2].x ? 1 : r.x === t[e - 2].x ? 0 : -1, c = r.y > t[e - 2].y ? 1 : r.y === t[e - 2].y ? 0 : -1), n.push("L ", r.x + l * o, " ", r.y + c * o), n }, createPath: function (t) { t = new fabric.Path(t, { fill: null, stroke: this.color, strokeWidth: this.width, strokeLineCap: this.strokeLineCap, strokeMiterLimit: this.strokeMiterLimit, strokeLineJoin: this.strokeLineJoin, strokeDashArray: this.strokeDashArray }); return this.shadow && (this.shadow.affectStroke = !0, t.shadow = new fabric.Shadow(this.shadow)), t }, decimatePoints: function (t, e) { if (t.length <= 2) return t; for (var i = this.canvas.getZoom(), n = Math.pow(e / i, 2), o = t.length - 1, r = t[0], a = [r], s = 1; s < o; s++)n <= Math.pow(r.x - t[s].x, 2) + Math.pow(r.y - t[s].y, 2) && (r = t[s], a.push(r)); return 1 === a.length && a.push(new fabric.Point(a[0].x, a[0].y)), a }, _finalizeAndAddPath: function () { this.canvas.contextTop.closePath(), this.decimate && (this._points = this.decimatePoints(this._points, this.decimate)); var t = this.convertPointsToSVGPath(this._points).join(""); "M 0 0 Q 0 0 0 0 L 0 0" !== t ? (t = this.createPath(t), this.canvas.clearContext(this.canvas.contextTop), this.canvas.fire("before:path:created", { path: t }), this.canvas.add(t), this.canvas.requestRenderAll(), t.setCoords(), this._resetShadow(), this.canvas.fire("path:created", { path: t })) : this.canvas.requestRenderAll() } }), fabric.CircleBrush = fabric.util.createClass(fabric.BaseBrush, { width: 10, initialize: function (t) { this.canvas = t, this.points = [] }, drawDot: function (t) { var e = this.addPoint(t), t = this.canvas.contextTop; this._saveAndTransform(t), this.dot(t, e), t.restore() }, dot: function (t, e) { t.fillStyle = e.fill, t.beginPath(), t.arc(e.x, e.y, e.radius, 0, 2 * Math.PI, !1), t.closePath(), t.fill() }, onMouseDown: function (t) { this.points.length = 0, this.canvas.clearContext(this.canvas.contextTop), this._setShadow(), this.drawDot(t) }, _render: function () { var t, e, i = this.canvas.contextTop, n = this.points; for (this._saveAndTransform(i), t = 0, e = n.length; t < e; t++)this.dot(i, n[t]); i.restore() }, onMouseMove: function (t) { this.needsFullRender() ? (this.canvas.clearContext(this.canvas.contextTop), this.addPoint(t), this._render()) : this.drawDot(t) }, onMouseUp: function () { var t = this.canvas.renderOnAddRemove; this.canvas.renderOnAddRemove = !1; for (var e = [], i = 0, n = this.points.length; i < n; i++){ var o = this.points[i], o = new fabric.Circle({ radius: o.radius, left: o.x, top: o.y, originX: "center", originY: "center", fill: o.fill }); this.shadow && (o.shadow = new fabric.Shadow(this.shadow)), e.push(o) } var r = new fabric.Group(e); r.canvas = this.canvas, this.canvas.fire("before:path:created", { path: r }), this.canvas.add(r), this.canvas.fire("path:created", { path: r }), this.canvas.clearContext(this.canvas.contextTop), this._resetShadow(), this.canvas.renderOnAddRemove = t, this.canvas.requestRenderAll() }, addPoint: function (t) { var e = new fabric.Point(t.x, t.y), i = fabric.util.getRandomInt(Math.max(0, this.width - 20), this.width + 20) / 2, t = new fabric.Color(this.color).setAlpha(fabric.util.getRandomInt(0, 100) / 100).toRgba(); return e.radius = i, e.fill = t, this.points.push(e), e } }), fabric.SprayBrush = fabric.util.createClass(fabric.BaseBrush, { width: 10, density: 20, dotWidth: 1, dotWidthVariance: 1, randomOpacity: !1, optimizeOverlapping: !0, initialize: function (t) { this.canvas = t, this.sprayChunks = [] }, onMouseDown: function (t) { this.sprayChunks.length = 0, this.canvas.clearContext(this.canvas.contextTop), this._setShadow(), this.addSprayChunk(t), this.render(this.sprayChunkPoints) }, onMouseMove: function (t) { this.addSprayChunk(t), this.render(this.sprayChunkPoints) }, onMouseUp: function () { var t = this.canvas.renderOnAddRemove; this.canvas.renderOnAddRemove = !1; for (var e = [], i = 0, n = this.sprayChunks.length; i < n; i++)for (var o = this.sprayChunks[i], r = 0, a = o.length; r < a; r++){ var s = new fabric.Rect({ width: o[r].width, height: o[r].width, left: o[r].x + 1, top: o[r].y + 1, originX: "center", originY: "center", fill: this.color }); e.push(s) } this.optimizeOverlapping && (e = this._getOptimizedRects(e)); var l = new fabric.Group(e); this.shadow && l.set("shadow", new fabric.Shadow(this.shadow)), this.canvas.fire("before:path:created", { path: l }), this.canvas.add(l), this.canvas.fire("path:created", { path: l }), this.canvas.clearContext(this.canvas.contextTop), this._resetShadow(), this.canvas.renderOnAddRemove = t, this.canvas.requestRenderAll() }, _getOptimizedRects: function (t) { for (var e, i = {}, n = 0, o = t.length; n < o; n++)i[e = t[n].left + "" + t[n].top] || (i[e] = t[n]); var r = []; for (e in i) r.push(i[e]); return r }, render: function (t) { var e, i, n = this.canvas.contextTop; for (n.fillStyle = this.color, this._saveAndTransform(n), e = 0, i = t.length; e < i; e++){ var o = t[e]; void 0 !== o.opacity && (n.globalAlpha = o.opacity), n.fillRect(o.x, o.y, o.width, o.width) } n.restore() }, _render: function () { var t, e, i = this.canvas.contextTop; for (i.fillStyle = this.color, this._saveAndTransform(i), t = 0, e = this.sprayChunks.length; t < e; t++)this.render(this.sprayChunks[t]); i.restore() }, addSprayChunk: function (t) { this.sprayChunkPoints = []; for (var e, i, n = this.width / 2, o = 0; o < this.density; o++){ e = fabric.util.getRandomInt(t.x - n, t.x + n), r = fabric.util.getRandomInt(t.y - n, t.y + n), i = this.dotWidthVariance ? fabric.util.getRandomInt(Math.max(1, this.dotWidth - this.dotWidthVariance), this.dotWidth + this.dotWidthVariance) : this.dotWidth; var r = new fabric.Point(e, r); r.width = i, this.randomOpacity && (r.opacity = fabric.util.getRandomInt(0, 100) / 100), this.sprayChunkPoints.push(r) } this.sprayChunks.push(this.sprayChunkPoints) } }), fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, { getPatternSrc: function () { var t = fabric.util.createCanvasElement(), e = t.getContext("2d"); return t.width = t.height = 25, e.fillStyle = this.color, e.beginPath(), e.arc(10, 10, 10, 0, 2 * Math.PI, !1), e.closePath(), e.fill(), t }, getPatternSrcFunction: function () { return String(this.getPatternSrc).replace("this.color", '"' + this.color + '"') }, getPattern: function () { return this.canvas.contextTop.createPattern(this.source || this.getPatternSrc(), "repeat") }, _setBrushStyles: function () { this.callSuper("_setBrushStyles"), this.canvas.contextTop.strokeStyle = this.getPattern() }, createPath: function (t) { var e = this.callSuper("createPath", t), t = e._getLeftTopCoords().scalarAdd(e.strokeWidth / 2); return e.stroke = new fabric.Pattern({ source: this.source || this.getPatternSrcFunction(), offsetX: -t.x, offsetY: -t.y }), e } }), function () { var t, a = fabric.util.getPointer, l = fabric.util.degreesToRadians, c = Math.abs, d = fabric.StaticCanvas.supports("setLineDash"), h = fabric.util.isTouchEvent; for (t in fabric.Canvas = fabric.util.createClass(fabric.StaticCanvas, { initialize: function (t, e) { e = e || {}, this.renderAndResetBound = this.renderAndReset.bind(this), this.requestRenderAllBound = this.requestRenderAll.bind(this), this._initStatic(t, e), this._initInteractive(), this._createCacheCanvas() }, uniformScaling: !0, uniScaleKey: "shiftKey", centeredScaling: !1, centeredRotation: !1, centeredKey: "altKey", altActionKey: "shiftKey", interactive: !0, selection: !0, selectionKey: "shiftKey", altSelectionKey: null, selectionColor: "rgba(100, 100, 255, 0.3)", selectionDashArray: [], selectionBorderColor: "rgba(255, 255, 255, 0.3)", selectionLineWidth: 1, selectionFullyContained: !1, hoverCursor: "move", moveCursor: "move", defaultCursor: "default", freeDrawingCursor: "crosshair", rotationCursor: "crosshair", notAllowedCursor: "not-allowed", containerClass: "canvas-container", perPixelTargetFind: !1, targetFindTolerance: 0, skipTargetFind: !1, isDrawingMode: !1, preserveObjectStacking: !1, snapAngle: 0, snapThreshold: null, stopContextMenu: !1, fireRightClick: !1, fireMiddleClick: !1, targets: [], _hoveredTarget: null, _hoveredTargets: [], _initInteractive: function () { this._currentTransform = null, this._groupSelector = null, this._initWrapperElement(), this._createUpperCanvas(), this._initEventListeners(), this._initRetinaScaling(), this.freeDrawingBrush = fabric.PencilBrush && new fabric.PencilBrush(this), this.calcOffset() }, _chooseObjectsToRender: function () { var t, e, i, n = this.getActiveObjects(); if (0 < n.length && !this.preserveObjectStacking) { e = [], i = []; for (var o = 0, r = this._objects.length; o < r; o++)t = this._objects[o], (-1 === n.indexOf(t) ? e : i).push(t); 1 < n.length && (this._activeObject._objects = i), e.push.apply(e, i) } else e = this._objects; return e }, renderAll: function () { !this.contextTopDirty || this._groupSelector || this.isDrawingMode || (this.clearContext(this.contextTop), this.contextTopDirty = !1), this.hasLostContext && this.renderTopLayer(this.contextTop); var t = this.contextContainer; return this.renderCanvas(t, this._chooseObjectsToRender()), this }, renderTopLayer: function (t) { t.save(), this.isDrawingMode && this._isCurrentlyDrawing && (this.freeDrawingBrush && this.freeDrawingBrush._render(), this.contextTopDirty = !0), this.selection && this._groupSelector && (this._drawSelection(t), this.contextTopDirty = !0), t.restore() }, renderTop: function () { var t = this.contextTop; return this.clearContext(t), this.renderTopLayer(t), this.fire("after:render"), this }, _normalizePointer: function (t, e) { t = t.calcTransformMatrix(), t = fabric.util.invertTransform(t), e = this.restorePointerVpt(e); return fabric.util.transformPoint(e, t) }, isTargetTransparent: function (t, e, i) { if (t.shouldCache() && t._cacheCanvas && t !== this._activeObject) { var n = this._normalizePointer(t, { x: e, y: i }), o = Math.max(t.cacheTranslationX + n.x * t.zoomX, 0), r = Math.max(t.cacheTranslationY + n.y * t.zoomY, 0); return fabric.util.isTransparent(t._cacheContext, Math.round(o), Math.round(r), this.targetFindTolerance) } n = this.contextCache, o = t.selectionBackgroundColor, r = this.viewportTransform; return t.selectionBackgroundColor = "", this.clearContext(n), n.save(), n.transform(r[0], r[1], r[2], r[3], r[4], r[5]), t.render(n), n.restore(), t === this._activeObject && t._renderControls(n, { hasBorders: !1, transparentCorners: !1 }, { hasBorders: !1 }), t.selectionBackgroundColor = o, fabric.util.isTransparent(n, e, i, this.targetFindTolerance) }, _isSelectionKeyPressed: function (e) { return "[object Array]" === Object.prototype.toString.call(this.selectionKey) ? !!this.selectionKey.find(function (t) { return !0 === e[t] }) : e[this.selectionKey] }, _shouldClearSelection: function (t, e) { var i = this.getActiveObjects(), n = this._activeObject; return !e || e && n && 1 < i.length && -1 === i.indexOf(e) && n !== e && !this._isSelectionKeyPressed(t) || e && !e.evented || e && !e.selectable && n && n !== e }, _shouldCenterTransform: function (t, e, i) { var n; if (t) return "scale" === e || "scaleX" === e || "scaleY" === e || "resizing" === e ? n = this.centeredScaling || t.centeredScaling : "rotate" === e && (n = this.centeredRotation || t.centeredRotation), n ? !i : i }, _getOriginFromCorner: function (t, e) { t = { x: t.originX, y: t.originY }; return "ml" === e || "tl" === e || "bl" === e ? t.x = "right" : "mr" !== e && "tr" !== e && "br" !== e || (t.x = "left"), "tl" === e || "mt" === e || "tr" === e ? t.y = "bottom" : "bl" !== e && "mb" !== e && "br" !== e || (t.y = "top"), t }, _getActionFromCorner: function (t, e, i, n) { if (!e || !t) return "drag"; e = n.controls[e]; return e.getActionName(i, e, n) }, _setupCurrentTransform: function (t, e, i) { var n, o, r, a, s; e && (s = this.getPointer(t), n = e.__corner, a = e.controls[n], o = i && n ? a.getActionHandler(t, e, a) : fabric.controlsUtils.dragHandler, r = this._getActionFromCorner(i, n, t, e), a = this._getOriginFromCorner(e, n), i = t[this.centeredKey], s = { target: e, action: r, actionHandler: o, corner: n, scaleX: e.scaleX, scaleY: e.scaleY, skewX: e.skewX, skewY: e.skewY, offsetX: s.x - e.left, offsetY: s.y - e.top, originX: a.x, originY: a.y, ex: s.x, ey: s.y, lastX: s.x, lastY: s.y, theta: l(e.angle), width: e.width * e.scaleX, shiftKey: t.shiftKey, altKey: i, original: fabric.util.saveObjectTransform(e) }, this._shouldCenterTransform(e, r, i) && (s.originX = "center", s.originY = "center"), s.original.originX = a.x, s.original.originY = a.y, this._currentTransform = s, this._beforeTransform(t)) }, setCursor: function (t) { this.upperCanvasEl.style.cursor = t }, _drawSelection: function (t) { var e, i, n = this._groupSelector, o = n.left, r = n.top, a = c(o), s = c(r); this.selectionColor && (t.fillStyle = this.selectionColor, t.fillRect(n.ex - (0 < o ? 0 : -o), n.ey - (0 < r ? 0 : -r), a, s)), this.selectionLineWidth && this.selectionBorderColor && (t.lineWidth = this.selectionLineWidth, t.strokeStyle = this.selectionBorderColor, 1 < this.selectionDashArray.length && !d ? (e = n.ex + .5 - (0 < o ? 0 : a), i = n.ey + .5 - (0 < r ? 0 : s), t.beginPath(), fabric.util.drawDashedLine(t, e, i, e + a, i, this.selectionDashArray), fabric.util.drawDashedLine(t, e, i + s - 1, e + a, i + s - 1, this.selectionDashArray), fabric.util.drawDashedLine(t, e, i, e, i + s, this.selectionDashArray), fabric.util.drawDashedLine(t, e + a - 1, i, e + a - 1, i + s, this.selectionDashArray), t.closePath(), t.stroke()) : (fabric.Object.prototype._setLineDash.call(this, t, this.selectionDashArray), t.strokeRect(n.ex + .5 - (0 < o ? 0 : a), n.ey + .5 - (0 < r ? 0 : s), a, s))) }, findTarget: function (t, e) { if (!this.skipTargetFind) { var i, n, o = this.getPointer(t, !0), r = this._activeObject, a = this.getActiveObjects(), s = h(t); if (this.targets = [], 1 < a.length && !e && r === this._searchPossibleTargets([r], o)) return r; if (1 === a.length && r._findTargetCorner(o, s)) return r; if (1 === a.length && r === this._searchPossibleTargets([r], o)) { if (!this.preserveObjectStacking) return r; i = r, n = this.targets, this.targets = [] } o = this._searchPossibleTargets(this._objects, o); return t[this.altSelectionKey] && o && i && o !== i && (o = i, this.targets = n), o } }, _checkTarget: function (t, e, i) { if (e && e.visible && e.evented && (e.containsPoint(t) || e._findTargetCorner(t))) return !((this.perPixelTargetFind || e.perPixelTargetFind) && !e.isEditing) || (!this.isTargetTransparent(e, i.x, i.y) || void 0) }, _searchPossibleTargets: function (t, e) { for (var i, n, o = t.length; o--;){ var r = t[o], a = r.group ? this._normalizePointer(r.group, e) : e; if (this._checkTarget(a, r, e)) { (i = t[o]).subTargetCheck && i instanceof fabric.Group && (n = this._searchPossibleTargets(i._objects, e)) && this.targets.push(n); break } } return i }, restorePointerVpt: function (t) { return fabric.util.transformPoint(t, fabric.util.invertTransform(this.viewportTransform)) }, getPointer: function (t, e) { if (this._absolutePointer && !e) return this._absolutePointer; if (this._pointer && e) return this._pointer; var i = a(t), n = this.upperCanvasEl, o = n.getBoundingClientRect(), r = o.width || 0, t = o.height || 0; r && t || ("top" in o && "bottom" in o && (t = Math.abs(o.top - o.bottom)), "right" in o && "left" in o && (r = Math.abs(o.right - o.left))), this.calcOffset(), i.x = i.x - this._offset.left, i.y = i.y - this._offset.top, e || (i = this.restorePointerVpt(i)); e = this.getRetinaScaling(); return 1 !== e && (i.x /= e, i.y /= e), t = 0 === r || 0 === t ? { width: 1, height: 1 } : { width: n.width / r, height: n.height / t }, { x: i.x * t.width, y: i.y * t.height } }, _createUpperCanvas: function () { var t = this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/, ""), e = this.lowerCanvasEl, i = this.upperCanvasEl; i ? i.className = "" : (i = this._createCanvasElement(), this.upperCanvasEl = i), fabric.util.addClass(i, "upper-canvas " + t), this.wrapperEl.appendChild(i), this._copyCanvasStyle(e, i), this._applyCanvasStyle(i), this.contextTop = i.getContext("2d") }, _createCacheCanvas: function () { this.cacheCanvasEl = this._createCanvasElement(), this.cacheCanvasEl.setAttribute("width", this.width), this.cacheCanvasEl.setAttribute("height", this.height), this.contextCache = this.cacheCanvasEl.getContext("2d") }, _initWrapperElement: function () { this.wrapperEl = fabric.util.wrapElement(this.lowerCanvasEl, "div", { class: this.containerClass }), fabric.util.setStyle(this.wrapperEl, { width: this.width + "px", height: this.height + "px", position: "relative" }), fabric.util.makeElementUnselectable(this.wrapperEl) }, _applyCanvasStyle: function (t) { var e = this.width || t.width, i = this.height || t.height; fabric.util.setStyle(t, { position: "absolute", width: e + "px", height: i + "px", left: 0, top: 0, "touch-action": this.allowTouchScrolling ? "manipulation" : "none", "-ms-touch-action": this.allowTouchScrolling ? "manipulation" : "none" }), t.width = e, t.height = i, fabric.util.makeElementUnselectable(t) }, _copyCanvasStyle: function (t, e) { e.style.cssText = t.style.cssText }, getSelectionContext: function () { return this.contextTop }, getSelectionElement: function () { return this.upperCanvasEl }, getActiveObject: function () { return this._activeObject }, getActiveObjects: function () { var t = this._activeObject; return t ? "activeSelection" === t.type && t._objects ? t._objects.slice(0) : [t] : [] }, _onObjectRemoved: function (t) { t === this._activeObject && (this.fire("before:selection:cleared", { target: t }), this._discardActiveObject(), this.fire("selection:cleared", { target: t }), t.fire("deselected")), t === this._hoveredTarget && (this._hoveredTarget = null, this._hoveredTargets = []), this.callSuper("_onObjectRemoved", t) }, _fireSelectionEvents: function (e, t) { var i = !1, n = this.getActiveObjects(), o = [], r = [], a = { e: t }; e.forEach(function (t) { -1 === n.indexOf(t) && (i = !0, t.fire("deselected", a), r.push(t)) }), n.forEach(function (t) { -1 === e.indexOf(t) && (i = !0, t.fire("selected", a), o.push(t)) }), 0 < e.length && 0 < n.length ? (a.selected = o, a.deselected = r, a.updated = o[0] || r[0], a.target = this._activeObject, i && this.fire("selection:updated", a)) : 0 < n.length ? (a.selected = o, a.target = this._activeObject, this.fire("selection:created", a)) : 0 < e.length && (a.deselected = r, this.fire("selection:cleared", a)) }, setActiveObject: function (t, e) { var i = this.getActiveObjects(); return this._setActiveObject(t, e), this._fireSelectionEvents(i, e), this }, _setActiveObject: function (t, e) { return this._activeObject !== t && (!!this._discardActiveObject(e, t) && (!t.onSelect({ e: e }) && (this._activeObject = t, !0))) }, _discardActiveObject: function (t, e) { var i = this._activeObject; if (i) { if (i.onDeselect({ e: t, object: e })) return !1; this._activeObject = null } return !0 }, discardActiveObject: function (t) { var e = this.getActiveObjects(), i = this.getActiveObject(); return e.length && this.fire("before:selection:cleared", { target: i, e: t }), this._discardActiveObject(t), this._fireSelectionEvents(e, t), this }, dispose: function () { var t = this.wrapperEl; return this.removeListeners(), t.removeChild(this.upperCanvasEl), t.removeChild(this.lowerCanvasEl), this.contextCache = null, this.contextTop = null, ["upperCanvasEl", "cacheCanvasEl"].forEach(function (t) { fabric.util.cleanUpJsdomNode(this[t]), this[t] = void 0 }.bind(this)), t.parentNode && t.parentNode.replaceChild(this.lowerCanvasEl, this.wrapperEl), delete this.wrapperEl, fabric.StaticCanvas.prototype.dispose.call(this), this }, clear: function () { return this.discardActiveObject(), this.clearContext(this.contextTop), this.callSuper("clear") }, drawControls: function (t) { var e = this._activeObject; e && e._renderControls(t) }, _toObject: function (t, e, i) { var n = this._realizeGroupTransformOnObject(t), i = this.callSuper("_toObject", t, e, i); return this._unwindGroupTransformOnObject(t, n), i }, _realizeGroupTransformOnObject: function (e) { if (e.group && "activeSelection" === e.group.type && this._activeObject === e.group) { var i = {}; return ["angle", "flipX", "flipY", "left", "scaleX", "scaleY", "skewX", "skewY", "top"].forEach(function (t) { i[t] = e[t] }), this._activeObject.realizeTransform(e), i } return null }, _unwindGroupTransformOnObject: function (t, e) { e && t.set(e) }, _setSVGObject: function (t, e, i) { var n = this._realizeGroupTransformOnObject(e); this.callSuper("_setSVGObject", t, e, i), this._unwindGroupTransformOnObject(e, n) }, setViewportTransform: function (t) { this.renderOnAddRemove && this._activeObject && this._activeObject.isEditing && this._activeObject.clearContextTop(), fabric.StaticCanvas.prototype.setViewportTransform.call(this, t) } }), fabric.StaticCanvas) "prototype" !== t && (fabric.Canvas[t] = fabric.StaticCanvas[t]) }(), function () { var n = fabric.util.addListener, o = fabric.util.removeListener, r = { passive: !1 }; function s(t, e) { return t.button && t.button === e - 1 } fabric.util.object.extend(fabric.Canvas.prototype, { mainTouchId: null, _initEventListeners: function () { this.removeListeners(), this._bindEvents(), this.addOrRemove(n, "add") }, _getEventPrefix: function () { return this.enablePointerEvents ? "pointer" : "mouse" }, addOrRemove: function (t, e) { var i = this.upperCanvasEl, n = this._getEventPrefix(); t(fabric.window, "resize", this._onResize), t(i, n + "down", this._onMouseDown), t(i, n + "move", this._onMouseMove, r), t(i, n + "out", this._onMouseOut), t(i, n + "enter", this._onMouseEnter), t(i, "wheel", this._onMouseWheel), t(i, "contextmenu", this._onContextMenu), t(i, "dblclick", this._onDoubleClick), t(i, "dragover", this._onDragOver), t(i, "dragenter", this._onDragEnter), t(i, "dragleave", this._onDragLeave), t(i, "drop", this._onDrop), this.enablePointerEvents || t(i, "touchstart", this._onTouchStart, r), "undefined" != typeof eventjs && e in eventjs && (eventjs[e](i, "gesture", this._onGesture), eventjs[e](i, "drag", this._onDrag), eventjs[e](i, "orientation", this._onOrientationChange), eventjs[e](i, "shake", this._onShake), eventjs[e](i, "longpress", this._onLongPress)) }, removeListeners: function () { this.addOrRemove(o, "remove"); var t = this._getEventPrefix(); o(fabric.document, t + "up", this._onMouseUp), o(fabric.document, "touchend", this._onTouchEnd, r), o(fabric.document, t + "move", this._onMouseMove, r), o(fabric.document, "touchmove", this._onMouseMove, r) }, _bindEvents: function () { this.eventsBound || (this._onMouseDown = this._onMouseDown.bind(this), this._onTouchStart = this._onTouchStart.bind(this), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this), this._onTouchEnd = this._onTouchEnd.bind(this), this._onResize = this._onResize.bind(this), this._onGesture = this._onGesture.bind(this), this._onDrag = this._onDrag.bind(this), this._onShake = this._onShake.bind(this), this._onLongPress = this._onLongPress.bind(this), this._onOrientationChange = this._onOrientationChange.bind(this), this._onMouseWheel = this._onMouseWheel.bind(this), this._onMouseOut = this._onMouseOut.bind(this), this._onMouseEnter = this._onMouseEnter.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onDoubleClick = this._onDoubleClick.bind(this), this._onDragOver = this._onDragOver.bind(this), this._onDragEnter = this._simpleEventHandler.bind(this, "dragenter"), this._onDragLeave = this._simpleEventHandler.bind(this, "dragleave"), this._onDrop = this._simpleEventHandler.bind(this, "drop"), this.eventsBound = !0) }, _onGesture: function (t, e) { this.__onTransformGesture && this.__onTransformGesture(t, e) }, _onDrag: function (t, e) { this.__onDrag && this.__onDrag(t, e) }, _onMouseWheel: function (t) { this.__onMouseWheel(t) }, _onMouseOut: function (e) { var i = this._hoveredTarget; this.fire("mouse:out", { target: i, e: e }), this._hoveredTarget = null, i && i.fire("mouseout", { e: e }); var n = this; this._hoveredTargets.forEach(function (t) { n.fire("mouse:out", { target: i, e: e }), t && i.fire("mouseout", { e: e }) }), this._hoveredTargets = [], this._iTextInstances && this._iTextInstances.forEach(function (t) { t.isEditing && t.hiddenTextarea.focus() }) }, _onMouseEnter: function (t) { this._currentTransform || this.findTarget(t) || (this.fire("mouse:over", { target: null, e: t }), this._hoveredTarget = null, this._hoveredTargets = []) }, _onOrientationChange: function (t, e) { this.__onOrientationChange && this.__onOrientationChange(t, e) }, _onShake: function (t, e) { this.__onShake && this.__onShake(t, e) }, _onLongPress: function (t, e) { this.__onLongPress && this.__onLongPress(t, e) }, _onDragOver: function (t) { t.preventDefault(); var e = this._simpleEventHandler("dragover", t); this._fireEnterLeaveEvents(e, t) }, _onContextMenu: function (t) { return this.stopContextMenu && (t.stopPropagation(), t.preventDefault()), !1 }, _onDoubleClick: function (t) { this._cacheTransformEventData(t), this._handleEvent(t, "dblclick"), this._resetTransformEventData(t) }, getPointerId: function (t) { var e = t.changedTouches; return e ? e[0] && e[0].identifier : this.enablePointerEvents ? t.pointerId : -1 }, _isMainEvent: function (t) { return !0 === t.isPrimary || !1 !== t.isPrimary && ("touchend" === t.type && 0 === t.touches.length || (!t.changedTouches || t.changedTouches[0].identifier === this.mainTouchId)) }, _onTouchStart: function (t) { t.preventDefault(), null === this.mainTouchId && (this.mainTouchId = this.getPointerId(t)), this.__onMouseDown(t), this._resetTransformEventData(); var e = this.upperCanvasEl, t = this._getEventPrefix(); n(fabric.document, "touchend", this._onTouchEnd, r), n(fabric.document, "touchmove", this._onMouseMove, r), o(e, t + "down", this._onMouseDown) }, _onMouseDown: function (t) { this.__onMouseDown(t), this._resetTransformEventData(); var e = this.upperCanvasEl, t = this._getEventPrefix(); o(e, t + "move", this._onMouseMove, r), n(fabric.document, t + "up", this._onMouseUp), n(fabric.document, t + "move", this._onMouseMove, r) }, _onTouchEnd: function (t) { var e, i; 0 < t.touches.length || (this.__onMouseUp(t), this._resetTransformEventData(), this.mainTouchId = null, e = this._getEventPrefix(), o(fabric.document, "touchend", this._onTouchEnd, r), o(fabric.document, "touchmove", this._onMouseMove, r), (i = this)._willAddMouseDown && clearTimeout(this._willAddMouseDown), this._willAddMouseDown = setTimeout(function () { n(i.upperCanvasEl, e + "down", i._onMouseDown), i._willAddMouseDown = 0 }, 400)) }, _onMouseUp: function (t) { this.__onMouseUp(t), this._resetTransformEventData(); var e = this.upperCanvasEl, i = this._getEventPrefix(); this._isMainEvent(t) && (o(fabric.document, i + "up", this._onMouseUp), o(fabric.document, i + "move", this._onMouseMove, r), n(e, i + "move", this._onMouseMove, r)) }, _onMouseMove: function (t) { !this.allowTouchScrolling && t.preventDefault && t.preventDefault(), this.__onMouseMove(t) }, _onResize: function () { this.calcOffset() }, _shouldRender: function (t) { var e = this._activeObject; return !!(!!e != !!t || e && t && e !== t) || (e && e.isEditing, !1) }, __onMouseUp: function (t) { var e, i = this._currentTransform, n = this._groupSelector, o = !1, r = !n || 0 === n.left && 0 === n.top; if (this._cacheTransformEventData(t), n = this._target, this._handleEvent(t, "up:before"), s(t, 3)) this.fireRightClick && this._handleEvent(t, "up", 3, r); else { if (s(t, 2)) return this.fireMiddleClick && this._handleEvent(t, "up", 2, r), void this._resetTransformEventData(); this.isDrawingMode && this._isCurrentlyDrawing ? this._onMouseUpInDrawingMode(t) : this._isMainEvent(t) && (i && (this._finalizeCurrentTransform(t), o = i.actionPerformed), r || (e = n === this._activeObject, this._maybeGroupObjects(t), o = o || (this._shouldRender(n) || !e && n === this._activeObject)), n && (e = n._findTargetCorner(this.getPointer(t, !0), fabric.util.isTouchEvent(t)), (e = (e = n.controls[e]) && e.getMouseUpHandler(t, n, e)) && e(t, i, (i = this.getPointer(t)).x, i.y), n.isMoving = !1), this._setCursorFromEvent(t, n), this._handleEvent(t, "up", 1, r), this._groupSelector = null, this._currentTransform = null, n && (n.__corner = 0), o ? this.requestRenderAll() : r || this.renderTop()) } }, _simpleEventHandler: function (t, e) { var i = this.findTarget(e), n = this.targets, o = { e: e, target: i, subTargets: n }; if (this.fire(t, o), i && i.fire(t, o), !n) return i; for (var r = 0; r < n.length; r++)n[r].fire(t, o); return i }, _handleEvent: function (t, e, i, n) { var o = this._target, r = this.targets || [], a = { e: t, target: o, subTargets: r, button: i || 1, isClick: n || !1, pointer: this._pointer, absolutePointer: this._absolutePointer, transform: this._currentTransform }; "up" === e && (a.currentTarget = this.findTarget(t), a.currentSubTargets = this.targets), this.fire("mouse:" + e, a), o && o.fire("mouse" + e, a); for (var s = 0; s < r.length; s++)r[s].fire("mouse" + e, a) }, _finalizeCurrentTransform: function (t) { var e = this._currentTransform, i = e.target, t = { e: t, target: i, transform: e, action: e.action }; i._scaling && (i._scaling = !1), i.setCoords(), (e.actionPerformed || this.stateful && i.hasStateChanged()) && (e.actionPerformed && (e = this._addEventOptions(t, e), this._fire(e, t)), this._fire("modified", t)) }, _addEventOptions: function (t, e) { var i, n; switch (e.action) { case "scaleX": i = "scaled", n = "x"; break; case "scaleY": i = "scaled", n = "y"; break; case "skewX": i = "skewed", n = "x"; break; case "skewY": i = "skewed", n = "y"; break; case "scale": i = "scaled", n = "equally"; break; case "rotate": i = "rotated"; break; case "drag": i = "moved" }return t.by = n, i }, _onMouseDownInDrawingMode: function (t) { this._isCurrentlyDrawing = !0, this.getActiveObject() && this.discardActiveObject(t).requestRenderAll(); var e = this.getPointer(t); this.freeDrawingBrush.onMouseDown(e, { e: t, pointer: e }), this._handleEvent(t, "down") }, _onMouseMoveInDrawingMode: function (t) { var e; this._isCurrentlyDrawing && (e = this.getPointer(t), this.freeDrawingBrush.onMouseMove(e, { e: t, pointer: e })), this.setCursor(this.freeDrawingCursor), this._handleEvent(t, "move") }, _onMouseUpInDrawingMode: function (t) { var e = this.getPointer(t); this._isCurrentlyDrawing = this.freeDrawingBrush.onMouseUp({ e: t, pointer: e }), this._handleEvent(t, "up") }, __onMouseDown: function (t) { this._cacheTransformEventData(t), this._handleEvent(t, "down:before"); var e, i, n, o, r, a = this._target; s(t, 3) ? this.fireRightClick && this._handleEvent(t, "down", 3) : s(t, 2) ? this.fireMiddleClick && this._handleEvent(t, "down", 2) : this.isDrawingMode ? this._onMouseDownInDrawingMode(t) : this._isMainEvent(t) && (this._currentTransform || (o = this._pointer, this._previousPointer = o, e = this._shouldRender(a), i = this._shouldGroup(t, a), this._shouldClearSelection(t, a) ? this.discardActiveObject(t) : i && (this._handleGrouping(t, a), a = this._activeObject), !this.selection || a && (a.selectable || a.isEditing || a === this._activeObject) || (this._groupSelector = { ex: o.x, ey: o.y, top: 0, left: 0 }), a && (n = a === this._activeObject, a.selectable && this.setActiveObject(a, t), r = a._findTargetCorner(this.getPointer(t, !0), fabric.util.isTouchEvent(t)), a.__corner = r, a !== this._activeObject || !r && i || (this._setupCurrentTransform(t, a, n), r = a.controls[r], o = this.getPointer(t), (r = r && r.getMouseDownHandler(t, a, r)) && r(t, this._currentTransform, o.x, o.y))), this._handleEvent(t, "down"), (e || i) && this.requestRenderAll())) }, _resetTransformEventData: function () { this._target = null, this._pointer = null, this._absolutePointer = null }, _cacheTransformEventData: function (t) { this._resetTransformEventData(), this._pointer = this.getPointer(t, !0), this._absolutePointer = this.restorePointerVpt(this._pointer), this._target = this._currentTransform ? this._currentTransform.target : this.findTarget(t) || null }, _beforeTransform: function (t) { var e = this._currentTransform; this.stateful && e.target.saveState(), this.fire("before:transform", { e: t, transform: e }) }, __onMouseMove: function (t) { var e, i; this._handleEvent(t, "move:before"), this._cacheTransformEventData(t), this.isDrawingMode ? this._onMouseMoveInDrawingMode(t) : this._isMainEvent(t) && ((i = this._groupSelector) ? (e = this._pointer, i.left = e.x - i.ex, i.top = e.y - i.ey, this.renderTop()) : this._currentTransform ? this._transformObject(t) : (i = this.findTarget(t) || null, this._setCursorFromEvent(t, i), this._fireOverOutEvents(i, t)), this._handleEvent(t, "move"), this._resetTransformEventData()) }, _fireOverOutEvents: function (t, e) { var i = this._hoveredTarget, n = this._hoveredTargets, o = this.targets, r = Math.max(n.length, o.length); this.fireSyntheticInOutEvents(t, e, { oldTarget: i, evtOut: "mouseout", canvasEvtOut: "mouse:out", evtIn: "mouseover", canvasEvtIn: "mouse:over" }); for (var a = 0; a < r; a++)this.fireSyntheticInOutEvents(o[a], e, { oldTarget: n[a], evtOut: "mouseout", evtIn: "mouseover" }); this._hoveredTarget = t, this._hoveredTargets = this.targets.concat() }, _fireEnterLeaveEvents: function (t, e) { var i = this._draggedoverTarget, n = this._hoveredTargets, o = this.targets, r = Math.max(n.length, o.length); this.fireSyntheticInOutEvents(t, e, { oldTarget: i, evtOut: "dragleave", evtIn: "dragenter" }); for (var a = 0; a < r; a++)this.fireSyntheticInOutEvents(o[a], e, { oldTarget: n[a], evtOut: "dragleave", evtIn: "dragenter" }); this._draggedoverTarget = t }, fireSyntheticInOutEvents: function (t, e, i) { var n, o, r = i.oldTarget, a = r !== t, s = i.canvasEvtIn, l = i.canvasEvtOut; a && (n = { e: e, target: t, previousTarget: r }, o = { e: e, target: r, nextTarget: t }), e = t && a, r && a && (l && this.fire(l, o), r.fire(i.evtOut, o)), e && (s && this.fire(s, n), t.fire(i.evtIn, n)) }, __onMouseWheel: function (t) { this._cacheTransformEventData(t), this._handleEvent(t, "wheel"), this._resetTransformEventData() }, _transformObject: function (t) { var e = this.getPointer(t), i = this._currentTransform; i.reset = !1, i.target.isMoving = !0, i.shiftKey = t.shiftKey, i.altKey = t[this.centeredKey], this._performTransformAction(t, i, e), i.actionPerformed && this.requestRenderAll() }, _performTransformAction: function (t, e, i) { var n = i.x, o = i.y, r = e.action, a = !1, i = e.actionHandler; i && (a = i(t, e, n, o)), "drag" === r && a && this.setCursor(e.target.moveCursor || this.moveCursor), e.actionPerformed = e.actionPerformed || a }, _fire: fabric.controlsUtils.fireEvent, _setCursorFromEvent: function (t, e) { if (!e) return this.setCursor(this.defaultCursor), !1; var i = e.hoverCursor || this.hoverCursor, n = this._activeObject && "activeSelection" === this._activeObject.type ? this._activeObject : null, n = (!n || !n.contains(e)) && e._findTargetCorner(this.getPointer(t, !0)); n ? this.setCursor(this.getCornerCursor(n, e, t)) : (e.subTargetCheck && this.targets.concat().reverse().map(function (t) { i = t.hoverCursor || i }), this.setCursor(i)) }, getCornerCursor: function (t, e, i) { t = e.controls[t]; return t.cursorStyleHandler(i, t, e) } }) }(), function () { var u = Math.min, f = Math.max; fabric.util.object.extend(fabric.Canvas.prototype, { _shouldGroup: function (t, e) { var i = this._activeObject; return i && this._isSelectionKeyPressed(t) && e && e.selectable && this.selection && (i !== e || "activeSelection" === i.type) && !e.onSelect({ e: t }) }, _handleGrouping: function (t, e) { var i = this._activeObject; i.__corner || (e !== i || (e = this.findTarget(t, !0)) && e.selectable) && (i && "activeSelection" === i.type ? this._updateActiveSelection(e, t) : this._createActiveSelection(e, t)) }, _updateActiveSelection: function (t, e) { var i = this._activeObject, n = i._objects.slice(0); i.contains(t) ? (i.removeWithUpdate(t), this._hoveredTarget = t, this._hoveredTargets = this.targets.concat(), 1 === i.size() && this._setActiveObject(i.item(0), e)) : (i.addWithUpdate(t), this._hoveredTarget = i, this._hoveredTargets = this.targets.concat()), this._fireSelectionEvents(n, e) }, _createActiveSelection: function (t, e) { var i = this.getActiveObjects(), t = this._createGroup(t); this._hoveredTarget = t, this._setActiveObject(t, e), this._fireSelectionEvents(i, e) }, _createGroup: function (t) { var e = this._objects, t = e.indexOf(this._activeObject) < e.indexOf(t) ? [this._activeObject, t] : [t, this._activeObject]; return this._activeObject.isEditing && this._activeObject.exitEditing(), new fabric.ActiveSelection(t, { canvas: this }) }, _groupSelectedObjects: function (t) { var e = this._collectObjects(t); 1 === e.length ? this.setActiveObject(e[0], t) : 1 < e.length && (e = new fabric.ActiveSelection(e.reverse(), { canvas: this }), this.setActiveObject(e, t)) }, _collectObjects: function (e) { for (var t, i = [], n = this._groupSelector.ex, o = this._groupSelector.ey, r = n + this._groupSelector.left, a = o + this._groupSelector.top, s = new fabric.Point(u(n, r), u(o, a)), l = new fabric.Point(f(n, r), f(o, a)), c = !this.selectionFullyContained, d = n === r && o === a, h = this._objects.length; h-- && !((t = this._objects[h]) && t.selectable && t.visible && (c && t.intersectsWithRect(s, l) || t.isContainedWithinRect(s, l) || c && t.containsPoint(s) || c && t.containsPoint(l)) && (i.push(t), d));); return 1 < i.length && (i = i.filter(function (t) { return !t.onSelect({ e: e }) })), i }, _maybeGroupObjects: function (t) { this.selection && this._groupSelector && this._groupSelectedObjects(t), this.setCursor(this.defaultCursor), this._groupSelector = null } }) }(), fabric.util.object.extend(fabric.StaticCanvas.prototype, { toDataURL: function (t) { var e = (t = t || {}).format || "png", i = t.quality || 1, n = (t.multiplier || 1) * (t.enableRetinaScaling ? this.getRetinaScaling() : 1), t = this.toCanvasElement(n, t); return fabric.util.toDataURL(t, e, i) }, toCanvasElement: function (t, e) { t = t || 1; var i = ((e = e || {}).width || this.width) * t, n = (e.height || this.height) * t, o = this.getZoom(), r = this.width, a = this.height, s = o * t, l = this.viewportTransform, c = (l[4] - (e.left || 0)) * t, o = (l[5] - (e.top || 0)) * t, e = this.interactive, t = [s, 0, 0, s, c, o], s = this.enableRetinaScaling, c = fabric.util.createCanvasElement(), o = this.contextTop; return c.width = i, c.height = n, this.contextTop = null, this.enableRetinaScaling = !1, this.interactive = !1, this.viewportTransform = t, this.width = i, this.height = n, this.calcViewportBoundaries(), this.renderCanvas(c.getContext("2d"), this._objects), this.viewportTransform = l, this.width = r, this.height = a, this.calcViewportBoundaries(), this.interactive = e, this.enableRetinaScaling = s, this.contextTop = o, c } }), fabric.util.object.extend(fabric.StaticCanvas.prototype, { loadFromJSON: function (t, i, e) { if (t) { var n = "string" == typeof t ? JSON.parse(t) : fabric.util.object.clone(t), o = this, r = n.clipPath, a = this.renderOnAddRemove; return this.renderOnAddRemove = !1, delete n.clipPath, this._enlivenObjects(n.objects, function (e) { o.clear(), o._setBgOverlay(n, function () { r ? o._enlivenObjects([r], function (t) { o.clipPath = t[0], o.__setupCanvas.call(o, n, e, a, i) }) : o.__setupCanvas.call(o, n, e, a, i) }) }, e), this } }, __setupCanvas: function (t, e, i, n) { var o = this; e.forEach(function (t, e) { o.insertAt(t, e) }), this.renderOnAddRemove = i, delete t.objects, delete t.backgroundImage, delete t.overlayImage, delete t.background, delete t.overlay, this._setOptions(t), this.renderAll(), n && n() }, _setBgOverlay: function (t, e) { var i, n = { backgroundColor: !1, overlayColor: !1, backgroundImage: !1, overlayImage: !1 }; t.backgroundImage || t.overlayImage || t.background || t.overlay ? (i = function () { n.backgroundImage && n.overlayImage && n.backgroundColor && n.overlayColor && e && e() }, this.__setBgOverlay("backgroundImage", t.backgroundImage, n, i), this.__setBgOverlay("overlayImage", t.overlayImage, n, i), this.__setBgOverlay("backgroundColor", t.background, n, i), this.__setBgOverlay("overlayColor", t.overlay, n, i)) : e && e() }, __setBgOverlay: function (e, t, i, n) { var o = this; if (!t) return i[e] = !0, void (n && n()); "backgroundImage" === e || "overlayImage" === e ? fabric.util.enlivenObjects([t], function (t) { o[e] = t[0], i[e] = !0, n && n() }) : this["set" + fabric.util.string.capitalize(e, !0)](t, function () { i[e] = !0, n && n() }) }, _enlivenObjects: function (t, e, i) { t && 0 !== t.length ? fabric.util.enlivenObjects(t, function (t) { e && e(t) }, null, i) : e && e([]) }, _toDataURL: function (e, i) { this.clone(function (t) { i(t.toDataURL(e)) }) }, _toDataURLWithMultiplier: function (e, i, n) { this.clone(function (t) { n(t.toDataURLWithMultiplier(e, i)) }) }, clone: function (e, t) { var i = JSON.stringify(this.toJSON(t)); this.cloneWithoutData(function (t) { t.loadFromJSON(i, function () { e && e(t) }) }) }, cloneWithoutData: function (t) { var e = fabric.util.createCanvasElement(); e.width = this.width, e.height = this.height; var i = new fabric.Canvas(e); this.backgroundImage ? (i.setBackgroundImage(this.backgroundImage.src, function () { i.renderAll(), t && t(i) }), i.backgroundImageOpacity = this.backgroundImageOpacity, i.backgroundImageStretch = this.backgroundImageStretch) : t && t(i) } }), function (t) { "use strict"; var p = t.fabric || (t.fabric = {}), e = p.util.object.extend, r = p.util.object.clone, i = p.util.toFixed, n = p.util.string.capitalize, a = p.util.degreesToRadians, o = p.StaticCanvas.supports("setLineDash"), t = !p.isLikelyNode; p.Object || (p.Object = p.util.createClass(p.CommonMethods, { type: "object", originX: "left", originY: "top", top: 0, left: 0, width: 0, height: 0, scaleX: 1, scaleY: 1, flipX: !1, flipY: !1, opacity: 1, angle: 0, skewX: 0, skewY: 0, cornerSize: 13, touchCornerSize: 24, transparentCorners: !0, hoverCursor: null, moveCursor: null, padding: 0, borderColor: "rgb(178,204,255)", borderDashArray: null, cornerColor: "rgb(178,204,255)", cornerStrokeColor: null, cornerStyle: "rect", cornerDashArray: null, centeredScaling: !1, centeredRotation: !0, fill: "rgb(0,0,0)", fillRule: "nonzero", globalCompositeOperation: "source-over", backgroundColor: "", selectionBackgroundColor: "", stroke: null, strokeWidth: 1, strokeDashArray: null, strokeDashOffset: 0, strokeLineCap: "butt", strokeLineJoin: "miter", strokeMiterLimit: 4, shadow: null, borderOpacityWhenMoving: .4, borderScaleFactor: 1, minScaleLimit: 0, selectable: !0, evented: !0, visible: !0, hasControls: !0, hasBorders: !0, perPixelTargetFind: !1, includeDefaultValues: !0, lockMovementX: !1, lockMovementY: !1, lockRotation: !1, lockScalingX: !1, lockScalingY: !1, lockSkewingX: !1, lockSkewingY: !1, lockScalingFlip: !1, excludeFromExport: !1, objectCaching: t, statefullCache: !1, noScaleCache: !0, strokeUniform: !1, dirty: !0, __corner: 0, paintFirst: "fill", stateProperties: "top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "), cacheProperties: "fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "), colorProperties: "fill stroke backgroundColor".split(" "), clipPath: void 0, inverted: !1, absolutePositioned: !1, initialize: function (t) { t && this.setOptions(t) }, _createCacheCanvas: function () { this._cacheProperties = {}, this._cacheCanvas = p.util.createCanvasElement(), this._cacheContext = this._cacheCanvas.getContext("2d"), this._updateCacheCanvas(), this.dirty = !0 }, _limitCacheSize: function (t) { var e = p.perfLimitSizeTotal, i = t.width, n = t.height, o = p.maxCacheSideLimit, r = p.minCacheSideLimit; if (i <= o && n <= o && i * n <= e) return i < r && (t.width = r), n < r && (t.height = r), t; var a = i / n, s = p.util.limitDimsByArea(a, e), a = p.util.capValue, e = a(r, s.x, o), o = a(r, s.y, o); return e < i && (t.zoomX /= i / e, t.width = e, t.capped = !0), o < n && (t.zoomY /= n / o, t.height = o, t.capped = !0), t }, _getCacheCanvasDimensions: function () { var t = this.getTotalObjectScaling(), e = this._getTransformedDimensions(0, 0), i = e.x * t.scaleX / this.scaleX, e = e.y * t.scaleY / this.scaleY; return { width: 2 + i, height: 2 + e, zoomX: t.scaleX, zoomY: t.scaleY, x: i, y: e } }, _updateCacheCanvas: function () { var t = this.canvas; if (this.noScaleCache && t && t._currentTransform) { var e = t._currentTransform.target, i = t._currentTransform.action; if (this === e && i.slice && "scale" === i.slice(0, 5)) return !1 } var n = this._cacheCanvas, o = this._limitCacheSize(this._getCacheCanvasDimensions()), r = p.minCacheSideLimit, a = o.width, s = o.height, l = o.zoomX, c = o.zoomY, d = a !== this.cacheWidth || s !== this.cacheHeight, h = this.zoomX !== l || this.zoomY !== c, u = d || h, f = 0, t = 0, e = !1; return d && (i = this._cacheCanvas.width, h = this._cacheCanvas.height, e = (d = i < a || h < s) || (a < .9 * i || s < .9 * h) && r < i && r < h, d && !o.capped && (r < a || r < s) && (f = .1 * a, t = .1 * s)), u && (e ? (n.width = Math.ceil(a + f), n.height = Math.ceil(s + t)) : (this._cacheContext.setTransform(1, 0, 0, 1, 0, 0), this._cacheContext.clearRect(0, 0, n.width, n.height)), t = o.x / 2, o = o.y / 2, this.cacheTranslationX = Math.round(n.width / 2 - t) + t, this.cacheTranslationY = Math.round(n.height / 2 - o) + o, this.cacheWidth = a, this.cacheHeight = s, this._cacheContext.translate(this.cacheTranslationX, this.cacheTranslationY), this._cacheContext.scale(l, c), this.zoomX = l, this.zoomY = c, !0) }, setOptions: function (t) { this._setOptions(t), this._initGradient(t.fill, "fill"), this._initGradient(t.stroke, "stroke"), this._initPattern(t.fill, "fill"), this._initPattern(t.stroke, "stroke") }, transform: function (t) { var e = this.group && !this.group._transformDone || this.group && this.canvas && t === this.canvas.contextTop, e = this.calcTransformMatrix(!e); t.transform(e[0], e[1], e[2], e[3], e[4], e[5]) }, toObject: function (t) { var e = p.Object.NUM_FRACTION_DIGITS, e = { type: this.type, version: p.version, originX: this.originX, originY: this.originY, left: i(this.left, e), top: i(this.top, e), width: i(this.width, e), height: i(this.height, e), fill: this.fill && this.fill.toObject ? this.fill.toObject() : this.fill, stroke: this.stroke && this.stroke.toObject ? this.stroke.toObject() : this.stroke, strokeWidth: i(this.strokeWidth, e), strokeDashArray: this.strokeDashArray && this.strokeDashArray.concat(), strokeLineCap: this.strokeLineCap, strokeDashOffset: this.strokeDashOffset, strokeLineJoin: this.strokeLineJoin, strokeMiterLimit: i(this.strokeMiterLimit, e), scaleX: i(this.scaleX, e), scaleY: i(this.scaleY, e), angle: i(this.angle, e), flipX: this.flipX, flipY: this.flipY, opacity: i(this.opacity, e), shadow: this.shadow && this.shadow.toObject ? this.shadow.toObject() : this.shadow, visible: this.visible, backgroundColor: this.backgroundColor, fillRule: this.fillRule, paintFirst: this.paintFirst, globalCompositeOperation: this.globalCompositeOperation, skewX: i(this.skewX, e), skewY: i(this.skewY, e) }; return this.clipPath && (e.clipPath = this.clipPath.toObject(t), e.clipPath.inverted = this.clipPath.inverted, e.clipPath.absolutePositioned = this.clipPath.absolutePositioned), p.util.populateWithProperties(this, e, t), this.includeDefaultValues || (e = this._removeDefaultValues(e)), e }, toDatalessObject: function (t) { return this.toObject(t) }, _removeDefaultValues: function (e) { var i = p.util.getKlass(e.type).prototype; return i.stateProperties.forEach(function (t) { "left" !== t && "top" !== t && (e[t] === i[t] && delete e[t], "[object Array]" === Object.prototype.toString.call(e[t]) && "[object Array]" === Object.prototype.toString.call(i[t]) && 0 === e[t].length && 0 === i[t].length && delete e[t]) }), e }, toString: function () { return "#<fabric." + n(this.type) + ">" }, getObjectScaling: function () { var t = p.util.qrDecompose(this.calcTransformMatrix()); return { scaleX: Math.abs(t.scaleX), scaleY: Math.abs(t.scaleY) } }, getTotalObjectScaling: function () { var t, e = this.getObjectScaling(), i = e.scaleX, n = e.scaleY; return this.canvas && (i *= (t = this.canvas.getZoom()) * (e = this.canvas.getRetinaScaling()), n *= t * e), { scaleX: i, scaleY: n } }, getObjectOpacity: function () { var t = this.opacity; return this.group && (t *= this.group.getObjectOpacity()), t }, _set: function (t, e) { var i, n = "scaleX" === t || "scaleY" === t, o = this[t] !== e; return n && (e = this._constrainScale(e)), "scaleX" === t && e < 0 ? (this.flipX = !this.flipX, e *= -1) : "scaleY" === t && e < 0 ? (this.flipY = !this.flipY, e *= -1) : "shadow" !== t || !e || e instanceof p.Shadow ? "dirty" === t && this.group && this.group.set("dirty", e) : e = new p.Shadow(e), this[t] = e, o && (i = this.group && this.group.isOnACache(), -1 < this.cacheProperties.indexOf(t) ? (this.dirty = !0, i && this.group.set("dirty", !0)) : i && -1 < this.stateProperties.indexOf(t) && this.group.set("dirty", !0)), this }, setOnGroup: function () { }, getViewportTransform: function () { return this.canvas && this.canvas.viewportTransform ? this.canvas.viewportTransform : p.iMatrix.concat() }, isNotVisible: function () { return 0 === this.opacity || !this.width && !this.height && 0 === this.strokeWidth || !this.visible }, render: function (t) { this.isNotVisible() || this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (t.save(), this._setupCompositeOperation(t), this.drawSelectionBackground(t), this.transform(t), this._setOpacity(t), this._setShadow(t, this), this.shouldCache() ? (this.renderCache(), this.drawCacheOnCanvas(t)) : (this._removeCacheCanvas(), this.dirty = !1, this.drawObject(t), this.objectCaching && this.statefullCache && this.saveState({ propertySet: "cacheProperties" })), t.restore()) }, renderCache: function (t) { t = t || {}, this._cacheCanvas || this._createCacheCanvas(), this.isCacheDirty() && (this.statefullCache && this.saveState({ propertySet: "cacheProperties" }), this.drawObject(this._cacheContext, t.forClipping), this.dirty = !1) }, _removeCacheCanvas: function () { this._cacheCanvas = null, this.cacheWidth = 0, this.cacheHeight = 0 }, hasStroke: function () { return this.stroke && "transparent" !== this.stroke && 0 !== this.strokeWidth }, hasFill: function () { return this.fill && "transparent" !== this.fill }, needsItsOwnCache: function () { return !("stroke" !== this.paintFirst || !this.hasFill() || !this.hasStroke() || "object" != typeof this.shadow) || !!this.clipPath }, shouldCache: function () { return this.ownCaching = this.needsItsOwnCache() || this.objectCaching && (!this.group || !this.group.isOnACache()), this.ownCaching }, willDrawShadow: function () { return !!this.shadow && (0 !== this.shadow.offsetX || 0 !== this.shadow.offsetY) }, drawClipPathOnCache: function (t) { var e, i = this.clipPath; t.save(), i.inverted ? t.globalCompositeOperation = "destination-out" : t.globalCompositeOperation = "destination-in", i.absolutePositioned && (e = p.util.invertTransform(this.calcTransformMatrix()), t.transform(e[0], e[1], e[2], e[3], e[4], e[5])), i.transform(t), t.scale(1 / i.zoomX, 1 / i.zoomY), t.drawImage(i._cacheCanvas, -i.cacheTranslationX, -i.cacheTranslationY), t.restore() }, drawObject: function (t, e) { var i = this.fill, n = this.stroke; e ? (this.fill = "black", this.stroke = "", this._setClippingProperties(t)) : this._renderBackground(t), this._render(t), this._drawClipPath(t), this.fill = i, this.stroke = n }, _drawClipPath: function (t) { var e = this.clipPath; e && (e.canvas = this.canvas, e.shouldCache(), e._transformDone = !0, e.renderCache({ forClipping: !0 }), this.drawClipPathOnCache(t)) }, drawCacheOnCanvas: function (t) { t.scale(1 / this.zoomX, 1 / this.zoomY), t.drawImage(this._cacheCanvas, -this.cacheTranslationX, -this.cacheTranslationY) }, isCacheDirty: function (t) { return !this.isNotVisible() && (!(!this._cacheCanvas || t || !this._updateCacheCanvas()) || !!(this.dirty || this.clipPath && this.clipPath.absolutePositioned || this.statefullCache && this.hasStateChanged("cacheProperties")) && (this._cacheCanvas && !t && (e = this.cacheWidth / this.zoomX, t = this.cacheHeight / this.zoomY, this._cacheContext.clearRect(-e / 2, -t / 2, e, t)), !0)); var e }, _renderBackground: function (t) { var e; this.backgroundColor && (e = this._getNonTransformedDimensions(), t.fillStyle = this.backgroundColor, t.fillRect(-e.x / 2, -e.y / 2, e.x, e.y), this._removeShadow(t)) }, _setOpacity: function (t) { this.group && !this.group._transformDone ? t.globalAlpha = this.getObjectOpacity() : t.globalAlpha *= this.opacity }, _setStrokeStyles: function (t, e) { var i = e.stroke; i && (t.lineWidth = e.strokeWidth, t.lineCap = e.strokeLineCap, t.lineDashOffset = e.strokeDashOffset, t.lineJoin = e.strokeLineJoin, t.miterLimit = e.strokeMiterLimit, i.toLive ? "percentage" === i.gradientUnits || i.gradientTrasnform || i.patternTransform ? this._applyPatternForTransformedGradient(t, i) : (t.strokeStyle = i.toLive(t, this), this._applyPatternGradientTransform(t, i)) : t.strokeStyle = e.stroke) }, _setFillStyles: function (t, e) { var i = e.fill; i && (i.toLive ? (t.fillStyle = i.toLive(t, this), this._applyPatternGradientTransform(t, e.fill)) : t.fillStyle = i) }, _setClippingProperties: function (t) { t.globalAlpha = 1, t.strokeStyle = "transparent", t.fillStyle = "#000000" }, _setLineDash: function (t, e, i) { e && 0 !== e.length && (1 & e.length && e.push.apply(e, e), o ? t.setLineDash(e) : i && i(t)) }, _renderControls: function (t, e) { var i = this.getViewportTransform(), n = this.calcTransformMatrix(), o = (void 0 !== (e = e || {}).hasBorders ? e : this).hasBorders, r = (void 0 !== e.hasControls ? e : this).hasControls, n = p.util.multiplyTransformMatrices(i, n), n = p.util.qrDecompose(n); t.save(), t.translate(n.translateX, n.translateY), t.lineWidth = +this.borderScaleFactor, this.group || (t.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1), e.forActiveSelection ? (t.rotate(a(n.angle)), o && this.drawBordersInGroup(t, n, e)) : (t.rotate(a(this.angle)), o && this.drawBorders(t, e)), r && this.drawControls(t, e), t.restore() }, _setShadow: function (t) { var e, i, n, o, r; this.shadow && (e = this.shadow, n = (i = this.canvas) && i.viewportTransform[0] || 1, o = i && i.viewportTransform[3] || 1, r = e.nonScaling ? { scaleX: 1, scaleY: 1 } : this.getObjectScaling(), i && i._isRetinaScaling() && (n *= p.devicePixelRatio, o *= p.devicePixelRatio), t.shadowColor = e.color, t.shadowBlur = e.blur * p.browserShadowBlurConstant * (n + o) * (r.scaleX + r.scaleY) / 4, t.shadowOffsetX = e.offsetX * n * r.scaleX, t.shadowOffsetY = e.offsetY * o * r.scaleY) }, _removeShadow: function (t) { this.shadow && (t.shadowColor = "", t.shadowBlur = t.shadowOffsetX = t.shadowOffsetY = 0) }, _applyPatternGradientTransform: function (t, e) { if (!e || !e.toLive) return { offsetX: 0, offsetY: 0 }; var i = e.gradientTransform || e.patternTransform, n = -this.width / 2 + e.offsetX || 0, o = -this.height / 2 + e.offsetY || 0; return "percentage" === e.gradientUnits ? t.transform(this.width, 0, 0, this.height, n, o) : t.transform(1, 0, 0, 1, n, o), i && t.transform(i[0], i[1], i[2], i[3], i[4], i[5]), { offsetX: n, offsetY: o } }, _renderPaintInOrder: function (t) { "stroke" === this.paintFirst ? (this._renderStroke(t), this._renderFill(t)) : (this._renderFill(t), this._renderStroke(t)) }, _render: function () { }, _renderFill: function (t) { this.fill && (t.save(), this._setFillStyles(t, this), "evenodd" === this.fillRule ? t.fill("evenodd") : t.fill(), t.restore()) }, _renderStroke: function (t) { var e; this.stroke && 0 !== this.strokeWidth && (this.shadow && !this.shadow.affectStroke && this._removeShadow(t), t.save(), this.strokeUniform && this.group ? (e = this.getObjectScaling(), t.scale(1 / e.scaleX, 1 / e.scaleY)) : this.strokeUniform && t.scale(1 / this.scaleX, 1 / this.scaleY), this._setLineDash(t, this.strokeDashArray, this._renderDashedStroke), this._setStrokeStyles(t, this), t.stroke(), t.restore()) }, _applyPatternForTransformedGradient: function (t, e) { var i, n = this._limitCacheSize(this._getCacheCanvasDimensions()), o = p.util.createCanvasElement(), r = this.canvas.getRetinaScaling(), a = n.x / this.scaleX / r, s = n.y / this.scaleY / r; o.width = a, o.height = s, (i = o.getContext("2d")).beginPath(), i.moveTo(0, 0), i.lineTo(a, 0), i.lineTo(a, s), i.lineTo(0, s), i.closePath(), i.translate(a / 2, s / 2), i.scale(n.zoomX / this.scaleX / r, n.zoomY / this.scaleY / r), this._applyPatternGradientTransform(i, e), i.fillStyle = e.toLive(t), i.fill(), t.translate(-this.width / 2 - this.strokeWidth / 2, -this.height / 2 - this.strokeWidth / 2), t.scale(r * this.scaleX / n.zoomX, r * this.scaleY / n.zoomY), t.strokeStyle = i.createPattern(o, "no-repeat") }, _findCenterFromElement: function () { return { x: this.left + this.width / 2, y: this.top + this.height / 2 } }, _assignTransformMatrixProps: function () { var t; this.transformMatrix && (t = p.util.qrDecompose(this.transformMatrix), this.flipX = !1, this.flipY = !1, this.set("scaleX", t.scaleX), this.set("scaleY", t.scaleY), this.angle = t.angle, this.skewX = t.skewX, this.skewY = 0) }, _removeTransformMatrix: function (t) { var e = this._findCenterFromElement(); this.transformMatrix && (this._assignTransformMatrixProps(), e = p.util.transformPoint(e, this.transformMatrix)), this.transformMatrix = null, t && (this.scaleX *= t.scaleX, this.scaleY *= t.scaleY, this.cropX = t.cropX, this.cropY = t.cropY, e.x += t.offsetLeft, e.y += t.offsetTop, this.width = t.width, this.height = t.height), this.setPositionByOrigin(e, "center", "center") }, clone: function (t, e) { e = this.toObject(e); this.constructor.fromObject ? this.constructor.fromObject(e, t) : p.Object._fromObject("Object", e, t) }, cloneAsImage: function (t, e) { e = this.toCanvasElement(e); return t && t(new p.Image(e)), this }, toCanvasElement: function (t) { t = t || {}; var e = p.util, i = e.saveObjectTransform(this), n = this.group, o = this.shadow, r = Math.abs, a = (t.multiplier || 1) * (t.enableRetinaScaling ? p.devicePixelRatio : 1); delete this.group, t.withoutTransform && e.resetObjectTransform(this), t.withoutShadow && (this.shadow = null); var s, l = p.util.createCanvasElement(), c = this.getBoundingRect(!0, !0), d = this.shadow, h = { x: 0, y: 0 }; d && (e = d.blur, s = d.nonScaling ? { scaleX: 1, scaleY: 1 } : this.getObjectScaling(), h.x = 2 * Math.round(r(d.offsetX) + e) * r(s.scaleX), h.y = 2 * Math.round(r(d.offsetY) + e) * r(s.scaleY)), s = c.width + h.x, h = c.height + h.y, l.width = Math.ceil(s), l.height = Math.ceil(h); h = new p.StaticCanvas(l, { enableRetinaScaling: !1, renderOnAddRemove: !1, skipOffscreen: !1 }); "jpeg" === t.format && (h.backgroundColor = "#fff"), this.setPositionByOrigin(new p.Point(h.width / 2, h.height / 2), "center", "center"); l = this.canvas; h.add(this); t = h.toCanvasElement(a || 1, t); return this.shadow = o, this.set("canvas", l), n && (this.group = n), this.set(i).setCoords(), h._objects = [], h.dispose(), h = null, t }, toDataURL: function (t) { return t = t || {}, p.util.toDataURL(this.toCanvasElement(t), t.format || "png", t.quality || 1) }, isType: function (t) { return this.type === t }, complexity: function () { return 1 }, toJSON: function (t) { return this.toObject(t) }, rotate: function (t) { var e = ("center" !== this.originX || "center" !== this.originY) && this.centeredRotation; return e && this._setOriginToCenter(), this.set("angle", t), e && this._resetOrigin(), this }, centerH: function () { return this.canvas && this.canvas.centerObjectH(this), this }, viewportCenterH: function () { return this.canvas && this.canvas.viewportCenterObjectH(this), this }, centerV: function () { return this.canvas && this.canvas.centerObjectV(this), this }, viewportCenterV: function () { return this.canvas && this.canvas.viewportCenterObjectV(this), this }, center: function () { return this.canvas && this.canvas.centerObject(this), this }, viewportCenter: function () { return this.canvas && this.canvas.viewportCenterObject(this), this }, getLocalPointer: function (t, e) { e = e || this.canvas.getPointer(t); t = new p.Point(e.x, e.y), e = this._getLeftTopCoords(); return this.angle && (t = p.util.rotatePoint(t, e, a(-this.angle))), { x: t.x - e.x, y: t.y - e.y } }, _setupCompositeOperation: function (t) { this.globalCompositeOperation && (t.globalCompositeOperation = this.globalCompositeOperation) } }), p.util.createAccessors && p.util.createAccessors(p.Object), e(p.Object.prototype, p.Observable), p.Object.NUM_FRACTION_DIGITS = 2, p.Object._fromObject = function (t, e, i, n) { var o = p[t]; e = r(e, !0), p.util.enlivenPatterns([e.fill, e.stroke], function (t) { void 0 !== t[0] && (e.fill = t[0]), void 0 !== t[1] && (e.stroke = t[1]), p.util.enlivenObjects([e.clipPath], function (t) { e.clipPath = t[0]; t = n ? new o(e[n], e) : new o(e); i && i(t) }) }) }, p.Object.__uid = 0) }("undefined" != typeof exports ? exports : this), function () { var r = fabric.util.degreesToRadians, s = { left: -.5, center: 0, right: .5 }, l = { top: -.5, center: 0, bottom: .5 }; fabric.util.object.extend(fabric.Object.prototype, { translateToGivenOrigin: function (t, e, i, n, o) { var r = t.x, a = t.y; return "string" == typeof e ? e = s[e] : e -= .5, "string" == typeof n ? n = s[n] : n -= .5, "string" == typeof i ? i = l[i] : i -= .5, "string" == typeof o ? o = l[o] : o -= .5, i = o - i, ((n = n - e) || i) && (e = this._getTransformedDimensions(), r = t.x + n * e.x, a = t.y + i * e.y), new fabric.Point(r, a) }, translateToCenterPoint: function (t, e, i) { i = this.translateToGivenOrigin(t, e, i, "center", "center"); return this.angle ? fabric.util.rotatePoint(i, t, r(this.angle)) : i }, translateToOriginPoint: function (t, e, i) { i = this.translateToGivenOrigin(t, "center", "center", e, i); return this.angle ? fabric.util.rotatePoint(i, t, r(this.angle)) : i }, getCenterPoint: function () { var t = new fabric.Point(this.left, this.top); return this.translateToCenterPoint(t, this.originX, this.originY) }, getPointByOrigin: function (t, e) { var i = this.getCenterPoint(); return this.translateToOriginPoint(i, t, e) }, toLocalPoint: function (t, e, i) { var n = this.getCenterPoint(), i = void 0 !== e && void 0 !== i ? this.translateToGivenOrigin(n, "center", "center", e, i) : new fabric.Point(this.left, this.top), t = new fabric.Point(t.x, t.y); return this.angle && (t = fabric.util.rotatePoint(t, n, -r(this.angle))), t.subtractEquals(i) }, setPositionByOrigin: function (t, e, i) { i = this.translateToCenterPoint(t, e, i), i = this.translateToOriginPoint(i, this.originX, this.originY); this.set("left", i.x), this.set("top", i.y) }, adjustPosition: function (t) { var e = r(this.angle), i = this.getScaledWidth(), n = fabric.util.cos(e) * i, o = fabric.util.sin(e) * i, e = "string" == typeof this.originX ? s[this.originX] : this.originX - .5, i = "string" == typeof t ? s[t] : t - .5; this.left += n * (i - e), this.top += o * (i - e), this.setCoords(), this.originX = t }, _setOriginToCenter: function () { this._originalOriginX = this.originX, this._originalOriginY = this.originY; var t = this.getCenterPoint(); this.originX = "center", this.originY = "center", this.left = t.x, this.top = t.y }, _resetOrigin: function () { var t = this.translateToOriginPoint(this.getCenterPoint(), this._originalOriginX, this._originalOriginY); this.originX = this._originalOriginX, this.originY = this._originalOriginY, this.left = t.x, this.top = t.y, this._originalOriginX = null, this._originalOriginY = null }, _getLeftTopCoords: function () { return this.translateToOriginPoint(this.getCenterPoint(), "left", "top") } }) }(), function () { var r = fabric.util, a = r.degreesToRadians, s = r.multiplyTransformMatrices, l = r.transformPoint; r.object.extend(fabric.Object.prototype, { oCoords: null, aCoords: null, lineCoords: null, ownMatrixCache: null, matrixCache: null, controls: {}, _getCoords: function (t, e) { return e ? t ? this.calcACoords() : this.calcLineCoords() : (this.aCoords && this.lineCoords || this.setCoords(!0), t ? this.aCoords : this.lineCoords) }, getCoords: function (t, e) { return e = this._getCoords(t, e), [new fabric.Point(e.tl.x, e.tl.y), new fabric.Point(e.tr.x, e.tr.y), new fabric.Point(e.br.x, e.br.y), new fabric.Point(e.bl.x, e.bl.y)] }, intersectsWithRect: function (t, e, i, n) { n = this.getCoords(i, n); return "Intersection" === fabric.Intersection.intersectPolygonRectangle(n, t, e).status }, intersectsWithObject: function (t, e, i) { return "Intersection" === fabric.Intersection.intersectPolygonPolygon(this.getCoords(e, i), t.getCoords(e, i)).status || t.isContainedWithinObject(this, e, i) || this.isContainedWithinObject(t, e, i) }, isContainedWithinObject: function (t, e, i) { for (var n = this.getCoords(e, i), e = e ? t.aCoords : t.lineCoords, o = 0, r = t._getImageLines(e); o < 4; o++)if (!t.containsPoint(n[o], r)) return !1; return !0 }, isContainedWithinRect: function (t, e, i, n) { n = this.getBoundingRect(i, n); return n.left >= t.x && n.left + n.width <= e.x && n.top >= t.y && n.top + n.height <= e.y }, containsPoint: function (t, e, i, n) { n = this._getCoords(i, n), e = e || this._getImageLines(n), e = this._findCrossPoints(t, e); return 0 !== e && e % 2 == 1 }, isOnScreen: function (t) { if (!this.canvas) return !1; var e = this.canvas.vptCoords.tl, i = this.canvas.vptCoords.br; return !!this.getCoords(!0, t).some(function (t) { return t.x <= i.x && t.x >= e.x && t.y <= i.y && t.y >= e.y }) || (!!this.intersectsWithRect(e, i, !0, t) || this._containsCenterOfCanvas(e, i, t)) }, _containsCenterOfCanvas: function (t, e, i) { e = { x: (t.x + e.x) / 2, y: (t.y + e.y) / 2 }; return !!this.containsPoint(e, null, !0, i) }, isPartiallyOnScreen: function (t) { if (!this.canvas) return !1; var e = this.canvas.vptCoords.tl, i = this.canvas.vptCoords.br; return !!this.intersectsWithRect(e, i, !0, t) || this.getCoords(!0, t).every(function (t) { return (t.x >= i.x || t.x <= e.x) && (t.y >= i.y || t.y <= e.y) }) && this._containsCenterOfCanvas(e, i, t) }, _getImageLines: function (t) { return { topline: { o: t.tl, d: t.tr }, rightline: { o: t.tr, d: t.br }, bottomline: { o: t.br, d: t.bl }, leftline: { o: t.bl, d: t.tl } } }, _findCrossPoints: function (t, e) { var i, n, o, r = 0; for (o in e) if (n = e[o], !(n.o.y < t.y && n.d.y < t.y || n.o.y >= t.y && n.d.y >= t.y || ((n.o.x === n.d.x && n.o.x >= t.x ? n.o.x : (i = (n.d.y - n.o.y) / (n.d.x - n.o.x), -(t.y - 0 * t.x - (n.o.y - i * n.o.x)) / (0 - i))) >= t.x && (r += 1), 2 !== r))) break; return r }, getBoundingRect: function (t, e) { e = this.getCoords(t, e); return r.makeBoundingBoxFromPoints(e) }, getScaledWidth: function () { return this._getTransformedDimensions().x }, getScaledHeight: function () { return this._getTransformedDimensions().y }, _constrainScale: function (t) { return Math.abs(t) < this.minScaleLimit ? t < 0 ? -this.minScaleLimit : this.minScaleLimit : 0 === t ? 1e-4 : t }, scale: function (t) { return this._set("scaleX", t), this._set("scaleY", t), this.setCoords() }, scaleToWidth: function (t, e) { e = this.getBoundingRect(e).width / this.getScaledWidth(); return this.scale(t / this.width / e) }, scaleToHeight: function (t, e) { e = this.getBoundingRect(e).height / this.getScaledHeight(); return this.scale(t / this.height / e) }, calcCoords: function (t) { return t ? this.calcACoords() : this.calcOCoords() }, calcLineCoords: function () { var t = this.getViewportTransform(), e = this.padding, i = a(this.angle), n = r.cos(i) * e, o = r.sin(i) * e, i = n + o, n = n - o, o = this.calcACoords(), t = { tl: l(o.tl, t), tr: l(o.tr, t), bl: l(o.bl, t), br: l(o.br, t) }; return e && (t.tl.x -= n, t.tl.y -= i, t.tr.x += i, t.tr.y -= n, t.bl.x -= i, t.bl.y += n, t.br.x += n, t.br.y += i), t }, calcOCoords: function () { var t = this._calcRotateMatrix(), e = this._calcTranslateMatrix(), i = this.getViewportTransform(), e = s(i, e), n = s(e, t), n = s(n, [1 / i[0], 0, 0, 1 / i[3], 0, 0]), o = this._calculateCurrentDimensions(), r = {}; return this.forEachControl(function (t, e, i) { r[e] = t.positionHandler(o, n, i) }), r }, calcACoords: function () { var t = this._calcRotateMatrix(), e = this._calcTranslateMatrix(), i = s(e, t), e = this._getTransformedDimensions(), t = e.x / 2, e = e.y / 2; return { tl: l({ x: -t, y: -e }, i), tr: l({ x: t, y: -e }, i), bl: l({ x: -t, y: e }, i), br: l({ x: t, y: e }, i) } }, setCoords: function (t) { return this.aCoords = this.calcACoords(), this.lineCoords = this.group ? this.aCoords : this.calcLineCoords(), t || (this.oCoords = this.calcOCoords(), this._setCornerCoords && this._setCornerCoords()), this }, _calcRotateMatrix: function () { return r.calcRotateMatrix(this) }, _calcTranslateMatrix: function () { var t = this.getCenterPoint(); return [1, 0, 0, 1, t.x, t.y] }, transformMatrixKey: function (t) { var e = ""; return !t && this.group && (e = this.group.transformMatrixKey(t) + "_"), e + this.top + "_" + this.left + "_" + this.scaleX + "_" + this.scaleY + "_" + this.skewX + "_" + this.skewY + "_" + this.angle + "_" + this.originX + "_" + this.originY + "_" + this.width + "_" + this.height + "_" + this.strokeWidth + this.flipX + this.flipY }, calcTransformMatrix: function (t) { var e = this.calcOwnMatrix(); if (t || !this.group) return e; var i = this.transformMatrixKey(t), t = this.matrixCache || (this.matrixCache = {}); return t.key === i ? t.value : (this.group && (e = s(this.group.calcTransformMatrix(!1), e)), t.key = i, t.value = e) }, calcOwnMatrix: function () { var t = this.transformMatrixKey(!0), e = this.ownMatrixCache || (this.ownMatrixCache = {}); if (e.key === t) return e.value; var i = this._calcTranslateMatrix(), i = { angle: this.angle, translateX: i[4], translateY: i[5], scaleX: this.scaleX, scaleY: this.scaleY, skewX: this.skewX, skewY: this.skewY, flipX: this.flipX, flipY: this.flipY }; return e.key = t, e.value = r.composeMatrix(i), e.value }, _calcDimensionsTransformMatrix: function (t, e, i) { return r.calcDimensionsMatrix({ skewX: t, skewY: e, scaleX: this.scaleX * (i && this.flipX ? -1 : 1), scaleY: this.scaleY * (i && this.flipY ? -1 : 1) }) }, _getNonTransformedDimensions: function () { var t = this.strokeWidth; return { x: this.width + t, y: this.height + t } }, _getTransformedDimensions: function (t, e) { void 0 === t && (t = this.skewX), void 0 === e && (e = this.skewY); var i, n = this._getNonTransformedDimensions(), o = 0 === t && 0 === e, n = this.strokeUniform ? (i = this.width, this.height) : (i = n.x, n.y); if (o) return this._finalizeDimensions(i * this.scaleX, n * this.scaleY); e = r.sizeAfterTransform(i, n, { scaleX: this.scaleX, scaleY: this.scaleY, skewX: t, skewY: e }); return this._finalizeDimensions(e.x, e.y) }, _finalizeDimensions: function (t, e) { return this.strokeUniform ? { x: t + this.strokeWidth, y: e + this.strokeWidth } : { x: t, y: e } }, _calculateCurrentDimensions: function () { var t = this.getViewportTransform(), e = this._getTransformedDimensions(); return l(e, t, !0).scalarAdd(2 * this.padding) } }) }(), fabric.util.object.extend(fabric.Object.prototype, { sendToBack: function () { return this.group ? fabric.StaticCanvas.prototype.sendToBack.call(this.group, this) : this.canvas && this.canvas.sendToBack(this), this }, bringToFront: function () { return this.group ? fabric.StaticCanvas.prototype.bringToFront.call(this.group, this) : this.canvas && this.canvas.bringToFront(this), this }, sendBackwards: function (t) { return this.group ? fabric.StaticCanvas.prototype.sendBackwards.call(this.group, this, t) : this.canvas && this.canvas.sendBackwards(this, t), this }, bringForward: function (t) { return this.group ? fabric.StaticCanvas.prototype.bringForward.call(this.group, this, t) : this.canvas && this.canvas.bringForward(this, t), this }, moveTo: function (t) { return this.group && "activeSelection" !== this.group.type ? fabric.StaticCanvas.prototype.moveTo.call(this.group, this, t) : this.canvas && this.canvas.moveTo(this, t), this } }), function () { function h(t, e) { if (e) { if (e.toLive) return t + ": url(#SVGID_" + e.id + "); "; var i = new fabric.Color(e), e = t + ": " + i.toRgb() + "; ", i = i.getAlpha(); return 1 !== i && (e += t + "-opacity: " + i.toString() + "; "), e } return t + ": none; " } var i = fabric.util.toFixed; fabric.util.object.extend(fabric.Object.prototype, { getSvgStyles: function (t) { var e = this.fillRule || "nonzero", i = this.strokeWidth || "0", n = this.strokeDashArray ? this.strokeDashArray.join(" ") : "none", o = this.strokeDashOffset || "0", r = this.strokeLineCap || "butt", a = this.strokeLineJoin || "miter", s = this.strokeMiterLimit || "4", l = void 0 !== this.opacity ? this.opacity : "1", c = this.visible ? "" : " visibility: hidden;", d = t ? "" : this.getSvgFilter(), t = h("fill", this.fill); return [h("stroke", this.stroke), "stroke-width: ", i, "; ", "stroke-dasharray: ", n, "; ", "stroke-linecap: ", r, "; ", "stroke-dashoffset: ", o, "; ", "stroke-linejoin: ", a, "; ", "stroke-miterlimit: ", s, "; ", t, "fill-rule: ", e, "; ", "opacity: ", l, ";", d, c].join("") }, getSvgSpanStyles: function (t, e) { var i = t.fontFamily ? "font-family: " + (-1 === t.fontFamily.indexOf("'") && -1 === t.fontFamily.indexOf('"') ? "'" + t.fontFamily + "'" : t.fontFamily) + "; " : "", n = t.strokeWidth ? "stroke-width: " + t.strokeWidth + "; " : "", i = i, o = t.fontSize ? "font-size: " + t.fontSize + "px; " : "", r = t.fontStyle ? "font-style: " + t.fontStyle + "; " : "", a = t.fontWeight ? "font-weight: " + t.fontWeight + "; " : "", s = t.fill ? h("fill", t.fill) : "", l = t.stroke ? h("stroke", t.stroke) : "", c = this.getSvgTextDecoration(t); return [l, n, i, o, r, a, c = c && "text-decoration: " + c + "; ", s, t.deltaY ? "baseline-shift: " + -t.deltaY + "; " : "", e ? "white-space: pre; " : ""].join("") }, getSvgTextDecoration: function (e) { return ["overline", "underline", "line-through"].filter(function (t) { return e[t.replace("-", "")] }).join(" ") }, getSvgFilter: function () { return this.shadow ? "filter: url(#SVGID_" + this.shadow.id + ");" : "" }, getSvgCommons: function () { return [this.id ? 'id="' + this.id + '" ' : "", this.clipPath ? 'clip-path="url(#' + this.clipPath.clipPathId + ')" ' : ""].join("") }, getSvgTransform: function (t, e) { t = t ? this.calcTransformMatrix() : this.calcOwnMatrix(); return 'transform="' + fabric.util.matrixToSVG(t) + (e || "") + '" ' }, _setSVGBg: function (t) { var e; this.backgroundColor && (e = fabric.Object.NUM_FRACTION_DIGITS, t.push("\t\t<rect ", this._getFillAttributes(this.backgroundColor), ' x="', i(-this.width / 2, e), '" y="', i(-this.height / 2, e), '" width="', i(this.width, e), '" height="', i(this.height, e), '"></rect>\n')) }, toSVG: function (t) { return this._createBaseSVGMarkup(this._toSVG(t), { reviver: t }) }, toClipPathSVG: function (t) { return "\t" + this._createBaseClipPathSVGMarkup(this._toSVG(t), { reviver: t }) }, _createBaseClipPathSVGMarkup: function (t, e) { var i = (e = e || {}).reviver, n = e.additionalTransform || "", e = [this.getSvgTransform(!0, n), this.getSvgCommons()].join(""), n = t.indexOf("COMMON_PARTS"); return t[n] = e, i ? i(t.join("")) : t.join("") }, _createBaseSVGMarkup: function (t, e) { var i, n = (e = e || {}).noStyle, o = e.reviver, r = n ? "" : 'style="' + this.getSvgStyles() + '" ', a = e.withShadow ? 'style="' + this.getSvgFilter() + '" ' : "", s = this.clipPath, l = this.strokeUniform ? 'vector-effect="non-scaling-stroke" ' : "", c = s && s.absolutePositioned, d = this.stroke, h = this.fill, u = this.shadow, f = [], p = t.indexOf("COMMON_PARTS"), e = e.additionalTransform; return s && (s.clipPathId = "CLIPPATH_" + fabric.Object.__uid++ , i = '<clipPath id="' + s.clipPathId + '" >\n' + s.toClipPathSVG(o) + "</clipPath>\n"), c && f.push("<g ", a, this.getSvgCommons(), " >\n"), f.push("<g ", this.getSvgTransform(!1), c ? "" : a + this.getSvgCommons(), " >\n"), e = [r, l, n ? "" : this.addPaintOrder(), " ", e ? 'transform="' + e + '" ' : ""].join(""), t[p] = e, h && h.toLive && f.push(h.toSVG(this)), d && d.toLive && f.push(d.toSVG(this)), u && f.push(u.toSVG(this)), s && f.push(i), f.push(t.join("")), f.push("</g>\n"), c && f.push("</g>\n"), o ? o(f.join("")) : f.join("") }, addPaintOrder: function () { return "fill" !== this.paintFirst ? ' paint-order="' + this.paintFirst + '" ' : "" } }) }(), function () { var o = fabric.util.object.extend, n = "stateProperties"; function r(e, t, i) { var n = {}; i.forEach(function (t) { n[t] = e[t] }), o(e[t], n, !0) } fabric.util.object.extend(fabric.Object.prototype, { hasStateChanged: function (t) { var e = "_" + (t = t || n); return Object.keys(this[e]).length < this[t].length || !function t(e, i, n) { if (e === i) return 1; if (Array.isArray(e)) { if (Array.isArray(i) && e.length === i.length) { for (var o = 0, r = e.length; o < r; o++)if (!t(e[o], i[o])) return; return 1 } } else if (e && "object" == typeof e) { var a, s = Object.keys(e); if (i && "object" == typeof i && (n || s.length === Object.keys(i).length)) { for (o = 0, r = s.length; o < r; o++)if (a = s[o], "canvas" !== a && "group" !== a && !t(e[a], i[a])) return; return 1 } } }(this[e], this, !0) }, saveState: function (t) { var e = t && t.propertySet || n, i = "_" + e; return this[i] ? (r(this, i, this[e]), t && t.stateProperties && r(this, i, t.stateProperties), this) : this.setupState(t) }, setupState: function (t) { var e = (t = t || {}).propertySet || n; return this["_" + (t.propertySet = e)] = {}, this.saveState(t), this } }) }(), function () { var o = fabric.util.degreesToRadians; fabric.util.object.extend(fabric.Object.prototype, { _findTargetCorner: function (t, e) { if (!this.hasControls || this.group || !this.canvas || this.canvas._activeObject !== this) return !1; var i, n, o = t.x, r = t.y, a = Object.keys(this.oCoords), s = a.length - 1; for (this.__corner = 0; 0 <= s; s--)if (n = a[s], this.isControlVisible(n) && (i = this._getImageLines(e ? this.oCoords[n].touchCorner : this.oCoords[n].corner), 0 !== (i = this._findCrossPoints({ x: o, y: r }, i)) && i % 2 == 1)) return this.__corner = n; return !1 }, forEachControl: function (t) { for (var e in this.controls) t(this.controls[e], e, this) }, _setCornerCoords: function () { var t, e = this.oCoords; for (t in e) { var i = this.controls[t]; e[t].corner = i.calcCornerCoords(this.angle, this.cornerSize, e[t].x, e[t].y, !1), e[t].touchCorner = i.calcCornerCoords(this.angle, this.touchCornerSize, e[t].x, e[t].y, !0) } }, drawSelectionBackground: function (t) { if (!this.selectionBackgroundColor || this.canvas && !this.canvas.interactive || this.canvas && this.canvas._activeObject !== this) return this; t.save(); var e = this.getCenterPoint(), i = this._calculateCurrentDimensions(), n = this.canvas.viewportTransform; return t.translate(e.x, e.y), t.scale(1 / n[0], 1 / n[3]), t.rotate(o(this.angle)), t.fillStyle = this.selectionBackgroundColor, t.fillRect(-i.x / 2, -i.y / 2, i.x, i.y), t.restore(), this }, drawBorders: function (n, t) { t = t || {}; var e = this._calculateCurrentDimensions(), i = this.borderScaleFactor, o = e.x + i, r = e.y + i, i = (void 0 !== t.hasControls ? t : this).hasControls, a = !1; return n.save(), n.strokeStyle = t.borderColor || this.borderColor, this._setLineDash(n, t.borderDashArray || this.borderDashArray, null), n.strokeRect(-o / 2, -r / 2, o, r), i && (n.beginPath(), this.forEachControl(function (t, e, i) { t.withConnection && t.getVisibility(i, e) && (a = !0, n.moveTo(t.x * o, t.y * r), n.lineTo(t.x * o + t.offsetX, t.y * r + t.offsetY)) }), a && n.stroke()), n.restore(), this }, drawBordersInGroup: function (t, e, i) { i = i || {}; var n = fabric.util.sizeAfterTransform(this.width, this.height, e), o = this.strokeWidth, r = this.strokeUniform, a = this.borderScaleFactor, s = n.x + o * (r ? this.canvas.getZoom() : e.scaleX) + a, a = n.y + o * (r ? this.canvas.getZoom() : e.scaleY) + a; return t.save(), this._setLineDash(t, i.borderDashArray || this.borderDashArray, null), t.strokeStyle = i.borderColor || this.borderColor, t.strokeRect(-s / 2, -a / 2, s, a), t.restore(), this }, drawControls: function (n, o) { return o = o || {}, n.save(), n.setTransform(this.canvas.getRetinaScaling(), 0, 0, this.canvas.getRetinaScaling(), 0, 0), n.strokeStyle = n.fillStyle = o.cornerColor || this.cornerColor, this.transparentCorners || (n.strokeStyle = o.cornerStrokeColor || this.cornerStrokeColor), this._setLineDash(n, o.cornerDashArray || this.cornerDashArray, null), this.setCoords(), this.forEachControl(function (t, e, i) { t.getVisibility(i, e) && t.render(n, i.oCoords[e].x, i.oCoords[e].y, o, i) }), n.restore(), this }, isControlVisible: function (t) { return this.controls[t] && this.controls[t].getVisibility(this, t) }, setControlVisible: function (t, e) { return this._controlsVisibility || (this._controlsVisibility = {}), this._controlsVisibility[t] = e, this }, setControlsVisibility: function (t) { for (var e in t = t || {}) this.setControlVisible(e, t[e]); return this }, onDeselect: function () { }, onSelect: function () { } }) }(), fabric.util.object.extend(fabric.StaticCanvas.prototype, { FX_DURATION: 500, fxCenterObjectH: function (e, t) { function i() { } var n = (t = t || {}).onComplete || i, o = t.onChange || i, r = this; return fabric.util.animate({ startValue: e.left, endValue: this.getCenter().left, duration: this.FX_DURATION, onChange: function (t) { e.set("left", t), r.requestRenderAll(), o() }, onComplete: function () { e.setCoords(), n() } }), this }, fxCenterObjectV: function (e, t) { function i() { } var n = (t = t || {}).onComplete || i, o = t.onChange || i, r = this; return fabric.util.animate({ startValue: e.top, endValue: this.getCenter().top, duration: this.FX_DURATION, onChange: function (t) { e.set("top", t), r.requestRenderAll(), o() }, onComplete: function () { e.setCoords(), n() } }), this }, fxRemove: function (e, t) { function i() { } var n = (t = t || {}).onComplete || i, o = t.onChange || i, r = this; return fabric.util.animate({ startValue: e.opacity, endValue: 0, duration: this.FX_DURATION, onChange: function (t) { e.set("opacity", t), r.requestRenderAll(), o() }, onComplete: function () { r.remove(e), n() } }), this } }), fabric.util.object.extend(fabric.Object.prototype, { animate: function () { if (arguments[0] && "object" == typeof arguments[0]) { var t, e, i = []; for (t in arguments[0]) i.push(t); for (var n = 0, o = i.length; n < o; n++)t = i[n], e = n !== o - 1, this._animate(t, arguments[0][t], arguments[1], e) } else this._animate.apply(this, arguments); return this }, _animate: function (n, t, o, r) { var a, s = this; t = t.toString(), o = o ? fabric.util.object.clone(o) : {}, ~n.indexOf(".") && (a = n.split(".")); var e = -1 < s.colorProperties.indexOf(n) || a && -1 < s.colorProperties.indexOf(a[1]), i = a ? this.get(a[0])[a[1]] : this.get(n); "from" in o || (o.from = i), e || (t = ~t.indexOf("=") ? i + parseFloat(t.replace("=", "")) : parseFloat(t)); t = { startValue: o.from, endValue: t, byValue: o.by, easing: o.easing, duration: o.duration, abort: o.abort && function () { return o.abort.call(s) }, onChange: function (t, e, i) { a ? s[a[0]][a[1]] = t : s.set(n, t), r || o.onChange && o.onChange(t, e, i) }, onComplete: function (t, e, i) { r || (s.setCoords(), o.onComplete && o.onComplete(t, e, i)) } }; e ? fabric.util.animateColor(t.startValue, t.endValue, t.duration, t) : fabric.util.animate(t) } }), function (t) { "use strict"; var o = t.fabric || (t.fabric = {}), r = o.util.object.extend, n = o.util.object.clone, i = { x1: 1, x2: 1, y1: 1, y2: 1 }, a = o.StaticCanvas.supports("setLineDash"); function e(t, e) { var i = t.origin, n = t.axis1, o = t.axis2, r = t.dimension, a = e.nearest, s = e.center, l = e.farthest; return function () { switch (this.get(i)) { case a: return Math.min(this.get(n), this.get(o)); case s: return Math.min(this.get(n), this.get(o)) + .5 * this.get(r); case l: return Math.max(this.get(n), this.get(o)) } } } o.Line ? o.warn("fabric.Line is already defined") : (o.Line = o.util.createClass(o.Object, { type: "line", x1: 0, y1: 0, x2: 0, y2: 0, cacheProperties: o.Object.prototype.cacheProperties.concat("x1", "x2", "y1", "y2"), initialize: function (t, e) { t = t || [0, 0, 0, 0], this.callSuper("initialize", e), this.set("x1", t[0]), this.set("y1", t[1]), this.set("x2", t[2]), this.set("y2", t[3]), this._setWidthHeight(e) }, _setWidthHeight: function (t) { t = t || {}, this.width = Math.abs(this.x2 - this.x1), this.height = Math.abs(this.y2 - this.y1), this.left = "left" in t ? t.left : this._getLeftToOriginX(), this.top = "top" in t ? t.top : this._getTopToOriginY() }, _set: function (t, e) { return this.callSuper("_set", t, e), void 0 !== i[t] && this._setWidthHeight(), this }, _getLeftToOriginX: e({ origin: "originX", axis1: "x1", axis2: "x2", dimension: "width" }, { nearest: "left", center: "center", farthest: "right" }), _getTopToOriginY: e({ origin: "originY", axis1: "y1", axis2: "y2", dimension: "height" }, { nearest: "top", center: "center", farthest: "bottom" }), _render: function (t) { t.beginPath(), (!this.strokeDashArray || this.strokeDashArray && a) && (e = this.calcLinePoints(), t.moveTo(e.x1, e.y1), t.lineTo(e.x2, e.y2)), t.lineWidth = this.strokeWidth; var e = t.strokeStyle; t.strokeStyle = this.stroke || t.fillStyle, this.stroke && this._renderStroke(t), t.strokeStyle = e }, _renderDashedStroke: function (t) { var e = this.calcLinePoints(); t.beginPath(), o.util.drawDashedLine(t, e.x1, e.y1, e.x2, e.y2, this.strokeDashArray), t.closePath() }, _findCenterFromElement: function () { return { x: (this.x1 + this.x2) / 2, y: (this.y1 + this.y2) / 2 } }, toObject: function (t) { return r(this.callSuper("toObject", t), this.calcLinePoints()) }, _getNonTransformedDimensions: function () { var t = this.callSuper("_getNonTransformedDimensions"); return "butt" === this.strokeLineCap && (0 === this.width && (t.y -= this.strokeWidth), 0 === this.height && (t.x -= this.strokeWidth)), t }, calcLinePoints: function () { var t = this.x1 <= this.x2 ? -1 : 1, e = this.y1 <= this.y2 ? -1 : 1, i = t * this.width * .5, n = e * this.height * .5; return { x1: i, x2: t * this.width * -.5, y1: n, y2: e * this.height * -.5 } }, _toSVG: function () { var t = this.calcLinePoints(); return ["<line ", "COMMON_PARTS", 'x1="', t.x1, '" y1="', t.y1, '" x2="', t.x2, '" y2="', t.y2, '" />\n'] } }), o.Line.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")), o.Line.fromElement = function (t, e, i) { i = i || {}; var n = o.parseAttributes(t, o.Line.ATTRIBUTE_NAMES), t = [n.x1 || 0, n.y1 || 0, n.x2 || 0, n.y2 || 0]; e(new o.Line(t, r(n, i))) }, o.Line.fromObject = function (t, e) { var i = n(t, !0); i.points = [t.x1, t.y1, t.x2, t.y2], o.Object._fromObject("Line", i, function (t) { delete t.points, e && e(t) }, "points") }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var r = t.fabric || (t.fabric = {}), a = Math.PI; r.Circle ? r.warn("fabric.Circle is already defined.") : (r.Circle = r.util.createClass(r.Object, { type: "circle", radius: 0, startAngle: 0, endAngle: 2 * a, cacheProperties: r.Object.prototype.cacheProperties.concat("radius", "startAngle", "endAngle"), _set: function (t, e) { return this.callSuper("_set", t, e), "radius" === t && this.setRadius(e), this }, toObject: function (t) { return this.callSuper("toObject", ["radius", "startAngle", "endAngle"].concat(t)) }, _toSVG: function () { var t, e, i, n, o = (this.endAngle - this.startAngle) % (2 * a); return 0 == o ? ["<circle ", "COMMON_PARTS", 'cx="0" cy="0" ', 'r="', this.radius, '" />\n'] : (t = r.util.cos(this.startAngle) * this.radius, e = r.util.sin(this.startAngle) * this.radius, i = r.util.cos(this.endAngle) * this.radius, n = r.util.sin(this.endAngle) * this.radius, o = a < o ? "1" : "0", ['<path d="M ' + t + " " + e, " A " + this.radius + " " + this.radius, " 0 ", +o + " 1", " " + i + " " + n, '" ', "COMMON_PARTS", " />\n"]) }, _render: function (t) { t.beginPath(), t.arc(0, 0, this.radius, this.startAngle, this.endAngle, !1), this._renderPaintInOrder(t) }, getRadiusX: function () { return this.get("radius") * this.get("scaleX") }, getRadiusY: function () { return this.get("radius") * this.get("scaleY") }, setRadius: function (t) { return this.radius = t, this.set("width", 2 * t).set("height", 2 * t) } }), r.Circle.ATTRIBUTE_NAMES = r.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")), r.Circle.fromElement = function (t, e) { var i = r.parseAttributes(t, r.Circle.ATTRIBUTE_NAMES); if (!("radius" in (t = i) && 0 <= t.radius)) throw new Error("value of `r` attribute is required and can not be negative"); i.left = (i.left || 0) - i.radius, i.top = (i.top || 0) - i.radius, e(new r.Circle(i)) }, r.Circle.fromObject = function (t, e) { return r.Object._fromObject("Circle", t, e) }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var n = t.fabric || (t.fabric = {}); n.Triangle ? n.warn("fabric.Triangle is already defined") : (n.Triangle = n.util.createClass(n.Object, { type: "triangle", width: 100, height: 100, _render: function (t) { var e = this.width / 2, i = this.height / 2; t.beginPath(), t.moveTo(-e, i), t.lineTo(0, -i), t.lineTo(e, i), t.closePath(), this._renderPaintInOrder(t) }, _renderDashedStroke: function (t) { var e = this.width / 2, i = this.height / 2; t.beginPath(), n.util.drawDashedLine(t, -e, i, 0, -i, this.strokeDashArray), n.util.drawDashedLine(t, 0, -i, e, i, this.strokeDashArray), n.util.drawDashedLine(t, e, i, -e, i, this.strokeDashArray), t.closePath() }, _toSVG: function () { var t = this.width / 2, e = this.height / 2; return ["<polygon ", "COMMON_PARTS", 'points="', [-t + " " + e, "0 " + -e, t + " " + e].join(","), '" />'] } }), n.Triangle.fromObject = function (t, e) { return n.Object._fromObject("Triangle", t, e) }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var i = t.fabric || (t.fabric = {}), e = 2 * Math.PI; i.Ellipse ? i.warn("fabric.Ellipse is already defined.") : (i.Ellipse = i.util.createClass(i.Object, { type: "ellipse", rx: 0, ry: 0, cacheProperties: i.Object.prototype.cacheProperties.concat("rx", "ry"), initialize: function (t) { this.callSuper("initialize", t), this.set("rx", t && t.rx || 0), this.set("ry", t && t.ry || 0) }, _set: function (t, e) { switch (this.callSuper("_set", t, e), t) { case "rx": this.rx = e, this.set("width", 2 * e); break; case "ry": this.ry = e, this.set("height", 2 * e) }return this }, getRx: function () { return this.get("rx") * this.get("scaleX") }, getRy: function () { return this.get("ry") * this.get("scaleY") }, toObject: function (t) { return this.callSuper("toObject", ["rx", "ry"].concat(t)) }, _toSVG: function () { return ["<ellipse ", "COMMON_PARTS", 'cx="0" cy="0" ', 'rx="', this.rx, '" ry="', this.ry, '" />\n'] }, _render: function (t) { t.beginPath(), t.save(), t.transform(1, 0, 0, this.ry / this.rx, 0, 0), t.arc(0, 0, this.rx, 0, e, !1), t.restore(), this._renderPaintInOrder(t) } }), i.Ellipse.ATTRIBUTE_NAMES = i.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")), i.Ellipse.fromElement = function (t, e) { t = i.parseAttributes(t, i.Ellipse.ATTRIBUTE_NAMES); t.left = (t.left || 0) - t.rx, t.top = (t.top || 0) - t.ry, e(new i.Ellipse(t)) }, i.Ellipse.fromObject = function (t, e) { return i.Object._fromObject("Ellipse", t, e) }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var r = t.fabric || (t.fabric = {}), n = r.util.object.extend; r.Rect ? r.warn("fabric.Rect is already defined") : (r.Rect = r.util.createClass(r.Object, { stateProperties: r.Object.prototype.stateProperties.concat("rx", "ry"), type: "rect", rx: 0, ry: 0, cacheProperties: r.Object.prototype.cacheProperties.concat("rx", "ry"), initialize: function (t) { this.callSuper("initialize", t), this._initRxRy() }, _initRxRy: function () { this.rx && !this.ry ? this.ry = this.rx : this.ry && !this.rx && (this.rx = this.ry) }, _render: function (t) { var e = this.rx ? Math.min(this.rx, this.width / 2) : 0, i = this.ry ? Math.min(this.ry, this.height / 2) : 0, n = this.width, o = this.height, r = -this.width / 2, a = -this.height / 2, s = 0 !== e || 0 !== i, l = .4477152502; t.beginPath(), t.moveTo(r + e, a), t.lineTo(r + n - e, a), s && t.bezierCurveTo(r + n - l * e, a, r + n, a + l * i, r + n, a + i), t.lineTo(r + n, a + o - i), s && t.bezierCurveTo(r + n, a + o - l * i, r + n - l * e, a + o, r + n - e, a + o), t.lineTo(r + e, a + o), s && t.bezierCurveTo(r + l * e, a + o, r, a + o - l * i, r, a + o - i), t.lineTo(r, a + i), s && t.bezierCurveTo(r, a + l * i, r + l * e, a, r + e, a), t.closePath(), this._renderPaintInOrder(t) }, _renderDashedStroke: function (t) { var e = -this.width / 2, i = -this.height / 2, n = this.width, o = this.height; t.beginPath(), r.util.drawDashedLine(t, e, i, e + n, i, this.strokeDashArray), r.util.drawDashedLine(t, e + n, i, e + n, i + o, this.strokeDashArray), r.util.drawDashedLine(t, e + n, i + o, e, i + o, this.strokeDashArray), r.util.drawDashedLine(t, e, i + o, e, i, this.strokeDashArray), t.closePath() }, toObject: function (t) { return this.callSuper("toObject", ["rx", "ry"].concat(t)) }, _toSVG: function () { return ["<rect ", "COMMON_PARTS", 'x="', -this.width / 2, '" y="', -this.height / 2, '" rx="', this.rx, '" ry="', this.ry, '" width="', this.width, '" height="', this.height, '" />\n'] } }), r.Rect.ATTRIBUTE_NAMES = r.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")), r.Rect.fromElement = function (t, e, i) { if (!t) return e(null); i = i || {}; t = r.parseAttributes(t, r.Rect.ATTRIBUTE_NAMES); t.left = t.left || 0, t.top = t.top || 0, t.height = t.height || 0, t.width = t.width || 0; t = new r.Rect(n(i ? r.util.object.clone(i) : {}, t)); t.visible = t.visible && 0 < t.width && 0 < t.height, e(t) }, r.Rect.fromObject = function (t, e) { return r.Object._fromObject("Rect", t, e) }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var a = t.fabric || (t.fabric = {}), r = a.util.object.extend, n = a.util.array.min, o = a.util.array.max, s = a.util.toFixed; a.Polyline ? a.warn("fabric.Polyline is already defined") : (a.Polyline = a.util.createClass(a.Object, { type: "polyline", points: null, cacheProperties: a.Object.prototype.cacheProperties.concat("points"), initialize: function (t, e) { e = e || {}, this.points = t || [], this.callSuper("initialize", e), this._setPositionDimensions(e) }, _setPositionDimensions: function (t) { var e, i = this._calcDimensions(t); this.width = i.width, this.height = i.height, t.fromSVG || (e = this.translateToGivenOrigin({ x: i.left - this.strokeWidth / 2, y: i.top - this.strokeWidth / 2 }, "left", "top", this.originX, this.originY)), void 0 === t.left && (this.left = t.fromSVG ? i.left : e.x), void 0 === t.top && (this.top = t.fromSVG ? i.top : e.y), this.pathOffset = { x: i.left + this.width / 2, y: i.top + this.height / 2 } }, _calcDimensions: function () { var t = this.points, e = n(t, "x") || 0, i = n(t, "y") || 0; return { left: e, top: i, width: (o(t, "x") || 0) - e, height: (o(t, "y") || 0) - i } }, toObject: function (t) { return r(this.callSuper("toObject", t), { points: this.points.concat() }) }, _toSVG: function () { for (var t = [], e = this.pathOffset.x, i = this.pathOffset.y, n = a.Object.NUM_FRACTION_DIGITS, o = 0, r = this.points.length; o < r; o++)t.push(s(this.points[o].x - e, n), ",", s(this.points[o].y - i, n), " "); return ["<" + this.type + " ", "COMMON_PARTS", 'points="', t.join(""), '" />\n'] }, commonRender: function (t) { var e, i = this.points.length, n = this.pathOffset.x, o = this.pathOffset.y; if (!i || isNaN(this.points[i - 1].y)) return !1; t.beginPath(), t.moveTo(this.points[0].x - n, this.points[0].y - o); for (var r = 0; r < i; r++)e = this.points[r], t.lineTo(e.x - n, e.y - o); return !0 }, _render: function (t) { this.commonRender(t) && this._renderPaintInOrder(t) }, _renderDashedStroke: function (t) { var e, i; t.beginPath(); for (var n = 0, o = this.points.length; n < o; n++)e = this.points[n], i = this.points[n + 1] || e, a.util.drawDashedLine(t, e.x, e.y, i.x, i.y, this.strokeDashArray) }, complexity: function () { return this.get("points").length } }), a.Polyline.ATTRIBUTE_NAMES = a.SHARED_ATTRIBUTES.concat(), a.Polyline.fromElementGenerator = function (o) { return function (t, e, i) { if (!t) return e(null); i = i || {}; var n = a.parsePointsAttribute(t.getAttribute("points")), t = a.parseAttributes(t, a[o].ATTRIBUTE_NAMES); t.fromSVG = !0, e(new a[o](n, r(t, i))) } }, a.Polyline.fromElement = a.Polyline.fromElementGenerator("Polyline"), a.Polyline.fromObject = function (t, e) { return a.Object._fromObject("Polyline", t, e, "points") }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var i = t.fabric || (t.fabric = {}); i.Polygon ? i.warn("fabric.Polygon is already defined") : (i.Polygon = i.util.createClass(i.Polyline, { type: "polygon", _render: function (t) { this.commonRender(t) && (t.closePath(), this._renderPaintInOrder(t)) }, _renderDashedStroke: function (t) { this.callSuper("_renderDashedStroke", t), t.closePath() } }), i.Polygon.ATTRIBUTE_NAMES = i.SHARED_ATTRIBUTES.concat(), i.Polygon.fromElement = i.Polyline.fromElementGenerator("Polygon"), i.Polygon.fromObject = function (t, e) { return i.Object._fromObject("Polygon", t, e, "points") }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var u = t.fabric || (t.fabric = {}), f = u.util.array.min, p = u.util.array.max, n = u.util.object.extend, o = Object.prototype.toString, e = u.util.toFixed; u.Path ? u.warn("fabric.Path is already defined") : (u.Path = u.util.createClass(u.Object, { type: "path", path: null, cacheProperties: u.Object.prototype.cacheProperties.concat("path", "fillRule"), stateProperties: u.Object.prototype.stateProperties.concat("path"), initialize: function (t, e) { e = e || {}, this.callSuper("initialize", e), t = t || []; var i = "[object Array]" === o.call(t); this.path = i ? u.util.makePathSimpler(t) : u.util.makePathSimpler(u.util.parsePath(t)), this.path && u.Polyline.prototype._setPositionDimensions.call(this, e) }, _renderPathCommands: function (t) { var e, i = 0, n = 0, o = 0, r = 0, a = 0, s = 0, l = -this.pathOffset.x, c = -this.pathOffset.y; t.beginPath(); for (var d = 0, h = this.path.length; d < h; ++d)switch ((e = this.path[d])[0]) { case "L": o = e[1], r = e[2], t.lineTo(o + l, r + c); break; case "M": i = o = e[1], n = r = e[2], t.moveTo(o + l, r + c); break; case "C": o = e[5], r = e[6], a = e[3], s = e[4], t.bezierCurveTo(e[1] + l, e[2] + c, a + l, s + c, o + l, r + c); break; case "Q": t.quadraticCurveTo(e[1] + l, e[2] + c, e[3] + l, e[4] + c), o = e[3], r = e[4], a = e[1], s = e[2]; break; case "z": case "Z": o = i, r = n, t.closePath() } }, _render: function (t) { this._renderPathCommands(t), this._renderPaintInOrder(t) }, toString: function () { return "#<fabric.Path (" + this.complexity() + '): { "top": ' + this.top + ', "left": ' + this.left + " }>" }, toObject: function (t) { return n(this.callSuper("toObject", t), { path: this.path.map(function (t) { return t.slice() }) }) }, toDatalessObject: function (t) { t = this.toObject(["sourcePath"].concat(t)); return t.sourcePath && delete t.path, t }, _toSVG: function () { return ["<path ", "COMMON_PARTS", 'd="', this.path.map(function (t) { return t.join(" ") }).join(" "), '" stroke-linecap="round" ', "/>\n"] }, _getOffsetTransform: function () { var t = u.Object.NUM_FRACTION_DIGITS; return " translate(" + e(-this.pathOffset.x, t) + ", " + e(-this.pathOffset.y, t) + ")" }, toClipPathSVG: function (t) { var e = this._getOffsetTransform(); return "\t" + this._createBaseClipPathSVGMarkup(this._toSVG(), { reviver: t, additionalTransform: e }) }, toSVG: function (t) { var e = this._getOffsetTransform(); return this._createBaseSVGMarkup(this._toSVG(), { reviver: t, additionalTransform: e }) }, complexity: function () { return this.path.length }, _calcDimensions: function () { for (var t, e, i = [], n = [], o = 0, r = 0, a = 0, s = 0, l = 0, c = this.path.length; l < c; ++l){ switch ((t = this.path[l])[0]) { case "L": a = t[1], s = t[2], e = []; break; case "M": o = a = t[1], r = s = t[2], e = []; break; case "C": e = u.util.getBoundsOfCurve(a, s, t[1], t[2], t[3], t[4], t[5], t[6]), a = t[5], s = t[6]; break; case "Q": e = u.util.getBoundsOfCurve(a, s, t[1], t[2], t[1], t[2], t[3], t[4]), a = t[3], s = t[4]; break; case "z": case "Z": a = o, s = r }e.forEach(function (t) { i.push(t.x), n.push(t.y) }), i.push(a), n.push(s) } var d = f(i) || 0, h = f(n) || 0; return { left: d, top: h, width: (p(i) || 0) - d, height: (p(n) || 0) - h } } }), u.Path.fromObject = function (e, i) { var t; "string" == typeof e.sourcePath ? (t = e.sourcePath, u.loadSVGFromURL(t, function (t) { t = t[0]; t.setOptions(e), i && i(t) })) : u.Object._fromObject("Path", e, i, "path") }, u.Path.ATTRIBUTE_NAMES = u.SHARED_ATTRIBUTES.concat(["d"]), u.Path.fromElement = function (t, e, i) { t = u.parseAttributes(t, u.Path.ATTRIBUTE_NAMES); t.fromSVG = !0, e(new u.Path(t.d, n(t, i))) }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var a = t.fabric || (t.fabric = {}), s = a.util.array.min, l = a.util.array.max; a.Group || (a.Group = a.util.createClass(a.Object, a.Collection, { type: "group", strokeWidth: 0, subTargetCheck: !1, cacheProperties: [], useSetOnGroup: !1, initialize: function (t, e, i) { e = e || {}, this._objects = [], i && this.callSuper("initialize", e), this._objects = t || []; for (var n = this._objects.length; n--;)this._objects[n].group = this; i ? this._updateObjectsACoords() : (i = e && e.centerPoint, void 0 !== e.originX && (this.originX = e.originX), void 0 !== e.originY && (this.originY = e.originY), i || this._calcBounds(), this._updateObjectsCoords(i), delete e.centerPoint, this.callSuper("initialize", e)), this.setCoords() }, _updateObjectsACoords: function () { for (var t = this._objects.length; t--;)this._objects[t].setCoords(!0) }, _updateObjectsCoords: function (t) { for (var t = t || this.getCenterPoint(), e = this._objects.length; e--;)this._updateObjectCoords(this._objects[e], t) }, _updateObjectCoords: function (t, e) { var i = t.left, n = t.top; t.set({ left: i - e.x, top: n - e.y }), t.group = this, t.setCoords(!0) }, toString: function () { return "#<fabric.Group: (" + this.complexity() + ")>" }, addWithUpdate: function (t) { return this._restoreObjectsState(), a.util.resetObjectTransform(this), t && (this._objects.push(t), t.group = this, t._set("canvas", this.canvas)), this._calcBounds(), this._updateObjectsCoords(), this.setCoords(), this.dirty = !0, this }, removeWithUpdate: function (t) { return this._restoreObjectsState(), a.util.resetObjectTransform(this), this.remove(t), this._calcBounds(), this._updateObjectsCoords(), this.setCoords(), this.dirty = !0, this }, _onObjectAdded: function (t) { this.dirty = !0, t.group = this, t._set("canvas", this.canvas) }, _onObjectRemoved: function (t) { this.dirty = !0, delete t.group }, _set: function (t, e) { var i = this._objects.length; if (this.useSetOnGroup) for (; i--;)this._objects[i].setOnGroup(t, e); if ("canvas" === t) for (; i--;)this._objects[i]._set(t, e); a.Object.prototype._set.call(this, t, e) }, toObject: function (n) { var o = this.includeDefaultValues, t = this._objects.map(function (t) { var e = t.includeDefaultValues; t.includeDefaultValues = o; var i = t.toObject(n); return t.includeDefaultValues = e, i }), e = a.Object.prototype.toObject.call(this, n); return e.objects = t, e }, toDatalessObject: function (n) { var o, t, e = this.sourcePath; t = e || (o = this.includeDefaultValues, this._objects.map(function (t) { var e = t.includeDefaultValues; t.includeDefaultValues = o; var i = t.toDatalessObject(n); return t.includeDefaultValues = e, i })); e = a.Object.prototype.toDatalessObject.call(this, n); return e.objects = t, e }, render: function (t) { this._transformDone = !0, this.callSuper("render", t), this._transformDone = !1 }, shouldCache: function () { var t = a.Object.prototype.shouldCache.call(this); if (t) for (var e = 0, i = this._objects.length; e < i; e++)if (this._objects[e].willDrawShadow()) return this.ownCaching = !1; return t }, willDrawShadow: function () { if (a.Object.prototype.willDrawShadow.call(this)) return !0; for (var t = 0, e = this._objects.length; t < e; t++)if (this._objects[t].willDrawShadow()) return !0; return !1 }, isOnACache: function () { return this.ownCaching || this.group && this.group.isOnACache() }, drawObject: function (t) { for (var e = 0, i = this._objects.length; e < i; e++)this._objects[e].render(t); this._drawClipPath(t) }, isCacheDirty: function (t) { if (this.callSuper("isCacheDirty", t)) return !0; if (!this.statefullCache) return !1; for (var e, i, n = 0, o = this._objects.length; n < o; n++)if (this._objects[n].isCacheDirty(!0)) return this._cacheCanvas && (e = this.cacheWidth / this.zoomX, i = this.cacheHeight / this.zoomY, this._cacheContext.clearRect(-e / 2, -i / 2, e, i)), !0; return !1 }, _restoreObjectsState: function () { return this._objects.forEach(this._restoreObjectState, this), this }, realizeTransform: function (t) { var e = t.calcTransformMatrix(), i = a.util.qrDecompose(e), e = new a.Point(i.translateX, i.translateY); return t.flipX = !1, t.flipY = !1, t.set("scaleX", i.scaleX), t.set("scaleY", i.scaleY), t.skewX = i.skewX, t.skewY = i.skewY, t.angle = i.angle, t.setPositionByOrigin(e, "center", "center"), t }, _restoreObjectState: function (t) { return this.realizeTransform(t), delete t.group, t.setCoords(), this }, destroy: function () { return this._objects.forEach(function (t) { t.set("dirty", !0) }), this._restoreObjectsState() }, toActiveSelection: function () { if (this.canvas) { var t = this._objects, e = this.canvas; this._objects = []; var i = this.toObject(); delete i.objects; var n = new a.ActiveSelection([]); return n.set(i), n.type = "activeSelection", e.remove(this), t.forEach(function (t) { t.group = n, t.dirty = !0, e.add(t) }), n.canvas = e, n._objects = t, (e._activeObject = n).setCoords(), n } }, ungroupOnCanvas: function () { return this._restoreObjectsState() }, setObjectsCoords: function () { return this.forEachObject(function (t) { t.setCoords(!0) }), this }, _calcBounds: function (t) { for (var e, i, n, o = [], r = [], a = ["tr", "br", "bl", "tl"], s = 0, l = this._objects.length, c = a.length; s < l; ++s)for ((e = this._objects[s]).aCoords = e.calcACoords(), n = 0; n < c; n++)i = a[n], o.push(e.aCoords[i].x), r.push(e.aCoords[i].y); this._getBounds(o, r, t) }, _getBounds: function (t, e, i) { var n = new a.Point(s(t), s(e)), o = new a.Point(l(t), l(e)), r = n.y || 0, t = n.x || 0, e = o.x - n.x || 0, n = o.y - n.y || 0; this.width = e, this.height = n, i || this.setPositionByOrigin({ x: t, y: r }, "left", "top") }, _toSVG: function (t) { for (var e = ["<g ", "COMMON_PARTS", " >\n"], i = 0, n = this._objects.length; i < n; i++)e.push("\t\t", this._objects[i].toSVG(t)); return e.push("</g>\n"), e }, getSvgStyles: function () { var t = void 0 !== this.opacity && 1 !== this.opacity ? "opacity: " + this.opacity + ";" : "", e = this.visible ? "" : " visibility: hidden;"; return [t, this.getSvgFilter(), e].join("") }, toClipPathSVG: function (t) { for (var e = [], i = 0, n = this._objects.length; i < n; i++)e.push("\t", this._objects[i].toClipPathSVG(t)); return this._createBaseClipPathSVGMarkup(e, { reviver: t }) } }), a.Group.fromObject = function (n, o) { var e = n.objects, i = a.util.object.clone(n, !0); delete i.objects, "string" != typeof e ? a.util.enlivenObjects(e, function (i) { a.util.enlivenObjects([n.clipPath], function (t) { var e = a.util.object.clone(n, !0); e.clipPath = t[0], delete e.objects, o && o(new a.Group(i, e, !0)) }) }) : a.loadSVGFromURL(e, function (t) { t = a.util.groupSVGElements(t, n, e); t.set(i), o && o(t) }) }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var n = t.fabric || (t.fabric = {}); n.ActiveSelection || (n.ActiveSelection = n.util.createClass(n.Group, { type: "activeSelection", initialize: function (t, e) { e = e || {}, this._objects = t || []; for (var i = this._objects.length; i--;)this._objects[i].group = this; e.originX && (this.originX = e.originX), e.originY && (this.originY = e.originY), this._calcBounds(), this._updateObjectsCoords(), n.Object.prototype.initialize.call(this, e), this.setCoords() }, toGroup: function () { var t = this._objects.concat(); this._objects = []; var e = n.Object.prototype.toObject.call(this), i = new n.Group([]); if (delete e.type, i.set(e), t.forEach(function (t) { t.canvas.remove(t), t.group = i }), i._objects = t, !this.canvas) return i; t = this.canvas; return t.add(i), (t._activeObject = i).setCoords(), i }, onDeselect: function () { return this.destroy(), !1 }, toString: function () { return "#<fabric.ActiveSelection: (" + this.complexity() + ")>" }, shouldCache: function () { return !1 }, isOnACache: function () { return !1 }, _renderControls: function (t, e, i) { t.save(), t.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1, this.callSuper("_renderControls", t, e), void 0 === (i = i || {}).hasControls && (i.hasControls = !1), i.forActiveSelection = !0; for (var n = 0, o = this._objects.length; n < o; n++)this._objects[n]._renderControls(t, i); t.restore() } }), n.ActiveSelection.fromObject = function (e, i) { n.util.enlivenObjects(e.objects, function (t) { delete e.objects, i && i(new n.ActiveSelection(t, e, !0)) }) }) }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var n = fabric.util.object.extend; t.fabric || (t.fabric = {}), t.fabric.Image ? fabric.warn("fabric.Image is already defined.") : (fabric.Image = fabric.util.createClass(fabric.Object, { type: "image", strokeWidth: 0, srcFromAttribute: !1, _lastScaleX: 1, _lastScaleY: 1, _filterScalingX: 1, _filterScalingY: 1, minimumScaleTrigger: .5, stateProperties: fabric.Object.prototype.stateProperties.concat("cropX", "cropY"), cacheKey: "", cropX: 0, cropY: 0, imageSmoothing: !0, initialize: function (t, e) { e = e || {}, this.filters = [], this.cacheKey = "texture" + fabric.Object.__uid++ , this.callSuper("initialize", e), this._initElement(t, e) }, getElement: function () { return this._element || {} }, setElement: function (t, e) { return this.removeTexture(this.cacheKey), this.removeTexture(this.cacheKey + "_filtered"), this._element = t, this._originalElement = t, this._initConfig(e), 0 !== this.filters.length && this.applyFilters(), this.resizeFilter && this.applyResizeFilters(), this }, removeTexture: function (t) { var e = fabric.filterBackend; e && e.evictCachesForKey && e.evictCachesForKey(t) }, dispose: function () { this.removeTexture(this.cacheKey), this.removeTexture(this.cacheKey + "_filtered"), this._cacheContext = void 0, ["_originalElement", "_element", "_filteredEl", "_cacheCanvas"].forEach(function (t) { fabric.util.cleanUpJsdomNode(this[t]), this[t] = void 0 }.bind(this)) }, getCrossOrigin: function () { return this._originalElement && (this._originalElement.crossOrigin || null) }, getOriginalSize: function () { var t = this.getElement(); return { width: t.naturalWidth || t.width, height: t.naturalHeight || t.height } }, _stroke: function (t) { var e, i; this.stroke && 0 !== this.strokeWidth && (e = this.width / 2, i = this.height / 2, t.beginPath(), t.moveTo(-e, -i), t.lineTo(e, -i), t.lineTo(e, i), t.lineTo(-e, i), t.lineTo(-e, -i), t.closePath()) }, _renderDashedStroke: function (t) { var e = -this.width / 2, i = -this.height / 2, n = this.width, o = this.height; t.save(), this._setStrokeStyles(t, this), t.beginPath(), fabric.util.drawDashedLine(t, e, i, e + n, i, this.strokeDashArray), fabric.util.drawDashedLine(t, e + n, i, e + n, i + o, this.strokeDashArray), fabric.util.drawDashedLine(t, e + n, i + o, e, i + o, this.strokeDashArray), fabric.util.drawDashedLine(t, e, i + o, e, i, this.strokeDashArray), t.closePath(), t.restore() }, toObject: function (t) { var e = []; this.filters.forEach(function (t) { t && e.push(t.toObject()) }); t = n(this.callSuper("toObject", ["cropX", "cropY"].concat(t)), { src: this.getSrc(), crossOrigin: this.getCrossOrigin(), filters: e }); return this.resizeFilter && (t.resizeFilter = this.resizeFilter.toObject()), t }, hasCrop: function () { return this.cropX || this.cropY || this.width < this._element.width || this.height < this._element.height }, _toSVG: function () { var t, e, i = [], n = [], o = this._element, r = -this.width / 2, a = -this.height / 2, s = "", l = ""; return o ? (this.hasCrop() && (e = fabric.Object.__uid++ , i.push('<clipPath id="imageCrop_' + e + '">\n', '\t<rect x="' + r + '" y="' + a + '" width="' + this.width + '" height="' + this.height + '" />\n', "</clipPath>\n"), s = ' clip-path="url(#imageCrop_' + e + ')" '), this.imageSmoothing || (l = '" image-rendering="optimizeSpeed'), n.push("\t<image ", "COMMON_PARTS", 'xlink:href="', this.getSvgSrc(!0), '" x="', r - this.cropX, '" y="', a - this.cropY, '" width="', o.width || o.naturalWidth, '" height="', o.height || o.height, l, '"', s, "></image>\n"), (this.stroke || this.strokeDashArray) && (s = this.fill, this.fill = null, t = ["\t<rect ", 'x="', r, '" y="', a, '" width="', this.width, '" height="', this.height, '" style="', this.getSvgStyles(), '"/>\n'], this.fill = s), i = "fill" !== this.paintFirst ? i.concat(t, n) : i.concat(n, t)) : [] }, getSrc: function (t) { t = t ? this._element : this._originalElement; return t ? t.toDataURL ? t.toDataURL() : this.srcFromAttribute ? t.getAttribute("src") : t.src : this.src || "" }, setSrc: function (t, i, n) { return fabric.util.loadImage(t, function (t, e) { this.setElement(t, n), this._setWidthHeight(), i && i(this, e) }, this, n && n.crossOrigin), this }, toString: function () { return '#<fabric.Image: { src: "' + this.getSrc() + '" }>' }, applyResizeFilters: function () { var t = this.resizeFilter, e = this.minimumScaleTrigger, i = this.getTotalObjectScaling(), n = i.scaleX, o = i.scaleY, r = this._filteredEl || this._originalElement; if (this.group && this.set("dirty", !0), !t || e < n && e < o) return this._element = r, this._filterScalingX = 1, this._filterScalingY = 1, this._lastScaleX = n, void (this._lastScaleY = o); fabric.filterBackend || (fabric.filterBackend = fabric.initFilterBackend()); var a = fabric.util.createCanvasElement(), s = this._filteredEl ? this.cacheKey + "_filtered" : this.cacheKey, i = r.width, e = r.height; a.width = i, a.height = e, this._element = a, this._lastScaleX = t.scaleX = n, this._lastScaleY = t.scaleY = o, fabric.filterBackend.applyFilters([t], r, i, e, this._element, s), this._filterScalingX = a.width / this._originalElement.width, this._filterScalingY = a.height / this._originalElement.height }, applyFilters: function (t) { if (t = (t = t || this.filters || []).filter(function (t) { return t && !t.isNeutralState() }), this.set("dirty", !0), this.removeTexture(this.cacheKey + "_filtered"), 0 === t.length) return this._element = this._originalElement, this._filteredEl = null, this._filterScalingX = 1, this._filterScalingY = 1, this; var e = this._originalElement, i = e.naturalWidth || e.width, n = e.naturalHeight || e.height; return this._element === this._originalElement ? ((e = fabric.util.createCanvasElement()).width = i, e.height = n, this._element = e, this._filteredEl = e) : (this._element = this._filteredEl, this._filteredEl.getContext("2d").clearRect(0, 0, i, n), this._lastScaleX = 1, this._lastScaleY = 1), fabric.filterBackend || (fabric.filterBackend = fabric.initFilterBackend()), fabric.filterBackend.applyFilters(t, this._originalElement, i, n, this._element, this.cacheKey), this._originalElement.width === this._element.width && this._originalElement.height === this._element.height || (this._filterScalingX = this._element.width / this._originalElement.width, this._filterScalingY = this._element.height / this._originalElement.height), this }, _render: function (t) { fabric.util.setImageSmoothing(t, this.imageSmoothing), !0 !== this.isMoving && this.resizeFilter && this._needsResize() && this.applyResizeFilters(), this._stroke(t), this._renderPaintInOrder(t) }, drawCacheOnCanvas: function (t) { fabric.util.setImageSmoothing(t, this.imageSmoothing), fabric.Object.prototype.drawCacheOnCanvas.call(this, t) }, shouldCache: function () { return this.needsItsOwnCache() }, _renderFill: function (t) { var e, i, n, o, r, a, s, l, c, d, h, u, f, p, g = this._element; g && (e = this._filterScalingX, u = this._filterScalingY, i = this.width, n = this.height, o = Math.min, f = (h = Math.max)(this.cropX, 0), p = h(this.cropY, 0), r = g.naturalWidth || g.width, a = g.naturalHeight || g.height, l = p * u, c = o(i * e, r - (s = f * e)), d = o(n * u, a - l), h = -i / 2, u = -n / 2, f = o(i, r / e - f), p = o(n, a / e - p), g && t.drawImage(g, s, l, c, d, h, u, f, p)) }, _needsResize: function () { var t = this.getTotalObjectScaling(); return t.scaleX !== this._lastScaleX || t.scaleY !== this._lastScaleY }, _resetWidthHeight: function () { this.set(this.getOriginalSize()) }, _initElement: function (t, e) { this.setElement(fabric.util.getById(t), e), fabric.util.addClass(this.getElement(), fabric.Image.CSS_CANVAS) }, _initConfig: function (t) { t = t || {}, this.setOptions(t), this._setWidthHeight(t) }, _initFilters: function (t, e) { t && t.length ? fabric.util.enlivenObjects(t, function (t) { e && e(t) }, "fabric.Image.filters") : e && e() }, _setWidthHeight: function (t) { t = t || {}; var e = this.getElement(); this.width = t.width || e.naturalWidth || e.width || 0, this.height = t.height || e.naturalHeight || e.height || 0 }, parsePreserveAspectRatioAttribute: function () { var t, e = fabric.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio || ""), i = this._element.width, n = this._element.height, o = 1, r = 1, a = 0, s = 0, l = 0, c = 0, d = this.width, h = this.height, u = { width: d, height: h }; return !e || "none" === e.alignX && "none" === e.alignY ? (o = d / i, r = h / n) : ("meet" === e.meetOrSlice && (t = (d - i * (o = r = fabric.util.findScaleToFit(this._element, u))) / 2, "Min" === e.alignX && (a = -t), "Max" === e.alignX && (a = t), t = (h - n * r) / 2, "Min" === e.alignY && (s = -t), "Max" === e.alignY && (s = t)), "slice" === e.meetOrSlice && (t = i - d / (o = r = fabric.util.findScaleToCover(this._element, u)), "Mid" === e.alignX && (l = t / 2), "Max" === e.alignX && (l = t), t = n - h / r, "Mid" === e.alignY && (c = t / 2), "Max" === e.alignY && (c = t), i = d / o, n = h / r)), { width: i, height: n, scaleX: o, scaleY: r, offsetLeft: a, offsetTop: s, cropX: l, cropY: c } } }), fabric.Image.CSS_CANVAS = "canvas-img", fabric.Image.prototype.getSvgSrc = fabric.Image.prototype.getSrc, fabric.Image.fromObject = function (t, i) { var n = fabric.util.object.clone(t); fabric.util.loadImage(n.src, function (e, t) { t ? i && i(null, !0) : fabric.Image.prototype._initFilters.call(n, n.filters, function (t) { n.filters = t || [], fabric.Image.prototype._initFilters.call(n, [n.resizeFilter], function (t) { n.resizeFilter = t[0], fabric.util.enlivenObjects([n.clipPath], function (t) { n.clipPath = t[0]; t = new fabric.Image(e, n); i(t, !1) }) }) }) }, null, n.crossOrigin) }, fabric.Image.fromURL = function (t, i, n) { fabric.util.loadImage(t, function (t, e) { i && i(new fabric.Image(t, n), e) }, null, n && n.crossOrigin) }, fabric.Image.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")), fabric.Image.fromElement = function (t, e, i) { t = fabric.parseAttributes(t, fabric.Image.ATTRIBUTE_NAMES); fabric.Image.fromURL(t["xlink:href"], e, n(i ? fabric.util.object.clone(i) : {}, t)) }) }("undefined" != typeof exports ? exports : this), fabric.util.object.extend(fabric.Object.prototype, { _getAngleValueForStraighten: function () { var t = this.angle % 360; return 0 < t ? 90 * Math.round((t - 1) / 90) : 90 * Math.round(t / 90) }, straighten: function () { return this.rotate(this._getAngleValueForStraighten()), this }, fxStraighten: function (t) { function e() { } var i = (t = t || {}).onComplete || e, n = t.onChange || e, o = this; return fabric.util.animate({ startValue: this.get("angle"), endValue: this._getAngleValueForStraighten(), duration: this.FX_DURATION, onChange: function (t) { o.rotate(t), n() }, onComplete: function () { o.setCoords(), i() } }), this } }), fabric.util.object.extend(fabric.StaticCanvas.prototype, { straightenObject: function (t) { return t.straighten(), this.requestRenderAll(), this }, fxStraightenObject: function (t) { return t.fxStraighten({ onChange: this.requestRenderAllBound }), this } }), function () { "use strict"; function t(t) { t && t.tileSize && (this.tileSize = t.tileSize), this.setupGLContext(this.tileSize, this.tileSize), this.captureGPUInfo() } fabric.isWebglSupported = function (t) { if (fabric.isLikelyNode) return !1; t = t || fabric.WebglFilterBackend.prototype.tileSize; var e, i, n, o = document.createElement("canvas"), r = o.getContext("webgl") || o.getContext("experimental-webgl"), o = !1; if (r) { fabric.maxTextureSize = r.getParameter(r.MAX_TEXTURE_SIZE), o = fabric.maxTextureSize >= t; for (var a = ["highp", "mediump", "lowp"], s = 0; s < 3; s++)if (n = void 0, n = "precision " + (i = a[s]) + " float;\nvoid main(){}", i = (e = r).createShader(e.FRAGMENT_SHADER), e.shaderSource(i, n), e.compileShader(i), !!e.getShaderParameter(i, e.COMPILE_STATUS)) { fabric.webGlPrecision = a[s]; break } } return this.isSupported = o }, (fabric.WebglFilterBackend = t).prototype = { tileSize: 2048, resources: {}, setupGLContext: function (t, e) { this.dispose(), this.createWebGLCanvas(t, e), this.aPosition = new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]), this.chooseFastestCopyGLTo2DMethod(t, e) }, chooseFastestCopyGLTo2DMethod: function (t, e) { var i, n = void 0 !== window.performance; try { new ImageData(1, 1), i = !0 } catch (t) { i = !1 } var o = "undefined" != typeof ArrayBuffer, r = "undefined" != typeof Uint8ClampedArray; if (n && i && o && r) { n = fabric.util.createCanvasElement(), o = new ArrayBuffer(t * e * 4); if (fabric.forceGLPutImageData) return this.imageBuffer = o, void (this.copyGLTo2D = copyGLTo2DPutImageData); r = { imageBuffer: o, destinationWidth: t, destinationHeight: e, targetCanvas: n }; n.width = t, n.height = e, n = window.performance.now(), copyGLTo2DDrawImage.call(r, this.gl, r), e = window.performance.now() - n, n = window.performance.now(), copyGLTo2DPutImageData.call(r, this.gl, r), window.performance.now() - n < e ? (this.imageBuffer = o, this.copyGLTo2D = copyGLTo2DPutImageData) : this.copyGLTo2D = copyGLTo2DDrawImage } }, createWebGLCanvas: function (t, e) { var i = fabric.util.createCanvasElement(); i.width = t, i.height = e; t = { alpha: !0, premultipliedAlpha: !1, depth: !1, stencil: !1, antialias: !1 }, e = i.getContext("webgl", t); (e = e || i.getContext("experimental-webgl", t)) && (e.clearColor(0, 0, 0, 0), this.canvas = i, this.gl = e) }, applyFilters: function (t, e, i, n, o, r) { var a, s = this.gl; r && (a = this.getCachedTexture(r, e)); var l = { originalWidth: e.width || e.originalWidth, originalHeight: e.height || e.originalHeight, sourceWidth: i, sourceHeight: n, destinationWidth: i, destinationHeight: n, context: s, sourceTexture: this.createTexture(s, i, n, !a && e), targetTexture: this.createTexture(s, i, n), originalTexture: a || this.createTexture(s, i, n, !a && e), passes: t.length, webgl: !0, aPosition: this.aPosition, programCache: this.programCache, pass: 0, filterBackend: this, targetCanvas: o }, e = s.createFramebuffer(); return s.bindFramebuffer(s.FRAMEBUFFER, e), t.forEach(function (t) { t && t.applyTo(l) }), resizeCanvasIfNeeded(l), this.copyGLTo2D(s, l), s.bindTexture(s.TEXTURE_2D, null), s.deleteTexture(l.sourceTexture), s.deleteTexture(l.targetTexture), s.deleteFramebuffer(e), o.getContext("2d").setTransform(1, 0, 0, 1, 0, 0), l }, dispose: function () { this.canvas && (this.canvas = null, this.gl = null), this.clearWebGLCaches() }, clearWebGLCaches: function () { this.programCache = {}, this.textureCache = {} }, createTexture: function (t, e, i, n) { var o = t.createTexture(); return t.bindTexture(t.TEXTURE_2D, o), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.NEAREST), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.NEAREST), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), n ? t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, n) : t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, e, i, 0, t.RGBA, t.UNSIGNED_BYTE, null), o }, getCachedTexture: function (t, e) { if (this.textureCache[t]) return this.textureCache[t]; e = this.createTexture(this.gl, e.width, e.height, e); return this.textureCache[t] = e }, evictCachesForKey: function (t) { this.textureCache[t] && (this.gl.deleteTexture(this.textureCache[t]), delete this.textureCache[t]) }, copyGLTo2D: copyGLTo2DDrawImage, captureGPUInfo: function () { if (this.gpuInfo) return this.gpuInfo; var t = this.gl, e = { renderer: "", vendor: "" }; if (!t) return e; var i, n = t.getExtension("WEBGL_debug_renderer_info"); return n && (i = t.getParameter(n.UNMASKED_RENDERER_WEBGL), n = t.getParameter(n.UNMASKED_VENDOR_WEBGL), i && (e.renderer = i.toLowerCase()), n && (e.vendor = n.toLowerCase())), this.gpuInfo = e } } }(), function () { "use strict"; function t() { } function e() { } (fabric.Canvas2dFilterBackend = e).prototype = { evictCachesForKey: t, dispose: t, clearWebGLCaches: t, resources: {}, applyFilters: function (t, e, i, n, o) { var r = o.getContext("2d"); r.drawImage(e, 0, 0, i, n); var a = { sourceWidth: i, sourceHeight: n, imageData: r.getImageData(0, 0, i, n), originalEl: e, originalImageData: r.getImageData(0, 0, i, n), canvasEl: o, ctx: r, filterBackend: this }; return t.forEach(function (t) { t.applyTo(a) }), a.imageData.width === i && a.imageData.height === n || (o.width = a.imageData.width, o.height = a.imageData.height), r.putImageData(a.imageData, 0, 0), a } } }(), fabric.Image = fabric.Image || {}, fabric.Image.filters = fabric.Image.filters || {}, fabric.Image.filters.BaseFilter = fabric.util.createClass({ type: "BaseFilter", vertexSource: "attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvoid main() {\nvTexCoord = aPosition;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}", fragmentSource: "precision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D uTexture;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\n}", initialize: function (t) { t && this.setOptions(t) }, setOptions: function (t) { for (var e in t) this[e] = t[e] }, createProgram: function (t, e, i) { e = e || this.fragmentSource, i = i || this.vertexSource, "highp" !== fabric.webGlPrecision && (e = e.replace(/precision highp float/g, "precision " + fabric.webGlPrecision + " float")); var n = t.createShader(t.VERTEX_SHADER); if (t.shaderSource(n, i), t.compileShader(n), !t.getShaderParameter(n, t.COMPILE_STATUS)) throw new Error("Vertex shader compile error for " + this.type + ": " + t.getShaderInfoLog(n)); i = t.createShader(t.FRAGMENT_SHADER); if (t.shaderSource(i, e), t.compileShader(i), !t.getShaderParameter(i, t.COMPILE_STATUS)) throw new Error("Fragment shader compile error for " + this.type + ": " + t.getShaderInfoLog(i)); e = t.createProgram(); if (t.attachShader(e, n), t.attachShader(e, i), t.linkProgram(e), !t.getProgramParameter(e, t.LINK_STATUS)) throw new Error('Shader link error for "${this.type}" ' + t.getProgramInfoLog(e)); n = this.getAttributeLocations(t, e), i = this.getUniformLocations(t, e) || {}; return i.uStepW = t.getUniformLocation(e, "uStepW"), i.uStepH = t.getUniformLocation(e, "uStepH"), { program: e, attributeLocations: n, uniformLocations: i } }, getAttributeLocations: function (t, e) { return { aPosition: t.getAttribLocation(e, "aPosition") } }, getUniformLocations: function () { return {} }, sendAttributeData: function (t, e, i) { var n = e.aPosition, e = t.createBuffer(); t.bindBuffer(t.ARRAY_BUFFER, e), t.enableVertexAttribArray(n), t.vertexAttribPointer(n, 2, t.FLOAT, !1, 0, 0), t.bufferData(t.ARRAY_BUFFER, i, t.STATIC_DRAW) }, _setupFrameBuffer: function (t) { var e, i, n = t.context; 1 < t.passes ? (e = t.destinationWidth, i = t.destinationHeight, t.sourceWidth === e && t.sourceHeight === i || (n.deleteTexture(t.targetTexture), t.targetTexture = t.filterBackend.createTexture(n, e, i)), n.framebufferTexture2D(n.FRAMEBUFFER, n.COLOR_ATTACHMENT0, n.TEXTURE_2D, t.targetTexture, 0)) : (n.bindFramebuffer(n.FRAMEBUFFER, null), n.finish()) }, _swapTextures: function (t) { t.passes-- , t.pass++; var e = t.targetTexture; t.targetTexture = t.sourceTexture, t.sourceTexture = e }, isNeutralState: function () { var t = this.mainParameter, e = fabric.Image.filters[this.type].prototype; if (t) { if (Array.isArray(e[t])) { for (var i = e[t].length; i--;)if (this[t][i] !== e[t][i]) return !1; return !0 } return e[t] === this[t] } return !1 }, applyTo: function (t) { t.webgl ? (this._setupFrameBuffer(t), this.applyToWebGL(t), this._swapTextures(t)) : this.applyTo2d(t) }, retrieveShader: function (t) { return t.programCache.hasOwnProperty(this.type) || (t.programCache[this.type] = this.createProgram(t.context)), t.programCache[this.type] }, applyToWebGL: function (t) { var e = t.context, i = this.retrieveShader(t); 0 === t.pass && t.originalTexture ? e.bindTexture(e.TEXTURE_2D, t.originalTexture) : e.bindTexture(e.TEXTURE_2D, t.sourceTexture), e.useProgram(i.program), this.sendAttributeData(e, i.attributeLocations, t.aPosition), e.uniform1f(i.uniformLocations.uStepW, 1 / t.sourceWidth), e.uniform1f(i.uniformLocations.uStepH, 1 / t.sourceHeight), this.sendUniformData(e, i.uniformLocations), e.viewport(0, 0, t.destinationWidth, t.destinationHeight), e.drawArrays(e.TRIANGLE_STRIP, 0, 4) }, bindAdditionalTexture: function (t, e, i) { t.activeTexture(i), t.bindTexture(t.TEXTURE_2D, e), t.activeTexture(t.TEXTURE0) }, unbindAdditionalTexture: function (t, e) { t.activeTexture(e), t.bindTexture(t.TEXTURE_2D, null), t.activeTexture(t.TEXTURE0) }, getMainParameter: function () { return this[this.mainParameter] }, setMainParameter: function (t) { this[this.mainParameter] = t }, sendUniformData: function () { }, createHelpLayer: function (t) { var e; t.helpLayer || ((e = document.createElement("canvas")).width = t.sourceWidth, e.height = t.sourceHeight, t.helpLayer = e) }, toObject: function () { var t = { type: this.type }, e = this.mainParameter; return e && (t[e] = this[e]), t }, toJSON: function () { return this.toObject() } }), fabric.Image.filters.BaseFilter.fromObject = function (t, e) { t = new fabric.Image.filters[t.type](t); return e && e(t), t }, function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.Image.filters, t = e.util.createClass; i.ColorMatrix = t(i.BaseFilter, { type: "ColorMatrix", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform mat4 uColorMatrix;\nuniform vec4 uConstants;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor *= uColorMatrix;\ncolor += uConstants;\ngl_FragColor = color;\n}", matrix: [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], mainParameter: "matrix", colorsOnly: !0, initialize: function (t) { this.callSuper("initialize", t), this.matrix = this.matrix.slice(0) }, applyTo2d: function (t) { for (var e, i, n, o, r = t.imageData.data, a = r.length, s = this.matrix, l = this.colorsOnly, c = 0; c < a; c += 4)e = r[c], i = r[c + 1], n = r[c + 2], l ? (r[c] = e * s[0] + i * s[1] + n * s[2] + 255 * s[4], r[c + 1] = e * s[5] + i * s[6] + n * s[7] + 255 * s[9], r[c + 2] = e * s[10] + i * s[11] + n * s[12] + 255 * s[14]) : (o = r[c + 3], r[c] = e * s[0] + i * s[1] + n * s[2] + o * s[3] + 255 * s[4], r[c + 1] = e * s[5] + i * s[6] + n * s[7] + o * s[8] + 255 * s[9], r[c + 2] = e * s[10] + i * s[11] + n * s[12] + o * s[13] + 255 * s[14], r[c + 3] = e * s[15] + i * s[16] + n * s[17] + o * s[18] + 255 * s[19]) }, getUniformLocations: function (t, e) { return { uColorMatrix: t.getUniformLocation(e, "uColorMatrix"), uConstants: t.getUniformLocation(e, "uConstants") } }, sendUniformData: function (t, e) { var i = this.matrix, n = [i[0], i[1], i[2], i[3], i[5], i[6], i[7], i[8], i[10], i[11], i[12], i[13], i[15], i[16], i[17], i[18]], i = [i[4], i[9], i[14], i[19]]; t.uniformMatrix4fv(e.uColorMatrix, !1, n), t.uniform4fv(e.uConstants, i) } }), e.Image.filters.ColorMatrix.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.Image.filters, t = e.util.createClass; i.Brightness = t(i.BaseFilter, { type: "Brightness", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uBrightness;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += uBrightness;\ngl_FragColor = color;\n}", brightness: 0, mainParameter: "brightness", applyTo2d: function (t) { if (0 !== this.brightness) for (var e = t.imageData.data, i = e.length, n = Math.round(255 * this.brightness), o = 0; o < i; o += 4)e[o] = e[o] + n, e[o + 1] = e[o + 1] + n, e[o + 2] = e[o + 2] + n }, getUniformLocations: function (t, e) { return { uBrightness: t.getUniformLocation(e, "uBrightness") } }, sendUniformData: function (t, e) { t.uniform1f(e.uBrightness, this.brightness) } }), e.Image.filters.Brightness.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.util.object.extend, n = e.Image.filters, t = e.util.createClass; n.Convolute = t(n.BaseFilter, { type: "Convolute", opaque: !1, matrix: [0, 0, 0, 0, 1, 0, 0, 0, 0], fragmentSource: { Convolute_3_1: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n}\n}\ngl_FragColor = color;\n}", Convolute_3_0: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}", Convolute_5_1: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n}\n}\ngl_FragColor = color;\n}", Convolute_5_0: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}", Convolute_7_1: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n}\n}\ngl_FragColor = color;\n}", Convolute_7_0: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}", Convolute_9_1: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n}\n}\ngl_FragColor = color;\n}", Convolute_9_0: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}" }, retrieveShader: function (t) { var e = Math.sqrt(this.matrix.length), i = this.type + "_" + e + "_" + (this.opaque ? 1 : 0), e = this.fragmentSource[i]; return t.programCache.hasOwnProperty(i) || (t.programCache[i] = this.createProgram(t.context, e)), t.programCache[i] }, applyTo2d: function (t) { for (var e, i, n, o, r, a, s, l, c, d, h = t.imageData, u = h.data, f = this.matrix, p = Math.round(Math.sqrt(f.length)), g = Math.floor(p / 2), b = h.width, m = h.height, h = t.ctx.createImageData(b, m), v = h.data, x = this.opaque ? 1 : 0, y = 0; y < m; y++)for (l = 0; l < b; l++){ for (r = 4 * (y * b + l), d = o = n = i = e = 0; d < p; d++)for (c = 0; c < p; c++)s = l + c - g, (a = y + d - g) < 0 || m <= a || s < 0 || b <= s || (a = 4 * (a * b + s), s = f[d * p + c], e += u[a] * s, i += u[1 + a] * s, n += u[2 + a] * s, x || (o += u[3 + a] * s)); v[r] = e, v[1 + r] = i, v[2 + r] = n, v[3 + r] = x ? u[3 + r] : o } t.imageData = h }, getUniformLocations: function (t, e) { return { uMatrix: t.getUniformLocation(e, "uMatrix"), uOpaque: t.getUniformLocation(e, "uOpaque"), uHalfSize: t.getUniformLocation(e, "uHalfSize"), uSize: t.getUniformLocation(e, "uSize") } }, sendUniformData: function (t, e) { t.uniform1fv(e.uMatrix, this.matrix) }, toObject: function () { return i(this.callSuper("toObject"), { opaque: this.opaque, matrix: this.matrix }) } }), e.Image.filters.Convolute.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.Image.filters, t = e.util.createClass; i.Grayscale = t(i.BaseFilter, { type: "Grayscale", fragmentSource: { average: "precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat average = (color.r + color.b + color.g) / 3.0;\ngl_FragColor = vec4(average, average, average, color.a);\n}", lightness: "precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\ngl_FragColor = vec4(average, average, average, col.a);\n}", luminosity: "precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\ngl_FragColor = vec4(average, average, average, col.a);\n}" }, mode: "average", mainParameter: "mode", applyTo2d: function (t) { for (var e, i = t.imageData.data, n = i.length, o = this.mode, r = 0; r < n; r += 4)"average" === o ? e = (i[r] + i[r + 1] + i[r + 2]) / 3 : "lightness" === o ? e = (Math.min(i[r], i[r + 1], i[r + 2]) + Math.max(i[r], i[r + 1], i[r + 2])) / 2 : "luminosity" === o && (e = .21 * i[r] + .72 * i[r + 1] + .07 * i[r + 2]), i[r] = e, i[r + 1] = e, i[r + 2] = e }, retrieveShader: function (t) { var e, i = this.type + "_" + this.mode; return t.programCache.hasOwnProperty(i) || (e = this.fragmentSource[this.mode], t.programCache[i] = this.createProgram(t.context, e)), t.programCache[i] }, getUniformLocations: function (t, e) { return { uMode: t.getUniformLocation(e, "uMode") } }, sendUniformData: function (t, e) { t.uniform1i(e.uMode, 1) }, isNeutralState: function () { return !1 } }), e.Image.filters.Grayscale.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.Image.filters, t = e.util.createClass; i.Invert = t(i.BaseFilter, { type: "Invert", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform int uInvert;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nif (uInvert == 1) {\ngl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);\n} else {\ngl_FragColor = color;\n}\n}", invert: !0, mainParameter: "invert", applyTo2d: function (t) { for (var e = t.imageData.data, i = e.length, n = 0; n < i; n += 4)e[n] = 255 - e[n], e[n + 1] = 255 - e[n + 1], e[n + 2] = 255 - e[n + 2] }, isNeutralState: function () { return !this.invert }, getUniformLocations: function (t, e) { return { uInvert: t.getUniformLocation(e, "uInvert") } }, sendUniformData: function (t, e) { t.uniform1i(e.uInvert, this.invert) } }), e.Image.filters.Invert.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.util.object.extend, n = e.Image.filters, t = e.util.createClass; n.Noise = t(n.BaseFilter, { type: "Noise", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uStepH;\nuniform float uNoise;\nuniform float uSeed;\nvarying vec2 vTexCoord;\nfloat rand(vec2 co, float seed, float vScale) {\nreturn fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\n}\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\ngl_FragColor = color;\n}", mainParameter: "noise", noise: 0, applyTo2d: function (t) { if (0 !== this.noise) for (var e, i = t.imageData.data, n = i.length, o = this.noise, r = 0, n = i.length; r < n; r += 4)e = (.5 - Math.random()) * o, i[r] += e, i[r + 1] += e, i[r + 2] += e }, getUniformLocations: function (t, e) { return { uNoise: t.getUniformLocation(e, "uNoise"), uSeed: t.getUniformLocation(e, "uSeed") } }, sendUniformData: function (t, e) { t.uniform1f(e.uNoise, this.noise / 255), t.uniform1f(e.uSeed, Math.random()) }, toObject: function () { return i(this.callSuper("toObject"), { noise: this.noise }) } }), e.Image.filters.Noise.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.Image.filters, t = e.util.createClass; i.Pixelate = t(i.BaseFilter, { type: "Pixelate", blocksize: 4, mainParameter: "blocksize", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uBlocksize;\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nfloat blockW = uBlocksize * uStepW;\nfloat blockH = uBlocksize * uStepW;\nint posX = int(vTexCoord.x / blockW);\nint posY = int(vTexCoord.y / blockH);\nfloat fposX = float(posX);\nfloat fposY = float(posY);\nvec2 squareCoords = vec2(fposX * blockW, fposY * blockH);\nvec4 color = texture2D(uTexture, squareCoords);\ngl_FragColor = color;\n}", applyTo2d: function (t) { for (var e, i, n, o, r, a, s, l, c, d, t = t.imageData, h = t.data, u = t.height, f = t.width, p = 0; p < u; p += this.blocksize)for (i = 0; i < f; i += this.blocksize)for (n = h[e = 4 * p * f + 4 * i], o = h[1 + e], r = h[2 + e], a = h[3 + e], c = Math.min(p + this.blocksize, u), d = Math.min(i + this.blocksize, f), s = p; s < c; s++)for (l = i; l < d; l++)h[e = 4 * s * f + 4 * l] = n, h[1 + e] = o, h[2 + e] = r, h[3 + e] = a }, isNeutralState: function () { return 1 === this.blocksize }, getUniformLocations: function (t, e) { return { uBlocksize: t.getUniformLocation(e, "uBlocksize"), uStepW: t.getUniformLocation(e, "uStepW"), uStepH: t.getUniformLocation(e, "uStepH") } }, sendUniformData: function (t, e) { t.uniform1f(e.uBlocksize, this.blocksize) } }), e.Image.filters.Pixelate.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var c = t.fabric || (t.fabric = {}), e = c.util.object.extend, i = c.Image.filters, t = c.util.createClass; i.RemoveColor = t(i.BaseFilter, { type: "RemoveColor", color: "#FFFFFF", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\nif(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\ngl_FragColor.a = 0.0;\n}\n}", distance: .02, useAlpha: !1, applyTo2d: function (t) { for (var e, i, n, o = t.imageData.data, r = 255 * this.distance, t = new c.Color(this.color).getSource(), a = [t[0] - r, t[1] - r, t[2] - r], s = [t[0] + r, t[1] + r, t[2] + r], l = 0; l < o.length; l += 4)e = o[l], i = o[l + 1], n = o[l + 2], a[0] < e && a[1] < i && a[2] < n && e < s[0] && i < s[1] && n < s[2] && (o[l + 3] = 0) }, getUniformLocations: function (t, e) { return { uLow: t.getUniformLocation(e, "uLow"), uHigh: t.getUniformLocation(e, "uHigh") } }, sendUniformData: function (t, e) { var i = new c.Color(this.color).getSource(), n = parseFloat(this.distance), o = [0 + i[0] / 255 - n, 0 + i[1] / 255 - n, 0 + i[2] / 255 - n, 1], n = [i[0] / 255 + n, i[1] / 255 + n, i[2] / 255 + n, 1]; t.uniform4fv(e.uLow, o), t.uniform4fv(e.uHigh, n) }, toObject: function () { return e(this.callSuper("toObject"), { color: this.color, distance: this.distance }) } }), c.Image.filters.RemoveColor.fromObject = c.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e, i = t.fabric || (t.fabric = {}), n = i.Image.filters, o = i.util.createClass, r = { Brownie: [.5997, .34553, -.27082, 0, .186, -.0377, .86095, .15059, 0, -.1449, .24113, -.07441, .44972, 0, -.02965, 0, 0, 0, 1, 0], Vintage: [.62793, .32021, -.03965, 0, .03784, .02578, .64411, .03259, 0, .02926, .0466, -.08512, .52416, 0, .02023, 0, 0, 0, 1, 0], Kodachrome: [1.12855, -.39673, -.03992, 0, .24991, -.16404, 1.08352, -.05498, 0, .09698, -.16786, -.56034, 1.60148, 0, .13972, 0, 0, 0, 1, 0], Technicolor: [1.91252, -.85453, -.09155, 0, .04624, -.30878, 1.76589, -.10601, 0, -.27589, -.2311, -.75018, 1.84759, 0, .12137, 0, 0, 0, 1, 0], Polaroid: [1.438, -.062, -.062, 0, 0, -.122, 1.378, -.122, 0, 0, -.016, -.016, 1.483, 0, 0, 0, 0, 0, 1, 0], Sepia: [.393, .769, .189, 0, 0, .349, .686, .168, 0, 0, .272, .534, .131, 0, 0, 0, 0, 0, 1, 0], BlackWhite: [1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 0, 0, 0, 1, 0] }; for (e in r) n[e] = o(n.ColorMatrix, { type: e, matrix: r[e], mainParameter: !1, colorsOnly: !0 }), i.Image.filters[e].fromObject = i.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var h = t.fabric, e = h.Image.filters, t = h.util.createClass; e.BlendColor = t(e.BaseFilter, { type: "BlendColor", color: "#F95C63", mode: "multiply", alpha: 1, fragmentSource: { multiply: "gl_FragColor.rgb *= uColor.rgb;\n", screen: "gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n", add: "gl_FragColor.rgb += uColor.rgb;\n", diff: "gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n", subtract: "gl_FragColor.rgb -= uColor.rgb;\n", lighten: "gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n", darken: "gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n", exclusion: "gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n", overlay: "if (uColor.r < 0.5) {\ngl_FragColor.r *= 2.0 * uColor.r;\n} else {\ngl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n}\nif (uColor.g < 0.5) {\ngl_FragColor.g *= 2.0 * uColor.g;\n} else {\ngl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n}\nif (uColor.b < 0.5) {\ngl_FragColor.b *= 2.0 * uColor.b;\n} else {\ngl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n}\n", tint: "gl_FragColor.rgb *= (1.0 - uColor.a);\ngl_FragColor.rgb += uColor.rgb;\n" }, buildSource: function (t) { return "precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ngl_FragColor = color;\nif (color.a > 0.0) {\n" + this.fragmentSource[t] + "}\n}" }, retrieveShader: function (t) { var e, i = this.type + "_" + this.mode; return t.programCache.hasOwnProperty(i) || (e = this.buildSource(this.mode), t.programCache[i] = this.createProgram(t.context, e)), t.programCache[i] }, applyTo2d: function (t) { for (var e, i, n, o = t.imageData.data, r = o.length, a = 1 - this.alpha, t = new h.Color(this.color).getSource(), s = t[0] * this.alpha, l = t[1] * this.alpha, c = t[2] * this.alpha, d = 0; d < r; d += 4)switch (e = o[d], i = o[d + 1], n = o[d + 2], this.mode) { case "multiply": o[d] = e * s / 255, o[d + 1] = i * l / 255, o[d + 2] = n * c / 255; break; case "screen": o[d] = 255 - (255 - e) * (255 - s) / 255, o[d + 1] = 255 - (255 - i) * (255 - l) / 255, o[d + 2] = 255 - (255 - n) * (255 - c) / 255; break; case "add": o[d] = e + s, o[d + 1] = i + l, o[d + 2] = n + c; break; case "diff": case "difference": o[d] = Math.abs(e - s), o[d + 1] = Math.abs(i - l), o[d + 2] = Math.abs(n - c); break; case "subtract": o[d] = e - s, o[d + 1] = i - l, o[d + 2] = n - c; break; case "darken": o[d] = Math.min(e, s), o[d + 1] = Math.min(i, l), o[d + 2] = Math.min(n, c); break; case "lighten": o[d] = Math.max(e, s), o[d + 1] = Math.max(i, l), o[d + 2] = Math.max(n, c); break; case "overlay": o[d] = s < 128 ? 2 * e * s / 255 : 255 - 2 * (255 - e) * (255 - s) / 255, o[d + 1] = l < 128 ? 2 * i * l / 255 : 255 - 2 * (255 - i) * (255 - l) / 255, o[d + 2] = c < 128 ? 2 * n * c / 255 : 255 - 2 * (255 - n) * (255 - c) / 255; break; case "exclusion": o[d] = s + e - 2 * s * e / 255, o[d + 1] = l + i - 2 * l * i / 255, o[d + 2] = c + n - 2 * c * n / 255; break; case "tint": o[d] = s + e * a, o[d + 1] = l + i * a, o[d + 2] = c + n * a } }, getUniformLocations: function (t, e) { return { uColor: t.getUniformLocation(e, "uColor") } }, sendUniformData: function (t, e) { var i = new h.Color(this.color).getSource(); i[0] = this.alpha * i[0] / 255, i[1] = this.alpha * i[1] / 255, i[2] = this.alpha * i[2] / 255, i[3] = this.alpha, t.uniform4fv(e.uColor, i) }, toObject: function () { return { type: this.type, color: this.color, mode: this.mode, alpha: this.alpha } } }), h.Image.filters.BlendColor.fromObject = h.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var m = t.fabric, e = m.Image.filters, t = m.util.createClass; e.BlendImage = t(e.BaseFilter, { type: "BlendImage", image: null, mode: "multiply", alpha: 1, vertexSource: "attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}", fragmentSource: { multiply: "precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.rgba *= color2.rgba;\ngl_FragColor = color;\n}", mask: "precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.a = color2.a;\ngl_FragColor = color;\n}" }, retrieveShader: function (t) { var e = this.type + "_" + this.mode, i = this.fragmentSource[this.mode]; return t.programCache.hasOwnProperty(e) || (t.programCache[e] = this.createProgram(t.context, i)), t.programCache[e] }, applyToWebGL: function (t) { var e = t.context, i = this.createTexture(t.filterBackend, this.image); this.bindAdditionalTexture(e, i, e.TEXTURE1), this.callSuper("applyToWebGL", t), this.unbindAdditionalTexture(e, e.TEXTURE1) }, createTexture: function (t, e) { return t.getCachedTexture(e.cacheKey, e._element) }, calculateMatrix: function () { var t = this.image, e = t._element.width, i = t._element.height; return [1 / t.scaleX, 0, 0, 0, 1 / t.scaleY, 0, -t.left / e, -t.top / i, 1] }, applyTo2d: function (t) { var e, i, n, o, r, a, s, l, c, d = t.imageData, h = t.filterBackend.resources, u = d.data, f = u.length, p = d.width, g = d.height, t = this.image; h.blendImage || (h.blendImage = m.util.createCanvasElement()), h = (d = h.blendImage).getContext("2d"), d.width !== p || d.height !== g ? (d.width = p, d.height = g) : h.clearRect(0, 0, p, g), h.setTransform(t.scaleX, 0, 0, t.scaleY, t.left, t.top), h.drawImage(t._element, 0, 0, p, g), c = h.getImageData(0, 0, p, g).data; for (var b = 0; b < f; b += 4)switch (r = u[b], a = u[b + 1], s = u[b + 2], l = u[b + 3], e = c[b], i = c[b + 1], n = c[b + 2], o = c[b + 3], this.mode) { case "multiply": u[b] = r * e / 255, u[b + 1] = a * i / 255, u[b + 2] = s * n / 255, u[b + 3] = l * o / 255; break; case "mask": u[b + 3] = o } }, getUniformLocations: function (t, e) { return { uTransformMatrix: t.getUniformLocation(e, "uTransformMatrix"), uImage: t.getUniformLocation(e, "uImage") } }, sendUniformData: function (t, e) { var i = this.calculateMatrix(); t.uniform1i(e.uImage, 1), t.uniformMatrix3fv(e.uTransformMatrix, !1, i) }, toObject: function () { return { type: this.type, image: this.image && this.image.toObject(), mode: this.mode, alpha: this.alpha } } }), m.Image.filters.BlendImage.fromObject = function (i, n) { m.Image.fromObject(i.image, function (t) { var e = m.util.object.clone(i); e.image = t, n(new m.Image.filters.BlendImage(e)) }) } }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var b = t.fabric || (t.fabric = {}), A = Math.pow, P = Math.floor, E = Math.sqrt, $ = Math.abs, a = Math.round, n = Math.sin, j = Math.ceil, e = b.Image.filters, t = b.util.createClass; e.Resize = t(e.BaseFilter, { type: "Resize", resizeType: "hermite", scaleX: 1, scaleY: 1, lanczosLobes: 3, getUniformLocations: function (t, e) { return { uDelta: t.getUniformLocation(e, "uDelta"), uTaps: t.getUniformLocation(e, "uTaps") } }, sendUniformData: function (t, e) { t.uniform2fv(e.uDelta, this.horizontal ? [1 / this.width, 0] : [0, 1 / this.height]), t.uniform1fv(e.uTaps, this.taps) }, retrieveShader: function (t) { var e = this.getFilterWindow(), i = this.type + "_" + e; return t.programCache.hasOwnProperty(i) || (e = this.generateShader(e), t.programCache[i] = this.createProgram(t.context, e)), t.programCache[i] }, getFilterWindow: function () { var t = this.tempScale; return Math.ceil(this.lanczosLobes / t) }, getTaps: function () { for (var t = this.lanczosCreate(this.lanczosLobes), e = this.tempScale, i = this.getFilterWindow(), n = new Array(i), o = 1; o <= i; o++)n[o - 1] = t(o * e); return n }, generateShader: function (t) { for (var e = new Array(t), i = this.fragmentSourceTOP, n = 1; n <= t; n++)e[n - 1] = n + ".0 * uDelta"; return i += "uniform float uTaps[" + t + "];\n", i += "void main() {\n", i += " vec4 color = texture2D(uTexture, vTexCoord);\n", i += " float sum = 1.0;\n", e.forEach(function (t, e) { i += " color += texture2D(uTexture, vTexCoord + " + t + ") * uTaps[" + e + "];\n", i += " color += texture2D(uTexture, vTexCoord - " + t + ") * uTaps[" + e + "];\n", i += " sum += 2.0 * uTaps[" + e + "];\n" }), i += " gl_FragColor = color / sum;\n", i += "}" }, fragmentSourceTOP: "precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\n", applyTo: function (t) { t.webgl ? (t.passes++ , this.width = t.sourceWidth, this.horizontal = !0, this.dW = Math.round(this.width * this.scaleX), this.dH = t.sourceHeight, this.tempScale = this.dW / this.width, this.taps = this.getTaps(), t.destinationWidth = this.dW, this._setupFrameBuffer(t), this.applyToWebGL(t), this._swapTextures(t), t.sourceWidth = t.destinationWidth, this.height = t.sourceHeight, this.horizontal = !1, this.dH = Math.round(this.height * this.scaleY), this.tempScale = this.dH / this.height, this.taps = this.getTaps(), t.destinationHeight = this.dH, this._setupFrameBuffer(t), this.applyToWebGL(t), this._swapTextures(t), t.sourceHeight = t.destinationHeight) : this.applyTo2d(t) }, isNeutralState: function () { return 1 === this.scaleX && 1 === this.scaleY }, lanczosCreate: function (i) { return function (t) { if (i <= t || t <= -i) return 0; if (t < 1.1920929e-7 && -1.1920929e-7 < t) return 1; var e = (t *= Math.PI) / i; return n(t) / t * n(e) / e } }, applyTo2d: function (t) { var e = t.imageData, i = this.scaleX, n = this.scaleY; this.rcpScaleX = 1 / i, this.rcpScaleY = 1 / n; var o, r = e.width, e = e.height, i = a(r * i), n = a(e * n); "sliceHack" === this.resizeType ? o = this.sliceByTwo(t, r, e, i, n) : "hermite" === this.resizeType ? o = this.hermiteFastResize(t, r, e, i, n) : "bilinear" === this.resizeType ? o = this.bilinearFiltering(t, r, e, i, n) : "lanczos" === this.resizeType && (o = this.lanczosResize(t, r, e, i, n)), t.imageData = o }, sliceByTwo: function (t, e, i, n, o) { var r, a, s = t.imageData, l = !1, c = !1, d = .5 * e, h = .5 * i, t = b.filterBackend.resources, u = 0, f = 0, p = e, g = 0; for (t.sliceByTwo || (t.sliceByTwo = document.createElement("canvas")), ((r = t.sliceByTwo).width < 1.5 * e || r.height < i) && (r.width = 1.5 * e, r.height = i), (a = r.getContext("2d")).clearRect(0, 0, 1.5 * e, i), a.putImageData(s, 0, 0), n = P(n), o = P(o); !l || !c;)i = h, n < P(.5 * (e = d)) ? d = P(.5 * d) : (d = n, l = !0), o < P(.5 * h) ? h = P(.5 * h) : (h = o, c = !0), a.drawImage(r, u, f, e, i, p, g, d, h), u = p, f = g, g += h; return a.getImageData(u, f, n, o) }, lanczosResize: function (t, f, p, g, b) { var m = t.imageData.data, v = t.ctx.createImageData(g, b), x = v.data, y = this.lanczosCreate(this.lanczosLobes), _ = this.rcpScaleX, w = this.rcpScaleY, C = 2 / this.rcpScaleX, S = 2 / this.rcpScaleY, T = j(_ * this.lanczosLobes / 2), k = j(w * this.lanczosLobes / 2), O = {}, F = {}, D = {}; return function t(e) { var i, n, o, r, a, s, l, c, d, h; for (F.x = (e + .5) * _, D.x = P(F.x), i = 0; i < b; i++){ for (F.y = (i + .5) * w, D.y = P(F.y), c = l = s = a = r = 0, n = D.x - T; n <= D.x + T; n++)if (!(n < 0 || f <= n)) { d = P(1e3 * $(n - F.x)), O[d] || (O[d] = {}); for (var u = D.y - k; u <= D.y + k; u++)u < 0 || p <= u || (h = P(1e3 * $(u - F.y)), O[d][h] || (O[d][h] = y(E(A(d * C, 2) + A(h * S, 2)) / 1e3)), 0 < (h = O[d][h]) && (r += h, a += h * m[o = 4 * (u * f + n)], s += h * m[o + 1], l += h * m[o + 2], c += h * m[o + 3])) } x[o = 4 * (i * g + e)] = a / r, x[o + 1] = s / r, x[o + 2] = l / r, x[o + 3] = c / r } return ++e < g ? t(e) : v }(0) }, bilinearFiltering: function (t, e, i, n, o) { for (var r, a, s, l, c, d, h, u, f = 0, p = this.rcpScaleX, g = this.rcpScaleY, b = 4 * (e - 1), m = t.imageData.data, t = t.ctx.createImageData(n, o), v = t.data, x = 0; x < o; x++)for (s = 0; s < n; s++)for (l = p * s - (r = P(p * s)), c = g * x - (a = P(g * x)), u = 4 * (a * e + r), d = 0; d < 4; d++)h = m[u + d] * (1 - l) * (1 - c) + m[4 + u + d] * l * (1 - c) + m[u + b + d] * c * (1 - l) + m[u + b + 4 + d] * l * c, v[f++] = h; return t }, hermiteFastResize: function (t, e, i, n, o) { for (var r = this.rcpScaleX, a = this.rcpScaleY, s = j(r / 2), l = j(a / 2), c = t.imageData.data, t = t.ctx.createImageData(n, o), d = t.data, h = 0; h < o; h++)for (var u = 0; u < n; u++){ for (var f = 4 * (u + h * n), p = 0, g = 0, b = 0, m = 0, v = 0, x = 0, y = 0, _ = (h + .5) * a, w = P(h * a); w < (h + 1) * a; w++)for (var C = $(_ - (w + .5)) / l, S = (u + .5) * r, T = C * C, k = P(u * r); k < (u + 1) * r; k++){ var O = $(S - (k + .5)) / s, F = E(T + O * O); 1 < F && F < -1 || 0 < (p = 2 * F * F * F - 3 * F * F + 1) && (y += p * c[3 + (O = 4 * (k + w * e))], b += p, c[3 + O] < 255 && (p = p * c[3 + O] / 250), m += p * c[O], v += p * c[1 + O], x += p * c[2 + O], g += p) } d[f] = m / g, d[1 + f] = v / g, d[2 + f] = x / g, d[3 + f] = y / b } return t }, toObject: function () { return { type: this.type, scaleX: this.scaleX, scaleY: this.scaleY, resizeType: this.resizeType, lanczosLobes: this.lanczosLobes } } }), b.Image.filters.Resize.fromObject = b.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.Image.filters, t = e.util.createClass; i.Contrast = t(i.BaseFilter, { type: "Contrast", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uContrast;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\ngl_FragColor = color;\n}", contrast: 0, mainParameter: "contrast", applyTo2d: function (t) { if (0 !== this.contrast) for (var e = t.imageData.data, i = e.length, t = Math.floor(255 * this.contrast), n = 259 * (t + 255) / (255 * (259 - t)), o = 0; o < i; o += 4)e[o] = n * (e[o] - 128) + 128, e[o + 1] = n * (e[o + 1] - 128) + 128, e[o + 2] = n * (e[o + 2] - 128) + 128 }, getUniformLocations: function (t, e) { return { uContrast: t.getUniformLocation(e, "uContrast") } }, sendUniformData: function (t, e) { t.uniform1f(e.uContrast, this.contrast) } }), e.Image.filters.Contrast.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.Image.filters, t = e.util.createClass; i.Saturation = t(i.BaseFilter, { type: "Saturation", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform float uSaturation;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat rgMax = max(color.r, color.g);\nfloat rgbMax = max(rgMax, color.b);\ncolor.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\ncolor.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\ncolor.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\ngl_FragColor = color;\n}", saturation: 0, mainParameter: "saturation", applyTo2d: function (t) { if (0 !== this.saturation) for (var e, i = t.imageData.data, n = i.length, o = -this.saturation, r = 0; r < n; r += 4)e = Math.max(i[r], i[r + 1], i[r + 2]), i[r] += e !== i[r] ? (e - i[r]) * o : 0, i[r + 1] += e !== i[r + 1] ? (e - i[r + 1]) * o : 0, i[r + 2] += e !== i[r + 2] ? (e - i[r + 2]) * o : 0 }, getUniformLocations: function (t, e) { return { uSaturation: t.getUniformLocation(e, "uSaturation") } }, sendUniformData: function (t, e) { t.uniform1f(e.uSaturation, -this.saturation) } }), e.Image.filters.Saturation.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var f = t.fabric || (t.fabric = {}), e = f.Image.filters, t = f.util.createClass; e.Blur = t(e.BaseFilter, { type: "Blur", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(v3offset);\nfor (float t = -nSamples; t <= nSamples; t++) {\nfloat percent = (t + offset - 0.5) / nSamples;\nfloat weight = 1.0 - abs(percent);\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\ntotal += weight;\n}\ngl_FragColor = color / total;\n}", blur: 0, mainParameter: "blur", applyTo: function (t) { t.webgl ? (this.aspectRatio = t.sourceWidth / t.sourceHeight, t.passes++ , this._setupFrameBuffer(t), this.horizontal = !0, this.applyToWebGL(t), this._swapTextures(t), this._setupFrameBuffer(t), this.horizontal = !1, this.applyToWebGL(t), this._swapTextures(t)) : this.applyTo2d(t) }, applyTo2d: function (t) { t.imageData = this.simpleBlur(t) }, simpleBlur: function (t) { var e, i, n = t.filterBackend.resources, o = t.imageData.width, r = t.imageData.height; n.blurLayer1 || (n.blurLayer1 = f.util.createCanvasElement(), n.blurLayer2 = f.util.createCanvasElement()), e = n.blurLayer1, i = n.blurLayer2, e.width === o && e.height === r || (i.width = e.width = o, i.height = e.height = r); var a, s, l, c, d = e.getContext("2d"), h = i.getContext("2d"), u = .06 * this.blur * .5; for (d.putImageData(t.imageData, 0, 0), h.clearRect(0, 0, o, r), c = -15; c <= 15; c++)l = u * (s = c / 15) * o + (a = (Math.random() - .5) / 4), h.globalAlpha = 1 - Math.abs(s), h.drawImage(e, l, a), d.drawImage(i, 0, 0), h.globalAlpha = 1, h.clearRect(0, 0, i.width, i.height); for (c = -15; c <= 15; c++)l = u * (s = c / 15) * r + (a = (Math.random() - .5) / 4), h.globalAlpha = 1 - Math.abs(s), h.drawImage(e, a, l), d.drawImage(i, 0, 0), h.globalAlpha = 1, h.clearRect(0, 0, i.width, i.height); t.ctx.drawImage(e, 0, 0); t = t.ctx.getImageData(0, 0, e.width, e.height); return d.globalAlpha = 1, d.clearRect(0, 0, e.width, e.height), t }, getUniformLocations: function (t, e) { return { delta: t.getUniformLocation(e, "uDelta") } }, sendUniformData: function (t, e) { var i = this.chooseRightDelta(); t.uniform2fv(e.delta, i) }, chooseRightDelta: function () { var t = 1, e = [0, 0]; return this.horizontal ? 1 < this.aspectRatio && (t = 1 / this.aspectRatio) : this.aspectRatio < 1 && (t = this.aspectRatio), t = t * this.blur * .12, this.horizontal ? e[0] = t : e[1] = t, e } }), e.Blur.fromObject = f.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var e = t.fabric || (t.fabric = {}), i = e.Image.filters, t = e.util.createClass; i.Gamma = t(i.BaseFilter, { type: "Gamma", fragmentSource: "precision highp float;\nuniform sampler2D uTexture;\nuniform vec3 uGamma;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec3 correction = (1.0 / uGamma);\ncolor.r = pow(color.r, correction.r);\ncolor.g = pow(color.g, correction.g);\ncolor.b = pow(color.b, correction.b);\ngl_FragColor = color;\ngl_FragColor.rgb *= color.a;\n}", gamma: [1, 1, 1], mainParameter: "gamma", initialize: function (t) { this.gamma = [1, 1, 1], i.BaseFilter.prototype.initialize.call(this, t) }, applyTo2d: function (t) { var e, i = t.imageData.data, t = this.gamma, n = i.length, o = 1 / t[0], r = 1 / t[1], a = 1 / t[2]; for (this.rVals || (this.rVals = new Uint8Array(256), this.gVals = new Uint8Array(256), this.bVals = new Uint8Array(256)), e = 0, n = 256; e < n; e++)this.rVals[e] = 255 * Math.pow(e / 255, o), this.gVals[e] = 255 * Math.pow(e / 255, r), this.bVals[e] = 255 * Math.pow(e / 255, a); for (e = 0, n = i.length; e < n; e += 4)i[e] = this.rVals[i[e]], i[e + 1] = this.gVals[i[e + 1]], i[e + 2] = this.bVals[i[e + 2]] }, getUniformLocations: function (t, e) { return { uGamma: t.getUniformLocation(e, "uGamma") } }, sendUniformData: function (t, e) { t.uniform3fv(e.uGamma, this.gamma) } }), e.Image.filters.Gamma.fromObject = e.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var i = t.fabric || (t.fabric = {}), e = i.Image.filters, t = i.util.createClass; e.Composed = t(e.BaseFilter, { type: "Composed", subFilters: [], initialize: function (t) { this.callSuper("initialize", t), this.subFilters = this.subFilters.slice(0) }, applyTo: function (e) { e.passes += this.subFilters.length - 1, this.subFilters.forEach(function (t) { t.applyTo(e) }) }, toObject: function () { return i.util.object.extend(this.callSuper("toObject"), { subFilters: this.subFilters.map(function (t) { return t.toObject() }) }) }, isNeutralState: function () { return !this.subFilters.some(function (t) { return !t.isNeutralState() }) } }), i.Image.filters.Composed.fromObject = function (t, e) { t = (t.subFilters || []).map(function (t) { return new i.Image.filters[t.type](t) }), t = new i.Image.filters.Composed({ subFilters: t }); return e && e(t), t } }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var n = t.fabric || (t.fabric = {}), e = n.Image.filters, t = n.util.createClass; e.HueRotation = t(e.ColorMatrix, { type: "HueRotation", rotation: 0, mainParameter: "rotation", calculateMatrix: function () { var t = this.rotation * Math.PI, e = n.util.cos(t), i = n.util.sin(t), t = Math.sqrt(1 / 3) * i, i = 1 - e; this.matrix = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], this.matrix[0] = e + i / 3, this.matrix[1] = 1 / 3 * i - t, this.matrix[2] = 1 / 3 * i + t, this.matrix[5] = 1 / 3 * i + t, this.matrix[6] = e + 1 / 3 * i, this.matrix[7] = 1 / 3 * i - t, this.matrix[10] = 1 / 3 * i - t, this.matrix[11] = 1 / 3 * i + t, this.matrix[12] = e + 1 / 3 * i }, isNeutralState: function (t) { return this.calculateMatrix(), e.BaseFilter.prototype.isNeutralState.call(this, t) }, applyTo: function (t) { this.calculateMatrix(), e.BaseFilter.prototype.applyTo.call(this, t) } }), n.Image.filters.HueRotation.fromObject = n.Image.filters.BaseFilter.fromObject }("undefined" != typeof exports ? exports : this), function (t) { "use strict"; var u = t.fabric || (t.fabric = {}), a = u.util.object.clone; u.Text ? u.warn("fabric.Text is already defined") : (t = "fontFamily fontWeight fontSize text underline overline linethrough" + " textAlign fontStyle lineHeight textBackgroundColor charSpacing styles path".split(" "), u.Text = u.util.createClass(u.Object, { _dimensionAffectingProps: ["fontSize", "fontWeight", "fontFamily", "fontStyle", "lineHeight", "text", "charSpacing", "textAlign", "styles", "path"], _reNewline: /\r?\n/, _reSpacesAndTabs: /[ \t\r]/g, _reSpaceAndTab: /[ \t\r]/, _reWords: /\S+/g, type: "text", fontSize: 40, fontWeight: "normal", fontFamily: "Times New Roman", underline: !1, overline: !1, linethrough: !1, textAlign: "left", fontStyle: "normal", lineHeight: 1.16, superscript: { size: .6, baseline: -.35 }, subscript: { size: .6, baseline: .11 }, textBackgroundColor: "", stateProperties: u.Object.prototype.stateProperties.concat(t), cacheProperties: u.Object.prototype.cacheProperties.concat(t), stroke: null, shadow: null, _fontSizeFraction: .222, offsets: { underline: .1, linethrough: -.315, overline: -.88 }, _fontSizeMult: 1.13, charSpacing: 0, styles: null, _measuringContext: null, deltaY: 0, _styleProperties: ["stroke", "strokeWidth", "fill", "fontFamily", "fontSize", "fontWeight", "fontStyle", "underline", "overline", "linethrough", "deltaY", "textBackgroundColor"], __charBounds: [], CACHE_FONT_SIZE: 400, MIN_TEXT_WIDTH: 2, initialize: function (t, e) { this.styles = e && e.styles || {}, this.text = t, this.__skipDimension = !0, this.callSuper("initialize", e), this.path && this.setPathInfo(), this.__skipDimension = !1, this.initDimensions(), this.setCoords(), this.setupState({ propertySet: "_dimensionAffectingProps" }) }, setPathInfo: function () { var t = this.path; t && (t.segmentsInfo = u.util.getPathSegmentsInfo(t.path)) }, getMeasuringContext: function () { return u._measuringContext || (u._measuringContext = this.canvas && this.canvas.contextCache || u.util.createCanvasElement().getContext("2d")), u._measuringContext }, _splitText: function () { var t = this._splitTextIntoLines(this.text); return this.textLines = t.lines, this._textLines = t.graphemeLines, this._unwrappedTextLines = t._unwrappedLines, this._text = t.graphemeText, t }, initDimensions: function () { this.__skipDimension || (this._splitText(), this._clearCache(), this.path ? (this.width = this.path.width, this.height = this.path.height) : (this.width = this.calcTextWidth() || this.cursorWidth || this.MIN_TEXT_WIDTH, this.height = this.calcTextHeight()), -1 !== this.textAlign.indexOf("justify") && this.enlargeSpaces(), this.saveState({ propertySet: "_dimensionAffectingProps" })) }, enlargeSpaces: function () { for (var t, e, i, n, o, r, a, s = 0, l = this._textLines.length; s < l; s++)if (("justify" === this.textAlign || s !== l - 1 && !this.isEndOfWrapping(s)) && (n = 0, o = this._textLines[s], (e = this.getLineWidth(s)) < this.width && (a = this.textLines[s].match(this._reSpacesAndTabs)))) { i = a.length, t = (this.width - e) / i; for (var c = 0, d = o.length; c <= d; c++)r = this.__charBounds[s][c], this._reSpaceAndTab.test(o[c]) ? (r.width += t, r.kernedWidth += t, r.left += n, n += t) : r.left += n } }, isEndOfWrapping: function (t) { return t === this._textLines.length - 1 }, missingNewlineOffset: function () { return 1 }, toString: function () { return "#<fabric.Text (" + this.complexity() + '): { "text": "' + this.text + '", "fontFamily": "' + this.fontFamily + '" }>' }, _getCacheCanvasDimensions: function () { var t = this.callSuper("_getCacheCanvasDimensions"), e = this.fontSize; return t.width += e * t.zoomX, t.height += e * t.zoomY, t }, _render: function (t) { this._setTextStyles(t), this._renderTextLinesBackground(t), this._renderTextDecoration(t, "underline"), this._renderText(t), this._renderTextDecoration(t, "overline"), this._renderTextDecoration(t, "linethrough") }, _renderText: function (t) { "stroke" === this.paintFirst ? (this._renderTextStroke(t), this._renderTextFill(t)) : (this._renderTextFill(t), this._renderTextStroke(t)) }, _setTextStyles: function (t, e, i) { t.textBaseline = "alphabetic", t.font = this._getFontDeclaration(e, i) }, calcTextWidth: function () { for (var t = this.getLineWidth(0), e = 1, i = this._textLines.length; e < i; e++){ var n = this.getLineWidth(e); t < n && (t = n) } return t }, _renderTextLine: function (t, e, i, n, o, r) { this._renderChars(t, e, i, n, o, r) }, _renderTextLinesBackground: function (t) { if (this.textBackgroundColor || this.styleHas("textBackgroundColor")) { for (var e, i, n, o, r, a, s = t.fillStyle, l = this._getLeftOffset(), c = this._getTopOffset(), d = 0, h = 0, u = this.path, f = 0, p = this._textLines.length; f < p; f++)if (e = this.getHeightOfLine(f), this.textBackgroundColor || this.styleHas("textBackgroundColor", f)) { n = this._textLines[f], i = this._getLineLeftOffset(f), d = h = 0, o = this.getValueOfPropertyAt(f, 0, "textBackgroundColor"); for (var g = 0, b = n.length; g < b; g++)r = this.__charBounds[f][g], a = this.getValueOfPropertyAt(f, g, "textBackgroundColor"), u ? (t.save(), t.translate(r.renderLeft, r.renderTop), t.rotate(r.angle), (t.fillStyle = a) && t.fillRect(-r.width / 2, -e / this.lineHeight * (1 - this._fontSizeFraction), r.width, e / this.lineHeight), t.restore()) : a !== o ? ((t.fillStyle = o) && t.fillRect(l + i + d, c, h, e / this.lineHeight), d = r.left, h = r.width, o = a) : h += r.kernedWidth; a && !u && (t.fillStyle = a, t.fillRect(l + i + d, c, h, e / this.lineHeight)), c += e } else c += e; t.fillStyle = s, this._removeShadow(t) } }, getFontCache: function (t) { var e = t.fontFamily.toLowerCase(); u.charWidthsCache[e] || (u.charWidthsCache[e] = {}); e = u.charWidthsCache[e], t = t.fontStyle.toLowerCase() + "_" + (t.fontWeight + "").toLowerCase(); return e[t] || (e[t] = {}), e[t] }, _measureChar: function (t, e, i, n) { var o, r, a, s, l, c = this.getFontCache(e), d = i + t, h = this._getFontDeclaration(e) === this._getFontDeclaration(n), n = e.fontSize / this.CACHE_FONT_SIZE; return i && void 0 !== c[i] && (a = c[i]), void 0 !== c[t] && (s = o = c[t]), h && void 0 !== c[d] && (s = (r = c[d]) - a), void 0 !== o && void 0 !== a && void 0 !== r || (l = this.getMeasuringContext(), this._setTextStyles(l, e, !0)), void 0 === o && (s = o = l.measureText(t).width, c[t] = o), void 0 === a && h && i && (a = l.measureText(i).width, c[i] = a), h && void 0 === r && (r = l.measureText(d).width, s = (c[d] = r) - a), { width: o * n, kernedWidth: s * n } }, getHeightOfChar: function (t, e) { return this.getValueOfPropertyAt(t, e, "fontSize") }, measureLine: function (t) { t = this._measureLine(t); return 0 !== this.charSpacing && (t.width -= this._getWidthOfCharSpacing()), t.width < 0 && (t.width = 0), t }, _measureLine: function (t) { var e, i, n, o, r, a, s = 0, l = this._textLines[t], c = new Array(l.length), d = 0, h = this.path; for (this.__charBounds[t] = c, h && (r = u.util.getPointOnPath(h.path, 0, h.segmentsInfo), a = h.segmentsInfo[h.segmentsInfo.length - 1].length, r.x += h.pathOffset.x, r.y += h.pathOffset.y), e = 0; e < l.length; e++)i = l[e], o = this._getGraphemeBox(i, t, e, n), h && (a < d && (d %= a), this._setGraphemeOnPath(d, o, r)), s += (c[e] = o).kernedWidth, d += o.kernedWidth, n = i; return c[e] = { left: o ? o.left + o.width : 0, width: 0, kernedWidth: 0, height: this.fontSize }, { width: s, numOfSpaces: 0 } }, _setGraphemeOnPath: function (t, e, i) { var n = t + e.kernedWidth / 2, o = this.path, t = u.util.getPointOnPath(o.path, n - .1, o.segmentsInfo), o = u.util.getPointOnPath(o.path, n + .1, o.segmentsInfo); e.renderLeft = t.x - i.x, e.renderTop = t.y - i.y, e.angle = Math.atan2(o.y - t.y, o.x - t.x) }, _getGraphemeBox: function (t, e, i, n, o) { var r = this.getCompleteStyleDeclaration(e, i), a = n ? this.getCompleteStyleDeclaration(e, i - 1) : {}, s = this._measureChar(t, r, n, a), t = s.kernedWidth, n = s.width; 0 !== this.charSpacing && (n += a = this._getWidthOfCharSpacing(), t += a); r = { width: n, left: 0, height: r.fontSize, kernedWidth: t, deltaY: r.deltaY }; return 0 < i && !o && (i = this.__charBounds[e][i - 1], r.left = i.left + i.width + s.kernedWidth - s.width), r }, getHeightOfLine: function (t) { if (this.__lineHeights[t]) return this.__lineHeights[t]; for (var e = this._textLines[t], i = this.getHeightOfChar(t, 0), n = 1, o = e.length; n < o; n++)i = Math.max(this.getHeightOfChar(t, n), i); return this.__lineHeights[t] = i * this.lineHeight * this._fontSizeMult }, calcTextHeight: function () { for (var t, e = 0, i = 0, n = this._textLines.length; i < n; i++)t = this.getHeightOfLine(i), e += i === n - 1 ? t / this.lineHeight : t; return e }, _getLeftOffset: function () { return -this.width / 2 }, _getTopOffset: function () { return -this.height / 2 }, _renderTextCommon: function (t, e) { t.save(); for (var i = 0, n = this._getLeftOffset(), o = this._getTopOffset(), r = 0, a = this._textLines.length; r < a; r++){ var s = this.getHeightOfLine(r), l = s / this.lineHeight, c = this._getLineLeftOffset(r); this._renderTextLine(e, t, this._textLines[r], n + c, o + i + l, r), i += s } t.restore() }, _renderTextFill: function (t) { (this.fill || this.styleHas("fill")) && this._renderTextCommon(t, "fillText") }, _renderTextStroke: function (t) { (this.stroke && 0 !== this.strokeWidth || !this.isEmptyStyles()) && (this.shadow && !this.shadow.affectStroke && this._removeShadow(t), t.save(), this._setLineDash(t, this.strokeDashArray), t.beginPath(), this._renderTextCommon(t, "strokeText"), t.closePath(), t.restore()) }, _renderChars: function (t, e, i, n, o, r) { var a, s, l, c, d = this.getHeightOfLine(r), h = -1 !== this.textAlign.indexOf("justify"), u = "", f = 0, p = this.path, g = !h && 0 === this.charSpacing && this.isEmptyStyles(r) && !p; if (e.save(), o -= d * this._fontSizeFraction / this.lineHeight, g) return this._renderChar(t, e, r, 0, i.join(""), n, o, d), void e.restore(); for (var b = 0, m = i.length - 1; b <= m; b++)c = b === m || this.charSpacing || p, u += i[b], l = this.__charBounds[r][b], 0 === f ? (n += l.kernedWidth - l.width, f += l.width) : f += l.kernedWidth, h && !c && this._reSpaceAndTab.test(i[b]) && (c = !0), c || (a = a || this.getCompleteStyleDeclaration(r, b), s = this.getCompleteStyleDeclaration(r, b + 1), c = this._hasStyleChanged(a, s)), c && (p ? (e.save(), e.translate(l.renderLeft, l.renderTop), e.rotate(l.angle), this._renderChar(t, e, r, b, u, -f / 2, 0, d), e.restore()) : this._renderChar(t, e, r, b, u, n, o, d), u = "", a = s, n += f, f = 0); e.restore() }, _applyPatternGradientTransformText: function (t) { var e, i = u.util.createCanvasElement(), n = this.width + this.strokeWidth, o = this.height + this.strokeWidth; return i.width = n, i.height = o, (e = i.getContext("2d")).beginPath(), e.moveTo(0, 0), e.lineTo(n, 0), e.lineTo(n, o), e.lineTo(0, o), e.closePath(), e.translate(n / 2, o / 2), e.fillStyle = t.toLive(e), this._applyPatternGradientTransform(e, t), e.fill(), e.createPattern(i, "no-repeat") }, handleFiller: function (t, e, i) { var n, o; return i.toLive ? "percentage" === i.gradientUnits || i.gradientTrasnform || i.patternTransform ? (n = -this.width / 2, o = -this.height / 2, t.translate(n, o), t[e] = this._applyPatternGradientTransformText(i), { offsetX: n, offsetY: o }) : (t[e] = i.toLive(t, this), this._applyPatternGradientTransform(t, i)) : (t[e] = i, { offsetX: 0, offsetY: 0 }) }, _setStrokeStyles: function (t, e) { return t.lineWidth = e.strokeWidth, t.lineCap = this.strokeLineCap, t.lineDashOffset = this.strokeDashOffset, t.lineJoin = this.strokeLineJoin, t.miterLimit = this.strokeMiterLimit, this.handleFiller(t, "strokeStyle", e.stroke) }, _setFillStyles: function (t, e) { return this.handleFiller(t, "fillStyle", e.fill) }, _renderChar: function (t, e, i, n, o, r, a) { var s, l, c = this._getStyleDeclaration(i, n), i = this.getCompleteStyleDeclaration(i, n), n = "fillText" === t && i.fill, t = "strokeText" === t && i.stroke && i.strokeWidth; (t || n) && (e.save(), n && (s = this._setFillStyles(e, i)), t && (l = this._setStrokeStyles(e, i)), e.font = this._getFontDeclaration(i), c && c.textBackgroundColor && this._removeShadow(e), c && c.deltaY && (a += c.deltaY), n && e && o.length >= 1 && r && s && a && e.fillText(o, r - s.offsetX, a - s.offsetY), t && e.strokeText(o, r - l.offsetX, a - l.offsetY), e.restore()) }, setSuperscript: function (t, e) { return this._setScript(t, e, this.superscript) }, setSubscript: function (t, e) { return this._setScript(t, e, this.subscript) }, _setScript: function (t, e, i) { var n = this.get2DCursorLocation(t, !0), o = this.getValueOfPropertyAt(n.lineIndex, n.charIndex, "fontSize"), n = this.getValueOfPropertyAt(n.lineIndex, n.charIndex, "deltaY"), i = { fontSize: o * i.size, deltaY: n + o * i.baseline }; return this.setSelectionStyles(i, t, e), this }, _hasStyleChanged: function (t, e) { return t.fill !== e.fill || t.stroke !== e.stroke || t.strokeWidth !== e.strokeWidth || t.fontSize !== e.fontSize || t.fontFamily !== e.fontFamily || t.fontWeight !== e.fontWeight || t.fontStyle !== e.fontStyle || t.deltaY !== e.deltaY }, _hasStyleChangedForSvg: function (t, e) { return this._hasStyleChanged(t, e) || t.overline !== e.overline || t.underline !== e.underline || t.linethrough !== e.linethrough }, _getLineLeftOffset: function (t) { var e = this.getLineWidth(t); return "center" === this.textAlign ? (this.width - e) / 2 : "right" === this.textAlign ? this.width - e : "justify-center" === this.textAlign && this.isEndOfWrapping(t) ? (this.width - e) / 2 : "justify-right" === this.textAlign && this.isEndOfWrapping(t) ? this.width - e : 0 }, _clearCache: function () { this.__lineWidths = [], this.__lineHeights = [], this.__charBounds = [] }, _shouldClearDimensionCache: function () { var t = this._forceClearCache; return (t = t || this.hasStateChanged("_dimensionAffectingProps")) && (this.dirty = !0, this._forceClearCache = !1), t }, getLineWidth: function (t) { if (this.__lineWidths[t]) return this.__lineWidths[t]; var e = "" === this._textLines[t] ? 0 : this.measureLine(t).width; return this.__lineWidths[t] = e }, _getWidthOfCharSpacing: function () { return 0 !== this.charSpacing ? this.fontSize * this.charSpacing / 1e3 : 0 }, getValueOfPropertyAt: function (t, e, i) { e = this._getStyleDeclaration(t, e); return (e && void 0 !== e[i] ? e : this)[i] }, _renderTextDecoration: function (t, e) { if (this[e] || this.styleHas(e)) { for (var i, n, o, r, a, s, l, c, d, h, u, f, p, g, b, m, v = this._getLeftOffset(), x = this._getTopOffset(), y = this.path, _ = this._getWidthOfCharSpacing(), w = 0, C = this._textLines.length; w < C; w++)if (i = this.getHeightOfLine(w), this[e] || this.styleHas(e, w)) { l = this._textLines[w], g = i / this.lineHeight, r = this._getLineLeftOffset(w), u = h = 0, c = this.getValueOfPropertyAt(w, 0, e), m = this.getValueOfPropertyAt(w, 0, "fill"), d = x + g * (1 - this._fontSizeFraction), n = this.getHeightOfChar(w, 0), a = this.getValueOfPropertyAt(w, 0, "deltaY"); for (var S = 0, T = l.length; S < T; S++)f = this.__charBounds[w][S], p = this.getValueOfPropertyAt(w, S, e), b = this.getValueOfPropertyAt(w, S, "fill"), o = this.getHeightOfChar(w, S), s = this.getValueOfPropertyAt(w, S, "deltaY"), y && p && b ? (t.save(), t.fillStyle = m, t.translate(f.renderLeft, f.renderTop), t.rotate(f.angle), t.fillRect(-f.kernedWidth / 2, this.offsets[e] * o + s, f.kernedWidth, this.fontSize / 15), t.restore()) : (p !== c || b !== m || o !== n || s !== a) && 0 < u ? (c && m && t.fillRect(v + r + h, d + this.offsets[e] * n + a, u, this.fontSize / 15), h = f.left, u = f.width, c = p, m = b, n = o, a = s) : u += f.kernedWidth; t.fillStyle = b, p && b && t.fillRect(v + r + h, d + this.offsets[e] * n + a, u - _, this.fontSize / 15), x += i } else x += i; this._removeShadow(t) } }, _getFontDeclaration: function (t, e) { var i = t || this, n = this.fontFamily, t = -1 < u.Text.genericFonts.indexOf(n.toLowerCase()), t = void 0 === n || -1 < n.indexOf("'") || -1 < n.indexOf(",") || -1 < n.indexOf('"') || t ? i.fontFamily : '"' + i.fontFamily + '"'; return [u.isLikelyNode ? i.fontWeight : i.fontStyle, u.isLikelyNode ? i.fontStyle : i.fontWeight, e ? this.CACHE_FONT_SIZE + "px" : i.fontSize + "px", t].join(" ") }, render: function (t) { this.visible && (this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (this._shouldClearDimensionCache() && this.initDimensions(), this.callSuper("render", t))) }, _splitTextIntoLines: function (t) { for (var e = t.split(this._reNewline), i = new Array(e.length), n = ["\n"], o = [], r = 0; r < e.length; r++)i[r] = u.util.string.graphemeSplit(e[r]), o = o.concat(i[r], n); return o.pop(), { _unwrappedLines: i, lines: e, graphemeText: o, graphemeLines: i } }, toObject: function (t) { t = ["text", "fontSize", "fontWeight", "fontFamily", "fontStyle", "lineHeight", "underline", "overline", "linethrough", "textAlign", "textBackgroundColor", "charSpacing"].concat(t), t = this.callSuper("toObject", t); return t.styles = a(this.styles, !0), t }, set: function (t, e) { this.callSuper("set", t, e); var i = !1, n = !1; if ("object" == typeof t) for (var o in t) "path" === o && this.setPathInfo(), i = i || -1 !== this._dimensionAffectingProps.indexOf(o), n = n || "path" === o; else i = -1 !== this._dimensionAffectingProps.indexOf(t), n = "path" === t; return n && this.setPathInfo(), i && (this.initDimensions(), this.setCoords()), this }, complexity: function () { return 1 } }), u.Text.ATTRIBUTE_NAMES = u.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")), u.Text.DEFAULT_SVG_FONT_SIZE = 16, u.Text.fromElement = function (t, e, i) { if (!t) return e(null); var n = u.parseAttributes(t, u.Text.ATTRIBUTE_NAMES), o = n.textAnchor || "left"; (i = u.util.object.extend(i ? a(i) : {}, n)).top = i.top || 0, i.left = i.left || 0, n.textDecoration && (-1 !== (r = n.textDecoration).indexOf("underline") && (i.underline = !0), -1 !== r.indexOf("overline") && (i.overline = !0), -1 !== r.indexOf("line-through") && (i.linethrough = !0), delete i.textDecoration), "dx" in n && (i.left += n.dx), "dy" in n && (i.top += n.dy), "fontSize" in i || (i.fontSize = u.Text.DEFAULT_SVG_FONT_SIZE); var r = ""; "textContent" in t ? r = t.textContent : "firstChild" in t && null !== t.firstChild && "data" in t.firstChild && null !== t.firstChild.data && (r = t.firstChild.data), r = r.replace(/^\s+|\s+$|\n+/g, "").replace(/\s+/g, " "); n = i.strokeWidth; i.strokeWidth = 0; t = new u.Text(r, i), r = t.getScaledHeight() / t.height, i = ((t.height + t.strokeWidth) * t.lineHeight - t.height) * r, r = t.getScaledHeight() + i, i = 0; "center" === o && (i = t.getScaledWidth() / 2), "right" === o && (i = t.getScaledWidth()), t.set({ left: t.left - i, top: t.top - (r - t.fontSize * (.07 + t._fontSizeFraction)) / t.lineHeight, strokeWidth: void 0 !== n ? n : 1 }), e(t) }, u.Text.fromObject = function (t, e) { return u.Object._fromObject("Text", t, e, "text") }, u.Text.genericFonts = ["sans-serif", "serif", "cursive", "fantasy", "monospace"], u.util.createAccessors && u.util.createAccessors(u.Text)) }("undefined" != typeof exports ? exports : this), fabric.util.object.extend(fabric.Text.prototype, { isEmptyStyles: function (t) { if (!this.styles) return !0; if (void 0 !== t && !this.styles[t]) return !0; var e, i = void 0 === t ? this.styles : { line: this.styles[t] }; for (e in i) for (var n in i[e]) for (var o in i[e][n]) return !1; return !0 }, styleHas: function (t, e) { if (!this.styles || !t || "" === t) return !1; if (void 0 !== e && !this.styles[e]) return !1; var i, n = void 0 === e ? this.styles : { 0: this.styles[e] }; for (i in n) for (var o in n[i]) if (void 0 !== n[i][o][t]) return !0; return !1 }, cleanStyle: function (t) { if (!this.styles || !t || "" === t) return !1; var e, i, n, o, r = this.styles, a = 0, s = !0, l = 0; for (n in r) { for (var c in e = 0, r[n]) a++ , (o = r[n][c]).hasOwnProperty(t) ? (i ? o[t] !== i && (s = !1) : i = o[t], o[t] === this[t] && delete o[t]) : s = !1, 0 !== Object.keys(o).length ? e++ : delete r[n][c]; 0 === e && delete r[n] } for (var d = 0; d < this._textLines.length; d++)l += this._textLines[d].length; s && a === l && (this[t] = i, this.removeStyle(t)) }, removeStyle: function (t) { if (this.styles && t && "" !== t) { var e, i, n, o = this.styles; for (i in o) { for (n in e = o[i]) delete e[n][t], 0 === Object.keys(e[n]).length && delete e[n]; 0 === Object.keys(e).length && delete o[i] } } }, _extendStyles: function (t, e) { t = this.get2DCursorLocation(t); this._getLineStyle(t.lineIndex) || this._setLineStyle(t.lineIndex), this._getStyleDeclaration(t.lineIndex, t.charIndex) || this._setStyleDeclaration(t.lineIndex, t.charIndex, {}), fabric.util.object.extend(this._getStyleDeclaration(t.lineIndex, t.charIndex), e) }, get2DCursorLocation: function (t, e) { void 0 === t && (t = this.selectionStart); for (var i = e ? this._unwrappedTextLines : this._textLines, n = i.length, o = 0; o < n; o++){ if (t <= i[o].length) return { lineIndex: o, charIndex: t }; t -= i[o].length + this.missingNewlineOffset(o) } return { lineIndex: o - 1, charIndex: i[o - 1].length < t ? i[o - 1].length : t } }, getSelectionStyles: function (t, e, i) { void 0 === t && (t = this.selectionStart || 0), void 0 === e && (e = this.selectionEnd || t); for (var n = [], o = t; o < e; o++)n.push(this.getStyleAtPosition(o, i)); return n }, getStyleAtPosition: function (t, e) { t = this.get2DCursorLocation(t); return (e ? this.getCompleteStyleDeclaration(t.lineIndex, t.charIndex) : this._getStyleDeclaration(t.lineIndex, t.charIndex)) || {} }, setSelectionStyles: function (t, e, i) { void 0 === e && (e = this.selectionStart || 0), void 0 === i && (i = this.selectionEnd || e); for (var n = e; n < i; n++)this._extendStyles(n, t); return this._forceClearCache = !0, this }, _getStyleDeclaration: function (t, e) { t = this.styles && this.styles[t]; return t ? t[e] : null }, getCompleteStyleDeclaration: function (t, e) { for (var i, n = this._getStyleDeclaration(t, e) || {}, o = {}, r = 0; r < this._styleProperties.length; r++)o[i = this._styleProperties[r]] = (void 0 === n[i] ? this : n)[i]; return o }, _setStyleDeclaration: function (t, e, i) { this.styles[t][e] = i }, _deleteStyleDeclaration: function (t, e) { delete this.styles[t][e] }, _getLineStyle: function (t) { return !!this.styles[t] }, _setLineStyle: function (t) { this.styles[t] = {} }, _deleteLineStyle: function (t) { delete this.styles[t] } }), function () { function o(t) { t.textDecoration && (-1 < t.textDecoration.indexOf("underline") && (t.underline = !0), -1 < t.textDecoration.indexOf("line-through") && (t.linethrough = !0), -1 < t.textDecoration.indexOf("overline") && (t.overline = !0), delete t.textDecoration) } fabric.IText = fabric.util.createClass(fabric.Text, fabric.Observable, { type: "i-text", selectionStart: 0, selectionEnd: 0, selectionColor: "rgba(17,119,255,0.3)", isEditing: !1, editable: !0, editingBorderColor: "rgba(102,153,255,0.25)", cursorWidth: 2, cursorColor: "", cursorDelay: 1e3, cursorDuration: 600, caching: !0, _reSpace: /\s|\n/, _currentCursorOpacity: 0, _selectionDirection: null, _abortCursorAnimation: !1, __widthOfSpace: [], inCompositionMode: !1, initialize: function (t, e) { this.callSuper("initialize", t, e), this.initBehavior() }, setSelectionStart: function (t) { t = Math.max(t, 0), this._updateAndFire("selectionStart", t) }, setSelectionEnd: function (t) { t = Math.min(t, this.text.length), this._updateAndFire("selectionEnd", t) }, _updateAndFire: function (t, e) { this[t] !== e && (this._fireSelectionChanged(), this[t] = e), this._updateTextarea() }, _fireSelectionChanged: function () { this.fire("selection:changed"), this.canvas && this.canvas.fire("text:selection:changed", { target: this }) }, initDimensions: function () { this.isEditing && this.initDelayedCursor(), this.clearContextTop(), this.callSuper("initDimensions") }, render: function (t) { this.clearContextTop(), this.callSuper("render", t), this.cursorOffsetCache = {}, this.renderCursorOrSelection() }, _render: function (t) { this.callSuper("_render", t) }, clearContextTop: function (t) { var e, i; this.isEditing && this.canvas && this.canvas.contextTop && (e = this.canvas.contextTop, i = this.canvas.viewportTransform, e.save(), e.transform(i[0], i[1], i[2], i[3], i[4], i[5]), this.transform(e), this._clearTextArea(e), t || e.restore()) }, renderCursorOrSelection: function () { var t, e; this.isEditing && this.canvas && this.canvas.contextTop && (t = this._getCursorBoundaries(), e = this.canvas.contextTop, this.clearContextTop(!0), this.selectionStart === this.selectionEnd ? this.renderCursor(t, e) : this.renderSelection(t, e), e.restore()) }, _clearTextArea: function (t) { var e = this.width + 4, i = this.height + 4; t.clearRect(-e / 2, -i / 2, e, i) }, _getCursorBoundaries: function (t) { void 0 === t && (t = this.selectionStart); var e = this._getLeftOffset(), i = this._getTopOffset(), t = this._getCursorBoundariesOffsets(t); return { left: e, top: i, leftOffset: t.left, topOffset: t.top } }, _getCursorBoundariesOffsets: function (t) { if (this.cursorOffsetCache && "top" in this.cursorOffsetCache) return this.cursorOffsetCache; for (var e = 0, i = 0, n = this.get2DCursorLocation(t), o = n.charIndex, r = n.lineIndex, a = 0; a < r; a++)e += this.getHeightOfLine(a); t = this._getLineLeftOffset(r); n = this.__charBounds[r][o]; return n && (i = n.left), 0 !== this.charSpacing && o === this._textLines[r].length && (i -= this._getWidthOfCharSpacing()), i = { top: e, left: t + (0 < i ? i : 0) }, this.cursorOffsetCache = i, this.cursorOffsetCache }, renderCursor: function (t, e) { var i = this.get2DCursorLocation(), n = i.lineIndex, o = 0 < i.charIndex ? i.charIndex - 1 : 0, r = this.getValueOfPropertyAt(n, o, "fontSize"), a = this.scaleX * this.canvas.getZoom(), s = this.cursorWidth / a, i = t.topOffset, a = this.getValueOfPropertyAt(n, o, "deltaY"); i += (1 - this._fontSizeFraction) * this.getHeightOfLine(n) / this.lineHeight - r * (1 - this._fontSizeFraction), this.inCompositionMode && this.renderSelection(t, e), e.fillStyle = this.cursorColor || this.getValueOfPropertyAt(n, o, "fill"), e.globalAlpha = this.__isMousedown ? 1 : this._currentCursorOpacity, e.fillRect(t.left + t.leftOffset - s / 2, i + t.top + a, s, r) }, renderSelection: function (t, e) { for (var i = (this.inCompositionMode ? this.hiddenTextarea : this).selectionStart, n = (this.inCompositionMode ? this.hiddenTextarea : this).selectionEnd, o = -1 !== this.textAlign.indexOf("justify"), i = this.get2DCursorLocation(i), n = this.get2DCursorLocation(n), r = i.lineIndex, a = n.lineIndex, s = i.charIndex < 0 ? 0 : i.charIndex, l = n.charIndex < 0 ? 0 : n.charIndex, c = r; c <= a; c++){ var d, h, u = this._getLineLeftOffset(c) || 0, f = this.getHeightOfLine(c), p = 0, g = 0; c === r && (p = this.__charBounds[r][s].left), r <= c && c < a ? g = o && !this.isEndOfWrapping(c) ? this.width : this.getLineWidth(c) || 5 : c === a && (g = 0 === l ? this.__charBounds[a][l].left : (h = this._getWidthOfCharSpacing(), this.__charBounds[a][l - 1].left + this.__charBounds[a][l - 1].width - h)), d = f, (this.lineHeight < 1 || c === a && 1 < this.lineHeight) && (f /= this.lineHeight), this.inCompositionMode ? (e.fillStyle = this.compositionColor || "black", e.fillRect(t.left + u + p, t.top + t.topOffset + f, g - p, 1)) : (e.fillStyle = this.selectionColor, e.fillRect(t.left + u + p, t.top + t.topOffset, g - p, f)), t.topOffset += d } }, getCurrentCharFontSize: function () { var t = this._getCurrentCharIndex(); return this.getValueOfPropertyAt(t.l, t.c, "fontSize") }, getCurrentCharColor: function () { var t = this._getCurrentCharIndex(); return this.getValueOfPropertyAt(t.l, t.c, "fill") }, _getCurrentCharIndex: function () { var t = this.get2DCursorLocation(this.selectionStart, !0), e = 0 < t.charIndex ? t.charIndex - 1 : 0; return { l: t.lineIndex, c: e } } }), fabric.IText.fromObject = function (t, e) { if (o(t), t.styles) for (var i in t.styles) for (var n in t.styles[i]) o(t.styles[i][n]); fabric.Object._fromObject("IText", t, e, "text") } }(), function () { var h = fabric.util.object.clone; fabric.util.object.extend(fabric.IText.prototype, { initBehavior: function () { this.initAddedHandler(), this.initRemovedHandler(), this.initCursorSelectionHandlers(), this.initDoubleClickSimulation(), this.mouseMoveHandler = this.mouseMoveHandler.bind(this) }, onDeselect: function () { this.isEditing && this.exitEditing(), this.selected = !1 }, initAddedHandler: function () { var e = this; this.on("added", function () { var t = e.canvas; t && (t._hasITextHandlers || (t._hasITextHandlers = !0, e._initCanvasHandlers(t)), t._iTextInstances = t._iTextInstances || [], t._iTextInstances.push(e)) }) }, initRemovedHandler: function () { var e = this; this.on("removed", function () { var t = e.canvas; t && (t._iTextInstances = t._iTextInstances || [], fabric.util.removeFromArray(t._iTextInstances, e), 0 === t._iTextInstances.length && (t._hasITextHandlers = !1, e._removeCanvasHandlers(t))) }) }, _initCanvasHandlers: function (t) { t._mouseUpITextHandler = function () { t._iTextInstances && t._iTextInstances.forEach(function (t) { t.__isMousedown = !1 }) }, t.on("mouse:up", t._mouseUpITextHandler) }, _removeCanvasHandlers: function (t) { t.off("mouse:up", t._mouseUpITextHandler) }, _tick: function () { this._currentTickState = this._animateCursor(this, 1, this.cursorDuration, "_onTickComplete") }, _animateCursor: function (t, e, i, n) { var o = { isAborted: !1, abort: function () { this.isAborted = !0 } }; return t.animate("_currentCursorOpacity", e, { duration: i, onComplete: function () { o.isAborted || t[n]() }, onChange: function () { t.canvas && t.selectionStart === t.selectionEnd && t.renderCursorOrSelection() }, abort: function () { return o.isAborted } }), o }, _onTickComplete: function () { var t = this; this._cursorTimeout1 && clearTimeout(this._cursorTimeout1), this._cursorTimeout1 = setTimeout(function () { t._currentTickCompleteState = t._animateCursor(t, 0, this.cursorDuration / 2, "_tick") }, 100) }, initDelayedCursor: function (t) { var e = this, t = t ? 0 : this.cursorDelay; this.abortCursorAnimation(), this._currentCursorOpacity = 1, this._cursorTimeout2 = setTimeout(function () { e._tick() }, t) }, abortCursorAnimation: function () { var t = this._currentTickState || this._currentTickCompleteState, e = this.canvas; this._currentTickState && this._currentTickState.abort(), this._currentTickCompleteState && this._currentTickCompleteState.abort(), clearTimeout(this._cursorTimeout1), clearTimeout(this._cursorTimeout2), this._currentCursorOpacity = 0, t && e && e.clearContext(e.contextTop || e.contextContainer) }, selectAll: function () { return this.selectionStart = 0, this.selectionEnd = this._text.length, this._fireSelectionChanged(), this._updateTextarea(), this }, getSelectedText: function () { return this._text.slice(this.selectionStart, this.selectionEnd).join("") }, findWordBoundaryLeft: function (t) { var e = 0, i = t - 1; if (this._reSpace.test(this._text[i])) for (; this._reSpace.test(this._text[i]);)e++ , i--; for (; /\S/.test(this._text[i]) && -1 < i;)e++ , i--; return t - e }, findWordBoundaryRight: function (t) { var e = 0, i = t; if (this._reSpace.test(this._text[i])) for (; this._reSpace.test(this._text[i]);)e++ , i++; for (; /\S/.test(this._text[i]) && i < this._text.length;)e++ , i++; return t + e }, findLineBoundaryLeft: function (t) { for (var e = 0, i = t - 1; !/\n/.test(this._text[i]) && -1 < i;)e++ , i--; return t - e }, findLineBoundaryRight: function (t) { for (var e = 0, i = t; !/\n/.test(this._text[i]) && i < this._text.length;)e++ , i++; return t + e }, searchWordBoundary: function (t, e) { for (var i = this._text, n = this._reSpace.test(i[t]) ? t - 1 : t, o = i[n], r = fabric.reNonWord; !r.test(o) && 0 < n && n < i.length;)o = i[n += e]; return r.test(o) && (n += 1 === e ? 0 : 1), n }, selectWord: function (t) { t = t || this.selectionStart; var e = this.searchWordBoundary(t, -1), t = this.searchWordBoundary(t, 1); this.selectionStart = e, this.selectionEnd = t, this._fireSelectionChanged(), this._updateTextarea(), this.renderCursorOrSelection() }, selectLine: function (t) { t = t || this.selectionStart; var e = this.findLineBoundaryLeft(t), t = this.findLineBoundaryRight(t); return this.selectionStart = e, this.selectionEnd = t, this._fireSelectionChanged(), this._updateTextarea(), this }, enterEditing: function (t) { if (!this.isEditing && this.editable) return this.canvas && (this.canvas.calcOffset(), this.exitEditingOnOthers(this.canvas)), this.isEditing = !0, this.initHiddenTextarea(t), this.hiddenTextarea.focus(), this.hiddenTextarea.value = this.text, this._updateTextarea(), this._saveEditingProps(), this._setEditingProps(), this._textBeforeEdit = this.text, this._tick(), this.fire("editing:entered"), this._fireSelectionChanged(), this.canvas && (this.canvas.fire("text:editing:entered", { target: this }), this.initMouseMoveHandler(), this.canvas.requestRenderAll()), this }, exitEditingOnOthers: function (t) { t._iTextInstances && t._iTextInstances.forEach(function (t) { t.selected = !1, t.isEditing && t.exitEditing() }) }, initMouseMoveHandler: function () { this.canvas.on("mouse:move", this.mouseMoveHandler) }, mouseMoveHandler: function (t) { var e, i; this.__isMousedown && this.isEditing && (e = this.getSelectionStartFromPointer(t.e), i = this.selectionStart, t = this.selectionEnd, (e === this.__selectionStartOnMouseDown && i !== t || i !== e && t !== e) && (e > this.__selectionStartOnMouseDown ? (this.selectionStart = this.__selectionStartOnMouseDown, this.selectionEnd = e) : (this.selectionStart = e, this.selectionEnd = this.__selectionStartOnMouseDown), this.selectionStart === i && this.selectionEnd === t || (this.restartCursorIfNeeded(), this._fireSelectionChanged(), this._updateTextarea(), this.renderCursorOrSelection()))) }, _setEditingProps: function () { this.hoverCursor = "text", this.canvas && (this.canvas.defaultCursor = this.canvas.moveCursor = "text"), this.borderColor = this.editingBorderColor, this.hasControls = this.selectable = !1, this.lockMovementX = this.lockMovementY = !0 }, fromStringToGraphemeSelection: function (t, e, i) { var n = i.slice(0, t), n = fabric.util.string.graphemeSplit(n).length; if (t === e) return { selectionStart: n, selectionEnd: n }; e = i.slice(t, e); return { selectionStart: n, selectionEnd: n + fabric.util.string.graphemeSplit(e).length } }, fromGraphemeToStringSelection: function (t, e, i) { var n = i.slice(0, t).join("").length; return t === e ? { selectionStart: n, selectionEnd: n } : { selectionStart: n, selectionEnd: n + i.slice(t, e).join("").length } }, _updateTextarea: function () { var t; this.cursorOffsetCache = {}, this.hiddenTextarea && (this.inCompositionMode || (t = this.fromGraphemeToStringSelection(this.selectionStart, this.selectionEnd, this._text), this.hiddenTextarea.selectionStart = t.selectionStart, this.hiddenTextarea.selectionEnd = t.selectionEnd), this.updateTextareaPosition()) }, updateFromTextArea: function () { var t; this.hiddenTextarea && (this.cursorOffsetCache = {}, this.text = this.hiddenTextarea.value, this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), t = this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart, this.hiddenTextarea.selectionEnd, this.hiddenTextarea.value), this.selectionEnd = this.selectionStart = t.selectionEnd, this.inCompositionMode || (this.selectionStart = t.selectionStart), this.updateTextareaPosition()) }, updateTextareaPosition: function () { var t; this.selectionStart === this.selectionEnd && (t = this._calcTextareaPosition(), this.hiddenTextarea.style.left = t.left, this.hiddenTextarea.style.top = t.top) }, _calcTextareaPosition: function () { if (!this.canvas) return { x: 1, y: 1 }; var t = this.inCompositionMode ? this.compositionStart : this.selectionStart, e = this._getCursorBoundaries(t), i = this.get2DCursorLocation(t), n = i.lineIndex, o = i.charIndex, r = this.getValueOfPropertyAt(n, o, "fontSize") * this.lineHeight, a = e.leftOffset, s = this.calcTransformMatrix(), t = { x: e.left + a, y: e.top + e.topOffset + r }, i = this.canvas.getRetinaScaling(), n = this.canvas.upperCanvasEl, o = n.width / i, a = n.height / i, e = o - r, i = a - r, o = n.clientWidth / o, a = n.clientHeight / a, t = fabric.util.transformPoint(t, s); return (t = fabric.util.transformPoint(t, this.canvas.viewportTransform)).x *= o, t.y *= a, t.x < 0 && (t.x = 0), t.x > e && (t.x = e), t.y < 0 && (t.y = 0), t.y > i && (t.y = i), t.x += this.canvas._offset.left, t.y += this.canvas._offset.top, { left: t.x + "px", top: t.y + "px", fontSize: r + "px", charHeight: r } }, _saveEditingProps: function () { this._savedProps = { hasControls: this.hasControls, borderColor: this.borderColor, lockMovementX: this.lockMovementX, lockMovementY: this.lockMovementY, hoverCursor: this.hoverCursor, selectable: this.selectable, defaultCursor: this.canvas && this.canvas.defaultCursor, moveCursor: this.canvas && this.canvas.moveCursor } }, _restoreEditingProps: function () { this._savedProps && (this.hoverCursor = this._savedProps.hoverCursor, this.hasControls = this._savedProps.hasControls, this.borderColor = this._savedProps.borderColor, this.selectable = this._savedProps.selectable, this.lockMovementX = this._savedProps.lockMovementX, this.lockMovementY = this._savedProps.lockMovementY, this.canvas && (this.canvas.defaultCursor = this._savedProps.defaultCursor, this.canvas.moveCursor = this._savedProps.moveCursor)) }, exitEditing: function () { var t = this._textBeforeEdit !== this.text, e = this.hiddenTextarea; return this.selected = !1, this.isEditing = !1, this.selectionEnd = this.selectionStart, e && (e.blur && e.blur(), e.parentNode && e.parentNode.removeChild(e)), this.hiddenTextarea = null, this.abortCursorAnimation(), this._restoreEditingProps(), this._currentCursorOpacity = 0, this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this.fire("editing:exited"), t && this.fire("modified"), this.canvas && (this.canvas.off("mouse:move", this.mouseMoveHandler), this.canvas.fire("text:editing:exited", { target: this }), t && this.canvas.fire("object:modified", { target: this })), this }, _removeExtraneousStyles: function () { for (var t in this.styles) this._textLines[t] || delete this.styles[t] }, removeStyleFromTo: function (t, e) { var i, t = this.get2DCursorLocation(t, !0), e = this.get2DCursorLocation(e, !0), n = t.lineIndex, o = t.charIndex, r = e.lineIndex, a = e.charIndex; if (n !== r) { if (this.styles[n]) for (d = o; d < this._unwrappedTextLines[n].length; d++)delete this.styles[n][d]; if (this.styles[r]) for (d = a; d < this._unwrappedTextLines[r].length; d++)(i = this.styles[r][d]) && (this.styles[n] || (this.styles[n] = {}), this.styles[n][o + d - a] = i); for (d = n + 1; d <= r; d++)delete this.styles[d]; this.shiftLineStyles(r, n - r) } else if (this.styles[n]) { i = this.styles[n]; for (var s, l, c = a - o, d = o; d < a; d++)delete i[d]; for (l in this.styles[n]) a <= (s = parseInt(l, 10)) && (i[s - c] = i[l], delete i[l]) } }, shiftLineStyles: function (t, e) { var i, n = h(this.styles); for (i in this.styles) { var o = parseInt(i, 10); t < o && (this.styles[o + e] = n[o], n[o - e] || delete this.styles[o]) } }, restartCursorIfNeeded: function () { this._currentTickState && !this._currentTickState.isAborted && this._currentTickCompleteState && !this._currentTickCompleteState.isAborted || this.initDelayedCursor() }, insertNewlineStyleObject: function (t, e, i, n) { var o, r, a = {}, s = !1, l = this._unwrappedTextLines[t].length === e; for (r in i = i || 1, this.shiftLineStyles(t, i), this.styles[t] && (o = this.styles[t][0 === e ? e : e - 1]), this.styles[t]) { var c = parseInt(r, 10); e <= c && (s = !0, a[c - e] = this.styles[t][r], l && 0 === e || delete this.styles[t][r]) } var d = !1; for (s && !l && (this.styles[t + i] = a, d = !0), d && i--; 0 < i;)n && n[i - 1] ? this.styles[t + i] = { 0: h(n[i - 1]) } : o ? this.styles[t + i] = { 0: h(o) } : delete this.styles[t + i], i--; this._forceClearCache = !0 }, insertCharStyleObject: function (t, e, i, n) { this.styles || (this.styles = {}); var o, r = this.styles[t], a = r ? h(r) : {}; for (o in i = i || 1, a) { var s = parseInt(o, 10); e <= s && (r[s + i] = a[s], a[s - i] || delete r[s]) } if (this._forceClearCache = !0, n) for (; i--;)Object.keys(n[i]).length && (this.styles[t] || (this.styles[t] = {}), this.styles[t][e + i] = h(n[i])); else if (r) for (var l = r[e ? e - 1 : 1]; l && i--;)this.styles[t][e + i] = h(l) }, insertNewStyleBlock: function (t, e, i) { for (var n = this.get2DCursorLocation(e, !0), o = [0], r = 0, a = 0; a < t.length; a++)"\n" === t[a] ? o[++r] = 0 : o[r]++; 0 < o[0] && (this.insertCharStyleObject(n.lineIndex, n.charIndex, o[0], i), i = i && i.slice(o[0] + 1)), r && this.insertNewlineStyleObject(n.lineIndex, n.charIndex + o[0], r); for (a = 1; a < r; a++)0 < o[a] ? this.insertCharStyleObject(n.lineIndex + a, 0, o[a], i) : i && (this.styles[n.lineIndex + a][0] = i[0]), i = i && i.slice(o[a] + 1); 0 < o[a] && this.insertCharStyleObject(n.lineIndex + a, 0, o[a], i) }, setSelectionStartEndWithShift: function (t, e, i) { i <= t ? (e === t ? this._selectionDirection = "left" : "right" === this._selectionDirection && (this._selectionDirection = "left", this.selectionEnd = t), this.selectionStart = i) : t < i && i < e ? "right" === this._selectionDirection ? this.selectionEnd = i : this.selectionStart = i : (e === t ? this._selectionDirection = "right" : "left" === this._selectionDirection && (this._selectionDirection = "right", this.selectionStart = e), this.selectionEnd = i) }, setSelectionInBoundaries: function () { var t = this.text.length; this.selectionStart > t ? this.selectionStart = t : this.selectionStart < 0 && (this.selectionStart = 0), this.selectionEnd > t ? this.selectionEnd = t : this.selectionEnd < 0 && (this.selectionEnd = 0) } }) }(), fabric.util.object.extend(fabric.IText.prototype, { initDoubleClickSimulation: function () { this.__lastClickTime = +new Date, this.__lastLastClickTime = +new Date, this.__lastPointer = {}, this.on("mousedown", this.onMouseDown) }, onMouseDown: function (t) { var e; this.canvas && (this.__newClickTime = +new Date, e = t.pointer, this.isTripleClick(e) && (this.fire("tripleclick", t), this._stopEvent(t.e)), this.__lastLastClickTime = this.__lastClickTime, this.__lastClickTime = this.__newClickTime, this.__lastPointer = e, this.__lastIsEditing = this.isEditing, this.__lastSelected = this.selected) }, isTripleClick: function (t) { return this.__newClickTime - this.__lastClickTime < 500 && this.__lastClickTime - this.__lastLastClickTime < 500 && this.__lastPointer.x === t.x && this.__lastPointer.y === t.y }, _stopEvent: function (t) { t.preventDefault && t.preventDefault(), t.stopPropagation && t.stopPropagation() }, initCursorSelectionHandlers: function () { this.initMousedownHandler(), this.initMouseupHandler(), this.initClicks() }, doubleClickHandler: function (t) { this.isEditing && this.selectWord(this.getSelectionStartFromPointer(t.e)) }, tripleClickHandler: function (t) { this.isEditing && this.selectLine(this.getSelectionStartFromPointer(t.e)) }, initClicks: function () { this.on("mousedblclick", this.doubleClickHandler), this.on("tripleclick", this.tripleClickHandler) }, _mouseDownHandler: function (t) { !this.canvas || !this.editable || t.e.button && 1 !== t.e.button || (this.__isMousedown = !0, this.selected && (this.inCompositionMode = !1, this.setCursorByClick(t.e)), this.isEditing && (this.__selectionStartOnMouseDown = this.selectionStart, this.selectionStart === this.selectionEnd && this.abortCursorAnimation(), this.renderCursorOrSelection())) }, _mouseDownHandlerBefore: function (t) { !this.canvas || !this.editable || t.e.button && 1 !== t.e.button || (this.selected = this === this.canvas._activeObject) }, initMousedownHandler: function () { this.on("mousedown", this._mouseDownHandler), this.on("mousedown:before", this._mouseDownHandlerBefore) }, initMouseupHandler: function () { this.on("mouseup", this.mouseUpHandler) }, mouseUpHandler: function (t) { if (this.__isMousedown = !1, !(!this.editable || this.group || t.transform && t.transform.actionPerformed || t.e.button && 1 !== t.e.button)) { if (this.canvas) { var e = this.canvas._activeObject; if (e && e !== this) return } this.__lastSelected && !this.__corner ? (this.selected = !1, this.__lastSelected = !1, this.enterEditing(t.e), this.selectionStart === this.selectionEnd ? this.initDelayedCursor(!0) : this.renderCursorOrSelection()) : this.selected = !0 } }, setCursorByClick: function (t) { var e = this.getSelectionStartFromPointer(t), i = this.selectionStart, n = this.selectionEnd; t.shiftKey ? this.setSelectionStartEndWithShift(i, n, e) : (this.selectionStart = e, this.selectionEnd = e), this.isEditing && (this._fireSelectionChanged(), this._updateTextarea()) }, getSelectionStartFromPointer: function (t) { for (var e = this.getLocalPointer(t), i = 0, n = 0, o = 0, r = 0, a = 0, s = 0, l = this._textLines.length; s < l && o <= e.y; s++)o += this.getHeightOfLine(s) * this.scaleY, 0 < (a = s) && (r += this._textLines[s - 1].length + this.missingNewlineOffset(s - 1)); n = this._getLineLeftOffset(a) * this.scaleX; for (var c = 0, d = this._textLines[a].length; c < d && (i = n, (n += this.__charBounds[a][c].kernedWidth * this.scaleX) <= e.x); c++)r++; return this._getNewSelectionStartFromOffset(e, i, n, r, d) }, _getNewSelectionStartFromOffset: function (t, e, i, n, o) { e = t.x - e, t = i - t.x, t = n + (e < t || t < 0 ? 0 : 1); return this.flipX && (t = o - t), t > this._text.length && (t = this._text.length), t } }), fabric.util.object.extend(fabric.IText.prototype, { initHiddenTextarea: function () { this.hiddenTextarea = fabric.document.createElement("textarea"), this.hiddenTextarea.setAttribute("autocapitalize", "off"), this.hiddenTextarea.setAttribute("autocorrect", "off"), this.hiddenTextarea.setAttribute("autocomplete", "off"), this.hiddenTextarea.setAttribute("spellcheck", "false"), this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea", ""), this.hiddenTextarea.setAttribute("wrap", "off"); var t = this._calcTextareaPosition(); this.hiddenTextarea.style.cssText = "position: absolute; top: " + t.top + "; left: " + t.left + "; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; paddingーtop: " + t.fontSize + ";", fabric.document.body.appendChild(this.hiddenTextarea), fabric.util.addListener(this.hiddenTextarea, "keydown", this.onKeyDown.bind(this)), fabric.util.addListener(this.hiddenTextarea, "keyup", this.onKeyUp.bind(this)), fabric.util.addListener(this.hiddenTextarea, "input", this.onInput.bind(this)), fabric.util.addListener(this.hiddenTextarea, "copy", this.copy.bind(this)), fabric.util.addListener(this.hiddenTextarea, "cut", this.copy.bind(this)), fabric.util.addListener(this.hiddenTextarea, "paste", this.paste.bind(this)), fabric.util.addListener(this.hiddenTextarea, "compositionstart", this.onCompositionStart.bind(this)), fabric.util.addListener(this.hiddenTextarea, "compositionupdate", this.onCompositionUpdate.bind(this)), fabric.util.addListener(this.hiddenTextarea, "compositionend", this.onCompositionEnd.bind(this)), !this._clickHandlerInitialized && this.canvas && (fabric.util.addListener(this.canvas.upperCanvasEl, "click", this.onClick.bind(this)), this._clickHandlerInitialized = !0) }, keysMap: { 9: "exitEditing", 27: "exitEditing", 33: "moveCursorUp", 34: "moveCursorDown", 35: "moveCursorRight", 36: "moveCursorLeft", 37: "moveCursorLeft", 38: "moveCursorUp", 39: "moveCursorRight", 40: "moveCursorDown" }, ctrlKeysMapUp: { 67: "copy", 88: "cut" }, ctrlKeysMapDown: { 65: "selectAll" }, onClick: function () { this.hiddenTextarea && this.hiddenTextarea.focus() }, onKeyDown: function (t) { if (this.isEditing) { if (t.keyCode in this.keysMap) this[this.keysMap[t.keyCode]](t); else { if (!(t.keyCode in this.ctrlKeysMapDown && (t.ctrlKey || t.metaKey))) return; this[this.ctrlKeysMapDown[t.keyCode]](t) } t.stopImmediatePropagation(), t.preventDefault(), 33 <= t.keyCode && t.keyCode <= 40 ? (this.inCompositionMode = !1, this.clearContextTop(), this.renderCursorOrSelection()) : this.canvas && this.canvas.requestRenderAll() } }, onKeyUp: function (t) { !this.isEditing || this._copyDone || this.inCompositionMode ? this._copyDone = !1 : t.keyCode in this.ctrlKeysMapUp && (t.ctrlKey || t.metaKey) && (this[this.ctrlKeysMapUp[t.keyCode]](t), t.stopImmediatePropagation(), t.preventDefault(), this.canvas && this.canvas.requestRenderAll()) }, onInput: function (t) { var e = this.fromPaste; if (this.fromPaste = !1, t && t.stopPropagation(), this.isEditing) { var i, n, o, r = this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText, a = this._text.length, s = r.length, l = s - a, c = this.selectionStart, d = this.selectionEnd, h = c !== d; if ("" === this.hiddenTextarea.value) return this.styles = {}, this.updateFromTextArea(), this.fire("changed"), void (this.canvas && (this.canvas.fire("text:changed", { target: this }), this.canvas.requestRenderAll())); var u = this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart, this.hiddenTextarea.selectionEnd, this.hiddenTextarea.value), t = c > u.selectionStart; h ? (o = this._text.slice(c, d), l += d - c) : s < a && (o = t ? this._text.slice(d + l, d) : this._text.slice(c, c - l)), u = r.slice(u.selectionEnd - l, u.selectionEnd), o && o.length && (u.length && (i = this.getSelectionStyles(c, c + 1, !1), i = u.map(function () { return i[0] })), o = h ? (n = c, d) : t ? (n = d - o.length, d) : (n = d) + o.length, this.removeStyleFromTo(n, o)), u.length && (e && u.join("") === fabric.copiedText && !fabric.disableStyleCopyPaste && (i = fabric.copiedTextStyle), this.insertNewStyleBlock(u, c, i)), this.updateFromTextArea(), this.fire("changed"), this.canvas && (this.canvas.fire("text:changed", { target: this }), this.canvas.requestRenderAll()) } }, onCompositionStart: function () { this.inCompositionMode = !0 }, onCompositionEnd: function () { this.inCompositionMode = !1 }, onCompositionUpdate: function (t) { this.compositionStart = t.target.selectionStart, this.compositionEnd = t.target.selectionEnd, this.updateTextareaPosition() }, copy: function () { this.selectionStart !== this.selectionEnd && (fabric.copiedText = this.getSelectedText(), fabric.disableStyleCopyPaste ? fabric.copiedTextStyle = null : fabric.copiedTextStyle = this.getSelectionStyles(this.selectionStart, this.selectionEnd, !0), this._copyDone = !0) }, paste: function () { this.fromPaste = !0 }, _getClipboardData: function (t) { return t && t.clipboardData || fabric.window.clipboardData }, _getWidthBeforeCursor: function (t, e) { var i = this._getLineLeftOffset(t); return 0 < e && (i += (e = this.__charBounds[t][e - 1]).left + e.width), i }, getDownCursorOffset: function (t, e) { var i = this._getSelectionForOffset(t, e), n = this.get2DCursorLocation(i), e = n.lineIndex; if (e === this._textLines.length - 1 || t.metaKey || 34 === t.keyCode) return this._text.length - i; i = n.charIndex, n = this._getWidthBeforeCursor(e, i), n = this._getIndexOnLine(e + 1, n); return this._textLines[e].slice(i).length + n + 1 + this.missingNewlineOffset(e) }, _getSelectionForOffset: function (t, e) { return t.shiftKey && this.selectionStart !== this.selectionEnd && e ? this.selectionEnd : this.selectionStart }, getUpCursorOffset: function (t, e) { var i = this._getSelectionForOffset(t, e), n = this.get2DCursorLocation(i), e = n.lineIndex; if (0 === e || t.metaKey || 33 === t.keyCode) return -i; t = n.charIndex, i = this._getWidthBeforeCursor(e, t), n = this._getIndexOnLine(e - 1, i), i = this._textLines[e].slice(0, t), t = this.missingNewlineOffset(e - 1); return -this._textLines[e - 1].length + n - i.length + (1 - t) }, _getIndexOnLine: function (t, e) { for (var i, n = this._textLines[t], o = this._getLineLeftOffset(t), r = 0, a = 0, s = n.length; a < s; a++)if (e < (o += c = this.__charBounds[t][a].width)) { i = !0; var l = o - c, c = o, l = Math.abs(l - e), r = Math.abs(c - e) < l ? a : a - 1; break } return i || (r = n.length - 1), r }, moveCursorDown: function (t) { this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length || this._moveCursorUpOrDown("Down", t) }, moveCursorUp: function (t) { 0 === this.selectionStart && 0 === this.selectionEnd || this._moveCursorUpOrDown("Up", t) }, _moveCursorUpOrDown: function (t, e) { t = this["get" + t + "CursorOffset"](e, "right" === this._selectionDirection); e.shiftKey ? this.moveCursorWithShift(t) : this.moveCursorWithoutShift(t), 0 !== t && (this.setSelectionInBoundaries(), this.abortCursorAnimation(), this._currentCursorOpacity = 1, this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea()) }, moveCursorWithShift: function (t) { var e = "left" === this._selectionDirection ? this.selectionStart + t : this.selectionEnd + t; return this.setSelectionStartEndWithShift(this.selectionStart, this.selectionEnd, e), 0 !== t }, moveCursorWithoutShift: function (t) { return t < 0 ? (this.selectionStart += t, this.selectionEnd = this.selectionStart) : (this.selectionEnd += t, this.selectionStart = this.selectionEnd), 0 !== t }, moveCursorLeft: function (t) { 0 === this.selectionStart && 0 === this.selectionEnd || this._moveCursorLeftOrRight("Left", t) }, _move: function (t, e, i) { var n; if (t.altKey) n = this["findWordBoundary" + i](this[e]); else { if (!t.metaKey && 35 !== t.keyCode && 36 !== t.keyCode) return this[e] += "Left" === i ? -1 : 1, !0; n = this["findLineBoundary" + i](this[e]) } if (this[e] !== n) return this[e] = n, !0 }, _moveLeft: function (t, e) { return this._move(t, e, "Left") }, _moveRight: function (t, e) { return this._move(t, e, "Right") }, moveCursorLeftWithoutShift: function (t) { var e = !0; return this._selectionDirection = "left", this.selectionEnd === this.selectionStart && 0 !== this.selectionStart && (e = this._moveLeft(t, "selectionStart")), this.selectionEnd = this.selectionStart, e }, moveCursorLeftWithShift: function (t) { return "right" === this._selectionDirection && this.selectionStart !== this.selectionEnd ? this._moveLeft(t, "selectionEnd") : 0 !== this.selectionStart ? (this._selectionDirection = "left", this._moveLeft(t, "selectionStart")) : void 0 }, moveCursorRight: function (t) { this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length || this._moveCursorLeftOrRight("Right", t) }, _moveCursorLeftOrRight: function (t, e) { t = "moveCursor" + t + "With"; this._currentCursorOpacity = 1, e.shiftKey ? t += "Shift" : t += "outShift", this[t](e) && (this.abortCursorAnimation(), this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea()) }, moveCursorRightWithShift: function (t) { return "left" === this._selectionDirection && this.selectionStart !== this.selectionEnd ? this._moveRight(t, "selectionStart") : this.selectionEnd !== this._text.length ? (this._selectionDirection = "right", this._moveRight(t, "selectionEnd")) : void 0 }, moveCursorRightWithoutShift: function (t) { var e = !0; return this._selectionDirection = "right", this.selectionStart === this.selectionEnd ? (e = this._moveRight(t, "selectionStart"), this.selectionEnd = this.selectionStart) : this.selectionStart = this.selectionEnd, e }, removeChars: function (t, e) { void 0 === e && (e = t + 1), this.removeStyleFromTo(t, e), this._text.splice(t, e - t), this.text = this._text.join(""), this.set("dirty", !0), this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this._removeExtraneousStyles() }, insertChars: function (t, e, i, n) { void 0 === n && (n = i), i < n && this.removeStyleFromTo(i, n); t = fabric.util.string.graphemeSplit(t); this.insertNewStyleBlock(t, i, e), this._text = [].concat(this._text.slice(0, i), t, this._text.slice(n)), this.text = this._text.join(""), this.set("dirty", !0), this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this._removeExtraneousStyles() } }), function () { var s = fabric.util.toFixed, l = / +/g; fabric.util.object.extend(fabric.Text.prototype, { _toSVG: function () { var t = this._getSVGLeftTopOffsets(), t = this._getSVGTextAndBg(t.textTop, t.textLeft); return this._wrapSVGTextAndBg(t) }, toSVG: function (t) { return this._createBaseSVGMarkup(this._toSVG(), { reviver: t, noStyle: !0, withShadow: !0 }) }, _getSVGLeftTopOffsets: function () { return { textLeft: -this.width / 2, textTop: -this.height / 2, lineTop: this.getHeightOfLine(0) } }, _wrapSVGTextAndBg: function (t) { var e = this.getSvgTextDecoration(this); return [t.textBgRects.join(""), '\t\t<text xml:space="preserve" ', this.fontFamily ? 'font-family="' + this.fontFamily.replace(/"/g, "'") + '" ' : "", this.fontSize ? 'font-size="' + this.fontSize + '" ' : "", this.fontStyle ? 'font-style="' + this.fontStyle + '" ' : "", this.fontWeight ? 'font-weight="' + this.fontWeight + '" ' : "", e ? 'text-decoration="' + e + '" ' : "", 'style="', this.getSvgStyles(!0), '"', this.addPaintOrder(), " >", t.textSpans.join(""), "</text>\n"] }, _getSVGTextAndBg: function (t, e) { var i, n = [], o = [], r = t; this._setSVGBg(o); for (var a = 0, s = this._textLines.length; a < s; a++)i = this._getLineLeftOffset(a), (this.textBackgroundColor || this.styleHas("textBackgroundColor", a)) && this._setSVGTextLineBg(o, a, e + i, r), this._setSVGTextLineText(n, a, e + i, r), r += this.getHeightOfLine(a); return { textSpans: n, textBgRects: o } }, _createTextCharSpan: function (t, e, i, n) { var o = t !== t.trim() || t.match(l), r = this.getSvgSpanStyles(e, o), a = r ? 'style="' + r + '"' : "", o = e.deltaY, r = "", e = fabric.Object.NUM_FRACTION_DIGITS; return o && (r = ' dy="' + s(o, e) + '" '), ['<tspan x="', s(i, e), '" y="', s(n, e), '" ', r, a, ">", fabric.util.string.escapeXml(t), "</tspan>"].join("") }, _setSVGTextLineText: function (t, e, i, n) { var o, r, a, s, l = this.getHeightOfLine(e), c = -1 !== this.textAlign.indexOf("justify"), d = "", h = 0, u = this._textLines[e]; n += l * (1 - this._fontSizeFraction) / this.lineHeight; for (var f = 0, p = u.length - 1; f <= p; f++)s = f === p || this.charSpacing, d += u[f], a = this.__charBounds[e][f], 0 === h ? (i += a.kernedWidth - a.width, h += a.width) : h += a.kernedWidth, c && !s && this._reSpaceAndTab.test(u[f]) && (s = !0), s || (o = o || this.getCompleteStyleDeclaration(e, f), r = this.getCompleteStyleDeclaration(e, f + 1), s = this._hasStyleChangedForSvg(o, r)), s && (s = this._getStyleDeclaration(e, f) || {}, t.push(this._createTextCharSpan(d, s, i, n)), d = "", o = r, i += h, h = 0) }, _pushTextBgRect: function (t, e, i, n, o, r) { var a = fabric.Object.NUM_FRACTION_DIGITS; t.push("\t\t<rect ", this._getFillAttributes(e), ' x="', s(i, a), '" y="', s(n, a), '" width="', s(o, a), '" height="', s(r, a), '"></rect>\n') }, _setSVGTextLineBg: function (t, e, i, n) { for (var o, r, a = this._textLines[e], s = this.getHeightOfLine(e) / this.lineHeight, l = 0, c = 0, d = this.getValueOfPropertyAt(e, 0, "textBackgroundColor"), h = 0, u = a.length; h < u; h++)o = this.__charBounds[e][h], (r = this.getValueOfPropertyAt(e, h, "textBackgroundColor")) !== d ? (d && this._pushTextBgRect(t, d, i + c, n, l, s), c = o.left, l = o.width, d = r) : l += o.kernedWidth; r && this._pushTextBgRect(t, r, i + c, n, l, s) }, _getFillAttributes: function (t) { var e = t && "string" == typeof t ? new fabric.Color(t) : ""; return e && e.getSource() && 1 !== e.getAlpha() ? 'opacity="' + e.getAlpha() + '" fill="' + e.setAlpha(1).toRgb() + '"' : 'fill="' + t + '"' }, _getSVGLineTopOffset: function (t) { for (var e, i = 0, n = 0; n < t; n++)i += this.getHeightOfLine(n); return e = this.getHeightOfLine(n), { lineTop: i, offset: (this._fontSizeMult - this._fontSizeFraction) * e / (this.lineHeight * this._fontSizeMult) } }, getSvgStyles: function (t) { return fabric.Object.prototype.getSvgStyles.call(this, t) + " white-space: pre;" } }) }(), function (t) { "use strict"; var v = t.fabric || (t.fabric = {}); v.Textbox = v.util.createClass(v.IText, v.Observable, { type: "textbox", minWidth: 20, dynamicMinWidth: 2, __cachedLines: null, lockScalingFlip: !0, noScaleCache: !1, _dimensionAffectingProps: v.Text.prototype._dimensionAffectingProps.concat("width"), _wordJoiners: /[ \t\r]/, splitByGrapheme: !1, initDimensions: function () { this.__skipDimension || (this.isEditing && this.initDelayedCursor(), this.clearContextTop(), this._clearCache(), this.dynamicMinWidth = 0, this._styleMap = this._generateStyleMap(this._splitText()), this.dynamicMinWidth > this.width && this._set("width", this.dynamicMinWidth), -1 !== this.textAlign.indexOf("justify") && this.enlargeSpaces(), this.height = this.calcTextHeight(), this.saveState({ propertySet: "_dimensionAffectingProps" })) }, _generateStyleMap: function (t) { for (var e = 0, i = 0, n = 0, o = {}, r = 0; r < t.graphemeLines.length; r++)"\n" === t.graphemeText[n] && 0 < r ? (i = 0, n++ , e++) : !this.splitByGrapheme && this._reSpaceAndTab.test(t.graphemeText[n]) && 0 < r && (i++ , n++), o[r] = { line: e, offset: i }, n += t.graphemeLines[r].length, i += t.graphemeLines[r].length; return o }, styleHas: function (t, e) { var i; return !this._styleMap || this.isWrapping || (i = this._styleMap[e]) && (e = i.line), v.Text.prototype.styleHas.call(this, t, e) }, isEmptyStyles: function (t) { if (!this.styles) return !0; var e, i, n, o = 0, r = !1, a = this._styleMap[t], s = this._styleMap[t + 1]; for (n in a && (t = a.line, o = a.offset), s && (r = s.line === t, e = s.offset), i = void 0 === t ? this.styles : { line: this.styles[t] }) for (var l in i[n]) if (o <= l && (!r || l < e)) for (var c in i[n][l]) return !1; return !0 }, _getStyleDeclaration: function (t, e) { if (this._styleMap && !this.isWrapping) { var i = this._styleMap[t]; if (!i) return null; t = i.line, e = i.offset + e } return this.callSuper("_getStyleDeclaration", t, e) }, _setStyleDeclaration: function (t, e, i) { var n = this._styleMap[t]; t = n.line, e = n.offset + e, this.styles[t][e] = i }, _deleteStyleDeclaration: function (t, e) { var i = this._styleMap[t]; t = i.line, e = i.offset + e, delete this.styles[t][e] }, _getLineStyle: function (t) { t = this._styleMap[t]; return !!this.styles[t.line] }, _setLineStyle: function (t) { t = this._styleMap[t]; this.styles[t.line] = {} }, _wrapText: function (t, e) { var i, n = []; for (this.isWrapping = !0, i = 0; i < t.length; i++)n = n.concat(this._wrapLine(t[i], i, e)); return this.isWrapping = !1, n }, _measureWord: function (t, e, i) { var n, o = 0; i = i || 0; for (var r = 0, a = t.length; r < a; r++)o += this._getGraphemeBox(t[r], e, r + i, n, !0).kernedWidth, n = t[r]; return o }, _wrapLine: function (t, e, i, n) { var o, r, a = 0, s = this.splitByGrapheme, l = [], c = [], d = s ? v.util.string.graphemeSplit(t) : t.split(this._wordJoiners), h = 0, u = s ? "" : " ", f = 0, p = 0, g = !0, b = this._getWidthOfCharSpacing(), n = n || 0; 0 === d.length && d.push([]), i -= n; for (var m = 0; m < d.length; m++)o = s ? d[m] : v.util.string.graphemeSplit(d[m]), r = this._measureWord(o, e, h), h += o.length, i < (a += f + r - b) && !g ? (l.push(c), c = [], a = r, g = !0) : a += b, g || s || c.push(u), c = c.concat(o), f = s ? 0 : this._measureWord([u], e, h), h++ , g = !1, p < r && (p = r); return m && l.push(c), p + n > this.dynamicMinWidth && (this.dynamicMinWidth = p - b + n), l }, isEndOfWrapping: function (t) { return !this._styleMap[t + 1] || this._styleMap[t + 1].line !== this._styleMap[t].line }, missingNewlineOffset: function (t) { return !this.splitByGrapheme || this.isEndOfWrapping(t) ? 1 : 0 }, _splitTextIntoLines: function (t) { for (var t = v.Text.prototype._splitTextIntoLines.call(this, t), e = this._wrapText(t.lines, this.width), i = new Array(e.length), n = 0; n < e.length; n++)i[n] = e[n].join(""); return t.lines = i, t.graphemeLines = e, t }, getMinWidth: function () { return Math.max(this.minWidth, this.dynamicMinWidth) }, _removeExtraneousStyles: function () { var t, e = {}; for (t in this._styleMap) this._textLines[t] && (e[this._styleMap[t].line] = 1); for (t in this.styles) e[t] || delete this.styles[t] }, toObject: function (t) { return this.callSuper("toObject", ["minWidth", "splitByGrapheme"].concat(t)) } }), v.Textbox.fromObject = function (t, e) { return v.Object._fromObject("Textbox", t, e, "text") } }("undefined" != typeof exports ? exports : this), function () { var t = fabric.controlsUtils, e = t.scaleSkewCursorStyleHandler, i = t.scaleCursorStyleHandler, n = t.scalingEqually, o = t.scalingYOrSkewingX, r = t.scalingXOrSkewingY, a = t.scaleOrSkewActionName, s = fabric.Object.prototype.controls; s.ml = new fabric.Control({ x: -.5, y: 0, cursorStyleHandler: e, actionHandler: r, getActionName: a }), s.mr = new fabric.Control({ x: .5, y: 0, cursorStyleHandler: e, actionHandler: r, getActionName: a }), s.mb = new fabric.Control({ x: 0, y: .5, cursorStyleHandler: e, actionHandler: o, getActionName: a }), s.mt = new fabric.Control({ x: 0, y: -.5, cursorStyleHandler: e, actionHandler: o, getActionName: a }), s.tl = new fabric.Control({ x: -.5, y: -.5, cursorStyleHandler: i, actionHandler: n }), s.tr = new fabric.Control({ x: .5, y: -.5, cursorStyleHandler: i, actionHandler: n }), s.bl = new fabric.Control({ x: -.5, y: .5, cursorStyleHandler: i, actionHandler: n }), s.br = new fabric.Control({ x: .5, y: .5, cursorStyleHandler: i, actionHandler: n }), s.mtr = new fabric.Control({ x: 0, y: -.5, actionHandler: t.rotationWithSnapping, cursorStyleHandler: t.rotationStyleHandler, offsetY: -40, withConnection: !0, actionName: "rotate" }), fabric.Textbox && ((n = fabric.Textbox.prototype.controls = {}).mtr = s.mtr, n.tr = s.tr, n.br = s.br, n.tl = s.tl, n.bl = s.bl, n.mt = s.mt, n.mb = s.mb, n.mr = new fabric.Control({ x: .5, y: 0, actionHandler: t.changeWidth, cursorStyleHandler: e, actionName: "resizing" }), n.ml = new fabric.Control({ x: -.5, y: 0, actionHandler: t.changeWidth, cursorStyleHandler: e, actionName: "resizing" })) }();
}
catch (e) {
console.log("faric_error:" + e.message); // 警報 'The message' 或 JavaScript 錯誤訊息
}