UNPKG

jsdk-offical

Version:

JSDK is the most comprehensive TypeScript framework, like JDK.

3 lines (2 loc) 138 kB
/*! Summernote v0.8.12 | (c) 2013- Alan Hong and other contributors | MIT license */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t=t||self).jQuery)}(this,function(C){"use strict";C=C&&C.hasOwnProperty("default")?C.default:C;var i=function(){function t(t,e,o,n){this.markup=t,this.children=e,this.options=o,this.callback=n}return t.prototype.render=function(t){var o=C(this.markup);if(this.options&&this.options.contents&&o.html(this.options.contents),this.options&&this.options.className&&o.addClass(this.options.className),this.options&&this.options.data&&C.each(this.options.data,function(t,e){o.attr("data-"+t,e)}),this.options&&this.options.click&&o.on("click",this.options.click),this.children){var e=o.find(".note-children-container");this.children.forEach(function(t){t.render(e.length?e:o)})}return this.callback&&this.callback(o,this.options),this.options&&this.options.callback&&this.options.callback(o),t&&t.append(o),o},t}(),t=function(o,n){return function(){var t="object"==typeof arguments[1]?arguments[1]:arguments[0],e=Array.isArray(arguments[0])?arguments[0]:[];return t&&t.children&&(e=t.children),new i(o,e,t,n)}},p=function(){function t(e,t){if(this.$node=e,this.options=$.extend({},{title:"",target:t.container,trigger:"hover focus",placement:"bottom"},t),this.$tooltip=$(['<div class="note-tooltip in">',' <div class="note-tooltip-arrow"/>',' <div class="note-tooltip-content"/>',"</div>"].join("")),"manual"!==this.options.trigger){var o=this.show.bind(this),n=this.hide.bind(this),i=this.toggle.bind(this);this.options.trigger.split(" ").forEach(function(t){"hover"===t?(e.off("mouseenter mouseleave"),e.on("mouseenter",o).on("mouseleave",n)):"click"===t?e.on("click",i):"focus"===t&&e.on("focus",o).on("blur",n)})}}return t.prototype.show=function(){var t=this.$node,e=t.offset(),o=this.$tooltip,n=this.options.title||t.attr("title")||t.data("title"),i=this.options.placement||t.data("placement");o.addClass(i),o.addClass("in"),o.find(".note-tooltip-content").text(n),o.appendTo(this.options.target);var r=t.outerWidth(),s=t.outerHeight(),a=o.outerWidth(),l=o.outerHeight();"bottom"===i?o.css({top:e.top+s,left:e.left+(r/2-a/2)}):"top"===i?o.css({top:e.top-l,left:e.left+(r/2-a/2)}):"left"===i?o.css({top:e.top+(s/2-l/2),left:e.left-a}):"right"===i&&o.css({top:e.top+(s/2-l/2),left:e.left+r})},t.prototype.hide=function(){this.$tooltip.removeClass("in"),this.$tooltip.remove()},t.prototype.toggle=function(){this.$tooltip.hasClass("in")?this.hide():this.show()},t}(),o=function(){function t(t,e){this.$button=t,this.options=$.extend({},{target:e.container},e),this.setEvent()}return t.prototype.setEvent=function(){var e=this;this.$button.on("click",function(t){e.toggle(),t.stopImmediatePropagation()})},t.prototype.clear=function(){var t=$(".note-btn-group.open");t.find(".note-btn.active").removeClass("active"),t.removeClass("open")},t.prototype.show=function(){this.$button.addClass("active"),this.$button.parent().addClass("open");var t=this.$button.next(),e=t.offset(),o=t.outerWidth(),n=$(window).width(),i=parseFloat($(this.options.target).css("margin-right"));e.left+o>n-i?t.css("margin-left",n-i-(e.left+o)):t.css("margin-left","")},t.prototype.hide=function(){this.$button.removeClass("active"),this.$button.parent().removeClass("open")},t.prototype.toggle=function(){var t=this.$button.parent().hasClass("open");this.clear(),t?this.hide():this.show()},t}();$(document).on("click",function(t){$(t.target).closest(".note-btn-group").length||$(".note-btn-group.open").removeClass("open")}),$(document).on("click.note-dropdown-menu",function(t){$(t.target).closest(".note-dropdown-menu").parent().removeClass("open")});var n=function(){function t(t,e){this.options=$.extend({},{target:e.container||"body"},e),this.$modal=t,this.$backdrop=$('<div class="note-modal-backdrop" />')}return t.prototype.show=function(){"body"===this.options.target?(this.$backdrop.css("position","fixed"),this.$modal.css("position","fixed")):(this.$backdrop.css("position","absolute"),this.$modal.css("position","absolute")),this.$backdrop.appendTo(this.options.target).show(),this.$modal.appendTo(this.options.target).addClass("open").show(),this.$modal.trigger("note.modal.show"),this.$modal.off("click",".close").on("click",".close",this.hide.bind(this))},t.prototype.hide=function(){this.$modal.removeClass("open").hide(),this.$backdrop.hide(),this.$modal.trigger("note.modal.hide")},t}(),e=t('<div class="note-editor note-frame"/>'),r=t('<div class="note-toolbar" role="toolbar"/>'),s=t('<div class="note-editing-area"/>'),a=t('<textarea class="note-codable" role="textbox" aria-multiline="true"/>'),l=t('<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>'),c=t(['<output class="note-status-output" role="status" aria-live="polite"/>','<div class="note-statusbar" role="resize">',' <div class="note-resizebar" role="seperator" aria-orientation="horizontal" aria-label="resize">',' <div class="note-icon-bar"/>',' <div class="note-icon-bar"/>',' <div class="note-icon-bar"/>'," </div>","</div>"].join("")),d=t('<div class="note-editor"/>'),u=t(['<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>','<output class="note-status-output" role="status" aria-live="polite"/>'].join("")),h=t('<div class="note-btn-group">'),f=t('<button type="button" class="note-btn" role="button" tabindex="-1">',function(t,e){e&&e.tooltip&&(t.attr({"aria-label":e.tooltip}),t.data("_lite_tooltip",new p(t,{title:e.tooltip,container:e.container})).on("click",function(t){$(t.currentTarget).data("_lite_tooltip").hide()})),e.contents&&t.html(e.contents),e&&e.data&&"dropdown"===e.data.toggle&&t.data("_lite_dropdown",new o(t,{container:e.container}))}),m=t('<div class="note-dropdown-menu" role="list">',function(t,i){var e=Array.isArray(i.items)?i.items.map(function(t){var e="string"==typeof t?t:t.value||"",o=i.template?i.template(t):t,n=$('<a class="note-dropdown-item" href="#" data-value="'+e+'" role="listitem" aria-label="'+e+'"></a>');return n.html(o).data("item",t),n}):i.items;t.html(e).attr({"aria-label":i.title}),t.on("click","> .note-dropdown-item",function(t){var e=$(this),o=e.data("item"),n=e.data("value");o.click?o.click(e):i.itemClick&&i.itemClick(t,o,n)})}),g=t('<div class="note-dropdown-menu note-check" role="list">',function(t,i){var e=Array.isArray(i.items)?i.items.map(function(t){var e="string"==typeof t?t:t.value||"",o=i.template?i.template(t):t,n=$('<a class="note-dropdown-item" href="#" data-value="'+e+'" role="listitem" aria-label="'+t+'"></a>');return n.html([w(i.checkClassName)," ",o]).data("item",t),n}):i.items;t.html(e).attr({"aria-label":i.title}),t.on("click","> .note-dropdown-item",function(t){var e=$(this),o=e.data("item"),n=e.data("value");o.click?o.click(e):i.itemClick&&i.itemClick(t,o,n)})}),v=t('<div class="note-color-palette"/>',function(t,e){for(var o=[],n=0,i=e.colors.length;n<i;n++){for(var r=e.eventName,s=e.colors[n],a=e.colorsName[n],l=[],c=0,d=s.length;c<d;c++){var u=s[c],h=a[c];l.push(['<button type="button" class="note-btn note-color-btn"','style="background-color:',u,'" ','data-event="',r,'" ','data-value="',u,'" ','title="',h,'" ','aria-label="',h,'" ','data-toggle="button" tabindex="-1"></button>'].join(""))}o.push('<div class="note-color-row">'+l.join("")+"</div>")}t.html(o.join("")),t.find(".note-color-btn").each(function(){$(this).data("_lite_tooltip",new p($(this),{container:e.container}))})}),b=t('<div class="note-modal" aria-hidden="false" tabindex="-1" role="dialog"/>',function(t,e){e.fade&&t.addClass("fade"),t.attr({"aria-label":e.title}),t.html([' <div class="note-modal-content">',e.title?' <div class="note-modal-header"> <button type="button" class="close" aria-label="Close" aria-hidden="true"><i class="note-icon-close"></i></button> <h4 class="note-modal-title">'+e.title+"</h4> </div>":"",' <div class="note-modal-body">'+e.body+"</div>",e.footer?' <div class="note-modal-footer">'+e.footer+"</div>":""," </div>"].join("")),t.data("modal",new n(t,e))}),y=t(['<div class="note-popover bottom">',' <div class="note-popover-arrow"/>',' <div class="popover-content note-children-container"/>',"</div>"].join(""),function(t,e){var o=void 0!==e.direction?e.direction:"bottom";t.addClass(o).hide(),e.hideArrow&&t.find(".note-popover-arrow").hide()}),k=t('<div class="checkbox"></div>',function(t,e){t.html(["<label"+(e.id?' for="'+e.id+'"':"")+">",' <input role="checkbox" type="checkbox"'+(e.id?' id="'+e.id+'"':""),e.checked?" checked":"",' aria-checked="'+(e.checked?"true":"false")+'"/>',e.text?e.text:"","</label>"].join(""))}),w=function(t,e){return"<"+(e=e||"i")+' class="'+t+'"/>'},x={editor:e,toolbar:r,editingArea:s,codable:a,editable:l,statusbar:c,airEditor:d,airEditable:u,buttonGroup:h,button:f,dropdown:m,dropdownCheck:g,dropdownButton:function(t,e){return h([f({className:"dropdown-toggle",contents:t.title+" "+w("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),m({className:t.className,items:t.items,template:t.template,itemClick:t.itemClick})],{callback:e}).render()},dropdownButtonContents:function(t,e){return t+" "+w(e.icons.caret,"span")},dropdownCheckButton:function(t,e){return h([f({className:"dropdown-toggle",contents:t.title+" "+w("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),g({className:t.className,checkClassName:t.checkClassName,items:t.items,template:t.template,itemClick:t.itemClick})],{callback:e}).render()},paragraphDropdownButton:function(t){return h([f({className:"dropdown-toggle",contents:t.title+" "+w("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),m([h({className:"note-align",children:t.items[0]}),h({className:"note-list",children:t.items[1]})])]).render()},tableDropdownButton:function(e){return h([f({className:"dropdown-toggle",contents:e.title+" "+w("note-icon-caret"),tooltip:e.tooltip,data:{toggle:"dropdown"}}),m({className:"note-table",items:['<div class="note-dimension-picker">',' <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>',' <div class="note-dimension-picker-highlighted"/>',' <div class="note-dimension-picker-unhighlighted"/>',"</div>",'<div class="note-dimension-display">1 x 1</div>'].join("")})],{callback:function(t){t.find(".note-dimension-picker-mousecatcher").css({width:e.col+"em",height:e.row+"em"}).mousedown(e.itemClick).mousemove(function(t){!function(t,e,o){var n,i=$(t.target.parentNode),r=i.next(),s=i.find(".note-dimension-picker-mousecatcher"),a=i.find(".note-dimension-picker-highlighted"),l=i.find(".note-dimension-picker-unhighlighted");if(void 0===t.offsetX){var c=$(t.target).offset();n={x:t.pageX-c.left,y:t.pageY-c.top}}else n={x:t.offsetX,y:t.offsetY};var d=Math.ceil(n.x/18)||1,u=Math.ceil(n.y/18)||1;a.css({width:d+"em",height:u+"em"}),s.data("value",d+"x"+u),3<d&&d<e&&l.css({width:d+1+"em"}),3<u&&u<o&&l.css({height:u+1+"em"}),r.html(d+" x "+u)}(t,e.col,e.row)})}}).render()},colorDropdownButton:function(c,d){return h({className:"note-color",children:[f({className:"note-current-color-button",contents:c.title,tooltip:c.lang.color.recent,click:c.currentClick,callback:function(t){var e=t.find(".note-recent-color");"foreColor"!==d&&(e.css("background-color","#FFFF00"),t.attr("data-backColor","#FFFF00"))}}),f({className:"dropdown-toggle",contents:w("note-icon-caret"),tooltip:c.lang.color.more,data:{toggle:"dropdown"}}),m({items:["<div>",'<div class="note-btn-group btn-background-color">',' <div class="note-palette-title">'+c.lang.color.background+"</div>"," <div>",'<button type="button" class="note-color-reset note-btn note-btn-block" data-event="backColor" data-value="inherit">',c.lang.color.transparent," </button>"," </div>",' <div class="note-holder" data-event="backColor"/>',' <div class="btn-sm">',' <input type="color" id="html5bcp" class="note-btn btn-default" value="#21104A" style="width:100%;" data-value="cp">',' <button type="button" class="note-color-reset btn" data-event="backColor" data-value="cpbackColor">',c.lang.color.cpSelect," </button>"," </div>","</div>",'<div class="note-btn-group btn-foreground-color">',' <div class="note-palette-title">'+c.lang.color.foreground+"</div>"," <div>",'<button type="button" class="note-color-reset note-btn note-btn-block" data-event="removeFormat" data-value="foreColor">',c.lang.color.resetToDefault," </button>"," </div>",' <div class="note-holder" data-event="foreColor"/>',' <div class="btn-sm">',' <input type="color" id="html5fcp" class="note-btn btn-default" value="#21104A" style="width:100%;" data-value="cp">',' <button type="button" class="note-color-reset btn" data-event="foreColor" data-value="cpforeColor">',c.lang.color.cpSelect," </button>"," </div>","</div>","</div>"].join(""),callback:function(t){t.find(".note-holder").each(function(){var t=$(this);t.append(v({colors:c.colors,eventName:t.data("event")}).render())}),"fore"===d?(t.find(".btn-background-color").hide(),t.css({"min-width":"210px"})):"back"===d&&(t.find(".btn-foreground-color").hide(),t.css({"min-width":"210px"}))},click:function(t){var e=$(t.target),o=e.data("event"),n=e.data("value"),i=document.getElementById("html5fcp").value,r=document.getElementById("html5bcp").value;if("cp"===n?t.stopPropagation():"cpbackColor"===n?n=r:"cpforeColor"===n&&(n=i),o&&n){var s="backColor"===o?"background-color":"color",a=e.closest(".note-color").find(".note-recent-color"),l=e.closest(".note-color").find(".note-current-color-button");a.css(s,n),l.attr("data-"+o,n),"fore"===d?c.itemClick("foreColor",n):"back"===d?c.itemClick("backColor",n):c.itemClick(o,n)}}})]}).render()},palette:v,dialog:b,videoDialog:function(t){var e='<div class="note-form-group"><label class="note-form-label">'+t.lang.video.url+' <small class="text-muted">'+t.lang.video.providers+'</small></label><input class="note-video-url note-input" type="text" /></div>',o=['<button type="button" href="#" class="note-btn note-btn-primary note-video-btn disabled" disabled>',t.lang.video.insert,"</button>"].join("");return b({title:t.lang.video.insert,fade:t.fade,body:e,footer:o}).render()},imageDialog:function(t){var e='<div class="note-form-group note-group-select-from-files"><label class="note-form-label">'+t.lang.image.selectFromFiles+'</label><input class="note-note-image-input note-input" type="file" name="files" accept="image/*" multiple="multiple" />'+t.imageLimitation+'</div><div class="note-form-group" style="overflow:auto;"><label class="note-form-label">'+t.lang.image.url+'</label><input class="note-image-url note-input" type="text" /></div>',o=['<button href="#" type="button" class="note-btn note-btn-primary note-btn-large note-image-btn disabled" disabled>',t.lang.image.insert,"</button>"].join("");return b({title:t.lang.image.insert,fade:t.fade,body:e,footer:o}).render()},linkDialog:function(t){var e='<div class="note-form-group"><label class="note-form-label">'+t.lang.link.textToDisplay+'</label><input class="note-link-text note-input" type="text" /></div><div class="note-form-group"><label class="note-form-label">'+t.lang.link.url+'</label><input class="note-link-url note-input" type="text" value="http://" /></div>'+(t.disableLinkTarget?"":'<div class="checkbox"><label><input type="checkbox" checked> '+t.lang.link.openInNewWindow+"</label></div>"),o=['<button href="#" type="button" class="note-btn note-btn-primary note-link-btn disabled" disabled>',t.lang.link.insert,"</button>"].join("");return b({className:"link-dialog",title:t.lang.link.insert,fade:t.fade,body:e,footer:o}).render()},popover:y,checkbox:k,icon:w,toggleBtn:function(t,e){t.toggleClass("disabled",!e),t.attr("disabled",!e)},toggleBtnActive:function(t,e){t.toggleClass("active",e)},check:function(t,e){t.find(".checked").removeClass("checked"),t.find('[data-value="'+e+'"]').addClass("checked")},onDialogShown:function(t,e){t.one("note.modal.show",e)},onDialogHidden:function(t,e){t.one("note.modal.hide",e)},showDialog:function(t){t.data("modal").show()},hideDialog:function(t){t.data("modal").hide()},getPopoverContent:function(t){return t.find(".note-popover-content")},getDialogBody:function(t){return t.find(".note-modal-body")},createLayout:function(t,e){var o=(e.airMode?x.airEditor([x.editingArea([x.airEditable()])]):x.editor([x.toolbar(),x.editingArea([x.codable(),x.editable()]),x.statusbar()])).render();return o.insertAfter(t),{note:t,editor:o,toolbar:o.find(".note-toolbar"),editingArea:o.find(".note-editing-area"),editable:o.find(".note-editable"),codable:o.find(".note-codable"),statusbar:o.find(".note-statusbar")}},removeLayout:function(t,e){t.html(e.editable.html()),e.editor.remove(),t.off("summernote"),t.show()}};C.summernote=C.summernote||{lang:{}},C.extend(C.summernote.lang,{"en-US":{font:{bold:"Bold",italic:"Italic",underline:"Underline",clear:"Remove Font Style",height:"Line Height",name:"Font Family",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",size:"Font Size"},image:{image:"Picture",insert:"Insert Image",resizeFull:"Resize full",resizeHalf:"Resize half",resizeQuarter:"Resize quarter",resizeNone:"Original size",floatLeft:"Float Left",floatRight:"Float Right",floatNone:"Remove float",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",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},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",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Insert Horizontal Rule"},style:{style:"Style",p:"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",cpSelect:"Select"},shortcut:{shortcuts:"Keyboard shortcuts",close:"Close",textFormatting:"Text formatting",action:"Action",paragraphFormatting:"Paragraph formatting",documentStyle:"Document Style",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Undo",redo:"Redo"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}});var S="function"==typeof define&&define.amd;var I,T=navigator.userAgent,N=/MSIE|Trident/i.test(T);if(N){var E=/MSIE (\d+[.]\d+)/.exec(T);E&&(I=parseFloat(E[1])),(E=/Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(T))&&(I=parseFloat(E[1]))}var R=/Edge\/\d+/.test(T),L=!!window.CodeMirror,A="ontouchstart"in window||0<navigator.MaxTouchPoints||0<navigator.msMaxTouchPoints,F=N||R?"DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted":"input",P={isMac:-1<navigator.appVersion.indexOf("Mac"),isMSIE:N,isEdge:R,isFF:!R&&/firefox/i.test(T),isPhantom:/PhantomJS/i.test(T),isWebkit:!R&&/webkit/i.test(T),isChrome:!R&&/chrome/i.test(T),isSafari:!R&&/safari/i.test(T),browserVersion:I,jqueryVersion:parseFloat(C.fn.jquery),isSupportAmd:S,isSupportTouch:A,hasCodeMirror:L,isFontInstalled:function(t){var e="Comic Sans MS"===t?"Courier New":"Comic Sans MS",o="mmmmmmmmmmwwwww",n=document.createElement("canvas").getContext("2d");n.font="200px '"+e+"'";var i=n.measureText(o).width;return n.font="200px '"+t+"', '"+e+"'",i!==n.measureText(o).width},isW3CRangeSupport:!!document.createRange,inputEventName:F};var H=0;var D={eq:function(e){return function(t){return e===t}},eq2:function(t,e){return t===e},peq2:function(o){return function(t,e){return t[o]===e[o]}},ok:function(){return!0},fail:function(){return!1},self:function(t){return t},not:function(t){return function(){return!t.apply(t,arguments)}},and:function(e,o){return function(t){return e(t)&&o(t)}},invoke:function(t,e){return function(){return t[e].apply(t,arguments)}},uniqueId:function(t){var e=++H+"";return t?t+e:e},rect2bnd:function(t){var e=$(document);return{top:t.top+e.scrollTop(),left:t.left+e.scrollLeft(),width:t.right-t.left,height:t.bottom-t.top}},invertObject:function(t){var e={};for(var o in t)t.hasOwnProperty(o)&&(e[t[o]]=o);return e},namespaceToCamel:function(t,e){return(e=e||"")+t.split(".").map(function(t){return t.substring(0,1).toUpperCase()+t.substring(1)}).join("")},debounce:function(n,i,r){var s;return function(){var t=this,e=arguments,o=r&&!s;clearTimeout(s),s=setTimeout(function(){s=null,r||n.apply(t,e)},i),o&&n.apply(t,e)}},isValidUrl:function(t){return/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(t)}};function B(t){return t[0]}function z(t){return t[t.length-1]}function M(t){return t.slice(1)}function O(t,e){return!!(t&&t.length&&e)&&-1!==t.indexOf(e)}var U={head:B,last:z,initial:function(t){return t.slice(0,t.length-1)},tail:M,prev:function(t,e){if(t&&t.length&&e){var o=t.indexOf(e);return-1===o?null:t[o-1]}return null},next:function(t,e){if(t&&t.length&&e){var o=t.indexOf(e);return-1===o?null:t[o+1]}return null},find:function(t,e){for(var o=0,n=t.length;o<n;o++){var i=t[o];if(e(i))return i}},contains:O,all:function(t,e){for(var o=0,n=t.length;o<n;o++)if(!e(t[o]))return!1;return!0},sum:function(t,o){return o=o||D.self,t.reduce(function(t,e){return t+o(e)},0)},from:function(t){for(var e=[],o=t.length,n=-1;++n<o;)e[n]=t[n];return e},isEmpty:function(t){return!t||!t.length},clusterBy:function(t,n){return t.length?M(t).reduce(function(t,e){var o=z(t);return n(z(o),e)?o[o.length]=e:t[t.length]=[e],t},[[B(t)]]):[]},compact:function(t){for(var e=[],o=0,n=t.length;o<n;o++)t[o]&&e.push(t[o]);return e},unique:function(t){for(var e=[],o=0,n=t.length;o<n;o++)O(e,t[o])||e.push(t[o]);return e}},j=String.fromCharCode(160);function K(t){return t&&C(t).hasClass("note-editable")}function W(e){return e=e.toUpperCase(),function(t){return t&&t.nodeName.toUpperCase()===e}}function V(t){return t&&3===t.nodeType}function q(t){return t&&/^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT|^AUDIO|^VIDEO|^EMBED/.test(t.nodeName.toUpperCase())}function _(t){return!K(t)&&(t&&/^DIV|^P|^LI|^H[1-7]/.test(t.nodeName.toUpperCase()))}var G=W("PRE"),Z=W("LI");var Y=W("TABLE"),Q=W("DATA");function X(t){return!(nt(t)||J(t)||tt(t)||_(t)||Y(t)||ot(t)||Q(t))}function J(t){return t&&/^UL|^OL/.test(t.nodeName.toUpperCase())}var tt=W("HR");function et(t){return t&&/^TD|^TH/.test(t.nodeName.toUpperCase())}var ot=W("BLOCKQUOTE");function nt(t){return et(t)||ot(t)||K(t)}var it=W("A");var rt=W("BODY");var st=P.isMSIE&&P.browserVersion<11?"&nbsp;":"<br>";function at(t){return V(t)?t.nodeValue.length:t?t.childNodes.length:0}function lt(t){var e=at(t);return 0===e||(!V(t)&&1===e&&t.innerHTML===st||!(!U.all(t.childNodes,V)||""!==t.innerHTML))}function ct(t){q(t)||at(t)||(t.innerHTML=st)}function dt(t,e){for(;t;){if(e(t))return t;if(K(t))break;t=t.parentNode}return null}function ut(t,e){e=e||D.fail;var o=[];return dt(t,function(t){return K(t)||o.push(t),e(t)}),o}function ht(t,e){e=e||D.fail;for(var o=[];t&&!e(t);)o.push(t),t=t.nextSibling;return o}function pt(t,e){var o=e.nextSibling,n=e.parentNode;return o?n.insertBefore(t,o):n.appendChild(t),t}function ft(o,t){return C.each(t,function(t,e){o.appendChild(e)}),o}function mt(t){return 0===t.offset}function gt(t){return t.offset===at(t.node)}function vt(t){return mt(t)||gt(t)}function bt(t,e){for(;t&&t!==e;){if(0!==kt(t))return!1;t=t.parentNode}return!0}function yt(t,e){if(!e)return!1;for(;t&&t!==e;){if(kt(t)!==at(t.parentNode)-1)return!1;t=t.parentNode}return!0}function kt(t){for(var e=0;t=t.previousSibling;)e+=1;return e}function Ct(t){return!!(t&&t.childNodes&&t.childNodes.length)}function wt(t,e){var o,n;if(0===t.offset){if(K(t.node))return null;o=t.node.parentNode,n=kt(t.node)}else n=Ct(t.node)?at(o=t.node.childNodes[t.offset-1]):(o=t.node,e?0:t.offset-1);return{node:o,offset:n}}function xt(t,e){var o,n;if(at(t.node)===t.offset){if(K(t.node))return null;o=t.node.parentNode,n=kt(t.node)+1}else n=Ct(t.node)?(o=t.node.childNodes[t.offset],0):(o=t.node,e?at(t.node):t.offset+1);return{node:o,offset:n}}function St(t,e){return t.node===e.node&&t.offset===e.offset}function $t(t,e){var o=e&&e.isSkipPaddingBlankHTML,n=e&&e.isNotSplitEdgePoint,i=e&&e.isDiscardEmptySplits;if(i&&(o=!0),vt(t)&&(V(t.node)||n)){if(mt(t))return t.node;if(gt(t))return t.node.nextSibling}if(V(t.node))return t.node.splitText(t.offset);var r=t.node.childNodes[t.offset],s=pt(t.node.cloneNode(!1),t.node);return ft(s,ht(r)),o||(ct(t.node),ct(s)),i&&(lt(t.node)&&Nt(t.node),lt(s))?(Nt(s),t.node.nextSibling):s}function It(t,o,n){var e=ut(o.node,D.eq(t));return e.length?1===e.length?$t(o,n):e.reduce(function(t,e){return t===o.node&&(t=$t(o,n)),$t({node:e,offset:t?kt(t):at(e)},n)}):null}function Tt(t){return document.createElement(t)}function Nt(t,e){if(t&&t.parentNode){if(t.removeNode)return t.removeNode(e);var o=t.parentNode;if(!e){for(var n=[],i=0,r=t.childNodes.length;i<r;i++)n.push(t.childNodes[i]);for(i=0,r=n.length;i<r;i++)o.insertBefore(n[i],t)}o.removeChild(t)}}var Et=W("TEXTAREA");function Rt(t,e){var o=Et(t[0])?t.val():t.html();return e?o.replace(/[\n\r]/g,""):o}var Lt={NBSP_CHAR:j,ZERO_WIDTH_NBSP_CHAR:"\ufeff",blank:st,emptyPara:"<p>"+st+"</p>",makePredByNodeName:W,isEditable:K,isControlSizing:function(t){return t&&C(t).hasClass("note-control-sizing")},isText:V,isElement:function(t){return t&&1===t.nodeType},isVoid:q,isPara:_,isPurePara:function(t){return _(t)&&!Z(t)},isHeading:function(t){return t&&/^H[1-7]/.test(t.nodeName.toUpperCase())},isInline:X,isBlock:D.not(X),isBodyInline:function(t){return X(t)&&!dt(t,_)},isBody:rt,isParaInline:function(t){return X(t)&&!!dt(t,_)},isPre:G,isList:J,isTable:Y,isData:Q,isCell:et,isBlockquote:ot,isBodyContainer:nt,isAnchor:it,isDiv:W("DIV"),isLi:Z,isBR:W("BR"),isSpan:W("SPAN"),isB:W("B"),isU:W("U"),isS:W("S"),isI:W("I"),isImg:W("IMG"),isTextarea:Et,isEmpty:lt,isEmptyAnchor:D.and(it,lt),isClosestSibling:function(t,e){return t.nextSibling===e||t.previousSibling===e},withClosestSiblings:function(t,e){e=e||D.ok;var o=[];return t.previousSibling&&e(t.previousSibling)&&o.push(t.previousSibling),o.push(t),t.nextSibling&&e(t.nextSibling)&&o.push(t.nextSibling),o},nodeLength:at,isLeftEdgePoint:mt,isRightEdgePoint:gt,isEdgePoint:vt,isLeftEdgeOf:bt,isRightEdgeOf:yt,isLeftEdgePointOf:function(t,e){return mt(t)&&bt(t.node,e)},isRightEdgePointOf:function(t,e){return gt(t)&&yt(t.node,e)},prevPoint:wt,nextPoint:xt,isSamePoint:St,isVisiblePoint:function(t){if(V(t.node)||!Ct(t.node)||lt(t.node))return!0;var e=t.node.childNodes[t.offset-1],o=t.node.childNodes[t.offset];return!(e&&!q(e)||o&&!q(o))},prevPointUntil:function(t,e){for(;t;){if(e(t))return t;t=wt(t)}return null},nextPointUntil:function(t,e){for(;t;){if(e(t))return t;t=xt(t)}return null},isCharPoint:function(t){if(!V(t.node))return!1;var e=t.node.nodeValue.charAt(t.offset-1);return e&&" "!==e&&e!==j},walkPoint:function(t,e,o,n){for(var i=t;i&&(o(i),!St(i,e));)i=xt(i,n&&t.node!==i.node&&e.node!==i.node)},ancestor:dt,singleChildAncestor:function(t,e){for(t=t.parentNode;t&&1===at(t);){if(e(t))return t;if(K(t))break;t=t.parentNode}return null},listAncestor:ut,lastAncestor:function(t,e){var o=ut(t);return U.last(o.filter(e))},listNext:ht,listPrev:function(t,e){e=e||D.fail;for(var o=[];t&&!e(t);)o.push(t),t=t.previousSibling;return o},listDescendant:function(i,r){var s=[];return r=r||D.ok,function t(e){i!==e&&r(e)&&s.push(e);for(var o=0,n=e.childNodes.length;o<n;o++)t(e.childNodes[o])}(i),s},commonAncestor:function(t,e){for(var o=ut(t),n=e;n;n=n.parentNode)if(-1<o.indexOf(n))return n;return null},wrap:function(t,e){var o=t.parentNode,n=C("<"+e+">")[0];return o.insertBefore(n,t),n.appendChild(t),n},insertAfter:pt,appendChildNodes:ft,position:kt,hasChildren:Ct,makeOffsetPath:function(t,e){return ut(e,D.eq(t)).map(kt).reverse()},fromOffsetPath:function(t,e){for(var o=t,n=0,i=e.length;n<i;n++)o=o.childNodes.length<=e[n]?o.childNodes[o.childNodes.length-1]:o.childNodes[e[n]];return o},splitTree:It,splitPoint:function(t,e){var o,n,i=e?_:nt,r=ut(t.node,i),s=U.last(r)||t.node;n=i(s)?(o=r[r.length-2],s):(o=s).parentNode;var a=o&&It(o,t,{isSkipPaddingBlankHTML:e,isNotSplitEdgePoint:e});return a||n!==t.node||(a=t.node.childNodes[t.offset]),{rightNode:a,container:n}},create:Tt,createText:function(t){return document.createTextNode(t)},remove:Nt,removeWhile:function(t,e){for(;t&&!K(t)&&e(t);){var o=t.parentNode;Nt(t),t=o}},replace:function(t,e){if(t.nodeName.toUpperCase()===e.toUpperCase())return t;var o=Tt(e);return t.style.cssText&&(o.style.cssText=t.style.cssText),ft(o,U.from(t.childNodes)),pt(o,t),Nt(t),o},html:function(t,e){var o=Rt(t);e&&(o=(o=o.replace(/<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g,function(t,e,o){o=o.toUpperCase();var n=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(o)&&!!e,i=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(o);return t+(n||i?"\n":"")})).trim());return o},value:Rt,posFromPlaceholder:function(t){var e=C(t),o=e.offset(),n=e.outerHeight(!0);return{left:o.left,top:o.top+n}},attachEvents:function(e,o){Object.keys(o).forEach(function(t){e.on(t,o[t])})},detachEvents:function(e,o){Object.keys(o).forEach(function(t){e.off(t,o[t])})},isCustomStyleTag:function(t){return t&&!V(t)&&U.contains(t.classList,"note-styletag")}},At=function(){function t(t,e){this.ui=C.summernote.ui,this.$note=t,this.memos={},this.modules={},this.layoutInfo={},this.options=e,this.initialize()}return t.prototype.initialize=function(){return this.layoutInfo=this.ui.createLayout(this.$note,this.options),this._initialize(),this.$note.hide(),this},t.prototype.destroy=function(){this._destroy(),this.$note.removeData("summernote"),this.ui.removeLayout(this.$note,this.layoutInfo)},t.prototype.reset=function(){var t=this.isDisabled();this.code(Lt.emptyPara),this._destroy(),this._initialize(),t&&this.disable()},t.prototype._initialize=function(){var e=this,o=C.extend({},this.options.buttons);Object.keys(o).forEach(function(t){e.memo("button."+t,o[t])});var n=C.extend({},this.options.modules,C.summernote.plugins||{});Object.keys(n).forEach(function(t){e.module(t,n[t],!0)}),Object.keys(this.modules).forEach(function(t){e.initializeModule(t)})},t.prototype._destroy=function(){var e=this;Object.keys(this.modules).reverse().forEach(function(t){e.removeModule(t)}),Object.keys(this.memos).forEach(function(t){e.removeMemo(t)}),this.triggerEvent("destroy",this)},t.prototype.code=function(t){var e=this.invoke("codeview.isActivated");if(void 0===t)return this.invoke("codeview.sync"),e?this.layoutInfo.codable.val():this.layoutInfo.editable.html();e?this.layoutInfo.codable.val(t):this.layoutInfo.editable.html(t),this.$note.val(t),this.triggerEvent("change",t,this.layoutInfo.editable)},t.prototype.isDisabled=function(){return"false"===this.layoutInfo.editable.attr("contenteditable")},t.prototype.enable=function(){this.layoutInfo.editable.attr("contenteditable",!0),this.invoke("toolbar.activate",!0),this.triggerEvent("disable",!1)},t.prototype.disable=function(){this.invoke("codeview.isActivated")&&this.invoke("codeview.deactivate"),this.layoutInfo.editable.attr("contenteditable",!1),this.invoke("toolbar.deactivate",!0),this.triggerEvent("disable",!0)},t.prototype.triggerEvent=function(){var t=U.head(arguments),e=U.tail(U.from(arguments)),o=this.options.callbacks[D.namespaceToCamel(t,"on")];o&&o.apply(this.$note[0],e),this.$note.trigger("summernote."+t,e)},t.prototype.initializeModule=function(t){var e=this.modules[t];e.shouldInitialize=e.shouldInitialize||D.ok,e.shouldInitialize()&&(e.initialize&&e.initialize(),e.events&&Lt.attachEvents(this.$note,e.events))},t.prototype.module=function(t,e,o){if(1===arguments.length)return this.modules[t];this.modules[t]=new e(this),o||this.initializeModule(t)},t.prototype.removeModule=function(t){var e=this.modules[t];e.shouldInitialize()&&(e.events&&Lt.detachEvents(this.$note,e.events),e.destroy&&e.destroy()),delete this.modules[t]},t.prototype.memo=function(t,e){if(1===arguments.length)return this.memos[t];this.memos[t]=e},t.prototype.removeMemo=function(t){this.memos[t]&&this.memos[t].destroy&&this.memos[t].destroy(),delete this.memos[t]},t.prototype.createInvokeHandlerAndUpdateState=function(e,o){var n=this;return function(t){n.createInvokeHandler(e,o)(t),n.invoke("buttons.updateCurrentStyle")}},t.prototype.createInvokeHandler=function(o,n){var i=this;return function(t){t.preventDefault();var e=C(t.target);i.invoke(o,n||e.closest("[data-value]").data("value"),e)}},t.prototype.invoke=function(){var t=U.head(arguments),e=U.tail(U.from(arguments)),o=t.split("."),n=1<o.length,i=n&&U.head(o),r=n?U.last(o):U.head(o),s=this.modules[i||"editor"];return!i&&this[r]?this[r].apply(this,e):s&&s[r]&&s.shouldInitialize()?s[r].apply(s,e):void 0},t}();function Ft(t,e){var o,n,i=t.parentElement(),r=document.body.createTextRange(),s=U.from(i.childNodes);for(o=0;o<s.length;o++)if(!Lt.isText(s[o])){if(r.moveToElementText(s[o]),0<=r.compareEndPoints("StartToStart",t))break;n=s[o]}if(0!==o&&Lt.isText(s[o-1])){var a=document.body.createTextRange(),l=null;a.moveToElementText(n||i),a.collapse(!n),l=n?n.nextSibling:i.firstChild;var c=t.duplicate();c.setEndPoint("StartToStart",a);for(var d=c.text.replace(/[\r\n]/g,"").length;d>l.nodeValue.length&&l.nextSibling;)d-=l.nodeValue.length,l=l.nextSibling;l.nodeValue;e&&l.nextSibling&&Lt.isText(l.nextSibling)&&d===l.nodeValue.length&&(d-=l.nodeValue.length,l=l.nextSibling),i=l,o=d}return{cont:i,offset:o}}function Pt(t){var s=function(t,e){var o,n;if(Lt.isText(t)){var i=Lt.listPrev(t,D.not(Lt.isText)),r=U.last(i).previousSibling;o=r||t.parentNode,e+=U.sum(U.tail(i),Lt.nodeLength),n=!r}else{if(o=t.childNodes[e]||t,Lt.isText(o))return s(o,0);e=0,n=!1}return{node:o,collapseToStart:n,offset:e}},e=document.body.createTextRange(),o=s(t.node,t.offset);return e.moveToElementText(o.node),e.collapse(o.collapseToStart),e.moveStart("character",o.offset),e}C.fn.extend({summernote:function(){var t=C.type(U.head(arguments)),e="string"===t,o="object"===t,i=C.extend({},C.summernote.options,o?U.head(arguments):{});i.langInfo=C.extend(!0,{},C.summernote.lang["en-US"],C.summernote.lang[i.lang]),i.icons=C.extend(!0,{},C.summernote.options.icons,i.icons),i.tooltip="auto"===i.tooltip?!P.isSupportTouch:i.tooltip,this.each(function(t,e){var o=C(e);if(!o.data("summernote")){var n=new At(o,i);o.data("summernote",n),o.data("summernote").triggerEvent("init",n.layoutInfo)}});var n=this.first();if(n.length){var r=n.data("summernote");if(e)return r.invoke.apply(r,U.from(arguments));i.focus&&r.invoke("editor.focus")}return this}});var Ht=function(){function r(t,e,o,n){this.sc=t,this.so=e,this.ec=o,this.eo=n,this.isOnEditable=this.makeIsOn(Lt.isEditable),this.isOnList=this.makeIsOn(Lt.isList),this.isOnAnchor=this.makeIsOn(Lt.isAnchor),this.isOnCell=this.makeIsOn(Lt.isCell),this.isOnData=this.makeIsOn(Lt.isData)}return r.prototype.nativeRange=function(){if(P.isW3CRangeSupport){var t=document.createRange();return t.setStart(this.sc,this.sc.data&&this.so>this.sc.data.length?0:this.so),t.setEnd(this.ec,this.sc.data?Math.min(this.eo,this.sc.data.length):this.eo),t}var e=Pt({node:this.sc,offset:this.so});return e.setEndPoint("EndToEnd",Pt({node:this.ec,offset:this.eo})),e},r.prototype.getPoints=function(){return{sc:this.sc,so:this.so,ec:this.ec,eo:this.eo}},r.prototype.getStartPoint=function(){return{node:this.sc,offset:this.so}},r.prototype.getEndPoint=function(){return{node:this.ec,offset:this.eo}},r.prototype.select=function(){var t=this.nativeRange();if(P.isW3CRangeSupport){var e=document.getSelection();0<e.rangeCount&&e.removeAllRanges(),e.addRange(t)}else t.select();return this},r.prototype.scrollIntoView=function(t){var e=C(t).height();return t.scrollTop+e<this.sc.offsetTop&&(t.scrollTop+=Math.abs(t.scrollTop+e-this.sc.offsetTop)),this},r.prototype.normalize=function(){var t=function(t,e){if(Lt.isVisiblePoint(t)&&(!Lt.isEdgePoint(t)||Lt.isRightEdgePoint(t)&&!e||Lt.isLeftEdgePoint(t)&&e||Lt.isRightEdgePoint(t)&&e&&Lt.isVoid(t.node.nextSibling)||Lt.isLeftEdgePoint(t)&&!e&&Lt.isVoid(t.node.previousSibling)||Lt.isBlock(t.node)&&Lt.isEmpty(t.node)))return t;var o=Lt.ancestor(t.node,Lt.isBlock);if((Lt.isLeftEdgePointOf(t,o)||Lt.isVoid(Lt.prevPoint(t).node))&&!e||(Lt.isRightEdgePointOf(t,o)||Lt.isVoid(Lt.nextPoint(t).node))&&e){if(Lt.isVisiblePoint(t))return t;e=!e}return(e?Lt.nextPointUntil(Lt.nextPoint(t),Lt.isVisiblePoint):Lt.prevPointUntil(Lt.prevPoint(t),Lt.isVisiblePoint))||t},e=t(this.getEndPoint(),!1),o=this.isCollapsed()?e:t(this.getStartPoint(),!0);return new r(o.node,o.offset,e.node,e.offset)},r.prototype.nodes=function(o,t){o=o||D.ok;var n=t&&t.includeAncestor,i=t&&t.fullyContains,e=this.getStartPoint(),r=this.getEndPoint(),s=[],a=[];return Lt.walkPoint(e,r,function(t){var e;Lt.isEditable(t.node)||(i?(Lt.isLeftEdgePoint(t)&&a.push(t.node),Lt.isRightEdgePoint(t)&&U.contains(a,t.node)&&(e=t.node)):e=n?Lt.ancestor(t.node,o):t.node,e&&o(e)&&s.push(e))},!0),U.unique(s)},r.prototype.commonAncestor=function(){return Lt.commonAncestor(this.sc,this.ec)},r.prototype.expand=function(t){var e=Lt.ancestor(this.sc,t),o=Lt.ancestor(this.ec,t);if(!e&&!o)return new r(this.sc,this.so,this.ec,this.eo);var n=this.getPoints();return e&&(n.sc=e,n.so=0),o&&(n.ec=o,n.eo=Lt.nodeLength(o)),new r(n.sc,n.so,n.ec,n.eo)},r.prototype.collapse=function(t){return t?new r(this.sc,this.so,this.sc,this.so):new r(this.ec,this.eo,this.ec,this.eo)},r.prototype.splitText=function(){var t=this.sc===this.ec,e=this.getPoints();return Lt.isText(this.ec)&&!Lt.isEdgePoint(this.getEndPoint())&&this.ec.splitText(this.eo),Lt.isText(this.sc)&&!Lt.isEdgePoint(this.getStartPoint())&&(e.sc=this.sc.splitText(this.so),e.so=0,t&&(e.ec=e.sc,e.eo=this.eo-this.so)),new r(e.sc,e.so,e.ec,e.eo)},r.prototype.deleteContents=function(){if(this.isCollapsed())return this;var t=this.splitText(),e=t.nodes(null,{fullyContains:!0}),n=Lt.prevPointUntil(t.getStartPoint(),function(t){return!U.contains(e,t.node)}),i=[];return C.each(e,function(t,e){var o=e.parentNode;n.node!==o&&1===Lt.nodeLength(o)&&i.push(o),Lt.remove(e,!1)}),C.each(i,function(t,e){Lt.remove(e,!1)}),new r(n.node,n.offset,n.node,n.offset).normalize()},r.prototype.makeIsOn=function(e){return function(){var t=Lt.ancestor(this.sc,e);return!!t&&t===Lt.ancestor(this.ec,e)}},r.prototype.isLeftEdgeOf=function(t){if(!Lt.isLeftEdgePoint(this.getStartPoint()))return!1;var e=Lt.ancestor(this.sc,t);return e&&Lt.isLeftEdgeOf(this.sc,e)},r.prototype.isCollapsed=function(){return this.sc===this.ec&&this.so===this.eo},r.prototype.wrapBodyInlineWithPara=function(){if(Lt.isBodyContainer(this.sc)&&Lt.isEmpty(this.sc))return this.sc.innerHTML=Lt.emptyPara,new r(this.sc.firstChild,0,this.sc.firstChild,0);var t,e=this.normalize();if(Lt.isParaInline(this.sc)||Lt.isPara(this.sc))return e;if(Lt.isInline(e.sc)){var o=Lt.listAncestor(e.sc,D.not(Lt.isInline));t=U.last(o),Lt.isInline(t)||(t=o[o.length-2]||e.sc.childNodes[e.so])}else t=e.sc.childNodes[0<e.so?e.so-1:0];var n=Lt.listPrev(t,Lt.isParaInline).reverse();if((n=n.concat(Lt.listNext(t.nextSibling,Lt.isParaInline))).length){var i=Lt.wrap(U.head(n),"p");Lt.appendChildNodes(i,U.tail(n))}return this.normalize()},r.prototype.insertNode=function(t){var e=this.wrapBodyInlineWithPara().deleteContents(),o=Lt.splitPoint(e.getStartPoint(),Lt.isInline(t));return o.rightNode?o.rightNode.parentNode.insertBefore(t,o.rightNode):o.container.appendChild(t),t},r.prototype.pasteHTML=function(t){var e=C("<div></div>").html(t)[0],o=U.from(e.childNodes),n=this.wrapBodyInlineWithPara().deleteContents();return 0<n.so&&(o=o.reverse()),o=o.map(function(t){return n.insertNode(t)}),0<n.so&&(o=o.reverse()),o},r.prototype.toString=function(){var t=this.nativeRange();return P.isW3CRangeSupport?t.toString():t.text},r.prototype.getWordRange=function(t){var e=this.getEndPoint();if(!Lt.isCharPoint(e))return this;var o=Lt.prevPointUntil(e,function(t){return!Lt.isCharPoint(t)});return t&&(e=Lt.nextPointUntil(e,function(t){return!Lt.isCharPoint(t)})),new r(o.node,o.offset,e.node,e.offset)},r.prototype.bookmark=function(t){return{s:{path:Lt.makeOffsetPath(t,this.sc),offset:this.so},e:{path:Lt.makeOffsetPath(t,this.ec),offset:this.eo}}},r.prototype.paraBookmark=function(t){return{s:{path:U.tail(Lt.makeOffsetPath(U.head(t),this.sc)),offset:this.so},e:{path:U.tail(Lt.makeOffsetPath(U.last(t),this.ec)),offset:this.eo}}},r.prototype.getClientRects=function(){return this.nativeRange().getClientRects()},r}(),Dt={create:function(t,e,o,n){if(4===arguments.length)return new Ht(t,e,o,n);if(2===arguments.length)return new Ht(o=t,n=e,o,n);var i=this.createFromSelection();return i||1!==arguments.length?i:(i=this.createFromNode(t)).collapse(Lt.emptyPara===t.innerHTML)},createFromSelection:function(){var t,e,o,n;if(P.isW3CRangeSupport){var i=document.getSelection();if(!i||0===i.rangeCount)return null;if(Lt.isBody(i.anchorNode))return null;var r=i.getRangeAt(0);t=r.startContainer,e=r.startOffset,o=r.endContainer,n=r.endOffset}else{var s=document.selection.createRange(),a=s.duplicate();a.collapse(!1);var l=s;l.collapse(!0);var c=Ft(l,!0),d=Ft(a,!1);Lt.isText(c.node)&&Lt.isLeftEdgePoint(c)&&Lt.isTextNode(d.node)&&Lt.isRightEdgePoint(d)&&d.node.nextSibling===c.node&&(c=d),t=c.cont,e=c.offset,o=d.cont,n=d.offset}return new Ht(t,e,o,n)},createFromNode:function(t){var e=t,o=0,n=t,i=Lt.nodeLength(n);return Lt.isVoid(e)&&(o=Lt.listPrev(e).length-1,e=e.parentNode),Lt.isBR(n)?(i=Lt.listPrev(n).length-1,n=n.parentNode):Lt.isVoid(n)&&(i=Lt.listPrev(n).length,n=n.parentNode),this.create(e,o,n,i)},createFromNodeBefore:function(t){return this.createFromNode(t).collapse(!0)},createFromNodeAfter:function(t){return this.createFromNode(t).collapse()},createFromBookmark:function(t,e){var o=Lt.fromOffsetPath(t,e.s.path),n=e.s.offset,i=Lt.fromOffsetPath(t,e.e.path),r=e.e.offset;return new Ht(o,n,i,r)},createFromParaBookmark:function(t,e){var o=t.s.offset,n=t.e.offset,i=Lt.fromOffsetPath(U.head(e),t.s.path),r=Lt.fromOffsetPath(U.last(e),t.e.path);return new Ht(i,o,r,n)}},Bt={BACKSPACE:8,TAB:9,ENTER:13,SPACE:32,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40,NUM0:48,NUM1:49,NUM2:50,NUM3:51,NUM4:52,NUM5:53,NUM6:54,NUM7:55,NUM8:56,B:66,E:69,I:73,J:74,K:75,L:76,R:82,S:83,U:85,V:86,Y:89,Z:90,SLASH:191,LEFTBRACKET:219,BACKSLASH:220,RIGHTBRACKET:221},zt={isEdit:function(t){return U.contains([Bt.BACKSPACE,Bt.TAB,Bt.ENTER,Bt.SPACE,Bt.DELETE],t)},isMove:function(t){return U.contains([Bt.LEFT,Bt.UP,Bt.RIGHT,Bt.DOWN],t)},nameFromCode:D.invertObject(Bt),code:Bt};var Mt=function(){function t(t){this.stack=[],this.stackOffset=-1,this.$editable=t,this.editable=t[0]}return t.prototype.makeSnapshot=function(){var t=Dt.create(this.editable);return{contents:this.$editable.html(),bookmark:t&&t.isOnEditable()?t.bookmark(this.editable):{s:{path:[],offset:0},e:{path:[],offset:0}}}},t.prototype.applySnapshot=function(t){null!==t.contents&&this.$editable.html(t.contents),null!==t.bookmark&&Dt.createFromBookmark(this.editable,t.bookmark).select()},t.prototype.rewind=function(){this.$editable.html()!==this.stack[this.stackOffset].contents&&this.recordUndo(),this.stackOffset=0,this.applySnapshot(this.stack[this.stackOffset])},t.prototype.commit=function(){this.stack=[],this.stackOffset=-1,this.recordUndo()},t.prototype.reset=function(){this.stack=[],this.stackOffset=-1,this.$editable.html(""),this.recordUndo()},t.prototype.undo=function(){this.$editable.html()!==this.stack[this.stackOffset].contents&&this.recordUndo(),0<this.stackOffset&&(this.stackOffset--,this.applySnapshot(this.stack[this.stackOffset]))},t.prototype.redo=function(){this.stack.length-1>this.stackOffset&&(this.stackOffset++,this.applySnapshot(this.stack[this.stackOffset]))},t.prototype.recordUndo=function(){this.stackOffset++,this.stack.length>this.stackOffset&&(this.stack=this.stack.slice(0,this.stackOffset)),this.stack.push(this.makeSnapshot())},t}(),Ot=function(){function t(){}return t.prototype.jQueryCSS=function(o,t){if(P.jqueryVersion<1.9){var n={};return C.each(t,function(t,e){n[e]=o.css(e)}),n}return o.css(t)},t.prototype.fromNode=function(t){var e=this.jQueryCSS(t,["font-family","font-size","text-align","list-style-type","line-height"])||{};return e["font-size"]=parseInt(e["font-size"],10),e},t.prototype.stylePara=function(t,o){C.each(t.nodes(Lt.isPara,{includeAncestor:!0}),function(t,e){C(e).css(o)})},t.prototype.styleNodes=function(t,e){t=t.splitText();var o=e&&e.nodeName||"SPAN",n=!(!e||!e.expandClosestSibling),i=!(!e||!e.onlyPartialContains);if(t.isCollapsed())return[t.insertNode(Lt.create(o))];var r=Lt.makePredByNodeName(o),s=t.nodes(Lt.isText,{fullyContains:!0}).map(function(t){return Lt.singleChildAncestor(t,r)||Lt.wrap(t,o)});if(n){if(i){var a=t.nodes();r=D.and(r,function(t){return U.contains(a,t)})}return s.map(function(t){var e=Lt.withClosestSiblings(t,r),o=U.head(e),n=U.tail(e);return C.each(n,function(t,e){Lt.appendChildNodes(o,e.childNodes),Lt.remove(e)}),U.head(e)})}return s},t.prototype.current=function(t){var e=C(Lt.isElement(t.sc)?t.sc:t.sc.parentNode),o=this.fromNode(e);try{o=C.extend(o,{"font-bold":document.queryCommandState("bold")?"bold":"normal","font-italic":document.queryCommandState("italic")?"italic":"normal","font-underline":document.queryCommandState("underline")?"underline":"normal","font-subscript":document.queryCommandState("subscript")?"subscript":"normal","font-superscript":document.queryCommandState("superscript")?"superscript":"normal","font-strikethrough":document.queryCommandState("strikethrough")?"strikethrough":"normal","font-family":document.queryCommandValue("fontname")||o["font-family"]})}catch(t){}if(t.isOnList()){var n=-1<["circle","disc","disc-leading-zero","square"].indexOf(o["list-style-type"]);o["list-style"]=n?"unordered":"ordered"}else o["list-style"]="none";var i=Lt.ancestor(t.sc,Lt.isPara);if(i&&i.style["line-height"])o["line-height"]=i.style.lineHeight;else{var r=parseInt(o["line-height"],10)/parseInt(o["font-size"],10);o["line-height"]=r.toFixed(1)}return o.anchor=t.isOnAnchor()&&Lt.ancestor(t.sc,Lt.isAnchor),o.ancestors=Lt.listAncestor(t.sc,Lt.isEditable),o.range=t,o},t}(),Ut=function(){function t(){}return t.prototype.insertOrderedList=function(t){this.toggleList("OL",t)},t.prototype.insertUnorderedList=function(t){this.toggleList("UL",t)},t.prototype.indent=function(t){var i=this,e=Dt.create(t).wrapBodyInlineWithPara(),o=e.nodes(Lt.isPara,{includeAncestor:!0}),n=U.clusterBy(o,D.peq2("parentNode"));C.each(n,function(t,e){var o=U.head(e);if(Lt.isLi(o)){var n=i.findList(o.previousSibling);n?e.map(function(t){return n.appendChild(t)}):(i.wrapList(e,o.parentNode.nodeName),e.map(function(t){return t.parentNode}).map(function(t){return i.appendToPrevious(t)}))}else C.each(e,function(t,e){C(e).css("marginLeft",function(t,e){return(parseInt(e,10)||0)+25})})}),e.select()},t.prototype.outdent=function(t){var n=this,e=Dt.create(t).wrapBodyInlineWithPara(),o=e.nodes(Lt.isPara,{includeAncestor:!0}),i=U.clusterBy(o,D.peq2("parentNode"));C.each(i,function(t,e){var o=U.head(e);Lt.isLi(o)?n.releaseList([e]):C.each(e,function(t,e){C(e).css("marginLeft",function(t,e){return 25<(e=parseInt(e,10)||0)?e-25:""})})}),e.select()},t.prototype.toggleList=function(o,t){var n=this,e=Dt.create(t).wrapBodyInlineWithPara(),i=e.nodes(Lt.isPara,{includeAncestor:!0}),r=e.paraBookmark(i),s=U.clusterBy(i,D.peq2("parentNode"));if(U.find(i,Lt.isPurePara)){var a=[];C.each(s,function(t,e){a=a.concat(n.wrapList(e,o))}),i=a}else{var l=e.nodes(Lt.isList,{includeAncestor:!0}).filter(function(t){return!C.nodeName(t,o)});l.length?C.each(l,function(t,e){Lt.replace(e,o)}):i=this.releaseList(s,!0)}Dt.createFromParaBookmark(r,i).select()},t.prototype.wrapList=function(t,e){var o=U.head(t),n=U.last(t),i=Lt.isList(o.previousSibling)&&o.previousSibling,r=Lt.isList(n.nextSibling)&&n.nextSibling,s=i||Lt.insertAfter(Lt.create(e||"UL"),n);return t=t.map(function(t){return Lt.isPurePara(t)?Lt.replace(t,"LI"):t}),Lt.appendChildNodes(s,t),r&&(Lt.appendChildNodes(s,U.from(r.childNodes)),Lt.remove(r)),t},t.prototype.releaseList=function(t,c){var d=this,u=[];return C.each(t,function(t,e){var o=U.head(e),n=U.last(e),i=c?Lt.lastAncestor(o,Lt.isList):o.parentNode,r=i.parentNode;if("LI"===i.parentNode.nodeName)e.map(function(t){var e=