XWWitPark/witpark_jzzs/xw_jzzs_web/public/lib/summernote/summernote.min.js
2024-09-12 08:10:00 +08:00

2 lines
68 KiB
JavaScript

/* 2020-9-22 15:23:19 | 版权所有 军懋国兴 */
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(window.jQuery)}(function(N){Array.prototype.reduce||(Array.prototype.reduce=function(e){var t,n=Object(this),o=n.length>>>0,i=0;if(2===arguments.length)t=arguments[1];else{for(;i<o&&!(i in n);)i++;if(o<=i)throw new TypeError("Reduce of empty array with no initial value");t=n[i++]}for(;i<o;i++)i in n&&(t=e(t,n[i],i,n));return t}),"function"!=typeof Array.prototype.filter&&(Array.prototype.filter=function(e){for(var t,n=Object(this),o=n.length>>>0,i=[],r=2<=arguments.length?arguments[1]:void 0,a=0;a<o;a++){a in n&&(t=n[a],e.call(r,t,a,n)&&i.push(t))}return i});function f(t){function e(e){null!==e.contents&&t.html(e.contents),null!==e.bookmark&&M.createFromBookmark(i,e.bookmark).select()}var n=[],o=-1,i=t[0];this.undo=function(){0<o&&e(n[--o])},this.redo=function(){n.length-1>o&&e(n[++o])},this.recordUndo=function(){var e;o++,n.length>o&&(n=n.slice(0,o)),n.push((e=M.create(),{contents:t.html(),bookmark:e?e.bookmark(i):{s:{path:[],offset:0},e:{path:[],offset:0}}}))},this.recordUndo()}function l(){this.stylePara=function(e,n){N.each(e.nodes(E.isPara,{includeAncestor:!0}),function(e,t){N(t).css(n)})},this.styleNodes=function(e,t){e=e.splitText();var n=t&&t.nodeName||"SPAN",o=!(!t||!t.expandClosestSibling),i=!(!t||!t.onlyPartialContains);if(e.isCollapsed())return e.insertNode(E.create(n));var r,a=E.makePredByNodeName(n),s=N.map(e.nodes(E.isText,{fullyContains:!0}),function(e){return E.singleChildAncestor(e,a)||E.wrap(e,n)});return o?(i&&(r=e.nodes(),a=P.and(a,function(e){return I.contains(r,e)})),N.map(s,function(e){var t=E.withClosestSiblings(e,a),n=I.head(t),o=I.tail(t);return N.each(o,function(e,t){E.appendChildNodes(n,t.childNodes),E.remove(t)}),I.head(t)})):s},this.current=function(e,t){var n,o=function(n,e){if(F.jqueryVersion<1.9){var o={};return N.each(e,function(e,t){o[t]=n.css(t)}),o}return n.css.call(n,e)}(N(E.isText(e.sc)?e.sc.parentNode:e.sc),["font-family","font-size","text-align","list-style-type","line-height"])||{};o["font-size"]=parseInt(o["font-size"],10),o["font-bold"]=document.queryCommandState("bold")?"bold":"normal",o["font-italic"]=document.queryCommandState("italic")?"italic":"normal",o["font-underline"]=document.queryCommandState("underline")?"underline":"normal",o["font-strikethrough"]=document.queryCommandState("strikeThrough")?"strikethrough":"normal",o["font-superscript"]=document.queryCommandState("superscript")?"superscript":"normal",o["font-subscript"]=document.queryCommandState("subscript")?"subscript":"normal",e.isOnList()?(n=-1<N.inArray(o["list-style-type"],["circle","disc","disc-leading-zero","square"]),o["list-style"]=n?"unordered":"ordered"):o["list-style"]="none";var i,r=E.ancestor(e.sc,E.isPara);return r&&r.style["line-height"]?o["line-height"]=r.style.lineHeight:(i=parseInt(o["line-height"],10)/parseInt(o["font-size"],10),o["line-height"]=i.toFixed(1)),o.image=E.isImg(t)&&t,o.anchor=e.isOnAnchor()&&E.ancestor(e.sc,E.isAnchor),o.ancestors=E.listAncestor(e.sc,E.isEditable),o.range=e,o}}function d(){this.insertTab=function(e,t,n){var o=E.createText(new Array(n+1).join(E.NBSP_CHAR));(t=t.deleteContents()).insertNode(o,!0),(t=M.create(o,n)).select()},this.insertParagraph=function(){var e=M.create();e=(e=e.deleteContents()).wrapBodyInlineWithPara();var t,n,o,i=E.ancestor(e.sc,E.isPara);i?(o=E.splitTree(i,e.getStartPoint()),t=(t=E.listDescendant(i,E.isEmptyAnchor)).concat(E.listDescendant(o,E.isEmptyAnchor)),N.each(t,function(e,t){E.remove(t)})):(n=e.sc.childNodes[e.so],o=N(E.emptyPara)[0],n?e.sc.insertBefore(o,n):e.sc.appendChild(o)),M.create(o,0).normalize().select()}}function c(){this.tab=function(e,t){var n=E.ancestor(e.commonAncestor(),E.isCell),o=E.ancestor(n,E.isTable),i=E.listDescendant(o,E.isCell),r=I[t?"prev":"next"](i,n);r&&M.create(r,0).select()},this.createTable=function(e,t){for(var n,o=[],i=0;i<e;i++)o.push("<td>"+E.blank+"</td>");n=o.join("");for(var r,a=[],s=0;s<t;s++)a.push("<tr>"+n+"</tr>");return r=a.join(""),N('<table class="table table-bordered">'+r+"</table>")[0]}}function p(){this.insertOrderedList=function(){this.toggleList("OL")},this.insertUnorderedList=function(){this.toggleList("UL")},this.indent=function(){var o=this,e=M.create().wrapBodyInlineWithPara(),t=e.nodes(E.isPara,{includeAncestor:!0}),n=I.clusterBy(t,P.peq2("parentNode"));N.each(n,function(e,t){var n=I.head(t);E.isLi(n)?o.wrapList(t,n.parentNode.nodeName):N.each(t,function(e,t){N(t).css("marginLeft",function(e,t){return(parseInt(t,10)||0)+25})})}),e.select()},this.outdent=function(){var o=this,e=M.create().wrapBodyInlineWithPara(),t=e.nodes(E.isPara,{includeAncestor:!0}),n=I.clusterBy(t,P.peq2("parentNode"));N.each(n,function(e,t){var n=I.head(t);E.isLi(n)?o.releaseList([t]):N.each(t,function(e,t){N(t).css("marginLeft",function(e,t){return 25<(t=parseInt(t,10)||0)?t-25:""})})}),e.select()},this.toggleList=function(n){var o,e,i=this,t=M.create().wrapBodyInlineWithPara(),r=t.nodes(E.isPara,{includeAncestor:!0}),a=t.paraBookmark(r),s=I.clusterBy(r,P.peq2("parentNode"));I.find(r,E.isPurePara)?(o=[],N.each(s,function(e,t){o=o.concat(i.wrapList(t,n))}),r=o):(e=t.nodes(E.isList,{includeAncestor:!0}).filter(function(e){return!N.nodeName(e,n)})).length?N.each(e,function(e,t){E.replace(t,n)}):r=this.releaseList(s,!0),M.createFromParaBookmark(a,r).select()},this.wrapList=function(e,t){var n=I.head(e),o=I.last(e),i=E.isList(n.previousSibling)&&n.previousSibling,r=E.isList(o.nextSibling)&&o.nextSibling,a=i||E.insertAfter(E.create(t||"UL"),o);return e=N.map(e,function(e){return E.isPurePara(e)?E.replace(e,"LI"):e}),E.appendChildNodes(a,e),r&&(E.appendChildNodes(a,I.from(r.childNodes)),E.remove(r)),e},this.releaseList=function(e,l){var d=[];return N.each(e,function(e,t){var n=I.head(t),o=I.last(t),i=l?E.lastAncestor(n,E.isList):n.parentNode,r=1<i.childNodes.length?E.splitTree(i,{node:o.parentNode,offset:E.position(o)+1},!0):null,a=E.splitTree(i,{node:n.parentNode,offset:E.position(n)},!0);t=l?E.listDescendant(a,E.isLi):I.from(a.childNodes).filter(E.isLi),!l&&E.isList(i.parentNode)||(t=N.map(t,function(e){return E.replace(e,"P")})),N.each(I.from(t).reverse(),function(e,t){E.insertAfter(t,i)});var s=I.compact([i,a,r]);N.each(s,function(e,t){var n=[t].concat(E.listDescendant(t,E.isList));N.each(n.reverse(),function(e,t){E.nodeLength(t)||E.remove(t,!0)})}),d=d.concat(t)}),d}}function e(){var u=new l,o=new c,i=new d,t=new p;this.createRange=function(e){return e.focus(),M.create()},this.saveRange=function(e,t){e.focus(),e.data("range",M.create()),t&&M.create().collapse().select()},this.saveNode=function(e){for(var t=[],n=0,o=e[0].childNodes.length;n<o;n++)t.push(e[0].childNodes[n]);e.data("childNodes",t)},this.restoreRange=function(e){var t=e.data("range");t&&(t.select(),e.focus())},this.restoreNode=function(e){e.html("");for(var t=e.data("childNodes"),n=0,o=t.length;n<o;n++)e[0].appendChild(t[n])},this.currentStyle=function(e){var t=M.create();return!!t&&(t.isOnEditable()&&u.current(t,e))};var n=this.triggerOnBeforeChange=function(e){var t=e.data("callbacks").onBeforeChange;t&&t(e.html(),e)},r=this.triggerOnChange=function(e){var t=e.data("callbacks").onChange;t&&t(e.html(),e)};this.undo=function(e){n(e),e.data("NoteHistory").undo(),r(e)},this.redo=function(e){n(e),e.data("NoteHistory").redo(),r(e)};for(var f=this.beforeCommand=function(e){n(e)},h=this.afterCommand=function(e){e.data("NoteHistory").recordUndo(),r(e)},e=["bold","italic","underline","strikethrough","superscript","subscript","justifyLeft","justifyCenter","justifyRight","justifyFull","formatBlock","removeFormat","backColor","foreColor","insertHorizontalRule","fontName"],a=0,s=e.length;a<s;a++)this[e[a]]=function(n){return function(e,t){f(e),document.execCommand(n,!1,t),h(e)}}(e[a]);this.tab=function(e,t){var n=M.create();n.isCollapsed()&&n.isOnCell()?o.tab(n):(f(e),i.insertTab(e,n,t.tabsize),h(e))},this.untab=function(){var e=M.create();e.isCollapsed()&&e.isOnCell()&&o.tab(e,!0)},this.insertParagraph=function(e){f(e),i.insertParagraph(e),h(e)},this.insertOrderedList=function(e){f(e),t.insertOrderedList(e),h(e)},this.insertUnorderedList=function(e){f(e),t.insertUnorderedList(e),h(e)},this.indent=function(e){f(e),t.indent(e),h(e)},this.outdent=function(e){f(e),t.outdent(e),h(e)},this.insertImage=function(t,e,n){A.createImage(e,n).then(function(e){f(t),e.css({display:"",width:Math.min(t.width(),e.width())}),M.create().insertNode(e[0]),M.createFromNode(e[0]).collapse().select(),h(t)}).fail(function(){var e=t.data("callbacks");e.onImageUploadError&&e.onImageUploadError()})},this.insertNode=function(e,t){f(e),this.createRange(e).insertNode(t),M.createFromNode(t).collapse().select(),h(e)},this.insertText=function(e,t){f(e);var n=this.createRange(e).insertNode(E.createText(t));M.create(n,E.nodeLength(n)).select(),h(e)},this.formatBlock=function(e,t){f(e),t=F.isMSIE?"<"+t+">":t,document.execCommand("FormatBlock",!1,t),h(e)},this.formatPara=function(e){f(e),this.formatBlock(e,"P"),h(e)};for(var a=1;a<=6;a++)this["formatH"+a]=function(t){return function(e){this.formatBlock(e,"H"+t)}}(a);this.fontSize=function(e,n){f(e);var t=this.createRange(e),o=u.styleNodes(t);N.each(o,function(e,t){N(t).css({"font-size":n+"px"})}),h(e)},this.lineHeight=function(e,t){f(e),u.stylePara(M.create(),{lineHeight:t}),h(e)},this.unlink=function(e){var t,n=M.create();n.isOnAnchor()&&(t=E.ancestor(n.sc,E.isAnchor),(n=M.createFromNode(t)).select(),f(e),document.execCommand("unlink"),h(e))},this.createLink=function(e,t,n){var o,i=t.url,r=t.text,a=t.newWindow,s=t.range,l=s.toString()!==r;f(e),n.onCreateLink&&(i=n.onCreateLink(i)),o=l?[s.insertNode(N("<A>"+r+"</A>")[0])]:u.styleNodes(s,{nodeName:"A",expandClosestSibling:!0,onlyPartialContains:!0}),N.each(o,function(e,t){N(t).attr("href",i),a?N(t).attr("target","_blank"):N(t).removeAttr("target")});var d=M.createFromNode(I.head(o)).collapse(!0).getStartPoint(),c=M.createFromNode(I.last(o)).collapse().getEndPoint();M.create(d.node,d.offset,c.node,c.offset).select(),h(e)},this.getLinkInfo=function(e){e.focus();var t=M.create().expand(E.isAnchor),n=N(I.head(t.nodes(E.isAnchor)));return{range:t,text:t.toString(),isNewWindow:!!n.length&&"_blank"===n.attr("target"),url:n.length?n.attr("href"):""}},this.color=function(e,t){var n=JSON.parse(t),o=n.foreColor,i=n.backColor;f(e),o&&document.execCommand("foreColor",!1,o),i&&document.execCommand("backColor",!1,i),h(e)},this.insertTable=function(e,t){var n=t.split("x");f(e),M.create().deleteContents().insertNode(o.createTable(n[0],n[1])),h(e)},this.floatMe=function(e,t,n){f(e),n.css("float",t),h(e)},this.imageShape=function(e,t,n){f(e),n.removeClass("img-rounded img-circle img-thumbnail"),t&&n.addClass(t),h(e)},this.resize=function(e,t,n){f(e),n.css({width:100*t+"%",height:""}),h(e)},this.resizeTo=function(e,t,n){var o,i,r;r=n?{width:(o=e.y/e.x)<(i=t.data("ratio"))?e.x:e.y/i,height:o<i?e.x*i:e.y}:{width:e.x,height:e.y},t.css(r)},this.removeMedia=function(e,t,n){f(e),n.detach();var o=e.data("callbacks");o&&o.onMediaDelete&&o.onMediaDelete(n,this,e),h(e)},this.focus=function(e){e.focus()}}function t(){this.update=function(n,e){function t(e,t){e.find(".dropdown-menu li a").each(function(){var e=N(this).data("value")+""==t+"";this.className=e?"checked":""})}function o(e,t){n.find(e).toggleClass("active",t())}if(e.image){var i=N(e.image);o('button[data-event="imageShape"][data-value="img-rounded"]',function(){return i.hasClass("img-rounded")}),o('button[data-event="imageShape"][data-value="img-circle"]',function(){return i.hasClass("img-circle")}),o('button[data-event="imageShape"][data-value="img-thumbnail"]',function(){return i.hasClass("img-thumbnail")}),o('button[data-event="imageShape"]:not([data-value])',function(){return!i.is(".img-rounded, .img-circle, .img-thumbnail")});var r=i.css("float");o('button[data-event="floatMe"][data-value="left"]',function(){return"left"===r}),o('button[data-event="floatMe"][data-value="right"]',function(){return"right"===r}),o('button[data-event="floatMe"][data-value="none"]',function(){return"left"!==r&&"right"!==r});var a=i.attr("style");return o('button[data-event="resize"][data-value="1"]',function(){return!!/(^|\s)(max-)?width\s*:\s*100%/.test(a)}),o('button[data-event="resize"][data-value="0.5"]',function(){return!!/(^|\s)(max-)?width\s*:\s*50%/.test(a)}),void o('button[data-event="resize"][data-value="0.25"]',function(){return!!/(^|\s)(max-)?width\s*:\s*25%/.test(a)})}var s=n.find(".note-fontname");if(s.length){var l=e["font-family"];if(l){for(var d=l.split(","),c=0,u=d.length;c<u&&(l=d[c].replace(/[\'\"]/g,"").replace(/\s+$/,"").replace(/^\s+/,""),!F.isFontInstalled(l));c++);s.find(".note-current-fontname").text(l),t(s,l)}}var f=n.find(".note-fontsize");f.find(".note-current-fontsize").text(e["font-size"]),t(f,parseFloat(e["font-size"])),t(n.find(".note-height"),parseFloat(e["line-height"])),o('button[data-event="bold"]',function(){return"bold"===e["font-bold"]}),o('button[data-event="italic"]',function(){return"italic"===e["font-italic"]}),o('button[data-event="underline"]',function(){return"underline"===e["font-underline"]}),o('button[data-event="strikethrough"]',function(){return"strikethrough"===e["font-strikethrough"]}),o('button[data-event="superscript"]',function(){return"superscript"===e["font-superscript"]}),o('button[data-event="subscript"]',function(){return"subscript"===e["font-subscript"]}),o('button[data-event="justifyLeft"]',function(){return"left"===e["text-align"]||"start"===e["text-align"]}),o('button[data-event="justifyCenter"]',function(){return"center"===e["text-align"]}),o('button[data-event="justifyRight"]',function(){return"right"===e["text-align"]}),o('button[data-event="justifyFull"]',function(){return"justify"===e["text-align"]}),o('button[data-event="insertUnorderedList"]',function(){return"unordered"===e["list-style"]}),o('button[data-event="insertOrderedList"]',function(){return"ordered"===e["list-style"]})},this.updateRecentColor=function(e,t,n){var o=N(e).closest(".note-color").find(".note-recent-color"),i=JSON.parse(o.attr("data-value"));i[t]=n,o.attr("data-value",JSON.stringify(i));var r="backColor"===t?"background-color":"color";o.find("i").css(r,n)}}function n(){var o=new t;this.update=function(e,t){o.update(e,t)},this.updateRecentColor=function(e,t,n){o.updateRecentColor(e,t,n)},this.activate=function(e){e.find("button").not('button[data-event="codeview"]').removeClass("disabled")},this.deactivate=function(e){e.find("button").not('button[data-event="codeview"]').addClass("disabled")},this.updateFullscreen=function(e,t){e.find('button[data-event="fullscreen"]').toggleClass("active",t)},this.updateCodeview=function(e,t){e.find('button[data-event="codeview"]').toggleClass("active",t),t?this.deactivate(e):this.activate(e)},this.get=function(e,t){return E.makeLayoutInfo(e).toolbar().find("[data-name="+t+"]")},this.setButtonState=function(e,t,n){n=!1!==n,this.get(e,t).toggleClass("active",n)}}function o(){var t=N(document);this.attach=function(e,t){t.disableResizeEditor||e.statusbar().on("mousedown",n)};var n=function(e){e.preventDefault(),e.stopPropagation();var n=E.makeLayoutInfo(e.target).editable(),o=n.offset().top-t.scrollTop(),i=E.makeLayoutInfo(e.currentTarget||e.target).editor().data("options");t.on("mousemove",function(e){var t=e.clientY-(24+o),t=0<i.minHeight?Math.max(t,i.minHeight):t;t=0<i.maxHeight?Math.min(t,i.maxHeight):t,n.height(t)}).one("mouseup",function(){t.off("mousemove")})}}function h(){function u(e,t){var n=N(e),o=t?n.offset():n.position(),i=n.outerHeight(!0);return{left:o.left,top:o.top+i}}function f(e,t){e.css({display:"block",left:t.left,top:t.top})}var h=new t;this.update=function(e,t,n){h.update(e,t);var o,i,r,a=e.find(".note-link-popover");t.anchor?(o=a.find("a"),i=N(t.anchor).attr("href"),r=N(t.anchor).attr("target"),o.attr("href",i).html(i),r?o.attr("target","_blank"):o.removeAttr("target"),f(a,u(t.anchor,n))):a.hide();var s=e.find(".note-image-popover");t.image?f(s,u(t.image,n)):s.hide();var l,d,c=e.find(".note-air-popover");n&&!t.range.isCollapsed()?(l=I.last(t.range.getClientRects()))&&(d=P.rect2bnd(l),f(c,{left:Math.max(d.left+d.width/2-20,0),top:d.top+d.height})):c.hide()},this.updateRecentColor=function(e,t,n){e.updateRecentColor(e,t,n)},this.hide=function(e){e.children().hide()}}function v(u){function t(e){var t,n,o,i,r,a,s,l,d,c;E.isControlSizing(e.target)&&(e.preventDefault(),e.stopPropagation(),t=E.makeLayoutInfo(e.target),n=t.handle(),o=t.popover(),i=t.editable(),r=t.editor(),a=n.find(".note-control-selection").data("target"),s=N(a),l=s.offset(),d=f.scrollTop(),c=r.data("options").airMode,f.on("mousemove",function(e){u.invoke("editor.resizeTo",{x:e.clientX-l.left,y:e.clientY-(l.top-d)},s,!e.shiftKey),u.invoke("handle.update",n,{image:a},c),u.invoke("popover.update",o,{image:a},c)}).one("mouseup",function(){f.off("mousemove"),u.invoke("editor.afterCommand",i)}),s.data("ratio")||s.data("ratio",s.height()/s.width()))}var f=N(document);this.attach=function(e){e.handle().on("mousedown",t)},this.update=function(e,t,n){var o,i,r,a,s=e.find(".note-control-selection");t.image?(o=N(t.image),i=n?o.offset():o.position(),r={w:o.outerWidth(!0),h:o.outerHeight(!0)},s.css({display:"block",left:i.left,top:i.top,width:r.w,height:r.h}).data("target",t.image),a=r.w+"x"+r.h,s.find(".note-control-selection-info").text(a)):s.hide()},this.hide=function(e){e.children().hide()}}function g(s){var l=N(window),d=N("html, body");this.toggle=function(e){function t(e){i.css("height",e.h),r.css("height",e.h),r.data("cmeditor")&&r.data("cmeditor").setsize(null,e.h)}var n=e.editor(),o=e.toolbar(),i=e.editable(),r=e.codable();n.toggleClass("fullscreen");var a=n.hasClass("fullscreen");a?(i.data("orgheight",i.css("height")),l.on("resize",function(){t({h:l.height()-o.outerHeight()})}).trigger("resize"),d.css("overflow","hidden")):(l.off("resize"),t({h:i.data("orgheight")}),d.css("overflow","visible")),s.invoke("toolbar.updateFullscreen",o,a)}}var u,i,r,a,s,m,b,C,y,k,x,w,T,S="function"==typeof define&&define.amd,F={isMac:-1<navigator.appVersion.indexOf("Mac"),isMSIE:-1<navigator.userAgent.indexOf("MSIE")||-1<navigator.userAgent.indexOf("Trident"),isFF:-1<navigator.userAgent.indexOf("Firefox"),jqueryVersion:parseFloat(N.fn.jquery),isSupportAmd:S,hasCodeMirror:S?require.specified("CodeMirror"):!!window.CodeMirror,isFontInstalled:function(e){var t="Comic Sans MS"===e?"Courier New":"Comic Sans MS",n=N("<div>").css({position:"absolute",left:"-9999px",top:"-9999px",fontSize:"200px"}).text("mmmmmmmmmwwwwwww").appendTo(document.body),o=n.css("fontFamily",t).width(),i=n.css("fontFamily",e+","+t).width();return n.remove(),o!==i},isW3CRangeSupport:!!document.createRange},P=(T=0,{eq:function(t){return function(e){return t===e}},eq2:function(e,t){return e===t},peq2:function(n){return function(e,t){return e[n]===t[n]}},ok:function(){return!0},fail:function(){return!1},self:function(e){return e},not:function(e){return function(){return!e.apply(e,arguments)}},and:function(t,n){return function(e){return t(e)&&n(e)}},uniqueId:function(e){var t=++T+"";return e?e+t:t},rect2bnd:function(e){var t=N(document);return{top:e.top+t.scrollTop(),left:e.left+t.scrollLeft(),width:e.right-e.left,height:e.bottom-e.top}},invertObject:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[e[t]]=t);return n}}),I={head:de,last:ce,initial:function(e){return e.slice(0,e.length-1)},tail:ue,prev:function(e,t){var n=e.indexOf(t);return-1===n?null:e[n-1]},next:function(e,t){var n=e.indexOf(t);return-1===n?null:e[n+1]},find:function(e,t){for(var n=0,o=e.length;n<o;n++){var i=e[n];if(t(i))return i}},contains:fe,all:function(e,t){for(var n=0,o=e.length;n<o;n++)if(!t(e[n]))return!1;return!0},sum:function(e,n){return n=n||P.self,e.reduce(function(e,t){return e+n(t)},0)},from:function(e){for(var t=[],n=-1,o=e.length;++n<o;)t[n]=e[n];return t},clusterBy:function(e,o){return e.length?ue(e).reduce(function(e,t){var n=ce(e);return o(ce(n),t)?n[n.length]=t:e[e.length]=[t],e},[[de(e)]]):[]},compact:function(e){for(var t=[],n=0,o=e.length;n<o;n++)e[n]&&t.push(e[n]);return t},unique:function(e){for(var t=[],n=0,o=e.length;n<o;n++)fe(t,e[n])||t.push(e[n]);return t}},L=String.fromCharCode(160),E=(i=O("LI"),r=O("TABLE"),a=function(e){return e&&/^UL|^OL/.test(e.nodeName.toUpperCase())},s=O("BLOCKQUOTE"),m=function(e){return V(e)||s(e)||U(e)},b=O("A"),C=O("BODY"),y=F.isMSIE?"&nbsp;":"<br>",k=function(e,t){for(;e;){if(t(e))return e;if(U(e))break;e=e.parentNode}return null},x=function(e){for(var t=0;e=e.previousSibling;)t+=1;return t},w=O("TEXTAREA"),{NBSP_CHAR:L,ZERO_WIDTH_NBSP_CHAR:"\ufeff",blank:y,emptyPara:"<p>"+y+"</p>",makePredByNodeName:O,isEditable:U,isControlSizing:function(e){return e&&N(e).hasClass("note-control-sizing")},buildLayoutInfo:z,makeLayoutInfo:function(e){var t,n=N(e).closest(".note-editor, .note-air-editor, .note-air-layout");return n.length?(t=n.is(".note-editor, .note-air-editor")?n:N("#note-editor-"+I.last(n.attr("id").split("-"))),z(t)):null},isText:j,isVoid:K,isPara:q,isPurePara:function(e){return q(e)&&!i(e)},isInline:W,isBodyInline:function(e){return W(e)&&!k(e,q)},isBody:C,isParaInline:function(e){return W(e)&&!!k(e,q)},isList:a,isTable:r,isCell:V,isBlockquote:s,isBodyContainer:m,isAnchor:b,isDiv:O("DIV"),isLi:i,isBR:O("BR"),isSpan:O("SPAN"),isB:O("B"),isU:O("U"),isS:O("S"),isI:O("I"),isImg:O("IMG"),isTextarea:w,isEmpty:G,isEmptyAnchor:P.and(b,G),isClosestSibling:function(e,t){return e.nextSibling===t||e.previousSibling===t},withClosestSiblings:function(e,t){t=t||P.ok;var n=[];return e.previousSibling&&t(e.previousSibling)&&n.push(e.previousSibling),n.push(e),e.nextSibling&&t(e.nextSibling)&&n.push(e.nextSibling),n},nodeLength:_,isLeftEdgePoint:$,isRightEdgePoint:ee,isEdgePoint:function(e){return $(e)||ee(e)},isLeftEdgeOf:function(e,t){for(;e&&e!==t;){if(0!==x(e))return!1;e=e.parentNode}return!0},isRightEdgeOf:function(e,t){for(;e&&e!==t;){if(x(e)!==_(e.parentNode)-1)return!1;e=e.parentNode}return!0},prevPoint:ne,nextPoint:oe,isSamePoint:ie,isVisiblePoint:function(e){if(j(e.node)||!te(e.node)||G(e.node))return!0;var t=e.node.childNodes[e.offset-1],n=e.node.childNodes[e.offset];return!(t&&!K(t)||n&&!K(n))},prevPointUntil:function(e,t){for(;e;){if(t(e))return e;e=ne(e)}return null},nextPointUntil:function(e,t){for(;e;){if(t(e))return e;e=oe(e)}return null},walkPoint:function(e,t,n,o){for(var i=e;i&&(n(i),!ie(i,t));)var r=o&&e.node!==i.node&&t.node!==i.node,i=oe(i,r)},ancestor:k,singleChildAncestor:function(e,t){for(e=e.parentNode;e&&1===_(e);){if(t(e))return e;if(U(e))break;e=e.parentNode}return null},listAncestor:Y,lastAncestor:function(e,t){var n=Y(e);return I.last(n.filter(t))},listNext:Q,listPrev:function(e,t){t=t||P.fail;for(var n=[];e&&!t(e);)n.push(e),e=e.previousSibling;return n},listDescendant:function(i,r){var a=[];return r=r||P.ok,function e(t){i!==t&&r(t)&&a.push(t);for(var n=0,o=t.childNodes.length;n<o;n++)e(t.childNodes[n])}(i),a},commonAncestor:function(e,t){for(var n=Y(e),o=t;o;o=o.parentNode)if(-1<N.inArray(o,n))return o;return null},wrap:function(e,t){var n=e.parentNode,o=N("<"+t+">")[0];return n.insertBefore(o,e),o.appendChild(e),o},insertAfter:Z,appendChildNodes:X,position:x,hasChildren:te,makeOffsetPath:function(e,t){var n=Y(t,P.eq(e));return N.map(n,x).reverse()},fromOffsetPath:function(e,t){for(var n=e,o=0,i=t.length;o<i;o++)n=n.childNodes.length<=t[o]?n.childNodes[n.childNodes.length-1]:n.childNodes[t[o]];return n},splitTree:ae,splitPoint:function(e,t){var n,o=t?q:m,i=Y(e.node,o),r=I.last(i)||e.node,a=o(r)?(n=i[i.length-2],r):(n=r).parentNode;return{rightNode:n&&ae(n,e,t),container:a}},create:se,createText:function(e){return document.createTextNode(e)},remove:le,removeWhile:function(e,t){for(;e&&!U(e)&&t(e);){var n=e.parentNode;le(e),e=n}},replace:function(e,t){if(e.nodeName.toUpperCase()===t.toUpperCase())return e;var n=se(t);return e.style.cssText&&(n.style.cssText=e.style.cssText),X(n,I.from(e.childNodes)),Z(n,e),le(e),n},html:function(e,t){var n=w(e[0])?e.val():e.html();return t&&(n=n.replace(/<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g,function(e,t,n){n=n.toUpperCase();var o=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(n)&&!!t,i=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(n);return e+(o||i?"\n":"")}),n=N.trim(n)),n},value:function(e,t){var n=e.val();return t?n.replace(/[\n\r]/g,""):n}}),M={create:function(e,t,n,o){if(arguments.length)2===arguments.length&&(n=e,o=t);else if(F.isW3CRangeSupport){var i=document.getSelection();if(0===i.rangeCount)return null;if(E.isBody(i.anchorNode))return null;var r=i.getRangeAt(0);e=r.startContainer,t=r.startOffset,n=r.endContainer,o=r.endOffset}else{var a=document.selection.createRange(),s=a.duplicate();s.collapse(!1);var l=a;l.collapse(!0);var d=D(l,!0),c=D(s,!1);E.isText(d.node)&&E.isLeftEdgePoint(d)&&E.isTextNode(c.node)&&E.isRightEdgePoint(c)&&c.node.nextSibling===d.node&&(d=c),e=d.cont,t=d.offset,n=c.cont,o=c.offset}return new B(e,t,n,o)},createFromNode:function(e){var t=e,n=0,o=e,i=E.nodeLength(o);return E.isVoid(t)&&(n=E.listPrev(t).length-1,t=t.parentNode),E.isBR(o)?(i=E.listPrev(o).length-1,o=o.parentNode):E.isVoid(o)&&(i=E.listPrev(o).length,o=o.parentNode),this.create(t,n,o,i)},createFromBookmark:function(e,t){var n=E.fromOffsetPath(e,t.s.path),o=t.s.offset,i=E.fromOffsetPath(e,t.e.path),r=t.e.offset;return new B(n,o,i,r)},createFromParaBookmark:function(e,t){var n=e.s.offset,o=e.e.offset,i=E.fromOffsetPath(I.head(t),e.s.path),r=E.fromOffsetPath(I.last(t),e.e.path);return new B(i,n,r,o)}},A={readFileAsDataURL:function(e){return N.Deferred(function(n){N.extend(new FileReader,{onload:function(e){var t=e.target.result;n.resolve(t)},onerror:function(){n.reject(this)}}).readAsDataURL(e)}).promise()},createImage:function(n,o){return N.Deferred(function(e){var t=N("<img>");t.one("load",function(){t.off("error abort"),e.resolve(t)}).one("error abort",function(){t.off("load").detach(),e.reject(t)}).css({display:"none"}).appendTo(document.body).attr({src:n,"data-filename":o})}).promise()}},R={isEdit:function(e){return I.contains([8,9,13,32],e)},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"}};function D(e,t){for(var n,o=e.parentElement(),i=document.body.createTextRange(),r=I.from(o.childNodes),a=0;a<r.length;a++)if(!E.isText(r[a])){if(i.moveToElementText(r[a]),0<=i.compareEndPoints("StartToStart",e))break;n=r[a]}if(0!==a&&E.isText(r[a-1])){var s=document.body.createTextRange(),l=null;s.moveToElementText(n||o),s.collapse(!n),l=n?n.nextSibling:o.firstChild;var d=e.duplicate();d.setEndPoint("StartToStart",s);for(var c=d.text.replace(/[\r\n]/g,"").length;c>l.nodeValue.length&&l.nextSibling;)c-=l.nodeValue.length,l=l.nextSibling;l.nodeValue,t&&l.nextSibling&&E.isText(l.nextSibling)&&c===l.nodeValue.length&&(c-=l.nodeValue.length,l=l.nextSibling),o=l,a=c}return{cont:o,offset:a}}function H(e){var t=document.body.createTextRange(),n=function e(t,n){var o;if(E.isText(t)){var i=E.listPrev(t,P.not(E.isText)),r=I.last(i).previousSibling,a=r||t.parentNode;n+=I.sum(I.tail(i),E.nodeLength),o=!r}else{if(a=t.childNodes[n]||t,E.isText(a))return e(a,0);n=0,o=!1}return{node:a,collapseToStart:o,offset:n}}(e.node,e.offset);return t.moveToElementText(n.node),t.collapse(n.collapseToStart),t.moveStart("character",n.offset),t}function B(i,r,a,s){function n(){if(F.isW3CRangeSupport){var e=document.createRange();return e.setStart(i,r),e.setEnd(a,s),e}var t=H({node:i,offset:r});return t.setEndPoint("EndToEnd",H({node:a,offset:s})),t}function e(t){return function(){var e=E.ancestor(i,t);return!!e&&e===E.ancestor(a,t)}}this.sc=i,this.so=r,this.ec=a,this.eo=s,this.getPoints=function(){return{sc:i,so:r,ec:a,eo:s}},this.getStartPoint=function(){return{node:i,offset:r}},this.getEndPoint=function(){return{node:a,offset:s}},this.select=function(){var e,t=n();F.isW3CRangeSupport?(0<(e=document.getSelection()).rangeCount&&e.removeAllRanges(),e.addRange(t)):t.select()},this.normalize=function(){function e(e){return E.isVisiblePoint(e)||(e=E.isLeftEdgePoint(e)?E.nextPointUntil(e,E.isVisiblePoint):E.prevPointUntil(e,E.isVisiblePoint)),e}var t=e(this.getStartPoint()),n=e(this.getEndPoint());return new B(t.node,t.offset,n.node,n.offset)},this.nodes=function(n,e){n=n||P.ok;var o=e&&e.includeAncestor,i=e&&e.fullyContains,t=this.getStartPoint(),r=this.getEndPoint(),a=[],s=[];return E.walkPoint(t,r,function(e){var t;E.isEditable(e.node)||(i?(E.isLeftEdgePoint(e)&&s.push(e.node),E.isRightEdgePoint(e)&&I.contains(s,e.node)&&(t=e.node)):t=o?E.ancestor(e.node,n):e.node,t&&n(t)&&a.push(t))},!0),I.unique(a)},this.commonAncestor=function(){return E.commonAncestor(i,a)},this.expand=function(e){var t=E.ancestor(i,e),n=E.ancestor(a,e);if(!t&&!n)return new B(i,r,a,s);var o=this.getPoints();return t&&(o.sc=t,o.so=0),n&&(o.ec=n,o.eo=E.nodeLength(n)),new B(o.sc,o.so,o.ec,o.eo)},this.collapse=function(e){return e?new B(i,r,i,r):new B(a,s,a,s)},this.splitText=function(){var e=i===a,t=this.getPoints();return E.isText(a)&&!E.isEdgePoint(this.getEndPoint())&&a.splitText(s),E.isText(i)&&!E.isEdgePoint(this.getStartPoint())&&(t.sc=i.splitText(r),t.so=0,e&&(t.ec=t.sc,t.eo=s-r)),new B(t.sc,t.so,t.ec,t.eo)},this.deleteContents=function(){if(this.isCollapsed())return this;var e=this.splitText(),t=e.nodes(null,{fullyContains:!0}),o=E.prevPointUntil(e.getStartPoint(),function(e){return!I.contains(t,e.node)}),i=[];return N.each(t,function(e,t){var n=t.parentNode;o.node!==n&&1===E.nodeLength(n)&&i.push(n),E.remove(t,!1)}),N.each(i,function(e,t){E.remove(t,!1)}),new B(o.node,o.offset,o.node,o.offset).normalize()},this.isOnEditable=e(E.isEditable),this.isOnList=e(E.isList),this.isOnAnchor=e(E.isAnchor),this.isOnCell=e(E.isCell),this.isLeftEdgeOf=function(e){if(!E.isLeftEdgePoint(this.getStartPoint()))return!1;var t=E.ancestor(this.sc,e);return t&&E.isLeftEdgeOf(this.sc,t)},this.isCollapsed=function(){return i===a&&r===s},this.wrapBodyInlineWithPara=function(){if(E.isBodyContainer(i)&&E.isEmpty(i))return i.innerHTML=E.emptyPara,new B(i.firstChild,0,i.firstChild,0);if(E.isParaInline(i)||E.isPara(i))return this.normalize();var e,t;E.isInline(i)?(e=E.listAncestor(i,P.not(E.isInline)),t=I.last(e),E.isInline(t)||(t=e[e.length-2]||i.childNodes[r])):t=i.childNodes[0<r?r-1:0];var n,o=E.listPrev(t,E.isParaInline).reverse();return(o=o.concat(E.listNext(t.nextSibling,E.isParaInline))).length&&(n=E.wrap(I.head(o),"p"),E.appendChildNodes(n,I.tail(o))),this.normalize()},this.insertNode=function(e){var t=this.wrapBodyInlineWithPara().deleteContents(),n=E.splitPoint(t.getStartPoint(),E.isInline(e));return n.rightNode?n.rightNode.parentNode.insertBefore(e,n.rightNode):n.container.appendChild(e),e},this.toString=function(){var e=n();return F.isW3CRangeSupport?e.toString():e.text},this.bookmark=function(e){return{s:{path:E.makeOffsetPath(e,i),offset:r},e:{path:E.makeOffsetPath(e,a),offset:s}}},this.paraBookmark=function(e){return{s:{path:I.tail(E.makeOffsetPath(I.head(e),i)),offset:r},e:{path:I.tail(E.makeOffsetPath(I.last(e),a)),offset:s}}},this.getClientRects=function(){return n().getClientRects()}}function U(e){return e&&N(e).hasClass("note-editable")}function z(t){if(t.hasClass("note-air-editor")){var e,n=I.last(t.attr("id").split("-"));return{editor:function(){return t},holder:function(){return t.data("holder")},editable:function(){return t},popover:(e=function(e){return function(){return N(e+n)}})("#note-popover-"),handle:e("#note-handle-"),dialog:e("#note-dialog-")}}return{editor:function(){return t},holder:function(){return t.data("holder")},dropzone:(e=function(e){return function(){return t.find(e)}})(".note-dropzone"),toolbar:e(".note-toolbar"),editable:e(".note-editable"),codable:e(".note-codable"),statusbar:e(".note-statusbar"),popover:e(".note-popover"),handle:e(".note-handle"),dialog:e(".note-dialog")}}function O(t){return t=t.toUpperCase(),function(e){return e&&e.nodeName.toUpperCase()===t}}function j(e){return e&&3===e.nodeType}function K(e){return e&&/^BR|^IMG|^HR/.test(e.nodeName.toUpperCase())}function q(e){return!U(e)&&(e&&/^DIV|^P|^LI|^H[1-7]/.test(e.nodeName.toUpperCase()))}function W(e){return!(m(e)||a(e)||q(e)||r(e)||s(e))}function V(e){return e&&/^TD|^TH/.test(e.nodeName.toUpperCase())}function _(e){return j(e)?e.nodeValue.length:e.childNodes.length}function G(e){var t=_(e);return 0===t||!E.isText(e)&&1===t&&e.innerHTML===y}function J(e){K(e)||_(e)||(e.innerHTML=y)}function Y(e,t){t=t||P.fail;var n=[];return k(e,function(e){return U(e)||n.push(e),t(e)}),n}function Q(e,t){t=t||P.fail;for(var n=[];e&&!t(e);)n.push(e),e=e.nextSibling;return n}function Z(e,t){var n=t.nextSibling,o=t.parentNode;return n?o.insertBefore(e,n):o.appendChild(e),e}function X(n,e){return N.each(e,function(e,t){n.appendChild(t)}),n}function $(e){return 0===e.offset}function ee(e){return e.offset===_(e.node)}function te(e){return!!(e&&e.childNodes&&e.childNodes.length)}function ne(e,t){var n,o;if(0===e.offset){if(U(e.node))return null;n=e.node.parentNode,o=x(e.node)}else o=te(e.node)?(n=e.node.childNodes[e.offset-1],_(n)):(n=e.node,t?0:e.offset-1);return{node:n,offset:o}}function oe(e,t){var n,o;if(_(e.node)===e.offset){if(U(e.node))return null;n=e.node.parentNode,o=x(e.node)+1}else o=te(e.node)?(n=e.node.childNodes[e.offset],0):(n=e.node,t?_(e.node):e.offset+1);return{node:n,offset:o}}function ie(e,t){return e.node===t.node&&e.offset===t.offset}function re(e,t){if(j(e.node))return $(e)?e.node:ee(e)?e.node.nextSibling:e.node.splitText(e.offset);var n=e.node.childNodes[e.offset],o=Z(e.node.cloneNode(!1),e.node);return X(o,Q(n)),t||(J(e.node),J(o)),o}function ae(e,o,i){var t=Y(o.node,P.eq(e));return t.length?1===t.length?re(o,i):t.reduce(function(e,t){var n=Z(t.cloneNode(!1),t);return e===o.node&&(e=re(o,i)),X(n,Q(e)),i||(J(t),J(n)),n}):null}function se(e){return document.createElement(e)}function le(e,t){if(e&&e.parentNode){if(e.removeNode)return e.removeNode(t);var n=e.parentNode;if(!t){for(var o=[],i=0,r=e.childNodes.length;i<r;i++)o.push(e.childNodes[i]);for(i=0,r=o.length;i<r;i++)n.insertBefore(o[i],e)}n.removeChild(e)}}function de(e){return e[0]}function ce(e){return e[e.length-1]}function ue(e){return e.slice(1)}function fe(e,t){return-1!==N.inArray(t,e)}F.hasCodeMirror&&(F.isSupportAmd?require(["CodeMirror"],function(e){u=e}):u=window.CodeMirror);function he(c){this.sync=function(e){c.invoke("codeview.isActivated",e)&&F.hasCodeMirror&&e.codable().data("cmEditor").save()},this.isActivated=function(e){return e.editor().hasClass("codeview")},this.toggle=function(e){this.isActivated(e)?this.deactivate(e):this.activate(e)},this.activate=function(e){var t,n,o=e.editor(),i=e.toolbar(),r=e.editable(),a=e.codable(),s=e.popover(),l=e.handle(),d=o.data("options");a.val(E.html(r,d.prettifyHtml)),a.height(r.height()),c.invoke("toolbar.updateCodeview",i,!0),c.invoke("popover.hide",s),c.invoke("handle.hide",l),o.addClass("codeview"),a.focus(),F.hasCodeMirror&&(t=u.fromTextArea(a[0],d.codemirror),d.codemirror.tern&&(n=new u.TernServer(d.codemirror.tern),t.ternServer=n,t.on("cursorActivity",function(e){n.updateArgHints(e)})),t.setSize(null,r.outerHeight()),a.data("cmEditor",t))},this.deactivate=function(e){var t,n=e.editor(),o=e.toolbar(),i=e.editable(),r=e.codable(),a=n.data("options");F.hasCodeMirror&&(t=r.data("cmEditor"),r.val(t.getValue()),t.toTextArea()),i.html(E.value(r,a.prettifyHtml)||E.emptyPara),i.height(a.height?r.height():"auto"),n.removeClass("codeview"),i.focus(),c.invoke("toolbar.updateCodeview",o,!1)}}function pe(d){var n=N(document);this.attach=function(e,t){t.airMode||t.disableDragAndDrop?n.on("drop",function(e){e.preventDefault()}):this.attachDragAndDropEvent(e,t)},this.attachDragAndDropEvent=function(o,i){var r=N(),a=o.editor(),s=o.dropzone(),l=s.find(".note-dropzone-message");n.on("dragenter",function(e){var t=d.invoke("codeview.isActivated",o),n=0<a.width()&&0<a.height();t||r.length||!n||(a.addClass("dragover"),s.width(a.width()),s.height(a.height()),l.text(i.langInfo.image.dragImageHere)),r=r.add(e.target)}).on("dragleave",function(e){(r=r.not(e.target)).length||a.removeClass("dragover")}).on("drop",function(){r=N(),a.removeClass("dragover")}),s.on("dragenter",function(){s.addClass("hover"),l.text(i.langInfo.image.dropImage)}).on("dragleave",function(){s.removeClass("hover"),l.text(i.langInfo.image.dragImageHere)}),s.on("drop",function(e){e.preventDefault();var t=e.originalEvent.dataTransfer,n=t.getData("text/html"),o=t.getData("text/plain"),i=E.makeLayoutInfo(e.currentTarget||e.target);t&&t.files&&t.files.length?(i.editable().focus(),d.insertImages(i,t.files)):n?N(n).each(function(){i.editable().focus(),d.invoke("editor.insertNode",i.editable(),this)}):o&&(i.editable().focus(),d.invoke("editor.insertText",i.editable(),o))}).on("dragover",!1)}}function ve(d){this.attach=function(e){e.editable().on("paste",t)};var t=function(e){var t=e.originalEvent.clipboardData,s=E.makeLayoutInfo(e.currentTarget||e.target),l=s.editable();if(!t||!t.items||!t.items.length){if(!l.data("callbacks").onImageUpload)return;return d.invoke("editor.saveNode",l),d.invoke("editor.saveRange",l),l.html(""),void setTimeout(function(){var e=l.find("img");if(e.length&&-1!==e[0].src.indexOf("data:")){for(var t=e[0].src,n=atob(t.split(",")[1]),o=new Uint8Array(n.length),i=0;i<n.length;i++)o[i]=n.charCodeAt(i);var r=new Blob([o],{type:"image/png"});r.name="clipboard.png",d.invoke("editor.restoreNode",l),d.invoke("editor.restoreRange",l),d.insertImages(s,[r]),d.invoke("editor.afterCommand",l)}else{var a=l.html();d.invoke("editor.restoreNode",l),d.invoke("editor.restoreRange",l);try{N(a).each(function(){l.focus(),d.invoke("editor.insertNode",l,this)})}catch(e){l.focus(),d.invoke("editor.insertText",l,a)}}},0)}var n=I.head(t.items);"file"===n.kind&&-1!==n.type.indexOf("image/")&&d.insertImages(s,[n.getAsFile()]),d.invoke("editor.afterCommand",l)}}function ge(s){function l(e,t){e.toggleClass("disabled",!t),e.attr("disabled",!t)}this.showLinkDialog=function(e,a,s){return N.Deferred(function(t){var n=a.find(".note-link-dialog"),o=n.find(".note-link-text"),i=n.find(".note-link-url"),e=n.find(".note-link-btn"),r=n.find("input[type=checkbox]");n.one("shown.bs.modal",function(){o.val(s.text),o.on("input",function(){s.text=o.val()}),s.url||(s.url=s.text,l(e,s.text)),i.on("input",function(){l(e,i.val()),s.text||o.val(i.val())}).val(s.url).trigger("focus").trigger("select"),r.prop("checked",s.newWindow),e.one("click",function(e){e.preventDefault(),t.resolve({range:s.range,url:i.val(),text:o.val(),newWindow:r.is(":checked")}),n.modal("hide")})}).one("hidden.bs.modal",function(){o.off("input"),i.off("input"),e.off("click"),"pending"===t.state()&&t.reject()}).modal("show")}).promise()},this.show=function(e){var t=e.editor(),n=e.dialog(),o=e.editable(),i=e.popover(),r=s.invoke("editor.getLinkInfo",o),a=t.data("options");s.invoke("editor.saveRange",o),this.showLinkDialog(o,n,r).then(function(e){s.invoke("editor.restoreRange",o),s.invoke("editor.createLink",o,e,a),s.invoke("popover.hide",i)}).fail(function(){s.invoke("editor.restoreRange",o)})}}function me(o){this.show=function(t){var e=t.dialog(),n=t.editable();o.invoke("editor.saveRange",n),this.showImageDialog(n,e).then(function(e){o.invoke("editor.restoreRange",n),"string"==typeof e?o.invoke("editor.insertImage",n,e):o.insertImages(t,e)}).fail(function(){o.invoke("editor.restoreRange",n)})},this.showImageDialog=function(e,o){return N.Deferred(function(t){var n=o.find(".note-image-dialog"),e=o.find(".note-image-input"),i=o.find(".note-image-url"),r=o.find(".note-image-btn");n.one("shown.bs.modal",function(){e.replaceWith(e.clone().on("change",function(){t.resolve(this.files||this.value),n.modal("hide")}).val("")),r.click(function(e){e.preventDefault(),t.resolve(i.val()),n.modal("hide")}),i.on("keyup paste",function(e){var t,n,o="paste"===e.type?e.originalEvent.clipboardData.getData("text"):i.val();n=o,(t=r).toggleClass("disabled",!n),t.attr("disabled",!n)}).val("").trigger("focus")}).one("hidden.bs.modal",function(){e.off("change"),i.off("keyup paste"),r.off("click"),"pending"===t.state()&&t.reject()}).modal("show")})}}function be(o){this.showHelpDialog=function(e,t){return N.Deferred(function(e){t.find(".note-help-dialog").one("hidden.bs.modal",function(){e.resolve()}).modal("show")}).promise()},this.show=function(e){var t=e.dialog(),n=e.editable();o.invoke("editor.saveRange",n,!0),this.showHelpDialog(n,t).then(function(){o.invoke("editor.restoreRange",n)})}}N.summernote=N.summernote||{},N.extend(N.summernote,{version:"0.6.3",options:{width:null,height:null,minHeight:null,maxHeight:null,focus:!1,tabsize:4,styleWithSpan:!0,disableLinkTarget:!1,disableDragAndDrop:!1,disableResizeEditor:!1,shortcuts:!0,placeholder:!1,prettifyHtml:!0,iconPrefix:"fa fa-",codemirror:{mode:"text/html",htmlMode:!0,lineNumbers:!0},lang:"en-US",direction:null,toolbar:[["style",["style"]],["font",["bold","italic","underline","clear"]],["fontname",["fontname"]],["color",["color"]],["para",["ul","ol","paragraph"]],["height",["height"]],["table",["table"]],["insert",["link","picture","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:"Helvetica Neue",fontNames:["Arial","Arial Black","Comic Sans MS","Courier New","Helvetica Neue","Helvetica","Impact","Lucida Grande","Tahoma","Times New Roman","Verdana"],fontNamesIgnoreCheck:[],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"]],lineHeights:["1.0","1.2","1.4","1.5","1.6","1.8","2.0","3.0"],insertTableMaxSize:{col:10,row:10},maximumImageFileSize:null,oninit:null,onfocus:null,onblur:null,onenter:null,onkeyup:null,onkeydown:null,onImageUpload:null,onImageUploadError:null,onMediaDelete:null,onToolbarClick:null,onsubmit:null,onCreateLink:function(e){return-1!==e.indexOf("@")&&-1===e.indexOf(":")?e="mailto:"+e:-1===e.indexOf("://")&&(e="http://"+e),e},keyMap:{pc:{ENTER:"insertParagraph","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","CTRL+K":"showLinkDialog"},mac:{ENTER:"insertParagraph","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","CMD+K":"showLinkDialog"}}},lang:{"en-US":{font:{bold:"Bold",italic:"Italic",underline:"Underline",clear:"Remove Font Style",height:"Line Height",name:"Font Family"},image:{image:"Picture",insert:"Insert Image",resizeFull:"Resize Full",resizeHalf:"Resize Half",resizeQuarter:"Resize Quarter",floatLeft:"Float Left",floatRight:"Float Right",floatNone:"Float None",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Drag image or text here",dropImage:"Drop image or Text",selectFromFiles:"Select from files",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",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"},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:"Background Color",foreground:"Foreground Color",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",extraKeys:"Extra keys"},history:{undo:"Undo",redo:"Redo"}}}});var Ce=new function(){function h(e,t){var n=t.event,o=t.value,i=t.title,r=t.className,a=t.dropdown,s=t.hide;return'<button type="button" class="btn btn-default btn-sm btn-small'+(r?" "+r:"")+(a?" dropdown-toggle":"")+'"'+(a?' data-toggle="dropdown"':"")+(i?' title="'+i+'"':"")+(n?' data-event="'+n+'"':"")+(o?" data-value='"+o+"'":"")+(s?" data-hide='"+s+"'":"")+' tabindex="-1">'+e+(a?' <span class="caret"></span>':"")+"</button>"+(a||"")}function p(e,t){return h('<i class="'+e+'"></i>',t)}function v(e,t){var n=N('<div class="'+e+' popover bottom in" style="display: none;"><div class="arrow"></div><div class="popover-content"></div></div>');return n.find(".popover-content").append(t),n}function s(e,t,n,o){return'<div class="'+e+' modal" aria-hidden="false"><div class="modal-dialog"><div class="modal-content">'+(t?'<div class="modal-header"><button type="button" class="close" aria-hidden="true" tabindex="-1">&times;</button><h4 class="modal-title">'+t+"</h4></div>":"")+'<form class="note-modal-form"><div class="modal-body">'+n+"</div>"+(o?'<div class="modal-footer">'+o+"</div>":"")+"</form></div></div></div>"}function C(u,f){function e(){var e=h('<span class="note-fontsize-10">100%</span>',{title:u.image.resizeFull,event:"resize",value:"1"}),t=h('<span class="note-fontsize-10">50%</span>',{title:u.image.resizeHalf,event:"resize",value:"0.5"}),n=h('<span class="note-fontsize-10">25%</span>',{title:u.image.resizeQuarter,event:"resize",value:"0.25"}),o=p(f.iconPrefix+"align-left",{title:u.image.floatLeft,event:"floatMe",value:"left"}),i=p(f.iconPrefix+"align-right",{title:u.image.floatRight,event:"floatMe",value:"right"}),r=p(f.iconPrefix+"align-justify",{title:u.image.floatNone,event:"floatMe",value:"none"}),a=p(f.iconPrefix+"square",{title:u.image.shapeRounded,event:"imageShape",value:"img-rounded"}),s=p(f.iconPrefix+"circle-o",{title:u.image.shapeCircle,event:"imageShape",value:"img-circle"}),l=p(f.iconPrefix+"picture-o",{title:u.image.shapeThumbnail,event:"imageShape",value:"img-thumbnail"}),d=p(f.iconPrefix+"times",{title:u.image.shapeNone,event:"imageShape",value:""}),c=p(f.iconPrefix+"trash-o",{title:u.image.remove,event:"removeMedia",value:"none"});return v("note-image-popover",'<div class="btn-group">'+e+t+n+'</div><div class="btn-group">'+o+i+r+'</div><div class="btn-group">'+a+s+l+d+'</div><div class="btn-group">'+c+"</div>")}var t,n=N('<div class="note-popover" />');return n.append((t='<a href="http://www.google.com" target="_blank">www.google.com</a>&nbsp;&nbsp;<div class="note-insert btn-group">'+p(f.iconPrefix+"edit",{title:u.link.edit,event:"showLinkDialog",hide:!0})+p(f.iconPrefix+"unlink",{title:u.link.unlink,event:"unlink"})+"</div>",v("note-link-popover",t))),n.append(e()),f.airMode&&n.append(function(){for(var e=N("<div />"),t=0,n=f.airPopover.length;t<n;t++){for(var o=f.airPopover[t],i=N('<div class="note-'+o[0]+' btn-group">'),r=0,a=o[1].length;r<a;r++){var s=N(T[o[1][r]](u,f));s.attr("data-name",o[1][r]),i.append(s)}e.append(i)}return v("note-air-popover",e.children())}()),n}function y(){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>'}function f(e,t){var n,o="note-shortcut-col col-xs-6 note-shortcut-",i=[];for(n in t)t.hasOwnProperty(n)&&i.push('<div class="'+o+'key">'+t[n].kbd+'</div><div class="'+o+'name">'+t[n].text+"</div>");return'<div class="note-shortcut-row row"><div class="'+o+'title col-xs-offset-6">'+e+'</div></div><div class="note-shortcut-row row">'+i.join('</div><div class="note-shortcut-row row">')+"</div>"}function o(e,t){var n,o,i,r,a,s,l,d,c='class="note-shortcut note-shortcut-col col-sm-6 col-xs-12"',u=["<div "+c+">"+(d=[{kbd:"⌘ + Z",text:(l=e).history.undo},{kbd:"⌘ + ⇧ + Z",text:l.history.redo},{kbd:"⌘ + ]",text:l.paragraph.indent},{kbd:"⌘ + [",text:l.paragraph.outdent},{kbd:"⌘ + ENTER",text:l.hr.insert}],f(l.shortcut.action,d))+"</div><div "+c+">"+(s=[{kbd:"⌘ + B",text:(a=e).font.bold},{kbd:"⌘ + I",text:a.font.italic},{kbd:"⌘ + U",text:a.font.underline},{kbd:"⌘ + \\",text:a.font.clear}],f(a.shortcut.textFormatting,s))+"</div>","<div "+c+">"+(r=[{kbd:"⌘ + NUM0",text:(i=e).style.normal},{kbd:"⌘ + NUM1",text:i.style.h1},{kbd:"⌘ + NUM2",text:i.style.h2},{kbd:"⌘ + NUM3",text:i.style.h3},{kbd:"⌘ + NUM4",text:i.style.h4},{kbd:"⌘ + NUM5",text:i.style.h5},{kbd:"⌘ + NUM6",text:i.style.h6}],f(i.shortcut.documentStyle,r))+"</div><div "+c+">"+(o=[{kbd:"⌘ + ⇧ + L",text:(n=e).paragraph.left},{kbd:"⌘ + ⇧ + E",text:n.paragraph.center},{kbd:"⌘ + ⇧ + R",text:n.paragraph.right},{kbd:"⌘ + ⇧ + J",text:n.paragraph.justify},{kbd:"⌘ + ⇧ + NUM7",text:n.lists.ordered},{kbd:"⌘ + ⇧ + NUM8",text:n.lists.unordered}],f(n.shortcut.paragraphFormatting,o))+"</div>"];return t.extraKeys&&u.push("<div "+c+">"+function(e,t){var n,o=t.extraKeys,i=[];for(n in o)o.hasOwnProperty(n)&&i.push({kbd:n,text:o[n]});return f(e.shortcut.extraKeys,i)}(e,t)+"</div>"),'<div class="note-shortcut-row row">'+u.join('</div><div class="note-shortcut-row row">')+"</div>"}function k(n,o){var i="";return N.each(r,function(e,t){i+=t(n,o)}),'<div class="note-dialog">'+i+"</div>"}function x(e,t,n){var i=P.invertObject(t);e.find("button").each(function(e,t){var n=N(t),o=i[n.data("event")];o&&n.attr("title",function(e,t){return t+" ("+(n=o,F.isMac&&(n=n.replace("CMD","⌘").replace("SHIFT","⇧")),n.replace("BACKSLASH","\\").replace("SLASH","/").replace("LEFTBRACKET","[").replace("RIGHTBRACKET","]"))+")";var n})}).tooltip({container:"body",trigger:"hover",placement:n||"top"}).on("click",function(){N(this).tooltip("hide")})}function w(e,t){var c=t.colors;e.find(".note-color-palette").each(function(){for(var e=N(this),t=e.attr("data-target-event"),n=[],o=0,i=c.length;o<i;o++){for(var r=c[o],a=[],s=0,l=r.length;s<l;s++){var d=r[s];a.push(['<button type="button" class="note-color-btn" style="background-color:',d,';" data-event="',t,'" data-value="',d,'" title="',d,'" data-toggle="button" tabindex="-1"></button>'].join(""))}n.push('<div class="note-color-row">'+a.join("")+"</div>")}e.html(n.join(""))})}var T={picture:function(e,t){return p(t.iconPrefix+"picture-o",{event:"showImageDialog",title:e.image.image,hide:!0})},link:function(e,t){return p(t.iconPrefix+"link",{event:"showLinkDialog",title:e.link.link,hide:!0})},table:function(e,t){return p(t.iconPrefix+"table",{title:e.table.table,dropdown:'<ul class="note-table 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>'})},style:function(o,e){var t=e.styleTags.reduce(function(e,t){var n=o.style["p"===t?"normal":t];return e+'<li><a data-event="formatBlock" href="#" data-value="'+t+'">'+("p"===t||"pre"===t?n:"<"+t+">"+n+"</"+t+">")+"</a></li>"},"");return p(e.iconPrefix+"magic",{title:o.style.style,dropdown:'<ul class="dropdown-menu">'+t+"</ul>"})},fontname:function(e,n){var o=[],t=n.fontNames.reduce(function(e,t){return F.isFontInstalled(t)||-1!==n.fontNamesIgnoreCheck.indexOf(t)?(o.push(t),e+'<li><a data-event="fontName" href="#" data-value="'+t+'" style="font-family:\''+t+'\'"><i class="'+n.iconPrefix+'check"></i> '+t+"</a></li>"):e},""),i=F.isFontInstalled(n.defaultFontName)?n.defaultFontName:o[0];return h('<span class="note-current-fontname">'+i+"</span>",{title:e.font.name,dropdown:'<ul class="dropdown-menu">'+t+"</ul>"})},color:function(e,t){var n='<i class="'+t.iconPrefix+'font" style="color:black;background-color:yellow;"></i>',o=h(n,{className:"note-recent-color",title:e.color.recent,event:"color",value:'{"backColor":"yellow"}'}),i='<ul class="dropdown-menu"><li><div class="btn-group"><div class="note-palette-title">'+e.color.background+'</div><div class="note-color-reset" data-event="backColor" data-value="inherit" title="'+e.color.transparent+'">'+e.color.setTransparent+'</div><div class="note-color-palette" data-target-event="backColor"></div></div><div class="btn-group"><div class="note-palette-title">'+e.color.foreground+'</div><div class="note-color-reset" data-event="foreColor" data-value="inherit" title="'+e.color.reset+'">'+e.color.resetToDefault+'</div><div class="note-color-palette" data-target-event="foreColor"></div></div></li></ul>';return o+h("",{title:e.color.more,dropdown:i})},bold:function(e,t){return p(t.iconPrefix+"bold",{event:"bold",title:e.font.bold})},italic:function(e,t){return p(t.iconPrefix+"italic",{event:"italic",title:e.font.italic})},underline:function(e,t){return p(t.iconPrefix+"underline",{event:"underline",title:e.font.underline})},clear:function(e,t){return p(t.iconPrefix+"eraser",{event:"removeFormat",title:e.font.clear})},ul:function(e,t){return p(t.iconPrefix+"list-ul",{event:"insertUnorderedList",title:e.lists.unordered})},ol:function(e,t){return p(t.iconPrefix+"list-ol",{event:"insertOrderedList",title:e.lists.ordered})},paragraph:function(e,t){var n=p(t.iconPrefix+"align-left",{title:e.paragraph.left,event:"justifyLeft"}),o=p(t.iconPrefix+"align-center",{title:e.paragraph.center,event:"justifyCenter"}),i=p(t.iconPrefix+"align-right",{title:e.paragraph.right,event:"justifyRight"}),r=p(t.iconPrefix+"align-justify",{title:e.paragraph.justify,event:"justifyFull"}),a=p(t.iconPrefix+"outdent",{title:e.paragraph.outdent,event:"outdent"}),s='<div class="dropdown-menu"><div class="note-align btn-group">'+n+o+i+r+'</div><div class="note-list btn-group">'+p(t.iconPrefix+"indent",{title:e.paragraph.indent,event:"indent"})+a+"</div></div>";return p(t.iconPrefix+"align-left",{title:e.paragraph.paragraph,dropdown:s})},height:function(e,n){var t=n.lineHeights.reduce(function(e,t){return e+'<li><a data-event="lineHeight" href="#" data-value="'+parseFloat(t)+'"><i class="'+n.iconPrefix+'check"></i> '+t+"</a></li>"},"");return p(n.iconPrefix+"text-height",{title:e.font.height,dropdown:'<ul class="dropdown-menu">'+t+"</ul>"})},help:function(e,t){return p(t.iconPrefix+"question",{event:"showHelpDialog",title:e.options.help,hide:!0})},fullscreen:function(e,t){return p(t.iconPrefix+"arrows-alt",{event:"fullscreen",title:e.options.fullscreen})},codeview:function(e,t){return p(t.iconPrefix+"code",{event:"codeview",title:e.options.codeview})},undo:function(e,t){return p(t.iconPrefix+"undo",{event:"undo",title:e.history.undo})},redo:function(e,t){return p(t.iconPrefix+"repeat",{event:"redo",title:e.history.redo})},hr:function(e,t){return p(t.iconPrefix+"minus",{event:"insertHorizontalRule",title:e.hr.insert})}},r={image:function(e,t){var n,o,i="";t.maximumImageFileSize&&(n=Math.floor(Math.log(t.maximumImageFileSize)/Math.log(1024)),o=+(t.maximumImageFileSize/Math.pow(1024,n)).toFixed(2)+" "+" KMGTP"[n]+"B",i="<small>"+e.image.maximumFileSize+" : "+o+"</small>");var r='<div class="form-group row-fluid note-group-select-from-files"><label>'+e.image.selectFromFiles+'</label><input class="note-image-input" type="file" name="files" accept="image/*" multiple="multiple" />'+i+'</div><div class="form-group row-fluid"><label>'+e.image.url+'</label><input class="note-image-url form-control span12" type="text" /></div>',a='<button href="#" class="btn btn-primary note-image-btn disabled" disabled>'+e.image.insert+"</button>";return s("note-image-dialog",e.image.insert,r,a)},link:function(e,t){var n='<div class="form-group row-fluid"><label>'+e.link.textToDisplay+'</label><input class="note-link-text form-control span12" type="text" /></div><div class="form-group row-fluid"><label>'+e.link.url+'</label><input class="note-link-url form-control span12" type="text" /></div>'+(t.disableLinkTarget?"":'<div class="checkbox"><label><input type="checkbox" checked> '+e.link.openInNewWindow+"</label></div>"),o='<button href="#" class="btn btn-primary note-link-btn disabled" disabled>'+e.link.insert+"</button>";return s("note-link-dialog",e.link.insert,n,o)},help:function(e,t){var n='<a class="modal-close pull-right" aria-hidden="true" tabindex="-1">'+e.shortcut.close+'</a><div class="title">'+e.shortcut.shortcuts+"</div>"+(F.isMac?o(e,t):o(e,t).replace(/⌘/g,"Ctrl").replace(/⇧/g,"Shift"))+'<p class="text-center"><a href="//summernote.org/" target="_blank">Summernote 0.6.3</a> · <a href="//github.com/summernote/summernote" target="_blank">Project</a> · <a href="//github.com/summernote/summernote/issues" target="_blank">Issues</a></p>';return s("note-help-dialog","",n,"")}};this.createLayoutByAirMode=function(e,t){var n=t.langInfo,o=t.keyMap[F.isMac?"mac":"pc"],i=P.uniqueId();e.addClass("note-air-editor note-editable"),e.attr({id:"note-editor-"+i,contentEditable:!0});var r=document.body,a=N(C(n,t));a.addClass("note-air-layout"),a.attr("id","note-popover-"+i),a.appendTo(r),x(a,o),w(a,t);var s=N(y());s.addClass("note-air-layout"),s.attr("id","note-handle-"+i),s.appendTo(r);var l=N(k(n,t));l.addClass("note-air-layout"),l.attr("id","note-dialog-"+i),l.find("button.close, a.modal-close").click(function(){N(this).closest(".modal").modal("hide")}),l.appendTo(r)},this.createLayoutByFrame=function(e,t){var n=t.langInfo,o=N('<div class="note-editor"></div>');t.width&&o.width(t.width),0<t.height&&N('<div class="note-statusbar">'+(t.disableResizeEditor?"":'<div class="note-resizebar"><div class="note-icon-bar"></div><div class="note-icon-bar"></div><div class="note-icon-bar"></div></div>')+"</div>").prependTo(o);var i=!e.is(":disabled"),r=N('<div class="note-editable" contentEditable="'+i+'"></div>').prependTo(o);t.height&&r.height(t.height),t.direction&&r.attr("dir",t.direction);var a=e.attr("placeholder")||t.placeholder;a&&r.attr("data-placeholder",a),r.html(E.html(e)),N('<textarea class="note-codable"></textarea>').prependTo(o);for(var s=N('<div class="note-toolbar btn-toolbar" />'),l=0,d=t.toolbar.length;l<d;l++){for(var c=t.toolbar[l][0],u=t.toolbar[l][1],f=N('<div class="note-'+c+' btn-group" />'),h=0,p=u.length;h<p;h++){var v,g=T[u[h]];N.isFunction(g)&&((v=N(g(n,t))).attr("data-name",u[h]),f.append(v))}s.append(f)}s.prependTo(o);var m=t.keyMap[F.isMac?"mac":"pc"];w(s,t),x(s,m,"bottom");var b=N(C(n,t)).prependTo(o);w(b,t),x(b,m),N(y()).prependTo(o),N(k(n,t)).prependTo(o).find("button.close, a.modal-close").click(function(){N(this).closest(".modal").modal("hide")}),N('<div class="note-dropzone"><div class="note-dropzone-message"></div></div>').prependTo(o),o.insertAfter(e),e.hide()},this.hasNoteEditor=function(e){return 0<this.noteEditorFromHolder(e).length},this.noteEditorFromHolder=function(e){return e.hasClass("note-air-editor")?e:e.next().hasClass("note-editor")?e.next():N()},this.createLayout=function(e,t){t.airMode?this.createLayoutByAirMode(e,t):this.createLayoutByFrame(e,t)},this.layoutInfoFromHolder=function(e){var t=this.noteEditorFromHolder(e);if(t.length)return t.data("holder",e),E.buildLayoutInfo(t)},this.removeLayout=function(e,t,n){n.airMode?(e.removeClass("note-air-editor note-editable").removeAttr("id contentEditable"),t.popover().remove(),t.handle().remove(),t.dialog().remove()):(e.html(t.editable().html()),t.editor().remove(),e.show())},this.getTemplate=function(){return{button:h,iconButton:p,dialog:s}},this.addButtonInfo=function(e,t){T[e]=t},this.addDialogInfo=function(e,t){r[e]=t}},ye=new function(){var d=this.modules={editor:new e,toolbar:new n,statusbar:new o,popover:new h,handle:new v(this),fullscreen:new g(this),codeview:new he(this),dragAndDrop:new pe(this),clipboard:new ve(this),linkDialog:new ge(this),imageDialog:new me(this),helpDialog:new be(this)};this.invoke=function(){var e=I.head(I.from(arguments)),t=I.tail(I.from(arguments)),n=e.split("."),o=1<n.length,i=o&&I.head(n),r=o?I.last(n):I.head(n),a=this.getModule(i),s=a[r];return s&&s.apply(a,t)},this.getModule=function(e){return this.modules[e]||this.modules.editor},this.insertImages=function(e,t){var n=e.editor(),o=e.editable(),i=e.holder(),r=o.data("callbacks"),a=n.data("options");r.onImageUpload?(r.onImageUpload(t,d.editor,o),l(i,"image.upload")([t])):N.each(t,function(e,t){var n=t.name;a.maximumImageFileSize&&a.maximumImageFileSize<t.size?r.onImageUploadError?(r.onImageUploadError(a.langInfo.image.maximumFileSizeError),l(i,"image.upload.error")(a.langInfo.image.maximumFileSizeError)):alert(a.langInfo.image.maximumFileSizeError):A.readFileAsDataURL(t).then(function(e){d.editor.insertImage(o,e,n)}).fail(function(){r.onImageUploadError&&(r.onImageUploadError(),l(i,"image.upload.error")(a.langInfo.image.maximumFileSizeError))})})};function i(e){E.isImg(e.target)&&e.preventDefault()}function c(o){setTimeout(function(){var e,t=E.makeLayoutInfo(o.currentTarget||o.target),n=d.editor.currentStyle(o.target);n&&((e=t.editor().data("options").airMode)||d.toolbar.update(t.toolbar(),n),d.popover.update(t.popover(),n,e),d.handle.update(t.handle(),n,e))},0)}function r(e){var t=E.makeLayoutInfo(e.currentTarget||e.target);d.popover.hide(t.popover()),d.handle.hide(t.handle())}function a(e){N(e.target).closest("[data-event]").length&&e.preventDefault()}function s(e){var t,n,o,i,r,a,s,l=N(e.target).closest("[data-event]");l.length&&(t=l.attr("data-event"),n=l.attr("data-value"),o=l.attr("data-hide"),i=E.makeLayoutInfo(e.target),-1!==N.inArray(t,["resize","floatMe","removeMedia","imageShape"])&&(r=i.handle().find(".note-control-selection"),a=N(r.data("target"))),o&&l.parents(".popover").hide(),N.isFunction(N.summernote.pluginEvents[t])?N.summernote.pluginEvents[t](e,d.editor,i,n):d.editor[t]?((s=i.editable()).focus(),d.editor[t](s,n,a),e.preventDefault()):u[t]&&(u[t].call(this,i),e.preventDefault()),-1!==N.inArray(t,["backColor","foreColor"])&&(i.editor().data("options",void 0).airMode?d.popover:d.toolbar).updateRecentColor(I.head(l),t,n),c(e))}var u={showLinkDialog:function(e){d.linkDialog.show(e)},showImageDialog:function(e){d.imageDialog.show(e)},showHelpDialog:function(e){d.helpDialog.show(e)},fullscreen:function(e){d.fullscreen.toggle(e)},codeview:function(e){d.codeview.toggle(e)}},l=function(e,t){return function(){return e.trigger("summernote."+t,arguments)}};this.bindKeyMap=function(r,a){var s=r.editor(),l=r.editable();l.on("keydown",function(e){var t=[];e.metaKey&&t.push("CMD"),e.ctrlKey&&!e.altKey&&t.push("CTRL"),e.shiftKey&&t.push("SHIFT");var n=R.nameFromCode[e.keyCode];n&&t.push(n);var o,i=a[t.join("+")];i?N.summernote.pluginEvents[i]?(o=N.summernote.pluginEvents[i],N.isFunction(o)&&o(e,d.editor,r)):d.editor[i]?(d.editor[i](l,s.data("options")),e.preventDefault()):u[i]&&(u[i].call(this,r),e.preventDefault()):R.isEdit(e.keyCode)&&d.editor.afterCommand(l)})},this.attach=function(t,n){n.shortcuts&&this.bindKeyMap(t,n.keyMap[F.isMac?"mac":"pc"]),t.editable().on("mousedown",i),t.editable().on("keyup mouseup",c),t.editable().on("scroll",r),d.clipboard.attach(t,n),d.handle.attach(t,n),t.popover().on("click",s),t.popover().on("mousedown",a),d.dragAndDrop.attach(t,n),n.airMode||(t.toolbar().on("click",s),t.toolbar().on("mousedown",a),d.statusbar.attach(t,n)),(n.airMode?t.popover():t.toolbar()).find(".note-dimension-picker-mousecatcher").css({width:n.insertTableMaxSize.col+"em",height:n.insertTableMaxSize.row+"em"}).on("mousemove",function(e){!function(e,t){var n,o,i=N(e.target.parentNode),r=i.next(),a=i.find(".note-dimension-picker-mousecatcher"),s=i.find(".note-dimension-picker-highlighted"),l=i.find(".note-dimension-picker-unhighlighted");o=void 0===e.offsetX?(n=N(e.target).offset(),{x:e.pageX-n.left,y:e.pageY-n.top}):{x:e.offsetX,y:e.offsetY};var d=Math.ceil(o.x/18)||1,c=Math.ceil(o.y/18)||1;s.css({width:d+"em",height:c+"em"}),a.attr("data-value",d+"x"+c),3<d&&d<t.insertTableMaxSize.col&&l.css({width:d+1+"em"}),3<c&&c<t.insertTableMaxSize.row&&l.css({height:c+1+"em"}),r.html(d+" x "+c)}(e,n)}),t.editor().data("options",n),F.isMSIE||setTimeout(function(){document.execCommand("styleWithCSS",0,n.styleWithSpan)},0);var e,o=new f(t.editable());t.editable().data("NoteHistory",o),n.onenter&&t.editable().keypress(function(e){e.keyCode===R.ENTER&&n.onenter(e)}),n.onfocus&&t.editable().focus(n.onfocus),n.onblur&&t.editable().blur(n.onblur),n.onkeyup&&t.editable().keyup(n.onkeyup),n.onkeydown&&t.editable().keydown(n.onkeydown),n.onpaste&&t.editable().on("paste",n.onpaste),n.onToolbarClick&&t.toolbar().click(n.onToolbarClick),n.onChange&&(e=function(){d.editor.triggerOnChange(t.editable())},F.isMSIE?t.editable().on("DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted",e):t.editable().on("input",e)),t.editable().data("callbacks",{onBeforeChange:n.onBeforeChange,onChange:n.onChange,onAutoSave:n.onAutoSave,onImageUpload:n.onImageUpload,onImageUploadError:n.onImageUploadError,onFileUpload:n.onFileUpload,onFileUploadError:n.onFileUpload,onMediaDelete:n.onMediaDelete}),E.isTextarea(I.head(t.holder()))&&t.holder().closest("form").submit(function(){var e=t.holder().code();t.holder().val(e),n.onsubmit&&n.onsubmit(e)})},this.attachCustomEvent=function(e,t){var n=e.holder(),o=e.editable();o.on("mousedown",l(n,"mousedown")),o.on("keyup mouseup",l(n,"update")),o.on("scroll",l(n,"scroll")),o.keypress(function(e){e.keyCode===R.ENTER&&l(n,"enter").call(this,e)}),o.focus(l(n,"focus")),o.blur(l(n,"blur")),o.keyup(l(n,"keyup")),o.keydown(l(n,"keydown")),o.on("paste",l(n,"paste")),t.airMode||(e.toolbar().click(l(n,"toolbar.click")),e.popover().click(l(n,"popover.click"))),F.isMSIE?o.on("DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted",l(n,"change")):o.on("input",l(n,"change")),E.isTextarea(I.head(n))&&n.closest("form").submit(function(e){var t=n.code();l(n,"submit").call(this,e,t)}),l(n,"init")();for(var i=0,r=N.summernote.plugins.length;i<r;i++)N.isFunction(N.summernote.plugins[i].init)&&N.summernote.plugins[i].init(e)},this.detach=function(e,t){e.holder().off(),e.editable().off(),e.popover().off(),e.handle().off(),e.dialog().off(),t.airMode||(e.dropzone().off(),e.toolbar().off(),e.statusbar().off())}};N.extend(N.summernote,{renderer:Ce,eventHandler:ye,core:{agent:F,dom:E,range:M},pluginEvents:{},plugins:[]}),N.summernote.addPlugin=function(e){N.summernote.plugins.push(e),e.buttons&&N.each(e.buttons,function(e,t){Ce.addButtonInfo(e,t)}),e.dialogs&&N.each(e.dialogs,function(e,t){Ce.addDialogInfo(e,t)}),e.events&&N.each(e.events,function(e,t){N.summernote.pluginEvents[e]=t}),e.langs&&N.each(e.langs,function(e,t){N.summernote.lang[e]&&N.extend(N.summernote.lang[e],t)}),e.options&&N.extend(N.summernote.options,e.options)},N.fn.extend({summernote:function(){var e=N.type(I.head(arguments)),t="string"===e,i="object"===e?I.head(arguments):{};(i=N.extend(!0,{},N.summernote.options,i)).langInfo=N.extend(!0,{},N.summernote.lang["en-US"],N.summernote.lang[i.lang]),this.each(function(e,t){var n,o=N(t);Ce.hasNoteEditor(o)||(Ce.createLayout(o,i),n=Ce.layoutInfoFromHolder(o),ye.attach(n,i),ye.attachCustomEvent(n,i))}),!t&&this.length&&i.oninit&&i.oninit();var n=this.first();if(n.length){var o=Ce.layoutInfoFromHolder(n);if(t){var r=I.head(I.from(arguments)),a=I.tail(I.from(arguments)),s=[r,o.editable()].concat(a);return ye.invoke.apply(ye,s)}i.focus&&o.editable().focus()}return this},code:function(i){if(void 0!==i)return this.each(function(e,t){var n=Ce.layoutInfoFromHolder(N(t)),o=n&&n.editable();o&&o.html(i)}),this;var e=this.first();if(e.length){var t=Ce.layoutInfoFromHolder(e),n=t&&t.editable();if(n&&n.length){var o=ye.invoke("codeview.isActivated",t);return ye.invoke("codeview.sync",t),o?t.codable().val():t.editable().html()}return E.isTextarea(e[0])?e.val():e.html()}},destroy:function(){return this.each(function(e,t){var n,o,i=N(t);Ce.hasNoteEditor(i)&&(o=(n=Ce.layoutInfoFromHolder(i)).editor().data("options"),ye.detach(n,o),Ce.removeLayout(i,n,o))}),this}})});