Files
espocrm/client/lib/summernote.js
2026-01-19 17:46:06 +01:00

13 lines
167 KiB
JavaScript

/*!
*
* Super simple WYSIWYG editor v0.9.1
* https://summernote.org
*
* Copyright 2013~ Hackerwins and contributors
* Summernote may be freely distributed under the MIT license.
*
* Date: 2024-10-09T10:28Z
*
*/
((t,e)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("jquery"));else if("function"==typeof define&&define.amd)define(["jquery"],e);else{var o,n="object"==typeof exports?e(require("jquery")):e(t.jQuery);for(o in n)("object"==typeof exports?exports:t)[o]=n[o]}})(self,V=>{{var _={7e3:(t,e,o)=>{var n=o(8938),n=o.n(n);n().summernote=n().summernote||{lang:{}};n().extend(!0,n().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",sizeunit:"Font Size Unit"},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, Google Drive, Vimeo, Vine, Instagram, DailyMotion, Youku, Peertube)"},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:"Text 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:{escape:"Escape",insertParagraph:"Insert Paragraph",undo:"Undo the last command",redo:"Redo 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"},output:{noSelection:"No Selection Made!"}}})},8938:t=>{t.exports=V}},G={};function i(t){var e=G[t];if(void 0!==e)return e.exports;e=G[t]={exports:{}};_[t](e,e.exports,i);return e.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;i.d(e,{a:e});return e};i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})};i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r=i(8938),w=i.n(r),Z=(i(7e3),["sans-serif","serif","monospace","cursive","fantasy"]);function Y(t){return-1===w().inArray(t.toLowerCase(),Z)?"'".concat(t,"'"):t}var r=navigator.userAgent,a=/MSIE|Trident/i.test(r);if(a){var f=/MSIE (\d+[.]\d+)/.exec(r);f&&(Qt=parseFloat(f[1]));f=/Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(r);f&&(Qt=parseFloat(f[1]))}let t=/Edge\/\d+/.test(r),e="ontouchstart"in window||0<navigator.MaxTouchPoints||0<navigator.msMaxTouchPoints,o=a?"DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted":"input",c={isMac:-1<navigator.appVersion.indexOf("Mac"),isMSIE:a,isEdge:t,isFF:!t&&/firefox/i.test(r),isPhantom:/PhantomJS/i.test(r),isWebkit:!t&&/webkit/i.test(r),isChrome:!t&&/chrome/i.test(r),isSafari:!t&&/safari/i.test(r)&&!/chrome/i.test(r),browserVersion:Qt,isSupportTouch:e,isFontInstalled:(()=>{var t=document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});t.width=40;t.height=20;n.textAlign="center";n.fillStyle="black";n.textBaseline="middle";function i(t,e){n.clearRect(0,0,40,20);n.font="20px "+Y(t)+', "'+e+'"';n.fillText("mw",20,10);var o=n.getImageData(0,0,40,20).data;return o.join("")}return function(t){var e="Comic Sans MS"===t?"Courier New":"Comic Sans MS",o=i(e,e),e=i(t,e);return o!==e}})(),isW3CRangeSupport:!!document.createRange,inputEventName:o,genericFontFamilies:Z,validFontName:Y};var X=0;let u={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)}},resetUniqueId:function(){X=0},uniqueId:function(t){var e=++X+"";return t?t+e:e},rect2bnd:function(t){var e=w()(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,o={};for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(o[t[e]]=e);return o},namespaceToCamel:function(t,e){e=e||"";return e+t.split(".").map(function(t){return t.substring(0,1).toUpperCase()+t.substring(1)}).join("")},debounce:function(n,i,r){var a;return function(){var t=this,e=arguments,o=r&&!a;clearTimeout(a);a=setTimeout(function(){a=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 Q(t){return t[0]}function J(t){return t[t.length-1]}function tt(t){return t.slice(1)}function et(t,e){if(t&&t.length&&e){if(t.indexOf)return-1!==t.indexOf(e);if(t.contains)return t.contains(e)}return!1}let d={head:Q,last:J,initial:function(t){return t.slice(0,t.length-1)},tail:tt,prev:function(t,e){var o;return!(t&&t.length&&e)||(o=t.indexOf(e),-1===o)?null:t[o-1]},next:function(t,e){var o;return!(t&&t.length&&e)||(o=t.indexOf(e),-1===o)?null:t[o+1]},find:function(t,e){for(var o=0,n=t.length;o<n;o++){var i=t[o];if(e(i))return i}},contains:et,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){o=o||u.self;return 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){var e;return t.length?(e=tt(t),e.reduce(function(t,e){var o=J(t);n(J(o),e)?o[o.length]=e:t[t.length]=[e];return t},[[t[0]]])):[]},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++)et(e,t[o])||e.push(t[o]);return e}};var ot=String.fromCharCode(160);function p(t){return t&&w()(t).hasClass("note-editable")}function m(e){e=e.toUpperCase();return function(t){return t&&t.nodeName.toUpperCase()===e}}function v(t){return t&&3===t.nodeType}function nt(t){return t&&/^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT|^AUDIO|^VIDEO|^EMBED/.test(t.nodeName.toUpperCase())}function g(t){return!p(t)&&t&&/^DIV|^P|^LI|^H[1-7]/.test(t.nodeName.toUpperCase())}var f=m("PRE"),it=m("LI"),rt=m("TABLE"),at=m("DATA");function st(t){return!(ft(t)||lt(t)||ct(t)||g(t)||rt(t)||dt(t)||at(t))}function lt(t){return t&&/^UL|^OL/.test(t.nodeName.toUpperCase())}var ct=m("HR");function ut(t){return t&&/^TD|^TH/.test(t.nodeName.toUpperCase())}var dt=m("BLOCKQUOTE");function ft(t){return ut(t)||dt(t)||p(t)}a=m("A");r=m("BODY");var ht=c.isMSIE&&c.browserVersion<11?"&nbsp;":"<br>";function b(t){return v(t)?t.nodeValue.length:t?t.childNodes.length:0}function y(t){var e=b(t);return 0===e||!v(t)&&1===e&&t.innerHTML===ht||!(!d.all(t.childNodes,v)||""!==t.innerHTML)}function pt(t){nt(t)||b(t)||(t.innerHTML=ht)}function mt(t,e){for(;t;){if(e(t))return t;if(p(t))break;t=t.parentNode}return null}function k(t,e){e=e||u.fail;var o=[];mt(t,function(t){p(t)||o.push(t);return e(t)});return o}function vt(t,e){e=e||u.fail;for(var o=[];t&&!e(t);){o.push(t);t=t.nextSibling}return o}function gt(t,e){var o=e.nextSibling,n=e.parentNode;o?n.insertBefore(t,o):n.appendChild(t);return t}function bt(o,t,n){w().each(t,function(t,e){!n&&it(o)&&null===o.firstChild&&lt(e)&&o.appendChild(It("br"));o.appendChild(e)});return o}function yt(t){return 0===t.offset}function C(t){return t.offset===b(t.node)}function kt(t){return yt(t)||C(t)}function wt(t,e){for(;t&&t!==e;){if(0!==S(t))return!1;t=t.parentNode}return!0}function Ct(t,e){if(!e)return!1;for(;t&&t!==e;){if(S(t)!==b(t.parentNode)-1)return!1;t=t.parentNode}return!0}function S(t){for(var e=0;t=t.previousSibling;)e+=1;return e}function x(t){return!!(t&&t.childNodes&&t.childNodes.length)}function St(t,e){var o,n;if(0===t.offset){if(p(t.node))return null;o=t.node.parentNode;n=S(t.node)}else if(x(t.node)){o=t.node.childNodes[t.offset-1];n=b(o)}else{o=t.node;n=e?0:t.offset-1}return{node:o,offset:n}}function xt(t,e){var o,n;if(b(t.node)===t.offset){if(p(t.node))return null;var i=function t(e){if(!e.nextSibling)return;if(e.parent!==e.nextSibling.parent)return;return v(e.nextSibling)?e.nextSibling:t(e.nextSibling)}(t.node);if(i){o=i;n=0}else{o=t.node.parentNode;n=S(t.node)+1}}else if(x(t.node)){o=t.node.childNodes[t.offset];n=0}else{o=t.node;n=e?b(t.node):t.offset+1}return{node:o,offset:n}}function Et(t,e){var o,n=0;if(b(t.node)===t.offset){if(p(t.node))return null;o=t.node.parentNode;n=S(t.node)+1;if(p(o)){o=t.node.nextSibling;n=0}}else if(x(t.node)){o=t.node.childNodes[t.offset];n=0}else{o=t.node;n=e?b(t.node):t.offset+1}return{node:o,offset:n}}function Tt(t,e){return t.node===e.node&&t.offset===e.offset}function Pt(t,e){var o=e&&e.isSkipPaddingBlankHTML,n=e&&e.isNotSplitEdgePoint,i=e&&e.isDiscardEmptySplits;i&&(o=!0);if(kt(t)&&(v(t.node)||n)){if(yt(t))return t.node;if(C(t))return t.node.nextSibling}if(v(t.node))return t.node.splitText(t.offset);var n=t.node.childNodes[t.offset],n=vt(n),r=gt(t.node.cloneNode(!1),t.node);bt(r,n);if(!o){pt(t.node);pt(r)}if(i){y(t.node)&&E(t.node);if(y(r))return E(r),t.node.nextSibling}return r}function Nt(t,o,n){var e=k(o.node,u.eq(t));if(!e.length)return null;if(1===e.length)return Pt(o,n);if(2<e.length){var i=e.slice(0,e.length-1),i=i.find(function(t){return t.nextSibling});if(i&&0!=o.offset&&C(o)){var r,i=i.nextSibling;if(1==i.nodeType){r=i.childNodes[0];e=k(r,u.eq(t));o={node:r,offset:0}}else if(3==i.nodeType&&!i.data.match(/[\n\r]/g)){r=i;e=k(r,u.eq(t));o={node:r,offset:0}}}}return e.reduce(function(t,e){t===o.node&&(t=Pt(o,n));return Pt({node:e,offset:t?S(t):b(e)},n)})}function It(t){return document.createElement(t)}function E(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(var a=0,s=n.length;a<s;a++)o.insertBefore(n[a],t)}o.removeChild(t)}}var $t=m("TEXTAREA");function Rt(t,e){var o=$t(t[0])?t.val():t.html();return e?o.replace(/[\n\r]/g,""):o}let h={NBSP_CHAR:ot,ZERO_WIDTH_NBSP_CHAR:"\ufeff",blank:ht,emptyPara:"<p>".concat(ht,"</p>"),makePredByNodeName:m,isEditable:p,isControlSizing:function(t){return t&&w()(t).hasClass("note-control-sizing")},isText:v,isElement:function(t){return t&&1===t.nodeType},isVoid:nt,isPara:g,isPurePara:function(t){return g(t)&&!it(t)},isHeading:function(t){return t&&/^H[1-7]/.test(t.nodeName.toUpperCase())},isInline:st,isBlock:u.not(st),isBodyInline:function(t){return st(t)&&!mt(t,g)},isBody:r,isParaInline:function(t){return st(t)&&!!mt(t,g)},isPre:f,isList:lt,isTable:rt,isData:at,isCell:ut,isBlockquote:dt,isBodyContainer:ft,isAnchor:a,isDiv:m("DIV"),isLi:it,isBR:m("BR"),isSpan:m("SPAN"),isB:m("B"),isU:m("U"),isS:m("S"),isI:m("I"),isImg:m("IMG"),isTextarea:$t,deepestChildIsEmpty:function(t){do{if(null===t.firstElementChild||""===t.firstElementChild.innerHTML)break}while(t=t.firstElementChild);return y(t)},isEmpty:y,isEmptyAnchor:u.and(a,y),isClosestSibling:function(t,e){return t.nextSibling===e||t.previousSibling===e},withClosestSiblings:function(t,e){e=e||u.ok;var o=[];t.previousSibling&&e(t.previousSibling)&&o.push(t.previousSibling);o.push(t);t.nextSibling&&e(t.nextSibling)&&o.push(t.nextSibling);return o},nodeLength:b,isLeftEdgePoint:yt,isRightEdgePoint:C,isEdgePoint:kt,isLeftEdgeOf:wt,isRightEdgeOf:Ct,isLeftEdgePointOf:function(t,e){return yt(t)&&wt(t.node,e)},isRightEdgePointOf:function(t,e){return C(t)&&Ct(t.node,e)},prevPoint:St,nextPoint:xt,nextPointWithEmptyNode:Et,isSamePoint:Tt,isVisiblePoint:function(t){var e,o;return!(!v(t.node)&&x(t.node)&&!y(t.node)&&(e=t.node.childNodes[t.offset-1],o=t.node.childNodes[t.offset],e&&!nt(e)||o&&!nt(o))&&!rt(o))},prevPointUntil:function(t,e){for(;t;){if(e(t))return t;t=St(t)}return null},nextPointUntil:function(t,e){for(;t;){if(e(t))return t;t=xt(t)}return null},isCharPoint:function(t){var e;return!!v(t.node)&&(e=t.node.nodeValue.charAt(t.offset-1),e)&&" "!==e&&e!==ot},isSpacePoint:function(t){var e;return!!v(t.node)&&(e=t.node.nodeValue.charAt(t.offset-1)," "===e||e===ot)},walkPoint:function(t,e,o,n){for(var i=t;i&&i.node;){o(i);if(Tt(i,e))break;var r=n&&t.node!==i.node&&e.node!==i.node,i=Et(i,r)}},ancestor:mt,singleChildAncestor:function(t,e){t=t.parentNode;for(;t&&1===b(t);){if(e(t))return t;if(p(t))break;t=t.parentNode}return null},listAncestor:k,lastAncestor:function(t,e){var o=k(t);return d.last(o.filter(e))},listNext:vt,listPrev:function(t,e){e=e||u.fail;for(var o=[];t&&!e(t);){o.push(t);t=t.previousSibling}return o},listDescendant:function(i,r){var a=[];r=r||u.ok;!function t(e){i!==e&&r(e)&&a.push(e);for(var o=0,n=e.childNodes.length;o<n;o++)t(e.childNodes[o])}(i);return a},commonAncestor:function(t,e){for(var o=k(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=w()("<"+e+">")[0];o.insertBefore(n,t);n.appendChild(t);return n},insertAfter:gt,appendChildNodes:bt,position:S,hasChildren:x,makeOffsetPath:function(t,e){var o=k(e,u.eq(t));return o.map(S).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:Nt,splitPoint:function(t,e){var o,n,i=e?g:ft,r=k(t.node,i),a=d.last(r)||t.node;if(i(a)){o=r[r.length-2];n=a}else{o=a;n=o.parentNode}i=o&&Nt(o,t,{isSkipPaddingBlankHTML:e,isNotSplitEdgePoint:e});i||n!==t.node||(i=t.node.childNodes[t.offset]);return{rightNode:i,container:n}},create:It,createText:function(t){return document.createTextNode(t)},remove:E,removeWhile:function(t,e){for(;t&&!p(t)&&e(t);){var o=t.parentNode;E(t);t=o}},replace:function(t,e){if(t.nodeName.toUpperCase()===e.toUpperCase())return t;var o=It(e);t.style.cssText&&(o.style.cssText=t.style.cssText);bt(o,d.from(t.childNodes));gt(o,t);E(t);return o},html:function(t,e){var o=Rt(t);if(e){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":"")});o=o.trim()}return o},value:Rt,posFromPlaceholder:function(t){var e=w()(t),o=e.offset(),e=e.outerHeight(!0);return{left:o.left,top:o.top+e}},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)&&d.contains(t.classList,"note-styletag")}};function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function At(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=T(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=T(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==T(n)?n:n+""),r)}}var Lt=(()=>{return t=function t(e,o){var n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.$note=e;this.memos={};this.modules={};this.layoutInfo={};this.options=w().extend(!0,{},o);w().summernote.ui=w().summernote.ui_template(this.options);this.ui=w().summernote.ui;this.initialize()},e=[{key:"initialize",value:function(){this.layoutInfo=this.ui.createLayout(this.$note);this._initialize();this.$note.hide();return this}},{key:"destroy",value:function(){this._destroy();this.$note.removeData("summernote");this.ui.removeLayout(this.$note,this.layoutInfo)}},{key:"reset",value:function(){var t=this.isDisabled();this.code(h.emptyPara);this._destroy();this._initialize();t&&this.disable()}},{key:"_initialize",value:function(){var e=this;this.options.id=u.uniqueId(w().now());this.options.container=this.options.container||this.layoutInfo.editor;var o=w().extend({},this.options.buttons),n=(Object.keys(o).forEach(function(t){e.memo("button."+t,o[t])}),w().extend({},this.options.modules,w().summernote.plugins||{}));Object.keys(n).forEach(function(t){e.module(t,n[t],!0)});Object.keys(this.modules).forEach(function(t){e.initializeModule(t)})}},{key:"_destroy",value: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)}},{key:"code",value: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.invoke("codeview.sync",t):this.layoutInfo.editable.html(t);this.$note.val(t);this.triggerEvent("change",t,this.layoutInfo.editable)}},{key:"isDisabled",value:function(){return"false"===this.layoutInfo.editable.attr("contenteditable")}},{key:"enable",value:function(){this.layoutInfo.editable.attr("contenteditable",!0);this.invoke("toolbar.activate",!0);this.triggerEvent("disable",!1);this.options.editing=!0}},{key:"disable",value:function(){this.invoke("codeview.isActivated")&&this.invoke("codeview.deactivate");this.layoutInfo.editable.attr("contenteditable",!1);this.options.editing=!1;this.invoke("toolbar.deactivate",!0);this.triggerEvent("disable",!0)}},{key:"triggerEvent",value:function(){var t=d.head(arguments),e=d.tail(d.from(arguments)),o=this.options.callbacks[u.namespaceToCamel(t,"on")];o&&o.apply(this.$note[0],e);this.$note.trigger("summernote."+t,e)}},{key:"initializeModule",value:function(t){var e=this.modules[t];e.shouldInitialize=e.shouldInitialize||u.ok;if(e.shouldInitialize()){e.initialize&&e.initialize();e.events&&h.attachEvents(this.$note,e.events)}}},{key:"module",value:function(t,e,o){if(1===arguments.length)return this.modules[t];this.modules[t]=new e(this);o||this.initializeModule(t)}},{key:"removeModule",value:function(t){var e=this.modules[t];if(e.shouldInitialize()){e.events&&h.detachEvents(this.$note,e.events);e.destroy&&e.destroy()}delete this.modules[t]}},{key:"memo",value:function(t,e){if(1===arguments.length)return this.memos[t];this.memos[t]=e}},{key:"removeMemo",value:function(t){this.memos[t]&&this.memos[t].destroy&&this.memos[t].destroy();delete this.memos[t]}},{key:"createInvokeHandlerAndUpdateState",value:function(e,o){var n=this;return function(t){n.createInvokeHandler(e,o)(t);n.invoke("buttons.updateCurrentStyle")}}},{key:"createInvokeHandler",value:function(o,n){var i=this;return function(t){t.preventDefault();var e=w()(t.target);i.invoke(o,n||e.closest("[data-value]").data("value"),e)}}},{key:"invoke",value:function(){var t=d.head(arguments),e=d.tail(d.from(arguments)),t=t.split("."),o=1<t.length,n=o&&d.head(t),o=o?d.last(t):d.head(t),t=this.modules[n||"editor"];return!n&&this[o]?this[o].apply(this,e):t&&t[o]&&t.shouldInitialize()?t[o].apply(t,e):void 0}}],e&&At(t.prototype,e),o&&At(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function Ft(t){return Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}w().fn.extend({summernote:function(){var t=Ft(d.head(arguments)),e="string"===t,t="object"===t,i=w().extend({},w().summernote.options,t?d.head(arguments):{});i.langInfo=w().extend(!0,{},w().summernote.lang["en-US"],w().summernote.lang[i.lang]);i.icons=w().extend(!0,{},w().summernote.options.icons,i.icons);i.tooltip="auto"===i.tooltip?!c.isSupportTouch:i.tooltip;this.each(function(t,e){var o=w()(e);if(!o.data("summernote")){var n=new Lt(o,i);o.data("summernote",n);o.data("summernote").triggerEvent("init",n.layoutInfo)}});t=this.first();if(t.length){t=t.data("summernote");if(e)return t.invoke.apply(t,d.from(arguments));i.focus&&t.invoke("editor.focus")}return this}});function P(t){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(t)}function Dt(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=P(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=P(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==P(n)?n:n+""),r)}}function Ht(t,e){for(var o,n=t.parentElement(),i=document.body.createTextRange(),r=d.from(n.childNodes),a=0;a<r.length;a++)if(!h.isText(r[a])){i.moveToElementText(r[a]);if(0<=i.compareEndPoints("StartToStart",t))break;o=r[a]}if(0!==a&&h.isText(r[a-1])){var s=document.body.createTextRange(),l=null;s.moveToElementText(o||n);s.collapse(!o);for(var l=o?o.nextSibling:n.firstChild,c=t.duplicate(),u=(c.setEndPoint("StartToStart",s),c.text.replace(/[\r\n]/g,"").length);u>l.nodeValue.length&&l.nextSibling;){u-=l.nodeValue.length;l=l.nextSibling}l.nodeValue;if(e&&l.nextSibling&&h.isText(l.nextSibling)&&u===l.nodeValue.length){u-=l.nodeValue.length;l=l.nextSibling}n=l;a=u}return{cont:n,offset:a}}function jt(t){function r(t,e){if(h.isText(t)){var o=h.listPrev(t,u.not(h.isText)),n=d.last(o).previousSibling,i=n||t.parentNode;e+=d.sum(d.tail(o),h.nodeLength);o=!n}else{i=t.childNodes[e]||t;if(h.isText(i))return r(i,0);e=0;o=!1}return{node:i,collapseToStart:o,offset:e}}var e=document.body.createTextRange(),o=r(t.node,t.offset);e.moveToElementText(o.node);e.collapse(o.collapseToStart);e.moveStart("character",o.offset);return e}var N=(()=>{function a(t,e,o,n){var i=this,r=a;if(!(i instanceof r))throw new TypeError("Cannot call a class as a function");this.sc=t;this.so=e;this.ec=o;this.eo=n;this.isOnEditable=this.makeIsOn(h.isEditable);this.isOnList=this.makeIsOn(h.isList);this.isOnAnchor=this.makeIsOn(h.isAnchor);this.isOnCell=this.makeIsOn(h.isCell);this.isOnData=this.makeIsOn(h.isData)}return t=a,e=[{key:"nativeRange",value:function(){if(c.isW3CRangeSupport){var t=document.createRange();t.setStart(this.sc,this.so);t.setEnd(this.ec,this.eo);return t}t=jt({node:this.sc,offset:this.so});t.setEndPoint("EndToEnd",jt({node:this.ec,offset:this.eo}));return t}},{key:"getPoints",value:function(){return{sc:this.sc,so:this.so,ec:this.ec,eo:this.eo}}},{key:"getStartPoint",value:function(){return{node:this.sc,offset:this.so}}},{key:"getEndPoint",value:function(){return{node:this.ec,offset:this.eo}}},{key:"select",value:function(){var t=this.nativeRange();if(c.isW3CRangeSupport){var e=document.getSelection();0<e.rangeCount&&e.removeAllRanges();e.addRange(t)}else t.select();return this}},{key:"scrollIntoView",value:function(t){var e=w()(t).height();t.scrollTop+e<this.sc.offsetTop&&(t.scrollTop+=Math.abs(t.scrollTop+e-this.sc.offsetTop));return this}},{key:"normalize",value:function(){function t(t,e){if(!t)return t;if(h.isVisiblePoint(t)&&(!h.isEdgePoint(t)||h.isRightEdgePoint(t)&&!e||h.isLeftEdgePoint(t)&&e||h.isRightEdgePoint(t)&&e&&h.isVoid(t.node.nextSibling)||h.isLeftEdgePoint(t)&&!e&&h.isVoid(t.node.previousSibling)||h.isBlock(t.node)&&h.isEmpty(t.node)))return t;var o,n=h.ancestor(t.node,h.isBlock),i=!1,r=(i||(r=h.prevPoint(t)||{node:null},i=(h.isLeftEdgePointOf(t,n)||h.isVoid(r.node))&&!e),!1);r||(o=h.nextPoint(t)||{node:null},r=(h.isRightEdgePointOf(t,n)||h.isVoid(o.node))&&e);if(i||r){if(h.isVisiblePoint(t))return t;e=!e}n=e?h.nextPointUntil(h.nextPoint(t),h.isVisiblePoint):h.prevPointUntil(h.prevPoint(t),h.isVisiblePoint);return n||t}var e=t(this.getEndPoint(),!1),o=this.isCollapsed()?e:t(this.getStartPoint(),!0);return new a(o.node,o.offset,e.node,e.offset)}},{key:"nodes",value:function(o,t){o=o||u.ok;var n=t&&t.includeAncestor,i=t&&t.fullyContains,e=this.getStartPoint(),r=this.getEndPoint(),a=[],s=[];h.walkPoint(e,r,function(t){if(!h.isEditable(t.node)){var e;if(i){h.isLeftEdgePoint(t)&&s.push(t.node);h.isRightEdgePoint(t)&&d.contains(s,t.node)&&(e=t.node)}else e=n?h.ancestor(t.node,o):t.node;e&&o(e)&&a.push(e)}},!0);return d.unique(a)}},{key:"commonAncestor",value:function(){return h.commonAncestor(this.sc,this.ec)}},{key:"expand",value:function(t){var e=h.ancestor(this.sc,t),o=h.ancestor(this.ec,t);if(!e&&!o)return new a(this.sc,this.so,this.ec,this.eo);var n=this.getPoints();if(e){n.sc=e;n.so=0}if(o){n.ec=o;n.eo=h.nodeLength(o)}return new a(n.sc,n.so,n.ec,n.eo)}},{key:"collapse",value:function(t){return t?new a(this.sc,this.so,this.sc,this.so):new a(this.ec,this.eo,this.ec,this.eo)}},{key:"splitText",value:function(){var t=this.sc===this.ec,e=this.getPoints();h.isText(this.ec)&&!h.isEdgePoint(this.getEndPoint())&&this.ec.splitText(this.eo);if(h.isText(this.sc)&&!h.isEdgePoint(this.getStartPoint())){e.sc=this.sc.splitText(this.so);e.so=0;if(t){e.ec=e.sc;e.eo=this.eo-this.so}}return new a(e.sc,e.so,e.ec,e.eo)}},{key:"deleteContents",value:function(){if(this.isCollapsed())return this;var t=this.splitText(),e=t.nodes(null,{fullyContains:!0}),n=h.prevPointUntil(t.getStartPoint(),function(t){return!d.contains(e,t.node)}),i=[];w().each(e,function(t,e){var o=e.parentNode;n.node!==o&&1===h.nodeLength(o)&&i.push(o);h.remove(e,!1)});w().each(i,function(t,e){h.remove(e,!1)});return new a(n.node,n.offset,n.node,n.offset).normalize()}},{key:"makeIsOn",value:function(e){return function(){var t=h.ancestor(this.sc,e);return!!t&&t===h.ancestor(this.ec,e)}}},{key:"isLeftEdgeOf",value:function(t){var e;return!!h.isLeftEdgePoint(this.getStartPoint())&&(e=h.ancestor(this.sc,t),e)&&h.isLeftEdgeOf(this.sc,e)}},{key:"isCollapsed",value:function(){return this.sc===this.ec&&this.so===this.eo}},{key:"wrapBodyInlineWithPara",value:function(){if(h.isBodyContainer(this.sc)&&h.isEmpty(this.sc))return this.sc.innerHTML=h.emptyPara,new a(this.sc.firstChild,0,this.sc.firstChild,0);var t=this.normalize();if(h.isParaInline(this.sc)||h.isPara(this.sc))return t;if(h.isInline(t.sc)){var e=h.listAncestor(t.sc,u.not(h.isInline)),o=d.last(e);h.isInline(o)||(o=e[e.length-2]||t.sc.childNodes[t.so])}else o=t.sc.childNodes[0<t.so?t.so-1:0];if(o){e=h.listPrev(o,h.isParaInline).reverse(),e=e.concat(h.listNext(o.nextSibling,h.isParaInline));if(e.length){t=h.wrap(d.head(e),"p");h.appendChildNodes(t,d.tail(e))}}return this.normalize()}},{key:"insertNode",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=this,o=((h.isText(t)||h.isInline(t))&&(o=this.wrapBodyInlineWithPara().deleteContents()),h.splitPoint(o.getStartPoint(),h.isInline(t)));if(o.rightNode){o.rightNode.parentNode.insertBefore(t,o.rightNode);h.isEmpty(o.rightNode)&&(e||h.isPara(t))&&o.rightNode.parentNode.removeChild(o.rightNode)}else o.container.appendChild(t);return t}},{key:"pasteHTML",value:function(t){t=((t||"")+"").trim(t);var e=w()("<div></div>").html(t)[0],e=d.from(e.childNodes),o=this,n=!1;if(0<=o.so){e=e.reverse();n=!0}e=e.map(function(t){return o.insertNode(t,!h.isInline(t))});n&&(e=e.reverse());return e}},{key:"toString",value:function(){var t=this.nativeRange();return c.isW3CRangeSupport?t.toString():t.text}},{key:"getWordRange",value:function(t){var e=this.getEndPoint();if(!h.isCharPoint(e))return this;var o=h.prevPointUntil(e,function(t){return!h.isCharPoint(t)});t&&(e=h.nextPointUntil(e,function(t){return!h.isCharPoint(t)}));return new a(o.node,o.offset,e.node,e.offset)}},{key:"getWordsRange",value:function(t){function e(t){return!h.isCharPoint(t)&&!h.isSpacePoint(t)}var o=this.getEndPoint();if(e(o))return this;var n=h.prevPointUntil(o,e);t&&(o=h.nextPointUntil(o,e));return new a(n.node,n.offset,o.node,o.offset)}},{key:"getWordsMatchRange",value:function(o){var n=this.getEndPoint(),t=h.prevPointUntil(n,function(t){var e;return!h.isCharPoint(t)&&!h.isSpacePoint(t)||(e=new a(t.node,t.offset,n.node,n.offset),e=o.exec(e.toString()),e&&0===e.index)}),t=new a(t.node,t.offset,n.node,n.offset),e=t.toString(),i=o.exec(e);return i&&i[0].length===e.length?t:null}},{key:"bookmark",value:function(t){return{s:{path:h.makeOffsetPath(t,this.sc),offset:this.so},e:{path:h.makeOffsetPath(t,this.ec),offset:this.eo}}}},{key:"paraBookmark",value:function(t){return{s:{path:d.tail(h.makeOffsetPath(d.head(t),this.sc)),offset:this.so},e:{path:d.tail(h.makeOffsetPath(d.last(t),this.ec)),offset:this.eo}}}},{key:"getClientRects",value:function(){var t=this.nativeRange();return t.getClientRects()}}],e&&Dt(t.prototype,e),o&&Dt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();let l={create:function(t,e,o,n){if(4===arguments.length)return new N(t,e,o,n);if(2===arguments.length){o=t;n=e;return new N(t,e,o,n)}var i=this.createFromSelection();if(i||1!==arguments.length)return i;i=t;h.isEditable(i)&&(i=i.lastChild);return this.createFromBodyElement(i,h.emptyPara===t.innerHTML)},createFromBodyElement:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=this.createFromNode(t);return o.collapse(e)},createFromSelection:function(){if(c.isW3CRangeSupport){var t=document.getSelection();if(!t||0===t.rangeCount)return null;if(h.isBody(t.anchorNode))return null;var t=t.getRangeAt(0),e=t.startContainer,o=t.startOffset,n=t.endContainer,t=t.endOffset}else{var i=document.selection.createRange(),r=i.duplicate(),i=(r.collapse(!1),i.collapse(!0),Ht(i,!0)),r=Ht(r,!1);h.isText(i.node)&&h.isLeftEdgePoint(i)&&h.isTextNode(r.node)&&h.isRightEdgePoint(r)&&r.node.nextSibling===i.node&&(i=r);e=i.cont;o=i.offset;n=r.cont;t=r.offset}return new N(e,o,n,t)},createFromNode:function(t){var e=t,o=0,n=t,i=h.nodeLength(n);if(h.isVoid(e)){o=h.listPrev(e).length-1;e=e.parentNode}if(h.isBR(n)){i=h.listPrev(n).length-1;n=n.parentNode}else if(h.isVoid(n)){i=h.listPrev(n).length;n=n.parentNode}return 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=h.fromOffsetPath(t,e.s.path),n=e.s.offset,i=h.fromOffsetPath(t,e.e.path),r=e.e.offset;return new N(o,n,i,r)},createFromParaBookmark:function(t,e){var o=t.s.offset,n=t.e.offset,i=h.fromOffsetPath(d.head(e),t.s.path),r=h.fromOffsetPath(d.last(e),t.e.path);return new N(i,o,r,n)}};var I={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,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,HOME:36,END:35,PAGEUP:33,PAGEDOWN:34};let s={isEdit:function(t){return d.contains([I.BACKSPACE,I.TAB,I.ENTER,I.SPACE,I.DELETE],t)},isRemove:function(t){return d.contains([I.BACKSPACE,I.DELETE],t)},isMove:function(t){return d.contains([I.LEFT,I.UP,I.RIGHT,I.DOWN],t)},isNavigation:function(t){return d.contains([I.HOME,I.END,I.PAGEUP,I.PAGEDOWN],t)},nameFromCode:u.invertObject(I),code:I};function $(t){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$(t)}function zt(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=$(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=$(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==$(n)?n:n+""),r)}}var Ot=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.stack=[];this.stackOffset=-1;this.context=e;this.$editable=e.layoutInfo.editable;this.editable=this.$editable[0]},e=[{key:"makeSnapshot",value:function(){var t=l.create(this.editable);return{contents:this.$editable.html(),bookmark:t&&t.isOnEditable()?t.bookmark(this.editable):{s:{path:[],offset:0},e:{path:[],offset:0}}}}},{key:"applySnapshot",value:function(t){null!==t.contents&&this.$editable.html(t.contents);null!==t.bookmark&&l.createFromBookmark(this.editable,t.bookmark).select()}},{key:"rewind",value:function(){this.$editable.html()!==this.stack[this.stackOffset].contents&&this.recordUndo();this.stackOffset=0;this.applySnapshot(this.stack[this.stackOffset])}},{key:"commit",value:function(){this.stack=[];this.stackOffset=-1;this.recordUndo()}},{key:"reset",value:function(){this.stack=[];this.stackOffset=-1;this.$editable.html("");this.recordUndo()}},{key:"undo",value:function(){this.$editable.html()!==this.stack[this.stackOffset].contents&&this.recordUndo();if(0<this.stackOffset){this.stackOffset--;this.applySnapshot(this.stack[this.stackOffset])}}},{key:"redo",value:function(){if(this.stack.length-1>this.stackOffset){this.stackOffset++;this.applySnapshot(this.stack[this.stackOffset])}}},{key:"recordUndo",value:function(){this.stackOffset++;this.stack.length>this.stackOffset&&(this.stack=this.stack.slice(0,this.stackOffset));this.stack.push(this.makeSnapshot());if(this.stack.length>this.context.options.historyLimit){this.stack.shift();--this.stackOffset}}}],e&&zt(t.prototype,e),o&&zt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}function Bt(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=R(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=R(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==R(n)?n:n+""),r)}}var Mt=(()=>{return t=function t(){var e=this,o=t;if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")},e=[{key:"jQueryCSS",value:function(o,t){var n={};w().each(t,function(t,e){n[e]=o.css(e)});return n}},{key:"fromNode",value:function(t){var e=this.jQueryCSS(t,["font-family","font-size","text-align","list-style-type","line-height"])||{},o=t[0].style.fontSize||e["font-size"];e["font-size"]=parseInt(o,10);e["font-size-unit"]=o.match(/[a-z%]+$/);return e}},{key:"stylePara",value:function(t,o){w().each(t.nodes(h.isPara,{includeAncestor:!0}),function(t,e){w()(e).css(o)})}},{key:"styleNodes",value:function(t,e){t=t.splitText();var o,n,i,r=e&&e.nodeName||"SPAN",a=!(!e||!e.expandClosestSibling),s=!(!e||!e.onlyPartialContains);return t.isCollapsed()?[t.insertNode(h.create(r))]:(i=h.makePredByNodeName(r),o=t.nodes(h.isText,{fullyContains:!0}).map(function(t){return h.singleChildAncestor(t,i)||h.wrap(t,r)}),a?(s&&(n=t.nodes(),i=u.and(i,function(t){return d.contains(n,t)})),o.map(function(t){var e=h.withClosestSiblings(t,i),o=d.head(e),n=d.tail(e);w().each(n,function(t,e){h.appendChildNodes(o,e.childNodes);h.remove(e)});return d.head(e)})):o)}},{key:"current",value:function(t){var e=w()(h.isElement(t.sc)?t.sc:t.sc.parentNode),e=this.fromNode(e);try{e=w().extend(e,{"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")||e["font-family"]})}catch(t){}if(t.isOnList()){var o=-1<["circle","disc","disc-leading-zero","square"].indexOf(e["list-style-type"]);e["list-style"]=o?"unordered":"ordered"}else e["list-style"]="none";o=h.ancestor(t.sc,h.isPara);if(o&&o.style["line-height"])e["line-height"]=o.style.lineHeight;else{o=parseInt(e["line-height"],10)/parseInt(e["font-size"],10);e["line-height"]=o.toFixed(1)}e.anchor=t.isOnAnchor()&&h.ancestor(t.sc,h.isAnchor);e.ancestors=h.listAncestor(t.sc,h.isEditable);e.range=t;return e}}],e&&Bt(t.prototype,e),o&&Bt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function Ut(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=A(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=A(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==A(n)?n:n+""),r)}}var Wt=(()=>{return t=function t(){var e=this,o=t;if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")},e=[{key:"insertOrderedList",value:function(t){this.toggleList("OL",t)}},{key:"insertUnorderedList",value:function(t){this.toggleList("UL",t)}},{key:"indent",value:function(t){var i=this,e=l.create(t).wrapBodyInlineWithPara(),o=e.nodes(h.isPara,{includeAncestor:!0}),o=d.clusterBy(o,u.peq2("parentNode"));w().each(o,function(t,e){var o=d.head(e);if(h.isLi(o)){var n=i.findList(o.previousSibling);if(n)e.map(function(t){return n.appendChild(t)});else{i.wrapList(e,o.parentNode.nodeName);e.map(function(t){return t.parentNode}).map(function(t){return i.appendToPrevious(t)})}}else w().each(e,function(t,e){w()(e).css("marginLeft",function(t,e){return(parseInt(e,10)||0)+25})})});e.select()}},{key:"outdent",value:function(t){var n=this,e=l.create(t).wrapBodyInlineWithPara(),o=e.nodes(h.isPara,{includeAncestor:!0}),o=d.clusterBy(o,u.peq2("parentNode"));w().each(o,function(t,e){var o=d.head(e);h.isLi(o)?n.releaseList([e]):w().each(e,function(t,e){w()(e).css("marginLeft",function(t,e){e=parseInt(e,10)||0;return 25<e?e-25:""})})});e.select()}},{key:"toggleList",value:function(o,t){var n=this,e=l.create(t).wrapBodyInlineWithPara(),i=e.nodes(h.isPara,{includeAncestor:!0}),r=e.paraBookmark(i),a=d.clusterBy(i,u.peq2("parentNode"));if(d.find(i,h.isPurePara)){var s=[];w().each(a,function(t,e){s=s.concat(n.wrapList(e,o))});i=s}else{e=e.nodes(h.isList,{includeAncestor:!0}).filter(function(t){return!w().nodeName(t,o)});e.length?w().each(e,function(t,e){h.replace(e,o)}):i=this.releaseList(a,!0)}l.createFromParaBookmark(r,i).select()}},{key:"wrapList",value:function(t,e){var o=d.head(t),n=d.last(t),o=h.isList(o.previousSibling)&&o.previousSibling,i=h.isList(n.nextSibling)&&n.nextSibling,o=o||h.insertAfter(h.create(e||"UL"),n);t=t.map(function(t){return h.isPurePara(t)?h.replace(t,"LI"):t});h.appendChildNodes(o,t,!0);if(i){h.appendChildNodes(o,d.from(i.childNodes),!0);h.remove(i)}return t}},{key:"releaseList",value:function(t,a){var s=this,l=[];w().each(t,function(t,e){var o=d.head(e),n=d.last(e),i=a?h.lastAncestor(o,h.isList):o.parentNode,r=i.parentNode;if("LI"===i.parentNode.nodeName){e.map(function(t){var e=s.findNextSiblings(t);r.nextSibling?r.parentNode.insertBefore(t,r.nextSibling):r.parentNode.appendChild(t);if(e.length){s.wrapList(e,i.nodeName);t.appendChild(e[0].parentNode)}});0===i.children.length&&r.removeChild(i);0===r.childNodes.length&&r.parentNode.removeChild(r)}else{n=1<i.childNodes.length?h.splitTree(i,{node:n.parentNode,offset:h.position(n)+1},{isSkipPaddingBlankHTML:!0}):null,o=h.splitTree(i,{node:o.parentNode,offset:h.position(o)},{isSkipPaddingBlankHTML:!0});e=a?h.listDescendant(o,h.isLi):d.from(o.childNodes).filter(h.isLi);!a&&h.isList(i.parentNode)||(e=e.map(function(t){return h.replace(t,"P")}));w().each(d.from(e).reverse(),function(t,e){h.insertAfter(e,i)});o=d.compact([i,o,n]);w().each(o,function(t,e){var o=[e].concat(h.listDescendant(e,h.isList));w().each(o.reverse(),function(t,e){h.nodeLength(e)||h.remove(e,!0)})})}l=l.concat(e)});return l}},{key:"appendToPrevious",value:function(t){return t.previousSibling?h.appendChildNodes(t.previousSibling,[t]):this.wrapList([t],"LI")}},{key:"findList",value:function(t){return t?d.find(t.children,function(t){return-1<["OL","UL"].indexOf(t.nodeName)}):null}},{key:"findNextSiblings",value:function(t){for(var e=[];t.nextSibling;){e.push(t.nextSibling);t=t.nextSibling}return e}}],e&&Ut(t.prototype,e),o&&Ut(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function Kt(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=L(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=L(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==L(n)?n:n+""),r)}}var qt=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.bullet=new Wt;this.options=e.options},e=[{key:"insertTab",value:function(t,e){var o=h.createText(new Array(e+1).join(h.NBSP_CHAR));t=t.deleteContents();t.insertNode(o,!0);t=l.create(o,e);t.select()}},{key:"insertParagraph",value:function(t,e){e=e||l.create(t);e=e.deleteContents();e=e.wrapBodyInlineWithPara();var o=h.ancestor(e.sc,h.isPara);if(o){if(h.isLi(o)&&(h.isEmpty(o)||h.deepestChildIsEmpty(o)))return void this.bullet.toggleList(o.parentNode.nodeName);var n=null;1===this.options.blockquoteBreakingLevel?n=h.ancestor(o,h.isBlockquote):2===this.options.blockquoteBreakingLevel&&(n=h.lastAncestor(o,h.isBlockquote));if(n){r=w()(h.emptyPara)[0];h.isRightEdgePoint(e.getStartPoint())&&h.isBR(e.sc.nextSibling)&&w()(e.sc.nextSibling).remove();var i=h.splitTree(n,e.getStartPoint(),{isDiscardEmptySplits:!0});i?i.parentNode.insertBefore(r,i):h.insertAfter(r,n)}else{var r=h.splitTree(o,e.getStartPoint()),i=h.listDescendant(o,h.isEmptyAnchor),i=i.concat(h.listDescendant(r,h.isEmptyAnchor));w().each(i,function(t,e){h.remove(e)});(h.isHeading(r)||h.isPre(r)||h.isCustomStyleTag(r))&&h.isEmpty(r)&&(r=h.replace(r,"p"))}}else{n=e.sc.childNodes[e.so];r=w()(h.emptyPara)[0];n?e.sc.insertBefore(r,n):e.sc.appendChild(r)}l.create(r,0).normalize().select().scrollIntoView(t)}}],e&&Kt(t.prototype,e),o&&Kt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function F(t){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(t)}function Vt(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=F(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=F(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==F(n)?n:n+""),r)}}function D(t,h,p,v){var g={colPos:0,rowPos:0},m=[],b=[];function y(t,e,o,n,i,r,a){var s={baseRow:o,baseCell:n,isRowSpan:i,isColSpan:r,isVirtual:a};m[t]||(m[t]=[]);m[t][e]=s}function k(t,e){if(!m[t])return e;if(!m[t][e])return e;for(var o=e;m[t][o];){o++;if(!m[t][o])return o}}function w(t,e,o,n){t===g.rowPos&&g.colPos>=o.cellIndex&&o.cellIndex<=e&&!n&&g.colPos++}function e(){for(var t=v.rows,e=0;e<t.length;e++)for(var o=t[e].cells,n=0;n<o.length;n++){i=void 0;r=void 0;a=void 0;s=void 0;l=void 0;c=void 0;u=void 0;d=void 0;f=void 0;h=void 0;p=void 0;m=void 0;var i=t[e],r=o[n],a=k(i.rowIndex,r.cellIndex),s=1<r.colSpan,l=1<r.rowSpan,c=i.rowIndex===g.rowPos&&r.cellIndex===g.colPos,u=(y(i.rowIndex,a,i,r,l,s,!1),r.attributes.rowSpan?parseInt(r.attributes.rowSpan.value,10):0);if(1<u)for(var d=1;d<u;d++){var f=i.rowIndex+d;w(f,a,r,c);y(f,a,i,r,!0,s,!0)}var h=r.attributes.colSpan?parseInt(r.attributes.colSpan.value,10):0;if(1<h)for(var p=1;p<h;p++){var m=k(i.rowIndex,a+p);w(i.rowIndex,m,r,c);y(i.rowIndex,m,i,r,l,!0,!0)}}}this.getActionList=function(){for(var t,e,o,n,i=h===D.where.Row?g.rowPos:-1,r=h===D.where.Column?g.colPos:-1,a=0,s=!0;s;){var l=0<=i?i:a,c=0<=r?r:a,u=m[l];if(!u)return s=!1,b;var d=u[c];if(!d)return s=!1,b;var f=D.resultAction.Ignore;switch(p){case D.requestAction.Add:f=(t=>{switch(h){case D.where.Column:if(t.isColSpan)return D.resultAction.SumSpanCount;if(t.isRowSpan&&t.isVirtual)return D.resultAction.Ignore;break;case D.where.Row:if(t.isRowSpan)return D.resultAction.SumSpanCount;if(t.isColSpan&&t.isVirtual)return D.resultAction.Ignore}return D.resultAction.AddCell})(d);break;case D.requestAction.Delete:f=(t=>{switch(h){case D.where.Column:if(t.isColSpan)return D.resultAction.SubtractSpanCount;break;case D.where.Row:if(!t.isVirtual&&t.isRowSpan)return D.resultAction.AddCell;if(t.isRowSpan)return D.resultAction.SubtractSpanCount}return D.resultAction.RemoveCell})(d)}b.push((t=d,e=f,o=l,n=c,{baseCell:t.baseCell,action:e,virtualTable:{rowIndex:o,cellIndex:n}}));a++}return b};if(t&&t.tagName&&("td"===t.tagName.toLowerCase()||"th"===t.tagName.toLowerCase())){g.colPos=t.cellIndex;t.parentElement&&t.parentElement.tagName&&"tr"===t.parentElement.tagName.toLowerCase()&&(g.rowPos=t.parentElement.rowIndex)}e()}D.where={Row:0,Column:1};D.requestAction={Add:0,Delete:1};D.resultAction={Ignore:0,SubtractSpanCount:1,RemoveCell:2,AddCell:3,SumSpanCount:4};var _t=(()=>{return t=function t(){var e=this,o=t;if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")},e=[{key:"tab",value:function(t,e){var o=h.ancestor(t.commonAncestor(),h.isCell),n=h.ancestor(o,h.isTable),n=h.listDescendant(n,h.isCell),n=d[e?"prev":"next"](n,o);n&&l.create(n,0).select()}},{key:"addRow",value:function(t,e){for(var o=h.ancestor(t.commonAncestor(),h.isCell),n=w()(o).closest("tr"),i=this.recoverAttributes(n),r=w()("<tr"+i+"></tr>"),i=new D(o,D.where.Row,D.requestAction.Add,w()(n).closest("table")[0]),a=i.getActionList(),s=0;s<a.length;s++){var l=a[s],c=this.recoverAttributes(l.baseCell);switch(l.action){case D.resultAction.AddCell:r.append("<td"+c+">"+h.blank+"</td>");break;case D.resultAction.SumSpanCount:if("top"===e){var u=l.baseCell.parent,u=(u?l.baseCell.closest("tr").rowIndex:0)<=n[0].rowIndex;if(u){u=w()("<div></div>").append(w()("<td"+c+">"+h.blank+"</td>").removeAttr("rowspan")).html();r.append(u);break}}u=parseInt(l.baseCell.rowSpan,10);u++;l.baseCell.setAttribute("rowSpan",u)}}if("top"===e)n.before(r);else{i=1<o.rowSpan;if(i){i=n[0].rowIndex+(o.rowSpan-2);w()(w()(n).parent().find("tr")[i]).after(w()(r))}else n.after(r)}}},{key:"addCol",value:function(t,e){for(var o=h.ancestor(t.commonAncestor(),h.isCell),n=w()(o).closest("tr"),i=w()(n).siblings(),i=(i.push(n),new D(o,D.where.Column,D.requestAction.Add,w()(n).closest("table")[0])),r=i.getActionList(),a=0;a<r.length;a++){var s=r[a],l=this.recoverAttributes(s.baseCell);switch(s.action){case D.resultAction.AddCell:"right"===e?w()(s.baseCell).after("<td"+l+">"+h.blank+"</td>"):w()(s.baseCell).before("<td"+l+">"+h.blank+"</td>");break;case D.resultAction.SumSpanCount:if("right"===e){var c=parseInt(s.baseCell.colSpan,10);c++;s.baseCell.setAttribute("colSpan",c)}else w()(s.baseCell).before("<td"+l+">"+h.blank+"</td>")}}}},{key:"recoverAttributes",value:function(t){var e="";if(t)for(var o=t.attributes||[],n=0;n<o.length;n++)"id"!==o[n].name.toLowerCase()&&o[n].specified&&(e+=" "+o[n].name+"='"+o[n].value+"'");return e}},{key:"deleteRow",value:function(t){for(var e=h.ancestor(t.commonAncestor(),h.isCell),o=w()(e).closest("tr"),n=o.children("td, th").index(w()(e)),i=o[0].rowIndex,e=new D(e,D.where.Row,D.requestAction.Delete,w()(o).closest("table")[0]),r=e.getActionList(),a=0;a<r.length;a++)if(r[a]){var s=r[a].baseCell,l=r[a].virtualTable,c=s.rowSpan&&1<s.rowSpan,u=c?parseInt(s.rowSpan,10):0;switch(r[a].action){case D.resultAction.Ignore:continue;case D.resultAction.AddCell:var d=o.next("tr")[0];if(!d)continue;var f=o[0].cells[n];if(c)if(2<u){u--;d.insertBefore(f,d.cells[n]);d.cells[n].setAttribute("rowSpan",u);d.cells[n].innerHTML=""}else if(2===u){d.insertBefore(f,d.cells[n]);d.cells[n].removeAttribute("rowSpan");d.cells[n].innerHTML=""}continue;case D.resultAction.SubtractSpanCount:if(c)if(2<u){u--;s.setAttribute("rowSpan",u);l.rowIndex!==i&&s.cellIndex===n&&(s.innerHTML="")}else if(2===u){s.removeAttribute("rowSpan");l.rowIndex!==i&&s.cellIndex===n&&(s.innerHTML="")}continue;case D.resultAction.RemoveCell:continue}}o.remove()}},{key:"deleteCol",value:function(t){for(var e=h.ancestor(t.commonAncestor(),h.isCell),o=w()(e).closest("tr"),n=o.children("td, th").index(w()(e)),e=new D(e,D.where.Column,D.requestAction.Delete,w()(o).closest("table")[0]),i=e.getActionList(),r=0;r<i.length;r++)if(i[r])switch(i[r].action){case D.resultAction.Ignore:continue;case D.resultAction.SubtractSpanCount:var a=i[r].baseCell,s=a.colSpan&&1<a.colSpan;if(s){s=a.colSpan?parseInt(a.colSpan,10):0;if(2<s){s--;a.setAttribute("colSpan",s);a.cellIndex===n&&(a.innerHTML="")}else if(2===s){a.removeAttribute("colSpan");a.cellIndex===n&&(a.innerHTML="")}}continue;case D.resultAction.RemoveCell:h.remove(i[r].baseCell,!0);continue}}},{key:"createTable",value:function(t,e,o){for(var n=[],i=0;i<t;i++)n.push("<td>"+h.blank+"</td>");for(var r=n.join(""),a=[],s=0;s<e;s++)a.push("<tr>"+r+"</tr>");var l=a.join(""),l=w()("<table>"+l+"</table>");o&&o.tableClassName&&l.addClass(o.tableClassName);return l[0]}},{key:"deleteTable",value:function(t){var e=h.ancestor(t.commonAncestor(),h.isCell);w()(e).closest("table").remove()}}],e&&Vt(t.prototype,e),o&&Vt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function Gt(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=H(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=H(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==H(n)?n:n+""),r)}}var Zt=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,Yt=/^(\+?\d{1,3}[\s-]?)?(\d{1,4})[\s-]?(\d{1,4})[\s-]?(\d{1,4})$/,Xt=/^([A-Za-z][A-Za-z0-9+-.]*\:|#|\/)/,Qt=(()=>{return t=function t(e){var u=this,o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.$note=e.layoutInfo.note;this.$editor=e.layoutInfo.editor;this.$editable=e.layoutInfo.editable;this.options=e.options;this.lang=this.options.langInfo;this.editable=this.$editable[0];this.lastRange=null;this.snapshot=null;this.style=new Mt;this.table=new _t;this.typing=new qt(e);this.bullet=new Wt;this.history=new Ot(e);this.context.memo("help.escape",this.lang.help.escape);this.context.memo("help.undo",this.lang.help.undo);this.context.memo("help.redo",this.lang.help.redo);this.context.memo("help.tab",this.lang.help.tab);this.context.memo("help.untab",this.lang.help.untab);this.context.memo("help.insertParagraph",this.lang.help.insertParagraph);this.context.memo("help.insertOrderedList",this.lang.help.insertOrderedList);this.context.memo("help.insertUnorderedList",this.lang.help.insertUnorderedList);this.context.memo("help.indent",this.lang.help.indent);this.context.memo("help.outdent",this.lang.help.outdent);this.context.memo("help.formatPara",this.lang.help.formatPara);this.context.memo("help.insertHorizontalRule",this.lang.help.insertHorizontalRule);this.context.memo("help.fontName",this.lang.help.fontName);for(var i=["bold","italic","underline","strikethrough","superscript","subscript","justifyLeft","justifyCenter","justifyRight","justifyFull","formatBlock","removeFormat","backColor"],r=0,a=i.length;r<a;r++){this[i[r]]=(e=>function(t){u.beforeCommand();document.execCommand(e,!1,t);u.afterCommand(!0)})(i[r]);this.context.memo("help."+i[r],this.lang.help[i[r]])}this.fontName=this.wrapCommand(function(t){return u.fontStyling("font-family",c.validFontName(t))});this.fontSize=this.wrapCommand(function(t){var e=u.currentStyle()["font-size-unit"];return u.fontStyling("font-size",t+e)});this.fontSizeUnit=this.wrapCommand(function(t){var e=u.currentStyle()["font-size"];return u.fontStyling("font-size",e+t)});for(var s=1;s<=6;s++){this["formatH"+s]=(t=>function(){u.formatBlock("H"+t)})(s);this.context.memo("help.formatH"+s,this.lang.help["formatH"+s])}this.insertParagraph=this.wrapCommand(function(){u.typing.insertParagraph(u.editable)});this.insertOrderedList=this.wrapCommand(function(){u.bullet.insertOrderedList(u.editable)});this.insertUnorderedList=this.wrapCommand(function(){u.bullet.insertUnorderedList(u.editable)});this.indent=this.wrapCommand(function(){u.bullet.indent(u.editable)});this.outdent=this.wrapCommand(function(){u.bullet.outdent(u.editable)});this.insertNode=this.wrapCommand(function(t){if(!u.isLimited(w()(t).text().length)){var e=u.getLastRange();e.insertNode(t);u.setLastRange(l.createFromNodeAfter(t).select())}});this.insertText=this.wrapCommand(function(t){if(!u.isLimited(t.length)){var e=u.getLastRange(),e=e.insertNode(h.createText(t));u.setLastRange(l.create(e,h.nodeLength(e)).select())}});this.pasteHTML=this.wrapCommand(function(t){if(!u.isLimited(t.length)){t=u.context.invoke("codeview.purify",t);var e=u.getLastRange().pasteHTML(t);u.setLastRange(l.createFromNodeAfter(d.last(e)).select())}});this.formatBlock=this.wrapCommand(function(t,e){var o=u.options.callbacks.onApplyCustomStyle;o?o.call(u,e,u.context,u.onFormatBlock):u.onFormatBlock(t,e)});this.insertHorizontalRule=this.wrapCommand(function(){var t=u.getLastRange().insertNode(h.create("HR"));t.nextSibling&&u.setLastRange(l.create(t.nextSibling,0).normalize().select())});this.lineHeight=this.wrapCommand(function(t){u.style.stylePara(u.getLastRange(),{lineHeight:t})});this.createLink=this.wrapCommand(function(t){var o=[],n=t.url,e=t.text,i=t.isNewWindow,r=u.options.linkAddNoReferrer,a=u.options.linkAddNoOpener,s=t.range||u.getLastRange(),l=e.length-s.toString().length;if(!(0<l&&u.isLimited(l))){var l=s.toString()!==e,n=("string"==typeof n&&(n=n.trim()),u.options.onCreateLink?u.options.onCreateLink(n):u.checkLinkUrl(n)),c=[];if(l){s=s.deleteContents(),l=s.insertNode(w()("<A></A>").text(e)[0]);c.push(l)}else c=u.style.styleNodes(s,{nodeName:"A",expandClosestSibling:!0,onlyPartialContains:!0});w().each(c,function(t,e){w()(e).attr("href",n);if(i){w()(e).attr("target","_blank");r&&o.push("noreferrer");a&&o.push("noopener");o.length&&w()(e).attr("rel",o.join(" "))}else w()(e).removeAttr("target")});u.setLastRange(u.createRangeFromList(c).select())}});this.color=this.wrapCommand(function(t){var e=t.foreColor,o=t.backColor;e&&document.execCommand("foreColor",!1,e);o&&document.execCommand("backColor",!1,o)});this.foreColor=this.wrapCommand(function(t){document.execCommand("foreColor",!1,t)});this.insertTable=this.wrapCommand(function(t){var e=t.split("x"),o=u.getLastRange().deleteContents();o.insertNode(u.table.createTable(e[0],e[1],u.options))});this.removeMedia=this.wrapCommand(function(){var t=w()(u.restoreTarget()).parent();t.closest("figure").length?t.closest("figure").remove():t=w()(u.restoreTarget()).detach();u.setLastRange(l.createFromSelection(t).select());u.context.triggerEvent("media.delete",t,u.$editable)});this.floatMe=this.wrapCommand(function(t){var e=w()(u.restoreTarget());e.toggleClass("note-float-left","left"===t);e.toggleClass("note-float-right","right"===t);e.css("float","none"===t?"":t)});this.resize=this.wrapCommand(function(t){var e=w()(u.restoreTarget());t=parseFloat(t);0===t?e.css("width",""):e.css({width:100*t+"%",height:""})})},e=[{key:"initialize",value:function(){var o=this;this.$editable.on("keydown",function(t){t.keyCode===s.code.ENTER&&o.context.triggerEvent("enter",t);o.context.triggerEvent("keydown",t);o.snapshot=o.history.makeSnapshot();o.hasKeyShortCut=!1;t.isDefaultPrevented()||(o.options.shortcuts?o.hasKeyShortCut=o.handleKeyMap(t):o.preventDefaultEditableShortCuts(t));if(o.isLimited(1,t)){var e=o.getLastRange();if(e.eo-e.so==0)return!1}o.setLastRange();o.options.recordEveryKeystroke&&!1===o.hasKeyShortCut&&o.history.recordUndo()}).on("keyup",function(t){o.setLastRange();o.context.triggerEvent("keyup",t)}).on("focus",function(t){o.setLastRange();o.context.triggerEvent("focus",t)}).on("blur",function(t){o.context.triggerEvent("blur",t)}).on("mousedown",function(t){o.context.triggerEvent("mousedown",t)}).on("mouseup",function(t){o.setLastRange();o.history.recordUndo();o.context.triggerEvent("mouseup",t)}).on("scroll",function(t){o.context.triggerEvent("scroll",t)}).on("paste",function(t){o.setLastRange();o.context.triggerEvent("paste",t)}).on("copy",function(t){o.context.triggerEvent("copy",t)}).on("input",function(){o.isLimited(0)&&o.snapshot&&o.history.applySnapshot(o.snapshot)});this.$editable.attr("spellcheck",this.options.spellCheck);this.$editable.attr("autocorrect",this.options.spellCheck);this.options.disableGrammar&&this.$editable.attr("data-gramm",!1);this.$editable.html(h.html(this.$note)||h.emptyPara);this.$editable.on(c.inputEventName,u.debounce(function(){o.context.triggerEvent("change",o.$editable.html(),o.$editable)},10));this.$editable.on("focusin",function(t){o.context.triggerEvent("focusin",t)}).on("focusout",function(t){o.context.triggerEvent("focusout",t)});if(this.options.airMode)this.options.overrideContextMenu&&this.$editor.on("contextmenu",function(t){o.context.triggerEvent("contextmenu",t);return!1});else{this.options.width&&this.$editor.outerWidth(this.options.width);this.options.height&&this.$editable.outerHeight(this.options.height);this.options.maxHeight&&this.$editable.css("max-height",this.options.maxHeight);this.options.minHeight&&this.$editable.css("min-height",this.options.minHeight)}this.history.recordUndo();this.setLastRange()}},{key:"destroy",value:function(){this.$editable.off()}},{key:"handleKeyMap",value:function(t){var e=this.options.keyMap[c.isMac?"mac":"pc"],o=[];t.metaKey&&o.push("CMD");t.ctrlKey&&!t.altKey&&o.push("CTRL");t.shiftKey&&o.push("SHIFT");var n=s.nameFromCode[t.keyCode],e=(n&&o.push(n),e[o.join("+")]);if("TAB"!==n||this.options.tabDisable){if(e){if(!1!==this.context.invoke(e))return t.preventDefault(),!0}else if(s.isEdit(t.keyCode)){s.isRemove(t.keyCode)&&this.context.invoke("removed");this.afterCommand()}}else this.afterCommand();return!1}},{key:"preventDefaultEditableShortCuts",value:function(t){(t.ctrlKey||t.metaKey)&&d.contains([66,73,85],t.keyCode)&&t.preventDefault()}},{key:"isLimited",value:function(t,e){t=t||0;return(void 0===e||!(s.isMove(e.keyCode)||s.isNavigation(e.keyCode)||e.ctrlKey||e.metaKey||d.contains([s.code.BACKSPACE,s.code.DELETE],e.keyCode)))&&0<this.options.maxTextLength&&this.$editable.text().length+t>this.options.maxTextLength}},{key:"checkLinkUrl",value:function(t){return Zt.test(t)?"mailto://"+t:Yt.test(t)?"tel://"+t:Xt.test(t)?t:"http://"+t}},{key:"createRange",value:function(){this.focus();this.setLastRange();return this.getLastRange()}},{key:"createRangeFromList",value:function(t){var e=l.createFromNodeBefore(d.head(t)),e=e.getStartPoint(),o=l.createFromNodeAfter(d.last(t)),o=o.getEndPoint();return l.create(e.node,e.offset,o.node,o.offset)}},{key:"setLastRange",value:function(t){if(t)this.lastRange=t;else{this.lastRange=l.create(this.editable);0===w()(this.lastRange.sc).closest(".note-editable").length&&(this.lastRange=l.createFromBodyElement(this.editable))}}},{key:"getLastRange",value:function(){this.lastRange||this.setLastRange();return this.lastRange}},{key:"saveRange",value:function(t){t&&this.getLastRange().collapse().select()}},{key:"restoreRange",value:function(){if(this.lastRange){this.lastRange.select();this.focus()}}},{key:"saveTarget",value:function(t){this.$editable.data("target",t)}},{key:"clearTarget",value:function(){this.$editable.removeData("target")}},{key:"restoreTarget",value:function(){return this.$editable.data("target")}},{key:"currentStyle",value:function(){var t=l.create(),t=t&&t.normalize();return t?this.style.current(t):this.style.fromNode(this.$editable)}},{key:"styleFromNode",value:function(t){return this.style.fromNode(t)}},{key:"undo",value:function(){this.context.triggerEvent("before.command",this.$editable.html());this.history.undo();this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"commit",value:function(){this.context.triggerEvent("before.command",this.$editable.html());this.history.commit();this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"redo",value:function(){this.context.triggerEvent("before.command",this.$editable.html());this.history.redo();this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"beforeCommand",value:function(){this.context.triggerEvent("before.command",this.$editable.html());document.execCommand("styleWithCSS",!1,this.options.styleWithCSS);this.focus()}},{key:"afterCommand",value:function(t){this.normalizeContent();this.history.recordUndo();t||this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"tab",value:function(){var t=this.getLastRange();if(t.isCollapsed()&&t.isOnCell())this.table.tab(t);else{if(0===this.options.tabSize)return!1;if(!this.isLimited(this.options.tabSize)){this.beforeCommand();this.typing.insertTab(t,this.options.tabSize);this.afterCommand()}}}},{key:"untab",value:function(){var t=this.getLastRange();if(t.isCollapsed()&&t.isOnCell())this.table.tab(t,!0);else if(0===this.options.tabSize)return!1}},{key:"wrapCommand",value:function(t){return function(){this.beforeCommand();t.apply(this,arguments);this.afterCommand()}}},{key:"removed",value:function(t,e,o){t=l.create();if(t.isCollapsed()&&t.isOnCell()){e=t.ec;(o=e.tagName)&&1===e.childElementCount&&"BR"===e.childNodes[0].tagName&&("P"===o?e.remove():0<=["TH","TD"].indexOf(o)&&e.firstChild.remove())}}},{key:"insertImage",value:function(t,e){var o,n=this;return(o=t,w().Deferred(function(t){var e=w()("<img>");e.one("load",function(){e.off("error abort");t.resolve(e)}).one("error abort",function(){e.off("load").detach();t.reject(e)}).css({display:"none"}).appendTo(document.body).attr("src",o)}).promise()).then(function(t){n.beforeCommand();if("function"==typeof e)e(t);else{"string"==typeof e&&t.attr("data-filename",e);t.css("width",Math.min(n.$editable.width(),t.width()))}t.show();n.getLastRange().insertNode(t[0]);n.setLastRange(l.createFromNodeAfter(t[0]).select());n.afterCommand()}).fail(function(t){n.context.triggerEvent("image.upload.error",t)})}},{key:"insertImagesAsDataURL",value:function(t){var i=this;w().each(t,function(t,e){var n,o=e.name;i.options.maximumImageFileSize&&i.options.maximumImageFileSize<e.size?i.context.triggerEvent("image.upload.error",i.lang.image.maximumFileSizeError):(n=e,w().Deferred(function(o){w().extend(new FileReader,{onload:function(t){var e=t.target.result;o.resolve(e)},onerror:function(t){o.reject(t)}}).readAsDataURL(n)}).promise()).then(function(t){return i.insertImage(t,o)}).fail(function(){i.context.triggerEvent("image.upload.error")})})}},{key:"insertImagesOrCallback",value:function(t){var e=this.options.callbacks;e.onImageUpload?this.context.triggerEvent("image.upload",t):this.insertImagesAsDataURL(t)}},{key:"getSelectedText",value:function(){var t=this.getLastRange();t.isOnAnchor()&&(t=l.createFromNode(h.ancestor(t.sc,h.isAnchor)));return t.toString()}},{key:"onFormatBlock",value:function(t,e){document.execCommand("FormatBlock",!1,c.isMSIE?"<"+t+">":t);if(e&&e.length){e[0].tagName.toUpperCase()!==t.toUpperCase()&&(e=e.find(t));if(e&&e.length){var o=this.createRange(),o=w()([o.sc,o.ec]).closest(t),n=(o.removeClass(),e[0].className||"");n&&o.addClass(n)}}}},{key:"formatPara",value:function(){this.formatBlock("P")}},{key:"fontStyling",value:function(t,e){var o=this.getLastRange();if(""!==o){var n=this.style.styleNodes(o);this.$editor.find(".note-status-output").html("");w()(n).css(t,e);if(o.isCollapsed()){n=d.head(n);if(n&&!h.nodeLength(n)){n.innerHTML=h.ZERO_WIDTH_NBSP_CHAR;l.createFromNode(n.firstChild).select();this.setLastRange();this.$editable.data("bogus",n)}}else o.select()}else{var i=w().now();this.$editor.find(".note-status-output").html('<div id="note-status-output-'+i+'" class="alert alert-info">'+this.lang.output.noSelection+"</div>");setTimeout(function(){w()("#note-status-output-"+i).remove()},5e3)}}},{key:"unlink",value:function(){var t=this.getLastRange();if(t.isOnAnchor()){var e=h.ancestor(t.sc,h.isAnchor),t=l.createFromNode(e);t.select();this.setLastRange();this.beforeCommand();document.execCommand("unlink");this.afterCommand()}}},{key:"getLinkInfo",value:function(){this.hasFocus()||this.focus();var t=this.getLastRange().expand(h.isAnchor),e=w()(d.head(t.nodes(h.isAnchor))),t={range:t,text:t.toString(),url:e.length?e.attr("href"):""};e.length&&(t.isNewWindow="_blank"===e.attr("target"));return t}},{key:"addRow",value:function(t){var e=this.getLastRange(this.$editable);if(e.isCollapsed()&&e.isOnCell()){this.beforeCommand();this.table.addRow(e,t);this.afterCommand()}}},{key:"addCol",value:function(t){var e=this.getLastRange(this.$editable);if(e.isCollapsed()&&e.isOnCell()){this.beforeCommand();this.table.addCol(e,t);this.afterCommand()}}},{key:"deleteRow",value:function(){var t=this.getLastRange(this.$editable);if(t.isCollapsed()&&t.isOnCell()){this.beforeCommand();this.table.deleteRow(t);this.afterCommand()}}},{key:"deleteCol",value:function(){var t=this.getLastRange(this.$editable);if(t.isCollapsed()&&t.isOnCell()){this.beforeCommand();this.table.deleteCol(t);this.afterCommand()}}},{key:"deleteTable",value:function(){var t=this.getLastRange(this.$editable);if(t.isCollapsed()&&t.isOnCell()){this.beforeCommand();this.table.deleteTable(t);this.afterCommand()}}},{key:"resizeTo",value:function(t,e,o){var n,i;i=o?(i=t.y/t.x,n=e.data("ratio"),{width:i<n?t.x:t.y/n,height:i<n?t.x*n:t.y}):{width:t.x,height:t.y};e.css(i)}},{key:"hasFocus",value:function(){return this.$editable.is(":focus")}},{key:"focus",value:function(){this.hasFocus()||this.$editable.trigger("focus")}},{key:"isEmpty",value:function(){return h.isEmpty(this.$editable[0])||h.emptyPara===this.$editable.html()}},{key:"empty",value:function(){this.context.invoke("code",h.emptyPara)}},{key:"normalizeContent",value:function(){this.$editable[0].normalize()}}],e&&Gt(t.prototype,e),o&&Gt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function Jt(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=j(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=j(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==j(n)?n:n+""),r)}}r=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.options=e.options;this.$editable=e.layoutInfo.editable},e=[{key:"initialize",value:function(){this.$editable.on("paste",this.pasteByEvent.bind(this))}},{key:"pasteByEvent",value:function(t){var e=this;if(!this.context.isDisabled()){var o=t.originalEvent.clipboardData;if(o&&o.items&&o.items.length){var n=o.files,o=o.getData("Text");if(0<n.length&&this.options.allowClipboardImagePasting){this.context.invoke("editor.insertImagesOrCallback",n);t.preventDefault()}0<o.length&&this.context.invoke("editor.isLimited",o.length)&&t.preventDefault()}else if(window.clipboardData){n=window.clipboardData.getData("text");this.context.invoke("editor.isLimited",n.length)&&t.preventDefault()}setTimeout(function(){e.context.invoke("editor.afterCommand")},10)}}}],e&&Jt(t.prototype,e),o&&Jt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function z(t){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},z(t)}function te(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=z(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=z(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==z(n)?n:n+""),r)}}f=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.$eventListener=w()(document);this.$editor=e.layoutInfo.editor;this.$editable=e.layoutInfo.editable;this.options=e.options;this.lang=this.options.langInfo;this.documentEventHandlers={};this.$dropzone=w()(['<div class="note-dropzone">','<div class="note-dropzone-message"></div>',"</div>"].join("")).prependTo(this.$editor)},e=[{key:"initialize",value:function(){if(this.options.disableDragAndDrop){this.documentEventHandlers.onDrop=function(t){t.preventDefault()};this.$eventListener=this.$dropzone;this.$eventListener.on("drop",this.documentEventHandlers.onDrop)}else this.attachDragAndDropEvent()}},{key:"attachDragAndDropEvent",value:function(){var i=this,n=w()(),r=this.$dropzone.find(".note-dropzone-message");this.documentEventHandlers.onDragenter=function(t){var e=i.context.invoke("codeview.isActivated"),o=0<i.$editor.width()&&0<i.$editor.height();if(!e&&!n.length&&o){i.$editor.addClass("dragover");i.$dropzone.width(i.$editor.width());i.$dropzone.height(i.$editor.height());r.text(i.lang.image.dragImageHere)}n=n.add(t.target)};this.documentEventHandlers.onDragleave=function(t){n=n.not(t.target);if(!n.length||"BODY"===t.target.nodeName){n=w()();i.$editor.removeClass("dragover")}};this.documentEventHandlers.onDrop=function(){n=w()();i.$editor.removeClass("dragover")};this.$eventListener.on("dragenter",this.documentEventHandlers.onDragenter).on("dragleave",this.documentEventHandlers.onDragleave).on("drop",this.documentEventHandlers.onDrop);this.$dropzone.on("dragenter",function(){i.$dropzone.addClass("hover");r.text(i.lang.image.dropImage)}).on("dragleave",function(){i.$dropzone.removeClass("hover");r.text(i.lang.image.dragImageHere)});this.$dropzone.on("drop",function(t){var n=t.originalEvent.dataTransfer;t.preventDefault();if(n&&n.files&&n.files.length){i.$editable.trigger("focus");i.context.invoke("editor.insertImagesOrCallback",n.files)}else w().each(n.types,function(t,e){if(!(-1<e.toLowerCase().indexOf("_moz_"))){var o=n.getData(e);-1<e.toLowerCase().indexOf("text")?i.context.invoke("editor.pasteHTML",o):w()(o).each(function(t,e){i.context.invoke("editor.insertNode",e)})}})}).on("dragover",!1)}},{key:"destroy",value:function(){var e=this;Object.keys(this.documentEventHandlers).forEach(function(t){e.$eventListener.off(t.slice(2).toLowerCase(),e.documentEventHandlers[t])});this.documentEventHandlers={}}}],e&&te(t.prototype,e),o&&te(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function O(t){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(t)}function ee(t,e){var o,n,i,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return n=!0,i=!1,{s:function(){r=r.call(t)},n:function(){var t=r.next();return n=t.done,t},e:function(t){i=!0,o=t},f:function(){try{n||null==r.return||r.return()}finally{if(i)throw o}}};if(Array.isArray(t)||(r=((t,e)=>{var o;if(t)return"string"==typeof t?oe(t,e):(o={}.toString.call(t).slice(8,-1),"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?oe(t,e):void 0)})(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var a=0,s=function(){};return{s:s,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,n=Array(e);o<e;o++)n[o]=t[o];return n}function ne(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=O(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=O(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==O(n)?n:n+""),r)}}a=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.$editor=e.layoutInfo.editor;this.$editable=e.layoutInfo.editable;this.$codable=e.layoutInfo.codable;this.options=e.options;this.CodeMirrorConstructor=window.CodeMirror;this.options.codemirror.CodeMirrorConstructor&&(this.CodeMirrorConstructor=this.options.codemirror.CodeMirrorConstructor)},e=[{key:"sync",value:function(t){var e=this.isActivated(),o=this.CodeMirrorConstructor;e&&(t?o?this.$codable.data("cmEditor").getDoc().setValue(t):this.$codable.val(t):o&&this.$codable.data("cmEditor").save())}},{key:"initialize",value:function(){var e=this;this.$codable.on("keyup",function(t){t.keyCode===s.code.ESCAPE&&e.deactivate()})}},{key:"isActivated",value:function(){return this.$editor.hasClass("codeview")}},{key:"toggle",value:function(){this.isActivated()?this.deactivate():this.activate();this.context.triggerEvent("codeview.toggled")}},{key:"purify",value:function(t){if(this.options.codeviewFilter){t=t.replace(this.options.codeviewFilterRegex,"");if(this.options.codeviewIframeFilter){var i=this.options.codeviewIframeWhitelistSrc.concat(this.options.codeviewIframeWhitelistSrcBase);t=t.replace(/(<iframe.*?>.*?(?:<\/iframe>)?)/gi,function(t){if(!/<.+src(?==?('|"|\s)?)[\s\S]+src(?=('|"|\s)?)[^>]*?>/i.test(t)){var e,o=ee(i);try{for(o.s();!(e=o.n()).done;){var n=e.value;if(new RegExp('src="(https?:)?//'+n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+'/(.+)"').test(t))return t}}catch(t){o.e(t)}finally{o.f()}}return""})}}return t}},{key:"activate",value:function(){var e=this,t=this.CodeMirrorConstructor;this.$codable.val(h.html(this.$editable,this.options.prettifyHtml));this.$codable.height(this.$editable.height());this.context.invoke("toolbar.updateCodeview",!0);this.context.invoke("airPopover.updateCodeview",!0);this.$editor.addClass("codeview");this.$codable.trigger("focus");if(t){var o=t.fromTextArea(this.$codable[0],this.options.codemirror);if(this.options.codemirror.tern){var n=new t.TernServer(this.options.codemirror.tern);o.ternServer=n;o.on("cursorActivity",function(t){n.updateArgHints(t)})}o.on("blur",function(t){e.context.triggerEvent("blur.codeview",o.getValue(),t)});o.on("change",function(){e.context.triggerEvent("change.codeview",o.getValue(),o)});o.setSize(null,this.$editable.outerHeight());this.$codable.data("cmEditor",o)}else{this.$codable.on("blur",function(t){e.context.triggerEvent("blur.codeview",e.$codable.val(),t)});this.$codable.on("input",function(){e.context.triggerEvent("change.codeview",e.$codable.val(),e.$codable)})}}},{key:"deactivate",value:function(){var t=this.CodeMirrorConstructor;if(t){t=this.$codable.data("cmEditor");this.$codable.val(t.getValue());t.toTextArea()}var t=this.purify(h.value(this.$codable,this.options.prettifyHtml)||h.emptyPara),e=this.$editable.html()!==t;this.$editable.html(t);this.$editable.height(this.options.height?this.$codable.height():"auto");this.$editor.removeClass("codeview");e&&this.context.triggerEvent("change",this.$editable.html(),this.$editable);this.$editable.trigger("focus");this.context.invoke("toolbar.updateCodeview",!1);this.context.invoke("airPopover.updateCodeview",!1)}},{key:"destroy",value:function(){this.isActivated()&&this.deactivate()}}],e&&ne(t.prototype,e),o&&ne(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function ie(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=B(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=B(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==B(n)?n:n+""),r)}}var re=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.$document=w()(document);this.$statusbar=e.layoutInfo.statusbar;this.$editable=e.layoutInfo.editable;this.$codable=e.layoutInfo.codable;this.options=e.options},e=[{key:"initialize",value:function(){var r=this;this.options.airMode||this.options.disableResizeEditor?this.destroy():this.$statusbar.on("mousedown touchstart",function(t){t.preventDefault();t.stopPropagation();function e(t){var e="mousemove"==t.type?t:t.originalEvent.touches[0],o=e.clientY-(24+n),e=e.clientY-(24+i),o=0<r.options.minheight?Math.max(o,r.options.minheight):o;o=0<r.options.maxHeight?Math.min(o,r.options.maxHeight):o;e=0<r.options.minheight?Math.max(e,r.options.minheight):e;e=0<r.options.maxHeight?Math.min(e,r.options.maxHeight):e;r.$editable.height(o);r.$codable.height(e)}var n=r.$editable.offset().top-r.$document.scrollTop(),i=r.$codable.offset().top-r.$document.scrollTop();r.$document.on("mousemove touchmove",e).one("mouseup touchend",function(){r.$document.off("mousemove touchmove",e)})})}},{key:"destroy",value:function(){this.$statusbar.off();this.$statusbar.addClass("locked")}}],e&&ie(t.prototype,e),o&&ie(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}function ae(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=M(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=M(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==M(n)?n:n+""),r)}}var se=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.$editor=e.layoutInfo.editor;this.$toolbar=e.layoutInfo.toolbar;this.$editable=e.layoutInfo.editable;this.$codable=e.layoutInfo.codable;this.$window=w()(window);this.$scrollbar=w()("html, body");this.scrollbarClassName="note-fullscreen-body";this.onResize=function(){o.resizeTo({h:o.$window.height()-o.$toolbar.outerHeight()})}},e=[{key:"resizeTo",value:function(t){this.$editable.css("height",t.h);this.$codable.css("height",t.h);this.$codable.data("cmeditor")&&this.$codable.data("cmeditor").setsize(null,t.h)}},{key:"toggle",value:function(){this.$editor.toggleClass("fullscreen");var t=this.isFullscreen();this.$scrollbar.toggleClass(this.scrollbarClassName,t);if(t){this.$editable.data("orgHeight",this.$editable.css("height"));this.$editable.data("orgMaxHeight",this.$editable.css("maxHeight"));this.$editable.css("maxHeight","");this.$window.on("resize",this.onResize).trigger("resize")}else{this.$window.off("resize",this.onResize);this.resizeTo({h:this.$editable.data("orgHeight")});this.$editable.css("maxHeight",this.$editable.css("orgMaxHeight"))}this.context.invoke("toolbar.updateFullscreen",t)}},{key:"isFullscreen",value:function(){return this.$editor.hasClass("fullscreen")}},{key:"destroy",value:function(){this.$scrollbar.removeClass(this.scrollbarClassName)}}],e&&ae(t.prototype,e),o&&ae(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function U(t){return U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},U(t)}function le(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=U(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=U(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==U(n)?n:n+""),r)}}var ce=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.$document=w()(document);this.$editingArea=e.layoutInfo.editingArea;this.options=e.options;this.lang=this.options.langInfo;this.events={"summernote.mousedown":function(t,e){o.update(e.target,e)&&e.preventDefault()},"summernote.keyup summernote.scroll summernote.change summernote.dialog.shown":function(){o.update()},"summernote.disable summernote.blur":function(){o.hide()},"summernote.codeview.toggled":function(){o.update()}}},e=[{key:"initialize",value:function(){var r=this;this.$handle=w()(['<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="',this.options.disableResizeImage?"note-control-holder":"note-control-sizing",' note-control-se"></div>',this.options.disableResizeImage?"":'<div class="note-control-selection-info"></div>',"</div>","</div>"].join("")).prependTo(this.$editingArea);this.$handle.on("mousedown",function(t){if(h.isControlSizing(t.target)){t.preventDefault();t.stopPropagation();var e=r.$handle.find(".note-control-selection").data("target"),o=e.offset(),n=r.$document.scrollTop(),i=function(t){r.context.invoke("editor.resizeTo",{x:t.clientX-o.left,y:t.clientY-(o.top-n)},e,!t.shiftKey);r.update(e[0],t)};r.$document.on("mousemove",i).one("mouseup",function(t){t.preventDefault();r.$document.off("mousemove",i);r.context.invoke("editor.afterCommand")});e.data("ratio")||e.data("ratio",e.height()/e.width())}});this.$handle.on("wheel",function(t){t.preventDefault();r.update()})}},{key:"destroy",value:function(){this.$handle.remove()}},{key:"update",value:function(t,e){if(this.context.isDisabled())return!1;var o=h.isImg(t),n=this.$handle.find(".note-control-selection");this.context.invoke("imagePopover.update",t,e);if(o){var i=w()(t),r=this.$editingArea[0].getBoundingClientRect(),a=t.getBoundingClientRect(),r=(n.css({display:"block",left:a.left-r.left,top:a.top-r.top,width:a.width,height:a.height}).data("target",i),new Image),i=(r.src=i.attr("src"),a.width+"x"+a.height+" ("+this.lang.image.original+": "+r.width+"x"+r.height+")");n.find(".note-control-selection-info").text(i);this.context.invoke("editor.saveTarget",t)}else this.hide();return o}},{key:"hide",value:function(){this.context.invoke("editor.clearTarget");this.$handle.children().hide()}}],e&&le(t.prototype,e),o&&le(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function W(t){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W(t)}function ue(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=W(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=W(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==W(n)?n:n+""),r)}}var de=/^([A-Za-z][A-Za-z0-9+-.]*\:[\/]{2}|tel:|mailto:[A-Z0-9._%+-]+@|xmpp:[A-Z0-9._%+-]+@)?(www\.)?(.+)$/i,fe=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.options=e.options;this.$editable=e.layoutInfo.editable;this.events={"summernote.keyup":function(t,e){e.isDefaultPrevented()||o.handleKeyup(e)},"summernote.keydown":function(t,e){o.handleKeydown(e)}}},e=[{key:"initialize",value:function(){this.lastWordRange=null}},{key:"destroy",value:function(){this.lastWordRange=null}},{key:"replace",value:function(){if(this.lastWordRange){var t=this.lastWordRange.toString(),e=t.match(de);if(e&&(e[1]||e[2])){e=e[1]?t:"http://"+t,t=this.options.showDomainOnlyForAutolink?t.replace(/^(?:https?:\/\/)?(?:tel?:?)?(?:mailto?:?)?(?:xmpp?:?)?(?:www\.)?/i,"").split("/")[0]:t,t=w()("<a></a>").html(t).attr("href",e)[0];this.context.options.linkTargetBlank&&w()(t).attr("target","_blank");this.lastWordRange.insertNode(t);this.lastWordRange=null;this.context.invoke("editor.focus");this.context.triggerEvent("change",this.$editable.html(),this.$editable)}}}},{key:"handleKeydown",value:function(t){if(d.contains([s.code.ENTER,s.code.SPACE],t.keyCode)){var e=this.context.invoke("editor.createRange").getWordRange();this.lastWordRange=e}}},{key:"handleKeyup",value:function(t){s.code.SPACE!==t.keyCode&&(s.code.ENTER!==t.keyCode||t.shiftKey)||this.replace()}}],e&&ue(t.prototype,e),o&&ue(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function K(t){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(t)}function he(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=K(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=K(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==K(n)?n:n+""),r)}}var pe=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.$note=e.layoutInfo.note;this.events={"summernote.change":function(){o.$note.val(e.invoke("code"))}}},e=[{key:"shouldInitialize",value:function(){return h.isTextarea(this.$note[0])}}],e&&he(t.prototype,e),o&&he(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function me(t){return me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(t)}function ve(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=me(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=me(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==me(n)?n:n+""),r)}}var ge=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.options=e.options.replace||{};this.keys=[s.code.ENTER,s.code.SPACE,s.code.PERIOD,s.code.COMMA,s.code.SEMICOLON,s.code.SLASH];this.previousKeydownCode=null;this.events={"summernote.keyup":function(t,e){e.isDefaultPrevented()||o.handleKeyup(e)},"summernote.keydown":function(t,e){o.handleKeydown(e)}}},e=[{key:"shouldInitialize",value:function(){return!!this.options.match}},{key:"initialize",value:function(){this.lastWord=null}},{key:"destroy",value:function(){this.lastWord=null}},{key:"replace",value:function(){if(this.lastWord){var o=this,t=this.lastWord.toString();this.options.match(t,function(t){if(t){var e="";"string"==typeof t?e=h.createText(t):t instanceof jQuery?e=t[0]:t instanceof Node&&(e=t);if(e){o.lastWord.insertNode(e);o.lastWord=null;o.context.invoke("editor.focus")}}})}}},{key:"handleKeydown",value:function(t){if((!this.previousKeydownCode||!d.contains(this.keys,this.previousKeydownCode))&&d.contains(this.keys,t.keyCode)){var e=this.context.invoke("editor.createRange").getWordRange();this.lastWord=e}this.previousKeydownCode=t.keyCode}},{key:"handleKeyup",value:function(t){d.contains(this.keys,t.keyCode)&&this.replace()}}],e&&ve(t.prototype,e),o&&ve(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function be(t){return be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},be(t)}function ye(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=be(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=be(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==be(n)?n:n+""),r)}}var ke=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.$editingArea=e.layoutInfo.editingArea;this.options=e.options;!0===this.options.inheritPlaceholder&&(this.options.placeholder=this.context.$note.attr("placeholder")||this.options.placeholder);this.events={"summernote.init summernote.change":function(){o.update()},"summernote.codeview.toggled":function(){o.update()}}},e=[{key:"shouldInitialize",value:function(){return!!this.options.placeholder}},{key:"initialize",value:function(){var t=this;this.$placeholder=w()('<div class="note-placeholder"></div>');this.$placeholder.on("click",function(){t.context.invoke("focus")}).html(this.options.placeholder).prependTo(this.$editingArea);this.update()}},{key:"destroy",value:function(){this.$placeholder.remove()}},{key:"update",value:function(){var t=!this.context.invoke("codeview.isActivated")&&this.context.invoke("editor.isEmpty");this.$placeholder.toggle(t)}}],e&&ye(t.prototype,e),o&&ye(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function we(t){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(t)}function Ce(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=we(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=we(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==we(n)?n:n+""),r)}}var Se=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.ui=w().summernote.ui;this.context=e;this.$toolbar=e.layoutInfo.toolbar;this.options=e.options;this.lang=this.options.langInfo;this.invertedKeyMap=u.invertObject(this.options.keyMap[c.isMac?"mac":"pc"])},e=[{key:"representShortcut",value:function(t){var e=this.invertedKeyMap[t];if(!this.options.shortcuts||!e)return"";c.isMac&&(e=e.replace("CMD","⌘").replace("SHIFT","⇧"));e=e.replace("BACKSLASH","\\").replace("SLASH","/").replace("LEFTBRACKET","[").replace("RIGHTBRACKET","]");return" ("+e+")"}},{key:"button",value:function(t){!this.options.tooltip&&t.tooltip&&delete t.tooltip;t.container=this.options.container;return this.ui.button(t)}},{key:"initialize",value:function(){this.addToolbarButtons();this.addImagePopoverButtons();this.addLinkPopoverButtons();this.addTablePopoverButtons();this.fontInstalledMap={}}},{key:"destroy",value:function(){delete this.fontInstalledMap}},{key:"isFontInstalled",value:function(t){Object.prototype.hasOwnProperty.call(this.fontInstalledMap,t)||(this.fontInstalledMap[t]=c.isFontInstalled(t)||d.contains(this.options.fontNamesIgnoreCheck,t));return this.fontInstalledMap[t]}},{key:"isFontDeservedToAdd",value:function(t){t=t.toLowerCase();return""!==t&&this.isFontInstalled(t)&&-1===c.genericFontFamilies.indexOf(t)}},{key:"colorPalette",value:function(l,t,o,n){var c=this;return this.ui.buttonGroup({className:"note-color "+l,children:[this.button({className:"note-current-color-button",contents:this.ui.icon(this.options.icons.font+" note-recent-color"),tooltip:t,click:function(t){var e=w()(t.currentTarget);o&&n?c.context.invoke("editor.color",{backColor:e.attr("data-backColor"),foreColor:e.attr("data-foreColor")}):o?c.context.invoke("editor.color",{backColor:e.attr("data-backColor")}):n&&c.context.invoke("editor.color",{foreColor:e.attr("data-foreColor")})},callback:function(t){var e=t.find(".note-recent-color");if(o){e.css("background-color",c.options.colorButton.backColor);t.attr("data-backColor",c.options.colorButton.backColor)}if(n){e.css("color",c.options.colorButton.foreColor);t.attr("data-foreColor",c.options.colorButton.foreColor)}else e.css("color","transparent")}}),this.button({className:"dropdown-toggle",contents:this.ui.dropdownButtonContents("",this.options),tooltip:this.lang.color.more,data:{toggle:"dropdown"}}),this.ui.dropdown({items:(o?['<div class="note-palette">','<div class="note-palette-title">'+this.lang.color.background+"</div>","<div>",'<button type="button" class="note-color-reset btn btn-light btn-default" data-event="backColor" data-value="transparent">',this.lang.color.transparent,"</button>","</div>",'<div class="note-holder" data-event="backColor">\x3c!-- back colors --\x3e</div>',"<div>",'<button type="button" class="note-color-select btn btn-light btn-default" data-event="openPalette" data-value="backColorPicker-'+this.options.id+'">',this.lang.color.cpSelect,"</button>",'<input type="color" id="backColorPicker-'+this.options.id+'" class="note-btn note-color-select-btn" value="'+this.options.colorButton.backColor+'" data-event="backColorPalette-'+this.options.id+'">',"</div>",'<div class="note-holder-custom" id="backColorPalette-'+this.options.id+'" data-event="backColor"></div>',"</div>"].join(""):"")+(n?['<div class="note-palette">','<div class="note-palette-title">'+this.lang.color.foreground+"</div>","<div>",'<button type="button" class="note-color-reset btn btn-light btn-default" data-event="removeFormat" data-value="foreColor">',this.lang.color.resetToDefault,"</button>","</div>",'<div class="note-holder" data-event="foreColor">\x3c!-- fore colors --\x3e</div>',"<div>",'<button type="button" class="note-color-select btn btn-light btn-default" data-event="openPalette" data-value="foreColorPicker-'+this.options.id+'">',this.lang.color.cpSelect,"</button>",'<input type="color" id="foreColorPicker-'+this.options.id+'" class="note-btn note-color-select-btn" value="'+this.options.colorButton.foreColor+'" data-event="foreColorPalette-'+this.options.id+'">',"</div>",'<div class="note-holder-custom" id="foreColorPalette-'+this.options.id+'" data-event="foreColor"></div>',"</div>"].join(""):""),callback:function(o){o.find(".note-holder").each(function(t,e){var o=w()(e);o.append(c.ui.palette({colors:c.options.colors,colorsName:c.options.colorsName,eventName:o.data("event"),container:c.options.container,tooltip:c.options.tooltip}).render())});var n=[["#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"]];o.find(".note-holder-custom").each(function(t,e){var o=w()(e);o.append(c.ui.palette({colors:n,colorsName:n,eventName:o.data("event"),container:c.options.container,tooltip:c.options.tooltip}).render())});o.find("input[type=color]").each(function(t,e){w()(e).on("change",function(){var t=o.find("#"+w()(this).data("event")).find(".note-color-btn").first(),e=this.value.toUpperCase();t.css("background-color",e).attr("aria-label",e).attr("data-value",e).attr("data-original-title",e);t.trigger("click")})})},click:function(t){t.stopPropagation();var e=w()("."+l).find(".note-dropdown-menu"),o=w()(t.target),n=o.data("event"),i=o.attr("data-value");if("openPalette"===n){var r=e.find("#"+i),e=w()(e.find("#"+r.data("event")).find(".note-color-row")[0]),a=e.find(".note-color-btn").last().detach(),s=r.val();a.css("background-color",s).attr("aria-label",s).attr("data-value",s).attr("data-original-title",s);e.prepend(a);r.trigger("click")}else{if(d.contains(["backColor","foreColor"],n)){s="backColor"===n?"background-color":"color",e=o.closest(".note-color").find(".note-recent-color"),a=o.closest(".note-color").find(".note-current-color-button");e.css(s,i);a.attr("data-"+n,i)}c.context.invoke("editor."+n,i)}}})]}).render()}},{key:"addToolbarButtons",value:function(){for(var r=this,e=(this.context.memo("button.style",function(){return r.ui.buttonGroup([r.button({className:"dropdown-toggle",contents:r.ui.dropdownButtonContents(r.ui.icon(r.options.icons.magic),r.options),tooltip:r.lang.style.style,data:{toggle:"dropdown"}}),r.ui.dropdown({className:"dropdown-style",items:r.options.styleTags,title:r.lang.style.style,template:function(t){"string"==typeof t&&(t={tag:t,title:Object.prototype.hasOwnProperty.call(r.lang.style,t)?r.lang.style[t]:t});var e=t.tag,o=t.title,n=t.style?' style="'+t.style+'" ':"",i=t.className?' class="'+t.className+'"':"";return"<"+e+n+i+">"+o+"</"+e+">"},click:r.context.createInvokeHandler("editor.formatBlock")})]).render()}),0),t=this.options.styleTags.length;e<t;e++)(()=>{var t=r.options.styleTags[e];r.context.memo("button.style."+t,function(){return r.button({className:"note-btn-style-"+t,contents:'<div data-value="'+t+'">'+t.toUpperCase()+"</div>",tooltip:r.lang.style[t],click:r.context.createInvokeHandler("editor.formatBlock")}).render()})})();this.context.memo("button.bold",function(){return r.button({className:"note-btn-bold",contents:r.ui.icon(r.options.icons.bold),tooltip:r.lang.font.bold+r.representShortcut("bold"),click:r.context.createInvokeHandlerAndUpdateState("editor.bold")}).render()});this.context.memo("button.italic",function(){return r.button({className:"note-btn-italic",contents:r.ui.icon(r.options.icons.italic),tooltip:r.lang.font.italic+r.representShortcut("italic"),click:r.context.createInvokeHandlerAndUpdateState("editor.italic")}).render()});this.context.memo("button.underline",function(){return r.button({className:"note-btn-underline",contents:r.ui.icon(r.options.icons.underline),tooltip:r.lang.font.underline+r.representShortcut("underline"),click:r.context.createInvokeHandlerAndUpdateState("editor.underline")}).render()});this.context.memo("button.clear",function(){return r.button({contents:r.ui.icon(r.options.icons.eraser),tooltip:r.lang.font.clear+r.representShortcut("removeFormat"),click:r.context.createInvokeHandler("editor.removeFormat")}).render()});this.context.memo("button.strikethrough",function(){return r.button({className:"note-btn-strikethrough",contents:r.ui.icon(r.options.icons.strikethrough),tooltip:r.lang.font.strikethrough+r.representShortcut("strikethrough"),click:r.context.createInvokeHandlerAndUpdateState("editor.strikethrough")}).render()});this.context.memo("button.superscript",function(){return r.button({className:"note-btn-superscript",contents:r.ui.icon(r.options.icons.superscript),tooltip:r.lang.font.superscript,click:r.context.createInvokeHandlerAndUpdateState("editor.superscript")}).render()});this.context.memo("button.subscript",function(){return r.button({className:"note-btn-subscript",contents:r.ui.icon(r.options.icons.subscript),tooltip:r.lang.font.subscript,click:r.context.createInvokeHandlerAndUpdateState("editor.subscript")}).render()});this.context.memo("button.fontname",function(){var t=r.context.invoke("editor.currentStyle");r.options.addDefaultFonts&&w().each(t["font-family"].split(","),function(t,e){e=e.trim().replace(/['"]+/g,"");r.isFontDeservedToAdd(e)&&-1===r.options.fontNames.indexOf(e)&&r.options.fontNames.push(e)});return r.ui.buttonGroup([r.button({className:"dropdown-toggle",contents:r.ui.dropdownButtonContents('<span class="note-current-fontname"></span>',r.options),tooltip:r.lang.font.name,data:{toggle:"dropdown"}}),r.ui.dropdownCheck({className:"dropdown-fontname",checkClassName:r.options.icons.menuCheck,items:r.options.fontNames.filter(r.isFontInstalled.bind(r)),title:r.lang.font.name,template:function(t){return'<span style="font-family: '+c.validFontName(t)+'">'+t+"</span>"},click:r.context.createInvokeHandlerAndUpdateState("editor.fontName")})]).render()});this.context.memo("button.fontsize",function(){return r.ui.buttonGroup([r.button({className:"dropdown-toggle",contents:r.ui.dropdownButtonContents('<span class="note-current-fontsize"></span>',r.options),tooltip:r.lang.font.size,data:{toggle:"dropdown"}}),r.ui.dropdownCheck({className:"dropdown-fontsize",checkClassName:r.options.icons.menuCheck,items:r.options.fontSizes,title:r.lang.font.size,click:r.context.createInvokeHandlerAndUpdateState("editor.fontSize")})]).render()});this.context.memo("button.fontsizeunit",function(){return r.ui.buttonGroup([r.button({className:"dropdown-toggle",contents:r.ui.dropdownButtonContents('<span class="note-current-fontsizeunit"></span>',r.options),tooltip:r.lang.font.sizeunit,data:{toggle:"dropdown"}}),r.ui.dropdownCheck({className:"dropdown-fontsizeunit",checkClassName:r.options.icons.menuCheck,items:r.options.fontSizeUnits,title:r.lang.font.sizeunit,click:r.context.createInvokeHandlerAndUpdateState("editor.fontSizeUnit")})]).render()});this.context.memo("button.color",function(){return r.colorPalette("note-color-all",r.lang.color.recent,!0,!0)});this.context.memo("button.forecolor",function(){return r.colorPalette("note-color-fore",r.lang.color.foreground,!1,!0)});this.context.memo("button.backcolor",function(){return r.colorPalette("note-color-back",r.lang.color.background,!0,!1)});this.context.memo("button.ul",function(){return r.button({contents:r.ui.icon(r.options.icons.unorderedlist),tooltip:r.lang.lists.unordered+r.representShortcut("insertUnorderedList"),click:r.context.createInvokeHandler("editor.insertUnorderedList")}).render()});this.context.memo("button.ol",function(){return r.button({contents:r.ui.icon(r.options.icons.orderedlist),tooltip:r.lang.lists.ordered+r.representShortcut("insertOrderedList"),click:r.context.createInvokeHandler("editor.insertOrderedList")}).render()});var o=this.button({contents:this.ui.icon(this.options.icons.alignLeft),tooltip:this.lang.paragraph.left+this.representShortcut("justifyLeft"),click:this.context.createInvokeHandler("editor.justifyLeft")}),n=this.button({contents:this.ui.icon(this.options.icons.alignCenter),tooltip:this.lang.paragraph.center+this.representShortcut("justifyCenter"),click:this.context.createInvokeHandler("editor.justifyCenter")}),i=this.button({contents:this.ui.icon(this.options.icons.alignRight),tooltip:this.lang.paragraph.right+this.representShortcut("justifyRight"),click:this.context.createInvokeHandler("editor.justifyRight")}),a=this.button({contents:this.ui.icon(this.options.icons.alignJustify),tooltip:this.lang.paragraph.justify+this.representShortcut("justifyFull"),click:this.context.createInvokeHandler("editor.justifyFull")}),s=this.button({contents:this.ui.icon(this.options.icons.outdent),tooltip:this.lang.paragraph.outdent+this.representShortcut("outdent"),click:this.context.createInvokeHandler("editor.outdent")}),l=this.button({contents:this.ui.icon(this.options.icons.indent),tooltip:this.lang.paragraph.indent+this.representShortcut("indent"),click:this.context.createInvokeHandler("editor.indent")});this.context.memo("button.justifyLeft",u.invoke(o,"render"));this.context.memo("button.justifyCenter",u.invoke(n,"render"));this.context.memo("button.justifyRight",u.invoke(i,"render"));this.context.memo("button.justifyFull",u.invoke(a,"render"));this.context.memo("button.outdent",u.invoke(s,"render"));this.context.memo("button.indent",u.invoke(l,"render"));this.context.memo("button.paragraph",function(){return r.ui.buttonGroup([r.button({className:"dropdown-toggle",contents:r.ui.dropdownButtonContents(r.ui.icon(r.options.icons.alignLeft),r.options),tooltip:r.lang.paragraph.paragraph,data:{toggle:"dropdown"}}),r.ui.dropdown([r.ui.buttonGroup({className:"note-align",children:[o,n,i,a]}),r.ui.buttonGroup({className:"note-list",children:[s,l]})])]).render()});this.context.memo("button.height",function(){return r.ui.buttonGroup([r.button({className:"dropdown-toggle",contents:r.ui.dropdownButtonContents(r.ui.icon(r.options.icons.textHeight),r.options),tooltip:r.lang.font.height,data:{toggle:"dropdown"}}),r.ui.dropdownCheck({items:r.options.lineHeights,checkClassName:r.options.icons.menuCheck,className:"dropdown-line-height",title:r.lang.font.height,click:r.context.createInvokeHandler("editor.lineHeight")})]).render()});this.context.memo("button.table",function(){return r.ui.buttonGroup([r.button({className:"dropdown-toggle",contents:r.ui.dropdownButtonContents(r.ui.icon(r.options.icons.table),r.options),tooltip:r.lang.table.table,data:{toggle:"dropdown"}}),r.ui.dropdown({title:r.lang.table.table,className:"note-table",items:['<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>'].join("")})],{callback:function(t){var e=t.find(".note-dimension-picker-mousecatcher");e.css({width:r.options.insertTableMaxSize.col+"em",height:r.options.insertTableMaxSize.row+"em"}).on("mousedown",r.context.createInvokeHandler("editor.insertTable")).on("mousemove",r.tableMoveHandler.bind(r))}}).render()});this.context.memo("button.link",function(){return r.button({contents:r.ui.icon(r.options.icons.link),tooltip:r.lang.link.link+r.representShortcut("linkDialog.show"),click:r.context.createInvokeHandler("linkDialog.show")}).render()});this.context.memo("button.picture",function(){return r.button({contents:r.ui.icon(r.options.icons.picture),tooltip:r.lang.image.image,click:r.context.createInvokeHandler("imageDialog.show")}).render()});this.context.memo("button.video",function(){return r.button({contents:r.ui.icon(r.options.icons.video),tooltip:r.lang.video.video,click:r.context.createInvokeHandler("videoDialog.show")}).render()});this.context.memo("button.hr",function(){return r.button({contents:r.ui.icon(r.options.icons.minus),tooltip:r.lang.hr.insert+r.representShortcut("insertHorizontalRule"),click:r.context.createInvokeHandler("editor.insertHorizontalRule")}).render()});this.context.memo("button.fullscreen",function(){return r.button({className:"btn-fullscreen note-codeview-keep",contents:r.ui.icon(r.options.icons.arrowsAlt),tooltip:r.lang.options.fullscreen,click:r.context.createInvokeHandler("fullscreen.toggle")}).render()});this.context.memo("button.codeview",function(){return r.button({className:"btn-codeview note-codeview-keep",contents:r.ui.icon(r.options.icons.code),tooltip:r.lang.options.codeview,click:r.context.createInvokeHandler("codeview.toggle")}).render()});this.context.memo("button.redo",function(){return r.button({contents:r.ui.icon(r.options.icons.redo),tooltip:r.lang.history.redo+r.representShortcut("redo"),click:r.context.createInvokeHandler("editor.redo")}).render()});this.context.memo("button.undo",function(){return r.button({contents:r.ui.icon(r.options.icons.undo),tooltip:r.lang.history.undo+r.representShortcut("undo"),click:r.context.createInvokeHandler("editor.undo")}).render()});this.context.memo("button.help",function(){return r.button({contents:r.ui.icon(r.options.icons.question),tooltip:r.lang.options.help,click:r.context.createInvokeHandler("helpDialog.show")}).render()})}},{key:"addImagePopoverButtons",value:function(){var t=this;this.context.memo("button.resizeFull",function(){return t.button({contents:'<span class="note-fontsize-10">100%</span>',tooltip:t.lang.image.resizeFull,click:t.context.createInvokeHandler("editor.resize","1")}).render()});this.context.memo("button.resizeHalf",function(){return t.button({contents:'<span class="note-fontsize-10">50%</span>',tooltip:t.lang.image.resizeHalf,click:t.context.createInvokeHandler("editor.resize","0.5")}).render()});this.context.memo("button.resizeQuarter",function(){return t.button({contents:'<span class="note-fontsize-10">25%</span>',tooltip:t.lang.image.resizeQuarter,click:t.context.createInvokeHandler("editor.resize","0.25")}).render()});this.context.memo("button.resizeNone",function(){return t.button({contents:t.ui.icon(t.options.icons.rollback),tooltip:t.lang.image.resizeNone,click:t.context.createInvokeHandler("editor.resize","0")}).render()});this.context.memo("button.floatLeft",function(){return t.button({contents:t.ui.icon(t.options.icons.floatLeft),tooltip:t.lang.image.floatLeft,click:t.context.createInvokeHandler("editor.floatMe","left")}).render()});this.context.memo("button.floatRight",function(){return t.button({contents:t.ui.icon(t.options.icons.floatRight),tooltip:t.lang.image.floatRight,click:t.context.createInvokeHandler("editor.floatMe","right")}).render()});this.context.memo("button.floatNone",function(){return t.button({contents:t.ui.icon(t.options.icons.rollback),tooltip:t.lang.image.floatNone,click:t.context.createInvokeHandler("editor.floatMe","none")}).render()});this.context.memo("button.removeMedia",function(){return t.button({contents:t.ui.icon(t.options.icons.trash),tooltip:t.lang.image.remove,click:t.context.createInvokeHandler("editor.removeMedia")}).render()})}},{key:"addLinkPopoverButtons",value:function(){var t=this;this.context.memo("button.linkDialogShow",function(){return t.button({contents:t.ui.icon(t.options.icons.link),tooltip:t.lang.link.edit,click:t.context.createInvokeHandler("linkDialog.show")}).render()});this.context.memo("button.unlink",function(){return t.button({contents:t.ui.icon(t.options.icons.unlink),tooltip:t.lang.link.unlink,click:t.context.createInvokeHandler("editor.unlink")}).render()})}},{key:"addTablePopoverButtons",value:function(){var t=this;this.context.memo("button.addRowUp",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowAbove),tooltip:t.lang.table.addRowAbove,click:t.context.createInvokeHandler("editor.addRow","top")}).render()});this.context.memo("button.addRowDown",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowBelow),tooltip:t.lang.table.addRowBelow,click:t.context.createInvokeHandler("editor.addRow","bottom")}).render()});this.context.memo("button.addColLeft",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colBefore),tooltip:t.lang.table.addColLeft,click:t.context.createInvokeHandler("editor.addCol","left")}).render()});this.context.memo("button.addColRight",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colAfter),tooltip:t.lang.table.addColRight,click:t.context.createInvokeHandler("editor.addCol","right")}).render()});this.context.memo("button.deleteRow",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowRemove),tooltip:t.lang.table.delRow,click:t.context.createInvokeHandler("editor.deleteRow")}).render()});this.context.memo("button.deleteCol",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colRemove),tooltip:t.lang.table.delCol,click:t.context.createInvokeHandler("editor.deleteCol")}).render()});this.context.memo("button.deleteTable",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.trash),tooltip:t.lang.table.delTable,click:t.context.createInvokeHandler("editor.deleteTable")}).render()})}},{key:"build",value:function(t,e){for(var o=0,n=e.length;o<n;o++){for(var i=e[o],r=Array.isArray(i)?i[0]:i,a=Array.isArray(i)?1===i.length?[i[0]]:i[1]:[i],s=this.ui.buttonGroup({className:"note-"+r}).render(),l=0,c=a.length;l<c;l++){var u=this.context.memo("button."+a[l]);u&&s.append("function"==typeof u?u(this.context):u)}s.appendTo(t)}}},{key:"updateCurrentStyle",value:function(t){var e=t||this.$toolbar,o=this.context.invoke("editor.currentStyle");this.updateBtnStates(e,{".note-btn-bold":function(){return"bold"===o["font-bold"]},".note-btn-italic":function(){return"italic"===o["font-italic"]},".note-btn-underline":function(){return"underline"===o["font-underline"]},".note-btn-subscript":function(){return"subscript"===o["font-subscript"]},".note-btn-superscript":function(){return"superscript"===o["font-superscript"]},".note-btn-strikethrough":function(){return"strikethrough"===o["font-strikethrough"]}});if(o["font-family"]){var n=o["font-family"].split(",").map(function(t){return t.replace(/[\'\"]/g,"").replace(/\s+$/,"").replace(/^\s+/,"")}),i=d.find(n,this.isFontInstalled.bind(this));e.find(".dropdown-fontname a").each(function(t,e){var o=w()(e),n=o.data("value")+""==i+"";o.toggleClass("checked",n)});e.find(".note-current-fontname").text(i).css("font-family",i)}if(o["font-size"]){var r=o["font-size"];e.find(".dropdown-fontsize a").each(function(t,e){var o=w()(e),n=o.data("value")+""==r+"";o.toggleClass("checked",n)});e.find(".note-current-fontsize").text(r);var a=o["font-size-unit"];e.find(".dropdown-fontsizeunit a").each(function(t,e){var o=w()(e),n=o.data("value")+""==a+"";o.toggleClass("checked",n)});e.find(".note-current-fontsizeunit").text(a)}if(o["line-height"]){var s=o["line-height"];e.find(".dropdown-line-height a").each(function(t,e){var o=w()(e),n=w()(e).data("value")+""==s+"";o.toggleClass("checked",n)});e.find(".note-current-line-height").text(s)}}},{key:"updateBtnStates",value:function(o,t){var n=this;w().each(t,function(t,e){n.ui.toggleBtnActive(o.find(t),e())})}},{key:"tableMoveHandler",value:function(t){var e=w()(t.target.parentNode),o=e.next(),n=e.find(".note-dimension-picker-mousecatcher"),i=e.find(".note-dimension-picker-highlighted"),e=e.find(".note-dimension-picker-unhighlighted");a=void 0===t.offsetX?(a=w()(t.target).offset(),{x:t.pageX-a.left,y:t.pageY-a.top}):{x:t.offsetX,y:t.offsetY};var r=Math.ceil(a.x/18)||1,a=Math.ceil(a.y/18)||1;i.css({width:r+"em",height:a+"em"});n.data("value",r+"x"+a);3<r&&r<this.options.insertTableMaxSize.col&&e.css({width:r+1+"em"});3<a&&a<this.options.insertTableMaxSize.row&&e.css({height:a+1+"em"});o.html(r+" x "+a)}}],e&&Ce(t.prototype,e),o&&Ce(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function xe(t){return xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xe(t)}function Ee(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=xe(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=xe(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==xe(n)?n:n+""),r)}}var Te=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.$window=w()(window);this.$document=w()(document);this.ui=w().summernote.ui;this.$note=e.layoutInfo.note;this.$editor=e.layoutInfo.editor;this.$toolbar=e.layoutInfo.toolbar;this.$editable=e.layoutInfo.editable;this.$statusbar=e.layoutInfo.statusbar;this.options=e.options;this.isFollowing=!1;this.followScroll=this.followScroll.bind(this)},e=[{key:"shouldInitialize",value:function(){return!this.options.airMode}},{key:"initialize",value:function(){var t=this;this.options.toolbar=this.options.toolbar||[];this.options.toolbar.length?this.context.invoke("buttons.build",this.$toolbar,this.options.toolbar):this.$toolbar.hide();this.options.toolbarContainer&&this.$toolbar.appendTo(this.options.toolbarContainer);this.changeContainer(!1);this.$note.on("summernote.keyup summernote.mouseup summernote.change",function(){t.context.invoke("buttons.updateCurrentStyle")});this.context.invoke("buttons.updateCurrentStyle");this.options.followingToolbar&&this.$window.on("scroll resize",this.followScroll)}},{key:"destroy",value:function(){this.$toolbar.children().remove();this.options.followingToolbar&&this.$window.off("scroll resize",this.followScroll)}},{key:"followScroll",value:function(){if(this.$editor.hasClass("fullscreen"))return!1;var t=this.$editor.outerHeight(),e=this.$editor.width(),o=this.$toolbar.height(),n=this.$statusbar.height(),i=0,r=(this.options.otherStaticBar&&(i=w()(this.options.otherStaticBar).outerHeight()),this.$document.scrollTop()),a=this.$editor.offset().top,t=a+t,a=a-i,t=t-i-o-n;if(!this.isFollowing&&a<r&&r<t-o){this.isFollowing=!0;this.$editable.css({marginTop:this.$toolbar.outerHeight()});this.$toolbar.css({position:"fixed",top:i,width:e,zIndex:1e3})}else if(this.isFollowing&&(r<a||t<r)){this.isFollowing=!1;this.$toolbar.css({position:"relative",top:0,width:"100%",zIndex:"auto"});this.$editable.css({marginTop:""})}}},{key:"changeContainer",value:function(t){t?this.$toolbar.prependTo(this.$editor):this.options.toolbarContainer&&this.$toolbar.appendTo(this.options.toolbarContainer);this.options.followingToolbar&&this.followScroll()}},{key:"updateFullscreen",value:function(t){this.ui.toggleBtnActive(this.$toolbar.find(".btn-fullscreen"),t);this.changeContainer(t)}},{key:"updateCodeview",value:function(t){this.ui.toggleBtnActive(this.$toolbar.find(".btn-codeview"),t);t?this.deactivate():this.activate()}},{key:"activate",value:function(t){var e=this.$toolbar.find("button");t||(e=e.not(".note-codeview-keep"));this.ui.toggleBtn(e,!0)}},{key:"deactivate",value:function(t){var e=this.$toolbar.find("button");t||(e=e.not(".note-codeview-keep"));this.ui.toggleBtn(e,!1)}}],e&&Ee(t.prototype,e),o&&Ee(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function Pe(t){return Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pe(t)}function Ne(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=Pe(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=Pe(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==Pe(n)?n:n+""),r)}}var Ie=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,$e=/^(\+?\d{1,3}[\s-]?)?(\d{1,4})[\s-]?(\d{1,4})[\s-]?(\d{1,4})$/,Re=/^([A-Za-z][A-Za-z0-9+-.]*\:|#|\/)/,Ae=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.$body=w()(document.body);this.$editor=e.layoutInfo.editor;this.options=e.options;this.lang=this.options.langInfo;e.memo("help.linkDialog.show",this.options.langInfo.help["linkDialog.show"])},e=[{key:"initialize",value:function(){var t=this.options.dialogsInBody?this.$body:this.options.container,e=['<div class="form-group note-form-group">','<label for="note-dialog-link-txt-'.concat(this.options.id,'" class="note-form-label">').concat(this.lang.link.textToDisplay,"</label>"),'<input id="note-dialog-link-txt-'.concat(this.options.id,'" class="note-link-text form-control note-form-control note-input" type="text"/>'),"</div>",'<div class="form-group note-form-group">','<label for="note-dialog-link-url-'.concat(this.options.id,'" class="note-form-label">').concat(this.lang.link.url,"</label>"),'<input id="note-dialog-link-url-'.concat(this.options.id,'" class="note-link-url form-control note-form-control note-input" type="text" value="http://"/>'),"</div>",this.options.disableLinkTarget?"":w()("<div></div>").append(this.ui.checkbox({className:"sn-checkbox-open-in-new-window",text:this.lang.link.openInNewWindow,checked:!0}).render()).html()].join(""),o='<input type="button" href="#" class="'.concat("btn btn-primary note-btn note-btn-primary note-link-btn",'" value="').concat(this.lang.link.insert,'" disabled>');this.$dialog=this.ui.dialog({className:"link-dialog",title:this.lang.link.insert,fade:this.options.dialogsFade,body:e,footer:o}).render().appendTo(t)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog);this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",function(t){if(t.keyCode===s.code.ENTER){t.preventDefault();e.trigger("click")}})}},{key:"checkLinkUrl",value:function(t){return Ie.test(t)?"mailto://"+t:$e.test(t)?"tel://"+t:Re.test(t)?t:"http://"+t}},{key:"onCheckLinkUrl",value:function(t){var e=this;t.on("blur",function(t){t.target.value=""==t.target.value?"":e.checkLinkUrl(t.target.value)})}},{key:"toggleLinkBtn",value:function(t,e,o){this.ui.toggleBtn(t,e.val()&&o.val())}},{key:"showLinkDialog",value:function(a){var s=this;return w().Deferred(function(e){var o=s.$dialog.find(".note-link-text"),n=s.$dialog.find(".note-link-url"),i=s.$dialog.find(".note-link-btn"),r=s.$dialog.find(".sn-checkbox-open-in-new-window input[type=checkbox]");s.ui.onDialogShown(s.$dialog,function(){s.context.triggerEvent("dialog.shown");!a.url&&u.isValidUrl(a.text)&&(a.url=s.checkLinkUrl(a.text));o.on("input paste propertychange",function(){var t=o.val(),e=document.createElement("div");e.innerText=t;t=e.innerHTML;a.text=t;s.toggleLinkBtn(i,o,n)}).val(a.text);n.on("input paste propertychange",function(){a.text||o.val(n.val());s.toggleLinkBtn(i,o,n)}).val(a.url);c.isSupportTouch||n.trigger("focus");s.toggleLinkBtn(i,o,n);s.bindEnterKey(n,i);s.bindEnterKey(o,i);s.onCheckLinkUrl(n);var t=void 0!==a.isNewWindow?a.isNewWindow:s.context.options.linkTargetBlank;r.prop("checked",t);i.one("click",function(t){t.preventDefault();e.resolve({range:a.range,url:n.val(),text:o.val(),isNewWindow:r.is(":checked")});s.ui.hideDialog(s.$dialog)})});s.ui.onDialogHidden(s.$dialog,function(){o.off();n.off();i.off();"pending"===e.state()&&e.reject()});s.ui.showDialog(s.$dialog)}).promise()}},{key:"show",value:function(){var e=this,t=this.context.invoke("editor.getLinkInfo");this.context.invoke("editor.saveRange");this.showLinkDialog(t).then(function(t){e.context.invoke("editor.restoreRange");e.context.invoke("editor.createLink",t)}).fail(function(){e.context.invoke("editor.restoreRange")})}}],e&&Ne(t.prototype,e),o&&Ne(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function Le(t){return Le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Le(t)}function Fe(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=Le(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=Le(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==Le(n)?n:n+""),r)}}var De=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.options=e.options;this.events={"summernote.keyup summernote.mouseup summernote.change summernote.scroll":function(){o.update()},"summernote.disable summernote.dialog.shown":function(){o.hide()},"summernote.blur":function(t,e){e.originalEvent&&e.originalEvent.relatedTarget&&o.$popover[0].contains(e.originalEvent.relatedTarget)||o.hide()}}},e=[{key:"shouldInitialize",value:function(){return!d.isEmpty(this.options.popover.link)}},{key:"initialize",value:function(){this.$popover=this.ui.popover({className:"note-link-popover",callback:function(t){var e=t.find(".popover-content,.note-popover-content");e.prepend('<span><a target="_blank"></a>&nbsp;</span>')}}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.link);this.$popover.on("mousedown",function(t){t.preventDefault()})}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(){if(this.context.invoke("editor.hasFocus")){var t=this.context.invoke("editor.getLastRange");if(t.isCollapsed()&&t.isOnAnchor()){var t=h.ancestor(t.sc,h.isAnchor),e=w()(t).attr("href"),e=(this.$popover.find("a").attr("href",e).text(e),h.posFromPlaceholder(t)),t=w()(this.options.container).offset();e.top-=t.top;e.left-=t.left;this.$popover.css({display:"block",left:e.left,top:e.top})}else this.hide()}else this.hide()}},{key:"hide",value:function(){this.$popover.hide()}}],e&&Fe(t.prototype,e),o&&Fe(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function He(t){return He="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},He(t)}function je(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=He(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=He(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==He(n)?n:n+""),r)}}var ze=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.$body=w()(document.body);this.$editor=e.layoutInfo.editor;this.options=e.options;this.lang=this.options.langInfo},e=[{key:"initialize",value:function(){var t="",e=(this.options.maximumImageFileSize&&(e=Math.floor(Math.log(this.options.maximumImageFileSize)/Math.log(1024)),e=+(this.options.maximumImageFileSize/Math.pow(1024,e)).toFixed(2)+" "+" KMGTP"[e]+"B",t="<small>".concat(this.lang.image.maximumFileSize+" : "+e,"</small>")),this.options.dialogsInBody?this.$body:this.options.container),t=['<div class="form-group note-form-group note-group-select-from-files">','<label for="note-dialog-image-file-'+this.options.id+'" class="note-form-label">'+this.lang.image.selectFromFiles+"</label>",'<input id="note-dialog-image-file-'+this.options.id+'" class="note-image-input form-control-file note-form-control note-input" ',' type="file" name="files" accept="'+this.options.acceptImageFileTypes+'" multiple="multiple"/>',t,"</div>",'<div class="form-group note-group-image-url">','<label for="note-dialog-image-url-'+this.options.id+'" class="note-form-label">'+this.lang.image.url+"</label>",'<input id="note-dialog-image-url-'+this.options.id+'" class="note-image-url form-control note-form-control note-input" type="text"/>',"</div>"].join(""),o='<input type="button" href="#" class="'.concat("btn btn-primary note-btn note-btn-primary note-image-btn",'" value="').concat(this.lang.image.insert,'" disabled>');this.$dialog=this.ui.dialog({title:this.lang.image.insert,fade:this.options.dialogsFade,body:t,footer:o}).render().appendTo(e)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog);this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",function(t){if(t.keyCode===s.code.ENTER){t.preventDefault();e.trigger("click")}})}},{key:"show",value:function(){var e=this;this.context.invoke("editor.saveRange");this.showImageDialog().then(function(t){e.ui.hideDialog(e.$dialog);e.context.invoke("editor.restoreRange");"string"==typeof t?e.options.callbacks.onImageLinkInsert?e.context.triggerEvent("image.link.insert",t):e.context.invoke("editor.insertImage",t):e.context.invoke("editor.insertImagesOrCallback",t)}).fail(function(){e.context.invoke("editor.restoreRange")})}},{key:"showImageDialog",value:function(){var i=this;return w().Deferred(function(e){var t=i.$dialog.find(".note-image-input"),o=i.$dialog.find(".note-image-url"),n=i.$dialog.find(".note-image-btn");i.ui.onDialogShown(i.$dialog,function(){i.context.triggerEvent("dialog.shown");t.replaceWith(t.clone().on("change",function(t){e.resolve(t.target.files||t.target.value)}).val(""));o.on("input paste propertychange",function(){i.ui.toggleBtn(n,o.val())}).val("");c.isSupportTouch||o.trigger("focus");n.on("click",function(t){t.preventDefault();e.resolve(o.val())});i.bindEnterKey(o,n)});i.ui.onDialogHidden(i.$dialog,function(){t.off();o.off();n.off();"pending"===e.state()&&e.reject()});i.ui.showDialog(i.$dialog)})}}],e&&je(t.prototype,e),o&&je(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function Oe(t){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oe(t)}function Be(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=Oe(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=Oe(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==Oe(n)?n:n+""),r)}}var Me=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.editable=e.layoutInfo.editable[0];this.options=e.options;this.events={"summernote.disable summernote.dialog.shown":function(){o.hide()},"summernote.blur":function(t,e){e.originalEvent&&e.originalEvent.relatedTarget&&o.$popover[0].contains(e.originalEvent.relatedTarget)||o.hide()}}},e=[{key:"shouldInitialize",value:function(){return!d.isEmpty(this.options.popover.image)}},{key:"initialize",value:function(){this.$popover=this.ui.popover({className:"note-image-popover"}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.image);this.$popover.on("mousedown",function(t){t.preventDefault()})}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(t,e){if(h.isImg(t)){var o=w()(t).offset(),n=w()(this.options.container).offset(),i={};if(this.options.popatmouse){i.left=e.pageX-20;i.top=e.pageY}else i=o;i.top-=n.top;i.left-=n.left;this.$popover.css({display:"block",left:i.left,top:i.top})}else this.hide()}},{key:"hide",value:function(){this.$popover.hide()}}],e&&Be(t.prototype,e),o&&Be(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function Ue(t){return Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ue(t)}function We(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=Ue(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=Ue(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==Ue(n)?n:n+""),r)}}var Ke=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.options=e.options;this.events={"summernote.mousedown":function(t,e){o.update(e.target)},"summernote.keyup summernote.scroll summernote.change":function(){o.update()},"summernote.disable summernote.dialog.shown":function(){o.hide()},"summernote.blur":function(t,e){e.originalEvent&&e.originalEvent.relatedTarget&&o.$popover[0].contains(e.originalEvent.relatedTarget)||o.hide()}}},e=[{key:"shouldInitialize",value:function(){return!d.isEmpty(this.options.popover.table)}},{key:"initialize",value:function(){this.$popover=this.ui.popover({className:"note-table-popover"}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.table);c.isFF&&document.execCommand("enableInlineTableEditing",!1,!1);this.$popover.on("mousedown",function(t){t.preventDefault()})}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(t){if(this.context.isDisabled())return!1;var e=h.isCell(t)||h.isCell(null==t?void 0:t.parentElement);if(e){var o=h.posFromPlaceholder(t),n=w()(this.options.container).offset();o.top-=n.top;o.left-=n.left;this.$popover.css({display:"block",left:o.left,top:o.top})}else this.hide();return e}},{key:"hide",value:function(){this.$popover.hide()}}],e&&We(t.prototype,e),o&&We(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function qe(t){return qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qe(t)}function Ve(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=qe(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=qe(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==qe(n)?n:n+""),r)}}var _e=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.$body=w()(document.body);this.$editor=e.layoutInfo.editor;this.options=e.options;this.lang=this.options.langInfo},e=[{key:"initialize",value:function(){var t=this.options.dialogsInBody?this.$body:this.options.container,e=['<div class="form-group note-form-group row-fluid">','<label for="note-dialog-video-url-'.concat(this.options.id,'" class="note-form-label">').concat(this.lang.video.url,' <small class="text-muted">').concat(this.lang.video.providers,"</small></label>"),'<input id="note-dialog-video-url-'.concat(this.options.id,'" class="note-video-url form-control note-form-control note-input" type="text"/>'),"</div>"].join(""),o='<input type="button" href="#" class="'.concat("btn btn-primary note-btn note-btn-primary note-video-btn",'" value="').concat(this.lang.video.insert,'" disabled>');this.$dialog=this.ui.dialog({title:this.lang.video.insert,fade:this.options.dialogsFade,body:e,footer:o}).render().appendTo(t)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog);this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",function(t){if(t.keyCode===s.code.ENTER){t.preventDefault();e.trigger("click")}})}},{key:"createVideoNode",value:function(t){var e=t.match(/(?:youtu\.be\/|youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=|shorts\/|live\/))([^&\n?]+)(?:.*[?&]t=([^&\n]+))?.*/),o=t.match(/(?:\.|\/\/)drive\.google\.com\/file\/d\/(.[a-zA-Z0-9_-]*)\/view/),n=t.match(/(?:www\.|\/\/)instagram\.com\/(reel|p)\/(.[a-zA-Z0-9_-]*)/),i=t.match(/\/\/vine\.co\/v\/([a-zA-Z0-9]+)/),r=t.match(/\/\/(player\.)?vimeo\.com\/([a-z]*\/)*(\d+)[?]?.*/),a=t.match(/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/),s=t.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),l=t.match(/\/\/(.*)\/videos\/watch\/([^?]*)(?:\?(?:start=(\w*))?(?:&stop=(\w*))?(?:&loop=([10]))?(?:&autoplay=([10]))?(?:&muted=([10]))?)?/),c=t.match(/\/\/v\.qq\.com.*?vid=(.+)/),u=t.match(/\/\/v\.qq\.com\/x?\/?(page|cover).*?\/([^\/]+)\.html\??.*/),d=t.match(/^.+.(mp4|m4v)$/),f=t.match(/^.+.(ogg|ogv)$/),h=t.match(/^.+.(webm)$/),p=t.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/);if(e&&11===e[1].length){var m=e[1],v=0;if(void 0!==e[2]){var g=e[2].match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);if(g)for(var b=[3600,60,1],y=0,k=b.length;y<k;y++)v+=void 0!==g[y+1]?b[y]*parseInt(g[y+1],10):0;else v=parseInt(e[2],10)}m=w()("<iframe>").attr("frameborder",0).attr("src","//www.youtube.com/embed/"+m+(0<v?"?start="+v:"")).attr("width","640").attr("height","360")}else if(o&&o[0].length)m=w()("<iframe>").attr("frameborder",0).attr("src","https://drive.google.com/file/d/"+o[1]+"/preview").attr("width","640").attr("height","480");else if(n&&n[0].length)m=w()("<iframe>").attr("frameborder",0).attr("src","https://instagram.com/p/"+n[2]+"/embed/").attr("width","612").attr("height","710").attr("scrolling","no").attr("allowtransparency","true");else if(i&&i[0].length)m=w()("<iframe>").attr("frameborder",0).attr("src",i[0]+"/embed/simple").attr("width","600").attr("height","600").attr("class","vine-embed");else if(r&&r[3].length)m=w()("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("src","//player.vimeo.com/video/"+r[3]).attr("width","640").attr("height","360");else if(a&&a[2].length)m=w()("<iframe>").attr("frameborder",0).attr("src","//www.dailymotion.com/embed/video/"+a[2]).attr("width","640").attr("height","360");else if(s&&s[1].length)m=w()("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("height","498").attr("width","510").attr("src","//player.youku.com/embed/"+s[1]);else if(l&&l[0].length){e=0,o=("undefined"!==l[2]&&(e=l[2]),0),n=("undefined"!==l[3]&&(o=l[3]),0),i=("undefined"!==l[4]&&(n=l[4]),0),r=("undefined"!==l[5]&&(i=l[5]),0);"undefined"!==l[6]&&(r=l[6]);m=w()('<iframe allowfullscreen sandbox="allow-same-origin allow-scripts allow-popups">').attr("frameborder",0).attr("src","//"+l[1]+"/videos/embed/"+l[2]+"?loop="+n+"&autoplay="+i+"&muted="+r+(0<e?"&start="+e:"")+(0<o?"&end="+v:"")).attr("width","560").attr("height","315")}else if(c&&c[1].length||u&&u[2].length)a=c&&c[1].length?c[1]:u[2],m=w()("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("height","310").attr("width","500").attr("src","https://v.qq.com/txp/iframe/player.html?vid="+a+"&amp;auto=0");else if(d||f||h)m=w()("<video controls>").attr("src",t).attr("width","640").attr("height","360");else{if(!p||!p[0].length)return!1;m=w()("<iframe>").attr("frameborder",0).attr("src","https://www.facebook.com/plugins/video.php?href="+encodeURIComponent(p[0])+"&show_text=0&width=560").attr("width","560").attr("height","301").attr("scrolling","no").attr("allowtransparency","true")}m.addClass("note-video-clip");return m[0]}},{key:"show",value:function(){var o=this,t=this.context.invoke("editor.getSelectedText");this.context.invoke("editor.saveRange");this.showVideoDialog(t).then(function(t){o.ui.hideDialog(o.$dialog);o.context.invoke("editor.restoreRange");var e=o.createVideoNode(t);e&&o.context.invoke("editor.insertNode",e)}).fail(function(){o.context.invoke("editor.restoreRange")})}},{key:"showVideoDialog",value:function(){var n=this;return w().Deferred(function(e){var o=n.$dialog.find(".note-video-url"),t=n.$dialog.find(".note-video-btn");n.ui.onDialogShown(n.$dialog,function(){n.context.triggerEvent("dialog.shown");o.on("input paste propertychange",function(){n.ui.toggleBtn(t,o.val())});c.isSupportTouch||o.trigger("focus");t.on("click",function(t){t.preventDefault();e.resolve(o.val())});n.bindEnterKey(o,t)});n.ui.onDialogHidden(n.$dialog,function(){o.off();t.off();"pending"===e.state()&&e.reject()});n.ui.showDialog(n.$dialog)})}}],e&&Ve(t.prototype,e),o&&Ve(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function Ge(t){return Ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(t)}function Ze(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=Ge(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=Ge(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==Ge(n)?n:n+""),r)}}var Ye=(()=>{return t=function t(e){var o=this,n=t;if(!(o instanceof n))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.$body=w()(document.body);this.$editor=e.layoutInfo.editor;this.options=e.options;this.lang=this.options.langInfo},e=[{key:"initialize",value:function(){var t=this.options.dialogsInBody?this.$body:this.options.container,e=['<p class="text-center">','<a href="http://summernote.org/" target="_blank" rel="noopener noreferrer">Summernote 0.9.1</a> · ','<a href="https://github.com/summernote/summernote" target="_blank" rel="noopener noreferrer">Project</a> · ','<a href="https://github.com/summernote/summernote/issues" target="_blank" rel="noopener noreferrer">Issues</a>',"</p>"].join("");this.$dialog=this.ui.dialog({title:this.lang.options.help,fade:this.options.dialogsFade,body:this.createShortcutList(),footer:e,callback:function(t){t.find(".modal-body,.note-modal-body").css({"max-height":300,overflow:"scroll"})}}).render().appendTo(t)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog);this.$dialog.remove()}},{key:"createShortcutList",value:function(){var n=this,i=this.options.keyMap[c.isMac?"mac":"pc"];return Object.keys(i).map(function(t){var e=i[t],o=w()('<div><div class="help-list-item"></div></div>');o.append(w()("<label><kbd>"+t+"</kdb></label>").css({width:180,"margin-right":10})).append(w()("<span></span>").html(n.context.memo("help."+e)||e));return o.html()}).join("")}},{key:"showHelpDialog",value:function(){var e=this;return w().Deferred(function(t){e.ui.onDialogShown(e.$dialog,function(){e.context.triggerEvent("dialog.shown");t.resolve()});e.ui.showDialog(e.$dialog)}).promise()}},{key:"show",value:function(){var t=this;this.context.invoke("editor.saveRange");this.showHelpDialog().then(function(){t.context.invoke("editor.restoreRange")})}}],e&&Ze(t.prototype,e),o&&Ze(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function Xe(t){return Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xe(t)}function Qe(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=Xe(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=Xe(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==Xe(n)?n:n+""),r)}}var Je=(()=>{return t=function t(e){var n=this,o=this,i=t;if(!(o instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.options=e.options;this.hidable=!0;this.onContextmenu=!1;this.pageX=null;this.pageY=null;this.events={"summernote.contextmenu":function(t){if(n.options.editing){t.preventDefault();t.stopPropagation();n.onContextmenu=!0;n.update(!0)}},"summernote.mousedown":function(t,e){n.pageX=e.pageX;n.pageY=e.pageY},"summernote.keyup summernote.mouseup summernote.scroll":function(t,e){if(n.options.editing&&!n.onContextmenu){if("keyup"==e.type){var o=n.context.invoke("editor.getLastRange"),o=o.getWordRange(),o=u.rect2bnd(d.last(o.getClientRects()));n.pageX=o.left;n.pageY=o.top}else{n.pageX=e.pageX;n.pageY=e.pageY}n.update()}n.onContextmenu=!1},"summernote.disable summernote.change summernote.dialog.shown summernote.blur":function(){n.hide()},"summernote.focusout":function(){n.$popover.is(":active,:focus")||n.hide()}}},e=[{key:"shouldInitialize",value:function(){return this.options.airMode&&!d.isEmpty(this.options.popover.air)}},{key:"initialize",value:function(){var t=this,e=(this.$popover=this.ui.popover({className:"note-air-popover"}).render().appendTo(this.options.container),this.$popover.find(".popover-content"));this.context.invoke("buttons.build",e,this.options.popover.air);this.$popover.on("mousedown",function(){t.hidable=!1});this.$popover.on("mouseup",function(){t.hidable=!0})}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(t){var e=this.context.invoke("editor.currentStyle");if(!e.range||e.range.isCollapsed()&&!t)this.hide();else{var e={left:this.pageX,top:this.pageY},o=w()(this.options.container).offset();e.top-=o.top;e.left-=o.left;this.$popover.css({display:"block",left:Math.max(e.left,0)+-5,top:e.top+5});this.context.invoke("buttons.updateCurrentStyle",this.$popover)}}},{key:"updateCodeview",value:function(t){this.ui.toggleBtnActive(this.$popover.find(".btn-codeview"),t);t&&this.hide()}},{key:"hide",value:function(){this.hidable&&this.$popover.hide()}}],e&&Qe(t.prototype,e),o&&Qe(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();function to(t){return to="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},to(t)}function eo(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=to(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=to(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==to(n)?n:n+""),r)}}var oo=(()=>{return t=function t(e){var o=this,n=this,i=t;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.context=e;this.ui=w().summernote.ui;this.$editable=e.layoutInfo.editable;this.options=e.options;this.hint=this.options.hint||[];this.direction=this.options.hintDirection||"bottom";this.hints=Array.isArray(this.hint)?this.hint:[this.hint];this.events={"summernote.keyup":function(t,e){e.isDefaultPrevented()||o.handleKeyup(e)},"summernote.keydown":function(t,e){o.handleKeydown(e)},"summernote.disable summernote.dialog.shown summernote.blur":function(){o.hide()}}},e=[{key:"shouldInitialize",value:function(){return 0<this.hints.length}},{key:"initialize",value:function(){var e=this;this.lastWordRange=null;this.matchingWord=null;this.$popover=this.ui.popover({className:"note-hint-popover",hideArrow:!0,direction:""}).render().appendTo(this.options.container);this.$popover.hide();this.$content=this.$popover.find(".popover-content,.note-popover-content");this.$content.on("click",".note-hint-item",function(t){e.$content.find(".active").removeClass("active");w()(t.currentTarget).addClass("active");e.replace()});this.$popover.on("mousedown",function(t){t.preventDefault()})}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"selectItem",value:function(t){this.$content.find(".active").removeClass("active");t.addClass("active");this.$content[0].scrollTop=t[0].offsetTop-this.$content.innerHeight()/2}},{key:"moveDown",value:function(){var t=this.$content.find(".note-hint-item.active"),e=t.next();if(e.length)this.selectItem(e);else{e=t.parent().next();e.length||(e=this.$content.find(".note-hint-group").first());this.selectItem(e.find(".note-hint-item").first())}}},{key:"moveUp",value:function(){var t=this.$content.find(".note-hint-item.active"),e=t.prev();if(e.length)this.selectItem(e);else{e=t.parent().prev();e.length||(e=this.$content.find(".note-hint-group").last());this.selectItem(e.find(".note-hint-item").last())}}},{key:"replace",value:function(){var t=this.$content.find(".note-hint-item.active");if(t.length){t=this.nodeFromItem(t);if(null!==this.matchingWord&&0===this.matchingWord.length)this.lastWordRange.so=this.lastWordRange.eo;else if(null!==this.matchingWord&&0<this.matchingWord.length&&!this.lastWordRange.isCollapsed()){var e=this.lastWordRange.eo-this.lastWordRange.so-this.matchingWord.length;0<e&&(this.lastWordRange.so+=e)}this.lastWordRange.insertNode(t);if("next"===this.options.hintSelect){e=document.createTextNode("");w()(t).after(e);l.createFromNodeBefore(e).select()}else l.createFromNodeAfter(t).select();this.lastWordRange=null;this.hide();this.context.invoke("editor.focus");this.context.triggerEvent("change",this.$editable.html(),this.$editable)}}},{key:"nodeFromItem",value:function(t){var e=this.hints[t.data("index")],o=t.data("item"),e=e.content?e.content(o):o;"string"==typeof e&&(e=h.createText(e));return e}},{key:"createItemTemplates",value:function(n,t){var i=this.hints[n];return t.map(function(t,e){var o=w()('<div class="note-hint-item"></div>');o.append(i.template?i.template(t):t+"");o.data({index:n,item:t});0===n&&0===e&&o.addClass("active");return o})}},{key:"handleKeydown",value:function(t){if(this.$popover.is(":visible"))if(t.keyCode===s.code.ENTER){t.preventDefault();this.replace()}else if(t.keyCode===s.code.UP){t.preventDefault();this.moveUp()}else if(t.keyCode===s.code.DOWN){t.preventDefault();this.moveDown()}}},{key:"searchKeyword",value:function(t,e,o){var n=this.hints[t];if(n&&n.match.test(e)&&n.search){var i=n.match.exec(e);this.matchingWord=i[0];n.search(i[1],o)}else o()}},{key:"createGroup",value:function(e,t){var o=this,n=w()('<div class="note-hint-group note-hint-group-'+e+'"></div>');this.searchKeyword(e,t,function(t){t=t||[];if(t.length){n.html(o.createItemTemplates(e,t));o.show()}});return n}},{key:"handleKeyup",value:function(t){var o=this;if(!d.contains([s.code.ENTER,s.code.UP,s.code.DOWN],t.keyCode)){var e,n,i=this.context.invoke("editor.getLastRange");if("words"===this.options.hintMode){e=i.getWordsRange(i);n=e.toString();this.hints.forEach(function(t){if(t.match.test(n))return e=i.getWordsMatchRange(t.match),!1});if(!e)return this.hide(),void 0}else e=i.getWordRange();n=e.toString();if(this.hints.length&&n){this.$content.empty();var r=u.rect2bnd(d.last(e.getClientRects())),a=w()(this.options.container).offset();if(r){r.top-=a.top;r.left-=a.left;this.$popover.hide();this.lastWordRange=e;this.hints.forEach(function(t,e){t.match.test(n)&&o.createGroup(e,n).appendTo(o.$content)});this.$content.find(".note-hint-item").first().addClass("active");"top"===this.direction?this.$popover.css({left:r.left,top:r.top-this.$popover.outerHeight()-5}):this.$popover.css({left:r.left,top:r.top+r.height+5})}}else this.hide()}}},{key:"show",value:function(){this.$popover.show()}},{key:"hide",value:function(){this.$popover.hide()}}],e&&eo(t.prototype,e),o&&eo(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();w().summernote=w().extend(w().summernote,{version:"0.9.1",plugins:{},dom:h,range:l,lists:d,options:{langInfo:w().summernote.lang["en-US"],editing:!0,modules:{editor:Qt,clipboard:r,dropzone:f,codeview:a,statusbar:re,fullscreen:se,handle:ce,hintPopover:oo,autoLink:fe,autoSync:pe,autoReplace:ge,placeholder:ke,buttons:Se,toolbar:Te,linkDialog:Ae,linkPopover:De,imageDialog:ze,imagePopover:Me,tablePopover:Ke,videoDialog:_e,helpDialog:Ye,airPopover:Je},buttons:{},lang:"en-US",followingToolbar:!1,toolbarPosition:"top",otherStaticBar:"",codeviewKeepButton:!1,toolbar:[["style",["style"]],["font",["bold","underline","clear"]],["fontname",["fontname"]],["color",["color"]],["para",["ul","ol","paragraph"]],["table",["table"]],["insert",["link","picture","video"]],["view",["fullscreen","codeview","help"]]],popatmouse:!0,popover:{image:[["resize",["resizeFull","resizeHalf","resizeQuarter","resizeNone"]],["float",["floatLeft","floatRight","floatNone"]],["remove",["removeMedia"]]],link:[["link",["linkDialogShow","unlink"]]],table:[["add",["addRowDown","addRowUp","addColLeft","addColRight"]],["delete",["deleteRow","deleteCol","deleteTable"]]],air:[["color",["color"]],["font",["bold","underline","clear"]],["para",["ul","paragraph"]],["table",["table"]],["insert",["link","picture"]],["view",["fullscreen","codeview"]]]},linkAddNoReferrer:!1,addLinkNoOpener:!1,airMode:!1,overrideContextMenu:!1,width:null,height:null,linkTargetBlank:!0,focus:!1,tabDisable:!1,tabSize:4,styleWithCSS:!1,shortcuts:!0,textareaAutoSync:!0,tooltip:"auto",container:null,maxTextLength:0,blockquoteBreakingLevel:2,spellCheck:!0,disableGrammar:!1,placeholder:null,inheritPlaceholder:!1,recordEveryKeystroke:!1,historyLimit:200,showDomainOnlyForAutolink:!1,hintMode:"word",hintSelect:"after",hintDirection:"bottom",styleTags:["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],fontNames:["Arial","Arial Black","Comic Sans MS","Courier New","Helvetica Neue","Helvetica","Impact","Lucida Grande","Tahoma","Times New Roman","Verdana"],fontNamesIgnoreCheck:[],addDefaultFonts:!0,fontSizes:["8","9","10","11","12","14","18","24","36"],fontSizeUnits:["px","pt"],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"]],colorsName:[["Black","Tundora","Dove Gray","Star Dust","Pale Slate","Gallery","Alabaster","White"],["Red","Orange Peel","Yellow","Green","Cyan","Blue","Electric Violet","Magenta"],["Azalea","Karry","Egg White","Zanah","Botticelli","Tropical Blue","Mischka","Twilight"],["Tonys Pink","Peach Orange","Cream Brulee","Sprout","Casper","Perano","Cold Purple","Careys Pink"],["Mandy","Rajah","Dandelion","Olivine","Gulf Stream","Viking","Blue Marguerite","Puce"],["Guardsman Red","Fire Bush","Golden Dream","Chelsea Cucumber","Smalt Blue","Boston Blue","Butterfly Bush","Cadillac"],["Sangria","Mai Tai","Buddha Gold","Forest Green","Eden","Venice Blue","Meteorite","Claret"],["Rosewood","Cinnamon","Olive","Parsley","Tiber","Midnight Blue","Valentino","Loulou"]],colorButton:{foreColor:"#000000",backColor:"#FFFF00"},lineHeights:["1.0","1.2","1.4","1.5","1.6","1.8","2.0","3.0"],tableClassName:"table table-bordered",insertTableMaxSize:{col:10,row:10},dialogsInBody:!1,dialogsFade:!1,maximumImageFileSize:null,acceptImageFileTypes:"image/*",allowClipboardImagePasting:!0,callbacks:{onBeforeCommand:null,onBlur:null,onBlurCodeview:null,onChange:null,onChangeCodeview:null,onDialogShown:null,onEnter:null,onFocus:null,onImageLinkInsert:null,onImageUpload:null,onImageUploadError:null,onInit:null,onKeydown:null,onKeyup:null,onMousedown:null,onMouseup:null,onPaste:null,onScroll:null},codemirror:{mode:"text/html",htmlMode:!0,lineNumbers:!0},codeviewFilter:!0,codeviewFilterRegex:/<\/*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|ilayer|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|t(?:itle|extarea)|xml)[^>]*?>/gi,codeviewIframeFilter:!0,codeviewIframeWhitelistSrc:[],codeviewIframeWhitelistSrcBase:["www.youtube.com","www.youtube-nocookie.com","www.facebook.com","vine.co","instagram.com","player.vimeo.com","www.dailymotion.com","player.youku.com","jumpingbean.tv","v.qq.com"],keyMap:{pc:{ESC:"escape",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":"linkDialog.show"},mac:{ESC:"escape",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":"linkDialog.show"}},icons:{align:"note-icon-align",alignCenter:"note-icon-align-center",alignJustify:"note-icon-align-justify",alignLeft:"note-icon-align-left",alignRight:"note-icon-align-right",rowBelow:"note-icon-row-below",colBefore:"note-icon-col-before",colAfter:"note-icon-col-after",rowAbove:"note-icon-row-above",rowRemove:"note-icon-row-remove",colRemove:"note-icon-col-remove",indent:"note-icon-align-indent",outdent:"note-icon-align-outdent",arrowsAlt:"note-icon-arrows-alt",bold:"note-icon-bold",caret:"note-icon-caret",circle:"note-icon-circle",close:"note-icon-close",code:"note-icon-code",eraser:"note-icon-eraser",floatLeft:"note-icon-float-left",floatRight:"note-icon-float-right",font:"note-icon-font",frame:"note-icon-frame",italic:"note-icon-italic",link:"note-icon-link",unlink:"note-icon-chain-broken",magic:"note-icon-magic",menuCheck:"note-icon-menu-check",minus:"note-icon-minus",orderedlist:"note-icon-orderedlist",pencil:"note-icon-pencil",picture:"note-icon-picture",question:"note-icon-question",redo:"note-icon-redo",rollback:"note-icon-rollback",square:"note-icon-square",strikethrough:"note-icon-strikethrough",subscript:"note-icon-subscript",superscript:"note-icon-superscript",table:"note-icon-table",textHeight:"note-icon-text-height",trash:"note-icon-trash",underline:"note-icon-underline",undo:"note-icon-undo",unorderedlist:"note-icon-unorderedlist",video:"note-icon-video"}}});function q(t){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q(t)}function no(t,e){for(var o,n,i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(o=r.key,n=void 0,n=((t,e)=>{if("object"!=q(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=q(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(o,"string"),"symbol"==q(n)?n:n+""),r)}}var io=(()=>{return t=function t(e,o,n,i){var r=this,a=t;if(!(r instanceof a))throw new TypeError("Cannot call a class as a function");this.markup=e;this.children=o;this.options=n;this.callback=i},e=[{key:"render",value:function(t){var o=w()(this.markup);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&&w().each(this.options.data,function(t,e){o.attr("data-"+t,e)});this.options&&this.options.click&&o.on("click",this.options.click);if(this.children){var e=o.find(".note-children-container");this.children.forEach(function(t){t.render(e.length?e:o)})}this.callback&&this.callback(o,this.options);this.options&&this.options.callback&&this.options.callback(o);t&&t.append(o);return o}}],e&&no(t.prototype,e),o&&no(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,o})();let n={create:function(o,n){return function(){var t="object"===q(arguments[1])?arguments[1]:arguments[0],e=Array.isArray(arguments[0])?arguments[0]:[];t&&t.children&&(e=t.children);return new io(o,e,t,n)}}};function ro(t){return ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ro(t)}function ao(t,e){return t+" "+Co(e.icons.caret,"span")}var so=n.create('<div class="note-editor note-frame panel panel-default"></div>'),lo=n.create('<div class="panel-heading note-toolbar" role="toolbar"></div>'),co=n.create('<div class="note-editing-area"></div>'),uo=n.create('<textarea class="note-codable" aria-multiline="true"></textarea>'),fo=n.create('<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"></div>'),ho=n.create(['<output class="note-status-output" role="status" aria-live="polite"></output>','<div class="note-statusbar" role="status">','<div class="note-resizebar" aria-label="Resize">','<div class="note-icon-bar"></div>','<div class="note-icon-bar"></div>','<div class="note-icon-bar"></div>',"</div>","</div>"].join("")),po=n.create('<div class="note-editor note-airframe"></div>'),mo=n.create(['<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"></div>','<output class="note-status-output" role="status" aria-live="polite"></output>'].join("")),vo=n.create('<div class="note-btn-group btn-group"></div>'),go=n.create('<ul class="note-dropdown-menu dropdown-menu"></ul>',function(t,r){var e=Array.isArray(r.items)?r.items.map(function(t){var e="string"==typeof t?t:t.value||"",o=r.template?r.template(t):t,n="object"===ro(t)?t.option:void 0,i='data-value="'+e+'"',n=void 0!==n?' data-option="'+n+'"':"";return'<li aria-label="'+e+'"><a href="#" '+i+n+">"+o+"</a></li>"}).join(""):r.items;t.html(e).attr({"aria-label":r.title});r&&r.codeviewKeepButton&&t.addClass("note-codeview-keep")}),bo=n.create('<ul class="note-dropdown-menu dropdown-menu note-check"></ul>',function(t,n){var e=Array.isArray(n.items)?n.items.map(function(t){var e="string"==typeof t?t:t.value||"",o=n.template?n.template(t):t;return'<li aria-label="'+t+'"><a href="#" data-value="'+e+'">'+Co(n.checkClassName)+" "+o+"</a></li>"}).join(""):n.items;t.html(e).attr({"aria-label":n.title});n&&n.codeviewKeepButton&&t.addClass("note-codeview-keep")}),yo=n.create('<div class="modal note-modal" aria-hidden="false" tabindex="-1" role="dialog"></div>',function(t,e){e.fade&&t.addClass("fade");t.attr({"aria-label":e.title});t.html(['<div class="modal-dialog">','<div class="modal-content">',e.title?'<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close" aria-hidden="true">&times;</button><h4 class="modal-title">'+e.title+"</h4></div>":"",'<div class="modal-body">'+e.body+"</div>",e.footer?'<div class="modal-footer">'+e.footer+"</div>":"","</div>","</div>"].join(""))}),ko=n.create(['<div class="note-popover popover in">','<div class="arrow"></div>','<div class="popover-content note-children-container"></div>',"</div>"].join(""),function(t,e){var o=void 0!==e.direction?e.direction:"bottom";t.addClass(o);e.hideArrow&&t.find(".arrow").hide()}),wo=n.create('<div class="checkbox"></div>',function(t,e){t.html(["<label"+(e.id?' for="note-'+e.id+'"':"")+">",'<input type="checkbox"'+(e.id?' id="note-'+e.id+'"':""),e.checked?" checked":"",' aria-checked="'+(e.checked?"true":"false")+'"/>',e.text||"","</label>"].join(""))}),Co=function(t,e){if(t.match(/^</))return t;e=e||"i";return"<"+e+' class="'+t+'"></'+e+">"};w().summernote=w().extend(w().summernote,{ui_template:function(h){return{editor:so,toolbar:lo,editingArea:co,codable:uo,editable:fo,statusbar:ho,airEditor:po,airEditable:mo,buttonGroup:vo,dropdown:go,dropdownButtonContents:ao,dropdownCheck:bo,dialog:yo,popover:ko,checkbox:wo,icon:Co,options:h,palette:function(t,e){return n.create('<div class="note-color-palette"></div>',function(t,e){for(var o=[],n=0,i=e.colors.length;n<i;n++){for(var r=e.eventName,a=e.colors[n],s=e.colorsName[n],l=[],c=0,u=a.length;c<u;c++){var d=a[c],f=s[c];l.push(['<button type="button" class="note-color-btn"','style="background-color:',d,'" ','data-event="',r,'" ','data-value="',d,'" ','title="',f,'" ','aria-label="',f,'" ','data-toggle="button" tabindex="-1"></button>'].join(""))}o.push('<div class="note-color-row">'+l.join("")+"</div>")}t.html(o.join(""));e.tooltip&&t.find(".note-color-btn").tooltip({container:e.container||h.container,trigger:"hover",placement:"bottom"})})(t,e)},button:function(t,e){return n.create('<button type="button" class="note-btn btn btn-default btn-sm" tabindex="-1"></button>',function(t,e){e&&e.tooltip&&t.attr({title:e.tooltip,"aria-label":e.tooltip}).tooltip({container:e.container||h.container,trigger:"hover",placement:"bottom"}).on("click",function(t){w()(t.currentTarget).tooltip("hide")});e&&e.codeviewButton&&t.addClass("note-codeview-keep")})(t,e)},toggleBtn:function(t,e){t.toggleClass("disabled",!e);t.attr("disabled",!e)},toggleBtnActive:function(t,e){t.toggleClass("active",e)},onDialogShown:function(t,e){t.one("shown.bs.modal",e)},onDialogHidden:function(t,e){t.one("hidden.bs.modal",e)},showDialog:function(t){t.modal("show")},hideDialog:function(t){t.modal("hide")},createLayout:function(t){var e=(h.airMode?po([co([uo(),mo()])]):"bottom"===h.toolbarPosition?so([co([uo(),fo()]),lo(),ho()]):so([lo(),co([uo(),fo()]),ho()])).render();e.insertAfter(t);return{note:t,editor:e,toolbar:e.find(".note-toolbar"),editingArea:e.find(".note-editing-area"),editable:e.find(".note-editable"),codable:e.find(".note-codable"),statusbar:e.find(".note-statusbar")}},removeLayout:function(t,e){t.html(e.editable.html());e.editor.remove();t.show()}}},interface:"bs3"});return{}}});
//# sourceMappingURL=summernote.js.map