| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/patratravelsonline.com/public/assets/js_new/ |
Upload File : |
!function (a) {
"function" == typeof define && define.amd ? define(["jquery", "codemirror"], a) : a(window.jQuery, window.CodeMirror)
}(function (a, b) {
"function" != typeof Array.prototype.reduce && (Array.prototype.reduce = function (a, b) {
var c, d, e = this.length >>> 0, f = !1;
for (1 < arguments.length && (d = b, f = !0), c = 0; e > c; ++c)
this.hasOwnProperty(c) && (f ? d = a(d, this[c], c, this) : (d = this[c], f = !0));
if (!f)
throw new TypeError("Reduce of empty array with no initial value");
return d
});
var c = {bMac: navigator.appVersion.indexOf("Mac") > -1, bMSIE: navigator.userAgent.indexOf("MSIE") > -1 || navigator.userAgent.indexOf("Trident") > -1, bFF: navigator.userAgent.indexOf("Firefox") > -1, jqueryVersion: parseFloat(a.fn.jquery), bCodeMirror: !!b}, d = function () {
var b = function (a) {
return function (b) {
return a === b
}
}, c = function (a, b) {
return a === b
}, d = function () {
return!0
}, e = function () {
return!1
}, f = function (a) {
return function () {
return!a.apply(a, arguments)
}
}, g = function (a) {
return a
}, h = 0, i = function (a) {
var b = ++h + "";
return a ? a + b : b
}, j = function (b) {
var c = a(document);
return{top: b.top + c.scrollTop(), left: b.left + c.scrollLeft(), width: b.right - b.left, height: b.bottom - b.top}
}, k = function (a) {
var b = {};
for (var c in a)
a.hasOwnProperty(c) && (b[a[c]] = c);
return b
};
return{eq: b, eq2: c, ok: d, fail: e, not: f, self: g, uniqueId: i, rect2bnd: j, invertObject: k}
}(), e = function () {
var a = function (a) {
return a[0]
}, b = function (a) {
return a[a.length - 1]
}, c = function (a) {
return a.slice(0, a.length - 1)
}, e = function (a) {
return a.slice(1)
}, f = function (a, b) {
var c = a.indexOf(b);
return-1 === c ? null : a[c + 1]
}, g = function (a, b) {
var c = a.indexOf(b);
return-1 === c ? null : a[c - 1]
}, h = function (a, b) {
return b = b || d.self, a.reduce(function (a, c) {
return a + b(c)
}, 0)
}, i = function (a) {
for (var b = [], c = -1, d = a.length; ++c < d; )
b[c] = a[c];
return b
}, j = function (c, d) {
if (0 === c.length)
return[];
var f = e(c);
return f.reduce(function (a, c) {
var e = b(a);
return d(b(e), c) ? e[e.length] = c : a[a.length] = [c], a
}, [[a(c)]])
}, k = function (a) {
for (var b = [], c = 0, d = a.length; d > c; c++)
a[c] && b.push(a[c]);
return b
};
return{head: a, last: b, initial: c, tail: e, prev: g, next: f, sum: h, from: i, compact: k, clusterBy: j}
}(), f = function () {
var b = function (b) {
return b && a(b).hasClass("note-editable")
}, g = function (b) {
return b && a(b).hasClass("note-control-sizing")
}, h = function (b) {
var c;
if (b.hasClass("note-air-editor")) {
var d = e.last(b.attr("id").split("-"));
return c = function (b) {
return function () {
return a(b + d)
}
}, {editor: function () {
return b
}, editable: function () {
return b
}, popover: c("#note-popover-"), handle: c("#note-handle-"), dialog: c("#note-dialog-")}
}
return c = function (a) {
return function () {
return b.find(a)
}
}, {editor: function () {
return b
}, dropzone: c(".note-dropzone"), toolbar: c(".note-toolbar"), editable: c(".note-editable"), codable: c(".note-codable"), statusbar: c(".note-statusbar"), popover: c(".note-popover"), handle: c(".note-handle"), dialog: c(".note-dialog")}
}, i = function (a) {
return function (b) {
return b && b.nodeName === a
}
}, j = function (a) {
return a && /^DIV|^P|^LI|^H[1-7]/.test(a.nodeName)
}, k = function (a) {
return a && /^UL|^OL/.test(a.nodeName)
}, l = function (a) {
return a && /^TD|^TH/.test(a.nodeName)
}, m = function (a, c) {
for (; a; ) {
if (c(a))
return a;
if (b(a))
break;
a = a.parentNode
}
return null
}, n = function (a, b) {
b = b || d.fail;
var c = [];
return m(a, function (a) {
return c.push(a), b(a)
}), c
}, o = function (b, c) {
for (var d = n(b), e = c; e; e = e.parentNode)
if (a.inArray(e, d) > -1)
return e;
return null
}, p = function (a, b) {
var c = [], d = !1, e = !1;
return function f(g) {
if (g) {
if (g === a && (d = !0), d && !e && c.push(g), g === b)
return void(e = !0);
for (var h = 0, i = g.childNodes.length; i > h; h++)
f(g.childNodes[h])
}
}(o(a, b)), c
}, q = function (a, b) {
b = b || d.fail;
for (var c = []; a && (c.push(a), !b(a)); )
a = a.previousSibling;
return c
}, r = function (a, b) {
b = b || d.fail;
for (var c = []; a && (c.push(a), !b(a)); )
a = a.nextSibling;
return c
}, s = function (a, b) {
var c = [];
return b = b || d.ok, function e(d) {
a !== d && b(d) && c.push(d);
for (var f = 0, g = d.childNodes.length; g > f; f++)
e(d.childNodes[f])
}(a), c
}, t = function (a, b) {
var c = b.nextSibling, d = b.parentNode;
return c ? d.insertBefore(a, c) : d.appendChild(a), a
}, u = function (b, c) {
return a.each(c, function (a, c) {
b.appendChild(c)
}), b
}, v = i("#text"), w = function (a) {
return v(a) ? a.nodeValue.length : a.childNodes.length
}, x = function (a) {
for (var b = 0; a = a.previousSibling; )
b += 1;
return b
}, y = function (b, c) {
var f = e.initial(n(c, d.eq(b)));
return a.map(f, x).reverse()
}, z = function (a, b) {
for (var c = a, d = 0, e = b.length; e > d; d++)
c = c.childNodes[b[d]];
return c
}, A = function (a, b) {
if (0 === b)
return a;
if (b >= w(a))
return a.nextSibling;
if (v(a))
return a.splitText(b);
var c = a.childNodes[b];
return a = t(a.cloneNode(!1), a), u(a, r(c))
}, B = function (a, b, c) {
var e = n(b, d.eq(a));
return 1 === e.length ? A(b, c) : e.reduce(function (a, d) {
var e = d.cloneNode(!1);
return t(e, d), a === b && (a = A(a, c)), u(e, r(a)), e
})
}, C = function (a, b) {
if (a && a.parentNode) {
if (a.removeNode)
return a.removeNode(b);
var c = a.parentNode;
if (!b) {
var d, e, f = [];
for (d = 0, e = a.childNodes.length; e > d; d++)
f.push(a.childNodes[d]);
for (d = 0, e = f.length; e > d; d++)
c.insertBefore(f[d], a)
}
c.removeChild(a)
}
}, D = function (a) {
return f.isTextarea(a[0]) ? a.val() : a.html()
};
return{blank: c.bMSIE ? " " : "<br/>", emptyPara: "<p><br/></p>", isEditable: b, isControlSizing: g, buildLayoutInfo: h, isText: v, isPara: j, isList: k, isTable: i("TABLE"), isCell: l, isAnchor: i("A"), isDiv: i("DIV"), isLi: i("LI"), isSpan: i("SPAN"), isB: i("B"), isU: i("U"), isS: i("S"), isI: i("I"), isImg: i("IMG"), isTextarea: i("TEXTAREA"), ancestor: m, listAncestor: n, listNext: r, listPrev: q, listDescendant: s, commonAncestor: o, listBetween: p, insertAfter: t, position: x, makeOffsetPath: y, fromOffsetPath: z, split: B, remove: C, html: D}
}(), g = {version: "0.5.2", options: {width: null, height: null, minHeight: null, maxHeight: null, focus: !1, tabsize: 4, styleWithSpan: !0, disableLinkTarget: !1, disableDragAndDrop: !1, disableResizeEditor: !1, codemirror: {mode: "text/html", lineNumbers: !0}, lang: "en-US", direction: null, toolbar: [["style", ["style"]], ["font", ["bold", "italic", "underline", "superscript", "subscript", "strikethrough", "clear"]], ["fontname", ["fontname"]], ["color", ["color"]], ["para", ["ul", "ol", "paragraph"]], ["height", ["height"]], ["table", ["table"]], ["insert", ["link", "picture", "video", "hr"]], ["view", ["fullscreen", "codeview"]], ["help", ["help"]]], airMode: !1, airPopover: [["color", ["color"]], ["font", ["bold", "underline", "clear"]], ["para", ["ul", "paragraph"]], ["table", ["table"]], ["insert", ["link", "picture"]]], styleTags: ["p", "blockquote", "pre", "h1", "h2", "h3", "h4", "h5", "h6"], defaultFontName: "Arial", fontNames: ["Serif", "Sans", "Arial", "Arial Black", "Courier", "Courier New", "Comic Sans MS", "Helvetica", "Impact", "Lucida Grande", "Lucida Sans", "Tahoma", "Times", "Times New Roman", "Verdana"], colors: [["#000000", "#424242", "#636363", "#9C9C94", "#CEC6CE", "#EFEFEF", "#F7F7F7", "#FFFFFF"], ["#FF0000", "#FF9C00", "#FFFF00", "#00FF00", "#00FFFF", "#0000FF", "#9C00FF", "#FF00FF"], ["#F7C6CE", "#FFE7CE", "#FFEFC6", "#D6EFD6", "#CEDEE7", "#CEE7F7", "#D6D6E7", "#E7D6DE"], ["#E79C9C", "#FFC69C", "#FFE79C", "#B5D6A5", "#A5C6CE", "#9CC6EF", "#B5A5D6", "#D6A5BD"], ["#E76363", "#F7AD6B", "#FFD663", "#94BD7B", "#73A5AD", "#6BADDE", "#8C7BC6", "#C67BA5"], ["#CE0000", "#E79439", "#EFC631", "#6BA54A", "#4A7B8C", "#3984C6", "#634AA5", "#A54A7B"], ["#9C0000", "#B56308", "#BD9400", "#397B21", "#104A5A", "#085294", "#311873", "#731842"], ["#630000", "#7B3900", "#846300", "#295218", "#083139", "#003163", "#21104A", "#4A1031"]], fontSizes: ["8", "9", "10", "11", "12", "14", "18", "24", "36"], lineHeights: ["1.0", "1.2", "1.4", "1.5", "1.6", "1.8", "2.0", "3.0"], oninit: null, onfocus: null, onblur: null, onenter: null, onkeyup: null, onkeydown: null, onImageUpload: null, onImageUploadError: null, onToolbarClick: null, keyMap: {pc: {"CTRL+Z": "undo", "CTRL+Y": "redo", TAB: "tab", "SHIFT+TAB": "untab", "CTRL+B": "bold", "CTRL+I": "italic", "CTRL+U": "underline", "CTRL+SHIFT+S": "strikethrough", "CTRL+BACKSLASH": "removeFormat", "CTRL+SHIFT+L": "justifyLeft", "CTRL+SHIFT+E": "justifyCenter", "CTRL+SHIFT+R": "justifyRight", "CTRL+SHIFT+J": "justifyFull", "CTRL+SHIFT+NUM7": "insertUnorderedList", "CTRL+SHIFT+NUM8": "insertOrderedList", "CTRL+LEFTBRACKET": "outdent", "CTRL+RIGHTBRACKET": "indent", "CTRL+NUM0": "formatPara", "CTRL+NUM1": "formatH1", "CTRL+NUM2": "formatH2", "CTRL+NUM3": "formatH3", "CTRL+NUM4": "formatH4", "CTRL+NUM5": "formatH5", "CTRL+NUM6": "formatH6", "CTRL+ENTER": "insertHorizontalRule"}, mac: {"CMD+Z": "undo", "CMD+SHIFT+Z": "redo", TAB: "tab", "SHIFT+TAB": "untab", "CMD+B": "bold", "CMD+I": "italic", "CMD+U": "underline", "CMD+SHIFT+S": "strikethrough", "CMD+BACKSLASH": "removeFormat", "CMD+SHIFT+L": "justifyLeft", "CMD+SHIFT+E": "justifyCenter", "CMD+SHIFT+R": "justifyRight", "CMD+SHIFT+J": "justifyFull", "CMD+SHIFT+NUM7": "insertUnorderedList", "CMD+SHIFT+NUM8": "insertOrderedList", "CMD+LEFTBRACKET": "outdent", "CMD+RIGHTBRACKET": "indent", "CMD+NUM0": "formatPara", "CMD+NUM1": "formatH1", "CMD+NUM2": "formatH2", "CMD+NUM3": "formatH3", "CMD+NUM4": "formatH4", "CMD+NUM5": "formatH5", "CMD+NUM6": "formatH6", "CMD+ENTER": "insertHorizontalRule"}}}, lang: {"en-US": {font: {bold: "Bold", italic: "Italic", underline: "Underline", strikethrough: "Strikethrough", clear: "Remove Font Style", height: "Line Height", name: "Font Family", size: "Font Size"}, image: {image: "Picture", insert: "Insert Image", resizeFull: "Resize Full", resizeHalf: "Resize Half", resizeQuarter: "Resize Quarter", floatLeft: "Float Left", floatRight: "Float Right", floatNone: "Float None", dragImageHere: "Drag an image here", selectFromFiles: "Select from files", url: "Image URL", remove: "Remove Image"}, link: {link: "Link", insert: "Insert Link", unlink: "Unlink", edit: "Edit", textToDisplay: "Text to display", url: "To what URL should this link go?", openInNewWindow: "Open in new window"}, video: {video: "Video", videoLink: "Video Link", insert: "Insert Video", url: "Video URL?", providers: "(YouTube, Vimeo, Vine, Instagram, or DailyMotion)"}, table: {table: "Table"}, hr: {insert: "Insert Horizontal Rule"}, style: {style: "Style", normal: "Normal", blockquote: "Quote", pre: "Code", h1: "Header 1", h2: "Header 2", h3: "Header 3", h4: "Header 4", h5: "Header 5", h6: "Header 6"}, lists: {unordered: "Unordered list", ordered: "Ordered list"}, options: {help: "Help", fullscreen: "Full Screen", codeview: "Code View"}, paragraph: {paragraph: "Paragraph", outdent: "Outdent", indent: "Indent", left: "Align left", center: "Align center", right: "Align right", justify: "Justify full"}, color: {recent: "Recent Color", more: "More Color", background: "BackColor", foreground: "FontColor", transparent: "Transparent", setTransparent: "Set transparent", reset: "Reset", resetToDefault: "Reset to default"}, shortcut: {shortcuts: "Keyboard shortcuts", close: "Close", textFormatting: "Text formatting", action: "Action", paragraphFormatting: "Paragraph formatting", documentStyle: "Document Style"}, history: {undo: "Undo", redo: "Redo"}}}}, h = function () {
var b = function (b) {
return a.Deferred(function (c) {
a.extend(new FileReader, {onload: function (a) {
var b = a.target.result;
c.resolve(b)
}, onerror: function () {
c.reject(this)
}}).readAsDataURL(b)
}).promise()
}, c = function (b) {
return a.Deferred(function (c) {
a("<img>").one("load", function () {
c.resolve(a(this))
}).one("error abort", function () {
c.reject(a(this))
}).css({display: "none"}).appendTo(document.body).attr("src", b)
}).promise()
};
return{readFileAsDataURL: b, createImage: c}
}(), i = {isEdit: function (a) {
return-1 !== [8, 9, 13, 32].indexOf(a)
}, nameFromCode: {8: "BACKSPACE", 9: "TAB", 13: "ENTER", 32: "SPACE", 48: "NUM0", 49: "NUM1", 50: "NUM2", 51: "NUM3", 52: "NUM4", 53: "NUM5", 54: "NUM6", 55: "NUM7", 56: "NUM8", 66: "B", 69: "E", 73: "I", 74: "J", 75: "K", 76: "L", 82: "R", 83: "S", 85: "U", 89: "Y", 90: "Z", 191: "SLASH", 219: "LEFTBRACKET", 220: "BACKSLASH", 221: "RIGHTBRACKET"}}, j = function () {
var b = function (b, d) {
if (c.jqueryVersion < 1.9) {
var e = {};
return a.each(d, function (a, c) {
e[c] = b.css(c)
}), e
}
return b.css.call(b, d)
};
this.stylePara = function (b, c) {
a.each(b.nodes(f.isPara), function (b, d) {
a(d).css(c)
})
}, this.current = function (c, d) {
var e = a(f.isText(c.sc) ? c.sc.parentNode : c.sc), g = ["font-family", "font-size", "text-align", "list-style-type", "line-height"], h = b(e, g) || {};
if (h["font-size"] = parseInt(h["font-size"], 10), h["font-bold"] = document.queryCommandState("bold") ? "bold" : "normal", h["font-italic"] = document.queryCommandState("italic") ? "italic" : "normal", h["font-underline"] = document.queryCommandState("underline") ? "underline" : "normal", h["font-strikethrough"] = document.queryCommandState("strikeThrough") ? "strikethrough" : "normal", h["font-superscript"] = document.queryCommandState("superscript") ? "superscript" : "normal", h["font-subscript"] = document.queryCommandState("subscript") ? "subscript" : "normal", c.isOnList()) {
var i = ["circle", "disc", "disc-leading-zero", "square"], j = a.inArray(h["list-style-type"], i) > -1;
h["list-style"] = j ? "unordered" : "ordered"
} else
h["list-style"] = "none";
var k = f.ancestor(c.sc, f.isPara);
if (k && k.style["line-height"])
h["line-height"] = k.style.lineHeight;
else {
var l = parseInt(h["line-height"], 10) / parseInt(h["font-size"], 10);
h["line-height"] = l.toFixed(1)
}
return h.image = f.isImg(d) && d, h.anchor = c.isOnAnchor() && f.ancestor(c.sc, f.isAnchor), h.aAncestor = f.listAncestor(c.sc, f.isEditable), h.range = c, h
}
}, k = function () {
var b = !!document.createRange, c = function (a, b) {
var c, d, g = a.parentElement(), h = document.body.createTextRange(), i = e.from(g.childNodes);
for (c = 0; c < i.length; c++)
if (!f.isText(i[c])) {
if (h.moveToElementText(i[c]), h.compareEndPoints("StartToStart", a) >= 0)
break;
d = i[c]
}
if (0 !== c && f.isText(i[c - 1])) {
var j = document.body.createTextRange(), k = null;
j.moveToElementText(d || g), j.collapse(!d), k = d ? d.nextSibling : g.firstChild;
var l = a.duplicate();
l.setEndPoint("StartToStart", j);
for (var m = l.text.replace(/[\r\n]/g, "").length; m > k.nodeValue.length && k.nextSibling; )
m -= k.nodeValue.length, k = k.nextSibling;
{
k.nodeValue
}
b && k.nextSibling && f.isText(k.nextSibling) && m === k.nodeValue.length && (m -= k.nodeValue.length, k = k.nextSibling), g = k, c = m
}
return{cont: g, offset: c}
}, g = function (a) {
var b = function (a, c) {
var g, h;
if (f.isText(a)) {
var i = f.listPrev(a, d.not(f.isText)), j = e.last(i).previousSibling;
g = j || a.parentNode, c += e.sum(e.tail(i), f.length), h = !j
} else {
if (g = a.childNodes[c] || a, f.isText(g))
return b(g, c);
c = 0, h = !1
}
return{cont: g, collapseToStart: h, offset: c}
}, c = document.body.createTextRange(), g = b(a.cont, a.offset);
return c.moveToElementText(g.cont), c.collapse(g.collapseToStart), c.moveStart("character", g.offset), c
}, h = function (c, h, i, j) {
this.sc = c, this.so = h, this.ec = i, this.eo = j;
var k = function () {
if (b) {
var a = document.createRange();
return a.setStart(c, h), a.setEnd(i, j), a
}
var d = g({cont: c, offset: h});
return d.setEndPoint("EndToEnd", g({cont: i, offset: j})), d
};
this.select = function () {
var a = k();
if (b) {
var c = document.getSelection();
c.rangeCount > 0 && c.removeAllRanges(), c.addRange(a)
} else
a.select()
}, this.nodes = function (b) {
var g = f.listBetween(c, i), h = e.compact(a.map(g, function (a) {
return f.ancestor(a, b)
}));
return a.map(e.clusterBy(h, d.eq2), e.head)
}, this.commonAncestor = function () {
return f.commonAncestor(c, i)
};
var l = function (a) {
return function () {
var b = f.ancestor(c, a);
return!!b && b === f.ancestor(i, a)
}
};
this.isOnEditable = l(f.isEditable), this.isOnList = l(f.isList), this.isOnAnchor = l(f.isAnchor), this.isOnCell = l(f.isCell), this.isCollapsed = function () {
return c === i && h === j
}, this.insertNode = function (a) {
var c = k();
b ? c.insertNode(a) : c.pasteHTML(a.outerHTML)
}, this.toString = function () {
var a = k();
return b ? a.toString() : a.text
}, this.bookmark = function (a) {
return{s: {path: f.makeOffsetPath(a, c), offset: h}, e: {path: f.makeOffsetPath(a, i), offset: j}}
}, this.getClientRects = function () {
var a = k();
return a.getClientRects()
}
};
return{create: function (a, d, e, f) {
if (0 === arguments.length)
if (b) {
var g = document.getSelection();
if (0 === g.rangeCount)
return null;
var i = g.getRangeAt(0);
a = i.startContainer, d = i.startOffset, e = i.endContainer, f = i.endOffset
} else {
var j = document.selection.createRange(), k = j.duplicate();
k.collapse(!1);
var l = j;
l.collapse(!0);
var m = c(l, !0), n = c(k, !1);
a = m.cont, d = m.offset, e = n.cont, f = n.offset
}
else
2 === arguments.length && (e = a, f = d);
return new h(a, d, e, f)
}, createFromNode: function (a) {
return this.create(a, 0, a, 1)
}, createFromBookmark: function (a, b) {
var c = f.fromOffsetPath(a, b.s.path), d = b.s.offset, e = f.fromOffsetPath(a, b.e.path), g = b.e.offset;
return new h(c, d, e, g)
}}
}(), l = function () {
this.tab = function (a, b) {
var c = f.ancestor(a.commonAncestor(), f.isCell), d = f.ancestor(c, f.isTable), g = f.listDescendant(d, f.isCell), h = e[b ? "prev" : "next"](g, c);
h && k.create(h, 0).select()
}, this.createTable = function (b, c) {
for (var d, e = [], g = 0; b > g; g++)
e.push("<td>" + f.blank + "</td>");
d = e.join("");
for (var h, i = [], j = 0; c > j; j++)
i.push("<tr>" + d + "</tr>");
h = i.join("");
var k = '<table class="table table-bordered">' + h + "</table>";
return a(k)[0]
}
}, m = function () {
var b = new j, d = new l;
this.saveRange = function (a) {
a.data("range", k.create())
}, this.restoreRange = function (a) {
var b = a.data("range");
b && b.select()
}, this.currentStyle = function (a) {
var c = k.create();
return c.isOnEditable() && b.current(c, a)
}, this.undo = function (a) {
a.data("NoteHistory").undo(a)
}, this.redo = function (a) {
a.data("NoteHistory").redo(a)
};
for (var e = this.recordUndo = function (a) {
a.data("NoteHistory").recordUndo(a)
}, g = ["bold", "italic", "underline", "strikethrough", "superscript", "subscript", "justifyLeft", "justifyCenter", "justifyRight", "justifyFull", "insertOrderedList", "insertUnorderedList", "indent", "outdent", "formatBlock", "removeFormat", "backColor", "foreColor", "insertHorizontalRule", "fontName"], i = 0, m = g.length; m > i; i++)
this[g[i]] = function (a) {
return function (b, c) {
e(b), document.execCommand(a, !1, c)
}
}(g[i]);
var n = function (b, c, d) {
e(b);
var g = new Array(d + 1).join(" ");
c.insertNode(a('<span id="noteTab">' + g + "</span>")[0]);
var h = a("#noteTab").removeAttr("id");
c = k.create(h[0], 1), c.select(), f.remove(h[0])
};
this.tab = function (a, b) {
var c = k.create();
c.isCollapsed() && c.isOnCell() ? d.tab(c) : n(a, c, b.tabsize)
}, this.untab = function () {
var a = k.create();
a.isCollapsed() && a.isOnCell() && d.tab(a, !0)
}, this.insertImage = function (a, b) {
h.createImage(b).then(function (b) {
e(a), b.css({display: "", width: Math.min(a.width(), b.width())}), k.create().insertNode(b[0])
}).fail(function () {
var b = a.data("callbacks");
b.onImageUploadError && b.onImageUploadError()
})
}, this.insertVideo = function (b, c) {
e(b);
var d, f = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/, g = c.match(f), h = /\/\/instagram.com\/p\/(.[a-zA-Z0-9]*)/, i = c.match(h), j = /\/\/vine.co\/v\/(.[a-zA-Z0-9]*)/, l = c.match(j), m = /\/\/(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/, n = c.match(m), o = /.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/, p = c.match(o);
if (g && 11 === g[2].length) {
var q = g[2];
d = a("<iframe>").attr("src", "//www.youtube.com/embed/" + q).attr("width", "640").attr("height", "360")
} else
i && i[0].length > 0 ? d = a("<iframe>").attr("src", i[0] + "/embed/").attr("width", "612").attr("height", "710").attr("scrolling", "no").attr("allowtransparency", "true") : l && l[0].length > 0 ? d = a("<iframe>").attr("src", l[0] + "/embed/simple").attr("width", "600").attr("height", "600").attr("class", "vine-embed") : n && n[3].length > 0 ? d = a("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("src", "//player.vimeo.com/video/" + n[3]).attr("width", "640").attr("height", "360") : p && p[2].length > 0 && (d = a("<iframe>").attr("src", "//www.dailymotion.com/embed/video/" + p[2]).attr("width", "640").attr("height", "360"));
d && (d.attr("frameborder", 0), k.create().insertNode(d[0]))
}, this.formatBlock = function (a, b) {
e(a), b = c.bMSIE ? "<" + b + ">" : b, document.execCommand("FormatBlock", !1, b)
}, this.formatPara = function (a) {
this.formatBlock(a, "P")
};
for (var i = 1; 6 >= i; i++)
this["formatH" + i] = function (a) {
return function (b) {
this.formatBlock(b, "H" + a)
}
}(i);
this.fontSize = function (a, b) {
e(a), document.execCommand("fontSize", !1, 3), c.bFF ? a.find("font[size=3]").removeAttr("size").css("font-size", b + "px") : a.find("span").filter(function () {
return"medium" === this.style.fontSize
}).css("font-size", b + "px")
}, this.lineHeight = function (a, c) {
e(a), b.stylePara(k.create(), {lineHeight: c})
}, this.unlink = function (a) {
var b = k.create();
if (b.isOnAnchor()) {
e(a);
var c = f.ancestor(b.sc, f.isAnchor);
b = k.createFromNode(c), b.select(), document.execCommand("unlink")
}
}, this.createLink = function (b, d, g, h) {
var i = k.create();
e(b);
var j = g;
if (-1 !== g.indexOf("@") && -1 === g.indexOf(":") ? j = "mailto:" + g : -1 === g.indexOf("://") && (j = "http://" + g), (c.bMSIE || c.bFF) && i.isCollapsed()) {
i.insertNode(a('<A id="linkAnchor">' + d + "</A>")[0]);
var l = a("#linkAnchor").attr("href", j).removeAttr("id");
i = k.createFromNode(l[0]), i.select()
} else
document.execCommand("createlink", !1, j);
a.each(i.nodes(f.isAnchor), function (b, c) {
a(c).html(d), h ? a(c).attr("target", "_blank") : a(c).removeAttr("target")
})
}, this.getLinkInfo = function () {
var b = k.create(), c = !0, d = "";
if (b.isOnAnchor()) {
var e = f.ancestor(b.sc, f.isAnchor);
b = k.createFromNode(e), c = "_blank" === a(e).attr("target"), d = e.href
}
return{text: b.toString(), url: d, newWindow: c}
}, this.getVideoInfo = function () {
var a = k.create();
if (a.isOnAnchor()) {
var b = f.ancestor(a.sc, f.isAnchor);
a = k.createFromNode(b)
}
return{text: a.toString()}
}, this.color = function (a, b) {
var c = JSON.parse(b), d = c.foreColor, f = c.backColor;
e(a), d && document.execCommand("foreColor", !1, d), f && document.execCommand("backColor", !1, f)
}, this.insertTable = function (a, b) {
e(a);
var c = b.split("x");
k.create().insertNode(d.createTable(c[0], c[1]))
}, this.floatMe = function (a, b, c) {
e(a), c.css("float", b)
}, this.resize = function (a, b, c) {
e(a), c.css({width: a.width() * b + "px", height: ""})
}, this.resizeTo = function (a, b, c) {
var d;
if (c) {
var e = a.y / a.x, f = b.data("ratio");
d = {width: f > e ? a.x : a.y / f, height: f > e ? a.x * f : a.y}
} else
d = {width: a.x, height: a.y};
b.css(d)
}, this.removeMedia = function (a, b, c) {
e(a), c.detach()
}
}, n = function () {
var a = [], b = [], c = function (a) {
var b = a[0], c = k.create();
return{contents: a.html(), bookmark: c.bookmark(b), scrollTop: a.scrollTop()}
}, d = function (a, b) {
a.html(b.contents).scrollTop(b.scrollTop), k.createFromBookmark(a[0], b.bookmark).select()
};
this.undo = function (e) {
var f = c(e);
0 !== a.length && (d(e, a.pop()), b.push(f))
}, this.redo = function (e) {
var f = c(e);
0 !== b.length && (d(e, b.pop()), a.push(f))
}, this.recordUndo = function (d) {
b = [], a.push(c(d))
}
}, o = function () {
this.update = function (b, c) {
var d = function (b, c) {
b.find(".dropdown-menu li a").each(function () {
var b = a(this).data("value") + "" == c + "";
this.className = b ? "checked" : ""
})
}, f = function (a, c) {
var d = b.find(a);
d.toggleClass("active", c())
}, g = b.find(".note-fontname");
if (g.length > 0) {
var h = c["font-family"];
h && (h = e.head(h.split(",")), h = h.replace(/\'/g, ""), g.find(".note-current-fontname").text(h), d(g, h))
}
var i = b.find(".note-fontsize");
i.find(".note-current-fontsize").text(c["font-size"]), d(i, parseFloat(c["font-size"]));
var j = b.find(".note-height");
d(j, parseFloat(c["line-height"])), f('button[data-event="bold"]', function () {
return"bold" === c["font-bold"]
}), f('button[data-event="italic"]', function () {
return"italic" === c["font-italic"]
})
}, this.updateRecentColor = function (b, c, d) {
var e = a(b).closest(".note-color"), f = e.find(".note-recent-color"), g = JSON.parse(f.attr("data-value"));
g[c] = d, f.attr("data-value", JSON.stringify(g));
var h = "backColor" === c ? "background-color" : "color";
f.find("i").css(h, d)
}
}, p = function () {
var a = new o;
this.update = function (b, c) {
a.update(b, c)
}, this.updateRecentColor = function (b, c, d) {
a.updateRecentColor(b, c, d)
}, this.activate = function (a) {
a.find("button").not('button[data-event="codeview"]').removeClass("disabled")
}, this.deactivate = function (a) {
a.find("button").not('button[data-event="codeview"]').addClass("disabled")
}, this.updateFullscreen = function (a, b) {
var c = a.find('button[data-event="fullscreen"]');
c.toggleClass("active", b)
}, this.updateCodeview = function (a, b) {
var c = a.find('button[data-event="codeview"]');
c.toggleClass("active", b)
}
}, q = function () {
var b = new o, c = function (b, c) {
var d = a(c), e = d.position(), f = d.outerHeight(!0);
b.css({display: "block", left: e.left, top: e.top + f})
}, f = 20;
this.update = function (a, g, h) {
b.update(a, g);
var i = a.find(".note-link-popover");
if (g.anchor) {
var j = i.find("a");
j.attr("href", g.anchor.href).html(g.anchor.href), c(i, g.anchor)
} else
i.hide();
var k = a.find(".note-image-popover");
if (g.image ? c(k, g.image) : k.hide(), h) {
var l = a.find(".note-air-popover");
if (g.range.isCollapsed())
l.hide();
else {
var m = d.rect2bnd(e.last(g.range.getClientRects()));
l.css({display: "block", left: Math.max(m.left + m.width / 2 - f, 0), top: m.top + m.height})
}
}
}, this.updateRecentColor = function (a, c, d) {
b.updateRecentColor(a, c, d)
}, this.hide = function (a) {
a.children().hide()
}
}, r = function () {
this.update = function (b, c) {
var d = b.find(".note-control-selection");
if (c.image) {
var e = a(c.image), f = e.position(), g = {w: e.outerWidth(!0), h: e.outerHeight(!0)};
d.css({display: "block", left: f.left, top: f.top, width: g.w, height: g.h}).data("target", c.image);
var h = g.w + "x" + g.h;
d.find(".note-control-selection-info").text(h)
} else
d.hide()
}, this.hide = function (a) {
a.children().hide()
}
}, s = function () {
var b = function (a, b) {
a.toggleClass("disabled", !b), a.attr("disabled", !b)
};
this.showImageDialog = function (c, d) {
return a.Deferred(function (a) {
var e = d.find(".note-image-dialog"), f = d.find(".note-image-input"), g = d.find(".note-image-url"), h = d.find(".note-image-btn");
e.one("shown.bs.modal", function () {
f.replaceWith(f.clone().on("change", function () {
e.modal("hide"), a.resolve(this.files)
})), h.click(function (b) {
b.preventDefault(), e.modal("hide"), a.resolve(g.val())
}), g.keyup(function () {
b(h, g.val())
}).val("").focus()
}).one("hidden.bs.modal", function () {
c.focus(), f.off("change"), g.off("keyup"), h.off("click")
}).modal("show")
})
}, this.showVideoDialog = function (c, d, e) {
return a.Deferred(function (a) {
var f = d.find(".note-video-dialog"), g = f.find(".note-video-url"), h = f.find(".note-video-btn");
f.one("shown.bs.modal", function () {
g.val(e.text).keyup(function () {
b(h, g.val())
}).trigger("keyup").trigger("focus"), h.click(function (b) {
b.preventDefault(), f.modal("hide"), a.resolve(g.val())
})
}).one("hidden.bs.modal", function () {
c.focus(), g.off("keyup"), h.off("click")
}).modal("show")
})
}, this.showLinkDialog = function (c, d, e) {
return a.Deferred(function (a) {
var f = d.find(".note-link-dialog"), g = f.find(".note-link-text"), h = f.find(".note-link-url"), i = f.find(".note-link-btn"), j = f.find("input[type=checkbox]");
f.one("shown.bs.modal", function () {
g.val(e.text), g.keyup(function () {
e.text = g.val()
}), e.url || (e.url = e.text, b(i, e.text)), h.keyup(function () {
b(i, h.val()), e.text || g.val(h.val())
}).val(e.url).trigger("focus").trigger("select"), j.prop("checked", e.newWindow), i.one("click", function (b) {
b.preventDefault(), f.modal("hide"), a.resolve(g.val(), h.val(), j.is(":checked"))
})
}).one("hidden.bs.modal", function () {
c.focus(), h.off("keyup")
}).modal("show")
}).promise()
}, this.showHelpDialog = function (a, b) {
var c = b.find(".note-help-dialog");
c.one("hidden.bs.modal", function () {
a.focus()
}).modal("show")
}
}, t = function () {
var d = a(document), g = new m, j = new p, k = new q, l = new r, o = new s, t = function (b) {
var c = a(b).closest(".note-editor, .note-air-editor, .note-air-layout");
if (0 === c.length)
return null;
var d;
return d = c.is(".note-editor, .note-air-editor") ? c : a("#note-editor-" + e.last(c.attr("id").split("-"))), f.buildLayoutInfo(d)
}, u = function (b, c) {
g.restoreRange(b);
var d = b.data("callbacks");
d.onImageUpload ? d.onImageUpload(c, g, b) : a.each(c, function (a, c) {
h.readFileAsDataURL(c).then(function (a) {
g.insertImage(b, a)
}).fail(function () {
d.onImageUploadError && d.onImageUploadError()
})
})
}, v = function (a) {
f.isImg(a.target) && a.preventDefault()
}, w = function (a) {
setTimeout(function () {
var b = t(a.currentTarget || a.target), c = g.currentStyle(a.target);
if (c) {
var d = b.editor().data("options").airMode;
d || j.update(b.toolbar(), c), k.update(b.popover(), c, d), l.update(b.handle(), c)
}
}, 0)
}, x = function (a) {
var b = t(a.currentTarget || a.target);
k.hide(b.popover()), l.hide(b.handle())
}, y = function (a) {
var b = a.originalEvent;
if (b.clipboardData && b.clipboardData.items && b.clipboardData.items.length) {
var c = t(a.currentTarget || a.target), d = e.head(b.clipboardData.items), f = "file" === d.kind && -1 !== d.type.indexOf("image/");
f && u(c.editable(), [d.getAsFile()])
}
}, z = function (b) {
if (f.isControlSizing(b.target)) {
b.preventDefault(), b.stopPropagation();
var c = t(b.target), e = c.handle(), h = c.popover(), i = c.editable(), j = e.find(".note-control-selection").data("target"), m = a(j), n = m.offset(), o = d.scrollTop();
d.on("mousemove", function (a) {
g.resizeTo({x: a.clientX - n.left, y: a.clientY - (n.top - o)}, m, !a.shiftKey), l.update(e, {image: j}), k.update(h, {image: j})
}).one("mouseup", function () {
d.off("mousemove")
}), m.data("ratio") || m.data("ratio", m.height() / m.width()), g.recordUndo(i)
}
}, A = function (b) {
var c = a(b.target).closest("[data-event]");
c.length > 0 && b.preventDefault()
}, B = function (b) {
var c = b.editor(), d = b.toolbar(), e = b.editable(), f = b.codable(), g = c.data("options"), h = a("html, body"), i = function (a) {
c.css("width", a.w), e.css("height", a.h), f.css("height", a.h), f.data("cmEditor") && f.data("cmEditor").setSize(null, a.h)
};
c.toggleClass("fullscreen");
var k = c.hasClass("fullscreen");
k ? (e.data("orgHeight", e.css("height")), a(window).on("resize", function () {
i({w: a(window).width(), h: a(window).height() - d.outerHeight()})
}).trigger("resize"), h.css("overflow", "hidden")) : (a(window).off("resize"), i({w: g.width || "", h: e.data("orgHeight")}), h.css("overflow", "visible")), j.updateFullscreen(d, k)
}, C = function (a) {
var d, e, g = a.editor(), h = a.toolbar(), i = a.editable(), l = a.codable(), m = a.popover(), n = g.data("options");
g.toggleClass("codeview");
var o = g.hasClass("codeview");
o ? (l.val(i.html()), l.height(i.height()), j.deactivate(h), k.hide(m), l.focus(), c.bCodeMirror && (d = b.fromTextArea(l[0], n.codemirror), n.codemirror.tern && (e = new b.TernServer(n.codemirror.tern), d.ternServer = e, d.on("cursorActivity", function (a) {
e.updateArgHints(a)
})), d.setSize(null, i.outerHeight()), d.autoFormatRange && d.autoFormatRange({line: 0, ch: 0}, {line: d.lineCount(), ch: d.getTextArea().value.length}), l.data("cmEditor", d))) : (c.bCodeMirror && (d = l.data("cmEditor"), l.val(d.getValue()), d.toTextArea()), i.html(l.val() || f.emptyPara), i.height(n.height ? l.height() : "auto"), j.activate(h), i.focus()), j.updateCodeview(a.toolbar(), o)
}, D = function (b) {
var c = a(b.target).closest("[data-event]");
if (c.length > 0) {
var d, f = c.attr("data-event"), h = c.attr("data-value"), i = t(b.target), l = i.dialog(), m = i.editable();
if (-1 !== a.inArray(f, ["resize", "floatMe", "removeMedia"])) {
var n = i.handle().find(".note-control-selection");
d = a(n.data("target"))
}
if (g[f] && (m.trigger("focus"), g[f](m, h, d)), -1 !== a.inArray(f, ["backColor", "foreColor"])) {
var p = i.editor().data("options", p), q = p.airMode ? k : j;
q.updateRecentColor(e.head(c), f, h)
} else if ("showLinkDialog" === f) {
m.focus();
var r = g.getLinkInfo();
g.saveRange(m), o.showLinkDialog(m, l, r).then(function (a, b, c) {
g.restoreRange(m), g.createLink(m, a, b, c), k.hide(i.popover())
})
} else if ("showImageDialog" === f)
m.focus(), o.showImageDialog(m, l).then(function (a) {
"string" == typeof a ? (g.restoreRange(m), g.insertImage(m, a)) : u(m, a)
});
else if ("showVideoDialog" === f) {
m.focus();
var s = g.getVideoInfo();
g.saveRange(m), o.showVideoDialog(m, l, s).then(function (a) {
g.restoreRange(m), g.insertVideo(m, a)
})
} else
"showHelpDialog" === f ? o.showHelpDialog(m, l) : "fullscreen" === f ? B(i) : "codeview" === f && C(i);
w(b)
}
}, E = 24, F = function (a) {
a.preventDefault(), a.stopPropagation();
var b = t(a.target).editable(), c = b.offset().top - d.scrollTop(), e = t(a.currentTarget || a.target), f = e.editor().data("options");
d.on("mousemove", function (a) {
var d = a.clientY - (c + E);
d = f.minHeight > 0 ? Math.max(d, f.minHeight) : d, d = f.maxHeight > 0 ? Math.min(d, f.maxHeight) : d, b.height(d)
}).one("mouseup", function () {
d.off("mousemove")
})
}, G = 18, H = function (b) {
var c, d = a(b.target.parentNode), e = d.next(), f = d.find(".note-dimension-picker-mousecatcher"), g = d.find(".note-dimension-picker-highlighted"), h = d.find(".note-dimension-picker-unhighlighted");
if (void 0 === b.offsetX) {
var i = a(b.target).offset();
c = {x: b.pageX - i.left, y: b.pageY - i.top}
} else
c = {x: b.offsetX, y: b.offsetY};
var j = {c: Math.ceil(c.x / G) || 1, r: Math.ceil(c.y / G) || 1};
g.css({width: j.c + "em", height: j.r + "em"}), f.attr("data-value", j.c + "x" + j.r), 3 < j.c && j.c < 10 && h.css({width: j.c + 1 + "em"}), 3 < j.r && j.r < 10 && h.css({height: j.r + 1 + "em"}), e.html(j.c + " x " + j.r)
}, I = function (b) {
var c = a(), e = b.dropzone, f = b.dropzone.find(".note-dropzone-message");
d.on("dragenter", function (a) {
var d = b.editor.hasClass("codeview");
d || 0 !== c.length || (b.editor.addClass("dragover"), e.width(b.editor.width()), e.height(b.editor.height()), f.text("Drag Image Here")), c = c.add(a.target)
}).on("dragleave", function (a) {
c = c.not(a.target), 0 === c.length && b.editor.removeClass("dragover")
}).on("drop", function () {
c = a(), b.editor.removeClass("dragover")
}), e.on("dragenter", function () {
e.addClass("hover"), f.text("Drop Image")
}).on("dragleave", function () {
e.removeClass("hover"), f.text("Drag Image Here")
}), e.on("drop", function (a) {
a.preventDefault();
var b = a.originalEvent.dataTransfer;
if (b && b.files) {
var c = t(a.currentTarget || a.target);
c.editable().focus(), u(c.editable(), b.files)
}
}).on("dragover", !1)
};
this.bindKeyMap = function (a, b) {
var c = a.editor, d = a.editable;
d.on("keydown", function (a) {
var e = [];
a.metaKey && e.push("CMD"), a.ctrlKey && e.push("CTRL"), a.shiftKey && e.push("SHIFT");
var f = i.nameFromCode[a.keyCode];
f && e.push(f);
var h = b[e.join("+")];
h ? (a.preventDefault(), g[h](d, c.data("options"))) : i.isEdit(a.keyCode) && g.recordUndo(d)
})
}, this.attach = function (a, b) {
this.bindKeyMap(a, b.keyMap[c.bMac ? "mac" : "pc"]), a.editable.on("mousedown", v), a.editable.on("keyup mouseup", w), a.editable.on("scroll", x), a.editable.on("paste", y), a.handle.on("mousedown", z), a.popover.on("click", D), a.popover.on("mousedown", A), b.airMode || (b.disableDragAndDrop || I(a), a.toolbar.on("click", D), a.toolbar.on("mousedown", A), b.disableResizeEditor || a.statusbar.on("mousedown", F));
var d = b.airMode ? a.popover : a.toolbar, e = d.find(".note-dimension-picker-mousecatcher");
if (e.on("mousemove", H), a.editable.on("blur", function () {
g.saveRange(a.editable)
}), a.editor.data("options", b), b.styleWithSpan && !c.bMSIE && setTimeout(function () {
document.execCommand("styleWithCSS", 0, !0)
}, 0), a.editable.data("NoteHistory", new n), b.onenter && a.editable.keypress(function (a) {
a.keyCode === i.ENTER && b.onenter(a)
}), b.onfocus && a.editable.focus(b.onfocus), b.onblur && a.editable.blur(b.onblur), b.onkeyup && a.editable.keyup(b.onkeyup), b.onkeydown && a.editable.keydown(b.onkeydown), b.onpaste && a.editable.on("paste", b.onpaste), b.onToolbarClick && a.toolbar.click(b.onToolbarClick), b.onChange) {
var f = function () {
b.onChange(a.editable, a.editable.html())
};
if (c.bMSIE) {
var h = "DOMCharacterDataModified, DOMSubtreeModified, DOMNodeInserted";
a.editable.on(h, f)
} else
a.editable.on("input", f)
}
a.editable.data("callbacks", {onAutoSave: b.onAutoSave, onImageUpload: b.onImageUpload, onImageUploadError: b.onImageUploadError, onFileUpload: b.onFileUpload, onFileUploadError: b.onFileUpload})
}, this.dettach = function (a) {
a.editable.off(), a.popover.off(), a.handle.off(), a.dialog.off(), a.editor.data("options").airMode && (a.dropzone.off(), a.toolbar.off(), a.statusbar.off())
}
}, u = function () {
var b = function (a, b) {
var c = b.event, d = b.value, e = b.title, f = b.className, g = b.dropdown;
return'<button type="button" class="btn btn-default btn-sm btn-small' + (f ? " " + f : "") + (g ? " dropdown-toggle" : "") + '"' + (g ? ' data-toggle="dropdown"' : "") + (e ? ' title="' + e + '"' : "") + (c ? ' data-event="' + c + '"' : "") + (d ? " data-value='" + d + "'" : "") + ' tabindex="-1">' + a + (g ? ' <span class="caret"></span>' : "") + "</button>" + (g || "")
}, e = function (a, c) {
var d = '<i class="' + a + '"></i>';
return b(d, c)
}, g = function (a, b) {
return'<div class="' + a + ' popover bottom in" style="display: none;"><div class="arrow"></div><div class="popover-content">' + b + "</div></div>"
}, h = function (a, b, c, d) {
return'<div class="' + a + ' modal" aria-hidden="false"><div class="modal-dialog"><div class="modal-content">' + (b ? '<div class="modal-header"><button type="button" class="close" aria-hidden="true" tabindex="-1">×</button><h4>' + b + "</h4></div>" : "") + '<form class="note-modal-form"><div class="modal-body"><div class="row-fluid">' + c + "</div></div>" + (d ? '<div class="modal-footer">' + d + "</div>" : "") + "</form></div></div></div>"
}, i = {picture: function (a) {
return e("fa fa-picture-o icon-picture", {event: "showImageDialog", title: a.image.image})
}, link: function (a) {
return e("fa fa-link icon-link", {event: "showLinkDialog", title: a.link.link})
}, video: function (a) {
return e("fa fa-youtube-play icon-play", {event: "showVideoDialog", title: a.video.video})
}, table: function (a) {
var b = '<ul class="dropdown-menu"><div class="note-dimension-picker"><div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"></div><div class="note-dimension-picker-highlighted"></div><div class="note-dimension-picker-unhighlighted"></div></div><div class="note-dimension-display"> 1 x 1 </div></ul>';
return e("fa fa-table icon-table", {title: a.table.table, dropdown: b})
}, style: function (a, b) {
var c = b.styleTags.reduce(function (b, c) {
var d = a.style["p" === c ? "normal" : c];
return b + '<li><a data-event="formatBlock" data-value="' + c + '">' + ("p" === c || "pre" === c ? d : "<" + c + ">" + d + "</" + c + ">") + "</a></li>"
}, "");
return e("fa fa-magic icon-magic", {title: a.style.style, dropdown: '<ul class="dropdown-menu">' + c + "</ul>"})
}, fontname: function (a, c) {
var d = c.fontNames.reduce(function (a, b) {
return a + '<li><a data-event="fontName" data-value="' + b + '"><i class="fa fa-check icon-ok"></i> ' + b + "</a></li>"
}, ""), e = '<span class="note-current-fontname">' + c.defaultFontName + "</span>";
return b(e, {title: a.font.name, dropdown: '<ul class="dropdown-menu">' + d + "</ul>"})
}, fontsize: function (a, c) {
var d = c.fontSizes.reduce(function (a, b) {
return a + '<li><a data-event="fontSize" data-value="' + b + '"><i class="fa fa-check icon-ok"></i> ' + b + "</a></li>"
}, ""), e = '<span class="note-current-fontsize">11</span>';
return b(e, {title: a.font.size, dropdown: '<ul class="dropdown-menu">' + d + "</ul>"})
}, color: function (a) {
var c = '<i class="fa fa-font icon-font" style="color:black;background-color:yellow;"></i>', d = b(c, {className: "note-recent-color", title: a.color.recent, event: "color", value: '{"backColor":"yellow"}'}), e = '<ul class="dropdown-menu"><li><div class="btn-group"><div class="note-palette-title">' + a.color.background + '</div><div class="note-color-reset" data-event="backColor" data-value="inherit" title="' + a.color.transparent + '">' + a.color.setTransparent + '</div><div class="note-color-palette" data-target-event="backColor"></div></div><div class="btn-group"><div class="note-palette-title">' + a.color.foreground + '</div><div class="note-color-reset" data-event="foreColor" data-value="inherit" title="' + a.color.reset + '">' + a.color.resetToDefault + '</div><div class="note-color-palette" data-target-event="foreColor"></div></div></li></ul>', f = b("", {title: a.color.more, dropdown: e});
return d + f
}, bold: function (a) {
return e("fa fa-bold icon-bold", {event: "bold", title: a.font.bold})
}, italic: function (a) {
return e("fa fa-italic icon-italic", {event: "italic", title: a.font.italic})
}, underline: function (a) {
return e("fa fa-underline icon-underline", {event: "underline", title: a.font.underline})
}, strikethrough: function (a) {
return e("fa fa-strikethrough icon-strikethrough", {event: "strikethrough", title: a.font.strikethrough})
}, superscript: function (a) {
return e("fa fa-superscript icon-superscript", {event: "superscript", title: a.font.superscript})
}, subscript: function (a) {
return e("fa fa-subscript icon-subscript", {event: "subscript", title: a.font.subscript})
}, clear: function (a) {
return e("fa fa-eraser icon-eraser", {event: "removeFormat", title: a.font.clear})
}, ul: function (a) {
return e("fa fa-list-ul icon-list-ul", {event: "insertUnorderedList", title: a.lists.unordered})
}, ol: function (a) {
return e("fa fa-list-ol icon-list-ol", {event: "insertOrderedList", title: a.lists.ordered})
}, paragraph: function (a) {
var b = e("fa fa-align-left icon-align-left", {title: a.paragraph.left, event: "justifyLeft"}), c = e("fa fa-align-center icon-align-center", {title: a.paragraph.center, event: "justifyCenter"}), d = e("fa fa-align-right icon-align-right", {title: a.paragraph.right, event: "justifyRight"}), f = e("fa fa-align-justify icon-align-justify", {title: a.paragraph.justify, event: "justifyFull"}), g = e("fa fa-outdent icon-indent-left", {title: a.paragraph.outdent, event: "outdent"}), h = e("fa fa-indent icon-indent-right", {title: a.paragraph.indent, event: "indent"}), i = '<div class="dropdown-menu"><div class="note-align btn-group">' + b + c + d + f + '</div><div class="note-list btn-group">' + h + g + "</div></div>";
return e("fa fa-align-left icon-align-left", {title: a.paragraph.paragraph, dropdown: i})
}, height: function (a, b) {
var c = b.lineHeights.reduce(function (a, b) {
return a + '<li><a data-event="lineHeight" data-value="' + parseFloat(b) + '"><i class="fa fa-check icon-ok"></i> ' + b + "</a></li>"
}, "");
return e("fa fa-text-height icon-text-height", {title: a.font.height, dropdown: '<ul class="dropdown-menu">' + c + "</ul>"})
}, help: function (a) {
return e("fa fa-question icon-question", {event: "showHelpDialog", title: a.options.help})
}, fullscreen: function (a) {
return e("fa fa-arrows-alt icon-fullscreen", {event: "fullscreen", title: a.options.fullscreen})
}, codeview: function (a) {
return e("fa fa-code icon-code", {event: "codeview", title: a.options.codeview})
}, undo: function (a) {
return e("fa fa-undo icon-undo", {event: "undo", title: a.history.undo})
}, redo: function (a) {
return e("fa fa-repeat icon-repeat", {event: "redo", title: a.history.redo})
}, hr: function (a) {
return e("fa fa-minus icon-hr", {event: "insertHorizontalRule", title: a.hr.insert})
}}, j = function (a, c) {
var d = function () {
var b = e("fa fa-edit icon-edit", {title: a.link.edit, event: "showLinkDialog"}), c = e("fa fa-unlink icon-unlink", {title: a.link.unlink, event: "unlink"}), d = '<a href="http://www.google.com" target="_blank">www.google.com</a> <div class="note-insert btn-group">' + b + c + "</div>";
return g("note-link-popover", d)
}, f = function () {
var c = b('<span class="note-fontsize-10">100%</span>', {title: a.image.resizeFull, event: "resize", value: "1"}), d = b('<span class="note-fontsize-10">50%</span>', {title: a.image.resizeHalf, event: "resize", value: "0.5"}), f = b('<span class="note-fontsize-10">25%</span>', {title: a.image.resizeQuarter, event: "resize", value: "0.25"}), h = e("fa fa-align-left icon-align-left", {title: a.image.floatLeft, event: "floatMe", value: "left"}), i = e("fa fa-align-right icon-align-right", {title: a.image.floatRight, event: "floatMe", value: "right"}), j = e("fa fa-align-justify icon-align-justify", {title: a.image.floatNone, event: "floatMe", value: "none"}), k = e("fa fa-trash-o icon-trash", {title: a.image.remove, event: "removeMedia", value: "none"}), l = '<div class="btn-group">' + c + d + f + '</div><div class="btn-group">' + h + i + j + '</div><div class="btn-group">' + k + "</div>";
return g("note-image-popover", l)
}, h = function () {
for (var b = "", d = 0, e = c.airPopover.length; e > d; d++) {
var f = c.airPopover[d];
b += '<div class="note-' + f[0] + ' btn-group">';
for (var h = 0, j = f[1].length; j > h; h++)
b += i[f[1][h]](a, c);
b += "</div>"
}
return g("note-air-popover", b)
};
return'<div class="note-popover">' + d() + f() + (c.airMode ? h() : "") + "</div>"
}, k = function () {
return'<div class="note-handle"><div class="note-control-selection"><div class="note-control-selection-bg"></div><div class="note-control-holder note-control-nw"></div><div class="note-control-holder note-control-ne"></div><div class="note-control-holder note-control-sw"></div><div class="note-control-sizing note-control-se"></div><div class="note-control-selection-info"></div></div></div>'
}, l = function (a, b) {
return'<table class="note-shortcut"><thead><tr><th></th><th>' + a + "</th></tr></thead><tbody>" + b + "</tbody></table>"
}, m = function (a) {
var b = "<tr><td>⌘ + B</td><td>" + a.font.bold + "</td></tr><tr><td>⌘ + I</td><td>" + a.font.italic + "</td></tr><tr><td>⌘ + U</td><td>" + a.font.underline + "</td></tr><tr><td>⌘ + ⇧ + S</td><td>" + a.font.strikethrough + "</td></tr><tr><td>⌘ + \\</td><td>" + a.font.clear + "</td></tr>";
return l(a.shortcut.textFormatting, b)
}, n = function (a) {
var b = "<tr><td>⌘ + Z</td><td>" + a.history.undo + "</td></tr><tr><td>⌘ + ⇧ + Z</td><td>" + a.history.redo + "</td></tr><tr><td>⌘ + ]</td><td>" + a.paragraph.indent + "</td></tr><tr><td>⌘ + [</td><td>" + a.paragraph.outdent + "</td></tr><tr><td>⌘ + ENTER</td><td>" + a.hr.insert + "</td></tr>";
return l(a.shortcut.action, b)
}, o = function (a) {
var b = "<tr><td>⌘ + ⇧ + L</td><td>" + a.paragraph.left + "</td></tr><tr><td>⌘ + ⇧ + E</td><td>" + a.paragraph.center + "</td></tr><tr><td>⌘ + ⇧ + R</td><td>" + a.paragraph.right + "</td></tr><tr><td>⌘ + ⇧ + J</td><td>" + a.paragraph.justify + "</td></tr><tr><td>⌘ + ⇧ + NUM7</td><td>" + a.lists.ordered + "</td></tr><tr><td>⌘ + ⇧ + NUM8</td><td>" + a.lists.unordered + "</td></tr>";
return l(a.shortcut.paragraphFormatting, b)
}, p = function (a) {
var b = "<tr><td>⌘ + NUM0</td><td>" + a.style.normal + "</td></tr><tr><td>⌘ + NUM1</td><td>" + a.style.h1 + "</td></tr><tr><td>⌘ + NUM2</td><td>" + a.style.h2 + "</td></tr><tr><td>⌘ + NUM3</td><td>" + a.style.h3 + "</td></tr><tr><td>⌘ + NUM4</td><td>" + a.style.h4 + "</td></tr><tr><td>⌘ + NUM5</td><td>" + a.style.h5 + "</td></tr><tr><td>⌘ + NUM6</td><td>" + a.style.h6 + "</td></tr>";
return l(a.shortcut.documentStyle, b)
}, q = function (a, b) {
var c = b.extraKeys, d = "";
for (var e in c)
c.hasOwnProperty(e) && (d += "<tr><td>" + e + "</td><td>" + c[e] + "</td></tr>");
return l(a.shortcut.extraKeys, d)
}, r = function (a, b) {
var c = '<table class="note-shortcut-layout"><tbody><tr><td>' + n(a, b) + "</td><td>" + m(a, b) + "</td></tr><tr><td>" + p(a, b) + "</td><td>" + o(a, b) + "</td></tr>";
return b.extraKeys && (c += '<tr><td colspan="2">' + q(a, b) + "</td></tr>"), c += "</tbody</table>"
}, s = function (a) {
return a.replace(/⌘/g, "Ctrl").replace(/⇧/g, "Shift")
}, t = function (a, b) {
var d = function () {
var b = "<h5>" + a.image.selectFromFiles + '</h5><input class="note-image-input" type="file" name="files" accept="image/*" /><h5>' + a.image.url + '</h5><input class="note-image-url form-control span12" type="text" />', c = '<button href="#" class="btn btn-primary note-image-btn disabled" disabled>' + a.image.insert + "</button>";
return h("note-image-dialog", a.image.insert, b, c)
}, e = function () {
var c = '<div class="form-group"><label>' + a.link.textToDisplay + '</label><input class="note-link-text form-control span12" type="text" /></div><div class="form-group"><label>' + a.link.url + '</label><input class="note-link-url form-control span12" type="text" /></div>' + (b.disableLinkTarget ? "" : '<div class="checkbox"><label><input type="checkbox" checked> ' + a.link.openInNewWindow + "</label></div>"), d = '<button href="#" class="btn btn-primary note-link-btn disabled" disabled>' + a.link.insert + "</button>";
return h("note-link-dialog", a.link.insert, c, d)
}, f = function () {
var b = '<div class="form-group"><label>' + a.video.url + '</label> <small class="text-muted">' + a.video.providers + '</small><input class="note-video-url form-control span12" type="text" /></div>', c = '<button href="#" class="btn btn-primary note-video-btn disabled" disabled>' + a.video.insert + "</button>";
return h("note-video-dialog", a.video.insert, b, c)
}, g = function () {
var d = '<a class="modal-close pull-right" aria-hidden="true" tabindex="-1">' + a.shortcut.close + '</a><div class="title">' + a.shortcut.shortcuts + "</div>" + (c.bMac ? r(a, b) : s(r(a, b))) + '<p class="text-center"><a href="//hackerwins.github.io/summernote/" target="_blank">Summernote 0.5.2</a> · <a href="//github.com/HackerWins/summernote" target="_blank">Project</a> · <a href="//github.com/HackerWins/summernote/issues" target="_blank">Issues</a></p>';
return h("note-help-dialog", "", d, "")
};
return'<div class="note-dialog">' + d() + e() + f() + g() + "</div>"
}, u = function () {
return'<div class="note-resizebar"><div class="note-icon-bar"></div><div class="note-icon-bar"></div><div class="note-icon-bar"></div></div>'
}, v = function (a) {
return c.bMac && (a = a.replace("CMD", "⌘").replace("SHIFT", "⇧")), a.replace("BACKSLASH", "\\").replace("SLASH", "/").replace("LEFTBRACKET", "[").replace("RIGHTBRACKET", "]")
}, w = function (b, c, e) {
var f = d.invertObject(c), g = b.find("button");
g.each(function (b, c) {
var d = a(c), e = f[d.data("event")];
e && d.attr("title", function (a, b) {
return b + " (" + v(e) + ")"
})
}).tooltip({container: "body", trigger: "hover", placement: e || "top"}).on("click", function () {
a(this).tooltip("hide")
})
}, x = function (b, c) {
var d = c.colors;
b.find(".note-color-palette").each(function () {
for (var b = a(this), c = b.attr("data-target-event"), e = [], f = 0, g = d.length; g > f; f++) {
for (var h = d[f], i = [], j = 0, k = h.length; k > j; j++) {
var l = h[j];
i.push(['<button type="button" class="note-color-btn" style="background-color:', l, ';" data-event="', c, '" data-value="', l, '" title="', l, '" data-toggle="button" tabindex="-1"></button>'].join(""))
}
e.push("<div>" + i.join("") + "</div>")
}
b.html(e.join(""))
})
};
this.createLayoutByAirMode = function (b, e) {
var f = e.keyMap[c.bMac ? "mac" : "pc"], g = a.summernote.lang[e.lang], h = d.uniqueId();
b.addClass("note-air-editor note-editable"), b.attr({id: "note-editor-" + h, contentEditable: !0});
var i = document.body, l = a(j(g, e));
l.addClass("note-air-layout"), l.attr("id", "note-popover-" + h), l.appendTo(i), w(l, f), x(l, e);
var m = a(k());
m.addClass("note-air-layout"), m.attr("id", "note-handle-" + h), m.appendTo(i);
var n = a(t(g, e));
n.addClass("note-air-layout"), n.attr("id", "note-dialog-" + h), n.find("button.close, a.modal-close").click(function () {
a(this).closest(".modal").modal("hide")
}), n.appendTo(i)
}, this.createLayoutByFrame = function (b, d) {
var e = a('<div class="note-editor"></div>');
d.width && e.width(d.width), d.height > 0 && a('<div class="note-statusbar">' + (d.disableResizeEditor ? "" : u()) + "</div>").prependTo(e);
var g = !b.is(":disabled"), h = a('<div class="note-editable" contentEditable="' + g + '"></div>').prependTo(e);
d.height && h.height(d.height), d.direction && h.attr("dir", d.direction), h.html(f.html(b) || f.emptyPara), a('<textarea class="note-codable"></textarea>').prependTo(e);
for (var l = a.summernote.lang[d.lang], m = "", n = 0, o = d.toolbar.length; o > n; n++) {
var p = d.toolbar[n];
m += '<div class="note-' + p[0] + ' btn-group">';
for (var q = 0, r = p[1].length; r > q; q++)
m += i[p[1][q]](l, d);
m += "</div>"
}
m = '<div class="note-toolbar btn-toolbar">' + m + "</div>";
var s = a(m).prependTo(e), v = d.keyMap[c.bMac ? "mac" : "pc"];
x(s, d), w(s, v, "bottom");
var y = a(j(l, d)).prependTo(e);
x(y, d), w(y, v), a(k()).prependTo(e);
var z = a(t(l, d)).prependTo(e);
z.find("button.close, a.modal-close").click(function () {
a(this).closest(".modal").modal("hide")
}), a('<div class="note-dropzone"><div class="note-dropzone-message"></div></div>').prependTo(e), e.insertAfter(b), b.hide()
}, this.noteEditorFromHolder = function (b) {
return b.hasClass("note-air-editor") ? b : b.next().hasClass("note-editor") ? b.next() : a()
}, this.createLayout = function (a, b) {
this.noteEditorFromHolder(a).length > 0 || (b.airMode ? this.createLayoutByAirMode(a, b) : this.createLayoutByFrame(a, b))
}, this.layoutInfoFromHolder = function (a) {
var b = this.noteEditorFromHolder(a);
if (b.length) {
var c = f.buildLayoutInfo(b);
for (var d in c)
c.hasOwnProperty(d) && (c[d] = c[d].call());
return c
}
}, this.removeLayout = function (a) {
var b = this.layoutInfoFromHolder(a);
b && (a.html(b.editable.html()), b.editor.remove(), a.show())
}
};
a.summernote = a.summernote || {}, a.extend(a.summernote, g);
var v = new u, w = new t;
a.fn.extend({summernote: function (b) {
if (b = a.extend({}, a.summernote.options, b), this.each(function (c, d) {
var e = a(d);
v.createLayout(e, b);
var g = v.layoutInfoFromHolder(e);
w.attach(g, b), f.isTextarea(e[0]) && e.closest("form").submit(function () {
e.html(e.code())
})
}), this.first().length && b.focus) {
var c = v.layoutInfoFromHolder(this.first());
c.editable.focus()
}
return this.length > 0 && b.oninit && b.oninit(), this
}, code: function (b) {
if (void 0 === b) {
var d = this.first();
if (0 === d.length)
return;
var e = v.layoutInfoFromHolder(d);
if (e && e.editable) {
var f = e.editor.hasClass("codeview");
return f && c.bCodeMirror && e.codable.data("cmEditor").save(), f ? e.codable.val() : e.editable.html()
}
return d.html()
}
return this.each(function (c, d) {
var e = v.layoutInfoFromHolder(a(d));
e && e.editable && e.editable.html(b)
}), this
}, destroy: function () {
return this.each(function (b, c) {
var d = a(c), e = v.layoutInfoFromHolder(d);
e && e.editable && (w.dettach(e), v.removeLayout(d))
}), this
}})
});