if(function(t,e){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,function(t,e){"use strict";var n=[],o=t.document,i=Object.getPrototypeOf,r=n.slice,a=n.concat,s=n.push,l=n.indexOf,c={},u=c.toString,d=c.hasOwnProperty,h=d.toString,f=h.call(Object),p={},m=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType},g=function(t){return null!=t&&t===t.window},v={type:!0,src:!0,nonce:!0,noModule:!0};function b(t,e,n){var i,r,a=(n=n||o).createElement("script");if(a.text=t,e)for(i in v)(r=e[i]||e.getAttribute&&e.getAttribute(i))&&a.setAttribute(i,r);n.head.appendChild(a).parentNode.removeChild(a)}function y(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?c[u.call(t)]||"object":typeof t}var k="3.4.1",w=function(t,e){return new w.fn.init(t,e)},x=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function C(t){var e=!!t&&"length"in t&&t.length,n=y(t);return!m(t)&&!g(t)&&("array"===n||0===e||"number"==typeof e&&0+~]|"+O+")"+O+"*"),_=new RegExp(O+"|>"),V=new RegExp(B),K=new RegExp("^"+j+"$"),G={ID:new RegExp("^#("+j+")"),CLASS:new RegExp("^\\.("+j+")"),TAG:new RegExp("^("+j+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+B),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),bool:new RegExp("^(?:"+F+")$","i"),needsContext:new RegExp("^"+O+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)","i")},Q=/HTML$/i,X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,tt=/[+~]/,et=new RegExp("\\\\([\\da-f]{1,6}"+O+"?|("+O+")|.)","ig"),nt=function(t,e,n){var o="0x"+e-65536;return o!=o||n?e:o<0?String.fromCharCode(o+65536):String.fromCharCode(o>>10|55296,1023&o|56320)},ot=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,it=function(t,e){return e?"\0"===t?"\ufffd":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},rt=function(){h()},at=kt(function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{R.apply(I=P.call(w.childNodes),w.childNodes)}catch(e){R={apply:I.length?function(t,e){L.apply(t,P.call(e))}:function(t,e){for(var n=t.length,o=0;t[n++]=e[o++];);t.length=n-1}}}function st(t,e,o,i){var r,s,c,u,d,p,v,b=e&&e.ownerDocument,x=e?e.nodeType:9;if(o=o||[],"string"!=typeof t||!t||1!==x&&9!==x&&11!==x)return o;if(!i&&((e?e.ownerDocument||e:w)!==f&&h(e),e=e||f,m)){if(11!==x&&(d=J.exec(t)))if(r=d[1]){if(9===x){if(!(c=e.getElementById(r)))return o;if(c.id===r)return o.push(c),o}else if(b&&(c=b.getElementById(r))&&y(e,c)&&c.id===r)return o.push(c),o}else{if(d[2])return R.apply(o,e.getElementsByTagName(t)),o;if((r=d[3])&&n.getElementsByClassName&&e.getElementsByClassName)return R.apply(o,e.getElementsByClassName(r)),o}if(n.qsa&&!$[t+" "]&&(!g||!g.test(t))&&(1!==x||"object"!==e.nodeName.toLowerCase())){if(v=t,b=e,1===x&&_.test(t)){for((u=e.getAttribute("id"))?u=u.replace(ot,it):e.setAttribute("id",u=k),s=(p=a(t)).length;s--;)p[s]="#"+u+" "+yt(p[s]);v=p.join(","),b=tt.test(t)&&vt(e.parentNode)||e}try{return R.apply(o,b.querySelectorAll(v)),o}catch(e){$(t,!0)}finally{u===k&&e.removeAttribute("id")}}}return l(t.replace(U,"$1"),e,o,i)}function lt(){var t=[];return function e(n,i){return t.push(n+" ")>o.cacheLength&&delete e[t.shift()],e[n+" "]=i}}function ct(t){return t[k]=!0,t}function ut(t){var e=f.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function dt(t,e){for(var n=t.split("|"),i=n.length;i--;)o.attrHandle[n[i]]=e}function ht(t,e){var n=e&&t,o=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(o)return o;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function ft(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function pt(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function mt(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&at(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function gt(t){return ct(function(e){return e=+e,ct(function(n,o){for(var i,r=t([],n.length,e),a=r.length;a--;)n[i=r[a]]&&(n[i]=!(o[i]=n[i]))})})}function vt(t){return t&&void 0!==t.getElementsByTagName&&t}for(e in n=st.support={},r=st.isXML=function(t){var e=(t.ownerDocument||t).documentElement;return!Q.test(t.namespaceURI||e&&e.nodeName||"HTML")},h=st.setDocument=function(t){var e,i,a=t?t.ownerDocument||t:w;return a!==f&&9===a.nodeType&&a.documentElement&&(p=(f=a).documentElement,m=!r(f),w!==f&&(i=f.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",rt,!1):i.attachEvent&&i.attachEvent("onunload",rt)),n.attributes=ut(function(t){return t.className="i",!t.getAttribute("className")}),n.getElementsByTagName=ut(function(t){return t.appendChild(f.createComment("")),!t.getElementsByTagName("*").length}),n.getElementsByClassName=Z.test(f.getElementsByClassName),n.getById=ut(function(t){return p.appendChild(t).id=k,!f.getElementsByName||!f.getElementsByName(k).length}),n.getById?(o.filter.ID=function(t){var e=t.replace(et,nt);return function(t){return t.getAttribute("id")===e}},o.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n=e.getElementById(t);return n?[n]:[]}}):(o.filter.ID=function(t){var e=t.replace(et,nt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},o.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n,o,i,r=e.getElementById(t);if(r){if((n=r.getAttributeNode("id"))&&n.value===t)return[r];for(i=e.getElementsByName(t),o=0;r=i[o++];)if((n=r.getAttributeNode("id"))&&n.value===t)return[r]}return[]}}),o.find.TAG=n.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):n.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,o=[],i=0,r=e.getElementsByTagName(t);if("*"===t){for(;n=r[i++];)1===n.nodeType&&o.push(n);return o}return r},o.find.CLASS=n.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&m)return e.getElementsByClassName(t)},v=[],g=[],(n.qsa=Z.test(f.querySelectorAll))&&(ut(function(t){p.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+O+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||g.push("\\["+O+"*(?:value|"+F+")"),t.querySelectorAll("[id~="+k+"-]").length||g.push("~="),t.querySelectorAll(":checked").length||g.push(":checked"),t.querySelectorAll("a#"+k+"+*").length||g.push(".#.+[+~]")}),ut(function(t){t.innerHTML="";var e=f.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&g.push("name"+O+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),p.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),g.push(",.*:")})),(n.matchesSelector=Z.test(b=p.matches||p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&&ut(function(t){n.disconnectedMatch=b.call(t,"*"),b.call(t,"[s!='']:x"),v.push("!=",B)}),g=g.length&&new RegExp(g.join("|")),v=v.length&&new RegExp(v.join("|")),e=Z.test(p.compareDocumentPosition),y=e||Z.test(p.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,o=e&&e.parentNode;return t===o||!(!o||1!==o.nodeType||!(n.contains?n.contains(o):t.compareDocumentPosition&&16&t.compareDocumentPosition(o)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},N=e?function(t,e){if(t===e)return d=!0,0;var o=!t.compareDocumentPosition-!e.compareDocumentPosition;return o||(1&(o=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!n.sortDetached&&e.compareDocumentPosition(t)===o?t===f||t.ownerDocument===w&&y(w,t)?-1:e===f||e.ownerDocument===w&&y(w,e)?1:u?H(u,t)-H(u,e):0:4&o?-1:1)}:function(t,e){if(t===e)return d=!0,0;var n,o=0,i=t.parentNode,r=e.parentNode,a=[t],s=[e];if(!i||!r)return t===f?-1:e===f?1:i?-1:r?1:u?H(u,t)-H(u,e):0;if(i===r)return ht(t,e);for(n=t;n=n.parentNode;)a.unshift(n);for(n=e;n=n.parentNode;)s.unshift(n);for(;a[o]===s[o];)o++;return o?ht(a[o],s[o]):a[o]===w?-1:s[o]===w?1:0}),f},st.matches=function(t,e){return st(t,null,null,e)},st.matchesSelector=function(t,e){if((t.ownerDocument||t)!==f&&h(t),n.matchesSelector&&m&&!$[e+" "]&&(!v||!v.test(e))&&(!g||!g.test(e)))try{var o=b.call(t,e);if(o||n.disconnectedMatch||t.document&&11!==t.document.nodeType)return o}catch(t){$(e,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(et,nt),t[3]=(t[3]||t[4]||t[5]||"").replace(et,nt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||st.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&st.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return G.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&V.test(n)&&(e=a(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(et,nt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=T[t+" "];return e||(e=new RegExp("(^|"+O+")"+t+"("+O+"|$)"))&&T(t,function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,e,n){return function(o){var i=st.attr(o,t);return null==i?"!="===e:!e||(i+="","="===e?i===n:"!="===e?i!==n:"^="===e?n&&0===i.indexOf(n):"*="===e?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function I(t,e,n){return m(e)?w.grep(t,function(t,o){return!!e.call(t,o,t)!==n}):e.nodeType?w.grep(t,function(t){return t===e!==n}):"string"!=typeof e?w.grep(t,function(t){return-1)[^>]*|#([\w-]+))$/;(w.fn.init=function(t,e,n){var i,r;if(!t)return this;if(n=n||D,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&3<=t.length?[null,t,null]:L.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(w.merge(this,w.parseHTML(i[1],(e=e instanceof w?e[0]:e)&&e.nodeType?e.ownerDocument||e:o,!0)),A.test(i[1])&&w.isPlainObject(e))for(i in e)m(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(r=o.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):m(t)?void 0!==n.ready?n.ready(t):t(w):w.makeArray(t,this)}).prototype=w.fn,D=w(o);var R=/^(?:parents|prev(?:Until|All))/,P={children:!0,contents:!0,next:!0,prev:!0};function H(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}w.fn.extend({has:function(t){var e=w(t,this),n=e.length;return this.filter(function(){for(var t=0;t\x20\t\r\n\f]*)/i,pt=/^$|^module$|\/(?:java|ecma)script/i,mt={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function gt(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&N(t,e)?w.merge([t],n):n}function vt(t,e){for(var n=0,o=t.length;nx",p.noCloneChecked=!!bt.cloneNode(!0).lastChild.defaultValue;var xt=/^key/,Ct=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Tt=/^([^.]*)(?:\.(.+)|)/;function St(){return!0}function Et(){return!1}function $t(t,e){return t===function(){try{return o.activeElement}catch(t){}}()==("focus"===e)}function Nt(t,e,n,o,i,r){var a,s;if("object"==typeof e){for(s in"string"!=typeof n&&(o=o||n,n=void 0),e)Nt(t,s,n,o,e[s],r);return t}if(null==o&&null==i?(i=n,o=n=void 0):null==i&&("string"==typeof n?(i=o,o=void 0):(i=o,o=n,n=void 0)),!1===i)i=Et;else if(!i)return t;return 1===r&&(a=i,(i=function(t){return w().off(t),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),t.each(function(){w.event.add(this,e,i,o,n)})}function At(t,e,n){n?(X.set(t,e,!1),w.event.add(t,e,{namespace:!1,handler:function(t){var o,i,a=X.get(this,e);if(1&t.isTrigger&&this[e]){if(a.length)(w.event.special[e]||{}).delegateType&&t.stopPropagation();else if(a=r.call(arguments),X.set(this,e,a),o=n(this,e),this[e](),a!==(i=X.get(this,e))||o?X.set(this,e,!1):i={},a!==i)return t.stopImmediatePropagation(),t.preventDefault(),i.value}else a.length&&(X.set(this,e,{value:w.event.trigger(w.extend(a[0],w.Event.prototype),a.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===X.get(t,e)&&w.event.add(t,e,St)}w.event={global:{},add:function(t,e,n,o,i){var r,a,s,l,c,u,d,h,f,p,m,g=X.get(t);if(g)for(n.handler&&(n=(r=n).handler,i=r.selector),i&&w.find.matchesSelector(it,i),n.guid||(n.guid=w.guid++),(l=g.events)||(l=g.events={}),(a=g.handle)||(a=g.handle=function(e){return void 0!==w&&w.event.triggered!==e.type?w.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(F)||[""]).length;c--;)f=m=(s=Tt.exec(e[c])||[])[1],p=(s[2]||"").split(".").sort(),f&&(d=w.event.special[f]||{},d=w.event.special[f=(i?d.delegateType:d.bindType)||f]||{},u=w.extend({type:f,origType:m,data:o,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:p.join(".")},r),(h=l[f])||((h=l[f]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(t,o,p,a)||t.addEventListener&&t.addEventListener(f,a)),d.add&&(d.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,u):h.push(u),w.event.global[f]=!0)},remove:function(t,e,n,o,i){var r,a,s,l,c,u,d,h,f,p,m,g=X.hasData(t)&&X.get(t);if(g&&(l=g.events)){for(c=(e=(e||"").match(F)||[""]).length;c--;)if(f=m=(s=Tt.exec(e[c])||[])[1],p=(s[2]||"").split(".").sort(),f){for(d=w.event.special[f]||{},h=l[f=(o?d.delegateType:d.bindType)||f]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=r=h.length;r--;)u=h[r],!i&&m!==u.origType||n&&n.guid!==u.guid||s&&!s.test(u.namespace)||o&&o!==u.selector&&("**"!==o||!u.selector)||(h.splice(r,1),u.selector&&h.delegateCount--,d.remove&&d.remove.call(t,u));a&&!h.length&&(d.teardown&&!1!==d.teardown.call(t,p,g.handle)||w.removeEvent(t,f,g.handle),delete l[f])}else for(f in l)w.event.remove(t,f+e[c],n,o,!0);w.isEmptyObject(l)&&X.remove(t,"handle events")}},dispatch:function(t){var e,n,o,i,r,a,s=w.event.fix(t),l=new Array(arguments.length),c=(X.get(this,"events")||{})[s.type]||[],u=w.event.special[s.type]||{};for(l[0]=s,e=1;e\x20\t\r\n\f]*)[^>]*)\/>/gi,Dt=/\s*$/g;function Pt(t,e){return N(t,"table")&&N(11!==e.nodeType?e:e.firstChild,"tr")&&w(t).children("tbody")[0]||t}function Ht(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function Ft(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function Ot(t,e){var n,o,i,r,a,s,l,c;if(1===e.nodeType){if(X.hasData(t)&&(r=X.access(t),a=X.set(e,r),c=r.events))for(i in delete a.handle,a.events={},c)for(n=0,o=c[i].length;n")},clone:function(t,e,n){var o,i,r,a,s,l,c,u=t.cloneNode(!0),d=rt(t);if(!(p.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||w.isXMLDoc(t)))for(a=gt(u),o=0,i=(r=gt(t)).length;o").attr(t.scriptAttrs||{}).prop({charset:t.scriptCharset,src:t.url}).on("load error",n=function(t){e.remove(),n=null,t&&r("error"===t.type?404:200,t.type)}),o.head.appendChild(e[0])},abort:function(){n&&n()}}});var Ke,Ge=[],Qe=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Ge.pop()||w.expando+"_"+Se++;return this[t]=!0,t}}),w.ajaxPrefilter("json jsonp",function(e,n,o){var i,r,a,s=!1!==e.jsonp&&(Qe.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qe.test(e.data)&&"data");if(s||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(Qe,"$1"+i):!1!==e.jsonp&&(e.url+=(Ee.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},e.dataTypes[0]="json",r=t[i],t[i]=function(){a=arguments},o.always(function(){void 0===r?w(t).removeProp(i):t[i]=r,e[i]&&(e.jsonpCallback=n.jsonpCallback,Ge.push(i)),a&&m(r)&&r(a[0]),a=r=void 0}),"script"}),p.createHTMLDocument=((Ke=o.implementation.createHTMLDocument("").body).innerHTML="
",2===Ke.childNodes.length),w.parseHTML=function(t,e,n){return"string"!=typeof t?[]:("boolean"==typeof e&&(n=e,e=!1),e||(p.createHTMLDocument?((i=(e=o.implementation.createHTMLDocument("")).createElement("base")).href=o.location.href,e.head.appendChild(i)):e=o),a=!n&&[],(r=A.exec(t))?[e.createElement(r[1])]:(r=wt([t],e,a),a&&a.length&&w(a).remove(),w.merge([],r.childNodes)));var i,r,a},w.fn.load=function(t,e,n){var o,i,r,a=this,s=t.indexOf(" ");return-1").append(w.parseHTML(t)).find(o):t)}).always(n&&function(t,e){a.each(function(){n.apply(this,r||[t.responseText,e,t])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){w.fn[e]=function(t){return this.on(e,t)}}),w.expr.pseudos.animated=function(t){return w.grep(w.timers,function(e){return t===e.elem}).length},w.offset={setOffset:function(t,e,n){var o,i,r,a,s,l,c=w.css(t,"position"),u=w(t),d={};"static"===c&&(t.style.position="relative"),s=u.offset(),r=w.css(t,"top"),l=w.css(t,"left"),("absolute"===c||"fixed"===c)&&-1<(r+l).indexOf("auto")?(a=(o=u.position()).top,i=o.left):(a=parseFloat(r)||0,i=parseFloat(l)||0),m(e)&&(e=e.call(t,n,w.extend({},s))),null!=e.top&&(d.top=e.top-s.top+a),null!=e.left&&(d.left=e.left-s.left+i),"using"in e?e.using.call(t,d):u.css(d)}},w.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){w.offset.setOffset(this,t,e)});var e,n,o=this[0];return o?o.getClientRects().length?{top:(e=o.getBoundingClientRect()).top+(n=o.ownerDocument.defaultView).pageYOffset,left:e.left+n.pageXOffset}:{top:0,left:0}:void 0},position:function(){if(this[0]){var t,e,n,o=this[0],i={top:0,left:0};if("fixed"===w.css(o,"position"))e=o.getBoundingClientRect();else{for(e=this.offset(),n=o.ownerDocument,t=o.offsetParent||n.documentElement;t&&(t===n.body||t===n.documentElement)&&"static"===w.css(t,"position");)t=t.parentNode;t&&t!==o&&1===t.nodeType&&((i=w(t).offset()).top+=w.css(t,"borderTopWidth",!0),i.left+=w.css(t,"borderLeftWidth",!0))}return{top:e.top-i.top-w.css(o,"marginTop",!0),left:e.left-i.left-w.css(o,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent;t&&"static"===w.css(t,"position");)t=t.offsetParent;return t||it})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var n="pageYOffset"===e;w.fn[t]=function(o){return q(this,function(t,o,i){var r;if(g(t)?r=t:9===t.nodeType&&(r=t.defaultView),void 0===i)return r?r[e]:t[o];r?r.scrollTo(n?r.pageXOffset:i,n?i:r.pageYOffset):t[o]=i},t,o,arguments.length)}}),w.each(["top","left"],function(t,e){w.cssHooks[e]=Wt(p.pixelPosition,function(t,n){if(n)return n=qt(t,e),Bt.test(n)?w(t).position()[e]+"px":n})}),w.each({Height:"height",Width:"width"},function(t,e){w.each({padding:"inner"+t,content:e,"":"outer"+t},function(n,o){w.fn[o]=function(i,r){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===r?"margin":"border");return q(this,function(e,n,i){var r;return g(e)?0===o.indexOf("outer")?e["inner"+t]:e.document.documentElement["client"+t]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+t],r["scroll"+t],e.body["offset"+t],r["offset"+t],r["client"+t])):void 0===i?w.css(e,n,s):w.style(e,n,i,s)},e,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(t,e){w.fn[e]=function(t,n){return 0this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):n==t?this.pause().cycle():this.slide(ndocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},e.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},e.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]}},s.prototype.init=function(e,n,o){if(this.enabled=!0,this.type=e,this.$element=t(n),this.options=this.getOptions(o),this.$viewport=this.options.viewport&&t(document).find(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var i=this.options.trigger.split(" "),r=i.length;r--;){var a=i[r];if("click"==a)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=a){var s="hover"==a?"mouseleave":"focusout";this.$element.on(("hover"==a?"mouseenter":"focusin")+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},s.prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.getOptions=function(n){var o=this.$element.data();for(var i in o)o.hasOwnProperty(i)&&-1!==t.inArray(i,e)&&delete o[i];return(n=t.extend({},this.getDefaults(),o,n)).delay&&"number"==typeof n.delay&&(n.delay={show:n.delay,hide:n.delay}),n.sanitize&&(n.template=a(n.template,n.whiteList,n.sanitizeFn)),n},s.prototype.getDelegateOptions=function(){var e={},n=this.getDefaults();return this._options&&t.each(this._options,function(t,o){n[t]!=o&&(e[t]=o)}),e},s.prototype.enter=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusin"==e.type?"focus":"hover"]=!0),n.tip().hasClass("in")||"in"==n.hoverState)n.hoverState="in";else{if(clearTimeout(n.timeout),n.hoverState="in",!n.options.delay||!n.options.delay.show)return n.show();n.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show)}},s.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},s.prototype.leave=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusout"==e.type?"focus":"hover"]=!1),!n.isInStateTrue()){if(clearTimeout(n.timeout),n.hoverState="out",!n.options.delay||!n.options.delay.hide)return n.hide();n.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide)}},s.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var n=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!n)return;var o=this,i=this.tip(),r=this.getUID(this.type);this.setContent(),i.attr("id",r),this.$element.attr("aria-describedby",r),this.options.animation&&i.addClass("fade");var a="function"==typeof this.options.placement?this.options.placement.call(this,i[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(a);c&&(a=a.replace(l,"")||"top"),i.detach().css({top:0,left:0,display:"block"}).addClass(a).data("bs."+this.type,this),this.options.container?i.appendTo(t(document).find(this.options.container)):i.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var u=this.getPosition(),d=i[0].offsetWidth,h=i[0].offsetHeight;if(c){var f=a,p=this.getPosition(this.$viewport);a="bottom"==a&&u.bottom+h>p.bottom?"top":"top"==a&&u.top-hp.width?"left":"left"==a&&u.left-da.top+a.height&&(i.top=a.top+a.height-l)}else{var c=e.left-r,u=e.left+r+n;ca.right&&(i.left=a.left+a.width-u)}return i},s.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},s.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},s.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},s.prototype.enable=function(){this.enabled=!0},s.prototype.disable=function(){this.enabled=!1},s.prototype.toggleEnabled=function(){this.enabled=!this.enabled},s.prototype.toggle=function(e){var n=this;e&&((n=t(e.currentTarget).data("bs."+this.type))||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n))),e?(n.inState.click=!n.inState.click,n.isInStateTrue()?n.enter(n):n.leave(n)):n.tip().hasClass("in")?n.leave(n):n.enter(n)},s.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},s.prototype.sanitizeHtml=function(t){return a(t,this.options.whiteList,this.options.sanitizeFn)};var l=t.fn.tooltip;t.fn.tooltip=function(e){return this.each(function(){var n=t(this),o=n.data("bs.tooltip"),i="object"==typeof e&&e;!o&&/destroy|hide/.test(e)||(o||n.data("bs.tooltip",o=new s(this,i)),"string"==typeof e&&o[e]())})},t.fn.tooltip.Constructor=s,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=l,this}}(jQuery),function(t){"use strict";var e=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");e.VERSION="3.4.1",e.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),((e.prototype=t.extend({},t.fn.tooltip.Constructor.prototype)).constructor=e).prototype.getDefaults=function(){return e.DEFAULTS},e.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),n=this.getContent();if(this.options.html){var o=typeof n;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(n=this.sanitizeHtml(n))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](n)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(n);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},e.prototype.hasContent=function(){return this.getTitle()||this.getContent()},e.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},e.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var n=t.fn.popover;t.fn.popover=function(n){return this.each(function(){var o=t(this),i=o.data("bs.popover"),r="object"==typeof n&&n;!i&&/destroy|hide/.test(n)||(i||o.data("bs.popover",i=new e(this,r)),"string"==typeof n&&i[n]())})},t.fn.popover.Constructor=e,t.fn.popover.noConflict=function(){return t.fn.popover=n,this}}(jQuery),function(t){"use strict";function e(n,o){this.$body=t(document.body),this.$scrollElement=t(n).is(document.body)?t(window):t(n),this.options=t.extend({},e.DEFAULTS,o),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",t.proxy(this.process,this)),this.refresh(),this.process()}function n(n){return this.each(function(){var o=t(this),i=o.data("bs.scrollspy");i||o.data("bs.scrollspy",i=new e(this,"object"==typeof n&&n)),"string"==typeof n&&i[n]()})}e.VERSION="3.4.1",e.DEFAULTS={offset:10},e.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},e.prototype.refresh=function(){var e=this,n="offset",o=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),t.isWindow(this.$scrollElement[0])||(n="position",o=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var e=t(this),i=e.data("target")||e.attr("href"),r=/^#./.test(i)&&t(i);return r&&r.length&&r.is(":visible")&&[[r[n]().top+o,i]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){e.offsets.push(this[0]),e.targets.push(this[1])})},e.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,n=this.getScrollHeight(),o=this.options.offset+n-this.$scrollElement.height(),i=this.offsets,r=this.targets,a=this.activeTarget;if(this.scrollHeight!=n&&this.refresh(),o<=e)return a!=(t=r[r.length-1])&&this.activate(t);if(a&&e=i[t]&&(void 0===i[t+1]||e .active"),a=i&&t.support.transition&&(r.length&&r.hasClass("fade")||!!o.find("> .fade").length);function s(){r.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),n.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),a?n.addClass("in"):n.removeClass("fade"),n.parent(".dropdown-menu").length&&n.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}r.length&&a?r.one("bsTransitionEnd",s).emulateTransitionEnd(e.TRANSITION_DURATION):s(),r.removeClass("in")};var o=t.fn.tab;t.fn.tab=n,t.fn.tab.Constructor=e,t.fn.tab.noConflict=function(){return t.fn.tab=o,this};var i=function(e){e.preventDefault(),n.call(t(this),"show")};t(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(t){"use strict";var e=function(n,o){this.options=t.extend({},e.DEFAULTS,o);var i=this.options.target===e.DEFAULTS.target?t(this.options.target):t(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(n),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function n(n){return this.each(function(){var o=t(this),i=o.data("bs.affix");i||o.data("bs.affix",i=new e(this,"object"==typeof n&&n)),"string"==typeof n&&i[n]()})}e.VERSION="3.4.1",e.RESET="affix affix-top affix-bottom",e.DEFAULTS={offset:0,target:window},e.prototype.getState=function(t,e,n,o){var i=this.$target.scrollTop(),r=this.$element.offset(),a=this.$target.height();if(null!=n&&"top"==this.affixed)return i0||navigator.msMaxTouchPoints>0,m=u?"DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted":"input",g={isMac:navigator.appVersion.indexOf("Mac")>-1,isMSIE:u,isEdge:h,isFF:!h&&/firefox/i.test(c),isPhantom:/PhantomJS/i.test(c),isWebkit:!h&&/webkit/i.test(c),isChrome:!h&&/chrome/i.test(c),isSafari:!h&&/safari/i.test(c)&&!/chrome/i.test(c),browserVersion:l,jqueryVersion:parseFloat(i.a.fn.jquery),isSupportAmd:r,isSupportTouch:p,hasCodeMirror:f,isFontInstalled:function(t){var e="Comic Sans MS"===t?"Courier New":"Comic Sans MS",n=document.createElement("canvas").getContext("2d");n.font="200px '"+e+"'";var o=n.measureText("mmmmmmmmmmwwwww").width;return n.font="200px "+s(t)+', "'+e+'"',o!==n.measureText("mmmmmmmmmmwwwww").width},isW3CRangeSupport:!!document.createRange,inputEventName:m,genericFontFamilies:a,validFontName:s},v=0,b={eq:function(t){return function(e){return t===e}},eq2:function(t,e){return t===e},peq2:function(t){return function(e,n){return e[t]===n[t]}},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(t,e){return function(n){return t(n)&&e(n)}},invoke:function(t,e){return function(){return t[e].apply(t,arguments)}},resetUniqueId:function(){v=0},uniqueId:function(t){var e=++v+"";return t?t+e:e},rect2bnd:function(t){var e=i()(document);return{top:t.top+e.scrollTop(),left:t.left+e.scrollLeft(),width:t.right-t.left,height:t.bottom-t.top}},invertObject:function(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[t[n]]=n);return e},namespaceToCamel:function(t,e){return(e=e||"")+t.split(".").map(function(t){return t.substring(0,1).toUpperCase()+t.substring(1)}).join("")},debounce:function(t,e,n){var o;return function(){var i=this,r=arguments,a=n&&!o;clearTimeout(o),o=setTimeout(function(){o=null,n||t.apply(i,r)},e),a&&t.apply(i,r)}},isValidUrl:function(t){return/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/gi.test(t)}};function y(t){return t[0]}function k(t){return t[t.length-1]}function w(t){return t.slice(1)}function x(t,e){if(t&&t.length&&e){if(t.indexOf)return-1!==t.indexOf(e);if(t.contains)return t.contains(e)}return!1}var C={head:y,last:k,initial:function(t){return t.slice(0,t.length-1)},tail:w,prev:function(t,e){if(t&&t.length&&e){var n=t.indexOf(e);return-1===n?null:t[n-1]}return null},next:function(t,e){if(t&&t.length&&e){var n=t.indexOf(e);return-1===n?null:t[n+1]}return null},find:function(t,e){for(var n=0,o=t.length;n";function q(t){return $(t)?t.nodeValue.length:t?t.childNodes.length:0}function W(t){var e=q(t);return 0===e||!$(t)&&1===e&&t.innerHTML===U||!(!C.all(t.childNodes,$)||""!==t.innerHTML)}function _(t){N(t)||q(t)||(t.innerHTML=U)}function V(t,e){for(;t;){if(e(t))return t;if(S(t))break;t=t.parentNode}return null}function K(t,e){e=e||b.fail;var n=[];return V(t,function(t){return S(t)||n.push(t),e(t)}),n}function G(t,e){e=e||b.fail;for(var n=[];t&&!e(t);)n.push(t),t=t.nextSibling;return n}function Q(t,e){var n=e.nextSibling,o=e.parentNode;return n?o.insertBefore(t,n):o.appendChild(t),t}function X(t,e){return i.a.each(e,function(e,n){t.appendChild(n)}),t}function Y(t){return 0===t.offset}function Z(t){return t.offset===q(t.node)}function J(t){return Y(t)||Z(t)}function tt(t,e){for(;t&&t!==e;){if(0!==nt(t))return!1;t=t.parentNode}return!0}function et(t,e){if(!e)return!1;for(;t&&t!==e;){if(nt(t)!==q(t.parentNode)-1)return!1;t=t.parentNode}return!0}function nt(t){for(var e=0;t=t.previousSibling;)e+=1;return e}function ot(t){return!!(t&&t.childNodes&&t.childNodes.length)}function it(t,e){var n,o;if(0===t.offset){if(S(t.node))return null;n=t.node.parentNode,o=nt(t.node)}else ot(t.node)?o=q(n=t.node.childNodes[t.offset-1]):(n=t.node,o=e?0:t.offset-1);return{node:n,offset:o}}function rt(t,e){var n,o;if(W(t.node))return null;if(q(t.node)===t.offset){if(S(t.node))return null;n=t.node.parentNode,o=nt(t.node)+1}else if(ot(t.node)){if(o=0,W(n=t.node.childNodes[t.offset]))return null}else if(n=t.node,o=e?q(t.node):t.offset+1,W(n))return null;return{node:n,offset:o}}function at(t,e){return t.node===e.node&&t.offset===e.offset}function st(t,e){var n=e&&e.isSkipPaddingBlankHTML,o=e&&e.isNotSplitEdgePoint,i=e&&e.isDiscardEmptySplits;if(i&&(n=!0),J(t)&&($(t.node)||o)){if(Y(t))return t.node;if(Z(t))return t.node.nextSibling}if($(t.node))return t.node.splitText(t.offset);var r=t.node.childNodes[t.offset],a=Q(t.node.cloneNode(!1),t.node);return X(a,G(r)),n||(_(t.node),_(a)),i&&(W(t.node)&&ut(t.node),W(a))?(ut(a),t.node.nextSibling):a}function lt(t,e,n){var o=K(e.node,b.eq(t));return o.length?1===o.length?st(e,n):o.reduce(function(t,o){return t===e.node&&(t=st(e,n)),st({node:o,offset:t?nt(t):q(o)},n)}):null}function ct(t){return document.createElement(t)}function ut(t,e){if(t&&t.parentNode){if(t.removeNode)return t.removeNode(e);var n=t.parentNode;if(!e){for(var o=[],i=0,r=t.childNodes.length;i".concat(U,"

"),makePredByNodeName:E,isEditable:S,isControlSizing:function(t){return t&&i()(t).hasClass("note-control-sizing")},isText:$,isElement:function(t){return t&&1===t.nodeType},isVoid:N,isPara:A,isPurePara:function(t){return A(t)&&!D(t)},isHeading:function(t){return t&&/^H[1-7]/.test(t.nodeName.toUpperCase())},isInline:P,isBlock:b.not(P),isBodyInline:function(t){return P(t)&&!V(t,A)},isBody:z,isParaInline:function(t){return P(t)&&!!V(t,A)},isPre:I,isList:H,isTable:L,isData:R,isCell:O,isBlockquote:j,isBodyContainer:M,isAnchor:B,isDiv:E("DIV"),isLi:D,isBR:E("BR"),isSpan:E("SPAN"),isB:E("B"),isU:E("U"),isS:E("S"),isI:E("I"),isImg:E("IMG"),isTextarea:dt,deepestChildIsEmpty:function(t){do{if(null===t.firstElementChild||""===t.firstElementChild.innerHTML)break}while(t=t.firstElementChild);return W(t)},isEmpty:W,isEmptyAnchor:b.and(B,W),isClosestSibling:function(t,e){return t.nextSibling===e||t.previousSibling===e},withClosestSiblings:function(t,e){e=e||b.ok;var n=[];return t.previousSibling&&e(t.previousSibling)&&n.push(t.previousSibling),n.push(t),t.nextSibling&&e(t.nextSibling)&&n.push(t.nextSibling),n},nodeLength:q,isLeftEdgePoint:Y,isRightEdgePoint:Z,isEdgePoint:J,isLeftEdgeOf:tt,isRightEdgeOf:et,isLeftEdgePointOf:function(t,e){return Y(t)&&tt(t.node,e)},isRightEdgePointOf:function(t,e){return Z(t)&&et(t.node,e)},prevPoint:it,nextPoint:rt,isSamePoint:at,isVisiblePoint:function(t){if($(t.node)||!ot(t.node)||W(t.node))return!0;var e=t.node.childNodes[t.offset-1],n=t.node.childNodes[t.offset];return!(e&&!N(e)||n&&!N(n))},prevPointUntil:function(t,e){for(;t;){if(e(t))return t;t=it(t)}return null},nextPointUntil:function(t,e){for(;t;){if(e(t))return t;t=rt(t)}return null},isCharPoint:function(t){if(!$(t.node))return!1;var e=t.node.nodeValue.charAt(t.offset-1);return e&&" "!==e&&e!==T},isSpacePoint:function(t){if(!$(t.node))return!1;var e=t.node.nodeValue.charAt(t.offset-1);return" "===e||e===T},walkPoint:function(t,e,n,o){for(var i=t;i&&(n(i),!at(i,e));)i=rt(i,o&&t.node!==i.node&&e.node!==i.node)},ancestor:V,singleChildAncestor:function(t,e){for(t=t.parentNode;t&&1===q(t);){if(e(t))return t;if(S(t))break;t=t.parentNode}return null},listAncestor:K,lastAncestor:function(t,e){var n=K(t);return C.last(n.filter(e))},listNext:G,listPrev:function(t,e){e=e||b.fail;for(var n=[];t&&!e(t);)n.push(t),t=t.previousSibling;return n},listDescendant:function(t,e){var n=[];return e=e||b.ok,function o(i){t!==i&&e(i)&&n.push(i);for(var r=0,a=i.childNodes.length;r-1)return o;return null},wrap:function(t,e){var n=t.parentNode,o=i()("<"+e+">")[0];return n.insertBefore(o,t),o.appendChild(t),o},insertAfter:Q,appendChildNodes:X,position:nt,hasChildren:ot,makeOffsetPath:function(t,e){return K(e,b.eq(t)).map(nt).reverse()},fromOffsetPath:function(t,e){for(var n=t,o=0,i=e.length;o\s]*)(.*?)(\s*\/?>)/g,function(t,e,n){n=n.toUpperCase();var o=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(n)&&!!e,i=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(n);return t+(o||i?"\n":"")})).trim()),n},value:ht,posFromPlaceholder:function(t){var e=i()(t),n=e.offset(),o=e.outerHeight(!0);return{left:n.left,top:n.top+o}},attachEvents:function(t,e){Object.keys(e).forEach(function(n){t.on(n,e[n])})},detachEvents:function(t,e){Object.keys(e).forEach(function(n){t.off(n,e[n])})},isCustomStyleTag:function(t){return t&&!$(t)&&C.contains(t.classList,"note-styletag")}},pt=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$note=e,this.memos={},this.modules={},this.layoutInfo={},this.options=i.a.extend(!0,{},n),i.a.summernote.ui=i.a.summernote.ui_template(this.options),this.ui=i.a.summernote.ui,this.initialize()}var e;return(e=[{key:"initialize",value:function(){return this.layoutInfo=this.ui.createLayout(this.$note),this._initialize(),this.$note.hide(),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(ft.emptyPara),this._destroy(),this._initialize(),t&&this.disable()}},{key:"_initialize",value:function(){var t=this;this.options.id=b.uniqueId(i.a.now()),this.options.container=this.options.container||this.layoutInfo.editor;var e=i.a.extend({},this.options.buttons);Object.keys(e).forEach(function(n){t.memo("button."+n,e[n])});var n=i.a.extend({},this.options.modules,i.a.summernote.plugins||{});Object.keys(n).forEach(function(e){t.module(e,n[e],!0)}),Object.keys(this.modules).forEach(function(e){t.initializeModule(e)})}},{key:"_destroy",value:function(){var t=this;Object.keys(this.modules).reverse().forEach(function(e){t.removeModule(e)}),Object.keys(this.memos).forEach(function(e){t.removeMemo(e)}),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.layoutInfo.codable.val(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=C.head(arguments),e=C.tail(C.from(arguments)),n=this.options.callbacks[b.namespaceToCamel(t,"on")];n&&n.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||b.ok,e.shouldInitialize()&&(e.initialize&&e.initialize(),e.events&&ft.attachEvents(this.$note,e.events))}},{key:"module",value:function(t,e,n){if(1===arguments.length)return this.modules[t];this.modules[t]=new e(this),n||this.initializeModule(t)}},{key:"removeModule",value:function(t){var e=this.modules[t];e.shouldInitialize()&&(e.events&&ft.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(t,e){var n=this;return function(o){n.createInvokeHandler(t,e)(o),n.invoke("buttons.updateCurrentStyle")}}},{key:"createInvokeHandler",value:function(t,e){var n=this;return function(o){o.preventDefault();var r=i()(o.target);n.invoke(t,e||r.closest("[data-value]").data("value"),r)}}},{key:"invoke",value:function(){var t=C.head(arguments),e=C.tail(C.from(arguments)),n=t.split("."),o=n.length>1,i=o&&C.head(n),r=o?C.last(n):C.head(n),a=this.modules[i||"editor"];return!i&&this[r]?this[r].apply(this,e):a&&a[r]&&a.shouldInitialize()?a[r].apply(a,e):void 0}}])&&function(t,e){for(var n=0;n=0)break;o=a[n]}if(0!==n&&ft.isText(a[n-1])){var s=document.body.createTextRange(),l=null;s.moveToElementText(o||i),s.collapse(!o),l=o?o.nextSibling:i.firstChild;var c=t.duplicate();c.setEndPoint("StartToStart",s);for(var u=c.text.replace(/[\r\n]/g,"").length;u>l.nodeValue.length&&l.nextSibling;)u-=l.nodeValue.length,l=l.nextSibling;e&&l.nextSibling&&ft.isText(l.nextSibling)&&u===l.nodeValue.length&&(u-=l.nodeValue.length,l=l.nextSibling),i=l,n=u}return{cont:i,offset:n}}function gt(t){var e=document.body.createTextRange(),n=function t(e,n){var o,i;if(ft.isText(e)){var r=ft.listPrev(e,b.not(ft.isText)),a=C.last(r).previousSibling;o=a||e.parentNode,n+=C.sum(C.tail(r),ft.nodeLength),i=!a}else{if(ft.isText(o=e.childNodes[n]||e))return t(o,0);n=0,i=!1}return{node:o,collapseToStart:i,offset:n}}(t.node,t.offset);return e.moveToElementText(n.node),e.collapse(n.collapseToStart),e.moveStart("character",n.offset),e}i.a.fn.extend({summernote:function(){var t=i.a.type(C.head(arguments)),e="string"===t,n=i.a.extend({},i.a.summernote.options,"object"===t?C.head(arguments):{});n.langInfo=i.a.extend(!0,{},i.a.summernote.lang["en-US"],i.a.summernote.lang[n.lang]),n.icons=i.a.extend(!0,{},i.a.summernote.options.icons,n.icons),n.tooltip="auto"===n.tooltip?!g.isSupportTouch:n.tooltip,this.each(function(t,e){var o=i()(e);if(!o.data("summernote")){var r=new pt(o,n);o.data("summernote",r),o.data("summernote").triggerEvent("init",r.layoutInfo)}});var o=this.first();if(o.length){var r=o.data("summernote");if(e)return r.invoke.apply(r,C.from(arguments));n.focus&&r.invoke("editor.focus")}return this}});var vt=function(){function t(e,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sc=e,this.so=n,this.ec=o,this.eo=i,this.isOnEditable=this.makeIsOn(ft.isEditable),this.isOnList=this.makeIsOn(ft.isList),this.isOnAnchor=this.makeIsOn(ft.isAnchor),this.isOnCell=this.makeIsOn(ft.isCell),this.isOnData=this.makeIsOn(ft.isData)}var e;return(e=[{key:"nativeRange",value:function(){if(g.isW3CRangeSupport){var t=document.createRange();return t.setStart(this.sc,this.sc.data&&this.so>this.sc.data.length?0:this.so),t.setEnd(this.ec,this.sc.data?Math.min(this.eo,this.sc.data.length):this.eo),t}var e=gt({node:this.sc,offset:this.so});return e.setEndPoint("EndToEnd",gt({node:this.ec,offset:this.eo})),e}},{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(g.isW3CRangeSupport){var e=document.getSelection();e.rangeCount>0&&e.removeAllRanges(),e.addRange(t)}else t.select();return this}},{key:"scrollIntoView",value:function(t){var e=i()(t).height();return t.scrollTop+e0?n.so-1:0];if(e){var i=ft.listPrev(e,ft.isParaInline).reverse();if((i=i.concat(ft.listNext(e.nextSibling,ft.isParaInline))).length){var r=ft.wrap(C.head(i),"p");ft.appendChildNodes(r,C.tail(i))}}return this.normalize()}},{key:"insertNode",value:function(t){var e=this;(ft.isText(t)||ft.isInline(t))&&(e=this.wrapBodyInlineWithPara().deleteContents());var n=ft.splitPoint(e.getStartPoint(),ft.isInline(t));return n.rightNode?n.rightNode.parentNode.insertBefore(t,n.rightNode):n.container.appendChild(t),t}},{key:"pasteHTML",value:function(t){t=i.a.trim(t);var e=i()("
").html(t)[0],n=C.from(e.childNodes),o=this;return o.so>=0&&(n=n.reverse()),n=n.map(function(t){return o.insertNode(t)}),o.so>0&&(n=n.reverse()),n}},{key:"toString",value:function(){var t=this.nativeRange();return g.isW3CRangeSupport?t.toString():t.text}},{key:"getWordRange",value:function(e){var n=this.getEndPoint();if(!ft.isCharPoint(n))return this;var o=ft.prevPointUntil(n,function(t){return!ft.isCharPoint(t)});return e&&(n=ft.nextPointUntil(n,function(t){return!ft.isCharPoint(t)})),new t(o.node,o.offset,n.node,n.offset)}},{key:"getWordsRange",value:function(e){var n=this.getEndPoint(),o=function(t){return!ft.isCharPoint(t)&&!ft.isSpacePoint(t)};if(o(n))return this;var i=ft.prevPointUntil(n,o);return e&&(n=ft.nextPointUntil(n,o)),new t(i.node,i.offset,n.node,n.offset)}},{key:"getWordsMatchRange",value:function(e){var n=this.getEndPoint(),o=ft.prevPointUntil(n,function(o){if(!ft.isCharPoint(o)&&!ft.isSpacePoint(o))return!0;var i=new t(o.node,o.offset,n.node,n.offset),r=e.exec(i.toString());return r&&0===r.index}),i=new t(o.node,o.offset,n.node,n.offset),r=i.toString(),a=e.exec(r);return a&&a[0].length===r.length?i:null}},{key:"bookmark",value:function(t){return{s:{path:ft.makeOffsetPath(t,this.sc),offset:this.so},e:{path:ft.makeOffsetPath(t,this.ec),offset:this.eo}}}},{key:"paraBookmark",value:function(t){return{s:{path:C.tail(ft.makeOffsetPath(C.head(t),this.sc)),offset:this.so},e:{path:C.tail(ft.makeOffsetPath(C.last(t),this.ec)),offset:this.eo}}}},{key:"getClientRects",value:function(){return this.nativeRange().getClientRects()}}])&&function(t,e){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];return this.createFromNode(t).collapse(e)},createFromSelection:function(){var t,e,n,o;if(g.isW3CRangeSupport){var i=document.getSelection();if(!i||0===i.rangeCount)return null;if(ft.isBody(i.anchorNode))return null;var r=i.getRangeAt(0);t=r.startContainer,e=r.startOffset,n=r.endContainer,o=r.endOffset}else{var a=document.selection.createRange(),s=a.duplicate();s.collapse(!1);var l=a;l.collapse(!0);var c=mt(l,!0),u=mt(s,!1);ft.isText(c.node)&&ft.isLeftEdgePoint(c)&&ft.isTextNode(u.node)&&ft.isRightEdgePoint(u)&&u.node.nextSibling===c.node&&(c=u),t=c.cont,e=c.offset,n=u.cont,o=u.offset}return new vt(t,e,n,o)},createFromNode:function(t){var e=t,n=0,o=t,i=ft.nodeLength(o);return ft.isVoid(e)&&(n=ft.listPrev(e).length-1,e=e.parentNode),ft.isBR(o)?(i=ft.listPrev(o).length-1,o=o.parentNode):ft.isVoid(o)&&(i=ft.listPrev(o).length,o=o.parentNode),this.create(e,n,o,i)},createFromNodeBefore:function(t){return this.createFromNode(t).collapse(!0)},createFromNodeAfter:function(t){return this.createFromNode(t).collapse()},createFromBookmark:function(t,e){var n=ft.fromOffsetPath(t,e.s.path),o=e.s.offset,i=ft.fromOffsetPath(t,e.e.path);return new vt(n,o,i,e.e.offset)},createFromParaBookmark:function(t,e){var n=t.s.offset,o=t.e.offset,i=ft.fromOffsetPath(C.head(e),t.s.path),r=ft.fromOffsetPath(C.last(e),t.e.path);return new vt(i,n,r,o)}},yt={BACKSPACE:8,TAB:9,ENTER:13,SPACE:32,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40,NUM0:48,NUM1:49,NUM2:50,NUM3:51,NUM4:52,NUM5:53,NUM6:54,NUM7:55,NUM8:56,B:66,E:69,I:73,J:74,K:75,L:76,R:82,S:83,U:85,V:86,Y:89,Z:90,SLASH:191,LEFTBRACKET:219,BACKSLASH:220,RIGHTBRACKET:221,HOME:36,END:35,PAGEUP:33,PAGEDOWN:34},kt={isEdit:function(t){return C.contains([yt.BACKSPACE,yt.TAB,yt.ENTER,yt.SPACE,yt.DELETE],t)},isMove:function(t){return C.contains([yt.LEFT,yt.UP,yt.RIGHT,yt.DOWN],t)},isNavigation:function(t){return C.contains([yt.HOME,yt.END,yt.PAGEUP,yt.PAGEDOWN],t)},nameFromCode:b.invertObject(yt),code:yt},wt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.stack=[],this.stackOffset=-1,this.context=e,this.$editable=e.layoutInfo.editable,this.editable=this.$editable[0]}var e;return(e=[{key:"makeSnapshot",value:function(){var t=bt.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&&bt.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(),this.stackOffset>0&&(this.stackOffset--,this.applySnapshot(this.stack[this.stackOffset]))}},{key:"redo",value:function(){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()),this.stack.length>this.context.options.historyLimit&&(this.stack.shift(),this.stackOffset-=1)}}])&&function(t,e){for(var n=0;n-1;n["list-style"]=o?"unordered":"ordered"}else n["list-style"]="none";var r=ft.ancestor(t.sc,ft.isPara);if(r&&r.style["line-height"])n["line-height"]=r.style.lineHeight;else{var a=parseInt(n["line-height"],10)/parseInt(n["font-size"],10);n["line-height"]=a.toFixed(1)}return n.anchor=t.isOnAnchor()&&ft.ancestor(t.sc,ft.isAnchor),n.ancestors=ft.listAncestor(t.sc,ft.isEditable),n.range=t,n}}])&&function(t,e){for(var n=0;n25?e-25:""})})}),n.select()}},{key:"toggleList",value:function(t,e){var n=this,o=bt.create(e).wrapBodyInlineWithPara(),r=o.nodes(ft.isPara,{includeAncestor:!0}),a=o.paraBookmark(r),s=C.clusterBy(r,b.peq2("parentNode"));if(C.find(r,ft.isPurePara)){var l=[];i.a.each(s,function(e,o){l=l.concat(n.wrapList(o,t))}),r=l}else{var c=o.nodes(ft.isList,{includeAncestor:!0}).filter(function(e){return!i.a.nodeName(e,t)});c.length?i.a.each(c,function(e,n){ft.replace(n,t)}):r=this.releaseList(s,!0)}bt.createFromParaBookmark(a,r).select()}},{key:"wrapList",value:function(t,e){var n=C.head(t),o=C.last(t),i=ft.isList(n.previousSibling)&&n.previousSibling,r=ft.isList(o.nextSibling)&&o.nextSibling,a=i||ft.insertAfter(ft.create(e||"UL"),o);return t=t.map(function(t){return ft.isPurePara(t)?ft.replace(t,"LI"):t}),ft.appendChildNodes(a,t),r&&(ft.appendChildNodes(a,C.from(r.childNodes)),ft.remove(r)),t}},{key:"releaseList",value:function(t,e){var n=this,o=[];return i.a.each(t,function(t,r){var a=C.head(r),s=C.last(r),l=e?ft.lastAncestor(a,ft.isList):a.parentNode,c=l.parentNode;if("LI"===l.parentNode.nodeName)r.map(function(t){var e=n.findNextSiblings(t);c.nextSibling?c.parentNode.insertBefore(t,c.nextSibling):c.parentNode.appendChild(t),e.length&&(n.wrapList(e,l.nodeName),t.appendChild(e[0].parentNode))}),0===l.children.length&&c.removeChild(l),0===c.childNodes.length&&c.parentNode.removeChild(c);else{var u=l.childNodes.length>1?ft.splitTree(l,{node:s.parentNode,offset:ft.position(s)+1},{isSkipPaddingBlankHTML:!0}):null,d=ft.splitTree(l,{node:a.parentNode,offset:ft.position(a)},{isSkipPaddingBlankHTML:!0});r=e?ft.listDescendant(d,ft.isLi):C.from(d.childNodes).filter(ft.isLi),!e&&ft.isList(l.parentNode)||(r=r.map(function(t){return ft.replace(t,"P")})),i.a.each(C.from(r).reverse(),function(t,e){ft.insertAfter(e,l)});var h=C.compact([l,d,u]);i.a.each(h,function(t,e){var n=[e].concat(ft.listDescendant(e,ft.isList));i.a.each(n.reverse(),function(t,e){ft.nodeLength(e)||ft.remove(e,!0)})})}o=o.concat(r)}),o}},{key:"appendToPrevious",value:function(t){return t.previousSibling?ft.appendChildNodes(t.previousSibling,[t]):this.wrapList([t],"LI")}},{key:"findList",value:function(t){return t?C.find(t.children,function(t){return["OL","UL"].indexOf(t.nodeName)>-1}):null}},{key:"findNextSiblings",value:function(t){for(var e=[];t.nextSibling;)e.push(t.nextSibling),t=t.nextSibling;return e}}])&&function(t,e){for(var n=0;n1,i=e.rowSpan>1,a=t.rowIndex===r.rowPos&&e.cellIndex===r.colPos;l(t.rowIndex,n,t,e,i,o,!1);var s=e.attributes.rowSpan?parseInt(e.attributes.rowSpan.value,10):0;if(s>1)for(var c=1;c1)for(var p=1;p=n.cellIndex&&n.cellIndex<=e&&!o&&r.colPos++}function f(e){switch(n){case t.where.Column:if(e.isColSpan)return t.resultAction.SubtractSpanCount;break;case t.where.Row:if(!e.isVirtual&&e.isRowSpan)return t.resultAction.AddCell;if(e.isRowSpan)return t.resultAction.SubtractSpanCount}return t.resultAction.RemoveCell}function p(e){switch(n){case t.where.Column:if(e.isColSpan)return t.resultAction.SumSpanCount;if(e.isRowSpan&&e.isVirtual)return t.resultAction.Ignore;break;case t.where.Row:if(e.isRowSpan)return t.resultAction.SumSpanCount;if(e.isColSpan&&e.isVirtual)return t.resultAction.Ignore}return t.resultAction.AddCell}this.getActionList=function(){for(var e=n===t.where.Row?r.rowPos:-1,i=n===t.where.Column?r.colPos:-1,l=0,u=!0;u;){var d=e>=0?e:l,h=i>=0?i:l,m=a[d];if(!m)return u=!1,s;var g=m[h];if(!g)return u=!1,s;var v=t.resultAction.Ignore;switch(o){case t.requestAction.Add:v=p(g);break;case t.requestAction.Delete:v=f(g)}s.push(c(g,v,d,h)),l++}return s},e&&e.tagName&&("td"===e.tagName.toLowerCase()||"th"===e.tagName.toLowerCase())&&(r.colPos=e.cellIndex,e.parentElement&&e.parentElement.tagName&&"tr"===e.parentElement.tagName.toLowerCase()&&(r.rowPos=e.parentElement.rowIndex)),function(){for(var t=i.rows,e=0;e"),s=new St(n,St.where.Row,St.requestAction.Add,i()(o).closest("table")[0]).getActionList(),l=0;l"+ft.blank+"");break;case St.resultAction.SumSpanCount:if("top"===e&&(c.baseCell.parent?c.baseCell.closest("tr").rowIndex:0)<=o[0].rowIndex){var d=i()("
").append(i()(""+ft.blank+"").removeAttr("rowspan")).html();a.append(d);break}var h=parseInt(c.baseCell.rowSpan,10);c.baseCell.setAttribute("rowSpan",++h)}}if("top"===e)o.before(a);else{if(n.rowSpan>1){var f=o[0].rowIndex+(n.rowSpan-2);return void i()(i()(o).parent().find("tr")[f]).after(i()(a))}o.after(a)}}},{key:"addCol",value:function(t,e){var n=ft.ancestor(t.commonAncestor(),ft.isCell),o=i()(n).closest("tr");i()(o).siblings().push(o);for(var r=new St(n,St.where.Column,St.requestAction.Add,i()(o).closest("table")[0]).getActionList(),a=0;a"+ft.blank+""):i()(s.baseCell).before(""+ft.blank+"");break;case St.resultAction.SumSpanCount:if("right"===e){var c=parseInt(s.baseCell.colSpan,10);s.baseCell.setAttribute("colSpan",++c)}else i()(s.baseCell).before(""+ft.blank+"")}}}},{key:"recoverAttributes",value:function(t){var e="";if(!t)return e;for(var n=t.attributes||[],o=0;o1,d=u?parseInt(l.rowSpan,10):0;switch(a[s].action){case St.resultAction.Ignore:continue;case St.resultAction.AddCell:var h=n.next("tr")[0];if(!h)continue;var f=n[0].cells[o];u&&(d>2?(d--,h.insertBefore(f,h.cells[o]),h.cells[o].setAttribute("rowSpan",d),h.cells[o].innerHTML=""):2===d&&(h.insertBefore(f,h.cells[o]),h.cells[o].removeAttribute("rowSpan"),h.cells[o].innerHTML=""));continue;case St.resultAction.SubtractSpanCount:u&&(d>2?(l.setAttribute("rowSpan",--d),c.rowIndex!==r&&l.cellIndex===o&&(l.innerHTML="")):2===d&&(l.removeAttribute("rowSpan"),c.rowIndex!==r&&l.cellIndex===o&&(l.innerHTML="")));continue;case St.resultAction.RemoveCell:continue}}n.remove()}},{key:"deleteCol",value:function(t){for(var e=ft.ancestor(t.commonAncestor(),ft.isCell),n=i()(e).closest("tr"),o=n.children("td, th").index(i()(e)),r=new St(e,St.where.Column,St.requestAction.Delete,i()(n).closest("table")[0]).getActionList(),a=0;a1){var l=s.colSpan?parseInt(s.colSpan,10):0;l>2?(s.setAttribute("colSpan",--l),s.cellIndex===o&&(s.innerHTML="")):2===l&&(s.removeAttribute("colSpan"),s.cellIndex===o&&(s.innerHTML=""))}continue;case St.resultAction.RemoveCell:ft.remove(r[a].baseCell,!0);continue}}},{key:"createTable",value:function(t,e,n){for(var o,r=[],a=0;a"+ft.blank+"");o=r.join("");for(var s,l=[],c=0;c"+o+"");s=l.join("");var u=i()(""+s+"
");return n&&n.tableClassName&&u.addClass(n.tableClassName),u[0]}},{key:"deleteTable",value:function(t){var e=ft.ancestor(t.commonAncestor(),ft.isCell);i()(e).closest("table").remove()}}])&&function(t,e){for(var n=0;n0&&n.isLimited(l))){var c=s.toString()!==o;"string"==typeof e&&(e=e.trim()),n.options.onCreateLink?e=n.options.onCreateLink(e):a&&(e=/^([A-Za-z][A-Za-z0-9+-.]*\:|#|\/)/.test(e)?e:n.options.defaultProtocol+e);var u=[];if(c){var d=(s=s.deleteContents()).insertNode(i()(""+o+"")[0]);u.push(d)}else u=n.style.styleNodes(s,{nodeName:"A",expandClosestSibling:!0,onlyPartialContains:!0});i.a.each(u,function(t,n){i()(n).attr("href",e),r?i()(n).attr("target","_blank"):i()(n).removeAttr("target")});var h=bt.createFromNodeBefore(C.head(u)).getStartPoint(),f=bt.createFromNodeAfter(C.last(u)).getEndPoint();n.setLastRange(bt.create(h.node,h.offset,f.node,f.offset).select())}}),this.color=this.wrapCommand(function(t){var e=t.foreColor,n=t.backColor;e&&document.execCommand("foreColor",!1,e),n&&document.execCommand("backColor",!1,n)}),this.foreColor=this.wrapCommand(function(t){document.execCommand("foreColor",!1,t)}),this.insertTable=this.wrapCommand(function(t){var e=t.split("x");n.getLastRange().deleteContents().insertNode(n.table.createTable(e[0],e[1],n.options))}),this.removeMedia=this.wrapCommand(function(){var t=i()(n.restoreTarget()).parent();t.closest("figure").length?t.closest("figure").remove():t=i()(n.restoreTarget()).detach(),n.context.triggerEvent("media.delete",t,n.$editable)}),this.floatMe=this.wrapCommand(function(t){var e=i()(n.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=i()(n.restoreTarget());0===(t=parseFloat(t))?e.css("width",""):e.css({width:100*t+"%",height:""})})}var e;return(e=[{key:"initialize",value:function(){var t=this;this.$editable.on("keydown",function(e){if(e.keyCode===kt.code.ENTER&&t.context.triggerEvent("enter",e),t.context.triggerEvent("keydown",e),t.snapshot=t.history.makeSnapshot(),t.hasKeyShortCut=!1,e.isDefaultPrevented()||(t.options.shortcuts?t.hasKeyShortCut=t.handleKeyMap(e):t.preventDefaultEditableShortCuts(e)),t.isLimited(1,e)){var n=t.getLastRange();if(n.eo-n.so==0)return!1}t.setLastRange(),t.options.recordEveryKeystroke&&!1===t.hasKeyShortCut&&t.history.recordUndo()}).on("keyup",function(e){t.setLastRange(),t.context.triggerEvent("keyup",e)}).on("focus",function(e){t.setLastRange(),t.context.triggerEvent("focus",e)}).on("blur",function(e){t.context.triggerEvent("blur",e)}).on("mousedown",function(e){t.context.triggerEvent("mousedown",e)}).on("mouseup",function(e){t.setLastRange(),t.history.recordUndo(),t.context.triggerEvent("mouseup",e)}).on("scroll",function(e){t.context.triggerEvent("scroll",e)}).on("paste",function(e){t.setLastRange(),t.context.triggerEvent("paste",e)}).on("input",function(){t.isLimited(0)&&t.snapshot&&t.history.applySnapshot(t.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(ft.html(this.$note)||ft.emptyPara),this.$editable.on(g.inputEventName,b.debounce(function(){t.context.triggerEvent("change",t.$editable.html(),t.$editable)},10)),this.$editable.on("focusin",function(e){t.context.triggerEvent("focusin",e)}).on("focusout",function(e){t.context.triggerEvent("focusout",e)}),this.options.airMode?this.options.overrideContextMenu&&this.$editor.on("contextmenu",function(e){return t.context.triggerEvent("contextmenu",e),!1}):(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[g.isMac?"mac":"pc"],n=[];t.metaKey&&n.push("CMD"),t.ctrlKey&&!t.altKey&&n.push("CTRL"),t.shiftKey&&n.push("SHIFT");var o=kt.nameFromCode[t.keyCode];o&&n.push(o);var i=e[n.join("+")];if("TAB"!==o||this.options.tabDisable)if(i){if(!1!==this.context.invoke(i))return t.preventDefault(),!0}else kt.isEdit(t.keyCode)&&this.afterCommand();else this.afterCommand();return!1}},{key:"preventDefaultEditableShortCuts",value:function(t){(t.ctrlKey||t.metaKey)&&C.contains([66,73,85],t.keyCode)&&t.preventDefault()}},{key:"isLimited",value:function(t,e){return t=t||0,(void 0===e||!(kt.isMove(e.keyCode)||kt.isNavigation(e.keyCode)||e.ctrlKey||e.metaKey||C.contains([kt.code.BACKSPACE,kt.code.DELETE],e.keyCode)))&&this.options.maxTextLength>0&&this.$editable.text().length+t>this.options.maxTextLength}},{key:"createRange",value:function(){return this.focus(),this.setLastRange(),this.getLastRange()}},{key:"setLastRange",value:function(t){t?this.lastRange=t:(this.lastRange=bt.create(this.editable),0===i()(this.lastRange.sc).closest(".note-editable").length&&(this.lastRange=bt.createFromBodyElement(this.editable)))}},{key:"getLastRange",value:function(){return this.lastRange||this.setLastRange(),this.lastRange}},{key:"saveRange",value:function(t){t&&this.getLastRange().collapse().select()}},{key:"restoreRange",value:function(){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=bt.create();return t&&(t=t.normalize()),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;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:"insertImage",value:function(t,e){var n,o=this;return(n=t,i.a.Deferred(function(t){var e=i()("");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",n)}).promise()).then(function(t){o.beforeCommand(),"function"==typeof e?e(t):("string"==typeof e&&t.attr("data-filename",e),t.css("width",Math.min(o.$editable.width(),t.width()))),t.show(),o.getLastRange().insertNode(t[0]),o.setLastRange(bt.createFromNodeAfter(t[0]).select()),o.afterCommand()}).fail(function(t){o.context.triggerEvent("image.upload.error",t)})}},{key:"insertImagesAsDataURL",value:function(t){var e=this;i.a.each(t,function(t,n){var o=n.name;e.options.maximumImageFileSize&&e.options.maximumImageFileSize":t),e&&e.length&&(e[0].tagName.toUpperCase()!==t.toUpperCase()&&(e=e.find(t)),e&&e.length)){var n=e[0].className||"";if(n){var o=this.createRange();i()([o.sc,o.ec]).closest(t).addClass(n)}}}},{key:"formatPara",value:function(){this.formatBlock("P")}},{key:"fontStyling",value:function(t,e){var n=this.getLastRange();if(""!==n){var o=this.style.styleNodes(n);if(this.$editor.find(".note-status-output").html(""),i()(o).css(t,e),n.isCollapsed()){var r=C.head(o);r&&!ft.nodeLength(r)&&(r.innerHTML=ft.ZERO_WIDTH_NBSP_CHAR,bt.createFromNodeAfter(r.firstChild).select(),this.setLastRange(),this.$editable.data("bogus",r))}}else{var a=i.a.now();this.$editor.find(".note-status-output").html('
'+this.lang.output.noSelection+"
"),setTimeout(function(){i()("#note-status-output-"+a).remove()},5e3)}}},{key:"unlink",value:function(){var t=this.getLastRange();if(t.isOnAnchor()){var e=ft.ancestor(t.sc,ft.isAnchor);(t=bt.createFromNode(e)).select(),this.setLastRange(),this.beforeCommand(),document.execCommand("unlink"),this.afterCommand()}}},{key:"getLinkInfo",value:function(){var t=this.getLastRange().expand(ft.isAnchor),e=i()(C.head(t.nodes(ft.isAnchor))),n={range:t,text:t.toString(),url:e.length?e.attr("href"):""};return e.length&&(n.isNewWindow="_blank"===e.attr("target")),n}},{key:"addRow",value:function(t){var e=this.getLastRange(this.$editable);e.isCollapsed()&&e.isOnCell()&&(this.beforeCommand(),this.table.addRow(e,t),this.afterCommand())}},{key:"addCol",value:function(t){var e=this.getLastRange(this.$editable);e.isCollapsed()&&e.isOnCell()&&(this.beforeCommand(),this.table.addCol(e,t),this.afterCommand())}},{key:"deleteRow",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteRow(t),this.afterCommand())}},{key:"deleteCol",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteCol(t),this.afterCommand())}},{key:"deleteTable",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteTable(t),this.afterCommand())}},{key:"resizeTo",value:function(t,e,n){var o;if(n){var i=t.y/t.x,r=e.data("ratio");o={width:r>i?t.x:t.y/r,height:r>i?t.x*r:t.y}}else o={width:t.x,height:t.y};e.css(o)}},{key:"hasFocus",value:function(){return this.$editable.is(":focus")}},{key:"focus",value:function(){this.hasFocus()||this.$editable.focus()}},{key:"isEmpty",value:function(){return ft.isEmpty(this.$editable[0])||ft.emptyPara===this.$editable.html()}},{key:"empty",value:function(){this.context.invoke("code",ft.emptyPara)}},{key:"normalizeContent",value:function(){this.$editable[0].normalize()}}])&&function(t,e){for(var n=0;n1?n.items[1]:C.head(n.items);"file"===o.kind&&-1!==o.type.indexOf("image/")?(this.context.invoke("editor.insertImagesOrCallback",[o.getAsFile()]),t.preventDefault()):"string"===o.kind&&this.context.invoke("editor.isLimited",n.getData("Text").length)&&t.preventDefault()}else if(window.clipboardData){var i=window.clipboardData.getData("text");this.context.invoke("editor.isLimited",i.length)&&t.preventDefault()}setTimeout(function(){e.context.invoke("editor.afterCommand")},10)}}])&&function(t,e){for(var n=0;n','
',"
"].join("")).prependTo(this.$editor)}var e;return(e=[{key:"initialize",value:function(){this.options.disableDragAndDrop?(this.documentEventHandlers.onDrop=function(t){t.preventDefault()},this.$eventListener=this.$dropzone,this.$eventListener.on("drop",this.documentEventHandlers.onDrop)):this.attachDragAndDropEvent()}},{key:"attachDragAndDropEvent",value:function(){var t=this,e=i()(),n=this.$dropzone.find(".note-dropzone-message");this.documentEventHandlers.onDragenter=function(o){var i=t.context.invoke("codeview.isActivated"),r=t.$editor.width()>0&&t.$editor.height()>0;i||e.length||!r||(t.$editor.addClass("dragover"),t.$dropzone.width(t.$editor.width()),t.$dropzone.height(t.$editor.height()),n.text(t.lang.image.dragImageHere)),e=e.add(o.target)},this.documentEventHandlers.onDragleave=function(n){(e=e.not(n.target)).length&&"BODY"!==n.target.nodeName||(e=i()(),t.$editor.removeClass("dragover"))},this.documentEventHandlers.onDrop=function(){e=i()(),t.$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(){t.$dropzone.addClass("hover"),n.text(t.lang.image.dropImage)}).on("dragleave",function(){t.$dropzone.removeClass("hover"),n.text(t.lang.image.dragImageHere)}),this.$dropzone.on("drop",function(e){var n=e.originalEvent.dataTransfer;e.preventDefault(),n&&n.files&&n.files.length?(t.$editable.focus(),t.context.invoke("editor.insertImagesOrCallback",n.files)):i.a.each(n.types,function(e,o){if(!(o.toLowerCase().indexOf("_moz_")>-1)){var r=n.getData(o);o.toLowerCase().indexOf("text")>-1?t.context.invoke("editor.pasteHTML",r):i()(r).each(function(e,n){t.context.invoke("editor.insertNode",n)})}})}).on("dragover",!1)}},{key:"destroy",value:function(){var t=this;Object.keys(this.documentEventHandlers).forEach(function(e){t.$eventListener.off(e.substr(2).toLowerCase(),t.documentEventHandlers[e])}),this.documentEventHandlers={}}}])&&function(t,e){for(var n=0;n.*?(?:<\/iframe>)?)/gi,function(t){if(/<.+src(?==?('|"|\s)?)[\s\S]+src(?=('|"|\s)?)[^>]*?>/i.test(t))return"";var n=!0,o=!1,i=void 0;try{for(var r,a=e[Symbol.iterator]();!(n=(r=a.next()).done);n=!0)if(new RegExp('src="(https?:)?//'+r.value.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+'/(.+)"').test(t))return t}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return""})}return t}},{key:"activate",value:function(){var t=this;if(this.$codable.val(ft.html(this.$editable,this.options.prettifyHtml)),this.$codable.height(this.$editable.height()),this.context.invoke("toolbar.updateCodeview",!0),this.$editor.addClass("codeview"),this.$codable.focus(),g.hasCodeMirror){var e=Et.fromTextArea(this.$codable[0],this.options.codemirror);if(this.options.codemirror.tern){var n=new Et.TernServer(this.options.codemirror.tern);e.ternServer=n,e.on("cursorActivity",function(t){n.updateArgHints(t)})}e.on("blur",function(n){t.context.triggerEvent("blur.codeview",e.getValue(),n)}),e.on("change",function(){t.context.triggerEvent("change.codeview",e.getValue(),e)}),e.setSize(null,this.$editable.outerHeight()),this.$codable.data("cmEditor",e)}else this.$codable.on("blur",function(e){t.context.triggerEvent("blur.codeview",t.$codable.val(),e)}),this.$codable.on("input",function(){t.context.triggerEvent("change.codeview",t.$codable.val(),t.$codable)})}},{key:"deactivate",value:function(){if(g.hasCodeMirror){var t=this.$codable.data("cmEditor");this.$codable.val(t.getValue()),t.toTextArea()}var e=this.purify(ft.value(this.$codable,this.options.prettifyHtml)||ft.emptyPara),n=this.$editable.html()!==e;this.$editable.html(e),this.$editable.height(this.options.height?this.$codable.height():"auto"),this.$editor.removeClass("codeview"),n&&this.context.triggerEvent("change",this.$editable.html(),this.$editable),this.$editable.focus(),this.context.invoke("toolbar.updateCodeview",!1)}},{key:"destroy",value:function(){this.isActivated()&&this.deactivate()}}])&&function(t,e){for(var n=0;n0?Math.max(o,t.options.minheight):o,o=t.options.maxHeight>0?Math.min(o,t.options.maxHeight):o,t.$editable.height(o)};t.$document.on("mousemove",o).one("mouseup",function(){t.$document.off("mousemove",o)})})}},{key:"destroy",value:function(){this.$statusbar.off(),this.$statusbar.addClass("locked")}}])&&function(t,e){for(var n=0;n','
','
','
','
','
','
',this.options.disableResizeImage?"":'
',"
",""].join("")).prependTo(this.$editingArea),this.$handle.on("mousedown",function(e){if(ft.isControlSizing(e.target)){e.preventDefault(),e.stopPropagation();var n=t.$handle.find(".note-control-selection").data("target"),o=n.offset(),i=t.$document.scrollTop(),r=function(e){t.context.invoke("editor.resizeTo",{x:e.clientX-o.left,y:e.clientY-(o.top-i)},n,!e.shiftKey),t.update(n[0],e)};t.$document.on("mousemove",r).one("mouseup",function(e){e.preventDefault(),t.$document.off("mousemove",r),t.context.invoke("editor.afterCommand")}),n.data("ratio")||n.data("ratio",n.height()/n.width())}}),this.$handle.on("wheel",function(e){e.preventDefault(),t.update()})}},{key:"destroy",value:function(){this.$handle.remove()}},{key:"update",value:function(t,e){if(this.context.isDisabled())return!1;var n=ft.isImg(t),o=this.$handle.find(".note-control-selection");if(this.context.invoke("imagePopover.update",t,e),n){var r=i()(t),a=r.position(),s={left:a.left+parseInt(r.css("marginLeft"),10),top:a.top+parseInt(r.css("marginTop"),10)},l={w:r.outerWidth(!1),h:r.outerHeight(!1)};o.css({display:"block",left:s.left,top:s.top,width:l.w,height:l.h}).data("target",r);var c=new Image;c.src=r.attr("src");var u=l.w+"x"+l.h+" ("+this.lang.image.original+": "+c.width+"x"+c.height+")";o.find(".note-control-selection-info").text(u),this.context.invoke("editor.saveTarget",t)}else this.hide();return n}},{key:"hide",value:function(){this.context.invoke("editor.clearTarget"),this.$handle.children().hide()}}])&&function(t,e){for(var n=0;n").html(o).attr("href",n)[0];this.context.options.linkTargetBlank&&i()(r).attr("target","_blank"),this.lastWordRange.insertNode(r),this.lastWordRange=null,this.context.invoke("editor.focus")}}}},{key:"handleKeydown",value:function(t){if(C.contains([kt.code.ENTER,kt.code.SPACE],t.keyCode)){var e=this.context.invoke("editor.createRange").getWordRange();this.lastWordRange=e}}},{key:"handleKeyup",value:function(t){C.contains([kt.code.ENTER,kt.code.SPACE],t.keyCode)&&this.replace()}}])&&function(t,e){for(var n=0;n'),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)}}])&&function(t,e){for(var n=0;n','
'+this.lang.color.background+"
","
",'","
",'
',"
",'",'',"
",'
',"
"].join(""):"")+(o?['
','
'+this.lang.color.foreground+"
","
",'","
",'
',"
",'",'',"
",'
',"
"].join(""):""),callback:function(t){t.find(".note-holder").each(function(t,e){var n=i()(e);n.append(r.ui.palette({colors:r.options.colors,colorsName:r.options.colorsName,eventName:n.data("event"),container:r.options.container,tooltip:r.options.tooltip}).render())});var e=[["#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"]];t.find(".note-holder-custom").each(function(t,n){var o=i()(n);o.append(r.ui.palette({colors:e,colorsName:e,eventName:o.data("event"),container:r.options.container,tooltip:r.options.tooltip}).render())}),t.find("input[type=color]").each(function(e,n){i()(n).change(function(){var e=t.find("#"+i()(this).data("event")).find(".note-color-btn").first(),n=this.value.toUpperCase();e.css("background-color",n).attr("aria-label",n).attr("data-value",n).attr("data-original-title",n),e.click()})})},click:function(e){e.stopPropagation();var n=i()("."+t).find(".note-dropdown-menu"),o=i()(e.target),a=o.data("event"),s=o.attr("data-value");if("openPalette"===a){var l=n.find("#"+s),c=i()(n.find("#"+l.data("event")).find(".note-color-row")[0]),u=c.find(".note-color-btn").last().detach(),d=l.val();u.css("background-color",d).attr("aria-label",d).attr("data-value",d).attr("data-original-title",d),c.prepend(u),l.click()}else{if(C.contains(["backColor","foreColor"],a)){var h="backColor"===a?"background-color":"color",f=o.closest(".note-color").find(".note-recent-color"),p=o.closest(".note-color").find(".note-current-color-button");f.css(h,s),p.attr("data-"+a,s)}r.context.invoke("editor."+a,s)}}})]}).render()}},{key:"addToolbarButtons",value:function(){var t=this;this.context.memo("button.style",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.magic),t.options),tooltip:t.lang.style.style,data:{toggle:"dropdown"}}),t.ui.dropdown({className:"dropdown-style",items:t.options.styleTags,title:t.lang.style.style,template:function(e){"string"==typeof e&&(e={tag:e,title:Object.prototype.hasOwnProperty.call(t.lang.style,e)?t.lang.style[e]:e});var n=e.tag;return"<"+n+(e.style?' style="'+e.style+'" ':"")+(e.className?' class="'+e.className+'"':"")+">"+e.title+""},click:t.context.createInvokeHandler("editor.formatBlock")})]).render()});for(var e=function(e,n){var o=t.options.styleTags[e];t.context.memo("button.style."+o,function(){return t.button({className:"note-btn-style-"+o,contents:'
'+o.toUpperCase()+"
",tooltip:t.lang.style[o],click:t.context.createInvokeHandler("editor.formatBlock")}).render()})},n=0,o=this.options.styleTags.length;n',t.options),tooltip:t.lang.font.name,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontname",checkClassName:t.options.icons.menuCheck,items:t.options.fontNames.filter(t.isFontInstalled.bind(t)),title:t.lang.font.name,template:function(t){return''+t+""},click:t.context.createInvokeHandlerAndUpdateState("editor.fontName")})]).render()}),this.context.memo("button.fontsize",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents('',t.options),tooltip:t.lang.font.size,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontsize",checkClassName:t.options.icons.menuCheck,items:t.options.fontSizes,title:t.lang.font.size,click:t.context.createInvokeHandlerAndUpdateState("editor.fontSize")})]).render()}),this.context.memo("button.fontsizeunit",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents('',t.options),tooltip:t.lang.font.sizeunit,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontsizeunit",checkClassName:t.options.icons.menuCheck,items:t.options.fontSizeUnits,title:t.lang.font.sizeunit,click:t.context.createInvokeHandlerAndUpdateState("editor.fontSizeUnit")})]).render()}),this.context.memo("button.color",function(){return t.colorPalette("note-color-all",t.lang.color.recent,!0,!0)}),this.context.memo("button.forecolor",function(){return t.colorPalette("note-color-fore",t.lang.color.foreground,!1,!0)}),this.context.memo("button.backcolor",function(){return t.colorPalette("note-color-back",t.lang.color.background,!0,!1)}),this.context.memo("button.ul",function(){return t.button({contents:t.ui.icon(t.options.icons.unorderedlist),tooltip:t.lang.lists.unordered+t.representShortcut("insertUnorderedList"),click:t.context.createInvokeHandler("editor.insertUnorderedList")}).render()}),this.context.memo("button.ol",function(){return t.button({contents:t.ui.icon(t.options.icons.orderedlist),tooltip:t.lang.lists.ordered+t.representShortcut("insertOrderedList"),click:t.context.createInvokeHandler("editor.insertOrderedList")}).render()});var r=this.button({contents:this.ui.icon(this.options.icons.alignLeft),tooltip:this.lang.paragraph.left+this.representShortcut("justifyLeft"),click:this.context.createInvokeHandler("editor.justifyLeft")}),a=this.button({contents:this.ui.icon(this.options.icons.alignCenter),tooltip:this.lang.paragraph.center+this.representShortcut("justifyCenter"),click:this.context.createInvokeHandler("editor.justifyCenter")}),s=this.button({contents:this.ui.icon(this.options.icons.alignRight),tooltip:this.lang.paragraph.right+this.representShortcut("justifyRight"),click:this.context.createInvokeHandler("editor.justifyRight")}),l=this.button({contents:this.ui.icon(this.options.icons.alignJustify),tooltip:this.lang.paragraph.justify+this.representShortcut("justifyFull"),click:this.context.createInvokeHandler("editor.justifyFull")}),c=this.button({contents:this.ui.icon(this.options.icons.outdent),tooltip:this.lang.paragraph.outdent+this.representShortcut("outdent"),click:this.context.createInvokeHandler("editor.outdent")}),u=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",b.invoke(r,"render")),this.context.memo("button.justifyCenter",b.invoke(a,"render")),this.context.memo("button.justifyRight",b.invoke(s,"render")),this.context.memo("button.justifyFull",b.invoke(l,"render")),this.context.memo("button.outdent",b.invoke(c,"render")),this.context.memo("button.indent",b.invoke(u,"render")),this.context.memo("button.paragraph",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.alignLeft),t.options),tooltip:t.lang.paragraph.paragraph,data:{toggle:"dropdown"}}),t.ui.dropdown([t.ui.buttonGroup({className:"note-align",children:[r,a,s,l]}),t.ui.buttonGroup({className:"note-list",children:[c,u]})])]).render()}),this.context.memo("button.height",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.textHeight),t.options),tooltip:t.lang.font.height,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({items:t.options.lineHeights,checkClassName:t.options.icons.menuCheck,className:"dropdown-line-height",title:t.lang.font.height,click:t.context.createInvokeHandler("editor.lineHeight")})]).render()}),this.context.memo("button.table",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.table),t.options),tooltip:t.lang.table.table,data:{toggle:"dropdown"}}),t.ui.dropdown({title:t.lang.table.table,className:"note-table",items:['
','
','
','
',"
",'
1 x 1
'].join("")})],{callback:function(e){e.find(".note-dimension-picker-mousecatcher").css({width:t.options.insertTableMaxSize.col+"em",height:t.options.insertTableMaxSize.row+"em"}).mousedown(t.context.createInvokeHandler("editor.insertTable")).on("mousemove",t.tableMoveHandler.bind(t))}}).render()}),this.context.memo("button.link",function(){return t.button({contents:t.ui.icon(t.options.icons.link),tooltip:t.lang.link.link+t.representShortcut("linkDialog.show"),click:t.context.createInvokeHandler("linkDialog.show")}).render()}),this.context.memo("button.picture",function(){return t.button({contents:t.ui.icon(t.options.icons.picture),tooltip:t.lang.image.image,click:t.context.createInvokeHandler("imageDialog.show")}).render()}),this.context.memo("button.video",function(){return t.button({contents:t.ui.icon(t.options.icons.video),tooltip:t.lang.video.video,click:t.context.createInvokeHandler("videoDialog.show")}).render()}),this.context.memo("button.hr",function(){return t.button({contents:t.ui.icon(t.options.icons.minus),tooltip:t.lang.hr.insert+t.representShortcut("insertHorizontalRule"),click:t.context.createInvokeHandler("editor.insertHorizontalRule")}).render()}),this.context.memo("button.fullscreen",function(){return t.button({className:"btn-fullscreen",contents:t.ui.icon(t.options.icons.arrowsAlt),tooltip:t.lang.options.fullscreen,click:t.context.createInvokeHandler("fullscreen.toggle")}).render()}),this.context.memo("button.codeview",function(){return t.button({className:"btn-codeview",contents:t.ui.icon(t.options.icons.code),tooltip:t.lang.options.codeview,click:t.context.createInvokeHandler("codeview.toggle")}).render()}),this.context.memo("button.redo",function(){return t.button({contents:t.ui.icon(t.options.icons.redo),tooltip:t.lang.history.redo+t.representShortcut("redo"),click:t.context.createInvokeHandler("editor.redo")}).render()}),this.context.memo("button.undo",function(){return t.button({contents:t.ui.icon(t.options.icons.undo),tooltip:t.lang.history.undo+t.representShortcut("undo"),click:t.context.createInvokeHandler("editor.undo")}).render()}),this.context.memo("button.help",function(){return t.button({contents:t.ui.icon(t.options.icons.question),tooltip:t.lang.options.help,click:t.context.createInvokeHandler("helpDialog.show")}).render()})}},{key:"addImagePopoverButtons",value:function(){var t=this;this.context.memo("button.resizeFull",function(){return t.button({contents:'100%',tooltip:t.lang.image.resizeFull,click:t.context.createInvokeHandler("editor.resize","1")}).render()}),this.context.memo("button.resizeHalf",function(){return t.button({contents:'50%',tooltip:t.lang.image.resizeHalf,click:t.context.createInvokeHandler("editor.resize","0.5")}).render()}),this.context.memo("button.resizeQuarter",function(){return t.button({contents:'25%',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 n=0,o=e.length;n3&&c3&&ul&&ac)&&(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(".btn-codeview").not(".btn-fullscreen")),this.ui.toggleBtn(e,!0)}},{key:"deactivate",value:function(t){var e=this.$toolbar.find("button");t||(e=e.not(".btn-codeview").not(".btn-fullscreen")),this.ui.toggleBtn(e,!1)}}])&&function(t,e){for(var n=0;n','"),''),"
",'
','"),''),"
",this.options.disableLinkTarget?"":i()("
").append(this.ui.checkbox({className:"sn-checkbox-open-in-new-window",text:this.lang.link.openInNewWindow,checked:!0}).render()).html(),i()("
").append(this.ui.checkbox({className:"sn-checkbox-use-protocol",text:this.lang.link.useProtocol,checked:!0}).render()).html()].join(""),n='');this.$dialog=this.ui.dialog({className:"link-dialog",title:this.lang.link.insert,fade:this.options.dialogsFade,body:e,footer:n}).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){t.keyCode===kt.code.ENTER&&(t.preventDefault(),e.trigger("click"))})}},{key:"toggleLinkBtn",value:function(t,e,n){this.ui.toggleBtn(t,e.val()&&n.val())}},{key:"showLinkDialog",value:function(t){var e=this;return i.a.Deferred(function(n){var o=e.$dialog.find(".note-link-text"),i=e.$dialog.find(".note-link-url"),r=e.$dialog.find(".note-link-btn"),a=e.$dialog.find(".sn-checkbox-open-in-new-window input[type=checkbox]"),s=e.$dialog.find(".sn-checkbox-use-protocol input[type=checkbox]");e.ui.onDialogShown(e.$dialog,function(){e.context.triggerEvent("dialog.shown"),!t.url&&b.isValidUrl(t.text)&&(t.url=t.text),o.on("input paste propertychange",function(){t.text=o.val(),e.toggleLinkBtn(r,o,i)}).val(t.text),i.on("input paste propertychange",function(){t.text||o.val(i.val()),e.toggleLinkBtn(r,o,i)}).val(t.url),g.isSupportTouch||i.trigger("focus"),e.toggleLinkBtn(r,o,i),e.bindEnterKey(i,r),e.bindEnterKey(o,r),a.prop("checked",void 0!==t.isNewWindow?t.isNewWindow:e.context.options.linkTargetBlank),s.prop("checked",!t.url&&e.context.options.useProtocol),r.one("click",function(r){r.preventDefault(),n.resolve({range:t.range,url:i.val(),text:o.val(),isNewWindow:a.is(":checked"),checkProtocol:s.is(":checked")}),e.ui.hideDialog(e.$dialog)})}),e.ui.onDialogHidden(e.$dialog,function(){o.off(),i.off(),r.off(),"pending"===n.state()&&n.reject()}),e.ui.showDialog(e.$dialog)}).promise()}},{key:"show",value:function(){var t=this,e=this.context.invoke("editor.getLinkInfo");this.context.invoke("editor.saveRange"),this.showLinkDialog(e).then(function(e){t.context.invoke("editor.restoreRange"),t.context.invoke("editor.createLink",e)}).fail(function(){t.context.invoke("editor.restoreRange")})}}])&&function(t,e){for(var n=0;n ')}}).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 e=ft.ancestor(t.sc,ft.isAnchor),n=i()(e).attr("href");this.$popover.find("a").attr("href",n).text(n);var o=ft.posFromPlaceholder(e),r=i()(this.options.container).offset();o.top-=r.top,o.left-=r.left,this.$popover.css({display:"block",left:o.left,top:o.top})}else this.hide()}else this.hide()}},{key:"hide",value:function(){this.$popover.hide()}}])&&function(t,e){for(var n=0;n")}var o=this.options.dialogsInBody?this.$body:this.options.container,i=['
','",'',t,"
",'
','",'',"
"].join(""),r='');this.$dialog=this.ui.dialog({title:this.lang.image.insert,fade:this.options.dialogsFade,body:i,footer:r}).render().appendTo(o)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",function(t){t.keyCode===kt.code.ENTER&&(t.preventDefault(),e.trigger("click"))})}},{key:"show",value:function(){var t=this;this.context.invoke("editor.saveRange"),this.showImageDialog().then(function(e){t.ui.hideDialog(t.$dialog),t.context.invoke("editor.restoreRange"),"string"==typeof e?t.options.callbacks.onImageLinkInsert?t.context.triggerEvent("image.link.insert",e):t.context.invoke("editor.insertImage",e):t.context.invoke("editor.insertImagesOrCallback",e)}).fail(function(){t.context.invoke("editor.restoreRange")})}},{key:"showImageDialog",value:function(){var t=this;return i.a.Deferred(function(e){var n=t.$dialog.find(".note-image-input"),o=t.$dialog.find(".note-image-url"),i=t.$dialog.find(".note-image-btn");t.ui.onDialogShown(t.$dialog,function(){t.context.triggerEvent("dialog.shown"),n.replaceWith(n.clone().on("change",function(t){e.resolve(t.target.files||t.target.value)}).val("")),o.on("input paste propertychange",function(){t.ui.toggleBtn(i,o.val())}).val(""),g.isSupportTouch||o.trigger("focus"),i.click(function(t){t.preventDefault(),e.resolve(o.val())}),t.bindEnterKey(o,i)}),t.ui.onDialogHidden(t.$dialog,function(){n.off(),o.off(),i.off(),"pending"===e.state()&&e.reject()}),t.ui.showDialog(t.$dialog)})}}])&&function(t,e){for(var n=0;n','"),''),"
"].join(""),n='');this.$dialog=this.ui.dialog({title:this.lang.video.insert,fade:this.options.dialogsFade,body:e,footer:n}).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){t.keyCode===kt.code.ENTER&&(t.preventDefault(),e.trigger("click"))})}},{key:"createVideoNode",value:function(t){var e,n=t.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?$/),o=t.match(/(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/),r=t.match(/\/\/vine\.co\/v\/([a-zA-Z0-9]+)/),a=t.match(/\/\/(player\.)?vimeo\.com\/([a-z]*\/)*(\d+)[?]?.*/),s=t.match(/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/),l=t.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),c=t.match(/\/\/v\.qq\.com.*?vid=(.+)/),u=t.match(/\/\/v\.qq\.com\/x?\/?(page|cover).*?\/([^\/]+)\.html\??.*/),d=t.match(/^.+.(mp4|m4v)$/),h=t.match(/^.+.(ogg|ogv)$/),f=t.match(/^.+.(webm)$/),p=t.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/);if(n&&11===n[1].length){var m=n[1],g=0;if(void 0!==n[2]){var v=n[2].match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);if(v)for(var b=[3600,60,1],y=0,k=b.length;y").attr("frameborder",0).attr("src","//www.youtube.com/embed/"+m+(g>0?"?start="+g:"")).attr("width","640").attr("height","360")}else if(o&&o[0].length)e=i()("